2 lines
371 KiB
Plaintext
2 lines
371 KiB
Plaintext
/*! For license information please see 80030.3e6135c4.js.LICENSE.txt */
|
||
(self.webpackChunkdouyin_web=self.webpackChunkdouyin_web||[]).push([["80030"],{198231:function(e,t,n){"use strict";n.d(t,{ko:function(){return a}});var i={2066:function(e,t,n){n.d(t,{v:function(){return N}});var i=Uint8Array,r=Uint16Array,o=Int32Array,s=new i([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),a=new i([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),c=new i([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),d=function(e,t){for(var n=new r(31),i=0;i<31;++i)n[i]=t+=1<<e[i-1];var s=new o(n[30]);for(i=1;i<30;++i)for(var a=n[i];a<n[i+1];++a)s[a]=a-n[i]<<5|i;return{b:n,r:s}},u=d(s,2),l=u.b,v=u.r;l[28]=258,v[258]=28;for(var h=d(a,0),f=h.b,p=(h.r,new r(32768)),g=0;g<32768;++g){var m=(43690&g)>>1|(21845&g)<<1;m=(61680&(m=(52428&m)>>2|(13107&m)<<2))>>4|(3855&m)<<4,p[g]=((65280&m)>>8|(255&m)<<8)>>1}var y=function(e,t,n){for(var i=e.length,o=0,s=new r(t);o<i;++o)e[o]&&++s[e[o]-1];var a,c=new r(t);for(o=1;o<t;++o)c[o]=c[o-1]+s[o-1]<<1;if(n){a=new r(1<<t);var d=15-t;for(o=0;o<i;++o)if(e[o])for(var u=o<<4|e[o],l=t-e[o],v=c[e[o]-1]++<<l,h=v|(1<<l)-1;v<=h;++v)a[p[v]>>d]=u}else for(a=new r(i),o=0;o<i;++o)e[o]&&(a[o]=p[c[e[o]-1]++]>>15-e[o]);return a},x=new i(288);for(g=0;g<144;++g)x[g]=8;for(g=144;g<256;++g)x[g]=9;for(g=256;g<280;++g)x[g]=7;for(g=280;g<288;++g)x[g]=8;var _=new i(32);for(g=0;g<32;++g)_[g]=5;var b=y(x,9,1),I=y(_,5,1),C=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},M=function(e,t,n){var i=t/8|0;return(e[i]|e[i+1]<<8)>>(7&t)&n},k=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(7&t)},S=function(e){return(e+7)/8|0},T=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],w=function(e,t,n){var i=Error(t||T[e]);if(i.code=e,Error.captureStackTrace&&Error.captureStackTrace(i,w),!n)throw i;return i},E=function(e,t,n,r){var o=e.length,d=r?r.length:0;if(!o||t.f&&!t.l)return n||new i(0);var u=!n,v=u||2!=t.i,h=t.i;u&&(n=new i(3*o));var p=function(e){var t=n.length;if(e>t){var r=new i(Math.max(2*t,e));r.set(n),n=r}},g=t.f||0,m=t.p||0,x=t.b||0,_=t.l,T=t.d,E=t.m,R=t.n,U=8*o;do{if(!_){g=M(e,m,1);var A=M(e,m+1,3);if(m+=3,!A){var O=e[(Y=S(m)+4)-4]|e[Y-3]<<8,P=Y+O;if(P>o){h&&w(0);break}v&&p(x+O),n.set(e.subarray(Y,P),x),t.b=x+=O,t.p=m=8*P,t.f=g;continue}if(1==A)_=b,T=I,E=9,R=5;else if(2==A){var D=M(e,m,31)+257,N=M(e,m+10,15)+4,B=D+M(e,m+5,31)+1;m+=14;for(var G=new i(B),L=new i(19),j=0;j<N;++j)L[c[j]]=M(e,m+3*j,7);m+=3*N;var V=C(L),F=(1<<V)-1,W=y(L,V,1);for(j=0;j<B;){var Y,$=W[M(e,m,F)];if(m+=15&$,(Y=$>>4)<16)G[j++]=Y;else{var q=0,H=0;for(16==Y?(H=3+M(e,m,3),m+=2,q=G[j-1]):17==Y?(H=3+M(e,m,7),m+=3):18==Y&&(H=11+M(e,m,127),m+=7);H--;)G[j++]=q}}var z=G.subarray(0,D),K=G.subarray(D);E=C(z),R=C(K),_=y(z,E,1),T=y(K,R,1)}else w(1);if(m>U){h&&w(0);break}}v&&p(x+131072);for(var Z=(1<<E)-1,J=(1<<R)-1,X=m;;X=m){var Q=(q=_[k(e,m)&Z])>>4;if((m+=15&q)>U){h&&w(0);break}if(q||w(2),Q<256)n[x++]=Q;else{if(256==Q){X=m,_=null;break}var ee=Q-254;if(Q>264){var et=s[j=Q-257];ee=M(e,m,(1<<et)-1)+l[j],m+=et}var en=T[k(e,m)&J],ei=en>>4;if(en||w(3),m+=15&en,K=f[ei],ei>3&&(et=a[ei],K+=k(e,m)&(1<<et)-1,m+=et),m>U){h&&w(0);break}v&&p(x+131072);var er=x+ee;if(x<K){var eo=d-K,es=Math.min(K,er);for(eo+x<0&&w(3);x<es;++x)n[x]=r[eo+x]}for(;x<er;++x)n[x]=n[x-K]}}t.l=_,t.p=X,t.b=x,t.f=g,_&&(g=1,t.m=E,t.d=T,t.n=R)}while(!g);return x!=n.length&&u?function(e,t,n){return(null==t||t<0)&&(t=0),(null==n||n>e.length)&&(n=e.length),new i(e.subarray(t,n))}(n,0,x):n.subarray(0,x)},R=new i(0),U="undefined"!=typeof TextDecoder&&new TextDecoder;try{U.decode(R,{stream:!0})}catch(e){}"function"==typeof queueMicrotask?queueMicrotask:"function"==typeof setTimeout&&setTimeout,n(7477),n(2338);var A=[],O=[],P=new Map,D=new Map;function N(e,t,n,i){return A.length||function(){var e=function(e){for(var t,n=atob(e),i=0,r=4;r<8;++r)i+=n.charCodeAt(r);return{d:E(Uint8Array.from(n.slice(8),V,i%256),{i:2},t&&t.out,t&&t.dictionary),i:0}}("UEsCAKslFjnydmpSeEMwGNiHgq0+BX+MkyralH2Yn3zkrxxu8olMmBvZD0KQFvKbd8SvDLEvxqSK7QYjZwRLTTGA67LZUW7uP+YAMVVIBbdBbD5HzkkEJUbkFnnH4ENKYc5VMQebwuycjuRJKbebf7hvtmV4EX5R8ME49qra4C9G53lGfMhEg+f0DgS5b0vsCM2edw13xAcCpXrL0wFEFmrUkGFW0CgT5a0cqHauWJhurOJheX0ZZ1C7B1Q0D1hkjLXv3I6LBEgEVGbvljX4sH3lXDOB18Zt5KZcX8VgmMEajaJDlkfM0mqcF9m7y7Orya735zC5Z1dihIqfofHXU6LGc8D1dWjAdff973FtHK3qYpKM0Tmim6rP5LQp8wKKeD9IkOJMl7CUWqSM4ZH10NL1F/1lNjoAkHrGx7AoFyNhgoyQzfnkwTHL1ziUqmpFCGCYmyqn24Sh9ta7j7XnHCNu2HTYwa7o1PoMZGnMKmLRY+O6tc/1trUnrbn0jr2b1SM59lx+FutIDnefeH5aAApi5BFJ3VdlZW3AVUflJtt6CyxPAat5F+WV9J4TfIMEKbhuEhnGR7l5YoClRe0to+OrvEnelghUyczYzkLNiEHjoblXel2/U30fwHlA7SFsHwbroPBLZnYRrKroWIss033AUxexelZ/h16itJWh82ToK34NULvSYvOx2h0YwbBHblWXp6WE2lDT/e9YhmVcmFmGxlhTZ5YxZd0bkelIBJ3a3nJosFMSNK8DElW2PnkBmC/vhk6JhTRqfZZDppQlad7LzK0/C72cWwqU6MGYsBzSKirZxROlJKcjB6pGFu4LToUuTzOXtaVaY39i/bRGzCKAUHHbyiB0Nx4awAB1AHQVwtFSdQT0SfsdhoHH5B0o3M8l5AhZ0Sq+qJY3kt/ocwK99glrIxLxGUx76ICCWFcIQYvNjmUw/HLb5k+Fj3X9gd8TOQBLeLNSUNuhu5zfRVXW50VMA81YFkyi3q8sfhXCyfb9QJHmtsUpb/1Tg7gvZ8L+xoHG79gYcM6DlZne6Av1WNWC6UzthVMjjzk75f6wFE2ZxRQyloy5CfeiUrBqSeNezCe63jRoPGiYTsgmzYG+y7SYuiQKubTrZyczMUki6tdEYerCLnvlLGA65u98Rp0y6DQvBudNEuXqaYTWeKNxAqjEu+gKR47NMU4tzVwgmHuoSk8JoLOT4wSL7aS629ShYKdV7LaG+nD/u/OKRZDYlXo8jCmNq0ar3pLZ78xVJIHszhcHnX9A8ENBpfQ+4mIVe8G8rU4h7P4f8hfM5OAszegkfAJID8z0nPpuJkaSaMa1+szODtnN3BtBOCZ8NZxxfpWAngWGD28L76wB5Lkv8SBmW0G5OOQywPjGnkRFCjK0GG6VAGHgHwqzcxZQ1W//S+mKGBnZTzLwc+hOd1ANRXR0go/GbpZtFwHQ/Xj2hmhJwZ1hf8lgpDABRdQe4ibLSAAkDkx4N+ACELQFdrW+fa4Sc5/CO+blblGLMK2Duu0Igd3x9HDuiR9okOgDvIkck090r1emU7T2rhUE/JkGs8FoGPobj7tDfx6FRoAniUr6ij0fU0xKx4c1weiiQfdfDiSopVAzM2M3WumSoTgMklNPPFvDHV3gx6rjqBhw4Jlk2ZtltZJCurMTepp72X0rClSz7hfso1I63mF0OEHbzk2s0eRpydxJ6Eoqp7EVSDtzCVmiWqi9EZQ4Vafb3To7v2NjR7dLCpjNqF2GJpHMKJfFqgtHjIbO5mqZIxkBTqFiVtd+68P/ACNpG/xCsjaYF3VxbgwtTicohQqQ7IzhDoynXIGVrPI8ZZv8G0KA0+ndmFUnrk+/MQRHIZRg2ARfGx+0EXxqHuG67sWNE+Yjl9lJgUcgO5vUUYd5AH2GQcfsIaB8D5N9gQ4y9tVe8STnQgIIM40ohVaw+kBXPc8L5cUTKCMvFxMuz5pGo+ckHpxcrTXW0rU48mr3darX3HP7M5ALf/oioCXOqWg+JYsOWuNxmDD8Zilio7vE2yW+myl5bfYkTCh4MDE0xI70MtIagaNSlBw6eeC1hLt1sbpZAIwXTXK+gSD9OiwRRgniOGP5Cc15n/TiEEba4yJOQi4N6o//BUg03HfXKm8XK0EPHxKo7BnaRrPMG+1Tb5g1Gkib24qR4iJUvxhg51ZLRCoZv5wVqSpwtpG6bTViz4X9EfMzektRa0HuCIEu+n+mqsF/of6jFFlJNFjQGdhRKx9GhZ/VxRLRRYOMgeoKzK67GESgd6WGsrwh8IWrFokshS4nqEqLngndkCloYIIVH1DfUPT8r3JKzgx5NqHZJjy58R2TX/cqXrv4Hdk2hjxB/PnW/hlHSuCRdOsDJu/URrX4a1xs2E+ep25GlT0w8ZKHwpbuu0gbc80aWFc+J6erzJSC3AtC7wfCVw+OCwt+w31Xx8SumAWHlBBxiRW3V9x9OEqTmW5NzbHT3qutxAhZWz3U1mKMe0wz0aQIVhJz2/ObqhSCSGQ8nhSMCnGupZdChuhdIljCeCbQ/haWFxkQWRLMmNzD/1IjANkL5VjWM1ThCy2lFQCm22FSvTLVMakrasWg1JVHSiCg8xO+syiWFM6qbNRnRXgXcwIqPn9SIzf4bkPrWZ3BE+2FPhBiWvBVxsO0rnO4bxjKKF2iVuTxqi/Ub9XCrDVndf3QVOz29piaYiTMHaqIDGUChyOAxhYB0xCrMYQ1Mo5ontoDPBznmSQ1mYvVxpoI2CczfGMtlyTVyRnOcDDzjlU55AAD9tA/KKs93wcsg9AxX3ezq7aL4Y6IObgbftw2Q1onciPPW2agPdUB+76TXWrrhF2Hwm9O9w5LC8K8Js0Oqi5aA05g9fbDZVNURoCw/nzfJSr7jh99gEt25kKz65JrYRxR/WxWeoTY21DfdYfnurK44jJX5UNxMx2w0c8+LmrimsbQJ2fb2+cdUoOBJjskT+cVSYIxfI6bkjrLRWmcLFX2rS3WhhSThHkZYWi78noAVv6SsqO3aQ+y4J3Rs4OmfBMNgFAYEurHwO+CoguPkORLIRi2k7QRWOeBpc04yEuAu2kHVLCCsCTtpVlICKjDZ3i9a/octJusH7kIBszKIRxIVCqKZ3pmnAnQSzWQk+2YcQ8+CDBn/FDBtr6svK6lItIVteseUuAHpvoVmDJnDXyaP5Zy0l2HFv4SMaCUJE/gzw1QqB3ltYd8+AU9ckpPnKNcWYW5cisccZAo0Y8gqkKMtCu4HkaZ5o72J2enOydLu5AvzDfeV4zSVt8iwZ4M8kCT8kn0YAWLyzAMwGUdmbf8PvAh8CzFuCssLOrOsBMxrS/NwgeYjkqFMAygI2g2reQoi1SHCtEo32UzdgtKBZPwp/YFtkq7Iz/ANHIReJVtmoCTF95ilNVvMzEKAoKwejkPigJCR/07eewkCt9g1mwcKcSnEiiK06mCvtH8exMDjKHHyDg=");A.length=0,O.length=0,P.clear();for(var t=L(e),n=0;n<t;++n)A.push(j(e));var i=L(e);for(n=0;n<i;++n){for(var r=L(e),o=!!L(e),s=[],a=L(e),c=0;c<a;++c)s.push([L(e),L(e),L(e),L(e)]);for(var d=[],u=L(e),l=0;l<u;++l)d.push(L(e));O.push([d,r,o,s])}}(),G(O[e],t,n,i)}function B(e,t){var n=O[e];D.has(e)&&P.delete(D.get(e));var i=function(){return G(n,this,arguments,t)};return D.set(e,i),P.set(i,[n,t]),i}function G(e,t,n,i){var r,o,s,a,c,d,u,l,v=-1,h=[],f=[];p(e,t,n,i);do try{g()}catch(e){u=3,l=e}while(m());return l;function p(e,t,n,i){var v=Math.min(n.length,e[1]),h={};Object.defineProperty(h,"length",{value:n.length,writable:!0,enumerable:!1,configurable:!0}),r=e[0],o=e[2],s=e[3],a=[i,h];for(var f=0;f<v;++f)a.push(n[f]);if(o)for(c=t,f=0;f<n.length;++f)h[f]=n[f];else{c=null==t?globalThis:Object(t);var p=function(e){e<v?Object.defineProperty(h,e,{get:function(){return a[e+2]},set:function(t){a[e+2]=t},enumerable:!0,configurable:!0}):h[e]=n[e]};for(f=0;f<n.length;++f)p(f)}d=0,u=0,l=void 0}function g(){for(;;){var e=r[d++];if(e<38){if(e<19){if(e<9){if(e<4){if(e<2){if(0===e){var t=r[d++];h[v]=h[v][A[t]]}else{var n=h[v--];h[v]=h[v]>n}}else if(2===e)h[++v]=void 0;else{var i=h[v--];h[v]-=i}}else if(e<6){if(4===e){var g=r[d++];h[v]?--v:d+=g}else{var m=h[v--];i=(M=h[v--])[m]--,h[++v]=i}}else if(e<7)h[++v]=NaN;else if(7===e)n=h[v--],h[v]=h[v]>=n;else{i=h[v--];var x=h[v--];(M=h[v--])[x]=i}}else if(e<14){if(e<11){if(9===e){var _=A[t=r[d++]];i=typeof globalThis[_],h[++v]=i}else{var b=r[d++];h[v=v-b+1]=h.slice(v,v+b)}}else if(e<12){var I=A[t=r[d++]];globalThis[I]||(globalThis[I]=void 0)}else 12===e?(n=h[v--],h[v]=h[v]<n):(g=r[d++],h[v]?d+=g:--v)}else if(e<16)14===e?h[++v]=!0:h[v]=!h[v];else{if(e<17)return u=2,void(l=h[v--]);if(17===e)h[v]=+h[v];else{t=r[d++],i=h[v--];var C=A[t];if(o&&!globalThis[C])return u=3,void(l=ReferenceError(C+" is not defined"));globalThis[C]=i}}}else if(e<28){if(e<23){if(e<21)19===e?(g=r[d++],d+=g):(n=h[v--],h[v]=h[v]^n);else if(21===e){if(0!==u)return}else i=h[v--],h[v]*=i}else if(e<25)23===e?(n=h[v--],h[v]=h[v]>>n):(n=h[v--],h[v]=h[v]<=n);else if(e<26){t=r[d++];var M=h[v--],k=[];for(var S in M)k.push(S);a[t]=[k,M]}else if(26===e)h[++v]=!1;else{var T=h[v--];h[v]=h[v][T]}}else if(e<33){if(e<30){if(28===e){var w=r[d++];for(t=r[d++],g=a;w>0;)g=g[0],--w;g[t]=h[v--]}else g=r[d++],h[v--]||(d+=g)}else e<31?(n=h[v--],h[v]=h[v]|n):31===e?(i=h[v--],h[v]+=i):h[v]=typeof h[v]}else if(e<35)33===e?h[v]=~h[v]:(i=h[v--],h[v]/=i);else{if(e<36)return u=3,void(l=h[v--]);if(36===e){var E=r[d++];v-=E;var R=h.slice(v+1,v+E+1),U=h[v--],O=h[v--];if("function"!=typeof U)return u=3,void(l=TypeError(typeof U+" is not a function"));var D=P.get(U);if(D)f.push([r,o,s,a,c,d,u,l]),p(D[0],O,R,D[1]);else{var N=U.apply(O,R);h[++v]=N}}else{t=r[d++];var G=h[v--],L=h[v--];k=a[t],S=void 0;do S=k[0].shift();while(void 0!==S&&!(S in k[1]));void 0!==S?(L[G]=S,h[++v]=!0):h[++v]=!1}}}else if(e<57){if(e<47){if(e<42){if(e<40)38===e?(t=r[d++],i=h[v--],(M=h[v--])[A[t]]=i):(M=h[v--],h[v]=h[v]in M);else if(40===e){for(w=r[d++],t=r[d++],g=a;w>0;)g=g[0],--w;i=g[t],h[++v]=i}else n=h[v--],h[v]=h[v]>>>n}else if(e<44)42===e?h[++v]=null:(n=h[v--],h[v]=h[v]!==n);else if(e<45)h[++v]=1/0;else if(45===e){t=r[d++];var j=h[v--];Object.defineProperty(h[v],A[t],{set:j,enumerable:!0,configurable:!0})}else{var V=h[v--];i=delete(M=h[v--])[V],h[++v]=i}}else if(e<52){if(e<49){if(47===e)t=r[d++],h[++v]=+A[t];else{var F=h[v--];i=++(M=h[v--])[F],h[++v]=i}}else e<50?(g=r[d++],i=h[v--],h[v]===i&&(--v,d+=g)):50===e?(t=r[d++],h[++v]=A[t]):(t=r[d++],i=h[v--],Object.defineProperty(h[v],A[t],{value:i,writable:!0,configurable:!0,enumerable:!0}))}else if(e<54)52===e?(n=h[v--],h[v]=h[v]!=n):(i=h[v],h[++v]=i);else if(e<55)M=h[v--],h[v]=h[v]instanceof M;else if(55===e)h[++v]=c;else{var W=A[t=r[d++]];if(!globalThis[W])return u=3,void(l=ReferenceError(W+" is not defined"));i=globalThis[W],h[++v]=i}}else if(e<67){if(e<62){if(e<59){if(57===e){E=r[d++];for(var Y=[void 0];E>0;)Y[E--]=h[v--];var $=h[v--];N=new(Function.bind.apply($,Y)),h[++v]=N}else n=h[v--],h[v]=h[v]==n}else if(e<60)n=h[v--],h[v]=h[v]===n;else if(60===e){for(w=r[d++],t=r[d++],g=a;w>0;)g=g[0],--w;h[++v]=g,h[++v]=t}else n=h[v--],h[v]=h[v]<<n}else if(e<64){if(62===e)--v;else{var q=h[v--];i=(M=h[v--])[q]++,h[++v]=i}}else if(e<65)i=h[v--],h[v]%=i;else if(65===e)h[v]=void 0;else{var H=h[v--];(M=h[v--])[H]=h[v]}}else if(e<72){if(e<69){if(67===e)h[++v]=r[d++];else{var z=h[v--];i=--(M=h[v--])[z],h[++v]=i}}else{if(e<70)return g=r[d++],u=1,void(l=d+g);if(70===e){t=r[d++];var K=h[v--];Object.defineProperty(h[v],A[t],{get:K,enumerable:!0,configurable:!0})}else h[++v]={}}}else if(e<74)72===e?(n=h[v--],h[v]=h[v]&n):(i=B(r[d++],a),h[++v]=i);else if(e<75){var Z=A[t=r[d++]];i=y(Z,o),h[++v]=i,h[++v]=Z}else 75===e?h[v]=-h[v]:(g=r[d++],h[v--]&&(d+=g))}}function m(){var e,t,n=d,i=s;if(1===u){for(var p=i.length-1;p>=0;--p)if((e=i[p])[0]<n&&n<=e[3])return n<=e[2]&&e[2]!==e[3]?d=e[2]:(d=l,u=0,l=void 0),!0;throw SyntaxError("Illegal statement")}if(2===u){for(p=i.length-1;p>=0;--p)if((e=i[p])[0]<n&&n<=e[2]&&e[2]!==e[3])return d=e[2],!0;return!!(t=f.pop())&&(h[++v]=l,r=t[0],o=t[1],s=t[2],a=t[3],c=t[4],d=t[5],u=t[6],l=t[7],!0)}if(3===u){for(p=i.length-1;p>=0;--p)if((e=i[p])[0]<n){if(n<=e[1]&&e[1]!==e[2])return d=e[1],h[++v]=l,u=0,l=void 0,!0;if(n<=e[2]&&e[2]!==e[3])return d=e[2],!0}if(t=f.pop())return r=t[0],o=t[1],s=t[2],a=t[3],c=t[4],d=t[5],m();throw l}return!0}function y(e,t){var n=Object.create(null);return Object.defineProperty(n,e,{get:function(){if(globalThis[e])return globalThis[e];throw ReferenceError(e+" is not defined")},set:function(n){if(t&&!globalThis[e])throw ReferenceError(e+" is not defined");globalThis[e]=n}}),n}}function L(e){for(var t=0,n=0;;){var i=e.d[e.i++];if(t|=(127&i)<<n,n+=7,!(128&i))return n<32&&64&i?t|-1<<n:t}}function j(e){for(var t=-1,n=[];;){var i=e.d[e.i++];if(i>=128&&i<192)t=(t<<6)+(63&i);else if(t>=0&&n.push(t),i<128)t=i;else if(i<224)t=31&i;else if(i<240)t=15&i;else{if(!(i<248))break;t=7&i}}return String.fromCodePoint.apply(null,n)}function V(e,t){return(e.charCodeAt(0)^(this+this%10*t)%256)>>>0}},5503:function(e){e.exports=function(){var e=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function t(e,t){var n=e[0],i=e[1],r=e[2],o=e[3];i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&r|~i&o)+t[0]-680876936|0)<<7|n>>>25)+i|0)&i|~n&r)+t[1]-389564586|0)<<12|o>>>20)+n|0)&n|~o&i)+t[2]+606105819|0)<<17|r>>>15)+o|0)&o|~r&n)+t[3]-1044525330|0)<<22|i>>>10)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&r|~i&o)+t[4]-176418897|0)<<7|n>>>25)+i|0)&i|~n&r)+t[5]+1200080426|0)<<12|o>>>20)+n|0)&n|~o&i)+t[6]-1473231341|0)<<17|r>>>15)+o|0)&o|~r&n)+t[7]-45705983|0)<<22|i>>>10)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&r|~i&o)+t[8]+1770035416|0)<<7|n>>>25)+i|0)&i|~n&r)+t[9]-1958414417|0)<<12|o>>>20)+n|0)&n|~o&i)+t[10]-42063|0)<<17|r>>>15)+o|0)&o|~r&n)+t[11]-1990404162|0)<<22|i>>>10)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&r|~i&o)+t[12]+1804603682|0)<<7|n>>>25)+i|0)&i|~n&r)+t[13]-40341101|0)<<12|o>>>20)+n|0)&n|~o&i)+t[14]-1502002290|0)<<17|r>>>15)+o|0)&o|~r&n)+t[15]+1236535329|0)<<22|i>>>10)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&o|r&~o)+t[1]-165796510|0)<<5|n>>>27)+i|0)&r|i&~r)+t[6]-1069501632|0)<<9|o>>>23)+n|0)&i|n&~i)+t[11]+643717713|0)<<14|r>>>18)+o|0)&n|o&~n)+t[0]-373897302|0)<<20|i>>>12)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&o|r&~o)+t[5]-701558691|0)<<5|n>>>27)+i|0)&r|i&~r)+t[10]+38016083|0)<<9|o>>>23)+n|0)&i|n&~i)+t[15]-660478335|0)<<14|r>>>18)+o|0)&n|o&~n)+t[4]-405537848|0)<<20|i>>>12)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&o|r&~o)+t[9]+568446438|0)<<5|n>>>27)+i|0)&r|i&~r)+t[14]-1019803690|0)<<9|o>>>23)+n|0)&i|n&~i)+t[3]-187363961|0)<<14|r>>>18)+o|0)&n|o&~n)+t[8]+1163531501|0)<<20|i>>>12)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i&o|r&~o)+t[13]-1444681467|0)<<5|n>>>27)+i|0)&r|i&~r)+t[2]-51403784|0)<<9|o>>>23)+n|0)&i|n&~i)+t[7]+1735328473|0)<<14|r>>>18)+o|0)&n|o&~n)+t[12]-1926607734|0)<<20|i>>>12)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i^r^o)+t[5]-378558|0)<<4|n>>>28)+i|0)^i^r)+t[8]-2022574463|0)<<11|o>>>21)+n|0)^n^i)+t[11]+1839030562|0)<<16|r>>>16)+o|0)^o^n)+t[14]-35309556|0)<<23|i>>>9)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i^r^o)+t[1]-1530992060|0)<<4|n>>>28)+i|0)^i^r)+t[4]+1272893353|0)<<11|o>>>21)+n|0)^n^i)+t[7]-155497632|0)<<16|r>>>16)+o|0)^o^n)+t[10]-1094730640|0)<<23|i>>>9)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i^r^o)+t[13]+681279174|0)<<4|n>>>28)+i|0)^i^r)+t[0]-358537222|0)<<11|o>>>21)+n|0)^n^i)+t[3]-722521979|0)<<16|r>>>16)+o|0)^o^n)+t[6]+76029189|0)<<23|i>>>9)+r|0,i=((i+=((r=((r+=((o=((o+=((n=((n+=(i^r^o)+t[9]-640364487|0)<<4|n>>>28)+i|0)^i^r)+t[12]-421815835|0)<<11|o>>>21)+n|0)^n^i)+t[15]+530742520|0)<<16|r>>>16)+o|0)^o^n)+t[2]-995338651|0)<<23|i>>>9)+r|0,i=((i+=((o=((o+=(i^((n=((n+=(r^(i|~o))+t[0]-198630844|0)<<6|n>>>26)+i|0)|~r))+t[7]+1126891415|0)<<10|o>>>22)+n|0)^((r=((r+=(n^(o|~i))+t[14]-1416354905|0)<<15|r>>>17)+o|0)|~n))+t[5]-57434055|0)<<21|i>>>11)+r|0,i=((i+=((o=((o+=(i^((n=((n+=(r^(i|~o))+t[12]+1700485571|0)<<6|n>>>26)+i|0)|~r))+t[3]-1894986606|0)<<10|o>>>22)+n|0)^((r=((r+=(n^(o|~i))+t[10]-1051523|0)<<15|r>>>17)+o|0)|~n))+t[1]-2054922799|0)<<21|i>>>11)+r|0,i=((i+=((o=((o+=(i^((n=((n+=(r^(i|~o))+t[8]+1873313359|0)<<6|n>>>26)+i|0)|~r))+t[15]-30611744|0)<<10|o>>>22)+n|0)^((r=((r+=(n^(o|~i))+t[6]-1560198380|0)<<15|r>>>17)+o|0)|~n))+t[13]+1309151649|0)<<21|i>>>11)+r|0,i=((i+=((o=((o+=(i^((n=((n+=(r^(i|~o))+t[4]-145523070|0)<<6|n>>>26)+i|0)|~r))+t[11]-1120210379|0)<<10|o>>>22)+n|0)^((r=((r+=(n^(o|~i))+t[2]+718787259|0)<<15|r>>>17)+o|0)|~n))+t[9]-343485551|0)<<21|i>>>11)+r|0,e[0]=n+e[0]|0,e[1]=i+e[1]|0,e[2]=r+e[2]|0,e[3]=o+e[3]|0}function n(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e.charCodeAt(t)+(e.charCodeAt(t+1)<<8)+(e.charCodeAt(t+2)<<16)+(e.charCodeAt(t+3)<<24);return n}function i(e){var t,n=[];for(t=0;t<64;t+=4)n[t>>2]=e[t]+(e[t+1]<<8)+(e[t+2]<<16)+(e[t+3]<<24);return n}function r(e){var i,r,o,s,a,c,d=e.length,u=[1732584193,-271733879,-1732584194,271733878];for(i=64;i<=d;i+=64)t(u,n(e.substring(i-64,i)));for(r=(e=e.substring(i-64)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=0;i<r;i+=1)o[i>>2]|=e.charCodeAt(i)<<(i%4<<3);if(o[i>>2]|=128<<(i%4<<3),i>55)for(t(u,o),i=0;i<16;i+=1)o[i]=0;return a=parseInt((s=(s=8*d).toString(16).match(/(.*?)(.{0,8})$/))[2],16),c=parseInt(s[1],16)||0,o[14]=a,o[15]=c,t(u,o),u}function o(t){var n,i="";for(n=0;n<4;n+=1)i+=e[t>>8*n+4&15]+e[t>>8*n&15];return i}function s(e){var t;for(t=0;t<e.length;t+=1)e[t]=o(e[t]);return e.join("")}function a(e){return/[\u0080-\uFFFF]/.test(e)&&(e=unescape(encodeURIComponent(e))),e}function c(e){var t,n=[],i=e.length;for(t=0;t<i-1;t+=2)n.push(parseInt(e.substr(t,2),16));return String.fromCharCode.apply(String,n)}function d(){this.reset()}return s(r("hello")),"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||function(){function e(e,t){return(e=0|e||0)<0?Math.max(e+t,0):Math.min(e,t)}ArrayBuffer.prototype.slice=function(t,n){var i,r,o,s,a=this.byteLength,c=e(t,a),d=a;return void 0!==n&&(d=e(n,a)),c>d?new ArrayBuffer(0):(o=new Uint8Array(r=new ArrayBuffer(i=d-c)),s=new Uint8Array(this,c,i),o.set(s),r)}}(),d.prototype.append=function(e){return this.appendBinary(a(e)),this},d.prototype.appendBinary=function(e){this._buff+=e,this._length+=e.length;var i,r=this._buff.length;for(i=64;i<=r;i+=64)t(this._hash,n(this._buff.substring(i-64,i)));return this._buff=this._buff.substring(i-64),this},d.prototype.end=function(e){var t,n,i=this._buff,r=i.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<r;t+=1)o[t>>2]|=i.charCodeAt(t)<<(t%4<<3);return this._finish(o,r),n=s(this._hash),e&&(n=c(n)),this.reset(),n},d.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},d.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},d.prototype.setState=function(e){return this._buff=e.buff,this._length=e.length,this._hash=e.hash,this},d.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},d.prototype._finish=function(e,n){var i,r,o,s=n;if(e[s>>2]|=128<<(s%4<<3),s>55)for(t(this._hash,e),s=0;s<16;s+=1)e[s]=0;r=parseInt((i=(i=8*this._length).toString(16).match(/(.*?)(.{0,8})$/))[2],16),o=parseInt(i[1],16)||0,e[14]=r,e[15]=o,t(this._hash,e)},d.hash=function(e,t){return d.hashBinary(a(e),t)},d.hashBinary=function(e,t){var n=s(r(e));return t?c(n):n},d.ArrayBuffer=function(){this.reset()},d.ArrayBuffer.prototype.append=function(e){var n,r,o,s,a,c=(r=this._buff.buffer,o=e,s=!0,(a=new Uint8Array(r.byteLength+o.byteLength)).set(new Uint8Array(r)),a.set(new Uint8Array(o),r.byteLength),s?a:a.buffer),d=c.length;for(this._length+=e.byteLength,n=64;n<=d;n+=64)t(this._hash,i(c.subarray(n-64,n)));return this._buff=new Uint8Array(n-64<d?c.buffer.slice(n-64):0),this},d.ArrayBuffer.prototype.end=function(e){var t,n,i=this._buff,r=i.length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(t=0;t<r;t+=1)o[t>>2]|=i[t]<<(t%4<<3);return this._finish(o,r),n=s(this._hash),e&&(n=c(n)),this.reset(),n},d.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},d.ArrayBuffer.prototype.getState=function(){var e,t=d.prototype.getState.call(this);return t.buff=(e=t.buff,String.fromCharCode.apply(null,new Uint8Array(e))),t},d.ArrayBuffer.prototype.setState=function(e){return e.buff=function(e,t){var n,i=e.length,r=new ArrayBuffer(i),o=new Uint8Array(r);for(n=0;n<i;n+=1)o[n]=e.charCodeAt(n);return t?o:r}(e.buff,!0),d.prototype.setState.call(this,e)},d.ArrayBuffer.prototype.destroy=d.prototype.destroy,d.ArrayBuffer.prototype._finish=d.prototype._finish,d.ArrayBuffer.hash=function(e,n){var r=s(function(e){var n,r,o,s,a,c,d=e.length,u=[1732584193,-271733879,-1732584194,271733878];for(n=64;n<=d;n+=64)t(u,i(e.subarray(n-64,n)));for(r=(e=n-64<d?e.subarray(n-64):new Uint8Array(0)).length,o=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0;n<r;n+=1)o[n>>2]|=e[n]<<(n%4<<3);if(o[n>>2]|=128<<(n%4<<3),n>55)for(t(u,o),n=0;n<16;n+=1)o[n]=0;return a=parseInt((s=(s=8*d).toString(16).match(/(.*?)(.{0,8})$/))[2],16),c=parseInt(s[1],16)||0,o[14]=a,o[15]=c,t(u,o),u}(new Uint8Array(e)));return n?c(r):r},d}()},5327:function(e,t,n){function i(){return n(3041)}function r(){return n(2729)}function o(){return n(5503)}function s(){return n(1439)}(0,n(2066).v)(0,this,arguments,{get 1(){return t},get 2(){return i},get 3(){return r},get 4(){return o},get 5(){return s}})},3041:function(e,t){var n;Object.defineProperty(t,"__esModule",{value:!0}),t.ActionType=void 0,function(e){e.EnterConversation="enter_chat",e.SendMessage="send_message"}(n||(t.ActionType=n={}))},1439:function(e,t,n){function i(){return n(5503)}(0,n(2066).v)(16,this,arguments,{get 1(){return t},get 2(){return i}})},2729:function(e,t){var n=this&&this.__awaiter||function(e,t,n,i){return new(n||(n=Promise))(function(r,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?r(e.value):((t=e.value)instanceof n?t:new n(function(e){e(t)})).then(s,a)}c((i=i.apply(e,t||[])).next())})},i=this&&this.__generator||function(e,t){var n,i,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},s=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return s.next=a(0),s.throw=a(1),s.return=a(2),"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(a){return function(c){return function(a){if(n)throw TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(o=0)),o;)try{if(n=1,i&&(r=2&a[0]?i.return:a[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,a[1])).done)return r;switch(i=0,r&&(a=[2&a[0],r.value]),a[0]){case 0:case 1:r=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,i=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!((r=(r=o.trys).length>0&&r[r.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!r||a[1]>r[0]&&a[1]<r[3])){o.label=a[1];break}if(6===a[0]&&o.label<r[1]){o.label=r[1],r=a;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(a);break}r[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],i=0}finally{n=r=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,c])}}};Object.defineProperty(t,"__esModule",{value:!0}),t.postReport=function(e){return n(this,void 0,void 0,function(){var t;return i(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,fetch("/aweme/v1/im/consistency/action/report",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})];case 1:return(t=n.sent()).ok?[2,{success:!0,statusCode:t.status}]:[2,{success:!1,statusCode:t.status,error:t.statusText}];case 2:return[2,{success:!1,error:String(n.sent())}];case 3:return[2]}})})}},8128:function(e,t,n){var i=n(9745);e.exports=i},7609:function(e,t,n){var i=n(694);e.exports=i},3670:function(e,t,n){n(7401),e.exports=n(9904)},3091:function(e,t,n){n(5033)},7477:function(e,t,n){n(2643)},2338:function(e,t,n){n(8796)},2643:function(e,t,n){n(2976);var i=n(8128);e.exports=i},8796:function(e,t,n){var i=n(7609);e.exports=i},8298:function(e,t,n){var i=n(8789),r=n(2599),o=TypeError;e.exports=function(e){if(i(e))return e;throw new o(r(e)+" is not a function")}},364:function(e,t,n){var i=n(541),r=n(2599),o=TypeError;e.exports=function(e){if(i(e))return e;throw new o(r(e)+" is not a constructor")}},3858:function(e,t,n){var i=n(4021),r=String,o=TypeError;e.exports=function(e){if(i(e))return e;throw new o("Can't set "+r(e)+" as a prototype")}},8023:function(e,t,n){var i=n(2034),r=String,o=TypeError;e.exports=function(e){if(i(e))return e;throw new o(r(e)+" is not an object")}},6867:function(e){e.exports="undefined"!=typeof ArrayBuffer&&"undefined"!=typeof DataView},3508:function(e,t,n){var i,r,o,s=n(6867),a=n(4044),c=n(9904),d=n(8789),u=n(2034),l=n(8929),v=n(2427),h=n(2599),f=n(331),p=n(4840),g=n(8074),m=n(7849),y=n(7267),x=n(7303),_=n(2323),b=n(9952),I=n(6269),C=I.enforce,M=I.get,k=c.Int8Array,S=k&&k.prototype,T=c.Uint8ClampedArray,w=T&&T.prototype,E=k&&y(k),R=S&&y(S),U=Object.prototype,A=c.TypeError,O=_("toStringTag"),P=b("TYPED_ARRAY_TAG"),D="TypedArrayConstructor",N=s&&!!x&&"Opera"!==v(c.opera),B=!1,G={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},L={BigInt64Array:8,BigUint64Array:8},j=function(e){var t=y(e);if(u(t)){var n=M(t);return n&&l(n,D)?n[D]:j(t)}},V=function(e){if(!u(e))return!1;var t=v(e);return l(G,t)||l(L,t)};for(i in G)(o=(r=c[i])&&r.prototype)?C(o)[D]=r:N=!1;for(i in L)(o=(r=c[i])&&r.prototype)&&(C(o)[D]=r);if((!N||!d(E)||E===Function.prototype)&&(E=function(){throw new A("Incorrect invocation")},N))for(i in G)c[i]&&x(c[i],E);if((!N||!R||R===U)&&(R=E.prototype,N))for(i in G)c[i]&&x(c[i].prototype,R);if(N&&y(w)!==R&&x(w,R),a&&!l(R,O))for(i in B=!0,g(R,O,{configurable:!0,get:function(){return u(this)?this[P]:void 0}}),G)c[i]&&f(c[i],P,i);e.exports={NATIVE_ARRAY_BUFFER_VIEWS:N,TYPED_ARRAY_TAG:B&&P,aTypedArray:function(e){if(V(e))return e;throw new A("Target is not a typed array")},aTypedArrayConstructor:function(e){if(d(e)&&(!x||m(E,e)))return e;throw new A(h(e)+" is not a typed array constructor")},exportTypedArrayMethod:function(e,t,n,i){if(a){if(n)for(var r in G){var o=c[r];if(o&&l(o.prototype,e))try{delete o.prototype[e]}catch(n){try{o.prototype[e]=t}catch(e){}}}R[e]&&!n||p(R,e,n?t:N&&S[e]||t,i)}},exportTypedArrayStaticMethod:function(e,t,n){var i,r;if(a){if(x){if(n){for(i in G)if((r=c[i])&&l(r,e))try{delete r[e]}catch(e){}}if(E[e]&&!n)return;try{return p(E,e,n?t:N&&E[e]||t)}catch(e){}}for(i in G)(r=c[i])&&(!r[e]||n)&&p(r,e,t)}},getTypedArrayConstructor:j,isView:function(e){if(!u(e))return!1;var t=v(e);return"DataView"===t||l(G,t)||l(L,t)},isTypedArray:V,TypedArray:E,TypedArrayPrototype:R}},1649:function(e,t,n){var i=n(7525),r=n(4186),o=n(1494),s=function(e){return function(t,n,s){var a=i(t),c=o(a);if(0===c)return!e&&-1;var d,u=r(s,c);if(e&&n!=n){for(;c>u;)if((d=a[u++])!=d)return!0}else for(;c>u;u++)if((e||u in a)&&a[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:s(!0),indexOf:s(!1)}},3580:function(e,t,n){var i=n(2323)("iterator"),r=!1;try{var o=0,s={next:function(){return{done:!!o++}},return:function(){r=!0}};s[i]=function(){return this},Array.from(s,function(){throw 2})}catch(e){}e.exports=function(e,t){try{if(!t&&!r)return!1}catch(e){return!1}var n=!1;try{var o={};o[i]=function(){return{next:function(){return{done:n=!0}}}},e(o)}catch(e){}return n}},7616:function(e,t,n){var i=n(3424),r=i({}.toString),o=i("".slice);e.exports=function(e){return o(r(e),8,-1)}},2427:function(e,t,n){var i=n(3708),r=n(8789),o=n(7616),s=n(2323)("toStringTag"),a=Object,c="Arguments"===o(function(){return arguments}());e.exports=i?o:function(e){var t,n,i;return void 0===e?"Undefined":null===e?"Null":"string"==typeof(n=function(e,t){try{return e[t]}catch(e){}}(t=a(e),s))?n:c?o(t):"Object"===(i=o(t))&&r(t.callee)?"Arguments":i}},6220:function(e,t,n){var i=n(8929),r=n(503),o=n(7763),s=n(5537);e.exports=function(e,t,n){for(var a=r(t),c=s.f,d=o.f,u=0;u<a.length;u++){var l=a[u];i(e,l)||n&&i(n,l)||c(e,l,d(t,l))}}},5539:function(e,t,n){var i=n(7439);e.exports=!i(function(){function e(){}return e.prototype.constructor=null,Object.getPrototypeOf(new e)!==e.prototype})},331:function(e,t,n){var i=n(4044),r=n(5537),o=n(1796);e.exports=i?function(e,t,n){return r.f(e,t,o(1,n))}:function(e,t,n){return e[t]=n,e}},1796:function(e){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},8074:function(e,t,n){var i=n(4699),r=n(5537);e.exports=function(e,t,n){return n.get&&i(n.get,t,{getter:!0}),n.set&&i(n.set,t,{setter:!0}),r.f(e,t,n)}},4840:function(e,t,n){var i=n(8789),r=n(5537),o=n(4699),s=n(9945);e.exports=function(e,t,n,a){a||(a={});var c=a.enumerable,d=void 0!==a.name?a.name:t;if(i(n)&&o(n,d,a),a.global)c?e[t]=n:s(t,n);else{try{a.unsafe?e[t]&&(c=!0):delete e[t]}catch(e){}c?e[t]=n:r.f(e,t,{value:n,enumerable:!1,configurable:!a.nonConfigurable,writable:!a.nonWritable})}return e}},9945:function(e,t,n){var i=n(9904),r=Object.defineProperty;e.exports=function(e,t){try{r(i,e,{value:t,configurable:!0,writable:!0})}catch(n){i[e]=t}return t}},4044:function(e,t,n){var i=n(7439);e.exports=!i(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},1975:function(e,t,n){var i=n(9904),r=n(2034),o=i.document,s=r(o)&&r(o.createElement);e.exports=function(e){return s?o.createElement(e):{}}},9415:function(e){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},3143:function(e,t,n){var i=n(9904).navigator,r=i&&i.userAgent;e.exports=r?String(r):""},5375:function(e,t,n){var i,r,o=n(9904),s=n(3143),a=o.process,c=o.Deno,d=a&&a.versions||c&&c.version,u=d&&d.v8;u&&(r=(i=u.split("."))[0]>0&&i[0]<4?1:+(i[0]+i[1])),!r&&s&&(!(i=s.match(/Edge\/(\d+)/))||i[1]>=74)&&(i=s.match(/Chrome\/(\d+)/))&&(r=+i[1]),e.exports=r},3654:function(e,t,n){var i=n(9904),r=n(7763).f,o=n(331),s=n(4840),a=n(9945),c=n(6220),d=n(2540);e.exports=function(e,t){var n,u,l,v,h,f=e.target,p=e.global,g=e.stat;if(n=p?i:g?i[f]||a(f,{}):i[f]&&i[f].prototype)for(u in t){if(v=t[u],l=e.dontCallGetSet?(h=r(n,u))&&h.value:n[u],!d(p?u:f+(g?".":"#")+u,e.forced)&&void 0!==l){if(typeof v==typeof l)continue;c(v,l)}(e.sham||l&&l.sham)&&o(v,"sham",!0),s(n,u,v,e)}}},7439:function(e){e.exports=function(e){try{return!!e()}catch(e){return!0}}},8368:function(e,t,n){var i=n(788),r=n(8298),o=n(9976),s=i(i.bind);e.exports=function(e,t){return r(e),void 0===t?e:o?s(e,t):function(){return e.apply(t,arguments)}}},9976:function(e,t,n){var i=n(7439);e.exports=!i(function(){var e=(function(){}).bind();return"function"!=typeof e||e.hasOwnProperty("prototype")})},173:function(e,t,n){var i=n(9976),r=Function.prototype.call;e.exports=i?r.bind(r):function(){return r.apply(r,arguments)}},3278:function(e,t,n){var i=n(4044),r=n(8929),o=Function.prototype,s=i&&Object.getOwnPropertyDescriptor,a=r(o,"name"),c=a&&"something"===(function(){}).name,d=a&&(!i||i&&s(o,"name").configurable);e.exports={EXISTS:a,PROPER:c,CONFIGURABLE:d}},5794:function(e,t,n){var i=n(3424),r=n(8298);e.exports=function(e,t,n){try{return i(r(Object.getOwnPropertyDescriptor(e,t)[n]))}catch(e){}}},788:function(e,t,n){var i=n(7616),r=n(3424);e.exports=function(e){if("Function"===i(e))return r(e)}},3424:function(e,t,n){var i=n(9976),r=Function.prototype,o=r.call,s=i&&r.bind.bind(o,o);e.exports=i?s:function(e){return function(){return o.apply(e,arguments)}}},4791:function(e,t,n){var i=n(9904),r=n(8789);e.exports=function(e,t){var n;return arguments.length<2?r(n=i[e])?n:void 0:i[e]&&i[e][t]}},5075:function(e,t,n){var i=n(2427),r=n(8366),o=n(9989),s=n(1869),a=n(2323)("iterator");e.exports=function(e){if(!o(e))return r(e,a)||r(e,"@@iterator")||s[i(e)]}},193:function(e,t,n){var i=n(173),r=n(8298),o=n(8023),s=n(2599),a=n(5075),c=TypeError;e.exports=function(e,t){var n=arguments.length<2?a(e):t;if(r(n))return o(i(n,e));throw new c(s(e)+" is not iterable")}},8366:function(e,t,n){var i=n(8298),r=n(9989);e.exports=function(e,t){var n=e[t];return r(n)?void 0:i(n)}},9904:function(e,t,n){var i=function(e){return e&&e.Math===Math&&e};e.exports=i("object"==typeof globalThis&&globalThis)||i("object"==typeof window&&window)||i("object"==typeof self&&self)||i("object"==typeof n.g&&n.g)||i("object"==typeof this&&this)||function(){return this}()||Function("return this")()},8929:function(e,t,n){var i=n(3424),r=n(8581),o=i({}.hasOwnProperty);e.exports=Object.hasOwn||function(e,t){return o(r(e),t)}},9349:function(e){e.exports={}},5373:function(e,t,n){var i=n(4044),r=n(7439),o=n(1975);e.exports=!i&&!r(function(){return 7!==Object.defineProperty(o("div"),"a",{get:function(){return 7}}).a})},8143:function(e,t,n){var i=n(3424),r=n(7439),o=n(7616),s=Object,a=i("".split);e.exports=r(function(){return!s("z").propertyIsEnumerable(0)})?function(e){return"String"===o(e)?a(e,""):s(e)}:s},7994:function(e,t,n){var i=n(3424),r=n(8789),o=n(3261),s=i(Function.toString);r(o.inspectSource)||(o.inspectSource=function(e){return s(e)}),e.exports=o.inspectSource},6269:function(e,t,n){var i,r,o,s=n(2654),a=n(9904),c=n(2034),d=n(331),u=n(8929),l=n(3261),v=n(1591),h=n(9349),f="Object already initialized",p=a.TypeError,g=a.WeakMap;if(s||l.state){var m=l.state||(l.state=new g);m.get=m.get,m.has=m.has,m.set=m.set,i=function(e,t){if(m.has(e))throw new p(f);return t.facade=e,m.set(e,t),t},r=function(e){return m.get(e)||{}},o=function(e){return m.has(e)}}else{var y=v("state");h[y]=!0,i=function(e,t){if(u(e,y))throw new p(f);return t.facade=e,d(e,y,t),t},r=function(e){return u(e,y)?e[y]:{}},o=function(e){return u(e,y)}}e.exports={set:i,get:r,has:o,enforce:function(e){return o(e)?r(e):i(e,{})},getterFor:function(e){return function(t){var n;if(!c(t)||(n=r(t)).type!==e)throw new p("Incompatible receiver, "+e+" required");return n}}}},9969:function(e,t,n){var i=n(2323),r=n(1869),o=i("iterator"),s=Array.prototype;e.exports=function(e){return void 0!==e&&(r.Array===e||s[o]===e)}},5623:function(e,t,n){var i=n(2427);e.exports=function(e){var t=i(e);return"BigInt64Array"===t||"BigUint64Array"===t}},8789:function(e){var t="object"==typeof document&&document.all;e.exports=void 0===t&&void 0!==t?function(e){return"function"==typeof e||e===t}:function(e){return"function"==typeof e}},541:function(e,t,n){var i=n(3424),r=n(7439),o=n(8789),s=n(2427),a=n(4791),c=n(7994),d=function(){},u=a("Reflect","construct"),l=/^\s*(?:class|function)\b/,v=i(l.exec),h=!l.test(d),f=function(e){if(!o(e))return!1;try{return u(d,[],e),!0}catch(e){return!1}},p=function(e){if(!o(e))return!1;switch(s(e)){case"AsyncFunction":case"GeneratorFunction":case"AsyncGeneratorFunction":return!1}try{return h||!!v(l,c(e))}catch(e){return!0}};p.sham=!0,e.exports=!u||r(function(){var e;return f(f.call)||!f(Object)||!f(function(){e=!0})||e})?p:f},2540:function(e,t,n){var i=n(7439),r=n(8789),o=/#|\.prototype\./,s=function(e,t){var n=c[a(e)];return n===u||n!==d&&(r(t)?i(t):!!t)},a=s.normalize=function(e){return String(e).replace(o,".").toLowerCase()},c=s.data={},d=s.NATIVE="N",u=s.POLYFILL="P";e.exports=s},9989:function(e){e.exports=function(e){return null==e}},2034:function(e,t,n){var i=n(8789);e.exports=function(e){return"object"==typeof e?null!==e:i(e)}},4021:function(e,t,n){var i=n(2034);e.exports=function(e){return i(e)||null===e}},8603:function(e){e.exports=!1},6165:function(e,t,n){var i=n(4791),r=n(8789),o=n(7849),s=n(6512),a=Object;e.exports=s?function(e){return"symbol"==typeof e}:function(e){var t=i("Symbol");return r(t)&&o(t.prototype,a(e))}},1869:function(e){e.exports={}},1494:function(e,t,n){var i=n(2190);e.exports=function(e){return i(e.length)}},4699:function(e,t,n){var i=n(3424),r=n(7439),o=n(8789),s=n(8929),a=n(4044),c=n(3278).CONFIGURABLE,d=n(7994),u=n(6269),l=u.enforce,v=u.get,h=String,f=Object.defineProperty,p=i("".slice),g=i("".replace),m=i([].join),y=a&&!r(function(){return 8!==f(function(){},"length",{value:8}).length}),x=String(String).split("String"),_=e.exports=function(e,t,n){"Symbol("===p(h(t),0,7)&&(t="["+g(h(t),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),n&&n.getter&&(t="get "+t),n&&n.setter&&(t="set "+t),(!s(e,"name")||c&&e.name!==t)&&(a?f(e,"name",{value:t,configurable:!0}):e.name=t),y&&n&&s(n,"arity")&&e.length!==n.arity&&f(e,"length",{value:n.arity});try{n&&s(n,"constructor")&&n.constructor?a&&f(e,"prototype",{writable:!1}):e.prototype&&(e.prototype=void 0)}catch(e){}var i=l(e);return s(i,"source")||(i.source=m(x,"string"==typeof t?t:"")),e};Function.prototype.toString=_(function(){return o(this)&&v(this).source||d(this)},"toString")},3413:function(e){var t=Math.ceil,n=Math.floor;e.exports=Math.trunc||function(e){var i=+e;return(i>0?n:t)(i)}},5537:function(e,t,n){var i=n(4044),r=n(5373),o=n(3742),s=n(8023),a=n(1705),c=TypeError,d=Object.defineProperty,u=Object.getOwnPropertyDescriptor,l="enumerable",v="configurable",h="writable";t.f=i?o?function(e,t,n){if(s(e),t=a(t),s(n),"function"==typeof e&&"prototype"===t&&"value"in n&&h in n&&!n[h]){var i=u(e,t);i&&i[h]&&(e[t]=n.value,n={configurable:v in n?n[v]:i[v],enumerable:l in n?n[l]:i[l],writable:!1})}return d(e,t,n)}:d:function(e,t,n){if(s(e),t=a(t),s(n),r)try{return d(e,t,n)}catch(e){}if("get"in n||"set"in n)throw new c("Accessors not supported");return"value"in n&&(e[t]=n.value),e}},7763:function(e,t,n){var i=n(4044),r=n(173),o=n(1941),s=n(1796),a=n(7525),c=n(1705),d=n(8929),u=n(5373),l=Object.getOwnPropertyDescriptor;t.f=i?l:function(e,t){if(e=a(e),t=c(t),u)try{return l(e,t)}catch(e){}if(d(e,t))return s(!r(o.f,e,t),e[t])}},2480:function(e,t,n){var i=n(6980),r=n(9415).concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return i(e,r)}},4613:function(e,t){t.f=Object.getOwnPropertySymbols},7267:function(e,t,n){var i=n(8929),r=n(8789),o=n(8581),s=n(1591),a=n(5539),c=s("IE_PROTO"),d=Object,u=d.prototype;e.exports=a?d.getPrototypeOf:function(e){var t=o(e);if(i(t,c))return t[c];var n=t.constructor;return r(n)&&t instanceof n?n.prototype:t instanceof d?u:null}},7849:function(e,t,n){var i=n(3424);e.exports=i({}.isPrototypeOf)},6980:function(e,t,n){var i=n(3424),r=n(8929),o=n(7525),s=n(1649).indexOf,a=n(9349),c=i([].push);e.exports=function(e,t){var n,i=o(e),d=0,u=[];for(n in i)!r(a,n)&&r(i,n)&&c(u,n);for(;t.length>d;)r(i,n=t[d++])&&(~s(u,n)||c(u,n));return u}},1941:function(e,t){var n={}.propertyIsEnumerable,i=Object.getOwnPropertyDescriptor,r=i&&!n.call({1:2},1);t.f=r?function(e){var t=i(this,e);return!!t&&t.enumerable}:n},7303:function(e,t,n){var i=n(5794),r=n(2034),o=n(2022),s=n(3858);e.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var e,t=!1,n={};try{(e=i(Object.prototype,"__proto__","set"))(n,[]),t=n instanceof Array}catch(e){}return function(n,i){return o(n),s(i),r(n)&&(t?e(n,i):n.__proto__=i),n}}():void 0)},5838:function(e,t,n){var i=n(173),r=n(8789),o=n(2034),s=TypeError;e.exports=function(e,t){var n,a;if("string"===t&&r(n=e.toString)&&!o(a=i(n,e))||r(n=e.valueOf)&&!o(a=i(n,e))||"string"!==t&&r(n=e.toString)&&!o(a=i(n,e)))return a;throw new s("Can't convert object to primitive value")}},503:function(e,t,n){var i=n(4791),r=n(3424),o=n(2480),s=n(4613),a=n(8023),c=r([].concat);e.exports=i("Reflect","ownKeys")||function(e){var t=o.f(a(e)),n=s.f;return n?c(t,n(e)):t}},2022:function(e,t,n){var i=n(9989),r=TypeError;e.exports=function(e){if(i(e))throw new r("Can't call method on "+e);return e}},1591:function(e,t,n){var i=n(1073),r=n(9952),o=i("keys");e.exports=function(e){return o[e]||(o[e]=r(e))}},3261:function(e,t,n){var i=n(8603),r=n(9904),o=n(9945),s="__core-js_shared__",a=e.exports=r[s]||o(s,{});(a.versions||(a.versions=[])).push({version:"3.48.0",mode:i?"pure":"global",copyright:"\xa9 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.48.0/LICENSE",source:"https://github.com/zloirock/core-js"})},1073:function(e,t,n){var i=n(3261);e.exports=function(e,t){return i[e]||(i[e]=t||{})}},5999:function(e,t,n){var i=n(5375),r=n(7439),o=n(9904).String;e.exports=!!Object.getOwnPropertySymbols&&!r(function(){var e=Symbol("symbol detection");return!o(e)||!(Object(e) instanceof Symbol)||!Symbol.sham&&i&&i<41})},4186:function(e,t,n){var i=n(1003),r=Math.max,o=Math.min;e.exports=function(e,t){var n=i(e);return n<0?r(n+t,0):o(n,t)}},4446:function(e,t,n){var i=n(2617),r=TypeError;e.exports=function(e){var t=i(e,"number");if("number"==typeof t)throw new r("Can't convert number to bigint");return BigInt(t)}},7525:function(e,t,n){var i=n(8143),r=n(2022);e.exports=function(e){return i(r(e))}},1003:function(e,t,n){var i=n(3413);e.exports=function(e){var t=+e;return t!=t||0===t?0:i(t)}},2190:function(e,t,n){var i=n(1003),r=Math.min;e.exports=function(e){var t=i(e);return t>0?r(t,9007199254740991):0}},8581:function(e,t,n){var i=n(2022),r=Object;e.exports=function(e){return r(i(e))}},2617:function(e,t,n){var i=n(173),r=n(2034),o=n(6165),s=n(8366),a=n(5838),c=n(2323),d=TypeError,u=c("toPrimitive");e.exports=function(e,t){if(!r(e)||o(e))return e;var n,c=s(e,u);if(c){if(void 0===t&&(t="default"),!r(n=i(c,e,t))||o(n))return n;throw new d("Can't convert object to primitive value")}return void 0===t&&(t="number"),a(e,t)}},1705:function(e,t,n){var i=n(2617),r=n(6165);e.exports=function(e){var t=i(e,"string");return r(t)?t:t+""}},3708:function(e,t,n){var i={};i[n(2323)("toStringTag")]="z",e.exports="[object z]"===String(i)},2599:function(e){var t=String;e.exports=function(e){try{return t(e)}catch(e){return"Object"}}},1621:function(e,t,n){var i=n(9904),r=n(7439),o=n(3580),s=n(3508).NATIVE_ARRAY_BUFFER_VIEWS,a=i.ArrayBuffer,c=i.Int8Array;e.exports=!s||!r(function(){c(1)})||!r(function(){new c(-1)})||!o(function(e){new c,new c(null),new c(1.5),new c(e)},!0)||r(function(){return 1!==new c(new a(2),1,void 0).length})},5827:function(e,t,n){var i=n(8368),r=n(173),o=n(364),s=n(8581),a=n(1494),c=n(193),d=n(5075),u=n(9969),l=n(5623),v=n(3508).aTypedArrayConstructor,h=n(4446);e.exports=function(e){var t,n,f,p,g,m,y,x,_=o(this),b=s(e),I=arguments.length,C=I>1?arguments[1]:void 0,M=void 0!==C,k=d(b);if(k&&!u(k))for(x=(y=c(b,k)).next,b=[];!(m=r(x,y)).done;)b.push(m.value);for(M&&I>2&&(C=i(C,arguments[2])),n=a(b),p=l(f=new(v(_))(n)),t=0;n>t;t++)g=M?C(b[t],t):b[t],f[t]=p?h(g):+g;return f}},9952:function(e,t,n){var i=n(3424),r=0,o=Math.random(),s=i(1.1.toString);e.exports=function(e){return"Symbol("+(void 0===e?"":e)+")_"+s(++r+o,36)}},6512:function(e,t,n){var i=n(5999);e.exports=i&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},3742:function(e,t,n){var i=n(4044),r=n(7439);e.exports=i&&r(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},2654:function(e,t,n){var i=n(9904),r=n(8789),o=i.WeakMap;e.exports=r(o)&&/native code/.test(String(o))},2323:function(e,t,n){var i=n(9904),r=n(1073),o=n(8929),s=n(9952),a=n(5999),c=n(6512),d=i.Symbol,u=r("wks"),l=c?d.for||d:d&&d.withoutSetter||s;e.exports=function(e){return o(u,e)||(u[e]=a&&o(d,e)?d[e]:l("Symbol."+e)),u[e]}},7401:function(e,t,n){var i=n(3654),r=n(9904);i({global:!0,forced:r.globalThis!==r},{globalThis:r})},5033:function(e,t,n){var i=n(1621);(0,n(3508).exportTypedArrayStaticMethod)("from",n(5827),i)},2976:function(e,t,n){n(7401)},9745:function(e,t,n){var i=n(3670);e.exports=i},694:function(e,t,n){var i=n(3091);e.exports=i}},r={};function o(e){var t=r[e];if(void 0!==t)return t.exports;var n=r[e]={exports:{}};return i[e].call(n.exports,n,n.exports,o),n.exports}o.d=function(e,t){for(var n in t)o.o(t,n)&&!o.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},o.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};var s={};!function(){var e=s;Object.defineProperty(e,"__esModule",{value:!0}),e.ActionType=e.ActionConsistencyManager=void 0;var t=o(5327);Object.defineProperty(e,"ActionConsistencyManager",{enumerable:!0,get:function(){return t.ActionConsistencyManager}});var n=o(3041);Object.defineProperty(e,"ActionType",{enumerable:!0,get:function(){return n.ActionType}})}();var a=s.ActionConsistencyManager;s.ActionType,s.__esModule},694432:function(e,t,n){"use strict";n.d(t,{ZP:function(){return el}});var i=n("183652"),r=n.n(i),o=n("164943");function s(e){var t,n=new RegExp("(^| )".concat(e,"=([^;]*)(;|$)"));return(t=document.cookie.match(n))?unescape(t[2]):""}function a(e){return"undefined"!=typeof FormData&&e instanceof FormData}function c(e,t,n){void 0===n&&(n=!0),t&&Object.keys(t).forEach(function(e){})}function d(e){return Object.keys(e).map(function(t){var n=e[t];return"object"==typeof n?"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(JSON.stringify(n))):"".concat(encodeURIComponent(t),"=").concat(encodeURIComponent(n))}).join("&")}var u=function(e){for(var t,n=e.toString(),i=[],r=0;r<n.length;r++)0<=(t=n.charCodeAt(r))&&t<=127?i.push(t):128<=t&&t<=2047?(i.push(192|31&t>>6),i.push(128|63&t)):(2048<=t&&t<=55295||57344<=t&&t<=65535)&&(i.push(224|15&t>>12),i.push(128|63&t>>6),i.push(128|63&t));for(var o=0;o<i.length;o++)i[o]&=255;return i},l=function(e){var t=[],n=[];if(void 0===e)return"";n=u(e);for(var i=0,r=n.length;i<r;++i)t.push((5^n[i]).toString(16));return t.join("")},v=function(e,t){void 0===e&&(e={}),void 0===t&&(t=-1);var n=Object.keys(e).sort()||[];return t>=0&&n.splice(t),{str:n.map(function(t){var n=e[t];return"object"==typeof n?"".concat(t,"=").concat(JSON.stringify(n)):"".concat(t,"=").concat(n)}).join("&"),arr:n}},h=function(e,t,n){if(void 0===e&&(e={}),void 0===t&&(t={}),void 0===n&&(n=""),!n)return{};var i=v(e,10),r=i.str,s=void 0===r?"":r,a=i.arr,c=void 0===a?[]:a,d=v(t),u=d.str,h=void 0===u?"":u;d.arr;var f="".concat(s,"&").concat(h,"&app_key=").concat(n);return{sign:(0,o.sha256)(f),qs:l(c.join(","))}},f=function(e){return Uint8Array.from((e.match(/.{1,2}/g)||[]).map(function(e){return parseInt(e,16)}))},p="4.2.3",g=function(){return(g=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},m=function(e,t,n,i){function r(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?n(e.value):r(e.value).then(s,a)}c((i=i.apply(e,t||[])).next())})},y=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(o){if(n)throw TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},x=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var r=0,i=Object.getOwnPropertySymbols(e);r<i.length;r++)0>t.indexOf(i[r])&&Object.prototype.propertyIsEnumerable.call(e,i[r])&&(n[i[r]]=e[i[r]]);return n},_=function(e,t,n){if(n||2==arguments.length)for(var i,r=0,o=t.length;r<o;r++)(i||!(r in t))&&(!i&&(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},b={web:{respHandler:function(e){return(null==e?void 0:e.message)==="success"},successCallBack:function(e){return null==e?void 0:e.data},failCallBack:function(e){return null==e?void 0:e.data}},sso:{respHandler:function(e){return(null==e?void 0:e.error_code)===0||(null==e?void 0:e.message)==="success"},successCallBack:function(e){return(null==e?void 0:e.message)==="success"?e.data:e},failCallBack:function(e){return e}},app:{},auth:{respHandler:function(e){return(null==e?void 0:e.status_code)===0},successCallBack:function(e){return e.data},failCallBack:function(e){return e}}},I=function(e,t){var n,i,r,o,s,a,d,u,l=b[e.config.params.account_sdk_source],v=(null==l?void 0:l.respHandler)||function(e){return(null==e?void 0:e.message)==="success"},h=(null==l?void 0:l.successCallBack)||function(e){return null==e?void 0:e.data},f=(null==l?void 0:l.failCallBack)||function(e){return null==e?void 0:e.data},p=(null===(n=null==e?void 0:e.config)||void 0===n?void 0:n.url)||"",m=(null===(i=null==e?void 0:e.headers)||void 0===i?void 0:i["x-tt-logid"])||"",y=(null==e?void 0:e.data)||{},x=(null==t?void 0:t.printLog)||!1,I=null===(r=null==e?void 0:e.config)||void 0===r?void 0:r.startTime;if("string"==typeof y)try{y=JSON.parse(y)}catch(e){}return v(y)?(x&&c("call ".concat(p," result >>>>"),{"%cSUCCESS":h(y),"%cLogid":m}),Promise.resolve(g(g({},h(y)||{}),{log_id:m,rawData:e,respHeader:null==e?void 0:e.headers,middlewareHandlerLog:_(_([],(null===(o=null==e?void 0:e.config)||void 0===o?void 0:o.middlewareHandlerLog)||[],!0),[{name:"request",time:Date.now()-I,endTime:Date.now(),startTime:I,errorCode:0,logid:m}],!1)}))):(x&&c("call ".concat(p," result >>>>"),{"%cERROR":f(y),"%cLogid":m}),Promise.reject(g(g({},f(y)||{}),{log_id:m,originConfig:g(g({},null==e?void 0:e.config),{middlewareHandlerLog:_(_([],(null===(s=null==e?void 0:e.config)||void 0===s?void 0:s.middlewareHandlerLog)||[],!0),[{name:"request",time:Date.now()-I,endTime:Date.now(),startTime:I,errorCode:(null===(a=null==y?void 0:y.data)||void 0===a?void 0:a.error_code)||(null==y?void 0:y.error_code)||"-998",logid:m}],!1)}),middlewareHandlerLog:_(_([],(null===(d=null==e?void 0:e.config)||void 0===d?void 0:d.middlewareHandlerLog)||[],!0),[{name:"request",time:Date.now()-I,endTime:Date.now(),startTime:I,errorCode:(null===(u=null==y?void 0:y.data)||void 0===u?void 0:u.error_code)||(null==y?void 0:y.error_code)||"-998",logid:m}],!1),rawData:e,respHeader:null==e?void 0:e.headers})))},C=function(e,t){var n,i,r,o,s,a,d,u=(null===(n=null==e?void 0:e.config)||void 0===n?void 0:n.url)||"",l=(null===(r=null===(i=null==e?void 0:e.response)||void 0===i?void 0:i.headers)||void 0===r?void 0:r["x-tt-logid"])||"unknown",v=(null==t?void 0:t.printLog)||!1,h=null===(o=null==e?void 0:e.config)||void 0===o?void 0:o.startTime;return v&&c("call ".concat(u," result >>>>"),{"%cERROR":"HTTP ERROR","%cLogid":l}),Promise.reject({error_code:e.code,description:e.message,is_network_error:!0,log_id:l,originConfig:g(g({},null==e?void 0:e.config),{middlewareHandlerLog:_(_([],(null===(s=null==e?void 0:e.config)||void 0===s?void 0:s.middlewareHandlerLog)||[],!0),[{name:"request",time:Date.now()-h,endTime:Date.now(),startTime:h,errorCode:e.code||"-999",logid:l}],!1)}),middlewareHandlerLog:_(_([],(null===(a=null==e?void 0:e.config)||void 0===a?void 0:a.middlewareHandlerLog)||[],!0),[{name:"request",time:Date.now()-h,endTime:Date.now(),startTime:h,errorCode:e.code||"-999",logid:l}],!1),rawData:e,respHeader:null===(d=null==e?void 0:e.response)||void 0===d?void 0:d.headers})},M=function(e,t){return m(void 0,void 0,void 0,function(){var n,i,r,o,u,l,v,f,p,m,_,b,I,C,M,k;return y(this,function(y){return(n=(null==t?void 0:t.printLog)||!1,i=(null==t?void 0:t.appKey)||"",r=null==e?void 0:e.url,o=(null==e?void 0:e.method)||"get",u=(null==e?void 0:e.data)||{},l=(null==e?void 0:e.params)||{},v=Object.assign({"Content-Type":"application/x-www-form-urlencoded",Accept:"application/json, text/javascript"},{"x-tt-passport-csrf-token":s("passport_csrf_token")||s("passport_csrf_token_default")||""},e.headers||{}),e.headers=v,n&&c("".concat(o," ").concat(r," >>>>"),{"%cdata >>>>":u,"%cparams >>>>":l}),(null===(M=e.params)||void 0===M?void 0:M.isResend)||(null===(k=e.params)||void 0===k?void 0:k.auto_retry_req))?(p=(f=e.params).isResend,m=x(f,["isResend"]),[2,g(g({},e),{params:m,startTime:Date.now()})]):(_={},Object.keys(u).filter(function(e){return void 0!==u[e]}).forEach(function(e){_[e]=u[e]}),["post","POST"].includes(o)&&(I=h(b=g({},(null==e?void 0:e.params)||{}),_,i),e.params=g(g({},b),I),a(u)?e.data=u:e.data=d(_)),["get","GET"].includes(o)&&(I=h(C=g(g({},_),e.params),{},i),e.params=g(g({},C),I)),[2,g(g({},e),{startTime:Date.now()})])})})},k=function(e,t){return m(void 0,void 0,void 0,function(){var n,i,r,o,s,a,c,d,u;return y(this,function(l){switch(l.label){case 0:if(n=(null==e?void 0:e.params)||{},i=t.aid,o=void 0===(r=t.language)?"zh":r,a=void 0===(s=t.generalParams)?{}:s,c=t.getGeneralParams,d={},!c)return[3,4];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,c()];case 2:return d=l.sent(),[3,4];case 3:return u=l.sent(),[3,4];case 4:return e.params=g(g(g({passport_jssdk_version:p,passport_jssdk_type:"lite",is_from_ttaccountsdk:1,aid:i,language:o},n),a),d),[2,Promise.resolve(e)]}})})},S=function(e,t,n,i){void 0===n&&(n="/"),document.cookie="".concat(e,"=").concat(t,";path=").concat(n,";domain=").concat(i||window.location.hostname)},T=function(){try{var e="",t=document.location.hostname,n=t.split(".");if(/^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])$/.test(t)||"localhost"===t){var i=document.location.hostname,r=/^.*?\b\.\b/;return i.replace(r,"")}var o=[];for(o.unshift(n.pop());o.length<2;)o.unshift(n.pop()),e=o.join(".");return e||document.location.hostname}catch(e){return document.location.hostname}},w=function(){return(w=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},E=function(){function e(e){this.enable=!1,this.traceID=this.getTraceId(),this.enable=!!(null==e?void 0:e.autoTrace)}return e.prototype.getUUID=function(){var e=new Date().getTime(),t="undefined"!=typeof performance&&performance.now&&1e3*performance.now()||0;return"xxxxxxxx".replace(/[xy]/g,function(n){var i=16*Math.random();return e>0?(i=(e+i)%16|0,e=Math.floor(e/16)):(i=(t+i)%16|0,t=Math.floor(t/16)),("x"===n?i:3&i|8).toString(16)})},e.prototype.getTraceId=function(){return this.getUUID().replace(/-/g,"")},e.prototype.start=function(){this.enable=!0},e.prototype.stop=function(){this.enable=!1},e}(),R=function(e){return function(t){return(null==e?void 0:e.enable)?(S("biz_trace_id",e.traceID||"","/",T()),t.headers=w(w({},t.headers||{}),{"x-tt-passport-trace-id":e.traceID||""}),t.params=w(w({},t.params||{}),{biz_trace_id:e.traceID||""})):S("biz_trace_id","","/",T()),t}},U=function(){return(U=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},A=function e(e,t){var n=e.host,i=e.isBoe,o=e.axiosConfig,s=e.requestInterceptors,a=e.responseInterceptors,c=r().create(U(U({},o),{xsrfCookieName:"passport_csrf_token",xsrfHeaderName:"x-tt-passport-csrf-token",baseURL:n||window&&"".concat(i?window.location.protocol:"https:","//").concat(window.location.hostname),withCredentials:!0}));return c.interceptors.request.use(function(t){return M(t,e)},void 0),c.interceptors.request.use(function(t){return k(t,e)},void 0),c.interceptors.request.use(R(t)),s&&Array.isArray(s)&&s.forEach(function(e){c.interceptors.request.use(function(t){return e(t)},void 0)}),a&&Array.isArray(a)&&a.forEach(function(e){c.interceptors.response.use(function(t){return e(t)},function(t){return e(t)})}),c.interceptors.response.use(function(t){return I(t,e)},function(t){return C(t,e)}),c},O=function(){return(O=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)};function P(e){var t,n,i=(null===(n=null===(t=null==e?void 0:e.data)||void 0===t?void 0:t.data)||void 0===n?void 0:n.response)||(null==e?void 0:e.data)||{};if("string"==typeof i)try{i=JSON.parse(i)}catch(e){}return i}var D=function(e,t){var n,i,r=(null===(n=null==e?void 0:e.config)||void 0===n?void 0:n.url)||"",o=(null===(i=null==e?void 0:e.headers)||void 0===i?void 0:i["x-tt-logid"])||"",s=P(e),a=(null==t?void 0:t.printLog)||!1;return(null==s?void 0:s.message)==="success"?(a&&c("call ".concat(r," result >>>>"),{SUCCESS:s.data,Logid:o},!1),Promise.resolve(O(O({},s.data||{}),{log_id:o}))):(a&&c("call ".concat(r," result >>>>"),{ERROR:s.data,Logid:o},!1),Promise.reject(O(O({},s.data),{log_id:o,originConfig:e.config})))},N=n("642440"),B=n.n(N),G=function(){return(G=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},L=function(e){return function(t){var n=t.baseURL,i=t.url,r=t.method,o=void 0===r?"GET":r,a=t.params,d=void 0===a?{}:a,u=t.data,l=void 0===u?{}:u,v=null==e?void 0:e.fetch,h=(null==e?void 0:e.printLog)||!1,f=B().isValid(i)?i:n+i;return h&&c("".concat(o," ").concat(f," >>>>"),{"data >>>>":l,"params >>>>":d},!1),v({url:f,method:o.toUpperCase(),params:G(G({},d),{is_native_h5:1}),data:l,needCommonParams:!0,header:{"x-tt-passport-csrf-token":s("passport_csrf_token")||s("passport_csrf_token_default")||""}}).then(function(e){return{data:e,status:200,statusText:"ok",config:t}})}},j=function(){return(j=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},V=function e(e,t){var n=e.host,i=e.isBoe,o=void 0!==i&&i,s=e.axiosConfig,a=r().create(j(j({},s),{baseURL:n||window&&"".concat(o?"http":"https","://").concat(window.location.hostname),adapter:L(e),withCredentials:!0,transformRequest:[function(e){var t=e;if("string"==typeof e)try{t=JSON.parse(e)}catch(e){}return t}]}));return a.interceptors.response.use(function(t){return D(t,e)},void 0),a.interceptors.request.use(R(t)),a},F=function(e,t,n){if(n||2==arguments.length)for(var i,r=0,o=t.length;r<o;r++)(i||!(r in t))&&(!i&&(i=Array.prototype.slice.call(t,0,r)),i[r]=t[r]);return e.concat(i||Array.prototype.slice.call(t))},W=o.sha256.hmac;function Y(e,t){return W(e,t)}function $(e,t,n,i){return void 0===i&&(i=32),H(q(e,t),n,i)}function q(e,t){var n=32;return(!e||0===e.length)&&(e=new Uint8Array(n)),Y(e,t)}function H(e,t,n){void 0===n&&(n=32);for(var i=new Uint8Array,r="",o=0;i.length<n;){o++;var s=Uint8Array.from(F(F(F([],Array.from(Uint8Array.from(f(r))),!0),Array.from(t),!0),[o],!1));r=Y(f(e),s),i=Uint8Array.from(F(F([],Array.from(i),!0),Array.from(Uint8Array.from(f(r))),!0))}return Uint8Array.from(i.slice(0,n))}var z=function(e,t,n){return"aid=".concat(e,"&path=").concat(t,"&ts=").concat(n)},K=function(e,t){return(void 0===t&&(t=location.hostname),0===e.indexOf("/passport")||-1===t.indexOf("sso"))?e:"/passport/sso".concat(e)},Z="x-tt-passport-aid-sign",J=function(){return(J=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},X=function(e){var t=e.appKey,n=e.aid,i=e.host,r=new TextEncoder;return function(e){if(!t||!n)return Promise.resolve(e);try{var o=e.url,s=void 0===o?"":o;s=String(s).split("?")[0];var a=K(s,i),c=new Date,d=Date.UTC(c.getUTCFullYear(),c.getUTCMonth(),c.getUTCDate(),12,0,0,0),u=String(d/1e3),l=r.encode(u),v=r.encode(t),h=$(l,v,new Uint8Array,32),f=z(n,a,u),p=Y(h,f);return!e.headers&&(e.headers={}),e.headers[Z]=p,e.params=J({ts:u},e.params||{}),Promise.resolve(e)}catch(t){return Promise.resolve(e)}}},Q=function(){return function e(e){var t=e.autoTrace,n=void 0===t||t,i=e.traceInstance||new E({autoTrace:n}),r=(null==e?void 0:e.fetch)?V(e,i):A(e,i);return r.trace=i,r.interceptors.request.use(X(e)),r}}(),ee="1.2.10",et=function(e){var t,n;return function(){for(var i=[],r=0;r<arguments.length;r++)i[r]=arguments[r];return t?Promise.resolve(t):(!n&&(n=new Promise(function(r,o){e.apply(void 0,i).then(function(e){e&&(t=e),r(e),n=void 0}).catch(function(e){o(e),n=void 0})})),n)}},en=function(e,t){var n,i,r;return void 0===t&&(t=60),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var a=(null==o?void 0:o[0]).force;return(void 0!==a&&a&&(r=0),n&&r&&Date.now()-r<1e3*t)?Promise.resolve(n):(!i&&(i=new Promise(function(t,s){e.apply(void 0,o).then(function(e){e&&(n=e),r=Date.now(),t(e),i=void 0}).catch(function(e){s(e),i=void 0})})),i)}},ei=function(){var e=function(t,n){return(e=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(t,n)};return function(t,n){if("function"!=typeof n&&null!==n)throw TypeError("Class extends value "+String(n)+" is not a constructor or null");function i(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(i.prototype=n.prototype,new i)}}(),er=function(){return(er=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var r in t=arguments[n],t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e}).apply(this,arguments)},eo=function(e,t,n,i){function r(e){return e instanceof n?e:new n(function(t){t(e)})}return new(n||(n=Promise))(function(n,o){function s(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){e.done?n(e.value):r(e.value).then(s,a)}c((i=i.apply(e,t||[])).next())})},es=function(e,t){var n,i,r,o,s={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(e){return function(t){return c([e,t])}}function c(o){if(n)throw TypeError("Generator is already executing.");for(;s;)try{if(n=1,i&&(r=2&o[0]?i.return:o[0]?i.throw||((r=i.return)&&r.call(i),0):i.next)&&!(r=r.call(i,o[1])).done)return r;switch(i=0,r&&(o=[2&o[0],r.value]),o[0]){case 0:case 1:r=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(r=(r=s.trys).length>0&&r[r.length-1])&&(6===o[0]||2===o[0])){s=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]<r[3])){s.label=o[1];break}if(6===o[0]&&s.label<r[1]){s.label=r[1],r=o;break}if(r&&s.label<r[2]){s.label=r[2],s.ops.push(o);break}r[2]&&s.ops.pop(),s.trys.pop();continue}o=t.call(e,s)}catch(e){o=[6,e],i=0}finally{n=r=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}},ea=1200,ec="x-tt-verify-passport-decision",ed="/passport/safe/get_identity_security_token/",eu=function(e){function t(t){var n=e.call(this,"IdentitySecurityTokenError")||this;return n.name="IdentitySecurityTokenError",n.data=t,n}return ei(t,e),t}(Error),el=function(){function e(e){var t=this;this.expireTime=ea,this.errorCount=0,this.initSecureSdk=function(){return eo(t,void 0,void 0,function(){var e,t,i;return es(this,function(r){switch(r.label){case 0:if(!(null==window?void 0:window.secureSdk))return[3,1];return this.secureSdk=window.secureSdk,[3,3];case 1:return[4,Promise.resolve().then(n.bind(n,763218))];case 2:e=r.sent().SecureSDK,this.secureSdk=e,r.label=3;case 3:return null===(t=this.secureSdk)||void 0===t||t.setConfig({scene:"web_protect",consumerPathList:[ed],certType:"cookie",signVersion:2,excludeSetCachePathList:[ed]}),null===(i=this.secureSdk)||void 0===i||i.start(),[2]}})})},this.initSecondVerify=et(function(){return eo(t,void 0,void 0,function(){var e;return es(this,function(t){switch(t.label){case 0:return[4,n.e("76861").then(n.bind(n,291347))];case 1:return(e=t.sent().default).init(er({aid:this.initProps.aid,isNewVerifyUI:!0},this.secondVerifyInitProps||{})),[2,e.verify.bind(e)]}})})}),this.secondVerify=function(e){return eo(t,void 0,void 0,function(){var t,n,i;return es(this,function(r){switch(r.label){case 0:if(!e)return[2,!1];r.label=1;case 1:return r.trys.push([1,4,,5]),[4,this.initSecondVerify()];case 2:return t=r.sent(),[4,t(JSON.parse(e))];case 3:if(!(n=r.sent())||!n.status)return[2,!1];return[2,!0];case 4:return i=r.sent(),[2,!1];case 5:return[2]}})})},this.getIdentitySecurityTokenRequest=function(e){var n=e.scene,i=e.skip_verify,r=void 0!==i&&i,o=e.auto_retry_req,s=void 0===o?0:o,a=e.force,c=void 0!==a&&a;return eo(t,void 0,void 0,function(){var e,t,i,o,a,d,u,l,v,h;return es(this,function(f){switch(f.label){case 0:return f.trys.push([0,2,,3]),[4,this.request({url:ed,params:{scene:n||"default",auto_retry_req:s,skip_verify:r,identity_token_force_get_tag:c?1:0}})];case 1:if(null==(e=f.sent())?void 0:e.identity_security_token)return[2,{identity_security_param:JSON.stringify({token:null==e?void 0:e.identity_security_token}),real_device_id:null==e?void 0:e.device_id}];return[2,Promise.reject(new eu(er(er({},e),{error_code:-999})))];case 2:return i=(null===(u=null===(d=null==(t=f.sent())?void 0:t.rawData)||void 0===d?void 0:d.headers)||void 0===u?void 0:u["x-tt-verify-passport-decision"])?1:0,o=(null===(l=null==t?void 0:t.rawData)||void 0===l?void 0:l.isAxiosError)?1:0,a=(null===(h=null===(v=null==t?void 0:t.rawData)||void 0===v?void 0:v.headers)||void 0===h?void 0:h["x-tt-identity-zt-err"])?1:0,[2,Promise.reject(new eu(er(er({},t||{}),{need_verify:i,is_network_error:o,is_zti_timeout_error:a})))];case 3:return[2]}})})},this.getIdentitySecurityTokenWithCache=en(this.getIdentitySecurityTokenRequest,1200),this.getIdentitySecurityToken=function(e,n){return void 0===n&&(n=!1),new Promise(function(i,r){t.getIdentitySecurityTokenWithCache(er({force:t.errorCount>0||n},e||{})).then(function(e){return t.cacheErrData=null,t.errorCount=0,i(e)}).catch(function(n){return"cold_start"!==e.scene&&(t.errorCount=1),r(n)})})},this.expireTime=(null==e?void 0:e.expireTime)||ea,this.errorCount=0,this.cacheErrData=null,this.getIdentitySecurityTokenWithCache=en(this.getIdentitySecurityTokenRequest,this.expireTime),this.initProps=e,!("boolean"==typeof e.enableSecureSdk&&!1===e.enableSecureSdk)&&this.initSecureSdk(),this.secondVerifyInitProps=er(er({},e.secondVerifyInitProps),{aid:e.aid}),this.request=new Q(er(er({},e.requestConfig||{}),{aid:this.initProps.aid,generalParams:{id_token_version:ee},responseInterceptors:[function(e){return eo(t,void 0,void 0,function(){var t,n,i,r,o,s,a,c;return es(this,function(d){switch(d.label){case 0:if(d.trys.push([0,4,,5]),t=e.headers,o=null==(r=(null==(i=void 0===(n=e.config)?{}:n)?void 0:i.params)||{})?void 0:r.auto_retry_req,s=null==r?void 0:r.skip_verify,o||s)return[2,Promise.resolve(e)];if(!(null==t?void 0:t[ec]))return[3,3];return[4,this.secondVerify(null==t?void 0:t[ec])];case 1:if(!d.sent())return[3,3];return[4,this.request(er(er({},i),{params:er(er({},r),{auto_retry_req:1})}))];case 2:return[2,Promise.resolve(null==(a=d.sent())?void 0:a.rawData)];case 3:return[2,Promise.resolve(e)];case 4:return[2,Promise.resolve(null==(c=d.sent())?void 0:c.rawData)];case 5:return[2]}})})},function(e){return eo(t,void 0,void 0,function(){var t,n,i;return es(this,function(r){switch(r.label){case 0:if(r.trys.push([0,3,,4]),(null==(t=e.config.params||{})?void 0:t.auto_retry_req)||(null===(i=null==e?void 0:e.headers)||void 0===i?void 0:i[ec]))return[2,Promise.resolve(e)];if(!(e.isAxiosError||"success"!==e.data.message))return[3,2];return[4,this.request(er(er({},e.config),{params:er(er({},t),{auto_retry_req:1})}))];case 1:return[2,Promise.resolve(r.sent().rawData)];case 2:return[2,Promise.resolve(e)];case 3:return[2,Promise.resolve(null==(n=r.sent())?void 0:n.rawData)];case 4:return[2]}})})}]})),e.immediately&&this.getIdentitySecurityTokenWithCache({scene:"cold_start",skip_verify:!1}).catch(function(e){})}return e.instance=function(t){return!e._instance&&(e._instance=new e(t)),e._instance},e}()},405110:function(e,t,n){"use strict";n.d(t,{I7:function(){return d},O9:function(){return S},Bs:function(){return u},zn:function(){return x},_:function(){return i},HF:function(){return k},P6:function(){return o},uX:function(){return c},c5:function(){return f},v9:function(){return r},k5:function(){return _},rb:function(){return v},NI:function(){return p},Lk:function(){return l},b3:function(){return g},v$:function(){return h}});var i,r,o,s,a,c,d,u,l,v,h,f,p,g,m,y,x,_,b=n("720709");let I="1.1.3",C="Detached: 8aa2dcb88b41538885168e4afbbd2b6bac8aefb2",M="8aa2dcb",k={sdkVersion:I,refer:b.m.Refer.PC,buildNumber:`${M}:${C}`,wsProtocols:["binary","base64","pbbp2"],ticketType:b.m.TicketType.TICKET_TYPE_WEB,envKey:"X-Tt-Env",boeHeaderKey:"X-Use-Boe",ppeHeaderKey:"X-Use-Ppe",requestAccessName:"web_sdk",heartbeatInterval:15e3,maxHeartbeatEmptyWindow:3e4,conversationRefreshCount:10};!function(e){e[e.Default=0]="Default",e[e.PushOnly=1]="PushOnly",e[e.All=2]="All",e[e.Disable=3]="Disable"}(i||(i={})),!function(e){e.MessageMode="s:mode",e.SendResponseStatus="s:send_response_status",e.SendResponseExtraInfo="s:send_response_extra_info",e.SendResponseCheckCode="s:send_response_check_code",e.SendResponseCheckMessage="s:send_response_check_msg",e.ClientMessageId="s:client_message_id",e.MentionedUser="s:mentioned_users",e.DoNotIncreaseUnread="s:do_not_increase_unread",e.DoNotPopConversation="s:do_not_pop_conversation",e.IsRecalled="s:is_recalled",e.ServerMessageId="s:server_message_id",e.LocalLogId="s:local_logid",e.MessageVisible="s:visible",e.MessageInvisible="s:invisible",e.RelationIsMuted="s:relation_is_muted",e.RelationIsMutedServer="s:relation_is_muted_server",e.RelationNormalOnly="s:relation_normal_only",e.RelationMuteTime="s:relation_mute_time",e.RelationMuteExt="s:relation_mute_ext",e.MessageSourceAppId="s:biz_aid",e.ConversationSourceAppId="s:s_aid",e.MarkActionType="s:action_type",e.IsRootReference="s:is_root_ref",e.MarkMessageNewExt="s:mark_message_new_ext",e.AckSampling="s:is_ack_sampling",e.AckSamplingShow="s:is_ack_sampling_show",e.DoNotUpdateLastMessage="s:do_not_update_last_msg",e.DoNotMoveReadIndex="s:do_not_move_read_index",e.FileExtKeyAudioAsrText="s:file_ext_key_audio_asr_text",e.RecognitionResponseCheckCode="s:recognition_response_check_code",e.RecognitionResponseCheckMsg="s:recognition_response_check_msg",e.PushPartDisableConfig="s:push_part_disable_config",e.MustNotify="s:must_notify",e.SendTime="s:stime",e.ConversationTags="s:conversation_tag",e.UserCustomConversationTags="s:user_custom_conversation_tag",e.EditInfo="s:edit_info",e.RefContent="s:ref_content",e.RefIsEdited="s:ref_is_edited"}(r||(r={}));let S="mute_wl";!function(e){e[e.Enable=0]="Enable",e[e.Disable=1]="Disable"}(o||(o={})),!function(e){e[e.SingleChat=1]="SingleChat",e[e.GroupChat=2]="GroupChat",e[e.LiveChat=3]="LiveChat"}(s||(s={})),!function(e){e[e.Normal=0]="Normal",e[e.Dissolved=1]="Dissolved"}(a||(a={})),!function(e){e[e.Off=0]="Off",e[e.On=1]="On"}(c||(c={})),!function(e){e[e.Off=0]="Off",e[e.On=1]="On"}(d||(d={})),!function(e){e[e.Unknown=0]="Unknown",e[e.Allow=1]="Allow",e[e.Disable=2]="Disable",e[e.PartAllow=3]="PartAllow"}(u||(u={})),!function(e){e[e.Off=0]="Off",e[e.On=1]="On"}(l||(l={})),!function(e){e[e.NotAvailable=0]="NotAvailable",e[e.Start=1]="Start",e[e.Error=2]="Error",e[e.Succeeded=3]="Succeeded"}(v||(v={})),!function(e){e[e.Unknown=0]="Unknown",e[e.Online=1]="Online",e[e.LoadMore=2]="LoadMore",e[e.Init=3]="Init",e[e.UserInbox=4]="UserInbox",e[e.BroadcastLoadMore=5]="BroadcastLoadMore",e[e.Offline=6]="Offline"}(h||(h={})),!function(e){e.Error="error",e.WebSocketConnected="websocket-connected",e.WebSocketDisconnected="websocket-disconnected",e.WebSocketReceiveUnexpectedFrame="websocket-receive-unexpected-frame",e.ReceiveNewMessage="receive-new-message",e.ReceiveSelfMessage="receive-self-message",e.ReceiveCommandMessage="receive-command-message",e.ReceiveBroadcastNewMessage="receive-broadcast-new-message",e.ReceiveBroadcastSelfMessage="receive-broadcast-self-message",e.ReceiveNewUpdateExtMessage="receive-new-update-ext-message",e.ReceiveNewP2PMessage="receive-new-p2p-message",e.MessageUpsert="message-upsert",e.ConversationChange="conversation-change",e.ConversationUpsert="conversation-upsert",e.ConversationDissolve="conversation-dissolve",e.ConversationBlock="conversation-block",e.ParticipantUpsert="participant-upsert",e.ParticipantJoin="participant-join",e.ParticipantLeave="participant-leave",e.ParticipantBlock="participant-block",e.ParticipantChange="participant-change",e.MessageSend="message-send",e.MessageRecall="message-recall",e.MessageDelete="message-delete",e.ConversationDelete="conversation-delete",e.ConversationLeave="conversation-leave",e.ConversationCreate="conversation-create",e.ConversationJoin="conversation-join",e.ReadReceiptChange="read-receipt-Change",e.ReceiveNewStrangerMessage="receive-new-stranger-message",e.StrangerUpgrade="stranger-upgrade",e.MessagePropertyUpsert="message-property-upsert",e.InitLoadPage="init-load-page",e.InitFinish="init-finish",e.InitParticipant="init-participant",e.TagListUpdate="tag-list-update"}(f||(f={})),!function(e){e[e.Unknown=-1]="Unknown",e[e.Success=0]="Success",e[e.InvalidToken=1]="InvalidToken",e[e.InvalidTicket=2]="InvalidTicket",e[e.InvalidRequest=4]="InvalidRequest",e[e.InvalidCommand=5]="InvalidCommand",e[e.ServerError=6]="ServerError",e[e.UserForbidden=11]="UserForbidden",e[e.MessageTargetConversationNotExist=15]="MessageTargetConversationNotExist",e[e.Degradation=16]="Degradation",e[e.RecallTimeout=17]="RecallTimeout",e[e.CallbackDeny=19]="CallbackDeny",e[e.ExpiredToken=100]="ExpiredToken",e[e.InvalidParam=400]="InvalidParam",e[e.ResourceExhausted=429]="ResourceExhausted",e[e.InternalError=500]="InternalError",e[e.InvalidInboxType=1e3]="InvalidInboxType",e[e.ConversationNotExist=1001]="ConversationNotExist",e[e.MessageNotExist=1002]="MessageNotExist",e[e.MessageOffline=1003]="MessageOffline",e[e.UnknownMessageType=1004]="UnknownMessageType",e[e.InvalidServerId=1005]="InvalidServerId",e[e.MessageNotReady=1006]="MessageNotReady",e[e.TokenFuncError=1007]="TokenFuncError",e[e.NetworkError=1008]="NetworkError",e[e.AlreadyDispose=1009]="AlreadyDispose",e[e.NoAdapter=1010]="NoAdapter",e[e.ComponentNotFound=1011]="ComponentNotFound",e[e.NotImplemented=1012]="NotImplemented",e[e.MPInvalidArgument=10001]="MPInvalidArgument",e[e.MPServerUrlError=10002]="MPServerUrlError",e[e.MPNotFileMsg=10003]="MPNotFileMsg",e[e.MPUploadError=10004]="MPUploadError",e[e.MPNotSupportCipher=10005]="MPNotSupportCipher",e[e.DbOpError=2e4]="DbOpError",e[e.StorageCryptoError=20001]="StorageCryptoError",e[e.AuthSignError=10201]="AuthSignError"}(p||(p={})),!function(e){e[e.Created=0]="Created",e[e.Preparing=1]="Preparing",e[e.Inflight=2]="Inflight",e[e.Succeeded=3]="Succeeded",e[e.Received=4]="Received",e[e.Failed=-1]="Failed",e[e.Rejected=-2]="Rejected",e[e.SelfVisible=-3]="SelfVisible"}(g||(g={})),!function(e){e[e.Succeeded=0]="Succeeded",e[e.UserNotInConversation=1]="UserNotInConversation",e[e.CheckConversationNotPass=2]="CheckConversationNotPass",e[e.CheckMessageNotPass=3]="CheckMessageNotPass",e[e.CheckMessageNotPassButSelfVisible=4]="CheckMessageNotPassButSelfVisible",e[e.UserHasBeenBlock=5]="UserHasBeenBlock"}(m||(m={})),!function(e){e[e.Succeeded=0]="Succeeded",e[e.Rejected=1]="Rejected",e[e.PartialRejected=2]="PartialRejected"}(y||(y={})),!function(e){e[e.Immediate=0]="Immediate",e[e.Throttle=1]="Throttle",e[e.Debounce=2]="Debounce",e[e.ThrottleWithArgs=3]="ThrottleWithArgs",e[e.DebounceWithArgs=4]="DebounceWithArgs"}(x||(x={})),!function(e){e[e.Default=0]="Default",e[e.AwemeMode=1]="AwemeMode"}(_||(_={}))},742365:function(e,t,n){"use strict";n.d(t,{G:function(){return a}});var i=n(405110),r=n(125415),o=n(586037),s=n(694253);class a extends Error{constructor(e){var t,n,c,d;super(`${e&&e.logid?`[${e.logid}] `:""}${e&&e.msg?'message: "'+e.msg+'"':""}${e&&e.innerError?`, inner error: "${e.innerError}"`:""}`),this.ctx=e.ctx,Object.assign(this,e),Object.setPrototypeOf(this,a.prototype),(null===(t=this.innerError)||void 0===t?void 0:t.logid)&&(this.logid=this.innerError.logid);try{"string"==typeof(null===(n=this.innerError)||void 0===n?void 0:n.stack)&&(this.stack=this.innerError.stack+"\n"+(null===(c=this.stack)||void 0===c?void 0:c.split("\n").slice(2).join("\n")))}catch(e){r.Y.ctxWarn(this.ctx,`concat trace fail=${e}, current stack=${this.stack}, inner stack=${null===(d=this.innerError)||void 0===d?void 0:d.stack}`)}if(!this.ctx)return;!e.ignoreEvent&&this.resolve(s.Uk.EventBus).emit(i.c5.Error,e.sender,this),this.resolve(s.Uk.Monitor).emitError(this),this.resolve(s.Uk.Monitor).emitCounter(o.U.BizSdkError,1,{type:e.type?`${e.type}:${i.NI[e.type]}`:"unknown"})}getContext(){return this.ctx}resolve(e){return this.ctx.resolve(e)}}},125415:function(e,t,n){"use strict";n.d(t,{Y:function(){return a},h:function(){return i}});var i,r=n(694253);!function(e){e[e.debug=0]="debug",e[e.info=1]="info",e[e.warn=2]="warn",e[e.error=3]="error",e[e.none=4]="none"}(i||(i={}));let o={[i.info]:"#1890ff",[i.debug]:"#19be6b",[i.warn]:"#ff9900",[i.error]:"#ed4014"},s={debug:i.debug,info:i.info,warn:i.warn,error:i.error,none:i.none};class a{static get isBrowser(){return"undefined"!=typeof navigator}static log(e,t,...n){if(t&&t.resolve(r.Uk.Monitor).emitLog(s[e],n),!!(null==t?void 0:t.option.debug)&&"none"!==e)this.level<=i[e]&&(t&&r.hi.Instance.instanceCount>1?a.isBrowser?console[e](`%c [Byted IM SDK][${t.id}] [${e}]:`,`color: ${o[i[e]]}; font-weight: 700`,...n):console[e](`[Byted IM SDK][${t.id}] [${e}]:`,...n):a.isBrowser?console[e](`%c [Byted IM SDK] [${e}]:`,`color: ${o[i[e]]}; font-weight: 700`,...n):console[e](`[Byted IM SDK] [${e}]:`,...n))}static debug(...e){this.log("debug",void 0,...e)}static info(...e){this.log("info",void 0,...e)}static warn(...e){this.log("warn",void 0,...e)}static error(...e){this.log("error",void 0,...e)}static ctxDebug(e,...t){this.log("debug",e,...t)}static ctxInfo(e,...t){this.log("info",e,...t)}static ctxWarn(e,...t){this.log("warn",e,...t)}static ctxError(e,...t){this.log("error",e,...t)}}a.level=i.debug},586037:function(e,t,n){"use strict";n.d(t,{U:function(){return i},u:function(){return s}});var i,r=n(405110),o=n(694253);!function(e){e.CreateConversation="create.conv",e.SendMessage="send.msg",e.ReceiveMessage="receive.msg",e.WsConnect="ws.connect",e.NetworkRequest="network.request",e.FrontierOpen="frontier.open",e.FrontierClose="frontier.close",e.FrontierError="frontier.error",e.FrontierReceive="frontier.receive",e.FrontierLive="frontier.live",e.WebSocketConnectFirst="ws.connect.first",e.WebSocketConnectAfterClose="ws.connect.afterclose",e.WebSocketConnectNoHeartbeat="ws.connect.noheartbeat",e.BizApiInvoke="api.invoke",e.MessageAck="message.ack",e.SuccessSuffix=".success",e.ErrorSuffix=".error",e.BizSdkInit="init",e.BizRefreshToken="refresh.token",e.BizSdkError="error",e.GetMessagesByConversation="message.get.byconversation",e.GetMessagesByTicker="message.get.ticker"}(i||(i={}));class s extends o.mA{static get avgDelta(){return 0===this.putDeltaTimes?0:this.totalDelta/this.putDeltaTimes}static putTimeDelta(e,t,n,i){if(void 0===n||void 0===i)return;let r=(t-e-(n-i))/2+e,o=i-r;s.putDeltaTimes++,s.totalDelta+=o}get avgDelta(){return s.avgDelta}static performanceNow(){return"object"==typeof performance&&"function"==typeof performance.now&&"number"==typeof performance.timeOrigin?performance.now()+performance.timeOrigin:Date.now()}invoke(e,...t){if(void 0===this.ctx.option.monitor)return!1;let n=this.ctx.option.monitor;!Array.isArray(n)&&(n=[n]),n.forEach(n=>{let i=n[e];return"function"==typeof i&&setTimeout(()=>{i.apply(n,t)},0)})}fillKv(e){let t=Object.assign(Object.assign(Object.assign({},e),this.ctx.option.monitorTagKv),{sdk_version:r.HF.sdkVersion,sdk_type:this.ctx.option.sdkType||"im-web-sdk",build_number:r.HF.buildNumber,app_id:this.ctx.option.appId.toString(),user_id:this.ctx.option.userId});return this.ctx.option.versionCode&&(t.version_code=this.ctx.option.versionCode),t}emitMetrics(e,t={},n={}){let i=`imsdk.${e}`;this.invoke("emitMetrics",i,t,this.fillKv(n))}emitCounter(e,t=1,n={}){if(0===t)return;let i=`imsdk.${e}`;this.invoke("emitMetrics",i,{count:t},this.fillKv(n))}emitDuration(e,t,n={}){let i=s.performanceNow()-t,r=`imsdk.${e}`;return this.invoke("emitMetrics",r,{duration:i},this.fillKv(n)),i}emitLatencyDuration(e,t,n={}){let i=this.ctx.option.timeCalibration?this.avgDelta:0,r=s.performanceNow()+i-t;if(!(r<0))this.invoke("emitMetrics",e,{duration:r},this.fillKv(n))}emitError(e){this.invoke("emitError",e,this.fillKv({}))}emitNetwork(e,t,n={}){this.invoke("emitNetwork",e,t,this.fillKv(n))}emitEvent(e,t,n){this.invoke("emitEvent",e,t,n)}emitLog(e,...t){this.invoke("emitLog",e,t[0])}emitTracker(e,t){this.invoke("emitTracker",e,this.fillKv(t))}}s.putDeltaTimes=0,s.totalDelta=0},736114:function(e,t,n){"use strict";var i;n.d(t,{W:function(){return i}}),!function(e){e.MultimediaMessageUpload="imsdk_upload_msg",e.InitHandler="imsdk_init_handler",e.Exception="imsdk_exception",e.SaveMessageError="imsdk_save_msg_error",e.MessageAck="imsdk_message_ack"}(i||(i={}))},491326:function(e,t,n){"use strict";n.d(t,{r:function(){return h}});var i=n(361073),r=n(720709),o=n(405110),s=n(629552),a=n(878042),c=n(721078),d=n.n(c),u=n(125415),l=n(694253),v=n(730512);class h extends l.mA{constructor(){super(...arguments),this.isMember=!0,this._badgeCount=0,this.muteBadgeCountInfos=[],this.__internal_pullCursor=i.MAX_VALUE,this.cacheUnreadCountCalc=void 0,this.cacheUnreadCountWithWhiteListCalc=void 0}get type(){return 15&this.bizType}set type(e){this.bizType=e}get inboxType(){return this.coreInfo.inboxType}mergeMuteBadgeCountInfos(e){if(!!e)e.forEach(e=>{let t=this.muteBadgeCountInfos.findIndex(t=>t.message_type===e.message_type);t>-1?this.muteBadgeCountInfos[t]=e:this.muteBadgeCountInfos.push(e)})}get badgeCount(){return this._badgeCount}set badgeCount(e){if(void 0!==e){if(void 0===this._badgeCount){this._badgeCount=e;return}e>this._badgeCount&&(this._badgeCount=e)}}get partMuteBadgeCount(){var e,t,n,i;return null!==(i=null===(n=null===(t=null===(e=this.muteBadgeCountInfos)||void 0===e?void 0:e.find)||void 0===t?void 0:t.call(e,e=>e.message_type===r.m.MuteMessageType.TYPE_PART_MUTE))||void 0===n?void 0:n.badge_count)&&void 0!==i?i:0}get mode(){return 0}get isStrangerConversation(){return 0!==this.mode}get isMuted(){return this.pushStatus!==o.Bs.Unknown?this.pushStatus===o.Bs.Disable:void 0!==this.settingInfo&&this.settingInfo.mute===o.I7.On}get pushStatus(){var e;return null!==(e=this.settingInfo.pushStatus)&&void 0!==e?e:o.Bs.Unknown}get weakMuteInfo(){return this.settingInfo.weakMuteInfo}get isStickOnTop(){return void 0!==this.settingInfo&&this.settingInfo.stickTop===o.uX.On}get isFavorite(){return void 0!==this.settingInfo&&this.settingInfo.favor===o.Lk.On}get ext(){let e={};return this.coreInfo&&this.coreInfo.ext&&(e=Object.assign(e,this.coreInfo.ext)),this.settingInfo&&this.settingInfo.ext&&(e=Object.assign(e,this.settingInfo.ext)),e}get rankScore(){var e,t,n,r,o;return this.isStickOnTop?(null!==(e=this.settingInfo.setTopTime)&&void 0!==e?e:i.ZERO).add(8e15).toNumber():null!==(o=null===(r=null===(n=null===(t=this.lastPopVisibleMessage)||void 0===t?void 0:t.createdAt)||void 0===n?void 0:n.getTime)||void 0===r?void 0:r.call(n))&&void 0!==o?o:-1}get lastMessage(){return this.filterLastMessage()}get lastVisibleMessage(){return this.filterLastMessage(e=>e.visible)}get lastPopVisibleMessage(){return this.filterLastMessage(e=>!e.unpop)}get firstMessage(){return this.filterFirstMessage()}get readIndex(){return this.settingInfo.readIndex}get readIndexV2(){return this.settingInfo.readIndexV2}get minIndex(){return this.settingInfo.minIndex}get version(){return this.coreInfo.version}get unreadCount(){return this.ctx.option.useBadgeCountForUnread&&this.settingInfo.readBadgeCount?this.unreadCountFromReadBadge:this.unreadCountFromReadIndex}get unreadCountFromReadBadge(){return Math.max(this.badgeCount-this.settingInfo.readBadgeCount,0)}get unreadCountFromReadIndex(){var e,t,n;return void 0===this.cacheUnreadCountCalc&&(this.cacheUnreadCountCalc=d()(e=>this.unreadMessageList.length,{maxSize:1})),this.cacheUnreadCountCalc(`${null===(t=null===(e=this.updatedAt)||void 0===e?void 0:e.getTime)||void 0===t?void 0:t.call(e)}:${null===(n=this.readIndex)||void 0===n?void 0:n.toString()}`)}get unreadCountWithWhiteList(){return this.ctx.option.useBadgeCountForUnread&&this.settingInfo.partMuteReadBadgeCount?this.unreadCountWithWhiteListFromReadBadge:this.unreadCountWithWhiteListFromReadIndex}get unreadCountWithWhiteListFromReadBadge(){return Math.max(this.partMuteBadgeCount-this.settingInfo.partMuteReadBadgeCount,0)}get unreadCountWithWhiteListFromReadIndex(){var e,t,n;return void 0===this.cacheUnreadCountWithWhiteListCalc&&(this.cacheUnreadCountWithWhiteListCalc=d()(e=>this.unreadMessageListWithWhiteList.length,{maxSize:1})),this.cacheUnreadCountWithWhiteListCalc(`${null===(t=null===(e=this.updatedAt)||void 0===e?void 0:e.getTime)||void 0===t?void 0:t.call(e)}:${null===(n=this.readIndex)||void 0===n?void 0:n.toString()}`)}forceRefreshUnreadCount(){var e;let t=this.unreadMessageList.length;t!==this.unreadCount&&void 0!==this.cacheUnreadCountCalc&&void 0!==this.cacheUnreadCountCalc.clear&&(u.Y.ctxDebug(this.ctx,`force refresh unread count: ${this.id}, value: ${t}`),null===(e=this.cacheUnreadCountCalc)||void 0===e||e.clear())}get unreadMessageList(){return this.readIndex?this.resolve(l.Uk.MessageManager).getList(this.id).filter(e=>e.indexInConversation.gt(this.readIndex)&&e.indexInConversation.gt(this.minIndex)&&e.increaseUnread):[]}get unreadMessageListWithWhiteList(){return this.unreadMessageList.filter(e=>this.isMsgInWeakMuteWhiteList(e))}isMsgInWeakMuteWhiteList(e){var t,n,i;return(null===(t=e.ext)||void 0===t?void 0:t[o.v9.MustNotify])||(null===(n=this.settingInfo.weakMuteInfo.whiteUids)||void 0===n?void 0:n.find(t=>t.toString()===e.sender))||(null===(i=this.settingInfo.weakMuteInfo.whiteMsgTypes)||void 0===i?void 0:i.find(t=>t===e.type))}getLocalMessageRangeList(e,t){return this.resolve(l.Uk.MessageManager).getList(this.id).filter(n=>n.indexInConversation.lte(t)&&n.indexInConversation.gt(e)&&n.indexInConversation.gt(this.minIndex)&&n.increaseUnread)}get updatedAt(){return this.lastMessage?this.lastMessage.createdAt:new Date(0)}get firstMessageIndex(){var e,t;return null!==(t=null===(e=this.filterFirstMessage(e=>e.indexInConversation&&e.indexInConversation.gt(0)))||void 0===e?void 0:e.indexInConversation)&&void 0!==t?t:i.ZERO}get lastMessageIndex(){var e,t;return null!==(t=null===(e=this.filterLastMessage(e=>e.indexInConversation&&e.indexInConversation.gt(0)))||void 0===e?void 0:e.indexInConversation)&&void 0!==t?t:i.ZERO}get lastMessageIndexV2(){var e,t;return null!==(t=null===(e=this.filterLastMessage(e=>e.indexInConversation&&e.indexInConversation.gt(0)))||void 0===e?void 0:e.indexInConversationV2)&&void 0!==t?t:i.ZERO}get lastMessageOrder(){var e,t;return null!==(t=null===(e=this.filterLastMessage(e=>e.orderInConversation&&e.orderInConversation.gt(0)))||void 0===e?void 0:e.orderInConversation)&&void 0!==t?t:i.ZERO}getMessageList(e=e=>e.visible){return this.resolve(l.Uk.MessageManager).getList(this.id).filter(e)}getParticipantList(){return this.resolve(l.Uk.ParticipantManager).get(this.id)}get toParticipantUserId(){if(this.type===r.m.ConversationType.GROUP_CHAT)return;let e=this.id.split(":");return e[2]===this.ctx.option.userId?e[3]:e[2]}get isBlocked(){return(0,v.vP)(this.ext,o.v9.RelationIsMuted)}get isServerBlocked(){return(0,v.vP)(this.ext,o.v9.RelationIsMutedServer)}get isBlockNormalOnly(){return this.isBlocked&&(0,v.vP)(this.ext,o.v9.RelationNormalOnly)}get tagIds(){let e=this.ext[o.v9.ConversationTags]||"";return""===e?[]:e.split(",")}get userTagIds(){let e=this.ext[o.v9.UserCustomConversationTags]||"";return""===e?[]:e.split(",")}static fromServerConversation(e,t,n){var i;let r=new h(e);r.id=t.conversation_id,r.shortId=t.conversation_short_id.toString(),r.type=t.conversation_type,r.ticket=t.ticket,r.participantCount=t.participants_count,r.isMember=t.is_participant,r.isOffline=!1,r.firstPageParticipant=t.first_page_participants,r.badgeCount=t.badge_count,r.muteBadgeCountInfos=null!==(i=t.mute_badge_count_infos)&&void 0!==i?i:[],r.coreInfo=new s._(r,t.conversation_core_info),r.settingInfo=new a.H(r,t.conversation_setting_info);let c=Object.keys(r.coreInfo.ext);for(let e of Object.keys(r.settingInfo.ext))c.includes(e)&&u.Y.ctxDebug(r.ctx,`conversation: ${r.shortId} ext duplicate key: ${e}`);return void 0!==n&&r.ctx.option.debug&&(r.coreInfo.ext[o.v9.LocalLogId]=n),r}filterLastMessage(e){let t=this.getMessageList(()=>!0),n=null;if(0===t.length)return null;if(void 0===e)return t[t.length-1];for(let i=t.length-1;i>=0;i--)if(e(t[i])){n=t[i];break}return n}filterFirstMessage(e){let t=this.getMessageList(()=>!0),n=null;if(0===t.length)return null;if(void 0===e)return t[0];for(let i of t)if(e(i)){n=i;break}return n}}},629552:function(e,t,n){"use strict";n.d(t,{_:function(){return s}});var i=n(361073),r=n(125415),o=n(694253);class s extends o.mA{constructor(e,t){var n,r;super(e.ctx),this.version=i.ZERO,this.parent=e,void 0!==t&&(this.desc=t.desc,this.ext=t.ext,this.icon=t.icon,this.name=t.name,this.notice=t.notice,this.owner=null!==(r=null===(n=t.owner)||void 0===n?void 0:n.toString())&&void 0!==r?r:"",this.version=t.info_version,this.secOwner=t.sec_owner,this.inboxType=t.inbox_type),void 0===this.inboxType&&(this.inboxType=this.resolve(o.Uk.InboxType).getDefaultInboxWithoutCheck())}get conversationId(){return this.parent.id}get ext(){return!this.innerExt&&(this.innerExt={}),this.innerExt}set ext(e){this.innerExt=null!=e?e:{}}mergeCore(e){return e.version.lt(this.version)?(r.Y.ctxDebug(this.ctx,"core info version local > online, local: ",this.version.toString(),"new: ",e.version.toString()),this):e.conversationId!==this.conversationId?(r.Y.ctxDebug(this.ctx,"core info conversation not match, local:",this.conversationId.toString(),"new: ",e.conversationId.toString()),this):(this.version=e.version,this.name=e.name,this.desc=e.desc,this.icon=e.icon,this.notice=e.notice,this.owner=e.owner,this.secOwner=e.owner,this.innerExt=Object.assign(Object.assign({},this.innerExt),e.innerExt),this.inboxType=e.inboxType,this)}}},878042:function(e,t,n){"use strict";n.d(t,{H:function(){return d}});var i=n(361073),r=n(125415),o=n(720709),s=n(405110),a=n(694253),c=n(211849);class d extends a.mA{constructor(e,t){var n,r;super(e.ctx),this.version=i.ZERO,this._pushStatus=s.Bs.Allow,this.minIndex=i.ZERO,this._readIndex=i.ZERO,this._readIndexV2=i.ZERO,this._readBadgeCount=0,this.muteReadBadgeCountInfos=[],this.parent=e,void 0!==t&&(this.ext=t.ext,this.favor=t.favorite,this.mute=t.mute,this.stickTop=t.stick_on_top,this.version=i.fromValue(null!==(n=t.setting_version)&&void 0!==n?n:i.ZERO),this.readIndex=t.read_index,this.readIndexV2=t.read_index_v2,this.minIndex=t.min_index,this.setFavoriteTime=t.set_favorite_time,this.setTopTime=t.set_top_time,this.pushStatus=t.push_status,this.readBadgeCount=t.read_badge_count,this.mergeMuteReadBadgeCountInfos(null!==(r=t.mute_read_badge_count_infos)&&void 0!==r?r:[]))}get conversationId(){return this.parent.id}get pushStatus(){return this._pushStatus}set pushStatus(e){[s.Bs.Allow,s.Bs.PartAllow,s.Bs.Disable].includes(e)?this._pushStatus=e:this._pushStatus=s.Bs.Unknown}get readIndex(){return this._readIndex}set readIndex(e){if(void 0===e)return;let t=i.fromValue(e);if(void 0===this._readIndex){this._readIndex=t;return}t.gt(this._readIndex)&&(this._readIndex=t)}get readIndexV2(){return this._readIndexV2}set readIndexV2(e){if(void 0===e)return;let t=i.fromValue(e);if(void 0===this._readIndexV2){this._readIndexV2=t;return}t.gt(this._readIndex)&&(this._readIndexV2=t)}get readBadgeCount(){return this._readBadgeCount}set readBadgeCount(e){if(void 0!==e){if(this.parent.badgeCount&&e>this.parent.badgeCount&&(e=this.parent.badgeCount),void 0===this._readBadgeCount){this._readBadgeCount=e;return}e>this._readBadgeCount&&(this._readBadgeCount=e)}}mergeMuteReadBadgeCountInfos(e){if(!!e)e.forEach(e=>{let t=this.muteReadBadgeCountInfos.findIndex(t=>t.message_type===e.message_type);t>-1?this.muteReadBadgeCountInfos[t]=e:this.muteReadBadgeCountInfos.push(e)})}get partMuteReadBadgeCount(){var e,t,n,i;return null!==(i=null===(n=null===(t=null===(e=this.muteReadBadgeCountInfos)||void 0===e?void 0:e.find)||void 0===t?void 0:t.call(e,e=>e.message_type===o.m.MuteMessageType.TYPE_PART_MUTE))||void 0===n?void 0:n.read_badge_count)&&void 0!==i?i:0}get ext(){return!this.innerExt&&(this.innerExt={}),this.innerExt}set ext(e){this.innerExt=null!=e?e:{}}mergeSetting(e){return e.version.lt(this.version)?(r.Y.ctxDebug(this.ctx,"setting info version local > online, local: ",this.version.toString(),"new: ",e.version.toString()),this):e.conversationId!==this.conversationId?(r.Y.ctxDebug(this.ctx,"setting info conversation not match, local:",this.conversationId.toString(),"new: ",e.conversationId.toString()),this):(this.stickTop=e.stickTop,this.setTopTime=e.setTopTime,this.mute=e.mute,this.favor=e.favor,this.setFavoriteTime=e.setFavoriteTime,this.innerExt=Object.assign(Object.assign({},this.innerExt),e.ext),this.readIndex=e.readIndex,this.readIndexV2=e.readIndexV2,this.minIndex=e.minIndex,this.version=e.version,this.pushStatus=e.pushStatus,this.readBadgeCount=e.readBadgeCount,this.mergeMuteReadBadgeCountInfos(e.muteReadBadgeCountInfos),this)}get weakMuteInfo(){var e,t,n;let o={whiteUids:[],whiteMsgTypes:[]};if(!this.innerExt[s.v9.PushPartDisableConfig])return o;try{let r=c.parse(this.innerExt[s.v9.PushPartDisableConfig]),o=null==r?void 0:r[s.O9],a=null!==(t=null===(e=null==o?void 0:o.white_uids)||void 0===e?void 0:e.map(i.fromValue))&&void 0!==t?t:[],d=null!==(n=null==o?void 0:o.white_msg_types)&&void 0!==n?n:[];return{whiteUids:a,whiteMsgTypes:d}}catch(e){return r.Y.ctxWarn(this.ctx,"conversation setting weak mute info parse error: ",e),o}}}},461352:function(e,t,n){"use strict";n.d(t,{R:function(){return i},v:function(){return l}});var i,r=n(361073),o=n(125415),s=n(405110),a=n(720709),c=n(694253),d=n(730512),u=n(211849);!function(e){e[e.Sending=0]="Sending",e[e.Success=1]="Success",e[e.Failed=2]="Failed"}(i||(i={}));class l extends c.mA{constructor(){super(...arguments),this.indexInConversation=r.ZERO,this.indexInConversationV2=r.ZERO,this.orderInConversation=r.ZERO,this.property={},this.source=s.v$.Unknown}get conversationType(){return 15&this.conversationBizType}set conversationType(e){this.conversationBizType=e}get clientId(){var e;return this.ext?null!==(e=this.ext[s.v9.ClientMessageId])&&void 0!==e?e:"":""}set clientId(e){!this.ext&&(this.ext={}),this.ext[s.v9.ClientMessageId]=e}static createClientMessage(e,t){var n;let i=new l(e);i.conversationId=t.conversationId,i.type=t.type,i.conversationType=t.conversationType,i.conversationShortId=t.conversationShortId,i.sender=e.option.userId,i.content=t.content,i.createdAt=new Date(Date.now());let c=Object.assign({},t.ext);for(let e of Object.keys(c))e.startsWith("s:")&&(o.Y.ctxDebug(i.ctx,`delete s: prefix ext key: '${e}: ${c[e]}'`),delete c[e]);if(i.ext=c,i.mentionedUsers=t.mentionedUsers,i.clientId=t.id,i.version=r.ZERO,i.serverStatus=s.P6.Enable,i.isOffline=!0,t.referenceMessage){let e=a.m.MessageStatus.AVAILABLE;t.referenceMessage.isRecalled?e=a.m.MessageStatus.RECALLED:!t.referenceMessage.visible&&(e=a.m.MessageStatus.INVISIBLE),i.referenceInfo={referenced_message_id:r.fromValue(t.referenceMessage.serverId),hint:null!==(n=t.referenceHint)&&void 0!==n?n:"",ref_message_type:r.fromValue(t.referenceMessage.type),referenced_message_status:e,ext:{[s.v9.RefContent]:t.referenceMessage.content,[s.v9.RefIsEdited]:String(t.referenceMessage.isEdited)}},void 0!==t.referenceMessage.referenceInfo?(i.referenceInfo.root_message_id=t.referenceMessage.referenceInfo.root_message_id,i.referenceInfo.root_message_conv_index=t.referenceMessage.referenceInfo.root_message_conv_index):(i.referenceInfo.root_message_id=r.fromValue(t.referenceMessage.serverId),i.referenceInfo.root_message_conv_index=t.referenceMessage.indexInConversation)}return i.ctx.option.secUid&&(i.secSender=i.ctx.option.secUid),i}static fromServerMessage(e,t,n){var i;let o=new l(e);return o.serverId=t.server_message_id.toString(),o.type=t.message_type,o.ext=Object.assign({},t.ext),o.conversationId=t.conversation_id,o.content=t.content,o.sender=t.sender.toString(),o.createdAt=new Date(t.create_time.toNumber()),o.indexInConversation=t.index_in_conversation,o.indexInConversationV2=null!==(i=t.index_in_conversation_v2)&&void 0!==i?i:r.ZERO,o.orderInConversation=t.order_in_conversation,o.serverStatus=t.status,o.conversationShortId=t.conversation_short_id.toString(),o.conversationType=t.conversation_type,o.version=t.version,o.secSender=t.sec_sender,o.isOffline=!1,o.property=l.fromServerProperty(t),t.reference_info&&(o.referenceInfo=t.reference_info),void 0!==n&&o.ctx.option.debug&&(o.ext[s.v9.LocalLogId]=n),o}static fromServerProperty(e){let t={};if(!e.property_list)return t;for(let n of Object.keys(e.property_list)){let r=e.property_list[n];r&&r.Items&&(t[n]=r.Items.map(t=>{var r,o,a,c,d;return{messageId:null!==(r=e.ext[s.v9.ClientMessageId])&&void 0!==r?r:"",conversationId:e.conversation_id,key:n,userId:null===(o=t.uid)||void 0===o?void 0:o.toString(),secUid:null!==(a=t.sec_uid)&&void 0!==a?a:"",createTime:new Date((null!==(d=null===(c=t.create_time)||void 0===c?void 0:c.toNumber())&&void 0!==d?d:0)*1e3),idempotentId:t.idempotent_id,value:t.value,version:e.version,status:i.Success}}))}return t}merge(e){if(e&&this.type===e.type){if(e.ext=Object.assign(this.ext||{},e.ext),""===e.content&&this.content&&(o.Y.ctxDebug(this.ctx,"ignore empty content replace:",e),e.content=this.content),e.clientId===this.clientId){if(e.indexInConversation.lt(this.indexInConversation))return this.indexInConversation=e.indexInConversation,this;if(e.indexInConversationV2.lt(this.indexInConversationV2))return this.indexInConversationV2=e.indexInConversationV2,this}Object.assign(this,e)}return this}get isNormalMsg(){return this.type<5e4}get isCommandMsg(){return this.type===a.m.MessageType.MESSAGE_TYPE_COMMAND}get isSpecialMessage(){return this.type>=5e4}get visible(){return this.serverStatus!==s.P6.Disable&&!this.isSpecialMessage&&(!this.ctx.option.userId||!this.ext||(this.ext[s.v9.MessageVisible]&&this.ext[s.v9.MessageVisible].length>0?-1!==this.ext[s.v9.MessageVisible].split(",").indexOf(this.ctx.option.userId):!this.ext[s.v9.MessageInvisible]||!(this.ext[s.v9.MessageInvisible].length>0)||-1===this.ext[s.v9.MessageInvisible].split(",").indexOf(this.ctx.option.userId)))}get unpop(){return!!this.ext&&(!!(!this.visible||(0,d.vP)(this.ext,s.v9.DoNotPopConversation))||!1)}get increaseUnread(){return!(this.isFromMe||!this.visible||this.isSpecialMessage||(0,d.vP)(this.ext,s.v9.DoNotIncreaseUnread))&&!0}get isFromMe(){return this.sender===this.ctx.option.userId}get isRecalled(){return this.ext&&!!this.ext[s.v9.IsRecalled]}get isMentioned(){return this.visible&&(this.mentionedUsers.includes(this.ctx.option.userId)||this.mentionedUsers.includes("0")&&!this.isFromMe)}get mentionedUsers(){return this.ext&&this.ext[s.v9.MentionedUser]?this.ext[s.v9.MentionedUser].split(","):[]}set mentionedUsers(e){!this.ext&&(this.ext={}),this.ext[s.v9.MentionedUser]=e.join(",")}get isStrangerMessage(){return!this.ext||["1","2","3"].includes(this.ext[s.v9.MessageMode])}get isRootReference(){return!!this.ext&&(0,d.vP)(this.ext,s.v9.IsRootReference)}get moveReadIndex(){return!this.ext||!(!this.visible||this.isFromMe||this.isSpecialMessage||(0,d.vP)(this.ext,s.v9.DoNotMoveReadIndex))&&!0}get updateLastMessage(){return!(!this.visible||this.isSpecialMessage||(0,d.vP)(this.ext,s.v9.DoNotUpdateLastMessage))&&!0}getReadReceipt(){return this.resolve(c.Uk.CoreInstance).getMessageReadReceipt({message:this})}get editInfo(){var e;if(!this.ext[s.v9.EditInfo])return null;try{let t=u.parse(this.ext[s.v9.EditInfo]),n=(null==t?void 0:t.content_edit_time)?new Date(null==t?void 0:t.content_edit_time):void 0;return{isEdited:!!(null==t?void 0:t.content_is_edited),editTime:n,editorUid:null===(e=null==t?void 0:t.content_editor)||void 0===e?void 0:e.toString()}}catch(e){return null}}get isEdited(){var e;return!!(null===(e=this.editInfo)||void 0===e?void 0:e.isEdited)}}},867983:function(e,t,n){"use strict";n.d(t,{z:function(){return s}});var i=n(720709),r=n(730512),o=n(461352);class s{static fromOp(e,t){var n;let i=new s;return i.conversationId=e.conversationId,i.messageId=e.clientId,i.key=t.key,i.userId=e.ctx.option.userId,i.secUid=e.ctx.option.secUid,i.createTime=new Date(Date.now()),i.idempotentId=t.idempotentId,i.value=null!==(n=t.value)&&void 0!==n?n:"",i.version=e.version,i.status=o.R.Sending,i}static mergeOperationToCurrent(e,t){var n;let o=(0,r.vM)(t,e=>e.key);for(let t of Object.keys(o))for(let r of o[t]){!e.property[t]&&(e.property[t]=[]);let o=null===(n=e.property[t])||void 0===n?void 0:n.findIndex(e=>e.idempotentId===r.idempotentId);switch(r.operation){case i.m.OPERATION_TYPE.ADD_PROPERTY_ITEM:-1===o&&e.property[t].push(s.fromOp(e,r));break;case i.m.OPERATION_TYPE.REMOVE_PROPERTY_ITEM:-1!==o&&e.property[t].splice(o,1),0===e.property[t].length&&delete e.property[t];break;case i.m.OPERATION_TYPE.SET_PROPERTY:e.property[t]=[s.fromOp(e,r)];break;case i.m.OPERATION_TYPE.DEL_PROPERTY:delete e.property[t]}}}}},526515:function(e,t,n){"use strict";n.d(t,{Q:function(){return c}});var i=n(361073),r=n(405110),o=n(720709),s=n(694253),a=n(730512);class c extends s.mA{constructor(){super(...arguments),this.minIndex=i.ZERO,this._readIndex=i.ZERO,this._readOrder=i.ZERO}get isServerBlocked(){return(0,a.vP)(this.ext,r.v9.RelationIsMutedServer)}get readIndex(){return this._readIndex}set readIndex(e){e&&e.gt(this._readIndex)&&(this._readIndex=e)}get readOrder(){return this._readOrder}set readOrder(e){e&&e.gt(this._readOrder)&&(this._readOrder=e)}get isSelf(){return this.userId===this.ctx.option.userId}get ext(){return!this.innerExt&&(this.innerExt={}),this.innerExt}set ext(e){this.innerExt=e}static featLocalParticipant(e,t){var n,i,r,o,s,a,c,d;return e.userId!==t.userId?e:(e.secUid=null!==(n=t.secUid)&&void 0!==n?n:e.secUid,e.role=null!==(i=t.role)&&void 0!==i?i:e.role,e.alias=null!==(r=t.alias)&&void 0!==r?r:e.alias,e.sortOrder=null!==(o=t.sortOrder)&&void 0!==o?o:e.sortOrder,e.blocked=null!==(s=t.blocked)&&void 0!==s?s:e.blocked,e.leftBlockTime=null!==(a=t.leftBlockTime)&&void 0!==a?a:e.leftBlockTime,e.readIndex=null!==(c=t.readIndex)&&void 0!==c?c:e.readIndex,e.readOrder=null!==(d=t.readOrder)&&void 0!==d?d:e.readOrder,e.ext=Object.assign(e.ext,t.ext),e)}static fromServerParticipant(e,t,n,i){var s,a,d,u,l;let v=new c(e);return v.userId=t.user_id.toString(),v.secUid=t.sec_uid,v.role=null!==(s=t.role)&&void 0!==s?s:void 0,v.alias=null!==(a=t.alias)&&void 0!==a?a:void 0,v.sortOrder=null!==(d=t.sort_order)&&void 0!==d?d:void 0,v.blocked=t.blocked===o.m.BlockStatus.BLOCK,v.leftBlockTime=null!==(u=t.left_block_time)&&void 0!==u?u:void 0,v.ext=null!==(l=t.ext)&&void 0!==l?l:{},v.conversationId=n.id,v.conversationType=n.type,void 0!==i&&v.ctx.option.debug&&(v.ext[r.v9.LocalLogId]=i),v}static fakeParticipant(e,t,n){let r=new c(e);return r.conversationId=n.id,r.conversationType=n.type,r.readIndex=i.ZERO,r.minIndex=i.ZERO,r.userId=t,r}}},272586:function(e,t,n){"use strict";n.d(t,{F:function(){return ef}});var i,r=n("954090"),o=n("720709"),s=n("361073"),a=n("405110");let c="v1/message/send",d="v1/conversation/get_ticket",u="v1/message/get_by_user",l="v2/message/get_by_user_init",v="v1/message/get_user_message",h="v1/conversation/get_list",f="v1/message/get_by_conversation",p="v1/account/online",g="v1/account/offline",m="v1/conversation/delete",y="v3/conversation/mark_read",x="v2/conversation/get_info",_="v2/conversation/create",b="v2/conversation/get_info_list",I="v2/conversation/get_by_favorite",C="v2/conversation/get_by_top",M="v1/conversation/participants_list",k="v1/conversation/add_participants",S="v1/conversation/remove_participants",T="v1/conversation/leave",w="v1/conversation/update_participant",E="v1/conversation/dissolve",R="v1/message/delete",U="v1/message/recall",A="v1/message/set_property",O="v1/conversation/set_core_info",P="v1/conversation/upsert_core_ext_info",D="v1/conversation/set_setting_info",N="v1/conversation/upsert_settings_ext",B="v3/conversation/get_read_index",G="v3/conversation/get_min_index",L="v1/stranger/get_conversation_list",j="v1/stranger/get_messages",V="v1/stranger/delete_message",F="v1/stranger/delete_conversation",W="v1/stranger/delete_all_conversations",Y="v1/stranger/mark_read_conversation",$="v1/stranger/mark_read_all_conversations",q="v1/client/user_action",H="v1/client/input_status",z="v1/media/get_upload_token",K="v1/media/get_urls",Z="v1/conversation/list",J="v1/broadcast/send_message",X="v1/broadcast/recv_message",Q="v1/broadcast/user_counter",ee="v1/client/ack",et="v1/voip/create",en="v1/voip/call",ei="v1/voip/update",er="v1/channel/heartbeat",eo="v1/profile/get_info",es="v1/client/report_metrics",ea="v1/config/get",ec="v1/message/get_message_by_init",ed="v1/message/modify_ext",eu={[o.m.IMCMD.SEND_MESSAGE]:c,200:u,203:l,300:h,301:f,400:p,401:g,410:q,411:H,603:m,608:x,609:_,610:b,611:I,612:C,614:E,605:M,650:k,651:S,652:T,655:w,701:R,702:U,705:A,902:O,904:P,921:D,922:N,1001:L,1002:j,1003:V,1004:F,1005:W,1006:Y,1007:$,2e3:B,2001:G,2002:y,2003:z,2004:K,2005:d,2006:Z,2007:J,2008:X,2009:Q,2010:ee,2011:et,2012:en,2013:ei,2014:er,2015:eo,2016:es,2017:ea,[o.m.IMCMD.GET_MESSAGE_BY_INIT]:ec,[o.m.IMCMD.MODIFY_MESSAGE_EXT]:ed,[o.m.IMCMD.UNREAD_COUNT_REPORT]:"v1/client/unread_count",[o.m.IMCMD.SEND_MESSAGE_P2P]:"v1/send_message/p2p",[o.m.IMCMD.BATCH_GAT_CONVERSATION_PARTICIPANTS_READINDEX]:"v1/conversation/batch_get_conversation_participants_readindex",[o.m.IMCMD.GET_CONVERSATIONS_CHECKINFO]:"v1/conversation/get_checkinfo",[o.m.IMCMD.GET_MESSAGES_CHECKINFO_IN_CONVERSATION]:"v1/message/get_checkinfo",[o.m.IMCMD.MARK_MESSAGE]:"v1/message/mark",[o.m.IMCMD.PULL_MARK_MESSAGE]:"v1/message/pull_mark",[o.m.IMCMD.GET_CONVERSATION_CORE_INFO]:"v1/conversation/get_core_info",[o.m.IMCMD.GET_UNREAD_COUNT]:"v1/client/get_unread_count",[o.m.IMCMD.BLOCK_MEMBERS]:"v1/conversation/block_member",[o.m.IMCMD.BLOCK_CONVERSATION]:"v1/conversation/block_conversation",[o.m.IMCMD.CHECK_IN_BLOCKLIST]:"v1/blocklist/check",[o.m.IMCMD.SET_BLOCKLIST]:"v1/blocklist/set",[o.m.IMCMD.GET_BLOCKLIST]:"v1/blocklist/get",[o.m.IMCMD.BATCH_UNMARK_MESSAGE]:"v1/message/batch_unmark",[o.m.IMCMD.MARK_MSG_UNREAD_COUNT_REPORT]:"v1/message/report_mark_count",[o.m.IMCMD.MARK_MSG_GET_UNREAD_COUNT]:"v1/message/get_mark_count",[o.m.IMCMD.GET_MESSAGE_INFO_BY_SERVER_ID]:"v1/message/get_by_id",[o.m.IMCMD.CLIENT_BATCH_ACK]:"v1/client/batch_ack",[o.m.IMCMD.AUDIO_RECOGNITION]:"v1/message/audio_recognition",[o.m.IMCMD.BATCH_MARK_CONVERSATION_READ_V3]:"v3/conversation/batch_mark_read",[o.m.IMCMD.GET_USER_MESSAGE]:v,[o.m.IMCMD.GET_TAG_META_INFO]:"v1/tag/get_meta_info",[o.m.IMCMD.SET_CONVERSATION_TAG]:"v1/conversation/set_tag",[o.m.IMCMD.MANAGE_TAG_META_INFO]:"v1/tag/manage_meta_info",[o.m.IMCMD.GET_CONVERSATIONS_BY_TAG]:"v1/conversation/get_by_tag",[o.m.IMCMD.ADD_CONVERSATION_BOTS]:"v1/conversation/add_bots",[o.m.IMCMD.REMOVE_CONVERSATION_BOTS]:"v1/conversation/remove_bots"};function el(e){var t;return null!==(t=eu[e])&&void 0!==t?t:""}var ev=n("694253");!function(e){e[e.RequestCreate=0]="RequestCreate",e[e.RequestSerialize=1]="RequestSerialize",e[e.BeforeSend=2]="BeforeSend",e[e.BeforeSendSingleFlight=3]="BeforeSendSingleFlight",e[e.AfterSendSingleFlight=4]="AfterSendSingleFlight",e[e.AfterSend=5]="AfterSend",e[e.ResponseDeserialize=6]="ResponseDeserialize",e[e.SendMethod=7]="SendMethod"}(i||(i={}));let eh=function e(){let e=1e4;return()=>e+=1}();class ef extends ev.mA{constructor(e,t,n,i){super(e),this._retryTimes=0,this.seqId=null!=i?i:eh(),this.reqBody=n,this.cmd=t;let r=el(t),o=this.ctx.option.apiUrl;!o.endsWith("/")&&(o=`${o}/`),this.url=o+r}get retryTimes(){return this._retryTimes}set retryTimes(e){this._retryTimes=e,this.request&&(this.request.headers=Object.assign(Object.assign({},this.request.headers),this.isRetryHeader))}get isRetryHeader(){return{"is-retry":this.retryTimes>1?"1":"0"}}get logid(){var e,t;return null!==(t=null===(e=this.response)||void 0===e?void 0:e.log_id)&&void 0!==t?t:""}prepareRequest(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=100===this.cmd?Object.assign(Object.assign({},this.ctx.option.headers),this.ctx.option.sendMessageHeader):this.ctx.option.headers,n=o.m.Request.create({body:this.reqBody,cmd:this.cmd,sequence_id:s.fromNumber(this.seqId),refer:a.HF.refer,token:this.ctx.cachedToken,headers:t,device_id:this.ctx.option.deviceId,sdk_version:a.HF.sdkVersion,build_number:a.HF.buildNumber,inbox_type:e,device_platform:this.ctx.option.devicePlatform,channel:this.ctx.option.channel,device_type:this.ctx.option.deviceType,os_version:this.ctx.option.osVersion,version_code:this.ctx.option.versionCode,auth_type:this.ctx.option.authType,biz:this.ctx.option.biz,access:a.HF.requestAccessName});for(let e of this.ctx.plugin)n=yield e.sendPacket(n);this.request=n})}}},120645:function(e,t,n){"use strict";n.d(t,{IL:function(){return i},KQ:function(){return l},RQ:function(){return d},fC:function(){return u},u_:function(){return v}});var i,r=n(720709),o=n(125415),s=n(405110);let a={appId:0,token:"",deviceId:"",userId:"",biz:"",apiUrl:"",frontierUrl:"",fpId:89,appKey:"e0f82475ab9dbf5717d18b4a9c0d7fd0",service:2,method:1,authType:r.m.AuthType.TOKEN_AUTH,inboxType:[0],headers:{},httpHeaders:{},sendMessageHeader:{},devicePlatform:"web",timeout:2e3,pullInterval:3e4,throttle:100,triggerStrategy:{[s.c5.ConversationChange]:s.zn.Debounce,[s.c5.MessageUpsert]:s.zn.Debounce,[s.c5.ConversationUpsert]:s.zn.ThrottleWithArgs},maxMessageCount:1e3,enableServerConfig:!1};function c(e,t,n){for(let i of Object.keys(n))"string"!=typeof n[i]&&o.Y.ctxError(e,`${t}[${i}] is not a string!`)}function d(e,t){"number"!=typeof t.appId&&o.Y.ctxError(e,"opt.appId is not a number! did you pass a string?"),"string"!=typeof t.deviceId&&o.Y.ctxError(e,"opt.deviceId is not a string! did you pass a number?"),"string"!=typeof t.userId&&o.Y.ctxError(e,"opt.userId is not a string! did you pass a number?"),("string"!=typeof t.apiUrl||0===t.apiUrl.length)&&o.Y.ctxError(e,"opt.apiUrl invalid"),("string"!=typeof t.frontierUrl||0===t.frontierUrl.length)&&o.Y.ctxError(e,"opt.frontierUrl invalid"),"object"==typeof t.headers&&c(e,"opt.headers",t.headers),"object"==typeof t.httpHeaders&&c(e,"opt.httpHeaders",t.httpHeaders),"object"==typeof t.monitorTagKv&&c(e,"opt.monitorTagKv",t.monitorTagKv),(Array.isArray(t.inboxType)&&(0===t.inboxType.length||t.inboxType.some(e=>e<0))||"number"==typeof t.inboxType&&t.inboxType<0)&&o.Y.ctxError(e,"opt.inboxType invalid"),"number"==typeof t.pullInterval&&t.pullInterval<5e3&&o.Y.ctxDebug(e,"opt.pullInterval too short")}function u(e){return Object.assign(Object.assign(Object.assign({},a),e),{triggerStrategy:Object.assign(Object.assign({},a.triggerStrategy),e.triggerStrategy)})}function l(e){return Object.assign(Object.assign(Object.assign({debug:!0,boe:!0},a),e),{triggerStrategy:Object.assign(Object.assign({},a.triggerStrategy),e.triggerStrategy)})}!function(e){e.sharkEnabled="sharkEnabled",e.autoFetchMsgEnabled="autoFetchMsgEnabled",e.autoFetchMsgInterval="autoFetchMsgInterval",e.conversationMsgRepairInterval="conversationMsgRepairInterval",e.conversationMsgRepairStart="conversationMsgRepairStart",e.conversationMsgRepairCount="conversationMsgRepairCount",e.conversationMsgRepairRatio="conversationMsgRepairRatio",e.UnreadCountReport="UnreadCountReport",e.autoPollingMsgEnabled="autoPollingMsgEnabled",e.triggerPollingMsgEnabled="triggerPollingMsgEnabled",e.defaultPollingMsgInterval="defaultPollingMsgInterval",e.unmuteWhiteUidsLen="unmuteWhiteUidsLen"}(i||(i={}));let v=[[i.conversationMsgRepairCount,100],[i.conversationMsgRepairInterval,864e5]]},150301:function(e,t,n){"use strict";n.d(t,{W:function(){return l}});var i=n(954090),r=n(720709),o=n(405110),s=n(742365),a=n(125415),c=n(586037),d=n(272586),u=n(694253);class l extends u.mA{constructor(e){super(e)}send(e,t,n={}){return(0,i.mG)(this,void 0,void 0,function*(){return(yield this.sendWithRawBody(e,t,n)).body})}sendWithRawBody(e,t,n={}){var l,v,h,f,p,g,m,y,x,_,b,I,C,M,k,S,T,w,E,R,U,A,O,P,D,N,B,G;return(0,i.mG)(this,void 0,void 0,function*(){let i;let L=c.u.performanceNow(),j=this.getReqTrackerContext(e);try{if(void 0===n.inboxType&&(n.inboxType=this.resolve(u.Uk.InboxType).getDefaultInboxWithoutCheck()),this.ctx.option.webSocketLevel===o._.PushOnly&&(n.forceHttp=!0),this.ctx.option.webSocketLevel===o._.All&&(n.forceHttp=!1),i=new d.F(this.ctx,t,e),yield i.prepareRequest(n.inboxType),yield this.resolve(u.Uk.NetworkManager).send(i,{maxHttpRetryTimes:!0===n.forceHttp?n.maxRetryTimes:void 0,maxWsRetryTimes:!0===n.forceHttp?0:n.maxRetryTimes,useBeacon:n.useBeacon}),n.useBeacon||void 0===i.response)return r.m.Response.create({});let w=i.response;if(0!==w.status_code){let d=w.status_code;switch(d){case o.NI.Degradation:throw new s.G({ctx:this.ctx,msg:"server degradation",type:o.NI.Degradation,sender:this,logid:null==w?void 0:w.log_id,args:{req:e,resp:w}});case o.NI.InvalidTicket:if(t===r.m.IMCMD.SEND_MESSAGE){let i=e.send_message_body.conversation_id,r=this.resolve(u.Uk.ConversationManager).get(i);if(!r)throw new s.G({ctx:this.ctx,msg:`conversation ${i} not exist in local`,type:o.NI.ConversationNotExist,sender:this,args:{convId:i}});let c=r.ticket;yield this.resolve(u.Uk.ConversationManager).refreshTicket(r.id);let d=r.ticket;if(c!==d&&!n.isRetryReq)return a.Y.ctxDebug(this.ctx,"refresh ticket due to invalid"),this.sendWithRawBody(e,t,Object.assign(Object.assign({},n),{isRetryReq:!0}));throw new s.G({ctx:this.ctx,msg:`invalid ticket for conv: ${i}`,type:o.NI.InvalidTicket,sender:this,logid:null==w?void 0:w.log_id,args:{req:e,resp:w}})}break;case o.NI.InvalidToken:case o.NI.ExpiredToken:let C=this.ctx.cachedToken;try{if(this.resolve(u.Uk.NetworkManager).closeWs(!0),""===C||this.ctx.option.authType===r.m.AuthType.SESSION_AUTH){if(!n.isRetryReq)return a.Y.ctxDebug(this.ctx,"http retry due to invalid session"),this.sendWithRawBody(e,t,Object.assign(Object.assign({},n),{isRetryReq:!0,forceHttp:!0}));throw new s.G({ctx:this.ctx,msg:"invalid session",type:o.NI.TokenFuncError,sender:this,logid:null==w?void 0:w.log_id,args:{req:e,resp:w}})}{yield this.ctx.resolve(u.Uk.AuthManager).refreshToken();let i=this.ctx.cachedToken;if(C!==i&&!n.isRetryReq)return a.Y.ctxDebug(this.ctx,"refresh token due to invalid"),this.sendWithRawBody(e,t,Object.assign(Object.assign({},n),{isRetryReq:!0}));throw new s.G({ctx:this.ctx,msg:`token refresh fail: ${i}`,type:o.NI.TokenFuncError,sender:this,logid:null==w?void 0:w.log_id,args:{req:e,resp:w}})}}catch(t){if(void 0!==t.type)throw t.args=Object.assign(Object.assign({},t.args),{req:e,resp:w}),t;throw new s.G({ctx:this.ctx,msg:"token refresh func error",type:o.NI.TokenFuncError,innerError:t,sender:this,logid:null==w?void 0:w.log_id,args:{req:e,resp:w}})}default:if(n.ignoreBizError)return this.resolve(u.Uk.Monitor).emitMetrics(c.U.NetworkRequest,{duration:Math.round(c.u.performanceNow()-L),retry_times:null!==(l=null==i?void 0:i.retryTimes)&&void 0!==l?l:0},{imsdk_cmd:t.toString(),imsdk_result:"0",seq_id:null!==(v=null==i?void 0:i.seqId.toString())&&void 0!==v?v:"",conversation_id:j.conversationId,uuid:j.uuid,error_msg:null!==(f=null===(h=null==i?void 0:i.response)||void 0===h?void 0:h.error_desc)&&void 0!==f?f:"",error_code:null!==(m=null===(g=null===(p=null==i?void 0:i.response)||void 0===p?void 0:p.status_code)||void 0===g?void 0:g.toString())&&void 0!==m?m:"",url_path:null!==(y=null==i?void 0:i.url)&&void 0!==y?y:"",net_type:null!==(_=null===(x=null==i?void 0:i.method)||void 0===x?void 0:x.toString())&&void 0!==_?_:"",logid:null!==(b=null==i?void 0:i.logid)&&void 0!==b?b:"",is_retry_req:n.isRetryReq?"1":"0"}),w;throw new s.G({ctx:this.ctx,msg:`${null!==(I=o.NI[d])&&void 0!==I?I:"unknown"}:${w.error_desc}`,type:d,sender:this,logid:null==w?void 0:w.log_id,args:{req:e,resp:w}})}}if(w.body){for(let e of(this.resolve(u.Uk.Monitor).emitMetrics(c.U.NetworkRequest,{duration:Math.round(c.u.performanceNow()-L),retry_times:null!==(C=i.retryTimes)&&void 0!==C?C:0},{imsdk_cmd:t.toString(),imsdk_result:"1",seq_id:i.seqId.toString(),conversation_id:j.conversationId,uuid:j.uuid,error_msg:"",error_code:"0",url_path:null!==(M=i.url)&&void 0!==M?M:"",net_type:null!==(S=null===(k=i.method)||void 0===k?void 0:k.toString())&&void 0!==S?S:"",logid:null!==(T=w.log_id)&&void 0!==T?T:"",is_retry_req:n.isRetryReq?"1":"0"}),this.ctx.plugin))yield e.receiveApiResponse(w);return w}throw new s.G({ctx:this.ctx,msg:"no response body",type:o.NI.Unknown,sender:this,logid:null==w?void 0:w.log_id,args:{req:e,resp:w}})}catch(r){if(this.resolve(u.Uk.Monitor).emitMetrics(c.U.NetworkRequest,{duration:Math.round(c.u.performanceNow()-L),retry_times:null!==(w=null==i?void 0:i.retryTimes)&&void 0!==w?w:0},{imsdk_cmd:t.toString(),imsdk_result:"0",seq_id:null!==(E=null==i?void 0:i.seqId.toString())&&void 0!==E?E:"",conversation_id:j.conversationId,uuid:j.uuid,error_msg:null!==(U=null===(R=null==i?void 0:i.response)||void 0===R?void 0:R.error_desc)&&void 0!==U?U:"",error_code:null!==(P=null===(O=null===(A=null==i?void 0:i.response)||void 0===A?void 0:A.status_code)||void 0===O?void 0:O.toString())&&void 0!==P?P:"",url_path:null!==(D=null==i?void 0:i.url)&&void 0!==D?D:"",net_type:null!==(B=null===(N=null==i?void 0:i.method)||void 0===N?void 0:N.toString())&&void 0!==B?B:"",logid:null!==(G=null==i?void 0:i.logid)&&void 0!==G?G:"",is_retry_req:n.isRetryReq?"1":"0"}),void 0===r)throw new s.G({ctx:this.ctx,msg:"unknown error",type:o.NI.Unknown,sender:this,args:{req:e}});if(void 0!==r.type)throw r.args=Object.assign(Object.assign({},r.args),{req:e}),r;throw new s.G({ctx:this.ctx,msg:"request unknown error",type:o.NI.Unknown,innerError:r,sender:this,args:{req:e}})}})}getReqTrackerContext(e){var t,n,i,r;for(let o of Object.keys(e)){let s=e[o];if(void 0!==s)return{conversationId:null!==(n=null===(t=s.conversation_id)||void 0===t?void 0:t.toString())&&void 0!==n?n:"",uuid:null!==(r=null===(i=s.client_message_id)||void 0===i?void 0:i.toString())&&void 0!==r?r:""}}return{conversationId:"",uuid:""}}}},711061:function(e,t,n){"use strict";n.d(t,{v:function(){return o}});var i=n(954090),r=n(694253);class o extends r.mA{constructor(e){super(e),this.name="BasePlugin"}get instance(){return this.resolve(r.Uk.CoreInstance)}init(){return(0,i.mG)(this,void 0,void 0,function*(){})}sendPacket(e){return(0,i.mG)(this,void 0,void 0,function*(){return e})}receivePacket(e){return(0,i.mG)(this,void 0,void 0,function*(){})}receiveApiResponse(e){return(0,i.mG)(this,void 0,void 0,function*(){})}ticker(){return(0,i.mG)(this,void 0,void 0,function*(){})}extendFunc(e){return e.bind(this)}dispose(){return(0,i.mG)(this,void 0,void 0,function*(){})}}},835318:function(e,t,n){"use strict";n.d(t,{T:function(){return o},j:function(){return i}});var i,r=n(694253);!function(e){e.SdkVersion="sdk.version",e.DbVersion="sdk.db.version",e.DbLastOpen="sdk.db.last_open",e.DbEncyption="sdk.db.encryption",e.UserToken="user.token",e.ConversationCheckTime="sdk.db.conversation.check.time",e.ConversationMsgCheckTime="sdk.db.conversation.msg.check.time"}(i||(i={}));class o extends r.mA{}},238758:function(e,t,n){"use strict";n.d(t,{v:function(){return r}});var i=n(694253);class r extends i.mA{}},694253:function(e,t,n){"use strict";n.d(t,{Uk:function(){return i},hi:function(){return s},jO:function(){return a},mA:function(){return c}});var i,r=n(120645),o=n(224131);!function(e){e.CoreInstance="coreInstance",e.NetworkManager="netManager",e.ConversationManager="conversationManger",e.MessageManager="messageManager",e.ParticipantManager="participantManager",e.AuthManager="authManager",e.EventBus="eventBus",e.Monitor="montior",e.DbProxy="dbProxy",e.SecurityProxy="securityProxy",e.CoreApi="coreApi",e.InboxType="inboxType",e.HybridLink="hybridLink",e.ExtensionPlugin="extensionPlugin",e.ExtensionApi="extensionApi",e.BroadcastManager="broadcastManager",e.EmojiPlugin="emojiPlugin",e.MetricsPlugin="metricsPlugin",e.MetricsApi="metricsApi",e.MultimediaPlugin="multimediaPlugin",e.MultimediaApi="multimediaApi",e.SharkPlugin="sharkPlugin",e.StoragePlugin="storagePlugin",e.StorageApi="storageApi",e.StrangerPlugin="strangerPlugin",e.StrangerApi="strangerApi"}(i||(i={}));class s{constructor(){this.services=new Map,this.plugins=new Map}register(e,t,n){!this.services.has(e)&&this.services.set(e,new Map),this.services.get(e).set(t,n)}resolve(e,t){var n;return null===(n=this.services.get(e))||void 0===n?void 0:n.get(t)}get instanceCount(){return this.services.size}}s.Instance=new s;class a{constructor(){this.initResult=0,this.cachedToken="",this.id="",this.config=new Map(r.u_),this.id=(0,o.k)()}get plugin(){var e;return null!==(e=s.Instance.plugins.get(this.id))&&void 0!==e?e:[]}set plugin(e){s.Instance.plugins.set(this.id,e)}register(e,t){let n=t;return"function"==typeof t&&(n=new t(this)),s.Instance.register(this.id,e,n),n}resolve(e){return s.Instance.resolve(this.id,e)}}class c{constructor(e){this.__internal_ctx=e}get ctx(){return this.getContext()}bindContext(e){this.__internal_ctx=e}getContext(){return this.__internal_ctx}resolve(e){return this.getContext().resolve(e)}register(e,t){return this.getContext().register(e,t)}}},421914:function(e,t,n){"use strict";n.d(t,{f:function(){return o}});var i=n(954090),r=n(694253);class o extends r.mA{execute(e){return(0,i.mG)(this,void 0,void 0,function*(){let t=e;return t=yield this.before(t),t=yield this.process(t),t=yield this.after(t)})}before(e){return(0,i.mG)(this,void 0,void 0,function*(){return e})}after(e){return(0,i.mG)(this,void 0,void 0,function*(){return e})}}},730512:function(e,t,n){"use strict";function i(e,t){return e.length>t?[e.slice(0,t),...i(e.slice(t),t)]:[e]}function r(e,t){let n={};for(let i of e){let e=t(i);void 0===n[e]&&(n[e]=[]),n[e].push(i)}return n}function o(e,t){if(Array.isArray(e))return e;if(void 0!==e)return[e];if(void 0!==t)return[t];return[]}function s(e,t){return void 0!==e&&void 0!==t&&("true"===e[t]||"1"===e[t])}n.d(t,{F3:function(){return i},sS:function(){return o},vM:function(){return r},vP:function(){return s}}),n(361073)},224131:function(e,t,n){"use strict";n.d(t,{k:function(){return a}});let i=[];for(let e=0;e<256;++e)i[e]=(e+256).toString(16).substr(1);function r(e){let t=0,n=i;return[n[e[t++]],n[e[t++]],n[e[t++]],n[e[t++]],"-",n[e[t++]],n[e[t++]],"-",n[e[t++]],n[e[t++]],"-",n[e[t++]],n[e[t++]],"-",n[e[t++]],n[e[t++]],n[e[t++]],n[e[t++]],n[e[t++]],n[e[t++]]].join("")}let o=Array(16);function s(){for(let e=0,t=0;e<16;e++)(3&e)==0&&(t=4294967296*Math.random()),o[e]=t>>>((3&e)<<3)&255;return o}function a(){let e=s();return e[6]=15&e[6]|64,e[8]=63&e[8]|128,r(o)}},704442:function(e,t,n){"use strict";n.d(t,{D:function(){return A}});var i,r=n("954090"),o=n("361073"),s=n.n(o),a=n("720709"),c=n("405110"),d=n("125415"),u=n("742365"),l=n("694253"),v=n("491326"),h=n("461352");n("808244");var f=n("526515"),p=n("711061"),g=n("211849"),m=n("867983"),y=n("730512"),x=n("150301");class _ extends x.W{LeaveConversation(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({leave_conversation_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType}});return this.send(t,a.m.IMCMD.LEAVE_CONVERSATION,{inboxType:e.inboxType})})}DeleteMessage(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({delete_message_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,message_id:e.serverId}});return this.send(t,a.m.IMCMD.DELETE_MESSAGE,{inboxType:e.inboxType})})}GetMessageByServerId(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({get_message_by_id_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,server_message_id:e.serverId}});return this.sendWithRawBody(t,a.m.IMCMD.GET_MESSAGE_INFO_BY_SERVER_ID,{inboxType:e.inboxType})})}MarkConversationDelete(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({delete_conversation_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,last_message_index:e.lastPullIndex,badge_count:e.badgeCount,mute_badge_count_infos:e.muteBadgeCountInfos}});return this.send(t,a.m.IMCMD.MARK_CONVERSATION_DELETE,{inboxType:e.inboxType})})}AddConversationParticipants(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({conversation_add_participants_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,participants:e.participants,biz_ext:e.bizExt}});return(yield this.send(t,a.m.IMCMD.ADD_CONVERSATION_PARTICIPANTS,{inboxType:e.inboxType})).conversation_add_participants_body})}SetConversationSettingInfo(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({set_conversation_setting_info_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,set_stick_on_top:e.stickOnTop,set_mute:e.mute,set_favorite:e.favorite,push_status:e.pushStatus}});return(yield this.send(t,a.m.IMCMD.SET_CONVERSATION_SETTING_INFO,{inboxType:e.inboxType})).set_conversation_setting_info_body})}UpsertConversationSettingExtInfo(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({upsert_conversation_setting_ext_info_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,ext:e.ext}});return(yield this.send(t,a.m.IMCMD.UPSERT_CONVERSATION_SETTING_EXT_INFO,{inboxType:e.inboxType})).upsert_conversation_setting_ext_info_body})}GetConversationParticipantsList(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({conversation_participants_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,cursor:e.cursor,limit:e.limit}});return this.sendWithRawBody(t,a.m.IMCMD.CONVERSATION_PARTICIPANTS_LIST,{inboxType:e.inboxType})})}DissolveConversation(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({dissolve_conversation_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType}});return this.send(t,a.m.IMCMD.DISSOLVE_CONVERSATION,{inboxType:e.inboxType})})}GetUserConversationList(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({get_conversation_list_body:{con_type:e.type,cursor:e.cursor,limit:e.limit,sort_type:e.sortType,include_role:e.includeRole,exclude_role:e.excludeRole,with_cold:e.withCold,push_status:e.pushStatus}});return this.sendWithRawBody(t,a.m.IMCMD.GET_USER_CONVERSATION_LIST,{inboxType:e.inboxType})})}UnreadCountReport(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({unread_count_report_body:{conv_unread_count:e.conv.map(e=>({conv_short_id:e.shortId,conversation_type:e.type,unread_count:e.count})),total_unread_count:e.total}});return this.send(t,a.m.IMCMD.UNREAD_COUNT_REPORT,{inboxType:e.inboxType})})}BroadcastReceiveMessage(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({broadcast_recv_message_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,cursor:e.cursor,limit:e.limit,reverse:e.reverse,pull_type:e.pullType}});return this.sendWithRawBody(t,a.m.IMCMD.BROADCAST_RECV_MESSAGE,{inboxType:e.inboxType})})}ModifyMessageProperty(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({modify_message_property_body:{property_list:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,server_message_id:e.serverId,client_message_id:e.clientId,modify_property_content:e.modifyContent.map(e=>({operation:e.operation,key:e.key,value:e.value,idempotent_id:e.idempotentId}))},ticket:e.ticket}});return(yield this.send(t,a.m.IMCMD.SET_MESSAGE_PROPERTY,{inboxType:e.inboxType})).modify_message_property_body})}GetConversationCoreInfo(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=a.m.RequestBody.create({get_conversation_core_info_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType}});return this.send(t,a.m.IMCMD.GET_CONVERSATION_CORE_INFO,{inboxType:e.inboxType})})}}var b=n("629552");class I extends v.r{constructor(){super(...arguments),this.localIndex=o.ZERO}get isMuted(){return!1}get isStickOnTop(){return!1}get isFavorite(){return!1}get toParticipantUserId(){}static fromServerConversation(e,t,n){let i=new I(e);return i.id=t.conversation_id,i.shortId=t.conversation_short_id.toString(),i.type=t.conversation_type,i.isOffline=!1,i.coreInfo=new b._(i,t),i}setConversationCursor(e){e>this.localIndex&&(this.localIndex=e),this.localIndex=e}getMessageList(e=e=>e.visible){return this.resolve(l.Uk.BroadcastManager).getList(this.id).filter(e)}get unreadCount(){return 0}}class C extends l.mA{constructor(e){super(e),this.messages=new Map,this.conversation=new Map}upsertOnline(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=(yield this.resolve(l.Uk.ExtensionApi).GetConversationCoreInfo({conversationId:e.id,conversationShortId:o.fromString(e.shortId),conversationType:e.type,inboxType:e.inboxType})).get_conversation_core_info_body;if(!t||!t.conversation_core_info)throw new u.G({ctx:this.ctx,type:c.NI.ConversationNotExist,msg:`local conversation: ${e.id} not found online`,sender:this,args:{conversationId:e.id}});let n=I.fromServerConversation(this.ctx,t.conversation_core_info);return this.conversation.set(e.id,n),n})}getWithOnline(e,t,n){return(0,r.mG)(this,void 0,void 0,function*(){let i=this.conversation.get(e);if(!i||i.isOffline){if(!t||!n)throw new u.G({ctx:this.ctx,type:c.NI.InvalidParam,msg:"no shortId and type provided",sender:this});!i&&((i=new I(this.ctx)).id=e,i.shortId=t,i.type=a.m.ConversationType.BROADCAST_CHAT,i.isOffline=!0,i.coreInfo=new b._(i)),i=yield this.upsertOnline(i)}return i})}upsert(e){let t;let n=this.getConversationMsgs(e.conversationId),i=n.msgs.findIndex(t=>t&&t.clientId===e.clientId);i>=0&&(t=n.msgs[i]),t?(t.type===e.type?e=t.merge(e):d.Y.ctxWarn(this.ctx,"try to merge different msg:",t,e),n.msgs[i]=e):this.insertMsg(n,e),this.resolve(l.Uk.EventBus).emit(c.c5.MessageUpsert,this,e)}getList(e){let t=this.getConversationMsgs(e),n=t.tail;if(t.front<n)return t.msgs.slice(t.front,n);let i=t.msgs.slice(0,n);return t.msgs.slice(t.front,C.MaxMsgSize).concat(i)}insertMsg(e,t){let n=e.tail;e.tail=(e.tail+1)%C.MaxMsgSize,e.tail===e.front&&(e.front=(e.front+1)%C.MaxMsgSize),e.msgs[n]=t}get(e,t){let n=this.getRaw(e,t);if(!n)throw new u.G({ctx:this.ctx,type:c.NI.MessageNotExist,msg:`message ${t} @ ${e} not exist in local`,sender:this});return n}getConversation(e){let t=this.conversation.get(e);if(!t)throw new u.G({ctx:this.ctx,msg:`broadcast conversation ${e} not exist in local`,type:c.NI.ConversationNotExist,sender:this,args:{conversationId:e}});return t}getRaw(e,t){let n;let i=this.getConversationMsgs(e),r=i.msgs.findIndex(e=>e&&e.clientId===t);return r>=0&&(n=i.msgs[r]),n}getByServerId(e,t){let n=this.getConversationMsgs(e),i=n.msgs.findIndex(e=>e&&e.serverId===t);if(i<0)throw new u.G({ctx:this.ctx,type:c.NI.MessageNotExist,msg:`message ${t} @ ${e} not exist in local`,sender:this});return n.msgs[i]}getConversationMsgs(e){let t=this.messages.get(e);return!t&&(t={msgs:Array(C.MaxMsgSize),front:0,tail:0},this.messages.set(e,t)),t}processNewMessagesFromPull(e,t,n){return(0,r.mG)(this,void 0,void 0,function*(){for(let n of e)!n.ext&&(n.ext={}),yield this.processNewMessage(n,t)})}processNewMessage(e,t){return(0,r.mG)(this,void 0,void 0,function*(){if(!e.ext&&(e.ext={}),e.source=t,e.type>=0)return this.processTextMessage(e);throw new u.G({ctx:this.ctx,type:c.NI.UnknownMessageType,msg:`unknown message type: ${e.type} for msg:${e.clientId}`,sender:this})})}dispose(){this.conversation.clear(),this.messages.clear()}processTextMessage(e){return(0,r.mG)(this,void 0,void 0,function*(){if(!e.isNormalMsg)return e;let t=void 0!==e.source&&(e.source===c.v$.Online||e.source===c.v$.BroadcastLoadMore),n=this.getRaw(e.conversationId,e.clientId),i=(null==n?void 0:n.flightStatus)!==void 0&&t;this.upsert(e);let r=this.getRaw(e.conversationId,e.clientId);return n?i&&r.flightStatus!==c.b3.Received&&(r.flightStatus=c.b3.Received,this.resolve(l.Uk.EventBus).emit(c.c5.ReceiveBroadcastSelfMessage,this,r),this.upsert(r)):t&&(e.sender!==this.ctx.option.userId?this.resolve(l.Uk.EventBus).emit(c.c5.ReceiveBroadcastNewMessage,this,e):this.resolve(l.Uk.EventBus).emit(c.c5.ReceiveBroadcastSelfMessage,this,e)),e})}}C.MaxMsgSize=1001;var M=n("421914");class k extends M.f{process(e){return(0,r.mG)(this,void 0,void 0,function*(){return e.data.type===a.m.MessageType.MESSAGE_TYPE_UPDATE_MESSAGE_PROPERTY&&(e.needContinue=!1,yield this.handlePropertyCmd(e.data)),e})}handlePropertyCmd(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=this.resolve(l.Uk.MessageManager).getRaw(e.conversationId,e.clientId);t?(t.version=e.version,d.Y.ctxDebug(this.ctx,"merge property, local:",t.property,"server:",e.property),t.property=e.property,this.resolve(l.Uk.MessageManager).upsert(t),this.resolve(l.Uk.EventBus).emit(c.c5.MessagePropertyUpsert,this,t)):d.Y.ctxDebug(this.ctx,"modify property cmd msg not exist in local",e)})}}!function(e){e[e.BlockUser=1]="BlockUser",e[e.BlockConvNormalOnly=2]="BlockConvNormalOnly",e[e.BlockConvAll=3]="BlockConvAll"}(i||(i={}));class S extends M.f{process(e){return(0,r.mG)(this,void 0,void 0,function*(){return e.data.type===a.m.MessageType.MESSAGE_TYPE_BLOCK_COMMAND&&(e.needContinue=!1,this.handleBlockCmd(e.data,e.conv)),e})}handleBlockCmd(e,t){let n=g.parse(e.content),r=n.block_status;if(n.type===i.BlockUser){let{userID:i}=n;if(null==i||0===i.length)return;let s=this.resolve(l.Uk.ParticipantManager).getMapRaw(t.id);if(!s)return;for(let a of i){let i=null==a?void 0:a.toString();if(!s.has(i))continue;let d=s.get(i);d.blocked=!!r;let u=n.blockTime[i];d.leftBlockTime=u?o.fromValue(u):void 0,this.resolve(l.Uk.ParticipantManager).upsert(t.id,d),this.resolve(l.Uk.EventBus).emit(c.c5.ParticipantBlock,this,{participant:d,message:e})}}else this.resolve(l.Uk.ConversationManager).refreshAsync(t).then(t=>{t.map(t=>this.resolve(l.Uk.EventBus).emit(c.c5.ConversationBlock,this,{conversation:t,message:e}))})}}class T extends M.f{process(e){return(0,r.mG)(this,void 0,void 0,function*(){return e.data.type===a.m.MessageType.MESSAGE_TYPE_MARK_COMMAND?(e.needContinue=!1,this.handlePinCmd(e.data,e.conv)):e.data.type===a.m.MessageType.MESSAGE_TYPE_BATCH_UNMARK_COMMAND&&(e.needContinue=!1,this.handleBatchUnmarkCmd(e.data,e.conv)),e})}handlePinCmd(e,t){let n=g.parse(e.content).server_message_id.toString(),i=this.resolve(l.Uk.MessageManager).getByServerIdRaw(t.id,n);if(!i){d.Y.ctxWarn(this.ctx,"local message not exist, serverMsg=",e);return}if(i.version.gt(e.version)){d.Y.ctxWarn(this.ctx,"server message is older, localMsg=",i,"serverMsg=",e);return}i.ext=e.ext,i.version=e.version,this.resolve(l.Uk.MessageManager).upsert(i)}handleBatchUnmarkCmd(e,t){var n,i;let r=g.parse(null!==(i=null===(n=null==e?void 0:e.ext)||void 0===n?void 0:n[c.v9.MarkMessageNewExt])&&void 0!==i?i:"{}");for(let n of Object.keys(r)){let i=this.resolve(l.Uk.MessageManager).getByServerIdRaw(t.id,n.toString());if(!i){d.Y.ctxWarn(this.ctx,"local message not exist, serverMsg=",e);continue}i.ext=Object.assign(i.ext,r[n]),i.version=e.version,this.resolve(l.Uk.MessageManager).upsert(i)}}}class w{}class E{static fromServerTag(e){var t;let n=new E;return n.id=e.tag_id.toString(),n.name=e.tag_name,n.ext=null!==(t=e.ext)&&void 0!==t?t:{},n.isDeleted=!!e.status,n}}class R extends M.f{process(e){return(0,r.mG)(this,void 0,void 0,function*(){return e.data.type===a.m.MessageType.MESSAGE_TYPE_NOTIFY_USER_CUSTOM_CONVERSATION_TAG_UPDATE_COMMAND&&(e.needContinue=!1,this.handle(e)),e})}handle(e){var t,n;let i=g.parse(e.data.content);this.resolve(l.Uk.EventBus).emit(c.c5.TagListUpdate,this,null!==(n=null===(t=i.user_custom_tag)||void 0===t?void 0:t.map(e=>E.fromServerTag(e)))&&void 0!==n?n:[])}}class U extends M.f{process(e){return(0,r.mG)(this,void 0,void 0,function*(){return e.data.type===a.m.MessageType.MESSAGE_TYPE_VISIBLE_MESSAGE_COMMAND&&(e.needContinue=!1,yield this.handle(e)),e})}handle(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=g.parse(e.data.content),n=s().fromValue(t.message_id).toString(),i=yield this.resolve(l.Uk.ExtensionPlugin).getMessageByServerId({conversation:{id:t.conversation_id,shortId:s().fromValue(t.conversation_short_id).toString(),type:t.conversation_type,inboxType:t.inbox_type},serverMessageId:n});i&&this.resolve(l.Uk.MessageManager).upsert(i)})}}class A extends p.v{constructor(){super(...arguments),this.name="ExtensionPlugin"}leaveConversation(e){return(0,r.mG)(this,void 0,void 0,function*(){yield this.api.LeaveConversation({conversationId:e.conversation.id,conversationShortId:o.fromString(e.conversation.shortId),conversationType:e.conversation.type,inboxType:e.conversation.inboxType}),this.resolve(l.Uk.ParticipantManager).delete(e.conversation.id,[this.ctx.option.userId])})}deleteMessage(e){return(0,r.mG)(this,void 0,void 0,function*(){if(!e.message.serverId)throw new u.G({ctx:this.ctx,type:c.NI.MessageNotReady,msg:`message ${e.message} is not ready`,reachServer:!1,sender:this});try{if(this.resolve(l.Uk.MessageManager).delete(e.message.conversationId,e.message.serverId),e.localOnly)return;let t=this.resolve(l.Uk.ConversationManager).get(e.message.conversationId);yield this.api.DeleteMessage({conversationId:e.message.conversationId,conversationShortId:o.fromString(e.message.conversationShortId),conversationType:e.message.conversationType,serverId:o.fromString(e.message.serverId),inboxType:t.inboxType})}catch(e){d.Y.ctxWarn(this.ctx,"delete message error, may lost server operation",e)}})}deleteConversation(e){var t;return(0,r.mG)(this,void 0,void 0,function*(){try{let n=e.conversation.lastMessageIndex;if(this.resolve(l.Uk.ConversationManager).delete(e.conversation.id),e.localOnly)return;yield this.api.MarkConversationDelete({conversationId:e.conversation.id,conversationShortId:o.fromString(e.conversation.shortId),conversationType:e.conversation.type,lastPullIndex:n,inboxType:e.conversation.inboxType,badgeCount:e.conversation.badgeCount,muteBadgeCountInfos:null===(t=e.conversation.muteBadgeCountInfos)||void 0===t?void 0:t.map(e=>({message_type:e.message_type,badge_count:e.badge_count}))})}catch(e){d.Y.ctxWarn(this.ctx,"delete conversation error, may lost server operation",e)}})}addParticipants(e){var t,n;return(0,r.mG)(this,void 0,void 0,function*(){let i=Array.isArray(e.participant)?e.participant:[e.participant],r=yield this.api.AddConversationParticipants({conversationId:e.conversation.id,conversationShortId:o.fromString(e.conversation.shortId),conversationType:e.conversation.type,participants:i.map(e=>o.fromValue(e)),bizExt:e.bizExt,inboxType:e.conversation.inboxType});return(null==r?void 0:r.status)!==0?{success:!1,failedParticipant:i,payload:e.conversation,checkCode:r.check_code,checkMsg:r.check_message,statusCode:r.status,statusMsg:r.extra_info}:{success:!0,failedParticipant:null!==(n=null===(t=r.failed_participants)||void 0===t?void 0:t.map(e=>e.toString()))&&void 0!==n?n:[],payload:e.conversation,checkCode:r.check_code,checkMsg:r.check_message,statusCode:r.status,statusMsg:r.extra_info}})}setConversationSettingInfo(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=yield this.api.SetConversationSettingInfo({conversationId:e.conversation.id,conversationShortId:o.fromString(e.conversation.shortId),conversationType:e.conversation.type,stickOnTop:e.stickOnTop,mute:e.mute,favorite:e.favorite,inboxType:e.conversation.inboxType,pushStatus:e.pushStatus});return(null==t?void 0:t.status)!==0?{success:!1,payload:e.conversation,checkCode:t.check_code,checkMsg:t.check_message,statusCode:t.status,statusMsg:t.extra_info}:(yield this.resolve(l.Uk.ConversationManager).refreshAsync(e.conversation),{success:!0,payload:e.conversation,checkCode:t.check_code,checkMsg:t.check_message,statusCode:t.status,statusMsg:t.extra_info})})}upsertConversationSettingExtInfo(e){return(0,r.mG)(this,void 0,void 0,function*(){let t=yield this.api.UpsertConversationSettingExtInfo({conversationId:e.conversation.id,conversationShortId:o.fromString(e.conversation.shortId),conversationType:e.conversation.type,ext:e.ext,inboxType:e.conversation.inboxType});return(null==t?void 0:t.status)!==0?{success:!1,payload:e.conversation,checkCode:t.check_code,checkMsg:t.check_message,statusCode:t.status,statusMsg:t.extra_info}:(yield this.resolve(l.Uk.ConversationManager).refreshAsync(e.conversation),{success:!0,payload:e.conversation,checkCode:t.check_code,checkMsg:t.check_message,statusCode:t.status,statusMsg:t.extra_info})})}getConversationParticipants(e){return this.resolve(l.Uk.ParticipantManager).getParticipants(e.conversation)}getConversationParticipantsAsync(e){var t,n;return(0,r.mG)(this,void 0,void 0,function*(){let i=!0,r=o.ZERO,s=50;for(;i;){let a=yield this.getConversationParticipantsByPage({cursor:r,limit:s,conversation:e.conversation});i=null!==(t=null==a?void 0:a.hasMore)&&void 0!==t&&t,r=null!==(n=null==a?void 0:a.cursor)&&void 0!==n?n:o.ZERO}return this.resolve(l.Uk.ParticipantManager).get(e.conversation.id)})}getConversationParticipantsByPage(e){var t,n,i,s,a,c;return(0,r.mG)(this,void 0,void 0,function*(){let r=null!==(t=e.cursor)&&void 0!==t?t:o.ZERO,d=null!==(n=e.limit)&&void 0!==n?n:50,u=yield this.api.GetConversationParticipantsList({conversationId:e.conversation.id,conversationShortId:o.fromString(e.conversation.shortId),conversationType:e.conversation.type,cursor:r?o.fromValue(r):o.ZERO,limit:d,inboxType:e.conversation.inboxType}),v=null===(s=null===(i=u.body)||void 0===i?void 0:i.conversation_participants_body)||void 0===s?void 0:s.participants_page,h=null!==(a=null==v?void 0:v.has_more)&&void 0!==a&&a;r=null!==(c=null==v?void 0:v.cursor)&&void 0!==c?c:o.ZERO;let p=[];return null==v||v.participants.forEach(t=>{p.push(f.Q.fromServerParticipant(this.ctx,t,e.conversation,u.log_id))}),this.resolve(l.Uk.ParticipantManager).upsertBatch(e.conversation.id,p),this.resolve(l.Uk.ConversationManager).upsert(e.conversation),{participants:p,hasMore:h,cursor:r}})}dissolveConversation(e){return(0,r.mG)(this,void 0,void 0,function*(){yield this.api.DissolveConversation({conversationId:e.conversation.id,conversationShortId:o.fromString(e.conversation.shortId),conversationType:e.conversation.type,inboxType:e.conversation.inboxType}),this.resolve(l.Uk.ConversationManager).delete(e.conversation.id),this.resolve(l.Uk.EventBus).emit(c.c5.ConversationDissolve,this,e.conversation),this.resolve(l.Uk.EventBus).emitEmpty(c.c5.ConversationChange,this)})}getUserConversationList(e){var t,n;return(0,r.mG)(this,void 0,void 0,function*(){if(void 0===e.inboxType&&(e.inboxType=this.resolve(l.Uk.InboxType).getDefaultInbox()),e.type!==a.m.ConversationType.GROUP_CHAT&&(void 0!==e.includeRole||void 0!==e.excludeRole))throw new u.G({ctx:this.ctx,type:c.NI.InvalidParam,msg:"role filter only available in group chat",sender:this,reachServer:!1});if(void 0!==e.includeRole&&void 0!==e.excludeRole)throw new u.G({ctx:this.ctx,type:c.NI.InvalidParam,msg:"conflict include and exclude",sender:this,reachServer:!1});let i=yield this.api.GetUserConversationList({type:e.type,cursor:e.cursor?o.fromValue(e.cursor):o.ZERO,limit:e.limit?o.fromValue(e.limit):o.fromNumber(20),sortType:null!==(t=e.sortType)&&void 0!==t?t:a.m.SortType.JOIN_TIME,includeRole:e.includeRole,excludeRole:e.excludeRole,withCold:e.withCold,inboxType:e.inboxType}),r=null===(n=i.body)||void 0===n?void 0:n.get_conversation_list_body,s=r.list.map(e=>v.r.fromServerConversation(this.ctx,e,i.log_id));return s.forEach(e=>this.resolve(l.Uk.ConversationManager).upsert(e)),{conversation:s,hasMore:null==r?void 0:r.has_more,cursor:null==r?void 0:r.next_cursor}})}unreadCountReport(){return(0,r.mG)(this,void 0,void 0,function*(){if(!this.ctx.option.unreadCountReport)throw new u.G({ctx:this.ctx,msg:"unread count report not enabled",sender:this,type:c.NI.InvalidParam,reachServer:!1});let e=this.resolve(l.Uk.ConversationManager).getConversationArray(),t=(0,y.vM)(e,e=>e.inboxType.toString());for(let e of Object.keys(t)){let n=t[e],i=[],r=0;for(let t of(n.forEach(e=>{let t=this.getNormalMsgUnreadCount(e);r+=t,i.push({shortId:o.fromString(e.shortId),count:o.fromNumber(t),type:e.type})}),(0,y.F3)(i,30)))try{yield this.api.UnreadCountReport({total:o.fromValue(r),conv:t,inboxType:Number.parseInt(e,10)})}catch(e){d.Y.ctxWarn(this.ctx,"report unread error:",e,"conv:",n)}}0===e.length&&(yield this.api.UnreadCountReport({total:o.fromValue(0),conv:[],inboxType:this.resolve(l.Uk.InboxType).getDefaultInbox()}))})}modifyMessageProperty(e){var t,n,i,s;return(0,r.mG)(this,void 0,void 0,function*(){let r;let d={success:!1,payload:e.message},u=this.resolve(l.Uk.ConversationManager).getRaw(e.message.conversationId);if(!u)return d;for(let i of e.modifyContent){let r=null!==(n=null===(t=e.message.property[i.key])||void 0===t?void 0:t.findIndex(e=>{var t;return e.idempotentId===(null!==(t=i.idempotentId)&&void 0!==t?t:this.ctx.option.userId)}))&&void 0!==n?n:-1;!i.operation&&(-1===r?i.operation=a.m.OPERATION_TYPE.ADD_PROPERTY_ITEM:i.operation=a.m.OPERATION_TYPE.REMOVE_PROPERTY_ITEM)}let v=e.modifyContent.map(e=>{var t;return Object.assign(Object.assign({},e),{idempotentId:null!==(t=e.idempotentId)&&void 0!==t?t:this.ctx.option.userId,operation:e.operation})});m.z.mergeOperationToCurrent(e.message,v),this.resolve(l.Uk.MessageManager).upsert(e.message),this.resolve(l.Uk.EventBus).emit(c.c5.MessagePropertyUpsert,this,e.message);try{r=yield this.api.ModifyMessageProperty({conversationId:u.id,conversationShortId:o.fromValue(u.shortId),conversationType:u.type,serverId:o.fromValue(e.message.serverId),clientId:e.message.clientId,ticket:u.ticket,modifyContent:v,inboxType:u.inboxType})}catch(t){for(let n of(d.success=!1,d.statusCode=null==r?void 0:r.status,d.statusMsg=t.msg,d.body=r,e.modifyContent)){let t=null!==(s=null===(i=e.message.property[n.key])||void 0===i?void 0:i.findIndex(e=>{var t;return e.idempotentId===(null!==(t=n.idempotentId)&&void 0!==t?t:this.ctx.option.userId)}))&&void 0!==s?s:-1;-1!==t&&(e.message.property[n.key][t].status=h.R.Failed)}return this.resolve(l.Uk.MessageManager).upsert(e.message),this.resolve(l.Uk.EventBus).emit(c.c5.MessagePropertyUpsert,this,e.message),d}return[a.m.ModifyMessagePropertyStatus.MODIFY_PROPERTY_SUCCESS,a.m.ModifyMessagePropertyStatus.MODIFY_PROPERTY_REPEAT_REQUEST].includes(null==r?void 0:r.status)&&(d.success=!0),e.message.version=null==r?void 0:r.version,this.resolve(l.Uk.MessageManager).upsert(e.message),this.resolve(l.Uk.EventBus).emit(c.c5.MessagePropertyUpsert,this,e.message),d.checkCode=o.ZERO,d.checkMsg="",d.statusCode=r.status,d.statusMsg="",d.body=r,d})}getMessageByServerId(e){var t,n;return(0,r.mG)(this,void 0,void 0,function*(){let i=this.resolve(l.Uk.MessageManager).getByServerIdRaw(e.conversation.id,e.serverMessageId);if(i)return i;try{let i=yield this.api.GetMessageByServerId({conversationId:e.conversation.id,conversationShortId:o.fromString(e.conversation.shortId),conversationType:e.conversation.type,serverId:o.fromString(e.serverMessageId),inboxType:e.conversation.inboxType}),r=null===(n=null===(t=i.body)||void 0===t?void 0:t.get_message_by_id_body)||void 0===n?void 0:n.msg_info;if(!r.body)return null;return h.v.fromServerMessage(this.ctx,r.body,i.log_id)}catch(e){return null}})}install(){this.api=new _(this.getContext()),this.ctx.register(l.Uk.BroadcastManager,new C(this.ctx)),this.ctx.register(l.Uk.ExtensionApi,this.api),this.ctx.register(l.Uk.ExtensionPlugin,this),this.instance.deleteConversation=this.extendFunc(this.deleteConversation),this.instance.deleteMessage=this.extendFunc(this.deleteMessage),this.instance.leaveConversation=this.extendFunc(this.leaveConversation),this.instance.addParticipants=this.extendFunc(this.addParticipants),this.instance.setConversationSettingInfo=this.extendFunc(this.setConversationSettingInfo),this.instance.upsertConversationSettingExtInfo=this.extendFunc(this.upsertConversationSettingExtInfo),this.instance.getConversationParticipants=this.extendFunc(this.getConversationParticipants),this.instance.getConversationParticipantsAsync=this.extendFunc(this.getConversationParticipantsAsync),this.instance.getConversationParticipantsByPage=this.extendFunc(this.getConversationParticipantsByPage),this.instance.dissolveConversation=this.extendFunc(this.dissolveConversation),this.instance.modifyMessageProperty=this.extendFunc(this.modifyMessageProperty),this.instance.unreadCountReport=this.extendFunc(this.unreadCountReport),this.instance.getUserConversationList=this.extendFunc(this.getUserConversationList),this.instance.getMessageByServerId=this.extendFunc(this.getMessageByServerId),this.instance.getConversationBots=this.extendFunc(this.getConversationBots),this.addEventHandler(),this.resolve(l.Uk.MessageManager).injectProcessor(new k(this.ctx)),this.resolve(l.Uk.MessageManager).injectProcessor(new S(this.ctx)),this.resolve(l.Uk.MessageManager).injectProcessor(new T(this.ctx)),this.resolve(l.Uk.MessageManager).injectProcessorBefore(new R(this.ctx)),this.resolve(l.Uk.MessageManager).injectProcessor(new U(this.ctx))}receivePacket(e){return(0,r.mG)(this,void 0,void 0,function*(){e.cmd===a.m.IMCMD.NEW_BROADCAST_MSG_NOTIFY&&(yield this.receiveBroadcastPacket(e)),e.cmd===a.m.IMCMD.NEW_P2P_MSG_NOTIFY&&(yield this.receiveP2PMessage(e))})}receiveP2PMessage(e){var t;return(0,r.mG)(this,void 0,void 0,function*(){if(null===(t=e.body)||void 0===t?void 0:t.has_new_p2p_message_notify){let t=e.body.has_new_p2p_message_notify,n=new w;n.sendType=t.send_type,n.sender=t.sender.toString(),n.secSender=t.sec_sender,n.conversationId=t.conversation_id,n.conversationShortId=t.conversation_short_id.toString(),n.conversationType=t.conversation_type,n.type=t.message_type,n.content=t.content,n.ext=t.ext,n.createTime=new Date(t.create_time.toNumber()),this.resolve(l.Uk.EventBus).emit(c.c5.ReceiveNewP2PMessage,this,n)}})}receiveBroadcastPacket(e){var t;return(0,r.mG)(this,void 0,void 0,function*(){let n=e.body.has_new_message_notify,i=n.message,r=h.v.fromServerMessage(this.ctx,i,e.log_id);!r.ext&&(r.ext={}),yield this.resolve(l.Uk.BroadcastManager).processNewMessage(r,c.v$.Online);let s=this.resolve(l.Uk.BroadcastManager).getConversation(r.conversationId),a=s.localIndex;if(s.setConversationCursor(n.next_cursor),a.gt(o.ZERO)&&(null===(t=n.previous_cursor)||void 0===t?void 0:t.gt(a))){let e=!0,t=a,n=0,i=5;for(;e&&n<i;){let i=yield this.broadcastReceiveMessageWithType({conversation:s,cursor:t,limit:50,reverse:!1,pullType:1});e=i.hasMore,t=i.cursor,yield this.resolve(l.Uk.BroadcastManager).processNewMessagesFromPull(i.msgs,c.v$.BroadcastLoadMore,i.log_id),n++}}})}dispose(){return(0,r.mG)(this,void 0,void 0,function*(){this.resolve(l.Uk.ParticipantManager).dispose(),this.resolve(l.Uk.BroadcastManager).dispose()})}addEventHandler(){this.ctx.option.autoReadIndex&&this.resolve(l.Uk.EventBus).subscribe(c.c5.MessageUpsert,e=>(0,r.mG)(this,void 0,void 0,function*(){if(e.flightStatus===c.b3.Inflight)return;let t=this.resolve(l.Uk.ConversationManager).getRaw(e.conversationId);if(!t||0===this.resolve(l.Uk.ParticipantManager).getRaw(t.id).length)return;let n=this.resolve(l.Uk.ParticipantManager).getByUserIdRaw(t.id,e.sender);n&&e.moveReadIndex&&(n.readIndex=e.indexInConversation,n.readOrder=e.orderInConversation,this.resolve(l.Uk.ParticipantManager).upsert(t.id,n),d.Y.ctxDebug(this.ctx,`auto readindex with read:${n.readIndex.toString()} & order:${n.readOrder.toString()}`))})),this.resolve(l.Uk.EventBus).subscribe(c.c5.ReceiveNewP2PMessage,e=>(0,r.mG)(this,void 0,void 0,function*(){if(e.type===a.m.MessageType.MESSAGE_TYPE_READ_COMMAND){let t=this.resolve(l.Uk.ConversationManager).getWithShortIdRaw(e.conversationShortId);if(!t)return;let n=g.parse(e.content),i=o.fromValue(n.P2PSender).toString(),r=this.resolve(l.Uk.ParticipantManager).getByUserIdRaw(t.id,i);if(!r)return;let s=r.readIndex,a=o.fromValue(n.P2PSenderReadIndex);if(!s.gte(a))r.readIndex=a,this.resolve(l.Uk.ParticipantManager).upsert(t.id,r),this.resolve(l.Uk.EventBus).emit(c.c5.ConversationUpsert,this,t),this.resolve(l.Uk.EventBus).emitEmpty(c.c5.ConversationChange,this),d.Y.ctxDebug(this.ctx,`p2p update ${r.userId} readindex: ${s.toString()} to ${a.toString()}`)}}))}broadcastReceiveMessageWithType(e){var t,n,i,s,a;return(0,r.mG)(this,void 0,void 0,function*(){let r=yield this.api.BroadcastReceiveMessage({conversationId:e.conversation.id,conversationShortId:o.fromString(e.conversation.shortId),conversationType:e.conversation.type,cursor:e.cursor?o.fromValue(e.cursor):e.conversation.localIndex,limit:e.limit?o.fromValue(e.limit):o.fromNumber(20),reverse:null!==(t=e.reverse)&&void 0!==t&&t,pullType:null!==(n=e.pullType)&&void 0!==n?n:0,inboxType:e.conversation.inboxType}),d=null===(i=r.body)||void 0===i?void 0:i.broadcast_recv_message_body,u=null!==(a=null===(s=d.messages)||void 0===s?void 0:s.map(e=>h.v.fromServerMessage(this.ctx,e,r.log_id)))&&void 0!==a?a:[];return yield this.resolve(l.Uk.BroadcastManager).processNewMessagesFromPull(u,c.v$.BroadcastLoadMore,r.log_id),d.next_cursor&&e.conversation.setConversationCursor(d.next_cursor),{msgs:u,hasMore:d.has_more,cursor:d.next_cursor,log_id:r.log_id}})}getNormalMsgUnreadCount(e){return e.isMuted?0:e.pushStatus===c.Bs.PartAllow?e.unreadCountWithWhiteList:e.unreadCount}getConversationBots(e){var t,n,i,s;return(0,r.mG)(this,void 0,void 0,function*(){return null!==(s=null===(i=null===(n=null===(t=(yield this.resolve(l.Uk.CoreApi).GetConversationInfoListV2({conversations:[e.conversation].map(e=>({conversationId:e.id,conversationShortId:o.fromString(e.shortId),conversationType:e.type})),inboxType:e.conversation.inboxType})).body)||void 0===t?void 0:t.get_conversation_info_list_v2_body)||void 0===n?void 0:n.conversation_info_list)||void 0===i?void 0:i[0].bots)&&void 0!==s?s:[]})}}},20194:function(e,t,n){"use strict";n.d(t,{n:function(){return v}});var i=n("711061"),r=n("694253"),o=n("954090"),s=n("238758"),a=n("125415"),c=n("742365"),d=n("405110"),u=n("361073");class l extends s.v{constructor(){super(...arguments),this.hasHybridLinkFunction=!0,this.name="AwemeHybridLinkPlugin",this.innerConvListVersion=[],this.innerNextCmdIndex=[],this.innerReadConvListVersion=[],this.lastPullPromise=null}get coreApi(){return this.resolve(r.Uk.CoreApi)}get inboxType(){return this.resolve(r.Uk.InboxType)}get instance(){return this.resolve(r.Uk.CoreInstance)}getConvListVersion(e){var t;return null!==(t=this.innerConvListVersion[null!=e?e:this.inboxType.getDefaultInbox()])&&void 0!==t?t:u.ZERO}setConvListVersion(e,t){var n;return(0,o.mG)(this,void 0,void 0,function*(){let i=null!=t?t:this.inboxType.getDefaultInbox(),o=this.innerConvListVersion[i];if(!!(!o||o.lt(e)))a.Y.ctxDebug(this.ctx,`update conv list version for inbox:${i} from ${null==o?void 0:o.toString()} to ${e.toString()}`),this.innerConvListVersion[i]=e,yield null===(n=this.resolve(r.Uk.DbProxy))||void 0===n?void 0:n.saveConvListVersion(i,e)})}getNextCmdIndex(e){var t;return null!==(t=this.innerNextCmdIndex[null!=e?e:this.inboxType.getDefaultInbox()])&&void 0!==t?t:u.ZERO}setNextCmdIndex(e,t){var n;return(0,o.mG)(this,void 0,void 0,function*(){let i=null!=t?t:this.inboxType.getDefaultInbox(),o=this.innerNextCmdIndex[i];if(!!(!o||o.lt(e)))a.Y.ctxDebug(this.ctx,`update cmd index for inbox:${i} from ${null==o?void 0:o.toString()} to ${e.toString()}`),this.innerNextCmdIndex[i]=e,yield null===(n=this.resolve(r.Uk.DbProxy))||void 0===n?void 0:n.saveNextCmdIndex(i,e)})}getReadConvListVersion(e){var t;return null!==(t=this.innerReadConvListVersion[null!=e?e:this.inboxType.getDefaultInbox()])&&void 0!==t?t:u.ZERO}setReadConvListVersion(e,t){var n;return(0,o.mG)(this,void 0,void 0,function*(){let i=null!=t?t:this.inboxType.getDefaultInbox(),o=this.innerReadConvListVersion[i];if(!!(!o||o.lt(e)))a.Y.ctxDebug(this.ctx,`update read conv list version for inbox:${i} from ${null==o?void 0:o.toString()} to ${e.toString()}`),this.innerReadConvListVersion[i]=e,yield null===(n=this.resolve(r.Uk.DbProxy))||void 0===n?void 0:n.saveReadConvListVersion(i,e)})}getMessagesByUserInit(e={}){var t,n,i,s,a;return(0,o.mG)(this,void 0,void 0,function*(){let o=null!==(t=e.inboxType)&&void 0!==t?t:this.inboxType.getDefaultInbox(),l=e.page;if(!this.inboxType.isValidInbox(o))throw new c.G({ctx:this.ctx,msg:"invalid inbox",type:d.NI.InvalidInboxType,sender:this});let v=yield this.coreApi.GetMessagesByInit({inboxType:o,convLimit:e.convLimit,msgLimit:e.msgLimit,page:l,version:e.versionForNextQuery}),h=null===(n=v.body)||void 0===n?void 0:n.message_by_init,f=null===(i=h.messages)||void 0===i?void 0:i.map(e=>e.conversations),p=[];null===(s=h.messages)||void 0===s||s.forEach(e=>e.messages&&(null==p?void 0:p.push(...e.messages)));let g=h.has_more,m=h.next_init_version,y=v.log_id;return this.instance.processInitConversation(f,y),yield this.instance.processInitMessage(p,y),!e.versionForNextQuery&&(yield this.setConvListVersion(h.version,o),yield this.setNextCmdIndex(null!==(a=h.cmd_index)&&void 0!==a?a:u.ZERO,o),yield this.setReadConvListVersion(h.readconv_version,o)),this.resolve(r.Uk.EventBus).emitEmpty(d.c5.InitLoadPage,this),{hasMore:g,page:(null!=l?l:0)+1,versionForNextQuery:m}})}getMessagesByUser({inboxType:e,source:t,convVersion:n,cmdIndex:i,readVersion:s}={}){var l,v,h;return(0,o.mG)(this,void 0,void 0,function*(){if(void 0===e&&(e=this.inboxType.getDefaultInbox()),!this.inboxType.isValidInbox(e))throw new c.G({ctx:this.ctx,msg:"invalid inbox",type:d.NI.InvalidInboxType,sender:this});if(!0===this.ctx.option.disableInitPull&&0===this.instance.getConversationList().length&&this.getConvListVersion(e).eq(u.ZERO)){a.Y.ctxWarn(this.ctx,"try to pull history from 0, preventing");return}let o=void 0!==n?u.fromValue(n):this.getConvListVersion(e),f=void 0!==i?u.fromValue(i):this.getNextCmdIndex(e),p=void 0!==s?u.fromValue(s):this.getReadConvListVersion(e);for(;o||f||p;){let n=yield this.coreApi.GetUserMessage({inboxType:e,version:o,cmdIndex:f,readVersion:p,source:null!=t?t:""}),i=null===(l=n.body)||void 0===l?void 0:l.get_user_message,s=i.messages,a=i.cmd_messages,c=i.read_info;if(s){if(o=s.has_more?s.next_conversation_version:void 0,s.messages)for(let e of s.messages){yield this.resolve(r.Uk.MessageManager).processNewMessagesFromPull(e.messages,d.v$.UserInbox,n.log_id);let t=this.resolve(r.Uk.ConversationManager).getRaw(e.conversation_id.toString());this.instance.handleBadgeCount({badge_count:e.badge_count,mute_badge_count_info:e.mute_badge_count_infos},t)}yield this.setConvListVersion(s.next_conversation_version,e)}else o=void 0;if(a?(f=a.has_more&&a.next_cmd_index?a.next_cmd_index:void 0,(null===(v=a.messages)||void 0===v?void 0:v.length)&&(yield this.instance.processInitMessage(a.messages,n.log_id),a.next_cmd_index&&(yield this.setNextCmdIndex(a.next_cmd_index,e)))):f=void 0,c){if(p=c.has_more?c.next_version:void 0,c.read_info)for(let e of c.read_info)this.resolve(r.Uk.ConversationManager).markRead(e.ConversationShortId.toString(),e.read_index,e.read_badge_count.toNumber(),null!==(h=e.mute_read_badge_count_infos)&&void 0!==h?h:[]);yield this.setReadConvListVersion(c.next_version,e)}else p=void 0;this.instance.initResult===d.rb.Start&&this.resolve(r.Uk.EventBus).emitEmpty(d.c5.InitLoadPage,this)}this.resolve(r.Uk.ConversationManager).refreshLocal()})}getInitMesages({inboxType:e,convLimit:t,msgLimit:n,convTotal:i}){return(0,o.mG)(this,void 0,void 0,function*(){a.Y.ctxDebug(this.ctx,`load history for inbox ${e} by full init`);let o={hasMore:!0,page:0,versionForNextQuery:void 0};for(;o.hasMore&&(o=yield this.getMessagesByUserInit(Object.assign({inboxType:e,convLimit:t,msgLimit:n},o)),!i||!(this.resolve(r.Uk.ConversationManager).getConversationArray().length>=i)););})}prepareHistoryForInbox({inboxType:e,convLimit:t,msgLimit:n,convTotal:i}){var s,c,d,l,v;return(0,o.mG)(this,void 0,void 0,function*(){try{let o=yield null===(s=this.resolve(r.Uk.DbProxy))||void 0===s?void 0:s.loadConvListVersion(e),h=yield null===(c=this.resolve(r.Uk.DbProxy))||void 0===c?void 0:c.loadNextCmdIndex(e),f=yield null===(d=this.resolve(r.Uk.DbProxy))||void 0===d?void 0:d.loadReadConvListVersion(e);if(o||h||f)return a.Y.ctxDebug(this.ctx,`load history for inbox ${e} by db`),yield this.setConvListVersion(null!=o?o:u.ZERO,e),yield this.setNextCmdIndex(null!=h?h:u.ZERO,e),yield this.setReadConvListVersion(null!=f?f:u.ZERO,e),yield this.getMessagesByUser({inboxType:e,source:"init"}),this.getInitMesages({inboxType:e,convLimit:t,msgLimit:n,convTotal:i}),!0;if(this.ctx.option.disableInitPull){a.Y.ctxDebug(this.ctx,`load history for inbox ${e} by disable init`);let i=yield this.coreApi.GetMessagesByInit({inboxType:e,convLimit:t,msgLimit:n}),r=null===(l=i.body)||void 0===l?void 0:l.message_by_init;return yield this.setConvListVersion(r.version,e),yield this.setNextCmdIndex(null!==(v=r.cmd_index)&&void 0!==v?v:u.ZERO,e),yield this.setReadConvListVersion(r.readconv_version,e),!0}return a.Y.ctxDebug(this.ctx,`load history for inbox ${e} by full init`),yield this.getInitMesages({inboxType:e,convLimit:t,msgLimit:n,convTotal:i}),yield this.getMessagesByUser({inboxType:e,source:"init"}),!0}catch(t){return a.Y.ctxError(this.ctx,`load history failed for inbox:${e}`,t),!1}})}receivePacket(e){var t,n,i,s;return(0,o.mG)(this,void 0,void 0,function*(){let o=e,c=!1,d=e.inbox_type,l=null===(t=o.body)||void 0===t?void 0:t.has_new_message_notify;if(!this.resolve(r.Uk.InboxType).getInboxTypeArray().includes(d)){a.Y.ctxDebug(this.ctx,`inbox type ${d} mismatch, drop, logid:${o.log_id}`);return}if(this.ctx.option.checkLastPullFinished&&this.lastPullPromise)try{yield this.lastPullPromise}catch(e){a.Y.ctxWarn(this.ctx,`lastPullPromise error, continue, current packet logid:${o.log_id}`)}l?(null===(n=null==l?void 0:l.conversation_version)||void 0===n?void 0:n.neq(u.ZERO))?c||(c=yield this.parseConvVersion(l,d,o)):(null===(i=null==l?void 0:l.cmd_message_index)||void 0===i?void 0:i.neq(u.ZERO))?c||(c=yield this.parseCmdIndex(l,d,o)):(null===(s=null==l?void 0:l.readconv_version)||void 0===s?void 0:s.neq(u.ZERO))?c||(c=yield this.parseReadConvVersion(l,d,o)):a.Y.ctxWarn(this.ctx,`push body doesn't match any link, skip, logid:${o.log_id}`):(c=!0,a.Y.ctxWarn(this.ctx,`push body is missing, logid:${o.log_id}`)),c&&(this.lastPullPromise=this.getMessagesByUser({inboxType:o.inbox_type,source:"cursor"}),yield this.lastPullPromise)})}parseConvVersion(e,t,n){var i,r,s,c,d,l;return(0,o.mG)(this,void 0,void 0,function*(){let o=null!==(i=null==e?void 0:e.conversation_version)&&void 0!==i?i:u.ZERO,v=null!==(r=null==e?void 0:e.previous_conversation_version)&&void 0!==r?r:u.ZERO,h=this.getConvListVersion(t),f=!1;return(null==h?void 0:h.lt(v))||(null==v?void 0:v.eq(u.ZERO))?(f=!0,a.Y.ctxWarn(this.ctx,`inbox ${t} push previousConvVersion is greater than local clientConvVersion, push:${v}, local:${h}, msgid:${null===(s=e.message)||void 0===s?void 0:s.server_message_id}, logid:${n.log_id}`)):!this.ctx.option.triggerPullWhenReceiveEmptyContent||(null===(c=e.message)||void 0===c?void 0:c.content)?((null==h?void 0:h.gt(v))&&a.Y.ctxWarn(this.ctx,`inbox ${t} push previousConvVersion is lower than local clientConvVersion, push:${v}, local:${h}, msgid:${null===(l=e.message)||void 0===l?void 0:l.server_message_id}, logid:${n.log_id}`),yield this.instance.processPushMessage(e,n),yield this.setConvListVersion(o,t)):(f=!0,a.Y.ctxWarn(this.ctx,`receive empty content push, msgid:${null===(d=e.message)||void 0===d?void 0:d.server_message_id}, logid:${n.log_id}`)),f})}parseCmdIndex(e,t,n){var i,r;return(0,o.mG)(this,void 0,void 0,function*(){let o=e.cmd_message_index;if(!o)return!1;let s=this.getNextCmdIndex(t),c=!1;return o&&o.gt(s)?(c=!0,a.Y.ctxWarn(this.ctx,`inbox ${t} push serverCmdIndex is greater than expected , push:${o}, expect:${s}, msgid:${null===(i=e.message)||void 0===i?void 0:i.server_message_id}, logid:${n.log_id}`)):(null==s?void 0:s.eq(o))?(yield this.instance.processPushMessage(e,n),yield this.setNextCmdIndex(o.add(1),t)):a.Y.ctxWarn(this.ctx,`inbox ${t} push serverCmdIndex is lower than expected , push:${o}, local:${s}, msgid:${null===(r=e.message)||void 0===r?void 0:r.server_message_id}, logid:${n.log_id}`),c})}parseReadConvVersion(e,t,n){var i;return(0,o.mG)(this,void 0,void 0,function*(){let r=e.readconv_version,o=e.pre_readconv_version;if(!r||!o)return!1;let s=this.getReadConvListVersion(t),c=!1;return!o.eq(s)&&(a.Y.ctxWarn(this.ctx,`inbox ${t} push serverPreReadConvVersion is not equal clientReadConvVersion , push:${o}, local:${s}, msgid:${null===(i=e.message)||void 0===i?void 0:i.server_message_id}, logid:${n.log_id}`),c=!0),yield this.setReadConvListVersion(r,t),c})}getReportParams(e){return Object.assign({hybrid_type:"aweme"},void 0!==e?{conv_list_version:this.getConvListVersion(e).toString(),cmd_index:this.getNextCmdIndex(e).toString(),read_conv_list_version:this.getReadConvListVersion(e).toString()}:{})}}class v extends i.v{constructor(){super(...arguments),this.name="AwemeHybridLinkPlugin"}install(){this.hybridLinkInstance=new l(this.ctx),this.register(r.Uk.HybridLink,this.hybridLinkInstance)}}},39313:function(e,t,n){"use strict";n.d(t,{b:function(){return u}});var i=n(954090);n(361073);var r=n(405110),o=n(125415),s=n(586037),a=n(694253);n(211849),n(808244);var c=n(711061),d=n(736114);class u extends c.v{constructor(){super(...arguments),this.name="MetricsPlugin",this.ignoreMethods=["getStrangerTotalUnread","getLocalStrangerConversation","checkRtcRequirements","parseContent","unreadCountReport","getMessageReferencedInfo","initAdapter","getConversationParticipants","broadcastGetConversation","getConversationMessages","createMessage","createTextMessage","createFileMessage","sendMessage","getMessageReadReceipt","createConversation","getConversationOnline","getConversationListOnline","getStrangerPreview","emojify","randomEmoji","getAllEmoji","constructor","getUserCursor","setUserCursor","init","getConversation","getConversationList","dispose","intervalFunc","receivePacket","messageFilter","sendMessageObject","tickerUpdate","prepareHistoryForInbox","prepareToken","clearCache","resolve","getContext","processInitMessage","processInitConversation","patchMessage","clientAck","handleBadgeCount","calcBadgeCount","processPushMessage"]}beforeHook(e,t){if(this.ctx.option.aspectBefore)return this.ctx.option.aspectBefore({name:e,params:t})}afterHook(e,t,n,i){let r=this.resolve(a.Uk.Monitor).emitDuration(s.U.BizApiInvoke+s.U.SuccessSuffix,n,{name:e});this.ctx.option.aspectAfter&&this.ctx.option.aspectAfter({name:e,params:t,duration:r,result:i})}errorHook(e,t,n,i){let o=this.resolve(a.Uk.Monitor).emitDuration(s.U.BizApiInvoke+s.U.ErrorSuffix,i,{name:e,error:n.type?`${n.type}:${r.NI[n.type]}`:"unknown"});if(this.ctx.option.aspectError){let i=this.ctx.option.aspectError({name:e,params:t,duration:o,error:n});if(void 0!==i)return!!i}return!0}wrapMetricsAsync(e,t){let n=0;return r=>(0,i.mG)(this,void 0,void 0,function*(){try{let i=this.beforeHook(e,r);if(!1===i)return;n=s.u.performanceNow();let o=yield t.call(this.instance,r);return this.afterHook(e,r,n,o),o}catch(t){if(this.errorHook(e,r,t,n))throw t}})}getFuncs(){let e=[],{instance:t}=this,n=Object.getOwnPropertyNames(t);e=e.concat(n);let i=Object.getPrototypeOf(t),r=Object.getOwnPropertyNames(i);e=e.concat(r);let o=Object.getOwnPropertyNames(Object.getPrototypeOf(i));return(e=e.concat(o)).filter(e=>"function"==typeof this.instance[e]&&!this.ignoreMethods.includes(e)&&!e.startsWith("__internal"))}install(){this.register(a.Uk.MetricsPlugin,this),this.ctx.option.monitor=this.unifyMonitorConfig();let e=this.instance;for(let t of this.getFuncs()){let n=e[t];o.Y.ctxDebug(this.ctx,`wrapping metrics for ${t}`),e[t]=this.wrapMetricsAsync(t,n)}this.subscribeTrackerEvent()}receivePacket(e){return(0,i.mG)(this,void 0,void 0,function*(){})}subscribeTrackerEvent(){this.resolve(a.Uk.EventBus).subscribe(r.c5.Error,e=>{this.resolve(a.Uk.Monitor).emitTracker(d.W.Exception,{error_stack:e.stack})}),this.resolve(a.Uk.EventBus).subscribe(r.c5.InitFinish,e=>{let t=this.instance.getConversationList(),n=t.map(e=>e.getMessageList().length).reduce((e,t)=>e+t,0);this.resolve(a.Uk.Monitor).emitTracker(d.W.InitHandler,{conv_count:t.length,total_msg_count:n,is_success:"1"})})}unifyMonitorConfig(){let e=this.ctx.option.monitor;return Array.isArray(e)?e:void 0!==e?(this.ctx.option.monitor=[e],this.ctx.option.monitor):(this.ctx.option.monitor=[],this.ctx.option.monitor)}}},236922:function(e,t,n){"use strict";n.d(t,{a:function(){return o}}),n(361073);var i=n(405110),r=n(125415);n(211849),n(808244);class o{constructor(e){this.errorTypeBlacklist=[i.NI.NetworkError],this.slardar=e}emitError(e,t){!this.errorTypeBlacklist.includes(e.type)&&this.slardar("captureException",e,Object.assign(Object.assign({},t),{type:`${e.type}:${i.NI[e.type]}`,msg:e.msg,logid:e.logid,args:e.args}))}emitNetwork(e,t,n){void 0!==t&&0!==t.status_code&&this.slardar("sendLog",{level:"error",content:`Response Error:${t.status_code}, cmd: ${t.cmd} msg: ${t.error_desc}, logid: ${t.log_id}`,extra:Object.assign({cmd:`${t.cmd}`},n)})}emitEvent(e,t,n){}emitLog(e,t){if(e===r.h.debug)return;let n={};t.forEach((e,t)=>{n[t]=e}),this.slardar("sendLog",{level:r.h[e],content:t.join(","),extra:Object.assign({},n)})}emitTracker(e,t){this.slardar("sendLog",{level:"debug",content:e,extra:t})}emitMetrics(e,t={},n={}){}}},386227:function(e,t,n){"use strict";n.d(t,{Dp:function(){return s},Cu:function(){return c},af:function(){return o}}),n("361073");var i=n("586037");n("211849"),n("808244");class r{constructor(e=[],t){this.metricsToReport=[],this.sampleRate={},this.call=e=>{if(!this.metricsToReport.includes(e))return!1;let t=this.sampleRate[e],n=this.sampleRate[r.globalSampleRate],i=Math.random();return void 0!==t?i<t:void 0===n||i<n},this.metricsToReport=e,t&&(this.sampleRate=t)}}function o(e){return(e.startsWith("imsdk")?e:`imsdk_${e}`).replace(/\./g,"_")}r.globalSampleRate="__globalSampleRate";let s=[i.U.CreateConversation,i.U.SendMessage,i.U.ReceiveMessage,i.U.WsConnect,i.U.NetworkRequest].map(e=>o(e)),a={[o(i.U.NetworkRequest)]:.05,[r.globalSampleRate]:1};class c{constructor(e,t){var n,i;this.sampleCallback=()=>!0,this.collector=e,(null==t?void 0:t.sampleCallback)?this.sampleCallback=t.sampleCallback:this.sampleCallback=new r(null!==(n=null==t?void 0:t.metricsToReport)&&void 0!==n?n:s,null!==(i=null==t?void 0:t.sampleRate)&&void 0!==i?i:a).call}emitCounter(e,t,n){}emitDuration(e,t,n){}emitError(e){}emitNetwork(e,t,n){}emitEvent(e,t,n){}emitLog(e,t){}emitTracker(e,t){}emitMetrics(e,t,n){var i;let r=o(e);if(!!(null===(i=this.sampleCallback)||void 0===i?void 0:i.call(this,r)))this.collector.event(r,Object.assign(Object.assign({},t),n))}}c.globalSampleRate=r.globalSampleRate},68146:function(e,t,n){"use strict";n.d(t,{v:function(){return a}});var i=n(954090);n(361073);var r=n(125415),o=n(694253);n(211849),n(808244);var s=n(711061);class a extends s.v{constructor(){super(...arguments),this.name="SharkPlugin",this.enabled=!0}install(){this.register(o.Uk.SharkPlugin,this);try{(void 0===this.ctx.option.sharkAppName||void 0===this.ctx.option.sharkPriorityRegion)&&(r.Y.ctxWarn(this.ctx,"shark required field not provided, ignore shark params"),this.enabled=!1),"undefined"==typeof navigator&&r.Y.ctxWarn(this.ctx,"window.navigator not available, may missing param"),"undefined"==typeof screen&&r.Y.ctxWarn(this.ctx,"window.screen not available, may missing param"),"undefined"==typeof document&&r.Y.ctxWarn(this.ctx,"window.document not available, may missing param"),("undefined"==typeof Intl||!("undefined"!=typeof Intl&&"function"==typeof Intl.DateTimeFormat&&"function"==typeof Intl.DateTimeFormat().resolvedOptions))&&r.Y.ctxWarn(this.ctx,"window.Intl not available, may missing param")}catch(e){r.Y.ctxError(this.ctx,"shark init error:",e),this.enabled=!1}}sendPacket(e){return(0,i.mG)(this,void 0,void 0,function*(){return this.enabled&&this.fillSharkParam(e),e})}fillSharkParam(e){var t,n,i,o,s,a,c,d,u,l,v,h,f,p,g,m,y;let x={};try{x.session_aid=null!==(t=this.ctx.option.appId.toString())&&void 0!==t?t:"",x.session_did=null!==(n=this.ctx.option.deviceId.toString())&&void 0!==n?n:"",x.app_name=this.ctx.option.sharkAppName,x.priority_region=this.ctx.option.sharkPriorityRegion,"undefined"!=typeof navigator&&(x.user_agent=null!==(i=navigator.userAgent)&&void 0!==i?i:"",x.cookie_enabled=null!==(s=null===(o=navigator.cookieEnabled)||void 0===o?void 0:o.toString())&&void 0!==s?s:"",x.browser_language=null!==(a=navigator.language)&&void 0!==a?a:"",x.browser_platform=null!==(c=navigator.platform)&&void 0!==c?c:"",x.browser_name=null!==(d=navigator.appCodeName)&&void 0!==d?d:"",x.browser_version=null!==(u=navigator.appVersion)&&void 0!==u?u:"",x.browser_online=null!==(v=null===(l=navigator.onLine)||void 0===l?void 0:l.toString())&&void 0!==v?v:""),"undefined"!=typeof screen&&(x.screen_width=null!==(f=null===(h=screen.width)||void 0===h?void 0:h.toString())&&void 0!==f?f:"",x.screen_height=null!==(g=null===(p=screen.height)||void 0===p?void 0:p.toString())&&void 0!==g?g:""),"undefined"!=typeof document&&(x.referer=null!==(m=document.referrer)&&void 0!==m?m:""),"undefined"!=typeof Intl&&"function"==typeof Intl.DateTimeFormat&&"function"==typeof Intl.DateTimeFormat().resolvedOptions&&(x.timezone_name=null!==(y=Intl.DateTimeFormat().resolvedOptions().timeZone)&&void 0!==y?y:"")}catch(e){r.Y.ctxWarn(this.ctx,"load shark param error, may missing param",e)}e.headers=Object.assign(Object.assign({},e.headers),x)}}},801253:function(e,t,n){"use strict";let i,r;n.d(t,{C:function(){return ef}});var o,s=n("954090"),a=n("361073"),c=n("125415"),d=n("694253");n("211849"),n("808244");var u=n("711061"),l=n("720709"),v=n("150301");class h extends v.W{GetMessagesCheckInfoInConversation(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=l.m.RequestBody.create({get_messages_checkinfo_in_conversation_body:{conversation_id:e.conversationId,conversation_short_id:a.fromValue(e.conversationShortId),conversation_type:e.conversationType,cursor_reverse_begin:e.cursorReverseBegin?a.fromValue(e.cursorReverseBegin):null,cursor_reverse_end:e.cursorReverseEnd?a.fromValue(e.cursorReverseEnd):null,expect_msg_total_count:e.expectedTotalMessageCount}});return(yield this.send(t,l.m.IMCMD.GET_MESSAGES_CHECKINFO_IN_CONVERSATION,{inboxType:e.inboxType})).get_messages_checkinfo_in_conversation_body})}GetConversationsCheckInfo(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=l.m.RequestBody.create({});return(yield this.send(t,l.m.IMCMD.GET_CONVERSATIONS_CHECKINFO,{inboxType:e.inboxType})).get_conversations_checkinfo_body})}}var f=n("835318");let p=(e,t)=>t.some(t=>e instanceof t);function g(){return i||(i=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function m(){return r||(r=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}let y=new WeakMap,x=new WeakMap,_=new WeakMap,b=new WeakMap,I=new WeakMap;function C(e){let t=new Promise((t,n)=>{let i=()=>{e.removeEventListener("success",r),e.removeEventListener("error",o)},r=()=>{t(E(e.result)),i()},o=()=>{n(e.error),i()};e.addEventListener("success",r),e.addEventListener("error",o)});return t.then(t=>{t instanceof IDBCursor&&y.set(t,e)}).catch(()=>{}),I.set(t,e),t}function M(e){if(x.has(e))return;let t=new Promise((t,n)=>{let i=()=>{e.removeEventListener("complete",r),e.removeEventListener("error",o),e.removeEventListener("abort",o)},r=()=>{t(),i()},o=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",r),e.addEventListener("error",o),e.addEventListener("abort",o)});x.set(e,t)}let k={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return x.get(e);if("objectStoreNames"===t)return e.objectStoreNames||_.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return E(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function S(e){k=e(k)}function T(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?m().includes(e)?function(...t){return e.apply(R(this),t),E(y.get(this))}:function(...t){return E(e.apply(R(this),t))}:function(t,...n){let i=e.call(R(this),t,...n);return _.set(i,t.sort?t.sort():[t]),E(i)}}function w(e){return"function"==typeof e?T(e):(e instanceof IDBTransaction&&M(e),p(e,g()))?new Proxy(e,k):e}function E(e){if(e instanceof IDBRequest)return C(e);if(b.has(e))return b.get(e);let t=w(e);return t!==e&&(b.set(e,t),I.set(t,e)),t}let R=e=>I.get(e);function U(e,t,{blocked:n,upgrade:i,blocking:r,terminated:o}={}){let s=indexedDB.open(e,t),a=E(s);return i&&s.addEventListener("upgradeneeded",e=>{i(E(s.result),e.oldVersion,e.newVersion,E(s.transaction))}),n&&s.addEventListener("blocked",()=>n()),a.then(e=>{o&&e.addEventListener("close",()=>o()),r&&e.addEventListener("versionchange",()=>r())}).catch(()=>{}),a}function A(e,{blocked:t}={}){let n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",()=>t()),E(n).then(()=>void 0)}let O=["get","getKey","getAll","getAllKeys","count"],P=["put","add","delete","clear"],D=new Map;function N(e,t){if(!(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t))return;if(D.get(t))return D.get(t);let n=t.replace(/FromIndex$/,""),i=t!==n,r=P.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!(r||O.includes(n)))return;let o=async function(e,...t){let o=this.transaction(e,r?"readwrite":"readonly"),s=o.store;return i&&(s=s.index(t.shift())),(await Promise.all([s[n](...t),r&&o.done]))[0]};return D.set(t,o),o}S(e=>({...e,get:(t,n,i)=>N(t,n)||e.get(t,n,i),has:(t,n)=>!!N(t,n)||e.has(t,n)}));let B=["continue","continuePrimaryKey","advance"],G={},L=new WeakMap,j=new WeakMap,V={get(e,t){if(!B.includes(t))return e[t];let n=G[t];return!n&&(n=G[t]=function(...e){L.set(this,j.get(this)[t](...e))}),n}};async function*F(...e){let t=this;if(!(t instanceof IDBCursor)&&(t=await t.openCursor(...e)),!t)return;let n=new Proxy(t,V);for(j.set(n,t),I.set(n,R(t));t;)yield n,t=await (L.get(n)||t.continue()),L.delete(n)}function W(e,t){return t===Symbol.asyncIterator&&p(e,[IDBIndex,IDBObjectStore,IDBCursor])||"iterate"===t&&p(e,[IDBIndex,IDBObjectStore])}S(e=>({...e,get:(t,n,i)=>W(t,n)?F:e.get(t,n,i),has:(t,n)=>W(t,n)||e.has(t,n)}));var Y=n("491326"),$=n("629552"),q=n("878042"),H=n("546405");class z{static toStore(e){var t,n,i,r,o,s,a,c,d,u,l,v;let h=new z;return h.coreInfo={conversationId:e.coreInfo.conversationId,version:null===(t=e.coreInfo.version)||void 0===t?void 0:t.toString(),name:e.coreInfo.name,desc:e.coreInfo.desc,icon:e.coreInfo.icon,notice:e.coreInfo.notice,owner:e.coreInfo.owner,secOwner:e.coreInfo.secOwner,innerExt:e.coreInfo.ext,inboxType:e.coreInfo.inboxType},h.firstPageParticipant={cursor:null===(i=null===(n=e.firstPageParticipant)||void 0===n?void 0:n.cursor)||void 0===i?void 0:i.toString(),hasMore:null===(r=e.firstPageParticipant)||void 0===r?void 0:r.has_more,participants:null===(s=null===(o=e.firstPageParticipant)||void 0===o?void 0:o.participants)||void 0===s?void 0:s.map(e=>{var t,n,i;return{userId:null===(t=e.user_id)||void 0===t?void 0:t.toString(),secUid:e.sec_uid,sortOrder:null===(n=e.sort_order)||void 0===n?void 0:n.toString(),role:e.role,alias:e.alias,blocked:e.blocked,leftBlockTime:null===(i=e.left_block_time)||void 0===i?void 0:i.toString()}})},h.id=e.id,h.isMember=e.isMember,h.mode=e.mode,h.isOffline=e.isOffline,h.participantCount=e.participantCount,h.settingInfo={conversationId:e.settingInfo.conversationId,version:null===(a=e.settingInfo.version)||void 0===a?void 0:a.toString(),stickTop:e.settingInfo.stickTop,mute:e.settingInfo.mute,favor:e.settingInfo.favor,innerExt:e.settingInfo.ext,minIndex:null===(c=e.settingInfo.minIndex)||void 0===c?void 0:c.toString(),readIndex:null===(d=e.settingInfo.readIndex)||void 0===d?void 0:d.toString(),readIndexV2:null===(u=e.settingInfo.readIndexV2)||void 0===u?void 0:u.toString(),setTopTime:null===(l=e.settingInfo.setTopTime)||void 0===l?void 0:l.toString(),setFavoriteTime:null===(v=e.settingInfo.setFavoriteTime)||void 0===v?void 0:v.toString(),pushStatus:e.settingInfo.pushStatus,readBadgeCount:e.settingInfo.readBadgeCount,muteReadBadgeCountInfos:e.settingInfo.muteReadBadgeCountInfos},h.shortId=e.shortId,h.ticket=e.ticket,h.type=e.bizType,h.badgeCount=e.badgeCount,h.muteBadgeCountInfos=e.muteBadgeCountInfos,h}static fromStore(e,t){var n,i,r,o,s,c,d,u,v,h,f,p,g;let m=t.mode?new H.C(e):new Y.r(e),y=new $._(m);y.version=a.fromValue(null!==(i=null===(n=t.coreInfo)||void 0===n?void 0:n.version)&&void 0!==i?i:0),y.name=t.coreInfo.name,y.desc=t.coreInfo.desc,y.icon=t.coreInfo.icon,y.notice=t.coreInfo.notice,y.owner=t.coreInfo.owner,y.secOwner=t.coreInfo.secOwner,y.ext=t.coreInfo.innerExt,y.inboxType=t.coreInfo.inboxType;let x=new q.H(m);return x.version=a.fromValue(null!==(o=null===(r=t.settingInfo)||void 0===r?void 0:r.version)&&void 0!==o?o:0),x.stickTop=t.settingInfo.stickTop,x.mute=t.settingInfo.mute,x.favor=t.settingInfo.favor,x.ext=t.settingInfo.innerExt,x.readIndex=a.fromValue(null!==(s=t.settingInfo.readIndex)&&void 0!==s?s:0),x.readIndexV2=a.fromValue(null!==(c=t.settingInfo.readIndexV2)&&void 0!==c?c:0),x.minIndex=a.fromValue(null!==(d=t.settingInfo.minIndex)&&void 0!==d?d:0),x.setTopTime=a.fromValue(null!==(u=t.settingInfo.setTopTime)&&void 0!==u?u:0),x.setFavoriteTime=a.fromValue(null!==(v=t.settingInfo.setFavoriteTime)&&void 0!==v?v:0),x.pushStatus=t.settingInfo.pushStatus,m.badgeCount=t.badgeCount,m.muteBadgeCountInfos=t.muteBadgeCountInfos,x.readBadgeCount=t.settingInfo.readBadgeCount,x.muteReadBadgeCountInfos=t.settingInfo.muteReadBadgeCountInfos,m.coreInfo=y,m.settingInfo=x,m.firstPageParticipant=l.m.ParticipantsPage.create({cursor:(null===(h=t.firstPageParticipant)||void 0===h?void 0:h.cursor)?a.fromValue(t.firstPageParticipant.cursor):void 0,has_more:null===(f=t.firstPageParticipant)||void 0===f?void 0:f.hasMore,participants:null===(g=null===(p=t.firstPageParticipant)||void 0===p?void 0:p.participants)||void 0===g?void 0:g.map(e=>({user_id:e.userId?a.fromValue(e.userId):void 0,sec_uid:e.secUid,sort_order:e.sortOrder?a.fromValue(e.sortOrder):void 0,role:e.role,alias:e.alias,blocked:e.blocked,left_block_time:e.leftBlockTime?a.fromValue(e.leftBlockTime):void 0}))}),m.id=t.id,m.isMember=t.isMember,m.isOffline=t.isOffline,m.participantCount=t.participantCount,m.shortId=t.shortId,m.ticket=t.ticket,m.bizType=t.type,m}}var K=n("461352"),Z=n("867983");class J{static formatMessageKey(e){return`${e.conversationId}:${e.clientId}`}static convertPropertyStore(e){return e.map(e=>({messageId:e.messageId,conversationId:e.conversationId,key:e.key,userId:e.userId,secUid:e.secUid,createTime:e.createTime,idempotentId:e.idempotentId,value:e.value,version:e.version.toString(),status:e.status}))}static fromPropertyStore(e){return e.map(e=>{let t=new Z.z;return t.messageId=e.messageId,t.conversationId=e.conversationId,t.key=e.key,t.userId=e.userId,t.secUid=e.secUid,t.createTime=new Date(e.createTime),t.idempotentId=e.idempotentId,t.value=e.value,t.version=a.fromValue(e.version),t.status=e.status,t})}static toStore(e){var t,n,i;let r=new J;for(let t of(r.clientId=e.clientId,r.content=e.content,r.conversationId=e.conversationId,r.conversationShortId=e.conversationShortId,r.conversationType=e.conversationBizType,r.createdAt=e.createdAt,r.ext=e.ext,r.indexInConversation=e.indexInConversation.toString(),r.indexInConversationV2=e.indexInConversationV2.toString(),r.orderInConversation=e.orderInConversation.toString(),r.secSender=e.secSender,r.sender=e.sender,r.serverId=e.serverId,r.serverStatus=e.serverStatus,r.type=e.type,r.version=e.version.toString(),r.property={},r.isOffline=e.isOffline,r.source=e.source,"number"==typeof e.flightStatus&&(r.flightStatus=e.flightStatus),Object.keys(e.property)))r.property[t]=J.convertPropertyStore(e.property[t]);return"number"==typeof e.flightStatus&&(r.flightStatus=e.flightStatus),e.referenceInfo&&(r.referenceInfo={referenceMessageId:e.referenceInfo.referenced_message_id.toString(),hint:e.referenceInfo.hint,refMessageType:e.referenceInfo.ref_message_type.toString(),referenceMessageStatus:e.referenceInfo.referenced_message_status,rootMessageId:null===(t=e.referenceInfo.root_message_id)||void 0===t?void 0:t.toString(),rootMessageConvIndex:null===(n=e.referenceInfo.root_message_conv_index)||void 0===n?void 0:n.toString(),ext:null!==(i=e.referenceInfo.ext)&&void 0!==i?i:{}}),r}static fromStore(e,t){var n,i;let r=new K.v(e);for(let e of(r.clientId=t.clientId,r.content=t.content,r.conversationId=t.conversationId,r.conversationShortId=t.conversationShortId,r.conversationBizType=t.conversationType,r.createdAt=new Date(t.createdAt),r.ext=t.ext,r.indexInConversation=a.fromValue(t.indexInConversation),r.indexInConversationV2=a.fromValue(null!==(n=t.indexInConversationV2)&&void 0!==n?n:"0"),r.orderInConversation=a.fromValue(t.orderInConversation),r.secSender=t.secSender,r.sender=t.sender,r.serverId=t.serverId,r.serverStatus=t.serverStatus,r.type=t.type,r.version=a.fromValue(t.version),r.isOffline=t.isOffline,r.source=t.source,"number"==typeof r.flightStatus&&(t.flightStatus=r.flightStatus),r.property={},Object.keys(t.property)))r.property[e]=J.fromPropertyStore(t.property[e]);return"number"==typeof t.flightStatus&&(r.flightStatus=t.flightStatus),t.referenceInfo&&(r.referenceInfo={referenced_message_id:a.fromValue(t.referenceInfo.referenceMessageId),hint:t.referenceInfo.hint,ref_message_type:a.fromValue(t.referenceInfo.refMessageType),referenced_message_status:t.referenceInfo.referenceMessageStatus,root_message_id:t.referenceInfo.rootMessageId?a.fromValue(t.referenceInfo.rootMessageId):void 0,root_message_conv_index:t.referenceInfo.rootMessageConvIndex?a.fromValue(t.referenceInfo.rootMessageConvIndex):void 0,ext:null!==(i=t.referenceInfo.ext)&&void 0!==i?i:void 0}),r}}var X=n("526515");class Q{static formatParticipantKey(e){return`${e.conversationId}:${e.userId}`}static toStore(e){var t,n;let i=new Q;return i.userId=e.userId,i.secUid=e.secUid,i.sortOrder=null===(t=e.sortOrder)||void 0===t?void 0:t.toString(),i.role=e.role,i.alias=e.alias,i.conversationId=e.conversationId,i.conversationType=e.conversationType,i.blocked=e.blocked,i.leftBlockTime=null===(n=e.leftBlockTime)||void 0===n?void 0:n.toString(),i.readIndex=e.readIndex.toString(),i.readOrder=e.readOrder.toString(),i.minIndex=e.minIndex.toString(),i}static fromStore(e,t){var n,i,r;let o=new X.Q(e);return o.userId=t.userId,o.secUid=t.secUid,o.sortOrder=t.sortOrder?a.fromValue(t.sortOrder):void 0,o.role=t.role,o.alias=t.alias,o.conversationId=t.conversationId,o.conversationType=t.conversationType,o.blocked=t.blocked,o.leftBlockTime=t.leftBlockTime?a.fromValue(t.leftBlockTime):void 0,o.readIndex=a.fromValue(null!==(n=t.readIndex)&&void 0!==n?n:0),o.readOrder=a.fromValue(null!==(i=t.readOrder)&&void 0!==i?i:0),o.minIndex=a.fromValue(null!==(r=t.minIndex)&&void 0!==r?r:0),o}}var ee=n("949868"),et=n("405110"),en=n("742365"),ei=n("586037");function er(e,t,n){let i=n.value;return n.value=function(...e){return(0,s.mG)(this,void 0,void 0,function*(){let n=0;try{n=ei.u.performanceNow();let r=yield i.call(this,...e);return this.resolve(d.Uk.Monitor).emitDuration(o.ProxyInvoke+ei.U.SuccessSuffix,n,{name:t}),r}catch(e){throw this.resolve(d.Uk.Monitor).emitDuration(o.ProxyInvoke+ei.U.ErrorSuffix,n,{name:t}),c.Y.ctxError(this.ctx,`db proxy op: ${t} error:`,e),new en.G({ctx:this.ctx,type:et.NI.DbOpError,innerError:e,sender:i,msg:`db proxy op: ${t} error`})}})},n}function eo(e,t){var n,i,r,a;return(0,s.mG)(this,void 0,void 0,function*(){let s=yield null===(i=null===(n=window.crypto)||void 0===n?void 0:n.subtle)||void 0===i?void 0:i.digest("SHA-256",ee.Buffer.from(t));return null===(a=null===(r=window.crypto)||void 0===r?void 0:r.subtle)||void 0===a?void 0:a.importKey("raw",s,"AES-CTR",!1,["encrypt","decrypt"]).catch(t=>{e.resolve(d.Uk.Monitor).emitCounter(o.PassphraseError),c.Y.ctxWarn(e,"generateKeyFromPassPhrase error",t)})})}function es(e,t,n){var i,r;return(0,s.mG)(this,void 0,void 0,function*(){try{let e=ee.Buffer.from(window.crypto.getRandomValues(new Uint8Array(16)),0,16),o=yield null===(r=null===(i=window.crypto)||void 0===i?void 0:i.subtle)||void 0===r?void 0:r.encrypt({name:"AES-CTR",counter:e,length:128},t,ee.Buffer.from(JSON.stringify(n)));return{ciphertext:ee.Buffer.from(o).toString("hex"),iv:e.toString("hex")}}catch(t){return c.Y.ctxWarn(e,"encrypt error, using fallback hex, error:",t,"data:",n),e.resolve(d.Uk.Monitor).emitCounter(o.EncryptError),{ciphertext:ee.Buffer.from(JSON.stringify(n)).toString("hex")}}})}function ea(e,t,n){return(0,s.mG)(this,void 0,void 0,function*(){try{let i;if(n.iv){let e=ee.Buffer.from(n.ciphertext,"hex"),r=ee.Buffer.from(n.iv,"hex"),o=yield window.crypto.subtle.decrypt({name:"AES-CTR",counter:r,length:128},t,e);i=JSON.parse(ee.Buffer.from(new Uint8Array(o)).toString())}else if(n.ciphertext)i=JSON.parse(ee.Buffer.from(n.ciphertext).toString());else throw new en.G({ctx:e,type:et.NI.StorageCryptoError,sender:n,msg:"unhandled decrypted data"});return i}catch(t){if(e.resolve(d.Uk.Monitor).emitCounter(o.DecryptError),t instanceof en.G)throw t;throw new en.G({ctx:e,type:et.NI.StorageCryptoError,sender:n,msg:"decryption failed"})}})}!function(e){e.ProxyInvoke="storage.proxy.invoke",e.IntegrityConversationCheckBefore="storage.integrity.conversation.before",e.IntegrityConversationCheckFix="storage.integrity.conversation.fix",e.CacheInit="storage.cache.init",e.CachePrune="storage.cache.prune",e.CacheRetention="storage.cache.retention",e.PassphraseError="storage.passphrase.error",e.EncryptError="storage.encrypt.error",e.DecryptError="storage.decrypt.error",e.CheckMsg="storage.check.msg",e.CheckConv="storage.check.conv"}(o||(o={}));class ec extends f.T{init(e){return new Promise((t,n)=>(0,s.mG)(this,void 0,void 0,function*(){this.currentUserId=e,setTimeout(()=>{t(!1)},1e3),this.db=yield U(`${ec.DbNamePrefix}:${this.ctx.option.boe?"boe":"prod"}:${this.ctx.option.appId}:${e}`,ec.DbVersion,{upgrade(e,t,n,i){e.createObjectStore("config"),e.createObjectStore("conversation",{keyPath:"id",autoIncrement:!1}),e.createObjectStore("message",{autoIncrement:!1}).createIndex("__index_con_id","conversationId"),e.createObjectStore("participant",{autoIncrement:!1}).createIndex("__index_con_id","conversationId"),e.createObjectStore("cursor"),e.createObjectStore("nextCmdIndex"),e.createObjectStore("readConvListVersion"),e.createObjectStore("convListVersion")}});let n=(yield this.db.get("config",f.j.DbVersion))!==void 0,i=(yield this.db.get("config",f.j.DbEncyption))==="true";if(this.ctx.option.encryption?(this.encryptionEnabled=!0,c.Y.ctxDebug(this.ctx,"storage encryption enabled")):(yield this.deleteConfig(f.j.DbEncyption),this.encryptionEnabled=!1),this.encryptionEnabled){let e=yield eo(this.ctx,this.currentUserId);e?this._key=e:(c.Y.ctxError(this.ctx,"load encryption key failed"),this.encryptionEnabled=!1)}n&&!i&&this.encryptionEnabled&&(yield this.clear(!0),c.Y.ctxWarn(this.ctx,"try to load unencrypted data but encryption enabled, clear local data"),n=!1),n&&i&&!this.encryptionEnabled&&(yield this.clear(!0),c.Y.ctxWarn(this.ctx,"try to load encrpyted data but not enabled, clear local data"),n=!1),yield this.db.put("config",ec.DbVersion.toString(),f.j.DbVersion),yield this.db.put("config",Date.now().toString(),f.j.DbLastOpen),yield this.db.put("config",this.encryptionEnabled.toString(),f.j.DbEncyption),t(n)}))}loadConversation(){var e,t;return(0,s.mG)(this,void 0,void 0,function*(){let n=yield this.db.getAll("conversation");if(!this.encryptionEnabled)return n.map(e=>z.fromStore(this.ctx,e));{let i=n.map(e=>ea(this.ctx,this._key,e)),r=yield Promise.allSettled(i),o=[];for(let n of r)if("fulfilled"===n.status)o.push(z.fromStore(this.ctx,n.value));else{let{id:i}=null===(e=n.reason)||void 0===e?void 0:e.sender;c.Y.ctxWarn(this.ctx,`decrypt conversation ${i} error, ${null===(t=n.reason)||void 0===t?void 0:t.message}`),yield this.db.delete("conversation",i)}return o}})}loadMessage(){var e,t;return(0,s.mG)(this,void 0,void 0,function*(){let n=yield this.db.getAll("message");if(!this.encryptionEnabled)return n.map(e=>J.fromStore(this.ctx,e));{let i=n.map(e=>ea(this.ctx,this._key,e)),r=yield Promise.allSettled(i),o=[];for(let n of r)if("fulfilled"===n.status)o.push(J.fromStore(this.ctx,n.value));else{let{clientId:i,conversationId:r}=null===(e=n.reason)||void 0===e?void 0:e.sender;c.Y.ctxWarn(this.ctx,`decrypt message ${i} error, ${null===(t=n.reason)||void 0===t?void 0:t.message}`),yield this.db.delete("message",J.formatMessageKey({clientId:i,conversationId:r}))}return o}})}loadParticipants(){var e,t;return(0,s.mG)(this,void 0,void 0,function*(){let n=yield this.db.getAll("participant");if(!this.encryptionEnabled)return n.map(e=>Q.fromStore(this.ctx,e));{let i=n.map(e=>ea(this.ctx,this._key,e)),r=yield Promise.allSettled(i),o=[];for(let n of r)if("fulfilled"===n.status)o.push(Q.fromStore(this.ctx,n.value));else{let{conversationId:i,userId:r}=null===(e=n.reason)||void 0===e?void 0:e.sender;c.Y.ctxWarn(this.ctx,`decrypt participant ${r} error, ${null===(t=n.reason)||void 0===t?void 0:t.message}`),yield this.db.delete("participant",Q.formatParticipantKey({conversationId:i,userId:r}))}return o}})}upsertMessage(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=J.toStore(e);if(this.encryptionEnabled){let n=yield es(this.ctx,this._key,t),i=Object.assign({conversationId:t.conversationId,clientId:t.clientId},n);yield this.db.put("message",i,J.formatMessageKey(e))}else yield this.db.put("message",t,J.formatMessageKey(e))})}upsertConversation(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=z.toStore(e);if(this.encryptionEnabled){let n=yield es(this.ctx,this._key,z.toStore(e)),i=Object.assign({id:t.id},n);yield this.db.put("conversation",i)}else yield this.db.put("conversation",t)})}upsertParticipant(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=Q.toStore(e);if(this.encryptionEnabled){let e=yield es(this.ctx,this._key,t),n=Object.assign({conversationId:t.conversationId,userId:t.userId},e);yield this.db.put("participant",n,Q.formatParticipantKey(n))}else yield this.db.put("participant",t,Q.formatParticipantKey(t))})}deleteMessage(e){return(0,s.mG)(this,void 0,void 0,function*(){yield this.db.delete("message",J.formatMessageKey(e))})}deleteConversation(e){return(0,s.mG)(this,void 0,void 0,function*(){yield this.clearConversation(e),yield this.db.delete("conversation",e.id)})}deleteParticipant(e){return(0,s.mG)(this,void 0,void 0,function*(){yield this.db.delete("participant",Q.formatParticipantKey(e))})}clearConversation(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=()=>(0,s.mG)(this,void 0,void 0,function*(){var t,n;let i=this.db.transaction("message","readwrite"),r=i.store.index("__index_con_id");try{for(var o,a=(0,s.KL)(r.iterate(e.id));!(o=yield a.next()).done;){let t=o.value;t.value.conversationId===e.id&&(yield t.delete())}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=a.return)&&(yield n.call(a))}finally{if(t)throw t.error}}yield i.done}),n=()=>(0,s.mG)(this,void 0,void 0,function*(){var t,n;let i=this.db.transaction("participant","readwrite"),r=i.store.index("__index_con_id");try{for(var o,a=(0,s.KL)(r.iterate(e.id));!(o=yield a.next()).done;){let t=o.value;t.value.conversationId===e.id&&(yield t.delete())}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=a.return)&&(yield n.call(a))}finally{if(t)throw t.error}}yield i.done});yield Promise.all([t(),n()])})}clear(e){return(0,s.mG)(this,void 0,void 0,function*(){yield Promise.all([this.db.clear("config"),this.db.clear("conversation"),this.db.clear("cursor"),this.db.clear("message"),this.db.clear("participant"),this.db.clear("nextCmdIndex"),this.db.clear("convListVersion"),this.db.clear("readConvListVersion")]),!e&&(yield A(ec.DbNamePrefix+this.currentUserId))})}loadNextCmdIndex(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=yield this.db.get("nextCmdIndex",e);return void 0!==t?a.fromValue(t):void 0})}saveNextCmdIndex(e,t){return(0,s.mG)(this,void 0,void 0,function*(){yield this.db.put("nextCmdIndex",t.toString(),e)})}loadUserCursor(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=yield this.db.get("cursor",e);return void 0!==t?a.fromValue(t):void 0})}saveUserCursor(e,t){return(0,s.mG)(this,void 0,void 0,function*(){yield this.db.put("cursor",t.toString(),e)})}loadConvListVersion(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=yield this.db.get("convListVersion",e);return void 0!==t?a.fromValue(t):void 0})}saveConvListVersion(e,t){return(0,s.mG)(this,void 0,void 0,function*(){yield this.db.put("convListVersion",t.toString(),e)})}loadReadConvListVersion(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=yield this.db.get("readConvListVersion",e);return void 0!==t?a.fromValue(t):void 0})}saveReadConvListVersion(e,t){return(0,s.mG)(this,void 0,void 0,function*(){yield this.db.put("readConvListVersion",t.toString(),e)})}saveConfig(e,t){return(0,s.mG)(this,void 0,void 0,function*(){yield this.db.put("config",t,e)})}loadConfig(e){var t;return(0,s.mG)(this,void 0,void 0,function*(){return null!==(t=yield this.db.get("config",e))&&void 0!==t?t:""})}deleteConfig(e){return(0,s.mG)(this,void 0,void 0,function*(){yield this.db.delete("config",e)})}checkMessages(){return(0,s.mG)(this,void 0,void 0,function*(){})}}ec.DbNamePrefix="imsdk",ec.DbVersion=2;var ed=n("730512"),eu=n("120645"),el=n("736114");class ev extends f.T{constructor(e,t){super(e),this.installed=!1,this.isUsingDb=!1,this.maxConversationCount=1e3,this.minMessageCount=200,this.driver=t}init(e){return(0,s.mG)(this,void 0,void 0,function*(){this.installed=!0;let t=ei.u.performanceNow();try{return this.isUsingDb=yield this.driver.init(e),this.isUsingDb&&(yield this.fillData(),c.Y.ctxDebug(this.ctx,`load data from cache for user: ${e}`)),this.resolve(d.Uk.Monitor).emitDuration(o.CacheInit+ei.U.SuccessSuffix,t),this.isUsingDb}catch(e){return c.Y.ctxError(this.ctx,"init db error:",e),this.resolve(d.Uk.MessageManager).clearAll(),this.resolve(d.Uk.ConversationManager).clearAll(),this.resolve(d.Uk.ParticipantManager).clearAll(),this.resolve(d.Uk.Monitor).emitDuration(o.CacheInit+ei.U.ErrorSuffix,t),this.isUsingDb=!1,!1}})}clear(e){return this.isUsingDb?this.driver.clear(e):Promise.resolve()}loadMessage(){return this.isUsingDb?this.driver.loadMessage():Promise.resolve([])}loadConversation(){return this.isUsingDb?this.driver.loadConversation():Promise.resolve([])}loadParticipants(){return this.isUsingDb?this.driver.loadParticipants():Promise.resolve([])}upsertMessage(e){var t;return(0,s.mG)(this,void 0,void 0,function*(){try{this.isUsingDb&&(yield this.driver.upsertMessage(e))}catch(n){throw void 0!==n&&this.resolve(d.Uk.Monitor).emitTracker(el.W.SaveMessageError,{error_msg:n.message,error_stack:n.stack,msg_source:Number.parseInt(null!==(t=e.source.toString())&&void 0!==t?t:"-1",10)}),n}})}upsertConversation(e){return this.isUsingDb?this.driver.upsertConversation(e):Promise.resolve()}upsertParticipant(e){return this.isUsingDb?this.driver.upsertParticipant(e):Promise.resolve()}deleteMessage(e){return this.isUsingDb?this.driver.deleteMessage(e):Promise.resolve()}deleteConversation(e){return this.isUsingDb?this.driver.deleteConversation(e):Promise.resolve()}deleteParticipant(e){return this.isUsingDb?this.driver.deleteParticipant(e):Promise.resolve()}clearConversation(e){return this.isUsingDb?this.driver.clearConversation(e):Promise.resolve()}loadUserCursor(e){return(0,s.mG)(this,void 0,void 0,function*(){return this.isUsingDb?this.driver.loadUserCursor(e):Promise.resolve(void 0)})}saveUserCursor(e,t){return this.isUsingDb?this.driver.saveUserCursor(e,t):Promise.resolve()}loadReadConvListVersion(e){return(0,s.mG)(this,void 0,void 0,function*(){return this.isUsingDb?this.driver.loadReadConvListVersion(e):Promise.resolve(void 0)})}saveReadConvListVersion(e,t){return this.isUsingDb?this.driver.saveReadConvListVersion(e,t):Promise.resolve(void 0)}loadNextCmdIndex(e){return(0,s.mG)(this,void 0,void 0,function*(){return this.isUsingDb?this.driver.loadNextCmdIndex(e):Promise.resolve(void 0)})}saveNextCmdIndex(e,t){return this.isUsingDb?this.driver.saveNextCmdIndex(e,t):Promise.resolve(void 0)}loadConvListVersion(e){return(0,s.mG)(this,void 0,void 0,function*(){return this.isUsingDb?this.driver.loadConvListVersion(e):Promise.resolve(void 0)})}saveConvListVersion(e,t){return this.isUsingDb?this.driver.saveConvListVersion(e,t):Promise.resolve(void 0)}saveConfig(e,t){return this.isUsingDb?this.driver.saveConfig(e,t):Promise.resolve(void 0)}loadConfig(e){return this.isUsingDb?this.driver.loadConfig(e):Promise.resolve("")}checkMessages(e){return(0,s.mG)(this,void 0,void 0,function*(){if(this.ctx.initResult!==et.rb.Succeeded||!(yield this.isNeedCheck(e.id)))return;let{id:t,shortId:n,type:i}=e,r=this.ctx.config.get(eu.IL.conversationMsgRepairCount);for(let o of this.resolve(d.Uk.InboxType).getInboxTypeArray()){let s=(yield this.resolve(d.Uk.StorageApi).GetMessagesCheckInfoInConversation({conversationId:t,conversationShortId:n,conversationType:i,inboxType:o,cursorReverseEnd:e.minIndex.toString(),expectedTotalMessageCount:r})).msgs_checkinfo_list;c.Y.ctxDebug(this.ctx,`msgs check: ${e.id}, msgs checkinfo list:`,s);let a=e.getMessageList(()=>!0);for(let t of(c.Y.ctxDebug(this.ctx,`msgs check: ${e.id}, local msg list:`,a),s)){let{isMissingQuantity:n,isMissTail:i}=this.getDiffMsg({minIndex:e.minIndex,headIndex:t.head_msg_index,tailIndex:t.tail_msg_index,serverCount:t.msg_count,localMsgList:a});yield this.syncMissMessages({isMissTail:i,isMissingQuantity:n,conversation:e,localMsgList:a,msgsCheckinfo:t,msgsCheckinfoList:s})}}})}isNeedCheck(e){return(0,s.mG)(this,void 0,void 0,function*(){let t=yield this.loadConfig(f.j.ConversationMsgCheckTime),n=t?JSON.parse(t):{},i=this.ctx.config.get(eu.IL.conversationMsgRepairInterval);return c.Y.ctxDebug(this.ctx,`msgs check: ${e}, config.interval ${i}, db.checkTimeConfig, ${n[e]}`),!!(!n[e]||Date.now()-n[e]>i)&&(n[e]=Date.now(),this.saveConfig(f.j.ConversationMsgCheckTime,JSON.stringify(n)),!0)})}getDiffMsg(e){let{minIndex:t,headIndex:n,tailIndex:i,serverCount:r,localMsgList:o}=e,s=0,a=!0;for(let e of o)e.indexInConversation.eq(i)?(a=!1,s++):e.indexInConversation.gte(n)&&e.indexInConversation.lt(i)&&s++;return{isMissingQuantity:s<r+(t.eq(n)?-1:0),isMissTail:a}}syncMissMessages(e){return(0,s.mG)(this,void 0,void 0,function*(){let{isMissTail:t,isMissingQuantity:n,conversation:i,msgsCheckinfoList:r,msgsCheckinfo:s,localMsgList:a}=e,u=[];if(t){let e=r.map(e=>e.head_msg_index).find(e=>null==e?void 0:e.gt(s.tail_msg_index));if(e){let{messages:t}=yield this.resolve(d.Uk.CoreInstance).getMessagesByConversation({conversation:i,cursor:e,direction:l.m.MessageDirection.OLDER,limit:1});Array.prototype.push.apply(u,t)}}if(n){let{messages:e}=yield this.resolve(d.Uk.CoreInstance).getMessagesByConversation({conversation:i,cursor:s.tail_msg_index,direction:l.m.MessageDirection.OLDER,limit:s.msg_count});c.Y.ctxDebug(this.ctx,`msgs check: ${i.id}, get messages by conversation:`,e),Array.prototype.push.apply(u,e.filter(e=>!e.isSpecialMessage&&!a.find(t=>t.serverId===e.serverId)))}c.Y.ctxDebug(this.ctx,`msgs check: ${i.id}, miss msg list:`,u),this.resolve(d.Uk.Monitor).emitMetrics(o.CheckMsg,{leak_count:u.length},{conversation_id:i.id})})}isOlderThan(e,t){return e.getTime()+864e5*t<Date.now()}fillData(){return(0,s.mG)(this,void 0,void 0,function*(){let e=yield this.driver.loadConversation(),t=e.filter(e=>this.resolve(d.Uk.InboxType).isValidInbox(e.inboxType));this.resolve(d.Uk.ConversationManager).applyLocal(t),e.length!==t.length&&0!==e.length&&c.Y.ctxWarn(this.ctx,`skip ${e.length-t.length} conversation for invalid inbox`);let n=yield this.driver.loadMessage(),i=n.filter(e=>t.some(t=>t.id===e.conversationId));if(this.resolve(d.Uk.MessageManager).applyLocal(i),n.length!==i.length&&0!==n.length&&c.Y.ctxWarn(this.ctx,`skip ${n.length-i.length} message for invalid inbox`),this.resolve(d.Uk.ParticipantManager)){let e=yield this.driver.loadParticipants(),n=e.filter(e=>t.some(t=>t.id===e.conversationId));e.length!==n.length&&0!==e.length&&c.Y.ctxWarn(this.ctx,`skip ${e.length-n.length} participant for invalid inbox`),this.resolve(d.Uk.ParticipantManager).applyLocal(n)}this.pruneData();let r=-1;"number"==typeof this.ctx.option.retention?r=this.ctx.option.retention:!0===this.ctx.option.retention&&(r=0),r>=0&&this.retention(r,i)})}pruneData(){let e=ei.u.performanceNow(),t=this.resolve(d.Uk.ConversationManager).getConversationArray(()=>!0),n=this.resolve(d.Uk.MessageManager).getRawMap(),i=t.map(e=>e.id).reduce((e,t)=>(e[t]=!0,e),{}),r=[];n.forEach((e,t)=>{void 0===i[t]&&r.push(t)}),r.length>0&&(c.Y.ctxWarn(this.ctx,"prune conversations:",r),setTimeout(()=>(0,s.mG)(this,void 0,void 0,function*(){for(let e of r)yield this.deleteConversation({id:e})}),0)),this.resolve(d.Uk.Monitor).emitDuration(o.CachePrune,e)}retention(e,t){let n=ei.u.performanceNow(),i=this.resolve(d.Uk.ConversationManager).getConversationArray(()=>!0);if(i.length>this.maxConversationCount){let e=[];for(;i.length>this.maxConversationCount;)e.push(i.pop());e.length>0&&(setTimeout(()=>(0,s.mG)(this,void 0,void 0,function*(){for(let t of e)yield this.deleteConversation(t)})),c.Y.ctxWarn(this.ctx,`retention ${e.length} overflow conversations`))}let r=[];if(e>=0&&void 0!==t&&t.length>0){let n=(0,ed.vM)(t,e=>e.conversationId);for(let t of Object.keys(n)){let i=n[t];if(i.length<=this.minMessageCount)continue;let o=i.length;for(let t of i){if(o<=this.minMessageCount)break;this.isOlderThan(t.createdAt,e)&&(r.push(t),o--)}}r.length>0&&(setTimeout(()=>(0,s.mG)(this,void 0,void 0,function*(){for(let e of r)yield this.deleteMessage(e)}),0),c.Y.ctxWarn(this.ctx,`retention ${r.length} overflow messages`))}this.resolve(d.Uk.Monitor).emitDuration(o.CacheRetention,n)}}function eh(){if("undefined"==typeof window)return!1;for(let e of["indexedDB","IDBDatabase","IDBObjectStore","IDBTransaction","IDBIndex","IDBCursor","IDBKeyRange","IDBRequest"])if(!window.hasOwnProperty(e)||!window[e])return!1;return!0}(0,s.gn)([er],ev.prototype,"clear",null),(0,s.gn)([er],ev.prototype,"loadMessage",null),(0,s.gn)([er],ev.prototype,"loadConversation",null),(0,s.gn)([er],ev.prototype,"loadParticipants",null),(0,s.gn)([er],ev.prototype,"upsertMessage",null),(0,s.gn)([er],ev.prototype,"upsertConversation",null),(0,s.gn)([er],ev.prototype,"upsertParticipant",null),(0,s.gn)([er],ev.prototype,"deleteMessage",null),(0,s.gn)([er],ev.prototype,"deleteConversation",null),(0,s.gn)([er],ev.prototype,"deleteParticipant",null),(0,s.gn)([er],ev.prototype,"clearConversation",null),(0,s.gn)([er],ev.prototype,"loadUserCursor",null),(0,s.gn)([er],ev.prototype,"saveUserCursor",null),(0,s.gn)([er],ev.prototype,"loadReadConvListVersion",null),(0,s.gn)([er],ev.prototype,"saveReadConvListVersion",null),(0,s.gn)([er],ev.prototype,"loadNextCmdIndex",null),(0,s.gn)([er],ev.prototype,"saveNextCmdIndex",null),(0,s.gn)([er],ev.prototype,"loadConvListVersion",null),(0,s.gn)([er],ev.prototype,"saveConvListVersion",null),(0,s.gn)([er],ev.prototype,"saveConfig",null),(0,s.gn)([er],ev.prototype,"loadConfig",null),(0,s.gn)([er],ev.prototype,"checkMessages",null);class ef extends u.v{constructor(){super(...arguments),this.name="StoragePlugin"}install(){if(this.instance.clearCache=this.extendFunc(this.clearCache),!0===this.ctx.option.storage){let e=this.selectDriver();if(!e){c.Y.ctxWarn(this.ctx,"no support driver found, disable db integration");return}this.driver=new ev(this.ctx,e),this.register(d.Uk.DbProxy,this.driver),void 0===this.ctx.option.integrityCheck&&(this.ctx.option.integrityCheck=!0)}this.api=this.register(d.Uk.StorageApi,h),this.register(d.Uk.StoragePlugin,this)}clearCache(){return(0,s.mG)(this,void 0,void 0,function*(){return yield this.dispose(),this.driver.clear()})}selectDriver(){return void 0!==this.ctx.option.driver?this.ctx.option.driver:eh()?new ec(this.ctx):void 0}init(){return(0,s.mG)(this,void 0,void 0,function*(){if(this.driver&&this.ctx.option.integrityCheck)try{yield this.checkConversation()}catch(e){c.Y.ctxWarn(this.ctx,"conversation integrity check err, be careful for conversation missing:",e)}})}checkConversation(){return(0,s.mG)(this,void 0,void 0,function*(){let e=this.resolve(d.Uk.ConversationManager).getConversationArray(e=>!e.isOffline).length,t=[];for(let e of this.resolve(d.Uk.InboxType).getInboxTypeArray()){if(void 0!==this.driver.loadUserCursor(e))(yield this.api.GetConversationsCheckInfo({inboxType:e})).conversation_checkinfo_list.forEach(e=>{let n=this.resolve(d.Uk.ConversationManager).getRaw(e.conversation_id);(void 0===n||0===n.getMessageList().length)&&t.push(e)})}let n=0;if(0!==t.length){c.Y.ctxWarn(this.ctx,"conversation missing:",t);let e=t.map(e=>this.resolve(d.Uk.ConversationManager).getWithCreateLocal(e.conversation_id,e.conversation_short_id.toString(),e.conversation_type));for(let t of yield this.resolve(d.Uk.ConversationManager).refreshAsync(e))try{yield this.resolve(d.Uk.CoreInstance).getMessagesByConversation({conversation:t})}catch(e){c.Y.ctxError(this.ctx,"pulling integrity check message error:",e)}n=e.map(e=>this.resolve(d.Uk.ConversationManager).getRaw(e.id)).map(e=>void 0!==e&&0!==e.getMessageList().length).filter(e=>!e).length}this.resolve(d.Uk.Monitor).emitMetrics(o.CheckConv,{leak_count:t.length,link_mode:0},{is_pre_check:"1",bad_check:0===n?"false":"true"}),this.resolve(d.Uk.Monitor).emitCounter(o.IntegrityConversationCheckBefore,e),this.resolve(d.Uk.Monitor).emitCounter(o.IntegrityConversationCheckFix,t.length),yield this.resolve(d.Uk.ConversationManager).refreshLocalAsync()})}}},887558:function(e,t,n){"use strict";n.d(t,{l:function(){return y}});var i=n("954090"),r=n("361073"),o=n("720709"),s=n("405110"),a=n("125415"),c=n("694253"),d=n("629552"),u=n("878042"),l=n("461352");n("808244");var v=n("711061"),h=n("150301");n("211849");class f extends h.W{GetStrangerConversationList(e){return(0,i.mG)(this,void 0,void 0,function*(){let t=o.m.RequestBody.create({get_stranger_conversation_body:{cursor:e.cursor,count:r.fromValue(e.limit),show_total_unread:!0}});return this.sendWithRawBody(t,o.m.IMCMD.GET_STRANGER_CONVERSATION_LIST)})}GetStrangerConversationMessage(e){return(0,i.mG)(this,void 0,void 0,function*(){let t=o.m.RequestBody.create({get_stranger_messages_body:{conversation_short_id:e.shortId,reset_unread_count:e.resetUnreadCount}});return this.sendWithRawBody(t,o.m.IMCMD.GET_STRANGER_MESSAGES_IN_CONVERSATION)})}DeleteStrangerConversation(e){return(0,i.mG)(this,void 0,void 0,function*(){let t=o.m.RequestBody.create({delete_stranger_conversation_body:{conversation_short_id:e.shortId}});return this.send(t,o.m.IMCMD.DELETE_STRANGER_CONVERSATION)})}MarkStrangerConversationRead(e){return(0,i.mG)(this,void 0,void 0,function*(){let t=o.m.RequestBody.create({mark_stranger_conversation_read_body:{conversation_short_id:e.shortId}});return this.send(t,o.m.IMCMD.MARK_STRANGER_CONVERSATION_READ)})}MarkAllStrangerConversationRead(){return(0,i.mG)(this,void 0,void 0,function*(){let e=o.m.RequestBody.create({mark_stranger_all_conversation_read_body:{}});return this.send(e,o.m.IMCMD.MARK_ALL_STRANGER_CONVERSATIONS_READ)})}DeleteAllStrangerConversation(){return(0,i.mG)(this,void 0,void 0,function*(){let e=o.m.RequestBody.create({delete_stranger_all_conversation_body:{}});return this.send(e,o.m.IMCMD.DELETE_ALL_STRANGER_CONVERSATIONS)})}}var p=n("546405"),g=n("421914");class m extends g.f{process(e){return(0,i.mG)(this,void 0,void 0,function*(){if(e.data.type===o.m.MessageType.MESSAGE_TYPE_MODE_CHANGE){let t=this.resolve(c.Uk.ConversationManager).getRaw(e.data.conversationId);if(!t)return a.Y.ctxDebug(this.ctx,`conversation ${e.data.conversationId} not exist, ignore upgrade`),e;if(!t.isStrangerConversation)return a.Y.ctxDebug(this.ctx,`conversation ${e.data.conversationId} not stranger, ignore upgrade`),e;this.resolve(c.Uk.ConversationManager).delete(e.data.conversationId);let n=yield this.resolve(c.Uk.ConversationManager).getWithOnline(e.data.conversationId,e.data.conversationShortId,e.data.conversationType);if(!n)return a.Y.ctxDebug(this.ctx,`conversation ${e.data.conversationId} not exist, ignore upgrade`),e;this.resolve(c.Uk.ConversationManager).markRead(n.id,n.lastMessageIndex,n.badgeCount,[]),a.Y.ctxDebug(this.ctx,"stranger upgrade,",n),this.resolve(c.Uk.EventBus).emit(s.c5.StrangerUpgrade,this,n),e.needContinue=!1}return e})}}class y extends v.v{constructor(){super(...arguments),this.name="StrangerPlugin",this.internalUnreadCount=0}getStrangerConversationList(e={}){var t,n,s,a,v,h,f;return(0,i.mG)(this,void 0,void 0,function*(){let i=yield this.api.GetStrangerConversationList({cursor:e.cursor?r.fromValue(e.cursor):r.ZERO,limit:null!==(t=e.limit)&&void 0!==t?t:10}),g=null===(n=i.body)||void 0===n?void 0:n.get_stranger_conversation_body,m=g.conversation_list;this.internalUnreadCount=g.total_unread;let y=!1;if((null===(s=e.cursor)||void 0===s?void 0:s.toString())==="0"&&1===e.limit){let e=yield this.getStrangerPreview({sync:!1});m&&1===m.length&&(null===(a=null==e?void 0:e.conversation)||void 0===a?void 0:a.id)===m[0].conversation_id&&(null===(v=null==e?void 0:e.message)||void 0===v?void 0:v.serverId)===(null===(f=null===(h=m[0].last_message)||void 0===h?void 0:h.server_message_id)||void 0===f?void 0:f.toString())&&(null==e?void 0:e.unreadCount)===(null==g?void 0:g.total_unread)&&(y=!0)}return{conversation:m.map(e=>{var t;let n=new p.C(this.ctx);if(n.coreInfo=new d._(n),n.settingInfo=new u.H(n),n.id=e.conversation_id,n.shortId=e.conversation_short_id.toString(),n.type=o.m.ConversationType.ONE_TO_ONE_CHAT,n.unreadCount=e.unread,n.isOffline=!1,n.firstPageParticipant=o.m.ParticipantsPage.create({participants:e.participants}),n.ext=null!==(t=e.ext)&&void 0!==t?t:{},!y){this.resolve(c.Uk.ConversationManager).upsert(n);let t=l.v.fromServerMessage(this.ctx,e.last_message,i.log_id);this.resolve(c.Uk.MessageManager).upsert(t)}return n}),unreadCount:null==g?void 0:g.total_unread,hasMore:null==g?void 0:g.has_more,cursor:null==g?void 0:g.next_cursor}})}getStrangerConversationMessage(e){var t,n;return(0,i.mG)(this,void 0,void 0,function*(){let i=yield this.api.GetStrangerConversationMessage({shortId:r.fromString(e.conversation.shortId),resetUnreadCount:null!==(t=e.resetUnreadCount)&&void 0!==t&&t});return(null===(n=i.body)||void 0===n?void 0:n.get_stranger_messages_body).messages.forEach(e=>this.resolve(c.Uk.MessageManager).upsert(l.v.fromServerMessage(this.ctx,e,i.log_id))),this.resolve(c.Uk.MessageManager).getList(e.conversation.id)})}deleteStrangerConversation(e){return(0,i.mG)(this,void 0,void 0,function*(){yield this.api.DeleteStrangerConversation({shortId:r.fromString(e.conversation.shortId)}),this.resolve(c.Uk.ConversationManager).delete(e.conversation.id)})}deleteAllStrangerConversation(){return(0,i.mG)(this,void 0,void 0,function*(){yield this.api.DeleteAllStrangerConversation(),this.resolve(c.Uk.ConversationManager).getConversationArray(e=>0!==e.mode).forEach(e=>this.resolve(c.Uk.ConversationManager).delete(e.id)),this.internalUnreadCount=0})}markStrangerConversationRead(e){return(0,i.mG)(this,void 0,void 0,function*(){yield this.api.MarkStrangerConversationRead({shortId:r.fromString(e.conversation.shortId)}),this.internalUnreadCount-=e.conversation.unreadCount,e.conversation.unreadCount=0,this.resolve(c.Uk.ConversationManager).upsert(e.conversation)})}markAllStrangerConversationRead(){return(0,i.mG)(this,void 0,void 0,function*(){yield this.api.MarkAllStrangerConversationRead(),this.resolve(c.Uk.ConversationManager).getConversationArray(e=>0!==e.mode).forEach(e=>{e.unreadCount=0,this.resolve(c.Uk.ConversationManager).upsert(e)}),this.internalUnreadCount=0})}getStrangerPreview(e={}){var t;return(0,i.mG)(this,void 0,void 0,function*(){let n=yield this.refreshStrangerPreviewConversation(null!==(t=null==e?void 0:e.sync)&&void 0!==t&&t);return n?{conversation:n,message:n.lastVisibleMessage,unreadCount:this.internalUnreadCount}:null})}install(){this.api=this.register(c.Uk.StrangerApi,f),this.register(c.Uk.StrangerPlugin,this),this.instance.getStrangerConversationList=this.extendFunc(this.getStrangerConversationList),this.instance.getStrangerConversationMessage=this.extendFunc(this.getStrangerConversationMessage),this.instance.deleteStrangerConversation=this.extendFunc(this.deleteStrangerConversation),this.instance.deleteAllStrangerConversation=this.extendFunc(this.deleteAllStrangerConversation),this.instance.markStrangerConversationRead=this.extendFunc(this.markStrangerConversationRead),this.instance.markAllStrangerConversationRead=this.extendFunc(this.markAllStrangerConversationRead),this.instance.getStrangerPreview=this.extendFunc(this.getStrangerPreview),this.resolve(c.Uk.MessageManager).injectProcessor(new m(this.ctx)),this.resolve(c.Uk.EventBus).subscribe(s.c5.StrangerUpgrade,e=>(0,i.mG)(this,void 0,void 0,function*(){yield this.resolve(c.Uk.CoreInstance).getMessagesByUser({inboxType:e.inboxType})}))}init(){return(0,i.mG)(this,void 0,void 0,function*(){try{yield this.getStrangerPreview({sync:!0})}catch(e){a.Y.ctxWarn(this.ctx,"stranger plugin init error:",e)}})}receivePacket(e){var t;return(0,i.mG)(this,void 0,void 0,function*(){if(e.cmd===o.m.IMCMD.STRANGER_NEW_MSG_NOTIFY){let n=null===(t=e.body)||void 0===t?void 0:t.has_new_message_notify.message;if(!this.resolve(c.Uk.ConversationManager).getRaw(n.conversation_id))return;let i=l.v.fromServerMessage(this.ctx,n,e.log_id);this.resolve(c.Uk.MessageManager).upsert(i),this.internalUnreadCount++,this.resolve(c.Uk.EventBus).emit(s.c5.ReceiveNewStrangerMessage,this,i)}})}ticker(){return(0,i.mG)(this,void 0,void 0,function*(){this.ctx.option.pullInterval&&(yield this.refreshStrangerPreviewConversation(!0))})}refreshStrangerPreviewConversation(e=!1){return(0,i.mG)(this,void 0,void 0,function*(){for(let t of(e&&(yield this.getStrangerConversationList({cursor:r.ZERO,limit:1})),this.resolve(c.Uk.ConversationManager).getConversationArray(e=>0!==e.mode)))if(t.lastVisibleMessage)return t;return null})}}},546405:function(e,t,n){"use strict";n.d(t,{C:function(){return r}}),n(361073);var i=n(491326);n(808244),n(211849);class r extends i.r{get unreadCount(){return this.internalUnreadCount}set unreadCount(e){this.internalUnreadCount=e}get mode(){let e=this.toParticipantUserId,t=this.id.split(":");return t[2]===e?1:t[3]===e?2:3}get ext(){return this.coreInfo.ext}set ext(e){this.coreInfo.ext=e}}},638033:function(e,t,n){"use strict";n.d(t,{A:function(){return eP}});var i,r,o,s,a=n("954090"),c=n("361073"),d=n("720709"),u=n("405110"),l=n("125415"),v=n("150301");class h extends v.W{SendMessage(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({send_message_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,content:e.content,mentioned_users:e.mentionedUsers,client_message_id:e.clientId,ticket:e.ticket,message_type:e.messageType,ext:e.ext,ref_msg_info:e.referenceInfo}});return this.sendWithRawBody(t,d.m.IMCMD.SEND_MESSAGE,{inboxType:e.inboxType,maxRetryTimes:this.ctx.option.maxSendMsgRetryTimes})})}GetMessagesByUser(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({messages_per_user_body:{cursor:e.cursor,limit:e.limit}});try{return yield this.sendWithRawBody(t,d.m.IMCMD.GET_MESSAGES_BY_USER,{inboxType:e.inboxType,maxRetryTimes:1})}catch(t){return l.Y.ctxWarn(this.ctx,`pull user error:${t}, ignore`),d.m.Response.create({body:d.m.ResponseBody.create({messages_per_user_body:d.m.MessagesPerUserResponseBody.create({next_cursor:e.cursor,has_more:!1,messages:[]})})})}})}GetMessagesByUserInitV2(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({messages_per_user_init_v2_body:{cursor:e.cursor,init_sub_type:e.initSubType,conv_limit:e.convLimit,msg_limit:e.msgLimit,biz_tag_ids:e.tagIds,user_custom_tag_ids:e.userCustomTagIds}});return this.sendWithRawBody(t,d.m.IMCMD.GET_MESSAGES_BY_USER_INIT_V2,{inboxType:e.inboxType,forceHttp:!0,maxRetryTimes:10})})}GetMessagesByInit(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({message_by_init:{version:e.version,page:e.page,conv_limit:e.convLimit,msg_limit:e.msgLimit}});return this.sendWithRawBody(t,d.m.IMCMD.GET_MESSAGE_BY_INIT,{inboxType:e.inboxType,forceHttp:!0,maxRetryTimes:10})})}GetMessagesByConversation(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({messages_in_conversation_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,anchor_index:e.anchorIndex,limit:e.limit,direction:e.direction}});return this.sendWithRawBody(t,d.m.IMCMD.GET_MESSAGES_BY_CONVERSATION,{inboxType:e.inboxType,forceHttp:!0})})}CreateConversationV2(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({create_conversation_v2_body:{conversation_type:e.type,participants:e.participants,persistent:e.persistent,idempotent_id:e.idempotentId,name:e.name,avatar_url:e.avatarUrl,description:e.desc,biz_ext:e.bizExt}});return this.sendWithRawBody(t,d.m.IMCMD.CREATE_CONVERSATION_V2,{inboxType:e.inboxType})})}GetConversationInfoListV2(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({get_conversation_info_list_v2_body:{conversation_info_list:e.conversations.map(e=>({conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType}))}});return this.sendWithRawBody(t,d.m.IMCMD.GET_CONVERSATION_INFO_LIST_V2,{inboxType:e.inboxType})})}MarkConversationReadV3(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({mark_conversation_read_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,read_message_index:e.readIndex,conv_unread_count:e.unreadCount,total_unread_count:e.totalUnreadCount,mute_read_badge_count_infos:e.muteReadBadgeCountInfos,read_badge_count:e.readBadgeCount}});return this.send(t,d.m.IMCMD.MARK_CONVERSATION_READ_V3,{inboxType:e.inboxType,maxRetryTimes:1})})}BatchMarkConversationReadV3(e){return(0,a.mG)(this,void 0,void 0,function*(){if(!e.batch.length)return;let t=d.m.RequestBody.create({batch_mark_read_body:{mark_read_requests:e.batch.map(e=>({conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,read_message_index:e.readIndex,conv_unread_count:e.unreadCount,total_unread_count:e.totalUnreadCount,read_message_index_v2:e.readIndexV2,mute_read_badge_count_infos:e.muteReadBadgeCountInfos,read_badge_count:e.readBadgeCount}))}});return this.send(t,d.m.IMCMD.BATCH_MARK_CONVERSATION_READ_V3,{inboxType:e.batch[0].inboxType,maxRetryTimes:1})})}RecallMessage(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({recall_message_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,server_message_id:e.serverId}});return this.sendWithRawBody(t,d.m.IMCMD.RECALL_MESSAGE,{inboxType:e.inboxType})})}GetTicket(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({get_ticket_body:{ticket_type:u.HF.ticketType,conversation_type:e.conversationType,conversation_short_id:e.shortId,to_id:e.toId,ext:e.ext}});return(yield this.send(t,d.m.IMCMD.GET_TICKET,{inboxType:e.inboxType})).get_ticket_body})}GetConversationParticipantsList(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({conversation_participants_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,cursor:e.cursor,limit:e.limit}});return this.sendWithRawBody(t,d.m.IMCMD.CONVERSATION_PARTICIPANTS_LIST,{inboxType:e.inboxType})})}GetConversationParticipantByUserId(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({mget_conversation_participants_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType,participants:e.participants}});return this.sendWithRawBody(t,d.m.IMCMD.MGET_CONVERSATION_PARTICIPANTS,{inboxType:e.inboxType})})}ClientAck(e){return(0,a.mG)(this,void 0,void 0,function*(){try{let t=d.m.RequestBody.create({client_ack_body:{start_time_stamp:e.startTimeStamp,cmd:e.cmd,network_type:e.NetworkType,logid:e.logid,client_time_stamp:e.clientTimeStamp,server_message_id:e.serverId,type:e.type}});yield this.send(t,d.m.IMCMD.CLIENT_ACK,{useBeacon:!0,inboxType:e.inboxType})}catch(e){l.Y.ctxWarn(this.ctx,`send ack error: ${e}, ignore`)}})}ClientBatchAck(e){var t,n;return(0,a.mG)(this,void 0,void 0,function*(){try{let i=null===(t=null==e?void 0:e.map)||void 0===t?void 0:t.call(e,e=>({start_time_stamp:e.startTimeStamp,cmd:e.cmd,network_type:e.NetworkType,logid:e.logid,client_time_stamp:e.clientTimeStamp,server_message_id:e.serverId,type:e.type})),r=d.m.RequestBody.create({client_batch_ack_body:{ack_list:i}});yield this.send(r,d.m.IMCMD.CLIENT_BATCH_ACK,{useBeacon:!0,inboxType:null===(n=null==e?void 0:e[0])||void 0===n?void 0:n.inboxType})}catch(e){l.Y.ctxWarn(this.ctx,`send batch ack error: ${e}, ignore`)}})}BatchGetConversationParticipantsReadIndex(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({batch_get_conversation_participants_readindex:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,request_from:e.request_from,min_index_required:e.min_index_required}});return(yield this.send(t,d.m.IMCMD.BATCH_GAT_CONVERSATION_PARTICIPANTS_READINDEX)).batch_get_conversation_participants_readindex})}GetConversationParticipantsReadIndexV3(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({participants_read_index_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType}});return(yield this.send(t,d.m.IMCMD.GET_CONVERSATION_PARTICIPANTS_READ_INDEX_V3,{inboxType:e.inboxType})).participants_read_index_body})}GetConversationParticipantsMinIndexV3(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({participants_min_index_body:{conversation_id:e.conversationId,conversation_short_id:e.conversationShortId,conversation_type:e.conversationType}});return(yield this.send(t,d.m.IMCMD.GET_CONVERSATION_PARTICIPANTS_MIN_INDEX_V3,{inboxType:e.inboxType})).participants_min_index_body})}GetConfigs(){return(0,a.mG)(this,void 0,void 0,function*(){let e=d.m.RequestBody.create();return(yield this.send(e,d.m.IMCMD.GET_CONFIGS)).get_configs_body})}GetUserMessage(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=d.m.RequestBody.create({get_user_message:{version:e.version,cmd_index:e.cmdIndex,read_version:e.readVersion,source:e.source}});try{return yield this.sendWithRawBody(t,d.m.IMCMD.GET_USER_MESSAGE,{inboxType:e.inboxType,maxRetryTimes:1,forceHttp:!0})}catch(e){return l.Y.ctxWarn(this.ctx,`pull user error:${e}, ignore`),d.m.Response.create({body:d.m.ResponseBody.create({get_user_message:d.m.GetUserMessageResponseBody.create({})})})}})}}var f=n("742365"),p=n("694253");class g{constructor(e,t,n){this.index=e,this.subject=t,this.handler=n}unsubscribe(){this.subject.unsubscribe(this)}}class m extends p.mA{constructor(){super(...arguments),this.subscriptions=new Map,this.idx=0}subscribe(e){for(let t of this.subscriptions.values())if(e===t.handler)return l.Y.ctxDebug(this.ctx,"ignore duplicate handler:",e),t;let t=new g(this.idx,this,e);return this.subscriptions.set(this.idx,t),this.idx++,t}nextEmpty(e){for(let t of this.subscriptions.values())if(t&&t.handler)try{t.handler({},e)}catch(e){l.Y.ctxWarn(this.ctx,"error in event handler:",e)}}next(e,t){for(let n of this.subscriptions.values())if(n&&n.handler)try{n.handler(e,t)}catch(e){l.Y.ctxWarn(this.ctx,"error in event handler:",e)}}unsubscribe(e){if(!!e)this.subscriptions.delete(e.index)}unsubscribeAll(){this.subscriptions.clear()}}function y(e,t,n){let i,r;return function(){let o=this,s=+new Date,a=arguments;clearTimeout(i),!r&&(r=s),s-r>=n?(e.apply(o,a),r=s):i=setTimeout(()=>{e.apply(o,a)},t)}}function x(e,t,n=!1){let i,r,o;let s=0,a=function(){e.apply(r,o),s=Date.now()};return function(){let e=Date.now();if(r=this,o=arguments,i&&(clearTimeout(i),i=null),n&&0===s)return i=setTimeout(()=>{a()},t),a();let c=t-(e-s);if(c>0)i=setTimeout(()=>{a()},c);else{if(n)return a();i=setTimeout(()=>{a()},t)}}}function _(e,t,n){let i={},r={},o=new Map,s=0;return function(){let a=this,c=+new Date,d=arguments,u=d[0],l=o.get(u);!o.has(u)&&(l=s++,o.set(u,l)),clearTimeout(i[l]),!r[l]&&(r[l]=c),c-r[l]>=n?(r[l]=c,e.apply(a,d)):i[l]=setTimeout(()=>{e.apply(a,d),delete r[l],delete i[l],o.delete(u)},t)}}function b(e,t){let n=new Map,i={},r={},o=0;return function(){let s=Date.now(),a=arguments,c=a[0],d=n.get(c);!n.has(c)&&(d=o++,n.set(c,d));let u=()=>{e.apply(this,a),delete r[d],delete i[d],n.delete(c)};void 0===r[d]&&(r[d]=0),i[d]&&(clearTimeout(i[d]),delete i[d]);let l=t-(s-r[d]);l>0?i[d]=setTimeout(()=>{u()},l):i[d]=setTimeout(()=>{u()},t)}}class I extends p.mA{constructor(){super(...arguments),this.subscriptions=new Map}subscribe(e,t){var n;if(!Object.values(u.c5).includes(e))throw new f.G({ctx:this.ctx,type:u.NI.InvalidParam,msg:`unknown event: ${e}`,sender:this});!this.subscriptions.has(e)&&this.subscriptions.set(e,new m(this.ctx));let i=this.subscriptions.get(e),r="number"==typeof this.ctx.option.throttle?this.ctx.option.throttle:100,o=null!==(n=this.ctx.option.triggerStrategy)&&void 0!==n?n:{};if(!1===this.ctx.option.throttle)return i.subscribe(t);if(void 0===o[e])return i.subscribe(t);switch(l.Y.ctxDebug(this.ctx,`apply strategy: ${u.zn[o[e]]} to event: ${e}`),o[e]){case u.zn.Throttle:return i.subscribe(y(t,r,r));case u.zn.Debounce:return i.subscribe(x(t,r));case u.zn.ThrottleWithArgs:return i.subscribe(_(t,r,r));case u.zn.DebounceWithArgs:return i.subscribe(b(t,r));case u.zn.Immediate:default:return i.subscribe(t)}}unsubscribe(e,t){if(!!this.subscriptions.has(e))this.subscriptions.get(e).unsubscribe(t)}unsubscribeAll(){for(let e of Object.values(this.subscriptions))e.unsubscribeAll();this.subscriptions.clear()}emitEmpty(e,t){return this.emit(e,t,void 0)}emit(e,t,n){this.resolve(p.Uk.Monitor).emitEvent(e,t,n);let i=this.subscriptions.get(e);i&&(n?l.Y.ctxDebug(this.ctx,`emit event "${e}" with sender:`,t,", eventArgs:",n):l.Y.ctxDebug(this.ctx,`emit event "${e}" with sender:`,t),i.next(n,t))}}var C=n("491326"),M=n("461352"),k=n("808244"),S=n.n(k);function T(e,t,n,i){n=n||0,i=i||e.length-n;let r=n,o=i,s=0;for(r=n,o=i;r<o;){let n=e[r++],i=n>>4;if(i>0){let n=i+240;for(;255===n;)i+=n=e[r++];let a=r+i;for(;r<a;)t[s++]=e[r++];if(r===o)break}let a=e[r++]|e[r++]<<8;if(0===a||a>s)return-(r-2);let c=15&n,d=c+240;for(;255===d;)c+=d=e[r++];let u=s-a,l=s+c+4;for(;s<l;)t[s++]=t[u++]}return s}!Math.imul&&(Math.imul=function(e,t){let n=e>>>16,i=65535&e,r=t>>>16,o=65535&t;return i*o+(n*o+i*r<<16)|0});let w=d.m.Request,E=d.m.Response,R=d.m.Frame;function U(e){return"undefined"!=typeof btoa?btoa(String.fromCharCode.apply(null,new Uint8Array(e))):""}function A(e){return new Uint8Array(w.encode(e).finish())}function O(e,t){let n=new Uint8Array(t);try{return E.decode(n)}catch(i){let t=U(n);throw l.Y.ctxWarn(e,"decode response error: ",i),l.Y.ctxDebug(e,"hex dump: ",t),t}}function P(e){return new Uint8Array(R.encode(e).finish())}function D(e,t){let n=new Uint8Array(t);try{return R.decode(n)}catch(i){let t=U(n);throw l.Y.ctxWarn(e,"decode frame error: ",i),l.Y.ctxDebug(e,"hex dump: ",t),t}}var N=n("586037"),B=n("272586");class G extends p.mA{constructor(e){super(e),this.wsLastReceiveTime=0,this.reqMap=new Map,this.manuallyClosed=!1;let{webSocketLevel:t,heartbeatInterval:n,maxHeartbeatEmptyWindow:i}=this.ctx.option;this.heartbeatInterval=null!=n?n:u.HF.heartbeatInterval,this.maxEmptyWindow=null!=i?i:u.HF.maxHeartbeatEmptyWindow,this.net=this.ctx.resolve(p.Uk.CoreInstance).net,this.http=this.ctx.resolve(p.Uk.CoreInstance).http,t!==u._.Disable&&(this.ws=this.ctx.resolve(p.Uk.CoreInstance).websocket,this.prepareWs()),this.onMessage=new m(e)}inSignCommandList(e){return[d.m.IMCMD.SEND_MESSAGE,d.m.IMCMD.CREATE_CONVERSATION_V2,d.m.IMCMD.CALL_VOIP,d.m.IMCMD.ADD_CONVERSATION_PARTICIPANTS,d.m.IMCMD.REMOVE_CONVERSATION_PARTICIPANTS,d.m.IMCMD.UPDATE_CONVERSATION_PARTICIPANT,d.m.IMCMD.SET_CONVERSATION_SETTING_INFO,d.m.IMCMD.SET_CONVERSATION_CORE_INFO,d.m.IMCMD.UPSERT_CONVERSATION_CORE_EXT_INFO,d.m.IMCMD.UPSERT_CONVERSATION_SETTING_EXT_INFO,d.m.IMCMD.DISSOLVE_CONVERSATION,d.m.IMCMD.MARK_MESSAGE,d.m.IMCMD.BATCH_UNMARK_MESSAGE,d.m.IMCMD.SET_MESSAGE_PROPERTY,d.m.IMCMD.MODIFY_MESSAGE_EXT].includes(e)}frontierSign(e){let t={"X-MS-STUB":S()(e)};if("undefined"!=typeof window&&void 0!==window.byted_acrawler&&"function"==typeof window.byted_acrawler.frontierSign){let e=window.byted_acrawler.frontierSign(t);return null!=e?e:{}}return{}}sendByBeacon(e){return(0,a.mG)(this,void 0,void 0,function*(){return e.method="beacon",l.Y.ctxDebug(this.ctx,`Beacon Request SeqId -> ${e.seqId}`,e.request),this.http.sendBeacon(e.url,e.request),e})}sendByHttp(e){return(0,a.mG)(this,void 0,void 0,function*(){e.method="http",l.Y.ctxDebug(this.ctx,`Http Request SeqId -> ${e.seqId}`,e.request);try{this.reqMap.set(e.seqId,e);let t=yield this.http.sendRequest(e.url,e.request);return e.response=t,0!==t.status_code?l.Y.ctxError(this.ctx,`Http Response SeqId -> ${e.seqId}`,e.response):l.Y.ctxDebug(this.ctx,`Http Response SeqId -> ${e.seqId}`,e.response),e}catch(e){throw new f.G({ctx:this.ctx,msg:"network error",type:u.NI.NetworkError,innerError:e,allowRetry:!0,sender:this,ignoreEvent:!0})}finally{this.reqMap.delete(e.seqId)}})}sendByWs(e){return(0,a.mG)(this,void 0,void 0,function*(){e.method="ws";let t=A(e.request),n=Object.assign(Object.assign({},this.inSignCommandList(e.cmd)?this.frontierSign(t):{}),this.ctx.option.headers),i=d.m.Frame.create({service:this.ctx.option.service,method:this.ctx.option.method,headers:Object.entries(n).map(([e,t])=>({key:e,value:t})),seqid:c.fromNumber(e.seqId),logid:c.fromNumber(Date.now()),payload_type:"pb",payload:t});e.frame=i;try{this.reqMap.set(e.seqId,e),l.Y.ctxDebug(this.ctx,`WS Request SeqId -> ${e.seqId}`,e.request),this.ws.send(P(i))}catch(t){throw this.reqMap.delete(e.seqId),new f.G({ctx:this.ctx,msg:"network error",type:u.NI.NetworkError,innerError:t,allowRetry:!0,sender:this})}return new Promise((t,n)=>{e.wsPromise={resolve:t,reject:n}})})}receiveRaw(e){var t,n,i;if(this.resetWsHeartbeat(),"hi"!==e.toString())try{let r=D(this.ctx,e);if(r.service!==this.ctx.option.service&&!this.ctx.option.acceptIncorrectFrame){l.Y.ctxDebug(this.ctx,`WS Response dropped, local serviceId=${this.ctx.option.service}, message=${r.service}`),this.resolve(p.Uk.EventBus).emit(u.c5.WebSocketReceiveUnexpectedFrame,this,r);return}let{payload:o}=r;if(null==o){l.Y.ctxWarn(this.ctx,"payload undefined or null");return}let s=r.payload_encoding;if("__lz4"===s){let e=new Uint8Array(10*o.length),t=0;if(((t=T(o,e))<0||t>e.length||t<o.length)&&(l.Y.ctxDebug(this.ctx,"WS response with lz4 compress, but first time decompressed failed, try second time"),e=new Uint8Array(1024e3),(t=T(o,e))<0||t>e.length||t<o.length)){l.Y.ctxWarn(this.ctx,"WS response with lz4 compress, try second time fail.");return}o=e.slice(0,t)}try{let e=O(this.ctx,o),s=d.m.Response.create(e);if(!this.resolve(p.Uk.InboxType).isValidInbox(s.inbox_type)&&s.sequence_id.eq(0)){l.Y.ctxWarn(this.ctx,`WS Push dropped, local inboxType=${this.ctx.option.inboxType}, message=${s.inbox_type}`,"resp:",s);return}let a=s.sequence_id.toNumber(),c=this.reqMap.get(a);c?(0!==s.status_code?l.Y.ctxError(this.ctx,`WS Response SeqId -> ${s.sequence_id}`,s):l.Y.ctxDebug(this.ctx,`WS Response SeqId -> ${s.sequence_id}`,s),c.response=s,c.wsPromise.resolve(c),this.reqMap.delete(a)):s.sequence_id.eq(0)?(l.Y.ctxDebug(this.ctx,"WS Push",null===(i=null===(n=null===(t=s.body)||void 0===t?void 0:t.has_new_message_notify)||void 0===n?void 0:n.message)||void 0===i?void 0:i.message_type,s),(c=new B.F(this.ctx,s.cmd)).frame=r,c.response=s,c.seqId=s.sequence_id.toNumber(),this.receive(c)):l.Y.ctxWarn(this.ctx,"WS Response dropped, no handler",s)}catch(e){l.Y.ctxWarn(this.ctx,"WS Response dropped, IM Response deserialize fail, hex dump:",e,"frame:",r)}}catch(e){l.Y.ctxWarn(this.ctx,"WS Response dropped, Frame deserialize fail, hex dump: ",e)}}send(e,t){var n,i,r,o,s,c,v,h,g,m;return(0,a.mG)(this,void 0,void 0,function*(){let y;if(t.useBeacon)return yield this.sendByBeacon(e),e.response=d.m.Response.create({}),e;let x=null!==(n=t.maxWsRetryTimes)&&void 0!==n?n:3,_=0===x?null!==(i=t.maxHttpRetryTimes)&&void 0!==i?i:3:(null!==(r=t.maxHttpRetryTimes)&&void 0!==r?r:null===(o=this.ws)||void 0===o?void 0:o.isOpen())?1:3;0===_&&(_=1),N.u.performanceNow()-this.wsLastReceiveTime-1.5*this.heartbeatInterval>this.maxEmptyWindow&&(null===(s=this.ws)||void 0===s?void 0:s.isOpen())&&(x=0,_=null!==(c=t.maxHttpRetryTimes)&&void 0!==c?c:3,l.Y.ctxWarn(this.ctx,"ws idle too long, fallback to http"));let b=new Date().getTime(),I=0,C=0,M=()=>{let t=!1,n=new Promise((n,i)=>{setTimeout(()=>{!t&&(this.reqMap.delete(e.seqId),i(new f.G({ctx:this.ctx,msg:"request timeout",type:u.NI.NetworkError,args:{cmd:e.cmd,seqId:e.seqId,requestDate:b,ctxId:this.ctx.id},allowRetry:!0,ignoreEvent:!0,sender:this})))},this.ctx.option.timeout)});return Promise.race([n,(()=>(0,a.mG)(this,void 0,void 0,function*(){var n;let i;let r=!1;if(I<x&&(null===(n=this.ws)||void 0===n?void 0:n.isOpen())&&(r=!0),0!==x&&I>=x&&0===C&&void 0!==this.ws&&(l.Y.ctxWarn(this.ctx,`Request ${e.seqId} fallback to http (wsRetryTimes)`),r=!1),C>=_)throw new f.G({ctx:this.ctx,msg:"http retry times limit exceeded",type:u.NI.NetworkError,sender:this,args:{cmd:e.cmd,seqId:e.seqId}});r?(I++,i=this.sendByWs(e)):(C++,i=this.sendByHttp(e));try{let n=yield i;t=!0,this.reqMap.delete(e.seqId);let{request:r,response:o}=n;if(this.resolve(p.Uk.Monitor).emitNetwork(r,o),o.status_code===u.NI.ResourceExhausted)throw new f.G({ctx:this.ctx,msg:"demotion enabled",type:u.NI.ResourceExhausted,allowRetry:!1,sender:this,logid:null==o?void 0:o.log_id});if(o.status_code===u.NI.InternalError&&(o.error_desc.includes("i/o timeout")||o.error_desc.includes("rpc timeout")||o.error_desc.includes("RPC timeout"))||o.error_desc.includes("connection timeout")||o.error_desc.includes("request timeout"))throw new f.G({ctx:this.ctx,msg:"request timeout",type:u.NI.NetworkError,allowRetry:!0,ignoreEvent:!0,sender:this,logid:null==o?void 0:o.log_id});return n.retryTimes=I+C,n}catch(e){if(e.type)throw e;throw new f.G({ctx:this.ctx,msg:"request error",type:u.NI.NetworkError,allowRetry:e.allowRetry,innerError:e,sender:this})}finally{this.reqMap.delete(e.seqId)}}))()])};for(;;){if(e.retryTimes++,e.retryTimes>=10){e.error=new f.G({ctx:this.ctx,msg:"too much retry",type:u.NI.NetworkError,sender:this});break}try{if(e.startTime=Date.now(),y=yield M(),e.endTime=Date.now(),"function"==typeof(null===(h=null===(v=null==y?void 0:y.response)||void 0===v?void 0:v.server_execution_end_time)||void 0===h?void 0:h.toNumber)&&"function"==typeof(null===(m=null===(g=null==y?void 0:y.response)||void 0===g?void 0:g.request_arrived_time)||void 0===m?void 0:m.toNumber)&&N.u.putTimeDelta(e.startTime,e.endTime,y.response.server_execution_end_time.toNumber(),y.response.request_arrived_time.toNumber()),void 0!==y)break}catch(t){if(e.error=t,(null==t?void 0:t.allowRetry)===!0){let n=500+100*e.retryTimes+100*Math.random();n>2e3&&(n=2e3),l.Y.ctxDebug(this.ctx,`req ${e.seqId} failed, retrying @ attempt ${e.retryTimes}, inner err:`,t),yield new Promise(e=>setTimeout(e,n));continue}break}}if(void 0===y)throw void 0===e.error&&(e.error=new f.G({ctx:this.ctx,msg:"unknown error",type:u.NI.NetworkError,sender:this})),e.error;return y})}get isWsOnline(){var e;return(null===(e=this.ws)||void 0===e?!!void 0:!!e.isOpen())&&N.u.performanceNow()-this.wsLastReceiveTime-1.5*this.heartbeatInterval<=this.maxEmptyWindow}sendByHttpTo(e,t,n){return(0,a.mG)(this,void 0,void 0,function*(){return"undefined"!=typeof fetch?(yield fetch(e)).arrayBuffer():this.http.send(e,t,n)})}receive(e){this.resolve(p.Uk.Monitor).emitNetwork(null,e.response),this.onMessage.next(e.response,this)}onWsClose(){return(0,a.mG)(this,void 0,void 0,function*(){l.Y.ctxDebug(this.ctx,"ws closed"),this.resolve(p.Uk.EventBus).emit(u.c5.WebSocketDisconnected,this,this.ws)})}prepareWs(){if(this.ctx.option.webSocketLevel!==u._.Disable)this.ws.onMessage.subscribe(e=>this.receiveRaw(e)),this.ws.onClose.subscribe(()=>this.onWsClose()),this.ws.onError.subscribe(()=>this.onWsClose()),this.ws.onOpen.subscribe(()=>{l.Y.ctxDebug(this.ctx,"ws connected"),this.resolve(p.Uk.EventBus).emit(u.c5.WebSocketConnected,this,this.ws),this.manuallyClosed=!1}),this.wsCheckTicker=this.ctx.resolve(p.Uk.CoreInstance).createTicker(this.ctx,this.heartbeatInterval),this.wsCheckTicker.onTick.subscribe(()=>{var e,t,n,i,r;let o=N.u.performanceNow()-this.wsLastReceiveTime+this.heartbeatInterval/1.5;(null===(e=this.ws)||void 0===e?void 0:e.isOpen())?o>this.maxEmptyWindow?(l.Y.ctxDebug(this.ctx,"not receive any packet in window, ws close connection"),this.resolve(p.Uk.Monitor).emitMetrics(N.U.WebSocketConnectNoHeartbeat,{count:1},{url:null!==(r=null===(i=this.ws)||void 0===i?void 0:i.url)&&void 0!==r?r:"unknown"}),this.connectWs(!0)):o>this.heartbeatInterval&&this.sendWsHeartbeat():(l.Y.ctxDebug(this.ctx,"ws try connect if closed"),this.resolve(p.Uk.Monitor).emitMetrics(N.U.WebSocketConnectAfterClose,{count:1},{url:null!==(n=null===(t=this.ws)||void 0===t?void 0:t.url)&&void 0!==n?n:"unknown"}),this.connectWs(!0))})}closeWs(e){var t,n;if(this.ctx.option.webSocketLevel!==u._.Disable)null===(t=this.ws)||void 0===t||t.close(),this.manuallyClosed=!e,this.manuallyClosed&&(null===(n=this.wsCheckTicker)||void 0===n||n.stop())}connectWs(e){var t,n,i;return(0,a.mG)(this,void 0,void 0,function*(){if(this.ctx.option.webSocketLevel===u._.Disable)return;if(this.manuallyClosed&&e){l.Y.ctxDebug(this.ctx,"ignore connect since manually closed");return}this.closeWs(!0);let r=N.u.performanceNow();try{yield this.ws.performOpen(),this.resolve(p.Uk.Monitor).emitMetrics(N.U.WsConnect,{ws_cost:Math.round(N.u.performanceNow()-r)},{error_code:"0",url:null!==(t=this.ws.option.frontierUrl)&&void 0!==t?t:"unknown"}),this.resetWsHeartbeat(),null===(n=this.wsCheckTicker)||void 0===n||n.start()}catch(e){this.resolve(p.Uk.Monitor).emitMetrics(N.U.WsConnect,{ws_cost:Math.round(N.u.performanceNow()-r)},{error_code:"1",url:null!==(i=this.ws.option.frontierUrl)&&void 0!==i?i:"unknown"})}})}sendWsHeartbeat(){var e;(null===(e=this.ws)||void 0===e?void 0:e.isOpen())?this.ws.send("hi"):l.Y.ctxWarn(this.ctx,"ws not connect but try to send heartbeat")}resetWsHeartbeat(){this.wsLastReceiveTime=N.u.performanceNow()}}var L=n("120645"),j=n("224131"),V=n("629552"),F=n("878042"),W=n("730512");class Y extends p.mA{constructor(e){super(e),this.refreshBuffer=[],this.refreshDebounce=x(()=>{this.triggerRefresh()},1e3,!0),this.conversations=new Map}applyLocal(e){e.forEach(e=>{this.conversations.set(e.id,e)})}clearAll(){this.conversations.clear()}getWithCreateLocal(e,t,n,i){let r=this.getRaw(e);if(!r){let o=new C.r(this.ctx);o.coreInfo=new V._(o),o.settingInfo=new F.H(o),o.id=e,o.shortId=t,o.type=n,o.isOffline=!0,r=o,void 0!==i?o.coreInfo.inboxType=i:void 0===i&&n===d.m.ConversationType.ONE_TO_ONE_CHAT&&4===e.split(":").length&&(o.coreInfo.inboxType=Number.parseInt(e.split(":")[0],10)),l.Y.ctxDebug(this.ctx,"create local conv:",o),this.upsert(r)}return r}upsert(e){var t;if(void 0===e)throw new f.G({ctx:this.ctx,msg:"upsert undefined conv",type:u.NI.InvalidParam,sender:this});if(!this.resolve(p.Uk.InboxType).isValidInbox(e.inboxType))throw new f.G({ctx:this.ctx,msg:`invalid inbox: ${e.inboxType}`,type:u.NI.InvalidParam,sender:this});let n=this.conversations.get(e.id);if(n&&e.isOffline&&(l.Y.ctxDebug(this.ctx,`local exist, try to use offline upsert, ignore, short id: ${n.shortId} with offline:${e.shortId}`),!n.isOffline))return l.Y.ctxDebug(this.ctx,"local is online, ignore update"),n;if(n){l.Y.ctxDebug(this.ctx,`merge conversation local=${n.version.toString()}:`,n,`new=${e.version.toString()}:`,e);let t=n.coreInfo||new V._(n),i=n.settingInfo||new F.H(n);(n=Object.assign(n,e)).coreInfo=t.mergeCore(e.coreInfo),n.settingInfo=i.mergeSetting(e.settingInfo),n.forceRefreshUnreadCount()}return this.conversations.set(e.id,null!=n?n:e),null===(t=this.resolve(p.Uk.DbProxy))||void 0===t||t.upsertConversation(null!=n?n:e),this.ctx.initResult===u.rb.Succeeded&&(this.resolve(p.Uk.EventBus).emit(u.c5.ConversationUpsert,this,null!=n?n:e),this.resolve(p.Uk.EventBus).emitEmpty(u.c5.ConversationChange,this)),e}refreshLocalAsync(){return(0,a.mG)(this,void 0,void 0,function*(){let e=this.getConversationArray().filter(e=>e.isOffline);if(0!==e.length)return this.refreshAsync(e)})}refreshLocal(){let e=Array.from(this.conversations.values()).filter(Y.conversationFilter).filter(e=>e.isOffline);if(0!==e.length)this.refresh(e)}triggerRefresh(){if(0===this.refreshBuffer.length)return;l.Y.ctxDebug(this.ctx,"clear refresh buffer:",this.refreshBuffer);let e=[...this.refreshBuffer];this.refreshBuffer=[],this.refreshAsync(e)}refresh(e){var t;let n=(0,W.sS)(e),i=[];if(0===this.refreshBuffer.length)i.push(...n);else{let e={};this.refreshBuffer.forEach(t=>e[t.id]=!0),n.forEach(t=>{!e[t.id]&&i.push(t)})}i.length>0&&this.refreshBuffer.push(...i);let r=null!==(t=this.ctx.option.conversationRefreshCount)&&void 0!==t?t:u.HF.conversationRefreshCount;this.refreshBuffer.length>=r?this.triggerRefresh():this.refreshDebounce()}refreshAsync(e){var t,n,i;return(0,a.mG)(this,void 0,void 0,function*(){let r=null!==(t=(0,W.sS)(e))&&void 0!==t?t:this.refreshBuffer;if(0===r.length)return[];l.Y.ctxDebug(this.ctx,"refresh conv: ",r);let o=[],s=(0,W.vM)(r,e=>e.inboxType.toString());for(let e of Object.keys(s))for(let t of(0,W.F3)(s[e],5))try{let i=yield this.resolve(p.Uk.CoreApi).GetConversationInfoListV2({conversations:t.map(e=>({conversationId:e.id,conversationShortId:c.fromString(e.shortId),conversationType:e.type})),inboxType:Number.parseInt(e,10)}),r=(null===(n=null==i?void 0:i.body)||void 0===n?void 0:n.get_conversation_info_list_v2_body).conversation_info_list;t.forEach(e=>{0===r.filter(t=>t.conversation_id===e.id).length&&(l.Y.ctxDebug(this.ctx,"delete local conv, may not exist online: ",e),this.delete(e.id))}),r.forEach(e=>{let t=this.upsert(C.r.fromServerConversation(this.ctx,e,null==i?void 0:i.log_id));o.push(t)})}catch(e){e&&(null==e?void 0:e.type)===u.NI.InternalError&&(null===(i=null==e?void 0:e.message)||void 0===i?void 0:i.includes("request.MGet empty"))?t.forEach(e=>{l.Y.ctxDebug(this.ctx,"delete local conv, may not exist online: ",e),this.delete(e.id)}):l.Y.ctxError(this.ctx,"unknown refresh error:",e)}return o})}get(e){let t=this.getRaw(e);return(!t&&(t=this.getWithShortIdRaw(e)),t)?t:(l.Y.ctxWarn(this.ctx,"conversation not exist in local conversationId:",e),null)}getWithShortIdRaw(e){for(let t of this.conversations.values())if(t.shortId===e)return t}getWithOnline(e,t,n){return(0,a.mG)(this,void 0,void 0,function*(){let i=this.getRaw(e);if(!i||i.isOffline){if(t&&n)i=this.getWithCreateLocal(e,t,n);else throw new f.G({ctx:this.ctx,type:u.NI.InvalidParam,msg:"no shortId and type provided",sender:this})}return yield this.refreshAsync(i),this.get(e)})}getRaw(e){return this.conversations.get(e)}getConversationArray(e=Y.conversationFilter){return Array.from(this.conversations.values()).filter(e).map(e=>({conv:e,rankScore:e.rankScore})).sort(Y.conversationComparator).map(e=>e.conv)}withConversation(e){return t=>{let n=this.get(e);if(!!n)return t(n)}}delete(e,t=!1){var n;let i=this.getRaw(e);if(!!i)!t&&this.getContext().resolve(p.Uk.MessageManager).clearConversation(e),this.conversations.delete(e),null===(n=this.resolve(p.Uk.DbProxy))||void 0===n||n.deleteConversation(i),this.resolve(p.Uk.EventBus).emitEmpty(u.c5.ConversationChange,this),this.resolve(p.Uk.EventBus).emit(u.c5.ConversationDelete,this,i)}markRead(e,t,n,i){let r;try{r=this.get(e)}catch(e){}if(!!r)return r.settingInfo.readIndex=t,n&&(r.settingInfo.readBadgeCount=n),(null==i?void 0:i.length)&&r.settingInfo.mergeMuteReadBadgeCountInfos(i),this.upsert(r)}join(e){var t;let n=this.get(e);if(!!n)n.isMember=!0,null===(t=this.resolve(p.Uk.DbProxy))||void 0===t||t.upsertConversation(n),this.resolve(p.Uk.EventBus).emitEmpty(u.c5.ConversationChange,this),this.resolve(p.Uk.EventBus).emit(u.c5.ConversationJoin,this,n)}leave(e){var t;let n=this.get(e);if(!!n)n.isMember=!1,null===(t=this.resolve(p.Uk.DbProxy))||void 0===t||t.upsertConversation(n),this.resolve(p.Uk.EventBus).emitEmpty(u.c5.ConversationChange,this),this.resolve(p.Uk.EventBus).emit(u.c5.ConversationLeave,this,n)}refreshTicket(e){return(0,a.mG)(this,void 0,void 0,function*(){if(!this.get(e))return})}static conversationFilter(e){return 0===e.mode&&e.isMember}dispose(){this.clearAll()}}Y.conversationComparator=(e,t)=>t.rankScore-e.rankScore;var $=n("211849");!function(e){e[e.MarkConversationRead=1]="MarkConversationRead",e[e.DeleteMessage=2]="DeleteMessage",e[e.DeleteConversation=3]="DeleteConversation",e[e.SettingInfoUpdate=4]="SettingInfoUpdate",e[e.CoreInfoUpdate=6]="CoreInfoUpdate",e[e.ParticipantUpdate=7]="ParticipantUpdate",e[e.FirstMessage=8]="FirstMessage",e[e.NewMarkConversationRead=14]="NewMarkConversationRead"}(i||(i={}));class q extends M.v{static fromMessage(e){let t=e;return t.contentObj=$.parse(e.content),t.commandSubType=t.contentObj.command_type,t}}var H=n("421914"),z=n("526515");class K extends H.f{process(e){return(0,a.mG)(this,void 0,void 0,function*(){return e.data.isCommandMsg&&(e.needContinue=!1,yield this.parseCommand(e.data)),e})}parseCommand(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=q.fromMessage(e);switch(t.contentObj.command_type){case i.DeleteConversation:this.handleDeleteConversationCMD(t);break;case i.DeleteMessage:this.handleDeleteMessageCMD(t);break;case i.MarkConversationRead:case i.NewMarkConversationRead:this.handleMarkConversationRead(t);break;case i.SettingInfoUpdate:yield this.handleUpdateSettingInfo(t);break;case i.CoreInfoUpdate:yield this.handleUpdateCoreInfo(t);break;case i.ParticipantUpdate:yield this.handleUpdateParticipant(t)}this.resolve(p.Uk.EventBus).emit(u.c5.ReceiveCommandMessage,this,t)})}handleDeleteConversationCMD(e){let{conversation_id:t}=e.contentObj;this.resolve(p.Uk.ConversationManager).delete(t)}handleDeleteMessageCMD(e){let{conversation_id:t,message_id:n}=e.contentObj;this.resolve(p.Uk.MessageManager).delete(t,n.toString())}handleMarkConversationRead(e){var t;if(this.ctx.initResult===u.rb.Succeeded){let{conversation_id:n,read_index:i,read_badge_count:r,mute_read_badge_count_info:o}=e.contentObj;this.resolve(p.Uk.ConversationManager).markRead(n,c.fromValue(i),r,null!==(t=null==o?void 0:o.map(e=>({message_type:e.type,read_badge_count:e.read_badge_count})))&&void 0!==t?t:[])}}handleUpdateSettingInfo(e){return(0,a.mG)(this,void 0,void 0,function*(){if(this.ctx.initResult===u.rb.Succeeded){let{conversation_version:t}=e.contentObj,n=c.fromValue(null!=t?t:c.MAX_VALUE),i=this.resolve(p.Uk.ConversationManager).getWithCreateLocal(e.conversationId,e.conversationShortId.toString(),e.conversationType);i.settingInfo.version.lte(n)?this.resolve(p.Uk.ConversationManager).refresh(i):l.Y.ctxWarn(this.ctx,"ignore online update setting info cmd, local version: ",i.settingInfo.version.toString(),"online: ",n.toString())}})}handleUpdateCoreInfo(e){return(0,a.mG)(this,void 0,void 0,function*(){if(this.ctx.initResult===u.rb.Succeeded){let{group_version:t}=e.contentObj,n=c.fromValue(t),i=this.resolve(p.Uk.ConversationManager).getWithCreateLocal(e.conversationId,e.conversationShortId.toString(),e.conversationType);i.coreInfo.version.lte(n)?this.resolve(p.Uk.ConversationManager).refresh(i):l.Y.ctxWarn(this.ctx,"ignore online update core info cmd, local version: ",i.coreInfo.version.toString(),"online: ",t.toString())}})}handleUpdateParticipant(e){return(0,a.mG)(this,void 0,void 0,function*(){if(this.ctx.initResult===u.rb.Succeeded){let{added_participant:t,modified_participant:n,removed_participant:i}=e.contentObj;if((null==t?void 0:t.length)>0){let n=t.map(String),i=[];n.forEach(t=>{let n=z.Q.fakeParticipant(this.ctx,t,{type:e.conversationType,id:e.conversationId});i.push(n)}),n.includes(this.ctx.option.userId)&&this.resolve(p.Uk.ConversationManager).join(e.conversationId),this.resolve(p.Uk.ParticipantManager).upsertBatch(e.conversationId,i)}if((null==n?void 0:n.length)>0){let t=this.resolve(p.Uk.ConversationManager).get(e.conversationId),i=n.map(String);t&&this.resolve(p.Uk.ParticipantManager).updateWithUserIdAsync(t,i)}if((null==i?void 0:i.length)>0){let t=i.map(String);t.includes(this.ctx.option.userId)&&this.resolve(p.Uk.ConversationManager).leave(e.conversationId),this.resolve(p.Uk.ParticipantManager).delete(e.conversationId,t)}}})}}class Z extends H.f{process(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=e.data.conversationId;if(!t)return l.Y.ctxWarn(this.ctx,"no conversation provided in message, ignore",e.data),e.needContinue=!1,e;let n=this.resolve(p.Uk.ConversationManager).getRaw(t);if(e.data.type===d.m.MessageType.MESSAGE_TYPE_CONVERSATION_DESTROY&&n)return this.resolve(p.Uk.ConversationManager).delete(t),this.resolve(p.Uk.EventBus).emit(u.c5.ConversationDissolve,this,n),this.resolve(p.Uk.EventBus).emitEmpty(u.c5.ConversationChange,this),e.needContinue=!1,e;if(!e.data.isNormalMsg&&void 0===n)return e.needContinue=!1,this.ctx.initResult===u.rb.Succeeded&&l.Y.ctxDebug(this.ctx,`ignore process, conv: ${e.data.conversationId} not exist for cmd msg`,e.data),e;let i=e.data,r=this.resolve(p.Uk.ConversationManager).getWithCreateLocal(i.conversationId,i.conversationShortId,i.conversationType);return e.conv=r,e})}}class J extends H.f{process(e){var t;return(0,a.mG)(this,void 0,void 0,function*(){if(!e.data.isNormalMsg)return e;let n=this.resolve(p.Uk.MessageManager).getRaw(null===(t=e.conv)||void 0===t?void 0:t.id,e.data.clientId),i=void 0!==e.data.source&&(e.data.source===u.v$.Online||e.data.source===u.v$.UserInbox),r=(null==n?void 0:n.flightStatus)!==void 0&&i;this.resolve(p.Uk.MessageManager).upsert(e.data);let o=this.resolve(p.Uk.MessageManager).getRaw(e.data.conversationId,e.data.clientId);return n?r&&o.flightStatus!==u.b3.Received&&(o.flightStatus=u.b3.Received,this.ctx.initResult===u.rb.Succeeded&&this.resolve(p.Uk.EventBus).emit(u.c5.ReceiveSelfMessage,this,o),this.resolve(p.Uk.MessageManager).upsert(o)):i&&!e.data.isStrangerMessage&&(e.data.sender!==this.ctx.option.userId?this.ctx.initResult===u.rb.Succeeded&&this.resolve(p.Uk.EventBus).emit(u.c5.ReceiveNewMessage,this,o):this.ctx.initResult===u.rb.Succeeded&&this.resolve(p.Uk.EventBus).emit(u.c5.ReceiveSelfMessage,this,o)),e})}}class X extends H.f{process(e){return(0,a.mG)(this,void 0,void 0,function*(){return e.data.type===d.m.MessageType.MESSAGE_TYPE_UPDATE_MESSAGE_EXT&&(e.needContinue=!1,this.handleUpdateExt(e)),e})}handleUpdateExt(e){var t,n,i,r,o,s,a;let c=null===(t=e.data)||void 0===t?void 0:t.ext[u.v9.ServerMessageId];if(!c)throw new f.G({ctx:this.ctx,type:u.NI.InvalidServerId,msg:`message ${e.data} has no s:server_message_id`,sender:this});let v=this.resolve(p.Uk.MessageManager).getByServerIdRaw(null===(n=e.conv)||void 0===n?void 0:n.id,c);if(!!v){if(v.version.gt(e.data.version)){l.Y.ctxWarn(this.ctx,`local msg version: ${v.version.toString()} > online msg version: ${e.data.version.toString()}, ignore, local msg:`,v,"online msg:",e.data);return}if(v.ext=e.data.ext,v.version=e.data.version,e.data.content&&(v.content=e.data.content),this.resolve(p.Uk.MessageManager).upsert(v),!v.visible)for(let t of this.resolve(p.Uk.MessageManager).getList(e.conv.id))(null===(r=null===(i=t.referenceInfo)||void 0===i?void 0:i.referenced_message_id)||void 0===r?void 0:r.toString())===v.serverId&&(t.referenceInfo.referenced_message_status=d.m.MessageStatus.INVISIBLE,this.resolve(p.Uk.MessageManager).upsert(t));if(v.isEdited)for(let t of this.resolve(p.Uk.MessageManager).getList(e.conv.id))(null===(s=null===(o=t.referenceInfo)||void 0===o?void 0:o.referenced_message_id)||void 0===s?void 0:s.toString())===v.serverId&&(t.referenceInfo=Object.assign(Object.assign({},t.referenceInfo),{ext:Object.assign(Object.assign({},null!==(a=t.referenceInfo.ext)&&void 0!==a?a:{}),{[u.v9.RefIsEdited]:"true",[u.v9.RefContent]:v.content})}),this.resolve(p.Uk.MessageManager).upsert(t));this.resolve(p.Uk.EventBus).emit(u.c5.ReceiveNewUpdateExtMessage,this,e.data),"true"===e.data.ext[u.v9.IsRecalled]&&this.resolve(p.Uk.MessageManager).markRecalled(e.conv.id,v.serverId)}}}class Q extends p.mA{constructor(e){super(e),this.messages=new Map,this.processors=[new Z(this.ctx),new K(this.ctx),new X(this.ctx),new J(this.ctx)]}applyLocal(e){e.forEach(e=>{!this.messages.has(e.conversationId)&&this.messages.set(e.conversationId,new Map),this.messages.get(e.conversationId).set(e.clientId,e)})}clearAll(){this.messages.clear()}get(e,t){let n=this.getRaw(e,t);if(!n)throw new f.G({ctx:this.ctx,type:u.NI.MessageNotExist,msg:`message ${t} @ ${e} not exist in local`,sender:this});return n}getRaw(e,t){return this.getConversationMap(e).get(t)}getRawMap(){return this.messages}getByServerIdRaw(e,t){let n=Array.from(this.getConversationMap(e).values()).filter(e=>e.serverId===t);if(0!==n.length)return this.get(e,n[0].clientId)}getByServerId(e,t){let n=Array.from(this.getConversationMap(e).values()).filter(e=>e.serverId===t);if(0===n.length)throw new f.G({ctx:this.ctx,type:u.NI.MessageNotExist,msg:`message ${t} @ ${e} not exist in local`,sender:this});return this.get(e,n[0].clientId)}getList(e){return Array.from(this.getConversationMap(e).values()).sort(Q.messageComparator)}upsert(e){var t;if(e.isSpecialMessage){l.Y.ctxWarn(this.ctx,"unexpected special message to upsert:",e);return}if(!e.clientId){l.Y.ctxDebug(this.ctx,"not found message clientId:",e);return}let n=this.getConversationMap(e.conversationId);if(this.ctx.option.maxMessageCount){let e=Math.max(200,this.ctx.option.maxMessageCount);if(n.size>=e){let t=~~(e/5);for(let e of n.keys()){if(t<=0)break;n.delete(e),t--}}}let i=n.get(e.clientId);if(i&&i.type===e.type?(["referenceInfo"].forEach(t=>{void 0===e[t]&&delete i[t]}),e=i.merge(e)):i&&i.type!==e.type&&l.Y.ctxWarn(this.ctx,"try to merge different msg:",i,e),n.set(e.clientId,e),null===(t=this.resolve(p.Uk.DbProxy))||void 0===t||t.upsertMessage(e),this.resolve(p.Uk.EventBus).emit(u.c5.MessageUpsert,this,e),this.ctx.initResult===u.rb.Succeeded){this.resolve(p.Uk.EventBus).emitEmpty(u.c5.ConversationChange,this);let t=this.getContext().resolve(p.Uk.ConversationManager).getRaw(e.conversationId);this.resolve(p.Uk.EventBus).emit(u.c5.ConversationUpsert,this,t),void 0!==i&&(null==t||t.forceRefreshUnreadCount())}}getConversationMap(e){let t=this.messages.get(e);return!t&&(t=new Map,this.messages.set(e,t)),t}clearConversationMessages(e,t=900){return(0,a.mG)(this,void 0,void 0,function*(){if(!((null==e?void 0:e.length)<0))e.forEach(e=>{let n=this.getConversationMap(e);if(n.size>=t){let e=~~(t/5);for(let t of n.keys()){if(e<=0)break;n.delete(t),e--}}})})}processNewMessage(e,t){return(0,a.mG)(this,void 0,void 0,function*(){if(!e.ext&&(e.ext={}),e.source=t,e.type>=0)return this.processMessage(e);throw new f.G({ctx:this.ctx,type:u.NI.UnknownMessageType,msg:`unknown message type: ${e.type} for msg:${e.clientId}`,sender:this})})}processNewMessagesFromPull(e,t,n){var i;return(0,a.mG)(this,void 0,void 0,function*(){let r=e.map(e=>M.v.fromServerMessage(this.ctx,e,n)),o=new Map;for(let e of r){!e.ext&&(e.ext={});let n=null===(i=o.get(e.conversationShortId))||void 0===i?void 0:i.indexInConversation;(!n||e.indexInConversation.lt(n))&&o.set(e.conversationShortId,e),yield this.processNewMessage(e,t)}return{msgs:r,conMap:o}})}delete(e,t){var n,i,r;let o=this.getConversationMap(e),s=Array.from(o.values()).filter(e=>e.serverId===t);if(0===s.length){l.Y.ctxDebug(this.ctx,`delete not exist msg: ${e}::${t}`);return}for(let a of(o.delete(s[0].clientId),null===(n=this.resolve(p.Uk.DbProxy))||void 0===n||n.deleteMessage(s[0]),this.getList(e)))(null===(r=null===(i=a.referenceInfo)||void 0===i?void 0:i.referenced_message_id)||void 0===r?void 0:r.toString())===t&&(a.referenceInfo.referenced_message_status=d.m.MessageStatus.DELETED,this.upsert(a));this.getContext().resolve(p.Uk.ConversationManager).get(e),this.resolve(p.Uk.EventBus).emit(u.c5.MessageUpsert,this,s[0]),this.resolve(p.Uk.EventBus).emit(u.c5.MessageDelete,this,s[0])}markRecalled(e,t,n){var i,r;let o=this.getByServerId(e,t);for(let s of(!o.ext&&(o.ext={}),o.ext[u.v9.IsRecalled]="true",n&&this.ctx.option.debug&&(o.ext[u.v9.LocalLogId]=n),this.upsert(o),this.getList(e)))(null===(r=null===(i=s.referenceInfo)||void 0===i?void 0:i.referenced_message_id)||void 0===r?void 0:r.toString())===t&&(s.referenceInfo.referenced_message_status=d.m.MessageStatus.RECALLED,this.upsert(s));this.getContext().resolve(p.Uk.ConversationManager).get(e),this.resolve(p.Uk.EventBus).emit(u.c5.MessageRecall,this,o)}clearConversation(e){var t;let n=this.getContext().resolve(p.Uk.ConversationManager).get(e);if(!!n)this.messages.set(e,new Map),null===(t=this.resolve(p.Uk.DbProxy))||void 0===t||t.clearConversation(n),this.resolve(p.Uk.EventBus).emitEmpty(u.c5.ConversationChange,this),this.resolve(p.Uk.EventBus).emit(u.c5.ConversationUpsert,this,n)}injectProcessorBefore(e){this.processors.unshift(e)}injectProcessor(e){this.processors.push(e)}processMessage(e){return(0,a.mG)(this,void 0,void 0,function*(){let t={needContinue:!0,data:e};for(let e of this.processors)if(!(t=yield e.process(t)).needContinue)break;return t.data})}dispose(){this.messages.clear(),this.processors=[]}}Q.messageComparator=(e,t)=>e.orderInConversation.gt(t.orderInConversation)?1:-1;class ee extends p.mA{constructor(e){super(e),this.participants=new Map}applyLocal(e){e.forEach(e=>{!this.participants.has(e.conversationId)&&this.participants.set(e.conversationId,new Map),this.participants.get(e.conversationId).set(e.userId.toString(),e)})}clearAll(){this.participants.clear()}updateWithUserIdAsync(e,t){var n,i,r,o;return(0,a.mG)(this,void 0,void 0,function*(){let s=t.map(e=>c.fromValue(e)),a=yield this.resolve(p.Uk.CoreApi).GetConversationParticipantByUserId({conversationId:e.id,conversationShortId:c.fromString(e.shortId),conversationType:e.type,inboxType:e.inboxType,participants:s}),d=null!==(o=null===(r=null===(i=null===(n=null==a?void 0:a.body)||void 0===n?void 0:n.mget_conversation_participants_body)||void 0===i?void 0:i.participants)||void 0===r?void 0:r.map(t=>z.Q.fromServerParticipant(this.ctx,t,e,a.log_id)))&&void 0!==o?o:[];this.upsertBatch(e.id,d)})}upsert(e,t,n=!1){var i;let r=this.participants.get(e.toString());!r&&(r=new Map);let o=t;return o.userId=o.userId.toString(),r.has(t.userId.toString())&&(o=z.Q.featLocalParticipant(r.get(t.userId.toString()),o)),r.set(t.userId.toString(),o),this.participants.set(e,r),!n&&(this.resolve(p.Uk.EventBus).emit(u.c5.ParticipantUpsert,this,o),this.resolve(p.Uk.EventBus).emitEmpty(u.c5.ParticipantChange,this)),null===(i=this.resolve(p.Uk.DbProxy))||void 0===i||i.upsertParticipant(o),Array.from(r.values())}upsertBatch(e,t,n=!1){return t.forEach(t=>this.upsert(e,t,n)),this.get(e)}delete(e,t){let n=this.participants.get(e);if(!!n)t.forEach(e=>{var t;let i=n.get(e.toString());if(void 0!==i)n.delete(e.toString()),this.resolve(p.Uk.EventBus).emit(u.c5.ParticipantLeave,this,i),this.resolve(p.Uk.EventBus).emitEmpty(u.c5.ParticipantChange,this),null===(t=this.resolve(p.Uk.DbProxy))||void 0===t||t.deleteParticipant(i)})}get(e){let t=this.participants.get(e);if(t)return Array.from(t.values());{let t=this.resolve(p.Uk.ConversationManager).get(e);return t?this.getParticipants(t):Array.from([])}}getParticipants(e){var t,n,i;let r=[],o=this.getRaw(e.id);return(null==o?void 0:o.length)>0?o:(Number(null===(n=null===(t=null==e?void 0:e.firstPageParticipant)||void 0===t?void 0:t.participants)||void 0===n?void 0:n.length)>0?((null===(i=null==e?void 0:e.firstPageParticipant)||void 0===i?void 0:i.participants)||[]).forEach(t=>{r.push(z.Q.fromServerParticipant(this.ctx,t,e,e.ext[u.v9.LocalLogId]))}):e.type===d.m.ConversationType.ONE_TO_ONE_CHAT&&(l.Y.ctxDebug(this.ctx,"no first page participant found, fallback to local"),[e.toParticipantUserId,this.ctx.option.userId].forEach(t=>{if(t){let n=z.Q.fakeParticipant(this.ctx,t,e);r.push(n)}})),this.upsertBatch(e.id,r,!0),this.resolve(p.Uk.EventBus).emit(u.c5.InitParticipant,this,e),r)}getMap(e){let t=this.participants.get(e);if(t)return t;throw new f.G({ctx:this.ctx,type:u.NI.ConversationNotExist,msg:`conversation ${e} participants is not loaded`,sender:this,args:{conversationId:e}})}getMapRaw(e){return this.participants.get(e)}getRaw(e){let t=this.participants.get(e);return t?Array.from(t.values()):[]}getByUserIdRaw(e,t){let n=this.participants.get(e);if(n)return n.get(t.toString())}dispose(){this.clearAll()}}class et extends p.mA{isValidInbox(e){return void 0!==e&&(!!this.getContext().option.acceptIncorrectInboxType||this.getInboxTypeArray().includes(e))}needSpecifyInbox(){let e=this.ctx.option.inboxType;return void 0!==e&&("number"!=typeof e||!(e>=0))&&(!!Array.isArray(e)&&!!(e.length>2)||!1)}getDefaultInboxWithoutCheck(){return this.getInboxTypeArray()[0]}getDefaultInbox(){if(this.needSpecifyInbox())throw new f.G({ctx:this.ctx,msg:"no available inboxType is provided",type:u.NI.InvalidInboxType,sender:this});return this.getDefaultInboxWithoutCheck()}getInboxTypeArray(){let e=this.ctx.option.inboxType;return Array.isArray(e)?e:void 0!==e?[e]:[0]}}!function(e){e[e.Unknown=0]="Unknown",e[e.Connected=1]="Connected",e[e.Disconnected=2]="Disconnected"}(r||(r={})),!function(e){e[e.Unknown=0]="Unknown",e[e.Cellular_2G=1]="Cellular_2G",e[e.Cellular_3G=2]="Cellular_3G",e[e.Cellular_4G=3]="Cellular_4G",e[e.Cellular_5G=4]="Cellular_5G",e[e.Wifi=5]="Wifi",e[e.Other=6]="Other",e[e.None=7]="None"}(o||(o={}));class en extends p.mA{}var ei=n("835318");class er extends p.mA{constructor(e){super(e)}prepareToken(){var e,t;return(0,a.mG)(this,void 0,void 0,function*(){let n=yield null===(e=this.resolve(p.Uk.DbProxy))||void 0===e?void 0:e.loadConfig(ei.j.UserToken);n?this.isCertAuth&&!1===(yield null===(t=this.resolve(p.Uk.SecurityProxy))||void 0===t?void 0:t.getCert())?yield this.refreshToken():this.ctx.cachedToken=n:yield this.refreshToken()})}refreshToken(){var e,t,n;return(0,a.mG)(this,void 0,void 0,function*(){let{token:i,authType:r}=this.ctx.option;if(r===d.m.AuthType.PASSPORT_CERT_AUTH){let t="";try{t=(yield null===(e=this.resolve(p.Uk.SecurityProxy))||void 0===e?void 0:e.getTicket())||"",this.ctx.cachedToken=t}catch(e){throw new f.G({ctx:this.ctx,msg:"failed to get ticket",type:u.NI.TokenFuncError,sender:this})}return t}if("function"!=typeof i)return this.ctx.cachedToken=i,l.Y.ctxDebug(this.ctx,"token cached from const: ",this.ctx.cachedToken),yield null===(n=this.resolve(p.Uk.DbProxy))||void 0===n?void 0:n.saveConfig(ei.j.UserToken,this.ctx.cachedToken),i;{let e;let n=N.u.performanceNow(),o=null;if(null!==(o=r===d.m.AuthType.CERT_AUTH?yield this.handleCertAuthToken(i):(e=i())instanceof Promise?yield e:e))return this.ctx.cachedToken=o,yield null===(t=this.resolve(p.Uk.DbProxy))||void 0===t?void 0:t.saveConfig(ei.j.UserToken,o),this.resolve(p.Uk.Monitor).emitDuration(N.U.BizRefreshToken,n),l.Y.ctxDebug(this.ctx,"token cached from function: ",this.ctx.cachedToken),o;throw new f.G({ctx:this.ctx,msg:"token is null",type:u.NI.TokenFuncError,sender:this})}})}handleCertAuthToken(e){var t,n,i;return(0,a.mG)(this,void 0,void 0,function*(){let r="";r=this.ctx.option.certAuthZeroTrustUsePubKey?yield null===(t=this.resolve(p.Uk.SecurityProxy))||void 0===t?void 0:t.getPubKey():yield null===(n=this.resolve(p.Uk.SecurityProxy))||void 0===n?void 0:n.getCertSignRequest();let{tsSign:o,token:s,sdkCert:a}=yield e(r),c={ts_sign:o,ticket:s,client_cert:a};return yield null===(i=this.resolve(p.Uk.SecurityProxy))||void 0===i?void 0:i.setSignValue(c),this.ctx.option.cert=a,this.ctx.option.tsSign=o,s})}get isCertAuth(){return this.ctx.option.authType&&[d.m.AuthType.CERT_AUTH,d.m.AuthType.PASSPORT_CERT_AUTH].includes(this.ctx.option.authType)}}function eo(e,t){return e.gt(t)?e:t}function es(e,t){return e.lt(t)?e:t}function ea(e,t,n){var i,r;let o=es(t.readIndex,null!==(i=t.readOrder)&&void 0!==i?i:t.readIndex),s=eo(n.readIndex,null!==(r=n.readOrder)&&void 0!==r?r:n.readIndex);return e.getMessageList().filter(e=>e.indexInConversation.gte(o)&&e.indexInConversation.lte(s))}function ec(e,t){let n=[],i=eu(e.minIndex,t.minIndex),r=eu(e.readIndex,t.readIndex);return void 0!==i&&n.push(i),void 0!==r&&n.push(r),n}function ed(e){let t=[];for(let n of(e.sort((e,t)=>e.minIndex.sub(t.minIndex).toNumber()),e)){let e=0!==t.length?t[t.length-1]:void 0;0===t.length||(null==e?void 0:e.readIndex.lt(n.minIndex))?t.push(n):e.readIndex=eo(e.readIndex,n.readIndex)}return t}function eu(e,t){if(e.neq(t)){let n=es(e,t);return{minIndex:n,readIndex:eo(e,t)}}}var el=n("711061"),ev=n("238758");class eh extends ev.v{constructor(){super(...arguments),this.innerCursor=[]}get coreApi(){return this.resolve(p.Uk.CoreApi)}get inboxType(){return this.resolve(p.Uk.InboxType)}get instance(){return this.resolve(p.Uk.CoreInstance)}getUserCursor(e){var t;return null!==(t=this.innerCursor[null!=e?e:this.inboxType.getDefaultInbox()])&&void 0!==t?t:c.ZERO}setUserCursor(e,t){var n;return(0,a.mG)(this,void 0,void 0,function*(){let i=null!=t?t:this.inboxType.getDefaultInbox(),r=this.innerCursor[i];if(!!(!r||r.lt(e)))l.Y.ctxDebug(this.ctx,`update cursor for inbox:${i} from ${null==r?void 0:r.toString()} to ${e.toString()}`),this.innerCursor[i]=e,yield null===(n=this.resolve(p.Uk.DbProxy))||void 0===n?void 0:n.saveUserCursor(i,e)})}getMessagesByUserInit(e={}){var t,n,i,r,o,s,d,v,h,g;return(0,a.mG)(this,void 0,void 0,function*(){let a,m,y,x,_;let b=null!==(t=e.inboxType)&&void 0!==t?t:this.inboxType.getDefaultInbox(),I=null!==(n=e.cursor)&&void 0!==n?n:c.ZERO,C=e.page;if(!this.inboxType.isValidInbox(b))throw new f.G({ctx:this.ctx,msg:"invalid inbox",type:u.NI.InvalidInboxType,sender:this});let M=c.ZERO,k=c.ZERO;if(e.mode===u.k5.AwemeMode){let t=yield this.coreApi.GetMessagesByInit({inboxType:b,convLimit:e.convLimit,msgLimit:e.msgLimit,page:C,version:e.version}),n=null===(i=t.body)||void 0===i?void 0:i.message_by_init;a=null===(r=n.messages)||void 0===r?void 0:r.map(e=>e.conversations),m=[],null===(o=n.messages)||void 0===o||o.forEach(e=>e.messages&&(null==m?void 0:m.push(...e.messages))),y=null==n?void 0:n.user_cursor,x=n.has_more,k=n.next_init_version,_=t.log_id}else{let t=yield this.coreApi.GetMessagesByUserInitV2({cursor:c.fromValue(I),inboxType:b,initSubType:e.initSubType,convLimit:e.convLimit,msgLimit:e.msgLimit,tagIds:null===(s=e.tagIds)||void 0===s?void 0:s.map(e=>c.fromValue(e)),userCustomTagIds:null===(d=e.userCustomTagIds)||void 0===d?void 0:d.map(e=>c.fromValue(e))}),n=null===(v=t.body)||void 0===v?void 0:v.messages_per_user_init_v2_body;a=n.conversations,m=n.messages,y=null==n?void 0:n.per_user_cursor,x=n.has_more,M=n.next_cursor,_=t.log_id}return this.instance.processInitConversation(a,_),yield this.instance.processInitMessage(m,_),this.getUserCursor(b).neq(c.ZERO)&&(null==y?void 0:y.neq(c.ZERO))&&(null===(h=this.getUserCursor(b))||void 0===h?void 0:h.neq(y))&&(l.Y.ctxWarn(this.ctx,`cursor not match: before:${null===(g=this.getUserCursor(b))||void 0===g?void 0:g.toString()}, after:${null==y?void 0:y.toString()}, pull user, logid:${_}`),yield this.getMessagesByUser({inboxType:b})),y&&(yield this.setUserCursor(y,b)),this.resolve(p.Uk.EventBus).emitEmpty(u.c5.InitLoadPage,this),{hasMore:x,cursor:M,page:(null!=C?C:0)+1,version:k}})}getMessagesByUser(e={}){var t,n,i,r,o;return(0,a.mG)(this,void 0,void 0,function*(){if(e.cursor instanceof Date&&(e.cursor=`${e.cursor.getTime()}000`),void 0===e.inboxType&&(e.inboxType=this.inboxType.getDefaultInbox()),!this.inboxType.isValidInbox(e.inboxType))throw new f.G({ctx:this.ctx,msg:"invalid inbox",type:u.NI.InvalidInboxType,sender:this});if(!0===this.ctx.option.disableInitPull&&0===this.instance.getConversationList().length&&this.getUserCursor(e.inboxType).eq(c.ZERO)&&void 0===e.cursor){l.Y.ctxWarn(this.ctx,"try to pull history from 0, preventing");return}let s=!0,a=void 0!==e.cursor?c.fromValue(e.cursor):this.getUserCursor(e.inboxType);for(;s;){let c=yield this.coreApi.GetMessagesByUser({cursor:a,limit:null!==(t=e.limit)&&void 0!==t?t:50,inboxType:e.inboxType}),d=null===(n=c.body)||void 0===n?void 0:n.messages_per_user_body;s=d.has_more,a=d.next_cursor;let v=new Map;null===(i=d.hasmore_message_conv_list)||void 0===i||i.forEach(e=>{let t=e.toString(),n=this.resolve(p.Uk.ConversationManager).getWithShortIdRaw(t);v.set(t,null==n?void 0:n.lastMessageIndex)});let{conMap:h}=yield this.resolve(p.Uk.MessageManager).processNewMessagesFromPull(d.messages,u.v$.UserInbox,c.log_id);null===(r=d.hasmore_message_conv_list)||void 0===r||r.forEach(e=>{let t=e.toString(),n=h.get(t);if(n){let e=this.resolve(p.Uk.ConversationManager).getRaw(n.conversationId);this.patchMessage({cursor:n,conversation:e,limitindex:v.get(t)})}else l.Y.ctxWarn(this.ctx,`not found message of conversation in hasmore_message_conv_list, conversationid:${t}, logid:${c.log_id}`)}),null===(o=d.conversation_badge_count)||void 0===o||o.map(e=>{let t=this.resolve(p.Uk.ConversationManager).getRaw(e.conversation_id.toString());t&&this.instance.handleBadgeCount(e,t)}),this.instance.initResult===u.rb.Start&&this.resolve(p.Uk.EventBus).emitEmpty(u.c5.InitLoadPage,this)}yield this.setUserCursor(a,e.inboxType),this.resolve(p.Uk.ConversationManager).refreshLocal()})}prepareHistoryForInbox({inboxType:e,convLimit:t,msgLimit:n,mode:i,convTotal:r,tagIds:o,userCustomTagIds:s}){var d,v,h;return(0,a.mG)(this,void 0,void 0,function*(){try{let a=yield null===(d=this.resolve(p.Uk.DbProxy))||void 0===d?void 0:d.loadUserCursor(e);if(void 0!==a)return l.Y.ctxDebug(this.ctx,`load history for inbox ${e} by db`),yield this.setUserCursor(a,e),yield this.getMessagesByUser({inboxType:e,cursor:a}),!0;if(this.ctx.option.disableInitPull){let r;if(l.Y.ctxDebug(this.ctx,`load history for inbox ${e} by disable init`),i===u.k5.AwemeMode){let i=yield this.coreApi.GetMessagesByInit({inboxType:e,convLimit:t,msgLimit:n});r=(null===(v=i.body)||void 0===v?void 0:v.message_by_init).user_cursor}else{let i=yield this.coreApi.GetMessagesByUserInitV2({inboxType:e,convLimit:t,msgLimit:n,cursor:c.ZERO});r=(null===(h=i.body)||void 0===h?void 0:h.messages_per_user_init_v2_body).per_user_cursor}return yield this.setUserCursor(r,e),!0}l.Y.ctxDebug(this.ctx,`load history for inbox ${e} by full init`);let f={hasMore:!0,cursor:c.ZERO,page:0,version:void 0};for(;f.hasMore&&(f=yield this.getMessagesByUserInit(Object.assign({inboxType:e,initSubType:this.ctx.option.initSubType,convLimit:t,msgLimit:n,mode:i,tagIds:o,userCustomTagIds:s},f)),!r||!(this.resolve(p.Uk.ConversationManager).getConversationArray().length>=r)););return!0}catch(t){return l.Y.ctxError(this.ctx,`load history failed for inbox:${e}`,t),!1}})}patchMessage(e){var t,n;return(0,a.mG)(this,void 0,void 0,function*(){let{cursor:i}=e,r=20;if(!e.limitindex)return;i instanceof M.v&&(i=i.indexInConversation),void 0===i&&(i=e.conversation.firstMessageIndex);let o=yield this.coreApi.GetMessagesByConversation({conversationId:e.conversation.id,conversationShortId:c.fromString(e.conversation.shortId),conversationType:e.conversation.type,anchorIndex:c.fromValue(i),direction:d.m.MessageDirection.OLDER,limit:null!==(t=e.limit)&&void 0!==t?t:r,inboxType:e.conversation.inboxType});this.resolve(p.Uk.Monitor).emitMetrics(N.U.GetMessagesByConversation,{count:1},{log_id:o.log_id,from:"patch",conversationId:e.conversation.shortId,cursor:c.fromValue(i).toString()});let s=null===(n=o.body)||void 0===n?void 0:n.messages_in_conversation_body,{conMap:a}=yield this.resolve(p.Uk.MessageManager).processNewMessagesFromPull(s.messages,u.v$.UserInbox,o.log_id),l=a.get(e.conversation.shortId);if(!(null==s?void 0:s.has_more)||!l||e.limitindex.gt((null==l?void 0:l.indexInConversation)||c.ZERO)){e.conversation.forceRefreshUnreadCount();return}this.patchMessage({conversation:e.conversation,limit:e.limit||r,cursor:null==s?void 0:s.next_cursor,limitindex:e.limitindex})})}receivePacket(e){var t,n,i,r,o,s,d;return(0,a.mG)(this,void 0,void 0,function*(){let a=e,u=!1,v=this.getUserCursor(a.inbox_type),h=null===(t=a.body)||void 0===t?void 0:t.has_new_message_notify;h?v.lt(null!==(n=h.previous_cursor)&&void 0!==n?n:c.ZERO)||(null===(i=h.previous_cursor)||void 0===i?void 0:i.eq(c.ZERO))?(u=!0,l.Y.ctxWarn(this.ctx,`push cursour is greater than local cursor, push:${null!==(r=h.previous_cursor)&&void 0!==r?r:c.ZERO}, local:${v.toString()}, msgid:${null===(o=h.message)||void 0===o?void 0:o.server_message_id}, logid:${a.log_id}`)):(null===(s=h.previous_cursor)||void 0===s?void 0:s.eq(v))?yield this.instance.processPushMessage(h,a):(u=!0,l.Y.ctxWarn(this.ctx,`push cursour is less than local cursor, push:${h.previous_cursor}, local:${v}, msgid:${null===(d=h.message)||void 0===d?void 0:d.server_message_id}, logid:${a.log_id}`)):(u=!0,l.Y.ctxWarn(this.ctx,`push body is missing, logid:${a.log_id}`)),u&&(yield this.getMessagesByUser({inboxType:a.inbox_type,cursor:v}))})}getReportParams(e){return Object.assign({hybrid_type:"imcloud"},void 0!==e?{cursor:this.getUserCursor(e).toString()}:{})}}class ef extends el.v{constructor(){super(...arguments),this.name="IMCloudHybridLinkPlugin"}install(){this.hybridLinkInstance=new eh(this.ctx),this.register(p.Uk.HybridLink,this.hybridLinkInstance)}}class ep{constructor(e,t){this.disposed=!1,this.plugins=[],this.isProcessing=!1;let n=new p.jO;this.ctx=n,n.register(p.Uk.Monitor,N.u),n.register(p.Uk.CoreInstance,this),!e.headers&&(e.headers={}),!e.httpHeaders&&(e.httpHeaders={}),!e.extended&&(e.extended={}),e.boe?("string"==typeof(e=(0,L.KQ)(e)).boe&&(e.headers[u.HF.envKey]=e.boe,e.headers[u.HF.boeHeaderKey]="1",e.httpHeaders[u.HF.envKey]=e.boe,e.httpHeaders[u.HF.boeHeaderKey]="1"),"boolean"==typeof e.boe&&(e.headers[u.HF.boeHeaderKey]="1",e.httpHeaders[u.HF.boeHeaderKey]="1")):"string"==typeof(e=(0,L.fC)(e)).ppe?(e.headers[u.HF.envKey]=e.ppe,e.headers[u.HF.ppeHeaderKey]="1",e.httpHeaders[u.HF.envKey]=e.ppe,e.httpHeaders[u.HF.ppeHeaderKey]="1"):e.canary&&(e.headers[u.HF.envKey]="canary",e.httpHeaders[u.HF.envKey]="canary"),void 0===e.timeCalibration&&(e.timeCalibration=!0),this.initPlatformOptions(e),n.option=e,(0,L.RQ)(this.ctx,e),this.net=e.network(n),this.http=e.http(n),this.websocket=e.webSocket(n);let i=!1===this.ctx.option.pullInterval||void 0===this.ctx.option.pullInterval?3e4:this.ctx.option.pullInterval;if(l.Y.ctxDebug(this.ctx,"use ticker interval:",i),this.ticker=this.createTicker(this.ctx,i),n.register(p.Uk.AuthManager,er),n.register(p.Uk.ConversationManager,Y),n.register(p.Uk.MessageManager,Q),n.register(p.Uk.ParticipantManager,ee),n.register(p.Uk.EventBus,I),n.register(p.Uk.NetworkManager,G),n.register(p.Uk.CoreApi,h),n.register(p.Uk.InboxType,et),e.debug){let t="undefined"!=typeof window?window:e.injectContext,i=`__imsdk_context_${this.ctx.id.split("-")[0]}`;if("object"==typeof e.injectContext&&(t=e.injectContext,e.injectContext=!0),"string"==typeof e.injectContext&&(i=e.injectContext,e.injectContext=!0),void 0===e.injectContext&&(e.injectContext=!0),"boolean"==typeof e.injectContext&&e.injectContext)try{Object.defineProperty(t,i,{enumerable:!1,configurable:!0,get:()=>n})}catch(e){l.Y.ctxDebug(n,"inject ctx:",n,`with name: ${i} to`,t,"failed: ",e)}}if(Array.isArray(t)&&(t.forEach(e=>{let t=new e(n);t.install(),this.plugins.push(t)}),this.ctx.plugin=this.plugins),!this.ctx.resolve(p.Uk.HybridLink)){l.Y.ctxDebug(this.ctx,"Service HybridLink is not registered, load internal IMCloudHybridLinkPlugin");let e=new ef(n);e.install(),this.plugins.push(e)}l.Y.ctxDebug(this.ctx,"loaded plugin:",this.plugins),e.boe?l.Y.ctxDebug(this.ctx,`using boe env: ${!0===e.boe?"default":e.boe}`):e.ppe&&l.Y.ctxDebug(this.ctx,`using ppe env: ${e.ppe}`),this.initEventHandler(),Object.seal&&(Object.seal(this),Object.seal(n))}getContext(){return this.ctx}resolve(e){return this.ctx.resolve(e)}get initResult(){return this.ctx.initResult}set initResult(e){this.ctx.initResult=e}get event(){return this.resolve(p.Uk.EventBus)}get api(){return this.resolve(p.Uk.CoreApi)}get network(){return this.resolve(p.Uk.NetworkManager)}get inboxType(){return this.resolve(p.Uk.InboxType)}get id(){return this.ctx.id}get option(){return this.ctx.option}init(e){var t,n,i,r,o,s,c,v,h,f,g;return(0,a.mG)(this,void 0,void 0,function*(){let{userId:a,enableServerConfig:m,authType:y,webSocketLevel:x}=this.ctx.option;if(y&&[d.m.AuthType.CERT_AUTH,d.m.AuthType.PASSPORT_CERT_AUTH].includes(y))try{null===(t=this.resolve(p.Uk.SecurityProxy))||void 0===t||t.init(),this.ctx.option.cert=yield null===(n=this.resolve(p.Uk.SecurityProxy))||void 0===n?void 0:n.getCert(),this.ctx.option.tsSign=yield null===(i=this.resolve(p.Uk.SecurityProxy))||void 0===i?void 0:i.getTsSign()}catch(e){l.Y.ctxWarn(this.ctx,"get cert and tsSign error")}let _=N.u.performanceNow();this.initResult=u.rb.Start;let b=null!==(o=yield null===(r=this.resolve(p.Uk.DbProxy))||void 0===r?void 0:r.init(a))&&void 0!==o&&o;b&&(this.initResult=u.rb.Succeeded);try{yield this.resolve(p.Uk.AuthManager).prepareToken()}catch(e){return this.initResult=u.rb.Error,l.Y.ctxError(this.ctx,"prepare token error:",e),this.resolve(p.Uk.Monitor).emitDuration(N.U.BizSdkInit+N.U.ErrorSuffix,_,Object.assign(Object.assign({use_db:null!==(s=b.toString())&&void 0!==s?s:"unknown"},this.resolve(p.Uk.HybridLink).getReportParams()),{reason:"token"})),this.initResult}if(m)try{yield this.initConfig()}catch(e){l.Y.ctxWarn(this.ctx,"init server config error:",e)}for(let t of this.inboxType.getInboxTypeArray())if(!(yield this.prepareHistoryForInbox({inboxType:t,convLimit:null==e?void 0:e.convLimit,msgLimit:null==e?void 0:e.msgLimit,mode:null==e?void 0:e.mode,convTotal:null==e?void 0:e.convTotal,tagIds:null==e?void 0:e.tagIds,userCustomTagIds:null==e?void 0:e.userCustomTagIds})))return this.initResult=u.rb.Error,l.Y.ctxError(this.ctx,"init history error for inbox",t),this.resolve(p.Uk.Monitor).emitDuration(N.U.BizSdkInit+N.U.ErrorSuffix,_,Object.assign(Object.assign({use_db:null!==(c=b.toString())&&void 0!==c?c:"unknown"},this.resolve(p.Uk.HybridLink).getReportParams(t)),{reason:"history"})),this.initResult;yield this.resolve(p.Uk.ConversationManager).refreshLocalAsync(),this.resolve(p.Uk.EventBus).emitEmpty(u.c5.ConversationChange,this);try{for(let e of this.plugins)yield e.init()}catch(e){return this.initResult=u.rb.Error,l.Y.ctxError(this.ctx,"init plugin error:",e),this.resolve(p.Uk.Monitor).emitDuration(N.U.BizSdkInit+N.U.ErrorSuffix,_,Object.assign(Object.assign({use_db:null!==(v=b.toString())&&void 0!==v?v:"unknown"},this.resolve(p.Uk.HybridLink).getReportParams()),{reason:"plugin"})),this.initResult}if(x!==u._.Disable)try{this.resolve(p.Uk.Monitor).emitCounter(N.U.WebSocketConnectFirst,1,{url:null!==(f=null===(h=this.network.ws)||void 0===h?void 0:h.url)&&void 0!==f?f:"unknown"}),yield this.network.connectWs(!0)}catch(e){l.Y.ctxWarn(this.ctx,"skip websocket, init open fail:",e)}return this.ticker.onTick.subscribe(()=>{this.tickerUpdate()}),this.ticker.restart(),this.initResult=u.rb.Succeeded,this.resolve(p.Uk.Monitor).emitDuration(N.U.BizSdkInit+N.U.SuccessSuffix,_,Object.assign({use_db:null!==(g=b.toString())&&void 0!==g?g:"unknown"},this.resolve(p.Uk.HybridLink).getReportParams())),this.resolve(p.Uk.EventBus).emit(u.c5.InitFinish,this,this.initResult),this.initResult})}getMessagesByUser(e){return(0,a.mG)(this,void 0,void 0,function*(){return this.resolve(p.Uk.HybridLink).getMessagesByUser(e)})}getMessagesByConversation(e){var t,n,i,r;return(0,a.mG)(this,void 0,void 0,function*(){let{cursor:o}=e,{direction:s}=e;o instanceof M.v&&(o=o.indexInConversation),void 0===o&&(o=e.conversation.firstMessageIndex,e.conversation.firstMessageIndex.gt(null!==(t=e.conversation.__internal_pullCursor)&&void 0!==t?t:c.ZERO)&&(o=e.conversation.__internal_pullCursor,l.Y.ctxDebug(this.ctx,`using internal cursor: ${o.toString()} < ${e.conversation.firstMessageIndex.toString()} for conversation:`,e.conversation)));let a=yield this.api.GetMessagesByConversation({conversationId:e.conversation.id,conversationShortId:c.fromString(e.conversation.shortId),conversationType:e.conversation.type,anchorIndex:c.fromValue(o),direction:s||d.m.MessageDirection.OLDER,limit:null!==(n=e.limit)&&void 0!==n?n:20,inboxType:e.conversation.inboxType});this.resolve(p.Uk.Monitor).emitMetrics(N.U.GetMessagesByConversation,{count:1},{log_id:a.log_id,from:"user",conversation_id:e.conversation.shortId,cursor:c.fromValue(o).toString()});let v=null===(i=a.body)||void 0===i?void 0:i.messages_in_conversation_body;e.conversation.__internal_pullCursor=null!==(r=v.next_cursor)&&void 0!==r?r:e.conversation.__internal_pullCursor;let{msgs:h}=yield this.resolve(p.Uk.MessageManager).processNewMessagesFromPull(v.messages,u.v$.LoadMore,a.log_id);return{messages:h,hasMore:null==v?void 0:v.has_more,cursor:null==v?void 0:v.next_cursor}})}markConversationRead(e){var t,n;return(0,a.mG)(this,void 0,void 0,function*(){let i,r,{readIndex:o,readIndexV2:s}=e,{conversation:a}=e;void 0===o?o=a.lastMessageIndex:o instanceof M.v&&(o=o.indexInConversation),void 0===s?s=a.lastMessageIndexV2:s instanceof M.v&&(s=s.indexInConversationV2);let u=c.fromValue(o),l=c.fromValue(s),v=a.readIndex;if(!e.force&&u.lt(v))return;let{newReadBadgeCount:h,newMuteReadBadgeCount:f}=this.calcBadgeCount(a,u,v),g=[{message_type:d.m.MuteMessageType.TYPE_PART_MUTE,read_badge_count:f}];if(this.resolve(p.Uk.ConversationManager).markRead(a.id,u,h,g),this.ctx.option.unreadCountReport){let o=this.getConversationList({filter:e=>e.inboxType===a.inboxType&&e.isMember&&0===e.mode}).reduce((e,t)=>e+t.unreadCount,0);r=null!==(t=e.totalUnreadCount)&&void 0!==t?t:o,i=null!==(n=e.convUnreadCount)&&void 0!==n?n:a.unreadCount}yield this.api.MarkConversationReadV3({conversationId:a.id,conversationShortId:c.fromString(a.shortId),conversationType:a.type,readIndex:u,readIndexV2:l.gt(0)?l:c.ONE,inboxType:a.inboxType,unreadCount:void 0!==i?c.fromValue(i):void 0,totalUnreadCount:void 0!==r?c.fromValue(r):void 0,readBadgeCount:h,muteReadBadgeCountInfos:g})})}calcBadgeCount(e,t,n){let i,r;return e.lastMessageIndex.eq(t)?(i=e.badgeCount,r=e.partMuteBadgeCount):(i=Math.min(e.badgeCount,e.settingInfo.readBadgeCount+e.getLocalMessageRangeList(n,t).length),r=Math.min(e.partMuteBadgeCount,e.settingInfo.partMuteReadBadgeCount+e.getLocalMessageRangeList(n,t).filter(t=>e.isMsgInWeakMuteWhiteList(t)).length)),{newReadBadgeCount:i,newMuteReadBadgeCount:r}}batchClearConversationRead(e){var t;return(0,a.mG)(this,void 0,void 0,function*(){let n=null!==(t=e.messageTypes)&&void 0!==t?t:[d.m.MuteMessageType.TYPE_PART_MUTE,0],i=e.conversations.map(e=>{let t=n.includes(d.m.MuteMessageType.TYPE_PART_MUTE),i=n.includes(0),r={muteReadBadgeCountInfos:t?[{message_type:d.m.MuteMessageType.TYPE_PART_MUTE,read_badge_count:e.partMuteBadgeCount}]:[{message_type:d.m.MuteMessageType.TYPE_PART_MUTE,read_badge_count:e.settingInfo.partMuteReadBadgeCount}],readBadgeCount:i?t?e.badgeCount:Math.max(e.badgeCount-e.unreadCountWithWhiteList,0):t?Math.min(e.settingInfo.readBadgeCount+e.unreadCountWithWhiteList,e.badgeCount):e.settingInfo.readBadgeCount},o=0,s=0,a=c.fromValue(e.settingInfo.readIndexV2);return Object.assign({conversationId:e.id,conversationShortId:c.fromString(e.shortId),conversationType:e.type,readIndex:c.fromValue(e.settingInfo.readIndex),readIndexV2:a.gt(0)?a:c.ONE,inboxType:e.inboxType,unreadCount:c.fromValue(o),totalUnreadCount:c.fromValue(s)},r)});yield this.api.BatchMarkConversationReadV3({batch:i})})}get noticeUnreadCount(){return this.getConversationList().filter(e=>e.pushStatus===u.Bs.Allow||e.pushStatus===u.Bs.Unknown).reduce((e,t)=>e+t.unreadCount,0)+this.getConversationList().filter(e=>e.pushStatus===u.Bs.PartAllow).reduce((e,t)=>e+t.unreadCountWithWhiteList,0)}get mutedUnreadCount(){return this.getConversationList().filter(e=>e.pushStatus===u.Bs.Disable).reduce((e,t)=>e+t.unreadCount,0)+this.getConversationList().filter(e=>e.pushStatus===u.Bs.PartAllow).reduce((e,t)=>e+Math.max(0,t.unreadCount-t.unreadCountWithWhiteList),0)}clearConversationMessages(e){let{conversationIds:t=[]}=e;t=t.length>0?t:this.getConversationList().map(e=>e.id),this.resolve(p.Uk.MessageManager).clearConversationMessages(t,e.limitMessage)}recallMessage(e){return(0,a.mG)(this,void 0,void 0,function*(){if(!e.message.serverId)throw new f.G({ctx:this.ctx,type:u.NI.MessageNotReady,msg:`message ${e.message} is not ready`,sender:this});let t=this.resolve(p.Uk.ConversationManager).get(e.message.conversationId);if(!t)return;let n=yield this.api.RecallMessage({conversationId:e.message.conversationId,conversationShortId:c.fromString(e.message.conversationShortId),conversationType:e.message.conversationType,serverId:c.fromString(e.message.serverId),inboxType:t.inboxType});this.resolve(p.Uk.MessageManager).markRecalled(e.message.conversationId,e.message.serverId,n.log_id)})}createConversation(e){var t,n,i,r,o;return(0,a.mG)(this,void 0,void 0,function*(){let s=N.u.performanceNow(),a=[],l={success:!1,payload:null};if(void 0===e.inboxType&&(e.inboxType=this.inboxType.getDefaultInbox()),!this.inboxType.isValidInbox(e.inboxType))throw new f.G({ctx:this.ctx,msg:"invalid inbox",type:u.NI.InvalidInboxType,sender:this});if(void 0===e.type&&(Array.isArray(e.participants)?e.participants.length<=1?e.type=d.m.ConversationType.ONE_TO_ONE_CHAT:e.type=d.m.ConversationType.GROUP_CHAT:e.type=d.m.ConversationType.ONE_TO_ONE_CHAT),(a=Array.isArray(e.participants)?-1===e.participants.indexOf(this.ctx.option.userId)?e.participants.concat(this.ctx.option.userId):e.participants:[e.participants,this.ctx.option.userId]).length>2&&e.type===d.m.ConversationType.ONE_TO_ONE_CHAT)return l.statusCode=u.NI.InvalidParam,l.statusMsg="one to one chat can only has 2 participants",l;void 0===e.persistent&&void 0!==e.idempotentId&&e.idempotentId.length>0&&(e.persistent=!0);try{let t=yield this.api.CreateConversationV2({type:e.type,participants:a.map(e=>c.fromValue(e)),persistent:e.persistent,idempotentId:e.idempotentId,name:e.name,avatarUrl:e.avatarUrl,desc:e.desc,bizExt:e.bizExt,inboxType:e.inboxType}),n=t.body.create_conversation_v2_body;if(l.checkCode=n.check_code,l.checkMsg=n.check_message,l.statusCode=n.status,l.statusMsg=n.extra_info,l.body=n,(null==n?void 0:n.status)===0){let e=C.r.fromServerConversation(this.ctx,null==n?void 0:n.conversation,t.log_id);this.resolve(p.Uk.ConversationManager).upsert(e),yield this.resolve(p.Uk.ConversationManager).refreshAsync(e);let i=this.resolve(p.Uk.ConversationManager).get(e.id);l.success=!0,l.payload=i,this.resolve(p.Uk.EventBus).emit(u.c5.ConversationCreate,this,i)}}catch(e){l.statusCode=null!==(t=e.type)&&void 0!==t?t:u.NI.NetworkError,l.innerError=e}return this.resolve(p.Uk.Monitor).emitMetrics(N.U.CreateConversation,{create_cost:Math.round(N.u.performanceNow()-s)},{type:null!==(i=null===(n=e.type)||void 0===n?void 0:n.toString())&&void 0!==i?i:"unknown",error_code:null!==(o=null===(r=l.statusCode)||void 0===r?void 0:r.toString())&&void 0!==o?o:"unknown"}),l})}getConversation(e){return this.resolve(p.Uk.ConversationManager).get(e.conversationId)}getConversationOnline(e){return(0,a.mG)(this,void 0,void 0,function*(){return this.resolve(p.Uk.ConversationManager).getWithOnline(e.conversationId,e.shortId,e.type)})}getConversationList(e={}){let{filter:t,tagIds:n,userCustomTagIds:i}=e,r=this.resolve(p.Uk.ConversationManager).getConversationArray(t);if(n||i){let e=Array.isArray(n)?n:[n].filter(Boolean),t=Array.isArray(i)?i:[i].filter(Boolean);if(e.length>0||t.length>0){let n=new Set(e),i=new Set(t);r=r.filter(e=>e.tagIds.find(e=>n.has(e))||e.userTagIds.find(e=>i.has(e)))}}return r}getConversationListOnline(e={}){return(0,a.mG)(this,void 0,void 0,function*(){return yield this.resolve(p.Uk.ConversationManager).refreshLocalAsync(),this.getConversationList(e)})}getConversationMessages(e){var t;let{conversation:n}=e;if(e.isCheckMsg)try{null===(t=this.resolve(p.Uk.DbProxy))||void 0===t||t.checkMessages(n)}catch(e){l.Y.ctxWarn(this.ctx,`check msgs error, conv id: ${n.id}`)}return!e.filter&&(e.filter=e=>e.visible),this.resolve(p.Uk.MessageManager).getList(n.id).filter(e.filter)}createMessage(e){var t;return(0,a.mG)(this,void 0,void 0,function*(){void 0===e.insert&&(e.insert=!0);let n=Object.assign({},e.ext),i=M.v.createClientMessage(this.ctx,{type:e.type,content:e.content,ext:n,id:null!==(t=e.clientId)&&void 0!==t?t:(0,j.k)(),conversationId:e.conversation.id,mentionedUsers:e.mentionedUsers||[],conversationShortId:e.conversation.shortId,conversationType:e.conversation.type,referenceMessage:e.referenceMessage,referenceHint:e.referenceHint});return i.flightStatus=u.b3.Created,i.sendFunc=this.__internal_sendMessageObject.bind(this),i.indexInConversation=e.conversation.lastMessageIndex.add(1),i.orderInConversation=e.conversation.lastMessageOrder.add(1),e.insert&&(yield this.resolve(p.Uk.MessageManager).processNewMessage(i,u.v$.Offline)),i})}sendMessage(e){var t,n,i,r;return(0,a.mG)(this,void 0,void 0,function*(){let{message:o}=e,s=Date.now(),a=yield o.sendFunc(o);this.resolve(p.Uk.EventBus).emit(u.c5.MessageSend,this,o);try{let e=Date.now(),c=this.resolve(p.Uk.ConversationManager).get(o.conversationId);if(!c)return;this.resolve(p.Uk.Monitor).emitMetrics(N.U.SendMessage,{con_member_count:c.participantCount-1,send_cost_time:e-s},{con_type:o.conversationType.toString(),conversation_id:o.conversationId,msg_uuid:o.serverId,msg_type:o.type.toString(),send_start_time:s.toString(),send_end_time:e.toString(),error_code:null!==(n=null===(t=a.statusCode)||void 0===t?void 0:t.toString())&&void 0!==n?n:"unknown",is_ws:(null===(i=this.network.ws)||void 0===i?void 0:i.isOpen())?"1":"0",logid:null!==(r=a.logid)&&void 0!==r?r:""})}catch(e){l.Y.ctxWarn(this.ctx,"Fail to report data after send message",e)}return a})}fetchConversation(e){return(0,a.mG)(this,void 0,void 0,function*(){let t=null;if(void 0!==e.shortId){let t=this.resolve(p.Uk.ConversationManager).getWithShortIdRaw(e.shortId);if(void 0!==t&&!t.isOffline)return t}if(void 0===e.inboxType&&(e.inboxType=this.inboxType.getDefaultInbox()),!this.inboxType.isValidInbox(e.inboxType))throw new f.G({ctx:this.ctx,msg:"invalid inbox",type:u.NI.InvalidInboxType,sender:this});if(void 0!==e.idempotentId&&void 0===e.participantId){let n=yield this.createConversation({type:d.m.ConversationType.GROUP_CHAT,participants:[],inboxType:e.inboxType,idempotentId:e.idempotentId});n.success&&null!==(t=n.payload)&&(yield this.getConversationOnline({conversationId:t.id,shortId:t.shortId,type:d.m.ConversationType.ONE_TO_ONE_CHAT}))}else if(void 0!==e.participantId){let n=yield this.createConversation({type:d.m.ConversationType.ONE_TO_ONE_CHAT,participants:e.participantId,inboxType:e.inboxType});n.success&&null!==(t=n.payload)&&(yield this.resolve(p.Uk.ConversationManager).refreshAsync(t))}else if(void 0!==e.shortId)t=yield this.getConversationOnline({conversationId:e.shortId,shortId:e.shortId,type:d.m.ConversationType.GROUP_CHAT});else throw new f.G({ctx:this.ctx,type:u.NI.InvalidParam,msg:"no valid param provided",reachServer:!1,sender:this});if(null!==t&&!t.isOffline)return yield this.getMessagesByConversation({conversation:t}),t;throw new f.G({ctx:this.ctx,type:u.NI.ConversationNotExist,msg:"fetch failed, conv is null or offline",reachServer:!1,sender:this})})}getMessageReadReceipt(e){if(!e.message.isFromMe||e.message.isOffline)return{finishedParticipants:[],expectedParticipants:[]};let t=this.resolve(p.Uk.ConversationManager).get(e.message.conversationId);if(!t)return;if(0===t.getParticipantList().length)return{finishedParticipants:[],expectedParticipants:[]};let n=e.message.__internal_cachedReadReceipt,i=!0;if(void 0!==n&&(0!==n.expectedParticipants.length&&n.expectedParticipants.length===n.finishedParticipants.length&&(i=!1),e.message.__internal_receiptClean&&(i=!1)),i){let n=[],i=[],r=t.getParticipantList();0!==r.length&&r.forEach(t=>{if(!t.minIndex.gt(e.message.indexInConversation))t.userId!==this.ctx.option.userId&&(i.push(t),(t.readOrder.gte(e.message.orderInConversation)||t.readIndex.gte(e.message.indexInConversation))&&n.push(t))}),e.message.__internal_cachedReadReceipt={finishedParticipants:n,expectedParticipants:i},e.message.__internal_receiptClean=!0}return e.message.__internal_cachedReadReceipt}updateConversationReadReceipt(e){return(0,a.mG)(this,void 0,void 0,function*(){let{conversation:t}=e,n=this.resolve(p.Uk.ParticipantManager).getRaw(t.id);if(!n.length){this.resolve(p.Uk.ParticipantManager).getParticipants(t);return}let i={},{readIndexs:r,minIndexs:o}=yield this.getParticipantsReadAndMinIndex({conversation:e.conversation,batchFetch:e.batchFetch});o.forEach(e=>{i[e.user_id.toString()]={minIndex:e.index,readIndex:e.index}}),r.forEach(e=>{void 0!==i[e.user_id.toString()]?i[e.user_id.toString()].readIndex=e.index:i[e.user_id.toString()]={readIndex:e.index,minIndex:c.ZERO}});let s=[];for(let e of Object.keys(i)){let r=i[e],o=n.find(t=>t.userId===e),a=ec(o?{readIndex:o.readIndex,minIndex:o.minIndex}:{readIndex:c.ZERO,minIndex:c.ZERO},r);s.push(...a),void 0!==o&&(o.readIndex.neq(r.readIndex)||o.readOrder.neq(r.readIndex)||o.minIndex.neq(r.minIndex))&&(o.readIndex=r.readIndex,o.readOrder=r.readIndex,o.minIndex=r.minIndex,this.resolve(p.Uk.ParticipantManager).upsert(t.id,o))}let a=ed(s),d=[];for(let e of a)d.push(...ea(t,{readIndex:e.minIndex},{readIndex:e.readIndex}));0!==d.length&&(d.forEach(e=>e.__internal_receiptClean=!1),this.resolve(p.Uk.EventBus).emit(u.c5.ReadReceiptChange,this,{conversation:t,messages:d}))})}dispose(){var e,t;this.resolve(p.Uk.EventBus).unsubscribeAll(),null===(e=this.ticker)||void 0===e||e.stop(),this.network.closeWs(),null===(t=this.network.ws)||void 0===t||t.dispose(),this.network.onMessage.unsubscribeAll(),this.plugins.forEach(e=>e.dispose()),this.plugins.length=0,this.resolve(p.Uk.ConversationManager).dispose(),this.resolve(p.Uk.MessageManager).dispose(),this.resolve(p.Uk.ParticipantManager).dispose(),this.ctx.option.monitor=void 0,this.ctx.option.aspectBefore=()=>(l.Y.ctxError(this.ctx,"do not invoke a disposed instance"),!1),this.disposed=!0,l.Y.ctxDebug(this.ctx,"sdk unloaded, do not invoke this instance")}prepareHistoryForInbox(e){return(0,a.mG)(this,void 0,void 0,function*(){return this.resolve(p.Uk.HybridLink).prepareHistoryForInbox(e)})}tickerUpdate(){return(0,a.mG)(this,void 0,void 0,function*(){if((yield this.network.net.getConnectionStatus())!==r.Disconnected&&this.initResult===u.rb.Succeeded){if(this.ctx.option.pullInterval&&!this.isProcessing&&!(this.ctx.option.disablePullIntervalWhenWsIsOnline&&this.network.isWsOnline))for(let e of this.inboxType.getInboxTypeArray())try{yield this.getMessagesByUser({inboxType:e}),this.resolve(p.Uk.Monitor).emitMetrics(N.U.GetMessagesByTicker,{count:1},Object.assign({tick_timer:this.ticker.getTickTimer(),time:Math.round(Date.now()/1e3).toString(),inbox:e.toString()},this.resolve(p.Uk.HybridLink).getReportParams(e)))}catch(e){l.Y.ctxWarn(this.ctx,"ticker running in pull user err:",e)}for(let e of this.plugins)try{yield e.ticker()}catch(e){l.Y.ctxWarn(this.ctx,"ticker running in plugin err:",e)}}})}__internal_sendMessageObject(e){var t,n,i,r,o;return(0,a.mG)(this,void 0,void 0,function*(){let s={success:!1,payload:e};if(e.serverId)return s.statusCode=0,s;let a=this.resolve(p.Uk.ConversationManager).getRaw(e.conversationId);if(void 0===a)return s.statusCode=u.NI.ConversationNotExist,s.statusMsg=`conversation ${e.conversationId} not exist in local`,s;e.flightStatus=u.b3.Inflight,yield this.resolve(p.Uk.MessageManager).processNewMessage(e,u.v$.Offline);try{!a.ticket&&(yield this.resolve(p.Uk.ConversationManager).refreshTicket(a.id))}catch(n){return e.flightStatus=u.b3.Failed,s.statusCode=null!==(t=n.type)&&void 0!==t?t:u.NI.InvalidTicket,s.innerError=n,this.resolve(p.Uk.MessageManager).upsert(e),s}try{if(this.ctx.option.timeCalibration){let t=this.ctx.resolve(p.Uk.Monitor).avgDelta,n=Date.now();e.ext[u.v9.SendTime]=(n+t).toString()}let t=yield this.api.SendMessage({conversationType:a.type,conversationId:a.id,conversationShortId:c.fromString(a.shortId),content:e.content,ticket:a.ticket,ext:e.ext,messageType:e.type,clientId:e.clientId,mentionedUsers:e.mentionedUsers.map(e=>c.fromString(e)),inboxType:a.inboxType,referenceInfo:e.referenceInfo}),o=null===(n=t.body)||void 0===n?void 0:n.send_message_body;if(e.ext[u.v9.SendResponseCheckCode]=null!==(i=null==o?void 0:o.check_code.toString())&&void 0!==i?i:"",e.ext[u.v9.SendResponseCheckMessage]=null==o?void 0:o.check_message,e.ext[u.v9.SendResponseExtraInfo]=null==o?void 0:o.extra_info,e.ext[u.v9.SendResponseStatus]=null!==(r=null==o?void 0:o.status.toString())&&void 0!==r?r:"",this.ctx.option.debug&&(e.ext[u.v9.LocalLogId]=t.log_id),s.body=o,s.checkCode=o.check_code,s.checkMsg=o.check_message,s.statusCode=o.status,s.statusMsg=o.extra_info,s.logid=t.log_id,0===o.status){let t=o.server_message_id.toString();e.serverId=t,e.flightStatus=u.b3.Succeeded,e.isOffline=!1,yield this.resolve(p.Uk.MessageManager).processNewMessage(e,u.v$.Offline),s.success=!0}else e.flightStatus!==u.b3.Received?(e.flightStatus=u.b3.Rejected,o.status===d.m.SendMessageStatus.CHECK_MSG_NOT_PASS_BUT_SELF_VISIBLE&&(e.flightStatus=u.b3.SelfVisible)):s.success=!0}catch(t){e.flightStatus!==u.b3.Received&&(e.flightStatus=u.b3.Failed),s.innerError=t,s.statusCode=null!==(o=t.type)&&void 0!==o?o:u.NI.NetworkError}return this.resolve(p.Uk.MessageManager).upsert(e),s})}receivePacket(e){var t,n;return(0,a.mG)(this,void 0,void 0,function*(){if(this.initResult===u.rb.Succeeded){this.isProcessing=!0;try{if(e.cmd===d.m.IMCMD.NEW_MSG_NOTIFY){let i=null===(t=e.body)||void 0===t?void 0:t.has_new_message_notify;if(i){let t=this.resolve(p.Uk.ConversationManager).getRaw(i.conversation_id);yield this.clientAck({packet:e,inboxType:null!==(n=null==t?void 0:t.inboxType)&&void 0!==n?n:null==e?void 0:e.inbox_type,type:d.m.MsgReportType.MSG_RECEIVE_BY_WS}),this.handleBadgeCount(i,t)}for(let t of(yield this.resolve(p.Uk.HybridLink).receivePacket(e),this.resolve(p.Uk.ConversationManager).refreshLocal(),this.plugins))yield t.receivePacket(e)}}catch(e){throw e}finally{this.isProcessing=!1}}})}handleBadgeCount(e,t){try{t&&(e.badge_count&&(t.badgeCount=e.badge_count),Array.isArray(e.mute_badge_count_info)?t.mergeMuteBadgeCountInfos(e.mute_badge_count_info):e.mute_badge_count_info&&t.mergeMuteBadgeCountInfos([e.mute_badge_count_info]),this.resolve(p.Uk.ConversationManager).upsert(t))}catch(e){l.Y.ctxWarn(this.ctx,"handle badge count data error",e)}}clientAck({packet:e,inboxType:t,type:n}){var i,r,s,u,l,v;return(0,a.mG)(this,void 0,void 0,function*(){let a;if(!(!(null===(i=e.body)||void 0===i?void 0:i.has_new_message_notify)||!e.start_time_stamp||e.start_time_stamp.lte(0))){switch(yield this.network.net.getNetworkType()){case o.Cellular_2G:a=d.m.NetworkType.MOBILE_2G;break;case o.Cellular_3G:a=d.m.NetworkType.MOBILE_3G;break;case o.Cellular_4G:a=d.m.NetworkType.MOBILE_4G;break;case o.Cellular_5G:a=d.m.NetworkType.MOBILE_5G;break;case o.Wifi:a=d.m.NetworkType.WIFI;break;default:a=d.m.NetworkType.UNKNOWN}this.resolve(p.Uk.Monitor).emitMetrics(N.U.MessageAck,{count:1},{start_timestamp:e.start_time_stamp.toString(),cmd:e.cmd.toString(),network_type:a.toString(),logid:e.log_id,client_timestamp:new Date().getTime().toString(),server_message_id:null!==(u=null===(s=null===(r=e.body.has_new_message_notify.message)||void 0===r?void 0:r.server_message_id)||void 0===s?void 0:s.toString())&&void 0!==u?u:"0",report_net_type:n.toString()}),yield this.api.ClientAck({startTimeStamp:e.start_time_stamp,cmd:e.cmd,NetworkType:a,logid:e.log_id,clientTimeStamp:c.fromNumber(new Date().getTime()),serverId:null!==(v=null===(l=e.body.has_new_message_notify.message)||void 0===l?void 0:l.server_message_id)&&void 0!==v?v:c.ZERO,inboxType:t,type:n})}})}reportMessageDelayTime(e,t){var n,i,r,o,s,a,c,d,v;let h;let f=null===(n=e.create_time)||void 0===n?void 0:n.toNumber();if(!f)return;let g=this.ctx.option.timeCalibration?this.resolve(p.Uk.Monitor).avgDelta:0,m=Date.now(),y=Math.round(m+g-f);if(y<=0){l.Y.ctxDebug(this.ctx,`message reception delay is less than 0, serverId:${e.server_message_id}, current:${m}, createTime:${f}, timeDelta:${g}`);return}let x=Number(null===(i=e.ext)||void 0===i?void 0:i[u.v9.SendTime]);if(Number.isFinite(x)){let t=Math.round(m+g-x);t>0?h=t:l.Y.ctxDebug(this.ctx,`end_end_cost is less than 0, serverId:${e.server_message_id}, current:${m}, sendTimeFromClient:${x}, timeDelta:${g}`)}this.resolve(p.Uk.Monitor).emitMetrics(N.U.ReceiveMessage,Object.assign({receive_cost_time:y},h?{end_end_cost:h}:{}),Object.assign({con_type:null!==(o=null===(r=e.conversation_type)||void 0===r?void 0:r.toString())&&void 0!==o?o:"",conversation_id:null!==(s=e.conversation_id)&&void 0!==s?s:"",msg_uuid:null!==(c=null===(a=e.server_message_id)||void 0===a?void 0:a.toString())&&void 0!==c?c:"",receive_end_time:m.toString(),receive_start_time:f.toString(),time_delta:g.toString(),msg_type:null!==(v=null===(d=e.message_type)||void 0===d?void 0:d.toString())&&void 0!==v?v:"",error_code:"0",ntp_ready:this.ctx.option.timeCalibration?"1":"0",is_ws:"1",logid:t},this.resolve(p.Uk.HybridLink).getReportParams()))}processInitMessage(e,t){return(0,a.mG)(this,void 0,void 0,function*(){e&&(yield this.resolve(p.Uk.MessageManager).processNewMessagesFromPull(e,u.v$.Init,t))})}processInitConversation(e,t){e&&e.map(e=>C.r.fromServerConversation(this.ctx,e,t)).forEach(e=>this.resolve(p.Uk.ConversationManager).upsert(e))}dbClear(e){var t;return(0,a.mG)(this,void 0,void 0,function*(){yield null===(t=this.resolve(p.Uk.DbProxy))||void 0===t?void 0:t.clear(e)})}processPushMessage(e,t){return(0,a.mG)(this,void 0,void 0,function*(){let n=e.message;if(n){this.reportMessageDelayTime(n,t.log_id);let e=M.v.fromServerMessage(this.ctx,n,t.log_id);!e.ext&&(e.ext={}),this.ctx.option.debug&&(e.ext[u.v9.LocalLogId]=t.log_id),yield this.resolve(p.Uk.MessageManager).processNewMessage(e,u.v$.Online)}else l.Y.ctxWarn(this.ctx,"msg body is empty:",e)})}getParticipantsReadAndMinIndex(e){var t;return(0,a.mG)(this,void 0,void 0,function*(){if(e.batchFetch){let{conversation:n}=e,i=(yield this.api.BatchGetConversationParticipantsReadIndex({conversationId:[n.id],conversationShortId:[c.fromString(n.shortId)],min_index_required:!0})).conversationParticipantsReadIndex,r=(null===(t=null==i?void 0:i[0])||void 0===t?void 0:t.participantReadIndex)||[],o=[],s=[];return r.forEach(e=>{e.index&&o.push({user_id:c.fromString(e.user_id.toString()),index:c.fromString(e.index.toString())}),s.push({user_id:c.fromString(e.user_id.toString()),index:c.fromString(e.index_min.toString())})}),{readIndexs:o,minIndexs:s}}{let t=yield this.api.GetConversationParticipantsReadIndexV3({conversationId:e.conversation.id,conversationShortId:c.fromString(e.conversation.shortId),conversationType:e.conversation.type,inboxType:e.conversation.inboxType}),n=yield this.api.GetConversationParticipantsMinIndexV3({conversationId:e.conversation.id,conversationShortId:c.fromString(e.conversation.shortId),conversationType:e.conversation.type,inboxType:e.conversation.inboxType});return{readIndexs:(null==t?void 0:t.indexes)||[],minIndexs:n.indexes||[]}}})}initEventHandler(){this.network.onMessage.subscribe(e=>this.receivePacket(e)),this.resolve(p.Uk.EventBus).subscribe(u.c5.InitParticipant,e=>{this.updateConversationReadReceipt({conversation:e,batchFetch:!0})})}initConfig(){var e;return(0,a.mG)(this,void 0,void 0,function*(){try{let t=yield this.api.GetConfigs();null===(e=null==t?void 0:t.configs)||void 0===e||e.forEach(e=>{let t=e.conf_value;null!=t&&("true"===e.conf_value?t=!0:"false"===e.conf_value?t=!1:!isNaN(Number(e.conf_value))&&(t=Number(e.conf_value)),this.ctx.config.set(e.conf_name,t))}),l.Y.ctxDebug(this.ctx,"load server config",this.ctx.config)}catch(e){l.Y.ctxWarn(this.ctx,"fail to load server config")}})}updateHeaders(e){this.ctx.option.headers=Object.assign(Object.assign({},this.ctx.option.headers),e)}updateSendMessageHeaders(e){this.ctx.option.sendMessageHeader=Object.assign(Object.assign({},this.ctx.option.sendMessageHeader),e)}}class eg extends en{getConnectionStatus(){return(0,a.mG)(this,void 0,void 0,function*(){return"undefined"==typeof navigator||void 0===navigator.onLine?r.Unknown:navigator.onLine?r.Connected:r.Disconnected})}getNetworkType(){return(0,a.mG)(this,void 0,void 0,function*(){if((yield this.getConnectionStatus())===r.Disconnected)return o.None;if("undefined"==typeof navigator||!navigator.connection||!navigator.connection.type)return o.Unknown;switch(navigator.connection.type){case"cellular":if(!navigator.connection.effectiveType)return o.Unknown;switch(navigator.connection.effectiveType){case"2g":case"slow-2g":return o.Cellular_2G;case"3g":return o.Cellular_3G;case"4g":return o.Cellular_4G;case"5g":return o.Cellular_5G;default:return o.Unknown}case"wifi":return o.Wifi;case"other":return o.Other;case"none":return o.None;default:return o.Unknown}})}}var em=n("183652"),ey=n.n(em);class ex extends p.mA{constructor(e){super(e),this.option=e.option}sendByBeacon(e,t){return!1}sendBeacon(e,t){setTimeout(()=>{!this.sendByBeacon(e,A(t))&&this.sendRequest(e,t)},0)}sendRequest(e,t){return(0,a.mG)(this,void 0,void 0,function*(){let n=yield this.send(e,"POST",this.encode(t));return this.decode(n)})}encode(e){return A(e).buffer}decode(e){return d.m.Response.create(O(this.ctx,e))}get headers(){return Object.assign({Accept:this.mime,"Content-Type":this.mime},this.option.httpHeaders)}get mime(){return"application/x-protobuf"}get dataType(){return"arraybuffer"}get method(){return"POST"}}class e_ extends ex{constructor(e){super(e),this.instance=ey().create({timeout:this.option.timeout,withCredentials:!!this.option.withCredentials,headers:this.headers,responseType:this.dataType,method:this.method})}send(e,t,n){return(0,a.mG)(this,void 0,void 0,function*(){return(yield this.instance.request({url:e,data:n,method:t})).data})}sendByBeacon(e,t){return void 0!==navigator.sendBeacon&&navigator.sendBeacon(e,t)}}function eb(e){let t=[];for(let n of Object.keys(e))void 0!==e[n]&&""!==e[n]&&t.push(`${n}=${e[n]}`);return t.join("&")}class eI extends p.mA{constructor(e){super(e),this.openTime=0,this.createTime=0,this.option=e.option,this.url=this.option.frontierUrl,this.onClose=new m(e),this.onOpen=new m(e),this.onError=new m(e),this.onMessage=new m(e),this.onOpen.subscribe(()=>{var e;this.openTime=N.u.performanceNow(),this.resolve(p.Uk.Monitor).emitMetrics(N.U.FrontierOpen,{duration:this.openTime-this.createTime},{url:null!==(e=this.url)&&void 0!==e?e:"unknown"})}),this.onClose.subscribe(e=>{var t,n,i,r;"undefined"!=typeof CloseEvent&&e instanceof CloseEvent?this.resolve(p.Uk.Monitor).emitMetrics(N.U.FrontierClose,{count:1},{url:null!==(t=this.url)&&void 0!==t?t:"unknown",code:null===(n=e.code)||void 0===n?void 0:n.toString(),reason:e.reason}):this.resolve(p.Uk.Monitor).emitMetrics(N.U.FrontierClose,{count:1},{url:null!==(i=this.url)&&void 0!==i?i:"unknown"}),0!==this.openTime&&!Number.isNaN(this.openTime)&&this.resolve(p.Uk.Monitor).emitMetrics(N.U.FrontierLive,{duration:N.u.performanceNow()-this.openTime},{url:null!==(r=this.url)&&void 0!==r?r:"unknown"}),this.openTime=0}),this.onMessage.subscribe(e=>{var t;if("hi"!==e.toString())this.resolve(p.Uk.Monitor).emitMetrics(N.U.FrontierReceive,{count:1},{url:null!==(t=this.url)&&void 0!==t?t:"unknown"})}),this.onError.subscribe(()=>{var e;this.resolve(p.Uk.Monitor).emitMetrics(N.U.FrontierError,{count:1},{url:null!==(e=this.url)&&void 0!==e?e:"unknown"})})}get paramUrl(){let{headers:e,authType:t,cert:n,tsSign:i}=this.option,r={};(null==e?void 0:e[u.HF.envKey])!==void 0&&(r[u.HF.envKey]=e[u.HF.envKey]),(null==e?void 0:e[u.HF.boeHeaderKey])!==void 0&&(r[u.HF.boeHeaderKey]=e[u.HF.boeHeaderKey]),(null==e?void 0:e[u.HF.ppeHeaderKey])!==void 0&&(r[u.HF.ppeHeaderKey]=e[u.HF.ppeHeaderKey]);let o=Object.assign(Object.assign({token:this.option.disableWsUrlToken?"":this.ctx.cachedToken,sid:this.option.sessionId,aid:this.option.appId,fpid:this.option.fpId,device_id:this.option.deviceId,access_key:S()(`${this.option.fpId+this.option.appKey+this.option.deviceId}f8a69f1719916z`),device_platform:this.option.devicePlatform,version_code:this.option.versionCode},this.option.extended),r);return d.m.AuthType.CERT_AUTH===t&&(o.sdk_cert=encodeURIComponent(null!=n?n:""),o.ts_sign=encodeURIComponent(null!=i?i:"")),`${this.url}?${eb(o)}`}performOpen(){let e=!1;this.createTime=N.u.performanceNow();let t=new Promise((t,n)=>{setTimeout(()=>{if(!e)n(new f.G({ctx:this.ctx,msg:"frontier connect timeout",type:u.NI.NetworkError,sender:this}))},this.ctx.option.timeout)});return Promise.race([t,(()=>(0,a.mG)(this,void 0,void 0,function*(){try{yield this.open()}catch(e){throw new f.G({ctx:this.ctx,msg:"ws connect error",innerError:e,sender:this,type:u.NI.NetworkError})}finally{e=!0}}))()])}dispose(){this.onOpen.unsubscribeAll(),this.onClose.unsubscribeAll(),this.onError.unsubscribeAll(),this.onMessage.unsubscribeAll()}}class eC extends eI{registerEvents(){this.ws.onclose=e=>{this.onClose.next(e,this)},this.ws.onopen=()=>{this.onOpen.nextEmpty(this)},this.ws.onmessage=e=>{this.onMessage.next(e.data,this)},this.ws.onerror=e=>{this.onError.next(e,this)}}open(){let e,t;if(this.isOpen())return l.Y.ctxWarn(this.ctx,"ws already open, close first"),Promise.resolve(!0);this.ws=new WebSocket(this.paramUrl,u.HF.wsProtocols),this.ws.binaryType="arraybuffer",this.registerEvents();let n=this.onOpen.subscribe(()=>{e(!0),this.onOpen.unsubscribe(n)}),i=this.onError.subscribe(e=>{t(e),this.onError.unsubscribe(i)});return new Promise((n,i)=>{e=n,t=i})}close(){this.ws&&(this.ws.onmessage=null,this.ws.close()),this.ws=void 0}send(e){this.ws.send(e)}isOpen(){return void 0!==this.ws&&this.ws.readyState===WebSocket.OPEN}}var eM=n("255436");!function(e){e[e.Stopped=0]="Stopped",e[e.Running=1]="Running"}(s||(s={}));class ek extends p.mA{constructor(e,t,n){return super(e),this.state=s.Stopped,this.refreshRate=0,this.doneDuration=0,this.refreshRate=t,this.doneDuration=n,this.onTick=new m(this.ctx),this.onDone=new m(this.ctx),this.onStop=new m(this.ctx),this}get duration(){return this.state===s.Stopped&&0!==this.lastStopTime?this.lastStopTime-this.startTime:this.state===s.Running?Date.now()-this.startTime:0}start(){this.state!==s.Running&&this.restart()}getTickTimer(){return this.tickTimer}update(){this.onTick.nextEmpty(this)}done(){this.stop(),this.onDone.nextEmpty()}}let{setIntervalWarp:eS,clearIntervalWarp:eT,setTimeoutWarp:ew,clearTimeoutWarp:eE}=eM.Z;class eR extends ek{restart(){this.tickTimer&&this.stop(),this.state=s.Running;let{enableHackTimer:e}=this.ctx.option,t=e?eS:setInterval,n=e?ew:setTimeout;this.tickTimer=t(()=>{this.update()},this.refreshRate),void 0!==this.doneDuration&&(this.doneTimer=n(()=>{this.done()},this.doneDuration)),this.startTime=Date.now(),this.lastStopTime=0,this.update()}stop(){if(this.state===s.Stopped)return;let{enableHackTimer:e}=this.ctx.option,t=e?eT:clearInterval,n=e?eE:clearTimeout;t(this.tickTimer),n(this.doneTimer),this.state=s.Stopped,this.lastStopTime=Date.now(),this.onStop.nextEmpty()}}let eU=e=>new eg(e),eA=e=>new e_(e),eO=e=>new eC(e);class eP extends ep{initPlatformOptions(e){e.network=e.network||eU,e.http=e.http||eA,e.webSocket=e.webSocket||eO,e.sdkType=e.sdkType||"im-web-sdk"}createTicker(e,t,n){return new eR(e,t,n)}}},872931:function(e,t,n){"use strict";n.d(t,{x:function(){return a}});var i=n(954090),r=n(711061),o=n(125415),s=n(720709);class a extends r.v{constructor(){super(...arguments),this.decrypt=null}install(){try{let e=window.useWebSecsdkApi("imDecrypt");if(e)this.decrypt=e,o.Y.ctxDebug(this.ctx,"content decrypt function:",e);else throw Error("No decrypt function")}catch(e){o.Y.ctxWarn(this.ctx,"get content decrypt function error:",e)}}sendPacket(e){return(0,i.mG)(this,void 0,void 0,function*(){return this.decrypt&&(e.pdes_version=1),e})}decryptMessage(e,t){var n;return(0,i.mG)(this,void 0,void 0,function*(){if(!!e&&!!this.decrypt)try{e.content&&(e.content=yield this.decrypt(e.content,t,"uid",this.ctx.option.userId))}catch(t){o.Y.ctxWarn(this.ctx,`decrypt msg ${null===(n=e.server_message_id)||void 0===n?void 0:n.toString()} error:`,t)}})}decryptMessages(e,t){return(0,i.mG)(this,void 0,void 0,function*(){if(!!e)yield Promise.all(e.map(e=>this.decryptMessage(e,t)))})}receiveApiResponse(e){var t,n,r,o,a,c,d,u,l,v,h,f,p,g,m,y,x,_,b,I,C,M,k,S,T;return(0,i.mG)(this,void 0,void 0,function*(){if(!this.decrypt)return;let i=e.pdes_key;if(i){let w=[];switch(e.cmd){case s.m.IMCMD.GET_MESSAGES_BY_USER:{let i=null===(n=null===(t=e.body)||void 0===t?void 0:t.messages_per_user_body)||void 0===n?void 0:n.messages;i&&w.push(...i);break}case s.m.IMCMD.GET_MESSAGES_BY_USER_INIT_V2:{let t=null===(o=null===(r=e.body)||void 0===r?void 0:r.messages_per_user_init_v2_body)||void 0===o?void 0:o.messages;t&&w.push(...t);break}case s.m.IMCMD.GET_MESSAGE_INFO_BY_SERVER_ID:{let t=null===(d=null===(c=null===(a=e.body)||void 0===a?void 0:a.get_message_by_id_body)||void 0===c?void 0:c.msg_info)||void 0===d?void 0:d.body;t&&w.push(t);break}case s.m.IMCMD.GET_MESSAGES_BY_CONVERSATION:{let t=null===(l=null===(u=e.body)||void 0===u?void 0:u.messages_in_conversation_body)||void 0===l?void 0:l.messages;t&&w.push(...t);break}case s.m.IMCMD.GET_STRANGER_CONVERSATION_LIST:case s.m.IMCMD.GET_STRANGER_MESSAGES_IN_CONVERSATION:{let t=null===(h=null===(v=e.body)||void 0===v?void 0:v.get_stranger_messages_body)||void 0===h?void 0:h.messages;t&&w.push(...t),null===(g=null===(p=null===(f=e.body)||void 0===f?void 0:f.get_stranger_conversation_body)||void 0===p?void 0:p.conversation_list)||void 0===g||g.forEach(e=>e.last_message&&w.push(e.last_message));break}case s.m.IMCMD.GET_MESSAGE_BY_INIT:null===(x=null===(y=null===(m=e.body)||void 0===m?void 0:m.message_by_init)||void 0===y?void 0:y.messages)||void 0===x||x.forEach(e=>e.messages&&w.push(...e.messages));break;case s.m.IMCMD.GET_USER_MESSAGE:null===(C=null===(I=null===(b=null===(_=e.body)||void 0===_?void 0:_.get_user_message)||void 0===b?void 0:b.messages)||void 0===I?void 0:I.messages)||void 0===C||C.forEach(e=>e.messages&&w.push(...e.messages)),null===(T=null===(S=null===(k=null===(M=e.body)||void 0===M?void 0:M.get_user_message)||void 0===k?void 0:k.messages)||void 0===S?void 0:S.messages)||void 0===T||T.forEach(e=>e.ext_messages&&w.push(...e.ext_messages))}yield this.decryptMessages(w,i)}})}}},977187:function(e,t,n){"use strict";n.d(t,{f:function(){return f}});var i=n("954090"),r=n("361073"),o=n("720709"),s=n("711061"),a=n("694253"),c=n("125415");class d extends a.mA{}var u=n("291402"),l=n("763218");class v extends d{constructor(e){super(e)}init(){let{appId:e,securityStoreType:t="local",securitySignVersion:n,securityCertType:i="request",securityScene:r=""}=this.ctx.option;this.ctx.option.authType===o.m.AuthType.CERT_AUTH?(this.sdk=(0,u.P)(),this.sdk.setDisableCrossStorage(!0),this.sdk.setNamespace("token")):this.sdk=l.SecureSDK,this.sdk.setStorageType(t),this.sdk.setConfig({aid:e,scene:r,certType:i,signVersion:n}),this.sdk.start(),this.securityCertType=i,this.securityScene=r}sign(e){return(0,i.mG)(this,void 0,void 0,function*(){let t=yield this.sdk.cryptoSDK.sign({sign_data:e,certType:this.securityCertType,scene:this.securityScene});return JSON.parse(this.sdk.convertBase64ToString(t))})}getCert(){return(0,i.mG)(this,void 0,void 0,function*(){return this.sdk.cryptoSDK.getCertificate({certType:this.securityCertType,scene:this.securityScene})})}getTsSign(){return(0,i.mG)(this,void 0,void 0,function*(){return this.sdk.cryptoSDK.getTSSign({certType:this.securityCertType,scene:this.securityScene})})}getTicket(){return(0,i.mG)(this,void 0,void 0,function*(){return this.sdk.cryptoSDK.getTicket({certType:this.securityCertType,scene:this.securityScene})})}setSignValue(e){return(0,i.mG)(this,void 0,void 0,function*(){this.sdk.cryptoSDK.setSignValue({sign:e,scene:this.securityScene})})}getCertSignRequest(){return(0,i.mG)(this,void 0,void 0,function*(){return this.sdk.cryptoSDK.getCertSignRequest()})}getPubKey(){return(0,i.mG)(this,void 0,void 0,function*(){return this.sdk.cryptoSDK.getPubKey()})}}let h=new Map([[o.m.IMCMD.SEND_MESSAGE,["send_message_body","content","conversation_id","conversation_short_id"]],[o.m.IMCMD.CREATE_CONVERSATION_V2,["create_conversation_v2_body","avatar_url","idempotent_id","name","participants"]],[o.m.IMCMD.ADD_CONVERSATION_PARTICIPANTS,["conversation_add_participants_body","conversation_id","conversation_short_id","participants"]]]);class f extends s.v{install(){this.isCertAuth&&this.register(a.Uk.SecurityProxy,new v(this.ctx))}sendPacket(e){return(0,i.mG)(this,void 0,void 0,function*(){if(this.isCertAuth){let{cert:t,tsSign:n}=this.ctx.option;e.sdk_cert=t||"",e.ts_sign=n||"";let i=Math.round(Date.now()/1e3);if(this.ctx.option.certAuthZeroTrustUsePubKey&&(e.iter_version="1",e.timestamp=r.fromValue(i)),h.has(e.cmd)){let t=h.get(e.cmd),n=t[0],o=[...t.slice(1),...this.ctx.option.certAuthZeroTrustUsePubKey?["timestamp"]:[]];o.sort();let s=[];o.forEach(t=>{var o,a;if("timestamp"===t)return s.push(`timestamp=${i}`);let c=null===(o=e.body)||void 0===o?void 0:o[n],d=null!==(a=null==c?void 0:c[t])&&void 0!==a?a:"",u=Array.isArray(d)?d.map(String).join(","):r.isLong(d)?String(d):d;s.push(`${t}=${u}`)});try{let{req_sign:t}=yield this.resolve(a.Uk.SecurityProxy).sign(s.join("&"));e.reuqest_sign=t}catch(e){c.Y.ctxWarn(this.ctx,"request sign fail",e)}}}return e})}get isCertAuth(){return this.ctx.option.authType&&[o.m.AuthType.CERT_AUTH,o.m.AuthType.PASSPORT_CERT_AUTH].includes(this.ctx.option.authType)}}},297738:function(e){!function(t,n){e.exports=n()}(0,function(){"use strict";var e,t,n=1e3,i=6e4,r=36e5,o=864e5,s=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,a=31536e6,c=2628e6,d=/^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/,u={years:31536e6,months:2628e6,days:864e5,hours:36e5,minutes:6e4,seconds:1e3,milliseconds:1,weeks:6048e5},l=function(e){return e instanceof y},v=function(e,t,n){return new y(e,n,t.$l)},h=function(e){return t.p(e)+"s"},f=function(e){return e<0},p=function(e){return f(e)?Math.ceil(e):Math.floor(e)},g=function(e){return Math.abs(e)},m=function(e,t){return e?f(e)?{negative:!0,format:""+g(e)+t}:{negative:!1,format:""+e+t}:{negative:!1,format:""}},y=function(){function f(e,t,n){var i=this;if(this.$d={},this.$l=n,void 0===e&&(this.$ms=0,this.parseFromMilliseconds()),t)return v(e*u[h(t)],this);if("number"==typeof e)return this.$ms=e,this.parseFromMilliseconds(),this;if("object"==typeof e)return Object.keys(e).forEach(function(t){i.$d[h(t)]=e[t]}),this.calMilliseconds(),this;if("string"==typeof e){var r=e.match(d);if(r){var o=r.slice(2).map(function(e){return null!=e?Number(e):0});return this.$d.years=o[0],this.$d.months=o[1],this.$d.weeks=o[2],this.$d.days=o[3],this.$d.hours=o[4],this.$d.minutes=o[5],this.$d.seconds=o[6],this.calMilliseconds(),this}}return this}var g=f.prototype;return g.calMilliseconds=function(){var e=this;this.$ms=Object.keys(this.$d).reduce(function(t,n){return t+(e.$d[n]||0)*u[n]},0)},g.parseFromMilliseconds=function(){var e=this.$ms;this.$d.years=p(e/a),e%=a,this.$d.months=p(e/c),e%=c,this.$d.days=p(e/o),e%=o,this.$d.hours=p(e/r),e%=r,this.$d.minutes=p(e/i),e%=i,this.$d.seconds=p(e/n),e%=n,this.$d.milliseconds=e},g.toISOString=function(){var e=m(this.$d.years,"Y"),t=m(this.$d.months,"M"),n=+this.$d.days||0;this.$d.weeks&&(n+=7*this.$d.weeks);var i=m(n,"D"),r=m(this.$d.hours,"H"),o=m(this.$d.minutes,"M"),s=this.$d.seconds||0;this.$d.milliseconds&&(s+=this.$d.milliseconds/1e3,s=Math.round(1e3*s)/1e3);var a=m(s,"S"),c=e.negative||t.negative||i.negative||r.negative||o.negative||a.negative,d=r.format||o.format||a.format?"T":"",u=(c?"-":"")+"P"+e.format+t.format+i.format+d+r.format+o.format+a.format;return"P"===u||"-P"===u?"P0D":u},g.toJSON=function(){return this.toISOString()},g.format=function(e){var n=e||"YYYY-MM-DDTHH:mm:ss",i={Y:this.$d.years,YY:t.s(this.$d.years,2,"0"),YYYY:t.s(this.$d.years,4,"0"),M:this.$d.months,MM:t.s(this.$d.months,2,"0"),D:this.$d.days,DD:t.s(this.$d.days,2,"0"),H:this.$d.hours,HH:t.s(this.$d.hours,2,"0"),m:this.$d.minutes,mm:t.s(this.$d.minutes,2,"0"),s:this.$d.seconds,ss:t.s(this.$d.seconds,2,"0"),SSS:t.s(this.$d.milliseconds,3,"0")};return n.replace(s,function(e,t){return t||String(i[e])})},g.as=function(e){return this.$ms/u[h(e)]},g.get=function(e){var t=this.$ms,n=h(e);return"milliseconds"===n?t%=1e3:t="weeks"===n?p(t/u[n]):this.$d[n],t||0},g.add=function(e,t,n){var i;return i=t?e*u[h(t)]:l(e)?e.$ms:v(e,this).$ms,v(this.$ms+i*(n?-1:1),this)},g.subtract=function(e,t){return this.add(e,t,!0)},g.locale=function(e){var t=this.clone();return t.$l=e,t},g.clone=function(){return v(this.$ms,this)},g.humanize=function(t){return e().add(this.$ms,"ms").locale(this.$l).fromNow(!t)},g.valueOf=function(){return this.asMilliseconds()},g.milliseconds=function(){return this.get("milliseconds")},g.asMilliseconds=function(){return this.as("milliseconds")},g.seconds=function(){return this.get("seconds")},g.asSeconds=function(){return this.as("seconds")},g.minutes=function(){return this.get("minutes")},g.asMinutes=function(){return this.as("minutes")},g.hours=function(){return this.get("hours")},g.asHours=function(){return this.as("hours")},g.days=function(){return this.get("days")},g.asDays=function(){return this.as("days")},g.weeks=function(){return this.get("weeks")},g.asWeeks=function(){return this.as("weeks")},g.months=function(){return this.get("months")},g.asMonths=function(){return this.as("months")},g.years=function(){return this.get("years")},g.asYears=function(){return this.as("years")},f}(),x=function(e,t,n){return e.add(t.years()*n,"y").add(t.months()*n,"M").add(t.days()*n,"d").add(t.hours()*n,"h").add(t.minutes()*n,"m").add(t.seconds()*n,"s").add(t.milliseconds()*n,"ms")};return function(n,i,r){e=r,t=r().$utils(),r.duration=function(e,t){return v(e,{$l:r.locale()},t)},r.isDuration=l;var o=i.prototype.add,s=i.prototype.subtract;i.prototype.add=function(e,t){return l(e)?x(this,e,1):o.bind(this)(e,t)},i.prototype.subtract=function(e,t){return l(e)?x(this,e,-1):s.bind(this)(e,t)}}})},232149:function(e){!function(t,n){e.exports=n()}(0,function(){return function(e,t,n){t.prototype.isYesterday=function(){var e="YYYY-MM-DD",t=n().subtract(1,"day");return this.format(e)===t.format(e)}}})},93849:function(e){!function(t,n){e.exports=n()}(0,function(){"use strict";var e="day";return function(t,n,i){var r=function(t){return t.add(4-t.isoWeekday(),e)},o=n.prototype;o.isoWeekYear=function(){return r(this).year()},o.isoWeek=function(t){if(!this.$utils().u(t))return this.add(7*(t-this.isoWeek()),e);var n,o,s,a=r(this),c=(n=this.isoWeekYear(),s=4-(o=(this.$u?i.utc:i)().year(n).startOf("year")).isoWeekday(),o.isoWeekday()>4&&(s+=7),o.add(s,e));return a.diff(c,"week")+1},o.isoWeekday=function(e){return this.$utils().u(e)?this.day()||7:this.day(this.day()%7?e:e-7)};var s=o.startOf;o.startOf=function(e,t){var n=this.$utils(),i=!!n.u(t)||t;return"isoweek"===n.p(e)?i?this.date(this.date()-(this.isoWeekday()-1)).startOf("day"):this.date(this.date()-1-(this.isoWeekday()-1)+7).endOf("day"):s.bind(this)(e,t)}}})},64105:function(e,t){!function(e,n){n(t)}(0,function(e){"use strict";var t=Object.keys;function n(e,t){return e===t||e!=e&&t!=t}function i(e){return e.constructor===Object||null==e.constructor}function r(e){return!!e&&"function"==typeof e.then}function o(e){return!!(e&&e.$$typeof)}function s(){var e=[];return{delete:function(t){for(var n=0;n<e.length;++n)if(e[n][0]===t){e.splice(n,1);return}},get:function(t){for(var n=0;n<e.length;++n)if(e[n][0]===t)return e[n][1]},set:function(t,n){for(var i=0;i<e.length;++i)if(e[i][0]===t){e[i][1]=n;return}e.push([t,n])}}}var a=function(e){return e?function(){return new WeakMap}:s}("function"==typeof WeakMap);function c(e){return function(t){var n=e||t;return function(e,t,i,r,o,s,c){void 0===c&&(c=a());var d=!!e&&"object"==typeof e,u=!!t&&"object"==typeof t;if(d!==u)return!1;if(!d&&!u)return n(e,t,c);var l=c.get(e);if(l&&c.get(t))return l===t;c.set(e,t),c.set(t,e);var v=n(e,t,c);return c.delete(e),c.delete(t),v}}}function d(e,t,n,i){var r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n(e[r],t[r],r,r,e,t,i))return!1;return!0}function u(e,t,n,i){var r=e.size===t.size;if(r&&e.size){var o={},s=0;e.forEach(function(a,c){if(r){var d=!1,u=0;t.forEach(function(r,l){!d&&!o[u]&&(d=n(c,l,s,u,e,t,i)&&n(a,r,c,l,e,t,i))&&(o[u]=!0),u++}),s++,r=d}})}return r}var l="_owner",v=Function.prototype.bind.call(Function.prototype.call,Object.prototype.hasOwnProperty);function h(e,n,i,r){var s=t(e),a=s.length;if(t(n).length!==a)return!1;if(a){for(var c=void 0;a-- >0;){if((c=s[a])===l){var d=o(e),u=o(n);if((d||u)&&d!==u)return!1}if(!v(n,c)||!i(e[c],n[c],c,c,e,n,r))return!1}}return!0}var f=function(){return"g"===/foo/g.flags?function(e,t){return e.source===t.source&&e.flags===t.flags}:function(e,t){return e.source===t.source&&e.global===t.global&&e.ignoreCase===t.ignoreCase&&e.multiline===t.multiline&&e.unicode===t.unicode&&e.sticky===t.sticky&&e.lastIndex===t.lastIndex}}();function p(e,t,n,i){var r=e.size===t.size;if(r&&e.size){var o={};e.forEach(function(s,a){if(r){var c=!1,d=0;t.forEach(function(r,u){!c&&!o[d]&&(c=n(s,r,a,u,e,t,i))&&(o[d]=!0),d++}),r=c}})}return r}var g="function"==typeof Map,m="function"==typeof Set,y=Object.prototype.valueOf;function x(e){var t="function"==typeof e?e(o):function(e,t,n,i,r,s,a){return o(e,t,a)};function o(e,o,s){if(e===o)return!0;if(e&&o&&"object"==typeof e&&"object"==typeof o){if(i(e)&&i(o))return h(e,o,t,s);var a=Array.isArray(e),c=Array.isArray(o);return a||c?a===c&&d(e,o,t,s):(a=e instanceof Date,c=o instanceof Date,a||c)?a===c&&n(e.getTime(),o.getTime()):(a=e instanceof RegExp,c=o instanceof RegExp,a||c)?a===c&&f(e,o):r(e)||r(o)?e===o:g&&(a=e instanceof Map,c=o instanceof Map,a||c)?a===c&&u(e,o,t,s):m&&(a=e instanceof Set,c=o instanceof Set,a||c)?a===c&&p(e,o,t,s):e.valueOf!==y||o.valueOf!==y?n(e.valueOf(),o.valueOf()):h(e,o,t,s)}return e!=e&&o!=o}return o}var _=x(),b=x(function(){return n}),I=x(c()),C=x(c(n));e.circularDeepEqual=I,e.circularShallowEqual=C,e.createCustomEqual=x,e.deepEqual=_,e.sameValueZeroEqual=n,e.shallowEqual=b,Object.defineProperty(e,"__esModule",{value:!0})})},642440:function(e,t,n){"use strict";var i=n(630272);function r(e){return e.replace(/[\^\$\.\*\+\-\?\=\!\:\|\\\/\(\)\[\]\{\}\,]/g,"\\$&")}var o={Uri:{createUriRegex:function(e){if("object"!=typeof(e=e||{})||Array.isArray(e))throw Error("options must be an object");var t="";if(e.scheme){if(!Array.isArray(e.scheme)&&(e.scheme=[e.scheme]),e.scheme.length<=0)throw Error("scheme must have at least 1 scheme specified");for(var n=0;n<e.scheme.length;++n){var o=e.scheme[n];if(!(o instanceof RegExp||"string"==typeof o))throw Error("scheme must only contain Regular Expressions or Strings");if(t+=t?"|":"",o instanceof RegExp)t+=o.source;else{if(!/[a-zA-Z][a-zA-Z0-9+-\.]*/.test(o))throw Error("scheme at position "+n+" must be a valid scheme");t+=r(o)}}}return RegExp("^(?:"+("(?:"+(t||i.scheme)+")")+":"+i.hierPart+")(?:\\?"+i.query+")?(?:#"+i.fragment+")?$")},uriRegex:new RegExp(i.uri)}};o.Uri.isValid=function(e){return o.Uri.uriRegex.test(e)},e.exports={createUriRegex:o.Uri.createUriRegex,uriRegex:o.Uri.uriRegex,isValid:o.Uri.isValid}},808244:function(module,__unused_webpack_exports,__webpack_require__){var process=__webpack_require__(777296);!function(){"use strict";var ERROR="input is invalid type",WINDOW="object"==typeof window,root=WINDOW?window:{};root.JS_MD5_NO_WINDOW&&(WINDOW=!1);var WEB_WORKER=!WINDOW&&"object"==typeof self,NODE_JS=!root.JS_MD5_NO_NODE_JS&&"object"==typeof process&&process.versions&&process.versions.node;NODE_JS?root=window:WEB_WORKER&&(root=self);var COMMON_JS=!root.JS_MD5_NO_COMMON_JS&&module.exports,AMD="function"==typeof define&&define.amd,ARRAY_BUFFER=!root.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,HEX_CHARS="0123456789abcdef".split(""),EXTRA=[128,32768,8388608,-2147483648],SHIFT=[0,8,16,24],OUTPUT_TYPES=["hex","array","digest","buffer","arrayBuffer","base64"],BASE64_ENCODE_CHAR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),buffer8,blocks=[];if(ARRAY_BUFFER){var buffer=new ArrayBuffer(68);buffer8=new Uint8Array(buffer),blocks=new Uint32Array(buffer)}(root.JS_MD5_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),ARRAY_BUFFER&&(root.JS_MD5_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var createOutputMethod=function(e){return function(t){return new Md5(!0).update(t)[e]()}},createMethod=function(){var e=createOutputMethod("hex");NODE_JS&&(e=nodeWrap(e)),e.create=function(){return new Md5},e.update=function(t){return e.create().update(t)};for(var t=0;t<OUTPUT_TYPES.length;++t){var n=OUTPUT_TYPES[t];e[n]=createOutputMethod(n)}return e},nodeWrap=function(method){var crypto=eval("require('crypto')"),Buffer=eval("require('buffer').Buffer"),nodeMethod=function(e){if("string"==typeof e)return crypto.createHash("md5").update(e,"utf8").digest("hex");if(null==e)throw ERROR;e.constructor===ArrayBuffer&&(e=new Uint8Array(e));return Array.isArray(e)||ArrayBuffer.isView(e)||e.constructor===Buffer?crypto.createHash("md5").update(new Buffer(e)).digest("hex"):method(e)};return nodeMethod};function Md5(e){if(e)blocks[0]=blocks[16]=blocks[1]=blocks[2]=blocks[3]=blocks[4]=blocks[5]=blocks[6]=blocks[7]=blocks[8]=blocks[9]=blocks[10]=blocks[11]=blocks[12]=blocks[13]=blocks[14]=blocks[15]=0,this.blocks=blocks,this.buffer8=buffer8;else if(ARRAY_BUFFER){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}Md5.prototype.update=function(e){if(!this.finalized){var t,n=typeof e;if("string"!==n){if("object"===n){if(null===e)throw ERROR;if(ARRAY_BUFFER&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!ARRAY_BUFFER||!ArrayBuffer.isView(e)))throw ERROR}else throw ERROR;t=!0}for(var i,r,o=0,s=e.length,a=this.blocks,c=this.buffer8;o<s;){if(this.hashed&&(this.hashed=!1,a[0]=a[16],a[16]=a[1]=a[2]=a[3]=a[4]=a[5]=a[6]=a[7]=a[8]=a[9]=a[10]=a[11]=a[12]=a[13]=a[14]=a[15]=0),t){if(ARRAY_BUFFER)for(r=this.start;o<s&&r<64;++o)c[r++]=e[o];else for(r=this.start;o<s&&r<64;++o)a[r>>2]|=e[o]<<SHIFT[3&r++]}else if(ARRAY_BUFFER)for(r=this.start;o<s&&r<64;++o)(i=e.charCodeAt(o))<128?c[r++]=i:(i<2048?c[r++]=192|i>>6:(i<55296||i>=57344?c[r++]=224|i>>12:(i=65536+((1023&i)<<10|1023&e.charCodeAt(++o)),c[r++]=240|i>>18,c[r++]=128|i>>12&63),c[r++]=128|i>>6&63),c[r++]=128|63&i);else for(r=this.start;o<s&&r<64;++o)(i=e.charCodeAt(o))<128?a[r>>2]|=i<<SHIFT[3&r++]:(i<2048?a[r>>2]|=(192|i>>6)<<SHIFT[3&r++]:(i<55296||i>=57344?a[r>>2]|=(224|i>>12)<<SHIFT[3&r++]:(i=65536+((1023&i)<<10|1023&e.charCodeAt(++o)),a[r>>2]|=(240|i>>18)<<SHIFT[3&r++],a[r>>2]|=(128|i>>12&63)<<SHIFT[3&r++]),a[r>>2]|=(128|i>>6&63)<<SHIFT[3&r++]),a[r>>2]|=(128|63&i)<<SHIFT[3&r++]);this.lastByteIndex=r,this.bytes+=r-this.start,r>=64?(this.start=r-64,this.hash(),this.hashed=!0):this.start=r}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},Md5.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[t>>2]|=EXTRA[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()}},Md5.prototype.hash=function(){var e,t,n,i,r,o,s=this.blocks;this.first?(n=((n=(-271733879^(i=((i=(-1732584194^2004318071&(e=((e=s[0]-680876937)<<7|e>>>25)-271733879<<0))+s[1]-117830708)<<12|i>>>20)+e<<0)&(-271733879^e))+s[2]-1126478375)<<17|n>>>15)+i<<0,t=((t=(e^n&(i^e))+s[3]-1316259209)<<22|t>>>10)+n<<0):(e=this.h0,t=this.h1,n=this.h2,e+=((i=this.h3)^t&(n^i))+s[0]-680876936,i+=(n^(e=(e<<7|e>>>25)+t<<0)&(t^n))+s[1]-389564586,n+=(t^(i=(i<<12|i>>>20)+e<<0)&(e^t))+s[2]+606105819,t+=(e^(n=(n<<17|n>>>15)+i<<0)&(i^e))+s[3]-1044525330,t=(t<<22|t>>>10)+n<<0),e+=(i^t&(n^i))+s[4]-176418897,i+=(n^(e=(e<<7|e>>>25)+t<<0)&(t^n))+s[5]+1200080426,n+=(t^(i=(i<<12|i>>>20)+e<<0)&(e^t))+s[6]-1473231341,t+=(e^(n=(n<<17|n>>>15)+i<<0)&(i^e))+s[7]-45705983,e+=(i^(t=(t<<22|t>>>10)+n<<0)&(n^i))+s[8]+1770035416,i+=(n^(e=(e<<7|e>>>25)+t<<0)&(t^n))+s[9]-1958414417,n+=(t^(i=(i<<12|i>>>20)+e<<0)&(e^t))+s[10]-42063,t+=(e^(n=(n<<17|n>>>15)+i<<0)&(i^e))+s[11]-1990404162,e+=(i^(t=(t<<22|t>>>10)+n<<0)&(n^i))+s[12]+1804603682,i+=(n^(e=(e<<7|e>>>25)+t<<0)&(t^n))+s[13]-40341101,n+=(t^(i=(i<<12|i>>>20)+e<<0)&(e^t))+s[14]-1502002290,t+=(e^(n=(n<<17|n>>>15)+i<<0)&(i^e))+s[15]+1236535329,t=(t<<22|t>>>10)+n<<0,e+=(n^i&(t^n))+s[1]-165796510,e=(e<<5|e>>>27)+t<<0,i+=(t^n&(e^t))+s[6]-1069501632,i=(i<<9|i>>>23)+e<<0,n+=(e^t&(i^e))+s[11]+643717713,n=(n<<14|n>>>18)+i<<0,t+=(i^e&(n^i))+s[0]-373897302,t=(t<<20|t>>>12)+n<<0,e+=(n^i&(t^n))+s[5]-701558691,e=(e<<5|e>>>27)+t<<0,i+=(t^n&(e^t))+s[10]+38016083,i=(i<<9|i>>>23)+e<<0,n+=(e^t&(i^e))+s[15]-660478335,n=(n<<14|n>>>18)+i<<0,t+=(i^e&(n^i))+s[4]-405537848,t=(t<<20|t>>>12)+n<<0,e+=(n^i&(t^n))+s[9]+568446438,e=(e<<5|e>>>27)+t<<0,i+=(t^n&(e^t))+s[14]-1019803690,i=(i<<9|i>>>23)+e<<0,n+=(e^t&(i^e))+s[3]-187363961,n=(n<<14|n>>>18)+i<<0,t+=(i^e&(n^i))+s[8]+1163531501,t=(t<<20|t>>>12)+n<<0,e+=(n^i&(t^n))+s[13]-1444681467,e=(e<<5|e>>>27)+t<<0,i+=(t^n&(e^t))+s[2]-51403784,i=(i<<9|i>>>23)+e<<0,n+=(e^t&(i^e))+s[7]+1735328473,n=(n<<14|n>>>18)+i<<0,t+=(i^e&(n^i))+s[12]-1926607734,e+=((r=(t=(t<<20|t>>>12)+n<<0)^n)^i)+s[5]-378558,i+=(r^(e=(e<<4|e>>>28)+t<<0))+s[8]-2022574463,n+=((o=(i=(i<<11|i>>>21)+e<<0)^e)^t)+s[11]+1839030562,t+=(o^(n=(n<<16|n>>>16)+i<<0))+s[14]-35309556,e+=((r=(t=(t<<23|t>>>9)+n<<0)^n)^i)+s[1]-1530992060,i+=(r^(e=(e<<4|e>>>28)+t<<0))+s[4]+1272893353,n+=((o=(i=(i<<11|i>>>21)+e<<0)^e)^t)+s[7]-155497632,t+=(o^(n=(n<<16|n>>>16)+i<<0))+s[10]-1094730640,e+=((r=(t=(t<<23|t>>>9)+n<<0)^n)^i)+s[13]+681279174,i+=(r^(e=(e<<4|e>>>28)+t<<0))+s[0]-358537222,n+=((o=(i=(i<<11|i>>>21)+e<<0)^e)^t)+s[3]-722521979,t+=(o^(n=(n<<16|n>>>16)+i<<0))+s[6]+76029189,e+=((r=(t=(t<<23|t>>>9)+n<<0)^n)^i)+s[9]-640364487,i+=(r^(e=(e<<4|e>>>28)+t<<0))+s[12]-421815835,n+=((o=(i=(i<<11|i>>>21)+e<<0)^e)^t)+s[15]+530742520,t+=(o^(n=(n<<16|n>>>16)+i<<0))+s[2]-995338651,t=(t<<23|t>>>9)+n<<0,e+=(n^(t|~i))+s[0]-198630844,e=(e<<6|e>>>26)+t<<0,i+=(t^(e|~n))+s[7]+1126891415,i=(i<<10|i>>>22)+e<<0,n+=(e^(i|~t))+s[14]-1416354905,n=(n<<15|n>>>17)+i<<0,t+=(i^(n|~e))+s[5]-57434055,t=(t<<21|t>>>11)+n<<0,e+=(n^(t|~i))+s[12]+1700485571,e=(e<<6|e>>>26)+t<<0,i+=(t^(e|~n))+s[3]-1894986606,i=(i<<10|i>>>22)+e<<0,n+=(e^(i|~t))+s[10]-1051523,n=(n<<15|n>>>17)+i<<0,t+=(i^(n|~e))+s[1]-2054922799,t=(t<<21|t>>>11)+n<<0,e+=(n^(t|~i))+s[8]+1873313359,e=(e<<6|e>>>26)+t<<0,i+=(t^(e|~n))+s[15]-30611744,i=(i<<10|i>>>22)+e<<0,n+=(e^(i|~t))+s[6]-1560198380,n=(n<<15|n>>>17)+i<<0,t+=(i^(n|~e))+s[13]+1309151649,t=(t<<21|t>>>11)+n<<0,e+=(n^(t|~i))+s[4]-145523070,e=(e<<6|e>>>26)+t<<0,i+=(t^(e|~n))+s[11]-1120210379,i=(i<<10|i>>>22)+e<<0,n+=(e^(i|~t))+s[2]+718787259,n=(n<<15|n>>>17)+i<<0,t+=(i^(n|~e))+s[9]-343485551,t=(t<<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)},Md5.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3;return HEX_CHARS[e>>4&15]+HEX_CHARS[15&e]+HEX_CHARS[e>>12&15]+HEX_CHARS[e>>8&15]+HEX_CHARS[e>>20&15]+HEX_CHARS[e>>16&15]+HEX_CHARS[e>>28&15]+HEX_CHARS[e>>24&15]+HEX_CHARS[t>>4&15]+HEX_CHARS[15&t]+HEX_CHARS[t>>12&15]+HEX_CHARS[t>>8&15]+HEX_CHARS[t>>20&15]+HEX_CHARS[t>>16&15]+HEX_CHARS[t>>28&15]+HEX_CHARS[t>>24&15]+HEX_CHARS[n>>4&15]+HEX_CHARS[15&n]+HEX_CHARS[n>>12&15]+HEX_CHARS[n>>8&15]+HEX_CHARS[n>>20&15]+HEX_CHARS[n>>16&15]+HEX_CHARS[n>>28&15]+HEX_CHARS[n>>24&15]+HEX_CHARS[i>>4&15]+HEX_CHARS[15&i]+HEX_CHARS[i>>12&15]+HEX_CHARS[i>>8&15]+HEX_CHARS[i>>20&15]+HEX_CHARS[i>>16&15]+HEX_CHARS[i>>28&15]+HEX_CHARS[i>>24&15]},Md5.prototype.toString=Md5.prototype.hex,Md5.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]},Md5.prototype.array=Md5.prototype.digest,Md5.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},Md5.prototype.buffer=Md5.prototype.arrayBuffer,Md5.prototype.base64=function(){for(var e,t,n,i="",r=this.array(),o=0;o<15;)e=r[o++],t=r[o++],n=r[o++],i+=BASE64_ENCODE_CHAR[e>>>2]+BASE64_ENCODE_CHAR[(e<<4|t>>>4)&63]+BASE64_ENCODE_CHAR[(t<<2|n>>>6)&63]+BASE64_ENCODE_CHAR[63&n];return i+=BASE64_ENCODE_CHAR[(e=r[o])>>>2]+BASE64_ENCODE_CHAR[e<<4&63]+"=="};var exports=createMethod();COMMON_JS?module.exports=exports:(root.md5=exports,AMD&&define(function(){return exports}))}()},164943:function(e,t,n){var i=n(777296);!function(){"use strict";var t="input is invalid type",r="object"==typeof window,o=r?window:{};o.JS_SHA256_NO_WINDOW&&(r=!1);var s=!r&&"object"==typeof self,a=!o.JS_SHA256_NO_NODE_JS&&"object"==typeof i&&i.versions&&i.versions.node;a?o=window:s&&(o=self);var c=!o.JS_SHA256_NO_COMMON_JS&&e.exports,d="function"==typeof define&&define.amd,u=!o.JS_SHA256_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,l="0123456789abcdef".split(""),v=[-2147483648,8388608,32768,128],h=[24,16,8,0],f=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],p=["hex","array","digest","arrayBuffer"],g=[];(o.JS_SHA256_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)}),u&&(o.JS_SHA256_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(e){return"object"==typeof e&&e.buffer&&e.buffer.constructor===ArrayBuffer});var m=function(e,t){return function(n){return new I(t,!0).update(n)[e]()}},y=function(e){var t=m("hex",e);a&&(t=x(t,e)),t.create=function(){return new I(e)},t.update=function(e){return t.create().update(e)};for(var n=0;n<p.length;++n){var i=p[n];t[i]=m(i,e)}return t},x=function(e,i){var r,s=n(89855),a=n(687841).Buffer,c=i?"sha224":"sha256";return r=a.from&&!o.JS_SHA256_NO_BUFFER_FROM?a.from:function(e){return new a(e)},function(n){if("string"==typeof n)return s.createHash(c).update(n,"utf8").digest("hex");if(null==n)throw Error(t);n.constructor===ArrayBuffer&&(n=new Uint8Array(n));return Array.isArray(n)||ArrayBuffer.isView(n)||n.constructor===a?s.createHash(c).update(r(n)).digest("hex"):e(n)}},_=function(e,t){return function(n,i){return new C(n,t,!0).update(i)[e]()}},b=function(e){var t=_("hex",e);t.create=function(t){return new C(t,e)},t.update=function(e,n){return t.create(e).update(n)};for(var n=0;n<p.length;++n){var i=p[n];t[i]=_(i,e)}return t};function I(e,t){t?(g[0]=g[16]=g[1]=g[2]=g[3]=g[4]=g[5]=g[6]=g[7]=g[8]=g[9]=g[10]=g[11]=g[12]=g[13]=g[14]=g[15]=0,this.blocks=g):this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],e?(this.h0=3238371032,this.h1=914150663,this.h2=812702999,this.h3=4144912697,this.h4=4290775857,this.h5=1750603025,this.h6=1694076839,this.h7=3204075428):(this.h0=1779033703,this.h1=3144134277,this.h2=1013904242,this.h3=2773480762,this.h4=1359893119,this.h5=2600822924,this.h6=528734635,this.h7=1541459225),this.block=this.start=this.bytes=this.hBytes=0,this.finalized=this.hashed=!1,this.first=!0,this.is224=e}function C(e,n,i){var r,o=typeof e;if("string"===o){var s,a=[],c=e.length,d=0;for(r=0;r<c;++r)(s=e.charCodeAt(r))<128?a[d++]=s:(s<2048?a[d++]=192|s>>>6:(s<55296||s>=57344?a[d++]=224|s>>>12:(s=65536+((1023&s)<<10|1023&e.charCodeAt(++r)),a[d++]=240|s>>>18,a[d++]=128|s>>>12&63),a[d++]=128|s>>>6&63),a[d++]=128|63&s);e=a}else if("object"===o){if(null===e)throw Error(t);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!u||!ArrayBuffer.isView(e)))throw Error(t)}else throw Error(t);e.length>64&&(e=new I(n,!0).update(e).array());var l=[],v=[];for(r=0;r<64;++r){var h=e[r]||0;l[r]=92^h,v[r]=54^h}I.call(this,n,i),this.update(v),this.oKeyPad=l,this.inner=!0,this.sharedMemory=i}I.prototype.update=function(e){if(!this.finalized){var n,i=typeof e;if("string"!==i){if("object"===i){if(null===e)throw Error(t);if(u&&e.constructor===ArrayBuffer)e=new Uint8Array(e);else if(!Array.isArray(e)&&(!u||!ArrayBuffer.isView(e)))throw Error(t)}else throw Error(t);n=!0}for(var r,o,s=0,a=e.length,c=this.blocks;s<a;){if(this.hashed&&(this.hashed=!1,c[0]=this.block,this.block=c[16]=c[1]=c[2]=c[3]=c[4]=c[5]=c[6]=c[7]=c[8]=c[9]=c[10]=c[11]=c[12]=c[13]=c[14]=c[15]=0),n)for(o=this.start;s<a&&o<64;++s)c[o>>>2]|=e[s]<<h[3&o++];else for(o=this.start;s<a&&o<64;++s)(r=e.charCodeAt(s))<128?c[o>>>2]|=r<<h[3&o++]:(r<2048?c[o>>>2]|=(192|r>>>6)<<h[3&o++]:(r<55296||r>=57344?c[o>>>2]|=(224|r>>>12)<<h[3&o++]:(r=65536+((1023&r)<<10|1023&e.charCodeAt(++s)),c[o>>>2]|=(240|r>>>18)<<h[3&o++],c[o>>>2]|=(128|r>>>12&63)<<h[3&o++]),c[o>>>2]|=(128|r>>>6&63)<<h[3&o++]),c[o>>>2]|=(128|63&r)<<h[3&o++]);this.lastByteIndex=o,this.bytes+=o-this.start,o>=64?(this.block=c[16],this.start=o-64,this.hash(),this.hashed=!0):this.start=o}return this.bytes>4294967295&&(this.hBytes+=this.bytes/4294967296<<0,this.bytes=this.bytes%4294967296),this}},I.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var e=this.blocks,t=this.lastByteIndex;e[16]=this.block,e[t>>>2]|=v[3&t],this.block=e[16],t>=56&&(!this.hashed&&this.hash(),e[0]=this.block,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.hBytes<<3|this.bytes>>>29,e[15]=this.bytes<<3,this.hash()}},I.prototype.hash=function(){var e,t,n,i,r,o,s,a,c,d,u,l=this.h0,v=this.h1,h=this.h2,p=this.h3,g=this.h4,m=this.h5,y=this.h6,x=this.h7,_=this.blocks;for(e=16;e<64;++e)t=((r=_[e-15])>>>7|r<<25)^(r>>>18|r<<14)^r>>>3,n=((r=_[e-2])>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,_[e]=_[e-16]+t+_[e-7]+n<<0;for(e=0,u=v&h;e<64;e+=4)this.first?(this.is224?(a=300032,x=(r=_[0]-1413257819)-150054599<<0,p=r+24177077<<0):(a=704751109,x=(r=_[0]-210244248)-1521486534<<0,p=r+143694565<<0),this.first=!1):(t=(l>>>2|l<<30)^(l>>>13|l<<19)^(l>>>22|l<<10),n=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),i=(a=l&v)^l&h^u,r=x+n+(s=g&m^~g&y)+f[e]+_[e],o=t+i,x=p+r<<0,p=r+o<<0),t=(p>>>2|p<<30)^(p>>>13|p<<19)^(p>>>22|p<<10),n=(x>>>6|x<<26)^(x>>>11|x<<21)^(x>>>25|x<<7),i=(c=p&l)^p&v^a,r=y+n+(s=x&g^~x&m)+f[e+1]+_[e+1],o=t+i,y=h+r<<0,t=((h=r+o<<0)>>>2|h<<30)^(h>>>13|h<<19)^(h>>>22|h<<10),n=(y>>>6|y<<26)^(y>>>11|y<<21)^(y>>>25|y<<7),i=(d=h&p)^h&l^c,r=m+n+(s=y&x^~y&g)+f[e+2]+_[e+2],o=t+i,m=v+r<<0,t=((v=r+o<<0)>>>2|v<<30)^(v>>>13|v<<19)^(v>>>22|v<<10),n=(m>>>6|m<<26)^(m>>>11|m<<21)^(m>>>25|m<<7),i=(u=v&h)^v&p^d,r=g+n+(s=m&y^~m&x)+f[e+3]+_[e+3],o=t+i,g=l+r<<0,l=r+o<<0,this.chromeBugWorkAround=!0;this.h0=this.h0+l<<0,this.h1=this.h1+v<<0,this.h2=this.h2+h<<0,this.h3=this.h3+p<<0,this.h4=this.h4+g<<0,this.h5=this.h5+m<<0,this.h6=this.h6+y<<0,this.h7=this.h7+x<<0},I.prototype.hex=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3,r=this.h4,o=this.h5,s=this.h6,a=this.h7,c=l[e>>>28&15]+l[e>>>24&15]+l[e>>>20&15]+l[e>>>16&15]+l[e>>>12&15]+l[e>>>8&15]+l[e>>>4&15]+l[15&e]+l[t>>>28&15]+l[t>>>24&15]+l[t>>>20&15]+l[t>>>16&15]+l[t>>>12&15]+l[t>>>8&15]+l[t>>>4&15]+l[15&t]+l[n>>>28&15]+l[n>>>24&15]+l[n>>>20&15]+l[n>>>16&15]+l[n>>>12&15]+l[n>>>8&15]+l[n>>>4&15]+l[15&n]+l[i>>>28&15]+l[i>>>24&15]+l[i>>>20&15]+l[i>>>16&15]+l[i>>>12&15]+l[i>>>8&15]+l[i>>>4&15]+l[15&i]+l[r>>>28&15]+l[r>>>24&15]+l[r>>>20&15]+l[r>>>16&15]+l[r>>>12&15]+l[r>>>8&15]+l[r>>>4&15]+l[15&r]+l[o>>>28&15]+l[o>>>24&15]+l[o>>>20&15]+l[o>>>16&15]+l[o>>>12&15]+l[o>>>8&15]+l[o>>>4&15]+l[15&o]+l[s>>>28&15]+l[s>>>24&15]+l[s>>>20&15]+l[s>>>16&15]+l[s>>>12&15]+l[s>>>8&15]+l[s>>>4&15]+l[15&s];return!this.is224&&(c+=l[a>>>28&15]+l[a>>>24&15]+l[a>>>20&15]+l[a>>>16&15]+l[a>>>12&15]+l[a>>>8&15]+l[a>>>4&15]+l[15&a]),c},I.prototype.toString=I.prototype.hex,I.prototype.digest=function(){this.finalize();var e=this.h0,t=this.h1,n=this.h2,i=this.h3,r=this.h4,o=this.h5,s=this.h6,a=this.h7,c=[e>>>24&255,e>>>16&255,e>>>8&255,255&e,t>>>24&255,t>>>16&255,t>>>8&255,255&t,n>>>24&255,n>>>16&255,n>>>8&255,255&n,i>>>24&255,i>>>16&255,i>>>8&255,255&i,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o,s>>>24&255,s>>>16&255,s>>>8&255,255&s];return!this.is224&&c.push(a>>>24&255,a>>>16&255,a>>>8&255,255&a),c},I.prototype.array=I.prototype.digest,I.prototype.arrayBuffer=function(){this.finalize();var e=new ArrayBuffer(this.is224?28:32),t=new DataView(e);return t.setUint32(0,this.h0),t.setUint32(4,this.h1),t.setUint32(8,this.h2),t.setUint32(12,this.h3),t.setUint32(16,this.h4),t.setUint32(20,this.h5),t.setUint32(24,this.h6),!this.is224&&t.setUint32(28,this.h7),e},C.prototype=new I,C.prototype.finalize=function(){if(I.prototype.finalize.call(this),this.inner){this.inner=!1;var e=this.array();I.call(this,this.is224,this.sharedMemory),this.update(this.oKeyPad),this.update(e),I.prototype.finalize.call(this)}};var M=y();M.sha256=M,M.sha224=y(!0),M.sha256.hmac=b(),M.sha224.hmac=b(!0),c?e.exports=M:(o.sha256=M.sha256,o.sha224=M.sha224,d&&define(function(){return M}))}()},211849:function(e,t,n){var i=n(481138).stringify,r=n(786737);e.exports=function(e){return{parse:r(e),stringify:i}},e.exports.parse=r(),e.exports.stringify=i},786737:function(e,t,n){var i=null,r=function(e){"use strict";var t,r,o,s,a={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:"\n",r:"\r",t:" "},c=function(e){throw{name:"SyntaxError",message:e,at:t,text:o}},d=function(e){return e&&e!==r&&c("Expected '"+e+"' instead of '"+r+"'"),r=o.charAt(t),t+=1,r},u=function(){var e=!1,t,o="";for("-"===r&&(o="-",d("-"));r>="0"&&r<="9";)o+=r,d();if("."===r)for(e=!0,o+=".";d()&&r>="0"&&r<="9";)o+=r;if("e"===r||"E"===r)for(e=!0,o+=r,d(),("-"===r||"+"===r)&&(o+=r,d());r>="0"&&r<="9";)o+=r,d();if(isFinite(t=+o))return e||Number(o).toString()===o?t:(null==i&&(i=n(361073)),i.fromString(o));c("Bad number")},l=function(){var e,t,n,i="";if('"'===r)for(;d();){if('"'===r)return d(),i;if("\\"===r){if(d(),"u"===r){for(t=0,n=0;t<4&&isFinite(e=parseInt(d(),16));t+=1){;n=16*n+e}i+=String.fromCharCode(n)}else if("string"==typeof a[r])i+=a[r];else break}else i+=r}c("Bad string")},v=function(){for(;r&&r<=" ";)d()},h=function(){switch(r){case"t":return d("t"),d("r"),d("u"),d("e"),!0;case"f":return d("f"),d("a"),d("l"),d("s"),d("e"),!1;case"n":return d("n"),d("u"),d("l"),d("l"),null}c("Unexpected '"+r+"'")},f=function(){var e=[];if("["===r){if(d("["),v(),"]"===r)return d("]"),e;for(;r;){if(e.push(s()),v(),"]"===r)return d("]"),e;d(","),v()}}c("Bad array")},p=function(){var e,t={};if("{"===r){if(d("{"),v(),"}"===r)return d("}"),t;for(;r;){if(e=l(),v(),d(":"),Object.hasOwnProperty.call(t,e)&&c('Duplicate key "'+e+'"'),t[e]=s(),v(),"}"===r)return d("}"),t;d(","),v()}}c("Bad object")};return s=function(){switch(v(),r){case"{":return p();case"[":return f();case'"':return l();case"-":return u();default:return r>="0"&&r<="9"?u():h()}},function(e,n){var i;return o=e+"",t=0,r=" ",i=s(),v(),r&&c("Syntax error"),"function"==typeof n?function e(t,i){var r,o=t[i];return o&&"object"==typeof o&&Object.keys(o).forEach(function(t){void 0!==(r=e(o,t))?o[t]=r:delete o[t]}),n.call(t,i,o)}({"":i},""):i}};e.exports=r},481138:function(e,t,n){var i=n(361073),r=e.exports;!function(){"use strict";var e,t,n,o=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,s={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"};function a(e){return o.lastIndex=0,o.test(e)?'"'+e.replace(o,function(e){var t=s[e];return"string"==typeof t?t:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function c(r,o){var s,d,u,l,v,h=e,f=o[r],p=null!=f&&(f instanceof i||i.isLong(f));switch(f&&"object"==typeof f&&"function"==typeof f.toJSON&&(f=f.toJSON(r)),"function"==typeof n&&(f=n.call(o,r,f)),typeof f){case"string":return a(f);case"number":return isFinite(f)?String(f):"null";case"boolean":case"null":return String(f);case"object":if(!f)return"null";if(p)return f.toString();if(e+=t,v=[],"[object Array]"===Object.prototype.toString.apply(f)){for(s=0,l=f.length;s<l;s+=1)v[s]=c(s,f)||"null";return u=0===v.length?"[]":e?"[\n"+e+v.join(",\n"+e)+"\n"+h+"]":"["+v.join(",")+"]",e=h,u}if(n&&"object"==typeof n)for(s=0,l=n.length;s<l;s+=1)"string"==typeof n[s]&&(u=c(d=n[s],f))&&v.push(a(d)+(e?": ":":")+u);else Object.keys(f).forEach(function(t){var n=c(t,f);n&&v.push(a(t)+(e?": ":":")+n)});return u=0===v.length?"{}":e?"{\n"+e+v.join(",\n"+e)+"\n"+h+"}":"{"+v.join(",")+"}",e=h,u}}"function"!=typeof r.stringify&&(r.stringify=function(i,r,o){var s;if(e="",t="","number"==typeof o)for(s=0;s<o;s+=1)t+=" ";else"string"==typeof o&&(t=o);if(n=r,r&&"function"!=typeof r&&("object"!=typeof r||"number"!=typeof r.length))throw Error("JSON.stringify");return c("",{"":i})})}()},32639:function(e){!function(t,n){e.exports=n()}(0,function(){"use strict";var e={isEqual:!0,isMatchingKey:!0,isPromise:!0,maxSize:!0,onCacheAdd:!0,onCacheChange:!0,onCacheHit:!0,transformKey:!0},t=Array.prototype.slice;function n(e){var n=e.length;return n?1===n?[e[0]]:2===n?[e[0],e[1]]:3===n?[e[0],e[1],e[2]]:t.call(e,0):[]}function i(t){var n={};for(var i in t)!e[i]&&(n[i]=t[i]);return n}function r(e){return"function"==typeof e&&e.isMemoized}function o(e,t){return e===t||e!=e&&t!=t}function s(e,t){var n={};for(var i in e)n[i]=e[i];for(var i in t)n[i]=t[i];return n}var a=function(){function e(e){this.keys=[],this.values=[],this.options=e;var t="function"==typeof e.isMatchingKey;t?this.getKeyIndex=this._getKeyIndexFromMatchingKey:e.maxSize>1?this.getKeyIndex=this._getKeyIndexForMany:this.getKeyIndex=this._getKeyIndexForSingle,this.canTransformKey="function"==typeof e.transformKey,this.shouldCloneArguments=this.canTransformKey||t,this.shouldUpdateOnAdd="function"==typeof e.onCacheAdd,this.shouldUpdateOnChange="function"==typeof e.onCacheChange,this.shouldUpdateOnHit="function"==typeof e.onCacheHit}return Object.defineProperty(e.prototype,"size",{get:function(){return this.keys.length},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"snapshot",{get:function(){return{keys:n(this.keys),size:this.size,values:n(this.values)}},enumerable:!1,configurable:!0}),e.prototype._getKeyIndexFromMatchingKey=function(e){var t=this.options,n=t.isMatchingKey,i=t.maxSize,r=this.keys,o=r.length;if(!o)return -1;if(n(r[0],e))return 0;if(i>1){for(var s=1;s<o;s++)if(n(r[s],e))return s}return -1},e.prototype._getKeyIndexForMany=function(e){var t,n,i=this.options.isEqual,r=this.keys,o=r.length;if(!o)return -1;if(1===o)return this._getKeyIndexForSingle(e);var s=e.length;if(s>1){for(var a=0;a<o;a++)if((t=r[a]).length===s){for(n=0;n<s&&i(t[n],e[n]);n++);if(n===s)return a}}else for(var a=0;a<o;a++)if((t=r[a]).length===s&&i(t[0],e[0]))return a;return -1},e.prototype._getKeyIndexForSingle=function(e){var t=this.keys;if(!t.length)return -1;var n=t[0],i=n.length;if(e.length!==i)return -1;var r=this.options.isEqual;if(i>1){for(var o=0;o<i;o++)if(!r(n[o],e[o]))return -1;return 0}return r(n[0],e[0])?0:-1},e.prototype.orderByLru=function(e,t,n){for(var i=this.keys,r=this.values,o=i.length,s=n;s--;)i[s+1]=i[s],r[s+1]=r[s];i[0]=e,r[0]=t;var a=this.options.maxSize;o===a&&n===o?(i.pop(),r.pop()):n>=a&&(i.length=r.length=a)},e.prototype.updateAsyncCache=function(e){var t=this,n=this.options,i=n.onCacheChange,r=n.onCacheHit,o=this.keys[0],s=this.values[0];this.values[0]=s.then(function(n){return t.shouldUpdateOnHit&&r(t,t.options,e),t.shouldUpdateOnChange&&i(t,t.options,e),n},function(e){var n=t.getKeyIndex(o);throw -1!==n&&(t.keys.splice(n,1),t.values.splice(n,1)),e})},e}();function c(e,t){if(void 0===t&&(t={}),r(e))return c(e.fn,s(e.options,t));if("function"!=typeof e)throw TypeError("You must pass a function to `memoize`.");var d=t.isEqual,u=void 0===d?o:d,l=t.isMatchingKey,v=t.isPromise,h=void 0!==v&&v,f=t.maxSize,p=void 0===f?1:f,g=t.onCacheAdd,m=t.onCacheChange,y=t.onCacheHit,x=t.transformKey,_=s({isEqual:u,isMatchingKey:l,isPromise:h,maxSize:p,onCacheAdd:g,onCacheChange:m,onCacheHit:y,transformKey:x},i(t)),b=new a(_),I=b.keys,C=b.values,M=b.canTransformKey,k=b.shouldCloneArguments,S=b.shouldUpdateOnAdd,T=b.shouldUpdateOnChange,w=b.shouldUpdateOnHit,E=function(){var t=k?n(arguments):arguments;M&&(t=x(t));var i=I.length?b.getKeyIndex(t):-1;if(-1!==i)w&&y(b,_,E),i&&(b.orderByLru(I[i],C[i],i),T&&m(b,_,E));else{var r=e.apply(this,arguments),o=k?t:n(arguments);b.orderByLru(o,r,I.length),h&&b.updateAsyncCache(E),S&&g(b,_,E),T&&m(b,_,E)}return C[0]};return E.cache=b,E.fn=e,E.isMemoized=!0,E.options=_,E}return c})},721078:function(e,t,n){!function(t,i){e.exports=i(n(32639),n(64105))}(0,function(e,t){"use strict";function n(){return(n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}).apply(this,arguments)}function i(e,t){if(null==e)return{};var n,i,r={},o=Object.keys(e);for(i=0;i<o.length;i++)n=o[i],!(t.indexOf(n)>=0)&&(r[n]=e[n]);return r}var r={isDeepEqual:!1,isPromise:!1,isReact:!1,isSerialized:!1,isShallowEqual:!1,matchesArg:void 0,matchesKey:void 0,maxAge:void 0,maxArgs:void 0,maxSize:1,onExpire:void 0,profileName:void 0,serializer:void 0,updateCacheForKey:void 0,transformArgs:void 0,updateExpire:!1};function o(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(function(e,t){return"function"==typeof e?"function"==typeof t?function(){e.apply(this,arguments),t.apply(this,arguments)}:e:"function"==typeof t?t:void 0})}function s(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return t.reduce(function(e,t){return"function"==typeof e?"function"==typeof t?function(){return e(t.apply(this,arguments))}:e:"function"==typeof t?t:void 0})}function a(e,t){for(var n=0;n<e.length;n++)if(e[n].key===t)return n;return -1}function c(e,t){var n="function"==typeof t?t:function(t,n){for(var i=0;i<n.length;i++)if(!e(t[i],n[i]))return!1;return!0};return function(e,t){for(var i=0;i<e.length;i++)if(e[i].length===t.length&&n(e[i],t))return i;return -1}}function d(e,t){return t&&t!==r?n({},e,t,{onCacheAdd:o(e.onCacheAdd,t.onCacheAdd),onCacheChange:o(e.onCacheChange,t.onCacheChange),onCacheHit:o(e.onCacheHit,t.onCacheHit),transformArgs:s(e.transformArgs,t.transformArgs)}):e}function u(e){return"function"==typeof e&&e.isMoized}function l(e,t,n){try{var i=n||t||"anonymous";Object.defineProperty(e,"name",{configurable:!0,enumerable:!1,value:"moized("+i+")",writable:!0})}catch(e){}}function v(e,t,n){var i=a(e,t);-1!==i&&(clearTimeout(e[i].timeoutId),n&&e.splice(i,1))}function h(e,t){var n=setTimeout(e,t);return"function"==typeof n.unref&&n.unref(),n}function f(e,t,n,i){var r=t.maxAge;return function o(s,d,u){var l=s.keys[0];if(-1===a(e,l)){var f=function(){var r=c(n,i)(s.keys,l),a=s.values[r];~r&&(s.keys.splice(r,1),s.values.splice(r,1),"function"==typeof t.onCacheChange&&t.onCacheChange(s,d,u)),v(e,l,!0),"function"==typeof t.onExpire&&!1===t.onExpire(l)&&(s.keys.unshift(l),s.values.unshift(a),o(s,d,u),"function"==typeof t.onCacheChange&&t.onCacheChange(s,d,u))};e.push({expirationMethod:f,key:l,timeoutId:h(f,r)})}}}function p(e,t){return function(n){var i=n.keys[0],r=a(e,i);~r&&(v(e,i,!1),e[r].timeoutId=h(e[r].expirationMethod,t.maxAge))}}function g(e,t,n,i){var r="number"==typeof t.maxAge&&isFinite(t.maxAge)?f(e,t,n,i):void 0;return{onCacheAdd:r,onCacheHit:r&&t.updateExpire?p(e,t):void 0}}var m={anonymousProfileNameCounter:1,isCollectingStats:!1,profiles:{}},y=!1;function x(e){e?delete m.profiles[e]:m.profiles={}}function _(e){void 0===e&&(e=!0),m.isCollectingStats=e}function b(e){var t=e.profileName;return function(){t&&!m.profiles[t]&&(m.profiles[t]={calls:0,hits:0}),m.profiles[t].calls++}}function I(e){return function(){var t=m.profiles,n=e.profileName;!t[n]&&(t[n]={calls:0,hits:0}),t[n].calls++,t[n].hits++}}function C(e){return e.displayName||e.name||"Anonymous "+m.anonymousProfileNameCounter++}function M(e,t){return e?(t/e*100).toFixed(4)+"%":"0.0000%"}function k(e){!m.isCollectingStats&&!y&&(y=!0);var t=m.profiles;if(e){if(!t[e])return{calls:0,hits:0,usage:"0.0000%"};var i=t[e];return n({},i,{usage:M(i.calls,i.hits)})}var r=Object.keys(m.profiles).reduce(function(e,n){return e.calls+=t[n].calls,e.hits+=t[n].hits,e},{calls:0,hits:0});return n({},r,{profiles:Object.keys(t).reduce(function(e,t){return e[t]=k(t),e},{}),usage:M(r.calls,r.hits)})}function S(e){return m.isCollectingStats?{onCacheAdd:b(e),onCacheHit:I(e)}:{}}var T={arguments:!0,callee:!0,caller:!0,constructor:!0,length:!0,name:!0,prototype:!0};function w(e,t,n){void 0===n&&(n=[]),Object.getOwnPropertyNames(e).forEach(function(i){if(!T[i]&&-1===n.indexOf(i)){var r=Object.getOwnPropertyDescriptor(e,i);r.get||r.set?Object.defineProperty(t,i,r):t[i]=e[i]}})}function E(e,t){var n=t.expirations,i=e.options,r=c(i.isEqual,i.isMatchingKey),o=e;o.clear=function(){var e=o._microMemoizeOptions.onCacheChange,t=o.cache;return t.keys.length=0,t.values.length=0,e&&e(t,o.options,o),!0},o.clearStats=function(){x(o.options.profileName)},o.get=function(e){var t=o._microMemoizeOptions.transformKey,n=o.cache,i=t?t(e):e;return -1!==r(n.keys,i)?o.apply(this,e):void 0},o.getStats=function(){return k(o.options.profileName)},o.has=function(e){var t=o._microMemoizeOptions.transformKey,n=t?t(e):e;return -1!==r(o.cache.keys,n)},o.keys=function(){return o.cacheSnapshot.keys},o.remove=function(e){var t=o._microMemoizeOptions,i=t.onCacheChange,s=t.transformKey,a=o.cache,c=r(a.keys,s?s(e):e);if(-1===c)return!1;var d=a.keys[c];return a.keys.splice(c,1),a.values.splice(c,1),i&&i(a,o.options,o),v(n,d,!0),!0},o.set=function(e,t){var n=o._microMemoizeOptions,i=o.cache,s=o.options,a=n.onCacheAdd,c=n.onCacheChange,d=n.transformKey,u=d?d(e):e,l=r(i.keys,u);if(-1===l){var v=s.maxSize-1;i.size>v&&(i.keys.length=v,i.values.length=v),i.keys.unshift(u),i.values.unshift(t),s.isPromise&&i.updateAsyncCache(o),a&&a(i,s,o),c&&c(i,s,o)}else{var h=i.keys[l];i.values[l]=t,l>0&&i.orderByLru(h,t,l),s.isPromise&&i.updateAsyncCache(o),"function"==typeof c&&c(i,s,o)}},o.values=function(){return o.cacheSnapshot.values}}function R(e,t){var n=t.expirations,i=t.options,r=t.originalFunction,o=e.options;Object.defineProperties(e,{_microMemoizeOptions:{configurable:!0,get:function(){return o}},cacheSnapshot:{configurable:!0,get:function(){var t=e.cache;return{keys:t.keys.slice(0),size:t.size,values:t.values.slice(0)}}},expirations:{configurable:!0,get:function(){return n}},expirationsSnapshot:{configurable:!0,get:function(){return n.slice(0)}},isMoized:{configurable:!0,get:function(){return!0}},options:{configurable:!0,get:function(){return i}},originalFunction:{configurable:!0,get:function(){return r}}}),w(r,e)}function U(e,t){return E(e,t),R(e,t),e}var A="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function O(e,t,i){var r=e(n({maxArgs:2,isShallowEqual:!0},i,{isReact:!1}));function o(e,n,i){this.props=e,this.context=n,this.updater=i,this.MoizedComponent=r(t)}return!t.displayName&&(t.displayName=t.name||"Component"),o.prototype.isReactComponent={},o.prototype.render=function(){return{$$typeof:A,type:this.MoizedComponent,props:this.props,ref:null,key:null,_owner:null}},w(t,o,["contextType","contextTypes"]),o.displayName="Moized("+(t.displayName||t.name||"Component")+")",l(o,t.name,i.profileName),o}function P(e){return function(t){if(e>=t.length)return t;if(0===e)return[];if(1===e)return[t[0]];if(2===e)return[t[0],t[1]];if(3===e)return[t[0],t[1],t[2]];for(var n=[],i=0;i<e;i++)n[i]=t[i];return n}}function D(e,t){for(var n=e.length,i=0;i<n;++i)if(e[i]===t)return i+1;return 0}function N(){var e=[],t=[];return function(n,i){var r=typeof i;if("function"===r||"symbol"===r)return i.toString();if("object"==typeof i){if(e.length){var o=D(e,this);0===o?e[e.length]=this:(e.splice(o),t.splice(o)),t[t.length]=n;var s=D(e,i);if(0!==s)return"[ref="+(t.slice(0,s).join(".")||".")+"]"}else e[0]=i,t[0]=n;return i}return""+i}}function B(e){var t=typeof e;return e&&("object"===t||"function"===t)?JSON.stringify(e,N()):e}function G(e){for(var t="|",n=0;n<e.length;n++)t+=B(e[n])+"|";return[t]}function L(e){return"function"==typeof e.serializer?e.serializer:G}function j(e,t){return e[0]===t[0]}function V(e){if("function"==typeof e)return function(t,n,i){return e(i.cache,i.options,i)}}function F(e){return e.matchesArg||e.isDeepEqual&&t.deepEqual||e.isShallowEqual&&t.shallowEqual||t.sameValueZeroEqual}function W(e){return e.matchesKey||e.isSerialized&&j||void 0}function Y(e){return s(e.isSerialized&&L(e),"function"==typeof e.transformArgs&&e.transformArgs,"number"==typeof e.maxArgs&&P(e.maxArgs))}function $(e){var t=e.options.updateCacheForKey,n=function(){for(var n=arguments.length,i=Array(n),r=0;r<n;r++)i[r]=arguments[r];if(!t(i))return e.apply(this,i);var o=e.fn.apply(this,i);return e.set(i,o),o};return w(e,n),n}var q=["matchesArg","isDeepEqual","isPromise","isReact","isSerialized","isShallowEqual","matchesKey","maxAge","maxArgs","maxSize","onCacheAdd","onCacheChange","onCacheHit","onExpire","profileName","serializer","updateCacheForKey","transformArgs","updateExpire"],H=function t(s,a){var c=a||r;if(u(s))return t(s.originalFunction,d(s.options,c));if("object"==typeof s)return function(e,n){return"function"==typeof e?t(e,d(s,n)):t(d(s,e))};if(c.isReact)return O(t,s,c);var v=n({},r,c,{maxAge:"number"==typeof c.maxAge&&c.maxAge>=0?c.maxAge:r.maxAge,maxArgs:"number"==typeof c.maxArgs&&c.maxArgs>=0?c.maxArgs:r.maxArgs,maxSize:"number"==typeof c.maxSize&&c.maxSize>=0?c.maxSize:r.maxSize,profileName:c.profileName||C(s)}),h=[];v.matchesArg,v.isDeepEqual;var f=v.isPromise;v.isReact,v.isSerialized,v.isShallowEqual,v.matchesKey,v.maxAge,v.maxArgs;var p=v.maxSize,m=v.onCacheAdd,y=v.onCacheChange,x=v.onCacheHit;v.onExpire,v.profileName,v.serializer;var _=v.updateCacheForKey;v.transformArgs,v.updateExpire;var b=i(v,q),I=F(v),M=W(v),k=g(h,v,I,M),T=S(v),w=Y(v),E=U(e(s,n({},b,{isEqual:I,isMatchingKey:M,isPromise:f,maxSize:p,onCacheAdd:V(o(m,k.onCacheAdd,T.onCacheAdd)),onCacheChange:V(y),onCacheHit:V(o(x,k.onCacheHit,T.onCacheHit)),transformKey:w})),{expirations:h,options:v,originalFunction:s});return _&&(E=$(E)),l(E,s.name,c.profileName),E};function z(e,t){return!0===t?H({maxAge:e,updateExpire:t}):"object"==typeof t?H({maxAge:e,onExpire:t.onExpire,updateExpire:t.updateExpire}):"function"==typeof t?H({maxAge:e,onExpire:t,updateExpire:!0}):H({maxAge:e})}return H.clearStats=x,H.collectStats=_,H.compose=function(){return s.apply(void 0,arguments)||H},H.deep=H({isDeepEqual:!0}),H.getStats=k,H.infinite=H({maxSize:1/0}),H.isCollectingStats=function(){return m.isCollectingStats},H.isMoized=function(e){return"function"==typeof e&&!!e.isMoized},H.matchesArg=function(e){return H({matchesArg:e})},H.matchesKey=function(e){return H({matchesKey:e})},H.maxAge=z,H.maxArgs=function(e){return H({maxArgs:e})},H.maxSize=function(e){return H({maxSize:e})},H.profile=function(e){return H({profileName:e})},H.promise=H({isPromise:!0,updateExpire:!0}),H.react=H({isReact:!0}),H.serialize=H({isSerialized:!0}),H.serializeWith=function(e){return H({isSerialized:!0,serializer:e})},H.shallow=H({isShallowEqual:!0}),H.transformArgs=function(e){return H({transformArgs:e})},H.updateCacheForKey=function(e){return H({updateCacheForKey:e})},Object.defineProperty(H,"default",{configurable:!1,enumerable:!1,value:H,writable:!1}),H})},630272:function(e){"use strict";var t={rfc3986:{}};t.generate=function(){var e="|",n="0-9",i="["+n+"]",r="a-zA-Z",o="["+r+"]";t.rfc3986.cidr=i+e+"[1-2]"+i+e+"3[0-2]";var s=n+"A-Fa-f",a="["+s+"]",c=r+n+"-\\._~",d="!\\$&'\\(\\)\\*\\+,;=",u="%"+s,l=c+u+d+":@",v="["+l+"]",h="0?",f="(?:"+h+h+i+e+h+"[1-9]"+i+e+"1"+i+i+e+"2[0-4]"+i+e+"25[0-5])";t.rfc3986.IPv4address="(?:"+f+"\\.){3}"+f;var p=a+"{1,4}",g="(?:"+p+":"+p+"|"+t.rfc3986.IPv4address+")",m="(?:"+p+":){6}"+g,y="::(?:"+p+":){5}"+g,x="(?:"+p+")?::(?:"+p+":){4}"+g,_="(?:(?:"+p+":){0,1}"+p+")?::(?:"+p+":){3}"+g,b="(?:(?:"+p+":){0,2}"+p+")?::(?:"+p+":){2}"+g,I="(?:(?:"+p+":){0,3}"+p+")?::"+p+":"+g,C="(?:(?:"+p+":){0,4}"+p+")?::"+g,M="(?:(?:"+p+":){0,5}"+p+")?::"+p,k="(?:(?:"+p+":){0,6}"+p+")?::";t.rfc3986.IPv6address="(?:"+m+e+y+e+x+e+_+e+b+e+I+e+C+e+M+e+k+")",t.rfc3986.IPvFuture="v"+a+"+\\.["+c+d+":]+",t.rfc3986.scheme=o+"["+r+n+"+-\\.]*";var S="["+c+u+d+":]*";t.rfc3986.IPLiteral="\\[(?:"+t.rfc3986.IPv6address+e+t.rfc3986.IPvFuture+")\\]";var T="["+c+u+d+"]{0,255}",w="(?:"+S+"@)?"+("(?:"+t.rfc3986.IPLiteral+e+t.rfc3986.IPv4address+e+T+")")+"(?::"+(i+"*")+")?",E=v+"*",R=v+"+",U="(?:\\/"+E+")*",A="\\/(?:"+R+U+")?",O=R+U;t.rfc3986.hierPart="(?:(?:\\/\\/"+w+U+")"+e+A+e+O+")",t.rfc3986.query="["+l+"\\/\\?]*(?=#|$)",t.rfc3986.fragment="["+l+"\\/\\?]*",t.rfc3986.uri="^(?:"+t.rfc3986.scheme+":"+t.rfc3986.hierPart+")(?:\\?"+t.rfc3986.query+")?(?:#"+t.rfc3986.fragment+")?$"},t.generate(),e.exports=t.rfc3986},664681:function(e,t,n){"use strict";n.d(t,{S:function(){return w}});var i=n("320165");n("101199"),n("228983"),n("759943"),n("939067");var r=n("732979"),o=n.n(r),s=n("93849"),a=n.n(s),c=n("719142"),d=n.n(c),u=n("232149"),l=n.n(u);o().extend(a()),o().extend(d()),o().extend(l());let v=864e5;function h(e){return o()(e).isToday()}function f(e,t){return Date.now()-e<t*v}let p="a:consecutive_chat",g="a:consecutive_level",m="a:consecutive_chat_pre",y="disable";var x={pre:0,0:"pre",fire:1,1:"fire",disable:2,2:"disable",check:3,3:"check",none:4,4:"none"};function _(e){var t,n;return e&&(null==e?void 0:null===(t=e.coreInfo)||void 0===t?void 0:t.ext)?null==e?void 0:null===(n=e.coreInfo)||void 0===n?void 0:n.ext[g]:null}function b(e){var t;let n=null==e?void 0:null===(t=e.coreInfo)||void 0===t?void 0:t.ext[m];if(!n)return{status:4};let i=n.split(":");if(3!==i.length)return{status:4};let r=i[0],o=1e3*Number.parseInt(i[1]),s=1e3*Number.parseInt(i[2]),a=Date.now(),c=a<=o?r:a<=s&&"closeFriend"==r?"disable_closeFriend":null;return c?{level:c,status:0,text:"newFriend"==c?"新朋友":null}:{status:4}}function I(e){var t,n;if(e&&(null==e?void 0:null===(t=e.coreInfo)||void 0===t?void 0:t.ext)){let t=null==e?void 0:null===(n=e.coreInfo)||void 0===n?void 0:n.ext[p];if(!t)return b(e);let i=t.split(":");if(5!==i.length)return{status:4};let r=Date.now(),o=Number.parseInt(i[0]),s=1e3*Number.parseInt(i[1]),a=1e3*Number.parseInt(i[2]);if(s<r&&r<a){let t,n=4;if(h(s)?(n=1,t=_(e)):f(s,2)?(n=2,t=y):f(s,5)&&(n=3,t=y),t===y){let t=b(e);if(t.level)return t}return{chatDays:o,level:t,status:n}}}return{status:4}}var C=e=>{var t,n;let{conversation:i,theme:r,isGroup:o,isFollowEach:s}=e,a=null==i?void 0:null===(t=i.coreInfo)||void 0===t?void 0:t.ext;if(!(null==a?void 0:a[p])&&!(null==a?void 0:a[g])&&!(null==a?void 0:a[m]))return{show:!1};let c="dark"===r?"#ebebeb":"#16182399",d="chat_days_",u={disable_icon:"https://p3.douyinpic.com/aweme-client-static-resource/thin_consecutive_flame_btn_off@3x.png~tplv-obj.image",enable_icon:"https://p3.douyinpic.com/aweme-client-static-resource/thin_consecutive_flame_btn_on@3x.png~tplv-obj.image",chat_days_disable:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_disable_3140%403x.png~tplv-obj.image",chat_days_normal:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_normal_3140%403x.png~tplv-obj.image",chat_days_purple:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_purple_3140%403x.png~tplv-obj.image",chat_days_blue:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_blue_3140%403x.png~tplv-obj.image",chat_days_gold:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_gold%403x.png~tplv-obj.image",chat_days_green:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_green_3140%403x.png~tplv-obj.image",chat_days_specialNewYearDay2024:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_specialNewYearDay2024_3140_new.png~tplv-obj.image",chat_days_disable_specialNewYearDay2024:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_disable_specialNewYearDay2024_3140_new.png~tplv-obj.image",chat_days_specialpurple1:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_purple_3140%403x.png~tplv-obj.image",chat_days_disable_specialpurple1:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_disable%403x.png~tplv-obj.image",chat_days_closeFriend:"https://p3.douyinpic.com/aweme-client-static-resource/chat_days_closeFriend_3140%403x.png~tplv-obj.image",chat_days_specialSpringFestival2024_emoji:"https://p3.douyinpic.com/aweme-client-static-resource/specialSpringFestival2024_emoji.png~tplv-obj.image",chat_days_disable_specialSpringFestival2024_emoji:"https://p3.douyinpic.com/aweme-client-static-resource/disable_specialSpringFestival2024.png~tplv-obj.image",chat_days_newFriend:"https://p3.douyinpic.com/aweme-client-static-resource/new_friend%403x.png~tplv-obj.image"},l={purple:"#9662FFFF",normal:"#FF4C13FF",blue:"#2EBCC8FF",gold:"#EE8F00FF",green:"#4fd22aFF",specialpurple1:"#9662FFFF",specialNewYearDay2024:"#FF4C13FF",closeFriend:"#9662FFFF",specialSpringFestival2024_emoji:"#FF851DFF",newFriend:"#51B154FF"},v=I(i),h=u[`${d}${v.level}`],f=null!==(n=l[v.level])&&void 0!==n?n:c,y=4!==v.status;return!0!==o&&!s&&(y=!1),{show:y,icon:h,color:f,days:v.chatDays||"",text:v.text,status:v.status}},M=n("32870"),k=n("469935"),S=n.n(k);let T=(e,t)=>e;function w(e){let{needSyncClientCloseConsecutiveChat:t=!1,close_consecutive_chat:n,platform:r,imgClass:o="",textClass:s="",boxStyle:a}=e,{show:c,icon:d,color:u,days:l,text:v,status:h}=C({conversation:T(e.conversation,r),theme:e.theme||"light",isGroup:e.isGroup,isFollowEach:e.isFollowEach});return t&&(void 0===n||n)?(0,i.jsx)(i.Fragment,{}):c?(0,i.jsxs)("span",{className:M.default.wrapper,style:a,children:[!!d&&(0,i.jsx)("img",{src:d,className:S()(M.default.chatFireIcon,o)}),!!l&&(0,i.jsx)("span",{style:{color:u},className:S()(M.default.chatFireText,s),children:h==x.check?"重燃中":l}),!!v&&(0,i.jsx)("span",{style:{color:u},className:S()(M.default.chatFireText,s),children:v})]}):(0,i.jsx)(i.Fragment,{})}},766409:function(e,t,n){"use strict";n.d(t,{k:function(){return l}});var i=n("629686"),r=n("811603");n("490629");var o=n("320165"),s=n("101199"),a=n("469935"),c=n.n(a),d=e=>{let t,n,i,r,o,a,c="",d=1,u={x:0,y:0},l=(0,s.useCallback)(t=>{if(!e)return;let n=-.005*t.deltaY,s=d*n+d;if(s<.1||s>20)return;d=s;let c={x:n*r*.5,y:n*i*.5},l=t.pageX-o-u.x,v=t.pageY-a-u.y,h=n*l,f=n*v;u.x-=h-c.x,u.y-=f-c.y,e.style.transform=`translate(${u.x}px, ${u.y}px) scale(${d})`},[e]);(0,s.useEffect)(()=>{let t=()=>{var t;let n=null==e?void 0:null===(t=e.getBoundingClientRect)||void 0===t?void 0:t.call(e);r=(null==n?void 0:n.width)||0,i=(null==n?void 0:n.height)||0,o=(null==n?void 0:n.left)||0,a=(null==n?void 0:n.top)||0};if(null==e?void 0:e.complete)t();else{var n;null==e||null===(n=e.addEventListener)||void 0===n||n.call(e,"load",t)}return()=>{var n;null==e||null===(n=e.removeEventListener)||void 0===n||n.call(e,"load",t)}},[e]);let v=(0,s.useCallback)(i=>{var r,o,s;if(!!e)i.preventDefault(),c="start",t=i.pageX,n=i.pageY,(null===(r=i.changedTouches)||void 0===r?void 0:r[0])&&(t=null===(o=i.changedTouches)||void 0===o?void 0:o[0].pageX,n=null===(s=i.changedTouches)||void 0===s?void 0:s[0].pageY)},[e]),h=(0,s.useCallback)(i=>{var r,o,s;if(!e||"start"!==c&&"move"!==c)return;c="move",i.preventDefault();let a=i.pageX,l=i.pageY;(null===(r=i.changedTouches)||void 0===r?void 0:r[0])&&(a=null===(o=i.changedTouches)||void 0===o?void 0:o[0].pageX,l=null===(s=i.changedTouches)||void 0===s?void 0:s[0].pageY);let v=a-t,h=l-n;t=a,n=l,u.x+=v,u.y+=h,e.style.transform=`translate(${u.x}px, ${u.y}px) scale(${d})`},[e]),f=(0,s.useCallback)(t=>{if(c="",!!e&&"move"===c)t.preventDefault()},[e]);return{onContainerMouseLeave:(0,s.useCallback)(()=>{c=""},[e]),onWheel:l,onMouseUp:f,onMouseDown:v,onMouseMove:h,onTouchStart:v,onTouchEnd:f,onTouchMove:h}},u=n("499966");let l=(0,s.forwardRef)((e,t)=>{let{style:n,imageStyle:a,className:l,imageClassName:v,src:h,onClick:f,onLoad:p,onError:g,onMouseEvent:m}=e,y=(0,r._)(e,["style","imageStyle","className","imageClassName","src","onClick","onLoad","onError","onMouseEvent"]),[x,_]=(0,s.useState)(null),b=(0,s.useRef)();(0,s.useEffect)(()=>{b.current&&_(b.current)},[b.current]),(0,s.useImperativeHandle)(t,()=>({getRef:()=>b.current}));let{onMouseMove:I,onMouseUp:C,onMouseDown:M,onContainerMouseLeave:k,onWheel:S,onTouchStart:T,onTouchEnd:w,onTouchMove:E}=d(x);return(0,o.jsx)("div",{style:(0,i._)({},n),className:c()(u.default.wrapper,l),onMouseMove:I,onMouseLeave:k,onTouchMove:E,children:(0,o.jsx)("img",(0,i._)({onClick:f,onMouseDown:M,onMouseUp:C,onTouchStart:T,onTouchEnd:w,onWheelCapture:e=>{S(e),null==m||m("wheel")},onLoad:p,onError:g,ref:b,className:c()(u.default.img,v),style:(0,i._)({},a),src:h},y))})})},670299:function(e,t,n){"use strict";n.d(t,{i:function(){return i}});var i={CLIENT:0,0:"CLIENT",WEB:1,1:"WEB"}},916706:function(e,t,n){"use strict";n.d(t,{_:function(){return r}});var i=n(474143);function r(e,t,n){return(0,i._)(e,t),n}}}]); |