coze-bridge 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +38 -34
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,25 +5,25 @@ import { dirname as __coze_dirname } from 'node:path';
|
|
|
5
5
|
const require = __coze_createRequire(import.meta.url);
|
|
6
6
|
const __filename = __coze_fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __coze_dirname(__filename);
|
|
8
|
-
var
|
|
9
|
-
|
|
10
|
-
`)
|
|
11
|
-
`,"utf8"),i?.mode!==void 0&&await F0(r,i.mode)}var nr=Ae(()=>{"use strict"});import{homedir as G0}from"node:os";import{join as ne}from"node:path";function j(r){let e=r??G0(),i=ne(e,".coze"),a=ne(i,"bridge"),x=ne(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:x,libEntry:ne(x,"index.js"),pidFile:ne(a,"bridge.pid"),portFile:ne(a,"bridge.port"),tokenFile:ne(a,"bridge.token"),logFile:ne(a,"bridge.log"),installLock:ne(a,"install.lock"),configFile:ne(a,"config.json"),agentsRoot:ne(i,"agents")}}function Te(r,e=j()){let i=ne(e.agentsRoot,r);return{root:i,config:ne(i,"config.json"),workspace:ne(i,"workspace"),logs:ne(i,"logs")}}var xe=Ae(()=>{"use strict"});var ws={};hs(ws,{AGENT_CONFIG_FILE_MODE:()=>Ft,enforceAgentConfigMode:()=>J0,loadAgentConfig:()=>ae,persistAgentSessions:()=>rr,persistAgentSkills:()=>Ut,saveAgentConfig:()=>de});import{chmod as W0,stat as V0}from"node:fs/promises";function ae(r,e){return zt(Te(r,e).config)}function de(r,e){return qt(Te(r.agentId,e).config,r,{mode:Ft})}async function J0(r,e){if(process.platform==="win32")return;let i=Te(r,e).config;try{let a=await V0(i);if(!a.isFile())return;let x=a.mode&511;x!==Ft&&(await W0(i,Ft),_s.warn("agent config mode auto-corrected to 0600",{path:i,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;_s.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function rr(r,e,i){let a=await ae(r,i);a&&(a.sessions=Object.fromEntries(e),await de(a,i))}async function Ut(r,e,i){let a=await ae(r,i);a&&(a.skills=e,await de(a,i))}var _s,Ft,it=Ae(()=>{"use strict";U();nr();xe();_s=L("agent-config"),Ft=384});var ri=oe(W=>{"use strict";function fn(){let r=["ENDZAwq","AxnFywnR","vgnzuuO","vwv3D0W","CMvQzwn0","BhfYqNq","aaaaaaaaaaa","AxnmB25N","t0njBLa","EfnnBhe","ze5NtuO","y0Pbyvy","Bu1jAvK","AevYvvq","reiGzMfPBgu","DgXUDNq","zcbLCNjVCI4","A05Nq1i","DeLK","tNHws0O","wgXsBKW","s0zlrKm","x2n1CNnVCK0","AMDPzuS","rvjst1i","sfLfCKy","ywXS","ru9IAeq","tKXuD0i","DwHUBLq","yNL0zxm","CgfNzwHPzgu","zMLUza","q3vZDg9Tq2W","zNDluw0","AvnyEKC","q2HbyKW","qxfWze4","shLmDuG","qNjXzu0","ywWGy3vYC28","vgXWt2m","Ehzvqwm","y2HLy2Tszwe","zNDuvwO","B2nRzxrgywK","r1HLqM4","y2HHCKnVzgu","v2LQDM4","sg5vyLO","CfvZwK0","x3vYBa","AxjLza","AuPUDMS","zK5Swee","EhPlseq","Du1hzwG","BgLUzw5V","z3zYtMi","B3jLtMfTzxm","EuTxEwq","sMf6see","re9ku0q","uNHTChO","mNWXFdr8mhW","Ef9MCM9UDgK","u2vYDMLJzvC","y09Wzw4","reTssha","CMvTB3zLq2G","tvL5zKm","B09buhy","uKXkCNe","C2vYDMLJzs0","sxLUBKy","v0TUAuG","v2vIu29JA2u","zMLN","yxbWzw5Kq2G","sNnVEfq","B2LUDfjLywm","BKDiExy","AxnrB1nby2S","EKjrCuy","DNbSvee","swjjBgq","DuzstMq","EfbvEMu","A3v0ywO","s1Poq1m","rwHdtha","ufnVCfy","rNjeBvC","rwrbBvy","tgP5sNO","vuzJu2u","zfrREhG","AgvHzgvYCW","tw9KDwXL","tMfTzq","uvzXAvy","CMvZzxruCMK","zM9Yy2u","A2v5CW","zvzAtfq","yKjQCK4","zKvVu2e","r2vWy0C","DcbVzIbYyw4","sxr0DgO","r2T5Dwq","Aw5N","ugLqBei","y29TCgXLDgu","BM5Ly3q","y29UBMvJDa","CYbHBhjLywq","r2vxqvq","x3DZ","zxjFywnRx20","t1Pbt1a","y3jLyxrLt3a","EwjMtLK","y3vYCMvUDeu","Ee9qrLG","v1zWvfC","qM9KyKm","ALrRqwq","suvtx0vsuK8","x2n1CNnVCK4","CMvWBgfJzq","yxbWBhK","CMfTzq","vezZyNy","Aefit2u","ze9wDuu","sK5jyMq","u3DKque","AeDgA1O","vxbMyM4","twfUr1O","pxv0zI04","nxWWFdj8nhW","CLbMC0W","zxmGCMvHy2G","zxjFAxnFywm","mxWZ","ihrPBwvVDxq","B25tDgfYDfi","z29PBMCGyxC","wfPez20","BLPhuei","tufyx1jfvfi","tunZy3q","B2fPqKW","BwvZC2fNzv8","BxnNsuq","r29pvhG","sgTJwKy","B01Vr2q","BMvLzf9Hy2S","tfveCKu","zfLTBfG","y29UBMvJDfm","uNHnrMy","B2fK","sfPdwhK","yM9KEq","uMvJB25Uzwm","wwnxC0q","sKzgsva","r2vdzva","igzPzwXKoIa","BNrfBMrWB2K","u2j1tw0","B3jRzxjhBg8","rMXRB0q","vffKAfC","s2z6y3C","x3jLBw92zvC","Bwf4twvZC2e","mhWYFdn8nhW","ExbL","s1b5C2y","BMz2r1G","x3DHAxq","B3bLBKrc","Dhr0CMC","r1Dpq0i","uxLJvuC","CvzMDvO","sgDgsNm","y3jLyxrLt2i","yMrFzgLK","Cgf5Bg9Hzfq","qNjPzgDL","BejuyLG","ENrHruO","yw5Rz00","zv9ZDwnJzxm","ANbVywK","D1nKz1C","D1LosM0","s3zSvg4","C2vUzf9Hy2S","uxvLDwu","A0jbu3u","CM9yzMS","x2LZsw5PDa","BwLZzq","CMnSyxO","AMX6uK8","yxnZAwDU","FdL8nxWYFda","ve1eqNu","D2rzEgW","zxj2AwnL","vwzuvve","nJy3mJeXnuHhrMvHwG","teHQAfi","sLPLzwe","zvDLzxm","x29Ut3bLBG","B3nsBMi","D3m6lY8","DgXTtha","ywXPzcb1CMW","rhzjthy","x2LUAxq","x3bYzwzPEa","AhPktgS","zeDnBeG","zNDXwgm","EsbJBg9Zzwq","yNL0zu9MzNm","x2rItMfTzq","Axnby2TdBgu","x2LUDgvYDMe","DeTKsfy","zw50zwqGDhK","x2LZv29YA2u","BgLTAxq","C3jNteu","x2rLC3rYB3K","u0PrEe4","Bu9NzLO","ANrxuxC","te50v3a","CMvTB3zLrxy","CxPMzuW","Eg1mqvi","Cgrdzu0","turTEhK","D2nmufO","D2fZq2XLyw4","Bg9IywXty28","C3zNqMi","Ec11C2uT","Dg9cExrLC0W","x3bHDgHlzxK","CgjfyxK","yw5UAve","rwPfyLi","t2f0z1K","yKDRsNK","rhftDfa","AwDZuMe","CIb0DhDjra","A1n0yxr1C0m","BffYswu","vgfN","veHwve4","C2nXz2G","AM9PBG","C2vYDMLJzq","B1fiD0q","BgrIr1e","CM9YrxzLBNq","vgfouvu","BKXPBMu","ALzNEeG","ywnRpwzYB24","v1vQuMe","qKvTBMC","u0nlDNu","AKDtEfq","B3jRig9MzMW","tKzzAwS","sxfdCuO","zLH6swy","ENbptvu","BwTfENu","x2nYzwf0zvm","ChvZAa","rfrSwNC","vhrcEwy","t294rMm","yxjrD2y","z0nOsuK","vLP3D1u","rKXSBMO","t3bLBKv2zw4","wK56zg4","z3flEhC","Dxrjza","DMLnEKO","CeDVyLe","u3fiuKK","uNHdB0i","s3nnD3G","u2vXsuq","B2XivMC","CgjICdi","y0T0wum","v2vPEgLUsLm","BMv3vMvYC2K","B3DjsvG","tfL4ugO","Ahr0Chm6","uwHlsLe","y21OAMq","CNvvB1u","rM11D0y","mNWXFdr8nq","Ec1TC2CTy3u","vNfqwfe","z2vtEw5J","ndH2EhPSBxq","CMvZzxrfBMq","C2HPzNq","whrmBfG","DMvUDa","sxbfu0u","z2vrDwv1zuW","r0DKENm","tur2AhG","q0juvgi","y29UC3rYDwm","tMzzvLO","Ew5NCuK","u2nMuxm","sw1qrem","A1bVyMe","BgvUz3rO","zhv4s28","yMXVy2TLza","CMDgzvK","DgLLCKPtt04","vLfQAxq","D2nVrg0","ufr6Aui","uuzVsfm","t2fmBvC","ruLYBMS","DxrVuMvJB24","ywX0tNi","Cgf5Bg9Hza","CNnVCL92ywW","q3vZDg9Trxi","vhv0sxG","DgHRz0y","EvPZuMK","t3zcqxC","Dg9mB3DLCKm","wgTsveG","q0Xpu0ve","AwXLx25HBwu","zw5NDgG","vuLdz2e","y2vZC0HHBMq","qKXOsuW","id4G","AKnwCNe","AuLisfy","yKjQs0y","AfjHtwy","ANbvsMG","re9tsgS","ALLwsxa","zMXvA2u","t1bftG","BvPgwNC","y29jv2O","y3jLyxrLuMu","CMv0CNLdB3u","quDgBwS","qKfbsxa","zw50tgLZDgu","C21oCKe","B3bLBIa","tKrYzfy","quPUA1q","Dhj1y3rVCIa","Aw9gsgq","DgHHBIbSB2m","uhb4sei","AwnNwhC","thngD00","AefJA01LC3m","y29UDgv4Da","Dg9iyxnO","zsbHihn0CMK","z3POrMG","CMvZzxrdB3u","D2Toz3e","wMnzzum","qvrAq28","x3bPBMDqB24","yvP4Eum","Cg9Nv1K","y3vYC29Yx2y","rKLmrv9ot1q","yxrLq291BNq","BLLftKi","vxP2B20","sxbfAKm","Ag5vCeS","DLblv0u","EgD6vMK","Dw5RBM93BIa","BLv3vLq","z2v0sxrLBq","nNW4FdL8nhW","DNnirgu","DgPftg0","Cefeqxu","DNLgEvy","A0r6txm","DvjjEhi","zcWGDw5RBM8","BLzYqvu","DLjtCM0","zwnVBM5Ly3q","v2LOs3y","zxbUq3i","yLLArg8","zwvKzwq","v1fZDfK","y3jLyxrLrxi","shrgzxy","y2XLyxjtDg8","D3jPDgvvAw4","wMvMBhq","Dfvgu1q","AKPbsNO","C2jfBg8","AvnSEwK","DhvMDg0","vvHiA1K","yw5Nzq","ugfpsw4","Dg9Y","zNjVBuj5Dgu","zw5JB2rPBMC","uuLjA3a","vurpzhm","rxjYB3jdB2q","zgvJB2rLzey","C2v0zgi","Chjcree","y2HnyxHdB3u","tgvdEKK","y29SBM8","t1b3Eu4","zw1PDa","t1juzxa","zxjYtxnN","rMvVBfu","D0fxrLC","yxvyCha","r3DeCgS","B25TzxnZywC","zNDZxZeUmc4","yxv0BW","qKHtr0W","D2jhB2i","wuvRr1K","Dgv4Dc9WBge","uMj4qvG","AwrI","CKLTCLC","C2fNzq","tM90BKS","tfzwA1C","AhfWq1C","ywDLsgLKzq","Dg1nyxq","y25TyK8","nhW1Fdj8mxW","DgfYz2v0","CvjQqwm","zxrxB3jRq2G","s2jYwxe","AenSB3nLrxy","tKTnDfu","z1rNyuG","sLnptLa","qLPNDKu","DwnYvMm","Cgf5Bg9Hzeu","BeTXs2e","DvfWqMO","DhLWzq","DhHkteO","ywrK","y1jkB3O","sezhu1C","EK1bELq","ywDL","tKfusvzfx0u","ALfUq2m","ugvmvNy","DxbKyxrLq3u","C3jJ","BgDozMu","vw5Oyw5KBgu","CLf6CxO","ANL1vum","x2rLyNvN","C0zMqvi","m1jlEM9ZAa","z2vjBMzVu3K","CMHqA1a","CgvZweq","Ahr0Ca","DxLJwvK","q09oveLovuu","BKLTy1e","BMrWB2LUDfq","z2v0qwXS","wKnLzxG","EfrVDgy","Dw5ZAwDUzwq","qK1zB0W","uxb0z1i","DM5fCxK","BM93","BNPHvve","wePWBNK","igzHAwWSig0","uerVqLG","r1nmywG","q0nIsuS","zw5HyMXLuw8","AhDAs2O","mdaWma","AhzZz1a","mti3mZK3mdDuAMPHywS","CMvHC29U","sfjXrhy","qwjVCNrfCNi","u3z5yKe","qxHnswO","u3PPz2i","ywrKt25L","ufHcsuC","EvjLy29UBMu","Dgv4DfbHEwW","wNbRAfC","y291BNq","CMvHzhDYAxq","zfjlCve","DM5grgq","ANzAyNG","z3z5BNC","rvHjCKC","wK5PtgW","EgL4BKS","D2zLCLK","ren0uvG","ywTezLe","yMXXzMC","wKPgDgC","yMLUza","ChbL","CfbgBhC","DhjPzxmGCMu","CxjAzwm","ugn3zKu","BwvZC2fNztO","q2fdtMG","x29UvgLTzw8","zw1LBNq","wfDOveG","BfPiChq","CefPA0G","wLjevNq","C2XPy2u","Cffuzg0","mhW0Fdn8mNW","DMfSDwvZ","uxHjteW","ywDgC1a","zNjVBNrPzxi","zxHWB3j0CW","AvjUrgO","AK5uzKC","tKLKC1u","B3Hiq2q","DhjHBNnHy3q","x3fVC0rc","C3vJy2vZCW","qwPpCeu","yvD1sLy","CMfSy0y","AgfZt3DUuhi","x21LC3nHz2u","rNjVBNrPzxi","DM50rhu","AvHJB1q","wwv2uw4","Du1VAM4","zxjFDhrS","C2v0","C2nYAxb0","CfrPtu0","DcbSAw1PDa","twrIr00","CgfNzxnOB3C","swjywMW","zw5XDwv1zq","uhzQvKC","BMzKDge","x2rYB3bhBg8","sMvoy08","A2v0ignVBNm","B3nLrxzLBNq","zufJAW","y29Uy2f0","s2XOC28","B01orvK","vgLvC3u","AgfUz2u","DgvZDa","AwXSihvZzsa","wxvyDNK","DeLUDgvYy2u","rxzLBNq","B3jL","EKXJt1O","DxbNCMfKzw4","rxr3ueO","vKzHyxm","rvDtthC","yMLUyxj5","CgLUz19VBMm","AxnszwfKEq","vMXIvNa","u3rYyxrLz3K","yxnJCMLWDa","D3jPDgu","B25mAw5L","ALjeEKm","BhfPDeC","tgnQrwC","ihrPBwvZ","DgLTzw91DcW","yMfJA3vWigu","sLvxq2G","CNnVCL9Uyw0","CNnVCKzPBgu","tKLnuu8","A0rvDhC","C3rOr28","twHHzeG","C3rVCcbPBw0","D2LSBfjLy28","y3vYC29Y","zgvSzxrLrge","vKrYvhq","lcbTyxGGCMu","DgHLBG","z1rPBwvVDxq","EMP0CwG","vKnvuuy","B3rVAfa","zMDLDKO","zNLUu2y","A0zQzKq","t01jqui","ywD6wuu","Cu9Qtu0","C2v0q3vYC28","zw5KCg9PBNq","B25JBg9Zzq","zv90Aw1LB3u","CM92AwrLihy","A2vRzeC","CMvHzhLtDge","BxDOAuO","C0nVDw50zxi","x2TLEvbHDgG","B1zNDM4","Aw5KzxGGB3u","yxjYyxLIDwy","B3bLCNr5tMe","BwfUDwfSihi","uwPsvLa","CgfYC2u","AMP6DuO","rMfkAfa","shrSsLu","yxvxENO","zMvY","EvD0uMS","zM9YrwfJAa","v1PQBfm","C3rYAw5N","CMTftu8","zMzLCG","zgv2AwnLx2K","Dw50","CKXfr3m","zgvIDwC","ywrKq291BNq","AhrvCfq","vxDwu2e","mxW0Fdb8m3W","wvnQwuG","r2j2EuS","AwPAs28","BKjbA2y","BvbbDK8","C1LIAKe","AwXK","z2XTvvq","yxGGCMv0CMK","zxjYB3i","q0Xpu0LorW","Bhm6ia","rMD4vem","A0L1reC","x1fVu01HBMe","CfHwC2S","z2v0s2v5","rMv3tLu","u2HHCMvKv28","Chfsq2C","y2HLy2TdDxi","qKTUt2m","y3vYC29YlNm","zwn0","twvZv2G","r3zTy1u","Cg9W","wNDUAva","z01gBLe","vwfdzLG","uwnkvgG","sND5DMW","DxjS","sxHzwvO","AuXgBu0","CxPOrMi","EMfzr1i","v1zqqKm","yNvMzMvYzwq","tgXwCg4","vfLOs3q","mta5nZy0mgTbEufhEa","CfvLsxa","CgLUz09Uy2u","EvjWA2C","BhrPCgXLihq","AgfZ","zxjFCw9Z","vfzdv0u","AeH2yKG","zMLSDgvY","B2jQzwn0u3q","shbQExK","ywDLu2HVDW","z0fMs1O","ALLmtfK","EKLhzKi","x0vysvnu","wef3B3G","CLHpDwy","tNPqywy","tLvTA0m","BMToBu0","yw51Ce1LC3m","yK5IueG","qvrnELy","CMvUDevUzha","wvD5DMO","CMPqBw4","BLPuz0O","DhDVCMTdAge","vvLAv2i","x2HHBMrSzu8","ChrVCG","uLHZuNC","De9KBva","Cw9Zx18","t1ncBxG","DKjushG","CMvZB2X2zq","v0P4twe","Cefnz3u","ihrYEsbYzwm","uuP3rwu","t1bvs2G","Cw9Z","wMnJCxu","z2v0q3vYC28","DMvYC2LVBMm","Aw9Ul2PZB24","t0DkEMy","yMzQsK0","x2LUAxrqCM8","A2XhEwq","y3fUEgC","yLHSqLK","CNLgC24","ExfrEe4","thj3D1O","B25dBg9Zzq","Aw5PDcbrB1m","x25HDMLNyxq","BeHHBMrSzxi","BMrWB2LUDca","turRvwS","x3DZsw5ZDge","C2vUza","nxW0Fdn8nNW","BNruCMLLC0m","weX2ru4","vMfJsKO","Aw5KzxG","zg9Uzq","tfH6uve","sg9vBgW","C3bSAxq","DwfSzKO","C0neyMC","C29Tzq","De1dDgS","x2vUzhbVAw4","vNHHwgK","BfbhuM8","Bu1bqK8","BMvbv2G","tunVqK8","z2vY","tg55q0O","y29UDgLUDwu","y2XLyxi","CLj0Bu4","vfnrsvi","B25tDg9Wsw0","zfvSEum","swP6u3m","y2f0y2G","Evfvsgi","Cg9PBNrbBMq","vfHnAMW","Efrurw52","vwfLAvK","B0HYrLC","DxrMofDYAxq","t2Xqz0W","uLzHz3G","uMDIBKm","wxb1v1i","AxmGDw5Kzwy","CgXLyxnLiha","yxv0B21HDgK","yM9L","CMfNzvn5BMm","t2ruzw4","z3nOvui","we5jBNy","AM1LuxC","u2LJtxG","zMzMzG","B3v0sw50zxi","y2LRufy","r2rgs3y","DMfSDwu","DgvmB2Djre4","z2v0qwXSs2u","mJuWotnYveHPve4","CKvKCfa","ywXty29Wzq","zKX3q3m","teHjv3K","ueDKrva","se5gthi","B3jpBMXPBMu","Dg9oDw1Izxi","Dw5KzwzPBMu","zuLQCKG","C0f6C04","tg9Nsuq","B3bLCNr5","qMLwBgW","Eu9eBwC","tgLhCKG","x2fKzfDZtgK","rwjKEMO","teTkB2W","D1ngAwK","y2XVC2u","EfHAuLy","o2nOyxjZzxq","wKfor0e","u2DnvNm","zwD2tKu","vu5myMm","ueDHCwm","wM9qwKq","m3W2Fdb8n3W","C1bzvuW","z3Phrwm","x29WDgLVBNm","B2zM","zMLSzw5HBwu","shPVruK","z2v0","rwPeEgO","DxfXqve","zgvSzxrL","DfjUufq","sK5utgG","B0Dsq0e","B25nzxnZywC","rhHyreS","DMviBhK","BIWGAg9ZDg4","Dg9cExrLC0i","qMTiwK8","mtuYmJK5n2DJqxHJva","runlC2e","u2LVB0i","CKjYue0","vhDTBMS","CMLLC0nVDw4","EMDyrMO","BgvY","vffyBMW","AMrjEMi","thbgq1e","qM9lExm","yMLUyxj5vhK","tNrgCKm","uvL6yLe","wvP6Eue","CMvXDwLYzwq","wfjRrKC","C3rYAw5NAwy","EvDOr2K","rNHZsK8","sMjQrhy","tKjMEfe","CKrqDLe","zcWG","zMf1wvi","ruPSA1u","u1jUtwG","t2LXsuO","tvnZtu4","Cgu6ia","y3vYC29Yx24","sffMuhq","DMLJzuLeig8","CMr6ueS","uLLis3C","uvjcqum","ver6q0y","txn0Cfy","B2nxu3O","zw5fDMvUDa","qNDUCe0","zw50","DMfS","vhfsBuq","sKrNBuW","DMvY","q2jytwW","Dw1zzem","AKn2sMi","qujPyKW","zgjLtLq","BfrPBwvVDxq","q2zlBKC","EuzfvwK","DNfirfO","C2v0y3vYC28","txPTBeC","BezSDxnO","seDsyvy","rLjPyvm","qxjjD3i","BgLUzq","txfUB0y","AKfAzue","ENbtueW","Der4u2u","zhbZEwG","tez3qNC","Cu1eC2K","Aw47y2HHCNm","B1jsqwi","z2v0q3vYCMu","vfn2D0i","EvrXCw4","B0vnrhy","ywrKrxzLBNq","ENL1uuW","CKnxAe4","ig1LC3nHz2u","CNjVCK1LC3m","x2jPBMfYEvq","vu9ZsMu","ug9QBuO","zLLmuKq","z3HLzui","x3bPBMDmB3m","C3vIyxjYyxK","x3jLy29UBMu","yxffqNe","y2XVC2veqG","EefMrve","BefuBMm","Agn3CNG","DgLUzYbZzxi","vvf6vxa","zezJqNK","BfH5y0q","zNjVBunOyxi","DhDhqK0","C0XPC3rLBMu","yKLot0e","Bg9N","uLjpuG","z2TksgK","EM16Dvy","wffeqxu","CxL1vwq","y05Xvgy","DujQr3G","tgTnvem","DxbvrLe","z1bMBha","BgHHtKu","tK50t1i","zMvlyMO","ihbYB3rVy28","qu9XBw8","Bgzhq0G","zfHZwwK","BwvKAwf0zwW","ywDLrxzLBNq","swTNBvC","wKfJvhO","zNjVBujPDhm","BM9RDgC","y3r4","AMPzBKC","D0Dut28","CNzHBa","BwLUAvbYB2C","z2u6ia","sKnpt1u","y29UBMvJDca","DgjTCNy","EezOqxq","rfvlqLi","B3nLza","q2PxEvm","rLDt","Bwf4tg9ZC0m","q291BNq","q29Kzq","AgLNAa","CKnwrvy","x19LC01Vzhu","wvnwrMO","CMvJB25Uzwm","tg9NsurozxC","y3jLyxrLq2W","qKDQy0i","terUDu8","uxz5yMi","CNbUtKi","BMfTzq","ExPjC1i","x3jLywr5q2W","rNDrse4","ywXSzwqGBxu","vNz5u1m","CgLUz0XVC3m","CMvZDwX0","nhWZFdj8mhW","Dgv4Dc9Qyxy","wg1TCei","zgrAr2W","tfnSvMi","DfvUsuy","u0vXqxm","CxPjCLK","tg9JAW","Euvjt1q","y0HQELy","B25ozxr3B3i","BwvZ","tejdt2W","ihzHBgLKigq","ywHAuhe","qNHyBKG","BND2tKC","C3v6Buu","v0nqB2q","vw9HyNO","zvvYBa","rezpuM8","yxrHlcbKyxq","y29Kzq","wfbKrKi","wfbSqxi","CgvYC2LZDgu","rfzoueK","DefsAeG","D0vnuMe","B2rIBeG","mNWWFde","vfn3wwG","sw5Lwfa","Bg9NsurozxC","Aw9U","wMPRvwe","BMrLEa","yxnL","A0D2Dxu","ywX3yxLZ","BMXmrvm","m3WWFdj8nhW","rePivxq","svzOtgW","zxjFBxnNAwq","FdeXFdn8nxW","uKruvxq","r3zmsKm","B25SAw5L","tNbdCLi","Dev2zw50","sxnxBfq","vNfksu4","x2LZtwLUAvq","qLzwEhy","y3ruAw1LB3u","C0Xf","wLfnAuG","vKnwC1u","zvrKuLu","tLL6AKG","tgfdr0K","AgvKtwf4uMu","x2HHBMrSzva","BLH5yK8","zxq9DxrMltG","x3nLCuLK","yu1ABeS","zw9UvLK","zxH0zw5ZAw8","DuLiA0W","x2HHBMrSzvi","u0H4vfK","DuT5ENa","y0vhqxK","mtq1mta3mtzytwXLDu0","z3P5BuK","DMLqrfO","y29buxa","zgvS","vgLTzw91Da","z3rPsei","zNjHBwvuExa","Awfmzum","BwrRsgq","x29UrxjYB3i","vvnZseW","yNLL","zMX1C2HfEha","zgjMCxu","thvnBLO","yKPzC1C","CMvHzg9UBhK","BMCGzMfPBgu","yw1Srwy","x2DLBMvYyxq","BMv4DcGPigm","mNWXmhWWFdC","wfLHweW","ihjLy29UBMu","D0DeEeq","DhLdr2i","v1n4yMC","Bw5gBeG","t1bftL9fuLi","twvZC2fNzuu","r21Asfe","C3PmC00","sxHRshq","vffoEgK","Dfr5yMS","DhjPzxm","DMD0wgy","reHXBLm","yuDPuMm","x2nSzwfYvgK","B25szwnLAxy","uhn6yMq","ufPKuKq","CgLUz1rPBwu","s1DUt0u","BLjpALy","CMfTugfYyw0","tvzLvNu","DgLTzw91Da","B25LCNjVCG","CgXXvK8","s1zgEem","rxHeDwu","yxbWBgLJyxq","A1bfB1e","BwvZC2fNzq","D0jurKi","v2LUzg93","tLnHCMO","AwXLtMfTzq","Ewfsvfa","BxnN","B2nRzxq","zNzbrgy","uxPjC3m","A2v5","BML0AwfSAxO","twDhtfm","x2LZtwLUAvC","BNrLCG","BwvY","vwHyEw0","x2rPC2nVBM4","Ag5yuwi","yw1L","rwLyC1K","AxnrB1nnzxm","zg12D1e","y1DUsMu","mtbOwxngz28","D01OC08","D1rAA2K","zMzmAw5L","Bwf4uMv0CMK","qw1VDw50","z3jxrvi","ywn6uMK","ywnRx2nVzgu","Ae9Wzw5fDMu","EvjYrKm","rM14D1C","BMnVzgLUzW","zxjHDg9Y","y0DoDNC","oda0mtKYogHpDxrYtG","C3rVCMu","BMvY","zfjKt1u","De1HBMfNzxi","BMDuAw1LCG","uuPpwM0","C2n1t04","y3jLyxrLtwu","A25VuNm","Aw50zwDLCIa","zgPNz3C","BwfW","BMP4s2K","vePwC3a","u1rAA0W","zNjVBu51Bwi","twLZC2LUzYa","ywjVCNq","x2LUAxrhBg8","zhLpEha","uejnq1a","yMXcwNC","z2v0u3rVCMe","B3fHAKq","rvDOuvy","r1v6zge","AwDHDg9Yt24","B2ndrK0","tNfbsw0","AeHszwy","v2XmtNu","jMPZy2fSBgi","yMfSrxzLBNq","mtb8nhW3Fdy","tM9yy3q","Cun4Cfq","yKn2u3K","Aw9UvgLTzw8","ChHwuLu","C0DXDKK","CMvJzxzPzwq","B2XKvMvYC2K","x0rctMfTzq","x29UugfNzu4","CLjhvxu","ChjVDg90Exa","quPswvG","A3r4BKO","B3vUDa","BNbJz1m","yw5NueK","q09otKvdveK","Aw5JBhvKzxm","qw9fuNa","q01kD2y","CKDQzvC","Ag9SwKW","BxvYzhm","ENLwz1G","x2nSzwfYugK","rwD5zfG","y1bQEu8","zejnsKK","vfHbB1G","quf5uwi","yMDus24","zunLDwS","r3DKqxq","yw1Lu3bHy2u","C3rHCNq","q3rHEfO","CMTLCKDSB2i","Dg9VigXHCMC","ChjVy2vZCW","CYbPBNn0yw4","vK1pELO","CMvKDwnL","yNjpwey","yK9VzxK","zMXVB3i","B2f3uxq","DKjPDfy","x2LZqNjVD3m","BvPWCKG","yNvAELy","vwnOD0O","y0vLywu","x2rPC3bHDgm","DhjZtNe","wezrtLq","AwjRBvm","BMnLq2XVC2u","EMzuBfa","uvLWDe4","CfzzD3O","igfYCMf5yNu","s1HWs1C","qLnMvuG","t2vYs0O","t2HPtwi","sg1RyLm","BMvJDa","x2n1CNnVCKy","ign1CNnVCIa","CMfUzg9T","AgrjAxe","C3rLBMvYCW","rvHJsNm","BMCGB3iGyw4","y3L1ELe","yNvMzMvY","BwLUzW","zLzZwM4","yLr2ANC","rKvJvLq","C0TlsKW","zfH5DwW","A0zws0u","B2nRzxrtDwm","tgLZDgvUzxi","A2DKzLC","AMf4rhC","z29Sq00","v29tzei","BNLgqMi","AMvJDfn0B3i","y2uGBM90igK","A0XpvNe","yNL0zuXLBMC","Bxjjy2e","vMHlvxG","Ce9WD2i","x29Uq2XVC2u","DufhuMe","x21PBMLoyxy","lcbOB3n0BMe","y3vZDg9Tshq","mtH3yMLruvO","qxzkwMW","D24GCMvHC28","AevYCM9Yrxy","wNP3zw8","x2DLDeLUDgu","DxnLCKLW","ChjVDg9JB2W","A2rOshO","x3bPBMC","rwXmquu","DK1zze0","AMTWve8","qKjpCeC","x2zVCM1HDeu","u2TPCcbWyxm","y29UBMvJDeu","zfDVCMTLCKC","yxDmAfa","CvHRwwG","uuXcEhu","uhjPBwfYEuS","wvLTtg8","tNDby1q","wfDoC00","venxzeC","rerjBxe","s0nQEuy","Bwu6ia","CMvJzwL2zwq","yw5Hz2vY","CgLUz0LUDgu","DhnKr1C","zgvMAw5Luhi","AK51C1m","BxPyyuS","v0TVA20","Bwv0Ag9K","C2v0u3rVCMe","EfzXAw8","z3nes1q","u05vChu","t0rcB2O","v0Diy3a","uuLyu2u","EwnXr2W","DuTltLu","ihn1y2nLC3m","zgf0yq","yvbjBKS","CvH4D3O","yxfAt0K","rLjptLrjrvi","tgTUtwu","B2zJvwG","r0vYvuy","yKHbquy","sLnmt1a","Aw5Lza","vfDXEu8","DhjPBq","C3vIC3rYAw4","x2XPC3rLBMu","Bg9Nsurhzw4","CKrfv1u","ywnOzwq","AxnbCNjHEq","DuXSCMi","x3nVy2TLDa","wvLlBwO","D3j5tgK","yw1LoIa","qNPWCMu","AwP1CLO","DLzjuKW","mdaWmdaWmda","t2TtAK4","yMXZChK","s2TkzNK","EuTxC3O","ruzNvxO","ugvKEgW","tuvtu0fhrv8","BNrbBMrvCgq","vfb2vgi","CK9nze4","vgjqrgO","DvD5DvO","yKT2v1q","q1zdDLy","t3fbqLG","wfHwB3G","q05PCeK","l3DZl3yY","ANn1DvC","twD2ugW","EKvsy3K","B25Uzwn0Aw4","y3vYCMvUDeK","s2rgz3K","Dg9tDhjPBMC","qNDevKy","q3fpA04","CM92AwrLige","whbizxK","zw5JB2rLrNi","C0nktum","x3bYB3rVy28","x2nVBM5Ly3q","y2XVC2uSihC","DKPyy1y","C3nHz2vfDMu","t0XuAMG","ve9hqLa","C21ovfa","ywnRtxnNswq","qMvYvhq","sLLwBum","CwPtEuG","B2zMC2v0","ww1hzLa","rgvKAwnHDgu","r2zuve8","B3bLBG","AKDXBgu","EhjQEwm","zxjYtM8","rLr4D3K","txv4u1q","vvPzEMG","Aw5KzxHpzG","A2nKsNG","x29UtwvZC2e","CMvWBgfJzui","B25VCgvU","ihzHBgLKihm","vKzVzw4","wNrcrxe","D3LvweC","Chv0","uxjryxa","C0jf","Bg93","ru51uxa","C2v0sxrLBq","q29UzMLN","Cg9PBNrdB24","AwrTy20","x3nLBMrby2S","mhWZ","y2fSBa","BgrXB0e","ueXXC2m","y1v5rgG","zgLZywjSzue","y29UBMvJDgK","y2HnyxHuCMK","twPKsKS","Axfoy0K","t3DStuy","zNjVBuHHC2G","Ae1LC3nHz2u","q0zov0C","x2LZtM9Kzq","qxzovey"];return fn=function(){return r},fn()}var S=A;(function(r,e){let i=A,a=r();for(;;)try{if(parseInt(i(747))/1*(-parseInt(i(192))/2)+parseInt(i(385))/3*(parseInt(i(624))/4)+-parseInt(i(1652))/5+parseInt(i(1269))/6*(parseInt(i(797))/7)+-parseInt(i(1131))/8+parseInt(i(412))/9+-parseInt(i(1116))/10*(-parseInt(i(1036))/11)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(fn,719906);var Ya=Object[S(1302)+S(760)],Qa=Object["getOwnPr"+S(560)+S(971)],Qs=(r,e)=>function(){return r&&(e=(0,r[Qa(r)[0]])(r=0)),e},$a=(r,e)=>{let i=S,a={gzGEc:function(f,u,h,g){return f(u,h,g)}};for(var x in e)a[i(779)](Ya,r,x,{get:e[x],enumerable:!0})};function ex(){return Vs||(Vs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function tx(){let r=S;return Js||(Js=[IDBCursor[r(1177)+"e"].advance,IDBCursor[r(1177)+"e"][r(711)],IDBCursor.prototype[r(711)+r(1290)+"ey"]])}function nx(r){let e=S,i={dXuWe:"success",jNusS:e(592),tsdGW:function(x,f){return x(f)},TiUsu:function(x){return x()},WSxbg:function(x,f){return x instanceof f}},a=new Promise((x,f)=>{let u=e,h={qzIrY:function(b,D){return i[A(1301)](b,D)},WVpTW:function(b){return i[A(496)](b)}},g=()=>{let b=A;r[b(1682)+b(252)+b(1133)](i.dXuWe,_),r[b(1682)+b(252)+"ner"](i[b(1303)],w)},_=()=>{let b=A;x(h[b(966)](ve,r[b(958)])),g()},w=()=>{let b=A;f(r[b(592)]),h[b(1559)](g)};r.addEventListener(i.dXuWe,_),r[u(873)+u(1251)](u(592),w)});return a.then(x=>{let f=e;i[f(1063)](x,IDBCursor)&&xr[f(478)](x,r)})[e(718)](()=>{}),dn[e(478)](a,r),a}function rx(r){let e=S,i={fEoSa:function(x,f){return x(f)},nsRGk:e(415)+"or",lqrBt:function(x){return x()},AntqD:"abort",MqnoF:e(1547),LDnuO:e(592)};if(un.has(r))return;let a=new Promise((x,f)=>{let u=e,h={ucrVc:u(1547),YmGfP:u(592),LENGX:i.AntqD,xBanD:function(b){return i[u(1439)](b)},GepcG:function(b){return i[u(1439)](b)}},g=()=>{let b=u;r[b(1682)+b(252)+b(1133)](h[b(363)],_),r[b(1682)+b(252)+b(1133)](h[b(1389)],w),r[b(1682)+b(252)+b(1133)](h.LENGX,w)},_=()=>{let b=u;h.xBanD(x),h[b(1541)](g)},w=()=>{let b=u;i[b(1540)](f,r.error||new DOMException(b(415)+"or",i.nsRGk)),i[b(1439)](g)};r[u(873)+u(1251)](i[u(860)],_),r[u(873)+"Listener"](i[u(948)],w),r["addEvent"+u(1251)](u(1149),w)});un[e(478)](r,a)}function sx(r){ln={zyuQL:function(a,x){return a(x)}}[S(874)](r,ln)}function ix(r){let e=S,i={WXxfO:function(a,x){return a===x},YYKmj:"qSwGE",XpHey:function(a,x){return a(x)},bYZDo:function(a,x){return a(x)},mFGjz:function(a,x){return a(x)},dRdOU:function(a,x){return a(x)},eCeuk:function(a,x){return a(x)},ArIwr:function(a,x){return a===x},kPoba:function(a,x){return a in x},XfSSv:e(634)+e(1493)};return i[e(858)](r,IDBDatabase[e(1177)+"e"][e(464)+e(995)])&&!i[e(207)](i.XfSSv,IDBTransaction[e(1177)+"e"])?function(a,...x){let f=e;if(i.WXxfO(i[f(1338)],i[f(1338)])){let u=r[f(1419)](i[f(1373)](Ct,this),a,...x);return ar[f(478)](u,a.sort?a.sort():[a]),i.XpHey(ve,u)}else return(this._listeners[_0x2e5178]||(this._listeners[_0x266d78]=[]))[f(158)]({fn:_0x2f5a89,ctx:_0x4bbd0d||this}),this}:tx()[e(1184)](r)?function(...a){let x=e;return r.apply(i[x(300)](Ct,this),a),i.mFGjz(ve,xr.get(this))}:function(...a){let x=e;return i[x(1134)](ve,r[x(1565)](i[x(1198)](Ct,this),a))}}function ox(r){let e=S,i={Szigb:function(a,x){return a===x},pzluu:"function",RXsRw:function(a,x){return a(x)},NLTwB:function(a,x){return a instanceof x},tjELm:function(a,x){return a(x)},klGyd:function(a,x,f){return a(x,f)},dYmlX:function(a){return a()}};return i[e(418)](typeof r,i.pzluu)?i[e(657)](ix,r):(i[e(1462)](r,IDBTransaction)&&i[e(289)](rx,r),i[e(676)]($s,r,i[e(1596)](ex))?new Proxy(r,ln):r)}function ve(r){let e=S,i={Upfbn:function(x,f){return x(f)},IpESE:function(x,f){return x!==f}};if(r instanceof IDBRequest)return i[e(1573)](nx,r);if(xn[e(629)](r))return xn[e(784)](r);let a=i[e(1573)](ox,r);return i[e(197)](a,r)&&(xn.set(r,a),dn[e(478)](a,r)),a}var $s,Vs,Js,xr,un,ar,xn,dn,ln,Ct,Xs=Qs({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={lqitG:function(i,a){return i===a},KPysf:function(i,a){return i>>>a},FLlnj:function(i,a){return i|a},mrIca:function(i,a){return i<<a},tHgvS:function(i,a){return i>>>a},DVNPI:function(i,a){return i|a},yEIOT:function(i,a){return i<<a},yRrFC:function(i,a){return i<<a},MuxST:function(i,a){return i<=a},YevQn:function(i,a){return i&a},dTkxx:function(i,a){return i>=a},xmLAR:function(i,a){return i|a},ndrDg:function(i,a){return i<<a},IsWlT:function(i,a){return i&a},AGFmk:function(i,a){return i-a},HkcZF:function(i,a){return i<<a},bJFbU:function(i,a){return i+a},jgieK:function(i,a){return i instanceof a},AJnkT:function(i,a){return i!==a},SRnMh:r(1050),SbuMm:r(695),gQzcf:r(634)+"oreNames",OhHSA:r(952),fVsZn:r(1132),AvNTF:function(i,a){return i(a)},dvfIl:r(1318),ruUoU:r(1678),xboCT:function(i,a){return i===a}};$s=(i,a)=>a[r(701)](x=>i instanceof x),xr=new WeakMap,un=new WeakMap,ar=new WeakMap,xn=new WeakMap,dn=new WeakMap,ln={get(i,a,x){let f=r,u={jSrBD:function(h,g){return h<g},zmzuV:function(h,g){return e[A(1397)](h,g)},tyCGb:function(h,g){return e[A(968)](h,g)},SEqAs:function(h,g){return e[A(475)](h,g)},hzJLk:function(h,g){return e[A(1530)](h,g)},IxYYZ:function(h,g){return h<g},gSMNA:function(h,g){return e[A(987)](h,g)},pAMgu:function(h,g){return e[A(1684)](h,g)},SNUpu:function(h,g){return e.ndrDg(h,g)},tOhhu:function(h,g){return e[A(1012)](h,g)},ZtBEq:function(h,g){return h&g},dyOxp:function(h,g){return e[A(250)](h,g)},dllHM:function(h,g){return h|g},YSjYH:function(h,g){return e.xmLAR(h,g)},LHIWy:function(h,g){return h&g},qZbSk:function(h,g){return e[A(1592)](h,g)},VxaXi:function(h,g){return e.bJFbU(h,g)}};if(e[f(1457)](i,IDBTransaction))if(e[f(256)](e[f(824)],"dbfqu")){if(_0x566d27-_0x5bbffb<1)return"";let h="";for(let g=_0x5c24e7;u.jSrBD(g,_0x14775f);){let _=_0x45f0b1[g++];if(u[f(902)](_,127))h+=_0x239354["fromChar"+f(939)](_);else if(_>=192&&_<224)h+=_0x12edbf[f(895)+f(939)](u[f(1062)](u[f(965)](31,_),6)|u.SEqAs(63,_0x3c942d[g++]));else if(u[f(1664)](_,224)&&u[f(616)](_,240))h+=_0x2acb67["fromChar"+f(939)](u.gSMNA(u[f(664)]((15&_)<<12,u[f(1310)](u.tOhhu(63,_0x499855[g++]),6)),u[f(1406)](63,_0xd589ca[g++])));else if(u[f(1664)](_,240)){let w=u[f(1151)](u.dllHM(u[f(583)](u[f(1310)](u[f(965)](7,_),18)|u[f(1310)](u[f(751)](63,_0x37dd01[g++]),12),u.qZbSk(u.ZtBEq(63,_0x3f1029[g++]),6)),u.tOhhu(63,_0x3a5c90[g++])),65536);h+=_0x241ada[f(895)+f(939)](55296+(w>>10)),h+=_0xc7e6f3["fromChar"+f(939)](u[f(704)](56320,u[f(1406)](1023,w)))}}return h}else{if(e[f(518)](a,e.SbuMm))return un.get(i);if(a===e.gQzcf)return e[f(518)](e.OhHSA,f(952))?i["objectSt"+f(1493)]||ar[f(784)](i):e[f(518)](_0x30b2cb,_0x44b74c)?_0x50c19c:new _0x3a3550(e[f(1617)](e[f(165)](_0x87b9d2.call(_0x46699c,0),_0x4d9078[f(1419)](_0xd3e1c0,1)<<8)|e[f(1261)](_0x454aae.call(_0x5527e0,2),16)|e.mrIca(_0x19ee11[f(1419)](_0x924044,3),24),0),e.tHgvS(e[f(987)](_0x1c94ef.call(_0x21748b,4)|e.yEIOT(_0x33b3a0[f(1419)](_0x15f1fb,5),8),e.yEIOT(_0x1030f9.call(_0x4f0d82,6),16))|e[f(1126)](_0xd07672[f(1419)](_0xca6b8a,7),24),0),!0);if(a===e[f(1244)])return x[f(634)+"oreNames"][1]?void 0:x[f(634)+f(503)](x[f(634)+f(1493)][0])}return e[f(1433)](ve,i[a])},set(i,a,x){let f=r;if(e.dvfIl===e[f(186)])this[f(1014)+"T"]||this[f(1105)+"X"]?this._onPageNetWorkChange():this[f(1214)+"er"]&&this[f(1150)+f(1164)+f(1251)]();else return i[a]=x,!0},has(i,a){let x=r;return e[x(1457)](i,IDBTransaction)&&(e[x(518)](a,e[x(1608)])||e.xboCT(a,e[x(1244)]))?!0:a in i}},Ct=i=>dn[r(784)](i)}}),ei={};$a(ei,{deleteDB:()=>xx,openDB:()=>ax,unwrap:()=>Ct,wrap:()=>ve});function ax(r,e,{blocked:i,upgrade:a,blocking:x,terminated:f}={}){let u=S,h={pTaLa:function(w,b,D,k,B){return w(b,D,k,B)},ZcYeC:function(w,b){return w(b)},VacJJ:function(w,b){return w!==b},GGdzs:u(519),ePSbi:u(768),oxHCd:u(671)+u(497),EXcJs:function(w,b){return w(b)},TaNQU:u(505)+u(301),QIXSe:u(210)},g=indexedDB[u(1392)](r,e),_=h[u(1239)](ve,g);return a&&g[u(873)+u(1251)](h[u(1712)],w=>{let b=u;h.pTaLa(a,ve(g[b(958)]),w[b(1173)+"on"],w.newVersion,h[b(270)](ve,g[b(464)+b(995)]))}),i&&g["addEvent"+u(1251)](h[u(1313)],()=>i()),_[u(536)](w=>{let b=u;h[b(693)]("Jujlv",h[b(199)])?(f&&w[b(873)+b(1251)](h.ePSbi,()=>f()),x&&w[b(873)+"Listener"](h[b(463)],()=>x())):this["_addWsLi"+b(1238)]()}).catch(()=>{}),_}function A(r,e){r=r-148;let i=fn(),a=i[r];if(A.QEaNOK===void 0){var x=function(g){let _="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",w="",b="";for(let D=0,k,B,N=0;B=g.charAt(N++);~B&&(k=D%4?k*64+B:B,D++%4)?w+=String.fromCharCode(255&k>>(-2*D&6)):0)B=_.indexOf(B);for(let D=0,k=w.length;D<k;D++)b+="%"+("00"+w.charCodeAt(D).toString(16)).slice(-2);return decodeURIComponent(b)};A.uKEGeY=x,A.oTWxpg={},A.QEaNOK=!0}let f=i[0],u=r+f,h=A.oTWxpg[u];return h?a=h:(a=A.uKEGeY(a),A.oTWxpg[u]=a),a}function xx(r,{blocked:e}={}){let i=S,a={kekdG:function(f,u){return f(u)}},x=indexedDB[i(533)+"tabase"](r);return e&&x.addEventListener(i(210),()=>e()),a[i(552)](ve,x)[i(536)](()=>{})}function Zs(r,e){let i=S,a={lZHpt:function(g,_){return g||_},MgGLS:i(1572),YnFio:i(425)+"e",IneXP:i(1053),EgydX:function(g,_){return g instanceof _},zLcOZ:function(g,_){return g in _},EEPTD:function(g,_){return g===_},VhKUx:i(572),zpSPL:function(g,_){return g!==_}};if(!(a[i(1192)](r,IDBDatabase)&&!a[i(504)](e,r)&&a.EEPTD(typeof e,a[i(1262)])))return;if(cn.get(e))return cn[i(784)](e);let x=e[i(1564)](/FromIndex$/,""),f=a[i(862)](e,x),u=ni.includes(x);if(!a[i(504)](x,(f?IDBIndex:IDBObjectStore)[i(1177)+"e"])||!(u||ti[i(1184)](x)))return;let h=async function(g,..._){let w=i;if(a[w(1104)]!=="hGFkZ"){let b=this[w(465)][w(1154)+w(386)+"nc"](this[w(1663)]),D=_0x20d5b4.parse(a[w(449)](b,"{}"));return _0x553839[w(455)](D)}else{let b=this[w(464)+w(995)](g,u?a.YnFio:a[w(993)]),D=b.store;return f&&(D=D[w(694)](_[w(194)]())),(await Promise[w(1460)]([D[x](..._),u&&b.done]))[0]}};return cn[i(478)](e,h),h}var ti,ni,cn,cx=Qs({"node_modules/idb/build/index.js"(){let r=S,e={DgQOj:r(599),KFKFC:r(394),nVUwm:"getAllKeys",MaBIv:"count",bHAAF:function(x,f){return x(f)},XQDAu:r(787),fNQTI:r(712),rGjeW:function(x){return x()}},i=(r(1576)+r(1580))[r(698)]("|"),a=0;for(;;){switch(i[a++]){case"0":Xs();continue;case"1":cn=new Map;continue;case"2":ti=[r(784),e.DgQOj,e[r(1455)],e.nVUwm,e.MaBIv];continue;case"3":e[r(1325)](sx,x=>({...x,get:(f,u,h)=>Zs(f,u)||x[r(784)](f,u,h),has:(f,u)=>!!Zs(f,u)||x[r(629)](f,u)}));continue;case"4":ni=["put",r(369),e[r(903)],e.fNQTI];continue;case"5":e[r(1187)](Xs);continue}break}}}),fx={idb:function(r){let e=S,i={OZAOP:e(1661)};r[e(459)]=Promise[e(662)]()[e(536)](()=>(cx(),ei))[e(536)](function(a){let x=e;return i[x(1554)]!=="DvILv"?(_0x564616+=_0x4a4c6e&&_0x3fcb16[x(1260)+"th"]||0,_0x35b88d):a})}},Ys={};function ye(r){var e=Ys[r];if(e!==void 0)return e.exports;var i=Ys[r]={exports:{}};return fx[r](i,i.exports,ye),i.exports}ye.d=(r,e)=>{let i=A;for(var a in e)ye.o(e,a)&&!ye.o(r,a)&&Object[i(1302)+i(760)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;ye.o=(e,i)=>Object[r(1177)+"e"][r(470)+r(760)][r(1419)](e,i)})(),(()=>{let r=S,e={gqKxw:function(i,a){return i!=a},LBCOl:r(942)+"le"};ye.r=i=>{let a=r;e[a(168)](a(756)+"d",typeof Symbol)&&Symbol.toStringTag&&Object[a(1302)+a(760)](i,Symbol[a(1369)+a(1704)],{value:"Module"}),Object[a(1302)+a(760)](i,e[a(972)],{value:!0})}})();var G={};(()=>{let r=S,e={XWNsM:function(s,t){return s+t},roXfk:function(s,t){return s+t},VMOzZ:function(s,t){return s+t},PvjVG:function(s,t){return s*t},pUeIp:function(s,t){return s(t)},BKnOc:function(s,t,n){return s(t,n)},uBjGx:function(s,t){return s+t},IVhLl:function(s,t){return s(t)},eVZLT:function(s,t){return s|t},YYmLo:function(s,t){return s&t},cEeae:r(172),TtByf:r(1443),TcYQJ:r(410),OCInP:r(740),sFfAR:function(s,t){return s+t},mkEzu:function(s,t){return s===t},bGkJy:function(s,t){return s(t)},MSsMN:r(1344)+r(1344)+r(1344)+r(1344),tOdmP:function(s,t){return s>=t},bINOA:r(959)+"1",flUke:function(s,t){return s!=t},jYLLY:function(s,t){return s>t},gPflp:function(s,t){return s<t},rDPvQ:function(s,t){return s!==t},NqAIm:"QEDVe",HQfPt:function(s,t){return s>t},rPfsL:function(s,t){return s!==t},VlbVp:function(s,t){return s-t},TQdhW:r(1348),cUyDh:r(1156),PLqsc:"kNgCR",TXMjl:function(s,t){return s===t},xVqio:function(s,t){return s<t},CFNWG:function(s,t,n){return s(t,n)},IynnF:function(s,t,n,o){return s(t,n,o)},MDmxy:function(s,t){return s!==t},rBrPM:function(s,t){return s===t},LpFCQ:r(1117),bTvjw:function(s,t,n){return s(t,n)},LXzQQ:function(s,t){return s>>>t},feKbj:function(s,t,n){return s(t,n)},cHjzV:function(s,t){return s&t},OMIAB:r(1148)+r(813)+r(1606)+"key",JCOOU:function(s,t){return s===t},XRfDe:r(1148)+r(813)+r(1606)+"value",wyUXG:function(s){return s()},fgevJ:function(s,t){return s!==t},TXAoX:function(s,t){return s<<t},jCvJb:function(s,t){return s|t},iSlyi:function(s,t){return s|t},IpEjC:function(s,t){return s&t},rdzPK:function(s,t){return s<<t},vJXcV:function(s,t){return s<=t},tKdHV:function(s,t){return s!==t},GmZHQ:function(s,t,n){return s(t,n)},arQwf:function(s,t,n){return s(t,n)},gkJHi:function(s,t){return s(t)},EJlkU:function(s){return s()},ijurZ:function(s,t,n){return s(t,n)},ORTep:function(s,t){return s(t)},lXycD:function(s,t){return s!==t},AAyQb:function(s,t,n){return s(t,n)},sGqvI:function(s,t){return s!==t},txJLJ:function(s,t){return s!==t},QzIss:function(s,t,n){return s(t,n)},UZYzh:r(381),kLOVq:r(1449),vBTHx:function(s,t,n){return s(t,n)},Zzweo:function(s,t,n){return s(t,n)},TOGBP:r(572),pqRCg:function(s,t){return s&t},GwdAt:function(s,t){return s>>>t},scuON:function(s,t){return s<t},IxkHt:function(s,t){return s|t},iLFmM:function(s,t){return s<t},MCsct:function(s,t){return s|t},pxVRU:function(s,t){return s===t},UYZWb:"gDtzB",cOXau:r(726),JazHA:function(s,t){return s!==t},pdCeM:r(274),TCWdG:r(261),ATMzV:function(s,t,n){return s(t,n)},iqNcI:function(s,t,n){return s(t,n)},DKRHp:function(s,t){return s(t)},XmmpB:r(1148)+r(813)+r(1606)+r(175),xPUze:function(s,t){return s+t},UXHkY:r(1386),WJxMa:"AGzlm",akDfQ:function(s,t){return s(t)},PTziB:function(s,t){return s+t},ECKsa:"Unimplem"+r(1673)+r(827),CCbIK:function(s,t){return s>>t},rXOuf:function(s,t){return s|t},GXeBn:function(s,t){return s!==t},QptgR:"heYwZ",cyuzQ:function(s,t){return s===t},auXpp:function(s,t){return s>=t},CqOkN:function(s,t){return s+t},RgbnC:function(s,t){return s>t},osRnb:function(s,t){return s+t},wdYxl:"Read past limit",tTybk:function(s,t,n){return s(t,n)},zgXFj:function(s,t){return s+t},npcgS:function(s,t,n){return s(t,n)},IbIld:function(s,t){return s===t},TqRmD:function(s,t){return s(t)},DTlZw:function(s,t){return s>=t},EiXsY:function(s,t){return s+t},pADAu:function(s,t){return s+t},qXkYh:function(s,t){return s&t},WlLNu:function(s,t){return s!==t},tmMat:"dRhgE",GErUF:r(925),gChII:function(s,t){return s|t},ocWSz:function(s,t){return s<<t},PeLVv:function(s,t){return s<t},jAZeA:function(s,t){return s==t},BMYoL:function(s,t){return s>=t},NFYik:function(s,t){return s&t},TSwYh:function(s,t){return s<<t},CNipI:function(s,t){return s|t},iIHHV:function(s,t){return s|t},lhaNE:function(s,t){return s<<t},VDrTt:function(s,t){return s<<t},iJnvk:function(s,t){return s&t},PDoBX:function(s,t){return s&t},mPAvO:function(s,t){return s<t},sAzsN:function(s,t){return s>=t},DHqnS:function(s,t){return s+t},Zccqu:function(s,t){return s+t},UaeiY:function(s,t){return s+t},VZwwU:function(s,t){return s|t},LaCGI:function(s,t){return s<<t},IkgmW:function(s,t){return s&t},XNInv:function(s,t){return s&t},OvBAw:function(s,t){return s<<t},PXBIG:function(s,t){return s&t},BVVxv:function(s,t){return s>t},VqPXQ:function(s,t,n){return s(t,n)},owIIX:function(s,t){return s>>t},blspy:function(s,t){return s|t},blBZw:function(s,t){return s<<t},jjYnG:function(s,t){return s|t},uRIxr:function(s,t){return s<=t},oQHwD:function(s,t){return s<t},zaYGR:function(s,t){return s+t},PSopV:function(s,t){return s-t},JbjDv:function(s,t,n){return s(t,n)},WZgXr:function(s,t,n){return s(t,n)},uMGeh:function(s,t){return s!==t},qMDsi:function(s,t){return s<=t},XFQNT:function(s,t){return s<t},OGJzf:function(s,t){return s|t},uIHkL:function(s,t){return s!==t},FewNU:r(639),mdkHd:function(s,t){return s|t},oaiBL:function(s,t){return s|t},ZCeex:function(s,t){return s>>t},fynSf:function(s,t){return s|t},noktg:function(s,t,n){return s(t,n)},EjDxj:function(s,t){return s+t},Oywtc:r(733),OPUKh:r(439),ExDue:"ZNiLl",KkJfy:function(s,t){return s>=t},fwTUj:function(s,t,n){return s(t,n)},ZwniP:function(s,t){return s(t)},BZgvE:function(s,t){return s(t)},fauYR:function(s,t){return s<<t},eWees:function(s,t){return s(t)},ahZPq:function(s,t){return s&t},BoKys:function(s,t){return s<<t},AqpdN:function(s,t){return s&t},KCjyF:function(s,t){return s&t},LFwBw:function(s,t){return s(t)},QRBAC:function(s,t){return s&t},LiGrH:function(s,t){return s(t)},MesWh:function(s,t){return s&t},NzPaf:function(s,t){return s|t},yWhGi:function(s,t){return s<<t},iVUBA:function(s,t){return s<<t},XtLlX:function(s,t){return s>>>t},UQzUp:function(s,t){return s|t},IjzSs:function(s,t){return s>>>t},buZzV:function(s,t){return s===t},veHly:function(s,t){return s===t},zMAzT:function(s,t){return s<t},NXscO:function(s,t){return s<t},KZNCS:function(s,t){return s<t},EWSLw:function(s,t){return s+t},cmhjd:function(s,t){return s&t},dFcBy:function(s,t){return s!==t},FxsJO:function(s,t){return s&t},qyuUd:function(s,t){return s+t},CbAwi:function(s,t){return s!==t},PiPlB:function(s,t){return s|t},AyBKx:function(s,t){return s>>>t},BHSGL:function(s,t){return s+t},Hpjyy:function(s,t){return s>>>t},KWnOE:function(s,t){return s&t},AvJZl:function(s,t){return s+t},uKyzp:function(s,t){return s!==t},UOsJe:function(s,t){return s>>>t},LlVpn:function(s,t){return s|t},QjRVP:function(s,t){return s&t},ZJFtg:function(s,t){return s+t},HyLuH:function(s,t){return s|t},rDEWU:function(s,t){return s>>>t},amlEf:function(s,t){return s>>>t},NxVKJ:function(s,t){return s&t},Kfzcw:function(s,t){return s>>>t},YZzyA:function(s,t){return s!==t},PaOIn:function(s,t){return s|t},uKKNU:function(s,t){return s&t},wBTFB:function(s,t){return s(t)},dGMlH:r(1336),WrZEO:r(278),MVeVu:function(s,t){return s|t},CjWyS:function(s,t){return s|t},CshWn:function(s,t){return s|t},gshUB:function(s,t){return s<<t},LnyCJ:function(s,t){return s<<t},BmhBj:function(s,t){return s|t},OqABX:function(s,t){return s|t},HzoEI:function(s,t){return s<<t},cPjyO:function(s,t){return s|t},qzhFb:function(s,t){return s|t},ktxnJ:function(s,t){return s<<t},OPwyN:function(s,t){return s<<t},HFzSM:function(s,t){return s!==t},lfGCH:r(468),bBjKF:function(s,t){return s&t},HoUll:function(s,t){return s>>>t},nzaUQ:function(s,t){return s>>>t},awLhP:function(s,t){return s&t},VjHTD:function(s,t){return s&t},LpVGL:function(s,t){return s>>>t},Tkigq:function(s,t){return s&t},WihKv:function(s,t){return s>>>t},YsWKX:function(s,t,n){return s(t,n)},WVPBC:r(1144),vnFDd:function(s,t){return s>=t},golCM:function(s,t){return s%t},FwQHN:function(s,t){return s/t},gzymI:function(s,t){return s*t},iRZoM:function(s,t){return s>>>t},Bzpre:function(s,t){return s>>>t},rRGUu:function(s,t){return s===t},ZANGA:function(s,t){return s>>>t},ddZGl:function(s,t){return s&t},TPvTb:function(s,t){return s>>>t},yaRTP:function(s,t){return s&t},VFoen:function(s,t){return s+t},ankgM:function(s,t){return s>>>t},GWOCB:function(s,t){return s+t},RDTUt:function(s,t){return s>>>t},eonVY:function(s,t){return s+t},zpOMU:function(s,t){return s<<t},ZNzdn:function(s,t){return s|t},oGRCA:function(s,t){return s<<t},Pwien:function(s,t){return s!==t},EtwPJ:function(s,t){return s===t},xgzVi:function(s,t){return s===t},VFaas:function(s,t){return s===t},dOVuE:function(s,t){return s+t},BkHZO:r(1567),ofcUh:r(1068),iaLeC:function(s,t){return s&t},dbeNT:function(s,t){return s>>>t},xixnK:function(s,t){return s&t},MDvhx:function(s,t){return s>>>t},OwlMF:function(s,t){return s&t},FrDmW:function(s,t){return s>>>t},sthGo:function(s,t){return s>>>t},HmkbS:function(s,t){return s>>>t},NNtOR:r(353)+r(1418),smNTP:r(1065)+"OR",LSlVb:r(1351)+r(1458),OnZGd:"MAX_RETR"+r(1562)+"R",ZpkhW:r(374)+"RROR",ldbGQ:r(1183)+"NG_ERROR",elZJZ:r(1645),PcwfE:r(690)+r(991),qjSyH:r(1498)+"3",bJYsW:function(s,t){return s===t},tUFST:function(s,t){return s-t},tMCtk:r(981),eIjrH:function(s,t){return s===t},vgtXf:r(592),RxCoB:function(s,t){return s instanceof t},UhXym:function(s,t){return s+t},cVTDI:r(380)+r(1450),yIkrL:function(s,t){return s===t},eYDWQ:r(644),uhnnT:"lfURi",NpCrR:function(s,t){return s===t},BodbC:function(s,t){return s<t},yFEUi:function(s,t){return s===t},TutIx:r(871),UfTUQ:r(881),aqZOI:"close",oHrFW:r(1683),NSarj:"open",gAfKZ:r(1092),pVYwz:function(s,t,n){return s(t,n)},JeNcO:r(510)+r(1633)+"s",ZoPZD:r(466),ixuDo:function(s,t,n){return s(t,n)},RYHKw:function(s,t,n){return s(t,n)},TWqyO:function(s,t){return s instanceof t},NfYVZ:"wcLPZ",ImPDC:r(319),FfNFd:function(s,t,n,o,c){return s(t,n,o,c)},PuvNZ:function(s,t){return s(t)},kwKNC:r(1038),MdbGM:r(529),FEcVT:function(s,t){return s===t},mzXaK:r(1059),sCJMC:r(1048),QcJTh:r(1468),Uzvom:function(s,t){return s||t},dXyul:function(s,t){return s||t},jNTfG:function(s,t){return s!=t},OkSjN:"1|4|3|0|2",zwsid:function(s,t){return s||t},gtiHB:function(s,t){return s<t},RbxAX:function(s,t){return s<t},nZTgJ:function(s,t){return s<t},VvySS:function(s,t){return s===t},BAAIp:function(s,t){return s&t},odblH:function(s,t){return s-t},mZprH:function(s,t){return s>=t},knoRs:function(s,t){return s<<t},HtlJU:function(s,t){return s<<t},xAfEQ:function(s,t){return s&t},TVylT:function(s,t){return s<<t},FeolU:function(s,t){return s&t},ycqGl:function(s,t){return s>=t},nImcQ:function(s,t){return s-t},SedBy:function(s,t){return s|t},WoSdB:function(s,t){return s|t},oEMDv:function(s,t){return s&t},REPfO:function(s,t){return s+t},rZnOh:function(s,t){return s+t},kGvuu:function(s,t){return s+t},fmppd:function(s,t){return s&t},jaxDw:function(s,t){return s<<t},XXVox:function(s,t){return s&t},vplTA:function(s,t){return s&t},jsuuW:function(s,t){return s(t)},yODmg:function(s,t){return s===t},WKokm:function(s,t){return s===t},rhPkP:function(s,t){return s!==t},tuftm:r(1593),iXcoT:function(s,t){return s<t},HZCXy:function(s,t){return s&t},pIMQh:function(s,t){return s&t},wcoDm:function(s,t){return s+t},JNIbd:function(s,t){return s!==t},DOSHk:r(545),wkNgq:r(1615)+"1|5",zyVgX:function(s,t){return s|t},WCPod:function(s,t){return s>>t},jCVrq:function(s,t){return s>>t},VdwIi:function(s,t){return s|t},TbPDj:r(1679),bXlBY:function(s,t){return s&t},GwDpk:function(s,t){return s|t},HYErF:function(s,t){return s==t},XLvEN:function(s,t,n,o){return s(t,n,o)},BBOpG:function(s,t){return s!=t},MjZVY:function(s,t){return s instanceof t},BGjcB:r(1090)+r(672),lQrIe:function(s,t){return s==t},otohP:function(s,t){return s(t)},MzmlG:r(284)+r(413),hHaMg:r(479),VLgdK:r(960)+r(514),lfJRO:r(389),dmvwQ:function(s,t,n){return s(t,n)},jcMjP:"tRsrf",jtWQw:function(s,t){return s(t)},QrQap:r(614),ScfQs:function(s,t){return s!==t},NKMtU:r(773),DxXDK:function(s){return s()},JUWCh:r(1638),mHckJ:"bFLHG",FmxwW:"vlTzt",sCDbg:function(s,t){return s!==t},KIwFg:r(235),idmcm:function(s,t,n){return s(t,n)},NYzjH:function(s,t){return s+t},jmeQw:function(s,t){return s===t},rtJoF:"PbQyb",kBASu:"ekjnV",aZxyC:r(1497),ABibL:function(s,t){return s!==t},Pszbd:"zLIsU",nwvNG:r(890),cWnJe:r(1247),glmUT:r(1378)+r(1550)+r(1667),dBMJI:function(s,t){return s===t},srgLE:r(433),vRSrm:r(1350),pesXD:function(s,t){return s||t},KdFgy:function(s,t){return s||t},tttrg:function(s,t){return s||t},igsRa:function(s,t,n){return s(t,n)},FRiaS:r(567),TQNxi:r(1087),yRpkg:"ivNji",WQstY:function(s,t){return s||t},MCoBO:function(s,t){return s||t},OatgY:r(756)+"d",aMZlK:r(683)+r(1448)+"d",wAHnL:function(s,t){return s!==t},fwqXc:"ssqlg",MTHFP:r(1695),qVfuZ:function(s,t,n){return s(t,n)},KHwGh:function(s,t){return s(t)},qOjMM:"LjXLg",nROjV:"Aarcz",cNqTf:function(s,t){return s+t},FaJhP:function(s,t){return s(t)},AjOpE:function(s,t){return s+t},PGaqc:r(705),jjzuJ:function(s,t,n,o){return s(t,n,o)},DJHUt:r(1499)+r(630),aLWBf:r(1499)+r(1579)+"k",pTiMM:r(1594),TDzCF:r(1435),vNjaz:function(s,t){return s&&t},TIOYN:"ack_id",kcdJx:r(1124),rgFeY:function(s,t){return s|t},lATnc:function(s,t){return s<<t},kDzMs:function(s,t){return s&t},DDImq:function(s,t){return s<<t},SIMqb:function(s,t){return s<=t},ZHleY:function(s,t){return s(t)},BiVll:function(s,t){return s instanceof t},CaCNh:r(414),UaCfX:function(s,t){return s instanceof t},bKvWT:r(342)+"in;chars"+r(1026),ldqoA:"applicat"+r(672)+r(770)+r(1575),VCVsU:"none_none",rkEMO:r(509),nUwVT:r(1648),Wijvn:function(s){return s()},KvlTn:r(320),HDAEQ:r(171),CDPOI:function(s,t){return s(t)},pXupO:function(s,t){return s+t},dNgMJ:function(s,t){return s(t)},mJzZR:function(s,t){return s&t},wSdgW:function(s,t){return s|t},ZGfaN:function(s,t){return s!==t},rCVEV:"jGqle",uMojn:function(s,t){return s+t},jyuUC:function(s,t){return s+t},rIvoj:r(558)+r(1542)+r(928),Gywxb:" + ",TVCWE:function(s,t){return s||t},pbEay:r(236),OLTjh:function(s,t){return s+t},pQTdm:function(s,t){return s+t},UICga:function(s,t){return s+t},UpDMD:function(s,t){return s!==t},KnNXq:function(s,t){return s|t},trsNq:function(s,t){return s<<t},nfvGX:function(s,t){return s|t},WKniH:function(s,t){return s<<t},GbvyK:function(s,t){return s&t},LrwwZ:function(s,t){return s&t},RxMFf:function(s,t){return s&t},ZRDVt:function(s,t){return s>t},wAWFW:function(s,t,n){return s(t,n)},mnFlH:function(s,t){return s>t},fXzIf:r(1141)+r(1204)+"e",PpxHB:r(949),nkNmM:function(s,t){return s&t},YEkGY:function(s,t){return s<t},zYoEb:function(s,t){return s>>>t},Pvwfo:"3|0|1|2|4",NvOtr:function(s,t){return s+t},rEdpP:function(s,t,n,o){return s(t,n,o)},JZeea:function(s,t){return s+t},GeCeP:function(s,t){return s|t},prBDA:function(s,t){return s<<t},wYFYN:function(s,t){return s|t},olHVg:function(s,t){return s+t},yZsRi:function(s,t){return s>>>t},ualfJ:function(s,t){return s+t},ryFsn:function(s,t){return s+t},uqqAQ:function(s,t){return s>>>t},kFVKE:function(s,t){return s>>>t},BerTt:function(s,t){return s+t},RjdhN:function(s,t){return s&t},PBMCP:function(s,t){return s+t},hwZKj:r(1058)+r(1006)+r(287)+"1",vyFyV:function(s,t){return s<<t},DHjkR:function(s,t){return s&t},YSVFj:function(s,t){return s|t},yqQxN:function(s,t){return s&t},dXsYi:function(s,t){return s|t},RzlLv:function(s,t){return s>>>t},sPYUL:function(s,t){return s|t},ElLAE:function(s,t){return s<<t},cikPV:function(s,t){return s|t},oawQt:function(s,t){return s>>>t},XPdFB:function(s,t){return s<<t},oMNEY:function(s,t){return s&t},RCIoi:function(s,t){return s<t},CBTTb:function(s,t){return s>>>t},nXybO:function(s,t){return s<<t},GZeRy:r(1185),QxILL:function(s,t){return s<t},neAWh:r(1494),oWGnE:r(632),KTGdE:function(s,t){return s+t},hHRef:function(s,t,n,o){return s(t,n,o)},rvoLA:r(1507)+r(951),MdPUn:r(951),cqnxg:function(s,t,n,o){return s(t,n,o)},bgYld:"header",HNFLr:"service",kIuDG:r(605)+r(1650),QycUG:function(s,t){return s(t)},tUnIF:function(s,t){return s(t)},nGHyv:r(275)+r(231),GNQfz:function(s,t){return s(t)},ibkmS:"gMsSv",FgxTC:r(1412),altNr:function(s,t){return s<t},WsVLf:r(450),HKgHz:"bNppf",JDgmL:function(s,t,n){return s(t,n)},DUKBR:function(s,t,n){return s(t,n)},ioFHd:r(276)+r(640),upUFQ:function(s,t,n){return s(t,n)},GvLJC:r(828)+r(1111),Itbyq:r(521)+r(665)+r(1366)+"g",BwDVF:r(875),lKqKa:"allCursorValues",QJOZm:"INSTANT",vExAG:function(s){return s()},XlRnL:function(s,t){return s===t},yVvqp:r(1496),bBjrN:r(853)+"r",jTkAd:function(s,t){return s===t},tARhH:r(310),UwVSa:function(s,t){return s(t)},MjdJK:function(s,t){return s(t)},nPRJB:function(s,t){return s<<t},XAwox:function(s,t){return s===t},aqEBq:"vidtI",ZjkUa:r(262),HFGSW:r(484),vMYdM:r(1020),jQnCc:function(s,t){return s||t},JSLOP:r(1473),agFsP:function(s){return s()},AxMIj:function(s,t){return s!=t},pPFlw:r(1532),fKhMI:r(942)+"le",USsHL:function(s,t){return s(t)},OoxFc:function(s,t){return s&t},PojmJ:r(1470),EjEbR:r(1489),gsDKT:function(s,t,n,o){return s(t,n,o)},holZL:function(s,t){return s(t)},UNLbc:r(1499)+r(477),hcsIu:"x-msg-qos",grWER:function(s,t,n){return s(t,n)},CEPUK:r(189)+r(524)+"e",YpuWR:function(s,t){return s(t)},MkpkS:function(s,t,n){return s(t,n)},IqCqJ:r(189)+r(222)+"ue",kPEoQ:function(s,t){return s>t},OWzEu:function(s,t){return s>t},dRKqQ:"yWtRk",rclaz:"iHVwx",KbrYq:function(s,t){return s!==t},uWyuZ:r(1475),kbVZe:r(241),XkRTH:function(s){return s()},duxKo:function(s,t){return s!==t},WZjlS:function(s,t){return s<t},TQXnl:function(s){return s()},lQdoG:function(s){return s()},eQfEP:function(s,t){return s===t},hqpCW:function(s,t){return s(t)},jJAJz:function(s,t){return s<t},KsMwx:function(s){return s()},cEGAy:function(s,t){return s===t},pXVsk:r(623),rOMdN:function(s,t,n){return s(t,n)},mZFZw:r(577),vywnD:r(647),BxJnd:r(1e3),Twmnk:function(s,t,n){return s(t,n)},qCxpT:"itIOn",aGiRc:function(s,t,n){return s(t,n)},GoOTx:function(s,t){return s+t},CVCvV:r(1130),pOpwb:"tZFaJ",EdAmV:function(s,t){return s!==t},XeNxD:function(s,t){return s!==t},OiqIJ:function(s,t){return s(t)},NNlgG:function(s,t){return s!==t},angPI:function(s,t,n){return s(t,n)},BCUVG:function(s,t,n){return s(t,n)},rpnNB:r(882),AbBjM:r(559)+r(568),yPLfe:r(177),ztaEJ:"auto",ZMrDs:r(391),ralcF:function(s,t){return s===t},lgNfe:r(731)+r(551)+r(1660),DDGVC:r(731)+"rovide ws params, WebSoc"+r(490)+r(257)+r(730)+r(1327),viMzJ:function(s,t){return s||t},HGRaV:r(789),cDqdC:r(1281),vsHDe:r(944)+"t",hErUT:r(530)+"ediately"+r(1060)+"ct",FTxwy:function(s,t){return s!==t},jGSxT:r(281),SicMx:"offline",tlmLp:"pagehide",Uoabz:r(483),XRkFG:r(985),OdTen:r(1009),ATKAN:function(s,t){return s!==t},jdIzb:function(s,t){return s!=t},nfdta:function(s,t){return s!=t},umYdC:function(s,t){return s===t},hAHOe:r(1636),fvADf:r(183),HnUbZ:"wss://",KVFxC:r(1658),OhiMb:r(1627),LUDrE:r(575)+"d",twGBM:function(s,t){return s||t},jsFdc:r(731)+"rovide bddID, de"+r(830)+r(1701),yngqI:"function",vBitV:function(s){return s()},scqgh:"web",HJyZE:function(s,t,n,o,c){return s(t,n,o,c)},NBfxQ:function(s,t){return s(t)},xXZRV:"upgraden"+r(301),aniEq:function(s,t){return s!==t},MstpV:function(s,t,n){return s(t,n)},wTZki:function(s,t){return s||t},WGHcp:function(s,t){return s!==t},blqfg:"iYlVl",Itttj:r(1201),RVagx:function(s,t){return s-t},Gkyud:r(1321)+">",UFcSe:function(s,t){return s*t},xTotf:function(s,t,n){return s(t,n)},ManGZ:r(510)+r(550)+"t",NRvyE:"going away, try "+r(944)+r(891)+r(843),jVgxH:function(s,t,n){return s(t,n)},thkgF:function(s,t){return s(t)},fNlXA:function(s){return s()},QYzbQ:function(s,t){return s!==t},iqTQf:r(500),EhCLp:function(s,t){return s===t},gMFnQ:function(s,t){return s||t},LnIrQ:function(s,t){return s!=t},nlLES:function(s,t){return s||t},STZkL:function(s,t){return s!=t},ATZCo:r(240),hnXQb:function(s,t){return s|t},SiooB:r(184),bgTKn:r(1446),epnCr:r(1583)+"ay, netw"+r(151)+"ine",RdovF:"ack",assJg:r(777)+r(188),emWUF:r(1378)+r(1206)+r(1258)+"nitialized",dUlyC:"ThPAP",uQpBj:"please provide a"+r(973)+r(982)+"a must b"+r(266)+r(1240)+r(1227)+r(574),SRKtS:function(s,t){return s(t)},uAGRa:function(s,t){return s||t},smNrA:function(s,t){return s instanceof t},FlkoD:r(485),DAjXL:function(s,t){return s+t},fiDLY:function(s,t){return s&t},TgaIt:function(s,t){return s+t},wbGob:function(s,t){return s+t},AOqmo:function(s,t){return s||t},oRRAb:r(561)+r(297)+r(1545),Zeflt:r(582)+"2",DqStP:function(s){return s()},qrZec:function(s,t){return s===t},xrjyc:r(772),SCKvu:"XBNHh",svgBb:function(s,t){return s(t)},mMABO:function(s,t){return s(t)},OerKJ:r(750),dpsyh:r(527),bfjJM:function(s,t){return s<<t},ijZKo:function(s,t){return s===t},LuMnZ:r(1256),tDxSe:"uhlNo",kdhHz:"sUaqo",gTgaH:"zjAKb",hdIiq:function(s,t){return s*t},QFoHS:function(s,t){return s/t},BwnpM:function(s,t){return s!=t},LNtWp:"Object",jRDzC:function(s,t){return s!=t},EXIrG:function(s,t){return s!=t},murds:function(s,t){return s===t},cKtYC:function(s,t){return s!=t},qRjAc:function(s,t){return s===t},ODBoj:r(1390)+r(1286)+r(1689)+"pe",wGDxD:function(s,t){return s===t},htUpT:r(601)+r(1203)+r(749),NtFrC:r(1500)+r(1609)+"balScope",hFuzb:function(s,t){return s!=t},GuwxJ:function(s,t){return s===t},NwAcT:function(s,t){return s!=t},xFhAt:function(s,t,n){return s(t,n)}};ye.r(G),ye.d(G,{FWS:()=>P0,CustomErrorEvent:()=>Yr,createCloseEvent:()=>ge,ReconnectEvent:()=>Zr,createErrorEvent:()=>ue,decodedFrame:()=>Gr,createOpenEvent:()=>rs,CustomCloseEvent:()=>Qr,createReconnectEvent:()=>Kn,FrontierMessageEvent:()=>es,encodeFrame:()=>jn,createMessageEvent:()=>ns,OpenEvent:()=>ts,ErrorCode:()=>Me,Event:()=>nt,MessageEvent:()=>$r});let i="";function a(s=""){let t=r,n="02",o=""+Date[t(401)](),c=i||(i=g(s)),d=Math[t(1236)]().toString(16).slice(-6);return e.XWNsM(e[t(1641)](n,o)+c,d)}function x(){let s=r;return e.VMOzZ(1e4*Date[s(401)](),Math[s(1211)](e[s(486)](1e4,Math[s(1236)]())))}function f(s){let t=r;return e.XWNsM(e[t(625)](Array,8)[t(1707)]("0"),e.BKnOc(parseInt,s,10).toString(2))[t(452)](-8)}function u(s){let t=r;return e.uBjGx(e[t(1004)](Array,4)[t(1707)]("0"),parseInt(s,2)[t(1369)](16)).slice(-4)}function h(s){let t=r;if(e[t(1218)]!==e[t(160)]){let n=s[t(698)](/\./)[t(1143)](d=>f(d)),o=[];return o[0]=u(n[0]+n[1]),o[1]=e[t(1004)](u,n[2]+n[3]),[e[t(1436)],e[t(1436)],e[t(1436)],"0000",e[t(1436)],e[t(1442)],o[0],o[1]][t(1707)]("")}else{for(_0x31cecb>>>=0;_0x550db7>=128;)e[t(604)](_0x78fd5d,_0x166520,e[t(1538)](e[t(1291)](127,_0x37fef8),128)),_0x5cb66d>>>=7;_0x23c14b(_0x3066b9,_0x24939d)}}function g(s){let t=r;if(e[t(156)](t(295),t(295))){let n=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[t(498)](s),o=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[t(498)](s);return n?e[t(1698)](h,s):o?e[t(625)](_,s):e[t(826)]}else{let n=_0x4a54c5[t(698)](/\./)[t(1143)](d=>_0x17a3b1(d)),o=[];return o[0]=_0x3537ec(e[t(1293)](n[0],n[1])),o[1]=_0x36f0a8(e[t(384)](n[2],n[3])),[t(410),e.TcYQJ,e[t(1436)],e.TcYQJ,e.TcYQJ,t(740),o[0],o[1]][t(1707)]("")}}function _(s){let t=r,n={THVTN:function(y,v){return e[A(658)](y,v)},XDFHb:e[t(898)],yCqdy:"message",GdFKv:t(592),cRJoz:t(768),wryLi:t(1392),LHjhR:function(y,v){return y||v},NkvZf:function(y,v){return e.flUke(y,v)}},o="",c=[],d=0,p=0,m=!0,l=e.TcYQJ;if(e[t(638)](s[t(1399)]("::"),-1)){let y=s[t(698)]("::");for(let E=0;e[t(909)](E,y.length);E++){if(e[t(820)]("QEDVe",e[t(1160)]))return n[t(1705)](_0x5812d4[t(1388)],_0x527181[t(1675)]);{let P=y[E];if(e[t(829)](P[t(1399)](":"),0)){let T=P[t(698)](":");m&&(d=T[t(208)]),p+=T.length;for(let O=0;O<T[t(208)];O++)if(e[t(1577)](4,T[O][t(208)])){let De=l.substring(0,e[t(512)](4,T[O][t(208)])),$=De.concat(T[O]);c[t(158)]($)}else c.push(T[O]);m=!1}else if(e.mkEzu(e[t(1611)],e[t(1422)])){let T=n.XDFHb.split("|"),O=0;for(;;){switch(T[O++]){case"0":this[t(1552)][t(873)+"Listener"](n.yCqdy,this[t(1401)+"ge"]);continue;case"1":this[t(1552)][t(873)+t(1251)](n[t(743)],this[t(1046)]);continue;case"2":this[t(1552)][t(873)+t(1251)](n[t(370)],this[t(1264)]);continue;case"3":this[t(1552)][t(873)+t(1251)](n[t(1339)],this[t(1656)]);continue;case"4":if(!this._ws)return;continue}break}}else{if(e[t(1577)](4,P[t(208)]))if(e.rDPvQ(e[t(1421)],t(1451))){if(_0x3b23f3)return new _0x456af3(_0x5815b9.url,_0xbd1b29[t(1276)]);if(_0x13b0b1||_0x36ce34)return new _0x5ab15f(_0x35fb7b[t(615)],_0x28308c[t(1276)],_0x3e8881[t(1531)]);if(n[t(1653)](_0x48c5df,_0x18ff78)&&n.NkvZf("undefined",typeof _0x30212a)&&_0x29bdeb)return new _0x489e71(_0x2583e2[t(615)],_0x545600[t(1276)+"s"])}else{let T=l.substring(0,e.VlbVp(4,P.length)),O=T[t(493)](P);c[t(158)](O)}else c[t(158)](P);m&&(d+=1),p+=1,m=!1}}}let v="";for(let E=0;E<e[t(512)](8,p);E++)v=v[t(493)](l);for(let E=0;e[t(909)](E,c[t(208)]);E++)e.TXMjl(E,d)?(o=o[t(493)](v),o=o.concat(c[E])):o=o[t(493)](c[E]);return o}{let y=s[t(698)](":");for(let v=0;e[t(1308)](v,y[t(208)]);v++){let E=y[v];if(e[t(1577)](4,y[v][t(208)])){let P=l[t(1330)+"g"](0,e[t(512)](4,y[v][t(208)])),T=P[t(493)](E);o=o[t(493)](T)}else o=o[t(493)](E)}return o}}function w(s,t){let n=r,o={pUsZM:function(p,m,l){return e[A(1431)](p,m,l)},NIMQO:function(p,m,l,y){return e[A(1508)](p,m,l,y)},zMnBM:function(p,m){return p+m}},c=s.key;c!==void 0&&(e[n(604)](Y,t,10),e[n(1431)](He,t,c));let d=s[n(744)];if(e[n(1686)](void 0,d))if(e[n(800)](e[n(807)],e[n(807)]))e[n(1245)](Y,t,18),e[n(1431)](He,t,d);else{let{offset:p}=o[n(1484)](_0x3e928e,_0x311a6f,_0x5114d7);_0x451b6b=p;let m={cursor_name:"",cursor:0,service:0},{value:l,offset:y}=o[n(1484)](_0x44e6f7,_0x3a253d,_0x2ffb1e);m.service=l,_0x3dabae=y;let{value:v,offset:E}=o.pUsZM(_0x2564f8,_0x42c61f,_0x24279c);_0x4f69ee=E,m[n(828)+n(1111)]=o[n(526)](_0x58ce90,_0x1414c4,_0x54aed8,o.zMnBM(_0x155d1f,v)),_0x26a3c2+=v;let{value:P,offset:T}=_0x406a15(_0x3a077b,_0x2a607e);m.cursor=P[n(755)](),_0x5655d6=T,_0x139030.push(m)}}function b(s){let t=r,n={};e:for(;!Ce(s);){let o=e[t(625)](te,s);switch(e[t(696)](o,3)){case 0:break e;case 1:n[t(1102)]=e.feKbj(ee,s,te(s));break;case 2:n[t(744)]=e[t(912)](ee,s,e[t(1698)](te,s));break;default:e[t(1245)](I,s,e.cHjzV(7,o))}}if(n[t(1102)]===void 0)throw new Error(e[t(544)]);if(e[t(929)](void 0,n[t(744)]))throw new Error(e.XRfDe);return n}function D(s){let t=r,n=e[t(1407)](se);return e[t(604)](k,s,n),Ee(n)}function k(s,t){let n=r,o={zjtqh:function($,ie){return e[A(1577)]($,ie)},KXpKW:function($,ie){return e[A(512)]($,ie)}},c=s[n(175)];e[n(1672)](void 0,c)&&(e.GmZHQ(Y,t,8),e[n(912)](wt,t,c));let d=s.LogID;e[n(541)](void 0,d)&&(Y(t,16),e[n(1067)](wt,t,d));let p=s[n(1708)];p!==void 0&&(e[n(1067)](Y,t,24),wt(t,F(p)));let m=s[n(1306)];e[n(1672)](void 0,m)&&(Y(t,32),e[n(162)](wt,t,e[n(901)](F,m)));let l=s[n(1531)];if(l!==void 0)for(let $ of l){e[n(162)](Y,t,42);let ie=e[n(823)](se);e[n(1342)](w,$,ie),e.GmZHQ(Y,t,ie.limit),e.GmZHQ(zo,t,ie),e.ORTep(me,ie)}let y=s[n(364)+n(1128)];e.lXycD(void 0,y)&&(e[n(1196)](Y,t,50),He(t,y));let v=s[n(1628)+n(1616)];e[n(1686)](void 0,v)&&(e[n(1431)](Y,t,58),e[n(1245)](He,t,v));let E=s.payload;e[n(1171)](void 0,E)&&(n(1168)===n(1168)?(e[n(1196)](Y,t,66),e[n(1245)](Y,t,E[n(208)]),Un(t,E)):(_0x4b8706=_0x21edb9[e[n(906)](e[n(384)](_0x213352,_0x49ae91),1)],_0x1038a3=_0x54998f[e[n(384)](_0x1a1fe7,_0x474086)+2],e[n(541)](e[n(1538)](_0x28f800,e[n(1195)](_0x54bb6b,8))&49344,32896)?_0x43615b+=_0x1e4da0:(_0x2df17d=e[n(846)](e.iSlyi(e.IpEjC(15,_0x2eefb0)<<12,e[n(831)](63&_0x5afc66,6)),e[n(280)](63,_0x584fb5)),_0x4bf9e9<2048||_0xb7184e>=55296&&e[n(1379)](_0x2c4f3b,57343)?_0x4e1de4+=_0xc4daca:(_0xf73424+=e[n(1698)](_0x5df75b,_0x4592ea),_0x3d40ef+=2))));let P=s[n(945)];e[n(368)](void 0,P)&&(e[n(604)](Y,t,74),e[n(1245)](He,t,P));let T=s["serverTi"+n(1243)];T!==void 0&&(e[n(604)](Y,t,82),e[n(1101)](He,t,T));let O=s.msgID;if(O!==void 0)if(e[n(1398)]!==e[n(1259)])Y(t,90),e[n(1067)](He,t,O);else{if(BBybsM[n(538)](4,_0x209356.length)){let $=_0x45a937[n(1330)+"g"](0,BBybsM[n(1228)](4,_0x2b456c[n(208)])),ie=$.concat(_0x2ae190);_0x3b9092[n(158)](ie)}else _0x1a0674[n(158)](_0x2989d9);_0x19ecfd&&(_0x2c0f15+=1),_0x107806+=1,_0x33d174=!1}let De=s[n(1043)+"e"];De!==void 0&&(e[n(661)](Y,t,96),e.Zzweo(wt,t,F(De)))}function B(s){return e[r(901)](N,Oe(s))}function N(s){let t=r,n={eHECm:function(o,c){return o!=c},sOACZ:e[t(1382)],RxElU:function(o,c){return e[t(602)](o,c)},tRnPT:function(o,c){return e[t(846)](o,c)},kFjfD:function(o,c){return e[t(1199)](o,c)},CbXMl:function(o,c){return o<c},btDdX:function(o,c){return e[t(1538)](o,c)},Klhso:function(o,c){return e[t(831)](o,c)},ZQMiH:function(o,c){return e[t(1138)](o,c)},cnmbO:function(o,c){return e[t(1069)](o,c)},tbmrv:function(o,c){return o<<c},QYptN:function(o,c){return e[t(617)](o,c)},coAQp:function(o,c){return e[t(1587)](o,c)}};if(e[t(1170)](e[t(654)],e.cOXau))return n.eHECm(t(572),typeof _0x58c6b1)&&(_0x2114b1 instanceof _0x31679f||_0x397964[t(1242)]&&_0x500eb4[t(1242)]instanceof _0x1ef153)||n.sOACZ!=typeof _0x1ff37c?"":(_0x3be79e.parse(_0x75c2dd),t(1090)+t(672));{let o={};e:for(;!e[t(1698)](Ce,s);)if(e[t(1495)](e[t(1685)],e[t(1294)])){let c=e.gkJHi(te,s);switch(e[t(696)](c,3)){case 0:break e;case 1:o[t(175)]=e[t(648)](Hr,s,!0);break;case 2:o[t(759)]=e[t(648)](Hr,s,!0);break;case 3:o[t(1708)]=te(s);break;case 4:o.method=e[t(1004)](te,s);break;case 5:{let d=q(s);(o[t(1531)]||(o.headers=[]))[t(158)](e[t(1698)](b,s)),s.limit=d;break}case 6:o[t(364)+t(1128)]=e[t(1245)](ee,s,e[t(1698)](te,s));break;case 7:o["payloadT"+t(1616)]=e[t(1196)](ee,s,e.ORTep(te,s));break;case 8:o[t(221)]=e[t(1196)](Fn,s,e.gkJHi(te,s));break;case 9:o.LogIDNew=e[t(1427)](ee,s,e[t(625)](te,s));break;case 10:o["serverTi"+t(1243)]=ee(s,te(s));break;case 11:o[t(1590)]=ee(s,e[t(1502)](te,s));break;case 12:o[t(1043)+"e"]=te(s);break;default:e[t(648)](I,s,7&c)}}else{if(_0x5501f6=n.RxElU(127,_0x263350[_0x1222f6])>>>0,_0x2a0ce4[_0x4a5e0f++]<128)return{value:_0x4df90b?_0x2753c9:n.tRnPT(0,_0xa9f486),offset:_0x97b637};if(_0x14b9c2=n[t(543)](n[t(788)](_0x114382,n.RxElU(127,_0x29e039[_0x5bc51c])<<7),0),n[t(844)](_0x187b11[_0x5ea500++],128))return{value:_0x38cd95?_0x34ea15:n.btDdX(0,_0x43509d),offset:_0x1c72f2};if(_0xfe5d4f=n[t(543)](_0x4a355a|n.Klhso(n.RxElU(127,_0x575ea8[_0x116bfd]),14),0),n[t(1018)](_0x2d170f[_0xcdf5a2++],128))return{value:_0x4ec80d?_0x13e099:n[t(352)](0,_0x685fd6),offset:_0x169501};if(_0x13aca9=n[t(543)](_0x380ef8|n[t(931)](127&_0x2f8381[_0x24f686],21),0),n[t(844)](_0xead758[_0x118d71++],128))return{value:_0x354c49?_0x567e06:0|_0x539d88,offset:_0x4dca9d};if(_0x47028d=n.kFjfD(_0x2390e3|n[t(494)](15&_0x2ed0c2[_0x45b32a],28),0),n[t(1225)](_0x3a99f2[_0x5e415a++],128))return{value:_0x467841?_0x47058f:0|_0x3a2179,offset:_0x40232};if((_0x429a58+=5)>_0x3a8ae5[t(208)])throw _0x51f11b=_0x2092b6.length,_0x55d8aa(_0x1e1336,10,_0x1ed8cb.length);return{value:_0x1b815f?_0x3aba7f:n[t(1039)](0,_0x3559b1),offset:_0x15ddad}}if(o.SeqID===void 0)throw new Error(e[t(961)]);if(e.TXMjl(void 0,o[t(759)]))throw new Error(t(1148)+t(813)+t(1606)+t(759));if(o[t(1708)]===void 0)throw new Error(t(1148)+"required"+t(1606)+t(1708));if(o.method===void 0)throw new Error(t(1148)+t(813)+t(1606)+"method");return o}}function q(s){let t=r,n={oVgvn:function(o,c){return o<c},lBTbX:function(o,c){return o(c)},VQjit:function(o,c){return e.xPUze(o,c)}};if(e[t(313)]===e[t(663)]){let o=0,c={};for(let d=0;n[t(557)](d,_0x5c0c41[t(208)]);d++)c[_0x183d96[d][t(828)+t(1111)]]=n[t(1630)](_0x1a991a,_0x17d212[d][t(828)+t(1111)]),o+=n[t(213)](14,c[_0xc5dd88[d][t(828)+"ame"]]);return[o,c]}else{let o=e[t(435)](te,s),c=s[t(1675)];return s.limit=e[t(1641)](s.offset,o),c}}function I(s,t){let n=r;switch(t){case 0:for(;e[n(602)](128,fe(s)););break;case 2:e[n(912)](_e,s,e[n(625)](te,s));break;case 5:e[n(1245)](_e,s,4);break;case 1:_e(s,8);break;default:throw new Error(e[n(215)](e[n(798)],t))}}function F(s){return s|=0,{low:s,high:e.CCbIK(s,31),unsigned:e.tOdmP(s,0)}}let V=[];function se(){let s=r,t=V[s(609)]();return t?(t[s(1388)]=t[s(1675)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function me(s){V[r(158)](s)}function Oe(s){return{bytes:s,offset:0,limit:s[r(208)]}}function Ee(s){let t=r,n={EFgUz:function(o,c){return e[A(642)](o,c)},GfTTO:function(o,c){return e[A(1195)](o,c)},XZDgm:function(o,c){return e[A(602)](o,c)},ZAcTz:function(o,c){return e[A(435)](o,c)}};if(e[t(1480)](t(1224),e[t(399)])){let o=s[t(1464)],c=s[t(1675)];return e.cyuzQ(o[t(208)],c)?o:o[t(884)](0,c)}else _0xae7847=n[t(1349)](n[t(1391)](n[t(1584)](31,_0x58027e),6),63&_0x472f93),_0x6d405e<128?_0x35b269+=_0x2ec8de:(_0x483ca9+=n[t(920)](_0x5c2b31,_0x323113),_0x3011a1++)}function _e(s,t){let n=r;if(e.jYLLY(e[n(215)](s.offset,t),s[n(1675)]))throw new Error(n(1284)+n(481));s[n(1388)]+=t}function Ce(s){let t=r;return e.auXpp(s[t(1388)],s[t(1675)])}function we(s,t){let n=r,o=s[n(1464)],c=s[n(1388)],d=s.limit,p=e[n(1371)](c,t);if(p>o[n(208)])if(e[n(1495)](n(1252),"hjYeq")){let m=new Uint8Array(e[n(486)](2,p));m.set(o),s.bytes=m}else this[n(781)](_0x9c9b7d,_0x3c5729);return s[n(1388)]=p,e[n(638)](p,d)&&(s[n(1675)]=p),c}function Ke(s,t){let n=r,o=s[n(1388)];if(e[n(728)](e[n(1657)](o,t),s[n(1675)]))throw new Error(e[n(1649)]);return s[n(1388)]+=t,o}function Fn(s,t){let n=r,o=e[n(1071)](Ke,s,t);return s[n(1464)].subarray(o,e.zgXFj(o,t))}function Un(s,t){let n=r,o=e.bTvjw(we,s,t[n(208)]);s[n(1464)][n(478)](t,o)}function ee(s,t){let n=r,o=e.npcgS(Ke,s,t),c=String["fromChar"+n(939)],d=s[n(1464)],p="\uFFFD",m="";for(let l=0;e[n(617)](l,t);l++){let y=d[l+o],v,E,P,T;e[n(1519)](e[n(280)](128,y),0)?m+=e[n(841)](c,y):e.cHjzV(224,y)===192?e.DTlZw(e.EiXsY(l,1),t)?m+=p:(v=d[e[n(290)](e[n(215)](l,o),1)],e[n(820)](e[n(1288)](192,v),128)?m+=p:e[n(1162)](e[n(351)],e[n(1324)])?(T=e[n(163)](e[n(836)](31&y,6),e[n(602)](63,v)),e[n(376)](T,128)?m+=p:(m+=e[n(1698)](c,T),l++)):(this[n(1266)+"igatorOnline"]=_0x1d67a4,_0x2cd9b5?this[n(655)+n(1713)]():this[n(655)+n(1119)]())):e[n(861)](e[n(280)](240,y),224)?e[n(398)](e[n(803)](l,2),t)?m+=p:(v=d[e[n(1657)](e[n(1207)](l,o),1)],E=d[e[n(906)](l+o,2)],e[n(1162)](e[n(152)](v|e[n(992)](E,8),49344),32896)?m+=p:(T=e.CNipI(e[n(238)](e[n(910)](e[n(152)](15,y),12),e[n(534)](e[n(1487)](63,v),6)),e[n(405)](63,E)),e.mPAvO(T,2048)||e[n(758)](T,55296)&&e.vJXcV(T,57343)?m+=p:(m+=c(T),l+=2))):(248&y)==240?e[n(159)](l+3,t)?m+=p:(v=d[e[n(1371)](e[n(1074)](l,o),1)],E=d[e[n(669)](e[n(723)](l,o),2)],P=d[e[n(1074)](e[n(803)](l,o),3)],e[n(1577)](e.iIHHV(e.iSlyi(v,e.rdzPK(E,8)),e.TXAoX(P,16))&12632256,8421504)?m+=p:(T=e[n(1069)](e[n(163)](e[n(164)](e[n(1022)](e.IkgmW(7,y),18),e[n(1022)](e[n(737)](63,v),12)),e[n(227)](63&E,6)),e[n(420)](63,P)),T<65536||e[n(1015)](T,1114111)?m+=p:(T-=65536,m+=e[n(190)](c,e[n(181)](T,10)+55296,e[n(737)](1023,T)+56320),l+=3))):m+=p}return m}function He(s,t){let n=r,o=t[n(208)],c=0;for(let m=0;e[n(587)](m,o);m++){let l=t.charCodeAt(m);e[n(398)](l,55296)&&e[n(293)](l,56319)&&e[n(1709)](e[n(619)](m,1),o)&&(l=e[n(1525)](e[n(1521)](e[n(836)](l,10),t[n(1481)+"At"](++m)),56613888)),c+=e[n(1709)](l,128)?1:l<2048?2:e.iLFmM(l,65536)?3:4}e[n(818)](Y,s,c);let d=e.WZgXr(we,s,c),p=s.bytes;for(let m=0;e[n(909)](m,o);m++)if(e[n(1490)](n(1716),n(650))){let l=t[n(1481)+"At"](m);if(e[n(658)](l,55296)&&e[n(866)](l,56319)&&e[n(384)](m,1)<o&&(l=e[n(215)](l<<10,t[n(1481)+"At"](++m))-56613888),e[n(909)](l,128))p[d++]=l;else{if(e[n(1138)](l,2048))p[d++]=e[n(846)](l>>6&31,192);else{if(e[n(1221)](l,65536))p[d++]=e[n(673)](e[n(152)](e[n(407)](l,12),15),224);else{if(e[n(1031)](e.FewNU,e[n(600)]))return new _0x5724b2(e.IxkHt(e[n(642)](e[n(1346)](e[n(534)](_0x2207f5[4],24),e.blBZw(_0xc799ce[5],16)),e[n(534)](_0x430832[6],8)),_0x2fd906[7]),e[n(924)](e[n(1153)](_0xc64531[0],24)|e.ocWSz(_0x4201bd[1],16),e[n(227)](_0xf42a82[2],8))|_0x29c5d3[3],_0x42dfeb);p[d++]=e[n(1045)](e.IpEjC(e[n(407)](l,18),7),240),p[d++]=e[n(1588)](e.CCbIK(l,12)&63,128)}p[d++]=e[n(164)](e[n(152)](e[n(395)](l,6),63),128)}p[d++]=e[n(542)](e[n(919)](63,l),128)}}else _0x20c8eb[n(899)](_0x4b47d2)}function zo(s,t){let n=r,o=e[n(922)](we,s,t[n(1675)]),c=s.bytes,d=t[n(1464)];for(let p=0,m=t[n(1675)];p<m;p++)c[e[n(785)](p,o)]=d[p]}function fe(s){return s[r(1464)][e.BKnOc(Ke,s,1)]}function Kr(s,t){let n=e.ijurZ(we,s,1);s.bytes[n]=t}function te(s){let t=r,n={qXxwz:e.Oywtc,wSZut:e[t(667)]},o=0,c=0,d;do if(t(431)!==e[t(1089)])switch(_0x1aca5e){case n[t(1319)]:case n.wSZut:return{["x-use-"+_0x349add]:1,"x-tt-env":_0x192657};default:return{}}else d=e[t(1004)](fe,s),o<32&&(c|=e.ocWSz(e[t(969)](127,d),o)),o+=7;while(128&d);return c}function Y(s,t){let n=r;for(t>>>=0;e[n(1347)](t,128);)e[n(1181)](Kr,s,e[n(1045)](127&t,128)),t>>>=7;e[n(1478)](Kr,s,t)}function Hr(s,t){let n=r,o=0,c=0,d=0,p;return p=e[n(610)](fe,s),o=e[n(405)](127,p),128&p&&(p=e[n(362)](fe,s),o|=e[n(822)](e[n(1288)](127,p),7),128&p&&(p=e.eWees(fe,s),o|=e[n(227)](127&p,14),e[n(974)](128,p)&&(p=fe(s),o|=e[n(808)](e[n(919)](127,p),21),e[n(974)](128,p)&&(p=e.eWees(fe,s),c=e[n(1471)](127,p),e[n(1296)](128,p)&&(p=e[n(362)](fe,s),c|=e[n(831)](e[n(1487)](127,p),7),e.AqpdN(128,p)&&(p=e[n(865)](fe,s),c|=e[n(1471)](127,p)<<14,128&p&&(p=fe(s),c|=e[n(1487)](127,p)<<21,e.QRBAC(128,p)&&(p=e[n(763)](fe,s),d=e[n(607)](127,p),e[n(1288)](128,p)&&(p=fe(s),d|=e.PXBIG(127,p)<<7))))))))),{low:e[n(643)](o,e[n(816)](c,28)),high:e.VZwwU(e.GwdAt(c,4),e.iVUBA(d,24)),unsigned:t}}function wt(s,t){let n=r,o=e[n(1199)](t.low,0),c=e[n(195)](e[n(892)](e.IjzSs(t[n(1411)],28),e[n(534)](t[n(940)],4)),0),d=e[n(696)](t.high,24),p=e.buZzV(0,d)?e[n(793)](0,c)?e[n(617)](o,16384)?e[n(1709)](o,128)?1:2:e[n(372)](o,2097152)?3:4:e[n(909)](c,16384)?e.NXscO(c,128)?5:6:e.KZNCS(c,2097152)?7:8:e[n(1221)](d,128)?9:10,m=we(s,p),l=s[n(1464)];switch(p){case 10:l[e[n(508)](m,9)]=e[n(185)](e[n(195)](d,7),1);case 9:l[e.xPUze(m,8)]=e[n(893)](9,p)?e[n(924)](128,d):e[n(817)](127,d);case 8:l[e[n(904)](m,7)]=e.CbAwi(8,p)?e[n(1546)](c>>>21,128):e[n(602)](e.AyBKx(c,21),127);case 7:l[e[n(339)](m,6)]=p!==7?e[n(642)](e[n(635)](c,14),128):e[n(1081)](e.LXzQQ(c,14),127);case 6:l[e[n(1270)](m,5)]=e[n(1034)](6,p)?e[n(1045)](e[n(879)](c,7),128):c>>>7&127;case 5:l[m+4]=e.uMGeh(5,p)?e[n(622)](128,c):e[n(1296)](127,c);case 4:l[e[n(1657)](m,3)]=e[n(1672)](4,p)?o>>>21|128:e[n(562)](e[n(696)](o,21),127);case 3:l[e[n(437)](m,2)]=e[n(1490)](3,p)?e[n(1472)](e[n(1333)](o,14),128):e[n(562)](e.AyBKx(o,14),127);case 2:l[e[n(1074)](m,1)]=p!==2?e[n(1546)](e[n(1055)](o,7),128):e[n(1453)](e[n(1612)](o,7),127);case 1:l[m]=e[n(812)](1,p)?e.PaOIn(128,o):e[n(1315)](127,o)}}function Gr(s){return e[r(1093)](B,s)}function jn(s){if(e[r(1665)]===e.WrZEO)_0x3c1348.log(_0x10cb29);else return e.wBTFB(D,s)}let Wr=65536,qo=r(1440),et=e[r(1529)](Wr,Wr),Vr=e[r(1237)](et,et),Jr=e[r(216)](Vr,2),Re=String[r(1177)+"e"][r(1481)+"At"];class R{constructor(t,n,o){let c=r;this.isLong=!0,this[c(1411)]=e[c(642)](0,t),this[c(940)]=e[c(1084)](0,n),this[c(397)]=!!o}static isLong(t){let n=r;return t&&e[n(800)](!0,t[n(1441)])}static[r(921)](t,n,o){return new R(t,n,o)}static fromBytes(t,n,o){return o?R.fromBytesLE(t,n):R[r(317)+"sBE"](t,n)}static[r(317)+r(1017)](t,n){let o=r;return new R(e[o(1587)](e[o(935)](e[o(1045)](t[0],e[o(831)](t[1],8)),e[o(1153)](t[2],16)),t[3]<<24),e.eVZLT(e.CshWn(t[4],e[o(736)](t[5],8)),t[6]<<16)|e[o(710)](t[7],24),n)}static[r(317)+r(1410)](t,n){let o=r;return new R(e.BmhBj(e[o(1359)](t[4]<<24|e[o(831)](t[5],16),e[o(822)](t[6],8)),t[7]),e[o(622)](e[o(935)](e[o(1346)](t[0]<<24,e[o(1153)](t[1],16)),e[o(783)](t[2],8)),t[3]),n)}static[r(1429)](t){let n=r;return t===qo?Xr:new R(e[n(1199)](e[n(1359)](e[n(1193)](Re.call(t,0),Re.call(t,1)<<8)|e.TSwYh(Re.call(t,2),16),Re[n(1419)](t,3)<<24),0),e[n(717)](e[n(618)](e[n(315)](Re[n(1419)](t,4),e[n(1179)](Re[n(1419)](t,5),8)),e[n(328)](Re.call(t,6),16))|e.VDrTt(Re.call(t,7),24),0),!0)}[r(265)](){let t=r,n={ocCFM:function(o,c,d,p){return o(c,d,p)}};if(e.HFzSM(e[t(915)],e[t(915)]))throw _0x22a627=_0xdb88d8[t(208)],n[t(1159)](_0x3c2956,_0x1bfc76,10,_0x310aff.length);return String[t(895)+t(939)](e[t(239)](255,this[t(1411)]),e[t(280)](e[t(697)](this[t(1411)],8),255),this.low>>>16&255,e[t(402)](this[t(1411)],24),e[t(1287)](255,this[t(940)]),e.VjHTD(e.LpVGL(this[t(940)],8),255),e.Tkigq(e[t(1333)](this[t(940)],16),255),e.WihKv(this[t(940)],24))}static[r(1147)+"er"](t,n=!0){let o=r,c={NDrdV:function(d,p,m){return e.YsWKX(d,p,m)}};if(e[o(1171)](e[o(620)],"eRWOr")){if(e[o(330)](isNaN,t))return n?Fo:Xr;if(n){if(t>=Vr)return jo}else{if(t<=-Jr)return Ko;if(e[o(427)](t+1,Jr))return Uo}return R[o(921)](e[o(924)](e[o(1254)](t,et),0),e.FwQHN(t,et)|0,n)}else _0x50fcb2(_0x2e2f6c,8),bqAGhF[o(255)](_0x4b2266,_0x27ea02,_0x323f08)}[r(755)](){let t=r;return this[t(397)]?e[t(1293)](e[t(1037)](e[t(298)](this[t(940)],0),et),e.iRZoM(this[t(1411)],0)):e[t(384)](this[t(940)]*et,e[t(1341)](this[t(1411)],0))}isZero(){let t=r;return e[t(721)](0,this[t(940)])&&e[t(1176)](0,this[t(1411)])}add(t){let n=r;R[n(1441)](t)||(t=R[n(1147)+"er"](t));let o=e[n(1199)](this[n(940)],16),c=e.ahZPq(65535,this[n(940)]),d=e.ZANGA(this.low,16),p=e[n(405)](65535,this[n(1411)]),m=e[n(635)](t[n(940)],16),l=e[n(962)](65535,t[n(940)]),y=e[n(1353)](t.low,16),v=e.yaRTP(65535,t.low),E=0,P=0,T=0,O=0;return O+=e[n(1405)](p,v),T+=O>>>16,O&=65535,T+=e[n(1521)](d,y),P+=e[n(1632)](T,16),T&=65535,P+=e[n(1622)](c,l),E+=e[n(1007)](P,16),P&=65535,E+=e[n(1029)](o,m),E&=65535,R[n(921)](e[n(155)](T,16)|O,e[n(167)](e[n(790)](E,16),P),this[n(397)])}equals(t){let n=r;return R[n(1441)](t)||(t=R[n(1147)+"er"](t)),e.Pwien(this[n(397)],t[n(397)])&&e[n(506)](e[n(771)](this[n(940)],31),1)&&e[n(283)](e[n(1612)](t[n(940)],31),1)?!1:e[n(507)](this[n(940)],t[n(940)])&&this[n(1411)]===t.low}[r(419)](){let t=r;return this[t(1411)]===-1&&e.TXMjl(-1,this[t(940)])?R.fromBits(0,0,this[t(397)]):e[t(800)](-1,this.low)?R[t(921)](0,e[t(1569)](this.high,1),this[t(397)]):R[t(921)](e[t(339)](this[t(1411)],1),this.high,this.unsigned)}toBytes(t){let n=r;if(e[n(893)](e[n(796)],e[n(1323)]))return t?this[n(1692)+"E"]():this[n(795)+"E"]();_0x590f06[n(1601)][n(1512)+n(589)](_0x4ddd9a)}toBytesLE(){let t=r,n=this.high,o=this.low;return[255&o,e[t(1044)](e[t(848)](o,8),255),e[t(833)](o>>>16,255),e[t(635)](o,24),e[t(1291)](255,n),e[t(432)](n>>>8,255),e.LXzQQ(n,16)&255,e[t(200)](n,24)]}[r(795)+"E"](){let t=r,n=this[t(940)],o=this.low;return[e[t(635)](n,24),e[t(1428)](e[t(402)](n,16),255),e[t(602)](e[t(1526)](n,8),255),255&n,e[t(528)](o,24),o>>>16&255,e[t(1296)](e[t(1232)](o,8),255),e[t(280)](255,o)]}}let Xr=new R(0,0,!1),Fo=new R(0,0,!0),Uo=R.fromBits(-1,2147483647,!1),jo=R[r(921)](-1,-1,!0),Ko=R[r(921)](0,-2147483648,!1);var Me=(function(s){let t=r,n=e[t(911)][t(698)]("|"),o=0;for(;;){switch(n[o++]){case"0":s[s[e[t(1383)]]=5005]=e[t(1383)];continue;case"1":s[s[e[t(963)]]=5004]=t(1351)+t(1458);continue;case"2":s[s[e.OnZGd]=5003]=e.OnZGd;continue;case"3":return s;case"4":s[s[e[t(423)]]=5001]=e[t(423)];continue;case"5":s[s[e[t(1710)]]=5002]=e[t(1710)];continue}break}})({});class nt{constructor(t){let n=r;this[n(367)]=t,this[n(354)]=null}}class Zr extends nt{constructor(t,n){let o=r;super(t),this[o(1092)]=n&&n[o(1092)]||null}}class Yr extends nt{constructor(t,n){let o=r;if(e.tKdHV(e.elZJZ,o(1645))){let{type:c}=_0x3fc06b;this[o(329)](c,_0x463d95)}else{let c=e[o(443)][o(698)]("|"),d=0;for(;;){switch(c[d++]){case"0":this[o(1092)]=n&&n[o(1092)]||"";continue;case"1":this.code=n&&n[o(983)]||5001;continue;case"2":this[o(1491)]=n&&n[o(1491)]||0;continue;case"3":this[o(327)]=n&&n.colno||0;continue;case"4":this[o(592)]=n&&n[o(592)]||null;continue;case"5":super(t);continue;case"6":this[o(782)]=n&&n[o(782)]||"";continue}break}}}}class Qr extends nt{constructor(t,n){let o=r,c=e[o(1387)].split("|"),d=0;for(;;){switch(c[d++]){case"0":this[o(1688)]=n&&n.wasClean||!1;continue;case"1":this[o(983)]=n&&n[o(983)]||0;continue;case"2":super(t);continue;case"3":this[o(531)+o(1548)]=n&&n[o(531)+"nnect"]||!1;continue;case"4":this[o(413)]=n&&n[o(413)]||"";continue}break}}}class $r extends nt{constructor(t,n){let o=r;super(t),this[o(1317)]=n&&n.data||null}}class es extends $r{constructor(t,n){let o=r;super(t),this[o(1317)]=n&&n[o(1317)]||null,this[o(1092)]=n&&n[o(1092)]||null}}class ts extends nt{constructor(t,n){let o=r;super(t),this.data=n&&n[o(1317)]||null}}function ue(s,{message:t,code:n,error:o}){return new Yr(s,{message:t,code:n,error:o})}function ge(s,{code:t,reason:n,wasClean:o,willReconnect:c}){return new Qr(s,{code:t,reason:n,wasClean:o,willReconnect:c})}function ns(s,{data:t,message:n}){return new es(s,{data:t,message:n})}function rs(s,{data:t}){return new ts(s,{data:t})}function Kn(s,{message:t}){return new Zr(s,{message:t})}class ss{constructor(t,n){let o=r;this.endpoints=t,this.maxRetries=n,this[o(1367)+o(997)]=0,this[o(1557)+"ndpointT"+o(802)+"t"]=0}[r(193)+r(1415)+r(1511)](){let t=r;this[t(1367)+t(997)]=0,this.currentEndpointTriesCount=0}[r(1535)+"es"](){let t=r;this["currentE"+t(393)+t(802)+"t"]=0}[r(869)+r(1607)+"nt"](){return this.endpoints[this.currentIndex]}[r(869)+r(1607)+r(691)+"ount"](){let t=r;return this["currentE"+t(393)+t(802)+"t"]}["checkRea"+r(1425)+"es"](){let t=r;return!!(this[t(1367)+t(997)]>=this[t(548)+"s"].length||e[t(1052)](this["currentI"+t(997)],e[t(308)](this[t(548)+"s"].length,1))&&e[t(1216)](this[t(1557)+t(393)+t(802)+"t"],this[t(1120)+"es"]))}[r(603)+r(649)+r(1514)+r(1023)+r(1072)](){let t=r;if(e.mkEzu(t(766),e[t(702)]))_0x136218.exports=_0x413c3d[t(662)]()[t(536)](()=>(_0x484e39(),_0x57aeab))[t(536)](function(n){return n});else return e.jAZeA(this[t(1367)+"ndex"],this[t(548)+"s"].length)?!0:this[t(1557)+t(393)+t(802)+"t"]>this[t(1120)+"es"]}[r(1402)+"ackupEnd"+r(720)+"UpdateCo"+r(576)](){let t=r;return this["currentE"+t(393)+t(802)+"t"]=1,this["currentI"+t(997)]++,this[t(548)+"s"][this[t(1367)+t(997)]]}[r(869)+"ntEndpoi"+r(1352)+r(277)](){let t=r;return this["currentE"+t(393)+t(802)+"t"]++,this[t(869)+t(1607)+"nt"]()}}let rt=(e[r(838)](e.OatgY,typeof globalThis)&&e[r(1241)](r(1094),globalThis[r(202)+r(316)][r(951)])||e[r(806)](e[r(1697)],typeof window)&&e[r(1035)](r(1094),window[r(202)+r(316)][r(951)]))&&e[r(417)](e[r(1697)],typeof document),Ge=e[r(1282)](e[r(1697)],typeof globalThis)&&(e[r(442)](e[r(1681)],globalThis.constructor[r(951)])||globalThis[r(202)+r(316)][r(951)]==="DedicatedWorkerGlobalScope")&&e[r(517)](e[r(1697)],typeof tt),bt=(e[r(430)](r(756)+"d",typeof globalThis)&&e[r(1189)](e.LNtWp,globalThis[r(202)+"tor"][r(951)])||r(756)+"d"==typeof globalThis||r(756)+"d"!=typeof globalThis&&!!globalThis[r(179)+r(1629)])&&e.jNTfG(e.OatgY,typeof wx),yt=e[r(178)](e[r(1697)],typeof globalThis)&&(e[r(355)](e[r(1311)],globalThis[r(202)+r(316)][r(951)])||e[r(1061)](e[r(580)],globalThis["construc"+r(316)].name)||e[r(469)](e[r(810)],globalThis[r(202)+r(316)][r(951)]))&&e.hFuzb(r(756)+"d",typeof self),Ho=e[r(461)](e[r(1697)],typeof globalThis)&&e.GuwxJ(e[r(1681)],globalThis[r(202)+"tor"].name)&&e[r(1292)](e[r(1697)],typeof global)&&e.rRGUu(e.LNtWp,global[r(202)+r(316)][r(951)])&&e[r(417)](e[r(1697)],typeof process)&&!!process.version;class Hn{constructor(){this._listeners={}}[r(329)](t,...n){let o=r,c=this[o(1331)+"rs"][t];if(c)c[o(452)]()[o(570)](d=>d.fn[o(1565)](d[o(923)],n));else if(e[o(757)](e[o(1073)],t)&&!this[o(1086)]){let d=n[o(208)]&&n[0];if(e[o(173)](d,Error))throw d;let p=new Error(e[o(1108)](e.cVTDI,d?e.PTziB(" (",d[o(1092)])+")":""));throw p[o(264)]=d,d}return this}[r(781)](t,n){let o=r;if(e.yIkrL(e.eYDWQ,e[o(1463)])){if(!this._ws)return;this[o(1677)+o(1510)+"t"](_0x201c8c,_0x12f165,_0x4e3462)}else{if(e.NpCrR(void 0,t))this._listeners={};else if(e.NpCrR(void 0,n))this._listeners[t]=null;else{let c=this._listeners[t];if(c)for(let d=0;e[o(1560)](d,c[o(208)]);)e.cyuzQ(c[d].fn,n)?c.splice(d,1):++d}return this}}on(t,n,o){let c=r;return(this._listeners[t]||(this[c(1331)+"rs"][t]=[]))[c(158)]({fn:n,ctx:o||this}),this}}class Go extends Hn{[r(1283)+r(877)+r(373)](t){let n=r;return e[n(851)](e[n(224)],e[n(1651)])?_0x2bedab?this.toBytesLE():this[n(795)+"E"]():t[n(331)]||t[n(1395)]?(n(444)+" "+(t[n(331)]||"")+" code: "+(t[n(1395)]||""))[n(1329)]():JSON[n(815)+"y"](t)}constructor(t,n,o){let c=r;super(),this[c(1337)]=null,bt&&wx[c(1597)+c(1099)]&&(this[c(1337)]=wx[c(1597)+c(1099)]({url:t,protocols:n,header:o,fail:this[c(157)+c(1479)+c(685)][c(438)](this),success:this["_createS"+c(1250)+"cessHandler"][c(438)](this)})),Ge&&tt[c(1597)+"ocket"]&&(this[c(1337)]=tt["connectS"+c(1099)]({url:t,protocols:n,header:o,fail:this[c(157)+c(1479)+c(685)][c(438)](this),success:this[c(157)+c(1250)+c(234)+c(804)][c(438)](this)}))}[r(157)+r(1250)+r(234)+r(804)](){let t=r;Promise[t(662)]()[t(536)](()=>{let n=t;this[n(764)+n(1238)]()})}[r(157)+r(1479)+r(685)](t){let n=r,o={kCMFZ:function(c,d,p){return e[A(1478)](c,d,p)},rjPmn:e.vgtXf,vPKWE:e[n(1320)]};if(e[n(724)]!==e[n(724)]){let c=_0x42884f[n(1330)+"g"](0,4-_0x384df6[_0x2fe405][n(208)]),d=c[n(493)](_0x2df65b[_0x8a0f2d]);_0x38e6cd[n(158)](d)}else Promise[n(662)]()[n(536)](()=>{let c=n,d=o.kCMFZ(ue,o[c(651)],{message:this[c(1283)+c(877)+c(373)](t)});this[c(329)](o[c(651)],d);let p=ge(o[c(282)],{reason:this[c(1283)+c(877)+c(373)](t)});this[c(329)](o[c(282)],p)})}[r(764)+r(1238)](){let t=r;this[t(1337)].onOpen(n=>{let o=t;this[o(329)](e[o(1095)],rs(e.NSarj,{...n,data:n[o(331)]||""}))}),this[t(1337)][t(682)](n=>{let o=t;this.emit(e.aqZOI,e[o(648)](ge,e.aqZOI,{...n}))}),this[t(1337)][t(791)+"e"](n=>{let o=t;this.emit(e.gAfKZ,ns(e[o(637)],{...n}))}),this[t(1337)].onError(n=>{let o=t;this[o(329)](e[o(1073)],e[o(1226)](ue,e[o(1073)],{...n,message:n[o(331)]||""}))})}[r(689)](t){let n=r,o={uycYY:e.vgtXf,vntDu:function(c,d,p){return e[A(832)](c,d,p)}};if(e.TWqyO(t,Uint8Array))if(n(1687)!==e[n(203)])this[n(1191)+"ngTimer"](),this.emit(e.JeNcO,e[n(776)]),this._pingPongTimeoutId=e.ixuDo(_0x1a3e69,this[n(1278)][n(438)](this),_0x5900eb);else{let c=t[n(1242)][n(452)](t[n(1668)+"et"],t[n(1260)+"th"]+t[n(1668)+"et"]);this[n(1337)]&&this[n(1337)][n(689)]({data:c,fail:d=>{let p=n;this.emit(o[p(390)],o.vntDu(ue,o[p(390)],{message:this[p(1283)+"rrorMessage"](d)}))}})}else this[n(1337)]&&this[n(1337)][n(689)]({data:t,fail:c=>{let d=n;this[d(329)](o[d(390)],o[d(473)](ue,d(592),{message:this["_formatE"+d(877)+"age"](c)}))}})}[r(768)](t,n){let o=r;if(e[o(206)]!==e[o(206)])return new _0x1c05e4(_0x56574a);this[o(1337)]&&this[o(1337)][o(768)]({code:t,reason:n})}[r(873)+"Listener"](t,n){this.on(t,n)}[r(1682)+r(252)+r(1133)](t,n){this.off(t,n)}get[r(553)+"te"](){let t=r;return this[t(1337)][t(553)+"te"]}get[r(809)+"pe"](){let t=r;return this[t(1337)][t(809)+"pe"]}set[r(809)+"pe"](t){}get[r(615)](){let t=r;if(e[t(1216)](e.kwKNC,e[t(482)]))FcUTnl.FfNFd(_0xc28e1,_0x290111(_0xdad956[t(958)]),_0x5c55ef[t(1173)+"on"],_0x69095b[t(180)+"on"],FcUTnl.PuvNZ(_0x4881d6,_0x24256["transact"+t(995)]));else return this[t(1337)][t(615)]}get[r(1276)](){let t=r;return this[t(1337)][t(1276)]}get[r(1030)+"ns"](){let t=r;return this[t(1337)][t(1030)+"ns"]}get[r(621)+r(1121)](){let t=r,n={TJVsp:function(o,c){return o(c)},OSBmx:function(o,c){return e[A(1347)](o,c)},zBQqF:function(o,c){return o<=c},XJpny:function(o,c){return e.VMOzZ(o,c)},GvmcU:function(o,c){return o|c},LYxPj:function(o,c){return o/c}};if(e[t(1246)](e[t(1304)],t(752))){if(EipgkZ[t(1145)](_0x3ea841,_0x17c46e))return _0x4e8b3c?_0x10314b:_0x39f20f;if(_0x12edf8){if(EipgkZ[t(660)](_0x9b973e,_0x5ec580))return _0x13bc88}else{if(EipgkZ[t(1517)](_0x4d16f6,-_0x505818))return _0x408073;if(EipgkZ[t(660)](EipgkZ[t(403)](_0x1f80d3,1),_0x262406))return _0x295364}return _0x4b7c2c[t(921)](EipgkZ.GvmcU(_0x35f382%_0x57f403,0),EipgkZ[t(608)](EipgkZ[t(182)](_0x32cf12,_0x548821),0),_0x4d5cc5)}else return 0}}function Wo(s,t){let n=r;if(n(429)===e[n(613)]){this["_dispatc"+n(358)+"ent"](_0x14e632(e.aqZOI,{code:1e3,reason:e[n(1375)]})),this[n(703)+n(1135)]?.[n(193)+n(1415)+n(1511)](),this[n(883)+n(555)]?.[n(268)+n(1106)]();return}else{if(t)return new t(s[n(615)],s[n(1276)]);if(e.Uzvom(bt,Ge))return new Go(s[n(615)],s[n(1276)],s[n(1531)]);if(e[n(1248)](rt,yt)&&e[n(461)](n(756)+"d",typeof WebSocket)&&WebSocket)return new WebSocket(s.url,s[n(1276)+"s"])}}function Vo(s){let t=r,n=e[t(1345)].split("|"),o=0;for(;;){switch(n[o++]){case"0":if(e.zwsid(rt,yt)&&e[t(461)](t(756)+"d",typeof WebSocket)&&WebSocket)return!0;continue;case"1":if(s)return!0;continue;case"2":return!1;case"3":if(Ge&&tt[t(1597)+t(1099)])return!0;continue;case"4":if(bt&&wx[t(1597)+t(1099)])return!0;continue}break}}function is(s,t,n){let o=r,c={GSLah:function(m,l){return m===l}},d=-1;async function p(m){let l=A;return m<=d?Promise[l(1438)](new Error(l(1057)+l(955)+l(628)+"imes in "+l(1205))):(d=m,c[l(406)](m,n.length)?Promise.resolve():n[m][l(438)](s)(t,p[l(438)](null,m+1)))}e[o(1655)](p,0)}function os(s){let t=r,n=0,o=0;for(let c=0;e.gtiHB(c,s[t(208)]);++c)o=s[t(1481)+"At"](c),e[t(343)](o,128)?n+=1:e.nZTgJ(o,2048)?n+=2:e[t(956)](e[t(1296)](64512,o),55296)&&e[t(251)](64512,s[t(1481)+"At"](e[t(215)](c,1)))===56320?(++c,n+=4):n+=3;return n}function as(s,t,n){let o=r;if(e[o(990)](n,t)<1)return"";let c="";for(let d=t;d<n;){let p=s[d++];if(p<=127)c+=String["fromChar"+o(939)](p);else if(e[o(1215)](p,192)&&p<224)c+=String[o(895)+"Code"](e[o(1140)](e[o(420)](31,p),6)|63&s[d++]);else if(e[o(334)](p,224)&&e.oQHwD(p,240))c+=String[o(895)+o(939)](e[o(1193)](e[o(642)](e[o(566)](e[o(888)](15,p),12),e.TVylT(e[o(332)](63,s[d++]),6)),e[o(1471)](63,s[d++])));else if(e[o(1314)](p,240)){let m=e[o(392)](e.SedBy(e.CshWn(e[o(1255)](e[o(910)](7&p,18),e[o(566)](e[o(152)](63,s[d++]),12)),e[o(790)](63&s[d++],6)),e[o(872)](63,s[d++])),65536);c+=String[o(895)+o(939)](e.REPfO(55296,e[o(181)](m,10))),c+=String[o(895)+o(939)](e.rZnOh(56320,1023&m))}}return c}function Gn(s,t,n){let o=r;if(e[o(387)](e.tuftm,e[o(312)]))_0x15b745=_0x4f3e78[e[o(999)](_0x341560+_0x32f925,1)],e.fmppd(192,_0x207643)!==128?_0x51de47+=_0x5f2318:(_0xd8cac7=e[o(924)](e[o(1253)](e[o(1360)](31,_0x415bf7),6),e[o(1518)](63,_0x115f8e)),_0x190e32<128?_0x44eae2+=_0x4d13c9:(_0x35c4d1+=e[o(1363)](_0x4ea7f5,_0xe0f281),_0x3c157a++));else{let c=n,d,p;for(let m=0;e[o(909)](m,s[o(208)]);++m)if(d=s[o(1481)+"At"](m),e[o(1042)](d,128))t[n++]=d;else if(e[o(474)](d,2048))t[n++]=e[o(181)](d,6)|192,t[n++]=e[o(1097)](63,d)|128;else if(e.yODmg(e[o(1600)](64512,d),55296)&&e.IbIld(e.pIMQh(64512,p=s.charCodeAt(e[o(214)](m,1))),56320)){if(e[o(1570)](e[o(242)],e[o(242)]))return!!(e[o(658)](this[o(1367)+"ndex"],this.endpoints[o(208)])||e[o(762)](this["currentI"+o(997)],e.PSopV(this[o(548)+"s"][o(208)],1))&&e[o(1305)](this[o(1557)+o(393)+o(802)+"t"],this[o(1120)+"es"]));{let l=e[o(269)][o(698)]("|"),y=0;for(;;){switch(l[y++]){case"0":d=e[o(669)](65536+e.zpOMU(e.fmppd(1023,d),10),e.uKKNU(1023,p));continue;case"1":t[n++]=e[o(673)](e[o(1081)](e[o(181)](d,6),63),128);continue;case"2":++m;continue;case"3":t[n++]=e[o(1190)](e[o(978)](d,18),240);continue;case"4":t[n++]=e[o(432)](e.jCVrq(d,12),63)|128;continue;case"5":t[n++]=e.VdwIi(e.FeolU(63,d),128);continue}break}}}else if(e.VvySS(e[o(1355)],e[o(1355)]))t[n++]=e[o(1472)](e[o(237)](d,12),224),t[n++]=e[o(678)](e[o(407)](d,6),63)|128,t[n++]=e[o(335)](e[o(420)](63,d),128);else{let l=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/.test(_0x2e7b11),y=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[o(498)](_0x4193dd);return l?e[o(1093)](_0x2fd776,_0x12ffd8):y?e[o(1655)](_0x58a244,_0x445a75):o(1344)+o(1344)+o(1344)+"00000000"}return e.tUFST(n,c)}}async function xs(s){let t=r;if(e[t(1459)](e[t(1382)],typeof s)){let n=new Uint8Array(e[t(625)](os,s));return e.XLvEN(Gn,s,n,0),n}return e[t(173)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(1242)],s.byteOffset,s[t(1260)+"th"])}function Jo(s){let t=r;try{return e[t(1282)](e[t(1382)],typeof s)&&(e[t(1328)](s,ArrayBuffer)||s[t(1242)]&&e.MjZVY(s[t(1242)],ArrayBuffer))||e[t(1282)](t(572),typeof s)?"":(JSON[t(563)](s),e.BGjcB)}catch{return e[t(1703)](e[t(1382)],typeof s)?t(342)+t(867)+t(1026):""}}let Xo=(s,t)=>{let n=r;switch(s){case e.Oywtc:case e[n(667)]:return{[n(1691)+s]:1,"x-tt-env":t};default:return{}}};class Zo{constructor(t){let n=r;this[n(937)+n(1180)]=t,this[n(424)]=0}[r(579)](){let t=r;this[t(424)]++}["checkRea"+r(325)+"nt"](){let t=r;return e[t(398)](this[t(424)],this[t(937)+"ount"])}[r(268)+r(1106)](t=0){let n=r;this[n(937)+n(1180)]=t,this.count=0}}async function Yo(s){let t=r,n={BSfUH:function(o,c){return e.otohP(o,c)},rImrW:e[t(854)],dphnE:e.hHaMg,CMJwf:e.VLgdK,JsoxT:function(o,c){return e[t(723)](o,c)},oqajD:e.lfJRO};return new Promise(o=>{let c=t;if(!rt)return o(n[c(345)]);try{let d=document["createEl"+c(447)](n.dphnE);window.frontierJSONP=p=>{let m=c;document[m(1601)][m(1503)+m(589)](d),window[m(458)+"JSONP"]=void 0,n[m(1229)](o,p&&p[m(1098)]||n[m(345)])},d[c(367)]=n[c(1186)],d[c(378)]=n[c(1513)](s[c(1564)](/^ws/,n[c(1155)]),c(1163)+c(1715)+c(212)+"P");try{document.body[c(1512)+c(589)](d)}catch{document[c(1601)]["removeCh"+c(589)](d)}}catch{window[c(458)+c(361)]=void 0,n.BSfUH(o,c(284)+c(413))}})}function ze(s,t,n){return!!s?.[r(1466)](c=>c.key===t&&c.value===n)}function st(s,t){let n=r,o={bZayN:function(c,d,p){return e[A(1114)](c,d,p)}};if(e[n(1305)](n(1634),e.jcMjP)){let c=MoSkSp.bZayN(_0x2cab0c,_0x3dfca7,1);_0x1fd434[n(1464)][c]=_0x29d607}else return s?.[n(1466)](c=>c[n(1102)]===t)?.[n(744)]}let Wn=null;async function Qo(){let s=r;return Wn||(Wn=Promise.resolve()[s(536)](ye[s(438)](ye,s(344)))),Wn}class $o extends Hn{constructor(t,n){let o=r,c={QVqiV:function(d,p,m){return d(p,m)},DCtQX:function(d,p,m){return d(p,m)},xOPFX:function(d,p){return e.jtWQw(d,p)}};e[o(1409)]!==e.QrQap?(PBVYBz[o(1534)](_0x507a9a,_0xe13aee,24),PBVYBz[o(434)](_0x4c7378,_0x4dfcc4,PBVYBz[o(1558)](_0x132b7f,_0x1c60f4))):(super(),this[o(1669)]=t,this[o(556)]=n,this[o(465)]=void 0,this[o(675)+o(1643)]=null)}async[r(1620)](){await this._init()}async[r(1662)](){let t=r;if(!this[t(465)]){if(this["_initPro"+t(1643)])return this[t(675)+t(1643)];try{let n=this[t(1669)],o=this[t(556)];this[t(675)+t(1643)]=(async()=>{let c=t;if(e[c(205)](c(1528),e[c(359)])){let{openDB:d}=await e[c(792)](Qo);this[c(465)]=await d("frontier_"+n,1,{upgrade(p){let m=c;p[m(1626)+m(1257)+"e"](n,{keyPath:o})}})}else this.on(_0x22bb02,_0x2c2044)})(),await this[t(675)+t(1643)]}catch(n){console[t(899)](n)}finally{this[t(675)+t(1643)]=null}}}async get(t){let n=r;try{return await this[n(1662)](),this[n(465)]?.[n(784)](this[n(1669)],t)}catch(o){console[n(899)](o)}}async[r(478)](t,n){let o=r;return await this[o(1662)](),this[o(465)]?.[o(1408)](this._dbName,t)}async del(t){let n=r;if(e.mHckJ===e[n(1127)])this._ws&&this[n(1552)][n(689)](_0x3c87fd),this[n(383)](e[n(523)],_0xb027e0);else try{return e[n(700)](n(235),e.KIwFg)?_0x186647[n(662)]():(await this[n(1662)](),this[n(465)]?.delete(this._dbName,t))}catch(o){console[n(899)](o)}}async[r(712)](){let t=r;try{return await this._init(),this[t(465)]?.clear(this[t(1669)])}catch(n){console[t(899)](n)}}async[r(1537)](){let t=r;return await this[t(1662)](),this._qosDB?.[t(746)+"ys"](this[t(1669)])}async[r(394)](){let t=r;if(e.jmeQw("PbQyb",e.rtJoF))return await this._init(),this[t(465)]?.[t(394)](this[t(1669)]);{let n=e[t(1416)](_0x4ad81b,_0x4184dd,_0x198a7a[t(1675)]),o=_0x19ad16[t(1464)],c=_0x39d079.bytes;for(let d=0,p=_0x2c7dbe[t(1675)];d<p;d++)o[e[t(1021)](d,n)]=c[d]}}async[r(887)](){let t=r;if(e[t(1640)]!==e[t(273)])try{e[t(847)](e[t(1078)],e[t(976)])?(this._qosDB?.[t(768)](),this[t(465)]=void 0):_0xed71f2[t(478)](_0x44add9,_0x2b979a)}catch(n){if(t(187)!==e[t(1115)])console[t(899)](n);else{let o=_0x41d192.substring(0,e[t(512)](4,_0x42a6fe.length)),c=o[t(493)](_0xa03e89);_0x133e6a[t(158)](c)}}else _0x390e6f(this[t(1377)+"ionTimeo"+t(169)]),this[t(1377)+"ionTimeo"+t(169)]=null}get[r(511)](){let t=r;try{return!!this[t(465)]}catch(n){return console.log(n),!1}}}class e0{constructor(t,n){let o=r;this[o(1174)]=t,this._pathKey=n,this[o(465)]=localStorage}async openDB(){}get _prefix(){return"frontier_"+this._DBName}async get(t){let n=r,o=this[n(465)][n(286)](this._prefix);return JSON[n(563)](e[n(1248)](o,"{}"))[t]}async[r(478)](t,n){let o=r,c=this[o(465)][o(286)](this._prefix),d=JSON[o(563)](e[o(279)](c,"{}"));return d[n||t[this._pathKey]]=t,this._qosDB[o(1413)](this[o(1663)],JSON.stringify(d)),n||t[this._pathKey]}async[r(1040)](t){let n=r,o=this[n(465)][n(286)](this._prefix),c=JSON[n(563)](e[n(1434)](o,"{}"));return c[t]=void 0,this[n(465)][n(1413)](this[n(1663)],JSON[n(815)+"y"](c))}async[r(712)](){let t=r;return this[t(465)][t(712)]()}async[r(1537)](){let t=r,n=this[t(465)][t(286)](this[t(1663)]),o=JSON[t(563)](n||"{}");return Object[t(1537)](o)}async getAll(){let t=r,n=this[t(465)][t(286)](this[t(1663)]),o=JSON[t(563)](n||"{}");return Object.values(o)}[r(887)](){return Promise[r(662)]()}get[r(511)](){let t=r,n={nBAkf:function(o,c){return o===c},UewwL:e[t(590)]};if(e[t(1194)](e[t(1676)],e[t(296)])){if(this[t(953)+t(934)]=!0,this[t(1076)+t(1107)](),this[t(1191)+t(1136)](),this[t(488)+t(1164)+t(1251)](),this._QoSManager?.[t(887)](),!this[t(1552)])return void this._debug(t(1378)+"s instan"+t(1258)+t(1103)+"ed");if(n[t(586)](this[t(1552)].readyState,this[t(230)])||n.nBAkf(this[t(1552)][t(553)+"te"],this[t(593)]))return void this._debug(n[t(1437)]);this["_destroy"+t(1510)+"t"](_0x480a20,_0x28a06f)}else return!!this[t(465)]}}class t0{constructor(t,n){let o=r;this[o(1174)]=t,this._pathKey=n,this[o(465)]=Ge?tt:bt?wx:null}async[r(1620)](){}get[r(1663)](){return"frontier_"+this._DBName}async[r(784)](t){let n=r,o=this[n(465)][n(1154)+n(191)](this[n(1663)]);return JSON.parse(e[n(388)](o,"{}"))[t]}async[r(478)](t,n){let o=r,c=this._qosDB.getStorageSync(this[o(1663)]),d=JSON[o(563)](e.pesXD(c,"{}"));return d[n||t[this[o(1693)]]]=t,this[o(465)][o(1307)+o(191)](this[o(1663)],JSON[o(815)+"y"](d)),n||t[this[o(1693)]]}async del(t){let n=r,o=this._qosDB[n(1154)+n(191)](this[n(1663)]),c=JSON[n(563)](e[n(1248)](o,"{}"));return c[t]=void 0,this[n(465)]["setStora"+n(191)](this._prefix,JSON[n(815)+"y"](c))}async[r(712)](){let t=r;return this[t(465)][t(305)+t(734)]()}async[r(1537)](){let t=r,n=this._qosDB["getStora"+t(386)+"nc"](this[t(1663)]),o=JSON[t(563)](e[t(1368)](n,"{}"));return Object[t(1537)](o)}async getAll(){let t=r,n=this[t(465)][t(1154)+"geInfoSync"](this[t(1663)]),o=JSON.parse(e[t(1621)](n,"{}"));return Object.values(o)}[r(887)](){return Promise[r(662)]()}get isReady(){let t=r,n={JFFIP:function(o,c,d){return e[A(1700)](o,c,d)}};if(e[t(1031)](e[t(857)],e[t(857)]))ZXHbxw[t(1604)](_0x5f50fe,_0x542b32,10),_0x4ad65a(_0x3201d8,_0x29455a);else return!!this[t(465)]}}function cs(s,t){let n=r;if(e[n(1070)]!==e[n(627)]){if(e[n(302)](Ge,Ge))return new t0(s,t);if(e[n(708)](rt,yt)&&e.flUke(e[n(1697)],typeof indexedDB))return new $o(s,t);if(e[n(1434)](rt,yt)&&e[n(244)](e.OatgY,typeof localStorage))return new e0(s,t);throw new Error(e.aMZlK)}else this._DBName=_0x7a15ff,this[n(1693)]=_0x167785,this[n(465)]=_0x1bbd55}class n0{constructor(){let t=r,n={Wnsob:function(o,c){return o<=c},mCoVf:function(o,c){return o>=c}};if(e.wAHnL(e[t(1666)],e.MTHFP))this[t(1671)+"lTimeoutId"]=null,this._interval=36e5,this[t(465)]=e[t(1624)](cs,t(668),t(1589)+"id");else{if(JIeRdQ.Wnsob(_0x569161,-_0x1e9d82))return _0x3065f0;if(JIeRdQ.mCoVf(_0x88bfba+1,_0x3c20f4))return _0x372744}}async[r(1671)+r(855)](){let t=r;e.KHwGh(clearInterval,this[t(1671)+t(849)+"Id"]),this[t(1671)+t(849)+"Id"]=e[t(1196)](setInterval,()=>{let n=t;this[n(1049)+n(1486)]()},this[t(1671)+"l"])}async[r(1620)](){let t=r;await this._qosDB[t(1620)]()[t(536)](()=>{let n=t;this[n(1671)+n(855)]()})}async["flushExp"+r(1486)](){let t=r,n={mwhiJ:function(d,p){return e.GXeBn(d,p)},EIrnk:e[t(546)],dRUXa:e[t(1082)]};(await this._qosDB?.getAll()||[])[t(633)](({timestamp:d})=>d<Date.now())[t(570)](d=>{let p=t;if(n[p(554)](n[p(218)],n.dRUXa))this[p(465)]?.[p(1040)](d[p(1589)+"id"]);else for(var m in _0x37a3df)_0x1bf11f(_0xf8fd64,m,{get:_0x5345ea[m],enumerable:!0})})}async[r(1040)](t){let n=r;return this[n(465)]?.[n(1040)](t)}async[r(478)](t,n){let o=r;return this[o(465)]?.[o(478)]({message_id:t,timestamp:n})}async[r(784)](t){return this[r(465)]?.get(t)}async closeDB(){let t=r;e[t(435)](clearInterval,this["_interva"+t(849)+"Id"]),await this[t(465)]?.[t(887)]()}get[r(511)](){let t=r;return this[t(465)]?.[t(511)]}}function Vn(s){let t=r,n={wEMRa:function(o,c){return o(c)},yQUHb:function(o,c){return e[A(728)](o,c)},NotnK:function(o,c){return e[A(905)](o,c)},MgvPl:function(o,c){return e[A(565)](o,c)},vnEqy:function(o,c){return e[A(467)](o,c)},OaLmW:function(o,c){return o|c}};if(e.dFcBy(e[t(775)],t(1625))){let o=!!this._options[t(408)+"S"];if(!o)return{enabled:o,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let c=e[t(564)](ze,s.message[t(1531)],e[t(1003)],"2"),d=c&&e[t(692)](ze,s[t(1092)][t(1531)],t(1499)+"er_qos_ack","1"),p=c&&ze(s[t(1092)][t(1531)],e.aLWBf,"1"),m=p?st(s[t(1092)][t(1531)],t(1499)+t(1553)+"sgid")?.split(",")[t(633)](Boolean)||[]:[];return{enabled:o,isQoSMessage:c,isQoSAck:d,isAckCleanupMessage:p,ackMsgIds:m}}else{if(_0x982783<1||_0x338781>_0xc22fca)return n[t(989)](_0x122cf1,_0x5c4d8a);n[t(719)](n[t(347)](_0x16f071,_0x36b11f),_0x2e7cd7)&&(_0x33f066=n[t(1364)](_0x10d2ba,_0x1073f1),_0x34eab1=0);let o=_0x528775[t(1419)](_0x1c6232,_0x25f248,_0x2f60cf+=_0x3f96de);return 7&_0x421d62&&(_0x45fd34=n[t(400)](n[t(217)](7,_0x33c46a),1)),o}}async function fs(){let s=r;return this["_QoSMana"+s(709)]||(this[s(597)+"ger"]=new n0),this["_QoSMana"+s(709)][s(511)]||await this._QoSManager[s(1620)](),this["_QoSMana"+s(709)]}async function r0(s,t){let n=r,{enableAutoAck:o}=this[n(780)],c=e[n(1508)](ze,s.message[n(1531)],e[n(480)],"1"),d=ze(s[n(1092)][n(1531)],e[n(834)],"1"),p=Vn[n(1419)](this,s);if(e.vNjaz(o,c)){let{SeqID:m,LogID:l,service:y,LogIDNew:v,method:E}=s[n(1092)];this[n(1417)]({SeqID:m,LogID:l,LogIDNew:v,service:y,method:E,headers:[{key:n(1435),value:"1"},{key:e.TIOYN,value:e[n(279)](v,"")},{key:e[n(1400)],value:"0"}]})}d&&!p[n(1516)]&&this[n(1219)+n(263)+n(918)](s),e[n(1407)](t)}async function s0(s,t){let n=r;this[n(383)](n(1298),s[n(1092)]),t()}async function i0(s,t){let n=r,o=e.ZHleY(Gr,await xs(s.data));try{if(e[n(761)](o[n(221)],Uint8Array))if(e[n(445)]!==e[n(445)])_0x12dcb6=e[n(211)](e[n(889)](e[n(292)](15,_0x2dd6bc),12),e[n(1295)](e.XNInv(63,_0x3141df),6))|63&_0x18bc24,e[n(652)](_0x595f15,2048)||e[n(1347)](_0xea4f63,55296)&&e.SIMqb(_0xdca8d2,57343)?_0x30d232+=_0x50531a:(_0x42f0ac+=_0x4024e8(_0x50bbcf),_0x27fde4+=2);else{let c=this[n(780)][n(364)+n(1128)]instanceof Object?{force:!!this[n(780)][n(364)+"ncoding"][n(1536)],encoding:this[n(780)][n(364)+n(1128)][n(318)]?this[n(780)][n(364)+n(1128)][n(318)][n(1564)](/\s/g,"")[n(228)+n(998)]():""}:{force:!1,encoding:this[n(780)]["payloadE"+n(1128)]?this._options["payloadE"+n(1128)][n(1564)](/\s/g,"")[n(228)+"ase"]():""},d=o[n(364)+n(1128)]?o[n(364)+n(1128)][n(1564)](/\s/g,"")[n(228)+n(998)]():"",p=e[n(612)](this._options[n(1628)+n(1616)],Object)?{force:!!this[n(780)][n(1628)+n(1616)][n(1536)],type:this[n(780)][n(1628)+"ype"][n(367)]?this._options[n(1628)+"ype"].type.replace(/\s/g,"")[n(228)+n(998)]():""}:{force:!1,type:this[n(780)][n(1628)+"ype"]?this._options[n(1628)+n(1616)].replace(/\s/g,"")[n(228)+n(998)]():""},m=o[n(1628)+n(1616)]?o[n(1628)+n(1616)].replace(/\s/g,"")[n(228)+n(998)]():"",l=p[n(1536)]?p[n(367)]:m||p.type,y=c[n(1536)]?c[n(318)]:d||c[n(318)],v=[e[n(1357)],e.BGjcB,e[n(1420)],e[n(1382)]],E=[e[n(1019)],e[n(573)]];this._options.enableTransformTextPayload&&v[n(1184)](l)&&(!y||E.includes(y))?o["textPayl"+n(1599)]=e[n(564)](as,o.payload,0,o[n(221)].byteLength):o.textPayload=""}else o[n(422)+n(1599)]=""}catch(c){e[n(1034)](e.nUwVT,e[n(285)])?FcUTnl.RxCoB(_0x39f5f8,_0x2c4ec4)&&_0x5a34c8[n(478)](_0x424656,_0x595a93):(o.textPayload="",console[n(899)](c))}s[n(1092)]=o,e[n(1482)](t)}function o0(s,t,n){let o=e.WQstY(n,8192),c=o>>>1,d=null,p=o;return function(m){let l=A;if(e.GXeBn(e[l(1637)],e.HDAEQ)){if(e[l(1523)](m,1)||e[l(1015)](m,c))return e.CDPOI(s,m);e.pXupO(p,m)>o&&(d=e.dNgMJ(s,o),p=0);let y=t[l(1419)](d,p,p+=m);return e.mJzZR(7,p)&&(p=e[l(905)](e[l(1635)](7,p),1)),y}else this[l(937)+l(1180)]=_0x4712bc,this[l(424)]=0}}let a0=4294967295;function x0(s,t,n){let o=r,c={VqJIN:e.ZoPZD,QJwEe:o(592),LkMTC:function(d,p){return e[o(540)](d,p)}};if(e.ZGfaN(e[o(941)],o(1393))){let d={rRtmN:function(y,v){return y(v)},hvsgP:function(y,v){let E=o;return CrgvcX[E(907)](y,v)},LeCzI:function(y){return y()}},p=()=>{let y=o;_0x365769[y(1682)+y(252)+"ner"](CrgvcX[y(1013)],m),_0x154fb1[y(1682)+y(252)+y(1133)](CrgvcX[y(666)],l)},m=()=>{let y=o;d[y(713)](_0x520264,d[y(411)](_0x3bd588,_0x199f69[y(958)])),p()},l=()=>{let y=o;d.rRtmN(_0x41e855,_0x439ced.error),d[y(326)](p)};_0x4175ed[o(873)+o(1251)](CrgvcX.VqJIN,m),_0x3049a2[o(873)+o(1251)](o(592),l)}else return RangeError(e[o(508)](e[o(999)](e[o(476)](e[o(382)](e.rIvoj+s,e.Gywxb),e[o(631)](t,1)),e[o(1694)]),n))}function c0(s,t,n){let o=r;if(e[o(1064)](n,a0))throw new Error(e[o(154)]);let c=3;for(;c>=0;)if(e[o(260)]===e[o(260)]){let d=e[o(645)](255,n);e[o(1508)](Xn,d,s,t+c),n>>>=8,c--}else _0x4680d2=_0x33c81d[e[o(1381)](e[o(453)](_0x5b8044,_0x2e750f),1)],_0x2d2787=_0x90f40e[e.VMOzZ(e[o(233)](_0x5ee90a,_0x196431),2)],_0x2d3ffd=_0x301332[e[o(1112)](e.AvJZl(_0x1ae636,_0x14353d),3)],e.UpDMD(e[o(185)](e.KnNXq(e.SedBy(_0x5c583a,e.ocWSz(_0x2634bb,8)),e[o(1220)](_0x3d4e54,16)),12632256),8421504)?_0x36fac4+=_0x5a0c5d:(_0x45356c=e.oaiBL(e[o(1618)](e[o(1361)](e[o(1509)](e[o(584)](7,_0x193931),18),e.TSwYh(e[o(681)](63,_0x100f53),12)),e.lATnc(e[o(1598)](63,_0x42ecf0),6)),63&_0x25b7a0),_0x5b1e53<65536||e[o(451)](_0x4a41b9,1114111)?_0x4a93ba+=_0x23bcad:(_0x3517d7-=65536,_0x25d6c5+=e[o(333)](_0x42bf08,e.GWOCB(e[o(978)](_0x13690a,10),55296),e[o(1074)](e[o(602)](1023,_0x4eb344),56320)),_0x30b91b+=3));return e[o(1622)](t,4)}function f0(s,t){let n=r,o=0,c=t,d=e[n(905)](t,4);for(;e[n(341)](c,d);){let{value:p,offset:m}=e.dmvwQ(Jn,s,c);c=m,o=e.zYoEb(o<<8,0),o+=p}return{value:o,offset:d}}function u0(s,t,n){let o=r,c=e.Pvwfo.split("|"),d=0;for(;;){switch(c[d++]){case"0":if(e.PeLVv(s[o(208)],40))return e.NvOtr(e[o(748)](Gn,s,t,n),n);continue;case"1":if(t[o(725)+"e"])return e[o(1021)](t[o(725)+"e"](s,n),n);continue;case"2":if(t.write)return e[o(1654)](t[o(515)](s,n),n);continue;case"3":if(!s)return n;continue;case"4":return e[o(1207)](Gn(s,t,n),n)}break}}function d0(s,t){let n=r,o=new R(e[n(1605)](e[n(846)](s[t+4]<<24|s[t+5]<<16,e[n(324)](s[e[n(904)](t,6)],8)),s[e.EiXsY(t,7)]),e.wYFYN(e.WKniH(s[t+0],24)|e[n(992)](s[e[n(339)](t,1)],16),e.TSwYh(s[t+2],8))|s[e[n(176)](t,3)],!0);return t+=8,{value:o,offset:e[n(437)](t,8)}}function l0(s,t,n){let o=r,c=s[o(1411)],d=s.high;return t[n]=d>>>24,t[e[o(1074)](n,1)]=e[o(226)](d,16)&255,t[e[o(699)](n,2)]=d>>>8&255,t[n+3]=255&d,t[e[o(679)](n,4)]=e[o(786)](c,24),t[n+5]=e[o(1288)](c>>>16,255),t[e[o(1521)](n,6)]=e[o(962)](e[o(1249)](c,8),255),t[e[o(1569)](n,7)]=e[o(1471)](255,c),n+=8,n}function Jn(s,t){let n=r;return s.readUInt8?{value:s.readUInt8(t),offset:e[n(1385)](t,1)}:{value:e.RjdhN(255,s[t]),offset:e[n(1152)](t,1)}}function Xn(s,t,n){let o=r;return t.writeUint8?t[o(306)+"t8"](s,n):t[n]=e[o(1598)](255,s),e[o(1293)](n,1)}let h0=function(s){return new Uint8Array(s)},g0=e[r(461)](r(756)+"d",typeof Buffer)?Buffer.allocUnsafe:e[r(932)](o0,h0,Uint8Array.prototype[r(884)]),p0=16,Zn=32;function m0(s){let t=r;if(e.GZeRy===t(462))_0x5cab9d[t(458)+t(361)]=void 0,_0x5cacab(t(284)+t(413));else{let n=0,o={};for(let c=0;e[t(456)](c,s[t(208)]);c++)e[t(1010)](e[t(707)],e.oWGnE)?_0x1dae2a[t(158)](_0x271fae):(o[s[c][t(828)+t(1111)]]=os(s[c][t(828)+t(1111)]),n+=e.KTGdE(14,o[s[c][t(828)+t(1111)]]));return[n,o]}}function us(s,t,n){let o=r,c={iSXzG:function(y,v,E,P){return e[A(1161)](y,v,E,P)},tfhbU:e.rvoLA,coIWj:e.MdPUn,lUhpY:function(y,v,E,P){return e[A(677)](y,v,E,P)},zERcy:function(y,v,E,P){return e[A(692)](y,v,E,P)},BKRst:e.bgYld,CfKnG:e[o(753)],HtFev:e[o(596)]},[d,p]=e[o(1623)](m0,s),m=e[o(964)](g0,d),l=0;return s.forEach(y=>{let v=o,E=(v(1165)+v(1647)+"|3|1|8").split("|"),P=0;for(;;){switch(E[P++]){case"0":l=c[v(1469)](u0,y.cursor_name,m,l);continue;case"1":l=c[v(1469)](l0,R.fromNumber(y[v(532)]||t),m,l);continue;case"2":console[v(899)](c.tfhbU,l);continue;case"3":console[v(899)](c[v(247)],l);continue;case"4":l=c.lUhpY(Xn,0,m,l);continue;case"5":l=c.zERcy(Xn,p[y[v(828)+v(1111)]],m,l);continue;case"6":l=c[v(1365)](c0,m,l,y[v(1708)]||0);continue;case"7":console[v(899)](c.BKRst,l);continue;case"8":console.log("curvalue",l);continue;case"9":console.log(c[v(850)],l);continue;case"10":console[v(899)](c[v(304)],y,y[v(1708)]);continue}break}}),{frameType:Zn,headers:[{key:e[o(1515)],value:n}],payload:m}}function _0(s){let t=r;if(e[t(1222)]===e[t(595)])_0x45e571(_0x5ca209,96),_0x41264(_0x46457d,e.GNQfz(_0x9ceaac,_0x220bb7));else{let n=0,o=[];for(;e[t(220)](n,s[t(1260)+"th"]);)if(e.WsVLf===e.HKgHz){let{url:c}=_0x1bf600||{},d=_0x5c74ca[t(1335)](c)?c:e[t(1382)]==typeof c?[c]:[];_0x186f9e&&_0x3f6f3e[t(1646)](this._options,_0x33b362),d&&d.length?this[t(703)+t(1135)]=new _0x58e325(d,this[t(780)][t(1120)+"es"]):this[t(703)+t(1135)]?.[t(193)+t(1415)+t(1511)](),this[t(883)+t(555)]?.[t(268)+t(1106)](this[t(780)][t(957)+t(938)]),this[t(953)+t(934)]=!1,this._ws&&this[t(1552)].readyState!==this.CLOSED?this[t(1109)+"ect"](1e3,t(561)+t(297)+t(1545),!0):(this[t(1642)]=!0,this[t(1377)]())}else{let{offset:c}=e[t(842)](Jn,s,n);n=c;let d={cursor_name:"",cursor:0,service:0},{value:p,offset:m}=f0(s,n);d[t(1708)]=p,n=m;let{value:l,offset:y}=e[t(333)](Jn,s,n);n=y,d[t(828)+t(1111)]=as(s,n,e[t(382)](n,l)),n+=l;let{value:v,offset:E}=e[t(933)](d0,s,n);d[t(532)]=v[t(755)](),n=E,o[t(158)](d)}return o}}function w0(){let s=r;return{frameType:Zn,headers:[{key:e[s(1515)],value:e[s(258)]}],payload:void 0}}class b0{constructor(t,n,o){let c=r;this[c(1563)+c(1200)]=t,this["_cursorF"+c(1096)]=n,this[c(471)+c(513)]=o,this[c(465)]=e[c(908)](cs,this["_cursorN"+c(1200)],e[c(1008)])}async[r(1620)](){let t=r;await this[t(465)][t(1620)]()}async[r(670)+"rs"](){let t=r;if(e[t(1162)](e[t(1370)],t(875))){let n=this[t(703)+"tManager"]?.[t(869)+t(1607)+"nt"]();this._debug(t(930)+n+t(1581)),this[t(1109)+t(606)](1001,e.Itbyq,!0)}else{if(!this._qosDB[t(511)])return;let n=this[t(471)+t(513)],o=await this._qosDB[t(394)]();switch(console.log(e[t(365)],o),n){case"ALL":return o&&o[t(208)]?e[t(677)](us,o,0,this[t(1234)+t(1096)]):void 0;case e[t(1137)]:return;case t(391):return o&&o[t(208)]?us(o,0,this[t(1234)+t(1096)]):e.vExAG(w0)}}}async set(t,n,o){let c=r,d={cJAaV:function(p,m,l){return e[A(1273)](p,m,l)}};if(e[c(1454)](e.yVvqp,c(765)))gAVzRw[c(1445)](_0x45e587,_0x5bb629,90),gAVzRw[c(1445)](_0x2e1999,_0x5a51b8,_0x5cccf4);else return console[c(899)](c(323),t,n,o),this[c(465)][c(478)]({cursor_name:t,cursor:n,service:o})}async[r(547)+"rs"](t){let n=r,o=e[n(1680)](_0,t);for(let c of o)console.log(e[n(1539)],o),await this[n(465)].set(c)}async get(t){let n=r,o={jYVIp:e[n(1073)]};if(e[n(1561)](n(310),e[n(988)]))return(await this[n(465)][n(784)](t))?.cursor;{let c=_0x20110a(o[n(243)],{message:_0x4c1732[n(1092)],code:_0x45921a[n(1351)+n(1458)],error:_0x58545d});this[n(1219)+"hErrorEv"+n(839)](c)}}async closeDB(){let t=r;e.XAwox(e[t(886)],t(1209))?(_0x3db4b0=e[t(581)](_0x4dc859,_0x4f6d22),_0x64bbd5=e[t(888)](127,_0x4746ae),128&_0xc22826&&(_0x4e207d=e[t(1426)](_0x38587f,_0x49f738),_0xc666fe|=e.nPRJB(e[t(495)](127,_0x5914ad),7))):await this[t(465)][t(887)]()}[r(377)+r(525)+r(1533)](t){let n=r;e[n(996)]===e[n(371)]?(this._cursorNameSpace=_0x156f03,this[n(1234)+"ileName"]=_0x3bcc07,this[n(471)+"Strategy"]=_0x2abf4e,this._qosDB=e[n(190)](_0x28ab13,this["_cursorN"+n(1200)],e[n(1008)])):this["_cursorF"+n(1096)]=t}get[r(511)](){let t=r,n={MLzUj:function(o,c,d){return e.BKnOc(o,c,d)},SvybA:t(768)};if(e[t(507)](e[t(1280)],t(1322))){let o=this[t(703)+t(1135)]?.[t(869)+t(1607)+"nt"]();this._dispatchCloseEvent(n.MLzUj(_0x6f576d,n[t(416)],{code:_0x1b28fe[t(983)],reason:t(1424)+t(1054)+"d, unkno"+t(1271)+t(794)+t(1340)+o})),this[t(703)+"tManager"]?.[t(193)+"pointCon"+t(1511)](),this[t(883)+t(555)]?.[t(268)+t(1106)]();return}else return this[t(465)][t(511)]}}let y0="__x_msg_"+r(659);async function ds(s){let t=r;if(!this._options[t(408)+"S"])return null;let{aID:n,fpID:o,messageStrategy:c}=this._options,d=e[t(375)](s,y0);try{if(e[t(820)](e[t(1326)],e[t(1326)]))this["_cursorF"+t(1096)]=_0x5402f4;else return this[t(1456)+t(1299)]?s&&this[t(1456)+t(1299)][t(377)+t(525)+t(1533)](s):this[t(1456)+"anager"]=new b0(o+"_"+n+"_"+d,d,c),this[t(1456)+t(1299)].isReady||await this[t(1456)+t(1299)][t(1620)](),this[t(1456)+"anager"]}catch{return null}}async function v0(s,t){let n=r;if(e[n(880)]!==e[n(1696)]){let o=e[n(1309)](ze,s[n(1092)][n(1531)],n(983),"-1"),c=e[n(1508)](ze,s[n(1092)][n(1531)],e.TDzCF,"1"),d=st(s.message.headers,"x_fronti"+n(1005)),p=e[n(1188)](Number,e.igsRa(st,s.message.headers,e[n(774)]))||0,m=Vn[n(1419)](this,s),l=e[n(1309)](ze,s[n(1092)][n(1531)],e.hcsIu,"2"),y=e[n(1122)](st,s.message[n(1531)],e.CEPUK),v=e[n(729)](Number,e.MkpkS(st,s.message[n(1531)],e[n(153)]));if(m[n(1516)])return e[n(457)](t);let E=m[n(1113)+n(346)]?await fs[n(1419)](this):null;if(e[n(1091)](s[n(1092)][n(1708)],0)&&c&&!o||e.OWzEu(s.message.service,0)){if(e[n(894)](e[n(426)],n(569)))return this[n(1219)+n(1430)+"Event"](_0x1b5879),e[n(457)](_0x54ac90);if(d&&m[n(1113)+n(346)]&&E)if(e[n(1162)](e[n(1644)],"iHVwx"))try{this[n(1552)]&&this[n(1552)][n(768)](_0x18ecb4,_0x34db95)}catch{}else return await E[n(784)](d)||(e[n(357)](e[n(1356)],e.kbVZe)?(this[n(1219)+"hMessage"+n(502)](s),await E[n(478)](d,e[n(669)](Date[n(401)](),p))):(FcUTnl[n(417)](FcUTnl.OatgY,typeof _0x467e99)&&_0x5460ca[n(1369)+n(1704)]&&_0xbfe80b[n(1302)+"operty"](_0x138af0,_0x2f89a4[n(1369)+n(1704)],{value:FcUTnl[n(440)]}),_0x2aabb5[n(1302)+n(760)](_0x643a9e,FcUTnl.fKhMI,{value:!0}))),e[n(229)](t);if(l)if(e[n(209)](n(1476),n(1476))){let P=0,T=0,O;do O=e[n(1047)](_0x463d63,_0x4a9609),P<32&&(T|=e.zpOMU(127&O,P)),P+=7;while(e[n(161)](128,O));return T}else{let P=await ds[n(1419)](this);if(!P)return this["_dispatc"+n(1430)+"Event"](s),t();let T=await P[n(784)](y)??-1;if(e[n(571)](T,v))this[n(1219)+n(1430)+n(502)](s),P[n(478)](y,v,s[n(1092)].service);else throw new Error(n(1172)+n(876)+n(1235)+v+(" larger "+n(259)+n(1474)+"r ")+T);return e[n(805)](t)}return this[n(1219)+n(1430)+n(502)](s),e[n(1482)](t)}}else e[n(1161)](_0xab327a,this,_0x125db3,[_0x444a70,_0x5e6e89,_0xd48365,_0x14f914,_0x51344f,_0x591073])}async function S0(s,t){let n=r,o=Vn.call(this,s);if(!o["isQoSMes"+n(346)])return e.lQdoG(t);let c=await fs[n(1419)](this);if(o[n(1670)+n(646)+n(373)]&&o[n(1384)+"s"][n(208)])for(let d of o.ackMsgIds)await c[n(1040)](d);t()}async function E0(s,t){let n=r,o=s[n(1092)][n(1043)+"e"]===p0,c=e.eQfEP(s[n(1092)][n(1043)+"e"],Zn);if(!o&&!c)return e[n(805)](t);let d=e[n(604)](st,s[n(1092)][n(1531)],e[n(1515)]);if(!d)return t();let p=await ds[n(1419)](this,d);if(!p)return e[n(792)](t);if(o){let m=await p[n(670)+"rs"](),l={frameType:m?.[n(1043)+"e"],SeqID:R[n(1147)+"er"](this[n(1027)]++),LogID:R[n(1147)+"er"](this._options.logIDGenerator()),service:9e3,method:5,headers:m?.[n(1531)],payload:m?.payload},y=e[n(349)](D,l);this[n(1552)]&&this[n(1552)][n(553)+"te"]&&this[n(1552)][n(689)](y)}if(c){let m=s[n(1092)][n(221)];m&&p[n(547)+"rs"](m)}}let C0=async function(s,t){let n=r;this[n(1642)]=!1,e[n(625)](clearTimeout,this["_connectionTimeo"+n(169)]),t()},D0=async function(s,t){let n=r;if(!this[n(1552)]||e[n(820)](this[n(1552)][n(553)+"te"],this[n(245)]))return e.Wijvn(t);let{pingInterval:o}=this[n(780)];this._endpointManager?.[n(193)+n(1415)+n(1511)]();for(let d=0;e[n(309)](d,this[n(471)+n(1639)][n(208)]);d++){let p=this[n(471)+n(1639)][d];if(e[n(738)](this[n(1552)][n(553)+"te"],this[n(245)])&&e[n(1034)](null,p))this._ws&&this._ws[n(689)](p),this[n(471)+n(1639)][d]=null;else break}this[n(471)+"Queue"]=this["_message"+n(1639)][n(633)](d=>!!d),this[n(272)+"gTimeoutId"]=e.JDgmL(setTimeout,()=>this[n(1278)](),o),this[n(1219)+n(1125)+"nt"](s),this[n(1214)+"er"]&&this._ws&&(this[n(1552)][n(809)+"pe"]=this[n(878)+"ype"]);let c=this[n(703)+n(1135)]?.[n(869)+n(1607)+"nt"]();this[n(383)](n(254)+c+n(1316)),e[n(174)](t)},A0=async function(s,t){let n=r,o=this["_endpoin"+n(1135)]?.[n(869)+"ntEndpoint"]();this._debug("open "+o),e[n(792)](t)};class P0 extends Hn{constructor(t){let n=r,o={VCUQF:function(c,d){return e[A(1621)](c,d)},wSFii:function(c,d,p){return e.BCUVG(c,d,p)},XySud:e[n(1095)]};if(e.yIkrL(e[n(950)],n(882))){super(),this[n(1266)+"igatorOnline"]=!0,this[n(1214)+"er"]=rt,this[n(1432)]=Ho,this[n(1014)+"T"]=Ge,this._isMiniWX=bt,this[n(1674)+"r"]=yt,this[n(471)+"Queue"]=[],this[n(703)+n(1135)]=null,this[n(953)+n(934)]=!1,this[n(878)+n(1616)]=e.AbBjM,this[n(1377)+n(967)]=!1,this["_connect"+n(1169)+n(169)]=null,this[n(885)+"ctTimeou"+n(1452)]=null,this["_pingPon"+n(537)+"Id"]=null,this[n(1027)]=0,this[n(1642)]=!1,this[n(1485)]="",this[n(597)+n(709)]=null,this[n(1456)+n(1299)]=null,this._pingLossCounter=null,this[n(1376)+"ls"]=e.yPLfe,this.CLOSED=3,this[n(1183)+"NG"]=0,this[n(245)]=1,this[n(593)]=2,this._onOpen=m=>{let l=n;if(e[l(1035)](e[l(598)],e.pXVsk))try{e.jjzuJ(is,this,m,[C0,D0,A0])}catch(y){let v=e[l(1354)](ue,e[l(1073)],{message:y.message,code:Me[l(1065)+"OR"],error:y});this["_dispatc"+l(1272)+l(839)](v)}else{let y=this[l(465)][l(1154)+l(191)](this[l(1663)]),v=_0x14792d[l(563)](ntZEYm[l(539)](y,"{}"));return v[_0x2d3023||_0x4b426d[this[l(1693)]]]=_0x3df5bd,this[l(465)][l(1307)+"geSync"](this[l(1663)],_0x4ea362.stringify(v)),_0x11908e||_0x470003[this[l(1693)]]}},this._onMessage=async m=>{let l=n,y={tEddx:function(v,E){return e[A(729)](v,E)}};if(e[l(793)](e[l(246)],e.vywnD))this[l(329)](l(1392),ntZEYm[l(767)](_0x2a3ccc,ntZEYm.XySud,{..._0x4d907f,data:_0x639770[l(331)]||""}));else{let{pingInterval:v,pingFrequency:E}=this[l(780)];if((e[l(641)]("hi",m[l(1317)])&&e[l(1561)](e.BxJnd,E)||e.xgzVi(l(338),E))&&(this["_clearPi"+l(1136)](),this[l(329)](e[l(489)],e[l(776)]),this[l(272)+l(537)+"Id"]=e[l(801)](setTimeout,this[l(1278)][l(438)](this),v)),m.data==="hi")return;try{e[l(1508)](is,this,m,[i0,r0,S0,E0,v0,s0])}catch(P){if(e[l(1167)]===e[l(1167)]){let T=e.GmZHQ(ue,e[l(1073)],{message:P.message,code:Me.MESSAGE_ERROR,error:P});this["_dispatc"+l(1272)+l(839)](T)}else _0x38f689=CfRZEJ.tEddx(_0x335964,_0x43082d),_0x37c465=0}}},this[n(1046)]=m=>{let l=n,y=this[l(703)+l(1135)]?.[l(1477)+l(1425)+"es"](),v=this[l(703)+"tManager"]?.[l(869)+l(1607)+"nt"]();if(y&&!m[l(1092)]){let E=l(930)+v+(l(404)+l(591)+l(1578)+"ed");this[l(1219)+l(1272)+l(839)](e[l(333)](ue,e.vgtXf,{message:E,code:Me.MAX_RETRIES_ERROR,error:m}));return}this[l(1552)]&&e.JCOOU(this[l(1552)][l(553)+"te"],this.OPEN)&&this[l(1109)+l(606)](),this["_dispatchErrorEv"+l(839)](e[l(1075)](ue,e[l(1073)],{message:m[l(1092)],code:Me[l(374)+l(900)],error:m}))},this[n(1264)]=async m=>{let l=n,y={djggw:function(E,P){return E(P)},aVuac:function(E,P){return e[A(1591)](E,P)}};this._clearTimer(),this["_clearPi"+l(1136)](),this[l(1613)+l(897)+"rs"](),this[l(1552)]=null,this[l(1377)+l(967)]=!1;let v=this[l(703)+l(1135)]?.["checkRea"+l(1425)+"es"]();if(!v&&this[l(684)+l(754)]()&&!this[l(953)+l(934)])if(e[l(1216)](e[l(1358)],e[l(1263)])){let E=VMQasR[l(1142)](_0x1e51a6,_0x1c2b49),P=_0x5d2d28[l(1675)];return _0x40aab8[l(1675)]=VMQasR.aVuac(_0x47734b[l(1388)],E),P}else{let E=this[l(703)+"tManager"]?.[l(869)+l(1607)+"nt"](),P=this._options["reconnec"+l(501)+l(656)](m.code,m[l(413)]);this[l(1219)+l(358)+"ent"](e.aGiRc(ge,e.aqZOI,{code:1006,reason:m.reason||l(1424)+l(1054)+l(294)+"wn reaso"+l(794)+l(1340)+E,willReconnect:P})),P&&this[l(1377)]();return}if(e[l(1527)](1e3,m[l(983)])&&this["_readyCl"+l(934)]){this[l(1219)+l(358)+l(839)](e[l(1101)](ge,l(768),{code:1e3,reason:l(1048)})),this["_endpoin"+l(1135)]?.[l(193)+l(1415)+l(1511)](),this["_pingLos"+l(555)]?.resetCounter();return}if(e.XeNxD(1e3,m[l(983)])&&v){let E=this[l(703)+l(1135)]?.[l(869)+l(1607)+"nt"](),P=m[l(413)];P||(P=await e[l(825)](Yo,this[l(1485)])),P=l(1424)+l(1054)+l(821)+P+(l(1267)+l(1297))+E+(l(535)+l(441)+l(1334)),this["_dispatc"+l(358)+l(839)](ge(e[l(1320)],{code:m[l(983)],reason:P}));let T=l(930)+E+(l(404)+l(591)+l(1578)+"ed");this["_dispatc"+l(1272)+l(839)](e.QzIss(ue,e.vgtXf,{message:T,code:Me[l(1586)+l(1562)+"R"]})),this[l(703)+"tManager"]?.[l(193)+l(1415)+l(1511)](),this[l(883)+l(555)]?.["resetCou"+l(1106)]();return}if(e.NNlgG(1e3,m.code)&&!m[l(413)]){let E=this[l(703)+l(1135)]?.[l(869)+l(1607)+"nt"]();this[l(1219)+"hCloseEv"+l(839)](e[l(1182)](ge,e[l(1320)],{code:m.code,reason:l(1424)+l(1054)+l(294)+l(1271)+l(794)+l(1340)+E})),this[l(703)+l(1135)]?.[l(193)+l(1415)+l(1511)](),this[l(883)+"sCounter"]?.[l(268)+l(1106)]();return}this["_dispatc"+l(358)+l(839)](m),this[l(703)+l(1135)]?.[l(193)+l(1415)+l(1511)](),this[l(883)+l(555)]?.["resetCou"+l(1106)]()},this.onclose=null,this[n(1086)]=null,this.onmessage=null,this[n(1403)]=null,this[n(1582)+n(297)]=null,this["onReceiv"+n(492)]=null,this[n(715)+"mediatel"+n(421)+"ct"]=null,this["_handleO"+n(1713)]=this[n(655)+"nLine"][n(438)](this),this[n(655)+n(1119)]=this[n(655)+n(1119)][n(438)](this),this._handlePageHide=this[n(1024)+"ageHide"][n(438)](this),this._handlePageShow=this[n(1024)+n(636)][n(438)](this),this[n(780)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(954)](1,0),service:0,logIDGenerator:x,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1631)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e.ZMrDs,env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:d}=t,p=Array.isArray(c)?c:n(572)==typeof c?[c]:[];if(!p||e.ralcF(0,p[n(208)]))throw new Error(e[n(379)]);if(!e[n(1444)](Vo,d))throw new Error(e.DDGVC);Object[n(1646)](this[n(780)],t),this[n(703)+n(1135)]=new ss(p,this[n(780)][n(1120)+"es"]),this[n(883)+n(555)]=new Zo(this[n(780)][n(957)+n(938)]),this[n(780)][n(732)+"cOpen"]&&(this[n(1642)]=!0,this[n(1377)]()),this[n(780)]["listenNe"+n(653)+"nged"]&&(this._isMiniTT||this._isMiniWX?this["_onPageN"+n(356)+n(314)]():this._isBrowser&&this[n(1150)+n(1164)+n(1251)]())}else e[n(1342)](_0x67a8bc,_0x4282bc,58),_0x376a9e(_0x3af4b8,_0x32f3b7)}[r(655)+r(1713)](){let t=r;this[t(780)][t(1423)+t(219)+t(1233)]||this[t(953)+"osed"]||this["_handleR"+t(297)]()}[r(655)+r(1119)](){let t=r;if(e[t(1031)](e[t(856)],e.cDqdC)){this[t(1677)+t(1510)+"t"]();let n=e.angPI(Kn,e[t(288)],{message:e[t(1447)]});this[t(715)+t(917)+t(421)+"ct"]&&this["onStopIm"+t(917)+t(421)+"ct"](n)}else{let n=this[t(465)].getItem(this[t(1663)]),o=_0x1bf2a4[t(563)](e[t(170)](n,"{}"));return o[_0x48b66e||_0x28f398[this[t(1693)]]]=_0x700d01,this[t(465)][t(1413)](this[t(1663)],_0x4653d7[t(815)+"y"](o)),_0x5e3959||_0x798396[this[t(1693)]]}}[r(1150)+r(1164)+"Listener"](){let t=r;e[t(1396)](e[t(150)],e.jGSxT)?(this[t(878)+"ype"]=_0x424749,this[t(1552)]&&(this._ws[t(809)+"pe"]=_0x4f2f78)):(this[t(1214)+"er"]&&window[t(873)+t(1251)](t(1009),this[t(655)+"nLine"]),this._isBrowser&&window[t(873)+"Listener"](e[t(739)],this[t(655)+t(1119)]),this[t(1214)+"er"]&&window.addEventListener(e[t(1659)],this["_handleP"+t(350)]),this[t(1214)+"er"]&&window[t(873)+"Listener"](e[t(979)],this[t(1024)+t(636)]))}[r(488)+r(1164)+r(1251)](){let t=r;this[t(1214)+"er"]&&window[t(1682)+t(252)+t(1133)](t(1009),this["_handleO"+t(1713)]),this._isBrowser&&window[t(1682)+t(252)+"ner"](e[t(739)],this[t(655)+t(1119)]),this[t(1214)+"er"]&&window[t(1682)+t(252)+"ner"](e[t(1659)],this[t(1024)+t(350)]),this[t(1214)+"er"]&&window[t(1682)+"entListe"+t(1133)](e[t(979)],this[t(1024)+t(636)])}[r(1024)+r(350)](t){let n=r;e[n(1246)](e[n(814)],e[n(814)])?(!t[n(986)+"d"]&&(this[n(1214)+"er"]&&window[n(1682)+n(252)+n(1133)](e[n(1659)],this[n(1024)+n(350)]),this[n(1214)+"er"]&&window[n(1682)+n(252)+n(1133)](e[n(979)],this._handlePageShow),this[n(768)]()),this[n(1214)+"er"]&&window[n(1682)+"entListener"](e[n(735)],this[n(655)+"nLine"]),this[n(1214)+"er"]&&window[n(1682)+"entListener"](e[n(739)],this[n(655)+n(1119)])):(this[n(367)]=_0x56980a,this[n(354)]=null)}["_handleP"+r(636)](t){let n=r;t[n(986)+"d"]&&(this[n(684)+n(754)]()&&(!this[n(1552)]||e.ATKAN(this[n(1552)][n(553)+"te"],this.OPEN)||e[n(820)](this[n(1552)][n(553)+"te"],this[n(1183)+"NG"]))&&this["_handleO"+n(1713)](),this[n(1214)+"er"]&&window[n(873)+n(1251)](e.OdTen,this[n(655)+n(1713)]),this[n(1214)+"er"]&&window[n(873)+n(1251)](e[n(739)],this[n(655)+n(1119)]))}async[r(1056)+r(980)](t){let n=r,o={Zmgln:function(c,d){return e[A(806)](c,d)},RsgEd:function(c,d){return c instanceof d},vqHDZ:function(c,d){return e[A(487)](c,d)},SwdAA:e[n(1382)],yFHPE:e[n(947)],giSlB:function(c,d){return e.HYErF(c,d)},gzhFh:e.bKvWT};if(e[n(845)](e[n(1568)],e[n(1568)])){let{fpID:c,deviceID:d,bddID:p,ttwID:m,accessKey:l,aID:y,customParams:v={},enableAutoAck:E,enableQoS:P,QoSLevel:T,env:O}=this[n(780)],De,$,ie;this._isBrowser||this._isMiniWX||this._isMiniTT?(De=location&&e[n(1100)]==location[n(1276)]?e[n(1483)]:e[n(1088)],$=t.replace(/((^ws)|(^http))((?:[s]*:\/\/))/,""),ie=/^wss(.*:\/\/)/[n(498)](t)?t:""+De+$):(De="wss://",$=t[n(1564)](/(^http)((?:[s]*:\/\/))/,""),ie=/(^ws)((?:[s]*:\/\/))/[n(498)]($)?$:""+De+$);let Ot=p?e[n(1231)]:m?"ttwid":e[n(1595)],ls=p||m||d;if(e[n(896)](!ls,!Ot))throw new Error(e.jsFdc);let T0=e[n(861)](e[n(204)],typeof v)?await e[n(1213)](v):v,I0=O?e[n(1700)](Xo,O.xUseEnv,O[n(722)]):{},Yn=Object[n(1646)]({device_platform:e[n(1706)],version_code:n(337)+"0",access_key:l,fpid:c,aid:y,[Ot]:ls,xsack:E?1:0,xaack:E?1:0,xsqos:P?1:0,qos_level:P?T:void 0,qos_sdk_version:2,...I0},T0),k0=Object[n(1537)](Yn)[n(1208)]((Qn,$n)=>Yn[$n]!==void 0?""+Qn+(Qn?"&":"?")+$n+"="+Yn[$n]:Qn,"");return ie+n(1362)+k0}else try{return ImxNuv.Zmgln(n(572),typeof _0x44c0c8)&&(ImxNuv.RsgEd(_0x484b17,_0x2093dc)||_0x1cbc1a[n(1242)]&&ImxNuv.RsgEd(_0x356519.buffer,_0x2e6045))||ImxNuv[n(852)](ImxNuv[n(1571)],typeof _0x4de66f)?"":(_0x1ed0eb[n(563)](_0x37a85f),ImxNuv.yFHPE)}catch{return ImxNuv.giSlB(n(572),typeof _0x9e4c4e)?ImxNuv[n(267)]:""}}async[r(1377)](){let t=r,n={UchwJ:function(o,c,d,p,m){return e.HJyZE(o,c,d,p,m)},MYyfC:function(o,c){return e[A(819)](o,c)},GeWAT:e[t(769)]};if(!(this["_connect"+t(967)]||this[t(953)+t(934)])){this[t(1377)+t(967)]=!0;try{if(e.aniEq("uEgYc",t(1603))){let o=this[t(703)+t(1135)]?.[t(603)+t(649)+t(1514)+t(1023)+t(1072)](),{timeoutInterval:c}=this._options;if(o){let p=this[t(703)+t(1135)]?.["getCurre"+t(1607)+"nt"](),m=this["_endpoin"+t(1135)]?.[t(1402)+"ackupEnd"+t(720)+"UpdateCount"](),l=this[t(703)+t(1135)]?.["getCurrentEndpoi"+t(691)+t(1180)]();if(m){let y="connect "+p+(" timeout, max re"+t(441)+"ached, w"+t(499)+t(522)+t(686))+m+" to retry",v=ue(e[t(1073)],{message:y,code:Me[t(1586)+t(1562)+"R"]});this[t(383)](y),this["_dispatc"+t(1272)+t(839)](v),this._url=await this[t(1056)+"eUrl"](m),this._debug(t(930)+m+" "+l+t(520)),this["_removeW"+t(897)+"rs"]()}else{let y=t(930)+p+(" timeout"+t(535)+"tries reached");this[t(383)](y),this[t(1219)+t(1272)+t(839)](e[t(835)](ue,"error",{message:y,code:Me[t(1586)+"IES_ERROR"]}));return}}else{let p=this[t(703)+t(1135)]?.[t(869)+t(1607)+t(1352)+t(277)](),m=this["_endpoin"+t(1135)]?.[t(869)+"ntEndpoi"+t(691)+t(1180)]();this[t(1485)]=await this[t(1056)+t(980)](e[t(1118)](p,"")),this[t(383)](t(930)+p+" "+m+t(520)),this[t(1613)+t(897)+"rs"]()}if(this._isInit)this._isInit=!1;else if(e[t(1312)](e[t(436)],"iYlVl"))this[t(1214)+"er"]&&_0x3a206e[t(1682)+t(252)+"ner"](t(1465),this["_handleP"+t(350)]),this._isBrowser&&_0x4b1cf3[t(1682)+t(252)+t(1133)](e[t(979)],this[t(1024)+t(636)]),this[t(768)]();else{let p=Kn(e[t(288)],{message:e[t(1543)]});this[t(1582)+"econnect"]&&this[t(1582)+t(297)](p)}let d=this[t(703)+t(1135)]?.[t(869)+"ntEndpointTriesC"+t(1180)]()||0;e[t(1091)](d,1)&&await this[t(1619)](e[t(727)](d,1)),this._debug(t(1424)+"ng url: "+this[t(1485)]+(t(913)+t(594))+this._protocols),this[t(1552)]=Wo({url:this._url,protocols:[this[t(1376)+"ls"]],headers:this[t(780)][t(927)+t(1083)+"s"][t(1268)+"tpHeader"]},this[t(780)].ws),(this._isBrowser||this._isWorker)&&this[t(1552)]&&(this[t(1552)][t(809)+"pe"]=this[t(878)+"ype"]),this[t(764)+t(1238)](),this[t(1377)+t(1169)+t(169)]=setTimeout(this._onTimeout[t(438)](this),c)}else{let o={PZdRD:function(c,d,p,m,l){let y=t;return QcMdQt[y(1217)](c,d,p,m,l)},RLJrq:function(c,d){let p=t;return QcMdQt[p(1504)](c,d)}};_0x1e5a58[t(873)+t(1251)](QcMdQt[t(1551)],c=>{let d=t;o[d(1079)](_0x33c5fc,o.RLJrq(_0x1ebc23,_0x4df804[d(958)]),c[d(1173)+"on"],c[d(180)+"on"],o[d(1506)](_0x444f15,_0x364ef1[d(464)+"ion"]))})}}catch(o){throw this[t(1377)+t(967)]=!1,o}}}[r(1076)+r(1107)](){let t=r;e[t(1363)](clearTimeout,this["_connect"+t(1169)+t(169)]),this["_connectionTimeo"+t(169)]=null}[r(1191)+r(1136)](){let t=r;clearTimeout(this[t(272)+t(537)+"Id"]),clearTimeout(this[t(885)+t(1016)+t(1452)]),this[t(272)+"gTimeoutId"]=null,this["_reconne"+t(1016)+t(1452)]=null}[r(383)](...t){let n=r;this[n(780)][n(578)]&&console[n(899)][n(1565)](console,[e[n(1544)],...t])}[r(1274)+"rvalValue"](t){let n=r,{initReconnectInterval:o,maxReconnectInterval:c,reconnectIntervalGrowFactor:d}=this[n(780)],p=e.UFcSe(o,Math.pow(d,e[n(1525)](t,1)));return p>c?c:p}[r(1278)](){let t=r;if(this._ws&&e[t(1305)](this[t(1552)][t(553)+"te"],this.CONNECTING)){this["_clearPi"+t(1136)](),this[t(272)+t(537)+"Id"]=setTimeout(this[t(1278)][t(438)](this),this[t(780)]["pingInte"+t(926)]);return}if(!this._ws||this._ws[t(553)+"te"]!==this[t(245)])return void this["_handleR"+t(297)]();this[t(1552)]&&this._ws.send("hi"),this[t(885)+t(1016)+t(1452)]=e[t(396)](setTimeout,this[t(1032)+"econnect"+t(1041)][t(438)](this),this._options[t(1080)+t(741)+t(840)])}[r(1032)+r(297)+r(1041)](){let t=r;this[t(883)+t(555)]?.addCount(),this[t(329)](e.ManGZ,t(1085)),this._pingLossCounter?.[t(1477)+t(325)+"nt"]()?this[t(1032)+"econnect"]():this[t(1278)]()}[r(684)+r(754)](){let t=r;return this._isMiniTT||this[t(1105)+"X"]?this["_miniNavigatorOn"+t(859)]:(this[t(1214)+"er"]||this[t(1674)+"r"])&&this[t(780)]["listenNe"+t(653)+"nged"]?navigator[t(516)]:!0}[r(1032)+r(297)](){let t=r;!this[t(684)+t(754)]()||this[t(953)+t(934)]||(this[t(703)+t(1135)]?.[t(193)+"pointConfig"](),this[t(883)+"sCounter"]?.["resetCou"+t(1106)](),this[t(1552)]?this[t(1109)+t(606)](1001,e.NRvyE,!0):this[t(1377)]())}[r(1175)+r(356)+"ange"](){let t=r;this._isMiniTT?tt[t(970)+"kStatusC"+t(497)](({isConnected:n})=>{let o=t;this[o(1266)+o(1158)+o(859)]=n,n?this[o(655)+o(1713)]():this[o(655)+o(1119)]()}):this[t(1105)+"X"]&&wx[t(970)+t(1702)+t(497)](({isConnected:n})=>{let o=t;this[o(1266)+o(1158)+o(859)]=n,n?this["_handleO"+o(1713)]():this["_handleO"+o(1119)]()})}[r(1619)](t){return new Promise(n=>{let o=A;e[o(1714)](setTimeout,n,this[o(1274)+"rvalValue"](t))})}[r(1109)+r(606)](t=1e3,n="",o=!1){let c=r,d={fDiMG:function(p,m){return e[A(225)](p,m)},AJRYX:function(p){return e[A(1488)](p)}};if(e[c(811)](e.iqTQf,c(500)))niNjrQ.fDiMG(_0x5c5cb6,_0x310a9b[c(592)]),niNjrQ[c(1178)](_0x45c644);else{if(!this[c(1552)])return;this._destroyWebSocket(t,n,o)}}[r(446)+"ut"](){let t=r,n=this[t(703)+t(1135)]?.[t(869)+t(1607)+"nt"]();this[t(383)](t(930)+n+t(1581)),this["_disconn"+t(606)](1001,e.Itbyq,!0)}[r(1417)](t){let n=r,o=jn(t);this[n(1552)]&&e[n(1524)](this._ws[n(553)+"te"],this[n(245)])&&(this[n(1552)]&&this[n(1552)].send(o),this[n(383)](e[n(523)],t))}[r(1613)+"sListeners"](){let t=r;this[t(1552)]&&(this._ws[t(1682)+t(252)+t(1133)](e[t(1095)],this[t(1656)]),this[t(1552)][t(1682)+"entListe"+t(1133)](t(768),this[t(1264)]),this[t(1552)][t(1682)+t(252)+"ner"](t(1092),this[t(1401)+"ge"]),this[t(1552)][t(1682)+"entListe"+t(1133)](t(592),this._onError))}[r(764)+r(1238)](){let t=r,n=(t(454)+"1")[t(698)]("|"),o=0;for(;;){switch(n[o++]){case"0":if(!this[t(1552)])return;continue;case"1":this[t(1552)][t(873)+t(1251)](t(592),this[t(1046)]);continue;case"2":this[t(1552)]["addEvent"+t(1251)](e.gAfKZ,this[t(1401)+"ge"]);continue;case"3":this._ws["addEvent"+t(1251)](e.aqZOI,this[t(1264)]);continue;case"4":this[t(1552)][t(873)+"Listener"](e[t(1095)],this[t(1656)]);continue}break}}[r(688)+r(1223)](t=1e3,n=""){let o=r;if(e[o(812)](e.ATZCo,e[o(271)])){if(e[o(388)](_0x5d42d9,_0x58e776))return new _0x5b5e57(_0x342d98,_0x5246ad);if(e[o(611)](_0x9749b8,_0x5e4bdd)&&e.LnIrQ(e.OatgY,typeof _0x30209f))return new _0x3a95e2(_0x253463,_0x1ab7b8);if(e[o(1001)](_0x327e49,_0x5a1d4b)&&e[o(1146)](e[o(1697)],typeof _0x284aa6))return new _0xd64c10(_0x21c568,_0x11f10c);throw new _0x565a49(e[o(1028)])}else try{this._ws&&this[o(1552)].close(t,n)}catch{}}[r(1677)+"WebSocket"](t=1e3,n="",o=!1){let c=r,d={CtaxZ:function(p,m){return e[A(238)](p,m)},suzmE:function(p,m){return p<<m},MDkUk:function(p,m){return e[A(1110)](p,m)},LVVkW:function(p,m){return e[A(778)](p,m)},QLBxu:function(p,m){return e.NzPaf(p,m)},NoXct:c(1002)+"1"};if(e[c(1686)](c(184),e[c(799)]))return new _0x427644(jFpETF[c(1202)](_0x319ccf[0]|jFpETF[c(977)](_0x5b4f8e[1],8),_0x5d3690[2]<<16)|jFpETF.suzmE(_0x2f1b5f[3],24),jFpETF[c(687)](jFpETF[c(348)](jFpETF[c(1289)](_0x1e5ad4[4],jFpETF[c(977)](_0x5c1a8e[5],8)),jFpETF[c(977)](_0x124964[6],16)),jFpETF[c(977)](_0x3f8977[7],24)),_0x1dd07b);if(this[c(1191)+c(1136)](),this["_clearTi"+c(1107)](),this[c(1613)+c(897)+"rs"](),this["_wsInsta"+c(1223)](1e3,n),this[c(1377)+"Lock"]=!1,o&&this[c(684)+c(754)]()&&!this[c(953)+"osed"]){if(this[c(703)+c(1135)]?.["checkRea"+c(1425)+"es"]()){let m=this[c(703)+"tManager"]?.[c(869)+"ntEndpoint"]();this["_dispatc"+c(358)+"ent"](e[c(1114)](ge,c(768),{code:1006,reason:c(930)+m+(" timeout"+c(535)+c(441)+c(1334)),wasClean:!0}))}else if(e[c(387)](e[c(1197)],e[c(1197)])){let m=d[c(1166)][c(698)]("|"),l=0;for(;;){switch(m[l++]){case"0":this[c(883)+c(555)]?.[c(268)+c(1106)]();continue;case"1":this[c(1377)]();continue;case"2":this[c(953)+c(934)]=!1;continue;case"3":this[c(703)+c(1135)]?.[c(193)+"pointCon"+c(1511)]();continue;case"4":this[c(1642)]=!0;continue}break}}else{let m=this[c(780)]["reconnec"+c(501)+c(656)](t,n);this[c(1219)+c(358)+c(839)](e[c(604)](ge,e.aqZOI,{code:t,reason:n,wasClean:!0,willReconnect:m})),m&&this._connect()}return}this[c(684)+c(754)]()||this[c(953)+"osed"]?this[c(1219)+c(358)+c(839)](ge(e[c(1320)],{code:t,reason:c(1048)})):this[c(1219)+c(358)+"ent"](ge(e[c(1320)],{code:1006,reason:e[c(299)]})),this[c(1552)]=null,this["_endpoin"+c(1135)]?.[c(193)+"pointCon"+c(1511)](),this[c(883)+c(555)]?.["resetCou"+c(1106)]()}[r(1219)+r(1125)+"nt"](t){let n=r;this[n(329)](e.NSarj,t),this[n(1403)]&&this.onopen(t)}[r(1219)+r(1430)+r(502)](t){let n=r;this[n(329)](n(1092),t),this[n(336)+"e"]&&this.onmessage(t)}[r(1219)+r(263)+r(918)](t){let n=r;this[n(329)](e.RdovF,t),this["onReceiv"+n(492)]&&this[n(1077)+n(492)](t)}["_dispatc"+r(1272)+r(839)](t){let n=r;this.emit(e[n(1073)],t),this[n(1086)]&&this.onerror(t)}["_dispatc"+r(358)+r(839)](t){let n=r;this[n(329)](n(768),t),this[n(549)]&&this.onclose(t)}get[r(809)+"pe"](){let t=r;return this._ws?this[t(1552)][t(809)+"pe"]:this[t(878)+t(1616)]}set[r(809)+"pe"](t){let n=r;this["_binaryT"+n(1616)]=t,this[n(1552)]&&(this[n(1552)][n(809)+"pe"]=t)}get[r(249)+"nt"](){let t=r;return this["_endpoin"+t(1135)]?.[t(869)+"ntEndpoi"+t(691)+t(1180)]()||0}get[r(621)+r(1121)](){let t=r,n=this[t(471)+t(1639)][t(1208)]((o,c)=>(o+=c&&c[t(1260)+"th"]||0,o),0);return e[t(339)](n,this._ws?this[t(1552)][t(621)+t(1121)]:0)}get[r(1030)+"ns"](){let t=r;return this[t(1552)]?this[t(1552)][t(1030)+"ns"]:""}get[r(1276)](){let t=r;return this._ws?this[t(1552)][t(1276)]:""}get[r(553)+"te"](){let t=r;return this._ws?this[t(1552)][t(553)+"te"]:this[t(780)][t(732)+t(1501)]?this[t(1183)+"NG"]:this.CLOSED}get url(){let t=r;return this[t(1552)]?this[t(1552)][t(615)]:this[t(1485)]}[r(768)](t=1e3,n){let o=r,c=e.assJg.split("|"),d=0;for(;;){switch(c[d++]){case"0":this[o(1191)+o(1136)]();continue;case"1":if(!this[o(1552)])return void this._debug(e.emWUF);continue;case"2":this[o(597)+"ger"]?.[o(887)]();continue;case"3":this[o(953)+o(934)]=!0;continue;case"4":if(this._ws[o(553)+"te"]===this.CLOSED||e[o(1216)](this._ws.readyState,this.CLOSING))return void this[o(383)](e.glmUT);continue;case"5":this["_destroy"+o(1510)+"t"](t,n);continue;case"6":this[o(1076)+o(1107)]();continue;case"7":this[o(488)+o(1164)+o(1251)]();continue}break}}async[r(689)](t,n){let o=r;if(e[o(716)]===o(1033))this[o(675)+o(1643)]=null;else{if(e[o(1703)](null,t))throw new Error(e[o(366)]);e[o(861)]("number",typeof t)&&(t=JSON[o(815)+"y"](t)),e[o(1382)]!=typeof t&&!e[o(173)](t,ArrayBuffer)&&!(t[o(1242)]&&e[o(612)](t[o(1242)],ArrayBuffer))&&(t=JSON[o(815)+"y"](t));let c=await e.ZHleY(xs,t),d=e.SRKtS(Jo,t),{method:p=0,service:m=this[o(780)][o(1708)],logID:l=this[o(780)][o(1332)+o(1129)](),headers:y=this[o(780)].headers,payloadEncoding:v=this[o(780)].payloadEncoding,payloadType:E=this._options[o(1628)+o(1616)],logIDNew:P=this[o(780)][o(994)+o(1414)]["enableAutoGenera"+o(745)+"ew"]?e[o(865)](a,this[o(780)][o(994)+o(1414)][o(1275)]):""}=e[o(1265)](n,{});if(!m)throw new Error("please p"+o(1372)+o(1404)+o(1650));let T={SeqID:R[o(1147)+"er"](this[o(1027)]++),LogID:R[o(1147)+"er"](l),service:m,method:p,headers:y,payloadEncoding:e[o(612)](v,Object)?v[o(318)]?v[o(318)]:"":v,payloadType:e[o(253)](E,Object)?E.type?E[o(367)]:d:E||d,payload:c,LogIDNew:P},O=jn(T);return this[o(1552)]&&this[o(1552)].readyState===this[o(245)]?(this[o(1552)]&&this[o(1552)][o(689)](O),this[o(383)]("sent",T)):this[o(471)+o(1639)].length<this[o(780)][o(1614)+o(198)+o(232)]?(this[o(471)+o(1639)][o(158)](O),this[o(383)](e[o(1610)],T)):(this[o(471)+o(1639)][o(194)](),this[o(471)+"Queue"][o(158)](O)),{seqID:this[o(1027)],logID:l,logIDNew:P}}}async[r(944)+"t"](t){let n=r,o={EObhD:function(c,d){return e.DAjXL(c,d)},iRnDj:function(c,d){return e.fiDLY(c,d)},WEDOx:function(c,d){return c>>>d},ybfNY:function(c,d){return c+d},aczRi:function(c,d){return e.TgaIt(c,d)},aXirw:function(c,d){return e.Kfzcw(c,d)},vVIRL:function(c,d){return e[A(340)](c,d)},oOAPv:function(c,d){return e[A(1296)](c,d)}};if(n(1522)!=="mqXes"){let{url:c}=e[n(914)](t,{}),d=Array[n(1335)](c)?c:e[n(1382)]==typeof c?[c]:[];t&&Object[n(1646)](this[n(780)],t),d&&d.length?this[n(703)+n(1135)]=new ss(d,this[n(780)][n(1120)+"es"]):this[n(703)+n(1135)]?.[n(193)+n(1415)+n(1511)](),this[n(883)+n(555)]?.[n(268)+n(1106)](this[n(780)]["pingLoss"+n(938)]),this[n(953)+n(934)]=!1,this._ws&&e.ZGfaN(this._ws[n(553)+"te"],this.CLOSED)?this[n(1109)+n(606)](1e3,e[n(868)],!0):(this[n(1642)]=!0,this[n(1377)]())}else{let c=_0x2e6848[n(1411)],d=_0x18fb34.high;return _0x55e1ae[_0x637fde]=d>>>24,_0x16140b[ubMjVT[n(1461)](_0x2ffce2,1)]=ubMjVT.iRnDj(d>>>16,255),_0x444ba2[_0x24c51b+2]=ubMjVT[n(460)](ubMjVT.WEDOx(d,8),255),_0x1a51d0[ubMjVT[n(1556)](_0x5d84c0,3)]=ubMjVT[n(460)](255,d),_0x4aa3e7[_0x3b60fa+4]=c>>>24,_0x216e48[ubMjVT[n(1461)](_0x4b2d2a,5)]=ubMjVT[n(460)](c>>>16,255),_0x1ecd0f[ubMjVT[n(1123)](_0x395ca9,6)]=ubMjVT[n(460)](ubMjVT.aXirw(c,8),255),_0x24070a[ubMjVT[n(1343)](_0x456676,7)]=ubMjVT[n(1505)](255,c),_0x13a1c4+=8,_0x4ce0ab}}async[r(1549)](){let t=r;if(!this[t(1377)+t(967)]){let n=e[t(307)][t(698)]("|"),o=0;for(;;){switch(n[o++]){case"0":this._readyClosed=!1;continue;case"1":this["_endpoin"+t(1135)]?.[t(193)+t(1415)+"fig"]();continue;case"2":this[t(1377)]();continue;case"3":this[t(1642)]=!0;continue;case"4":this[t(883)+t(555)]?.[t(268)+t(1106)]();continue}break}}}["addEvent"+r(1251)](t,n){let o=r,c={nZGPB:function(d){return e[A(1699)](d)}};if(e[o(442)](e[o(1394)],e[o(149)])){let d=this[o(703)+o(1135)]?.["getCurre"+o(1607)+"nt"]();this[o(383)](o(254)+d),BGQfCi[o(1585)](_0x3bcc87)}else this.on(t,n)}["dispatch"+r(502)](t){let n=r,{type:o}=t;this[n(329)](o,t)}[r(1682)+"entListener"](t,n){this[r(781)](t,n)}[r(626)](){let t=r,n={TSvwB:function(o,c){return e[A(1690)](o,c)},GUzda:function(o,c){return e[A(706)](o,c)},TSQIR:e[t(776)],gvrNb:e.JeNcO,XWhTH:e[t(1574)],BxXnH:function(o,c){return o!==c},bOoey:e[t(1230)],sYbjA:e[t(864)],FLdhB:function(o,c){return e[t(674)](o,c)},jvZbx:function(o,c){return e[t(585)](o,c)},uFRNd:e[t(1051)],hwxBF:e[t(863)],nTUty:function(o,c,d){return e[t(162)](o,c,d)}};if(e[t(1277)]!==e[t(360)])return new Promise((o,c)=>{let d=t,p={fiVtd:function(m,l){return n[A(1157)](m,l)},BEmng:function(m,l){return n.FLdhB(m,l)}};if(n[d(428)](n[d(1520)],n.hwxBF))_0x48e1b0[d(1601)][d(1503)+d(589)](_0x59c59d),_0x2dfeff.frontierJSONP=void 0,GtkrAm[d(870)](_0x3cd241,_0x54233f&&_0x53e311[d(1098)]||d(284)+d(413));else{this[d(1191)+d(1136)](),this["_pingPon"+d(537)+"Id"]=n.nTUty(setTimeout,this[d(1278)][d(438)](this),this[d(780)][d(1300)+d(926)]);let m=()=>{let y=d;n.GUzda(o,n[y(714)]),this[y(781)](n.gvrNb,m),this[y(781)](n[y(448)],l)},l=()=>{let y=d;n[y(975)](n[y(1210)],n[y(588)])?(c(y(1085)),this.off(y(510)+y(1633)+"s",m),this.off(n.XWhTH,l)):(_0xf49a9d=QZhdWi.fiVtd(_0x574c80,_0x41cb49),_0x49aa2d|=QZhdWi[y(148)](127&_0x367045,7))};this.on(n[d(1492)],m),this.on(n.XWhTH,l),this._ping()}});{let o=_0x7e7cc1[t(1092)][t(221)];o&&_0x5c2f4f[t(547)+"rs"](o)}}}})(),W[S(1467)+S(491)]=G[S(1467)+S(491)],W["CustomEr"+S(1711)]=G[S(223)+S(1711)],W[S(321)+"e"]=G[S(321)+"e"],W[S(502)]=G[S(502)],W[S(936)]=G[S(936)],W[S(472)+S(1066)+S(196)]=G["Frontier"+S(1066)+S(196)],W.MessageEvent=G[S(1066)+"vent"],W.OpenEvent=G[S(166)+"t"],W["Reconnec"+S(1011)]=G[S(1602)+"tEvent"],W[S(946)+S(491)]=G[S(946)+"oseEvent"],W[S(303)+S(1711)]=G[S(303)+S(1711)],W[S(1139)+S(1380)+"nt"]=G[S(1139)+S(1380)+"nt"],W[S(1555)+"enEvent"]=G[S(1555)+S(837)],W["createRe"+S(1285)+S(196)]=G[S(248)+S(1285)+S(196)],W[S(322)+S(1566)]=G[S(322)+S(1566)],W[S(1374)+S(1111)]=G[S(1374)+S(1111)];for(an in G)[S(1467)+S(491),S(223)+S(1711),S(321)+"e",S(502),S(936),S(472)+"MessageE"+S(196),"MessageE"+S(196),S(166)+"t",S(1602)+S(1011),"createCl"+S(491),S(303)+S(1711),S(1139)+S(1380)+"nt","createOpenEvent",S(248)+"connectE"+S(196),S(322)+S(1566),S(1374)+S(1111)].indexOf(an)===-1&&(W[an]=G[an]);var an;Object.defineProperty(W,S(942)+"le",{value:!0})});var ke=oe((jd,oi)=>{"use strict";var si=["nodebuffer","arraybuffer","fragments"],ii=typeof Blob<"u";ii&&si.push("blob");oi.exports={BINARY_TYPES:si,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:ii,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Dt=oe((Kd,hn)=>{"use strict";var{EMPTY_BUFFER:ux}=ke(),cr=Buffer[Symbol.species];function dx(r,e){if(r.length===0)return ux;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let x=0;x<r.length;x++){let f=r[x];i.set(f,a),a+=f.length}return a<e?new cr(i.buffer,i.byteOffset,a):i}function ai(r,e,i,a,x){for(let f=0;f<x;f++)i[a+f]=r[f]^e[f&3]}function xi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function lx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function fr(r){if(fr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new cr(r):ArrayBuffer.isView(r)?e=new cr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),fr.readOnly=!1),e}hn.exports={concat:dx,mask:ai,toArrayBuffer:lx,toBuffer:fr,unmask:xi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=H("bufferutil");hn.exports.mask=function(e,i,a,x,f){f<48?ai(e,i,a,x,f):r.mask(e,i,a,x,f)},hn.exports.unmask=function(e,i){e.length<32?xi(e,i):r.unmask(e,i)}}catch{}});var ui=oe((Hd,fi)=>{"use strict";var ci=Symbol("kDone"),ur=Symbol("kRun"),dr=class{constructor(e){this[ci]=()=>{this.pending--,this[ur]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[ur]()}[ur](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[ci])}}};fi.exports=dr});var lt=oe((Gd,gi)=>{"use strict";var At=H("zlib"),di=Dt(),hx=ui(),{kStatusCode:li}=ke(),gx=Buffer[Symbol.species],px=Buffer.from([0,0,255,255]),pn=Symbol("permessage-deflate"),Ne=Symbol("total-length"),ut=Symbol("callback"),Fe=Symbol("buffers"),dt=Symbol("error"),gn,lr=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!gn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;gn=new hx(i)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[ut];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let i=this._options,a=e.find(x=>!(i.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>x.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return i.serverNoContextTakeover&&(a.server_no_context_takeover=!0),i.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof i.serverMaxWindowBits=="number"&&(a.server_max_window_bits=i.serverMaxWindowBits),typeof i.clientMaxWindowBits=="number"?a.client_max_window_bits=i.clientMaxWindowBits:(a.client_max_window_bits===!0||i.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let i=e[0];if(this._options.clientNoContextTakeover===!1&&i.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!i.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(i.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&i.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return i}normalizeParams(e){return e.forEach(i=>{Object.keys(i).forEach(a=>{let x=i[a];if(x.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(x=x[0],a==="client_max_window_bits"){if(x!==!0){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(x!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else throw new Error(`Unknown parameter "${a}"`);i[a]=x})}),e}decompress(e,i,a){gn.add(x=>{this._decompress(e,i,(f,u)=>{x(),a(f,u)})})}compress(e,i,a){gn.add(x=>{this._compress(e,i,(f,u)=>{x(),a(f,u)})})}_decompress(e,i,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,u=typeof this.params[f]!="number"?At.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=At.createInflateRaw({...this._options.zlibInflateOptions,windowBits:u}),this._inflate[pn]=this,this._inflate[Ne]=0,this._inflate[Fe]=[],this._inflate.on("error",_x),this._inflate.on("data",hi)}this._inflate[ut]=a,this._inflate.write(e),i&&this._inflate.write(px),this._inflate.flush(()=>{let f=this._inflate[dt];if(f){this._inflate.close(),this._inflate=null,a(f);return}let u=di.concat(this._inflate[Fe],this._inflate[Ne]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ne]=0,this._inflate[Fe]=[],i&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,u)})}_compress(e,i,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,u=typeof this.params[f]!="number"?At.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=At.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:u}),this._deflate[Ne]=0,this._deflate[Fe]=[],this._deflate.on("data",mx)}this._deflate[ut]=a,this._deflate.write(e),this._deflate.flush(At.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=di.concat(this._deflate[Fe],this._deflate[Ne]);i&&(f=new gx(f.buffer,f.byteOffset,f.length-4)),this._deflate[ut]=null,this._deflate[Ne]=0,this._deflate[Fe]=[],i&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};gi.exports=lr;function mx(r){this[Fe].push(r),this[Ne]+=r.length}function hi(r){if(this[Ne]+=r.length,this[pn]._maxPayload<1||this[Ne]<=this[pn]._maxPayload){this[Fe].push(r);return}this[dt]=new RangeError("Max payload size exceeded"),this[dt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[dt][li]=1009,this.removeListener("data",hi),this.reset()}function _x(r){if(this[pn]._inflate=null,this[dt]){this[ut](this[dt]);return}r[li]=1007,this[ut](r)}});var ht=oe((Wd,mn)=>{"use strict";var{isUtf8:pi}=H("buffer"),{hasBlob:bx}=ke(),yx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function vx(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function hr(r){let e=r.length,i=0;for(;i<e;)if((r[i]&128)===0)i++;else if((r[i]&224)===192){if(i+1===e||(r[i+1]&192)!==128||(r[i]&254)===192)return!1;i+=2}else if((r[i]&240)===224){if(i+2>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||r[i]===224&&(r[i+1]&224)===128||r[i]===237&&(r[i+1]&224)===160)return!1;i+=3}else if((r[i]&248)===240){if(i+3>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||(r[i+3]&192)!==128||r[i]===240&&(r[i+1]&240)===128||r[i]===244&&r[i+1]>143||r[i]>244)return!1;i+=4}else return!1;return!0}function Sx(r){return bx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}mn.exports={isBlob:Sx,isValidStatusCode:vx,isValidUTF8:hr,tokenChars:yx};if(pi)mn.exports.isValidUTF8=function(r){return r.length<24?hr(r):pi(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=H("utf-8-validate");mn.exports.isValidUTF8=function(e){return e.length<32?hr(e):r(e)}}catch{}});var wr=oe((Vd,Si)=>{"use strict";var{Writable:Ex}=H("stream"),mi=lt(),{BINARY_TYPES:Cx,EMPTY_BUFFER:_i,kStatusCode:Dx,kWebSocket:Ax}=ke(),{concat:gr,toArrayBuffer:Px,unmask:Tx}=Dt(),{isValidStatusCode:Ix,isValidUTF8:wi}=ht(),_n=Buffer[Symbol.species],le=0,bi=1,yi=2,vi=3,pr=4,mr=5,wn=6,_r=class extends Ex{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Cx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ax]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=le}_write(e,i,a){if(this._opcode===8&&this._state==le)return a();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(a)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let a=this._buffers[0];return this._buffers[0]=new _n(a.buffer,a.byteOffset+e,a.length-e),new _n(a.buffer,a.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let a=this._buffers[0],x=i.length-e;e>=a.length?i.set(this._buffers.shift(),x):(i.set(new Uint8Array(a.buffer,a.byteOffset,e),x),this._buffers[0]=new _n(a.buffer,a.byteOffset+e,a.length-e)),e-=a.length}while(e>0);return i}startLoop(e){this._loop=!0;do switch(this._state){case le:this.getInfo(e);break;case bi:this.getPayloadLength16(e);break;case yi:this.getPayloadLength64(e);break;case vi:this.getMask();break;case pr:this.getData(e);break;case mr:case wn:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let i=this.consume(2);if((i[0]&48)!==0){let x=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(x);return}let a=(i[0]&64)===64;if(a&&!this._extensions[mi.extensionName]){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._fin=(i[0]&128)===128,this._opcode=i[0]&15,this._payloadLength=i[1]&127,this._opcode===0){if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(!this._fragmented){let x=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let x=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(x);return}if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let x=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(x);return}}else{let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(i[1]&128)===128,this._isServer){if(!this._masked){let x=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(x);return}}else if(this._masked){let x=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(x);return}this._payloadLength===126?this._state=bi:this._payloadLength===127?this._state=yi:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let i=this.consume(8),a=i.readUInt32BE(0);if(a>Math.pow(2,21)-1){let x=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(x);return}this._payloadLength=a*Math.pow(2,32)+i.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(i);return}this._masked?this._state=vi:this._state=pr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=pr}getData(e){let i=_i;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}i=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&Tx(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=mr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[mi.extensionName].decompress(e,this._fin,(x,f)=>{if(x)return i(x);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let u=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(u);return}this._fragments.push(f)}this.dataMessage(i),this._state===le&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=le;return}let i=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let x;this._binaryType==="nodebuffer"?x=gr(a,i):this._binaryType==="arraybuffer"?x=Px(gr(a,i)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=le):(this._state=wn,setImmediate(()=>{this.emit("message",x,!0),this._state=le,this.startLoop(e)}))}else{let x=gr(a,i);if(!this._skipUTF8Validation&&!wi(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===mr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=le):(this._state=wn,setImmediate(()=>{this.emit("message",x,!1),this._state=le,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,_i),this.end();else{let a=e.readUInt16BE(0);if(!Ix(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(f);return}let x=new _n(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!wi(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(f);return}this._loop=!1,this.emit("conclude",a,x),this.end()}this._state=le;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=le):(this._state=wn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=le,this.startLoop(i)}))}createError(e,i,a,x,f){this._loop=!1,this._errored=!0;let u=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(u,this.createError),u.code=f,u[Dx]=x,u}};Si.exports=_r});var vr=oe((Xd,Di)=>{"use strict";var{Duplex:Jd}=H("stream"),{randomFillSync:kx}=H("crypto"),Ei=lt(),{EMPTY_BUFFER:Nx,kWebSocket:Lx,NOOP:Bx}=ke(),{isBlob:gt,isValidStatusCode:Ox}=ht(),{mask:Ci,toBuffer:Xe}=Dt(),he=Symbol("kByteLength"),Rx=Buffer.alloc(4),bn=8*1024,Ze,pt=bn,pe=0,Mx=1,zx=2,br=class r{constructor(e,i,a){this._extensions=i||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=pe,this.onerror=Bx,this[Lx]=void 0}static frame(e,i){let a,x=!1,f=2,u=!1;i.mask&&(a=i.maskBuffer||Rx,i.generateMask?i.generateMask(a):(pt===bn&&(Ze===void 0&&(Ze=Buffer.alloc(bn)),kx(Ze,0,bn),pt=0),a[0]=Ze[pt++],a[1]=Ze[pt++],a[2]=Ze[pt++],a[3]=Ze[pt++]),u=(a[0]|a[1]|a[2]|a[3])===0,f=6);let h;typeof e=="string"?(!i.mask||u)&&i[he]!==void 0?h=i[he]:(e=Buffer.from(e),h=e.length):(h=e.length,x=i.mask&&i.readOnly&&!u);let g=h;h>=65536?(f+=8,g=127):h>125&&(f+=2,g=126);let _=Buffer.allocUnsafe(x?h+f:f);return _[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(_[0]|=64),_[1]=g,g===126?_.writeUInt16BE(h,2):g===127&&(_[2]=_[3]=0,_.writeUIntBE(h,4,6)),i.mask?(_[1]|=128,_[f-4]=a[0],_[f-3]=a[1],_[f-2]=a[2],_[f-1]=a[3],u?[_,e]:x?(Ci(e,a,_,f,h),[_]):(Ci(e,a,e,0,h),[_,e])):[_,e]}close(e,i,a,x){let f;if(e===void 0)f=Nx;else{if(typeof e!="number"||!Ox(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)f=Buffer.allocUnsafe(2),f.writeUInt16BE(e,0);else{let h=Buffer.byteLength(i);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");f=Buffer.allocUnsafe(2+h),f.writeUInt16BE(e,0),typeof i=="string"?f.write(i,2):f.set(i,2)}}let u={[he]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==pe?this.enqueue([this.dispatch,f,!1,u,x]):this.sendFrame(r.frame(f,u),x)}ping(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):gt(e)?(x=e.size,f=!1):(e=Xe(e),x=e.length,f=Xe.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[he]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};gt(e)?this._state!==pe?this.enqueue([this.getBlobData,e,!1,u,a]):this.getBlobData(e,!1,u,a):this._state!==pe?this.enqueue([this.dispatch,e,!1,u,a]):this.sendFrame(r.frame(e,u),a)}pong(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):gt(e)?(x=e.size,f=!1):(e=Xe(e),x=e.length,f=Xe.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[he]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};gt(e)?this._state!==pe?this.enqueue([this.getBlobData,e,!1,u,a]):this.getBlobData(e,!1,u,a):this._state!==pe?this.enqueue([this.dispatch,e,!1,u,a]):this.sendFrame(r.frame(e,u),a)}send(e,i,a){let x=this._extensions[Ei.extensionName],f=i.binary?2:1,u=i.compress,h,g;typeof e=="string"?(h=Buffer.byteLength(e),g=!1):gt(e)?(h=e.size,g=!1):(e=Xe(e),h=e.length,g=Xe.readOnly),this._firstFragment?(this._firstFragment=!1,u&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(u=h>=x._threshold),this._compress=u):(u=!1,f=0),i.fin&&(this._firstFragment=!0);let _={[he]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:g,rsv1:u};gt(e)?this._state!==pe?this.enqueue([this.getBlobData,e,this._compress,_,a]):this.getBlobData(e,this._compress,_,a):this._state!==pe?this.enqueue([this.dispatch,e,this._compress,_,a]):this.dispatch(e,this._compress,_,a)}getBlobData(e,i,a,x){this._bufferedBytes+=a[he],this._state=zx,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(yr,this,h,x);return}this._bufferedBytes-=a[he];let u=Xe(f);i?this.dispatch(u,i,a,x):(this._state=pe,this.sendFrame(r.frame(u,a),x),this.dequeue())}).catch(f=>{process.nextTick(qx,this,f,x)})}dispatch(e,i,a,x){if(!i){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Ei.extensionName];this._bufferedBytes+=a[he],this._state=Mx,f.compress(e,a.fin,(u,h)=>{if(this._socket.destroyed){let g=new Error("The socket was closed while data was being compressed");yr(this,g,x);return}this._bufferedBytes-=a[he],this._state=pe,a.readOnly=!1,this.sendFrame(r.frame(h,a),x),this.dequeue()})}dequeue(){for(;this._state===pe&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,i){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],i),this._socket.uncork()):this._socket.write(e[0],i)}};Di.exports=br;function yr(r,e,i){typeof i=="function"&&i(e);for(let a=0;a<r._queue.length;a++){let x=r._queue[a],f=x[x.length-1];typeof f=="function"&&f(e)}}function qx(r,e,i){yr(r,e,i),r.onerror(e)}});var Oi=oe((Zd,Bi)=>{"use strict";var{kForOnEventAttribute:Pt,kListener:Sr}=ke(),Ai=Symbol("kCode"),Pi=Symbol("kData"),Ti=Symbol("kError"),Ii=Symbol("kMessage"),ki=Symbol("kReason"),mt=Symbol("kTarget"),Ni=Symbol("kType"),Li=Symbol("kWasClean"),Le=class{constructor(e){this[mt]=null,this[Ni]=e}get target(){return this[mt]}get type(){return this[Ni]}};Object.defineProperty(Le.prototype,"target",{enumerable:!0});Object.defineProperty(Le.prototype,"type",{enumerable:!0});var Ye=class extends Le{constructor(e,i={}){super(e),this[Ai]=i.code===void 0?0:i.code,this[ki]=i.reason===void 0?"":i.reason,this[Li]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[Ai]}get reason(){return this[ki]}get wasClean(){return this[Li]}};Object.defineProperty(Ye.prototype,"code",{enumerable:!0});Object.defineProperty(Ye.prototype,"reason",{enumerable:!0});Object.defineProperty(Ye.prototype,"wasClean",{enumerable:!0});var _t=class extends Le{constructor(e,i={}){super(e),this[Ti]=i.error===void 0?null:i.error,this[Ii]=i.message===void 0?"":i.message}get error(){return this[Ti]}get message(){return this[Ii]}};Object.defineProperty(_t.prototype,"error",{enumerable:!0});Object.defineProperty(_t.prototype,"message",{enumerable:!0});var Tt=class extends Le{constructor(e,i={}){super(e),this[Pi]=i.data===void 0?null:i.data}get data(){return this[Pi]}};Object.defineProperty(Tt.prototype,"data",{enumerable:!0});var Fx={addEventListener(r,e,i={}){for(let x of this.listeners(r))if(!i[Pt]&&x[Sr]===e&&!x[Pt])return;let a;if(r==="message")a=function(f,u){let h=new Tt("message",{data:u?f:f.toString()});h[mt]=this,yn(e,this,h)};else if(r==="close")a=function(f,u){let h=new Ye("close",{code:f,reason:u.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[mt]=this,yn(e,this,h)};else if(r==="error")a=function(f){let u=new _t("error",{error:f,message:f.message});u[mt]=this,yn(e,this,u)};else if(r==="open")a=function(){let f=new Le("open");f[mt]=this,yn(e,this,f)};else return;a[Pt]=!!i[Pt],a[Sr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Sr]===e&&!i[Pt]){this.removeListener(r,i);break}}};Bi.exports={CloseEvent:Ye,ErrorEvent:_t,Event:Le,EventTarget:Fx,MessageEvent:Tt};function yn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var vn=oe((Yd,Ri)=>{"use strict";var{tokenChars:It}=ht();function Se(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function Ux(r){let e=Object.create(null),i=Object.create(null),a=!1,x=!1,f=!1,u,h,g=-1,_=-1,w=-1,b=0;for(;b<r.length;b++)if(_=r.charCodeAt(b),u===void 0)if(w===-1&&It[_]===1)g===-1&&(g=b);else if(b!==0&&(_===32||_===9))w===-1&&g!==-1&&(w=b);else if(_===59||_===44){if(g===-1)throw new SyntaxError(`Unexpected character at index ${b}`);w===-1&&(w=b);let k=r.slice(g,w);_===44?(Se(e,k,i),i=Object.create(null)):u=k,g=w=-1}else throw new SyntaxError(`Unexpected character at index ${b}`);else if(h===void 0)if(w===-1&&It[_]===1)g===-1&&(g=b);else if(_===32||_===9)w===-1&&g!==-1&&(w=b);else if(_===59||_===44){if(g===-1)throw new SyntaxError(`Unexpected character at index ${b}`);w===-1&&(w=b),Se(i,r.slice(g,w),!0),_===44&&(Se(e,u,i),i=Object.create(null),u=void 0),g=w=-1}else if(_===61&&g!==-1&&w===-1)h=r.slice(g,b),g=w=-1;else throw new SyntaxError(`Unexpected character at index ${b}`);else if(x){if(It[_]!==1)throw new SyntaxError(`Unexpected character at index ${b}`);g===-1?g=b:a||(a=!0),x=!1}else if(f)if(It[_]===1)g===-1&&(g=b);else if(_===34&&g!==-1)f=!1,w=b;else if(_===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${b}`);else if(_===34&&r.charCodeAt(b-1)===61)f=!0;else if(w===-1&&It[_]===1)g===-1&&(g=b);else if(g!==-1&&(_===32||_===9))w===-1&&(w=b);else if(_===59||_===44){if(g===-1)throw new SyntaxError(`Unexpected character at index ${b}`);w===-1&&(w=b);let k=r.slice(g,w);a&&(k=k.replace(/\\/g,""),a=!1),Se(i,h,k),_===44&&(Se(e,u,i),i=Object.create(null),u=void 0),h=void 0,g=w=-1}else throw new SyntaxError(`Unexpected character at index ${b}`);if(g===-1||f||_===32||_===9)throw new SyntaxError("Unexpected end of input");w===-1&&(w=b);let D=r.slice(g,w);return u===void 0?Se(e,D,i):(h===void 0?Se(i,D,!0):a?Se(i,h,D.replace(/\\/g,"")):Se(i,h,D),Se(e,u,i)),e}function jx(r){return Object.keys(r).map(e=>{let i=r[e];return Array.isArray(i)||(i=[i]),i.map(a=>[e].concat(Object.keys(a).map(x=>{let f=a[x];return Array.isArray(f)||(f=[f]),f.map(u=>u===!0?x:`${x}=${u}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Ri.exports={format:jx,parse:Ux}});var Dn=oe((el,Ji)=>{"use strict";var Kx=H("events"),Hx=H("https"),Gx=H("http"),qi=H("net"),Wx=H("tls"),{randomBytes:Vx,createHash:Jx}=H("crypto"),{Duplex:Qd,Readable:$d}=H("stream"),{URL:Er}=H("url"),Ue=lt(),Xx=wr(),Zx=vr(),{isBlob:Yx}=ht(),{BINARY_TYPES:Mi,CLOSE_TIMEOUT:Qx,EMPTY_BUFFER:Sn,GUID:$x,kForOnEventAttribute:Cr,kListener:ec,kStatusCode:tc,kWebSocket:X,NOOP:Fi}=ke(),{EventTarget:{addEventListener:nc,removeEventListener:rc}}=Oi(),{format:sc,parse:ic}=vn(),{toBuffer:oc}=Dt(),Ui=Symbol("kAborted"),Dr=[8,13],Be=["CONNECTING","OPEN","CLOSING","CLOSED"],ac=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,M=class r extends Kx{constructor(e,i,a){super(),this._binaryType=Mi[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Sn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,i===void 0?i=[]:Array.isArray(i)||(typeof i=="object"&&i!==null?(a=i,i=[]):i=[i]),ji(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Mi.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,i,a){let x=new Xx({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new Zx(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[X]=this,f[X]=this,e[X]=this,x.on("conclude",fc),x.on("drain",uc),x.on("error",dc),x.on("message",lc),x.on("ping",hc),x.on("pong",gc),f.onerror=pc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",Gi),e.on("data",Cn),e.on("end",Wi),e.on("error",Vi),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ue.extensionName]&&this._extensions[Ue.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,i){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ce(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,i,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Hi(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ar(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Sn,i,a)}pong(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ar(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Sn,i,a)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof i=="function"&&(a=i,i={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Ar(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[Ue.extensionName]||(x.compress=!1),this._sender.send(e||Sn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ce(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(M,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(M.prototype,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(M,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(M.prototype,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(M,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(M.prototype,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(M,"CLOSED",{enumerable:!0,value:Be.indexOf("CLOSED")});Object.defineProperty(M.prototype,"CLOSED",{enumerable:!0,value:Be.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(M.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(M.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Cr])return e[ec];return null},set(e){for(let i of this.listeners(r))if(i[Cr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Cr]:!0})}})});M.prototype.addEventListener=nc;M.prototype.removeEventListener=rc;Ji.exports=M;function ji(r,e,i,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Qx,protocolVersion:Dr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=x.autoPong,r._closeTimeout=x.closeTimeout,!Dr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Dr.join(", ")})`);let f;if(e instanceof Er)f=e;else try{f=new Er(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}f.protocol==="http:"?f.protocol="ws:":f.protocol==="https:"&&(f.protocol="wss:"),r._url=f.href;let u=f.protocol==="wss:",h=f.protocol==="ws+unix:",g;if(f.protocol!=="ws:"&&!u&&!h?g=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!f.pathname?g="The URL's pathname is empty":f.hash&&(g="The URL contains a fragment identifier"),g){let N=new SyntaxError(g);if(r._redirects===0)throw N;En(r,N);return}let _=u?443:80,w=Vx(16).toString("base64"),b=u?Hx.request:Gx.request,D=new Set,k;if(x.createConnection=x.createConnection||(u?cc:xc),x.defaultPort=x.defaultPort||_,x.port=f.port||_,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":w,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(k=new Ue({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=sc({[Ue.extensionName]:k.offer()})),i.length){for(let N of i){if(typeof N!="string"||!ac.test(N)||D.has(N))throw new SyntaxError("An invalid or duplicated subprotocol was specified");D.add(N)}x.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(f.username||f.password)&&(x.auth=`${f.username}:${f.password}`),h){let N=x.path.split(":");x.socketPath=N[0],x.path=N[1]}let B;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=u,r._originalHostOrSocketPath=h?x.socketPath:f.host;let N=a&&a.headers;if(a={...a,headers:{}},N)for(let[q,I]of Object.entries(N))a.headers[q.toLowerCase()]=I}else if(r.listenerCount("redirect")===0){let N=h?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!N||r._originalSecure&&!u)&&(delete x.headers.authorization,delete x.headers.cookie,N||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),B=r._req=b(x),r._redirects&&r.emit("redirect",r.url,B)}else B=r._req=b(x);x.timeout&&B.on("timeout",()=>{ce(r,B,"Opening handshake has timed out")}),B.on("error",N=>{B===null||B[Ui]||(B=r._req=null,En(r,N))}),B.on("response",N=>{let q=N.headers.location,I=N.statusCode;if(q&&x.followRedirects&&I>=300&&I<400){if(++r._redirects>x.maxRedirects){ce(r,B,"Maximum redirects exceeded");return}B.abort();let F;try{F=new Er(q,e)}catch{let se=new SyntaxError(`Invalid URL: ${q}`);En(r,se);return}ji(r,F,i,a)}else r.emit("unexpected-response",B,N)||ce(r,B,`Unexpected server response: ${N.statusCode}`)}),B.on("upgrade",(N,q,I)=>{if(r.emit("upgrade",N),r.readyState!==M.CONNECTING)return;B=r._req=null;let F=N.headers.upgrade;if(F===void 0||F.toLowerCase()!=="websocket"){ce(r,q,"Invalid Upgrade header");return}let V=Jx("sha1").update(w+$x).digest("base64");if(N.headers["sec-websocket-accept"]!==V){ce(r,q,"Invalid Sec-WebSocket-Accept header");return}let se=N.headers["sec-websocket-protocol"],me;if(se!==void 0?D.size?D.has(se)||(me="Server sent an invalid subprotocol"):me="Server sent a subprotocol but none was requested":D.size&&(me="Server sent no subprotocol"),me){ce(r,q,me);return}se&&(r._protocol=se);let Oe=N.headers["sec-websocket-extensions"];if(Oe!==void 0){if(!k){ce(r,q,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Ee;try{Ee=ic(Oe)}catch{ce(r,q,"Invalid Sec-WebSocket-Extensions header");return}let _e=Object.keys(Ee);if(_e.length!==1||_e[0]!==Ue.extensionName){ce(r,q,"Server indicated an extension that was not requested");return}try{k.accept(Ee[Ue.extensionName])}catch{ce(r,q,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[Ue.extensionName]=k}r.setSocket(q,I,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(B,r):B.end()}function En(r,e){r._readyState=M.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function xc(r){return r.path=r.socketPath,qi.connect(r)}function cc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=qi.isIP(r.host)?"":r.host),Wx.connect(r)}function ce(r,e,i){r._readyState=M.CLOSING;let a=new Error(i);Error.captureStackTrace(a,ce),e.setHeader?(e[Ui]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(En,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Ar(r,e,i){if(e){let a=Yx(e)?e.size:oc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Be[r.readyState]})`);process.nextTick(i,a)}}function fc(r,e){let i=this[X];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[X]!==void 0&&(i._socket.removeListener("data",Cn),process.nextTick(Ki,i._socket),r===1005?i.close():i.close(r,e))}function uc(){let r=this[X];r.isPaused||r._socket.resume()}function dc(r){let e=this[X];e._socket[X]!==void 0&&(e._socket.removeListener("data",Cn),process.nextTick(Ki,e._socket),e.close(r[tc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function zi(){this[X].emitClose()}function lc(r,e){this[X].emit("message",r,e)}function hc(r){let e=this[X];e._autoPong&&e.pong(r,!this._isServer,Fi),e.emit("ping",r)}function gc(r){this[X].emit("pong",r)}function Ki(r){r.resume()}function pc(r){let e=this[X];e.readyState!==M.CLOSED&&(e.readyState===M.OPEN&&(e._readyState=M.CLOSING,Hi(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Hi(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Gi(){let r=this[X];if(this.removeListener("close",Gi),this.removeListener("data",Cn),this.removeListener("end",Wi),r._readyState=M.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[X]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",zi),r._receiver.on("finish",zi))}function Cn(r){this[X]._receiver.write(r)||this.pause()}function Wi(){let r=this[X];r._readyState=M.CLOSING,r._receiver.end(),this.end()}function Vi(){let r=this[X];this.removeListener("error",Vi),this.on("error",Fi),r&&(r._readyState=M.CLOSING,this.destroy())}});var Qi=oe((nl,Yi)=>{"use strict";var tl=Dn(),{Duplex:mc}=H("stream");function Xi(r){r.emit("close")}function _c(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Zi(r){this.removeListener("error",Zi),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function wc(r,e){let i=!0,a=new mc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,u){let h=!u&&a._readableState.objectMode?f.toString():f;a.push(h)||r.pause()}),r.once("error",function(f){a.destroyed||(i=!1,a.destroy(f))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,f){if(r.readyState===r.CLOSED){f(x),process.nextTick(Xi,a);return}let u=!1;r.once("error",function(g){u=!0,f(g)}),r.once("close",function(){u||f(x),process.nextTick(Xi,a)}),i&&r.terminate()},a._final=function(x){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(x)});return}r._socket!==null&&(r._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){x()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(x,f,u){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,u)});return}r.send(x,u)},a.on("end",_c),a.on("error",Zi),a}Yi.exports=wc});var Pr=oe((rl,$i)=>{"use strict";var{tokenChars:bc}=ht();function yc(r){let e=new Set,i=-1,a=-1,x=0;for(x;x<r.length;x++){let u=r.charCodeAt(x);if(a===-1&&bc[u]===1)i===-1&&(i=x);else if(x!==0&&(u===32||u===9))a===-1&&i!==-1&&(a=x);else if(u===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);let h=r.slice(i,a);if(e.has(h))throw new SyntaxError(`The "${h}" subprotocol is duplicated`);e.add(h),i=a=-1}else throw new SyntaxError(`Unexpected character at index ${x}`)}if(i===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let f=r.slice(i,x);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);return e.add(f),e}$i.exports={parse:yc}});var oo=oe((il,io)=>{"use strict";var vc=H("events"),An=H("http"),{Duplex:sl}=H("stream"),{createHash:Sc}=H("crypto"),eo=vn(),Qe=lt(),Ec=Pr(),Cc=Dn(),{CLOSE_TIMEOUT:Dc,GUID:Ac,kWebSocket:Pc}=ke(),Tc=/^[+/0-9A-Za-z]{22}==$/,to=0,no=1,so=2,Tr=class extends vc{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Dc,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Cc,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=An.createServer((a,x)=>{let f=An.STATUS_CODES[426];x.writeHead(426,{"Content-Length":f.length,"Content-Type":"text/plain"}),x.end(f)}),this._server.listen(e.port,e.host,e.backlog,i)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=Ic(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,u)=>{this.handleUpgrade(x,f,u,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=to}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===so){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(kt,this);return}if(e&&this.once("close",e),this._state!==no)if(this._state=no,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(kt,this):process.nextTick(kt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{kt(this)})}}shouldHandle(e){if(this.options.path){let i=e.url.indexOf("?");if((i!==-1?e.url.slice(0,i):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,i,a,x){i.on("error",ro);let f=e.headers["sec-websocket-key"],u=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){$e(this,e,i,405,"Invalid HTTP method");return}if(u===void 0||u.toLowerCase()!=="websocket"){$e(this,e,i,400,"Invalid Upgrade header");return}if(f===void 0||!Tc.test(f)){$e(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){$e(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Nt(i,400);return}let g=e.headers["sec-websocket-protocol"],_=new Set;if(g!==void 0)try{_=Ec.parse(g)}catch{$e(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let w=e.headers["sec-websocket-extensions"],b={};if(this.options.perMessageDeflate&&w!==void 0){let D=new Qe({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let k=eo.parse(w);k[Qe.extensionName]&&(D.accept(k[Qe.extensionName]),b[Qe.extensionName]=D)}catch{$e(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let D={origin:e.headers[`${h===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(D,(k,B,N,q)=>{if(!k)return Nt(i,B||401,N,q);this.completeUpgrade(b,f,_,e,i,a,x)});return}if(!this.options.verifyClient(D))return Nt(i,401)}this.completeUpgrade(b,f,_,e,i,a,x)}completeUpgrade(e,i,a,x,f,u,h){if(!f.readable||!f.writable)return f.destroy();if(f[Pc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>to)return Nt(f,503);let _=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Sc("sha1").update(i+Ac).digest("base64")}`],w=new this.options.WebSocket(null,void 0,this.options);if(a.size){let b=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;b&&(_.push(`Sec-WebSocket-Protocol: ${b}`),w._protocol=b)}if(e[Qe.extensionName]){let b=e[Qe.extensionName].params,D=eo.format({[Qe.extensionName]:[b]});_.push(`Sec-WebSocket-Extensions: ${D}`),w._extensions=e}this.emit("headers",_,x),f.write(_.concat(`\r
|
|
8
|
+
var L0=Object.create;var or=Object.defineProperty;var N0=Object.getOwnPropertyDescriptor;var O0=Object.getOwnPropertyNames;var B0=Object.getPrototypeOf,R0=Object.prototype.hasOwnProperty;var J=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Pe=(r,e)=>()=>(r&&(e=r(r=0)),e);var oe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ws=(r,e)=>{for(var i in e)or(r,i,{get:e[i],enumerable:!0})},M0=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of O0(e))!R0.call(r,x)&&x!==i&&or(r,x,{get:()=>e[x],enumerable:!(a=N0(e,x))||a.enumerable});return r};var Ie=(r,e,i)=>(i=r!=null?L0(B0(r)):{},M0(e||!r||!r.__esModule?or(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as z0,mkdir as q0,readFile as F0,writeFile as U0}from"node:fs/promises";import{dirname as K0}from"node:path";async function Ft(r){try{let e=await F0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Ut(r,e,i){await q0(K0(r),{recursive:!0}),await U0(r,`${JSON.stringify(e,null,2)}
|
|
9
|
+
`,"utf8"),i?.mode!==void 0&&await z0(r,i.mode)}var ar=Pe(()=>{"use strict"});function bs(r){return Ht[_s]<=Ht[r]}function xr(r){ys={...r}}function Kt(r,e,i,a){if(Ht[r]<Ht[_s])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...ys,...a});r==="error"||r==="warn"?W0.write(`${x}
|
|
10
|
+
`):H0.write(`${x}
|
|
11
|
+
`)}function T(r){return{debug:(e,i)=>Kt("debug",r,e,i),info:(e,i)=>Kt("info",r,e,i),warn:(e,i)=>Kt("warn",r,e,i),error:(e,i)=>Kt("error",r,e,i),child:e=>T(`${r}.${e}`)}}var Ht,_s,H0,W0,ys,U=Pe(()=>{"use strict";Ht={debug:10,info:20,warn:30,error:40},_s=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),H0=process.stdout,W0=process.stderr,ys={}});import{homedir as j0}from"node:os";import{join as re}from"node:path";function H(r){let e=r??j0(),i=re(e,".coze"),a=re(i,"bridge"),x=re(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:x,libEntry:re(x,"index.js"),pidFile:re(a,"bridge.pid"),portFile:re(a,"bridge.port"),tokenFile:re(a,"bridge.token"),logFile:re(a,"bridge.log"),installLock:re(a,"install.lock"),configFile:re(a,"config.json"),agentsRoot:re(i,"agents")}}function Te(r,e=H()){let i=re(e.agentsRoot,r);return{root:i,config:re(i,"config.json"),workspace:re(i,"workspace"),logs:re(i,"logs")}}var ce=Pe(()=>{"use strict"});var Gt={};ws(Gt,{AGENT_CONFIG_FILE_MODE:()=>Wt,enforceAgentConfigMode:()=>V0,loadAgentConfig:()=>ae,persistAgentSessions:()=>cr,persistAgentSkills:()=>jt,saveAgentConfig:()=>de});import{chmod as G0,stat as J0}from"node:fs/promises";function ae(r,e){return Ft(Te(r,e).config)}function de(r,e){return Ut(Te(r.agentId,e).config,r,{mode:Wt})}async function V0(r,e){if(process.platform==="win32")return;let i=Te(r,e).config;try{let a=await J0(i);if(!a.isFile())return;let x=a.mode&511;x!==Wt&&(await G0(i,Wt),vs.warn("agent config mode auto-corrected to 0600",{path:i,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;vs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function cr(r,e,i){let a=await ae(r,i);a&&(a.sessions=Object.fromEntries(e),await de(a,i))}async function jt(r,e,i){let a=await ae(r,i);a&&(a.skills=e,await de(a,i))}var vs,Wt,Ue=Pe(()=>{"use strict";ar();U();ce();vs=T("agent-config"),Wt=384});var oi=oe(N=>{"use strict";var S=O;function pn(){let r=["z29VC0i","zMXVB3i","tw9KDwXL","zw5JB2rLrNi","sNrZCfm","yMLUyxj5vhK","B25TzxnZywC","CM92AwrLige","rhnMCfG","BuLpuuq","qK1nuMS","Dfnmt3q","DgHLBG","BMrhBu4","Dg9cExrLCW","CuvrCLC","Eej5uMO","vw5PBxbSzw0","uxL0sLO","t3bLBKv2zw4","ANzbuLy","zwn0","yxrHlcbKyxq","y2XVC2uSihC","D2vhDKW","zg9Uzq","s1L4u2W","uMLuwvm","uLbdBha","y3jLyxrLt2i","B3nLza","vKTgyMu","yMfJA3vWigu","CMfTugfYyw0","BKPzs3y","BK1ZDvK","C3rLBMvYCW","CNzHBa","rxvpr0O","Bwf4uMv0CMK","Dhr6twW","C3jJ","CLvTyKm","B3bLBG","CMvZDwX0","zgvMAw5Luhi","zwjjDhu","BMvJDa","mxW1Fdr8mhW","AMLHCei","uKncqxm","y2j3qLO","BeHHBMrSzxi","BgvUz3rO","D0zNveW","rxzLBNq","BuPuEhi","swrABLm","m3WXFdr8mhW","AgfZt3DUuhi","zgf0yq","CMvZB2X2zq","wePwteC","q3D3EvK","yvjXCe4","AevYCM9Yrxy","uhrJswi","x3bPBMDqB24","DMfzv1e","DxrVuMvJB24","C3vIyxjYyxK","z2v0","x29UugfNzu4","x2nYzwf0zvm","tMjIEfO","yMfSrxzLBNq","zNjVBNrPzxi","y1vbz2K","qwrrsei","zhDWwNm","x2zVCM1HDeu","vKHyrKK","zw1PDa","s0rrv1a","yunVDxK","uvL0zeO","vxfrD08","x2XPC3rLBMu","CK5nDxK","q21jD2e","x3DZ","CNjVCK1LC3m","zLrYtMK","zMvY","x2LZtwLUAvC","s2fjzMG","AenbC1O","r2TTuu0","ChrVCG","Dgv4Dc9WBge","BhPqv1a","Axnby2TdBgu","ign1CNnVCIa","q3vZDg9Trxi","x2n1CNnVCK0","zxHWB3j0CW","vLnAC1a","zhLUteG","nZK1mdaXofjjwgfsCG","EuLvyuW","tev0tee","AefJA01LC3m","DgvZDa","CYbPBNn0yw4","AgvKtwf4uMu","z1rPBwvVDxq","C3bSAxq","ww9evxu","u29pEKm","CgrHAgu","y3vYC29Yx2y","s21cs1O","DKPHrMO","qvnzD0G","C3rYAw5NAwy","nxWZFdr8mhW","tuvtu0fhrv8","zKjvBNC","AwXSihvZzsa","yxbWBhK","vMPIC1y","BML0AwfSAxO","DhbizwfKzxi","DMnzthK","BMCGzMfPBgu","mti4vhn3tM1V","x2n1CNnVCKy","zM9Yy2u","ysbTDxn0igi","pxv0zI04","BMDLza","y2HLy2Tszwe","zfDXA3u","x3bHDgHlzxK","wuL1C00","DNbWqLa","zNDXs0i","z290r20","y3r4","v0TTCuC","t0Lzrxq","wgXevxm","D3jPDgvvAw4","wenUuK4","rwj6txy","Ew9tsxC","rfjHu1C","x3fVC0rc","r0XZuve","C2vUza","uvDKufi","z2vY","B25fCNjVCG","x21PBMLoyxy","tufyx1jfvfi","rvzcEMW","uNzqvNC","zgPKBKi","ANHTwgy","CMjcufK","yw1LoIa","sKXdAu4","x0vysvnu","y3vYC29YlNm","u21sAM0","rhPvB0W","BNvTyMvY","AeTTz0K","tKXiqM4","zLrsqLa","mhW4Fdv8nhW","DM5JEMm","EgHNruq","zw5JB2rPBMC","Bwv0Ag9K","EgLQuK4","CMfNzvn5BMm","A0HhAeq","v2vIu29JA2u","yLr4Euu","tKfusvzfx0u","BMP5sei","Ec1TC2CTy3u","ANnVA04","CgXLyxnLiha","uMPbsLy","DMzrtKK","yxnZAwDU","x1fVu01HBMe","ChvhENK","CKDjEei","ywDL","uu1Mu0y","zxj2AwnL","nhWYFdf8m3W","rgj4D0K","ww1dyNa","twfovKm","A2v5CW","uxvLDwu","DgLTzw91DcW","BwvZC2fNzq","Axb5q00","t2Dzsxu","u1z1uMO","DvzHswO","x2rPC3bHDgm","q3vZDg9Tq2W","rvjis2q","B3vUDa","BK51Cgi","DxbbDKO","vwjwq28","vvfovuS","AhnPEem","z0PtDKS","zw1hyvO","rgzrEgW","zKTYD2C","rxHUufi","s3DJu24","qvDtt0G","CwHktvC","q1DLz1e","zNjVBunOyxi","yNL0zu9MzNm","t1bftG","rgLUBMW","v2Hbv1a","x2HHBMrSzvi","qxzPzgS","uMDTs20","zMvWqwO","EMfuyNe","De1HBMfNzxi","zvHmtgu","zMfVufO","tMjnCM8","DeLK","rhjcwfa","q1vcD1u","CxHmsKC","sgzQru8","shf6ww4","DhzrzMW","C2vwvLa","vLbLzgS","ywnRpwzYB24","nhWYFdv8ma","sefcuei","AMvJDfn0B3i","AMfcCMq","Dxrjza","vgfiqvi","D0PHs3i","x3jLywr5q2W","wNvABxi","Dg9cExrLC0W","CvPMAfK","DxbKyxrLq3u","x3bPBMC","uMrVthm","ufrHEKK","DfHsweq","B2LUDfjLywm","vePKDeC","CMvHzhLtDge","nZqYodmXmhPXrMPTzG","mdaWmdaWmda","jMPZy2fSBgi","uwfgsuS","EKnwtLG","C2nYAxb0","wePqu2O","Cgf5Bg9Hzfq","CMvZzxrdB3u","A3vHDeC","EvjLy29UBMu","BNf2y0e","quXm","CgzkD20","vxP6rfK","yMXVy2TLza","swzMvwW","wLzhs3G","zvn2v2u","vujNA0y","zufJAW","lcbTyxGGCMu","zKjsvfa","yunAu2S","A05ZqNC","AvjVy0S","DNLyDgu","B3jL","CMvZzxruCMK","zNfbAwO","y2HnyxHuCMK","ywXty29Wzq","zw5HyMXLuw8","zsbHihn0CMK","Bhf1B3q","zKXiuu4","zxjFBxnNAwq","Dg9iyxnO","DKXwrNe","v3biwfi","B3jLtMfTzxm","suTMshm","x2LZv29YA2u","ExfSB3C","Bg93","n3WZFdr8nG","zgrjrcWGzgu","CNP3ueO","s0rOEvC","r0vLswC","BwLUzW","qLnkze4","DwneC1G","rvDuqwG","B25nzxnZywC","DgvmB2Djre4","r0joEg0","AgvHzgvYCW","tvHpC1y","zKTVAK8","wxbsueW","yxGGCMv0CMK","vMTgC1O","ChzcEfG","rMTNt2S","suvtx0vsuK8","s25duKi","wNvIrK4","zw5KCg9PBNq","zLzJzxK","EvfWCNu","C3vIC3rYAw4","q09otKvdveK","CgzHCNu","qxbhwMS","rKvkDwO","tMDuB24","sLzevvO","z2v0sxrLBq","zw50zwqGDhK","rg1zANC","CvjwuNG","Efrurw52","zxjFDhrS","ywr2yw5Jzq","CLLTuKW","DgLTzw91Da","su1oww0","rhvrwLm","B25tDgfYDfi","BwfUDwfSihi","zezptuO","BgjUBvu","C2v0sxrLBq","C2v0","uLjpuG","EgX3CMq","z2v0qwXSs2u","shDSDg0","zvfduxG","BM5Ly3q","Ec11C2uT","zwDgr0K","wvrVCMS","ywnOzwqSihC","mNWX","zwLhqKi","z2vjBMzVu3K","zvLkufO","vxLqvu0","Aw9U","x3nLCuLK","x2DLBMvYyxq","x2LUAxq","z2v0t3DUuhi","x29Ut3bLBG","rfL1ufu","qwnbsNi","CMfTzq","tgLZDgvUzxi","zxzACvG","surMBwy","zNLMt1u","yw5Nzq","ywrKq291BNq","AM9PBG","B2nRzxq","B25ozxr3B3i","zvvysNC","D3n1AvG","rNjVBNrPzxi","zKztAhO","uenZsfG","x3bPBMDmB3m","AM5yqwm","zMX1C2HfEha","zMLSzw5HBwu","zejwDxu","C0XeC2W","ug9bzeS","qxjyrgy","x2LUDgvYDMe","zw50","y2f0y2G","x29Uq2XVC2u","zxmGCMvHy2G","zNDZxZeUmc4","CgfNzxnOB3C","BwLZzq","zxq9DxrMltG","x3nLBMrby2S","y29UDgLUDwu","D0fxCK8","x3nVy2TLDa","zufYse4","C3rUDMm","Dg5sAe0","CgLUz19VBMm","C2vUzf9Hy2S","Aw47y2HHCNm","yNvMzMvYzwq","CM9YrxzLBNq","C1Hduxu","C2vYDMLJzq","shrPBgS","mxWZFdz8n3W","DMvUDa","B3DAtxe","B2PACwW","B1bpExq","BwvY","DxbNCMfKzw4","q1DpzKO","r3Dur2y","wvnLv3a","BMCGDxjSoIa","zxf1ywXZ","tgHsA1y","u0D1CKy","whrhz1i","AMvzv2W","CNnVCKzPBgu","ywnOzwq","vLrUA08","y3fxEgG","y01Hvhy","wvr0y2y","EsbJBg9Zzwq","uhn5De8","ywnRtxnNswq","Bg9NsurozxC","CxLfzw8","wg5ns2y","t3fwt1e","CMvHzg9UBhK","vvDIsu0","Dezcww4","veLXuvK","ig1LC3nHz2u","CffTtuW","ihrPBwvZ","zcWGDw5RBM8","ruX6seC","AuTAyuS","wg5brKK","o2nOyxjZzxq","ru90A1i","CfnJDMq","DhHzzM8","vhLPzKC","uKjvA0W","vujqEuW","D3jnuMO","DwL3EvG","zurPzMK","ALPLD2K","shj2whu","C2vUDa","B3jTwxm","uxLNyKi","txHLA1K","Afv5EuG","ExffCKG","BgTSzgm","yMTcz1i","sNrAq1q","x2n1CNnVCK4","zxH0ugf5Bg8","z2v0u3rVCMe","sMf2B1a","zhbyCgm","ug9xzKC","vKDXAuC","CMTsreS","CNH3wgW","q09oveLovuu","tKDFrvjst1i","CKT1q04","twfrCLm","BwvZC2fNzv8","t0fJqMm","mdaWma","Ee9HyLK","x2HHBMrSzu8","B2zMC2v0","ywDLrxzLBNq","EwviDu8","EevlAeq","wvnbv0y","B2nRzxrtDwm","C3rVCMu","B3zeAvG","zNv5vMO","y3vYCMvUDeu","u2LqBLe","y29UBMvJDgK","B3zIwK8","B0Xytxy","CvPcANm","ChvZAa","EMHyyKS","tfbnswW","s0XbDe0","uMf4tLm","ug9wCey","z3bgt2i","tg9Nsuq","ChDOrK4","EhH0ywm","r25owMW","DMvYC2LVBMm","y3vYC29Y","zcbLCNjVCI4","CMvJzwL2zwq","t1PlswS","v2LUzg93","Dhn6B3u","DuvZDw8","AgHbEwi","y01xtvm","C3nju1q","EMzbDK0","y09Wzw4","wfnMAMy","AuDrEK0","AeTdzgS","y3jLyxrLuMu","zNjVBujPDhm","BMrWB2LUDfq","rNrzt24","CM92AwrLihC","uNvYr2y","Dhr3Awq","C2v0u3rVCMe","yM5Hu0q","AKXOthC","y3jLyxrLtwu","BNrLCG","Cg9PBNrdB24","y3jLyxrLt3a","v2Lmz08","ChjVy2vZCW","t3viBLO","txfIr2q","CM92AwrLigi","yu11thO","zNz5D2G","Be9UyKy","t3fWCxu","A2Tcvui","Eu1nC2S","ywzL","rxjYB3jdB2q","CMvWBgfJzq","Cw9Z","Bur2rwm","CgH3ANa","DxjS","vhDgDfK","Aw5L","zxjYtM8","y29UBMvJDa","CMvHzfvjBNq","DgLUzYbZzxi","y2XLyxi","twvZC2fNzuu","vw5Oyw5KBgu","CMvJB25Uzwm","A2v5","sNbuCwe","zMLN","tKLzwva","zufwAhK","C1PzEwC","qLDAqxe","qu1PuNm","AvzXv1e","wLHyv1i","z0Xvrgq","t0TnEMu","Dw5RBM93BIa","DhjPBq","yvzJq08","D3nZoI8V","surIC1i","AwDHDg9Yt24","AhL3C04","qKvpENe","zvfuBMS","zwrPyxrLBhK","sxP4DfK","Bff0yMG","zwvKzwq","yxrLq291BNq","mxWY","uNrQyve","DwvIvxK","y2vQBgW","AxnmB25N","ChjVDg90Exa","vvfcD3a","ChHhzKK","Bhj3zuO","q29Kzq","C2v0q3vYC28","ENPdEeO","su5Msfu","y2HHCKnVzgu","tKXLz08","rMvtz1i","CgvYC2LZDgu","Dev2zw50","ywrK","BunOrMK","AwrI","r0fVt1K","rKzmv1e","x2LZsw5PDa","ihzHBgLKihm","rM9fA3K","CgLUz1rPBwu","yM9KEq","y29TCgXLDgu","ihrYEsbYzwm","y2fLzhu","C2DPza","r0Hst0G","zfDVCMTLCKC","yxbWzw5Kq2G","DM9KrhG","sfbIwLu","AMDSze4","qNzAzu8","qMXwCKK","DM1TvhK","Befjr2K","BMDuAw1LCG","CYbHBhjLywq","sLPAqMq","uuf5Cxi","C2PAvgi","sg1AuNa","BNruCMLLC0m","sKHYsK4","ywnRDxbfBMq","uKzwvfu","Ae9Wzw5fDMu","x2LZtwLUAvq","AufvD1a","zv90Aw1LB3u","EgLnz2y","sLniquq","B3nLrxzLBNq","BNnwrxu","uxL0DMS","EevKu1e","zgvSzxrLrge","su5XyMK","tgDuBui","q0Xpu0ve","Ce5pDxi","DeLUDgvYy2u","ChLizfG","zxjYB3i","Bw5Jtxi","BM9cwfq","thHuzNG","CMfUzg9T","BwPgvMG","vuDLtvi","zxjYtxnN","y1rkr0m","ywDLsgLKzq","yNLL","CefbB2W","BgDrCu0","CLzHBhvLCW","EvDJuLi","u2vXsuq","suTOsfO","zvvYBa","t1bftL9fuLi","CgDSruS","zxrVD2O","BgLTAxq","ihbYB3rVy28","tKvRAe4","zxbkCha","AKrbtfm","Ef9MCM9UDgK","CvrMDMW","zMLUza","sw5KC1O","vxPNv1u","BIWGAg9ZDg4","A0rpAfm","r3LwrMW","tgT4qLu","suzxCvy","x3bYB3rVy28","Dg9cExrLC0i","q291BNq","Cuvbwhu","mZaWodG4owDPr1HVzG","DhDVCMTdAge","tMrPtKe","DgzVzvq","A3rWzey","yxv0BW","t2TdBfK","Eerlt0i","C2XPy2u","DMfSDwvZ","uhjxquO","B3jpBMXPBMu","tLLfD24","DwDjvKm","BeH6y3C","u0v6zvy","ywvPDKW","BezSDxnO","B25Uzwn0Aw4","ufHuwMG","B0fNt2K","vfD5A3K","qKLrvfC","uwrzrMy","q3vTB1i","y2vZC0HHBMq","ww9nqMS","zxrxB3jRq2G","C2HPzNq","zgvIDwC","C2vYDMvYvgK","tLDADuK","whbUzKG","C2v0zgi","Dg9mB3DLCKm","zwvTEw4","wufRywS","A3v3uM0","rwHuANK","DhjHBNnHy3q","BhnwyM4","vg1Utw4","z0XjwMm","CgLgBKu","B1bsAfm","zNnfrNO","BwvKAwf0zwW","qMfNt08","q0XTCMu","BgLUzq","y3jrsw8","thHjwva","tePYBfa","Aw9Ul2PZB24","DcbSAw1PDa","zurjvvG","u3DoAw4","B3bLCNr5","twzJu0C","zMrkExC","C2fNzq","tgHzEgW","uMPrB0y","wxDKEuy","sMDjzMK","sLnptLa","qNfotMO","zuLOuhC","z2vrDwv1zuW","x29UrxjYB3i","Cg9PBNrbBMq","t2jVCeS","yMLUza","Dhj1y3rVCIa","ihzHBgLKigq","Bwf4tg9ZC0m","vMHAqxG","BhDkrLe","wu5urMe","rhzkywO","ignVzgu6ia","su5tvefova","x29UvgLTzw8","vKr6C2W","DMHJtfu","Bgfpq2e","DMfS","qu5KAMu","zw5fDMvUDa","DMfSDwu","yxj0u3i","zKr2txe","nJCWnZmYoeLhzgzSta","y291BNq","r0fjr3y","x2TLEvbHDgG","zM9YrwfJAa","vwPKufe","DLfqzeC","Du9mtMq","mNWXFdv8mhW","zevpA2G","zMLSDgvY","x2rLC3rYB3K","ANbnEfm","l3DZl3yY","vKrHvLC","ywXSB2nvBNm","sM5Tue8","x2fKzfDZtgK","x3vYBa","qKjws0q","BgLUzw5V","zv9ZDwnJzxm","y3vZDg9Tshq","y2XVC2u","ExbL","tgTcq2e","DxrMofDYAxq","y2fSBa","rgfMCum","zMzmAw5L","uNfkzKO","wLPRqMK","x3DZsw5ZDge","qwXkC0K","v0fIqNC","rwLeC0W","CuHNrKK","Aw9UvgLTzw8","EhD4vwy","BffYCwi","ywXPzcb1CMW","s0veCKm","D2rhq0u","sNbHB1e","BeT5q1a","x2LUAxrhBg8","B3bLBKrc","ChrkBKu","z2TWshC","x2HHBMrSzva","AvPzyM8","DKnYzNm","A0HjuM8","CwzQqM4","tgnct1m","s2nbAxu","CgLUz0XVC3m","v0HUD3y","t0DnBe0","u1Dyq0K","CLrIv24","AxnAzxjV","B29bBLq","C3vJy2vZCW","yw1L","DNPOuLa","rKPiDKm","q0rYtLm","zM5pu0O","vu1Iv0q","DhLWzq","t0for2i","ENHJzfy","qvzLuui","DeP0ufG","y3vYC29Yx24","qufeDLO","sw14AgO","x2LZqNjVD3m","DuDJBMW","CMvXDwLYzwq","BMnVzgLUzW","zevUCuW","v3jdD1e","AhnmsNG","AujABum","C3DIq0q","B2XKvMvYC2K","vhPmEeC","y29UBMvJDca","ANHNEw4","De91wKO","C2f4ww0","tLfrvxe","Dg9tDhjPBMC","z25Qy0m","AwXLtMfTzq","y2HnyxHdB3u","zuLwrwy","qM9JDxe","zfHnqNi","s0LyywO","BhDPExC","wKDMtee","B25mAw5L","Dg9oDw1Izxi","CK1ftu4","qLvVCuO","D05XBfa","sgPUC3y","CNrRBxa","ruXtuvO","CNnVCL9Uyw0","zhD2shC","ywXSzwqGBxu","x3DHAxq","AxmGDw5Kzwy","qwjVCNrfCNi","A2vqzwu","BMCGB3iGyw4","tKndv28","tNLgqwO","r0PqzLG","rwPYsfG","BMvLzf9Hy2S","y3jLyxrLrxi","Duz2B3G","EMjJC2q","y3vYCMvUDeK","y29UBMvJDeu","sKPXsfO","B25SAw5L","DKXzr0K","vhjWB1a","v0rirw8","ufzft2i","vgLTzw91Da","zgLZywjSzue","B01isxK","ywnRx2nVzgu","swXisfK","sKrOtM4","AhfIDue","yu9Xwvy","zw50tgLZDgu","rhrZAK0","C0Xf","BfjgC20","z2Drse4","q2LsqMG","y29Kzq","BM93","qw1VDw50","ndm4mJiZofnrv2jWsq","B25VCgvU","C29YDa","zfLPwLa","BxHxtKG","uhbmrhK","zhrRt1K","wxHqtfu","reTjsfG","DNnnzuC","CuPxu2i","BMnLq2XVC2u","y29UDgv4Da","C1P6rMq","Aw50zwDLCIa","x19LC01Vzhu","yM9L","AxnbCNjHEq","shD3swm","sNjQEKy","BM1hweO","yw51Ce1LC3m","ALb5ueW","Dw5KzwzPBMu","vvvdzKi","EMrLCK8","yxvpD1u","CMvKDwnL","y3vYDMfSDwu","twPovfu","q0Xpu0LorW","senlBvy","y05Msue","BgvY","CgfNzwHPzgu","uevVyw8","x2vUzhbVAw4","vxbKyxrLq28","ENHAvNm","C0DbEhe","uuP0rfi","BMrLEa","r25jq2G","zuLSww8","tKTvsKe","t2vOt2G","vMPMu3a","CNfsr2C","wwzKswW","qxvTuLG","A0nzr1O","DeThAe8","ywDLu2HVDW","qNjPzgDL","Dw50","tuzUEe0","vu5nrM4","DeDKEwq","yxKSihrYEsa","Bwu6ia","BM9Uzv9UB24","EuXdruS","C3rYAw5N","zhDdBem","BfDxEg4","wgzusMq","tNPID3G","ufH4ywu","yKvYBum","x3jLy29UBMu","C0jf","CgfYC2u","ChbL","D2nPtxG","ihrPBwvVDxq","AKL6C0S","D2n6r0C","B25szwnLAxy","EeDvs3K","CgLUz0LUDgu","B3bLBIa","AxnrB1nby2S","y3ruAw1LB3u","B2nRzxrgywK","qufMzvm","ref3thu","yKLNsK8","rfDZrNm","CMv0CNLdB3u","quDlz1O","B3vxwNu","CMvQzwn0","BwfW","x2LUAxrqCM8","z2u6ia","vKX3yNi","D3m6lY8","C2vYDMLJzs0","teL3tg8","tKXJEgG","z1jnANu","qunct0S","rNDssgW","wML2sfK","DhjPzxm","AfPOCeu","AxnFywnR","sNfrseW","BgjQC3e","x2nSzwfYugK","te9zBve","yxjYyxLIDwy","v3PSCvu","Bg9N","Cgf5Bg9Hza","AwXLx25HBwu","Bvzmr2S","D2DHvhO","CxzcBKe","sxDNv1m","y1L6v08","ywrKrxzLBNq","z2vtEw5J","sMvAz3O","q1fRsKu","Cg93","yw5ZzM9YBvq","DgLLCKPtt04","yK5RuLm","Aw5JBhvKzxm","s2vLzem","yNP5sNi","BeXjseO","rw1uvMu","CIb0DhDjra","tMr4Bu0","yNL0zuXLBMC","ve13CLm","rxDdA0O","CKD5AuO","DMvYC2LVBG","DNbUBwK","Bw5HrNa","x2nSzwfYvgK","ywXS","x29UtwvZC2e","Certrfq","A01ms20","zxjFAxnFywm","Cen4qwi","uw9qANa","BfztEw8","Evr4q3i","q2jPA2i","CwvPv0C","r1P6q0y","zMnpqwm","uMvHzcbWyxm","B2fK","ww1XB0W","zNvUy3rPB24","CKPhtgu","C25OAMq","D3P0A1K","zK9hvNG","Bvb3s2S","y3jLyxrLrwW","yuD6yLq","zxH0zw5ZAw8","BNrbBMrvCgq","zxDdDhG","x2rLyNvN","CML2qKK","EhPQAKG","z2v0q3vYC28","CgLUz09Uy2u","zgvSzxrL","C0nVDw50zxi","q2rTr00","BK5Tsg8","CMvHC29U","CMvWBgfJzui","zw51t0q","BNfjqLO","B2DwDfe","y2HLy2TdDxi","vgfN","AxjLza","A1n0yxr1C0m","lcbOB3n0BMe","u3rYyxrLz3K","x2rItMfTzq","thHVsfO","DhjPzxmGCMu","tg9NsurozxC","vNrrvg0","B25LCNjVCG","BwvZ","DMvY","BxnN","venPwvC","t01VDvm","BuDQuxe","rKfhwMi","tMfTzq","BuzgB2K","x21LC3nHz2u","q29UzMLN","ywTiEue","se9iyMe","tKXgCum","B1zpAMO","mxWZFdj8nhW","re9erwS","CuXqyLC","BgTqswC","zNjHBwvuExa","AgfUz2u","yw1Owxm","ze1Atxi","B2zMBgLUzq","D3jPDgu","wvLTuKG","y29UBMvJDfm","rLDt","DgHHBIbSB2m","C29Tzq","r0P1ru8","t2jQzwn0","B0HKsve","qKDrEvO","A3PiCLe","uuTZz0i","CMvUDevUzha","y2XLyxjtDg8","DMLJzuLeig8","Dgv4DfbHEwW","EfvZzuvUDG","B25tDg9Wsw0","BNbXtgK","zw5XDwv1zq","zNjVBuj5Dgu","Chv0","CwrmExm","Cg1Mu1e","yxbWBgLJyxq","zcWG","yw5Hz2vY","x3bYzwzPEa","DwP3t0e","A0rorfG","yxnL","C0fIq0m","u3Lzugy","uhjPBwfYEuS","AgfZ","uwPmCxu","A2zlwwC","AwTMD1G","v2rlufe","x25HDMLNyxq","ywrKt25L","yu9Wz3a","q0PLqKy","txH2wKS","yLLTy04","BwXRzK4","CLLTCMq","Dg9Y","oduXmti2uwD2DKPv","z1n5Buq","s01dvhK","B2jQzwn0u3q","tvvcrwy","v2vPEgLUsLm","seTNtwm","BeHbs1O","vMjQCNK","B25JBg9Zzq","thncwKG","q0T2tvK","sevWrei","ExnvDKm","nhWYFdb8mxW","q1bbwLe","AxnrB1nnzxm","DMT6zhu","A2v0ignVBNm","r3vJCKK","zwnVBM5Ly3q","C2v0y3vYC28","Bg5Ssw0","twLZC2LUzYa","AenSB3nLrxy","ENDLreO","x2rYB3bhBg8","yxKSig5LDhC","BhrPCgXLihq","zgLZCgf0y2G","svb0AK0","u01wtNe","tK9As1a","ChztENC","nhWZFdv8mhW","y3rSALq","Aw5Lza","Dgv4Dc9Qyxy","A29hvw8","CLbUEKq","s3nnqNu","igzPzwXKoIa","u1DyDLG","qKf4tfi","zNjVBu51Bwi","x2nVBM5Ly3q","twPKDhC","D24GCMvHC28","AwXK","ihjLy29UBMu","m3HIBwH5sW","C2XIAha","z2v0s2v5","AgTjrgG","z2v0qwXS","m3WXFdj8nhW","B3bLCNr5tMe","zxjHDg9Y","ywjVCNq","rgjYB20","se1kEue","y29Uy2f0","DgfYz2v0","z2fPtwO","x3jLBw92zvC","teD6wKy","vwv0Ehu","BMrWB2LUDca","Cgf5Bg9Hzeu","BfrPBwvVDxq","DKL5B3G","zwnUvvq","zxjFCw9Zx2e","C052v2e","u1nqCNy","r2DfteK","z2jUwg8","x29WDgLVBNm","x0rctMfTzq","A0DcCei","rvjst1i","rgLYC00","Dg9hzw5LCMe","ywWGy3vYC28","suXOzfC","vfPutfu","t2Ppwxq","uKvcwha","DMzerg8","zMvcuMq","qMrfvNq","z29PBMCGyxC","vLD6B2y","id4G","tMrRBMi","vK1vwgu","y2XVC2veqG","EvzSA1K","wxHfr0K","r0PlwMm","AhvVvNi","qujMCfq","CMvTB3zLrxy","yKn2vgq","u29otKG","CgjICdi","qLLky20","y3jLyxrLq2W","BMv3vMvYC2K","zgvS","B2zM","ChjVDg9JB2W","yNL0zxm","rxnhD2y","BxnNsuq","CfDSzge","rxvgEuK","x194x21Zz18","y29SBM8","qLvJwK8","rMLAtLu","C3bSAwnL","sKnjyuK","B3v0sw50zxi","rwL5Ewq","q3zKweO","AxnszwfKEq","uwPdueO","rMvxrfi","CwT6z08","rg1mCuy","mxWWFdv8m3W","DwXuAfG","D2fZq2XLyw4","qKLVr0u","C3nHz2vfDMu","ywX3yxLZ","terSCvu","y29UC3rYDwm","tLPcwhG","wLHfqKy","x2jPBMfYEvq","BMvY","sKDty3u","zNrJC0O","x2rPC2nVBM4","t2ryEK4","BM1qtLG","AgLNAa","vKn2ufi","DgLtv28","Cg9W","D0nTzLO","wffzDxG","y2PzyxO","BKfTBfi","Ae1LC3nHz2u","t1znt1y","Bezru1i","vgfXBNu","CNnVCL92ywW","t3fvDM8","D1Pdv0e","zK5Mr3O","Dvf3Ewq","Be1isKW","AgTRsLa","CMvZzxrfBMq","ChPMsge","mNWZFdf8nhW","Ag1ssNq","Aw5KzxGGB3u","EvbOtMu","BwvZC2fNztO","CNzHBfzHBhu","BKXPBMu","vevps08","s0PQt3m","te1Py3C","AuzKywm","zMzTt1K","twzxBvy","A3rhs28","BuzqDeG","BNrfBMrWB2K","yNvMzMvY","BeP1zeC","Dw5ZAwDUzwq","CLrnDhy","AKv4r2K","AgnTA0q","svv1BMO","zMzLCG","Aw5KzxHpzG","qMLlz1i","Dwzjz0K","igXHCMDLCIa","s21qzxq","tg9JAW","D2nmAgS","zgvJB2rLzey","qKLvzwi","D2LSBfjLy28","BLHnuuy","B3jRig9MzMW","CMLLC0nVDw4","D3zTuwC","mtyWmte5m1HpwwftzG","D0TdDvO","rMLWq3O","yKnMzhu","qKHqyvG","rNLSDe8","t0TfCLm","yw1Lu3bHy2u","v0DAvu8","D3PuCfK","wNnxBuy","vwPVvge","BfvSCwO","wLfZu2S","r2XzuhO","DKjur0C","DKHdvwO","AfHjuhO","z2v0q3vYCMu","BMfTzq","C0XPC3rLBMu"];return pn=function(){return r},pn()}(function(r,e){let i=O,a=r();for(;;)try{if(parseInt(i(925))/1*(parseInt(i(875))/2)+-parseInt(i(1082))/3+-parseInt(i(453))/4+-parseInt(i(1380))/5+-parseInt(i(1211))/6+-parseInt(i(606))/7+-parseInt(i(1238))/8*(-parseInt(i(361))/9)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(pn,978563);var Qa=Object.defineProperty,ex=Object[S(1494)+S(931)+S(803)],ti=(r,e)=>function(){return r&&(e=(0,r[{GAoOY:function(f,u){return f(u)}}[S(273)](ex,r)[0]])(r=0)),e},tx=(r,e)=>{let i={EroCp:function(x,f,u,h){return x(f,u,h)}};for(var a in e)i.EroCp(Qa,r,a,{get:e[a],enumerable:!0})};function nx(){return Xs||(Xs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function rx(){let r=S;return $s||($s=[IDBCursor[r(257)+"e"][r(1464)],IDBCursor[r(257)+"e"].continue,IDBCursor[r(257)+"e"][r(1531)+r(860)+"ey"]])}function sx(r){let e=S,i={ptJnE:"success",LkBCa:e(321),eQTnk:e(668),Hwltm:e(1202)+"in;chars"+e(1529),DdNxu:e(873),TmnMn:function(x){return x()},dwpZs:function(x,f){return x instanceof f}},a=new Promise((x,f)=>{let u=e,h={usgBJ:function(y,E){return y==E},Tzkjq:i[u(246)],TyifG:i[u(1478)],vnczc:i.DdNxu,mFvyO:function(y){return i[u(402)](y)}},p=()=>{let y=u;r[y(977)+y(597)+"ner"](i[y(500)],w),r[y(977)+y(597)+"ner"](i[y(478)],b)},w=()=>{x(Se(r[u(1147)])),p()},b=()=>{let y=u;if(h[y(1284)]!==y(308))f(r[y(321)]),h.mFvyO(p);else return h.usgBJ(h.Tzkjq,typeof _0x20aa1a)?h[y(1589)]:""};r[u(727)+u(1499)](u(516),w),r[u(727)+u(1499)](i[u(478)],b)});return a[e(1115)](x=>{let f=e;i[f(1182)](x,IDBCursor)&&hr[f(1474)](x,r)})[e(1523)](()=>{}),wn.set(a,r),a}function ix(r){let e=S,i={gnjcC:e(933),jxgyn:function(x){return x()},FyltO:function(x,f){return x(f)},xRolQ:e(570)+"or",dwvHw:e(280)};if(mn.has(r))return;let a=new Promise((x,f)=>{let u=e,h={jgldN:u(1331),jLhLw:function(y,E){return i[u(1087)](y,E)},YSeWp:i.xRolQ,WDHEo:function(y){return i[u(543)](y)}},p=()=>{let y=u;r["removeEv"+y(597)+y(1017)](y(280),w),r[y(977)+"entListener"]("error",b),r[y(977)+"entListener"](i[y(548)],b)},w=()=>{let y=u;i[y(543)](x),i[y(543)](p)},b=()=>{let y=u;if(h[y(289)]===h[y(289)])h[y(193)](f,r[y(321)]||new DOMException(h[y(1554)],y(570)+"or")),h[y(587)](p);else return this[y(1260)].clear()};r[u(727)+u(1499)](i[u(566)],w),r[u(727)+"Listener"](u(321),b),r[u(727)+u(1499)](u(933),b)});mn[e(1474)](r,a)}function ox(r){_n={RurGf:function(a,x){return a(x)}}[S(189)](r,_n)}function ax(r){let e=S,i={QoPjp:function(a,x){return a(x)},viWAI:function(a,x){return a===x},ugIVC:e(878)+"oreNames",AcAJr:function(a){return a()},yqErH:function(a,x){return a!==x},HfjEO:e(1429)};return i.viWAI(r,IDBDatabase.prototype["transact"+e(1490)])&&!(i[e(374)]in IDBTransaction.prototype)?function(a,...x){let f=e,u=r[f(480)](kt(this),a,...x);return lr[f(1474)](u,a.sort?a[f(608)]():[a]),Se(u)}:i[e(1497)](rx)[e(735)](r)?i[e(120)](i[e(1355)],i[e(1355)])?null:function(...a){let x=e;return r[x(1232)](i[x(756)](kt,this),a),Se(hr.get(this))}:function(...a){return i[e(756)](Se,r.apply(kt(this),a))}}function xx(r){let e=S,i={YoMBk:function(a,x){return a===x},lkPIg:e(766),wbNQd:function(a,x){return a(x)},JDhNn:function(a,x){return a instanceof x},ACBOK:function(a,x,f){return a(x,f)},emGaZ:function(a){return a()}};return i[e(387)](typeof r,i[e(821)])?i.wbNQd(ax,r):(i[e(594)](r,IDBTransaction)&&i.wbNQd(ix,r),i[e(707)](ni,r,i[e(1329)](nx))?new Proxy(r,_n):r)}function Se(r){let e=S;if(r instanceof IDBRequest)return sx(r);if(hn[e(861)](r))return hn.get(r);let i=xx(r);return i!==r&&(hn[e(1474)](r,i),wn[e(1474)](i,r)),i}var ni,Xs,$s,hr,mn,lr,hn,wn,_n,kt,Zs=ti({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={LxIYP:function(i,a,x){return i(a,x)},UApej:function(i,a){return i+a},lAIGi:r(321),ecnUT:function(i,a){return i===a},IMNYm:"sICJL",GwTGf:r(1128),hsixC:r(878)+"oreNames",sZYyg:r(148),wrMRj:r(650),wJaKr:function(i,a){return i(a)},mJTxr:function(i,a){return i===a},egFGI:r(596),xOabY:function(i,a){return i===a}};ni=(i,a)=>a[r(832)](x=>i instanceof x),hr=new WeakMap,mn=new WeakMap,lr=new WeakMap,hn=new WeakMap,wn=new WeakMap,_n={get(i,a,x){let f=r,u={lUlqj:function(h,p,w){return e[O(412)](h,p,w)},njyHB:function(h,p){return e.UApej(h,p)},dpXpc:e[f(293)]};if(e.ecnUT(e[f(1467)],e[f(1467)])){if(i instanceof IDBTransaction){if(e.ecnUT(a,e[f(1553)]))return mn[f(1174)](i);if(e.ecnUT(a,e[f(1327)]))return i[f(878)+"oreNames"]||lr[f(1174)](i);if(e.ecnUT(a,e[f(231)])){if(e[f(946)](e[f(1592)],e[f(1592)]))return x[f(878)+"oreNames"][1]?void 0:x[f(878)+f(1407)](x[f(878)+f(1420)][0]);{let h=u[f(1094)](_0x1fa2b5,_0x5eb83a,_0x462c77);return _0x48b306.bytes.subarray(h,u[f(1294)](h,_0x4cea87))}}}return e[f(1367)](Se,i[a])}else this[f(1185)](u[f(128)],u.lUlqj(_0x2f19c8,f(321),{message:this["_formatE"+f(1194)+"age"](_0x1d6330)}))},set(i,a,x){return i[a]=x,!0},has(i,a){let x=r;return e[x(1159)](e.egFGI,e[x(1482)])?i instanceof IDBTransaction&&(a===e[x(1553)]||e[x(140)](a,e[x(231)]))?!0:a in i:_0x2259ba.resolve()}},kt=i=>wn[r(1174)](i)}}),ri={};tx(ri,{deleteDB:()=>fx,openDB:()=>cx,unwrap:()=>kt,wrap:()=>Se});function cx(r,e,{blocked:i,upgrade:a,blocking:x,terminated:f}={}){let u=S,h={ZGfLA:function(b,y){return b(y)},gJSvK:"close",nRqQq:u(1551)+u(250),CRlyA:u(1395)},p=indexedDB.open(r,e),w=Se(p);return a&&p[u(727)+u(1499)](h.nRqQq,b=>{let y=u;a(h[y(556)](Se,p[y(1147)]),b[y(540)+"on"],b[y(983)+"on"],Se(p[y(400)+y(1490)]))}),i&&p["addEvent"+u(1499)](h.CRlyA,()=>i()),w.then(b=>{let y=u;f&&b[y(727)+y(1499)](h[y(1328)],()=>f()),x&&b[y(727)+"Listener"]("versionc"+y(823),()=>x())})[u(1523)](()=>{}),w}function O(r,e){r=r-114;let i=pn(),a=i[r];if(O.PHAiEX===void 0){var x=function(p){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",b="",y="";for(let E=0,P,I,L=0;I=p.charAt(L++);~I&&(P=E%4?P*64+I:I,E++%4)?b+=String.fromCharCode(255&P>>(-2*E&6)):0)I=w.indexOf(I);for(let E=0,P=b.length;E<P;E++)y+="%"+("00"+b.charCodeAt(E).toString(16)).slice(-2);return decodeURIComponent(y)};O.OvahYP=x,O.SwsrFY={},O.PHAiEX=!0}let f=i[0],u=r+f,h=O.SwsrFY[u];return h?a=h:(a=O.OvahYP(a),O.SwsrFY[u]=a),a}function fx(r,{blocked:e}={}){let i=S,a={BIoGE:"blocked",KsMBu:function(f,u){return f(u)}},x=indexedDB[i(314)+"tabase"](r);return e&&x[i(727)+i(1499)](a[i(1009)],()=>e()),a[i(915)](Se,x)[i(1115)](()=>{})}function Qs(r,e){let i=S,a={OdXzN:"readwrite",XnAFI:function(p,w){return p instanceof w},odkFm:function(p,w){return p===w},thCnz:i(668),jaBrd:function(p,w){return p!==w}};if(!(a[i(1584)](r,IDBDatabase)&&!(e in r)&&a.odkFm(typeof e,a.thCnz)))return;if(gn[i(1174)](e))return gn[i(1174)](e);let x=e[i(211)](/FromIndex$/,""),f=a[i(1364)](e,x),u=ii[i(735)](x);if(!(x in(f?IDBIndex:IDBObjectStore)[i(257)+"e"])||!(u||si.includes(x)))return;let h=async function(p,...w){let b=i,y=this[b(400)+"ion"](p,u?a[b(1021)]:b(1574)),E=y[b(148)];return f&&(E=E.index(w[b(389)]())),(await Promise[b(750)]([E[x](...w),u&&y[b(1128)]]))[0]};return gn[i(1474)](e,h),h}var si,ii,gn,ux=ti({"node_modules/idb/build/index.js"(){let r=S,e={kJtvp:r(909)+r(1485),fLHQN:r(848),rdgNu:r(270),eIlYo:r(782),vzhRP:r(222),Uetxu:function(x,f){return x(f)},FoEky:function(x){return x()},CKvMY:r(927),VHXFI:r(929),EuFyI:r(1477)+"ys",NIYYP:r(454)},i=e.kJtvp.split("|"),a=0;for(;;){switch(i[a++]){case"0":ii=[e[r(1415)],e.rdgNu,e[r(649)],e[r(518)]];continue;case"1":e[r(941)](ox,x=>({...x,get:(f,u,h)=>Qs(f,u)||x.get(f,u,h),has:(f,u)=>!!Qs(f,u)||x[r(861)](f,u)}));continue;case"2":gn=new Map;continue;case"3":e[r(277)](Zs);continue;case"4":Zs();continue;case"5":si=[r(1174),e[r(886)],e[r(1184)],e[r(991)],e[r(229)]];continue}break}}}),dx={idb:function(r){let e=S,i={PVEOb:function(a,x,f){return a(x,f)},WNheT:e(321),nmPNX:function(a,x){return a===x},qZfhY:"SoAoA",Cbikb:e(472)};r[e(1208)]=Promise[e(1164)]()[e(1115)](()=>(ux(),ri)).then(function(a){let x=e;if(i[x(1022)](i[x(1371)],i[x(759)])){let f=i[x(588)](_0x36fa86,i.WNheT,{message:_0x3dbb4a[x(1314)],code:_0xa6bcff.OPEN_ERROR,error:_0x5b8f10});this[x(1319)+"hErrorEvent"](f)}else return a})}},ei={};function ve(r){let e=S,i={brHoB:e(1161)+"2",GJPfX:function(h,p){return h!==p}},a=i.brHoB[e(1219)]("|"),x=0;for(;;){switch(a[x++]){case"0":dx[r](u,u[e(1208)],ve);continue;case"1":if(i[e(575)](void 0,f))return f.exports;continue;case"2":return u.exports;case"3":var f=ei[r];continue;case"4":var u=ei[r]={exports:{}};continue}break}}(()=>{let r=S,e={CelYR:function(i,a){return i!==a},dFOMJ:"bDEHH",sAbCC:r(1113)};ve.d=(i,a)=>{let x=r;if(e.CelYR(e[x(1471)],e[x(858)]))for(var f in a)ve.o(a,f)&&!ve.o(i,f)&&Object[x(1148)+x(418)](i,f,{enumerable:!0,get:a[f]});else _0x32b29a=_0x2e86a8[x(936)](_0x4ceb40),_0x2d0dd1=_0x1b801a[x(936)](_0x5503a6[_0x49f822])}})(),(()=>{let r=S;ve.o=(e,i)=>Object.prototype[r(1162)+r(418)][r(480)](e,i)})(),(()=>{let r=S,e={SiPnQ:function(i,a){return i instanceof a},bIgJO:r(851)+r(414),IlHHY:r(851)+"ion/json;charset"+r(1242),lJudG:"none_none",zbcsd:"binary",SmRjm:function(i,a){return i===a},amhYs:r(507),JavoP:function(i,a){return i!=a},GBNxm:r(629)+"d",LGLFu:r(1105)};ve.r=i=>{let a=r;if(e[a(1277)](e[a(824)],e[a(824)]))e[a(127)](e[a(1436)],typeof Symbol)&&Symbol[a(547)+"Tag"]&&Object[a(1148)+"operty"](i,Symbol[a(547)+a(792)],{value:e.LGLFu}),Object[a(1148)+"operty"](i,a(621)+"le",{value:!0});else{let x=e[a(152)](N[a(952)][a(943)+a(534)],_0x26f3b5)?{force:!!N._options[a(943)+a(534)].force,encoding:N._options[a(943)+"ncoding"].encoding?N[a(952)]["payloadE"+a(534)][a(1286)][a(211)](/\s/g,"")[a(395)+a(857)]():""}:{force:!1,encoding:N._options[a(943)+a(534)]?N[a(952)][a(943)+"ncoding"][a(211)](/\s/g,"")["toLowerC"+a(857)]():""},f=_0x499e78[a(943)+"ncoding"]?_0x23addf[a(943)+a(534)].replace(/\s/g,"")[a(395)+"ase"]():"",u=N[a(952)][a(1387)+a(477)]instanceof _0x5a9470?{force:!!N[a(952)][a(1387)+a(477)][a(1240)],type:N._options[a(1387)+a(477)][a(523)]?N[a(952)][a(1387)+a(477)][a(523)].replace(/\s/g,"").toLowerCase():""}:{force:!1,type:N._options[a(1387)+a(477)]?N[a(952)][a(1387)+"ype"][a(211)](/\s/g,"")[a(395)+a(857)]():""},h=_0x56d301[a(1387)+a(477)]?_0x5ec254[a(1387)+"ype"][a(211)](/\s/g,"")[a(395)+a(857)]():"",p=u.force?u[a(523)]:h||u[a(523)],w=x.force?x[a(1286)]:f||x[a(1286)],b=[a(1202)+a(1539)+a(1529),e[a(692)],e[a(593)],"string"],y=[e[a(1061)],e[a(580)]];N[a(952)]["enableTr"+a(732)+a(125)+"ad"]&&b[a(735)](p)&&(!w||y[a(735)](w))?_0x437999[a(842)+a(764)]=_0x1841fb(_0x3a8880.payload,0,_0x361bea.payload[a(742)+"th"]):_0x4a0b25.textPayload=""}}})();var V={};(()=>{let r=S,e={BIUeb:"rWMjK",DRaSW:"yoLSH",yQpru:function(s,t){return s(t)},VPedk:function(s,t){return s+t},RBUkL:function(s,t){return s+t},OkClY:function(s,t){return s*t},DbxwI:function(s,t){return s*t},qkzgO:function(s,t){return s+t},DYuPU:function(s,t){return s(t)},xGUKy:function(s,t,n){return s(t,n)},ouWZu:function(s,t){return s+t},IUunj:function(s,t){return s(t)},GucrI:function(s,t){return s+t},zderO:r(139),ZXXWR:"ffff",zzCxJ:function(s,t){return s===t},dwClC:r(876),xEdSQ:function(s,t){return s(t)},OAcBc:"00000000"+r(1381)+r(1381)+"00000000",eUXJw:function(s,t){return s>t},uiwyX:function(s,t){return s<t},YIusM:function(s,t){return s>t},fwqKB:function(s,t){return s!==t},VjfSp:function(s,t){return s-t},RaxNS:function(s,t){return s!==t},yeHuO:function(s,t){return s<t},ESbun:function(s,t){return s!==t},GyVFl:function(s,t){return s!==t},OGMlM:function(s,t){return s>>>t},mxWNH:function(s,t,n){return s(t,n)},ssIST:function(s,t){return s(t)},OqUvo:function(s,t,n){return s(t,n)},mIOQD:function(s,t){return s&t},bzyJr:r(898)+r(533)+r(916)+r(450),VjbsV:r(629)+"d",INqbi:r(274),noBXT:r(1285),oVOjj:function(s){return s()},ipyCM:function(s,t){return s&t},BUcZO:r(476),iKZaK:r(1537)+r(474)+"s",nNupb:r(1537)+"e_timeout",UqQwO:function(s,t){return s+t},ErFEF:r(930)+"0",qLPbW:r(1146),VWzof:r(1314),BlVrI:function(s,t){return s===t},VtQTm:r(1047),qvBnA:r(166),KMCTy:function(s,t,n){return s(t,n)},ysDrb:function(s,t){return s!==t},gLUDd:function(s,t){return s!==t},OZKIk:function(s,t){return s!==t},LDlqU:function(s,t,n){return s(t,n)},kDNDX:function(s,t,n){return s(t,n)},zhXbK:function(s,t){return s(t)},saxYm:"TChIZ",yLCEK:r(1002),pWlda:function(s,t,n){return s(t,n)},OMouS:function(s){return s()},owZMq:function(s,t,n){return s(t,n)},ZQsSk:function(s,t){return s!==t},PEoao:function(s,t,n){return s(t,n)},dEOkh:function(s,t,n){return s(t,n)},YxEGI:function(s,t,n){return s(t,n)},pglEK:function(s,t,n){return s(t,n)},eSvWe:function(s,t){return s!==t},TIqQY:function(s,t,n){return s(t,n)},fdJyw:function(s,t){return s!==t},tcGkB:r(437),LEtLA:function(s,t,n){return s(t,n)},ABfpT:function(s,t){return s(t)},IndsZ:function(s,t){return s(t)},qdLys:function(s,t){return s<<t},yCHse:r(1335),cMWMS:function(s,t){return s(t)},Dbrom:function(s,t,n){return s(t,n)},JrjzF:function(s,t){return s(t)},SWXCI:function(s,t,n){return s(t,n)},RgmKm:function(s,t){return s(t)},aPgyL:function(s,t,n){return s(t,n)},GLsQQ:function(s,t){return s(t)},QMfSF:function(s,t,n){return s(t,n)},kMBFC:function(s,t){return s(t)},BSJdN:function(s,t,n){return s(t,n)},gpFOb:"Missing "+r(533)+r(916)+"SeqID",bTxyE:r(898)+r(533)+r(916)+r(1543),yUTSx:"Missing "+r(533)+" field: "+r(1287),EhTjy:function(s,t){return s(t)},kuatG:function(s,t,n){return s(t,n)},VkFsZ:function(s,t,n){return s(t,n)},TMwrS:function(s,t){return s+t},DvJaj:function(s,t){return s>>t},BIQTW:function(s,t){return s>t},HmZRp:"Skip pas"+r(415),AMiRs:function(s,t){return s>t},cMaTv:function(s,t){return s*t},Nzbwx:function(s,t){return s>t},dluyS:function(s,t){return s+t},lMHJL:r(763)+"t limit",XfTJd:function(s,t,n){return s(t,n)},lHAKZ:function(s,t,n){return s(t,n)},GlYPz:function(s,t){return s||t},hUyyH:function(s,t,n){return s(t,n)},caedu:function(s,t){return s===t},zcbLN:r(1472),hywsN:function(s,t){return s+t},YoDUu:function(s,t){return s(t)},FZMva:function(s,t){return s+t},UWbIM:function(s,t){return s+t},Fxguv:function(s,t){return s+t},seVVP:function(s,t){return s&t},RtjaQ:function(s,t){return s<t},wsuiX:function(s,t){return s&t},EwCkJ:function(s,t){return s>=t},jPyPL:"BvLKH",aMuLz:function(s,t){return s+t},fnOSJ:function(s,t){return s+t},LsBZH:function(s,t){return s+t},CumoR:function(s,t){return s&t},XpnfH:function(s,t){return s|t},ndGmN:function(s,t){return s<<t},OKMze:function(s,t){return s|t},gbnXo:function(s,t){return s<<t},JHrJN:function(s,t){return s&t},sHHbM:function(s,t){return s(t)},crQIo:function(s,t){return s==t},NWZuI:function(s,t){return s+t},YpRPL:function(s,t){return s+t},RiTYS:function(s,t){return s+t},IqOXF:function(s,t){return s<<t},FEJuj:function(s,t){return s<<t},OjOYt:function(s,t){return s===t},HjIWC:r(1272),XJPSj:r(1070),DsfpX:function(s,t){return s|t},ArXDf:function(s,t){return s|t},FJHvC:function(s,t){return s<<t},lLIHJ:function(s,t){return s&t},yoSIw:function(s,t,n){return s(t,n)},zxcdV:function(s,t){return s>>t},PtcIb:function(s,t){return s&t},uGcnl:function(s,t,n){return s(t,n)},eDIUX:"jHNgW",ZuZmr:"NYqVN",VLwbr:function(s,t){return s<=t},zfAvM:function(s,t){return s+t},rPnzD:function(s,t){return s<<t},KJjOs:function(s,t,n){return s(t,n)},VhBNF:function(s,t){return s<t},HABPB:function(s,t){return s<t},oMHIy:function(s,t){return s+t},ebItu:function(s,t){return s-t},ffmOY:function(s,t){return s+t},cjYaz:function(s,t){return s<<t},kePee:r(1394),kHIRo:function(s,t){return s&t},uOLNd:function(s,t){return s>>t},xijRN:function(s,t){return s<t},hkkJP:function(s,t){return s&t},DHXtF:function(s,t){return s>>t},rMEMN:function(s,t){return s&t},vCrfs:function(s,t){return s>>t},XJVLG:function(s,t){return s|t},UQNUK:function(s,t){return s>>t},IPtjM:function(s,t){return s|t},MmTiq:function(s,t){return s<t},AGKgZ:function(s,t){return s+t},GAIGv:function(s,t){return s(t)},wztkY:function(s,t){return s<t},tvQfl:function(s,t){return s<<t},XtGgR:function(s,t){return s|t},LGzZF:function(s,t){return s&t},scLnE:"timeout,"+r(281)+r(379)+"g",ktpdF:r(321),aeivL:r(241),QygbB:function(s,t){return s&t},mPwKk:function(s,t){return s&t},QPATj:r(1316),ggQHN:r(1449),NdxmM:function(s,t){return s&t},tVeaE:function(s,t){return s&t},xlwrd:function(s,t){return s<<t},JgIfi:function(s,t){return s&t},oPRhS:function(s,t){return s&t},QjLqu:function(s,t){return s(t)},NLFqC:function(s,t){return s&t},MxekY:function(s,t){return s===t},NmOPM:r(162),DTowV:function(s,t){return s&t},uGknd:function(s,t){return s&t},Hjnsv:function(s,t){return s!==t},DAwLu:r(1299),tFBYn:function(s,t){return s<<t},snhjd:function(s,t){return s&t},YTork:function(s,t){return s|t},rUmbC:function(s,t){return s>>>t},KYxSl:function(s,t){return s<<t},kHGhD:function(s,t){return s>>>t},VDzsl:function(s,t){return s<<t},WhAWP:function(s,t){return s===t},Avidk:function(s,t){return s<t},XSfjf:function(s,t){return s<t},BYJcm:function(s,t){return s&t},tiSWo:function(s,t){return s>>>t},UbVCo:function(s,t){return s+t},qEQrW:function(s,t){return s&t},CwwyY:function(s,t){return s!==t},mFFoi:function(s,t){return s+t},goosB:function(s,t){return s|t},BDoNX:function(s,t){return s>>>t},vIyox:function(s,t){return s|t},lHzcw:function(s,t){return s&t},qHgFI:function(s,t){return s!==t},rkRDK:function(s,t){return s>>>t},YxPLU:function(s,t){return s+t},evZqX:function(s,t){return s|t},wzTpY:function(s,t){return s>>>t},aVcCO:function(s,t){return s>>>t},puGzy:function(s,t){return s(t)},JqQHL:r(216),eIhPw:r(341),JtZCT:r(722),pvBxX:function(s,t){return s|t},aRqpN:function(s,t){return s|t},YAkak:function(s,t){return s|t},VVyoU:function(s,t){return s<<t},vfDDo:function(s,t){return s<<t},gotGm:function(s,t){return s|t},CPAZQ:function(s,t){return s<<t},bwanJ:function(s,t){return s<<t},vBTGG:function(s,t){return s|t},VDaVW:function(s,t){return s<<t},jIzsK:function(s,t){return s<<t},XYmut:"KXOVS",hXIPz:r(819),dMZMr:function(s,t){return s===t},oZMTU:function(s,t){return s|t},DtsjM:function(s,t){return s<<t},PWtKx:function(s,t){return s|t},tsscV:function(s,t){return s<<t},HsZtL:function(s,t){return s<<t},rzwPJ:function(s,t){return s<<t},hKCdk:function(s,t){return s&t},lQrqb:function(s,t){return s&t},cqWxh:function(s,t){return s>>>t},SFVIn:function(s,t){return s>>>t},nAmlR:function(s,t){return s>>>t},iBZmC:function(s,t){return s&t},lWWxn:function(s,t){return s>>>t},UBgkF:function(s,t){return s>>>t},fyfOU:function(s,t){return s(t)},pDSDT:r(214),pAnVw:"kCyjp",EsGwf:function(s,t){return s<=t},CDrNS:function(s,t){return s>=t},Qytvk:function(s,t){return s|t},yVlkY:function(s,t){return s%t},cYzWO:function(s,t){return s|t},OVMOV:function(s,t){return s/t},KwcSn:function(s,t){return s+t},YNTFa:function(s,t){return s>>>t},KeedC:function(s,t){return s*t},OqVOQ:function(s,t){return s===t},sGAxq:"BRdgA",MUBEf:r(1406),lwiyw:function(s,t){return s>>>t},JnmPO:function(s,t){return s|t},vhcLU:"auGCr",kuwRm:"BgMGs",fTRBP:function(s,t){return s===t},nsVEu:function(s,t){return s>>>t},WKmqG:function(s,t){return s===t},gYDpZ:function(s,t){return s===t},fsEFz:function(s,t){return s===t},DirsM:function(s,t,n,o){return s(t,n,o)},NHbli:"dsIry",ZsWmF:function(s,t){return s*t},MjNTU:r(656),cNfIA:function(s,t){return s&t},vQPdG:function(s,t){return s>>>t},VSZsP:function(s,t){return s>>>t},Imxhj:function(s,t){return s&t},mncMr:function(s,t){return s>>>t},ulThX:function(s,t){return s&t},HqzYn:function(s,t){return s>>>t},vmmTy:function(s,t){return s>>>t},EOtkR:function(s,t){return s&t},CLmre:function(s,t){return s>>>t},KDQWP:function(s,t){return s&t},NQQUq:function(s,t){return s>>>t},bNkRS:function(s,t){return s&t},nNmHo:function(s,t){return s>>>t},pScvd:function(s,t){return s&t},kDoHB:r(1006)+"2|4",faoPZ:"CONNECTING_ERROR",rtkmp:r(339)+"OR",bnaSD:r(1229)+r(955),UGeMR:r(1267)+r(1445)+"R",voWYe:r(1151)+"2|3|6",WFyJj:"TjwOk",FAGZb:r(999),vHCUj:function(s,t){return s>=t},QKsgB:function(s,t){return s==t},liaGy:"UZzSz",PXxae:function(s,t){return s===t},OANGb:r(404),CUBwU:function(s,t){return s instanceof t},jgrJq:function(s,t){return s+t},iiXfR:function(s,t){return s+t},rTbWn:function(s,t){return s===t},CdmGM:function(s,t){return s+t},TWyky:function(s,t){return s+t},JGScu:function(s,t){return s+t},OKErS:function(s,t){return s!==t},UMbWD:function(s,t){return s<<t},qJWSb:function(s,t){return s&t},tJtPX:function(s,t){return s<t},bCfdu:r(1447),JtspS:r(403),FwRHl:"sent",YmZLC:function(s,t){return s!==t},dXwpj:r(267),WpHXR:r(168)+r(823),jvARV:function(s,t,n){return s(t,n)},pnKfr:function(s,t){return s===t},BWZAq:r(1384),YTtcf:function(s,t){return s!==t},LOYmQ:r(1225),UIVME:function(s,t){return s+t},tKGhO:function(s,t){return s===t},iVqWQ:function(s,t){return s!=t},BHPaX:r(1307)+"0",qZBjs:function(s,t){return s+t},BiKgR:function(s,t){return s(t)},iRocK:function(s,t){return s!==t},uebUy:r(1470)+r(895)+"ing",djdnB:function(s,t){return s===t},JVDUZ:"CvdXJ",IWraN:function(s,t){return s<=t},dHZqr:"next() c"+r(567)+r(903)+"imes in "+r(199),OIYEt:function(s,t){return s===t},txYfo:function(s,t){return s+t},wczGG:r(1479),wciMx:function(s,t){return s(t)},CmIwa:function(s,t){return s===t},SSPrv:r(373),DWsFs:function(s,t){return s<t},tXRXD:function(s,t){return s<t},fKojO:function(s,t){return s===t},uWDJz:function(s,t){return s===t},lKyCP:function(s,t){return s&t},kzHrQ:function(s,t){return s<t},vaYWQ:function(s,t){return s|t},Mjdtw:function(s,t){return s<<t},GnICh:function(s,t){return s|t},pmfSQ:function(s,t){return s&t},zpOLd:function(s,t){return s<<t},RjAJV:function(s,t){return s&t},bvtMm:function(s,t){return s<<t},SAAiO:function(s,t){return s&t},cyKoK:function(s,t){return s+t},VKFbe:function(s,t){return s>t},iZYbo:function(s,t){return s<t},fqAij:r(376),koGUo:function(s,t){return s|t},lgQqM:function(s,t){return s===t},ASYwH:function(s,t){return s+t},hmRJt:r(1228)+r(252),QaFIK:function(s,t){return s|t},jZewi:function(s,t){return s&t},eDifi:function(s,t){return s|t},wdGCE:function(s,t){return s&t},SGurF:function(s,t){return s&t},cTJGC:function(s,t){return s|t},MXOsV:function(s,t){return s-t},LPMIl:r(668),ctljT:function(s,t,n,o){return s(t,n,o)},rYmRL:r(259),DafqC:function(s,t){return s!=t},TaHAR:r(851)+"ion/json",qeiWG:function(s,t){return s==t},HeVjv:r(1202)+r(1539)+"et=utf-8",hsLJx:r(584),XGHfV:r(122),qxLJG:r(346),pdahe:r(622),eXLLe:r(678),KnCRB:function(s,t){return s(t)},epJpp:r(238)+r(786),zweDJ:r(1385),EiDsL:function(s,t){return s+t},IDbsR:r(272),mFPtH:function(s,t){return s+t},ZVGKx:function(s,t){return s!==t},lFQSR:function(s,t){return s|t},pfJwm:function(s,t){return s<<t},zvWPX:function(s,t){return s|t},fcOAc:function(s,t){return s<<t},aGzbT:function(s,t){return s&t},QgTbW:function(s,t){return s&t},JSHAD:function(s,t){return s&t},NbMro:function(s,t){return s<t},Wyqcw:function(s,t){return s!==t},GctGC:r(1352),tSLOt:function(s,t){return s!==t},pzfHa:"uBpzz",mbdSa:r(644),lwJFQ:r(776),KEDrC:r(871),gRMju:function(s,t){return s(t)},qTfvl:function(s,t){return s!==t},KNlwn:r(297),CJeBF:function(s,t){return s||t},weGvL:function(s,t){return s||t},FiZNU:function(s,t){return s||t},ZZkBi:function(s,t){return s===t},NOZKP:r(595),VTnkO:function(s,t){return s||t},ogVtQ:function(s,t){return s===t},YbbER:"TxXeE",MFnxM:function(s,t){return s!==t},qfjBn:"zxVqZ",SVuRj:function(s,t){return s!==t},IKfHs:"nIEEb",AADvZ:r(552),YSAWF:function(s,t){return s||t},uVaIj:function(s,t){return s||t},LnTCZ:function(s,t){return s||t},HwwIc:function(s,t){return s!=t},cUAgi:"init QoSDB failed",AVeQB:r(212),DKIHX:function(s,t){return s!==t},ttzMl:r(1501),KaIfh:function(s,t,n){return s(t,n)},BagOO:r(1527),BEOzq:function(s,t){return s===t},jExGi:r(306),JpaoQ:r(248),EGppy:function(s,t){return s instanceof t},PTazI:r(224)+r(170),YmCbp:function(s,t){return s+t},sNvWa:r(1063),OehOh:"cXRbe",rGIxB:function(s,t){return s(t)},vwskh:function(s,t,n,o){return s(t,n,o)},pwhFN:r(347)+"er_qos",dEnqL:function(s,t,n,o){return s(t,n,o)},kNsBw:function(s,t,n,o){return s(t,n,o)},LgTmB:r(347)+r(754)+"k",kfKYg:function(s,t,n){return s(t,n)},dtUQb:r(347)+"er_ack_m"+r(283),uQwyd:function(s,t){return s!==t},dUptJ:r(145),eiGBB:r(205),JeZgz:r(712),xwxUf:function(s,t){return s&&t},BvZeO:"ack_id",WrCwQ:r(592),Ndknb:function(s){return s()},upAvJ:r(171),MaNVC:function(s){return s()},YmqoL:r(960),mnaFp:function(s,t){return s(t)},YfdIl:function(s,t){return s instanceof t},CWOfJ:r(666)+"e",tszou:function(s,t,n,o){return s(t,n,o)},yvpdP:function(s,t){return s!==t},gaiMj:r(544),AlJsI:function(s){return s()},GnNZl:function(s,t){return s+t},GluWf:" + ",EuOGJ:r(968),mhuyD:function(s,t){return s>t},mscLe:r(620)+"too large",jpMxS:function(s,t){return s+t},FkgOk:function(s,t){return s<t},fNfGz:function(s,t){return s>>>t},xjUtl:function(s,t){return s+t},lVSyo:function(s,t){return s|t},xIdKk:function(s,t){return s<<t},ucDsX:function(s,t){return s+t},oQjpc:function(s,t){return s|t},PoWfG:function(s,t){return s|t},dWqku:function(s,t){return s|t},UyPUM:function(s,t){return s<<t},vodDx:function(s,t){return s<<t},UxzoR:function(s,t){return s+t},tVLKw:function(s,t){return s+t},NZBXx:function(s,t){return s>>>t},SWXvX:function(s,t){return s&t},jiapB:function(s,t){return s>>>t},tGdyd:function(s,t){return s>>>t},ftcsJ:function(s,t){return s+t},Dinnl:function(s,t){return s>>>t},AdQHB:function(s,t){return s+t},sXCQu:function(s,t){return s&t},dynLH:function(s,t){return s+t},PGIcp:function(s,t){return s+t},kDOhS:r(1283)+"9|7|2|3|11|10|1|6",rPytJ:function(s,t){return s&t},qEAXu:function(s,t){return s>t},SoOzC:function(s,t,n,o){return s(t,n,o)},imXmw:function(s,t){return s>>>t},WzlqU:function(s,t){return s|t},aOpgp:function(s,t){return s<<t},fDvMq:function(s,t){return s<t},uiDnK:function(s,t){return s|t},feBRd:function(s,t){return s<t},GANuV:function(s,t){return s|t},rNMuy:function(s,t){return s<<t},fTrNi:function(s,t){return s|t},aTTrb:function(s,t){return s<<t},ILhdW:function(s,t){return s&t},QWIdG:function(s,t){return s<t},oLXMv:function(s,t){return s|t},rJGLe:function(s,t){return s(t)},ktGKo:r(1276)+r(1306),TdqQN:"header",jnXAc:r(1543),cNLmM:function(s,t,n,o){return s(t,n,o)},wgaTz:r(703)+r(1101),KcAiu:function(s,t){return s<t},rGyiJ:function(s,t,n){return s(t,n)},Xkpka:function(s,t,n,o){return s(t,n,o)},TJdtG:r(1223)+r(721),dtkOY:r(528)+"ame",rKuCN:r(1392),MfWmV:r(442),lrweJ:r(133),HrvXu:r(394),dfeWh:r(896)+"r",qRVRx:r(381),lkldc:r(881),EVBzl:r(1126)+r(1216)+"ce not i"+r(1234)+"ed",iFdac:r(1126)+r(295)+r(1567),UQBwp:function(s,t){return s<t},eYJPZ:function(s,t){return s+t},hZhpE:function(s,t){return s===t},RdoLs:r(355),VCvPR:function(s,t,n){return s(t,n)},IFWqV:function(s,t,n){return s(t,n)},bCvTd:function(s,t,n,o){return s(t,n,o)},yKKss:r(603),JyxzF:function(s,t,n){return s(t,n)},yWcRR:"x_fronti"+r(1416),laOCa:function(s,t){return s(t)},bTRhM:r(347)+r(1463),PCsHX:function(s,t,n,o){return s(t,n,o)},AuKWD:"x-msg-qos",RCBAs:function(s,t,n){return s(t,n)},QytJZ:"x-msg-cu"+r(565)+"e",fOGVx:r(1295)+r(1035)+"ue",FeWDR:r(1005),yqlow:r(337),EWTAh:function(s){return s()},AVvRS:function(s,t){return s===t},WcUyd:function(s,t){return s===t},UjdPQ:function(s,t,n){return s(t,n)},uEsuo:function(s,t){return s(t)},XCnRN:function(s){return s()},GgELI:function(s,t){return s<t},wFgTL:function(s,t){return s!==t},ovbZO:function(s){return s()},fFShz:function(s,t,n,o){return s(t,n,o)},eIVEf:r(933),sjZTb:"gJHZK",snvod:r(483),bErmC:function(s,t,n){return s(t,n)},WMWJE:function(s,t){return s!==t},hkIDh:r(331),pyHdX:function(s,t){return s===t},artSr:function(s,t){return s===t},SwNin:r(516),isLlA:function(s,t,n){return s(t,n)},wcLhk:function(s,t,n,o){return s(t,n,o)},UjoTa:r(717)+r(1196),xByRj:r(980),yIUaL:"auto",dYiZP:"please provide v"+r(493),YwdyF:function(s,t){return s(t)},NEkhN:r(1230),ormYs:"stop imm"+r(247)+r(924)+"ct",QYtdJ:r(826),akHyA:r(640),tfoeT:function(s,t){return s||t},hwtBB:r(303),ZBWiE:"urliU",eAVhy:r(264),hCAsZ:function(s,t){return s!==t},MxvZK:r(564),eArHN:"bd_did",DmYjw:r(190),NdiNA:"device_id",mKLww:r(1297)+r(202)+r(1426)+r(841)+r(740),IwgWS:r(766),ApGZk:function(s,t,n){return s(t,n)},npqLi:r(1526)+"0",fBRTP:function(s,t){return s<t},JpTqa:function(s,t){return s&t},QdYFf:function(s,t,n){return s(t,n)},VQhGy:function(s,t){return s||t},oBXox:function(s,t,n){return s(t,n)},QJDCy:r(225)+"t",NLcxh:"start",pAAol:r(288),BdEVt:function(s,t){return s(t)},DbyXO:"FRONTIER>",rqRGg:function(s,t){return s*t},vLVFq:function(s,t){return s-t},DzUoL:function(s,t){return s===t},OuHnZ:function(s,t){return s!==t},nqIBZ:r(966)+r(664)+"reconnecting ser"+r(804),PJtRQ:function(s,t,n){return s(t,n)},SMVNq:function(s,t){return s(t)},sLDsl:r(889)+"3",GcewK:r(818)+"0",TCiYW:function(s,t){return s!==t},UBPyL:function(s,t){return s===t},lnlIm:function(s,t){return s===t},VaYat:function(s,t){return s!==t},WHnwv:r(326),AWSOH:"ack",GZzCF:function(s,t){return s===t},FtYOn:r(1396),ZivHY:"xZHsT",oPAen:function(s,t,n,o,c){return s(t,n,o,c)},JJqHZ:function(s,t){return s(t)},AAfeS:r(1274),auOwU:r(1545)+r(1361),wvmQg:function(s,t){return s===t},XlDUs:function(s,t){return s===t},nJYKv:r(1297)+r(1110)+r(435)+r(1125)+r(1241)+r(1413)+r(572)+" arraybu"+r(1067),TEOKO:r(1279),FCUmJ:function(s,t){return s(t)},MwLqq:function(s,t){return s||t},ikfwX:r(1297)+r(1110)+r(276)+r(1306),QWdPR:function(s,t){return s(t)},ooAnT:function(s,t){return s===t},LxoHZ:r(1028),GHROH:r(1200),jynSk:r(846),qyEeo:function(s,t){return s!==t},cCpqm:r(979),vkzdu:"MfcSG",wydLk:function(s,t){return s||t},BUoqJ:"4|1|3|0|2",EmTVe:function(s,t){return s(t)},WiLgO:"\0\0\0\0\0\0\0\0",REBXp:function(s,t){return s*t},jABKv:function(s,t){return s===t},PXTZh:r(173),DfQxl:function(s,t){return s!=t},KmBKZ:function(s,t){return s!=t},ujwOA:r(834),NyFAj:function(s,t){return s===t},LxTfx:"Dedicate"+r(285)+"lobalScope",sPRCm:function(s,t){return s===t},kGBpB:function(s,t){return s==t},TCDcr:function(s,t){return s!=t},mFyKq:function(s,t){return s!=t},PscMK:function(s,t){return s!=t},nLota:function(s,t){return s===t},nXMQF:function(s,t){return s===t},yMMsk:"ServiceWorkerGlobalScope",ObopK:function(s,t){return s===t},wAWrO:function(s,t){return s!=t},BAxLR:function(s,t){return s===t},ahwxq:r(992)+"qos__"};ve.r(V),ve.d(V,{FWS:()=>I0,CustomErrorEvent:()=>ns,createCloseEvent:()=>pe,ReconnectEvent:()=>ts,createErrorEvent:()=>ue,decodedFrame:()=>Xr,createOpenEvent:()=>xs,CustomCloseEvent:()=>rs,createReconnectEvent:()=>Jn,FrontierMessageEvent:()=>is,encodeFrame:()=>Gn,createMessageEvent:()=>as,OpenEvent:()=>os,ErrorCode:()=>qe,Event:()=>it,MessageEvent:()=>ss});let i="";function a(s=""){let t=r;if(e[t(1076)]!==e[t(1259)]){let o=""+Date[t(604)](),c=i||(i=e[t(1450)](p,s)),l=Math[t(325)]()[t(547)](16)[t(369)](-6);return e[t(1359)](e[t(1590)](e.RBUkL("02",o),c),l)}else return this[t(1260)]?.[t(1001)]}function x(){let s=r;return e[s(1590)](e[s(367)](1e4,Date[s(604)]()),Math[s(1104)](e[s(1308)](1e4,Math[s(325)]())))}function f(s){let t=r;return e[t(1004)](e[t(1496)](Array,8)[t(1505)]("0"),e.xGUKy(parseInt,s,10)[t(547)](2))[t(369)](-8)}function u(s){let t=r;return e[t(696)](e[t(1066)](Array,4)[t(1505)]("0"),e[t(684)](parseInt,s,2)[t(547)](16))[t(369)](-4)}function h(s){let t=r,n=s[t(1219)](/\./)[t(698)](l=>f(l)),o=[];return o[0]=e[t(1496)](u,e[t(894)](n[0],n[1])),o[1]=e[t(1066)](u,e[t(1590)](n[2],n[3])),[t(139),e.zderO,e[t(631)],t(139),e.zderO,e[t(235)],o[0],o[1]][t(1505)]("")}function p(s){let t=r;if(e[t(263)](e[t(669)],e[t(669)])){let n=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[t(1215)](s),o=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[t(1215)](s);return n?e[t(313)](h,s):o?e[t(1066)](w,s):e[t(138)]}else this[t(523)]=_0x3a4c25,this[t(937)]=null}function w(s){let t=r,n="",o=[],c=0,l=0,m=!0,g=e.zderO;if(e[t(1508)](s[t(1068)]("::"),-1)){let d=s.split("::");for(let v=0;e[t(1593)](v,d[t(1156)]);v++){let C=d[v];if(e[t(1247)](C[t(1068)](":"),0)){let k=C[t(1219)](":");m&&(c=k[t(1156)]),l+=k[t(1156)];for(let R=0;e[t(1593)](R,k.length);R++)if(e[t(1249)](4,k[R].length)){let B=g[t(1451)+"g"](0,e[t(652)](4,k[R][t(1156)])),Y=B[t(936)](k[R]);o[t(157)](Y)}else o.push(k[R]);m=!1}else{if(e[t(161)](4,C[t(1156)])){let k=g[t(1451)+"g"](0,e.VjfSp(4,C.length)),R=k[t(936)](C);o[t(157)](R)}else o[t(157)](C);m&&(c+=1),l+=1,m=!1}}let _="";for(let v=0;e[t(1593)](v,e[t(652)](8,l));v++)_=_[t(936)](g);for(let v=0;e[t(144)](v,o[t(1156)]);v++)e.zzCxJ(v,c)?(n=n[t(936)](_),n=n.concat(o[v])):n=n[t(936)](o[v]);return n}{let d=s[t(1219)](":");for(let _=0;e.yeHuO(_,d.length);_++){let v=d[_];if(e.ESbun(4,d[_][t(1156)])){let C=g[t(1451)+"g"](0,e[t(652)](4,d[_][t(1156)])),k=C[t(936)](v);n=n.concat(k)}else n=n[t(936)](v)}return n}}function b(s,t){let n=r,o=s.key;e.RaxNS(void 0,o)&&(Q(t,10),e[n(684)](De,t,o));let c=s[n(450)];e[n(354)](void 0,c)&&(e[n(684)](Q,t,18),De(t,c))}function y(s){let t=r,n={};e:for(;!e[t(313)](ye,s);){let o=e[t(1496)](ne,s);switch(e[t(511)](o,3)){case 0:break e;case 1:n.key=e[t(610)](Ae,s,e.IUunj(ne,s));break;case 2:n.value=e[t(610)](Ae,s,e[t(178)](ne,s));break;default:e.OqUvo(ie,s,e[t(1112)](7,o))}}if(e[t(263)](void 0,n[t(226)]))throw new Error(t(898)+t(533)+t(916)+t(226));if(n[t(450)]===void 0)throw new Error(e[t(737)]);return n}function E(s){let t=r,n={fuyVj:e[t(1233)]};if(e[t(315)]!==e[t(323)]){let o=e.oVOjj(z);return P(s,o),e.yQpru(Me,o)}else{let o={pfaru:function(c,l){return c!=l},Vbjry:vkRXmW[t(150)]};_0x57501d.r=c=>{let l=t;o[l(1453)](o[l(883)],typeof _0x3905c9)&&_0x322aa6[l(547)+l(792)]&&_0x83a640["definePr"+l(418)](c,_0x5bae0c[l(547)+l(792)],{value:l(1105)}),_0x14f335["definePr"+l(418)](c,"__esModule",{value:!0})}}}function P(s,t){let n=r,o={TzLxG:function(c,l){return e.ipyCM(c,l)},NLHBn:function(c,l){return e[O(511)](c,l)},pvSzw:function(c,l){return e[O(1315)](c,l)},jsokN:function(c,l){return e[O(511)](c,l)},GcJJw:function(c,l){return c>>>l},xzjjH:function(c,l){return e[O(511)](c,l)},fFojl:e.BUcZO,BqNNj:function(c,l){return e[O(178)](c,l)},lzPWP:n(516),SyYPf:e[n(1583)],MqbGd:e[n(1323)],gePFT:function(c,l){return e[n(1247)](c,l)},ovDiX:function(c,l){return e[n(1189)](c,l)},cbwBZ:n(763)+n(415),lRFsm:function(c,l,m){return c(l,m)},AUGXW:function(c,l,m){return e[n(1036)](c,l,m)},vpnmi:e.ErFEF,KbQRZ:e[n(820)],lquot:e.VWzof};if(e.BlVrI(e[n(801)],e[n(724)]))return _0x5c8c04[n(1337)+"Code"](o.TzLxG(255,this.low),o[n(541)](o[n(1281)](this[n(1424)],8),255),o[n(908)](o.NLHBn(this[n(1424)],16),255),o[n(1296)](this.low,24),255&this[n(1023)],o[n(908)](o.GcJJw(this[n(1023)],8),255),o[n(908)](o[n(779)](this.high,16),255),this[n(1023)]>>>24);{let c=s[n(336)];e[n(1249)](void 0,c)&&(Q(t,8),e[n(877)](bt,t,c));let l=s[n(164)];if(e.RaxNS(void 0,l))if(e.ysDrb(n(1428),n(1428))){let me=this[n(642)+n(1347)]?.[n(1100)+n(1059)+"nt"](),X=this[n(952)][n(225)+n(319)+n(1201)](_0x535f02[n(603)],_0x4f607f.reason);this[n(1319)+n(899)+"ent"](_0x145390(o.fFojl,{code:1006,reason:_0x122081.reason||n(153)+n(1237)+n(1581)+n(922)+n(352)+n(1273)+me,willReconnect:X})),X&&this[n(920)]();return}else Q(t,16),e.OqUvo(bt,t,l);let m=s[n(1543)];e[n(236)](void 0,m)&&(n(1549)!==n(655)?(e[n(610)](Q,t,24),bt(t,e[n(178)](xe,m))):(o[n(427)](_0x4d5c82,o[n(1203)]),this.off(o[n(859)],_0x4a47e5),this.off(o[n(201)],_0x2505d3)));let g=s.method;e[n(172)](void 0,g)&&(e[n(1012)](Q,t,32),e[n(856)](bt,t,e.zhXbK(xe,g)));let d=s[n(1437)];if(d!==void 0)for(let me of d)if(e[n(263)](e[n(545)],e[n(667)])){let X=_0x432675[n(142)];if(o.gePFT(o[n(149)](X,_0x10cbce),_0x55dc90.limit))throw new _0x13c08a(o[n(1154)]);return _0x28df3a[n(142)]+=_0x29aa8d,X}else{e[n(990)](Q,t,42);let X=e[n(807)](z);e[n(1547)](b,me,X),Q(t,X[n(342)]),e[n(1547)](ke,t,X),e.DYuPU(G,X)}let _=s[n(943)+n(534)];e[n(1095)](void 0,_)&&(e[n(641)](Q,t,50),e[n(462)](De,t,_));let v=s[n(1387)+n(477)];e.OZKIk(void 0,v)&&(e.YxEGI(Q,t,58),e[n(990)](De,t,v));let C=s[n(720)];e[n(1249)](void 0,C)&&(e[n(877)](Q,t,66),e[n(973)](Q,t,C[n(1156)]),e[n(340)](zt,t,C));let k=s[n(800)];e[n(1398)](void 0,k)&&(Q(t,74),e[n(1577)](De,t,k));let R=s[n(391)+n(1430)];e[n(161)](void 0,R)&&(e.fdJyw(e.tcGkB,n(997))?(Q(t,82),e[n(684)](De,t,R)):(o[n(600)](_0x4630fc,_0x184c7a,16),o.AUGXW(_0x109670,_0x18fe99,_0xe08710)));let B=s[n(989)];B!==void 0&&(e[n(684)](Q,t,90),e[n(1547)](De,t,B));let Y=s[n(822)+"e"];if(e.GyVFl(void 0,Y))if(e[n(291)](n(271),"mChFi"))e[n(610)](Q,t,96),e.LEtLA(bt,t,e.DYuPU(xe,Y));else{let me=o[n(747)][n(1219)]("|"),X=0;for(;;){switch(me[X++]){case"0":this._ws[n(727)+n(1499)]("error",this[n(430)]);continue;case"1":this._ws[n(727)+n(1499)](o.KbQRZ,this[n(1495)]);continue;case"2":this[n(1193)][n(727)+n(1499)](n(476),this[n(1524)]);continue;case"3":if(!this._ws)return;continue;case"4":this[n(1193)]["addEvent"+n(1499)](o[n(1414)],this[n(751)+"ge"]);continue}break}}}}function I(s){let t=r;return e[t(976)](L,e[t(1450)](Ee,s))}function L(s){let t=r;if(e[t(236)](t(1335),e.yCHse))_0x49f1ff=e.IndsZ(_0x40b746,_0x1ecb03),_0x454609|=e[t(849)](127&_0x260b0e,7);else{let n={};e:for(;!e[t(1066)](ye,s);){let o=e[t(177)](ne,s);switch(o>>>3){case 0:break e;case 1:n[t(336)]=e[t(934)](Yr,s,!0);break;case 2:n[t(164)]=e.PEoao(Yr,s,!0);break;case 3:n[t(1543)]=e[t(1450)](ne,s);break;case 4:n.method=ne(s);break;case 5:{let c=e[t(625)](j,s);(n[t(1437)]||(n.headers=[])).push(e[t(1450)](y,s)),s[t(342)]=c;break}case 6:n[t(943)+t(534)]=e[t(512)](Ae,s,e[t(1344)](ne,s));break;case 7:n[t(1387)+"ype"]=Ae(s,e[t(625)](ne,s));break;case 8:n[t(720)]=e.aPgyL(Mt,s,e.IUunj(ne,s));break;case 9:n[t(800)]=e[t(1012)](Ae,s,e.GLsQQ(ne,s));break;case 10:n.serverTiming=e.QMfSF(Ae,s,e.kMBFC(ne,s));break;case 11:n[t(989)]=e[t(1431)](Ae,s,e[t(313)](ne,s));break;case 12:n[t(822)+"e"]=ne(s);break;default:e[t(973)](ie,s,e.mIOQD(7,o))}}if(n[t(336)]===void 0)throw new Error(e[t(163)]);if(n.LogID===void 0)throw new Error("Missing required"+t(916)+t(164));if(e[t(263)](void 0,n[t(1543)]))throw new Error(e[t(1292)]);if(e[t(291)](void 0,n[t(1287)]))throw new Error(e.yUTSx);return n}}function j(s){let t=r,n=e[t(1261)](ne,s),o=s.limit;return s[t(342)]=e[t(1590)](s[t(142)],n),o}function ie(s,t){let n=r;switch(t){case 0:for(;e[n(1112)](128,e[n(399)](te,s)););break;case 2:e.xGUKy(_e,s,e.RgmKm(ne,s));break;case 5:e[n(1389)](_e,s,4);break;case 1:e[n(1442)](_e,s,8);break;default:throw new Error(e.TMwrS(n(1120)+n(1459)+"pe: ",t))}}function xe(s){let t=r;return s|=0,{low:s,high:e[t(440)](s,31),unsigned:s>=0}}let D=[];function z(){let s=r,t=D[s(1026)]();return t?(t[s(142)]=t[s(342)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function G(s){D.push(s)}function Ee(s){return{bytes:s,offset:0,limit:s[r(1156)]}}function Me(s){let t=r,n=s[t(987)],o=s[t(342)];return e[t(263)](n[t(1156)],o)?n:n.subarray(0,o)}function _e(s,t){let n=r;if(e[n(383)](s[n(142)]+t,s[n(342)]))throw new Error(e[n(299)]);s[n(142)]+=t}function ye(s){let t=r;return s[t(142)]>=s[t(342)]}function ge(s,t){let n=r,o=s[n(987)],c=s[n(142)],l=s.limit,m=e[n(1189)](c,t);if(e[n(233)](m,o.length)){let g=new Uint8Array(e.cMaTv(2,m));g[n(1474)](o),s[n(987)]=g}return s[n(142)]=m,m>l&&(s[n(342)]=m),c}function rt(s,t){let n=r,o=s[n(142)];if(e[n(672)](e.dluyS(o,t),s[n(342)]))throw new Error(e[n(1040)]);return s[n(142)]+=t,o}function Mt(s,t){let n=r,o=e[n(671)](rt,s,t);return s.bytes.subarray(o,o+t)}function zt(s,t){let n=r,o=e[n(882)](ge,s,t[n(1156)]);s[n(987)].set(t,o)}function Ae(s,t){let n=r,o={WdKPQ:function(_,v){return e[O(1096)](_,v)},NgTon:function(_,v,C){return e.SWXCI(_,v,C)},sdrcT:function(_){return e.oVOjj(_)},LhRkV:function(_,v,C){return _(v,C)},rxwXl:function(_,v,C){return e[O(119)](_,v,C)},wNqlP:function(_,v){return e.EhTjy(_,v)}},c=rt(s,t),l=String[n(1337)+n(261)],m=s[n(987)],g="\uFFFD",d="";for(let _=0;_<t;_++)if(e[n(282)](n(1271),e.zcbLN)){let v=this[n(1260)][n(1458)](this[n(854)]),C=_0x168992[n(677)](o[n(865)](v,"{}"));return _0x3db1d1[n(1311)](C)}else{let v=m[e.hywsN(_,c)],C,k,R,B;if(e.caedu(128&v,0))d+=e[n(1220)](l,v);else if(e[n(291)](e[n(1315)](224,v),192))e.FZMva(_,1)>=t?d+=g:(C=m[e[n(1575)](e.Fxguv(_,c),1)],e[n(1358)](192,C)!==128?d+=g:(B=e.qdLys(31&v,6)|e.seVVP(63,C),e.RtjaQ(B,128)?d+=g:(d+=e[n(177)](l,B),_++)));else if(e[n(1509)](240,v)==224)if(e.EwCkJ(e[n(1359)](_,2),t))d+=g;else if(e[n(263)](e.jPyPL,e[n(628)]))C=m[e.TMwrS(e[n(203)](_,c),1)],k=m[e[n(521)](e[n(885)](_,c),2)],e[n(385)](e[n(393)](C,e[n(1116)](k,8)),49344)!==32896?d+=g:(B=e[n(237)](e[n(237)](e[n(849)](e[n(385)](15,v),12),e[n(951)](63&C,6)),e.JHrJN(63,k)),e.uiwyX(B,2048)||B>=55296&&B<=57343?d+=g:(d+=e.sHHbM(l,B),_+=2));else{HbPduY[n(1456)](_0x20109d,_0x37f883,42);let Y=HbPduY.sdrcT(_0x41a512);HbPduY.NgTon(_0x39c7ba,_0x18bac4,Y),HbPduY[n(1557)](_0x322796,_0x169549,Y.limit),HbPduY[n(132)](_0x34edd1,_0x409e3b,Y),HbPduY[n(561)](_0x1502a1,Y)}else e[n(411)](248&v,240)?e[n(744)](_+3,t)?d+=g:(C=m[e[n(392)](e.UqQwO(_,c),1)],k=m[e[n(1440)](e[n(1130)](_,c),2)],R=m[e.aMuLz(_,c)+3],e[n(1358)](C|e.IqOXF(k,8)|e[n(1455)](R,16),12632256)!==8421504?d+=g:e[n(961)](e.HjIWC,e[n(1386)])?this[n(985)](_0x1a78b3,_0x4403a7):(B=e.XpnfH(e[n(1111)](e[n(1520)](e.qdLys(e[n(1358)](7,v),18),e[n(519)](63&C,12)),e.FEJuj(63&k,6)),e[n(738)](63,R)),e[n(144)](B,65536)||B>1114111?d+=g:(B-=65536,d+=e.yoSIw(l,e[n(1189)](e[n(525)](B,10),55296),e[n(1169)](1023,B)+56320),_+=3))):d+=g}return d}function De(s,t){let n=r,o={YYmRH:function(d){return e[O(807)](d)}},c=t[n(1156)],l=0;for(let d=0;d<c;d++)if(e.caedu(e[n(416)],e[n(1369)])){let _=this[n(642)+n(1347)]?.[n(1100)+n(1059)+"nt"]();this[n(777)](n(686)+_),o[n(828)](_0x482951)}else{let _=t[n(265)+"At"](d);_>=55296&&e.VLwbr(_,56319)&&e[n(253)](e[n(179)](d,1),c)&&(_=e[n(392)](e.rPnzD(_,10),t.charCodeAt(++d))-56613888),l+=_<128?1:e[n(144)](_,2048)?2:e[n(253)](_,65536)?3:4}Q(s,l);let m=e[n(1052)](ge,s,l),g=s[n(987)];for(let d=0;e.VhBNF(d,c);d++){let _=t[n(265)+"At"](d);if(_>=55296&&e[n(701)](_,56319)&&e[n(1362)](e[n(591)](d,1),c)&&(_=e[n(1149)](e[n(1055)](e[n(1029)](_,10),t[n(265)+"At"](++d)),56613888)),_<128)g[m++]=_;else{if(e[n(236)](e[n(571)],e[n(571)]))return(_0xda141c(8)[n(1505)]("0")+e[n(532)](_0x20d435,_0x164197,10)[n(547)](2))[n(369)](-8);e[n(1362)](_,2048)?g[m++]=e[n(1111)](e[n(505)](e[n(460)](_,6),31),192):(e[n(1288)](_,65536)?g[m++]=e[n(1041)](e.DHXtF(_,12),15)|224:(g[m++]=e[n(559)](e[n(504)](_,18),7)|240,g[m++]=e[n(1165)](e.seVVP(e.UQNUK(_,12),63),128)),g[m++]=e[n(559)](_>>6,63)|128),g[m++]=e[n(905)](e[n(1169)](63,_),128)}}}function ke(s,t){let n=r;if(e[n(420)](n(207),n(576))){let o=e[n(856)](ge,s,t[n(342)]),c=s.bytes,l=t[n(987)];for(let m=0,g=t[n(342)];e.MmTiq(m,g);m++)c[e[n(695)](m,o)]=l[m]}else return this[n(1533)][n(774)+"ns"]}function te(s){let t=r;return s[t(987)][e[t(1389)](rt,s,1)]}function Ge(s,t){let n=ge(s,1);s.bytes[n]=t}function ne(s){let t=r,n=0,o=0,c;do c=e[t(455)](te,s),e[t(769)](n,32)&&(o|=e[t(1357)](127&c,n)),n+=7;while(e[t(1112)](128,c));return o}function Q(s,t){let n=r;for(t>>>=0;t>=128;)e[n(877)](Ge,s,e[n(1559)](e[n(940)](127,t),128)),t>>>=7;e[n(1305)](Ge,s,t)}function Yr(s,t){let n=r,o={UUCfB:e.scLnE,aCouy:e[n(365)],NLegO:function(d,_){return e[n(411)](d,_)},lbjsq:e.aeivL,mGjQq:"ws://"},c=0,l=0,m=0,g;if(g=e[n(350)](te,s),c=e.QygbB(127,g),e[n(771)](128,g)){if(e.QPATj===e[n(601)]){let d=this[n(642)+"tManager"]?.[n(1100)+n(1059)+"nt"]();this[n(777)](n(542)+d+n(680)),this[n(1020)+"ect"](1001,o[n(630)],!0)}else if(g=te(s),c|=e.cjYaz(e[n(741)](127,g),7),e.tVeaE(128,g)&&(g=te(s),c|=e[n(1476)](127&g,14),e.JgIfi(128,g)&&(g=te(s),c|=e[n(914)](e[n(405)](127,g),21),e.mPwKk(128,g)&&(g=e[n(862)](te,s),l=e[n(816)](127,g),128&g))))if(e[n(118)]("rPNmg",e.NmOPM)){let d=_0x59417c(o[n(1187)],{message:_0x5d4ab8[n(1314)],code:_0x132587[n(1229)+n(955)],error:_0x4cdbb3});this["_dispatc"+n(1168)+n(1522)](d)}else g=e[n(158)](te,s),l|=e.rPnzD(e[n(425)](127,g),7),e[n(816)](128,g)&&(g=e[n(455)](te,s),l|=e[n(1169)](127,g)<<14,e.DTowV(128,g)&&(g=te(s),l|=e.uGknd(127,g)<<21,128&g&&(g=te(s),m=e[n(1315)](127,g),e[n(385)](128,g)&&(e[n(562)](e[n(691)],n(1090))?(g=e[n(350)](te,s),m|=e[n(1576)](e[n(768)](127,g),7)):(_0x36b693=_0x16789a&&o[n(266)]("https:",_0x2f6837.protocol)?o[n(714)]:o[n(808)],_0xd2f221=_0x15386a[n(211)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),_0x525eb7=/^wss(.*:\/\/)/[n(1215)](_0x45c77f)?_0xbe2c07:""+_0x229ca5+_0x5f0818)))))}return{low:c|l<<28,high:e[n(1483)](e[n(1145)](l,4),e.KYxSl(m,24)),unsigned:t}}function bt(s,t){let n=r,o=e[n(1290)](t[n(1424)],0),c=(e[n(511)](t[n(1424)],28)|e[n(444)](t[n(1023)],4))>>>0,l=e[n(1290)](t[n(1023)],24),m=e[n(291)](0,l)?e[n(1341)](0,c)?o<16384?e.yeHuO(o,128)?1:2:e[n(1343)](o,2097152)?3:4:e[n(181)](c,16384)?e[n(1288)](c,128)?5:6:c<2097152?7:8:e[n(1362)](l,128)?9:10,g=ge(s,m),d=s[n(987)];switch(m){case 10:d[e.YpRPL(g,9)]=e[n(981)](e[n(1025)](l,7),1);case 9:d[e[n(1325)](g,8)]=e[n(1095)](9,m)?e[n(1483)](128,l):e[n(1118)](127,l);case 8:d[g+7]=e[n(1166)](8,m)?e[n(1559)](e.tiSWo(c,21),128):c>>>21&127;case 7:d[e[n(811)](g,6)]=m!==7?e[n(1103)](e.BDoNX(c,14),128):e[n(771)](e.kHGhD(c,14),127);case 6:d[g+5]=m!==6?e[n(945)](c>>>7,128):e[n(375)](c>>>7,127);case 5:d[e[n(811)](g,4)]=e[n(1095)](5,m)?128|c:e[n(301)](127,c);case 4:d[e[n(696)](g,3)]=e[n(489)](4,m)?e.ArXDf(e[n(131)](o,21),128):e[n(1145)](o,21)&127;case 3:d[e[n(613)](g,2)]=e.ZQsSk(3,m)?e[n(1500)](e[n(131)](o,14),128):e[n(1315)](e[n(1091)](o,14),127);case 2:d[e.mFFoi(g,1)]=e[n(172)](2,m)?e.XJVLG(o>>>7,128):e[n(240)](o,7)&127;case 1:d[g]=e[n(1398)](1,m)?128|o:127&o}}function Xr(s){return e.cMWMS(I,s)}function Gn(s){return e[r(1302)](E,s)}let $r=65536,Uo=e[r(198)],st=e[r(962)]($r,$r),Zr=e[r(736)](st,st),Qr=e[r(1032)](Zr,2),ze=String[r(257)+"e"].charCodeAt;class M{constructor(t,n,o){let c=r;this[c(256)]=!0,this.low=e[c(1520)](0,t),this[c(1023)]=e[c(1165)](0,n),this[c(1062)]=!!o}static[r(256)](t){let n=r;return t&&e[n(291)](!0,t[n(256)])}static fromBits(t,n,o){let c=r;if(e[c(263)]("sqALo",e[c(713)]))for(var l in _0x5e2f16)_0x22e57b.o(_0x3187ca,l)&&!_0x553707.o(_0x3db2c3,l)&&_0x53bfd7[c(1148)+c(418)](_0x4d0147,l,{enumerable:!0,get:_0x44b0e7[l]});else return new M(t,n,o)}static[r(847)+"s"](t,n,o){let c=r;return o?M[c(847)+c(599)](t,n):M[c(847)+c(676)](t,n)}static[r(847)+r(599)](t,n){let o=r;if(e[o(428)]===e[o(123)])_0x570283[o(719)](_0x2ac035);else return new M(e[o(1443)](e[o(1167)](e[o(1111)](t[0],e[o(1576)](t[1],8)),e[o(1129)](t[2],16)),e[o(519)](t[3],24)),e[o(1167)](e[o(1520)](e[o(397)](t[4],e.VVyoU(t[5],8)),e.vfDDo(t[6],16)),e[o(963)](t[7],24)),n)}static[r(847)+r(676)](t,n){let o=r;return new M(e[o(945)](e[o(1250)](e[o(890)](t[4],24),e.vfDDo(t[5],16))|e.bwanJ(t[6],8),t[7]),e[o(1111)](e[o(1097)](e[o(467)](t[0],24)|t[1]<<16,e[o(681)](t[2],8)),t[3]),n)}static fromHash(t){let n=r,o={pQmML:function(c,l){return c-l}};if(e.XYmut!==e[n(1099)])return e.dMZMr(t,Uo)?es:new M(e[n(131)](e.oZMTU(ze[n(480)](t,0)|e.gbnXo(ze[n(480)](t,1),8),e[n(519)](ze[n(480)](t,2),16))|e[n(598)](ze[n(480)](t,3),24),0),(e.PWtKx(e.IPtjM(ze.call(t,4),e.tsscV(ze[n(480)](t,5),8)),e.HsZtL(ze.call(t,6),16))|e.rzwPJ(ze[n(480)](t,7),24))>>>0,!0);if(_0x5017fd[n(1156)]!==4){let c=_0x50ad75.substring(0,XmPHYa[n(1579)](4,_0x3ce0cf[n(1156)])),l=c[n(936)](_0x58de9c);_0xf7d68a.push(l)}else _0x263ec2[n(157)](_0xbb110a);_0x1cefba&&(_0x4e7097+=1),_0x2e2d2c+=1,_0x31678f=!1}[r(1417)](){let t=r;return String[t(1337)+t(261)](e[t(183)](255,this[t(1424)]),e[t(492)](e.cqWxh(this[t(1424)],8),255),e.SFVIn(this[t(1424)],16)&255,e[t(1030)](this[t(1424)],24),255&this[t(1023)],e[t(538)](e[t(670)](this.high,8),255),e.UBgkF(this[t(1023)],16)&255,this[t(1023)]>>>24)}static[r(919)+"er"](t,n=!0){let o=r;if(e[o(1502)](isNaN,t))return n?Ko:es;if(n){if(t>=Zr)return Wo}else{if(e.MxekY(e[o(752)],e.pAnVw))return _0x529d6b?this.toBytesLE():this[o(358)+"E"]();if(e[o(988)](t,-Qr))return jo;if(e[o(520)](e[o(811)](t,1),Qr))return Ho}return M[o(185)](e[o(312)](e[o(972)](t,st),0),e[o(726)](e[o(1032)](t,st),0),n)}toNumber(){let t=r;return this[t(1062)]?e[t(1333)](e[t(1565)](e.YNTFa(this[t(1023)],0),st),e[t(439)](this[t(1424)],0)):e[t(203)](e[t(736)](this.high,st),this[t(1424)]>>>0)}[r(514)](){let t=r;return e[t(118)](0,this[t(1023)])&&this[t(1424)]===0}[r(270)](t){let n=r;if(e[n(1573)](e[n(645)],e[n(879)]))this[n(1185)](n(476),_0x6f1597),this.onclose&&this.onclose(_0x1c65a5);else{M[n(256)](t)||(t=M[n(919)+"er"](t));let o=e[n(670)](this[n(1023)],16),c=65535&this[n(1023)],l=e[n(1399)](this.low,16),m=e.tVeaE(65535,this[n(1424)]),g=t[n(1023)]>>>16,d=e.oPRhS(65535,t[n(1023)]),_=e[n(1030)](t.low,16),v=e[n(117)](65535,t.low),C=0,k=0,R=0,B=0;return B+=m+v,R+=e[n(555)](B,16),B&=65535,R+=e[n(244)](l,_),k+=e[n(1145)](R,16),R&=65535,k+=c+d,C+=k>>>16,k&=65535,C+=e[n(743)](o,g),C&=65535,M.fromBits(e.cYzWO(R<<16,B),e[n(469)](e[n(951)](C,16),k),this.unsigned)}}[r(1556)](t){let n=r;if(e[n(825)](e[n(445)],e[n(398)]))this[n(1193)]&&this._ws[n(1262)](_0x21aa5d),this[n(812)+n(1312)][_0x29b6de]=null;else return M[n(256)](t)||(t=M[n(919)+"er"](t)),e[n(1398)](this[n(1062)],t[n(1062)])&&e[n(1282)](e[n(311)](this.high,31),1)&&e[n(291)](t[n(1023)]>>>31,1)?!1:e[n(1252)](this[n(1023)],t[n(1023)])&&e.gYDpZ(this[n(1424)],t.low)}[r(867)](){let t=r;return e[t(406)](-1,this[t(1424)])&&e[t(1573)](-1,this[t(1023)])?M[t(185)](0,0,this.unsigned):e[t(291)](-1,this[t(1424)])?M[t(185)](0,this.high+1,this[t(1062)]):M[t(185)](this[t(1424)]+1,this[t(1023)],this.unsigned)}[r(1117)](t){let n=r;if(e[n(961)](e.NHbli,e.NHbli))return t?this[n(1370)+"E"]():this.toBytesBE();if(e[n(411)](n(668),typeof _0x375bfc)){let o=new _0x3cb986(e[n(1450)](_0x28e735,_0x5377ae));return e[n(956)](_0x4dcd2a,_0x96caa,o,0),o}return _0x1cd45f instanceof _0x4e77f0?new _0x1aae40(_0x4e2e4d):new _0xd9e01a(_0x589280[n(1060)],_0x213d6b[n(1338)+"et"],_0x17f828[n(742)+"th"])}[r(1370)+"E"](){let t=r;if(e.MjNTU!==e[t(635)])return this.unsigned?e[t(695)](e[t(1092)](this.high>>>0,_0x2a3139),this[t(1424)]>>>0):e[t(244)](e[t(736)](this[t(1023)],_0x2ba58),this.low>>>0);{let n=this[t(1023)],o=this[t(1424)];return[255&o,e[t(638)](e[t(459)](o,8),255),e[t(240)](o,16)&255,e[t(1209)](o,24),e[t(530)](255,n),e.lHzcw(e[t(322)](n,8),255),e[t(1007)](e[t(1564)](n,16),255),e[t(1356)](n,24)]}}toBytesBE(){let t=r,n=this[t(1023)],o=this[t(1424)];return[e.vmmTy(n,24),e[t(1586)](n>>>16,255),e[t(981)](e[t(511)](n,8),255),e[t(816)](255,n),e[t(409)](o,24),e[t(1186)](e.NQQUq(o,16),255),e[t(734)](e[t(785)](o,8),255),e[t(1587)](255,o)]}}let es=new M(0,0,!1),Ko=new M(0,0,!0),Ho=M[r(185)](-1,2147483647,!1),Wo=M[r(185)](-1,-1,!0),jo=M[r(185)](0,-2147483648,!1);var qe=(function(s){let t=r,n=e.kDoHB[t(1219)]("|"),o=0;for(;;){switch(n[o++]){case"0":s[s["CONNECTI"+t(134)]=5002]=e[t(1349)];continue;case"1":s[s["NATIVE_E"+t(1475)]=5001]=t(1293)+t(1475);continue;case"2":s[s[e[t(563)]]=5005]=e.rtkmp;continue;case"3":s[s[e[t(192)]]=5004]=e[t(192)];continue;case"4":return s;case"5":s[s[t(1267)+"IES_ERROR"]=5003]=e[t(327)];continue}break}})({});class it{constructor(t){let n=r;this[n(523)]=t,this[n(937)]=null}}class ts extends it{constructor(t,n){let o=r;super(t),this[o(1314)]=n&&n[o(1314)]||null}}class ns extends it{constructor(t,n){let o=r,c=e.voWYe[o(1219)]("|"),l=0;for(;;){switch(c[l++]){case"0":this[o(1516)]=n&&n.filename||"";continue;case"1":super(t);continue;case"2":this[o(473)]=n&&n[o(473)]||0;continue;case"3":this[o(1314)]=n&&n[o(1314)]||"";continue;case"4":this[o(993)]=n&&n[o(993)]||0;continue;case"5":this[o(321)]=n&&n[o(321)]||null;continue;case"6":this[o(603)]=n&&n[o(603)]||5001;continue}break}}}class rs extends it{constructor(t,n){let o=r;super(t),this.code=n&&n[o(603)]||0,this[o(786)]=n&&n[o(786)]||"",this.wasClean=n&&n[o(1008)]||!1,this[o(1077)+o(1480)]=n&&n[o(1077)+"nnect"]||!1}}class ss extends it{constructor(t,n){let o=r;super(t),this.data=n&&n[o(1163)]||null}}class is extends ss{constructor(t,n){let o=r;super(t),this[o(1163)]=n&&n.data||null,this[o(1314)]=n&&n[o(1314)]||null}}class os extends it{constructor(t,n){let o=r;super(t),this[o(1163)]=n&&n[o(1163)]||null}}function ue(s,{message:t,code:n,error:o}){return new ns(s,{message:t,code:n,error:o})}function pe(s,{code:t,reason:n,wasClean:o,willReconnect:c}){return new rs(s,{code:t,reason:n,wasClean:o,willReconnect:c})}function as(s,{data:t,message:n}){return new is(s,{data:t,message:n})}function xs(s,{data:t}){return new os(s,{data:t})}function Jn(s,{message:t}){return new ts(s,{message:t})}class cs{constructor(t,n){let o=r;this.endpoints=t,this[o(1142)+"es"]=n,this["currentI"+o(647)]=0,this[o(151)+"ndpointT"+o(1080)+"t"]=0}[r(1042)+r(196)+"fig"](){let t=r;if(e[t(118)]("TjwOk",e.WFyJj))this[t(581)+t(647)]=0,this[t(151)+t(186)+t(1080)+"t"]=0;else{let n=_0x26f260[t(1451)+"g"](0,4-_0x3e64ec[_0x5b415b][t(1156)]),o=n.concat(_0x1b089[_0x177523]);_0x15abf5[t(157)](o)}}[r(1408)+"es"](){let t=r;this[t(151)+t(186)+t(1080)+"t"]=0}["getCurre"+r(1059)+"nt"](){let t=r;return this[t(1448)+"s"][this[t(581)+t(647)]]}[r(1100)+r(1059)+"ntTriesC"+r(1322)](){let t=r;if(e[t(1166)](e[t(809)],e.FAGZb))_0x47ba1a[t(1474)](_0x160985,_0x5260e0);else return this[t(151)+t(186)+"riesCount"]}[r(1244)+r(1410)+"es"](){let t=r;return!!(e[t(1098)](this[t(581)+t(647)],this[t(1448)+"s"][t(1156)])||e[t(282)](this[t(581)+"ndex"],this[t(1448)+"s"][t(1156)]-1)&&this[t(151)+t(186)+"riesCount"]===this[t(1142)+"es"])}[r(791)+r(839)+"ointReac"+r(1217)+r(710)](){let t=r;return e[t(838)](this["currentI"+t(647)],this.endpoints[t(1156)])?!0:this[t(151)+t(186)+"riesCount"]>this[t(1142)+"es"]}["replaceB"+r(302)+"pointAnd"+r(643)+r(660)](){let t=r;return this[t(151)+t(186)+t(1080)+"t"]=1,this[t(581)+t(647)]++,this.endpoints[this["currentI"+t(647)]]}["getCurrentEndpoi"+r(775)+r(251)](){let t=r;return this[t(151)+t(186)+"riesCount"]++,this.getCurrentEndpoint()}}let ot=(e[r(624)](e[r(1233)],typeof globalThis)&&e.jABKv(e[r(380)],globalThis[r(1013)+"tor"].name)||e[r(1330)](e[r(1233)],typeof window)&&e[r(380)]===window[r(1013)+"tor"][r(1101)])&&e[r(1224)](e[r(1233)],typeof document),Je=e.VjbsV!=typeof globalThis&&(e[r(855)]===globalThis[r(1013)+r(874)][r(1101)]||e[r(574)](e[r(324)],globalThis[r(1013)+r(874)][r(1101)]))&&e[r(1330)](e[r(1233)],typeof tt),vt=(e[r(1233)]!=typeof globalThis&&e.sPRCm(r(834),globalThis["construc"+r(874)][r(1101)])||e[r(954)](e[r(1233)],typeof globalThis)||e.TCDcr(e[r(1233)],typeof globalThis)&&!!globalThis[r(880)+r(659)])&&e.mFyKq(e[r(1233)],typeof wx),St=e.PscMK(e[r(1233)],typeof globalThis)&&(e.nLota(e[r(324)],globalThis[r(1013)+r(874)][r(1101)])||e[r(1078)]("SharedWorkerGlob"+r(1411),globalThis[r(1013)+"tor"][r(1101)])||e[r(208)]===globalThis[r(1013)+"tor"][r(1101)])&&r(629)+"d"!=typeof self,Go=e[r(624)](e[r(1233)],typeof globalThis)&&e[r(432)]("Object",globalThis["construc"+r(874)].name)&&e[r(1532)](e[r(1233)],typeof global)&&e[r(918)](e[r(855)],global[r(1013)+r(874)].name)&&e[r(1233)]!=typeof process&&!!process[r(746)];class Vn{constructor(){let t=r;e[t(1249)](e.liaGy,"tNaxj")?this[t(1190)+"rs"]={}:_0x300692.resolve()[t(1115)](()=>{let n=t;this[n(470)+n(1139)]()})}emit(t,...n){let o=r,c=this[o(1190)+"rs"][t];if(c)c[o(369)]()[o(457)](l=>l.fn[o(1232)](l[o(1251)],n));else if(e[o(673)](o(321),t)&&!this.onerror)if(o(404)===e[o(524)]){let l=n.length&&n[0];if(e[o(1353)](l,Error))throw l;let m=new Error(e[o(392)](o(224)+o(170),l?e.jgrJq(e.iiXfR(" (",l[o(1314)]),")"):""));throw m.context=l,l}else{if(!this[o(866)+"orOnline"]()||this[o(1368)+o(1133)])return;this[o(642)+o(1347)]?.[o(1042)+o(196)+o(228)](),this["_pingLos"+o(783)]?.["resetCou"+o(195)](),this._ws?this["_disconn"+o(1124)](1001,o(966)+o(664)+"reconnec"+o(221)+o(804),!0):this[o(920)]()}return this}[r(985)](t,n){let o=r;if(e[o(673)](void 0,t))this[o(1190)+"rs"]={};else if(e[o(513)](void 0,n))this._listeners[t]=null;else{let c=this[o(1190)+"rs"][t];if(c)for(let l=0;e[o(253)](l,c[o(1156)]);)c[l].fn===n?c[o(996)](l,1):++l}return this}on(t,n,o){let c=r;return(this[c(1190)+"rs"][t]||(this[c(1190)+"rs"][t]=[])).push({fn:n,ctx:o||this}),this}}class Jo extends Vn{[r(1183)+r(1194)+r(1304)](t){let n=r;return t[n(328)]||t[n(218)]?(n(1048)+" "+(t.errMsg||"")+n(441)+(t.errNo||""))[n(239)]():JSON.stringify(t)}constructor(t,n,o){let c=r;super(),this[c(1533)]=null,vt&&wx["connectS"+c(1506)]&&(this._socket=wx[c(829)+c(1506)]({url:t,protocols:n,header:o,fail:this["_createSocketFai"+c(1155)][c(433)](this),success:this["_createS"+c(147)+"cessHandler"][c(433)](this)})),Je&&tt[c(829)+c(1506)]&&(this[c(1533)]=tt["connectS"+c(1506)]({url:t,protocols:n,header:o,fail:this[c(1176)+c(689)+c(1155)][c(433)](this),success:this[c(1176)+c(147)+c(386)+c(639)][c(433)](this)}))}[r(1176)+r(147)+r(386)+r(639)](){let t=r;Promise[t(1164)]()[t(1115)](()=>{this[t(470)+"steners"]()})}[r(1176)+r(689)+r(1155)](t){let n=r,o={slbhp:function(c,l,m){return e[O(1305)](c,l,m)},ZXEBF:"error",CWegQ:n(476)};e[n(1573)](e[n(1085)],e[n(1107)])?(_0x14c5c2=_0x2ef391[e[n(784)](_0x36130a+_0x345e7c,1)],_0x450e5c=_0x3ad5e6[e[n(382)](e[n(1018)](_0x33dfb1,_0x4e9f75),2)],e[n(1088)](e[n(538)](e[n(1097)](_0x397c26,_0x138b0d<<8),49344),32896)?_0x1477c2+=_0x1f9dd2:(_0x3457f8=e.rMEMN(15,_0x4e72fe)<<12|e.UMbWD(e[n(738)](63,_0x1a1454),6)|e[n(616)](63,_0x27d248),e[n(527)](_0x862e6e,2048)||e[n(744)](_0x1bc481,55296)&&e[n(701)](_0x254f9f,57343)?_0x15982f+=_0x406e1b:(_0x26a512+=_0x20aace(_0x42ca71),_0x4e42c0+=2))):Promise[n(1164)]().then(()=>{let c=n,l=o[c(926)](ue,o[c(1015)],{message:this[c(1183)+c(1194)+c(1304)](t)});this[c(1185)](o[c(1015)],l);let m=o[c(926)](pe,o[c(1336)],{reason:this["_formatE"+c(1194)+c(1304)](t)});this[c(1185)](c(476),m)})}[r(470)+r(1139)](){let t=r,n={sZzFd:e[t(708)],QJtDR:function(o,c){return e.YmZLC(o,c)},LhYxl:e.dXwpj,hhAyb:t(1314),KLAtM:function(o,c,l){return e[t(990)](o,c,l)}};this[t(1533)].onOpen(o=>{let c=t;this[c(1185)](e[c(820)],e[c(462)](xs,e.qLPbW,{...o,data:o.errMsg||""}))}),this._socket.onClose(o=>{let c=t;this[c(1185)](c(476),e.uGcnl(pe,e[c(994)],{...o}))}),this[t(1533)][t(1434)+"e"](o=>{let c=t;n[c(646)](n[c(422)],n[c(422)])?(this[c(1193)]&&this[c(1193)][c(1262)](_0x40eb30),this._debug(n[c(619)],_0x1c8092)):this[c(1185)](n[c(176)],n[c(160)](as,c(1314),{...o}))}),this[t(1533)][t(1265)](o=>{let c=t;this[c(1185)](e[c(365)],e[c(882)](ue,e[c(365)],{...o,message:o[c(328)]||""}))})}[r(1262)](t){let n=r,o={lsVbn:n(321),kMLKm:function(c,l,m){return e[n(1123)](c,l,m)},wZCWA:function(c,l){return e.vCrfs(c,l)},xHWou:function(c,l){return e.NWZuI(c,l)},JZZBd:function(c,l){return e[n(741)](c,l)}};if(e.pnKfr(e[n(232)],e[n(232)]))if(t instanceof Uint8Array)if(e[n(1566)](e[n(716)],n(1225)))_0x5a3cdd&&_0x5c2b45["addEvent"+n(1499)](gbTWjn[n(994)],()=>_0x2ec925()),_0x2b4a5c&&_0x15dbd6[n(727)+n(1499)](gbTWjn[n(1419)],()=>_0x41090d());else{let c=t[n(1060)][n(369)](t.byteOffset,e.UIVME(t[n(742)+"th"],t[n(1338)+"et"]));this[n(1533)]&&this[n(1533)][n(1262)]({data:c,fail:l=>{let m=n;this[m(1185)](o[m(401)],o[m(753)](ue,"error",{message:this._formatErrorMessage(l)}))}})}else this[n(1533)]&&this[n(1533)].send({data:t,fail:c=>{let l=n;this[l(1185)](o[l(401)],o.kMLKm(ue,l(321),{message:this[l(1183)+"rrorMess"+l(1304)](c)}))}});else _0x24d4cf-=65536,_0x34e9f6+=_0x19b08c(NNDjMK[n(1037)](_0x426738,10)+55296,NNDjMK.xHWou(NNDjMK[n(296)](1023,_0x2b33a0),56320)),_0x4139cd+=3}[r(476)](t,n){let o=r;this._socket&&this._socket[o(476)]({code:t,reason:n})}addEventListener(t,n){this.on(t,n)}[r(977)+r(597)+r(1017)](t,n){this[r(985)](t,n)}get[r(1379)+"te"](){let t=r;return this[t(1533)][t(1379)+"te"]}get[r(1108)+"pe"](){return this[r(1533)].binaryType}set[r(1108)+"pe"](t){}get url(){let t=r;return this[t(1533)][t(215)]}get protocol(){let t=r;return this[t(1533)][t(986)]}get[r(774)+"ns"](){return this[r(1533)].extensions}get[r(1540)+r(605)](){let t=r,n={HOHba:t(1044)+"0"};if(e[t(657)](t(1160),t(1160)))return 0;{let o=n[t(815)][t(1219)]("|"),c=0;for(;;){switch(o[c++]){case"0":this._connect();continue;case"1":this[t(1368)+t(1133)]=!1;continue;case"2":this[t(642)+t(1347)]?.resetEndpointConfig();continue;case"3":this["_pingLos"+t(783)]?.[t(1388)+t(195)]();continue;case"4":this._isInit=!0;continue}break}}}}function Vo(s,t){let n=r;if(t)return new t(s.url,s[n(986)]);if(e.GlYPz(vt,Je))return new Jo(s[n(215)],s[n(986)],s.headers);if((ot||St)&&e[n(234)](e[n(1233)],typeof WebSocket)&&WebSocket)return new WebSocket(s[n(215)],s[n(986)+"s"])}function Yo(s){let t=r,n=e[t(1086)][t(1219)]("|"),o=0;for(;;){switch(n[o++]){case"0":return!1;case"1":if(Je&&tt[t(829)+t(1506)])return!0;continue;case"2":if(vt&&wx[t(829)+"ocket"])return!0;continue;case"3":if((ot||St)&&e[t(1233)]!=typeof WebSocket&&WebSocket)return!0;continue;case"4":if(s)return!0;continue}break}}function fs(s,t,n){let o=r,c={iGQzM:function(l,m){return e[O(1096)](l,m)},LUwGA:function(l,m){return e[O(411)](l,m)},fvywh:"string",PsytO:function(l,m){return e[O(1405)](l,m)},mlkfN:e[o(254)],ddrik:function(l,m){return e[o(1270)](l,m)},MaQrS:e[o(1457)],yTxCr:function(l,m){return e.IWraN(l,m)},wCmfZ:e.dHZqr,pNOur:function(l,m){return e[o(1253)](l,m)},NCnFa:function(l,m){return e[o(1588)](l,m)}};if(e[o(161)](e[o(682)],e[o(682)]))return e[o(156)](e[o(1069)](_0x573d48,4)[o(1505)]("0"),_0x445496(_0x23baae,2).toString(16)).slice(-4);{let l=-1;async function m(g){let d=o;if(c.ddrik(d(1e3),c[d(136)]))return c[d(758)](g,l)?Promise[d(697)](new Error(c[d(1027)])):(l=g,c[d(318)](g,n[d(1156)])?Promise[d(1164)]():n[g].bind(s)(t,m.bind(null,c.NCnFa(g,1))));{let{url:_}=c[d(182)](_0x336dc9,{}),v=_0x20ad06[d(623)](_)?_:c.LUwGA(c[d(204)],typeof _)?[_]:[];_0x19a7d2&&_0x32b88e[d(1300)](this[d(952)],_0x60738e),v&&v[d(1156)]?this[d(642)+d(1347)]=new _0x3d80e2(v,this[d(952)].maxRetries):this[d(642)+d(1347)]?.["resetEnd"+d(196)+d(228)](),this[d(1513)+"sCounter"]?.[d(1388)+d(195)](this[d(952)].pingLossCount),this[d(1368)+"osed"]=!1,this[d(1193)]&&c[d(1568)](this._ws[d(1379)+"te"],this[d(317)])?this[d(1020)+d(1124)](1e3,c[d(872)],!0):(this[d(275)]=!0,this[d(920)]())}}e[o(679)](m,0)}}function us(s){let t=r,n=0,o=0;for(let c=0;e[t(769)](c,s.length);++c)if(e[t(1192)](e[t(949)],e[t(949)]))o=s[t(265)+"At"](c),e[t(693)](o,128)?n+=1:e[t(1376)](o,2048)?n+=2:e[t(1439)](e[t(616)](64512,o),55296)&&e.uWDJz(e[t(497)](64512,s[t(265)+"At"](c+1)),56320)?(++c,n+=4):n+=3;else return _0x321d7f||(_0x46e0e0=[_0x2819d6[t(257)+"e"][t(1464)],_0x5d395e[t(257)+"e"][t(1531)],_0xf1044c[t(257)+"e"][t(1531)+t(860)+"ey"]]);return n}function ds(s,t,n){let o=r;if(e[o(837)](n-t,1))return"";let c="";for(let l=t;e[o(837)](l,n);){let m=s[l++];if(e.IWraN(m,127))c+=String[o(1337)+"Code"](m);else if(e.CDrNS(m,192)&&e[o(1362)](m,224))c+=String["fromChar"+o(261)](e[o(1250)](e.UMbWD(31&m,6),e[o(1118)](63,s[l++])));else if(e.CDrNS(m,224)&&m<240)c+=String[o(1337)+o(261)](e[o(1171)](e[o(741)](15,m)<<12,e[o(921)](63&s[l++],6))|e[o(734)](63,s[l++]));else if(e[o(520)](m,240)){let g=e[o(1149)](e[o(1443)](e[o(648)](e[o(850)](7,m)<<18,e.zpOLd(e[o(1298)](63,s[l++]),12))|e.bvtMm(e.SAAiO(63,s[l++]),6),63&s[l++]),65536);c+=String["fromChar"+o(261)](e.cyKoK(55296,e.DHXtF(g,10))),c+=String[o(1337)+"Code"](56320+(1023&g))}}return c}function Yn(s,t,n){let o=r,c=n,l,m;for(let g=0;e[o(1362)](g,s[o(1156)]);++g)if(l=s.charCodeAt(g),l<128)t[n++]=l;else if(e[o(503)](l,2048))if(e[o(1409)]===o(730)){let d=_0x51aadd.bytes,_=_0x33f451[o(142)],v=_0x3ce1f3[o(342)],C=_+_0x41ffb6;if(e[o(1134)](C,d.length)){let k=new _0x2b080e(2*C);k[o(1474)](d),_0x421a27[o(987)]=k}return _0x195763.offset=C,e[o(233)](C,v)&&(_0x226aeb.limit=C),_}else t[n++]=e[o(726)](e.DHXtF(l,6),192),t[n++]=e[o(913)](e.pmfSQ(63,l),128);else if(e[o(1041)](64512,l)===55296&&e[o(333)](e[o(301)](64512,m=s[o(265)+"At"](e[o(1226)](g,1))),56320)){let d=e[o(1045)][o(1219)]("|"),_=0;for(;;){switch(d[_++]){case"0":t[n++]=e[o(1250)](e[o(440)](l,12)&63,128);continue;case"1":t[n++]=e[o(1383)](e[o(1041)](e[o(504)](l,6),63),128);continue;case"2":t[n++]=e[o(393)](e[o(1595)](63,l),128);continue;case"3":++g;continue;case"4":t[n++]=e[o(1594)](e.vCrfs(l,18),240);continue;case"5":l=e[o(392)](65536+(e[o(1587)](1023,l)<<10),e[o(495)](1023,m));continue}break}}else t[n++]=e.Qytvk(e[o(1326)](l,12),224),t[n++]=e[o(1558)](e.vCrfs(l,6),63)|128,t[n++]=e[o(329)](e[o(1118)](63,l),128);return e[o(1438)](n,c)}async function ls(s){let t=r;if(e[t(159)]==typeof s){let n=new Uint8Array(e[t(1496)](us,s));return e[t(910)](Yn,s,n,0),n}return e[t(1353)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(1060)],s[t(1338)+"et"],s[t(742)+"th"])}function Xo(s){let t=r;if(e[t(1465)]===e[t(1465)])try{return e[t(481)](t(668),typeof s)&&(e[t(1353)](s,ArrayBuffer)||s.buffer&&s.buffer instanceof ArrayBuffer)||e[t(481)](e.LPMIl,typeof s)?"":(JSON[t(677)](s),e[t(1366)])}catch{return e[t(760)](e.LPMIl,typeof s)?e.HeVjv:""}else{let n=255&_0x323e07;_0x49dde8(n,_0x3ef257,_0x1832a9+_0x2b724c),_0x45225f>>>=8,_0x13a5e2--}}let $o=(s,t)=>{let n=r;if(e[n(825)](e.XGHfV,e[n(1354)]))_0x14c2ba.persisted&&(N[n(866)+n(372)]()&&(!N[n(1193)]||N[n(1193)][n(1379)+"te"]!==N[n(1339)]||e[n(236)](N[n(1193)][n(1379)+"te"],N[n(1452)+"NG"]))&&N[n(141)+"nLine"](),N[n(531)+"er"]&&_0x1795ca[n(727)+n(1499)](e[n(537)],N[n(141)+"nLine"]),N[n(531)+"er"]&&_0xf7a95b[n(727)+"Listener"]("offline",N[n(141)+n(482)]));else switch(s){case e[n(1222)]:case e[n(1348)]:return{[n(1481)+s]:1,"x-tt-env":t};default:return{}}};class Zo{constructor(t){let n=r;this[n(436)+n(1322)]=t,this[n(454)]=0}addCount(){let t=r;this[t(454)]++}["checkRea"+r(550)+"nt"](){let t=r;return e[t(1098)](this[t(454)],this[t(436)+t(1322)])}["resetCou"+r(195)](t=0){let n=r;this[n(436)+n(1322)]=t,this[n(454)]=0}}async function Qo(s){let t=r,n={TrpoP:function(o,c){return e[O(1446)](o,c)},ExnPR:function(o,c){return o(c)},LMicw:e[t(345)],ANdje:e[t(900)],NCCWo:t(912)+"ascript",CiRBh:function(o,c){return e[t(488)](o,c)},RjQoF:"http",RLQDA:function(o,c){return o(c)}};return new Promise(o=>{let c=t,l={FipCz:function(m,g){return n[O(586)](m,g)},VGqiG:"unknown "+c(786)};if(!ot)return n[c(1332)](o,n[c(1053)]);try{let m=document[c(772)+"ement"](n[c(448)]);window[c(1179)+c(426)]=g=>{let d=c;document[d(279)].removeChild(m),window[d(1179)+d(426)]=void 0,l[d(1084)](o,g&&g[d(805)]||l[d(130)])},m[c(523)]=n[c(573)],m[c(1144)]=n[c(602)](s[c(211)](/^ws/,n[c(423)]),c(1382)+c(1360)+c(733)+"P");try{document[c(279)][c(286)+c(923)](m)}catch{document[c(279)]["removeCh"+c(923)](m)}}catch{window[c(1179)+c(426)]=void 0,n.RLQDA(o,c(238)+"reason")}})}function Fe(s,t,n){let o=r;return!!s?.[o(349)](c=>c.key===t&&c[o(450)]===n)}function at(s,t){let n=r;return s?.[n(349)](o=>o[n(226)]===t)?.[n(450)]}let Xn=null;async function e0(){let s=r;return Xn||(Xn=Promise[s(1164)]()[s(1115)](ve[s(433)](ve,e[s(242)]))),Xn}class t0 extends Vn{constructor(t,n){let o=r;super(),this[o(797)]=t,this[o(456)]=n,this._qosDB=void 0,this[o(699)+o(1528)]=null}async[r(499)](){await this[r(1493)]()}async[r(1493)](){let t=r,n={WAbBw:function(o){return e[O(817)](o)},Oqpqu:function(o,c,l,m){return e.ctljT(o,c,l,m)}};if(!this[t(1260)]){if(this[t(699)+t(1528)])return this[t(699)+t(1528)];try{let o=this[t(797)],c=this[t(456)];this[t(699)+"mise"]=(async()=>{let l=t,{openDB:m}=await n[l(487)](e0);this[l(1260)]=await n[l(206)](m,l(1179)+"_"+o,1,{upgrade(g){let d=l;g[d(1132)+d(1363)+"e"](o,{keyPath:c})}})})(),await this[t(699)+t(1528)]}catch(o){console[t(719)](o)}finally{this[t(699)+"mise"]=null}}}async[r(1174)](t){let n=r;try{return await this[n(1493)](),this[n(1260)]?.[n(1174)](this[n(797)],t)}catch(o){console.log(o)}}async[r(1474)](t,n){let o=r;return await this[o(1493)](),this._qosDB?.[o(848)](this[o(797)],t)}async[r(984)](t){let n=r;try{return await this[n(1493)](),this[n(1260)]?.[n(782)](this[n(797)],t)}catch(o){console[n(719)](o)}}async[r(222)](){let t=r,n={vppBP:function(o,c){return e[O(744)](o,c)}};try{return t(539)!=="ctPam"?(await this[t(1493)](),this[t(1260)]?.[t(222)](this[t(797)])):cqGMWR[t(1248)](_0x264df4.offset,_0xc64fef[t(342)])}catch(o){e.Wyqcw(e.GctGC,t(975))?console[t(719)](o):(_0x4ff520=_0x58d84a[e.mFPtH(_0x2b782f,_0x2424ec)+1],_0x123119=_0x498bb6[e[t(743)](_0x3550d4,_0x3738da)+2],_0x2f33a5=_0x3f3725[e.cyKoK(_0x39196c,_0x45e0a6)+3],e[t(1397)](e[t(1443)](e[t(1033)](_0x5dca41,e[t(1393)](_0x33765d,8)),e[t(522)](_0x12a57b,16))&12632256,8421504)?_0x4800cf+=_0x57e0e5:(_0x32c04f=e.vBTGG(e[t(237)](e.zvWPX(e[t(762)](e[t(773)](7,_0x807880),18),e[t(1427)](e.QgTbW(63,_0x488c23),12)),e[t(921)](63&_0x49a1c8,6)),e[t(309)](63,_0x4f6f8a)),e[t(1350)](_0x51862d,65536)||e.eUXJw(_0x5d7132,1114111)?_0x579bbc+=_0x526022:(_0x30d2c7-=65536,_0x2b1906+=e[t(1305)](_0x20e937,e.TWyky(e[t(460)](_0x305702,10),55296),e[t(1118)](1023,_0x579338)+56320),_0x5df484+=3)))}}async[r(1311)](){let t=r;return e[t(1114)](e[t(1043)],e.mbdSa)?(await this[t(1493)](),this[t(1260)]?.[t(1477)+"ys"](this._dbName)):!!this[t(1260)]}async[r(929)](){let t=r;return await this[t(1493)](),this[t(1260)]?.[t(929)](this[t(797)])}async[r(971)](){let t=r;try{this[t(1260)]?.close(),this[t(1260)]=void 0}catch(n){console.log(n)}}get isReady(){let t=r;try{return!!this[t(1260)]}catch(n){return console[t(719)](n),!1}}}class n0{constructor(t,n){let o=r;if(e[o(354)](e[o(438)],e[o(494)]))this._DBName=t,this._pathKey=n,this[o(1260)]=localStorage;else{if(this._ws&&this._ws[o(1379)+"te"]===this[o(1452)+"NG"]){this[o(715)+o(294)](),this[o(1170)+"gTimeoutId"]=_0x343aaf(this[o(1373)].bind(this),this._options[o(685)+o(1140)]);return}if(!this._ws||this[o(1193)][o(1379)+"te"]!==this[o(1339)])return void this[o(1342)+o(895)]();this[o(1193)]&&this[o(1193)].send("hi"),this["_reconne"+o(688)+"tId"]=_0x5c91f3(this[o(1342)+"econnect"+o(589)].bind(this),this[o(952)][o(278)+o(998)+o(447)])}}async[r(499)](){}get[r(854)](){let t=r,n={jvLch:function(o,c){return e[O(706)](o,c)},enuOD:function(o,c,l){return e.kDNDX(o,c,l)}};if(e[t(348)](e.KNlwn,"QAyqr"))n.jvLch(_0x5e8dad,this[t(1521)+"lTimeoutId"]),this[t(1521)+"lTimeoutId"]=n[t(788)](_0x347844,()=>{let o=t;this[o(1515)+o(793)]()},this[t(1521)+"l"]);else return t(1179)+"_"+this[t(953)]}async get(t){let n=r,o=this[n(1260)][n(1458)](this[n(854)]);return JSON.parse(e[n(869)](o,"{}"))[t]}async[r(1474)](t,n){let o=r,c=this[o(1260)].getItem(this[o(854)]),l=JSON[o(677)](e[o(1127)](c,"{}"));return l[n||t[this[o(1246)]]]=t,this[o(1260)][o(1473)](this[o(854)],JSON[o(1227)+"y"](l)),n||t[this[o(1246)]]}async del(t){let n=r,o=this[n(1260)].getItem(this._prefix),c=JSON[n(677)](e[n(995)](o,"{}"));return c[t]=void 0,this._qosDB.setItem(this[n(854)],JSON[n(1227)+"y"](c))}async[r(222)](){let t=r;return this[t(1260)][t(222)]()}async[r(1311)](){let t=r,n=this._qosDB[t(1458)](this[t(854)]),o=JSON[t(677)](n||"{}");return Object[t(1311)](o)}async[r(929)](){let t=r,n=this[t(1260)].getItem(this._prefix),o=JSON.parse(e.weGvL(n,"{}"));return Object.values(o)}[r(971)](){return Promise[r(1164)]()}get[r(1001)](){let t=r,n={DuQZS:e[t(994)],aCZSk:function(o,c,l){return o(c,l)}};if(e[t(484)](e[t(907)],e.NOZKP))return!!this[t(1260)];this[t(1185)](WchIyh[t(1468)],WchIyh[t(1403)](_0xc71797,WchIyh[t(1468)],{..._0x37ffb4}))}}class r0{constructor(t,n){let o=r;this._DBName=t,this._pathKey=n,this[o(1260)]=Je?tt:vt?wx:null}async[r(499)](){}get[r(854)](){let t=r;return t(1179)+"_"+this[t(953)]}async[r(1174)](t){let n=r,o=this[n(1260)]["getStora"+n(728)](this[n(854)]);return JSON[n(677)](e.VTnkO(o,"{}"))[t]}async[r(1474)](t,n){let o=r,c={rivBI:function(l,m){return l>=m}};if(e[o(790)](e.YbbER,o(1548)))return xHUmKi[o(778)](this[o(454)],this[o(436)+o(1322)]);{let l=this[o(1260)]["getStora"+o(728)](this[o(854)]),m=JSON[o(677)](l||"{}");return m[n||t[this._pathKey]]=t,this[o(1260)]["setStora"+o(728)](this[o(854)],JSON[o(1227)+"y"](m)),n||t[this[o(1246)]]}}async del(t){let n=r;if(e.MFnxM(e[n(506)],e[n(506)])){let o=this[n(1260)][n(126)+n(728)](this._prefix),c=_0x5e3edf.parse(o||"{}");return c[_0x29310c||_0x5d05f2[this._pathKey]]=_0x472f83,this[n(1260)][n(191)+n(728)](this._prefix,_0x260420.stringify(c)),_0x16e94c||_0x3833fc[this._pathKey]}else{let o=this._qosDB[n(126)+n(728)](this._prefix),c=JSON[n(677)](e.FiZNU(o,"{}"));return c[t]=void 0,this[n(1260)][n(191)+n(728)](this[n(854)],JSON[n(1227)+"y"](c))}}async[r(222)](){let t=r;return this[t(1260)][t(840)+t(1289)]()}async[r(1311)](){let t=r,n={KIXaj:function(o,c){return e[O(1096)](o,c)}};if(e[t(1317)](e[t(1421)],e[t(529)])){let o=this[t(1260)][t(126)+t(1487)+"nc"](this[t(854)]),c=JSON[t(677)](e[t(1563)](o,"{}"));return Object[t(1311)](c)}else{let o=this[t(1260)].getItem(this[t(854)]),c=_0x32aecf[t(677)](MqqBOt[t(554)](o,"{}"));return _0x48bd6f[t(370)](c)}}async[r(929)](){let t=r,n=this[t(1260)]["getStora"+t(1487)+"nc"](this._prefix),o=JSON[t(677)](e.GlYPz(n,"{}"));return Object[t(370)](o)}[r(971)](){return Promise.resolve()}get isReady(){return!!this[r(1260)]}}function hs(s,t){let n=r;if(e.YSAWF(Je,Je))return new r0(s,t);if(e[n(1318)](ot,St)&&n(629)+"d"!=typeof indexedDB)return new t0(s,t);if(e.LnTCZ(ot,St)&&e[n(624)](e[n(1233)],typeof localStorage))return new n0(s,t);throw new Error(e[n(1180)])}class s0{constructor(){let t=r;this[t(1521)+"lTimeoutId"]=null,this[t(1521)+"l"]=36e5,this[t(1260)]=hs(e[t(526)],t(137)+"id")}async[r(1521)+r(378)](){let t=r,n={vLYGI:e[t(159)],vsMeG:function(o,c){return e[t(614)](o,c)},vcYLy:e[t(1143)],IEXuG:t(1177)};e[t(1261)](clearInterval,this[t(1521)+t(944)+"Id"]),this[t(1521)+t(944)+"Id"]=e[t(1198)](setInterval,()=>{let o=t,c={jeYWl:function(l,m){return l!=m},LJrlP:n[o(585)],dXMBr:function(l,m){return l instanceof m},LIwLo:o(851)+o(414)};if(n[o(615)](n[o(1236)],n.IEXuG))this[o(1515)+"ired"]();else return ajBWZp.jeYWl(ajBWZp[o(413)],typeof _0x19dd94)&&(ajBWZp[o(553)](_0x4b065d,_0x45cfe7)||_0x42cfd1[o(1060)]&&ajBWZp[o(553)](_0x3e9ecb[o(1060)],_0x2583bd))||ajBWZp[o(1560)](ajBWZp.LJrlP,typeof _0x2b7a5e)?"":(_0x2872f0[o(677)](_0x4bd376),ajBWZp[o(704)])},this[t(1521)+"l"])}async openDB(){let t=r;await this[t(1260)][t(499)]()[t(1115)](()=>{let n=t,o={oHdIQ:e[n(408)]};e[n(245)](e[n(1064)],e[n(496)])?(this._isBrowser&&_0x2124cd[n(977)+n(597)+n(1017)]("pagehide",this[n(502)+"ageHide"]),this._isBrowser&&_0x206ac6[n(977)+n(597)+"ner"](o[n(835)],this[n(502)+n(658)]),this[n(476)]()):this[n(1521)+"lFlush"]()})}async[r(1515)+r(793)](){let t=r;if(e[t(948)]!==e[t(651)])(await this[t(1260)]?.[t(929)]()||[])[t(463)](({timestamp:c})=>c<Date.now()).forEach(c=>{let l=t;this[l(1260)]?.[l(984)](c[l(137)+"id"])});else{let n=_0x5974b9[t(1156)]&&_0x4098a2[0];if(e.EGppy(n,_0x327bc5))throw n;let o=new _0x34a803(e[t(521)](e[t(1375)],n?e[t(1309)](" (",n[t(1314)])+")":""));throw o[t(618)]=n,n}}async[r(984)](t){let n=r;return this[n(1260)]?.[n(984)](t)}async[r(1474)](t,n){let o=r;return this._qosDB?.[o(1474)]({message_id:t,timestamp:n})}async[r(1174)](t){return this._qosDB?.get(t)}async[r(971)](){let t=r;e[t(1303)](clearInterval,this[t(1521)+"lTimeoutId"]),await this[t(1260)]?.closeDB()}get[r(1001)](){let t=r;return this[t(1260)]?.[t(1001)]}}function $n(s){let t=r,n=!!this[t(952)][t(1412)+"S"];if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e.vwskh(Fe,s[t(1314)][t(1437)],e[t(165)],"2"),c=o&&e[t(535)](Fe,s[t(1314)][t(1437)],t(347)+t(947)+"ck","1"),l=o&&e[t(1404)](Fe,s.message[t(1437)],e[t(316)],"1"),m=l?e[t(863)](at,s[t(1314)][t(1437)],e.dtUQb)?.[t(1219)](",")[t(463)](Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:c,isAckCleanupMessage:l,ackMsgIds:m}}async function gs(){let s=r;return this[s(1301)+"ger"]||(this[s(1301)+"ger"]=new s0),this[s(1301)+"ger"][s(1001)]||await this._QoSManager[s(499)](),this[s(1301)+s(1264)]}async function i0(s,t){let n=r;if(e[n(1039)](e.dUptJ,e[n(1486)])){let{enableAutoAck:o}=this._options,c=e[n(535)](Fe,s[n(1314)][n(1437)],n(577),"1"),l=Fe(s.message[n(1437)],e[n(729)],"1"),m=$n[n(480)](this,s);if(e[n(491)](o,c)){let{SeqID:g,LogID:d,service:_,LogIDNew:v,method:C}=s.message;this[n(1530)]({SeqID:g,LogID:d,LogIDNew:v,service:_,method:C,headers:[{key:e[n(729)],value:"1"},{key:e[n(290)],value:e[n(1563)](v,"")},{key:e[n(536)],value:"0"}]})}l&&!m[n(687)]&&this[n(1319)+n(1214)+n(143)](s),e[n(969)](t)}else{if(this._options["disableA"+n(1172)+n(1150)]||this["_readyCl"+n(1133)])return;this[n(1342)+n(895)]()}}async function o0(s,t){let n=r;this[n(777)](e[n(1324)],s[n(1314)]),e[n(1310)](t)}async function a0(s,t){let n=r,o={stnvc:function(c,l,m){return e[O(877)](c,l,m)}};if(e[n(765)]===n(960)){let c=e[n(1303)](Xr,await e[n(748)](ls,s[n(1163)]));try{if(c[n(720)]instanceof Uint8Array){let l=this[n(952)][n(943)+n(534)]instanceof Object?{force:!!this._options["payloadE"+n(534)][n(1240)],encoding:this[n(952)][n(943)+n(534)].encoding?this._options[n(943)+"ncoding"].encoding[n(211)](/\s/g,"")["toLowerC"+n(857)]():""}:{force:!1,encoding:this[n(952)][n(943)+"ncoding"]?this._options[n(943)+n(534)][n(211)](/\s/g,"")[n(395)+n(857)]():""},m=c["payloadE"+n(534)]?c[n(943)+n(534)][n(211)](/\s/g,"")[n(395)+"ase"]():"",g=e[n(654)](this[n(952)]["payloadT"+n(477)],Object)?{force:!!this[n(952)][n(1387)+n(477)][n(1240)],type:this._options[n(1387)+"ype"][n(523)]?this[n(952)].payloadType[n(523)][n(211)](/\s/g,"")[n(395)+n(857)]():""}:{force:!1,type:this[n(952)][n(1387)+"ype"]?this._options.payloadType.replace(/\s/g,"")["toLowerC"+n(857)]():""},d=c[n(1387)+n(477)]?c[n(1387)+n(477)].replace(/\s/g,"")[n(395)+n(857)]():"",_=g[n(1240)]?g[n(523)]:d||g[n(523)],v=l[n(1240)]?l.encoding:m||l[n(1286)],C=[e.HeVjv,n(851)+"ion/json","applicat"+n(414)+n(1585)+n(1242),n(668)],k=[e[n(1552)],"binary"];this[n(952)]["enableTr"+n(732)+n(125)+"ad"]&&C.includes(_)&&(!v||k[n(735)](v))?c[n(842)+n(764)]=e[n(174)](ds,c[n(720)],0,c[n(720)][n(742)+"th"]):c[n(842)+n(764)]=""}else c["textPayl"+n(764)]=""}catch(l){e.yvpdP(e[n(938)],e[n(938)])?(AanyUh[n(1535)](_0xfb49f4,_0x1a7c01,90),AanyUh[n(1535)](_0x50c617,_0x5a08b7,_0x514f72)):(c[n(842)+n(764)]="",console.log(l))}s[n(1314)]=c,e[n(486)](t)}else{let c=_0x8c444c.bytes,l=_0x36d0bf[n(342)];return c[n(1156)]===l?c:c[n(1173)](0,l)}}function x0(s,t,n){let o=r;if(e.ysDrb(o(579),o(579)))_0x1cb451["frontier"+o(426)]=void 0,_0x3091b4(o(238)+o(786));else{let c=e[o(869)](n,8192),l=e[o(1091)](c,1),m=null,g=c;return function(d){let _=o;if(d<1||e[_(1134)](d,l))return e[_(862)](s,d);e[_(672)](e.TMwrS(g,d),c)&&(m=s(c),g=0);let v=t.call(m,g,g+=d);return e[_(1595)](7,g)&&(g=e[_(1018)](7|g,1)),v}}}let c0=4294967295;function f0(s,t,n){let o=r;return e[o(1302)](RangeError,e.GnNZl(o(1046)+"t of ran"+o(700)+s+e.GluWf+e[o(146)](t,1)+e[o(1141)],n))}function u0(s,t,n){let o=r;if(e.mhuyD(n,c0))throw new Error(e.mscLe);let c=3;for(;c>=0;){let l=255&n;Qn(l,s,e[o(465)](t,c)),n>>>=8,c--}return t+4}function d0(s,t){let n=r,o=0,c=t,l=e[n(1058)](t,4);for(;e[n(1444)](c,l);){let{value:m,offset:g}=e.lHAKZ(Zn,s,c);c=g,o=e[n(1038)](e.FJHvC(o,8),0),o+=m}return{value:o,offset:l}}function l0(s,t,n){let o=r,c="3|2|0|1|4"[o(1219)]("|"),l=0;for(;;){switch(c[l++]){case"0":if(t[o(479)+"e"])return e.xjUtl(t.utf8Write(s,n),n);continue;case"1":if(t[o(827)])return e.qkzgO(t.write(s,n),n);continue;case"2":if(e[o(769)](s[o(1156)],40))return e[o(1309)](Yn(s,t,n),n);continue;case"3":if(!s)return n;continue;case"4":return e.dEnqL(Yn,s,t,n)+n}break}}function h0(s,t){let n=r,o=new M(e[n(1443)](e.vBTGG(e[n(757)](e[n(681)](s[e[n(1333)](t,4)],24),e.xIdKk(s[e[n(1018)](t,5)],16)),s[e[n(1432)](t,6)]<<8),s[e[n(167)](t,7)]),e.oQjpc(e[n(129)](e[n(1245)](e[n(681)](s[e[n(696)](t,0)],24),e[n(1489)](s[t+1],16)),e[n(287)](s[e.UxzoR(t,2)],8)),s[t+3]),!0);return t+=8,{value:o,offset:e.tVLKw(t,8)}}function g0(s,t,n){let o=r,c=s[o(1424)],l=s[o(1023)];return t[n]=e[o(1014)](l,24),t[e[o(1018)](n,1)]=e[o(917)](e[o(1152)](l,16),255),t[e.ffmOY(n,2)]=e[o(981)](e[o(663)](l,8),255),t[n+3]=e[o(1041)](255,l),t[e[o(695)](n,4)]=e[o(546)](c,24),t[e[o(1019)](n,5)]=e[o(1340)](c,16)&255,t[e[o(1181)](n,6)]=e[o(1542)](e[o(292)](c,8),255),t[n+7]=255&c,n+=8,n}function Zn(s,t){let n=r;return s[n(220)+"8"]?{value:s.readUInt8(t),offset:e[n(1210)](t,1)}:{value:e[n(1587)](255,s[t]),offset:e[n(613)](t,1)}}function Qn(s,t,n){let o=r;return t.writeUint8?t[o(1255)+"t8"](s,n):t[n]=e.mPwKk(255,s),e.PGIcp(n,1)}let p0=function(s){return new Uint8Array(s)},m0=e[r(1233)]!=typeof Buffer?Buffer[r(468)+r(209)]:e.RCBAs(x0,p0,Uint8Array[r(257)+"e"][r(1173)]),w0=16,er=32;function _0(s){let t=r,n=0,o={};for(let c=0;e[t(253)](c,s[t(1156)]);c++)o[s[c]["cursor_n"+t(517)]]=e[t(767)](us,s[c][t(528)+"ame"]),n+=14+o[s[c][t(528)+t(517)]];return[n,o]}function ps(s,t,n){let o=r,c={UzgWU:e[o(1057)],eemyn:function(_,v,C,k){return _(v,C,k)},Htilk:e.TdqQN,plCyW:e[o(1514)],BGQyZ:function(_,v,C,k){return e.cNLmM(_,v,C,k)},wKCuZ:e[o(723)],nMsuY:function(_,v,C,k){return e.vwskh(_,v,C,k)},fepAj:o(634)},[l,m]=e[o(455)](_0,s),g=m0(l),d=0;return s[o(457)](_=>{let v=o;console.log(c[v(351)],_,_[v(1543)]),d=c[v(396)](Qn,0,g,d),console[v(719)](c[v(1544)],d),d=c[v(396)](u0,g,d,_[v(1543)]||0),console[v(719)](c.plCyW,d),d=c[v(836)](Qn,m[_[v(528)+v(517)]],g,d),console[v(719)](c[v(1083)],d),d=c[v(396)](l0,_[v(528)+v(517)],g,d),console.log(v(1101),d),d=c[v(1138)](g0,M[v(919)+"er"](_.cursor||t),g,d),console.log(c[v(1345)],d)}),{frameType:er,headers:[{key:o(1223)+o(721),value:n}],payload:g}}function y0(s){let t=r,n=0,o=[];for(;e[t(508)](n,s[t(742)+"th"]);){let{offset:c}=e[t(1036)](Zn,s,n);n=c;let l={cursor_name:"",cursor:0,service:0},{value:m,offset:g}=e[t(745)](d0,s,n);l[t(1543)]=m,n=g;let{value:d,offset:_}=Zn(s,n);n=_,l[t(528)+t(517)]=e.Xkpka(ds,s,n,e[t(1575)](n,d)),n+=d;let{value:v,offset:C}=e[t(1198)](h0,s,n);l.cursor=v.toNumber(),n=C,o[t(157)](l)}return o}function b0(){let s=r;return{frameType:er,headers:[{key:e.TJdtG,value:"FILE_NOT"+s(1275)}],payload:void 0}}class v0{constructor(t,n,o){let c=r;this[c(124)+c(1089)]=t,this._cursorFileName=n,this[c(812)+c(796)]=o,this[c(1260)]=e.lHAKZ(hs,this._cursorNameSpace,e[c(612)])}async openDB(){let t=r;await this[t(1260)][t(499)]()}async[r(780)+"rs"](){let t=r;if(!this[t(1260)].isReady)return;let n=this[t(812)+t(796)],o=await this[t(1260)].getAll();switch(console[t(719)]("allCurso"+t(334),o),n){case e[t(135)]:return o&&o[t(1156)]?e[t(910)](ps,o,0,this["_cursorF"+t(549)]):void 0;case e[t(1056)]:return;case e[t(260)]:return o&&o[t(1156)]?e[t(174)](ps,o,0,this[t(1239)+"ileName"]):e[t(486)](b0)}}async[r(1474)](t,n,o){let c=r;return console[c(719)](e[c(114)],t,n,o),this[c(1260)][c(1474)]({cursor_name:t,cursor:n,service:o})}async setCursors(t){let n=r,o=e[n(455)](y0,t);for(let c of o)console[n(719)](e.dfeWh,o),await this[n(1260)][n(1474)](c)}async[r(1174)](t){let n=r;return(await this[n(1260)][n(1174)](t))?.cursor}async[r(971)](){let t=r;e.qHgFI(e[t(1461)],t(1519))?await this[t(1260)].closeDB():_0x47a4da[t(719)](_0x5f20a4)}[r(1372)+r(1561)+r(810)](t){let n=r;if(n(626)!==e[n(121)])this[n(1239)+n(549)]=t;else return _0x265215[n(719)](e[n(114)],_0x28ca8a,_0x23da39,_0x25a46e),this[n(1260)][n(1474)]({cursor_name:_0x15fb52,cursor:_0x2d8dd5,service:_0x4c4547})}get[r(1001)](){return this._qosDB.isReady}}let S0=e.ahwxq;async function ms(s){let t=r,n={PpLDy:e[t(1268)],ysUvC:function(g,d){return g===d},EbzMv:e[t(1054)],UNMFn:function(g,d){return e[t(258)](g,d)},PrWAJ:function(g,d){return e[t(1488)](g,d)}};if(!this[t(952)][t(1412)+"S"])return null;let{aID:o,fpID:c,messageStrategy:l}=this[t(952)],m=e[t(1318)](s,S0);try{if(e[t(711)](e[t(1374)],e[t(1374)]))return this[t(1207)+t(853)]?s&&this[t(1207)+"anager"][t(1372)+"rsorFile"+t(810)](s):this[t(1207)+t(853)]=new v0(c+"_"+o+"_"+m,m,l),this["_cursorM"+t(853)].isReady||await this[t(1207)+t(853)][t(499)](),this[t(1207)+t(853)];{let g=(t(461)+t(1425))[t(1219)]("|"),d=0;for(;;){switch(g[d++]){case"0":this[t(901)+t(1178)+t(1499)]();continue;case"1":this[t(749)+"mer"]();continue;case"2":this["_readyCl"+t(1133)]=!0;continue;case"3":if(!this[t(1193)])return void this[t(777)](n[t(611)]);continue;case"4":if(n[t(888)](this._ws.readyState,this[t(317)])||n[t(888)](this[t(1193)][t(1379)+"te"],this.CLOSING))return void this[t(777)](n[t(1257)]);continue;case"5":this[t(715)+t(294)]();continue;case"6":this[t(464)+t(1291)+"t"](_0x389122,_0x5283e2);continue;case"7":this["_QoSMana"+t(1264)]?.closeDB();continue}break}}}catch{if(e[t(1114)]("VMUXe",t(970))){let g=_0x3b4a8f(_0x1162b2,_0x3a9211[t(342)]),d=_0x3756d4[t(987)],_=_0x3cad99.bytes;for(let v=0,C=_0x29f625[t(342)];zaFnIq[t(662)](v,C);v++)d[zaFnIq[t(371)](v,g)]=_[v]}else return null}}async function C0(s,t){let n=r,o=e[n(535)](Fe,s.message[n(1437)],e.yKKss,"-1"),c=Fe(s[n(1314)][n(1437)],e[n(729)],"1"),l=e.JyxzF(at,s.message.headers,e[n(335)]),m=e[n(446)](Number,e[n(1198)](at,s[n(1314)].headers,e.bTRhM))||0,g=$n[n(480)](this,s),d=e[n(1512)](Fe,s.message.headers,e.AuKWD,"2"),_=e[n(1153)](at,s[n(1314)].headers,e[n(1121)]),v=e.fyfOU(Number,at(s[n(1314)][n(1437)],e[n(770)]));if(g[n(687)])return t();let C=g[n(891)+"sage"]?await gs[n(480)](this):null;if(e[n(360)](s[n(1314)][n(1543)],0)&&c&&!o||e[n(1508)](s[n(1314)].service,0)){if(l&&g[n(891)+"sage"]&&C){if(!!!await C[n(1174)](l))if(e[n(1003)]!==e[n(1423)])this[n(1319)+n(1031)+"Event"](s),await C.set(l,Date[n(604)]()+m);else{let{offset:R}=e.XfTJd(_0x314410,_0xdaaa87,_0x157521);_0x40beef=R;let B={cursor_name:"",cursor:0,service:0},{value:Y,offset:me}=e[n(1024)](_0x386f6d,_0x59d93f,_0x3d4444);B[n(1543)]=Y,_0x7d244c=me;let{value:X,offset:qt}=e[n(356)](_0x2b877d,_0x516d04,_0x166e82);_0x3e8dbf=qt,B["cursor_n"+n(517)]=e[n(978)](_0x2c9c66,_0x3ab467,_0x5e2542,e[n(1058)](_0x3d65b0,X)),_0x59801a+=X;let{value:tr,offset:nr}=_0x24e40f(_0x57c5cf,_0x195463);B[n(169)]=tr[n(558)](),_0x1d4bb3=nr,_0x1bb890[n(157)](B)}return t()}if(d){let k=await ms[n(480)](this);if(!k)return this["_dispatc"+n(1031)+n(1158)](s),e.EWTAh(t);let R=await k[n(1174)](_)??-1;if(R<v)this[n(1319)+n(1031)+n(1158)](s),k[n(1474)](_,v,s[n(1314)].service);else throw new Error("recevied"+n(1578)+n(1205)+v+(n(1071)+n(831)+n(958)+"r ")+R);return t()}return this[n(1319)+n(1031)+n(1158)](s),e[n(1433)](t)}}async function E0(s,t){let n=r,o=$n[n(480)](this,s);if(!o["isQoSMes"+n(421)])return t();let c=await gs[n(480)](this);if(o[n(1204)+n(627)+n(1304)]&&o[n(1569)+"s"].length)for(let l of o[n(1569)+"s"])await c[n(984)](l);e[n(969)](t)}async function A0(s,t){let n=r,o=e.AVvRS(s[n(1314)][n(822)+"e"],w0),c=e.WcUyd(s[n(1314)][n(822)+"e"],er);if(e[n(491)](!o,!c))return e[n(1433)](t);let l=e[n(458)](at,s.message[n(1437)],e[n(1378)]);if(!l)return e.Ndknb(t);let m=await ms.call(this,l);if(!m)return t();if(o){let g=await m[n(780)+"rs"](),d={frameType:g?.[n(822)+"e"],SeqID:M[n(919)+"er"](this[n(1491)]++),LogID:M[n(919)+"er"](this[n(952)]["logIDGen"+n(932)]()),service:9e3,method:5,headers:g?.[n(1437)],payload:g?.[n(720)]},_=e[n(175)](E,d);this._ws&&this[n(1193)][n(1379)+"te"]&&this[n(1193)][n(1262)](_)}if(c){let g=s[n(1314)][n(720)];g&&m[n(262)+"rs"](g)}}let D0=async function(s,t){let n=r;this[n(275)]=!1,e[n(1303)](clearTimeout,this[n(920)+n(490)+n(1365)]),e[n(1256)](t)},k0=async function(s,t){let n=r;if(!this[n(1193)]||this[n(1193)][n(1379)+"te"]!==this[n(1339)])return e[n(817)](t);let{pingInterval:o}=this[n(952)];this[n(642)+n(1347)]?.["resetEnd"+n(196)+"fig"]();for(let l=0;e[n(950)](l,this[n(812)+"Queue"][n(1156)]);l++){let m=this[n(812)+"Queue"][l];if(this._ws.readyState===this[n(1339)]&&e[n(1157)](null,m))this[n(1193)]&&this._ws[n(1262)](m),this[n(812)+"Queue"][l]=null;else break}this[n(812)+"Queue"]=this._messageQueue.filter(l=>!!l),this[n(1170)+n(1218)+"Id"]=e[n(1153)](setTimeout,()=>this[n(1373)](),o),this[n(1319)+n(304)+"nt"](s),this._isBrowser&&this._ws&&(this[n(1193)][n(1108)+"pe"]=this["_binaryT"+n(477)]);let c=this[n(642)+n(1347)]?.[n(1100)+n(1059)+"nt"]();this[n(777)]("open "+c+" success"),e[n(807)](t)},P0=async function(s,t){let n=r,o=this["_endpoin"+n(1347)]?.[n(1100)+n(1059)+"nt"]();this._debug(n(686)+o),e[n(154)](t)};class I0 extends Vn{constructor(t){let n=r,o={BhoFW:function(g,d){return e[O(320)](g,d)},ELzHG:function(g,d){return e[O(451)](g,d)},zaTbq:function(g,d){return g===d},RvPVw:e[n(1583)],lQtbh:e[n(417)],mDvEc:function(g,d,_){return e.isLlA(g,d,_)},xDKOB:function(g,d,_,v){return e[n(1074)](g,d,_,v)},GJuEO:e[n(365)]};super(),this[n(1266)+n(243)+n(410)]=!0,this[n(531)+"er"]=ot,this._isNode=Go,this[n(305)+"T"]=Je,this._isMiniWX=vt,this[n(1422)+"r"]=St,this[n(812)+n(1312)]=[],this[n(642)+n(1347)]=null,this[n(1368)+"osed"]=!1,this["_binaryT"+n(477)]=e[n(1093)],this["_connect"+n(1073)]=!1,this[n(920)+n(490)+"utId"]=null,this[n(675)+n(688)+"tId"]=null,this._pingPongTimeoutId=null,this[n(1491)]=0,this[n(275)]=!1,this[n(471)]="",this[n(1301)+n(1264)]=null,this[n(1207)+"anager"]=null,this[n(1513)+n(783)]=null,this[n(357)+"ls"]=e[n(1119)],this[n(317)]=3,this[n(1452)+"NG"]=0,this.OPEN=1,this[n(636)]=2,this[n(1495)]=g=>{let d=n;try{e[d(1511)](fs,this,g,[D0,k0,P0])}catch(_){let v=ue(e.ktpdF,{message:_[d(1314)],code:qe[d(339)+"OR"],error:_});this[d(1319)+d(1168)+d(1522)](v)}},this[n(751)+"ge"]=async g=>{let d=n,{pingInterval:_,pingFrequency:v}=this[d(952)];if((o.BhoFW("hi",g.data)&&o[d(1582)](d(1011),v)||o[d(1346)](d(366),v))&&(this[d(715)+d(294)](),this[d(1185)](o[d(1269)],o[d(249)]),this[d(1170)+"gTimeoutId"]=o[d(213)](setTimeout,this[d(1373)].bind(this),_)),g.data!=="hi")try{o[d(368)](fs,this,g,[a0,i0,E0,A0,C0,o0])}catch(C){let k=ue(o[d(833)],{message:C.message,code:qe[d(1229)+d(955)],error:C});this[d(1319)+d(1168)+d(1522)](k)}},this._onError=g=>{let d=n,_={HEpDB:d(321),HMJyA:e[d(551)]};if(e[d(298)]!=="gJHZK"){if(!this[d(1193)])return;this["_destroy"+d(1291)+"t"](_0x131d7f,_0x30325b,_0x5a1000)}else{let v=this[d(642)+d(1347)]?.["checkRea"+d(1410)+"es"](),C=this[d(642)+d(1347)]?.[d(1100)+"ntEndpoint"]();if(v&&!g[d(1314)])if(e[d(1166)](e.snvod,d(483)))_0x2191b5[d(977)+d(597)+d(1017)](d(280),_0x534a7b),_0x3fc1d0["removeEv"+d(597)+d(1017)](OMiKCg[d(887)],_0x4c48e5),_0xfcb753[d(977)+"entListe"+d(1017)](OMiKCg[d(935)],_0x145191);else{let k=d(542)+C+(" fail, m"+d(1441)+"es reached");this[d(1319)+d(1168)+d(1522)](ue(e[d(365)],{message:k,code:qe[d(1267)+d(1445)+"R"],error:g}));return}this._ws&&e[d(1341)](this[d(1193)].readyState,this[d(1339)])&&this[d(1020)+d(1124)](),this["_dispatchErrorEv"+d(1522)](e[d(458)](ue,e.ktpdF,{message:g[d(1314)],code:qe[d(1293)+d(1475)],error:g}))}},this[n(1524)]=async g=>{let d=n;this[d(749)+d(1550)](),this._clearPingTimer(),this[d(939)+d(1102)+"rs"](),this[d(1193)]=null,this[d(920)+d(1073)]=!1;let _=this[d(642)+d(1347)]?.checkReachMaxTries();if(!_&&this[d(866)+d(372)]()&&!this["_readyCl"+d(1133)]){let v=this[d(642)+d(1347)]?.[d(1100)+"ntEndpoint"](),C=this[d(952)][d(225)+d(319)+"ptor"](g[d(603)],g[d(786)]);this[d(1319)+"hCloseEv"+d(1522)](e[d(674)](pe,e[d(994)],{code:1006,reason:g[d(786)]||d(153)+d(1237)+d(1581)+d(922)+d(352)+"ame: "+v,willReconnect:C})),C&&this[d(920)]();return}if(e.WMWJE(1e3,g[d(603)])&&this["_readyCl"+d(1133)]){this[d(1319)+d(899)+d(1522)](pe(e[d(994)],{code:1e3,reason:e.hkIDh})),this["_endpoin"+d(1347)]?.[d(1042)+d(196)+d(228)](),this[d(1513)+d(783)]?.resetCounter();return}if(e.qTfvl(1e3,g[d(603)])&&_){let v=this["_endpoin"+d(1347)]?.["getCurre"+d(1059)+"nt"](),C=g.reason;C||(C=await e.fyfOU(Qo,this._url)),C=d(153)+d(1237)+d(852)+C+(d(795)+d(665))+v+(d(1401)+"tries re"+d(1562)),this[d(1319)+d(899)+d(1522)](e[d(1258)](pe,e[d(994)],{code:g[d(603)],reason:C}));let k=d(542)+v+(" fail, m"+d(1441)+d(1525)+"ed");this[d(1319)+d(1168)+d(1522)](ue("error",{message:k,code:qe[d(1267)+d(1445)+"R"]})),this["_endpoin"+d(1347)]?.[d(1042)+"pointConfig"](),this[d(1513)+d(783)]?.[d(1388)+d(195)]();return}if(e[d(661)](1e3,g[d(603)])&&!g[d(786)]){let v=this["_endpoin"+d(1347)]?.[d(1100)+d(1059)+"nt"]();this["_dispatc"+d(899)+d(1522)](pe(e[d(994)],{code:g.code,reason:"connecti"+d(1237)+d(1581)+d(922)+d(352)+"ame: "+v})),this["_endpoin"+d(1347)]?.resetEndpointConfig(),this[d(1513)+d(783)]?.[d(1388)+d(195)]();return}this["_dispatc"+d(899)+"ent"](g),this[d(642)+d(1347)]?.[d(1042)+"pointCon"+d(228)](),this["_pingLos"+d(783)]?.[d(1388)+d(195)]()},this[n(884)]=null,this[n(802)]=null,this.onmessage=null,this[n(607)]=null,this[n(1469)+"econnect"]=null,this[n(683)+n(1400)]=null,this[n(844)+n(407)+n(1390)+"ct"]=null,this[n(141)+n(1050)]=this[n(141)+n(1050)][n(433)](this),this._handleOffLine=this[n(141)+n(482)].bind(this),this[n(502)+n(330)]=this[n(502)+n(330)][n(433)](this),this._handlePageShow=this[n(502)+n(658)].bind(this),this._options={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:1/0,service:0,logIDGenerator:x,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1212)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e[n(260)],env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:l}=t,m=Array[n(623)](c)?c:e[n(411)](e[n(159)],typeof c)?[c]:[];if(!m||e[n(1573)](0,m[n(1156)]))throw new Error(e[n(609)]);if(!e[n(424)](Yo,l))throw new Error("please p"+n(188)+"s params, WebSoc"+n(893)+n(434)+n(569)+n(911));Object[n(1300)](this._options,t),this[n(642)+"tManager"]=new cs(m,this._options.maxRetries),this[n(1513)+"sCounter"]=new Zo(this[n(952)][n(509)+n(359)]),this[n(952)]["automati"+n(180)]&&(e[n(489)](e[n(344)],e.NEkhN)?(this[n(256)]=!0,this[n(1424)]=e[n(1250)](0,_0x29587b),this.high=0|_0x4d9676,this[n(1062)]=!!_0x256f7c):(this[n(275)]=!0,this[n(920)]())),this[n(952)]["listenNe"+n(362)+n(1243)]&&(this[n(305)+"T"]||this._isMiniWX?this[n(1175)+n(388)+n(1503)]():this[n(531)+"er"]&&this[n(498)+"balEvent"+n(1499)]())}["_handleO"+r(1050)](){let t=r;this[t(952)][t(590)+t(1172)+t(1150)]||this["_readyCl"+t(1133)]||this["_handleR"+t(895)]()}[r(141)+r(482)](){let t=r;this[t(464)+t(1291)+"t"]();let n=e[t(745)](Jn,t(225)+"t",{message:e[t(116)]});this["onStopIm"+t(407)+t(1390)+"ct"]&&this[t(844)+"mediatelyReconnect"](n)}[r(498)+"balEventListener"](){let t=r;this[t(531)+"er"]&&window["addEvent"+t(1499)](e[t(537)],this[t(141)+t(1050)]),this[t(531)+"er"]&&window["addEvent"+t(1499)](e[t(1188)],this[t(141)+"ffLine"]),this[t(531)+"er"]&&window[t(727)+t(1499)](e[t(814)],this[t(502)+t(330)]),this._isBrowser&&window[t(727)+t(1499)](e.BagOO,this[t(502)+t(658)])}[r(901)+r(1178)+r(1499)](){let t=r;this._isBrowser&&window["removeEv"+t(597)+t(1017)](e[t(537)],this["_handleO"+t(1050)]),this[t(531)+"er"]&&window[t(977)+t(597)+"ner"](e.QYtdJ,this[t(141)+t(482)]),this[t(531)+"er"]&&window["removeEv"+t(597)+"ner"](e[t(814)],this[t(502)+t(330)]),this._isBrowser&&window[t(977)+t(597)+"ner"](e[t(408)],this[t(502)+t(658)])}[r(502)+r(330)](t){let n=r,o={ERHKd:function(c,l){return e[O(364)](c,l)}};if(e.hwtBB===e.ZBWiE){let c=this[n(1260)]["getStora"+n(1487)+"nc"](this._prefix),l=_0x382180[n(677)](YsKhLA[n(1321)](c,"{}"));return _0x319571[n(1311)](l)}else!t.persisted&&(this[n(531)+"er"]&&window[n(977)+"entListe"+n(1017)](e[n(814)],this[n(502)+"ageHide"]),this[n(531)+"er"]&&window[n(977)+n(597)+n(1017)](e[n(408)],this[n(502)+"ageShow"]),this[n(476)]()),this._isBrowser&&window[n(977)+n(597)+n(1017)](e[n(537)],this[n(141)+n(1050)]),this._isBrowser&&window[n(977)+n(597)+"ner"]("offline",this[n(141)+"ffLine"])}_handlePageShow(t){let n=r;n(1131)===e[n(230)]?_0x5852de.o=(o,c)=>_0x5dc92f[n(257)+"e"]["hasOwnPr"+n(418)][n(480)](o,c):t[n(268)+"d"]&&(this[n(866)+n(372)]()&&(!this[n(1193)]||e[n(1095)](this[n(1193)][n(1379)+"te"],this[n(1339)])||e[n(1199)](this[n(1193)][n(1379)+"te"],this[n(1452)+"NG"]))&&this[n(141)+"nLine"](),this[n(531)+"er"]&&window.addEventListener(n(584),this[n(141)+n(1050)]),this[n(531)+"er"]&&window[n(727)+n(1499)](e[n(1188)],this._handleOffLine))}async[r(1492)+r(338)](t){let n=r,{fpID:o,deviceID:c,bddID:l,ttwID:m,accessKey:g,aID:d,customParams:_={},enableAutoAck:v,enableQoS:C,QoSLevel:k,env:R}=this[n(952)],B,Y,me;this[n(531)+"er"]||this[n(1197)+"X"]||this._isMiniTT?(B=location&&e[n(838)]("https:",location[n(986)])?e.aeivL:n(702),Y=t[n(211)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),me=/^wss(.*:\/\/)/[n(1215)](t)?t:""+B+Y):e[n(961)](n(255),e[n(870)])?_0x35bac5=_0x2e8c62(_0x4e82cc):(B=e[n(377)],Y=t[n(211)](/(^http)((?:[s]*:\/\/))/,""),me=/(^ws)((?:[s]*:\/\/))/[n(1215)](Y)?Y:""+B+Y);let X=l?e[n(1534)]:m?e[n(1460)]:e[n(363)],qt=l||m||c;if(e[n(869)](!qt,!X))throw new Error(e.mKLww);let tr=e.crQIo(e[n(725)],typeof _)?await e[n(807)](_):_,nr=R?e[n(1454)]($o,R[n(843)],R[n(1462)]):{},rr=Object.assign({device_platform:"web",version_code:e[n(845)],access_key:g,fpid:o,aid:d,[X]:qt,xsack:v?1:0,xaack:v?1:0,xsqos:C?1:0,qos_level:C?k:void 0,qos_sdk_version:2,...nr},tr),T0=Object[n(1311)](rr)[n(633)]((sr,ir)=>rr[ir]!==void 0?""+sr+(sr?"&":"?")+ir+"="+rr[ir]:sr,"");return me+n(466)+T0}async[r(920)](){let t=r;if(!(this[t(920)+"Lock"]||this[t(1368)+"osed"])){this[t(920)+t(1073)]=!0;try{let n=this["_endpoin"+t(1347)]?.[t(791)+t(839)+t(1377)+t(1217)+t(710)](),{timeoutInterval:o}=this._options;if(n){let l=this[t(642)+"tManager"]?.["getCurre"+t(1059)+"nt"](),m=this[t(642)+t(1347)]?.[t(787)+t(302)+t(431)+"UpdateCo"+t(660)](),g=this[t(642)+t(1347)]?.[t(1100)+t(1059)+t(300)+t(1322)]();if(m){let d=t(542)+l+(t(680)+", max retries re"+t(1484)+t(1231)+t(1135)+t(942))+m+" to retry",_=e[t(384)](ue,e[t(365)],{message:d,code:qe[t(1267)+t(1445)+"R"]});this[t(777)](d),this[t(1319)+t(1168)+t(1522)](_),this[t(471)]=await this[t(1492)+t(338)](m),this[t(777)](t(542)+m+" "+g+t(1580)),this[t(939)+t(1102)+"rs"]()}else{let d=t(542)+l+(" timeout, max retries re"+t(1562));this[t(777)](d),this[t(1319)+t(1168)+t(1522)](e[t(877)](ue,e[t(365)],{message:d,code:qe.MAX_RETRIES_ERROR}));return}}else{let l=this["_endpoin"+t(1347)]?.["getCurre"+t(1059)+t(775)+t(251)](),m=this[t(642)+t(1347)]?.[t(1100)+t(1059)+t(300)+t(1322)]();this[t(471)]=await this[t(1492)+"eUrl"](e.VQhGy(l,"")),this[t(777)](t(542)+l+" "+m+t(1580)),this[t(939)+t(1102)+"rs"]()}if(this[t(275)])this[t(275)]=!1;else{let l=e.oBXox(Jn,e.QJDCy,{message:e[t(705)]});this[t(1469)+"econnect"]&&this[t(1469)+t(895)](l)}let c=this["_endpoin"+t(1347)]?.["getCurre"+t(1059)+t(300)+t(1322)]()||0;e.VKFbe(c,1)&&await this[t(568)](c-1),this[t(777)](t(153)+t(1555)+this[t(471)]+(t(343)+"ls: ")+this._protocols),this._ws=e[t(512)](Vo,{url:this[t(471)],protocols:[this[t(357)+"ls"]],headers:this[t(952)]["miniProg"+t(1136)+"s"][t(475)+t(1235)]},this._options.ws),(this._isBrowser||this[t(1422)+"r"])&&this[t(1193)]&&(this._ws[t(1108)+"pe"]=this._binaryType),this._addWsListeners(),this[t(920)+t(490)+t(1365)]=setTimeout(this[t(443)+"ut"][t(433)](this),o)}catch(n){if(e[t(332)]!=="VUvkE")throw this[t(920)+t(1073)]=!1,n;{let o=0,c=0,l;do l=_0x5296f6(_0x3f4804),e[t(1402)](o,32)&&(c|=e.UyPUM(e[t(227)](127,l),o)),o+=7;while(128&l);return c}}}}[r(749)+"mer"](){let t=r;e[t(1066)](clearTimeout,this[t(920)+"ionTimeoutId"]),this[t(920)+t(490)+"utId"]=null}[r(715)+r(294)](){let t=r;e[t(679)](clearTimeout,this[t(1170)+t(1218)+"Id"]),e[t(965)](clearTimeout,this[t(675)+"ctTimeou"+t(1351)]),this[t(1170)+t(1218)+"Id"]=null,this[t(675)+t(688)+t(1351)]=null}[r(777)](...t){let n=r;this._options[n(390)]&&console[n(719)][n(1232)](console,[e.DbyXO,...t])}_getIntervalValue(t){let n=r,{initReconnectInterval:o,maxReconnectInterval:c,reconnectIntervalGrowFactor:l}=this._options,m=e[n(653)](o,Math[n(731)](l,e[n(1418)](t,1)));return e[n(1134)](m,c)?c:m}[r(1373)](){let t=r;if(this[t(1193)]&&e[t(1278)](this._ws[t(1379)+"te"],this[t(1452)+"NG"])){this[t(715)+"ngTimer"](),this[t(1170)+t(1218)+"Id"]=e[t(745)](setTimeout,this[t(1373)][t(433)](this),this[t(952)][t(685)+t(1140)]);return}if(!this[t(1193)]||e[t(200)](this[t(1193)].readyState,this[t(1339)]))return void this[t(1342)+t(895)]();this[t(1193)]&&this._ws[t(1262)]("hi"),this[t(675)+t(688)+t(1351)]=setTimeout(this[t(1342)+t(895)+t(589)][t(433)](this),this[t(952)][t(278)+t(998)+t(447)])}[r(1342)+r(895)+"Timeout"](){let t=r;this[t(1513)+t(783)]?.[t(1504)](),this[t(1185)](t(1537)+t(307)+"t",t(1466)),this[t(1513)+t(783)]?.[t(1244)+t(550)+"nt"]()?this[t(1342)+t(895)]():this[t(1373)]()}[r(866)+"orOnline"](){let t=r;return this[t(305)+"T"]||this[t(1197)+"X"]?this[t(1266)+t(243)+"line"]:(this[t(531)+"er"]||this[t(1422)+"r"])&&this[t(952)]["listenNetworkCha"+t(1243)]?navigator[t(557)]:!0}[r(1342)+r(895)](){let t=r;!this[t(866)+t(372)]()||this[t(1368)+"osed"]||(this[t(642)+t(1347)]?.[t(1042)+t(196)+t(228)](),this[t(1513)+t(783)]?.[t(1388)+t(195)](),this._ws?this[t(1020)+t(1124)](1001,e[t(789)],!0):this[t(920)]())}[r(1175)+r(388)+r(1503)](){let t=r;this._isMiniTT?tt[t(1507)+t(794)+t(823)](({isConnected:n})=>{let o=t;this[o(1266)+o(243)+o(410)]=n,n?this[o(141)+"nLine"]():this[o(141)+"ffLine"]()}):this[t(1197)+"X"]&&wx["onNetwor"+t(794)+t(823)](({isConnected:n})=>{let o=t;this[o(1266)+o(243)+"line"]=n,n?this[o(141)+o(1050)]():this["_handleO"+o(482)]()})}[r(568)](t){return new Promise(n=>{let o=O;e.PJtRQ(setTimeout,n,this["_getInte"+o(1049)+"e"](t))})}[r(1020)+"ect"](t=1e3,n="",o=!1){let c=r;this._ws&&this[c(464)+c(1291)+"t"](t,n,o)}[r(443)+"ut"](){let t=r,n=this[t(642)+t(1347)]?.[t(1100)+t(1059)+"nt"]();this._debug("connect "+n+t(680)),this[t(1020)+t(1124)](1001,t(1313)+t(281)+t(379)+"g",!0)}[r(1530)](t){let n=r,o=e[n(906)](Gn,t);this[n(1193)]&&e.rTbWn(this[n(1193)].readyState,this[n(1339)])&&(this[n(1193)]&&this[n(1193)][n(1262)](o),this._debug(n(1538),t))}[r(939)+r(1102)+"rs"](){let t=r,n=e[t(1518)][t(1219)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(1193)][t(977)+t(597)+t(1017)](e[t(994)],this[t(1524)]);continue;case"1":this[t(1193)][t(977)+t(597)+t(1017)](e[t(967)],this._onMessage);continue;case"2":this[t(1193)]["removeEventListe"+t(1017)](e[t(820)],this[t(1495)]);continue;case"3":this[t(1193)]["removeEv"+t(597)+t(1017)](e[t(365)],this[t(430)]);continue;case"4":if(!this[t(1193)])return;continue}break}}[r(470)+r(1139)](){let t=r,n=e.GcewK[t(1219)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(1193)]["addEvent"+t(1499)](t(321),this[t(430)]);continue;case"1":if(!this._ws)return;continue;case"2":this._ws[t(727)+t(1499)](e.BUcZO,this._onClose);continue;case"3":this[t(1193)][t(727)+t(1499)](e[t(820)],this[t(1495)]);continue;case"4":this[t(1193)].addEventListener(t(1314),this[t(751)+"ge"]);continue}break}}[r(485)+r(617)](t=1e3,n=""){let o=r;try{this[o(1193)]&&this[o(1193)][o(476)](t,n)}catch{}}[r(464)+r(1291)+"t"](t=1e3,n="",o=!1){let c=r,l={dBVuu:function(m,g){return e[O(806)](m,g)},lwLWb:function(m,g){return e[O(1145)](m,g)},Taqnu:function(m,g){return e[O(1591)](m,g)},hcmkD:function(m,g){return e.vmmTy(m,g)},GJKZc:function(m,g){return e[O(897)](m,g)}};if(e.VaYat(e[c(510)],e[c(510)]))return _0x2b6922[c(256)](_0x1d58ce)||(_0x11b0dc=_0x15509f[c(919)+"er"](_0x3740ec)),YynwxH[c(1517)](this[c(1062)],_0x10eaa4[c(1062)])&&YynwxH.lwLWb(this.high,31)===1&&YynwxH[c(1034)](YynwxH[c(1065)](_0x5ed381[c(1023)],31),1)?!1:YynwxH[c(974)](this[c(1023)],_0x5c5b77[c(1023)])&&YynwxH[c(974)](this[c(1424)],_0x10f431.low);if(this[c(715)+c(294)](),this[c(749)+"mer"](),this[c(939)+c(1102)+"rs"](),this[c(485)+c(617)](1e3,n),this[c(920)+c(1073)]=!1,o&&this["_navigat"+c(372)]()&&!this._readyClosed){if(this[c(642)+"tManager"]?.[c(1244)+c(1410)+"es"]()){let g=this._endpointManager?.[c(1100)+c(1059)+"nt"]();this[c(1319)+c(899)+"ent"](e[c(1213)](pe,e[c(994)],{code:1006,reason:"connect "+g+(" timeout"+c(1401)+c(799)+c(1562)),wasClean:!0}))}else{let g=this[c(952)]["reconnec"+c(319)+c(1201)](t,n);this[c(1319)+c(899)+c(1522)](pe(c(476),{code:t,reason:n,wasClean:!0,willReconnect:g})),g&&this[c(920)]()}return}this[c(866)+c(372)]()||this[c(1368)+"osed"]?this[c(1319)+c(899)+c(1522)](e.UjdPQ(pe,e[c(994)],{code:t,reason:e[c(928)]})):this["_dispatc"+c(899)+c(1522)](e[c(1213)](pe,e.BUcZO,{code:1006,reason:c(966)+c(902)+c(1079)+c(217)})),this[c(1193)]=null,this[c(642)+c(1347)]?.[c(1042)+c(196)+c(228)](),this[c(1513)+"sCounter"]?.[c(1388)+c(195)]()}[r(1319)+r(304)+"nt"](t){let n=r;this.emit(e.qLPbW,t),this[n(607)]&&this[n(607)](t)}[r(1319)+r(1031)+r(1158)](t){let n=r;this[n(1185)](e[n(967)],t),this[n(1109)+"e"]&&this.onmessage(t)}["_dispatc"+r(1214)+r(143)](t){let n=r;this[n(1185)](e[n(1334)],t),this[n(683)+n(1400)]&&this[n(683)+n(1400)](t)}[r(1319)+r(1168)+r(1522)](t){let n=r;this[n(1185)](e.ktpdF,t),this.onerror&&this[n(802)](t)}[r(1319)+"hCloseEvent"](t){let n=r;this.emit(e[n(994)],t),this[n(884)]&&this[n(884)](t)}get[r(1108)+"pe"](){let t=r;return this[t(1193)]?this[t(1193)][t(1108)+"pe"]:this[t(1016)+"ype"]}set[r(1108)+"pe"](t){let n=r;this._binaryType=t,this[n(1193)]&&(this[n(1193)][n(1108)+"pe"]=t)}get[r(694)+"nt"](){let t=r;return this[t(642)+t(1347)]?.[t(1100)+t(1059)+"ntTriesC"+t(1322)]()||0}get[r(1540)+r(605)](){let t=r;if(e[t(761)](e[t(187)],e[t(709)]))_0x58d74b(this,_0x2a8236,[_0x3ce2f0,_0x3ef5a5,_0x272a33,_0x391372,_0x270af3,_0x5779a3]);else return this[t(812)+t(1312)][t(633)]((o,c)=>(o+=c&&c[t(742)+"th"]||0,o),0)+(this._ws?this._ws["buffered"+t(605)]:0)}get[r(774)+"ns"](){let t=r;return this[t(1193)]?this[t(1193)][t(774)+"ns"]:""}get[r(986)](){let t=r;if(e[t(690)]!=="hQkOi")return this[t(1193)]?this._ws[t(986)]:"";gbTWjn.oPAen(_0x5d0de7,gbTWjn[t(583)](_0x3aefeb,_0x4ae884[t(1147)]),_0x1b08b3[t(540)+"on"],_0x156746.newVersion,gbTWjn[t(1302)](_0x2429cd,_0x1ea85b[t(400)+t(1490)]))}get[r(1379)+"te"](){let t=r;return this[t(1193)]?this[t(1193)][t(1379)+"te"]:this[t(952)].automaticOpen?this.CONNECTING:this.CLOSED}get[r(215)](){let t=r;return this[t(1193)]?this[t(1193)][t(215)]:this._url}[r(476)](t=1e3,n){let o=r,c=e[o(632)][o(1219)]("|"),l=0;for(;;){switch(c[l++]){case"0":this[o(464)+o(1291)+"t"](t,n);continue;case"1":this["_readyCl"+o(1133)]=!0;continue;case"2":if(!this[o(1193)])return void this._debug(e[o(1268)]);continue;case"3":this[o(749)+o(1550)]();continue;case"4":this[o(1301)+o(1264)]?.closeDB();continue;case"5":if(e[o(1081)](this[o(1193)].readyState,this[o(317)])||e[o(1254)](this[o(1193)][o(1379)+"te"],this[o(636)]))return void this[o(777)](e[o(1054)]);continue;case"6":this._clearPingTimer();continue;case"7":this[o(901)+o(1178)+o(1499)]();continue}break}}async send(t,n){let o=r;if(e[o(760)](null,t))throw new Error(e[o(1137)]);e[o(760)](e[o(1051)],typeof t)&&(t=JSON[o(1227)+"y"](t)),e[o(234)](o(668),typeof t)&&!e[o(654)](t,ArrayBuffer)&&!(t[o(1060)]&&t[o(1060)]instanceof ArrayBuffer)&&(t=JSON[o(1227)+"y"](t));let c=await e.FCUmJ(ls,t),l=Xo(t),{method:m=0,service:g=this[o(952)][o(1543)],logID:d=this._options["logIDGen"+o(932)](),headers:_=this[o(952)][o(1437)],payloadEncoding:v=this[o(952)][o(943)+o(534)],payloadType:C=this[o(952)][o(1387)+o(477)],logIDNew:k=this._options[o(1570)+o(813)]["enableAu"+o(957)+o(1435)+"ew"]?e[o(862)](a,this[o(952)][o(1570)+o(813)].userIp):""}=e.MwLqq(n,{});if(!g)throw new Error(e[o(864)]);let R={SeqID:M.fromNumber(this[o(1491)]++),LogID:M.fromNumber(d),service:g,method:m,headers:_,payloadEncoding:v instanceof Object?v[o(1286)]?v[o(1286)]:"":v,payloadType:e[o(654)](C,Object)?C[o(523)]?C.type:l:C||l,payload:c,LogIDNew:k},B=e[o(1263)](Gn,R);return this[o(1193)]&&e[o(515)](this[o(1193)][o(1379)+"te"],this[o(1339)])?(this._ws&&this[o(1193)][o(1262)](B),this[o(777)](o(115),R)):e[o(964)](this[o(812)+o(1312)][o(1156)],this[o(952)]["maxMessa"+o(429)+"ength"])?e.zzCxJ(e[o(798)],e[o(284)])?(_0x4e2ae5[o(977)+o(597)+"ner"](o(516),_0x14e3dc),_0x32e19b[o(977)+o(597)+o(1017)](gbTWjn[o(365)],_0x62062f)):(this._messageQueue.push(B),this[o(777)](e.jynSk,R)):e[o(1571)](o(979),e.cCpqm)?gbTWjn[o(1353)](_0x18515b,_0x3d7e33)&&_0x18eae5[o(1474)](_0x3d09a2,_0x522aba):(this._messageQueue[o(389)](),this[o(812)+o(1312)][o(157)](B)),{seqID:this[o(1491)],logID:d,logIDNew:k}}async[r(225)+"t"](t){let n=r;if(e[n(892)]!==n(419)){let o={hKmgI:function(c,l){return c(l)}};return function(c,...l){let m=n,g=_0x5519c9.call(o[m(1280)](_0x490b5c,this),c,...l);return _0x14b218.set(g,c[m(608)]?c[m(608)]():[c]),o.hKmgI(_0x9586b,g)}}else{let{url:o}=e.wydLk(t,{}),c=Array[n(623)](o)?o:e[n(838)](n(668),typeof o)?[o]:[];t&&Object[n(1300)](this._options,t),c&&c[n(1156)]?this[n(642)+n(1347)]=new cs(c,this[n(952)][n(1142)+"es"]):this["_endpoin"+n(1347)]?.[n(1042)+n(196)+"fig"](),this[n(1513)+n(783)]?.["resetCou"+n(195)](this[n(952)]["pingLoss"+n(359)]),this["_readyCl"+n(1133)]=!1,this[n(1193)]&&this._ws.readyState!==this[n(317)]?this[n(1020)+n(1124)](1e3,e[n(254)],!0):(this._isInit=!0,this[n(920)]())}}async[r(219)](){let t=r;if(!this._connectLock){let n=e[t(560)][t(1219)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(275)]=!0;continue;case"1":this["_pingLos"+t(783)]?.resetCounter();continue;case"2":this._connect();continue;case"3":this[t(1368)+t(1133)]=!1;continue;case"4":this[t(642)+t(1347)]?.[t(1042)+t(196)+t(228)]();continue}break}}}[r(727)+r(1499)](t,n){this.on(t,n)}[r(904)+"Event"](t){let n=r,{type:o}=t;this[n(1185)](o,t)}[r(977)+r(597)+r(1017)](t,n){this.off(t,n)}[r(781)](){let t=r,n={nqvcA:function(o,c){return e[O(739)](o,c)},gkpHw:t(1466),tnRhM:t(1537)+t(474)+"s",LEPlD:e.SwNin,XnMKf:function(o,c,l){return o(c,l)},KmPet:e.nNupb};return new Promise((o,c)=>{let l=t,m={ioqtT:function(_,v){return n[O(1391)](_,v)},pCxAb:n.LEPlD,HCKmV:"ping_onc"+l(474)+"s"};this._clearPingTimer(),this[l(1170)+l(1218)+"Id"]=n[l(1572)](setTimeout,this._ping.bind(this),this[l(952)][l(685)+"rval"]);let g=()=>{let _=l;m.ioqtT(o,m[_(755)]),this[_(985)](m[_(637)],g),this[_(985)](_(1537)+_(307)+"t",d)},d=()=>{let _=l;n[_(1391)](c,n[_(501)]),this.off(n[_(1536)],g),this.off(_(1537)+_(307)+"t",d)};this.on(n[l(1536)],g),this.on(n[l(1072)],d),this[l(1373)]()})}}})(),N[S(1320)+S(310)]=V[S(1320)+S(310)],N["CustomEr"+S(1541)]=V[S(1206)+S(1541)],N[S(210)+"e"]=V[S(210)+"e"],N[S(1158)]=V[S(1158)],N.FWS=V[S(830)],N[S(1510)+S(223)+S(1546)]=V[S(1510)+S(223)+S(1546)],N[S(223)+"vent"]=V["MessageE"+S(1546)],N.OpenEvent=V[S(1122)+"t"],N["Reconnec"+S(269)]=V.ReconnectEvent,N[S(982)+S(310)]=V.createCloseEvent,N[S(578)+S(1541)]=V.createErrorEvent,N[S(194)+"ssageEvent"]=V[S(194)+S(1010)+"nt"],N["createOp"+S(449)]=V[S(197)+S(449)],N[S(184)+"connectE"+S(1546)]=V[S(184)+S(582)+S(1546)],N.decodedFrame=V[S(1075)+S(1498)],N[S(1106)+S(517)]=V["encodeFr"+S(517)];for(ln in V)["CustomCl"+S(310),S(1206)+S(1541),S(210)+"e",S(1158),S(830),S(1510)+S(223)+S(1546),S(223)+S(1546),S(1122)+"t","Reconnec"+S(269),S(982)+S(310),S(578)+S(1541),"createMe"+S(1010)+"nt","createOp"+S(449),S(184)+"connectE"+S(1546),"decodedF"+S(1498),S(1106)+S(517)].indexOf(ln)===-1&&(N[ln]=V[ln]);var ln;Object[S(1148)+S(418)](N,S(621)+"le",{value:!0})});var Ne=oe((Vd,ci)=>{"use strict";var ai=["nodebuffer","arraybuffer","fragments"],xi=typeof Blob<"u";xi&&ai.push("blob");ci.exports={BINARY_TYPES:ai,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:xi,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Pt=oe((Yd,yn)=>{"use strict";var{EMPTY_BUFFER:lx}=Ne(),gr=Buffer[Symbol.species];function hx(r,e){if(r.length===0)return lx;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let x=0;x<r.length;x++){let f=r[x];i.set(f,a),a+=f.length}return a<e?new gr(i.buffer,i.byteOffset,a):i}function fi(r,e,i,a,x){for(let f=0;f<x;f++)i[a+f]=r[f]^e[f&3]}function ui(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function gx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function pr(r){if(pr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new gr(r):ArrayBuffer.isView(r)?e=new gr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),pr.readOnly=!1),e}yn.exports={concat:hx,mask:fi,toArrayBuffer:gx,toBuffer:pr,unmask:ui};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=J("bufferutil");yn.exports.mask=function(e,i,a,x,f){f<48?fi(e,i,a,x,f):r.mask(e,i,a,x,f)},yn.exports.unmask=function(e,i){e.length<32?ui(e,i):r.unmask(e,i)}}catch{}});var hi=oe((Xd,li)=>{"use strict";var di=Symbol("kDone"),mr=Symbol("kRun"),wr=class{constructor(e){this[di]=()=>{this.pending--,this[mr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[mr]()}[mr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[di])}}};li.exports=wr});var ht=oe(($d,wi)=>{"use strict";var It=J("zlib"),gi=Pt(),px=hi(),{kStatusCode:pi}=Ne(),mx=Buffer[Symbol.species],_x=Buffer.from([0,0,255,255]),vn=Symbol("permessage-deflate"),Oe=Symbol("total-length"),dt=Symbol("callback"),He=Symbol("buffers"),lt=Symbol("error"),bn,_r=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!bn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;bn=new px(i)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[dt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let i=this._options,a=e.find(x=>!(i.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>x.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return i.serverNoContextTakeover&&(a.server_no_context_takeover=!0),i.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof i.serverMaxWindowBits=="number"&&(a.server_max_window_bits=i.serverMaxWindowBits),typeof i.clientMaxWindowBits=="number"?a.client_max_window_bits=i.clientMaxWindowBits:(a.client_max_window_bits===!0||i.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let i=e[0];if(this._options.clientNoContextTakeover===!1&&i.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!i.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(i.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&i.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return i}normalizeParams(e){return e.forEach(i=>{Object.keys(i).forEach(a=>{let x=i[a];if(x.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(x=x[0],a==="client_max_window_bits"){if(x!==!0){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(x!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else throw new Error(`Unknown parameter "${a}"`);i[a]=x})}),e}decompress(e,i,a){bn.add(x=>{this._decompress(e,i,(f,u)=>{x(),a(f,u)})})}compress(e,i,a){bn.add(x=>{this._compress(e,i,(f,u)=>{x(),a(f,u)})})}_decompress(e,i,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,u=typeof this.params[f]!="number"?It.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=It.createInflateRaw({...this._options.zlibInflateOptions,windowBits:u}),this._inflate[vn]=this,this._inflate[Oe]=0,this._inflate[He]=[],this._inflate.on("error",bx),this._inflate.on("data",mi)}this._inflate[dt]=a,this._inflate.write(e),i&&this._inflate.write(_x),this._inflate.flush(()=>{let f=this._inflate[lt];if(f){this._inflate.close(),this._inflate=null,a(f);return}let u=gi.concat(this._inflate[He],this._inflate[Oe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Oe]=0,this._inflate[He]=[],i&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,u)})}_compress(e,i,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,u=typeof this.params[f]!="number"?It.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=It.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:u}),this._deflate[Oe]=0,this._deflate[He]=[],this._deflate.on("data",yx)}this._deflate[dt]=a,this._deflate.write(e),this._deflate.flush(It.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=gi.concat(this._deflate[He],this._deflate[Oe]);i&&(f=new mx(f.buffer,f.byteOffset,f.length-4)),this._deflate[dt]=null,this._deflate[Oe]=0,this._deflate[He]=[],i&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};wi.exports=_r;function yx(r){this[He].push(r),this[Oe]+=r.length}function mi(r){if(this[Oe]+=r.length,this[vn]._maxPayload<1||this[Oe]<=this[vn]._maxPayload){this[He].push(r);return}this[lt]=new RangeError("Max payload size exceeded"),this[lt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[lt][pi]=1009,this.removeListener("data",mi),this.reset()}function bx(r){if(this[vn]._inflate=null,this[lt]){this[dt](this[lt]);return}r[pi]=1007,this[dt](r)}});var gt=oe((Zd,Sn)=>{"use strict";var{isUtf8:_i}=J("buffer"),{hasBlob:vx}=Ne(),Sx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Cx(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function yr(r){let e=r.length,i=0;for(;i<e;)if((r[i]&128)===0)i++;else if((r[i]&224)===192){if(i+1===e||(r[i+1]&192)!==128||(r[i]&254)===192)return!1;i+=2}else if((r[i]&240)===224){if(i+2>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||r[i]===224&&(r[i+1]&224)===128||r[i]===237&&(r[i+1]&224)===160)return!1;i+=3}else if((r[i]&248)===240){if(i+3>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||(r[i+3]&192)!==128||r[i]===240&&(r[i+1]&240)===128||r[i]===244&&r[i+1]>143||r[i]>244)return!1;i+=4}else return!1;return!0}function Ex(r){return vx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}Sn.exports={isBlob:Ex,isValidStatusCode:Cx,isValidUTF8:yr,tokenChars:Sx};if(_i)Sn.exports.isValidUTF8=function(r){return r.length<24?yr(r):_i(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=J("utf-8-validate");Sn.exports.isValidUTF8=function(e){return e.length<32?yr(e):r(e)}}catch{}});var Er=oe((Qd,Ai)=>{"use strict";var{Writable:Ax}=J("stream"),yi=ht(),{BINARY_TYPES:Dx,EMPTY_BUFFER:bi,kStatusCode:kx,kWebSocket:Px}=Ne(),{concat:br,toArrayBuffer:Ix,unmask:Tx}=Pt(),{isValidStatusCode:Lx,isValidUTF8:vi}=gt(),Cn=Buffer[Symbol.species],le=0,Si=1,Ci=2,Ei=3,vr=4,Sr=5,En=6,Cr=class extends Ax{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Dx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Px]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=le}_write(e,i,a){if(this._opcode===8&&this._state==le)return a();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(a)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let a=this._buffers[0];return this._buffers[0]=new Cn(a.buffer,a.byteOffset+e,a.length-e),new Cn(a.buffer,a.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let a=this._buffers[0],x=i.length-e;e>=a.length?i.set(this._buffers.shift(),x):(i.set(new Uint8Array(a.buffer,a.byteOffset,e),x),this._buffers[0]=new Cn(a.buffer,a.byteOffset+e,a.length-e)),e-=a.length}while(e>0);return i}startLoop(e){this._loop=!0;do switch(this._state){case le:this.getInfo(e);break;case Si:this.getPayloadLength16(e);break;case Ci:this.getPayloadLength64(e);break;case Ei:this.getMask();break;case vr:this.getData(e);break;case Sr:case En:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let i=this.consume(2);if((i[0]&48)!==0){let x=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(x);return}let a=(i[0]&64)===64;if(a&&!this._extensions[yi.extensionName]){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._fin=(i[0]&128)===128,this._opcode=i[0]&15,this._payloadLength=i[1]&127,this._opcode===0){if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(!this._fragmented){let x=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let x=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(x);return}if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let x=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(x);return}}else{let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(i[1]&128)===128,this._isServer){if(!this._masked){let x=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(x);return}}else if(this._masked){let x=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(x);return}this._payloadLength===126?this._state=Si:this._payloadLength===127?this._state=Ci:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let i=this.consume(8),a=i.readUInt32BE(0);if(a>Math.pow(2,21)-1){let x=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(x);return}this._payloadLength=a*Math.pow(2,32)+i.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(i);return}this._masked?this._state=Ei:this._state=vr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=vr}getData(e){let i=bi;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}i=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&Tx(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=Sr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[yi.extensionName].decompress(e,this._fin,(x,f)=>{if(x)return i(x);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let u=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(u);return}this._fragments.push(f)}this.dataMessage(i),this._state===le&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=le;return}let i=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let x;this._binaryType==="nodebuffer"?x=br(a,i):this._binaryType==="arraybuffer"?x=Ix(br(a,i)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=le):(this._state=En,setImmediate(()=>{this.emit("message",x,!0),this._state=le,this.startLoop(e)}))}else{let x=br(a,i);if(!this._skipUTF8Validation&&!vi(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===Sr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=le):(this._state=En,setImmediate(()=>{this.emit("message",x,!1),this._state=le,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,bi),this.end();else{let a=e.readUInt16BE(0);if(!Lx(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(f);return}let x=new Cn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!vi(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(f);return}this._loop=!1,this.emit("conclude",a,x),this.end()}this._state=le;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=le):(this._state=En,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=le,this.startLoop(i)}))}createError(e,i,a,x,f){this._loop=!1,this._errored=!0;let u=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(u,this.createError),u.code=f,u[kx]=x,u}};Ai.exports=Cr});var kr=oe((tl,Pi)=>{"use strict";var{Duplex:el}=J("stream"),{randomFillSync:Nx}=J("crypto"),Di=ht(),{EMPTY_BUFFER:Ox,kWebSocket:Bx,NOOP:Rx}=Ne(),{isBlob:pt,isValidStatusCode:Mx}=gt(),{mask:ki,toBuffer:$e}=Pt(),he=Symbol("kByteLength"),zx=Buffer.alloc(4),An=8*1024,Ze,mt=An,we=0,qx=1,Fx=2,Ar=class r{constructor(e,i,a){this._extensions=i||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=we,this.onerror=Rx,this[Bx]=void 0}static frame(e,i){let a,x=!1,f=2,u=!1;i.mask&&(a=i.maskBuffer||zx,i.generateMask?i.generateMask(a):(mt===An&&(Ze===void 0&&(Ze=Buffer.alloc(An)),Nx(Ze,0,An),mt=0),a[0]=Ze[mt++],a[1]=Ze[mt++],a[2]=Ze[mt++],a[3]=Ze[mt++]),u=(a[0]|a[1]|a[2]|a[3])===0,f=6);let h;typeof e=="string"?(!i.mask||u)&&i[he]!==void 0?h=i[he]:(e=Buffer.from(e),h=e.length):(h=e.length,x=i.mask&&i.readOnly&&!u);let p=h;h>=65536?(f+=8,p=127):h>125&&(f+=2,p=126);let w=Buffer.allocUnsafe(x?h+f:f);return w[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(w[0]|=64),w[1]=p,p===126?w.writeUInt16BE(h,2):p===127&&(w[2]=w[3]=0,w.writeUIntBE(h,4,6)),i.mask?(w[1]|=128,w[f-4]=a[0],w[f-3]=a[1],w[f-2]=a[2],w[f-1]=a[3],u?[w,e]:x?(ki(e,a,w,f,h),[w]):(ki(e,a,e,0,h),[w,e])):[w,e]}close(e,i,a,x){let f;if(e===void 0)f=Ox;else{if(typeof e!="number"||!Mx(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)f=Buffer.allocUnsafe(2),f.writeUInt16BE(e,0);else{let h=Buffer.byteLength(i);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");f=Buffer.allocUnsafe(2+h),f.writeUInt16BE(e,0),typeof i=="string"?f.write(i,2):f.set(i,2)}}let u={[he]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==we?this.enqueue([this.dispatch,f,!1,u,x]):this.sendFrame(r.frame(f,u),x)}ping(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):pt(e)?(x=e.size,f=!1):(e=$e(e),x=e.length,f=$e.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[he]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};pt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,u,a]):this.getBlobData(e,!1,u,a):this._state!==we?this.enqueue([this.dispatch,e,!1,u,a]):this.sendFrame(r.frame(e,u),a)}pong(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):pt(e)?(x=e.size,f=!1):(e=$e(e),x=e.length,f=$e.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[he]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};pt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,u,a]):this.getBlobData(e,!1,u,a):this._state!==we?this.enqueue([this.dispatch,e,!1,u,a]):this.sendFrame(r.frame(e,u),a)}send(e,i,a){let x=this._extensions[Di.extensionName],f=i.binary?2:1,u=i.compress,h,p;typeof e=="string"?(h=Buffer.byteLength(e),p=!1):pt(e)?(h=e.size,p=!1):(e=$e(e),h=e.length,p=$e.readOnly),this._firstFragment?(this._firstFragment=!1,u&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(u=h>=x._threshold),this._compress=u):(u=!1,f=0),i.fin&&(this._firstFragment=!0);let w={[he]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:p,rsv1:u};pt(e)?this._state!==we?this.enqueue([this.getBlobData,e,this._compress,w,a]):this.getBlobData(e,this._compress,w,a):this._state!==we?this.enqueue([this.dispatch,e,this._compress,w,a]):this.dispatch(e,this._compress,w,a)}getBlobData(e,i,a,x){this._bufferedBytes+=a[he],this._state=Fx,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Dr,this,h,x);return}this._bufferedBytes-=a[he];let u=$e(f);i?this.dispatch(u,i,a,x):(this._state=we,this.sendFrame(r.frame(u,a),x),this.dequeue())}).catch(f=>{process.nextTick(Ux,this,f,x)})}dispatch(e,i,a,x){if(!i){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Di.extensionName];this._bufferedBytes+=a[he],this._state=qx,f.compress(e,a.fin,(u,h)=>{if(this._socket.destroyed){let p=new Error("The socket was closed while data was being compressed");Dr(this,p,x);return}this._bufferedBytes-=a[he],this._state=we,a.readOnly=!1,this.sendFrame(r.frame(h,a),x),this.dequeue()})}dequeue(){for(;this._state===we&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,i){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],i),this._socket.uncork()):this._socket.write(e[0],i)}};Pi.exports=Ar;function Dr(r,e,i){typeof i=="function"&&i(e);for(let a=0;a<r._queue.length;a++){let x=r._queue[a],f=x[x.length-1];typeof f=="function"&&f(e)}}function Ux(r,e,i){Dr(r,e,i),r.onerror(e)}});var zi=oe((nl,Mi)=>{"use strict";var{kForOnEventAttribute:Tt,kListener:Pr}=Ne(),Ii=Symbol("kCode"),Ti=Symbol("kData"),Li=Symbol("kError"),Ni=Symbol("kMessage"),Oi=Symbol("kReason"),wt=Symbol("kTarget"),Bi=Symbol("kType"),Ri=Symbol("kWasClean"),Be=class{constructor(e){this[wt]=null,this[Bi]=e}get target(){return this[wt]}get type(){return this[Bi]}};Object.defineProperty(Be.prototype,"target",{enumerable:!0});Object.defineProperty(Be.prototype,"type",{enumerable:!0});var Qe=class extends Be{constructor(e,i={}){super(e),this[Ii]=i.code===void 0?0:i.code,this[Oi]=i.reason===void 0?"":i.reason,this[Ri]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[Ii]}get reason(){return this[Oi]}get wasClean(){return this[Ri]}};Object.defineProperty(Qe.prototype,"code",{enumerable:!0});Object.defineProperty(Qe.prototype,"reason",{enumerable:!0});Object.defineProperty(Qe.prototype,"wasClean",{enumerable:!0});var _t=class extends Be{constructor(e,i={}){super(e),this[Li]=i.error===void 0?null:i.error,this[Ni]=i.message===void 0?"":i.message}get error(){return this[Li]}get message(){return this[Ni]}};Object.defineProperty(_t.prototype,"error",{enumerable:!0});Object.defineProperty(_t.prototype,"message",{enumerable:!0});var Lt=class extends Be{constructor(e,i={}){super(e),this[Ti]=i.data===void 0?null:i.data}get data(){return this[Ti]}};Object.defineProperty(Lt.prototype,"data",{enumerable:!0});var Kx={addEventListener(r,e,i={}){for(let x of this.listeners(r))if(!i[Tt]&&x[Pr]===e&&!x[Tt])return;let a;if(r==="message")a=function(f,u){let h=new Lt("message",{data:u?f:f.toString()});h[wt]=this,Dn(e,this,h)};else if(r==="close")a=function(f,u){let h=new Qe("close",{code:f,reason:u.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[wt]=this,Dn(e,this,h)};else if(r==="error")a=function(f){let u=new _t("error",{error:f,message:f.message});u[wt]=this,Dn(e,this,u)};else if(r==="open")a=function(){let f=new Be("open");f[wt]=this,Dn(e,this,f)};else return;a[Tt]=!!i[Tt],a[Pr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Pr]===e&&!i[Tt]){this.removeListener(r,i);break}}};Mi.exports={CloseEvent:Qe,ErrorEvent:_t,Event:Be,EventTarget:Kx,MessageEvent:Lt};function Dn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var kn=oe((rl,qi)=>{"use strict";var{tokenChars:Nt}=gt();function Ce(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function Hx(r){let e=Object.create(null),i=Object.create(null),a=!1,x=!1,f=!1,u,h,p=-1,w=-1,b=-1,y=0;for(;y<r.length;y++)if(w=r.charCodeAt(y),u===void 0)if(b===-1&&Nt[w]===1)p===-1&&(p=y);else if(y!==0&&(w===32||w===9))b===-1&&p!==-1&&(b=y);else if(w===59||w===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y);let P=r.slice(p,b);w===44?(Ce(e,P,i),i=Object.create(null)):u=P,p=b=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(h===void 0)if(b===-1&&Nt[w]===1)p===-1&&(p=y);else if(w===32||w===9)b===-1&&p!==-1&&(b=y);else if(w===59||w===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y),Ce(i,r.slice(p,b),!0),w===44&&(Ce(e,u,i),i=Object.create(null),u=void 0),p=b=-1}else if(w===61&&p!==-1&&b===-1)h=r.slice(p,y),p=b=-1;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(x){if(Nt[w]!==1)throw new SyntaxError(`Unexpected character at index ${y}`);p===-1?p=y:a||(a=!0),x=!1}else if(f)if(Nt[w]===1)p===-1&&(p=y);else if(w===34&&p!==-1)f=!1,b=y;else if(w===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(w===34&&r.charCodeAt(y-1)===61)f=!0;else if(b===-1&&Nt[w]===1)p===-1&&(p=y);else if(p!==-1&&(w===32||w===9))b===-1&&(b=y);else if(w===59||w===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y);let P=r.slice(p,b);a&&(P=P.replace(/\\/g,""),a=!1),Ce(i,h,P),w===44&&(Ce(e,u,i),i=Object.create(null),u=void 0),h=void 0,p=b=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(p===-1||f||w===32||w===9)throw new SyntaxError("Unexpected end of input");b===-1&&(b=y);let E=r.slice(p,b);return u===void 0?Ce(e,E,i):(h===void 0?Ce(i,E,!0):a?Ce(i,h,E.replace(/\\/g,"")):Ce(i,h,E),Ce(e,u,i)),e}function Wx(r){return Object.keys(r).map(e=>{let i=r[e];return Array.isArray(i)||(i=[i]),i.map(a=>[e].concat(Object.keys(a).map(x=>{let f=a[x];return Array.isArray(f)||(f=[f]),f.map(u=>u===!0?x:`${x}=${u}`).join("; ")})).join("; ")).join(", ")}).join(", ")}qi.exports={format:Wx,parse:Hx}});var Ln=oe((ol,$i)=>{"use strict";var jx=J("events"),Gx=J("https"),Jx=J("http"),Ki=J("net"),Vx=J("tls"),{randomBytes:Yx,createHash:Xx}=J("crypto"),{Duplex:sl,Readable:il}=J("stream"),{URL:Ir}=J("url"),We=ht(),$x=Er(),Zx=kr(),{isBlob:Qx}=gt(),{BINARY_TYPES:Fi,CLOSE_TIMEOUT:ec,EMPTY_BUFFER:Pn,GUID:tc,kForOnEventAttribute:Tr,kListener:nc,kStatusCode:rc,kWebSocket:Z,NOOP:Hi}=Ne(),{EventTarget:{addEventListener:sc,removeEventListener:ic}}=zi(),{format:oc,parse:ac}=kn(),{toBuffer:xc}=Pt(),Wi=Symbol("kAborted"),Lr=[8,13],Re=["CONNECTING","OPEN","CLOSING","CLOSED"],cc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,F=class r extends jx{constructor(e,i,a){super(),this._binaryType=Fi[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Pn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,i===void 0?i=[]:Array.isArray(i)||(typeof i=="object"&&i!==null?(a=i,i=[]):i=[i]),ji(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Fi.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,i,a){let x=new $x({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new Zx(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[Z]=this,f[Z]=this,e[Z]=this,x.on("conclude",dc),x.on("drain",lc),x.on("error",hc),x.on("message",gc),x.on("ping",pc),x.on("pong",mc),f.onerror=wc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",Vi),e.on("data",Tn),e.on("end",Yi),e.on("error",Xi),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[We.extensionName]&&this._extensions[We.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,i){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,i,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Ji(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Nr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Pn,i,a)}pong(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Nr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Pn,i,a)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof i=="function"&&(a=i,i={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Nr(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[We.extensionName]||(x.compress=!1),this._sender.send(e||Pn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(F,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(F.prototype,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(F,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(F.prototype,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(F,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(F.prototype,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(F,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});Object.defineProperty(F.prototype,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(F.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(F.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Tr])return e[nc];return null},set(e){for(let i of this.listeners(r))if(i[Tr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Tr]:!0})}})});F.prototype.addEventListener=sc;F.prototype.removeEventListener=ic;$i.exports=F;function ji(r,e,i,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:ec,protocolVersion:Lr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=x.autoPong,r._closeTimeout=x.closeTimeout,!Lr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Lr.join(", ")})`);let f;if(e instanceof Ir)f=e;else try{f=new Ir(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}f.protocol==="http:"?f.protocol="ws:":f.protocol==="https:"&&(f.protocol="wss:"),r._url=f.href;let u=f.protocol==="wss:",h=f.protocol==="ws+unix:",p;if(f.protocol!=="ws:"&&!u&&!h?p=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!f.pathname?p="The URL's pathname is empty":f.hash&&(p="The URL contains a fragment identifier"),p){let L=new SyntaxError(p);if(r._redirects===0)throw L;In(r,L);return}let w=u?443:80,b=Yx(16).toString("base64"),y=u?Gx.request:Jx.request,E=new Set,P;if(x.createConnection=x.createConnection||(u?uc:fc),x.defaultPort=x.defaultPort||w,x.port=f.port||w,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":b,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(P=new We({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=oc({[We.extensionName]:P.offer()})),i.length){for(let L of i){if(typeof L!="string"||!cc.test(L)||E.has(L))throw new SyntaxError("An invalid or duplicated subprotocol was specified");E.add(L)}x.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(f.username||f.password)&&(x.auth=`${f.username}:${f.password}`),h){let L=x.path.split(":");x.socketPath=L[0],x.path=L[1]}let I;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=u,r._originalHostOrSocketPath=h?x.socketPath:f.host;let L=a&&a.headers;if(a={...a,headers:{}},L)for(let[j,ie]of Object.entries(L))a.headers[j.toLowerCase()]=ie}else if(r.listenerCount("redirect")===0){let L=h?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!L||r._originalSecure&&!u)&&(delete x.headers.authorization,delete x.headers.cookie,L||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),I=r._req=y(x),r._redirects&&r.emit("redirect",r.url,I)}else I=r._req=y(x);x.timeout&&I.on("timeout",()=>{fe(r,I,"Opening handshake has timed out")}),I.on("error",L=>{I===null||I[Wi]||(I=r._req=null,In(r,L))}),I.on("response",L=>{let j=L.headers.location,ie=L.statusCode;if(j&&x.followRedirects&&ie>=300&&ie<400){if(++r._redirects>x.maxRedirects){fe(r,I,"Maximum redirects exceeded");return}I.abort();let xe;try{xe=new Ir(j,e)}catch{let z=new SyntaxError(`Invalid URL: ${j}`);In(r,z);return}ji(r,xe,i,a)}else r.emit("unexpected-response",I,L)||fe(r,I,`Unexpected server response: ${L.statusCode}`)}),I.on("upgrade",(L,j,ie)=>{if(r.emit("upgrade",L),r.readyState!==F.CONNECTING)return;I=r._req=null;let xe=L.headers.upgrade;if(xe===void 0||xe.toLowerCase()!=="websocket"){fe(r,j,"Invalid Upgrade header");return}let D=Xx("sha1").update(b+tc).digest("base64");if(L.headers["sec-websocket-accept"]!==D){fe(r,j,"Invalid Sec-WebSocket-Accept header");return}let z=L.headers["sec-websocket-protocol"],G;if(z!==void 0?E.size?E.has(z)||(G="Server sent an invalid subprotocol"):G="Server sent a subprotocol but none was requested":E.size&&(G="Server sent no subprotocol"),G){fe(r,j,G);return}z&&(r._protocol=z);let Ee=L.headers["sec-websocket-extensions"];if(Ee!==void 0){if(!P){fe(r,j,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Me;try{Me=ac(Ee)}catch{fe(r,j,"Invalid Sec-WebSocket-Extensions header");return}let _e=Object.keys(Me);if(_e.length!==1||_e[0]!==We.extensionName){fe(r,j,"Server indicated an extension that was not requested");return}try{P.accept(Me[We.extensionName])}catch{fe(r,j,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[We.extensionName]=P}r.setSocket(j,ie,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(I,r):I.end()}function In(r,e){r._readyState=F.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function fc(r){return r.path=r.socketPath,Ki.connect(r)}function uc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=Ki.isIP(r.host)?"":r.host),Vx.connect(r)}function fe(r,e,i){r._readyState=F.CLOSING;let a=new Error(i);Error.captureStackTrace(a,fe),e.setHeader?(e[Wi]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(In,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Nr(r,e,i){if(e){let a=Qx(e)?e.size:xc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Re[r.readyState]})`);process.nextTick(i,a)}}function dc(r,e){let i=this[Z];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[Z]!==void 0&&(i._socket.removeListener("data",Tn),process.nextTick(Gi,i._socket),r===1005?i.close():i.close(r,e))}function lc(){let r=this[Z];r.isPaused||r._socket.resume()}function hc(r){let e=this[Z];e._socket[Z]!==void 0&&(e._socket.removeListener("data",Tn),process.nextTick(Gi,e._socket),e.close(r[rc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function Ui(){this[Z].emitClose()}function gc(r,e){this[Z].emit("message",r,e)}function pc(r){let e=this[Z];e._autoPong&&e.pong(r,!this._isServer,Hi),e.emit("ping",r)}function mc(r){this[Z].emit("pong",r)}function Gi(r){r.resume()}function wc(r){let e=this[Z];e.readyState!==F.CLOSED&&(e.readyState===F.OPEN&&(e._readyState=F.CLOSING,Ji(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Ji(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Vi(){let r=this[Z];if(this.removeListener("close",Vi),this.removeListener("data",Tn),this.removeListener("end",Yi),r._readyState=F.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[Z]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Ui),r._receiver.on("finish",Ui))}function Tn(r){this[Z]._receiver.write(r)||this.pause()}function Yi(){let r=this[Z];r._readyState=F.CLOSING,r._receiver.end(),this.end()}function Xi(){let r=this[Z];this.removeListener("error",Xi),this.on("error",Hi),r&&(r._readyState=F.CLOSING,this.destroy())}});var to=oe((xl,eo)=>{"use strict";var al=Ln(),{Duplex:_c}=J("stream");function Zi(r){r.emit("close")}function yc(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Qi(r){this.removeListener("error",Qi),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function bc(r,e){let i=!0,a=new _c({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,u){let h=!u&&a._readableState.objectMode?f.toString():f;a.push(h)||r.pause()}),r.once("error",function(f){a.destroyed||(i=!1,a.destroy(f))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,f){if(r.readyState===r.CLOSED){f(x),process.nextTick(Zi,a);return}let u=!1;r.once("error",function(p){u=!0,f(p)}),r.once("close",function(){u||f(x),process.nextTick(Zi,a)}),i&&r.terminate()},a._final=function(x){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(x)});return}r._socket!==null&&(r._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){x()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(x,f,u){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,u)});return}r.send(x,u)},a.on("end",yc),a.on("error",Qi),a}eo.exports=bc});var Or=oe((cl,no)=>{"use strict";var{tokenChars:vc}=gt();function Sc(r){let e=new Set,i=-1,a=-1,x=0;for(x;x<r.length;x++){let u=r.charCodeAt(x);if(a===-1&&vc[u]===1)i===-1&&(i=x);else if(x!==0&&(u===32||u===9))a===-1&&i!==-1&&(a=x);else if(u===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);let h=r.slice(i,a);if(e.has(h))throw new SyntaxError(`The "${h}" subprotocol is duplicated`);e.add(h),i=a=-1}else throw new SyntaxError(`Unexpected character at index ${x}`)}if(i===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let f=r.slice(i,x);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);return e.add(f),e}no.exports={parse:Sc}});var co=oe((ul,xo)=>{"use strict";var Cc=J("events"),Nn=J("http"),{Duplex:fl}=J("stream"),{createHash:Ec}=J("crypto"),ro=kn(),et=ht(),Ac=Or(),Dc=Ln(),{CLOSE_TIMEOUT:kc,GUID:Pc,kWebSocket:Ic}=Ne(),Tc=/^[+/0-9A-Za-z]{22}==$/,so=0,io=1,ao=2,Br=class extends Cc{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:kc,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Dc,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Nn.createServer((a,x)=>{let f=Nn.STATUS_CODES[426];x.writeHead(426,{"Content-Length":f.length,"Content-Type":"text/plain"}),x.end(f)}),this._server.listen(e.port,e.host,e.backlog,i)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=Lc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,u)=>{this.handleUpgrade(x,f,u,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=so}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===ao){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Ot,this);return}if(e&&this.once("close",e),this._state!==io)if(this._state=io,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Ot,this):process.nextTick(Ot,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Ot(this)})}}shouldHandle(e){if(this.options.path){let i=e.url.indexOf("?");if((i!==-1?e.url.slice(0,i):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,i,a,x){i.on("error",oo);let f=e.headers["sec-websocket-key"],u=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){nt(this,e,i,405,"Invalid HTTP method");return}if(u===void 0||u.toLowerCase()!=="websocket"){nt(this,e,i,400,"Invalid Upgrade header");return}if(f===void 0||!Tc.test(f)){nt(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){nt(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Bt(i,400);return}let p=e.headers["sec-websocket-protocol"],w=new Set;if(p!==void 0)try{w=Ac.parse(p)}catch{nt(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let b=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&b!==void 0){let E=new et({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let P=ro.parse(b);P[et.extensionName]&&(E.accept(P[et.extensionName]),y[et.extensionName]=E)}catch{nt(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let E={origin:e.headers[`${h===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(E,(P,I,L,j)=>{if(!P)return Bt(i,I||401,L,j);this.completeUpgrade(y,f,w,e,i,a,x)});return}if(!this.options.verifyClient(E))return Bt(i,401)}this.completeUpgrade(y,f,w,e,i,a,x)}completeUpgrade(e,i,a,x,f,u,h){if(!f.readable||!f.writable)return f.destroy();if(f[Ic])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>so)return Bt(f,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Ec("sha1").update(i+Pc).digest("base64")}`],b=new this.options.WebSocket(null,void 0,this.options);if(a.size){let y=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;y&&(w.push(`Sec-WebSocket-Protocol: ${y}`),b._protocol=y)}if(e[et.extensionName]){let y=e[et.extensionName].params,E=ro.format({[et.extensionName]:[y]});w.push(`Sec-WebSocket-Extensions: ${E}`),b._extensions=e}this.emit("headers",w,x),f.write(w.concat(`\r
|
|
12
12
|
`).join(`\r
|
|
13
|
-
`)),f.removeListener("error",
|
|
13
|
+
`)),f.removeListener("error",oo),b.setSocket(f,u,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(b),b.on("close",()=>{this.clients.delete(b),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Ot,this)})),h(b,x)}};xo.exports=Br;function Lc(r,e){for(let i of Object.keys(e))r.on(i,e[i]);return function(){for(let a of Object.keys(e))r.removeListener(a,e[a])}}function Ot(r){r._state=ao,r.emit("close")}function oo(){this.destroy()}function Bt(r,e,i,a){i=i||Nn.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...a},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${Nn.STATUS_CODES[e]}\r
|
|
14
14
|
`+Object.keys(a).map(x=>`${x}: ${a[x]}`).join(`\r
|
|
15
15
|
`)+`\r
|
|
16
16
|
\r
|
|
17
|
-
`+i)}function
|
|
17
|
+
`+i)}function nt(r,e,i,a,x,f){if(r.listenerCount("wsClientError")){let u=new Error(x);Error.captureStackTrace(u,nt),r.emit("wsClientError",u,i,e)}else Bt(i,a,x,f)}});import{spawn as rf}from"node:child_process";import{existsSync as sf,openSync as of}from"node:fs";import{mkdir as af}from"node:fs/promises";import{dirname as xf}from"node:path";import{fileURLToPath as cf}from"node:url";function zr(r=H()){return sf(r.libEntry)?r.libEntry:cf(new URL("../index.ts",import.meta.url))}async function Io(r={}){let e=r.paths??H(),i=r.entryOverride??zr(e);await af(xf(e.logFile),{recursive:!0});let a=of(e.logFile,"a"),f=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],u=rf(process.execPath,f,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(u.unref(),typeof u.pid!="number")throw new Error("failed to spawn daemon (no pid)");return ff.info("daemon spawned",{pid:u.pid,entry:i}),{pid:u.pid,entry:i}}var ff,qr=Pe(()=>{"use strict";U();ce();ff=T("spawn-daemon")});import{spawn as wf}from"node:child_process";import{mkdir as _f,unlink as yf,writeFile as bf}from"node:fs/promises";import{dirname as vf,join as Sf}from"node:path";function Un(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Bo(r,e){return new Promise((i,a)=>{let x=wf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",u=>{f+=u.toString("utf8")}),x.on("error",a),x.on("close",u=>{u===0?i():a(new Error(`${r} ${e.join(" ")} exited ${u}: ${f.trim()}`))})})}var Fn,Kr,Hr,Ro=Pe(()=>{"use strict";U();Fn=T("supervisor.launchd"),Kr="ai.coze.bridge",Hr={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
18
18
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
19
19
|
<plist version="1.0">
|
|
20
20
|
<dict>
|
|
21
21
|
<key>Label</key>
|
|
22
|
-
<string>${
|
|
22
|
+
<string>${Kr}</string>
|
|
23
23
|
<key>ProgramArguments</key>
|
|
24
24
|
<array>
|
|
25
|
-
<string>${
|
|
26
|
-
<string>${
|
|
25
|
+
<string>${Un(r.nodeBin)}</string>
|
|
26
|
+
<string>${Un(r.entry)}</string>
|
|
27
27
|
<string>--daemon</string>
|
|
28
28
|
</array>
|
|
29
29
|
<key>RunAtLoad</key>
|
|
@@ -33,12 +33,12 @@ var N0=Object.create;var er=Object.defineProperty;var L0=Object.getOwnPropertyDe
|
|
|
33
33
|
<key>ThrottleInterval</key>
|
|
34
34
|
<integer>10</integer>
|
|
35
35
|
<key>StandardOutPath</key>
|
|
36
|
-
<string>${
|
|
36
|
+
<string>${Un(r.logFile)}</string>
|
|
37
37
|
<key>StandardErrorPath</key>
|
|
38
|
-
<string>${
|
|
38
|
+
<string>${Un(r.logFile)}</string>
|
|
39
39
|
</dict>
|
|
40
40
|
</plist>
|
|
41
|
-
`},configPath(r){return
|
|
41
|
+
`},configPath(r){return Sf(r.homeDir,"Library","LaunchAgents",`${Kr}.plist`)},async install(r){let e=this.configPath(r);await _f(vf(e),{recursive:!0}),await bf(e,this.renderConfig(r),"utf8"),Fn.info("plist written",{plistPath:e}),await Bo("launchctl",["load","-w",e]),Fn.info("launchd job loaded",{label:Kr})},async uninstall(r){let e=this.configPath(r);await Bo("launchctl",["unload","-w",e]).catch(i=>Fn.warn("launchctl unload failed (ignored)",{err:String(i)})),await yf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),Fn.info("launchd job removed",{plistPath:e})}}});import{spawn as Cf}from"node:child_process";import{mkdir as Ef,unlink as Af,writeFile as Df}from"node:fs/promises";import{dirname as kf,join as Pf}from"node:path";function Wn(r,e){return new Promise((i,a)=>{let x=Cf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",u=>{f+=u.toString("utf8")}),x.on("error",a),x.on("close",u=>{u===0?i():a(new Error(`${r} ${e.join(" ")} exited ${u}: ${f.trim()}`))})})}var Kn,Hn,Wr,Mo=Pe(()=>{"use strict";U();Kn=T("supervisor.systemd"),Hn="coze-bridge.service",Wr={platform:"linux",renderConfig(r){return`[Unit]
|
|
42
42
|
Description=Coze Bridge daemon
|
|
43
43
|
After=network.target
|
|
44
44
|
|
|
@@ -52,7 +52,7 @@ StandardError=append:${r.logFile}
|
|
|
52
52
|
|
|
53
53
|
[Install]
|
|
54
54
|
WantedBy=default.target
|
|
55
|
-
`},configPath(r){return
|
|
55
|
+
`},configPath(r){return Pf(r.homeDir,".config","systemd","user",Hn)},async install(r){let e=this.configPath(r);await Ef(kf(e),{recursive:!0}),await Df(e,this.renderConfig(r),"utf8"),Kn.info("systemd unit written",{unitPath:e}),await Wn("systemctl",["--user","daemon-reload"]),await Wn("systemctl",["--user","enable","--now",Hn]),Kn.info("systemd unit enabled",{unitName:Hn})},async uninstall(r){let e=this.configPath(r);await Wn("systemctl",["--user","disable","--now",Hn]).catch(i=>Kn.warn("systemctl disable failed (ignored)",{err:String(i)})),await Af(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await Wn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Kn.info("systemd unit removed",{unitPath:e})}}});import{spawn as If}from"node:child_process";import{join as Tf}from"node:path";function zo(r,e){return new Promise((i,a)=>{let x=If(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";x.stderr?.on("data",u=>{f+=u.toString("utf8")}),x.on("error",a),x.on("close",u=>{u===0?i():a(new Error(`${r} ${e.join(" ")} exited ${u}: ${f.trim()}`))})})}var jr,jn,Gr,qo=Pe(()=>{"use strict";U();jr=T("supervisor.taskscheduler"),jn="CozeBridge",Gr={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
|
|
56
56
|
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
57
57
|
<RegistrationInfo>
|
|
58
58
|
<Description>Coze Bridge daemon</Description>
|
|
@@ -76,7 +76,7 @@ WantedBy=default.target
|
|
|
76
76
|
</Exec>
|
|
77
77
|
</Actions>
|
|
78
78
|
</Task>
|
|
79
|
-
`},configPath(r){return
|
|
79
|
+
`},configPath(r){return Tf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await zo("schtasks",["/Create","/SC","ONLOGON","/TN",jn,"/TR",e,"/RU",r.userName,"/F"]),jr.info("task scheduler entry created",{task:jn})},async uninstall(r){await zo("schtasks",["/Delete","/TN",jn,"/F"]).catch(e=>jr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),jr.info("task scheduler entry removed",{task:jn})}}});var Jr={};ws(Jr,{buildContext:()=>Bf,getSupervisor:()=>Of,launchdSupervisor:()=>Hr,systemdSupervisor:()=>Wr,taskSchedulerSupervisor:()=>Gr});import{homedir as Lf,userInfo as Nf}from"node:os";function Of(r=process.platform){switch(r){case"darwin":return Hr;case"linux":return Wr;case"win32":return Gr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function Bf(){let r=H();return{nodeBin:process.execPath,entry:zr(r),logFile:r.logFile,homeDir:Lf(),userName:Nf().username}}var Vr=Pe(()=>{"use strict";ce();qr();Ro();Mo();qo()});Ue();U();import{readdir as ea}from"node:fs/promises";import{mkdir as Y0,writeFile as X0}from"node:fs/promises";import{join as $0}from"node:path";var Z0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function Ve(r,e,i,a){await Y0(r,{recursive:!0});let x=Z0[e],f=$0(r,x),u=Q0(e,i,a);return await X0(f,u,"utf8"),f}function Q0(r,e,i){let a=`# Coze Agent: ${e}
|
|
80
80
|
|
|
81
81
|
> framework: \`${r}\`
|
|
82
82
|
|
|
@@ -85,10 +85,10 @@ WantedBy=default.target
|
|
|
85
85
|
`:`_No instructions provided._
|
|
86
86
|
`;return`${a}---
|
|
87
87
|
|
|
88
|
-
${x}`}var be=L("agent-detail-sync"),jt=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await ea(i)}catch(x){be.info("agents dir not found, skip detail sync",{root:i,err:String(x)});return}be.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){be.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}be.info("detail sync done",{reason:e})}async syncOne(e){let i=await ae(e,this.opts.paths);if(!i){be.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(u){be.warn("detail RPC failed, using local data",{agentId:e,err:String(u)});return}if(a.agentId&&a.agentId!==e){be.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,f=!1;if(a.agentName&&a.agentName!==i.agentName&&(i.agentName=a.agentName,x=!0),a.description!==void 0&&a.description!==i.description&&(i.description=a.description,x=!0),a.cozeIdentity&&a.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=a.cozeIdentity,x=!0,f=!0),a.deployType&&be.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){be.debug("detail sync: no diff",{agentId:e});return}await de(i,this.opts.paths),be.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:i.agentName}),f&&(await We(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};it();import{spawn as ta}from"node:child_process";import{mkdir as na,readFile as Is,readdir as ra,rm as sa,stat as Ht,writeFile as ia}from"node:fs/promises";import{join as Ie,normalize as oa,relative as ks,resolve as aa,sep as Ns}from"node:path";var bs="https://llm-gateway.coze.cn",Kt="auto";function sr(r){return{model:r.model??Kt,...r.modelToken?{modelToken:r.modelToken}:{}}}function ys(r){return!r||r===Kt}function vs(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=bs,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),ys(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Ss(r){let e=[];return ys(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_provider="openai"'),e.push("-c",`model_provider_overrides.openai.base_url="${bs}/v1"`)),e}function Es(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}function Cs(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Ds(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function ot(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var C=class extends Error{code;retriable;cause;constructor(e,i,a){super(i),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};U();xe();function Ve(r,e){if(Cs(r)!=="cloud")throw new C("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}var J=L("agent-handlers"),As=5*1024*1024,xa=1,ca=6,fa=new Set(["node_modules",".git",".coze","dist","build",".next"]),ua=3e4,Gt=class{constructor(e){this.opts=e}opts;async listSkills(e){Ve(e._meta,"_agent/listSkills");let i=ot(e._meta),a=await this.loadAgentCfg(i),x=a?.workspace??Te(i).workspace,f=a?.skills??[],u=[];for(let h of f){let g=Ie(x,h.relPath,"SKILL.md");await Ht(g).then(w=>w.isFile()).catch(()=>!1)&&u.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:u}}async addSkills(e){Ve(e._meta,"_agent/addSkills");let i=ot(e._meta),a=await this.requireAgentCfg(i),x=e.skills??[],f=[...a.skills??[]],u=new Map(f.map((g,_)=>[g.skillId,_])),h=[];for(let g of x){if(!g.skillName)throw new C("IPC_BAD_REQUEST","skill missing skillName");let _=da(g.skillName),w=la(a.framework),b=Ie(w,_),D=Ie(a.workspace,b);await na(D,{recursive:!0});let k=await ga(g.downloadUrl);ma(k)?await _a(k,D):await ia(Ie(D,"SKILL.md"),k.toString("utf8"),"utf8");let B={skillId:g.skillId,skillName:g.skillName,relPath:b,installedAt:Date.now(),...g.description?{description:g.description}:{},...g.version?{version:g.version}:{},...g.downloadUrl?{downloadUrl:g.downloadUrl}:{}},N=u.get(g.skillId);N!==void 0?f[N]=B:(u.set(g.skillId,f.length),f.push(B)),h.push(g),J.info("skill installed",{agentId:i,skillId:g.skillId,skillName:g.skillName,relPath:b})}return await Ut(i,f),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){Ve(e._meta,"_agent/removeSkills");let i=ot(e._meta),a=await this.requireAgentCfg(i),x=new Set(e.skillIds??[]),f=a.skills??[],u=[];for(let h of f){if(!x.has(h.skillId)){u.push(h);continue}let g=Ie(a.workspace,h.relPath);await sa(g,{recursive:!0,force:!0}),J.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await Ut(i,u),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex")for(let[x,f]of a.sessions)try{await a.downstream.sessionLoad({sessionId:f,cwd:a.workspace}),J.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f})}catch(u){J.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f,err:String(u)})}}async updateAgent(e){if(!e.cozeIdentity?.trim())return J.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await ae(i);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(J.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await de(a),await We(a.workspace,a.framework,i,e.cozeIdentity),J.info("_agent/update: cozeIdentity rewritten",{agentId:i,framework:a.framework}),await this.reloadAgentSessions(i,"identity-changed"),{ok:!0})}async disconnectAgent(e){let i=e.agentId;if(!i)throw new C("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await ae(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await de(a),J.info("agent disconnected",{agentId:i,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(i,e.reason??"disconnect"),{ok:!0}):(J.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Ve(e._meta,"_agent/switchModel"),!e.agentId)throw new C("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model&&e.model.trim()?e.model:Kt,a=e.modelToken?.trim()||void 0,x=await ae(e.agentId);if(!x)throw new C("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);x.model=i,a!==void 0?x.modelToken=a:delete x.modelToken,await de(x),J.info("_agent/switchModel: model/modelToken persisted",{agentId:e.agentId,model:i,hasToken:!!a,reason:e.reason??"",force:e.force??!1});let f=this.opts.agents.get(e.agentId);if(!f)return J.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};if(f.status==="switching")return J.info("_agent/switchModel: already switching, params updated via config",{agentId:e.agentId}),{ok:!0};if(!this.opts.executeModelSwitch)throw new C("BRIDGE_INTERNAL","_agent/switchModel: executeModelSwitch callback not wired");f.status="switching";let u=f.msgQueue.enqueue(async()=>{}),h=setTimeout(()=>{J.warn("_agent/switchModel: 30s idle timeout, forcing downstream stop",{agentId:e.agentId}),f.downstream.stop("switchModel idle timeout").catch(g=>J.warn("force stop failed (ignored)",{agentId:e.agentId,err:String(g)}))},ua);try{return await u.catch(g=>J.warn("_agent/switchModel: msgQueue idle wait rejected (continuing)",{agentId:e.agentId,err:String(g)})),clearTimeout(h),await this.opts.executeModelSwitch(e.agentId),{ok:!0}}catch(g){clearTimeout(h),J.error("_agent/switchModel: failed, marking disconnected",{agentId:e.agentId,err:String(g)});let _=await ae(e.agentId).catch(()=>null);throw _&&(_.disconnectedAt=Date.now(),_.disconnectReason=`model switch failed: ${g instanceof Error?g.message:String(g)}`,await de(_).catch(w=>J.warn("write disconnect marker failed (ignored)",{err:String(w)}))),this.opts.disposeAndMarkDisconnected?await this.opts.disposeAndMarkDisconnected(e.agentId,`model switch failed: ${g instanceof Error?g.message:String(g)}`).catch(w=>J.warn("disposeAndMarkDisconnected failed (ignored)",{err:String(w)})):f.status="disconnected",g instanceof C&&(g.code==="MODEL_SWITCH_FAILED"||g.code==="AGENT_NOT_FOUND")?g:new C("MODEL_SWITCH_FAILED",g instanceof Error?g.message:String(g),{cause:g})}}async getFileTree(e){Ve(e._meta,"_agent/getFileTree");let i=e._meta,a=ot(i),x=this.resolveWorkspace(a),f=e.filePath??"",u=this.safeJoin(x,f),h=await Ht(u).catch(()=>null);if(!h)throw new C("IPC_BAD_REQUEST",`path not found: ${f}`);let g=wa(e.depth);return h.isDirectory()?{tree:await Ls(x,u,f,g)}:{tree:[{name:ba(f),path:Bs(f||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Ve(e._meta,"_agent/getFileContent");let i=ot(e._meta),a=this.resolveWorkspace(i);if(!e.filePath)throw new C("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await Ht(x).catch(()=>null);if(!f||!f.isFile())throw new C("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.size>As)throw new C("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${As})`);let u=await Is(x);return u.includes(0)?{content:u.toString("base64"),encoding:"base64",size:f.size}:{content:u.toString("utf8"),encoding:"utf-8",size:f.size}}resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:Te(e).workspace}safeJoin(e,i){let a=aa(e,i||"."),x=ks(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Ns}`))throw new C("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return ae(e)}async requireAgentCfg(e){let i=await this.loadAgentCfg(e);if(!i)throw new C("AGENT_NOT_FOUND",`no config for agent: ${e}`);return i}};function da(r){let e=r.trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new C("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function la(r){return r==="claude-code"?Ie(".claude","skills"):Ie(".agents","skills")}var ha=3e4,Ps=50*1024*1024,Ts=3e4;async function ga(r){if(!r)throw new C("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:"))return pa(r);if(r.startsWith("file:")){let e=new URL(r).pathname,i=await Is(e);if(i.length>Ps)throw new C("IPC_BAD_REQUEST",`skill too large: ${i.length} bytes`);return i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),ha);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new C("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();if(x.byteLength>Ps)throw new C("IPC_BAD_REQUEST",`skill too large: ${x.byteLength} bytes`);return Buffer.from(x)}finally{clearTimeout(i)}}throw new C("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function pa(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new C("IPC_BAD_REQUEST","bad data URL");let i=!!e[2],a=e[3]??"";return i?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function ma(r){return r.length>=2&&r[0]===31&&r[1]===139}async function _a(r,e){await new Promise((i,a)=>{let x=ta("tar",["-xzf","-","-C",e,"--strip-components=1"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",h=>{f+=String(h)});let u=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar extract timeout (${Ts}ms)`))},Ts);x.on("error",h=>{clearTimeout(u),a(new C("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(u),h===0?i():a(new C("IPC_BAD_REQUEST",`tar exit ${h}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Ls(r,e,i,a){if(a<=0)return[];let x;try{x=await ra(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let u of x){if(fa.has(u.name))continue;let h=Ie(e,u.name),g=oa(Ie(i,u.name)),_=null;try{_=await Ht(h)}catch{continue}let w={name:u.name,path:Bs(ks(r,h)),isDir:_.isDirectory(),size:_.size,modifiedAt:Math.floor(_.mtimeMs)};_.isDirectory()&&a>1&&(w.children=await Ls(r,h,g,a-1)),f.push(w)}return f.sort((u,h)=>u.isDir!==h.isDir?u.isDir?-1:1:u.name.localeCompare(h.name)),f}function wa(r){return!r||r<=0?xa:Math.min(r,ca)}function ba(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function Bs(r){return r.split(Ns).join("/")}it();import{mkdir as ir,rm as Ia}from"node:fs/promises";import{spawn as Ca}from"node:child_process";function at(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function Os(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function xt(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Je(r,e){return{jsonrpc:"2.0",id:r,error:e}}var Wt=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},z={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_SWITCHING:-32007,MODEL_SWITCH_FAILED:-32008};function Vt(r){return"method"in r&&"id"in r&&r.id!==void 0}function Rs(r){return"method"in r&&!("id"in r)}function Jt(r){return!("method"in r)&&"id"in r}var ya={AGENT_NOT_FOUND:z.AGENT_NOT_FOUND,AGENT_BUSY:z.AGENT_BUSY,AGENT_DISCONNECTED:z.AGENT_DISCONNECTED,AGENT_TIMEOUT:z.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:z.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:z.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:z.INTERNAL_ERROR,BRIDGE_INTERNAL:z.INTERNAL_ERROR,IPC_AUTH_FAILED:z.INTERNAL_ERROR,IPC_BAD_REQUEST:z.INVALID_REQUEST,MODEL_SWITCHING:z.MODEL_SWITCHING,MODEL_SWITCH_FAILED:z.MODEL_SWITCH_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:z.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:z.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:z.INTERNAL_ERROR};function Xt(r){return r instanceof C?{code:ya[r.code]??z.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:z.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function Ms(r){let e=r.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new C(i,r.message,{retriable:e?.retriable??!1,cause:r.data})}function zs(r){return`${JSON.stringify(r)}
|
|
89
|
-
`}var
|
|
90
|
-
`);this.buffer=i.pop()??"";let a=[];for(let x of i){let f=x.replace(/\r$/,"").trim();if(f)try{a.push(JSON.parse(f))}catch(u){this.onError?.({line:f,error:u})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(i){return this.onError?.({line:e,error:i}),[]}}};var Fs={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel",initialize:"initialize"},Lu=Object.fromEntries(Object.entries(Fs).map(([r,e])=>[e,r])),va={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":["agentId"],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.pair":[],initialize:[]},ct=class{seq=0;next(e,i){this.seq+=1;let a=Fs[e]??Sa(e),x=va[a]??[],f=[a,String(this.seq)];if(x.length>0){let u=x.map(g=>qs(i?.[g]??"")),h=Ea(u).join(":");h&&f.push(h)}else i&&Object.values(i).some(u=>u)&&f.push(Object.values(i).filter(Boolean).map(u=>qs(String(u))).join(":"));return f.join("_")}reset(){this.seq=0}};function Sa(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function qs(r){return r.replace(/[:_\s]+/g,"-")}function Ea(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}U();var Da=3e4;function Us(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var qe=class{constructor(e){this.opts=e;this.log=L(`downstream.${this.constructor.name}`),this.decoder=new Zt({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new ct;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new C("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=Ca(this.opts.command,this.opts.args,{cwd:this.opts.cwd,env:{...this.sanitizeEnv(process.env),...this.opts.env},stdio:["pipe","pipe","pipe"],detached:e});this.child=i,i.stdout?.setEncoding("utf8"),i.stdout?.on("data",a=>{for(let x of this.decoder.push(a))this.dispatch(x)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),i.on("exit",(a,x)=>{this.stopped=!0,this.failAllPending(new C("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let f of this.exitHandlers)f(a,x)}),i.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new C("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:i.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let i=this.child,a=new Promise(f=>i.once("exit",()=>f()));Us(i.pid,"SIGTERM");let x=setTimeout(()=>{i.killed||Us(i.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(x)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){if(!this.child||this.stopped)return;let i=this.idAllocator.next("session/cancel");this.writeFrame(at(i,"session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(xt(e,i))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(Je(e,i))}catch(a){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(a)})}}onExit(e){this.exitHandlers.push(e)}call(e,i,a=Da){if(!this.child||this.stopped)return Promise.reject(new C("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=at(x,e,i),u=a>0&&Number.isFinite(a);return new Promise((h,g)=>{let _=u?setTimeout(()=>{this.pending.delete(x),g(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:h,reject:g,timer:_,method:e});try{this.writeFrame(f)}catch(w){_&&clearTimeout(_),this.pending.delete(x),g(w)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new C("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(zs(e))}dispatch(e){if(Jt(e)){let i=e.id!==null?this.pending.get(e.id):void 0;if(!i){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),i.timer&&clearTimeout(i.timer),e.error?i.reject(Ms(e.error)):i.resolve(e.result);return}if(Rs(e)){if(e.method==="session/update")for(let i of this.updateHandlers)Promise.resolve(i(e.params)).catch(a=>this.log.warn("update handler failed",{err:String(a)}));else this.log.debug("unknown notification",{method:e.method});return}if(Vt(e)){let i=e;this.handleAgentRequest(i).catch(a=>this.log.error("agent request handler failed",{method:i.method,err:String(a)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(Je(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let i of this.agentRequestHandlers)try{await i(e)}catch(a){this.log.error("agentRequestHandler threw",{method:e.method,err:String(a)});try{this.writeFrame(Je(e.id,Xt(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var Aa="@zed-industries/claude-code-acp@latest";function Pa(r){let e={};for(let[i,a]of Object.entries(r))a!==void 0&&(i.startsWith("CLAUDE")||i==="AI_AGENT"||i==="BAGGAGE"||(e[i]=a));return e}var Yt=class extends qe{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",Aa],x={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return Pa(e)}};var Ta="@zed-industries/codex-acp@latest",Qt=class extends qe{framework="codex";constructor(e){let i=e.command??"npx",a=e.args??["-y",Ta],x=e.extraArgs?[...a,...e.extraArgs]:a,f={command:i,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f)}};import{spawn as js}from"node:child_process";U();var $t=class extends qe{framework="openclaw";registerLog;profile;agentId;sessionName;registered=!1;constructor(e){let i=e.profile??"coze",a=e.sessionName??"default",x=["--profile",i,"acp","--session",`agent:${e.agentId}:${a}`],f={command:e.command,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f),this.profile=i,this.agentId=e.agentId,this.sessionName=a,this.registerLog=L("downstream.openclaw.register")}async start(){await this.registerAgent().catch(e=>{this.registerLog.warn("openclaw agents add failed (will continue to acp anyway)",{agentId:this.agentId,err:String(e)})}),await super.start()}registerAgent(){return new Promise((e,i)=>{let a=js(this.opts.command,["--profile",this.profile,"agents","add",this.agentId,"--workspace",this.opts.cwd,"--non-interactive"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",i),a.on("close",f=>{f===0?(this.registered=!0,this.registerLog.info("agent registered",{agentId:this.agentId,profile:this.profile}),e()):i(new C("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${f}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(i=>{let a=js(this.opts.command,["--profile",this.profile,"agents","delete",this.agentId,"--force"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",f=>{this.registerLog.warn("openclaw agents delete failed (best-effort)",{agentId:this.agentId,err:String(f)}),i()}),a.on("close",f=>{f===0?this.registerLog.info("agent unregistered",{agentId:this.agentId}):this.registerLog.warn("openclaw agents delete non-zero exit",{agentId:this.agentId,code:f,stderr:x.trim()}),this.registered=!1,i()})})}get acpSessionName(){return this.sessionName}};U();xe();var en=class{slots=[];running=!1;closed=!1;disposed=!1;enqueue(e){return this.disposed?Promise.reject(new Error("AsyncQueue disposed")):this.closed?Promise.reject(new Error("AsyncQueue closed")):new Promise((i,a)=>{this.slots.push({task:e,resolve:i,reject:a}),this.drain()})}close(){this.closed=!0}dispose(e=new Error("AsyncQueue disposed")){for(this.disposed=!0,this.closed=!0;this.slots.length>0;)this.slots.shift()?.reject(e)}get size(){return this.slots.length}get isRunning(){return this.running}async drain(){if(!this.running){this.running=!0;try{for(;this.slots.length>0&&!this.disposed;){let e=this.slots.shift();if(!e)break;try{let i=await e.task();e.resolve(i)}catch(i){e.reject(i)}}}finally{this.running=!1}}}};var tn=class{agentId;framework;workspace;msgQueue;sessions=new Map;verifiedSessions=new Set;activeTriggers=new Map;status="starting";lastActiveAt=Date.now();_downstream;constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this._downstream=e.downstream,this.msgQueue=new en}get downstream(){return this._downstream}swap(e){this._downstream=e,this.verifiedSessions.clear(),this.activeTriggers.clear()}async dispose(e){this.status="stopped",this.msgQueue.dispose(new Error(`AgentSession disposed${e?`: ${e}`:""}`)),await this._downstream.stop(e)}};var K=L("agent-manager"),ka=(r,e,i,a,x)=>{switch(r){case"claude-code":{let f=x?vs(x):void 0;return new Yt({cwd:i,...f&&Object.keys(f).length>0?{env:f}:{}})}case"codex":{let f=x?Ss(x):[],u=x?Es(x):void 0;return new Qt({cwd:i,...f.length>0?{extraArgs:f}:{},...u&&Object.keys(u).length>0?{env:u}:{}})}case"openclaw":return new $t({command:e,cwd:i,agentId:a})}},Na=[0,5e3,5e3],La=2e4,Ks={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},nn=class{paths;config;registry;factory;restartDelaysMs;createTimeoutMs;healthReporter;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??ka,this.restartDelaysMs=e.restartDelaysMs??Na,this.createTimeoutMs=e.createTimeoutMs??La,this.healthReporter=e.healthReporter}async createAgent(e){if(!e.agentId)throw new C("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new C("IPC_BAD_REQUEST","framework required");this.registry.reviveIfDisconnected?.(e.agentId);let i=this.registry.get(e.agentId);if(i){if(i.framework!==e.framework)throw new C("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${i.framework})`);if(i.status==="error")K.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await i.dispose("rebuild after error").catch(g=>K.warn("dispose stale agent failed (ignored)",{err:String(g)})),this.registry.unregister(e.agentId);else return K.info("agent already exists,return current",{agentId:e.agentId}),{ok:!0,agentId:i.agentId,workspace:i.workspace,pid:i.downstream.pid()??0,framework:i.framework}}let a=this.config.frameworksCache?.[e.framework];if(!a)throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let x=Te(e.agentId,this.paths),f=e.workspace??x.workspace,u=new AbortController,h=setTimeout(()=>u.abort(new C("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs);try{return await this.createAgentInner(e,x,f,a,u.signal)}finally{clearTimeout(h)}}async createAgentInner(e,i,a,x,f){let u=()=>{if(f.aborted)throw f.reason instanceof Error?f.reason:new C("AGENT_TIMEOUT","_agent/create aborted")},h,g,_=!1;try{await ir(i.root,{recursive:!0}),await ir(a,{recursive:!0}),await ir(i.logs,{recursive:!0}),u(),e.framework!=="openclaw"&&await We(a,e.framework,e.agentId,e.cozeIdentity),u();let w=await ae(e.agentId,this.paths).catch(()=>null),b=sr({model:e.model??w?.model,modelToken:e.modelToken??w?.modelToken});if(h=this.factory(e.framework,x.path,a,e.agentId,b),await h.start(),u(),await h.initialize(Ks),u(),e.framework==="openclaw"&&await We(a,"openclaw",e.agentId,e.cozeIdentity),g=new tn({agentId:e.agentId,framework:e.framework,workspace:a,downstream:h}),g.status="ok",w?.sessions){for(let[B,N]of Object.entries(w.sessions))g.sessions.set(B,N);Object.keys(w.sessions).length>0&&K.info("restored persisted sessions for agent",{agentId:e.agentId,count:Object.keys(w.sessions).length})}this.registry.register(g),_=!0;let D={agentId:e.agentId,framework:e.framework,workspace:a,cozeIdentity:e.cozeIdentity,createdAt:w?.createdAt??Date.now(),sessions:w?.sessions??{},model:b.model};b.modelToken&&(D.modelToken=b.modelToken),w?.skills&&(D.skills=w.skills),w?.agentName&&(D.agentName=w.agentName),w?.description&&(D.description=w.description),await de(D,this.paths);let k=h.pid()??0;return K.info("agent created",{agentId:e.agentId,framework:e.framework,pid:k}),this.installRestartHook(g),{ok:!0,agentId:e.agentId,workspace:a,pid:k,framework:e.framework}}catch(w){throw K.error("agent create failed,rolling back",{agentId:e.agentId,err:String(w)}),h?.cleanup&&await h.cleanup("rollback").catch(b=>K.warn("downstream cleanup failed (ignored)",{err:String(b)})),h&&await h.stop("rollback").catch(()=>{}),_&&g&&(await g.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Ia(i.root,{recursive:!0,force:!0}).catch(b=>K.warn("rm agent dir failed (ignored)",{err:String(b)})),w instanceof C?w:new C("AGENT_SPAWN_FAILED",String(w),{cause:w})}}async reportHealth(e,i,a){if(!this.healthReporter){K.info("healthReporter not wired, skip _agent/health upstream",{agentId:e.agentId,status:i});return}try{await this.healthReporter({status:i,_meta:{cozeAgentId:e.agentId}}),K.info("_agent/health reported",{agentId:e.agentId,status:i,cause:a})}catch(x){K.warn("_agent/health upstream failed (ignored)",{agentId:e.agentId,status:i,err:String(x)})}}installRestartHook(e){let i=0,a=x=>{if(e.status==="stopped"||e.status==="disconnected"||e.status==="switching")return;if(i>=this.restartDelaysMs.length){K.error("agent restart exhausted",{agentId:e.agentId,attempts:i,...x}),e.status="error",this.reportHealth(e,"error",x);return}let f=this.restartDelaysMs[i]??5e3;i+=1,e.status="degraded",K.warn("agent restart scheduled",{agentId:e.agentId,attempt:i,delayMs:f,...x}),setTimeout(()=>{this.doRestart(e,i).then(u=>{u?(i=0,e.status="ok"):a(null)})},f)};e.downstream.onExit((x,f)=>a({code:x,signal:f}))}async spawnAndInitialize(e,i){let a=await ae(e.agentId,this.paths).catch(()=>null),x=a?sr(a):void 0,f=this.factory(e.framework,i,e.workspace,e.agentId,x);try{return await f.start(),await f.initialize(Ks),f}catch(u){throw await f.stop("spawnAndInitialize failed").catch(()=>{}),u}}rewireSession(e,i){e.swap(i),this.registry.attachHooks?.(e),this.installRestartHook(e)}async doRestart(e,i){let a=this.config.frameworksCache?.[e.framework];if(!a)return K.error("framework cache missing during restart",{agentId:e.agentId,framework:e.framework}),e.status="error",!1;K.info("agent restart attempt",{agentId:e.agentId,attempt:i});try{let x=await this.spawnAndInitialize(e,a.path);return this.rewireSession(e,x),K.info("agent restart succeeded",{agentId:e.agentId,attempt:i}),!0}catch(x){return K.warn("agent restart attempt failed",{agentId:e.agentId,attempt:i,err:String(x)}),!1}}async executeModelSwitch(e){let i=this.registry.get(e);if(!i)throw new C("AGENT_NOT_FOUND",`agent not found: ${e}`);let a=this.config.frameworksCache?.[i.framework];if(!a)throw new C("AGENT_SPAWN_FAILED",`framework ${i.framework} not detected; cannot respawn for switchModel`);K.info("executeModelSwitch: stopping old downstream",{agentId:e,framework:i.framework}),await i.downstream.stop("switchModel").catch(u=>{K.warn("stop old downstream failed (ignored, continuing)",{agentId:e,err:String(u)})});let x;try{x=await this.spawnAndInitialize(i,a.path)}catch(u){throw new C("MODEL_SWITCH_FAILED",`failed to spawn new downstream after switchModel: ${u instanceof Error?u.message:String(u)}`,{cause:u})}this.rewireSession(i,x);let f=[...i.sessions.entries()];for(let[u,h]of f)try{await x.sessionLoad({sessionId:h,cwd:i.workspace}),i.verifiedSessions.add(h)}catch(g){throw new C("MODEL_SWITCH_FAILED",`sessionLoad failed after switchModel for cloud session ${u} (acp=${h}): ${g instanceof Error?g.message:String(g)}`,{cause:g})}f.length>0&&K.info("executeModelSwitch: session/load reloaded",{agentId:e,count:f.length}),i.status="ok",K.info("executeModelSwitch: success",{agentId:e,framework:i.framework})}};U();import{spawn as Ba}from"node:child_process";import{constants as Hs,access as Oa}from"node:fs/promises";import{delimiter as Ra,join as Ma}from"node:path";var za=L("framework-detector"),Gs={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},qa=[".exe",".cmd",".bat",".ps1"],vt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Ba,access:e.access??Oa}}async detect(e){let i=Gs[e],a=await this.which(i);if(!a)return za.debug("framework binary not found",{framework:e,bin:i}),null;let x=await this.probeVersion(a);return{path:a,version:x}}async detectAll(){let e=await Promise.all(Object.keys(Gs).map(async a=>[a,await this.detect(a)])),i={};for(let[a,x]of e)x&&(i[a]=x);return i}async which(e){let i=this.env.pathEnv.split(Ra).filter(Boolean),a=this.env.platform==="win32"?["",...qa]:[""];for(let x of i)for(let f of a){let u=Ma(x,e+f);if(await this.isExecutable(u))return u}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Hs.F_OK:Hs.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",x=!1,f,u=h=>{x||(x=!0,f&&clearTimeout(f),i(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});f=setTimeout(()=>{h.kill("SIGKILL"),u("unknown")},5e3),h.stdout?.on("data",g=>{a+=g.toString("utf8")}),h.on("error",()=>u("unknown")),h.on("close",()=>{let g=Ua(a).split(/\r?\n/)[0]??"";u(g)})}catch{u("unknown")}})}},Fa=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Ua(r){return r.replace(Fa,"")}nr();xe();function rn(r){return zt(r??j().configFile)}function ft(r,e){return qt(e??j().configFile,r)}var St="(pending-pair)";it();U();var Q=L("core"),ja=5*6e4,Ka=3e4,sn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;upstreamIds=new ct;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths}registerExtension(e,i){this.extensions[e]=i}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),Q.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){Q.info("Core stopping",{reason:e}),await Promise.all([...this.agents.values()].map(i=>i.dispose(e))),this.agents.clear(),await this.upstream.stop(e)}get(e){return this.agents.get(e)}register(e){this.agents.set(e.agentId,e),this.attachDownstreamHooks(e),Q.info("agent registered",{agentId:e.agentId,framework:e.framework})}unregister(e){this.agents.delete(e)}reviveIfDisconnected(e){this.disconnectedAgents.delete(e)&&Q.info("agent revived from disconnect",{agentId:e})}attachDownstreamHooks(e){e.downstream.onUpdate(i=>{this.forwardUpdate(e,i)}),e.downstream.onAgentRequest(i=>{this.handleAgentRequest(e,i)}),e.downstream.onExit((i,a)=>{Q.warn("agent downstream exited",{agentId:e.agentId,code:i,signal:a})})}attachHooks(e){this.attachDownstreamHooks(e)}async handleFrame(e){if(Jt(e)){this.handleUpstreamResponse(e);return}if(Vt(e))try{if(e.method.startsWith("_agent/")){let i=this.extensions[e.method];if(!i){await this.sendError(e.id,z.METHOD_NOT_FOUND,`extension not registered: ${e.method}`);return}let a=await i(e,this);await this.upstream.send(xt(e.id,a));return}if(e.method.startsWith("session/")){let i=await this.routeSessionMethod(e);await this.upstream.send(xt(e.id,i));return}if(e.method==="initialize"){await this.upstream.send(xt(e.id,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}await this.sendError(e.id,z.METHOD_NOT_FOUND,`method not implemented: ${e.method}`)}catch(i){Q.error("handleFrame failed",{method:e.method,err:String(i)}),await this.upstream.send(Je(e.id,Xt(i)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new C("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new C("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new C("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new C("AGENT_NOT_FOUND",`agent not found: ${a}`);if(x.status==="switching")throw new C("MODEL_SWITCHING",`agent ${a} is switching model; retry later`,{retriable:!0});let f=Date.now(),u=!1;try{let h=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,i));return u=!0,h}finally{Q.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-f,ok:u})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:x}=Ds(a);switch(i){case"session/new":{let f=x;return await e.downstream.sessionNew({...f,cwd:f.cwd||e.workspace})}case"session/load":{let f=x,u=f.sessionId,h=e.sessions.get(u);try{let g=h??u,_=await e.downstream.sessionLoad({...f,sessionId:g,cwd:f.cwd||e.workspace});return h||e.sessions.set(u,g),_}catch(g){Q.warn("session/load failed,fallback to session/new",{agentId:e.agentId,cloudId:u,err:String(g)});let _=await e.downstream.sessionNew({cwd:f.cwd||e.workspace});return e.sessions.set(u,_.sessionId),{}}}case"session/prompt":{let f=x,u=f.sessionId,h=e.sessions.get(u),g=!1;if(h&&!e.verifiedSessions.has(h))try{await e.downstream.sessionLoad({sessionId:h,cwd:e.workspace}),e.verifiedSessions.add(h),Q.info("session restored via session/load",{agentId:e.agentId,cloudId:u,acpId:h})}catch(b){Q.warn("session/load failed,fallback to session/new",{agentId:e.agentId,cloudId:u,acpId:h,err:String(b)}),e.sessions.delete(u),h=void 0}h||(h=(await e.downstream.sessionNew({cwd:e.workspace})).sessionId,e.sessions.set(u,h),e.verifiedSessions.add(h),g=!0);let _=a._meta?.cozeTriggerMsgId;_?e.activeTriggers.set(h,_):e.activeTriggers.delete(h);let w=await e.downstream.sessionPrompt({...f,sessionId:h});return g&&this.persistSessionMapping(e),w}case"session/cancel":{let u=x.sessionId;if(!u)throw new C("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(u);return h&&await e.downstream.sessionCancel({sessionId:h}),{ok:!0}}default:throw new C("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}forwardUpdate(e,i){let a=i.sessionId,x=this.reverseSessionId(e,a);if(!x){Q.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let f={cozeAgentId:e.agentId},u=e.activeTriggers.get(a);u&&(f.cozeTriggerMsgId=u),this.upstream.send(Os("session/update",{...i,sessionId:x,_meta:f})).catch(h=>Q.warn("forward update failed",{agentId:e.agentId,err:String(h)}))}handleAgentRequest(e,i){if(i.method==="session/request_permission"){this.forwardPermissionRequest(e,i);return}Q.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:i.method}),e.downstream.respondAgentRequestError(i.id,{code:z.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${i.method}`})}forwardPermissionRequest(e,i){let a=this.upstreamIds.next("session/request_permission"),x=i.params??{},u=x.sessionId,h=u?e.activeTriggers.get(u):void 0,g={cozeAgentId:e.agentId};h&&(g.cozeTriggerMsgId=h);let _=u?this.reverseSessionId(e,u):void 0,w={...x,..._?{sessionId:_}:{},_meta:g},b=setTimeout(()=>{let D=this.pendingUpstream.get(a);D&&(this.pendingUpstream.delete(a),Q.warn("upstream permission request timed out,replying cancelled to agent",{agentId:e.agentId,upstreamId:a}),e.downstream.respondAgentRequest(D.agentRequestId,{outcome:{kind:"cancelled"}}))},ja);this.pendingUpstream.set(a,{agentRequestId:i.id,session:e,method:i.method,timer:b}),this.upstream.send(at(a,"session/request_permission",w)).catch(D=>{let k=this.pendingUpstream.get(a);k&&(clearTimeout(k.timer),this.pendingUpstream.delete(a)),Q.error("forward permission request failed",{agentId:e.agentId,err:String(D)}),e.downstream.respondAgentRequestError(i.id,{code:z.INTERNAL_ERROR,message:`upstream send failed: ${String(D)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),clearTimeout(i.timer),e.error?i.session.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.session.downstream.respondAgentRequest(i.agentRequestId,e.result);return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new Wt(e.error)):a.resolve(e.result);return}Q.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=Ka){let x=this.upstreamIds.next(e);return new Promise((f,u)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),u(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:u,timer:h}),this.upstream.send(at(x,e,i)).catch(g=>{let _=this.pendingBridge.get(x);_&&(clearTimeout(_.timer),this.pendingBridge.delete(x)),u(g)})})}async persistSessionMapping(e){if(this.paths)try{await rr(e.agentId,e.sessions,this.paths)}catch(i){Q.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[a,x]of e.sessions.entries())if(x===i)return a}sendError(e,i,a){return this.upstream.send(Je(e,{code:i,message:a}))}};U();xe();import{randomBytes as Ha}from"node:crypto";import{chmod as Ga,mkdir as Wa,writeFile as Ws}from"node:fs/promises";import{createServer as Va}from"node:http";import{dirname as Ja}from"node:path";var Xa=1e6,or=L("ipc"),on=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(i=>[`${i.method} ${i.path}`,i])),this.paths=e.paths??j()}async start(){this.token=Ha(32).toString("hex");let e=Va((a,x)=>{this.dispatch(a,x)});this.server=e,await new Promise((a,x)=>{e.once("error",x),e.listen(0,"127.0.0.1",()=>a())});let i=e.address();if(!i||typeof i!="object")throw new Error("failed to obtain IPC port");return this.port=i.port,await this.persistAuthFiles(),or.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((i,a)=>{e.close(x=>x?a(x):i())}),this.server=null)}async persistAuthFiles(){await Wa(Ja(this.paths.portFile),{recursive:!0}),await Ws(this.paths.portFile,String(this.port),"utf8"),await Ws(this.paths.tokenFile,this.token,"utf8");try{await Ga(this.paths.tokenFile,384)}catch(e){or.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Et(i,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){Et(i,404,{error:"not found"});return}let u=null;if(e.method==="POST")try{u=await Za(e)}catch(h){Et(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await f.handler(u,e);Et(i,200,h??{ok:!0})}catch(h){or.error("IPC handler failed",{key:x,err:String(h)}),Et(i,500,{error:h instanceof Error?h.message:String(h)})}}};function Et(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function Za(r){let e=[],i=0;for await(let x of r){let f=x;if(i+=f.length,i>Xa)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var wo=Pe(ri(),1);var kc=Pe(Qi(),1),Nc=Pe(vn(),1),Lc=Pe(lt(),1),Bc=Pe(wr(),1),Oc=Pe(vr(),1),Rc=Pe(Pr(),1),ao=Pe(Dn(),1),Mc=Pe(oo(),1);var xo=ao.default;U();var Pn="1008033",co="1289";var fo="pbbp2",uo="https://www.coze.cn",lo="/api/coze_claw/resource/get_frontier_key",zc="https://www.coze.cn",qc="wss://frontier.coze.cn";function ho(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??zc}function go(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??qc}function Tn(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),a&&(e["x-use-ppe"]=a),e}var re=L("upstream.frontier"),mo="application/json",_o="none",In=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){re.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:uo,...Tn(this.opts.ppeOverride)};class i extends xo{constructor(h){super(h,fo,{headers:e})}send(h,...g){if(ms("debug"))try{let _;typeof h=="string"?_=Buffer.from(h,"utf8"):h instanceof Buffer?_=h:h instanceof ArrayBuffer?_=new Uint8Array(h):ArrayBuffer.isView(h)?_=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):_=new Uint8Array(0);let w=Buffer.from(_.slice(0,128)).toString("hex");re.debug("WS raw frame out",{bytes:_.byteLength,headHex:w})}catch(_){re.warn("WS raw frame dump failed",{err:String(_)})}super.send(h,...g)}}let a=go(this.opts.urlOverride),x={url:a,ws:i,fpID:co,aID:Pn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:mo,force:!0},payloadEncoding:{encoding:_o,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new wo.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let u=this.openCount===1;re.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:u,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:u})).catch(h=>re.warn("onConnect handler threw (ignored)",{err:String(h)}))},f.onclose=u=>{this.opened=!1,re.info("frontier closed",{code:u.code,reason:u.reason,willReconnect:u.willReconnect})},f.onerror=u=>{re.warn("frontier error",{code:u.code,msg:u.message})},f.onmessage=u=>this.handleMessage(u),this.fws=f,await f.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(a){re.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new C("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;re.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:mo,payloadEncoding:_o})}catch(f){throw new C("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(f)}`,{cause:f})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let i=e.message?.service;if(i!==33555712){re.debug("drop non-adapter frontier frame",{service:i});return}let a=jc(e);if(!a){re.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){re.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){re.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}re.info("frontier frame in",{logid:Uc(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>re.warn("frontier frame handler threw",{err:String(f)}))}};function Uc(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function jc(r){let e=r.message;if(e?.textPayload)return e.textPayload;let i=e?.payload;if(!i)return null;try{return Buffer.from(i).toString("utf8")}catch{return null}}U();function yo(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var bo=L("handshake");async function vo(r){let e=ho(r.endpoint),i=r.timeoutMs??1e4,a=`${Kc(e)}${lo}?aid=${encodeURIComponent(Pn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Tn(r.ppeOverride)},f=new AbortController,u=setTimeout(()=>f.abort(),i);bo.info("frontier key handshake",{base:e,deviceId:r.deviceId||St});try{let h=await fetch(a,{method:"GET",headers:x,signal:f.signal}),g=h.headers.get("x-tt-logid")??"",_=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let k=await h.text().catch(()=>"");throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${g}: ${k.slice(0,200)}`)}let w=await h.json();if(w.code!==void 0&&w.code!==0)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${w.code} msg=${w.msg??"-"} logid=${g}`);let b=w.data?.access_key,D=w.data?.device_id;if(!b||!D)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${g}: ${JSON.stringify(w)}`);return bo.info("handshake ok",{remoteDeviceId:D,logid:g,traceId:_}),{accessKey:b,deviceId:D}}catch(h){throw h instanceof C?h:h.name==="AbortError"?new C("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new C("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(u)}}function Kc(r){return r.endsWith("/")?r.slice(0,-1):r}U();var Ir=L("upstream.switchable"),kn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;Ir.info("swap upstream",{reason:i});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw Ir.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(i??"swapped").catch(x=>Ir.warn("previous upstream stop threw (ignored)",{err:String(x)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};U();var kr=L("upstream"),Lt=class{handler=null;async start(){kr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){kr.info("NoopUpstream stopped",{reason:e})}async send(e){kr.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};U();xe();U();xe();import{readFileSync as Hc,unlinkSync as Gc}from"node:fs";import{mkdir as Wc,readFile as So,unlink as Eo,writeFile as Vc}from"node:fs/promises";import{dirname as Jc}from"node:path";var Xc=L("single-instance"),Nn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??j().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(Xc.warn("removing stale pid file",{stalePid:e}),await Eo(this.pidFile).catch(()=>{})),await Wc(Jc(this.pidFile),{recursive:!0}),await Vc(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await So(this.pidFile,"utf8")).trim()===String(process.pid)&&await Eo(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await So(this.pidFile,"utf8"),i=Number.parseInt(e.trim(),10);return Number.isFinite(i)&&i>0?i:null}catch(e){if(e.code==="ENOENT")return null;throw e}}isAlive(e){try{return process.kill(e,0),!0}catch(i){return i.code==="EPERM"}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Hc(this.pidFile,"utf8").trim()===String(process.pid)&&Gc(this.pidFile)}catch{}})}};var Z=L("daemon"),Zc="coze-bridge-daemon";async function Do(){let r=new Nn({processTitle:Zc}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await rn(),a=i??{deviceId:""};tr({deviceId:a.deviceId||St,pid:process.pid}),i?Z.info("loaded bridge config",{deviceId:a.deviceId||St}):Z.info("initialized bridge config (deviceId pending first pair)");try{let I=new vt;a.frameworksCache=await I.detectAll(),Z.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(I){Z.warn("framework detection failed",{err:String(I)})}await ft(a);let x=new kn(new Lt),f=j(),u=new sn({upstream:x,paths:f});await Qc(f,u);let h=new nn({paths:f,config:a,registry:u,healthReporter:async I=>{await u.sendRequest("_agent/health",I)}}),g,_;u.registerExtension("_agent/create",async I=>h.createAgent(I.params)),u.registerExtension("_agent/health",async()=>({ok:!0}));let w=new Gt({agents:u.agents,disposeAndMarkDisconnected:async(I,F)=>{let V=u.agents.get(I);V&&(await V.dispose(`disconnect: ${F}`).catch(se=>Z.warn("dispose during disconnect failed (ignored)",{agentId:I,err:String(se)})),V.status="disconnected",u.unregister(I)),u.disconnectedAgents.add(I)},executeModelSwitch:I=>h.executeModelSwitch(I)});u.registerExtension("_agent/listSkills",I=>w.listSkills(I.params)),u.registerExtension("_agent/addSkills",I=>w.addSkills(I.params)),u.registerExtension("_agent/removeSkills",I=>w.removeSkills(I.params)),u.registerExtension("_agent/getFileTree",I=>w.getFileTree(I.params)),u.registerExtension("_agent/getFileContent",I=>w.getFileContent(I.params)),u.registerExtension("_agent/update",I=>w.updateAgent(I.params)),u.registerExtension("_agent/disconnect",I=>w.disconnectAgent(I.params)),u.registerExtension("_agent/switchModel",I=>w.switchModel(I.params));let b=new jt({paths:f,handlers:w,sendDetail:I=>u.sendRequest("_agent/detail",I)});x.onConnect(({initial:I})=>{Z.info("frontier upstream connected, triggering detail sync",{initial:I}),b.syncAll(I?"initial-connect":"reconnect").catch(F=>Z.warn("detail sync top-level error (ignored)",{err:String(F)}))});let D=new on({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...u.agents.keys()],deviceId:a.deviceId,frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async I=>{let F=I,V=F?.privatecode,se=F?.pairing_code;if(!V||!se)throw new C("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let me=yo(F.env),Oe=F.handshake_url,Ee=F.frontier_url,_e=Yc(F.env,Oe,Ee),Ce=!!g&&g!==V,we=_!==void 0&&_!==_e;if(Ce||we){Z.warn("pair config switched, resetting agents",{pcChanged:Ce,envChanged:we,previousPc:g?Co(g):"",nextPc:Co(V),previousEnvKey:_??"",nextEnvKey:_e});for(let ee of[...u.agents.values()])await ee.dispose("pair config switch").catch(()=>{}),u.agents.delete(ee.agentId);await x.swap(new Lt,"pair switch").catch(()=>{})}let Ke=await vo({privatecode:V,deviceId:a.deviceId,...Oe?{endpoint:Oe}:{},ppeOverride:me});a.deviceId||(await ft({...a,deviceId:Ke.deviceId}),a.deviceId=Ke.deviceId,tr({deviceId:a.deviceId,pid:process.pid}),Z.info("bootstrapped local deviceId from handshake",{deviceId:a.deviceId}));let Fn=new In({handshake:Ke,privatecode:V,bridgeDeviceId:a.deviceId,...Ee?{urlOverride:Ee}:{},ppeOverride:me});await x.swap(Fn,"pair"),g=V,_=_e;let Un=Object.keys(a.frameworksCache??{});try{let ee=await u.sendRequest("_agent/pair",{pairCode:se,patToken:V,frameworks:Un,_meta:{cozeDeviceId:a.deviceId}});return Z.info("_agent/pair ok",{pairResult:ee}),{ok:!0,note:"paired with cloud"}}catch(ee){return Z.error("_agent/pair failed",{err:String(ee)}),{ok:!1,note:`pair failed: ${String(ee)}`}}}},{method:"POST",path:"/_agent/create",handler:async I=>{let F=I;return{ok:!0,result:await h.createAgent(F)}}},{method:"POST",path:"/refresh",handler:async()=>{Z.info("IPC /refresh: re-detecting frameworks");let I=new vt;return a.frameworksCache=await I.detectAll(),await ft(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(Z.info("IPC /shutdown received"),setImmediate(()=>{q.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:k,token:B}=await D.start();await u.start();let N=null,q={port:k,token:B,core:u,ipc:D,shutdown(I){return N||(Z.info("daemon shutdown",{reason:I}),N=(async()=>{await u.stop(I),await D.stop(),await r.release()})(),N)}};for(let I of["SIGTERM","SIGINT"])process.on(I,()=>{q.shutdown(I).then(()=>process.exit(0))});return Z.info("daemon ready",{port:k,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),q}function Co(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function Yc(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function Qc(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:f}=await Promise.resolve().then(()=>(it(),ws));for(let u of a){await f(u,r).catch(h=>Z.warn("enforceAgentConfigMode failed (ignored)",{agentId:u,err:String(h)}));try{let h=await x(u,r);h?.disconnectedAt&&(e.disconnectedAgents.add(u),Z.info("agent marked disconnected on startup",{agentId:u,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){Z.warn("failed to load agent config on startup, skipping",{agentId:u,err:String(h)})}}}Lr();xe();import{readFile as Po}from"node:fs/promises";var je=class{paths;constructor(e){this.paths=e??j()}async probe(e=1e3){let i=await this.readAuth();if(!i)return{kind:"not-running"};try{let a=await this.fetch(i,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...i}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:xf(a)}}}async request(e){let i=await this.readAuth();if(!i)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(i,e)}async readAuth(){try{let[e,i]=await Promise.all([Po(this.paths.portFile,"utf8"),Po(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=i.trim();return!Number.isFinite(a)||a<=0||!x?null:{port:a,token:x}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let a=i.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let f=new AbortController,u=setTimeout(()=>f.abort(),i.timeoutMs??5e3);try{let h=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:x,body:a?JSON.stringify(i.body):void 0,signal:f.signal}),g=await h.text();return{status:h.status,body:af(g)}}finally{clearTimeout(u)}}};function af(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function xf(r){return r instanceof Error?r.message:String(r)}U();xe();import{copyFile as To,mkdir as cf,readFile as Br,writeFile as ff}from"node:fs/promises";import{dirname as uf,resolve as Or,sep as Ln}from"node:path";import{fileURLToPath as df}from"node:url";U();xe();var Io=L("dist-install");function lf(r){let e=df(r),i=uf(e),a=`${Ln}src${Ln}`;if(i.includes(a)||i.endsWith(`${Ln}src${Ln}cli`))return null;let x=Or(i,"index.js"),f=Or(i,"..","package.json");return{dist:x,pkgJson:f}}async function ko(r={}){let e=r.paths??j(),i=lf(import.meta.url),a=r.sourceDist??i?.dist,x=r.sourcePackageJson??i?.pkgJson;if(!a||!x)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let f;try{f=JSON.parse(await Br(x,"utf8")).version??"unknown"}catch(b){return Io.warn("cannot read source package.json,skip dist install",{err:String(b)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(b)}`}}let u=await rn(e.configFile)??{deviceId:""},h=u.libVersion;if(h===f)try{return await Br(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await cf(e.libDir,{recursive:!0}),await To(a,e.libEntry),await To(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let g=Or(e.libDir,"package.json"),_=`${JSON.stringify({type:"module"},null,2)}
|
|
91
|
-
`;return await
|
|
88
|
+
${x}`}var be=T("agent-detail-sync"),Jt=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await ea(i)}catch(x){be.info("agents dir not found, skip detail sync",{root:i,err:String(x)});return}be.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){be.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}be.info("detail sync done",{reason:e})}async syncOne(e){let i=await ae(e,this.opts.paths);if(!i){be.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(u){be.warn("detail RPC failed, using local data",{agentId:e,err:String(u)});return}if(a.agentId&&a.agentId!==e){be.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,f=!1;if(a.agentName&&a.agentName!==i.agentName&&(i.agentName=a.agentName,x=!0),a.description!==void 0&&a.description!==i.description&&(i.description=a.description,x=!0),a.cozeIdentity&&a.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=a.cozeIdentity,x=!0,f=!0),a.deployType&&be.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){be.debug("detail sync: no diff",{agentId:e});return}await de(i,this.opts.paths),be.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:i.agentName}),f&&(await Ve(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ue();import{spawn as ta}from"node:child_process";import{mkdir as na,readFile as Ns,readdir as ra,rm as sa,stat as Yt,writeFile as ia}from"node:fs/promises";import{join as Le,normalize as oa,relative as Os,resolve as aa,sep as Bs}from"node:path";function Ss(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Cs(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function xt(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var A=class extends Error{code;retriable;cause;constructor(e,i,a){super(i),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};U();ce();function Ye(r,e){if(Ss(r)!=="cloud")throw new A("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}var Es="https://llm-gateway.coze.cn",Vt="auto";function fr(r){return{model:r.model??Vt,...r.modelToken?{modelToken:r.modelToken}:{}}}function As(r){return!r||r===Vt}function Ds(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=Es,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),As(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function ks(r){let e=[];return As(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_provider="openai"'),e.push("-c",`model_provider_overrides.openai.base_url="${Es}/v1"`)),e}function Ps(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var $=T("agent-handlers"),Is=5*1024*1024,xa=1,ca=6,fa=new Set(["node_modules",".git",".coze","dist","build",".next"]),ua=3e4,Xt=class{constructor(e){this.opts=e}opts;async listSkills(e){Ye(e._meta,"_agent/listSkills");let i=xt(e._meta),a=await this.loadAgentCfg(i),x=a?.workspace??Te(i).workspace,f=a?.skills??[],u=[];for(let h of f){let p=Le(x,h.relPath,"SKILL.md");await Yt(p).then(b=>b.isFile()).catch(()=>!1)&&u.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:u}}async addSkills(e){Ye(e._meta,"_agent/addSkills");let i=xt(e._meta),a=await this.requireAgentCfg(i),x=e.skills??[],f=[...a.skills??[]],u=new Map(f.map((p,w)=>[p.skillId,w])),h=[];for(let p of x){if(!p.skillName)throw new A("IPC_BAD_REQUEST","skill missing skillName");let w=da(p.skillName),b=la(a.framework),y=Le(b,w),E=Le(a.workspace,y);await na(E,{recursive:!0});let P=await ga(p.downloadUrl);ma(P)?await wa(P,E):await ia(Le(E,"SKILL.md"),P.toString("utf8"),"utf8");let I={skillId:p.skillId,skillName:p.skillName,relPath:y,installedAt:Date.now(),...p.description?{description:p.description}:{},...p.version?{version:p.version}:{},...p.downloadUrl?{downloadUrl:p.downloadUrl}:{}},L=u.get(p.skillId);L!==void 0?f[L]=I:(u.set(p.skillId,f.length),f.push(I)),h.push(p),$.info("skill installed",{agentId:i,skillId:p.skillId,skillName:p.skillName,relPath:y})}return await jt(i,f),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){Ye(e._meta,"_agent/removeSkills");let i=xt(e._meta),a=await this.requireAgentCfg(i),x=new Set(e.skillIds??[]),f=a.skills??[],u=[];for(let h of f){if(!x.has(h.skillId)){u.push(h);continue}let p=Le(a.workspace,h.relPath);await sa(p,{recursive:!0,force:!0}),$.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await jt(i,u),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex")for(let[x,f]of a.sessions)try{await a.downstream.sessionLoad({sessionId:f,cwd:a.workspace}),$.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f})}catch(u){$.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f,err:String(u)})}}async updateAgent(e){if(!e.cozeIdentity?.trim())return $.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await ae(i);if(!a)throw new A("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?($.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await de(a),await Ve(a.workspace,a.framework,i,e.cozeIdentity),$.info("_agent/update: cozeIdentity rewritten",{agentId:i,framework:a.framework}),await this.reloadAgentSessions(i,"identity-changed"),{ok:!0})}async disconnectAgent(e){let i=e.agentId;if(!i)throw new A("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await ae(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await de(a),$.info("agent disconnected",{agentId:i,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(i,e.reason??"disconnect"),{ok:!0}):($.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Ye(e._meta,"_agent/switchModel"),!e.agentId)throw new A("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model&&e.model.trim()?e.model:Vt,a=e.modelToken?.trim()||void 0,x=await ae(e.agentId);if(!x)throw new A("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);x.model=i,a!==void 0?x.modelToken=a:delete x.modelToken,await de(x),$.info("_agent/switchModel: model/modelToken persisted",{agentId:e.agentId,model:i,hasToken:!!a,reason:e.reason??"",force:e.force??!1});let f=this.opts.agents.get(e.agentId);if(!f)return $.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};if(f.status==="switching")return $.info("_agent/switchModel: already switching, params updated via config",{agentId:e.agentId}),{ok:!0};if(!this.opts.executeModelSwitch)throw new A("BRIDGE_INTERNAL","_agent/switchModel: executeModelSwitch callback not wired");f.status="switching";let u=f.msgQueue.enqueue(async()=>{}),h=setTimeout(()=>{$.warn("_agent/switchModel: 30s idle timeout, forcing downstream stop",{agentId:e.agentId}),f.downstream.stop("switchModel idle timeout").catch(p=>$.warn("force stop failed (ignored)",{agentId:e.agentId,err:String(p)}))},ua);try{return await u.catch(p=>$.warn("_agent/switchModel: msgQueue idle wait rejected (continuing)",{agentId:e.agentId,err:String(p)})),clearTimeout(h),await this.opts.executeModelSwitch(e.agentId),{ok:!0}}catch(p){clearTimeout(h),$.error("_agent/switchModel: failed, marking disconnected",{agentId:e.agentId,err:String(p)});let w=await ae(e.agentId).catch(()=>null);throw w&&(w.disconnectedAt=Date.now(),w.disconnectReason=`model switch failed: ${p instanceof Error?p.message:String(p)}`,await de(w).catch(b=>$.warn("write disconnect marker failed (ignored)",{err:String(b)}))),this.opts.disposeAndMarkDisconnected?await this.opts.disposeAndMarkDisconnected(e.agentId,`model switch failed: ${p instanceof Error?p.message:String(p)}`).catch(b=>$.warn("disposeAndMarkDisconnected failed (ignored)",{err:String(b)})):f.status="disconnected",p instanceof A&&(p.code==="MODEL_SWITCH_FAILED"||p.code==="AGENT_NOT_FOUND")?p:new A("MODEL_SWITCH_FAILED",p instanceof Error?p.message:String(p),{cause:p})}}async getFileTree(e){Ye(e._meta,"_agent/getFileTree");let i=e._meta,a=xt(i),x=this.resolveWorkspace(a),f=e.filePath??"",u=this.safeJoin(x,f),h=await Yt(u).catch(()=>null);if(!h)throw new A("IPC_BAD_REQUEST",`path not found: ${f}`);let p=_a(e.depth);return h.isDirectory()?{tree:await Rs(x,u,f,p)}:{tree:[{name:ya(f),path:Ms(f||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Ye(e._meta,"_agent/getFileContent");let i=xt(e._meta),a=this.resolveWorkspace(i);if(!e.filePath)throw new A("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await Yt(x).catch(()=>null);if(!f||!f.isFile())throw new A("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.size>Is)throw new A("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${Is})`);let u=await Ns(x);return u.includes(0)?{content:u.toString("base64"),encoding:"base64",size:f.size}:{content:u.toString("utf8"),encoding:"utf-8",size:f.size}}resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:Te(e).workspace}safeJoin(e,i){let a=aa(e,i||"."),x=Os(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Bs}`))throw new A("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return ae(e)}async requireAgentCfg(e){let i=await this.loadAgentCfg(e);if(!i)throw new A("AGENT_NOT_FOUND",`no config for agent: ${e}`);return i}};function da(r){let e=r.trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new A("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function la(r){return r==="claude-code"?Le(".claude","skills"):Le(".agents","skills")}var ha=3e4,Ts=50*1024*1024,Ls=3e4;async function ga(r){if(!r)throw new A("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:"))return pa(r);if(r.startsWith("file:")){let e=new URL(r).pathname,i=await Ns(e);if(i.length>Ts)throw new A("IPC_BAD_REQUEST",`skill too large: ${i.length} bytes`);return i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),ha);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new A("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();if(x.byteLength>Ts)throw new A("IPC_BAD_REQUEST",`skill too large: ${x.byteLength} bytes`);return Buffer.from(x)}finally{clearTimeout(i)}}throw new A("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function pa(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new A("IPC_BAD_REQUEST","bad data URL");let i=!!e[2],a=e[3]??"";return i?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function ma(r){return r.length>=2&&r[0]===31&&r[1]===139}async function wa(r,e){await new Promise((i,a)=>{let x=ta("tar",["-xzf","-","-C",e,"--strip-components=1"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",h=>{f+=String(h)});let u=setTimeout(()=>{x.kill("SIGKILL"),a(new A("IPC_BAD_REQUEST",`tar extract timeout (${Ls}ms)`))},Ls);x.on("error",h=>{clearTimeout(u),a(new A("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(u),h===0?i():a(new A("IPC_BAD_REQUEST",`tar exit ${h}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Rs(r,e,i,a){if(a<=0)return[];let x;try{x=await ra(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let u of x){if(fa.has(u.name))continue;let h=Le(e,u.name),p=oa(Le(i,u.name)),w=null;try{w=await Yt(h)}catch{continue}let b={name:u.name,path:Ms(Os(r,h)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&a>1&&(b.children=await Rs(r,h,p,a-1)),f.push(b)}return f.sort((u,h)=>u.isDir!==h.isDir?u.isDir?-1:1:u.name.localeCompare(h.name)),f}function _a(r){return!r||r<=0?xa:Math.min(r,ca)}function ya(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function Ms(r){return r.split(Bs).join("/")}U();var Ct=T("agent-health-reporter"),ba=3e4,$t=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??ba}opts;timer=null;inFlight=!1;intervalMs;start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs),this.timer.unref?.(),Ct.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,Ct.info("heartbeat stopped"))}async tick(){if(this.inFlight){Ct.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Ct.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let i=[...this.opts.core.agents.values()];for(let a of i){let x=va(a);if(!x)continue;let f={status:x,_meta:{cozeAgentId:a.agentId,cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",f)}catch(u){Ct.warn("heartbeat send failed",{agentId:a.agentId,status:x,err:String(u)})}}}finally{this.inFlight=!1}}};function va(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"||r.status==="degraded"?"online":null}Ue();import{mkdir as ur,rm as La}from"node:fs/promises";import{spawn as Da}from"node:child_process";function ct(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function zs(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function ft(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Xe(r,e){return{jsonrpc:"2.0",id:r,error:e}}var Zt=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},K={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_SWITCHING:-32007,MODEL_SWITCH_FAILED:-32008};function Qt(r){return"method"in r&&"id"in r&&r.id!==void 0}function qs(r){return"method"in r&&!("id"in r)}function en(r){return!("method"in r)&&"id"in r}var Sa={AGENT_NOT_FOUND:K.AGENT_NOT_FOUND,AGENT_BUSY:K.AGENT_BUSY,AGENT_DISCONNECTED:K.AGENT_DISCONNECTED,AGENT_TIMEOUT:K.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:K.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:K.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:K.INTERNAL_ERROR,BRIDGE_INTERNAL:K.INTERNAL_ERROR,IPC_AUTH_FAILED:K.INTERNAL_ERROR,IPC_BAD_REQUEST:K.INVALID_REQUEST,MODEL_SWITCHING:K.MODEL_SWITCHING,MODEL_SWITCH_FAILED:K.MODEL_SWITCH_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:K.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:K.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:K.INTERNAL_ERROR};function tn(r){return r instanceof A?{code:Sa[r.code]??K.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:K.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function Fs(r){let e=r.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new A(i,r.message,{retriable:e?.retriable??!1,cause:r.data})}function Us(r){return`${JSON.stringify(r)}
|
|
89
|
+
`}var nn=class{buffer="";onError;constructor(e={}){this.onError=e.onError}push(e){this.buffer+=typeof e=="string"?e:e.toString("utf8");let i=this.buffer.split(`
|
|
90
|
+
`);this.buffer=i.pop()??"";let a=[];for(let x of i){let f=x.replace(/\r$/,"").trim();if(f)try{a.push(JSON.parse(f))}catch(u){this.onError?.({line:f,error:u})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(i){return this.onError?.({line:e,error:i}),[]}}};var Hs={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel",initialize:"initialize"},qu=Object.fromEntries(Object.entries(Hs).map(([r,e])=>[e,r])),Ca={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":["agentId"],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.pair":[],initialize:[]},ut=class{seq=0;next(e,i){this.seq+=1;let a=Hs[e]??Ea(e),x=Ca[a]??[],f=[a,String(this.seq)];if(x.length>0){let u=x.map(p=>Ks(i?.[p]??"")),h=Aa(u).join(":");h&&f.push(h)}else i&&Object.values(i).some(u=>u)&&f.push(Object.values(i).filter(Boolean).map(u=>Ks(String(u))).join(":"));return f.join("_")}reset(){this.seq=0}};function Ea(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Ks(r){return r.replace(/[:_\s]+/g,"-")}function Aa(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}U();var ka=3e4;function Ws(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Ke=class{constructor(e){this.opts=e;this.log=T(`downstream.${this.constructor.name}`),this.decoder=new nn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new ut;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new A("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=Da(this.opts.command,this.opts.args,{cwd:this.opts.cwd,env:{...this.sanitizeEnv(process.env),...this.opts.env},stdio:["pipe","pipe","pipe"],detached:e});this.child=i,i.stdout?.setEncoding("utf8"),i.stdout?.on("data",a=>{for(let x of this.decoder.push(a))this.dispatch(x)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),i.on("exit",(a,x)=>{this.stopped=!0,this.failAllPending(new A("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let f of this.exitHandlers)f(a,x)}),i.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new A("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:i.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let i=this.child,a=new Promise(f=>i.once("exit",()=>f()));Ws(i.pid,"SIGTERM");let x=setTimeout(()=>{i.killed||Ws(i.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(x)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){if(!this.child||this.stopped)return;let i=this.idAllocator.next("session/cancel");this.writeFrame(ct(i,"session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(ft(e,i))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(Xe(e,i))}catch(a){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(a)})}}onExit(e){this.exitHandlers.push(e)}call(e,i,a=ka){if(!this.child||this.stopped)return Promise.reject(new A("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=ct(x,e,i),u=a>0&&Number.isFinite(a);return new Promise((h,p)=>{let w=u?setTimeout(()=>{this.pending.delete(x),p(new A("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:h,reject:p,timer:w,method:e});try{this.writeFrame(f)}catch(b){w&&clearTimeout(w),this.pending.delete(x),p(b)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new A("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(Us(e))}dispatch(e){if(en(e)){let i=e.id!==null?this.pending.get(e.id):void 0;if(!i){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),i.timer&&clearTimeout(i.timer),e.error?i.reject(Fs(e.error)):i.resolve(e.result);return}if(qs(e)){if(e.method==="session/update")for(let i of this.updateHandlers)Promise.resolve(i(e.params)).catch(a=>this.log.warn("update handler failed",{err:String(a)}));else this.log.debug("unknown notification",{method:e.method});return}if(Qt(e)){let i=e;this.handleAgentRequest(i).catch(a=>this.log.error("agent request handler failed",{method:i.method,err:String(a)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(Xe(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let i of this.agentRequestHandlers)try{await i(e)}catch(a){this.log.error("agentRequestHandler threw",{method:e.method,err:String(a)});try{this.writeFrame(Xe(e.id,tn(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var Pa="@zed-industries/claude-code-acp@latest";function Ia(r){let e={};for(let[i,a]of Object.entries(r))a!==void 0&&(i.startsWith("CLAUDE")||i==="AI_AGENT"||i==="BAGGAGE"||(e[i]=a));return e}var rn=class extends Ke{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",Pa],x={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return Ia(e)}};var Ta="@zed-industries/codex-acp@latest",sn=class extends Ke{framework="codex";constructor(e){let i=e.command??"npx",a=e.args??["-y",Ta],x=e.extraArgs?[...a,...e.extraArgs]:a,f={command:i,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f)}};import{spawn as js}from"node:child_process";U();var on=class extends Ke{framework="openclaw";registerLog;profile;agentId;sessionName;registered=!1;constructor(e){let i=e.profile??"coze",a=e.sessionName??"default",x=["--profile",i,"acp","--session",`agent:${e.agentId}:${a}`],f={command:e.command,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f),this.profile=i,this.agentId=e.agentId,this.sessionName=a,this.registerLog=T("downstream.openclaw.register")}async start(){await this.registerAgent().catch(e=>{this.registerLog.warn("openclaw agents add failed (will continue to acp anyway)",{agentId:this.agentId,err:String(e)})}),await super.start()}registerAgent(){return new Promise((e,i)=>{let a=js(this.opts.command,["--profile",this.profile,"agents","add",this.agentId,"--workspace",this.opts.cwd,"--non-interactive"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",i),a.on("close",f=>{f===0?(this.registered=!0,this.registerLog.info("agent registered",{agentId:this.agentId,profile:this.profile}),e()):i(new A("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${f}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(i=>{let a=js(this.opts.command,["--profile",this.profile,"agents","delete",this.agentId,"--force"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",f=>{this.registerLog.warn("openclaw agents delete failed (best-effort)",{agentId:this.agentId,err:String(f)}),i()}),a.on("close",f=>{f===0?this.registerLog.info("agent unregistered",{agentId:this.agentId}):this.registerLog.warn("openclaw agents delete non-zero exit",{agentId:this.agentId,code:f,stderr:x.trim()}),this.registered=!1,i()})})}get acpSessionName(){return this.sessionName}};U();ce();var an=class{slots=[];running=!1;closed=!1;disposed=!1;enqueue(e){return this.disposed?Promise.reject(new Error("AsyncQueue disposed")):this.closed?Promise.reject(new Error("AsyncQueue closed")):new Promise((i,a)=>{this.slots.push({task:e,resolve:i,reject:a}),this.drain()})}close(){this.closed=!0}dispose(e=new Error("AsyncQueue disposed")){for(this.disposed=!0,this.closed=!0;this.slots.length>0;)this.slots.shift()?.reject(e)}get size(){return this.slots.length}get isRunning(){return this.running}async drain(){if(!this.running){this.running=!0;try{for(;this.slots.length>0&&!this.disposed;){let e=this.slots.shift();if(!e)break;try{let i=await e.task();e.resolve(i)}catch(i){e.reject(i)}}}finally{this.running=!1}}}};var xn=class{agentId;framework;workspace;msgQueue;sessions=new Map;verifiedSessions=new Set;activeTriggers=new Map;status="starting";lastActiveAt=Date.now();_downstream;constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this._downstream=e.downstream,this.msgQueue=new an}get downstream(){return this._downstream}swap(e){this._downstream=e,this.verifiedSessions.clear(),this.activeTriggers.clear()}async dispose(e){this.status="stopped",this.msgQueue.dispose(new Error(`AgentSession disposed${e?`: ${e}`:""}`)),await this._downstream.stop(e)}};var W=T("agent-manager"),Na=(r,e,i,a,x)=>{switch(r){case"claude-code":{let f=x?Ds(x):void 0;return new rn({cwd:i,...f&&Object.keys(f).length>0?{env:f}:{}})}case"codex":{let f=x?ks(x):[],u=x?Ps(x):void 0;return new sn({cwd:i,...f.length>0?{extraArgs:f}:{},...u&&Object.keys(u).length>0?{env:u}:{}})}case"openclaw":return new on({command:e,cwd:i,agentId:a})}},Oa=[0,5e3,5e3],Ba=2e4,Gs={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},cn=class{paths;config;registry;factory;restartDelaysMs;createTimeoutMs;healthReporter;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??Na,this.restartDelaysMs=e.restartDelaysMs??Oa,this.createTimeoutMs=e.createTimeoutMs??Ba,this.healthReporter=e.healthReporter}async createAgent(e){if(!e.agentId)throw new A("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new A("IPC_BAD_REQUEST","framework required");this.registry.reviveIfDisconnected?.(e.agentId);let i=this.registry.get(e.agentId);if(i){if(i.framework!==e.framework)throw new A("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${i.framework})`);if(i.status==="error")W.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await i.dispose("rebuild after error").catch(p=>W.warn("dispose stale agent failed (ignored)",{err:String(p)})),this.registry.unregister(e.agentId);else return W.info("agent already exists,return current",{agentId:e.agentId}),{ok:!0,agentId:i.agentId,workspace:i.workspace,pid:i.downstream.pid()??0,framework:i.framework}}let a=this.config.frameworksCache?.[e.framework];if(!a)throw new A("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let x=Te(e.agentId,this.paths),f=e.workspace??x.workspace,u=new AbortController,h=setTimeout(()=>u.abort(new A("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs);try{return await this.createAgentInner(e,x,f,a,u.signal)}finally{clearTimeout(h)}}async createAgentInner(e,i,a,x,f){let u=()=>{if(f.aborted)throw f.reason instanceof Error?f.reason:new A("AGENT_TIMEOUT","_agent/create aborted")},h,p,w=!1;try{await ur(i.root,{recursive:!0}),await ur(a,{recursive:!0}),await ur(i.logs,{recursive:!0}),u(),e.framework!=="openclaw"&&await Ve(a,e.framework,e.agentId,e.cozeIdentity),u();let b=await ae(e.agentId,this.paths).catch(()=>null),y=fr({model:e.model??b?.model,modelToken:e.modelToken??b?.modelToken});if(h=this.factory(e.framework,x.path,a,e.agentId,y),await h.start(),u(),await h.initialize(Gs),u(),e.framework==="openclaw"&&await Ve(a,"openclaw",e.agentId,e.cozeIdentity),p=new xn({agentId:e.agentId,framework:e.framework,workspace:a,downstream:h}),p.status="ok",b?.sessions){for(let[I,L]of Object.entries(b.sessions))p.sessions.set(I,L);Object.keys(b.sessions).length>0&&W.info("restored persisted sessions for agent",{agentId:e.agentId,count:Object.keys(b.sessions).length})}this.registry.register(p),w=!0;let E={agentId:e.agentId,framework:e.framework,workspace:a,cozeIdentity:e.cozeIdentity,createdAt:b?.createdAt??Date.now(),sessions:b?.sessions??{},model:y.model};y.modelToken&&(E.modelToken=y.modelToken),b?.skills&&(E.skills=b.skills),b?.agentName&&(E.agentName=b.agentName),b?.description&&(E.description=b.description),await de(E,this.paths);let P=h.pid()??0;return W.info("agent created",{agentId:e.agentId,framework:e.framework,pid:P}),this.installRestartHook(p),{ok:!0,agentId:e.agentId,workspace:a,pid:P,framework:e.framework}}catch(b){throw W.error("agent create failed,rolling back",{agentId:e.agentId,err:String(b)}),h?.cleanup&&await h.cleanup("rollback").catch(y=>W.warn("downstream cleanup failed (ignored)",{err:String(y)})),h&&await h.stop("rollback").catch(()=>{}),w&&p&&(await p.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await La(i.root,{recursive:!0,force:!0}).catch(y=>W.warn("rm agent dir failed (ignored)",{err:String(y)})),b instanceof A?b:new A("AGENT_SPAWN_FAILED",String(b),{cause:b})}}async reportHealth(e,i,a){if(!this.healthReporter){W.info("healthReporter not wired, skip _agent/health upstream",{agentId:e.agentId,status:i});return}try{await this.healthReporter({status:i,_meta:{cozeAgentId:e.agentId}}),W.info("_agent/health reported",{agentId:e.agentId,status:i,cause:a})}catch(x){W.warn("_agent/health upstream failed (ignored)",{agentId:e.agentId,status:i,err:String(x)})}}installRestartHook(e){let i=0,a=x=>{if(e.status==="stopped"||e.status==="disconnected"||e.status==="switching")return;if(i>=this.restartDelaysMs.length){W.error("agent restart exhausted",{agentId:e.agentId,attempts:i,...x}),e.status="error",this.reportHealth(e,"error",x);return}let f=this.restartDelaysMs[i]??5e3;i+=1,e.status="degraded",W.warn("agent restart scheduled",{agentId:e.agentId,attempt:i,delayMs:f,...x}),setTimeout(()=>{this.doRestart(e,i).then(u=>{u?(i=0,e.status="ok"):a(null)})},f)};e.downstream.onExit((x,f)=>a({code:x,signal:f}))}async spawnAndInitialize(e,i){let a=await ae(e.agentId,this.paths).catch(()=>null),x=a?fr(a):void 0,f=this.factory(e.framework,i,e.workspace,e.agentId,x);try{return await f.start(),await f.initialize(Gs),f}catch(u){throw await f.stop("spawnAndInitialize failed").catch(()=>{}),u}}rewireSession(e,i){e.swap(i),this.registry.attachHooks?.(e),this.installRestartHook(e)}async doRestart(e,i){let a=this.config.frameworksCache?.[e.framework];if(!a)return W.error("framework cache missing during restart",{agentId:e.agentId,framework:e.framework}),e.status="error",!1;W.info("agent restart attempt",{agentId:e.agentId,attempt:i});try{let x=await this.spawnAndInitialize(e,a.path);return this.rewireSession(e,x),W.info("agent restart succeeded",{agentId:e.agentId,attempt:i}),!0}catch(x){return W.warn("agent restart attempt failed",{agentId:e.agentId,attempt:i,err:String(x)}),!1}}async executeModelSwitch(e){let i=this.registry.get(e);if(!i)throw new A("AGENT_NOT_FOUND",`agent not found: ${e}`);let a=this.config.frameworksCache?.[i.framework];if(!a)throw new A("AGENT_SPAWN_FAILED",`framework ${i.framework} not detected; cannot respawn for switchModel`);W.info("executeModelSwitch: stopping old downstream",{agentId:e,framework:i.framework}),await i.downstream.stop("switchModel").catch(u=>{W.warn("stop old downstream failed (ignored, continuing)",{agentId:e,err:String(u)})});let x;try{x=await this.spawnAndInitialize(i,a.path)}catch(u){throw new A("MODEL_SWITCH_FAILED",`failed to spawn new downstream after switchModel: ${u instanceof Error?u.message:String(u)}`,{cause:u})}this.rewireSession(i,x);let f=[...i.sessions.entries()];for(let[u,h]of f)try{await x.sessionLoad({sessionId:h,cwd:i.workspace}),i.verifiedSessions.add(h)}catch(p){throw new A("MODEL_SWITCH_FAILED",`sessionLoad failed after switchModel for cloud session ${u} (acp=${h}): ${p instanceof Error?p.message:String(p)}`,{cause:p})}f.length>0&&W.info("executeModelSwitch: session/load reloaded",{agentId:e,count:f.length}),i.status="ok",W.info("executeModelSwitch: success",{agentId:e,framework:i.framework})}};U();import{spawn as Ra}from"node:child_process";import{constants as Js,access as Ma}from"node:fs/promises";import{delimiter as za,join as qa}from"node:path";var Fa=T("framework-detector"),Vs={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Ua=[".exe",".cmd",".bat",".ps1"],Et=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Ra,access:e.access??Ma}}async detect(e){let i=Vs[e],a=await this.which(i);if(!a)return Fa.debug("framework binary not found",{framework:e,bin:i}),null;let x=await this.probeVersion(a);return{path:a,version:x}}async detectAll(){let e=await Promise.all(Object.keys(Vs).map(async a=>[a,await this.detect(a)])),i={};for(let[a,x]of e)x&&(i[a]=x);return i}async which(e){let i=this.env.pathEnv.split(za).filter(Boolean),a=this.env.platform==="win32"?["",...Ua]:[""];for(let x of i)for(let f of a){let u=qa(x,e+f);if(await this.isExecutable(u))return u}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Js.F_OK:Js.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",x=!1,f,u=h=>{x||(x=!0,f&&clearTimeout(f),i(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});f=setTimeout(()=>{h.kill("SIGKILL"),u("unknown")},5e3),h.stdout?.on("data",p=>{a+=p.toString("utf8")}),h.on("error",()=>u("unknown")),h.on("close",()=>{let p=Ha(a).split(/\r?\n/)[0]??"";u(p)})}catch{u("unknown")}})}},Ka=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Ha(r){return r.replace(Ka,"")}ar();ce();function fn(r){return Ft(r??H().configFile)}function At(r,e){return Ut(e??H().configFile,r)}Ue();U();var ee=T("core"),Wa=5*6e4,ja=3e4,un=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;upstreamIds=new ut;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths}registerExtension(e,i){this.extensions[e]=i}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),ee.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){ee.info("Core stopping",{reason:e}),await Promise.all([...this.agents.values()].map(i=>i.dispose(e))),this.agents.clear(),await this.upstream.stop(e)}get(e){return this.agents.get(e)}register(e){this.agents.set(e.agentId,e),this.attachDownstreamHooks(e),ee.info("agent registered",{agentId:e.agentId,framework:e.framework})}unregister(e){this.agents.delete(e)}reviveIfDisconnected(e){this.disconnectedAgents.delete(e)&&ee.info("agent revived from disconnect",{agentId:e})}attachDownstreamHooks(e){e.downstream.onUpdate(i=>{this.forwardUpdate(e,i)}),e.downstream.onAgentRequest(i=>{this.handleAgentRequest(e,i)}),e.downstream.onExit((i,a)=>{ee.warn("agent downstream exited",{agentId:e.agentId,code:i,signal:a})})}attachHooks(e){this.attachDownstreamHooks(e)}async handleFrame(e){if(en(e)){this.handleUpstreamResponse(e);return}if(Qt(e))try{if(e.method.startsWith("_agent/")){let i=this.extensions[e.method];if(!i){await this.sendError(e.id,K.METHOD_NOT_FOUND,`extension not registered: ${e.method}`);return}let a=await i(e,this);await this.upstream.send(ft(e.id,a));return}if(e.method.startsWith("session/")){let i=await this.routeSessionMethod(e);await this.upstream.send(ft(e.id,i));return}if(e.method==="initialize"){await this.upstream.send(ft(e.id,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}await this.sendError(e.id,K.METHOD_NOT_FOUND,`method not implemented: ${e.method}`)}catch(i){ee.error("handleFrame failed",{method:e.method,err:String(i)}),await this.upstream.send(Xe(e.id,tn(i)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new A("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new A("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new A("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new A("AGENT_NOT_FOUND",`agent not found: ${a}`);if(x.status==="switching")throw new A("MODEL_SWITCHING",`agent ${a} is switching model; retry later`,{retriable:!0});let f=Date.now(),u=!1;try{let h=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,i));return u=!0,h}finally{ee.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-f,ok:u})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:x}=Cs(a);switch(i){case"session/new":{let f=x;return await e.downstream.sessionNew({...f,cwd:f.cwd||e.workspace})}case"session/load":{let f=x,u=f.sessionId,h=e.sessions.get(u);try{let p=h??u,w=await e.downstream.sessionLoad({...f,sessionId:p,cwd:f.cwd||e.workspace});return h||e.sessions.set(u,p),w}catch(p){ee.warn("session/load failed,fallback to session/new",{agentId:e.agentId,cloudId:u,err:String(p)});let w=await e.downstream.sessionNew({cwd:f.cwd||e.workspace});return e.sessions.set(u,w.sessionId),{}}}case"session/prompt":{let f=x,u=f.sessionId,h=e.sessions.get(u),p=!1;if(h&&!e.verifiedSessions.has(h))try{await e.downstream.sessionLoad({sessionId:h,cwd:e.workspace}),e.verifiedSessions.add(h),ee.info("session restored via session/load",{agentId:e.agentId,cloudId:u,acpId:h})}catch(y){ee.warn("session/load failed,fallback to session/new",{agentId:e.agentId,cloudId:u,acpId:h,err:String(y)}),e.sessions.delete(u),h=void 0}h||(h=(await e.downstream.sessionNew({cwd:e.workspace})).sessionId,e.sessions.set(u,h),e.verifiedSessions.add(h),p=!0);let w=a._meta?.cozeTriggerMsgId;w?e.activeTriggers.set(h,w):e.activeTriggers.delete(h);let b=await e.downstream.sessionPrompt({...f,sessionId:h});return p&&this.persistSessionMapping(e),b}case"session/cancel":{let u=x.sessionId;if(!u)throw new A("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(u);return h&&await e.downstream.sessionCancel({sessionId:h}),{ok:!0}}default:throw new A("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}forwardUpdate(e,i){let a=i.sessionId,x=this.reverseSessionId(e,a);if(!x){ee.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let f={cozeAgentId:e.agentId},u=e.activeTriggers.get(a);u&&(f.cozeTriggerMsgId=u),this.upstream.send(zs("session/update",{...i,sessionId:x,_meta:f})).catch(h=>ee.warn("forward update failed",{agentId:e.agentId,err:String(h)}))}handleAgentRequest(e,i){if(i.method==="session/request_permission"){this.forwardPermissionRequest(e,i);return}ee.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:i.method}),e.downstream.respondAgentRequestError(i.id,{code:K.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${i.method}`})}forwardPermissionRequest(e,i){let a=this.upstreamIds.next("session/request_permission"),x=i.params??{},u=x.sessionId,h=u?e.activeTriggers.get(u):void 0,p={cozeAgentId:e.agentId};h&&(p.cozeTriggerMsgId=h);let w=u?this.reverseSessionId(e,u):void 0,b={...x,...w?{sessionId:w}:{},_meta:p},y=setTimeout(()=>{let E=this.pendingUpstream.get(a);E&&(this.pendingUpstream.delete(a),ee.warn("upstream permission request timed out,replying cancelled to agent",{agentId:e.agentId,upstreamId:a}),e.downstream.respondAgentRequest(E.agentRequestId,{outcome:{kind:"cancelled"}}))},Wa);this.pendingUpstream.set(a,{agentRequestId:i.id,session:e,method:i.method,timer:y}),this.upstream.send(ct(a,"session/request_permission",b)).catch(E=>{let P=this.pendingUpstream.get(a);P&&(clearTimeout(P.timer),this.pendingUpstream.delete(a)),ee.error("forward permission request failed",{agentId:e.agentId,err:String(E)}),e.downstream.respondAgentRequestError(i.id,{code:K.INTERNAL_ERROR,message:`upstream send failed: ${String(E)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),clearTimeout(i.timer),e.error?i.session.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.session.downstream.respondAgentRequest(i.agentRequestId,e.result);return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new Zt(e.error)):a.resolve(e.result);return}ee.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=ja){let x=this.upstreamIds.next(e);return new Promise((f,u)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),u(new A("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:u,timer:h}),this.upstream.send(ct(x,e,i)).catch(p=>{let w=this.pendingBridge.get(x);w&&(clearTimeout(w.timer),this.pendingBridge.delete(x)),u(p)})})}async persistSessionMapping(e){if(this.paths)try{await cr(e.agentId,e.sessions,this.paths)}catch(i){ee.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[a,x]of e.sessions.entries())if(x===i)return a}sendError(e,i,a){return this.upstream.send(Xe(e,{code:i,message:a}))}};U();ce();import{randomBytes as Ga}from"node:crypto";import{chmod as Ja,mkdir as Va,writeFile as Ys}from"node:fs/promises";import{createServer as Ya}from"node:http";import{dirname as Xa}from"node:path";var $a=1e6,dr=T("ipc"),dn=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(i=>[`${i.method} ${i.path}`,i])),this.paths=e.paths??H()}async start(){this.token=Ga(32).toString("hex");let e=Ya((a,x)=>{this.dispatch(a,x)});this.server=e,await new Promise((a,x)=>{e.once("error",x),e.listen(0,"127.0.0.1",()=>a())});let i=e.address();if(!i||typeof i!="object")throw new Error("failed to obtain IPC port");return this.port=i.port,await this.persistAuthFiles(),dr.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((i,a)=>{e.close(x=>x?a(x):i())}),this.server=null)}async persistAuthFiles(){await Va(Xa(this.paths.portFile),{recursive:!0}),await Ys(this.paths.portFile,String(this.port),"utf8"),await Ys(this.paths.tokenFile,this.token,"utf8");try{await Ja(this.paths.tokenFile,384)}catch(e){dr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Dt(i,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){Dt(i,404,{error:"not found"});return}let u=null;if(e.method==="POST")try{u=await Za(e)}catch(h){Dt(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await f.handler(u,e);Dt(i,200,h??{ok:!0})}catch(h){dr.error("IPC handler failed",{key:x,err:String(h)}),Dt(i,500,{error:h instanceof Error?h.message:String(h)})}}};function Dt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function Za(r){let e=[],i=0;for await(let x of r){let f=x;if(i+=f.length,i>$a)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var vo=Ie(oi(),1);var Nc=Ie(to(),1),Oc=Ie(kn(),1),Bc=Ie(ht(),1),Rc=Ie(Er(),1),Mc=Ie(kr(),1),zc=Ie(Or(),1),fo=Ie(Ln(),1),qc=Ie(co(),1);var uo=fo.default;U();var On="1008033",lo="1289";var ho="pbbp2",go="https://www.coze.cn",po="/api/coze_claw/resource/get_frontier_key",Fc="https://www.coze.cn",Uc="wss://frontier.coze.cn";function mo(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??Fc}function wo(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??Uc}function Bn(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),a&&(e["x-use-ppe"]=a),e}var se=T("upstream.frontier"),yo="application/json",bo="none",Rn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){se.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:go,...Bn(this.opts.ppeOverride)};class i extends uo{constructor(h){super(h,ho,{headers:e})}send(h,...p){if(bs("debug"))try{let w;typeof h=="string"?w=Buffer.from(h,"utf8"):h instanceof Buffer?w=h:h instanceof ArrayBuffer?w=new Uint8Array(h):ArrayBuffer.isView(h)?w=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):w=new Uint8Array(0);let b=Buffer.from(w.slice(0,128)).toString("hex");se.debug("WS raw frame out",{bytes:w.byteLength,headHex:b})}catch(w){se.warn("WS raw frame dump failed",{err:String(w)})}super.send(h,...p)}}let a=wo(this.opts.urlOverride),x={url:a,ws:i,fpID:lo,aID:On,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:yo,force:!0},payloadEncoding:{encoding:bo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new vo.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let u=this.openCount===1;se.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:u,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:u})).catch(h=>se.warn("onConnect handler threw (ignored)",{err:String(h)}))},f.onclose=u=>{this.opened=!1,se.info("frontier closed",{code:u.code,reason:u.reason,willReconnect:u.willReconnect})},f.onerror=u=>{se.warn("frontier error",{code:u.code,msg:u.message})},f.onmessage=u=>this.handleMessage(u),this.fws=f,await f.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(a){se.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new A("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;se.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:yo,payloadEncoding:bo})}catch(f){throw new A("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(f)}`,{cause:f})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let i=e.message?.service;if(i!==33555712){se.debug("drop non-adapter frontier frame",{service:i});return}let a=Wc(e);if(!a){se.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){se.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){se.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}se.info("frontier frame in",{logid:Hc(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>se.warn("frontier frame handler threw",{err:String(f)}))}};function Hc(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function Wc(r){let e=r.message;if(e?.textPayload)return e.textPayload;let i=e?.payload;if(!i)return null;try{return Buffer.from(i).toString("utf8")}catch{return null}}U();function Co(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var So=T("handshake");async function Eo(r){let e=mo(r.endpoint),i=r.timeoutMs??1e4,a=`${jc(e)}${po}?aid=${encodeURIComponent(On)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Bn(r.ppeOverride)},f=new AbortController,u=setTimeout(()=>f.abort(),i);So.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:x,signal:f.signal}),p=h.headers.get("x-tt-logid")??"",w=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let P=await h.text().catch(()=>"");throw new A("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${p}: ${P.slice(0,200)}`)}let b=await h.json();if(b.code!==void 0&&b.code!==0)throw new A("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${b.code} msg=${b.msg??"-"} logid=${p}`);let y=b.data?.access_key,E=b.data?.device_id;if(!y||!E)throw new A("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${p}: ${JSON.stringify(b)}`);return So.info("handshake ok",{remoteDeviceId:E,logid:p,traceId:w}),{accessKey:y,deviceId:E}}catch(h){throw h instanceof A?h:h.name==="AbortError"?new A("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new A("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(u)}}function jc(r){return r.endsWith("/")?r.slice(0,-1):r}U();var Rr=T("upstream.switchable"),Mn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;Rr.info("swap upstream",{reason:i});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw Rr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(i??"swapped").catch(x=>Rr.warn("previous upstream stop threw (ignored)",{err:String(x)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};U();var Mr=T("upstream"),Rt=class{handler=null;async start(){Mr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Mr.info("NoopUpstream stopped",{reason:e})}async send(e){Mr.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};U();ce();U();ce();import{readFileSync as Gc,unlinkSync as Jc}from"node:fs";import{mkdir as Vc,readFile as Ao,unlink as Do,writeFile as Yc}from"node:fs/promises";import{dirname as Xc}from"node:path";var $c=T("single-instance"),zn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??H().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&($c.warn("removing stale pid file",{stalePid:e}),await Do(this.pidFile).catch(()=>{})),await Vc(Xc(this.pidFile),{recursive:!0}),await Yc(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Ao(this.pidFile,"utf8")).trim()===String(process.pid)&&await Do(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Ao(this.pidFile,"utf8"),i=Number.parseInt(e.trim(),10);return Number.isFinite(i)&&i>0?i:null}catch(e){if(e.code==="ENOENT")return null;throw e}}isAlive(e){try{return process.kill(e,0),!0}catch(i){return i.code==="EPERM"}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Gc(this.pidFile,"utf8").trim()===String(process.pid)&&Jc(this.pidFile)}catch{}})}};var q=T("daemon"),Zc="coze-bridge-daemon";async function Po(){let r=new zn({processTitle:Zc}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await fn(),a=i??{};xr({pid:process.pid}),q.info(i?"loaded bridge config":"initialized bridge config");try{let D=new Et;a.frameworksCache=await D.detectAll(),q.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(D){q.warn("framework detection failed",{err:String(D)})}await At(a);let x=new Mn(new Rt),f=H(),u=new un({upstream:x,paths:f});await ef(f,u);let h=new cn({paths:f,config:a,registry:u,healthReporter:async D=>{await u.sendRequest("_agent/health",D)}}),p,w,b=null,y=null;u.registerExtension("_agent/create",async D=>h.createAgent(D.params)),u.registerExtension("_agent/health",async()=>({ok:!0}));let E=new Xt({agents:u.agents,disposeAndMarkDisconnected:async(D,z)=>{let G=u.agents.get(D);G&&(await G.dispose(`disconnect: ${z}`).catch(Ee=>q.warn("dispose during disconnect failed (ignored)",{agentId:D,err:String(Ee)})),G.status="disconnected",u.unregister(D)),u.disconnectedAgents.add(D)},executeModelSwitch:D=>h.executeModelSwitch(D)});u.registerExtension("_agent/listSkills",D=>E.listSkills(D.params)),u.registerExtension("_agent/addSkills",D=>E.addSkills(D.params)),u.registerExtension("_agent/removeSkills",D=>E.removeSkills(D.params)),u.registerExtension("_agent/getFileTree",D=>E.getFileTree(D.params)),u.registerExtension("_agent/getFileContent",D=>E.getFileContent(D.params)),u.registerExtension("_agent/update",D=>E.updateAgent(D.params)),u.registerExtension("_agent/disconnect",D=>E.disconnectAgent(D.params)),u.registerExtension("_agent/switchModel",D=>E.switchModel(D.params));let P=new Jt({paths:f,handlers:E,sendDetail:D=>u.sendRequest("_agent/detail",D)});x.onConnect(({initial:D})=>{q.info("frontier upstream connected, triggering detail sync",{initial:D}),P.syncAll(D?"initial-connect":"reconnect").catch(z=>q.warn("detail sync top-level error (ignored)",{err:String(z)}))});let I=new dn({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...u.agents.keys()],deviceId:b??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async D=>{let z=D,G=z?.privatecode,Ee=z?.pairing_code;if(!G||!Ee)throw new A("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let Me=Co(z.env),_e=z.handshake_url,ye=z.frontier_url,ge=Qc(z.env,_e,ye),rt=!!p&&p!==G,Mt=w!==void 0&&w!==ge;if(rt||Mt){q.warn("pair config switched, resetting agents",{pcChanged:rt,envChanged:Mt,previousPc:p?ko(p):"",nextPc:ko(G),previousEnvKey:w??"",nextEnvKey:ge});for(let ke of[...u.agents.values()])await ke.dispose("pair config switch").catch(()=>{}),u.agents.delete(ke.agentId);await x.swap(new Rt,"pair switch").catch(()=>{})}let zt=await Eo({privatecode:G,..._e?{endpoint:_e}:{},ppeOverride:Me});b=zt.deviceId,xr({deviceId:b,pid:process.pid});let Ae=new Rn({handshake:zt,privatecode:G,...ye?{urlOverride:ye}:{},ppeOverride:Me});await x.swap(Ae,"pair"),p=G,w=ge;let De=Object.keys(a.frameworksCache??{});try{let ke=await u.sendRequest("_agent/pair",{pairCode:Ee,patToken:G,frameworks:De,_meta:{cozeDeviceId:b}});q.info("_agent/pair ok",{pairResult:ke}),y||(y=new $t({core:u,getDeviceId:()=>b??""})),y.start();let te;return z.agent_id&&(te=await tf(z.agent_id,f,h,Ge=>u.sendRequest("_agent/detail",Ge)).catch(Ge=>(q.error("--agent-id ensureAgent failed",{agentId:z.agent_id,err:String(Ge)}),{ok:!1,agentId:z.agent_id??"",note:String(Ge)}))),{ok:!0,note:"paired with cloud",...te?{agent:te}:{}}}catch(ke){return q.error("_agent/pair failed",{err:String(ke)}),{ok:!1,note:`pair failed: ${String(ke)}`}}}},{method:"POST",path:"/_agent/create",handler:async D=>{let z=D;return{ok:!0,result:await h.createAgent(z)}}},{method:"POST",path:"/refresh",handler:async()=>{q.info("IPC /refresh: re-detecting frameworks");let D=new Et;return a.frameworksCache=await D.detectAll(),await At(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(q.info("IPC /shutdown received"),setImmediate(()=>{xe.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:L,token:j}=await I.start();await u.start(),nf(f,h).catch(D=>q.warn("auto-revive top-level error (ignored)",{err:String(D)}));let ie=null,xe={port:L,token:j,core:u,ipc:I,shutdown(D){return ie||(q.info("daemon shutdown",{reason:D}),ie=(async()=>{y?.stop(),await u.stop(D),await I.stop(),await r.release()})(),ie)}};for(let D of["SIGTERM","SIGINT"])process.on(D,()=>{xe.shutdown(D).then(()=>process.exit(0))});return q.info("daemon ready",{port:L,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),xe}function ko(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function Qc(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function ef(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:f}=await Promise.resolve().then(()=>(Ue(),Gt));for(let u of a){await f(u,r).catch(h=>q.warn("enforceAgentConfigMode failed (ignored)",{agentId:u,err:String(h)}));try{let h=await x(u,r);h?.disconnectedAt&&(e.disconnectedAgents.add(u),q.info("agent marked disconnected on startup",{agentId:u,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){q.warn("failed to load agent config on startup, skipping",{agentId:u,err:String(h)})}}}async function tf(r,e,i,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ue(),Gt)),f=await x(r,e);if(f){q.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let p={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{},...f.modelToken?{modelToken:f.modelToken}:{}};return await i.createAgent(p),{ok:!0,agentId:r,note:f.disconnectedAt?"revived from local config":"connected from local config"}}q.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let u=await a({_meta:{cozeAgentId:r}});if(!u.framework)throw new A("AGENT_NOT_FOUND",`agent ${r} \u4E0D\u5728\u672C\u5730; \u4E91\u7AEF _agent/detail \u54CD\u5E94\u7F3A framework \u5B57\u6BB5 (D36 \u534F\u8BAE\u6269\u5C55\u672A\u751F\u6548), \u65E0\u6CD5\u5728\u672C\u673A\u65B0\u5EFA`);let h={agentId:u.agentId,framework:u.framework,...u.cozeIdentity?{cozeIdentity:u.cozeIdentity}:{},...u.model?{model:u.model}:{},...u.modelToken?{modelToken:u.modelToken}:{}};return await i.createAgent(h),{ok:!0,agentId:r,note:"created from cloud detail"}}async function nf(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ue(),Gt));q.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,u=0;for(let h of a){let p;try{p=await x(h,r)}catch(w){q.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(w)}),u+=1;continue}if(!p){u+=1;continue}if(p.disconnectedAt){q.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:p.disconnectedAt}),u+=1;continue}try{q.info("auto-revive: spawning",{agentId:h,framework:p.framework}),await e.createAgent({agentId:p.agentId,framework:p.framework,...p.cozeIdentity?{cozeIdentity:p.cozeIdentity}:{},...p.model?{model:p.model}:{},...p.modelToken?{modelToken:p.modelToken}:{}}),f+=1}catch(w){q.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:p.framework,err:String(w)}),u+=1}}return q.info("auto-revive: done",{revived:f,skipped:u,total:a.length}),{revived:f,skipped:u,total:a.length}}qr();ce();import{readFile as To}from"node:fs/promises";var je=class{paths;constructor(e){this.paths=e??H()}async probe(e=1e3){let i=await this.readAuth();if(!i)return{kind:"not-running"};try{let a=await this.fetch(i,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...i}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:df(a)}}}async request(e){let i=await this.readAuth();if(!i)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(i,e)}async readAuth(){try{let[e,i]=await Promise.all([To(this.paths.portFile,"utf8"),To(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=i.trim();return!Number.isFinite(a)||a<=0||!x?null:{port:a,token:x}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let a=i.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let f=new AbortController,u=setTimeout(()=>f.abort(),i.timeoutMs??5e3);try{let h=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:x,body:a?JSON.stringify(i.body):void 0,signal:f.signal}),p=await h.text();return{status:h.status,body:uf(p)}}finally{clearTimeout(u)}}};function uf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function df(r){return r instanceof Error?r.message:String(r)}U();ce();import{copyFile as Lo,mkdir as lf,readFile as Fr,writeFile as hf}from"node:fs/promises";import{dirname as gf,resolve as Ur,sep as qn}from"node:path";import{fileURLToPath as pf}from"node:url";U();ce();var No=T("dist-install");function mf(r){let e=pf(r),i=gf(e),a=`${qn}src${qn}`;if(i.includes(a)||i.endsWith(`${qn}src${qn}cli`))return null;let x=Ur(i,"index.js"),f=Ur(i,"..","package.json");return{dist:x,pkgJson:f}}async function Oo(r={}){let e=r.paths??H(),i=mf(import.meta.url),a=r.sourceDist??i?.dist,x=r.sourcePackageJson??i?.pkgJson;if(!a||!x)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let f;try{f=JSON.parse(await Fr(x,"utf8")).version??"unknown"}catch(y){return No.warn("cannot read source package.json,skip dist install",{err:String(y)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(y)}`}}let u=await fn(e.configFile)??{},h=u.libVersion;if(h===f)try{return await Fr(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await lf(e.libDir,{recursive:!0}),await Lo(a,e.libEntry),await Lo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let p=Ur(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
|
|
91
|
+
`;return await Fr(p,"utf8").catch(()=>null)!==w&&await hf(p,w),u.libVersion=f,await At(u,e.configFile),No.info("dist installed",{libEntry:e.libEntry,fromVersion:h,toVersion:f}),h?{kind:"version-changed",fromVersion:h,toVersion:f,libEntry:e.libEntry}:{kind:"first-install",libVersion:f,libEntry:e.libEntry}}var Rf=T("cli");function yt(r,e){let i=[],a;for(let x=0;x<r.length;x++){let f=r[x];if(f===e){a=r[x+1],x+=1;continue}if(f.startsWith(`${e}=`)){a=f.slice(e.length+1);continue}i.push(f)}return{value:a,rest:i}}function Mf(r){let e=r.slice(2);if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let i=e,{value:a,rest:x}=yt(i,"--pat-token");i=x;let{value:f,rest:u}=yt(i,"--pair-code");i=u;let{value:h,rest:p}=yt(i,"--env");i=p;let{value:w,rest:b}=yt(i,"--handshake-url");i=b;let{value:y,rest:E}=yt(i,"--frontier-url");i=E;let{value:P}=yt(i,"--agent-id");if(!a||!f)return{mode:"help"};let I={mode:"pair",privatecode:a,pairingCode:f};return h&&(I.env=h),w&&(I.handshakeUrl=w),y&&(I.frontierUrl=y),P&&(I.agentId=P),I}var zf=`
|
|
92
92
|
coze-bridge - local bridge daemon for cloud Agent Service
|
|
93
93
|
|
|
94
94
|
Usage:
|
|
@@ -107,38 +107,42 @@ Environment routing (optional, per-pair, not persisted):
|
|
|
107
107
|
--handshake-url <url> override HTTP base (default https://www.coze.cn)
|
|
108
108
|
--frontier-url <url> override Frontier WS URL (default wss://frontier.coze.cn)
|
|
109
109
|
|
|
110
|
-
|
|
110
|
+
Auto-connect agent (optional):
|
|
111
|
+
--agent-id <id> pair \u540E\u81EA\u52A8 connect \u6307\u5B9A agent \u2014 \u672C\u5730\u5DF2\u6709\u8D70 reconnect/
|
|
112
|
+
revive, \u6CA1\u6709\u8D70 _agent/detail \u62C9\u4E91\u7AEF\u8BE6\u60C5\u7136\u540E\u672C\u5730\u65B0\u5EFA
|
|
113
|
+
|
|
114
|
+
Example: npx -y coze-bridge --pat-token=sat_xxx --pair-code=xxx --env=ppe_xxx --agent-id=7639628097007927571
|
|
111
115
|
|
|
112
116
|
Internal:
|
|
113
117
|
<node> <entry> --daemon daemon mode (OS supervisor only)
|
|
114
|
-
`.trimStart();async function
|
|
118
|
+
`.trimStart();async function Fo(r=process.argv,e={}){let i=Mf(r);switch(i.mode){case"help":return process.stdout.write(zf),0;case"daemon":{try{await Po()}catch(a){return Rf.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return qf(e);case"stop":return Ff(e);case"refresh":return Uf(e);case"uninstall":return Kf(e);case"install-service":return Hf();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),Wf(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function qf(r){let e=new je(r.paths),i=await e.probe();if(i.kind==="not-running")return process.stdout.write(`coze-bridge: not running
|
|
115
119
|
`),1;if(i.kind==="stale")return process.stdout.write(`coze-bridge: stale (${i.reason})
|
|
116
120
|
`),1;let a=await e.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
|
|
117
121
|
${JSON.stringify(a.body,null,2)}
|
|
118
|
-
`),0}async function
|
|
122
|
+
`),0}async function Ff(r){let e=new je(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running
|
|
119
123
|
`),0;try{return await e.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
|
|
120
124
|
`),0}catch(a){return process.stdout.write(`coze-bridge: stop failed: ${String(a)}
|
|
121
|
-
`),1}}async function
|
|
125
|
+
`),1}}async function Uf(r){let e=new je(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
|
|
122
126
|
`),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
|
|
123
127
|
${JSON.stringify(a.body,null,2)}
|
|
124
128
|
`),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
|
|
125
129
|
`),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
|
|
126
|
-
`),1}}async function
|
|
130
|
+
`),1}}async function Kf(r){let e=new je(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
|
|
127
131
|
`);try{await e.request({method:"POST",path:"/shutdown"})}catch(f){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(f)}
|
|
128
|
-
`)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:u}=await Promise.resolve().then(()=>(
|
|
132
|
+
`)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:u}=await Promise.resolve().then(()=>(Vr(),Jr)),h=f();await h.uninstall(u()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
|
|
129
133
|
`)}catch(f){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(f)}
|
|
130
|
-
`)}let a=r.paths??
|
|
134
|
+
`)}let a=r.paths??H(),{rm:x}=await import("node:fs/promises");try{await x(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
|
|
131
135
|
`)}catch(f){return process.stderr.write(`coze-bridge: remove failed: ${String(f)}
|
|
132
136
|
`),1}return process.stdout.write(`coze-bridge: uninstalled
|
|
133
|
-
`),0}async function
|
|
137
|
+
`),0}async function Hf(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(Vr(),Jr)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
|
|
134
138
|
`),await i.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
|
|
135
139
|
`),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
|
|
136
|
-
`),1}}async function
|
|
137
|
-
`),(await
|
|
138
|
-
`)}let
|
|
139
|
-
`),await
|
|
140
|
-
`),1;let
|
|
141
|
-
`),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(
|
|
142
|
-
`),1)}catch(
|
|
143
|
-
`),1}}async function
|
|
140
|
+
`),1}}async function Wf(r,e,i,a={},x){let f=new je(i.paths),u=i.spawnDaemon??Io;if(!i.skipDistInstall){let w=await Oo({paths:i.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
|
|
141
|
+
`),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(y=>setTimeout(y,500)))):w.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${w.libVersion}
|
|
142
|
+
`)}let h=await f.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
|
|
143
|
+
`),await u({paths:i.paths}),h=await jf(f,i.waitTimeoutMs??1e4,i.sleep??Gf),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
|
|
144
|
+
`),1;let p={privatecode:r,pairing_code:e};a.env&&(p.env=a.env),a.handshakeUrl&&(p.handshake_url=a.handshakeUrl),a.frontierUrl&&(p.frontier_url=a.frontierUrl),x&&(p.agent_id=x);try{let w=await f.request({method:"POST",path:"/pair",body:p});return w.status===200&&w.body?.ok?(process.stdout.write(`coze-bridge: paired (${w.body.note??"ok"})
|
|
145
|
+
`),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(w.body)}
|
|
146
|
+
`),1)}catch(w){return process.stderr.write(`coze-bridge: pair failed: ${String(w)}
|
|
147
|
+
`),1}}async function jf(r,e,i){let a=Date.now()+e;for(;Date.now()<a;){let x=await r.probe(500);if(x.kind==="connected")return x;await i(200)}return r.probe(500)}function Gf(r){return new Promise(e=>setTimeout(e,r))}Fo(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
|
|
144
148
|
`),process.exit(1)});
|