coze-bridge 0.1.17 → 0.1.19
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 +45 -45
- 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
|
-
`)}function R(r){return{debug:(e,i)=>Qt("debug",r,e,i),info:(e,i)=>Qt("info",r,e,i),warn:(e,i)=>Qt("warn",r,e,i),error:(e,i)=>Qt("error",r,e,i),child:e=>R(`${r}.${e}`)}}var en,Ls,a0,x0,Ns,H=Le(()=>{"use strict";en={debug:10,info:20,warn:30,error:40},Ls=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),a0=process.stdout,x0=process.stderr,Ns={}});import{homedir as c0}from"node:os";import{join as se}from"node:path";function K(r){let e=r??c0(),i=se(e,".coze"),a=se(i,"bridge"),c=se(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:c,libEntry:se(c,"index.js"),pidFile:se(a,"bridge.pid"),portFile:se(a,"bridge.port"),tokenFile:se(a,"bridge.token"),logFile:se(a,"bridge.log"),installLock:se(a,"install.lock"),configFile:se(a,"config.json"),agentsRoot:se(i,"agents")}}function Re(r,e=K()){let i=se(e.agentsRoot,r);return{root:i,config:se(i,"config.json"),workspace:se(i,"workspace"),logs:se(i,"logs")}}var fe=Le(()=>{"use strict"});var rn={};Ds(rn,{AGENT_CONFIG_FILE_MODE:()=>tn,enforceAgentConfigMode:()=>d0,loadAgentConfig:()=>de,persistAgentSessions:()=>_r,persistAgentSkills:()=>nn,saveAgentConfig:()=>we});import{chmod as u0,stat as f0}from"node:fs/promises";function de(r,e){return ct(Re(r,e).config)}function we(r,e){return $t(Re(r.agentId,e).config,r,{mode:tn})}async function d0(r,e){if(process.platform==="win32")return;let i=Re(r,e).config;try{let a=await f0(i);if(!a.isFile())return;let c=a.mode&511;c!==tn&&(await u0(i,tn),Ms.warn("agent config mode auto-corrected to 0600",{path:i,from:c.toString(8)}))}catch(a){if(a.code==="ENOENT")return;Ms.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function _r(r,e,i){let a=await de(r,i);a&&(a.sessions=Object.fromEntries(e),await we(a,i))}async function nn(r,e,i){let a=await de(r,i);a&&(a.skills=e,await we(a,i))}var Ms,tn,Ge=Le(()=>{"use strict";Zt();H();fe();Ms=R("agent-config"),tn=384});var Ti=ce(Z=>{"use strict";var S=D;(function(r,e){let i=D,a=r();for(;;)try{if(-parseInt(i(554))/1*(parseInt(i(1769))/2)+-parseInt(i(1665))/3+parseInt(i(1548))/4+parseInt(i(1317))/5+-parseInt(i(517))/6*(parseInt(i(1805))/7)+parseInt(i(868))/8+-parseInt(i(1361))/9===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Tn,243679);var Rx=Object[S(1198)+S(775)],Mx=Object["getOwnPropertyNa"+S(1595)],Ci=(r,e)=>function(){return r&&(e=(0,r[{nxkUk:function(u,d){return u(d)}}[S(869)](Mx,r)[0]])(r=0)),e},Ox=(r,e)=>{for(var i in e)Rx(r,i,{get:e[i],enumerable:!0})};function Tn(){let r=["B1PZzMi","De1HBMfNzxi","z2v0qwXS","x2n1CNnVCKy","Ae5nA20","qKX1Ee0","zNjVBu51Bwi","ruDWtve","z3frzfO","s05tDgu","x29UvgLTzw8","BwvZ","v3riCM4","AKDHC1K","zsbHihn0CMK","AxH6BeC","BxbYv1y","u3vmzKu","y29Uy2f0","tMnAueW","s1rxB1K","zuzSzxe","yxbWBhK","Eefosgi","B2jQzwn0u3q","vuPIq2W","s2jqBhO","yKHNDKi","yw5Hz2vY","u1zjC0y","EunkwxC","wMXmq0y","zxjYtxnN","wMH4v3e","x2rPC3bHDgm","zgjNCMK","B25ozxr3B3i","rvHKs3G","uMvHzcbWyxm","zvH4tu4","BgLUzq","C2vYDMvYvgK","y2XVC2uSihC","sgLjseW","DgfIyxnL","BM93","tufJvfy","B3v0sw50zxi","sfneqwG","B25tDg9Wsw0","x2rPC2nVBM4","rLb6tNC","q0Xpu0LorW","CuPrveK","mhW1Fdj8mxW","y3jLyxrLq2W","zcWGDw5RBM8","uK9dwu8","ywrKrxzLBNq","x25HDMLNyxq","CeXNyxa","se1dwvO","ufHdwu0","DerwwvO","seL4ugu","z1fODhK","Dw5RBM93BIa","BgvY","vvfLru4","ihrPBwvVDxq","o2nOyxjZzxq","vLvuqxe","rfPAt0i","uvfKqva","C3vJy2vZCW","ruzrBwC","Bwf4twvZC2e","C0PYyxu","sgjvzxe","CMvJB25Uzwm","D212shG","mtK4mtiZEeP1wLHX","rKH2qNa","A0H2svO","tgjZDg4","BhHLA2G","AwnVqxK","x2rItMfTzq","uu1VEgq","sNLttxu","Aw5KzxGGB3u","Cg9PBNrbBMq","u3zjz3m","BwvIwK0","CKDbENe","CNzHBa","uwHPtgS","su5tvefova","y29UBMvJDca","ENbnENi","sw9ZwLC","x2vUzhbVAw4","C3vIC3rYAw4","CLjAt3i","y29UBMvJDfm","qMrqtgi","Ew5OrMO","zK9OCve","x2HHBMrSzva","zxjFywnRx20","Eej6rvG","sxzuDeu","D2rXt24","t1rTsKG","zhvlD0S","rfHhsee","y2XVC2u","AenYBhm","EKzJsxO","CYbWyxjHBxm","Ec11C2uT","zxnsv2S","BwvZC2fNzq","rfvJEum","DvLAuNu","y3jLyxrLuMu","C1vPs1u","te1xB2m","z3zeBK8","D2vI","rxzLBNq","yKXevem","qw5fugy","Cufgs0C","CMvJzwL2zwq","BxnNsuq","Aw9xyLC","tuD0EKe","C1nTCuy","zff4vwW","CMvHC29U","zevZC20","zxHWB3j0CW","sMfYq3G","BgLUzw5V","rgH0vfK","CMLLC0nVDw4","wg95wgi","AevYCM9Yrxy","uxfzC3i","ANbOuMG","AgfWq2O","mxWWFdn8nhW","ywLRuwO","zxq9DxrMltG","DfnACNC","twvZC2fNzuu","tuvtu0fhrv8","C3rVCcbPBw0","CgzRCxO","vvz4C08","yMfSu2nVCgu","CKL6CxO","uK5RwKG","yxbWBgLJyxq","Cu9tzhm","x3fVC0rc","x2n1CNnVCK0","C2jdEfO","Cg93","C0LfyxC","Dgv4Dc9WBge","vxbKyxrLq28","q2PnteO","DwHHEu4","vuLVtwS","C3rHCNq","AefZt0C","zfjTBfi","CgLUz1rPBwu","B2XKvMvYC2K","rMneyKu","DxrVuMvJB24","rvLNzxK","ywr2yw5Jzq","mtaXntrRDxfpvLO","zw5fDMvUDa","rxfvsfK","DxnLCKLW","AgvHzgvY","C2nYAxb0","vMXbr2G","B2fK","yKDvs1i","id4G","rxjYB3jdB2q","uvPes04","z2v0u3rVCMe","q2jwr0G","Dg9Y","BwvZC2fNzv8","EMPQwhO","r1fPvu8","zw1LBNq","s2XvzMy","zMzmAw5L","sfjosNa","CMfUzg9T","x3vYBa","y3vYCMvUDeu","x2jPBMfYEvq","CfHhywy","zNjPvxi","t3zyuvC","CwDczMi","y3jLyxrLt3a","ChjVDg90Exa","BMrWB2LUDfq","x29UugfNzu4","u3bHyMe","AwXK","nJyWnZnqywHVz2u","yMfJA3vWigu","zgvJB2rLzey","sw9WDuu","EKn1wvG","rMXqBKS","A0fVCMS","AxmGDw5Kzwy","rNbuCKm","x2LZqNjVD3m","u2XwEMK","ysbTDxn0igi","vw5PBxbSzw0","Cgu6ia","CNnVCL9Uyw0","CMvZDwX0","zw5XDwv1zq","C2T1Cui","zfHAwe4","DhjPBq","CM92AwrLihy","ChfmsuK","zw5JB2rLrNi","u2TAD1a","zgrjrcWGzgu","wMnKvfK","vwLgvhq","AhPdrvO","mhWY","DxnRr3u","A0DnwwS","t2H6weK","Dg1fzLO","AgvKtwf4uMu","yNvMzMvY","zKT6vMu","svn2zee","rxrPBKi","C2XPy2u","rKj3v2m","suTnrM0","uwHtBvy","y3r4","z2v0q3vYC28","AhLMDe4","BMrLEa","yK5hz20","CM92AwrLigi","Bhm6ia","r0jTtu8","zNjVBunOyxi","quXm","D2HQr1i","AwXLx25HBwu","x2TLEvbHDgG","BvvSteO","nhWXFdv8m3W","v0DAwM0","qxruBMq","sg9Ytu4","z2v0q3vYCMu","CwXqyvy","Eg9bq3K","DMvYC2LVBMm","ANzSrLi","s0jqEwq","tvPfrMK","A0DstM8","zxjFBxnNAwq","C2z4qNG","zfHzuNq","BLDKq0C","EhHuree","Dg9VigXHCMC","ig1LC3nHz2u","uMT2B1G","tw5rrwC","mhW1Fdj8m3W","rM9hvNC","DMfSDwu","DwHMteW","Aw9dtw0","yxrLq291BNq","zv90Aw1LB3u","tufyx1jfvfi","Dg9cExrLC0W","CejjshG","vwDTtvC","BezSDxnO","zw5JB2rPBMC","t2joB0y","ChjVDg9JB2W","x2XPC3rLBMu","ve14zMS","s2DruMe","zcbLCNjVCI4","ywnOzwq","BvHjDvm","y2fSBa","ihzHBgLKihm","vKzfq0C","BfrPBwvVDxq","BgLTAxq","DwPPCuG","BLfPruS","ywXS","t1bvEg0","v1DzEM4","CMvHzhLtDge","D0fTrvG","ENLSyKC","EK91uNC","vwfeDMS","twjUqMO","y29UBMvJDeu","uu1QD2u","Bu5LAvq","r21dvg0","EwnYrvm","DhbizwfKzxi","CNnVCKzPBgu","BNrLCG","Bu1owgW","EgTZyMG","t0XPzva","DhjHBNnHy3q","BgvUz3rO","Bez1tu0","tvnAuhC","yxnL","Aw5KzxHpzG","uMLHzLK","whvzzMS","CgfYC2u","ywrK","BwLUzW","Bwu6ia","C3bbsvm","vfP2thi","AeryEva","zwnVBM5Ly3q","yNvMzMvYzwq","vvztyw0","uhfcsKG","x2LZsw5PDa","EK5xAgm","Aw5N","y2XVC2veqG","u2TIs3K","rxLMsve","AgnfzMy","EsbJBg9Zzwq","n3WXFdH8mhW","re5jqLG","x3bHDgHlzxK","qNL0uvu","ExbL","Ae1AEui","x2nYzwf0zvm","we9pzfu","BKjlAK8","tLfLB1C","tK9zugy","AxnAzxjV","shzjzeK","zNHcuKK","sufLrg0","yxzjDKG","zMLSzw5HBwu","C0jf","CMv0CNLdB3u","ywWGy3vYC28","zw50tgLZDgu","yw5Nzq","x2rLyNvN","sLfdyLO","wK5tsvC","u3LNvLe","rLjptLrjrvi","vwL4we8","yMnswhq","uMvJB25Uzwm","Bg9Nsurhzw4","rLbMz28","u3rYyxrLz3K","v01Lv3u","CMfTzq","AwDHDg9Yt24","z1rPBwvVDxq","EKjct1a","CMvTB3zLq2G","uMLdt1y","u1Dpvu8","Bwf4uMv0CMK","DMvUDa","CM92AwrLihC","DgHLBG","wwrXrgC","wMTRsLK","qLLXvNi","DcbVzIbYyw4","y2L3vgC","q09rAwO","ChbL","rNfVCuq","r2Xivu8","A1PNrwO","uhDgq1m","BNrbBMrvCgq","AfbxtvK","AxnrB1nby2S","vgfN","A1jhtxe","x2rLC3rYB3K","tfzYDwy","Dg9cExrLC0i","BeH5uei","DgvZDa","mJuYCLLJuvLU","Aw5Lza","BKX1uhK","rxnxrNi","DwLWA1q","svv4v3O","qxnfu1G","CMTLCKDSB2i","CvnwAe0","ywXSzwqGBxu","shbmy1K","rfHLBwm","vK9iAM4","rvPYBKG","ign1CNnVCIa","vuLUyu0","x2LUAxq","CvbKrwq","z2v0qwXSs2u","Aw5KzxG","yvrguwG","r1D6rLG","AvnWD3m","wxfUEKC","t3rgsLK","AgfUz2u","y2uGBM90igK","DuDWv2S","CNrABxG","Bwv0Ag9K","AxH1q1G","DvbAv0G","x29UtwvZC2e","CgLUz19VBMm","CMH3wKO","AxDqExe","Bwf4tg9ZC0m","oufMuuDhDq","rvjhsKe","zwTSsNi","zuTswxK","y2DPweu","yNL0yu0","ywXSq3vYC28","t0rPtfa","wNr1CMu","zgTithi","Dfrmtui","zMX1C2HfEha","ywnRDxbfBMq","rgX0wMe","uKvnEuC","zKrJu0W","B3jpBMXPBMu","wLLTuuu","DuDtAhq","r1z6q0m","DxbNCMfKzw4","vKHHtMS","CgXLyxnLiha","x29WDgLVBNm","CeH5ANG","DwzcwvK","ihrPBwvZ","Ae1LC3nHz2u","zuLZCMm","AwrI","EgHJwgy","zhzwzgu","y3ruAw1LB3u","suPfwhG","v2HhrfG","BwfW","ugTLD2u","ywX3yxLZ","B2zMC2v0","DcbSAw1PDa","qKzMDhi","y2HnyxHdB3u","vfPbr1y","B2nRzxrtDwm","te1XCxm","rff0qu0","y29UDgLUDwu","rMn5q3m","BNrfBMrWB2K","z2HzCKy","zxH0zw5ZAw8","B3bLBKrc","t3vyuvq","wwvPy2G","D3LVANi","zMvY","B25tDgfYDfi","tu9fCwe","vhnKBNK","ChvZAa","ChPfC1C","CM9YrxzLBNq","B25LCNjVCG","qNjKBve","s0foq3m","C3rYAw5NAwy","Chv0","q05sA28","wwT3rxi","tefPswW","EMzgwfC","zhjhDM0","q1v1vg8","x3bYB3rVy28","pxv0zI04","vhbYz2e","AefJA01LC3m","vKD1Cu8","AxnrB1nnzxm","sK5cChe","rMXjwxG","uMrnvgi","z2vjBMzVu3K","z2vtEw5J","y29UC3rYDwm","rwzgsei","DgLUzYbZzxi","lcbOB3n0BMe","AvPOtwm","Bfbcv0S","Dhr3Awq","y3jLyxrLrwW","rNzUDu0","r0zTrfe","CNjlAue","rwHAv24","zhnhB3O","qwjVCNrfCNi","z2jvrxm","AfvuzNu","uxbvq0K","Aw9Ul2PZB24","Cg9W","z1bhz3m","yMLUyxj5vhK","yxbmCfO","vNrUt2u","yw51Ce1LC3m","sgrHuxG","Aw47y2HHCNm","r1PLywO","rLnTD20","C3vIyxjYyxK","zgvSzxrLrge","wu5WvgG","D1PjBgu","vw5Lww8","sLrIBve","rhjuEKO","tgTouxe","Ahr0Ca","uvfftui","x1fVu01HBMe","Ahr0Chm6","rgvPzfO","DgHHBIbSB2m","x0rctMfTzq","vgLTzw91Da","AKXwA1u","qNjPzgDL","Dgv4Dc9Qyxy","vKvWteW","EMnczNG","zxLeqKS","thvuD0y","wevcBhu","yKDmr3y","zgvS","tfLSCfi","yvfRDNG","BvbUC2C","Agnfwum","x3DHAxq","BNHVqKq","C0Xf","Dg9iyxnO","C2DPza","z1nqB1u","vgP1BLC","A2TAAfq","zvbSALy","s1LSC24","rKzmC3a","DgDLDgG","DwjMDwm","A2v5CW","q0LfDeW","B2XSwxq","zw5HyMXLuw8","tKHguu8","t2PZBMK","q29UzMLN","DhjPzxm","x3nLBMrby2S","CwPrDeq","tuHJtMy","rLrpAei","yMPLsLy","x2HHBMrSzu8","jMPZy2fSBgi","yKT3uxm","zwXAzu8","yxHsAKq","tKfusvzfx0u","DhLWzq","u2Xht3a","vMLRCeu","CMvUDevUzha","qxDNsvi","q3rkBvC","veXOAg4","ExnUBKi","x2DLBMvYyxq","wKDyu1K","u3HTvLu","v0TNDNa","sw9iwK4","C2vUzf9Hy2S","qwD6uKO","B25pCgvU","D0f4uuK","DMvYC2LVBG","ve9fweq","v2ThrwK","zLPZsNK","AfPtqM0","z2v0","tNrgEeS","zNjVBuj5Dgu","r1nwAfm","x3DZsw5ZDge","wfDtCuy","BMv4DcGPigm","y2HusKq","y2HLy2Tszwe","yxnJCMLWDa","Aw92Cee","CNLHDfG","C29Tzq","DMfJwM4","igXHCMDLCIa","q09oveLovuu","rNjVBNrPzxi","zgTNB0q","qw1VDw50","DMvY","wK9vBKO","DhrkEvm","CgvjCei","yxnZAwDU","tfLVAMi","B3bLCNr5","BMnLq2XVC2u","C2rUr0e","uLDrz24","Fdb8nxWZ","vgjeDNO","yKPWwKu","yxrHlcbKyxq","u2j5A24","ywnOzwqSihC","y29SBM8","CfzfvMu","qLfpv3u","x2nSzwfYvgK","ExDgvu0","Avn4t3i","rfbKrxy","ywXRrKy","AMLmuNO","vNzvC0K","x3DZ","vNPfzKG","D0PRBgq","yxPKA0C","y2LpELa","D1fzu0e","B3jL","A0DprfC","BxHvD0S","zw5KCg9PBNq","zwvKzwq","uhvjqNK","mdaWmdaWmda","rvDzCuO","B3jRzxjhBg8","zLjdvgq","D1DTwwi","yxv0BW","z2u6ia","vKTWqxO","uxvLDwu","x2LZv29YA2u","CK1xqLC","zLrRC1O","B3jRig9MzMW","A1n0yxr1C0m","rePuugK","sKPUtg0","q3vZDg9Tq2W","BxnN","z1nczuG","y3jLyxrLrxi","s2HuCMq","CMvHzhDYAxq","sKHSCuS","sNLTEKW","DKfVEgC","DMLJzuLeig8","wgzywMK","BNHtC0O","A3fNqvO","uLbPzvi","rhb1tuS","t3bLBKv2zw4","x19LC01Vzhu","AhDHtfC","qKjps1y","sKDjs3m","CMvWBgfJzui","EwvxwwW","EwXOtw8","yufhwMS","quv3v2u","r1bPDxm","x29Ut3bLBG","Dw5PDee","r3vtuvC","vMfcvMG","rKLmrv9ot1q","ywnRx2LK","Dxrjza","ventAum","z2v0s2v5","rwDnr3y","rufetKO","tM1KBwO","vKnoBeS","DfrbCNa","rMPTuhy","v2Ttrxm","C3bSAxq","wMDzt2O","BfzQvgO","mJKWnJyWmeT1txn6Ba","BNHRvwS","AePUwwu","t1bftL9fuLi","CgLUz0LUDgu","D3rfDwe","C29YDa","sezfuKO","BwfUDwfSihi","DM16D1e","Exz4u3e","yxKSig5LDhC","u2HHCMvKv28","v0f2zwy","yxv0B21HDgK","AwXSihvZzsa","y2XLyxjtDg8","sLrHCuO","C2v0q3vYC28","uNfjEei","C3Hvs3u","DgzuANu","DgLTzw91DcW","Cvn6AMy","AxnszwfKEq","yKH4A2q","s0jIzhy","AxnmB25N","zw50zwqGDhK","vvz6t2u","CvHhvgu","BMCGzMfPBgu","mNW0","rvLesfa","s1vKEwi","B25dBg9Zzq","y1jUswW","BhnVAgi","zw50","CMPMwLm","vvzevxK","A1DUvfG","AxfdAhi","BMDLza","t2nxDfa","r3jIDve","tgLZDgvUzxi","CgfNzwHPzgu","q0Xpu0ve","ywrKq291BNq","AenSB3nLrxy","x2LUAxrhBg8","twLZC2LUzYa","BKjPCuy","x2HHBMrSzvi","r1DTD3a","zNDZxZeUmc4","D01XrgO","C0zSAuC","zv9ZDwnJzxm","C3rLBMvYCW","ExDpzLK","tMHgAM8","zLLvDKe","svvyrey","mxW0Fdy","z3r6zgG","rvjst1i","rKLTrgi","ELDSvgS","ywDL","DhDVCMTdAge","BeHHBMrSzxi","zLPKCxu","zg1orwW","C1bRtMC","zhbdv2G","yNrHugu","B25Uzwn0Aw4","tK5uEM4","wez2zgW","Dw5ZAwDUzwq","Cu95qw0","vxDWCKC","EK1msLq","twzHtKy","y3vYC29Y","D3nZoI8V","BKvLy0i","Ae9Wzw5fDMu","ALvysfC","wgzjwxm","C0nVDw50zxi","BM1iwNK","AMrMsvC","s1Pwv2i","mxWWFdj8nhW","txLotfu","vM5Lqwe","zw1PDa","CNDpsMi","rMPNzvi","DgPRsMy","zM1rzvK","uNrqugG","yNDbDwC","zg9Uzq","v2v2rKy","AgvHzgvYCW","uNrRsLi","zcWG","ihbYB3rVy28","D24GCMvHC28","vfvuqLq","wfPsCNC","EKXvEKC","tKjgu1i","CuPOBwq","s3zrDwe","q0XcvKC","uLHpv0S","uNreB3O","yLDksfa","ywTeqLG","Cw9Zx18","sMndt2i","s1Lhuuu","ruPwA2u","BuXXwvy","DeLK","re5Lwei","vwfdv0O","CgLUz0XVC3m","CMvZzxrdB3u","CfrcBKS","zerNu1a","y291BNq","Dg9oDw1Izxi","zxj2AwnL","B01rreO","v2vIu29JA2u","r2PNrMe","t1rmuLe","C3nHz2vfDMu","CMvTB3zLrxy","vw9gwNG","sNL6C3G","BNruCMLLC0m","yMXVy2TLza","zwHztuW","u0zrEfa","rwfRAK0","AfvhyvO","q054ru4","EvjLy29UBMu","y29UBMvJDa","zxjYB3i","AhjTqM4","yMzKA1a","nxW0Fdj8mxW","Aw5JBhvKzxm","DhfRu3u","yMLUza","uhnNEhe","C2vYDMLJzs0","B2XKy3m","igfYCMf5yNu","y1nhzM8","tvPYwhC","C2vUDa","BwvKAwf0zwW","BKT4DKy","zwzuwMK","zw5HyMXLqxu","AvvcwNm","rMXwrxC","AMPPAMq","AuL0vwK","BMHnENy","Def6BeC","D2fZq2XLyw4","DMfSDwvZ","Bg9NsurozxC","ueHSAve","DKPpBvi","ywnRtxnNswq","EwHHtee","v3jPtgS","u2rjD04","B3Dxzha","s293rvG","x21LC3nHz2u","A2j2vMe","C3nIAwm","wwHhvfm","sujxzxO","yNL0zxm","AxnFywnR","x3nVy2TLDa","zvftqNm","x2DLDeLUDgu","y3vYC29YlNm","B25VCgvU","vhLys1K","y2XLyxi","DLrbyLq","Bg9N","Avr3zva","zMXVB3i","DhjPzxmGCMu","zxjFCw9Z","ihrVihjLDhi","Afn6ue4","qwjdwwe","EKzPrLC","ywXPzcb1CMW","ChjVy2vZCW","z0nbDuK","BMrWB2LUDca","zNHYC1K","rejir2S","yMDqwxK","BwvY","thfjrhu","yvz2zeq","CwDYyuC","s2niwxK","z2v0sxrLBq","DNDls2u","B3jLtMfTzxm","uMrrD20","Cg9PBNrdB24","v3v6BKy","tNPvz2i","AxPXCNC","ue5rBei","Eu5cvwm","B0TYB0W","ywDLsgLKzq","vxrIBgu","AxnbCNjHEq","tMXev1a","v1rswhC","z2n4EMu","u1P2B00","ywDLrxzLBNq","Dhj1y3rVCIa","EwXOCMm","rfbpuuO","tKfzB1a","wKvkyNy","B3bLBIa","AundBvm","zvvYBa","u2vXsuq","igzHAwWSig0","DLnKrNG","tfrMvfm","Dg9cExrLCW","r2vjExC","vwXUAw4","thLQrhO","vuzmzxO","vg1eExC","zNjVBNrPzxi","z1vpCwC","yujZuMO","wLztseG","DK9OA1q","BhrPCgXLihq","qwvVB0C","q09otKvdveK","DeflvKq","AMTztwe","C2v0","C2vYDMLJzq","tKDFrvjst1i","zM9Yy2u","zM9YrwfJAa","CNjVCK1LC3m","CevxuuC","zwjAqva","B2zMBgLUzq","Cg1WDgW","x2nSzwfYugK","tfHmDhu","y2HLy2TdDxi","r21xA1m","x2LZtwLUAvC","C3rVCMu","wwHstLq","AwXLtMfTzq","zKTWtwC","icSG","BMXcy1K","ueXms2m","rhDlDgS","B25szwnLAxy","BMvY","z0LgyLy","yM9L","CNPrwwG","rwXQyuO","q2PHsvC","rhbmDNK","Aw1LCYbPBIa","B3vUDa","y0fdsKG","z1zmALO","DLHYz2m","zM9Qqw0","x3jLy29UBMu","zgvIDwC","BIWGAg9ZDg4","Cgf5Bg9Hzfq","BuHUy1K","ChrVCG","Ec1TC2CTy3u","Cw1NBg0","z0z6wgm","Dg9tDhjPBMC","uvbNB1K","zhrQqxq","CMvZzxruCMK","D0fID1m","u2vYDMLJzvC","y3vYC29Yx2y","zMLSDgvY","qxnTD2u","CYbHBhjLywq","zgvMAw5Luhi","rw5vr0W","x2LZtM9Kzq","y2vZC0HHBMq","yw1L","Du1vqw0","ELLXsve","AKTTy2y","yw1Lu3bHy2u","whDHuge","EhvID1q","z0jbsNa","EwvvEuy","wuXnue0","ufr4su4","sLnptLa","BhLAvuG","t3nMvvG","BffsBuK","B1nJBNa","ENDgu1e","EuHczMy","CMvWBgfJzq","y29UBMvJDgK","Dg9mB3DLCKm","y09Wzw4","ihzHBgLKigq","DMfS","AgzJEvu","x3bPBMDqB24","BxvcywW","lcbTyxGGCMu","nxWXFdn8mhW","zgf0yq","verjzwm","zxrxB3jRq2G","DxrMofDYAxq","C3bSAwnL","Aw50zwDLCIa","BMfTzq","x3bPBMDmB3m","rurUBhC","B3nLrxzLBNq","r2fUs0S","CfrjyLi","Dg9hzw5LCMe","vMvLru0","yMHws0e","qxbbyLq","D3m6lY8","DgTOvwi","C2fNzq","tuHquNe","Aw5L","zvDcC0W","rNLWCeO","CMvHzfvjBNq","x21PBMLoyxy","q29Kzq","q0HKtLy","sw5Vsfq","zufJAW","Cgf5Bg9Hzeu","vLrMAui","DeLUDgvYy2u","rLLpq1u","B3bvCKS","z1nYswC","Auf6qwK","quXZsKC","wef2DMu","BMDuAw1LCG","zvfKyKG","mNWWFdn8nhW","yujwzem","zwn0","zKHLyM0","vM51CM4","qvvRwhK","wNLRte8","Buv0EgG","uM10Dxy","wMHTAe8","AxPrD0i","v3PtDMq","C0vfA1C","Dw5KzwzPBMu","DgLTzw91Da","yNHVv3G","BKXPBMu","x3bYzwzPEa","CxPdENy","tg9JAW","DvvVDe8","B0T3uKe","Cgf5Bg9Hza","uLjpuG","A1LVq1a","y2HnyxHuCMK","sgrPrKS","C1vPwNC","sLzYDxy","rNDHu0S","x0vysvnu","Bg93","B3LduhG","qMnjBwK","zwrPyxrLBhK","q21Ut2S","qNLwtLi","qxzfvw0","rgXRseW","DeXLr3C","yMHnqxO","r1Hry24","DgXLzuu","Auvbyuu","v3Dlvxy","tvn4q1u","mtaWmZy3nxHfte5VtG","CuTMwLG","BwLZzq","zfnXtuq","Ef9MCM9UDgK","x3jLywr5q2W","z29PBMCGyxC","A1bwwgO","uhjPBwfYEuS","CwjNtee","BMnVzgLUzW","yvLsDw4","yxbWzw5Kq2G","zNbMzK8","BML0AwfSAxO","sKLnEhG","zNjVBuHHC2G","yNL0zuXLBMC","Ec1TC2CTCw8","DNLcyu0","yNL0zu9MzNm","y2HHCKnVzgu","ugjOCwe","Dev2zw50","uKLqALy","Eg9WDKm","ELP0uvq","ALLOuMS","Au5RCK8","uMjYsxa","DgnuD0W","yLnSsg4","zNjHBwvuExa","B25mAw5L","Aw9UvgLTzw8","rLDt","x3nLCuLK","q2T1Cuy","twzkBK8","B25TzxnZywC","vMjkBee","DeD5B28","Bg9IywXty28","y3jLyxrLtwu","oty5nJC4sezmr01Z","AxjLza","vxfWsg8","EKvnzg8","B2nRzxrgywK","y0H4tNC","q3nnDhy","B2nRzxq","y3jLyxrLt2i","svHvse4","zgvSzxrL","x3jLBw92zvC","CMvQzwn0","DLbZwee","uw52v0i","uLHbsfa","Aw5PDcbrB1m","swjXt08","yw1LoIa","yKnxtwi","yKvJC0q","yNLL","CNzHBfzHBhu","zxmGCMvHy2G","y29Kzq","ze95BMO","y3vZDg9Tshq","yxbNrKi","uhn2EMm","x2LUAxrqCM8","EhPtCMu","AgzHqKS","mNWZFdb8nxW","y3vYDMfSDwu","t2L0Euu","A2v5","x2LUDgvYDMe","Dgv4DfbHEwW","CYbPBNn0yw4","DezHDgO","wwfKBfC","AhvrCgC","C0vVuuW","wKnRtLK","CIb0DhDjra","v2vZrK8","C2vUza","z2vY","DvDICum","uvDhDhy","B3nLza","shLMwKG","ywnR","ywDLu2HVDW","AvnuEeu","vxDRzhi","DxzgrNK","yxGGCMv0CMK","C1zvzvK","wgrswM8","CM1QzKi","x3bPBMC","u2TPCcbWyxm","B2zM","vu1gD2O","sM5YvNO","mdaWma","yMfSrxzLBNq","rfbyA24","BvHwugW","DxbKyxrLq3u","CMvXDwLYzwq","BNHdq1O","Awvwyum","Cuzqyvi","C2v0u3rVCMe","tg9Nsuq","CLzHBhvLCW","wxbcAMq","B3fPuxy","x2rYB3bhBg8","zMLUza","ywnRx2nVzgu","AgLOu0u","s2PhDwu","u2P2zhG","C2v0sxrLBq","igzPzwXKoIa","u3nirNC","D2fcCLC","l3DZl3yY","thvqqMO","ihrYEsbYzwm","CMjSrva","x29Uq2XVC2u","AM9PBG","v2LgAhC","reHxwK0","D3jPDgvvAw4","zNjVBujPDhm","zNvUy3rPB24","CM92AwrLige","BMCGB3iGyw4","vencrKK","y29TCgXLDgu","zxjFCw9Zx2e","zxjHDg9Y","suXlsLO","zw5NDgG","z0XYEeu","B25JBg9Zzq","x2LZtwLUAvq","AgfZ","wNPOEKK","rMDKugG","CMfTugfYyw0","DwrrC0y","C3jJ","C0n0wLK","yxKSihrYEsa","zwvdt3q","EvDVCMO","m3W0Fdj8mte","u1zzv1y","C3vAt2u","rvL4A0C","D2LSBfjLy28","y3vYC29Yx24","zMLN","zxf1ywXZ","C3rYAw5N","D3jPDgu","nNW3Fdr8mq","CgjICdi","D1fMueq","AMvJDfn0B3i","s29kqva","tMfTzq","uNvRB1K","BujcALu","vwjfC0O","y3vYCMvUDeK","C2v0zgi","yMrFzgLK","x2fKzfDZtgK","nNW4Fdf8mta","y2fTDgC","C0XPC3rLBMu","zerkrgG","q0LiDfy","x29UrxjYB3i","t1bftG","thfms24","Cu9tyuq","wxHzAMS","A3rhvhi","CgfNzxnOB3C","s0DNsM0","yM9KEq","tw9YA1e","rMn0sfG","CgvYC2LZDgu","vgzQwui","EePxC0G","seLgvg0","AwrPBw4","BMvLzf9Hy2S","EfvZzuvUDG","B2LUDfjLywm","x2n1CNnVCK4","y2f0y2G","y254q3y","s3v3yNi","y1bKCeG","shjSqK8","CLvlD1i","Ew10AvK","EufuAMS","sKfmwNq","vwzOy1u","y256ChC","wNj3sMm","suvtx0vsuK8","ve5PA3i","zMzMzG","CMvZzxrfBMq","rLDOwwy","mte4mJeZmMvNufPOAq","vKnSAK8","zxH0ugf5Bg8","yLzJB0m","D3rbvKy","DeLStwm","zNrQs0m","u0zNsu8","x2zVCM1HDeu","BgnAsfG","werkzxm","vu1rreG","EKPxrhO","uwTAz3q","AgLNAa","vwjHyKu","q3vZDg9Trxi","q291BNq","BhvxDeS","Aw9U","BfPJA2O","ugrLAuq","CvPsC2S","zM1dzKu","CMvZB2X2zq","BMzjzwG","AgfZt3DUuhi","x2nVBM5Ly3q","uKDeq1m","rMD3yLC","u2jmEM8","uvfbuvq","t2jQzwn0","uKD1vNK","te1Mzg4","DxjS"];return Tn=function(){return r},Tn()}function Bx(){return yi||(yi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function zx(){let r=S;return bi||(bi=[IDBCursor.prototype[r(1768)],IDBCursor.prototype[r(600)],IDBCursor.prototype[r(600)+"PrimaryKey"]])}function qx(r){let e=S,i={rwOJb:e(1024),fgopR:"RSMyH",rtZmx:function(c,u){return c(u)},sdnGA:function(c){return c()},wyojr:"success",wtAVF:function(c,u){return c instanceof u}},a=new Promise((c,u)=>{let d=e,l={VbJlA:i.rwOJb,hDXyP:function(w,C){return w!==C},WevFF:i.fgopR,nBiqF:d(1573),fqQkh:function(w,C){return w(C)},grDUZ:function(w,C){return i[d(545)](w,C)},vmzwQ:function(w){return i[d(777)](w)}},p=()=>{let w=d;r["removeEventListe"+w(1166)](w(1658),_),r[w(1012)+w(1977)+"ner"](l[w(1357)],v)},_=()=>{let w=d;if(l[w(1944)](l[w(975)],l[w(921)]))l.fqQkh(c,l.grDUZ(ke,r.result)),l[w(877)](p);else return _0x18d1b6||(_0xdf8ed8=[_0x3bcfa1[w(1800)+"e"][w(1768)],_0x249ca4[w(1800)+"e"][w(600)],_0x220087[w(1800)+"e"][w(600)+w(1325)+"ey"]])},v=()=>{u(r[d(1024)]),p()};r[d(1642)+d(914)](i[d(608)],_),r[d(1642)+d(914)](i[d(968)],v)});return a[e(495)](c=>{let u=e;i[u(1552)](c,IDBCursor)&&Ar[u(1142)](c,r)})[e(1531)](()=>{}),Ln[e(1142)](a,r),a}function Fx(r){let e=S,i={fzuRL:e(651)+"or",TbDvz:function(c){return c()},PTxIN:e(1465),MfJnO:"error",huQpg:"abort"};if(In.has(r))return;let a=new Promise((c,u)=>{let d=e,l={LTfTS:i[d(1212)],Rmtuv:i[d(1355)],kLuQn:i[d(1402)],eKRYy:function(w){return w()},AsESX:function(w){return i[d(780)](w)}},p=()=>{let w=d;r["removeEventListe"+w(1166)](l[w(1125)],_),r["removeEv"+w(1977)+w(1166)](l[w(1279)],v),r[w(1012)+w(1977)+w(1166)](l.kLuQn,v)},_=()=>{let w=d;l[w(557)](c),l[w(523)](p)},v=()=>{let w=d;u(r[w(1024)]||new DOMException(w(651)+"or",i.fzuRL)),i.TbDvz(p)};r["addEvent"+d(914)](i[d(1212)],_),r[d(1642)+d(914)](i[d(1355)],v),r[d(1642)+d(914)](i[d(1402)],v)});In.set(r,a)}function D(r,e){r=r-483;let i=Tn(),a=i[r];if(D.iGoQzr===void 0){var c=function(p){let _="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",v="",w="";for(let C=0,P,T,N=0;T=p.charAt(N++);~T&&(P=C%4?P*64+T:T,C++%4)?v+=String.fromCharCode(255&P>>(-2*C&6)):0)T=_.indexOf(T);for(let C=0,P=v.length;C<P;C++)w+="%"+("00"+v.charCodeAt(C).toString(16)).slice(-2);return decodeURIComponent(w)};D.qdDRgD=c,D.vAacXI={},D.iGoQzr=!0}let u=i[0],d=r+u,l=D.vAacXI[d];return l?a=l:(a=D.qdDRgD(a),D.vAacXI[d]=a),a}function Ux(r){Nn={mXVPl:function(a,c){return a(c)}}[S(1430)](r,Nn)}function Hx(r){let e=S,i={nQwyU:function(a,c){return a*c},WqAyP:function(a,c){return a!==c},pKWRK:"YAUfm",kDLlX:e(1176),tTLMB:function(a,c){return a(c)},qKfZX:function(a,c){return a(c)},icoAy:function(a,c){return a(c)},WkGEi:function(a,c){return a in c}};return r===IDBDatabase[e(1800)+"e"][e(1930)+e(1567)]&&!i[e(747)](e(1608)+"oreNames",IDBTransaction.prototype)?function(a,...c){let u=e;if(i.WqAyP(i.pKWRK,i.kDLlX)){let d=r.call(i[u(564)](qt,this),a,...c);return Cr[u(1142)](d,a[u(874)]?a[u(874)]():[a]),ke(d)}else return i.nQwyU(1e4,_0x3de065.now())+_0x2edad3[u(1076)](i.nQwyU(1e4,_0x45103e[u(1791)]()))}:zx()[e(1028)](r)?function(...a){let c=e;return r.apply(i[c(1318)](qt,this),a),i[c(1318)](ke,Ar[c(750)](this))}:function(...a){let c=e;return i[c(1670)](ke,r[c(1606)](i[c(564)](qt,this),a))}}function Kx(r){let e=S,i={rrKiA:function(a,c){return a===c},OtFJY:e(1461),vacZn:function(a,c){return a(c)},UInaM:function(a,c,u){return a(c,u)}};return i[e(648)](typeof r,i[e(541)])?i[e(763)](Hx,r):(r instanceof IDBTransaction&&i[e(763)](Fx,r),i[e(532)](Ai,r,Bx())?new Proxy(r,Nn):r)}function ke(r){let e=S,i={UqpHo:function(c,u){return c instanceof u},ifeom:function(c,u){return c(u)},kUyCp:function(c,u){return c(u)},OPUxm:function(c,u){return c!==u}};if(i[e(1363)](r,IDBRequest))return i.ifeom(qx,r);if(Pn.has(r))return Pn[e(750)](r);let a=i.kUyCp(Kx,r);return i[e(1911)](a,r)&&(Pn[e(1142)](r,a),Ln[e(1142)](a,r)),a}var Ai,yi,bi,Ar,In,Cr,Pn,Ln,Nn,qt,vi=Ci({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={kbvVa:function(i,a){return i instanceof a},wMqDj:function(i,a){return i===a},ysnnB:function(i,a){return i===a},KTWoY:r(1608)+r(1097),UaDvk:r(1157),FSmwm:function(i,a){return i&a},GeIyw:function(i,a){return i+a},UfBXQ:function(i,a){return i!==a},RNkZH:"thpkt",hCrls:r(974),EDnlw:function(i,a){return i in a}};Ai=(i,a)=>a[r(762)](c=>i instanceof c),Ar=new WeakMap,In=new WeakMap,Cr=new WeakMap,Pn=new WeakMap,Ln=new WeakMap,Nn={get(i,a,c){let u=r;if(e[u(1060)](i,IDBTransaction)){if(e[u(925)](a,u(974)))return In.get(i);if(e[u(735)](a,e[u(1604)]))return i[u(1608)+"oreNames"]||Cr[u(750)](i);if(e[u(925)](a,e[u(1917)]))return c.objectStoreNames[1]?void 0:c["objectSt"+u(801)](c[u(1608)+u(1097)][0])}return ke(i[a])},set(i,a,c){let u=r;return e.UfBXQ(e.RNkZH,e[u(1747)])?(_0x48bd32.writeUint8?_0x2a6447[u(1459)+"t8"](_0x3d2e7b,_0x44b92a):_0x24eff8[_0x19de87]=e[u(665)](255,_0x334267),e[u(1127)](_0x2e7fee,1)):(i[a]=c,!0)},has(i,a){let c=r;return e[c(1060)](i,IDBTransaction)&&(a===e[c(1701)]||a===c(1157))?!0:e[c(1239)](a,i)}},qt=i=>Ln[r(750)](i)}}),ki={};Ox(ki,{deleteDB:()=>jx,openDB:()=>Gx,unwrap:()=>qt,wrap:()=>ke});function Gx(r,e,{blocked:i,upgrade:a,blocking:c,terminated:u}={}){let d=S,l={QNSll:function(v,w){return v<=w},XGxMw:function(v,w){return v>=w},VFECG:function(v,w){return v+w},GSVhS:d(1503),BSFOL:function(v,w){return v===w},cPdpH:function(v,w,C,P,T){return v(w,C,P,T)},jjijd:function(v,w){return v(w)},qJQTI:function(v,w,C,P){return v(w,C,P)},mLqYV:d(1553),aQkvx:"UDwLx",efTZi:d(1700),kssqf:function(v,w){return v===w},dpCWh:d(1016)},p=indexedDB.open(r,e),_=ke(p);if(a)if(l.kssqf(d(1513),d(932))){if(l.QNSll(_0xe45c61,-_0x584507))return _0x48f25a;if(l.XGxMw(l[d(1905)](_0x22b122,1),_0x15a171))return _0x149dbe}else p[d(1642)+"Listener"](d(574)+d(805),v=>{let w=d,C={gpMsh:l[w(753)]};if(l.BSFOL(w(1151),"kRTWD"))return _0x16a72d[w(1074)](C.gpMsh,_0x3900ba,_0xa5186d,_0x5813a4),this[w(1750)][w(1142)]({cursor_name:_0x284330,cursor:_0x43d0d4,service:_0x54baf2});l[w(1534)](a,l[w(1044)](ke,p[w(1820)]),v[w(1764)+"on"],v.newVersion,ke(p[w(1930)+w(1567)]))});return i&&p[d(1642)+"Listener"](l[d(944)],()=>i()),_.then(v=>{let w=d;l[w(996)]!==l[w(693)]?(u&&v.addEventListener(l[w(1040)],()=>u()),c&&v[w(1642)+"Listener"](w(1868)+w(542),()=>c())):l[w(1637)](_0x15e8df,this,_0x31f5c6,[_0x3ab14a,_0x17d3dc,_0x410ea4])})[d(1531)](()=>{}),_}function jx(r,{blocked:e}={}){let i=S,a={BRHOz:i(1016),ufBYY:function(u,d){return u(d)}},c=indexedDB[i(667)+i(1628)](r);return e&&c[i(1642)+i(914)](a.BRHOz,()=>e()),a[i(579)](ke,c).then(()=>{})}function Si(r,e){let i=S,a={unitA:i(828)+"e",aVvdD:"readonly",OcWtP:function(p,_){return p instanceof _},UiFTt:function(p,_){return p in _},Pbhqa:function(p,_){return p===_},BXqGl:i(1491),uBERD:function(p,_){return p!==_}};if(!(a[i(912)](r,IDBDatabase)&&!a[i(1831)](e,r)&&a[i(1339)](typeof e,a.BXqGl)))return;if(Dn[i(750)](e))return Dn[i(750)](e);let c=e.replace(/FromIndex$/,""),u=a.uBERD(e,c),d=Di.includes(c);if(!(c in(u?IDBIndex:IDBObjectStore)[i(1800)+"e"])||!(d||Pi[i(1028)](c)))return;let l=async function(p,..._){let v=i,w=this[v(1930)+v(1567)](p,d?a[v(850)]:a[v(1092)]),C=w.store;return u&&(C=C[v(536)](_.shift())),(await Promise[v(1910)]([C[c](..._),d&&w.done]))[0]};return Dn[i(1142)](e,l),l}var Pi,Di,Dn,Wx=Ci({"node_modules/idb/build/index.js"(){let r=S,e={udQsF:r(1638)+"3|4",hZSBm:"put",bHgvB:r(1939),fRCTd:"delete",hyftN:r(750),TZvLr:r(857),YadlW:function(c,u){return c(u)},gBAJp:function(c){return c()}},i=e[r(1477)][r(865)]("|"),a=0;for(;;){switch(i[a++]){case"0":vi();continue;case"1":Di=[e[r(749)],e[r(1611)],e[r(810)],"clear"];continue;case"2":Pi=[e[r(1849)],e[r(1943)],"getAll",r(535)+"ys","count"];continue;case"3":Dn=new Map;continue;case"4":e[r(1401)](Ux,c=>({...c,get:(u,d,l)=>Si(u,d)||c[r(750)](u,d,l),has:(u,d)=>!!Si(u,d)||c[r(1473)](u,d)}));continue;case"5":e[r(1209)](vi);continue}break}}}),Jx={idb:function(r){let e=S;r[e(1726)]=Promise.resolve()[e(495)](()=>(Wx(),ki)).then(function(i){return i})}},Ei={};function Ae(r){let e=S,i={gSrIg:function(u,d){return u!==d}};var a=Ei[r];if(i[e(1265)](void 0,a))return a[e(1726)];var c=Ei[r]={exports:{}};return Jx[r](c,c[e(1726)],Ae),c[e(1726)]}Ae.d=(r,e)=>{let i=D;for(var a in e)Ae.o(e,a)&&!Ae.o(r,a)&&Object["definePr"+i(775)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;Ae.o=(e,i)=>Object.prototype[r(1574)+"operty"][r(1903)](e,i)})(),(()=>{let r=S,e={GWmwp:function(i,a){return i!=a},EsWFr:"Module",qlPaV:r(839)+"le"};Ae.r=i=>{let a=r;e[a(923)](a(1284)+"d",typeof Symbol)&&Symbol[a(1188)+a(510)]&&Object["definePr"+a(775)](i,Symbol[a(1188)+"Tag"],{value:e[a(520)]}),Object["definePr"+a(775)](i,e[a(1866)],{value:!0})}})();var $={};(()=>{let r=S,e={dsGoz:function(s,t){return s(t)},NhFjo:function(s,t){return s+t},FPzNw:function(s,t){return s*t},bcRXt:function(s,t){return s(t)},GrbuQ:function(s,t,n){return s(t,n)},UneYo:function(s,t){return s+t},gSBeH:function(s,t,n){return s(t,n)},gbCnK:r(969),Tprga:r(1427),ZsZCM:r(1545),owWdp:function(s,t){return s(t)},oqchM:"000000000000000000000000"+r(807),eIsrc:function(s){return s()},fZdqu:function(s,t,n){return s(t,n)},MAcTV:function(s,t){return s>t},EtinB:function(s,t){return s<t},RdQwm:function(s,t){return s!==t},sFliG:function(s,t){return s!==t},wmvHx:function(s,t){return s-t},QPgoY:function(s,t){return s<t},QQEMB:function(s,t){return s<t},VvUsI:function(s,t){return s===t},QMjwe:function(s,t){return s<t},kmrnX:r(937),zwFSQ:function(s,t){return s===t},tleeE:r(578),RPieR:r(863),FcyCs:function(s,t,n){return s(t,n)},YNpTh:function(s,t,n){return s(t,n)},qJhmd:function(s,t){return s(t)},RtkJR:r(1948),GQiUO:r(1458),Psgxq:function(s,t){return s>>>t},tjkJf:function(s,t,n){return s(t,n)},mkxkd:function(s,t){return s&t},UVDUy:function(s,t){return s===t},wVASH:r(920)+r(1432)+r(1448)+r(1396),JQCbZ:function(s,t,n){return s(t,n)},KFspT:function(s,t,n){return s(t,n)},NHFQO:r(530),sVUeY:r(1315),ghYrF:function(s,t,n){return s(t,n)},OvXQW:function(s,t){return s(t)},BrdmQ:function(s,t,n){return s(t,n)},xxTDA:function(s){return s()},pLgap:function(s,t,n){return s(t,n)},BYqVr:function(s,t){return s!==t},iZhMc:function(s,t,n){return s(t,n)},CNRko:function(s,t,n){return s(t,n)},ZzhzI:function(s,t,n){return s(t,n)},oKwRA:function(s,t){return s!==t},IoHZN:function(s,t,n){return s(t,n)},gIFbV:function(s,t){return s!==t},GFmDQ:"bAAzT",fojAm:"JlLEY",bJpZE:function(s,t,n){return s(t,n)},ieVaC:function(s,t,n){return s(t,n)},idimn:function(s,t){return s===t},FiiUF:r(573),FPfgo:function(s,t,n){return s(t,n)},sCtZY:function(s,t){return s(t)},JcCOb:function(s,t){return s>>>t},zNWhc:function(s,t){return s(t)},kRGMq:function(s,t){return s(t)},FgwbW:function(s,t){return s(t)},XFvdl:function(s,t,n){return s(t,n)},iEAaE:function(s,t){return s(t)},BytQU:function(s,t,n){return s(t,n)},NAYoP:function(s,t){return s&t},dtjAt:r(920)+r(1432)+" field: SeqID",LyHXm:r(920)+r(1432)+r(1448)+r(1437),ssbic:function(s,t){return s===t},mNeiT:r(920)+r(1432)+r(1448)+r(1143),Spaba:function(s,t){return s===t},iSTxE:function(s,t){return s(t)},izQwB:function(s,t){return s+t},fxBRI:function(s,t){return s(t)},ixzlG:function(s,t){return s(t)},UJbCl:function(s,t,n){return s(t,n)},DPdEv:function(s,t,n){return s(t,n)},WiFhw:r(1817)+r(896)+r(1818),YkwEr:function(s,t){return s>>t},qgBfb:function(s,t){return s>=t},JALZt:function(s,t){return s(t)},UaCWJ:r(1328),ciwTg:r(596),ynhFj:"KTKFc",uipkT:"NiUMz",iTweP:function(s,t){return s+t},SbLzo:r(1423)+r(593),PwFCS:function(s,t){return s>=t},VikpE:function(s,t){return s>>>t},SFgIO:function(s,t){return s+t},vSdFx:function(s,t){return s<<t},fpffO:function(s,t){return s<<t},DlkHL:function(s,t){return s>t},vuQXC:r(988),lxekh:function(s,t){return s*t},ZhxWq:function(s,t){return s>t},KZVWb:function(s,t){return s(t)},HpLcY:"unknown reason",opUrK:r(1774),HIxPe:r(684)+r(759),yHBff:r(723)+"ack=frontierJSONP",LMWoc:function(s,t){return s!==t},lsohb:r(904),DeidZ:"qzzpg",BdPLb:function(s,t){return s>t},NtFxK:r(1622)+r(593),cSGfo:function(s,t,n){return s(t,n)},HdaQx:function(s,t,n){return s(t,n)},wdqOn:"FSPPM",oJkxX:function(s,t){return s+t},DXemc:function(s,t){return s===t},QkZgt:function(s,t){return s&t},DpuMK:function(s,t){return s&t},BFftr:function(s,t){return s!==t},kqgAZ:function(s,t){return s&t},Tsdny:function(s,t){return s+t},wtEua:function(s,t){return s|t},EljaJ:function(s,t){return s<<t},xksbh:function(s,t){return s&t},WAvef:function(s,t){return s>=t},NcZPL:function(s,t){return s<=t},WKgvp:function(s,t){return s==t},nKxvF:function(s,t){return s&t},iwPyq:function(s,t){return s+t},VEpLL:function(s,t){return s+t},HiIHL:function(s,t){return s+t},dvVde:function(s,t){return s+t},AgzRJ:function(s,t){return s!==t},Sjvdx:function(s,t){return s&t},DrTzJ:function(s,t){return s|t},KvQua:function(s,t){return s<<t},RtDoz:function(s,t){return s|t},IBWez:function(s,t){return s|t},bxoWx:function(s,t){return s|t},lVjTj:function(s,t){return s<<t},ubfuc:function(s,t){return s&t},nQiEK:function(s,t){return s<t},hMZyB:function(s,t){return s+t},GjgFa:function(s,t){return s<t},pKkiR:function(s,t){return s>=t},eklJr:function(s,t){return s<t},TCBFI:function(s,t){return s+t},zylbG:function(s,t){return s<<t},nxCCZ:function(s,t){return s<t},ymtiY:function(s,t,n){return s(t,n)},qsKPy:function(s,t){return s>=t},UMFwj:function(s,t){return s<=t},Ulnin:function(s,t){return s+t},SlVzi:function(s,t){return s-t},bwAug:function(s,t){return s<<t},jiLRz:function(s,t){return s<t},DJTPi:function(s,t){return s&t},YLMPM:function(s,t){return s>>t},AwgIR:function(s,t){return s|t},rzQYh:function(s,t){return s&t},jUXHW:function(s,t){return s>>t},GBmMO:function(s,t,n){return s(t,n)},aAGZk:function(s,t){return s<t},xubwT:function(s,t){return s<t},COQij:function(s,t){return s|t},Jyzsx:function(s,t){return s>>>t},uGpWk:function(s,t,n,o){return s(t,n,o)},UQeEN:function(s,t){return s&t},azdkG:function(s,t){return s>>>t},gVmRD:function(s,t){return s|t},dQxUl:function(s,t){return s<<t},CNxEN:function(s,t){return s&t},yeDAp:"XWSqF",kGODW:function(s,t,n){return s(t,n)},QIuSq:function(s,t){return s<t},mEtxh:function(s,t){return s&t},JGIKs:function(s,t){return s>=t},dZkuC:function(s,t){return s|t},yeUyF:function(s,t){return s&t},olyai:function(s,t){return s&t},bNGgm:function(s,t){return s&t},AtTnd:function(s,t){return s&t},wrziq:function(s,t){return s&t},IopuE:function(s,t){return s&t},UMQDH:function(s,t){return s(t)},BBOKV:function(s,t){return s(t)},sWMzm:function(s,t){return s&t},AeooG:function(s,t){return s|t},uvFFy:function(s,t){return s<<t},aFgPW:function(s,t,n){return s(t,n)},JarCx:r(1047),DPXkn:function(s,t){return s|t},yWorj:function(s,t){return s>>>t},RbrIp:function(s,t){return s===t},zZtQT:function(s,t){return s===t},dSqMD:function(s,t){return s<t},kWnTX:function(s,t){return s<t},qjQtD:function(s,t){return s<t},PdeiD:function(s,t){return s<t},fHebm:function(s,t,n){return s(t,n)},skuqB:function(s,t){return s>>>t},JIMxx:function(s,t){return s!==t},eQdbH:function(s,t){return s|t},YdqDg:function(s,t){return s|t},cHxNw:function(s,t){return s!==t},OvQvc:function(s,t){return s&t},qAFKG:function(s,t){return s+t},muBal:function(s,t){return s!==t},ZYmQE:function(s,t){return s|t},MOEqa:function(s,t){return s>>>t},SxmVU:function(s,t){return s+t},zYqIQ:function(s,t){return s|t},dXZXN:function(s,t){return s>>>t},SVYWV:function(s,t){return s|t},ijjiK:function(s,t){return s|t},zjjXz:function(s,t){return s&t},DpLvy:function(s,t){return s!==t},hcEff:function(s,t){return s&t},aTFQh:function(s,t){return s||t},mPnsg:r(1392),qbgLA:function(s,t){return s|t},DltZa:"close",DhtTY:r(1215),pVRNs:r(1148),sUiKU:function(s,t){return s<<t},EYgey:function(s,t){return s<<t},SDKhw:function(s,t){return s<<t},Lbstn:function(s,t){return s<<t},LuPBj:function(s,t){return s|t},dDgSP:function(s,t){return s<<t},sEoQL:function(s,t){return s|t},EFQmg:function(s,t){return s<<t},vTAbT:function(s,t){return s|t},ObNoF:function(s,t){return s|t},HorMN:function(s,t){return s<<t},GPJVK:function(s,t){return s&t},OLieP:function(s,t){return s&t},rIzqz:function(s,t){return s>>>t},KjGue:function(s,t){return s(t)},XoyXb:r(1707),qfbVr:function(s,t){return s>=t},bHxkd:function(s,t){return s===t},DcIOm:r(1641),qOyAm:"Gytzq",yyIgZ:function(s,t){return s<=t},sfxBx:function(s,t){return s%t},ZFLBA:function(s,t){return s/t},JJnLm:r(1284)+"d",GlHUO:r(839)+"le",zFcIz:r(1649),MbnBj:"sCBHA",nfyam:function(s,t){return s*t},KbPlz:function(s,t){return s>>>t},fYUvA:function(s,t){return s===t},VCNlK:function(s,t){return s>>>t},IvTtE:function(s,t){return s&t},RXAHP:function(s,t){return s>>>t},SdIwN:function(s,t){return s+t},XOOdU:function(s,t){return s+t},AvEUm:function(s,t){return s|t},YhGTS:function(s,t){return s|t},TDIec:"EYxkG",SAeVF:function(s,t){return s!==t},hUTfu:function(s,t){return s>>>t},VtnOe:function(s,t){return s===t},EYDHP:r(959),npRiv:function(s,t){return s===t},UbEsJ:function(s,t){return s===t},FyppJ:function(s,t){return s+t},Sbykn:function(s,t){return s&t},HMhDz:function(s,t){return s>>>t},ZJnoP:function(s,t){return s&t},pBIHx:function(s,t){return s&t},ywFUM:function(s,t){return s>>>t},chTJD:function(s,t){return s>>>t},kGRNo:function(s,t){return s>>>t},BXTJm:function(s,t){return s&t},GanKK:function(s,t){return s>>>t},vyBaM:r(1230)+r(900),CjaIW:r(1741)+r(935),NQeoW:r(871)+"OR",ftjKC:r(1889)+r(1543)+"R",OgTtD:"NATIVE_E"+r(1294),GPius:function(s,t){return s!==t},SygVQ:"ZfIZe",bEjar:r(1558),vAoxg:r(1882)+r(933),AhaSG:"dSItf",FlEOh:r(1271)+"1",tGyoo:function(s,t){return s!==t},yBXaf:function(s,t){return s>=t},kHvIZ:function(s,t){return s===t},uPZWH:function(s,t){return s>t},Pkewe:r(1024),MGtzA:function(s,t){return s instanceof t},bhVKA:"Unhandle"+r(1900),nlBcY:function(s,t){return s+t},dmNEl:function(s,t){return s===t},fOhqQ:function(s,t){return s===t},UVSam:function(s,t){return s===t},qFPaR:function(s,t){return s===t},aWGgM:function(s,t,n){return s(t,n)},VTfiB:r(852),xtuSW:function(s,t,n){return s(t,n)},DXGHA:"message",rRZOr:"open",QZDKN:function(s,t,n){return s(t,n)},iabiX:function(s,t){return s+t},cnxCv:function(s,t){return s&t},IbqOO:function(s,t){return s>>t},vwKKe:function(s,t){return s!==t},sJrau:"sEEkW",Utble:function(s,t){return s<t},ODiLP:function(s,t){return s!==t},tFatj:"WFzXi",SWOUO:r(1983)+">",TMxfk:function(s,t){return s===t},vHAkQ:r(634),ciOzP:function(s,t){return s|t},QMoxd:function(s,t){return s!==t},tHsPY:r(1830),lZckj:r(671),rUKwR:function(s,t){return s||t},KhTrd:function(s,t){return s!=t},tkhUb:function(s,t){return s!=t},drGvm:r(756)+r(526)+r(1137)+r(1173)+r(1084),RdMTb:function(s,t){return s+t},TNikr:function(s,t){return s<t},eWBsL:function(s,t){return s<t},PNQlB:function(s,t){return s<t},pTBnK:function(s,t){return s===t},yvxSq:"is_ack",VlAGh:r(854),RukoY:r(1443),nBKjO:function(s,t){return s===t},oKroL:r(1186),CLBVG:"XujqL",FcDbE:function(s,t){return s<t},WVtPz:function(s,t){return s<t},EJZCX:function(s,t){return s>=t},XAvve:function(s,t){return s<t},uGSht:function(s,t){return s|t},SVIsF:function(s,t){return s&t},uhayN:function(s,t){return s>=t},jHhpp:function(s,t){return s&t},fmQeY:function(s,t){return s<<t},OTmJH:function(s,t){return s&t},PLLKc:function(s,t){return s|t},Kuwbr:function(s,t){return s<<t},uWbqC:function(s,t){return s<<t},lFuMM:function(s,t){return s&t},kSuXM:function(s,t){return s+t},KPANk:function(s,t){return s&t},WriLk:function(s,t){return s<t},wgKoG:function(s,t){return s>>t},LqJLO:function(s,t){return s&t},zcBfx:function(s,t){return s===t},LMqqs:function(s,t){return s&t},bgPYy:r(1861)+r(1833),sGUWn:function(s,t){return s&t},HIFTm:function(s,t){return s&t},wQYSA:function(s,t){return s>>t},mebZM:function(s,t){return s<<t},XfXZi:function(s,t){return s&t},PqxYC:r(1475),yNBUc:function(s,t){return s|t},TCSiC:function(s,t){return s|t},FBwWc:function(s,t){return s|t},zjNBY:function(s,t){return s&t},EgMGv:function(s,t){return s-t},hrmBn:r(1491),JHlqK:function(s,t,n,o){return s(t,n,o)},VzEfH:function(s,t){return s(t)},TyXKY:"GmWkS",jdfIW:function(s,t){return s!=t},JOclH:function(s,t){return s!=t},peIpB:r(1748)+r(655),Kjkzm:function(s,t){return s===t},ApAbT:function(s,t){return s!==t},mprWV:r(1454),FHvBp:r(1168),KowEX:r(502),kGMYk:function(s,t){return s!==t},OTLRQ:r(1523),FImDb:r(1862),HMCYZ:function(s,t){return s(t)},bEcsD:function(s,t){return s<t},BcImi:function(s,t){return s<<t},luWtK:function(s,t){return s!==t},KGmzT:r(551),DPOQJ:function(s,t){return s>=t},wAbwS:function(s,t){return s!==t},qSzjf:"KMqVE",ioWbW:r(995),ZOUnJ:function(s,t){return s>t},GZeaj:function(s,t){return s(t)},QYNcw:function(s,t){return s!==t},RiafY:r(1244),TmDyw:r(1757),nxoBD:r(1364),DNeXB:function(s,t){return s&t},SlGOp:r(599),vDjhz:r(583),jkYMa:r(1735),PHliQ:function(s){return s()},qPdEd:function(s,t,n,o){return s(t,n,o)},kroaM:function(s,t){return s(t)},vOhkT:function(s,t){return s===t},HAabq:r(497),xJWsH:r(1810),dkHLr:r(1285),oScnp:r(1870),QQdAP:"LxVWE",RiCOV:r(972),hihSE:function(s,t){return s instanceof t},DLycM:"LVWgv",TkWsm:r(1216),mBBjU:function(s,t){return s<<t},mXIuS:function(s,t){return s|t},waBrW:r(984),lPBWK:"DvaRT",WzSvd:function(s,t){return s||t},AnEPf:"ping_onc"+r(1888)+"t",CUuTo:r(705),ylhrc:r(1927),uMUAm:r(897),ZEJbv:function(s,t){return s||t},zfFXW:function(s,t){return s>t},ycrES:r(1291),wAxQI:function(s,t){return s||t},WWYzn:function(s,t){return s||t},bVcoC:function(s,t){return s<<t},ZhmhO:function(s,t){return s|t},RGuVy:function(s,t){return s<<t},qXGTe:r(484),CIHtV:r(1967),iItUi:function(s,t){return s||t},YqnzG:function(s,t,n){return s(t,n)},mUlLJ:r(806),AEwWe:r(1832),DwKtk:function(s,t){return s||t},HyLEq:function(s,t){return s||t},CkuqF:r(1377)+"DB failed",RbEgY:"qos",iqChr:r(1784)+"id",fTksZ:function(s,t){return s(t)},GbIPn:"x_fronti"+r(1078),rBNyV:r(1321)+r(1466)+"ck",kPVXj:r(1321)+"er_is_ack",RqIxB:function(s,t,n){return s(t,n)},bGLGv:r(1321)+r(1693)+r(700),bytaM:function(s,t){return s*t},yeWYl:r(1527),tAKVD:function(s,t){return s&&t},bCWMb:r(851),rmjfB:function(s,t){return s||t},UgmMW:function(s,t){return s|t},EfFHB:function(s,t){return s|t},wJkld:r(1916),gbUEs:r(1718),vkkFl:function(s){return s()},FTOhB:function(s,t){return s(t)},JymzL:function(s,t){return s instanceof t},UVxsO:r(1755)+r(663)+r(1738),ZkNfK:r(1748)+"ion/json"+r(1654)+r(628),iCCmS:"binary",XEBlu:function(s){return s()},eXxMN:"ogjeT",KNSte:function(s,t){return s>t},apgFB:function(s,t){return s(t)},QhiLk:function(s,t){return s|t},qLbdi:function(s,t){return s||t},uskGu:function(s,t){return s(t)},EqUHY:r(1674)+r(499)+r(813),bGUKR:r(1161),bhMAz:r(1236)+r(1878)+"e",LqIDu:r(525),JVruv:r(1899),iSxOr:function(s,t){return s+t},QhSmV:function(s,t){return s<t},WesFO:function(s,t,n){return s(t,n)},CIEtL:function(s,t){return s>>>t},hfcyU:"4|0|2|3|1",lyZUH:function(s,t,n,o){return s(t,n,o)},kLLfx:function(s,t){return s+t},GmCTm:function(s,t,n,o){return s(t,n,o)},FFLsp:function(s,t){return s<<t},VCljO:function(s,t){return s<<t},jLVkU:function(s,t){return s|t},AbCYa:function(s,t){return s<<t},QWGtv:function(s,t){return s+t},fKpMg:function(s,t){return s+t},xYGvc:function(s,t){return s+t},kYoCP:"mAhqP",RWQgn:function(s,t){return s&t},InoHT:function(s,t){return s+t},VvzpB:function(s,t){return s&t},fDcSL:function(s,t){return s>>>t},Utgyz:function(s,t){return s&t},axRjD:function(s,t,n){return s(t,n)},NAvAR:function(s,t){return s>>>t},SvIgs:function(s,t){return s<t},yhaLA:function(s,t){return s|t},WtHrn:function(s,t){return s>>>t},MSxCU:function(s,t){return s&t},esRWk:function(s,t){return s<t},hPWMY:function(s,t){return s<<t},UwprG:function(s,t){return s&t},FoGVw:function(s,t){return s>>>t},DNIBX:"KTqlT",KoJAP:function(s,t){return s|t},YxYjk:r(974),tSZrw:function(s,t){return s!==t},tqkSu:r(1481),VGLOB:function(s,t){return s<t},LuTwF:function(s,t){return s(t)},HbUeq:r(1773),PXCYM:r(1394),izqrw:function(s,t,n,o){return s(t,n,o)},dXYRt:r(1143),sULbG:r(1069)+r(1006),NlUWE:function(s,t,n){return s(t,n)},aThyM:function(s,t,n){return s(t,n)},xoACy:"cursor_file_name",bKwQs:function(s,t){return s(t)},qzCzv:function(s,t){return s===t},rMWBW:"cursor_n"+r(1202),kIwpv:r(560)+r(1438),gPGgs:r(1856),FqoqD:r(1681),GhHKl:function(s,t,n,o){return s(t,n,o)},IAeDm:r(1503),EnUGL:"setcursor",FvnuM:r(1341),elZeO:function(s,t,n,o){return s(t,n,o)},ebZAP:function(s,t,n){return s(t,n)},XdRZo:r(1321)+r(1873),MfaNF:r(1321)+"er_ttl",EADNJ:function(s,t,n,o){return s(t,n,o)},Yeich:r(1335)+"s",MZrXw:function(s,t,n){return s(t,n)},hJnYe:r(1185)+r(1819)+"e",dbgri:function(s,t){return s(t)},sbCxZ:"x-msg-cursor_value",qOSds:function(s){return s()},TLhhn:function(s,t){return s>t},CHdNV:r(1743),ZVSHH:r(1954),JySMu:function(s){return s()},gqQdZ:function(s){return s()},dOynj:function(s){return s()},whjGR:function(s,t,n){return s(t,n)},pXGaf:function(s,t){return s(t)},cBGJv:function(s){return s()},akDBX:r(853)+"_EXIST",gtzdh:function(s,t){return s===t},dEssm:r(1563),ZCkNY:function(s,t,n){return s(t,n)},fmCfE:function(s){return s()},wWmYb:function(s,t){return s===t},hSzPN:r(550)+r(927)+"s",YhRNT:r(1658),lHyPB:function(s,t,n){return s(t,n)},YpBjd:function(s,t,n,o){return s(t,n,o)},aBVdC:function(s,t,n){return s(t,n)},QQAQT:function(s,t,n){return s(t,n)},oZsfb:function(s,t){return s===t},DOSoR:"ASKRh",kZgEj:r(1382),nhMzv:function(s,t){return s(t)},mHncY:r(1157),LYlpR:"arraybuf"+r(609),SkbKy:r(1494),LYojb:function(s,t){return s/t},HyfZH:"auto",WTRXw:function(s,t){return s==t},qZRsk:"please p"+r(494)+r(1703)+", WebSocket cons"+r(1114)+r(1812)+r(518),Ojsni:r(862),KANCs:"jODae",tgeth:function(s,t,n){return s(t,n)},iUBZs:"online",EGpMQ:r(915),rjfZS:r(1517),QqYsr:r(1150),xBzEX:r(677),ZgYOj:r(955),NlDWP:r(644),ywOfY:"device_id",HdiFK:function(s,t){return s||t},RkvoX:r(576)+r(1852)+r(1829)+r(832)+r(1405),hgQsB:r(1461),LyjDz:function(s){return s()},tfTju:function(s,t,n){return s(t,n)},vXrgc:r(1713),YGreA:r(924)+"0",zpMzr:function(s,t){return s|t},sxUKu:function(s,t){return s|t},DZZOB:function(s,t){return s||t},cgiXE:"TReoU",gLrxE:function(s,t){return s===t},ryatX:"EvVDl",fZsJy:function(s,t,n){return s(t,n)},MyNLU:function(s,t){return s||t},sPkNg:"reconnect",mxUwK:r(1760),sIEaw:function(s,t,n){return s(t,n)},duKwK:function(s,t){return s(t)},btaPe:function(s,t){return s(t)},BLuxM:r(994),CsMtv:r(1416),cACJH:r(623),aLGHA:function(s,t){return s*t},JTaqJ:function(s,t){return s===t},MHcNf:function(s,t,n){return s(t,n)},NgdRZ:r(1323)+r(1480)+r(1663)+r(640)+r(769),fjGEi:r(814),QnvWB:r(890)+r(1453)+r(946)+"g",RfLGc:"send_ack",xzSre:"2|3|4|1|0",HvIdI:function(s,t){return s instanceof t},UIoMk:"objectSt"+r(1097),sSmqF:function(s,t){return s(t)},UixXO:function(s,t){return s===t},MSZPw:r(1300),nLuPy:r(1276),olNtd:function(s,t,n){return s(t,n)},sIzWw:r(1323)+r(879)+r(819)+r(1251),zFiFW:r(1413),gUOqg:function(s,t){return s===t},VBtjE:r(1626)+r(1197)+r(1956),ZGXSY:r(1626)+r(1399)+r(543)+r(1331)+"ed",pVEVe:function(s,t){return s(t)},Gkqhy:function(s,t){return s===t},dDJDh:"please p"+r(1462)+r(1224)+r(782)+r(1816)+r(1598)+r(1463)+r(1034)+"ffer",DVhxY:"number",nupSJ:function(s,t){return s!=t},REMyG:function(s,t){return s instanceof t},DRCfX:function(s,t){return s(t)},pHkeD:function(s,t){return s(t)},zJWDz:r(576)+r(1462)+r(1904)+r(1006),yCJYw:function(s,t){return s instanceof t},TeUmZ:r(1037),FdguP:function(s,t){return s<t},ALsJG:r(1052),HFERJ:r(1821),XuYfk:r(1263),XZRrw:function(s,t){return s==t},CtJmW:r(876)+r(1945)+r(1951),hAsOG:"3|4|0|2|1",bjeJV:r(1026),FlVEw:"urqcp",jYhRk:r(1708),xopvC:r(1542),ollYt:"\0\0\0\0\0\0\0\0",ILKJZ:function(s,t){return s*t},StPsQ:function(s,t){return s/t},camtg:"Window",OityE:function(s,t){return s===t},uhfLL:"DedicatedWorkerG"+r(1359)+"pe",LXLtu:function(s,t){return s!=t},qOSaD:function(s,t){return s===t},WkSEs:function(s,t){return s!=t},dRmlR:r(880)+r(524)+"alScope",UoFZx:r(1193)+r(809)+r(1745),FWhYf:function(s,t){return s!=t},eoYGL:function(s,t){return s!=t},jKmcf:"Object",utqCz:function(s,t){return s!=t},WhGDX:function(s,t,n){return s(t,n)},Nmdmj:"__x_msg_"+r(992)};Ae.r($),Ae.d($,{FWS:()=>Va,CustomErrorEvent:()=>ls,createCloseEvent:()=>_e,ReconnectEvent:()=>ds,createErrorEvent:()=>he,decodedFrame:()=>as,createOpenEvent:()=>ws,CustomCloseEvent:()=>hs,createReconnectEvent:()=>ir,FrontierMessageEvent:()=>ps,encodeFrame:()=>sr,createMessageEvent:()=>_s,OpenEvent:()=>ms,ErrorCode:()=>He,Event:()=>ot,MessageEvent:()=>gs});let i="";function a(s=""){let t=r,n="02",o=""+Date.now(),x=i||(i=e[t(650)](p,s)),h=Math[t(1791)]()[t(1188)](16).slice(-6);return e.NhFjo(n+o+x,h)}function c(){let s=r;return e[s(1635)](1e4,Date[s(1629)]())+Math.floor(1e4*Math[s(1791)]())}function u(s){let t=r;return e[t(930)](e[t(1985)](Array,8)[t(1456)]("0"),e.GrbuQ(parseInt,s,10)[t(1188)](2))[t(1843)](-8)}function d(s){let t=r;return e.UneYo(e[t(1985)](Array,4)[t(1456)]("0"),e[t(825)](parseInt,s,2).toString(16))[t(1843)](-4)}function l(s){let t=r,n={bywsf:function(o,x){return o||x}};if(e.gbCnK!==t(1655)){let o=s[t(865)](/\./)[t(589)](g=>u(g)),x=[];return x[0]=d(e[t(930)](o[0],o[1])),x[1]=d(e[t(930)](o[2],o[3])),[e.Tprga,e[t(629)],e[t(629)],e[t(629)],e.Tprga,e.ZsZCM,x[0],x[1]][t(1456)]("")}else{let o=this[t(1750)][t(1095)](this[t(1288)]),x=_0x22c72a[t(1938)](n.bywsf(o,"{}"));return x[_0xba3f1b]=void 0,this[t(1750)].setItem(this[t(1288)],_0x2192e4[t(619)+"y"](x))}}function p(s){let t=r,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(516)](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(516)](s);return n?e[t(1985)](l,s):o?e[t(1057)](_,s):e.oqchM}function _(s){let t=r,n="",o=[],x=0,h=0,g=!0,m=e[t(629)];if(e[t(1630)](s[t(1935)]("::"),-1)){let f=s[t(865)]("::");for(let b=0;b<f.length;b++){let A=f[b];if(A[t(1935)](":")>0){let I=A[t(865)](":");g&&(x=I.length),h+=I.length;for(let L=0;e[t(1842)](L,I[t(1931)]);L++)if(e[t(1098)](4,I[L][t(1931)])){let V=m[t(1686)+"g"](0,4-I[L][t(1931)]),ee=V.concat(I[L]);o[t(613)](ee)}else o.push(I[L]);g=!1}else{if(e[t(926)](4,A[t(1931)])){let I=m[t(1686)+"g"](0,e[t(1664)](4,A[t(1931)])),L=I[t(1602)](A);o[t(613)](L)}else o.push(A);g&&(x+=1),h+=1,g=!1}}let y="";for(let b=0;e[t(1189)](b,e[t(1664)](8,h));b++)y=y[t(1602)](m);for(let b=0;e.QQEMB(b,o.length);b++)e.VvUsI(b,x)&&(n=n[t(1602)](y)),n=n[t(1602)](o[b]);return n}{let f=s[t(865)](":");for(let y=0;e[t(1920)](y,f.length);y++)if(e[t(926)]("CbdnR",e.kmrnX)){let b=f[y];if(e[t(1098)](4,f[y][t(1931)])){let A=m[t(1686)+"g"](0,4-f[y][t(1931)]),I=A[t(1602)](b);n=n.concat(I)}else n=n[t(1602)](b)}else{let b=e[t(582)](_0x39fe47);return e[t(941)](_0x3e62cd,_0xb4a55a,b),_0x5ee21b(b)}return n}}function v(s,t){let n=r,o={SuLfE:function(x,h){return e.UneYo(x,h)},gFzXc:function(x,h){return x&h}};if(e[n(1218)](e[n(1313)],e[n(836)]))return _0x42cf6f[n(1254)+"8"]?{value:_0xe8fa02[n(1254)+"8"](_0x1f8466),offset:o[n(1601)](_0x19273d,1)}:{value:o[n(1187)](255,_0x310583[_0x1b89ab]),offset:o[n(1601)](_0x14de6e,1)};{let x=s[n(1396)];e[n(926)](void 0,x)&&(e.gSBeH(J,t,10),e[n(601)](Se,t,x));let h=s[n(1884)];h!==void 0&&(J(t,18),Se(t,h))}}function w(s){let t=r,n={};e:for(;!e[t(1985)](De,s);)if(e[t(977)]===e[t(1786)])e.fZdqu(_0x9d0242,_0x56b753,24),e[t(668)](_0x524337,_0x47126b,e[t(985)](_0xdf2039,_0x2bf3a6));else{let o=e[t(1057)](U,s);switch(e[t(1031)](o,3)){case 0:break e;case 1:n[t(1396)]=e[t(970)](ve,s,e[t(1985)](U,s));break;case 2:n[t(1884)]=e[t(825)](ve,s,e[t(1985)](U,s));break;default:ae(s,e.mkxkd(7,o))}}if(e[t(908)](void 0,n.key))throw new Error(e.wVASH);if(n[t(1884)]===void 0)throw new Error("Missing required field: "+t(1884));return n}function C(s){let t=e.eIsrc(ue);return P(s,t),W(t)}function P(s,t){let n=r,o=s[n(1122)];o!==void 0&&(e[n(825)](J,t,8),e.JQCbZ(At,t,o));let x=s[n(1437)];e[n(926)](void 0,x)&&(e[n(941)](J,t,16),e.KFspT(At,t,x));let h=s.service;if(e[n(926)](void 0,h))if(e[n(926)](e[n(713)],e[n(1419)]))e[n(941)](J,t,24),e[n(603)](At,t,e.OvXQW(te,h));else return!!this[n(1750)];let g=s[n(546)];g!==void 0&&(e.YNpTh(J,t,32),At(t,te(g)));let m=s[n(976)];if(m!==void 0)for(let ee of m){e[n(617)](J,t,42);let M=e[n(1877)](ue);e[n(1644)](v,ee,M),e.fZdqu(J,t,M[n(1907)]),e[n(941)](Xt,t,M),k(M)}let f=s[n(1260)+"ncoding"];e[n(498)](void 0,f)&&(e[n(642)](J,t,50),e[n(617)](Se,t,f));let y=s["payloadT"+n(1961)];e.sFliG(void 0,y)&&(e[n(621)](J,t,58),e.ZzhzI(Se,t,y));let b=s[n(1293)];e[n(1292)](void 0,b)&&(e[n(642)](J,t,66),e[n(740)](J,t,b[n(1931)]),Vt(t,b));let A=s.LogIDNew;e[n(498)](void 0,A)&&(e[n(1980)](J,t,74),e[n(1980)](Se,t,A));let I=s[n(1625)+n(1940)];e[n(1167)](void 0,I)&&(J(t,82),e[n(621)](Se,t,I));let L=s[n(1719)];e[n(1167)](void 0,L)&&(e.sFliG(e[n(647)],e[n(1178)])?(e[n(781)](J,t,90),e[n(1434)](Se,t,L)):(this[n(1949)]=!0,this[n(1575)]()));let V=s[n(1349)+"e"];if(e[n(1292)](void 0,V))if(e[n(1526)](e.FiiUF,e.FiiUF))e[n(1988)](J,t,96),At(t,e[n(1479)](te,V));else return _0x4c70e1}function T(s){return N(e[r(1797)](q,s))}function N(s){let t=r,n={};e:for(;!e[t(985)](De,s);){let o=U(s);switch(e[t(993)](o,3)){case 0:break e;case 1:n.SeqID=e.KFspT(Te,s,!0);break;case 2:n[t(1437)]=e[t(1474)](Te,s,!0);break;case 3:n[t(1143)]=U(s);break;case 4:n[t(546)]=e.zNWhc(U,s);break;case 5:{let x=z(s);(n[t(976)]||(n.headers=[]))[t(613)](w(s)),s[t(1907)]=x;break}case 6:n[t(1260)+t(1327)]=e[t(913)](ve,s,e[t(511)](U,s));break;case 7:n[t(1182)+t(1961)]=e[t(621)](ve,s,e[t(511)](U,s));break;case 8:n[t(1293)]=e[t(668)](Ct,s,e[t(1797)](U,s));break;case 9:n.LogIDNew=ve(s,e[t(1577)](U,s));break;case 10:n[t(1625)+t(1940)]=e[t(948)](ve,s,e[t(1314)](U,s));break;case 11:n[t(1719)]=e[t(1960)](ve,s,e[t(1314)](U,s));break;case 12:n[t(1349)+"e"]=U(s);break;default:ae(s,e[t(1117)](7,o))}}if(n[t(1122)]===void 0)throw new Error(e[t(1190)]);if(n[t(1437)]===void 0)throw new Error(e.LyHXm);if(e[t(1061)](void 0,n[t(1143)]))throw new Error(e[t(1921)]);if(e[t(1803)](void 0,n[t(546)]))throw new Error("Missing "+t(1432)+t(1448)+t(546));return n}function z(s){let t=r,n=e[t(1415)](U,s),o=s[t(1907)];return s[t(1907)]=e[t(1281)](s[t(592)],n),o}function ae(s,t){let n=r;switch(t){case 0:for(;128&e[n(1970)](xe,s););break;case 2:e[n(603)](ne,s,e.ixzlG(U,s));break;case 5:e.UJbCl(ne,s,4);break;case 1:e[n(791)](ne,s,8);break;default:throw new Error(e.UneYo(e[n(1457)],t))}}function te(s){let t=r;return s|=0,{low:s,high:e[t(622)](s,31),unsigned:e[t(1798)](s,0)}}let be=[];function ue(){let s=r,t=be[s(656)]();return t?(t[s(592)]=t[s(1907)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function k(s){be[r(613)](s)}function q(s){return{bytes:s,offset:0,limit:s[r(1931)]}}function W(s){let t=r,n={zLUzG:function(o,x){return e[D(1539)](o,x)}};if(e[t(999)]!==e[t(500)]){let o=s[t(1064)],x=s.limit;return e[t(794)](o.length,x)?o:o[t(666)](0,x)}else{let o=_0x36dc44.deleteDatabase(_0x53705a);return _0x52b1f0&&o["addEvent"+t(914)](t(1016),()=>_0x247450()),dXofnX[t(983)](_0x1167a6,o)[t(495)](()=>{})}}function ne(s,t){let n=r,o={MZEFi:n(1706),SFQxP:function(x,h,g){return e[n(948)](x,h,g)}};if(e[n(498)](e[n(1690)],e[n(521)])){if(e.iTweP(s[n(592)],t)>s[n(1907)])throw new Error(e[n(1578)]);s[n(592)]+=t}else this.emit(o[n(1871)],o[n(1018)](_0x3e7c36,o[n(1871)],{..._0x1c99cc}))}function De(s){let t=r;return e[t(506)](s[t(592)],s.limit)}function me(s,t){let n=r,o={Ksorw:function(f,y){return e[D(1031)](f,y)},pTIbR:function(f,y){return f&y},iNkrO:function(f,y){return e[D(1031)](f,y)},aikQj:function(f,y){return e[D(730)](f,y)},zMLJT:function(f,y){return f&y},uoTSc:function(f,y){return e[D(1555)](f,y)},HhSRn:function(f,y){return e[D(730)](f,y)},IXUHN:function(f,y){return f+y},ZNSIW:function(f,y){return e[D(1281)](f,y)},EWYqJ:function(f,y){return e[D(1124)](f,y)},hNMkm:function(f,y){return f|y},yATjk:function(f,y){return e[D(1330)](f,y)}},x=s[n(1064)],h=s[n(592)],g=s[n(1907)],m=e[n(1075)](h,t);if(e[n(1309)](m,x[n(1931)]))if(e.gIFbV(n(529),e.vuQXC)){let f=new Uint8Array(e[n(1669)](2,m));f[n(1142)](x),s.bytes=f}else{_0x471d9a[n(895)](_0x11cdf4)||(_0x627fc3=_0x3dcf99[n(1590)+"er"](_0x21ad06));let f=o.Ksorw(this[n(1562)],16),y=o[n(1242)](65535,this[n(1562)]),b=this[n(1302)]>>>16,A=o.pTIbR(65535,this[n(1302)]),I=o[n(1345)](_0x3bf9e1[n(1562)],16),L=o[n(1242)](65535,_0x2a7af7[n(1562)]),V=o.aikQj(_0x37d54c[n(1302)],16),ee=o[n(952)](65535,_0x6e82d0[n(1302)]),M=0,X=0,re=0,Ie=0;return Ie+=o.uoTSc(A,ee),re+=o.HhSRn(Ie,16),Ie&=65535,re+=b+V,X+=o[n(1737)](re,16),re&=65535,X+=o[n(1370)](y,L),M+=X>>>16,X&=65535,M+=o[n(1981)](f,I),M&=65535,_0x30b5ce[n(1460)](o[n(808)](re,16)|Ie,o[n(1588)](o[n(1538)](M,16),X),this[n(949)])}return s[n(592)]=m,e[n(1617)](m,g)&&(s.limit=m),h}function Xe(s,t){let n=r,o={URQpr:function(x,h){return e[D(963)](x,h)},VneAa:e[n(527)],UFLez:e[n(1264)],NUoAX:e[n(1648)],Psvzc:e[n(1219)]};if(e[n(1711)](e[n(905)],e[n(678)])){let x=s[n(592)];if(e[n(1689)](x+t,s[n(1907)]))throw new Error(e[n(751)]);return s[n(592)]+=t,x}else{let x={EhZWn:function(g,m){return o.URQpr(g,m)},HRNJp:o[n(966)]},h=_0x45c797[n(645)+n(1787)](o[n(1130)]);_0x5c7037["frontier"+n(1213)]=g=>{let m=n;_0x350fa5[m(1519)][m(489)+m(1804)](h),_0x8b89f4["frontier"+m(1213)]=void 0,x[m(649)](_0x566d84,g&&g[m(824)]||x[m(1790)])},h[n(728)]=o.NUoAX,h[n(1478)]=_0x1659c7[n(1220)](/^ws/,n(674))+o[n(1389)];try{_0x15f383[n(1519)][n(1329)+n(1804)](h)}catch{_0x5229d1[n(1519)][n(489)+n(1804)](h)}}}function Ct(s,t){let n=r,o=e[n(1035)](Xe,s,t);return s[n(1064)][n(666)](o,e[n(1555)](o,t))}function Vt(s,t){let n=r,o=e[n(1644)](me,s,t[n(1931)]);s[n(1064)][n(1142)](t,o)}function ve(s,t){let n=r,o=e[n(662)](Xe,s,t),x=String.fromCharCode,h=s[n(1064)],g="\uFFFD",m="";for(let f=0;e[n(1189)](f,t);f++)if(e.UVDUy(e[n(1696)],e[n(1696)])){let y=h[e.oJkxX(f,o)],b,A,I,L;e[n(528)](e.QkZgt(128,y),0)?m+=e[n(1479)](x,y):e[n(837)](224,y)===192?e[n(1281)](f,1)>=t?m+=g:(b=h[f+o+1],e.BFftr(e[n(835)](192,b),128)?m+=g:(L=e[n(1117)](31,y)<<6|e.mkxkd(63,b),L<128?m+=g:(m+=e[n(511)](x,L),f++))):(240&y)==224?f+2>=t?m+=g:(b=h[f+o+1],A=h[e[n(612)](e[n(670)](f,o),2)],e[n(837)](e[n(873)](b,e[n(1170)](A,8)),49344)!==32896?m+=g:(L=e[n(873)](e.wtEua(e.mkxkd(15,y)<<12,e[n(837)](63,b)<<6),e[n(1928)](63,A)),e.EtinB(L,2048)||e[n(881)](L,55296)&&e[n(1603)](L,57343)?m+=g:(m+=x(L),f+=2))):e[n(739)](e[n(1039)](248,y),240)?e[n(881)](f+3,t)?m+=g:(b=h[e.iwPyq(e[n(612)](f,o),1)],A=h[e[n(685)](e[n(1627)](f,o),2)],I=h[e[n(585)](e.izQwB(f,o),3)],e[n(742)](e[n(1446)](e.wtEua(e.DrTzJ(b,e[n(986)](A,8)),I<<16),12632256),8421504)?m+=g:(L=e[n(989)](e[n(1063)](e[n(1286)](e[n(867)](e[n(1039)](7,y),18),e[n(1124)](63&b,12)),e[n(1117)](63,A)<<6),e[n(708)](63,I)),e[n(1909)](L,65536)||L>1114111?m+=g:(L-=65536,m+=e[n(601)](x,e[n(1962)](e[n(622)](L,10),55296),e.izQwB(e[n(1039)](1023,L),56320)),f+=3))):m+=g}else this[n(1397)+n(1893)]();return m}function Se(s,t){let n=r,o=t[n(1931)],x=0;for(let m=0;e[n(1009)](m,o);m++){let f=t.charCodeAt(m);e.pKkiR(f,55296)&&f<=56319&&e[n(556)](e[n(585)](m,1),o)&&(f=e[n(1664)](e[n(1464)](e[n(1915)](f,10),t[n(1338)+"At"](++m)),56613888)),x+=f<128?1:e[n(1842)](f,2048)?2:e[n(1433)](f,65536)?3:4}e[n(1537)](J,s,x);let h=e[n(1434)](me,s,x),g=s[n(1064)];for(let m=0;m<o;m++){let f=t[n(1338)+"At"](m);e.qsKPy(f,55296)&&e[n(1425)](f,56319)&&e[n(1128)](m,1)<o&&(f=e[n(1815)](e[n(1627)](e[n(973)](f,10),t.charCodeAt(++m)),56613888)),f<128?g[h++]=f:(e[n(793)](f,2048)?g[h++]=e[n(1039)](e[n(622)](f,6),31)|192:(f<65536?g[h++]=e[n(1063)](e[n(821)](e[n(1211)](f,12),15),224):(g[h++]=e[n(873)](e[n(821)](e[n(1211)](f,18),7),240),g[h++]=e.AwgIR(e[n(1169)](f>>12,63),128)),g[h++]=e[n(672)](e[n(958)](f,6)&63,128)),g[h++]=e[n(873)](e[n(708)](63,f),128))}}function Xt(s,t){let n=r,o=e[n(1854)](me,s,t[n(1907)]),x=s[n(1064)],h=t[n(1064)];for(let g=0,m=t[n(1907)];e[n(846)](g,m);g++)x[g+o]=h[g]}function xe(s){return s[r(1064)][Xe(s,1)]}function Yt(s,t){let n=r;if(e[n(1526)](n(755),e.yeDAp)){let o=e.kGODW(me,s,1);s.bytes[o]=t}else{let o=(n(1957)+n(1483)+"|10|5|6|9").split("|"),x=0;for(;;){switch(o[x++]){case"0":if(e[n(793)](_0x1df0d1[_0x7a1515++],128))return{value:_0x1daedd?_0x44f5d6:e[n(1286)](0,_0x4752aa),offset:_0x2ac1b6};continue;case"1":if(e[n(1208)](_0x18c971[_0x167e8f++],128))return{value:_0x5c7662?_0x8f06bf:e.COQij(0,_0x30063f),offset:_0x1c321e};continue;case"2":_0x4c8c5d=e[n(1014)](e.COQij(_0x24846f,e[n(1915)](127&_0x4098dc[_0xf01e94],21)),0);continue;case"3":_0x5c88d8=e[n(1014)](e[n(732)](_0x69c2d6,(127&_0x5700f4[_0x59931e])<<14),0);continue;case"4":if(e.QQEMB(_0x53666a[_0x321fd0++],128))return{value:_0x106b36?_0x520e30:0|_0x26afca,offset:_0x3029be};continue;case"5":if(_0x9ec7a6[_0x5094f5++]<128)return{value:_0x20b743?_0x43cca4:e[n(989)](0,_0x2e144e),offset:_0x114382};continue;case"6":if(e[n(1630)](_0x11f8dc+=5,_0x49d6d9[n(1931)]))throw _0x84acd6=_0x1486b5[n(1931)],e[n(544)](_0x164c21,_0x25c6aa,10,_0xf7f34e[n(1931)]);continue;case"7":_0x1195be=e[n(708)](127,_0x5e7a99[_0x4aed60])>>>0;continue;case"8":_0x5b6c56=e[n(993)](e[n(1286)](_0x1c7097,e.UQeEN(127,_0xd7f785[_0x4746ee])<<7),0);continue;case"9":return{value:_0x116c64?_0x251cbf:0|_0x3ea6dc,offset:_0x1890a6};case"10":_0x3a387a=e[n(798)](e.gVmRD(_0x49c308,e[n(1723)](e[n(1021)](15,_0x59adb6[_0x35fde8]),28)),0);continue;case"11":if(e[n(846)](_0xe387bb[_0x25e8b7++],128))return{value:_0x4b19f9?_0x22c3ba:0|_0x3fc8ec,offset:_0x3a6dc2};continue}break}}}function U(s){let t=r,n=0,o=0,x;do x=e.OvXQW(xe,s),e.QIuSq(n,32)&&(o|=e[t(973)](e[t(1278)](127,x),n)),n+=7;while(128&x);return o}function J(s,t){let n=r;for(t>>>=0;e[n(842)](t,128);)e[n(642)](Yt,s,e.dZkuC(e.yeUyF(127,t),128)),t>>>=7;Yt(s,t)}function Te(s,t){let n=r,o=0,x=0,h=0,g;return g=e[n(1970)](xe,s),o=127&g,e.olyai(128,g)&&(g=e[n(1415)](xe,s),o|=e.fpffO(e[n(1851)](127,g),7),128&g&&(g=e[n(1314)](xe,s),o|=e.dQxUl(e[n(1039)](127,g),14),e[n(1561)](128,g)&&(g=e[n(1797)](xe,s),o|=e[n(1723)](127&g,21),128&g&&(g=xe(s),x=e[n(1863)](127,g),e.wrziq(128,g)&&(g=e[n(963)](xe,s),x|=e[n(1446)](127,g)<<7,e[n(1808)](128,g)&&(g=e[n(1559)](xe,s),x|=e.DpuMK(127,g)<<14,128&g&&(g=e[n(841)](xe,s),x|=e[n(1124)](e[n(1117)](127,g),21),e.sWMzm(128,g)&&(g=xe(s),h=127&g,e[n(1117)](128,g)&&(g=xe(s),h|=e[n(1170)](e[n(1021)](127,g),7)))))))))),{low:e[n(1138)](o,e.KvQua(x,28)),high:e[n(798)](x,4)|e[n(1417)](h,24),unsigned:t}}function At(s,t){let n=r;if(e.VvUsI(e[n(1727)],"SWTKv")){let o=0,x=_0xc86019,h=_0x1f763f+4;for(;e[n(675)](x,h);){let{value:g,offset:m}=e.aFgPW(_0x3e5f04,_0x310bb5,x);x=m,o=e[n(1031)](e.fpffO(o,8),0),o+=g}return{value:o,offset:h}}else{let o=e[n(1031)](t[n(1302)],0),x=e.DPXkn(e[n(798)](t[n(1302)],28),e[n(1170)](t[n(1562)],4))>>>0,h=e[n(1482)](t[n(1562)],24),g=e[n(1346)](0,h)?e[n(1343)](0,x)?o<16384?o<128?1:2:e[n(1320)](o,2097152)?3:4:e.QMjwe(x,16384)?e[n(909)](x,128)?5:6:e[n(718)](x,2097152)?7:8:e[n(1569)](h,128)?9:10,m=e[n(1274)](me,s,g),f=s[n(1064)];switch(g){case 10:f[m+9]=e[n(1822)](h,7)&1;case 9:f[m+8]=e[n(1332)](9,g)?e[n(1270)](128,h):e[n(835)](127,h);case 8:f[e.SFgIO(m,7)]=g!==8?e[n(496)](x>>>21,128):e[n(1169)](e[n(730)](x,21),127);case 7:f[m+6]=e[n(1366)](7,g)?x>>>14|128:e.OvQvc(e[n(1014)](x,14),127);case 6:f[e[n(1717)](m,5)]=e.muBal(6,g)?e[n(571)](e[n(611)](x,7),128):e.OvQvc(e[n(798)](x,7),127);case 5:f[e[n(738)](m,4)]=e[n(1228)](5,g)?e.gVmRD(128,x):e[n(1928)](127,x);case 4:f[m+3]=g!==4?e[n(1204)](e[n(1823)](o,21),128):o>>>21&127;case 3:f[m+2]=e[n(594)](3,g)?e[n(1484)](e[n(1822)](o,14),128):e[n(1561)](e[n(1482)](o,14),127);case 2:f[e[n(1128)](m,1)]=e.BYqVr(2,g)?e.ijjiK(o>>>7,128):e[n(1785)](e[n(1031)](o,7),127);case 1:f[m]=e[n(1172)](1,g)?e[n(989)](128,o):e.hcEff(127,o)}}}function as(s){return T(s)}function sr(s){let t=r,n={ttJyS:function(o,x){return e.aTFQh(o,x)}};if(e[t(1711)](e.mPnsg,e[t(694)])){let o=this[t(1750)][t(1095)](this[t(1288)]),x=_0x13cc2b[t(1938)](n[t(771)](o,"{}"));return x[_0x2ca005||_0x2caf68[this._pathKey]]=_0x59fc05,this[t(1750)][t(1447)](this._prefix,_0x3b8b37.stringify(x)),_0x2a7dd3||_0x48bdd4[this[t(1959)]]}else return e[t(985)](C,s)}let xs=65536,ia=e[r(711)],it=e.lxekh(xs,xs),cs=e[r(1468)](it,it),us=e.StPsQ(cs,2),Ue=String[r(1800)+"e"][r(1338)+"At"];class B{constructor(t,n,o){let x=r;this.isLong=!0,this[x(1302)]=e[x(496)](0,t),this[x(1562)]=e.qbgLA(0,n),this[x(949)]=!!o}static[r(895)](t){let n=r;if(e[n(794)](n(1215),e[n(1729)]))return t&&e[n(908)](!0,t.isLong);{let o=this[n(1685)+n(1585)]?.["getCurre"+n(602)+"nt"](),x=this._options[n(1663)+"tInterce"+n(1184)](_0x3e69a6[n(1385)],_0x9ce275.reason);this["_dispatc"+n(918)+n(906)](e[n(1609)](_0xfbdd32,e.DltZa,{code:1006,reason:_0x29b53c[n(1724)]||n(1221)+n(899)+n(1640)+n(980)+n(1181)+n(1379)+o,willReconnect:x})),x&&this[n(1575)]();return}}static[r(1460)](t,n,o){return new B(t,n,o)}static[r(752)+"s"](t,n,o){let x=r;return o?B[x(752)+x(698)](t,n):B[x(752)+x(1974)](t,n)}static[r(752)+r(698)](t,n){let o=r;if(o(1148)!==e.pVRNs){let{type:x}=_0x4660dd;this[o(967)](x,_0x2467a9)}else return new B(e.ijjiK(e[o(501)](t[0],e[o(1710)](t[1],8))|t[2]<<16,t[3]<<24),e[o(1429)](e.DrTzJ(t[4],e[o(1767)](t[5],8))|e.SDKhw(t[6],16),e[o(1668)](t[7],24)),n)}static[r(752)+"sBE"](t,n){let o=r;return new B(e[o(1452)](e.AwgIR(e[o(1710)](t[4],24),t[5]<<16),e[o(1124)](t[6],8))|t[7],e[o(1286)](t[0]<<24,e[o(1003)](t[1],16))|e[o(1417)](t[2],8)|t[3],n)}static[r(1333)](t){let n=r;return t===ia?fs:new B(e[n(993)](e.ijjiK(e.AeooG(e.sEoQL(Ue[n(1903)](t,0),Ue[n(1903)](t,1)<<8),e[n(1659)](Ue[n(1903)](t,2),16)),Ue[n(1903)](t,3)<<24),0),e[n(1270)](e.vTAbT(e[n(1895)](Ue.call(t,4),e[n(1864)](Ue[n(1903)](t,5),8)),Ue[n(1903)](t,6)<<16),e[n(1659)](Ue[n(1903)](t,7),24))>>>0,!0)}[r(699)](){let t=r;return String[t(1855)+"Code"](e.olyai(255,this.low),e.GPJVK(e.VikpE(this[t(1302)],8),255),e[t(1929)](e[t(1482)](this[t(1302)],16),255),e[t(1746)](this[t(1302)],24),e[t(1278)](255,this[t(1562)]),this[t(1562)]>>>8&255,e.AtTnd(e.VikpE(this[t(1562)],16),255),this[t(1562)]>>>24)}static fromNumber(t,n=!0){let o=r;if(e[o(1445)](isNaN,t))return n?oa:fs;if(n)if(e[o(1061)](e.XoyXb,e[o(1731)])){if(e.qfbVr(t,cs))return xa}else _0x65dc87[o(1142)](_0x5513ba,_0x3d947e);else{if(e[o(893)](e.DcIOm,e[o(950)]))return e[o(1599)](_0x3a87bf,e[o(650)](_0x309c97,_0x54e624));if(e.yyIgZ(t,-us))return ca;if(e[o(930)](t,1)>=us)return aa}return B[o(1460)](e[o(1874)](t,it)|0,e[o(1452)](e.ZFLBA(t,it),0),n)}[r(1005)](){let t=r,n={ixuCX:function(o,x){return o!=x},ZykLO:e.JJnLm,Asmwe:e[t(504)]};if(e[t(1702)]!==e[t(1918)])return this[t(949)]?e.nfyam(this[t(1562)]>>>0,it)+e[t(1610)](this[t(1302)],0):e[t(1281)](this[t(1562)]*it,this[t(1302)]>>>0);_0x388489.r=o=>{let x=t;OfpMDh[x(547)](OfpMDh[x(1277)],typeof _0x8d8e61)&&_0x1687a1["toString"+x(510)]&&_0x1de5a6[x(1198)+x(775)](o,_0xbdfdb5[x(1188)+x(510)],{value:"Module"}),_0x3c2176[x(1198)+x(775)](o,OfpMDh[x(1196)],{value:!0})}}[r(1968)](){let t=r;return e[t(931)](0,this[t(1562)])&&e[t(1343)](0,this[t(1302)])}[r(1939)](t){let n=r;B[n(895)](t)||(t=B.fromNumber(t));let o=e[n(1746)](this[n(1562)],16),x=65535&this[n(1562)],h=e[n(861)](this[n(1302)],16),g=e[n(837)](65535,this[n(1302)]),m=t[n(1562)]>>>16,f=e[n(1695)](65535,t[n(1562)]),y=t[n(1302)]>>>16,b=e[n(708)](65535,t[n(1302)]),A=0,I=0,L=0,V=0;return V+=e[n(585)](g,b),L+=e.RXAHP(V,16),V&=65535,L+=e[n(1056)](h,y),I+=L>>>16,L&=65535,I+=e[n(1717)](x,f),A+=I>>>16,I&=65535,A+=e[n(1964)](o,m),A&=65535,B.fromBits(e[n(1308)](e.vSdFx(L,16),V),e[n(1062)](A<<16,I),this[n(949)])}[r(1490)](t){let n=r,o={EakjM:function(x,h,g){return e[D(825)](x,h,g)}};if(n(1486)!==e[n(1232)]){let x=this._options[n(1663)+n(1262)+n(1184)](_0x3a1382,_0x5e95fb);this[n(1618)+"hCloseEv"+n(906)](o[n(1019)](_0x54f5eb,"close",{code:_0x2f7a08,reason:_0x2d736a,wasClean:!0,willReconnect:x})),x&&this._connect()}else return B[n(895)](t)||(t=B[n(1590)+"er"](t)),e.SAeVF(this[n(949)],t.unsigned)&&this[n(1562)]>>>31===1&&e[n(1061)](e[n(653)](t[n(1562)],31),1)?!1:e.VtnOe(this.high,t[n(1562)])&&this[n(1302)]===t.low}addOne(){let t=r,n={JnrVz:function(o,x){return e[D(1970)](o,x)},WVtde:function(o){return e[D(582)](o)}};if(e[t(794)](e[t(901)],e[t(901)]))return this[t(1302)]===-1&&e.npRiv(-1,this[t(1562)])?B[t(1460)](0,0,this[t(949)]):e.UbEsJ(-1,this[t(1302)])?B[t(1460)](0,this[t(1562)]+1,this[t(949)]):B[t(1460)](e[t(1253)](this[t(1302)],1),this[t(1562)],this[t(949)]);this[t(1949)]=!1,n[t(1426)](_0x380684,this[t(1575)+t(1351)+t(855)]),n.WVtde(_0x2749b8)}[r(1126)](t){return t?this[r(1890)+"E"]():this.toBytesBE()}toBytesLE(){let t=r,n=this[t(1562)],o=this[t(1302)];return[e[t(1785)](255,o),e[t(783)](o>>>8,255),e.xksbh(e.HMhDz(o,16),255),o>>>24,e[t(837)](255,n),e.ZJnoP(e[t(798)](n,8),255),e[t(1891)](e[t(789)](n,16),255),n>>>24]}toBytesBE(){let t=r,n=this[t(1562)],o=this.low;return[e[t(757)](n,24),e[t(1695)](e[t(1872)](n,16),255),e[t(1610)](n,8)&255,255&n,o>>>24,e.UQeEN(o>>>16,255),e.BXTJm(e[t(1241)](o,8),255),e[t(1652)](255,o)]}}let fs=new B(0,0,!1),oa=new B(0,0,!0),aa=B[r(1460)](-1,2147483647,!1),xa=B[r(1460)](-1,-1,!0),ca=B[r(1460)](0,-2147483648,!1);var He=(function(s){let t=r,n=e[t(1336)][t(865)]("|"),o=0;for(;;){switch(n[o++]){case"0":s[s[t(1741)+t(935)]=5004]=e[t(1171)];continue;case"1":s[s[t(1139)+t(1144)]=5002]="CONNECTI"+t(1144);continue;case"2":s[s[e[t(1966)]]=5005]=e.NQeoW;continue;case"3":s[s[e[t(1554)]]=5003]=e.ftjKC;continue;case"4":return s;case"5":s[s[t(727)+t(1294)]=5001]=e.OgTtD;continue}break}})({});class ot{constructor(t){let n=r,o={Agmzw:function(x,h,g){return x(h,g)}};e.GPius(e[n(1982)],e.bEjar)?(this[n(728)]=t,this.target=null):(_0x41af40(_0xba473e,82),LdbiQA.Agmzw(_0x6611ea,_0x4b6a40,_0xf64d10))}}class ds extends ot{constructor(t,n){let o=r;super(t),this[o(1706)]=n&&n.message||null}}class ls extends ot{constructor(t,n){let o=r,x=e[o(831)][o(865)]("|"),h=0;for(;;){switch(x[h++]){case"0":super(t);continue;case"1":this[o(1728)]=n&&n[o(1728)]||0;continue;case"2":this[o(785)]=n&&n.colno||0;continue;case"3":this[o(1973)]=n&&n[o(1973)]||"";continue;case"4":this[o(1706)]=n&&n[o(1706)]||"";continue;case"5":this.error=n&&n.error||null;continue;case"6":this.code=n&&n[o(1385)]||5001;continue}break}}}class hs extends ot{constructor(t,n){let o=r;if(e.UbEsJ(e.AhaSG,e.AhaSG)){let x=e.FlEOh.split("|"),h=0;for(;;){switch(x[h++]){case"0":this[o(1385)]=n&&n[o(1385)]||0;continue;case"1":this[o(1487)+"nnect"]=n&&n.willReconnect||!1;continue;case"2":super(t);continue;case"3":this[o(1724)]=n&&n.reason||"";continue;case"4":this[o(1048)]=n&&n[o(1048)]||!1;continue}break}}else this.emit(e.DltZa,_0x109c4a),this.onclose&&this[o(1471)](_0x48c1b3)}}class gs extends ot{constructor(t,n){let o=r;super(t),this[o(1231)]=n&&n[o(1231)]||null}}class ps extends gs{constructor(t,n){let o=r;super(t),this[o(1231)]=n&&n[o(1231)]||null,this.message=n&&n[o(1706)]||null}}class ms extends ot{constructor(t,n){let o=r;super(t),this[o(1231)]=n&&n.data||null}}function he(s,{message:t,code:n,error:o}){return new ls(s,{message:t,code:n,error:o})}function _e(s,{code:t,reason:n,wasClean:o,willReconnect:x}){return new hs(s,{code:t,reason:n,wasClean:o,willReconnect:x})}function _s(s,{data:t,message:n}){let o=r;if(e[o(1358)](o(961),"nmHZy"))this[o(1949)]=!0,this[o(1575)]();else return new ps(s,{data:t,message:n})}function ws(s,{data:t}){return new ms(s,{data:t})}function ir(s,{message:t}){return new ds(s,{message:t})}class ys{constructor(t,n){let o=r;this[o(804)+"s"]=t,this[o(492)+"es"]=n,this[o(1502)+o(1850)]=0,this["currentEndpointT"+o(1730)+"t"]=0}[r(1546)+"pointCon"+r(1489)](){let t=r;this[t(1502)+"ndex"]=0,this[t(1793)+t(1801)+"riesCount"]=0}[r(1191)+"es"](){let t=r;this[t(1793)+"ndpointT"+t(1730)+"t"]=0}[r(1865)+r(602)+"nt"](){let t=r;return this[t(804)+"s"][this[t(1502)+t(1850)]]}["getCurre"+r(602)+r(1015)+"ount"](){let t=r;return this[t(1793)+t(1801)+t(1730)+"t"]}["checkRea"+r(1296)+"es"](){let t=r;return!!(e.yBXaf(this["currentI"+t(1850)],this.endpoints[t(1931)])||e[t(1667)](this[t(1502)+t(1850)],this[t(804)+"s"].length-1)&&this[t(1793)+t(1801)+t(1730)+"t"]===this[t(492)+"es"])}[r(1154)+r(731)+"ointReac"+r(1838)+"tries"](){let t=r;return e[t(739)](this[t(1502)+t(1850)],this.endpoints[t(1931)])?!0:e[t(548)](this[t(1793)+t(1801)+t(1730)+"t"],this[t(492)+"es"])}[r(843)+r(566)+r(1675)+r(1756)+"unt"](){let t=r;return this[t(1793)+t(1801)+t(1730)+"t"]=1,this["currentI"+t(1850)]++,this.endpoints[this[t(1502)+t(1850)]]}[r(1865)+r(602)+r(507)+r(1887)](){let t=r;return this[t(1793)+t(1801)+t(1730)+"t"]++,this[t(1865)+t(602)+"nt"]()}}let at=(e[r(1248)](e[r(822)],typeof globalThis)&&e[r(1667)](e.camtg,globalThis["construc"+r(1783)].name)||r(1284)+"d"!=typeof window&&e[r(893)](e[r(1507)],window[r(638)+"tor"].name))&&e[r(962)](e[r(822)],typeof document),Ye=e[r(827)](e.JJnLm,typeof globalThis)&&(e[r(1395)](r(1580),globalThis[r(638)+r(1783)][r(1237)])||e[r(1885)]===globalThis[r(638)+r(1783)][r(1237)])&&e[r(1153)](r(1284)+"d",typeof tt),kt=(e[r(1248)](e[r(822)],typeof globalThis)&&e[r(1514)]("Object",globalThis[r(638)+r(1783)][r(1237)])||e.XZRrw(e[r(822)],typeof globalThis)||e.nupSJ(e[r(822)],typeof globalThis)&&!!globalThis["WeixinJS"+r(683)])&&e[r(1248)](e[r(822)],typeof wx),Pt=e[r(864)](e.JJnLm,typeof globalThis)&&(e.OityE(e.uhfLL,globalThis[r(638)+r(1783)][r(1237)])||e[r(1762)]===globalThis[r(638)+r(1783)][r(1237)]||e[r(1470)](e[r(1013)],globalThis[r(638)+r(1783)][r(1237)]))&&e[r(1547)](e[r(822)],typeof self),ua=e.eoYGL(e[r(822)],typeof globalThis)&&e.RbrIp(e[r(1205)],globalThis[r(638)+r(1783)][r(1237)])&&e.WkSEs(e[r(822)],typeof global)&&e[r(931)](e[r(1205)],global[r(638)+r(1783)][r(1237)])&&r(1284)+"d"!=typeof process&&!!process[r(745)];class or{constructor(){let t=r;this[t(1897)+"rs"]={}}emit(t,...n){let o=r,x=this[o(1897)+"rs"][t];if(x)x.slice()[o(1146)](h=>h.fn.apply(h[o(1847)],n));else if(e[o(590)]===t&&!this[o(616)]){let h=n.length&&n[0];if(e[o(1721)](h,Error))throw h;let g=new Error(e[o(1245)]+(h?e[o(1162)](e[o(685)](" (",h[o(1706)]),")"):""));throw g.context=h,h}return this}[r(1424)](t,n){let o=r;if(e[o(942)](void 0,t))this[o(1897)+"rs"]={};else if(e[o(1218)](void 0,n))this[o(1897)+"rs"][t]=null;else{let x=this._listeners[t];if(x)for(let h=0;e[o(1842)](h,x[o(1931)]);)e[o(1691)](x[h].fn,n)?x[o(1235)](h,1):++h}return this}on(t,n,o){let x=r;return(this[x(1897)+"rs"][t]||(this[x(1897)+"rs"][t]=[]))[x(613)]({fn:n,ctx:o||this}),this}}class fa extends or{_formatErrorMessage(t){let n=r;return t.errMsg||t.errNo?("message: "+(t.errMsg||"")+" code: "+(t.errNo||""))[n(1824)]():JSON[n(619)+"y"](t)}constructor(t,n,o){let x=r;super(),this[x(1066)]=null,kt&&wx[x(1688)+"ocket"]&&(this._socket=wx[x(1688)+x(1368)]({url:t,protocols:n,header:o,fail:this[x(1963)+"ocketFailHandler"][x(1030)](this),success:this[x(1963)+x(597)+x(1201)+x(1651)][x(1030)](this)})),Ye&&tt["connectS"+x(1368)]&&(this[x(1066)]=tt[x(1688)+x(1368)]({url:t,protocols:n,header:o,fail:this[x(1963)+x(1365)+x(940)][x(1030)](this),success:this[x(1963)+"ocketSuc"+x(1201)+"ler"][x(1030)](this)}))}["_createS"+r(597)+r(1201)+r(1651)](){let t=r;Promise[t(1572)]().then(()=>{let n=t;this[n(1505)+n(928)]()})}[r(1963)+r(1365)+r(940)](t){let n=r,o={SkkoP:function(x,h,g){return e.aWGgM(x,h,g)},hcEYC:e.Pkewe,KcHYy:e[n(567)]};if(e[n(848)](e[n(1261)],e[n(1261)])){if(e.UVSam(void 0,_0x5eac1c))this[n(1897)+"rs"]={};else if(e.qFPaR(void 0,_0xf4513b))this[n(1897)+"rs"][_0x1c356c]=null;else{let x=this[n(1897)+"rs"][_0x148933];if(x)for(let h=0;e[n(1842)](h,x[n(1931)]);)e[n(1947)](x[h].fn,_0x1595ae)?x[n(1235)](h,1):++h}return this}else Promise[n(1572)]()[n(495)](()=>{let x=n,h=o.SkkoP(he,"error",{message:this[x(1556)+"rrorMess"+x(938)](t)});this.emit(o[x(695)],h);let g=_e("close",{reason:this["_formatE"+x(1147)+x(938)](t)});this[x(967)](o[x(1094)],g)})}_addWsListeners(){let t=r,n={KlUff:e.rRZOr,vPsXA:function(o,x,h){return e[D(1035)](o,x,h)},kkZhT:function(o,x){return e[D(1218)](o,x)},cnzpw:t(902),gcxze:t(1700),IUxWz:function(o,x,h){return e[t(1537)](o,x,h)},UfhcU:function(o,x,h){return e.ghYrF(o,x,h)},fKzVe:e[t(590)]};this[t(1066)][t(743)](o=>{let x=t;this[x(967)](n[x(1788)],n[x(1374)](ws,n[x(1788)],{...o,data:o.errMsg||""}))}),this._socket[t(903)](o=>{let x=t;if(n[x(703)](n[x(1541)],n.cnzpw))this.emit(n[x(1111)],n[x(522)](_e,n[x(1111)],{...o}));else return _0x4fa77a?this[x(1890)+"E"]():this[x(514)+"E"]()}),this[t(1066)].onMessage(o=>{let x=t;this[x(967)]("message",e.xtuSW(_s,e[x(1699)],{...o}))}),this[t(1066)].onError(o=>{let x=t;this[x(967)](x(1024),n[x(1540)](he,n[x(1840)],{...o,message:o[x(1616)]||""}))})}[r(1407)](t){let n=r,o={apLpZ:"error",MuYKA:function(x,h,g){return e[D(1780)](x,h,g)}};if(t instanceof Uint8Array){let x=t.buffer.slice(t[n(1337)+"et"],e.iabiX(t[n(1334)+"th"],t[n(1337)+"et"]));this[n(1066)]&&this._socket[n(1407)]({data:x,fail:h=>{let g=n;this.emit(o[g(659)],o.MuYKA(he,o[g(659)],{message:this[g(1556)+g(1147)+g(938)](h)}))}})}else this._socket&&this[n(1066)][n(1407)]({data:t,fail:x=>{let h=n;this[h(967)](o[h(659)],o.MuYKA(he,o[h(659)],{message:this["_formatE"+h(1147)+"age"](x)}))}})}[r(1700)](t,n){let o=r;this[o(1066)]&&this[o(1066)][o(1700)]({code:t,reason:n})}[r(1642)+"Listener"](t,n){let o=r;e[o(1096)](o(1283),e[o(1661)])?(_0x43db5c[_0x31a335++]=e[o(1326)](e[o(958)](_0x3d24d7,12),224),_0x1efaf3[_0x48f684++]=e[o(1073)](e[o(1532)](e[o(1378)](_0x1d90fb,6),63),128),_0x43cf2a[_0x32470d++]=e[o(1652)](63,_0x2a3ce5)|128):this.on(t,n)}[r(1012)+r(1977)+"ner"](t,n){let o=r;if(e[o(561)](e[o(1400)],e[o(1400)])){let x=0,h=0;for(let g=0;e[o(1107)](g,_0x44f04d[o(1931)]);++g)h=_0x3847db[o(1338)+"At"](g),e.EtinB(h,128)?x+=1:h<2048?x+=2:e.UQeEN(64512,h)===55296&&e[o(931)](e[o(1955)](64512,_0x5dd332[o(1338)+"At"](g+1)),56320)?(++g,x+=4):x+=3;return x}else this.off(t,n)}get[r(1913)+"te"](){let t=r;return this[t(1066)][t(1913)+"te"]}get binaryType(){let t=r;if(e[t(1898)](e.vHAkQ,t(1101)))this[t(577)][t(1180)]&&_0x51c016[t(1074)][t(1606)](_0x1288b0,[e[t(491)],..._0x5c9890]);else return this._socket.binaryType}set binaryType(t){}get url(){let t=r;return this[t(1066)][t(1583)]}get[r(1896)](){let t=r;return this[t(1066)][t(1896)]}get extensions(){return this[r(1066)].extensions}get[r(1946)+"Amount"](){let t=r;if(e[t(1672)](e.tHsPY,e[t(1568)]))return 0;_0x4428e6[_0x190b63++]=e.ciOzP(_0x34c570>>18&7,240),_0x4227eb[_0x3ccca3++]=e[t(1808)](_0x4bb096>>12,63)|128}}function da(s,t){let n=r;if(t)return new t(s[n(1583)],s.protocol);if(e.rUKwR(kt,Ye))return new fa(s[n(1583)],s[n(1896)],s.headers);if(e.rUKwR(at,Pt)&&e[n(827)](e[n(822)],typeof WebSocket)&&WebSocket)return new WebSocket(s[n(1583)],s[n(1896)+"s"])}function la(s){let t=r,n=(t(1736)+"2")[t(865)]("|"),o=0;for(;;){switch(n[o++]){case"0":if(kt&&wx[t(1688)+t(1368)])return!0;continue;case"1":if(s)return!0;continue;case"2":return!1;case"3":if(Ye&&tt[t(1688)+t(1368)])return!0;continue;case"4":if(e[t(537)](at,Pt)&&e[t(1248)](e[t(822)],typeof WebSocket)&&WebSocket)return!0;continue}break}}function bs(s,t,n){let o=-1;async function x(h){let g=D;return e[g(1603)](h,o)?Promise[g(1373)](new Error(e[g(625)])):(o=h,h===n[g(1931)]?Promise.resolve():n[h][g(1030)](s)(t,x[g(1030)](null,e[g(635)](h,1))))}x(0)}function vs(s){let t=r,n=0,o=0;for(let x=0;e[t(1544)](x,s.length);++x)o=s[t(1338)+"At"](x),e[t(1252)](o,128)?n+=1:e[t(1103)](o,2048)?n+=2:e[t(1002)](64512&o,55296)&&e[t(1785)](64512,s[t(1338)+"At"](x+1))===56320?(++x,n+=4):n+=3;return n}function Ss(s,t,n){let o=r;if(e[o(1965)](e[o(1105)],e[o(987)])){let{SeqID:x,LogID:h,service:g,LogIDNew:m,method:f}=_0x5e874b.message;this[o(717)]({SeqID:x,LogID:h,LogIDNew:m,service:g,method:f,headers:[{key:e.yvxSq,value:"1"},{key:e.VlAGh,value:e.rUKwR(m,"")},{key:e[o(1499)],value:"0"}]})}else{if(e[o(1765)](n-t,1))return"";let x="";for(let h=t;e.WVtPz(h,n);){let g=s[h++];if(g<=127)x+=String.fromCharCode(g);else if(e.EJZCX(g,192)&&e[o(1268)](g,224))x+=String[o(1855)+o(1256)](e[o(572)](e[o(1915)](31&g,6),e[o(1613)](63,s[h++])));else if(e[o(1758)](g,224)&&g<240)x+=String["fromChar"+o(1256)](e[o(1062)](e.EYgey(e.jHhpp(15,g),12)|e[o(971)](e[o(1697)](63,s[h++]),6),e.kqgAZ(63,s[h++])));else if(g>=240){let m=e[o(1664)](e.LuPBj(e[o(1163)](e[o(1533)](e[o(1808)](7,g),18),e[o(1409)](e.lFuMM(63,s[h++]),12))|e[o(971)](e[o(1928)](63,s[h++]),6),e[o(1613)](63,s[h++])),65536);x+=String["fromChar"+o(1256)](e.kSuXM(55296,e[o(1211)](m,10))),x+=String[o(1855)+"Code"](e[o(1464)](56320,e.KPANk(1023,m)))}}return x}}function ar(s,t,n){let o=r,x={IosZW:function(f,y){return e[D(1950)](f,y)},ZjgqW:o(1650)+o(1724)},h=n,g,m;for(let f=0;e[o(1055)](f,s[o(1931)]);++f)if(g=s[o(1338)+"At"](f),e[o(718)](g,128))t[n++]=g;else if(e.GjgFa(g,2048))t[n++]=e.wgKoG(g,6)|192,t[n++]=e.LqJLO(63,g)|128;else if(e.GPJVK(64512,g)===55296&&e[o(686)](e.LMqqs(64512,m=s[o(1338)+"At"](e[o(930)](f,1))),56320)){let y=e[o(1089)][o(865)]("|"),b=0;for(;;){switch(y[b++]){case"0":t[n++]=e[o(1403)](e[o(1532)](e.YLMPM(g,6),63),128);continue;case"1":++f;continue;case"2":t[n++]=e.bxoWx(e.sGUWn(63,g),128);continue;case"3":t[n++]=e[o(989)](e[o(1525)](e[o(800)](g,12),63),128);continue;case"4":g=e[o(585)](65536+e[o(1677)](1023&g,10),e[o(833)](1023,m));continue;case"5":t[n++]=e.jUXHW(g,18)|240;continue}break}}else e[o(1898)](e.PqxYC,"Uztvr")?(_0x17ae54[o(1132)+o(1213)]=void 0,x[o(1684)](_0x185bee,x.ZjgqW)):(t[n++]=e[o(1104)](g>>12,224),t[n++]=e[o(856)](e[o(1211)](g,6)&63,128),t[n++]=e[o(1844)](e.zjNBY(63,g),128));return e[o(858)](n,h)}async function Es(s){let t=r;if(e[t(1025)]==typeof s){let n=new Uint8Array(vs(s));return e[t(829)](ar,s,n,0),n}return e[t(1721)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(1839)],s[t(1337)+"et"],s.byteLength)}function ha(s){let t=r,n={eyDBK:function(o,x){return e[D(796)](o,x)}};if(t(1155)!==e[t(1071)])_0x2d3be2+=jomTpt[t(687)](_0x4fb7bb,_0x1ccb3d),_0x268fcc++;else try{return e.jdfIW(e.hrmBn,typeof s)&&(e[t(1721)](s,ArrayBuffer)||s.buffer&&e[t(1721)](s[t(1839)],ArrayBuffer))||e.JOclH(e[t(1025)],typeof s)?"":(JSON[t(1938)](s),e[t(772)])}catch{return e[t(739)](t(1491),typeof s)?t(1755)+t(663)+t(1738):""}}let ga=(s,t)=>{let n=r,o={FpTrC:function(x,h){return e.eWBsL(x,h)},alkFF:function(x,h){return e[D(873)](x,h)},wQfPD:function(x,h){return e[D(1863)](x,h)},hUGaZ:function(x,h){return e.Kjkzm(x,h)},bLDTC:function(x,h){return x+h},MHPRq:n(1027)+"3|0",QpUCI:function(x,h){return e[n(1844)](x,h)},FctHX:function(x,h){return x&h},VHaNk:function(x,h){return x>>h},HrlBO:function(x,h){return e.ciOzP(x,h)},oqiQv:function(x,h){return e.YLMPM(x,h)},ERGJA:function(x,h){return e[n(672)](x,h)},friUr:function(x,h){return e[n(1075)](x,h)},gSPoU:function(x,h){return x<<h},ruHJC:function(x,h){return x&h}};if(e[n(1246)](e[n(1600)],"oAElX"))switch(s){case e[n(1666)]:case e[n(1058)]:return{[n(1704)+s]:1,"x-tt-env":t};default:return{}}else if(_0x8afada=_0x2ee74d[n(1338)+"At"](_0x23fa27),_0x585fdb<128)_0x35596f[_0x3e7e30++]=_0x2fd37d;else if(fNxMMc[n(1813)](_0x33d6d5,2048))_0x1788d3[_0x3c0231++]=fNxMMc[n(792)](_0x50ce86>>6,192),_0x387dfb[_0x3a365e++]=fNxMMc[n(792)](fNxMMc.wQfPD(63,_0x4d5ee8),128);else if(fNxMMc[n(1020)](fNxMMc[n(1495)](64512,_0x3e52eb),55296)&&fNxMMc[n(1020)](64512&(_0x3c5833=_0x3bf4f6.charCodeAt(fNxMMc.bLDTC(_0x25b8a1,1))),56320)){let x=fNxMMc[n(1250)][n(865)]("|"),h=0;for(;;){switch(x[h++]){case"0":_0x18d6b7[_0x33e675++]=fNxMMc[n(654)](fNxMMc[n(1495)](63,_0x6193fa),128);continue;case"1":_0x59a44a[_0x43607b++]=fNxMMc[n(654)](fNxMMc[n(1521)](fNxMMc[n(575)](_0x57cb0c,12),63),128);continue;case"2":_0x80566[_0x38d2c4++]=fNxMMc[n(1535)](fNxMMc[n(1440)](_0x3c5d2b,18),240);continue;case"3":_0x5bc8d8[_0x4490c6++]=fNxMMc[n(555)](fNxMMc[n(575)](_0x4e6814,6)&63,128);continue;case"4":++_0x4d0f5f;continue;case"5":_0x2676bc=fNxMMc[n(1715)](fNxMMc[n(1796)](65536,fNxMMc[n(701)](fNxMMc.ruHJC(1023,_0x15104a),10)),1023&_0x173cba);continue}break}}else _0x576de1[_0x3974fd++]=fNxMMc[n(654)](fNxMMc[n(575)](_0x169473,12),224),_0x39887f[_0x101231++]=fNxMMc.ERGJA(fNxMMc[n(1440)](_0x361843,6)&63,128),_0x43e5eb[_0xa676d3++]=63&_0x37896a|128};class pa{constructor(t){let n=r;this[n(553)+"ount"]=t,this[n(1004)]=0}[r(917)](){let t=r,n={LVruf:function(o,x){return o||x}};if(e.kGMYk(e[t(1010)],e[t(936)]))this.count++;else{let o=this[t(1750)]["getStora"+t(637)](this._prefix),x=_0x2ad3d3[t(1938)](n[t(513)](o,"{}"));return x[_0x2a7543||_0x4bc505[this[t(1959)]]]=_0x4df021,this._qosDB["setStora"+t(637)](this[t(1288)],_0x2b0d31.stringify(x)),_0x1a9d0c||_0x4653f4[this[t(1959)]]}}[r(758)+r(595)+"nt"](){let t=r;if(e.luWtK(e.KGmzT,e.KGmzT)){let n=0,o=0,x;do x=e[t(1645)](_0x34da33,_0x2096c2),e[t(1381)](n,32)&&(o|=e[t(1304)](127&x,n)),n+=7;while(e[t(598)](128,x));return o}else return e[t(1116)](this[t(1004)],this[t(553)+t(1174)])}[r(1001)+r(1926)](t=0){let n=r;e[n(1192)](e[n(891)],e[n(1720)])?(this[n(553)+n(1174)]=t,this[n(1004)]=0):_0x517d57[n(1572)]()[n(495)](()=>{let o=n;this[o(1505)+o(928)]()})}}async function ma(s){let t=r,n={jvlFR:function(o,x){return e[D(770)](o,x)},MefcB:function(o,x){return e[D(1635)](o,x)},Zdcju:function(o,x){return o(x)},Zture:t(651)+"or",SsHFw:function(o,x){return o(x)},IJEXx:function(o,x){return e[t(664)](o,x)},gvDnO:e.HpLcY,sUiZw:function(o,x){return e.QYNcw(o,x)},KGgJm:e[t(1936)],lHHJm:e[t(1264)],ioCMm:function(o,x){return e[t(1253)](o,x)},WuznF:e.yHBff,iSpws:function(o,x){return e[t(1192)](o,x)},IKMFm:e[t(1131)],KBbdv:e[t(697)],Ykflx:function(o,x){return e.BBOKV(o,x)}};return new Promise(o=>{let x=t,h={bdgPO:function(g,m){return n[D(1449)](g,m)}};if(!at)return n[x(587)](o,n[x(1712)]);try{if(n[x(1298)](n[x(1518)],x(584))){let g=document[x(645)+x(1787)](n.lHHJm);window["frontier"+x(1213)]=m=>{let f=x;document[f(1519)][f(489)+"ild"](g),window["frontier"+f(1213)]=void 0,h.bdgPO(o,m&&m[f(824)]||"unknown "+f(1724))},g[x(728)]=x(684)+x(759),g.src=n[x(1886)](s[x(1220)](/^ws/,x(674)),n[x(1100)]);try{document[x(1519)][x(1329)+x(1804)](g)}catch{if(n[x(539)](n[x(1845)],n[x(894)]))document[x(1519)][x(489)+x(1804)](g);else{let m=_0x5f44bf[x(1064)],f=_0x18ebcc[x(592)],y=_0x5d08c7[x(1907)],b=f+_0x16c97;if(eTTLBd[x(1869)](b,m[x(1931)])){let A=new _0x5a11c2(eTTLBd.MefcB(2,b));A[x(1142)](m),_0x3c70e8[x(1064)]=A}return _0x308605.offset=b,eTTLBd[x(1869)](b,y)&&(_0x3edbce[x(1907)]=b),f}}}else eTTLBd.Zdcju(_0x238ab0,_0xa09991[x(1024)]||new _0x4b50ca(eTTLBd[x(562)],eTTLBd[x(562)])),_0x4218de()}catch{window[x(1132)+x(1213)]=void 0,n.Ykflx(o,n[x(1712)])}})}function Ke(s,t,n){let o=r;return!!s?.find(x=>x.key===t&&x[o(1884)]===n)}function xt(s,t){let n=r;return s?.[n(1442)](o=>o[n(1396)]===t)?.[n(1884)]}let xr=null;async function _a(){let s=r,t={LvvsL:function(n,o){return e.GZeaj(n,o)},ejMgB:function(n,o){return e[D(998)](n,o)}};if(s(673)===e[s(729)])_0x15b872=RVyonJ.LvvsL(_0x399171,_0x435750),_0xf1d5d4|=RVyonJ.ejMgB(127,_0x2a5fdd)<<7;else return xr||(xr=Promise[s(1572)]()[s(495)](Ae[s(1030)](Ae,e.vDjhz))),xr}class wa extends or{constructor(t,n){let o=r;super(),this[o(1671)]=t,this[o(1859)]=n,this[o(1750)]=void 0,this._initPromise=null}async[r(605)](){await this[r(533)]()}async[r(533)](){let t=r;if(!this[t(1750)]){if(this[t(1390)+"mise"])return this[t(1390)+t(1319)];try{let n=this[t(1671)],o=this._keyPath;this[t(1390)+t(1319)]=(async()=>{let x=t;if(x(1734)===e[x(1141)])return(this[x(1897)+"rs"][_0x463528]||(this._listeners[_0x18c7fe]=[]))[x(613)]({fn:_0x2ccd62,ctx:_0x232b29||this}),this;{let{openDB:h}=await e[x(1051)](_a);this[x(1750)]=await e[x(534)](h,x(1132)+"_"+n,1,{upgrade(g){let m=x;g[m(1369)+m(1496)+"e"](n,{keyPath:o})}})}})(),await this[t(1390)+t(1319)]}catch(n){console.log(n)}finally{this[t(1390)+t(1319)]=null}}}async[r(750)](t){let n=r;try{if(e[n(1136)](e.HAabq,"cVOJY")){if(RqMkLS[n(1721)](_0x549643,_0x1a52a8))return RqMkLS.kroaM(_0x463d2c,_0x365ba2);if(_0x15c314[n(1473)](_0xf2f6de))return _0x479fc6[n(750)](_0x374dee);let o=_0x36a597(_0x153e14);return o!==_0x21ae32&&(_0x58edc0.set(_0x4baa9d,o),_0x400db6.set(o,_0x26f752)),o}else return await this._init(),this._qosDB?.get(this._dbName,t)}catch(o){console.log(o)}}async set(t,n){let o=r;if(e[o(848)](e[o(1524)],e[o(1524)]))this.off(_0x2a4e07,_0x51689b);else return await this[o(533)](),this._qosDB?.[o(620)](this[o(1671)],t)}async[r(691)](t){let n=r;try{return await this[n(533)](),this._qosDB?.[n(1371)](this[n(1671)],t)}catch(o){console[n(1074)](o)}}async[r(1072)](){let t=r,n={TaelK:e[t(563)],fxrsY:"enqueue"};if(t(1621)===e[t(1217)])this[t(1238)+t(960)]?.addCount(),this.emit(t(550)+"e_timeout",n.TaelK),this["_pingLos"+t(960)]?.["checkRea"+t(595)+"nt"]()?this[t(922)+t(1945)]():this[t(1422)]();else try{return await this._init(),this._qosDB?.[t(1072)](this[t(1671)])}catch(o){e.Kjkzm(e[t(1657)],e[t(490)])?(this._messageQueue[t(613)](_0x20601e),this[t(1979)](n[t(1087)],_0x2d4d37)):console[t(1074)](o)}}async keys(){let t=r;return await this[t(533)](),this[t(1750)]?.[t(535)+"ys"](this[t(1671)])}async[r(1586)](){let t=r;return await this._init(),this[t(1750)]?.[t(1586)](this[t(1671)])}async[r(1952)](){let t=r;try{e[t(908)](e.DLycM,e.TkWsm)?RqMkLS[t(1444)](_0x5df9d2,_0x4d7d56)&&_0x58758f[t(1142)](_0xfe7068,_0x3eb132):(this[t(1750)]?.[t(1700)](),this[t(1750)]=void 0)}catch(n){console.log(n)}}get isReady(){let t=r;try{return e[t(1096)](e[t(1450)],e[t(643)])?!!this[t(1750)]:new _0x5e71ca(_0x1f3099[0]|e[t(1500)](_0x1b6c10[1],8)|e[t(1170)](_0x4a5886[2],16)|_0x364a72[3]<<24,e[t(1902)](_0x2a68da[4],e[t(1500)](_0x1b3a32[5],8))|e[t(1533)](_0x291115[6],16)|e[t(973)](_0x4e0e1a[7],24),_0x5f7a40)}catch(n){return console[t(1074)](n),!1}}}class ya{constructor(t,n){let o=r;this[o(680)]=t,this[o(1959)]=n,this[o(1750)]=localStorage}async[r(605)](){}get[r(1288)](){return r(1132)+"_"+this._DBName}async[r(750)](t){let n=r,o=this[n(1750)].getItem(this._prefix);return JSON.parse(e[n(1282)](o,"{}"))[t]}async[r(1142)](t,n){let o=r,x=this[o(1750)][o(1095)](this[o(1288)]),h=JSON[o(1938)](e[o(1536)](x,"{}"));return h[n||t[this[o(1959)]]]=t,this[o(1750)][o(1447)](this[o(1288)],JSON[o(619)+"y"](h)),n||t[this._pathKey]}async[r(691)](t){let n=r,o=this[n(1750)][n(1095)](this._prefix),x=JSON.parse(e.WzSvd(o,"{}"));return x[t]=void 0,this[n(1750)].setItem(this[n(1288)],JSON.stringify(x))}async[r(1072)](){let t=r,n={OuXQT:function(o,x){return e[D(1985)](o,x)},SkZwP:e[t(1716)],tmEfZ:t(550)+"e_success",HSDAh:function(o,x,h){return e[t(1644)](o,x,h)}};if(e[t(660)](e[t(626)],t(705)))return this[t(1750)].clear();{let o={ePljV:function(g,m){return g(m)},LNHIU:"success",spAIS:n[t(1837)],qgraG:n[t(1828)]};this[t(1152)+t(1269)](),this[t(1227)+"gTimeoutId"]=n[t(1632)](_0x321341,this[t(1422)][t(1030)](this),this[t(577)]["pingInte"+t(1679)]);let x=()=>{let g=t;o[g(704)](_0x1e09fc,o.LNHIU),this[g(1424)](o[g(1942)],x),this[g(1424)](o[g(1093)],h)},h=()=>{let g=t;n[g(606)](_0x30ca0e,g(1285)),this.off(g(550)+g(927)+"s",x),this.off(n.SkZwP,h)};this.on(n.tmEfZ,x),this.on(n[t(1828)],h),this[t(1422)]()}}async[r(709)](){let t=r;if(e[t(926)](e[t(1115)],e[t(1203)])){let n=this[t(1750)][t(1095)](this[t(1288)]),o=JSON.parse(n||"{}");return Object.keys(o)}else this[t(1750)]?.del(_0x55dd00[t(1784)+"id"])}async[r(1586)](){let t=r,n=this[t(1750)][t(1095)](this[t(1288)]),o=JSON.parse(e[t(1118)](n,"{}"));return Object.values(o)}[r(1952)](){return Promise[r(1572)]()}get isReady(){return!!this[r(1750)]}}class ba{constructor(t,n){let o=r,x={avIvH:function(h,g){return e[D(739)](h,g)},RGDCS:function(h,g){return e[D(624)](h,g)}};if(e.sFliG(e[o(1923)],e[o(1923)]))return XnKdqg[o(1972)](this[o(1502)+"ndex"],this[o(804)+"s"].length)?!0:XnKdqg[o(1576)](this[o(1793)+o(1801)+"riesCount"],this.maxRetries);this[o(680)]=t,this[o(1959)]=n,this._qosDB=Ye?tt:kt?wx:null}async[r(605)](){}get[r(1288)](){let t=r;return t(1132)+"_"+this[t(680)]}async[r(750)](t){let n=r,o=this._qosDB["getStora"+n(637)](this[n(1288)]);return JSON.parse(e[n(744)](o,"{}"))[t]}async[r(1142)](t,n){let o=r,x=this[o(1750)][o(1781)+o(637)](this._prefix),h=JSON.parse(x||"{}");return h[n||t[this._pathKey]]=t,this[o(1750)][o(1436)+o(637)](this[o(1288)],JSON[o(619)+"y"](h)),n||t[this[o(1959)]]}async[r(691)](t){let n=r,o=this._qosDB[n(1781)+n(637)](this[n(1288)]),x=JSON.parse(e[n(1912)](o,"{}"));return x[t]=void 0,this._qosDB["setStora"+n(637)](this[n(1288)],JSON[n(619)+"y"](x))}async clear(){let t=r,n={iovpA:function(o,x){return e[D(1270)](o,x)},MorkQ:function(o,x){return e[D(1551)](o,x)},TOEXD:function(o,x){return e.IBWez(o,x)},VEmlZ:function(o,x){return e[D(1280)](o,x)},zBBOP:function(o,x){return e[D(1581)](o,x)},ktGTr:function(o,x){return o<<x}};return e[t(898)]===e[t(1510)]?new _0x578f80(NNLNfd.iovpA(NNLNfd[t(760)](NNLNfd.iovpA(NNLNfd[t(1520)](_0x5180e0[4],24),_0x26ae41[5]<<16),_0x480941[6]<<8),_0x38519d[7]),NNLNfd[t(746)](NNLNfd.VEmlZ(NNLNfd[t(488)](_0x1bf539[0],24),NNLNfd[t(488)](_0x17f528[1],16))|NNLNfd[t(1516)](_0x3765c8[2],8),_0x342c20[3]),_0x4c29e9):this[t(1750)][t(884)+"rageSync"]()}async[r(709)](){let t=r,n=this._qosDB[t(1781)+t(636)+"nc"](this[t(1288)]),o=JSON[t(1938)](n||"{}");return Object[t(709)](o)}async getAll(){let t=r,n=this[t(1750)][t(1781)+"geInfoSync"](this[t(1288)]),o=JSON[t(1938)](e[t(1045)](n,"{}"));return Object[t(1049)](o)}[r(1952)](){return Promise[r(1572)]()}get[r(892)](){let t=r,n={oMQDJ:function(o,x,h){return e[D(540)](o,x,h)}};if(e[t(1860)]===e[t(847)]){let o=n[t(1007)](_0x586dea,t(1024),{message:_0x46afb2[t(1706)],code:_0x51b82d[t(1741)+t(935)],error:_0x4ad276});this[t(1618)+t(1732)+t(906)](o)}else return!!this[t(1750)]}}function Cs(s,t){let n=r;if(e[n(1164)](Ye,Ye))return new ba(s,t);if(e[n(1164)](at,Pt)&&e.KhTrd("undefined",typeof indexedDB))return new wa(s,t);if(e.HyLEq(at,Pt)&&e.jdfIW(e[n(822)],typeof localStorage))return new ya(s,t);throw new Error(e[n(1354)])}class va{constructor(){let t=r;this[t(1397)+t(1906)+"Id"]=null,this[t(1397)+"l"]=36e5,this[t(1750)]=e[t(668)](Cs,e.RbEgY,e[t(910)])}async["_interva"+r(1893)](){let t=r;e[t(818)](clearInterval,this[t(1397)+t(1906)+"Id"]),this[t(1397)+"lTimeoutId"]=setInterval(()=>{let n=t;this[n(565)+n(1362)]()},this._interval)}async openDB(){let t=r;await this[t(1750)][t(605)]()[t(495)](()=>{let n=t;this[n(1397)+n(1893)]()})}async["flushExp"+r(1362)](){let t=r;(await this[t(1750)]?.[t(1586)]()||[])[t(1195)](({timestamp:x})=>x<Date[t(1629)]())[t(1146)](x=>{let h=t;this._qosDB?.[h(691)](x[h(1784)+"id"])})}async[r(691)](t){let n=r;return this._qosDB?.[n(691)](t)}async[r(1142)](t,n){let o=r;return this._qosDB?.[o(1142)]({message_id:t,timestamp:n})}async get(t){let n=r;return this[n(1750)]?.[n(750)](t)}async[r(1952)](){let t=r;e[t(650)](clearInterval,this[t(1397)+t(1906)+"Id"]),await this[t(1750)]?.closeDB()}get[r(892)](){let t=r;return this[t(1750)]?.[t(892)]}}function cr(s){let t=r,n=!!this[t(577)][t(712)+"S"];if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e.JHlqK(Ke,s[t(1706)].headers,e.GbIPn,"2"),x=o&&Ke(s[t(1706)][t(976)],e.rBNyV,"1"),h=o&&Ke(s[t(1706)].headers,e[t(1324)],"1"),g=h?e[t(887)](xt,s[t(1706)][t(976)],e[t(690)])?.[t(865)](",")[t(1195)](Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:x,isAckCleanupMessage:h,ackMsgIds:g}}async function As(){let s=r;if(s(840)===s(845)){let{initReconnectInterval:t,maxReconnectInterval:n,reconnectIntervalGrowFactor:o}=this[s(577)],x=e[s(559)](t,_0x24b287[s(1753)](o,_0x5c2a98-1));return e[s(1309)](x,n)?n:x}else return this[s(676)+s(1408)]||(this[s(676)+s(1408)]=new va),this[s(676)+s(1408)][s(892)]||await this[s(676)+"ger"][s(605)](),this[s(676)+s(1408)]}async function Sa(s,t){let n=r,o={OhzXI:function(f,y){return f<y},ImMXO:function(f,y){return e.Kjkzm(f,y)}},{enableAutoAck:x}=this[n(577)],h=e[n(829)](Ke,s[n(1706)][n(976)],e[n(844)],"1"),g=e[n(534)](Ke,s[n(1706)][n(976)],e.yvxSq,"1"),m=cr[n(1903)](this,s);if(e[n(1140)](x,h))if(e[n(893)](e[n(1380)],e[n(1380)])){let{SeqID:f,LogID:y,service:b,LogIDNew:A,method:I}=s.message;this[n(717)]({SeqID:f,LogID:y,LogIDNew:A,service:b,method:I,headers:[{key:n(1065),value:"1"},{key:e[n(1775)],value:e[n(1421)](A,"")},{key:n(1443),value:"0"}]})}else{let f=this._listeners[_0x2c39e6];if(f)for(let y=0;dWfcil[n(1836)](y,f.length);)dWfcil.ImMXO(f[y].fn,_0x2427b1)?f[n(1235)](y,1):++y}g&&!m[n(509)]&&this[n(1618)+"hAckMess"+n(1113)](s),t()}async function Ea(s,t){let n=r,o={JNBpq:function(x,h){return e[D(1892)](x,h)},tLeGw:function(x,h){return e[D(989)](x,h)},XwaPa:function(x,h){return x+h},nEecB:function(x,h){return e[D(1677)](x,h)},LMfdn:function(x,h){return e[D(639)](x,h)}};if(e.RdQwm(e[n(797)],e[n(797)])){let x=new _0x3c4fed(o[n(633)](o[n(1310)](o.tLeGw(_0x3c16c7[o.XwaPa(_0x12d2bf,4)]<<24,o[n(956)](_0x33d9c8[o[n(1207)](_0x5b3853,5)],16)),o.nEecB(_0x4751fb[o[n(1207)](_0x430aed,6)],8)),_0x4ee911[_0x20d582+7]),o.JNBpq(o[n(1582)](o.tLeGw(_0x430a13[o[n(1207)](_0x584dcd,0)]<<24,o.nEecB(_0x35b819[o.XwaPa(_0x4220cc,1)],16)),o[n(956)](_0x59d639[_0x2a8a2b+2],8)),_0x5727ea[_0x2708bc+3]),!0);return _0x20a0c0+=8,{value:x,offset:o[n(1207)](_0x247ba2,8)}}else this[n(1979)](e[n(652)],s[n(1706)]),e.vkkFl(t)}async function Ca(s,t){let n=r,o=e[n(720)](as,await e[n(1577)](Es,s[n(1231)]));try{if(e[n(1444)](o.payload,Uint8Array)){let x=this[n(577)][n(1260)+n(1327)]instanceof Object?{force:!!this[n(577)][n(1260)+n(1327)][n(1145)],encoding:this[n(577)]["payloadE"+n(1327)][n(1894)]?this._options[n(1260)+n(1327)].encoding[n(1220)](/\s/g,"")[n(1222)+n(1934)]():""}:{force:!1,encoding:this[n(577)][n(1260)+n(1327)]?this[n(577)][n(1260)+n(1327)][n(1220)](/\s/g,"")[n(1222)+n(1934)]():""},h=o["payloadE"+n(1327)]?o[n(1260)+n(1327)][n(1220)](/\s/g,"")[n(1222)+"ase"]():"",g=e[n(830)](this[n(577)][n(1182)+n(1961)],Object)?{force:!!this[n(577)]["payloadT"+n(1961)][n(1145)],type:this[n(577)][n(1182)+n(1961)][n(728)]?this._options[n(1182)+"ype"][n(728)][n(1220)](/\s/g,"")[n(1222)+"ase"]():""}:{force:!1,type:this[n(577)][n(1182)+n(1961)]?this._options[n(1182)+n(1961)][n(1220)](/\s/g,"")[n(1222)+"ase"]():""},m=o["payloadT"+n(1961)]?o[n(1182)+n(1961)][n(1220)](/\s/g,"")[n(1222)+n(1934)]():"",f=g.force?g[n(728)]:m||g[n(728)],y=x[n(1145)]?x.encoding:h||x[n(1894)],b=[e[n(1744)],e[n(772)],e.ZkNfK,e[n(1025)]],A=["none_none",e[n(1120)]];this._options["enableTransformT"+n(1550)+"ad"]&&b.includes(f)&&(!y||A[n(1028)](y))?o[n(1398)+n(1776)]=Ss(o[n(1293)],0,o[n(1293)][n(1334)+"th"]):o[n(1398)+n(1776)]=""}else o[n(1398)+n(1776)]=""}catch(x){o[n(1398)+n(1776)]="",console.log(x)}s[n(1706)]=o,e[n(689)](t)}function Aa(s,t,n){let o=r,x={ICtfC:function(y,b){return e.zwFSQ(y,b)},ppvuG:e[o(1623)],Vnurn:function(y,b){return e[o(1433)](y,b)},qkbYy:function(y,b){return e[o(1593)](y,b)},DBHGk:function(y,b){return e[o(1388)](y,b)},VGuqO:function(y,b){return y&b},MnQEg:function(y,b){return e[o(1281)](y,b)},pJLXD:function(y,b){return e[o(1680)](y,b)}},h=e.qLbdi(n,8192),g=e[o(1376)](h,1),m=null,f=h;return function(y){let b=o;if(x.ICtfC(x.ppvuG,"ogjeT")){if(x[b(1275)](y,1)||x.qkbYy(y,g))return x[b(1088)](s,y);f+y>h&&(m=s(h),f=0);let A=t.call(m,f,f+=y);return x[b(631)](7,f)&&(f=x[b(1881)](x.pJLXD(7,f),1)),A}else _0x1da048[b(1369)+b(1496)+"e"](_0x55cda3,{keyPath:_0x48c563})}}let ka=4294967295;function Pa(s,t,n){let o=r;return e[o(1834)](RangeError,e[o(1128)](e[o(1962)](e.TCBFI(e[o(1771)],s),e[o(1777)]),e[o(1164)](t,1))+o(1778)+n)}function Da(s,t,n){let o=r;if(e[o(1309)](n,ka))throw new Error(e[o(1311)]);let x=3;for(;e[o(1116)](x,0);){if(e[o(1091)]===e[o(1299)])return this[o(1750)]?.[o(892)];{let h=e[o(1863)](255,n);e.JHlqK(fr,h,s,e[o(1962)](t,x)),n>>>=8,x--}}return e[o(790)](t,4)}function Ta(s,t){let n=r,o=0,x=t,h=e.SFgIO(t,4);for(;e[n(1846)](x,h);){let{value:g,offset:m}=e[n(1406)](ur,s,x);x=m,o=e[n(710)](o<<8,0),o+=g}return{value:o,offset:h}}function Ia(s,t,n){let o=r,x=e[o(1226)][o(865)]("|"),h=0;for(;;){switch(x[h++]){case"0":if(s[o(1931)]<40)return e[o(1214)](ar,s,t,n)+n;continue;case"1":return e.kLLfx(e[o(1922)](ar,s,t,n),n);case"2":if(t[o(1234)+"e"])return e[o(1162)](t[o(1234)+"e"](s,n),n);continue;case"3":if(t[o(1492)])return t.write(s,n)+n;continue;case"4":if(!s)return n;continue}break}}function La(s,t){let n=r,o=new B(e[n(1892)](e.EfFHB(s[e.izQwB(t,4)]<<24|e[n(706)](s[t+5],16),e[n(1549)](s[e.nlBcY(t,6)],8)),s[e[n(1075)](t,7)]),e[n(682)](e[n(672)](e[n(732)](e[n(1668)](s[e[n(1464)](t,0)],24),e[n(1081)](s[t+1],16)),s[e[n(1410)](t,2)]<<8),s[e[n(1160)](t,3)]),!0);return t+=8,{value:o,offset:e.xYGvc(t,8)}}function Na(s,t,n){let o=r;if(e[o(1898)](e[o(1295)],e[o(1295)])){let x=s.low,h=s[o(1562)];return t[n]=h>>>24,t[e[o(1962)](n,1)]=e[o(778)](e[o(1823)](h,16),255),t[e[o(685)](n,2)]=e[o(1932)](e[o(710)](h,8),255),t[e[o(1253)](n,3)]=255&h,t[e[o(1258)](n,4)]=e[o(993)](x,24),t[e[o(552)](n,5)]=e[o(783)](e.kGRNo(x,16),255),t[e.Ulnin(n,6)]=e.VvzpB(e[o(569)](x,8),255),t[e[o(930)](n,7)]=255&x,n+=8,n}else _0x3d55cc(),RqMkLS[o(1051)](_0x5a5127)}function ur(s,t){let n=r;return s[n(1254)+"8"]?{value:s[n(1254)+"8"](t),offset:t+1}:{value:e.Utgyz(255,s[t]),offset:t+1}}function fr(s,t,n){let o=r;return t[o(1459)+"t8"]?t[o(1459)+"t8"](s,n):t[n]=e[o(1697)](255,s),e[o(552)](n,1)}let Ra=function(s){return new Uint8Array(s)},Ma=e.utqCz(e[r(822)],typeof Buffer)?Buffer.allocUnsafe:e[r(588)](Aa,Ra,Uint8Array[r(1800)+"e"][r(666)]),Oa=16,dr=32;function Ba(s){let t=r;if(e[t(1739)](e[t(1029)],e[t(1029)])){if(RqMkLS[t(1435)](_0x721bbf,RqMkLS[t(1515)]))return _0x19d4fd[t(750)](_0x3596a0);if(_0x3c1145===t(1608)+t(1097))return _0x3b75a0[t(1608)+t(1097)]||_0x591d55.get(_0x2511f5);if(_0x92e76c===t(1157))return _0x21f2cd[t(1608)+t(1097)][1]?void 0:_0x15b2c2["objectSt"+t(801)](_0x239fde["objectSt"+t(1097)][0])}else{let n=0,o={};for(let x=0;e.VGLOB(x,s.length);x++)o[s[x][t(1488)+t(1202)]]=e[t(688)](vs,s[x].cursor_name),n+=e.Tsdny(14,o[s[x][t(1488)+"ame"]]);return[n,o]}}function ks(s,t,n){let o=r,x={eFleq:o(1032)+o(1237),ZlLCF:e[o(1662)],osZhx:e[o(1646)],ISvdA:function(y,b,A,I){return e[o(1102)](y,b,A,I)},CbVGH:e[o(1875)],kAork:e.sULbG,biusS:function(y,b,A,I){return e[o(829)](y,b,A,I)}},[h,g]=e.VzEfH(Ba,s),m=e[o(688)](Ma,h),f=0;return s[o(1146)](y=>{let b=o,A=("9|7|2|4|"+b(1506)+b(779))[b(865)]("|"),I=0;for(;;){switch(A[I++]){case"0":console[b(1074)](b(1237),f);continue;case"1":console[b(1074)](x[b(1605)],f);continue;case"2":console.log(x[b(1615)],f);continue;case"3":console.log(x.osZhx,f);continue;case"4":f=x[b(1841)](Da,m,f,y[b(1143)]||0);continue;case"5":f=x.ISvdA(Na,B[b(1590)+"er"](y.cursor||t),m,f);continue;case"6":console.log(x[b(1782)],f);continue;case"7":f=x[b(1841)](fr,0,m,f);continue;case"8":f=fr(g[y[b(1488)+b(1202)]],m,f);continue;case"9":console[b(1074)](x[b(1811)],y,y[b(1143)]);continue;case"10":f=x.biusS(Ia,y["cursor_n"+b(1202)],m,f);continue}break}}),{frameType:dr,headers:[{key:"cursor_f"+o(1858),value:n}],payload:m}}function za(s){let t=r,n=0,o=[];for(;e.esRWk(n,s.byteLength);){let{offset:x}=e.NlUWE(ur,s,n);n=x;let h={cursor_name:"",cursor:0,service:0},{value:g,offset:m}=e[t(802)](Ta,s,n);h[t(1143)]=g,n=m;let{value:f,offset:y}=e.aThyM(ur,s,n);n=y,h[t(1488)+t(1202)]=e.lyZUH(Ss,s,n,e.dvVde(n,f)),n+=f;let{value:b,offset:A}=La(s,n);h[t(954)]=b[t(1005)](),n=A,o[t(613)](h)}return o}function qa(){let s=r;return{frameType:dr,headers:[{key:e[s(1867)],value:s(853)+s(1301)}],payload:void 0}}class Fa{constructor(t,n,o){let x=r;if(e[x(1501)](x(538),"GWzFX"))this["_cursorN"+x(1206)]=t,this[x(1587)+x(1159)]=n,this[x(1059)+x(483)]=o,this._qosDB=Cs(this[x(1530)+x(1206)],e[x(817)]);else{let h=e[x(724)](_0x13c09d,_0x431fb0);this[x(795)]&&e[x(1289)](this[x(795)][x(1913)+"te"],this[x(1512)])&&(this[x(795)]&&this[x(795)][x(1407)](h),this[x(1979)](x(741),_0x41bfe9))}}async[r(605)](){let t=r;await this[t(1750)][t(605)]()}async[r(1848)+"rs"](){let t=r;if(!this[t(1750)].isReady)return;let n=this[t(1059)+t(483)],o=await this._qosDB[t(1586)]();switch(console[t(1074)](e.kIwpv,o),n){case e[t(657)]:return o&&o[t(1931)]?ks(o,0,this[t(1587)+t(1159)]):void 0;case e[t(503)]:return;case t(765):return o&&o.length?e.GhHKl(ks,o,0,this[t(1587)+t(1159)]):qa()}}async set(t,n,o){let x=r;return console[x(1074)](e[x(1971)],t,n,o),this[x(1750)].set({cursor_name:t,cursor:n,service:o})}async[r(886)+"rs"](t){let n=r,o=e[n(724)](za,t);for(let x of o)console[n(1074)](e[n(1199)],o),await this[n(1750)][n(1142)](x)}async[r(750)](t){let n=r;return(await this[n(1750)][n(750)](t))?.[n(954)]}async[r(1952)](){await this[r(1750)].closeDB()}["updateCu"+r(1925)+r(1498)](t){let n=r;this[n(1587)+n(1159)]=t}get[r(892)](){let t=r;return this[t(1750)][t(892)]}}let Ua=e[r(860)];async function Ps(s){let t=r;if(!this[t(577)].enableQoS)return null;let{aID:n,fpID:o,messageStrategy:x}=this[t(577)],h=s||Ua;try{return this[t(1751)+t(1612)]?s&&this[t(1751)+"anager"][t(1431)+t(1925)+t(1498)](s):this["_cursorM"+t(1612)]=new Fa(o+"_"+n+"_"+h,h,x),this["_cursorM"+t(1612)][t(892)]||await this[t(1751)+t(1612)].openDB(),this["_cursorM"+t(1612)]}catch{if(e[t(646)]==="PRjXl"){let g=this[t(1685)+t(1585)]?.[t(1865)+t(602)+"nt"]();this[t(1618)+t(918)+"ent"](_0x1f160b(t(1700),{code:1006,reason:t(1682)+g+(t(1653)+t(1229)+t(1077)+t(1901)),wasClean:!0}))}else return null}}async function Ha(s,t){let n=r,o=e[n(725)](Ke,s[n(1706)][n(976)],n(1385),"-1"),x=Ke(s[n(1706)][n(976)],e[n(878)],"1"),h=e[n(1149)](xt,s.message[n(976)],e[n(1420)]),g=e[n(818)](Number,xt(s[n(1706)].headers,e[n(953)]))||0,m=cr.call(this,s),f=e[n(859)](Ke,s[n(1706)][n(976)],e[n(607)],"2"),y=e[n(1036)](xt,s[n(1706)][n(976)],e[n(870)]),b=e[n(1619)](Number,xt(s[n(1706)][n(976)],e[n(1752)]));if(m[n(509)])return e[n(1749)](t);let A=m[n(632)+n(1249)]?await As[n(1903)](this):null;if(e[n(734)](s[n(1706)][n(1143)],0)&&x&&!o||s[n(1706)][n(1143)]>0)if(e[n(1257)]!==e[n(1135)]){if(h&&m[n(632)+"sage"]&&A)return!!!await A[n(750)](h)&&(this[n(1618)+n(581)+n(1714)](s),await A.set(h,Date[n(1629)]()+g)),e[n(1051)](t);if(f){let I=await Ps[n(1903)](this);if(!I)return this[n(1618)+n(581)+"Event"](s),t();let L=await I[n(750)](y)??-1;if(e[n(1103)](L,b))this["_dispatc"+n(581)+n(1714)](s),I.set(y,b,s[n(1706)][n(1143)]);else throw new Error("recevied"+n(1879)+n(531)+b+(n(764)+n(679)+n(1976)+"r ")+L);return e[n(1673)](t)}return this[n(1618)+"hMessage"+n(1714)](s),e[n(689)](t)}else try{e[n(534)](_0x26ed12,this,_0x5ab292,[_0x2005df,_0x318127,_0x233988])}catch(I){let L=e[n(1780)](_0x33debb,e[n(590)],{message:I[n(1706)],code:_0x3f4fe3[n(871)+"OR"],error:I});this[n(1618)+"hErrorEv"+n(906)](L)}}async function Ka(s,t){let n=r,o=cr[n(1903)](this,s);if(!o[n(632)+n(1249)])return e[n(1592)](t);let x=await As[n(1903)](this);if(o["isAckCle"+n(661)+n(938)]&&o[n(1053)+"s"][n(1931)])for(let h of o[n(1053)+"s"])await x[n(691)](h);e[n(1386)](t)}async function Ga(s,t){let n=r,o=e.UbEsJ(s[n(1706)][n(1349)+"e"],Oa),x=e.fOhqQ(s.message[n(1349)+"e"],dr);if(!o&&!x)return e[n(1386)](t);let h=e[n(1857)](xt,s[n(1706)][n(976)],n(1194)+n(1858));if(!h)return e[n(1051)](t);let g=await Ps[n(1903)](this,h);if(!g)return e[n(582)](t);if(o){let m=await g[n(1848)+"rs"](),f={frameType:m?.[n(1349)+"e"],SeqID:B.fromNumber(this[n(1353)]++),LogID:B[n(1590)+"er"](this[n(577)]["logIDGen"+n(1467)]()),service:9e3,method:5,headers:m?.[n(976)],payload:m?.payload},y=e[n(1795)](C,f);this[n(795)]&&this[n(795)].readyState&&this._ws[n(1407)](y)}if(x){let m=s[n(1706)][n(1293)];m&&g[n(886)+"rs"](m)}}let ja=async function(s,t){let n=r;this[n(1949)]=!1,clearTimeout(this[n(1575)+n(1351)+n(855)]),e.cBGJv(t)},Wa=async function(s,t){let n=r,o={eQSBs:e[n(991)]};if(!this[n(795)]||this[n(795)].readyState!==this.OPEN)return e[n(1877)](t);let{pingInterval:x}=this[n(577)];this[n(1685)+n(1585)]?.[n(1546)+n(1099)+"fig"]();for(let g=0;e[n(1544)](g,this[n(1059)+n(815)][n(1931)]);g++){let m=this[n(1059)+n(815)][g];if(this[n(795)][n(1913)+"te"]===this[n(1512)]&&e[n(848)](null,m))if(e[n(934)](e[n(1725)],"UbabE"))this[n(795)]&&this[n(795)][n(1407)](m),this[n(1059)+"Queue"][g]=null;else return{frameType:_0x5c0f3d,headers:[{key:n(1194)+n(1858),value:KuVjXo[n(1067)]}],payload:void 0};else break}this[n(1059)+"Queue"]=this[n(1059)+n(815)][n(1195)](g=>!!g),this[n(1227)+n(487)+"Id"]=e[n(1404)](setTimeout,()=>this[n(1422)](),x),this[n(1618)+n(957)+"nt"](s),this[n(1814)+"er"]&&this._ws&&(this[n(795)].binaryType=this[n(1794)+n(1961)]);let h=this[n(1685)+n(1585)]?.[n(1865)+n(602)+"nt"]();this[n(1979)](n(1119)+h+" success"),e[n(1571)](t)},Ja=async function(s,t){let n=r,o=this[n(1685)+n(1585)]?.[n(1865)+n(602)+"nt"]();this._debug(n(1119)+o),t()};class Va extends or{constructor(t){let n=r,o={GXQcn:function(m,f,y){return e[D(1579)](m,f,y)},zCuYX:e[n(590)],ZMLwa:function(m,f,y){return m(f,y)},rGAzq:function(m,f){return e.oZsfb(m,f)},TjunW:function(m,f,y){return e.aThyM(m,f,y)},nxSsJ:function(m,f){return e[n(1566)](m,f)},dkgoD:e.DOSoR,ByVNR:n(990),xANHb:function(m,f){return e[n(1358)](m,f)},gOeha:function(m,f,y){return e[n(1780)](m,f,y)},SZvoM:e[n(567)],JEyGY:e.kZgEj,ehYML:function(m,f){return e[n(1046)](m,f)},bZlpI:function(m,f,y){return m(f,y)},ujiqH:function(m,f){return e.JymzL(m,f)},gCAuI:e[n(1515)],aBsRj:e[n(1183)]};super(),this["_miniNav"+n(486)+"line"]=!0,this._isBrowser=at,this[n(1200)]=ua,this[n(1472)+"T"]=Ye,this[n(1156)+"X"]=kt,this[n(816)+"r"]=Pt,this[n(1059)+n(815)]=[],this[n(1685)+"tManager"]=null,this[n(1322)+n(1411)]=!1,this[n(1794)+n(1961)]=e[n(692)],this[n(1575)+n(1290)]=!1,this[n(1575)+n(1351)+"utId"]=null,this["_reconne"+n(586)+n(997)]=null,this[n(1227)+n(487)+"Id"]=null,this[n(1353)]=0,this[n(1949)]=!1,this[n(1792)]="",this[n(676)+n(1408)]=null,this[n(1751)+n(1612)]=null,this[n(1238)+n(960)]=null,this[n(627)+"ls"]=e[n(1953)],this[n(916)]=3,this[n(1139)+"NG"]=0,this[n(1512)]=1,this[n(1636)]=2,this[n(849)]=m=>{let f=n;try{bs(this,m,[ja,Wa,Ja])}catch(y){let b=o[f(1312)](he,o[f(1809)],{message:y.message,code:He[f(871)+"OR"],error:y});this[f(1618)+f(1732)+f(906)](b)}},this[n(549)+"ge"]=async m=>{let f=n,{pingInterval:y,pingFrequency:b}=this[f(577)];if((m[f(1231)]==="hi"&&f(591)===b||e[f(811)](f(812),b))&&(this[f(1152)+f(1269)](),this[f(967)](e[f(1080)],e[f(1158)]),this[f(1227)+f(487)+"Id"]=e[f(515)](setTimeout,this[f(1422)][f(1030)](this),y)),!e.pTBnK("hi",m[f(1231)]))try{e[f(1439)](bs,this,m,[Ca,Sa,Ka,Ga,Ha,Ea])}catch(A){let I=e[f(1272)](he,f(1024),{message:A.message,code:He[f(1741)+f(935)],error:A});this[f(1618)+f(1732)+f(906)](I)}},this[n(1511)]=m=>{let f=n,y=this._endpointManager?.[f(758)+f(1296)+"es"](),b=this[f(1685)+f(1585)]?.[f(1865)+f(602)+"nt"]();if(y&&!m[f(1706)]){let A=f(1682)+b+(f(1123)+f(1418)+"es reached");this[f(1618)+f(1732)+f(906)](o.ZMLwa(he,o[f(1809)],{message:A,code:He[f(1889)+f(1543)+"R"],error:m}));return}this[f(795)]&&o[f(1678)](this._ws[f(1913)+"te"],this[f(1512)])&&this[f(1634)+f(1273)](),this[f(1618)+"hErrorEvent"](o[f(702)](he,o[f(1809)],{message:m[f(1706)],code:He[f(727)+f(1294)],error:m}))},this._onClose=async m=>{let f=n;this["_clearTi"+f(1090)](),this["_clearPi"+f(1269)](),this[f(1372)+f(1508)+"rs"](),this[f(795)]=null,this[f(1575)+f(1290)]=!1;let y=this[f(1685)+f(1585)]?.[f(758)+f(1296)+"es"]();if(!y&&this[f(1643)+"orOnline"]()&&!this["_readyCl"+f(1411)])if(o[f(834)](o[f(767)],o[f(1307)])){let b=this[f(1685)+f(1585)]?.[f(1865)+f(602)+"nt"](),A=this[f(577)]["reconnec"+f(1262)+"ptor"](m[f(1385)],m[f(1724)]);this[f(1618)+f(918)+f(906)](_e("close",{code:1006,reason:m[f(1724)]||f(1221)+f(899)+f(1640)+f(980)+f(1181)+"ame: "+b,willReconnect:A})),A&&this[f(1575)]();return}else return _0x522f38[f(1572)]();if(o[f(1607)](1e3,m.code)&&this[f(1322)+f(1411)]){this[f(1618)+f(918)+f(906)](o.gOeha(_e,o[f(1112)],{code:1e3,reason:o.JEyGY})),this[f(1685)+"tManager"]?.[f(1546)+"pointConfig"](),this["_pingLos"+f(960)]?.[f(1001)+f(1926)]();return}if(m[f(1385)]!==1e3&&y){let b=this[f(1685)+"tManager"]?.["getCurre"+f(602)+"nt"](),A=m[f(1724)];A||(A=await o[f(1017)](ma,this[f(1792)])),A=f(1221)+f(899)+f(978)+A+(f(641)+f(1941))+b+(f(1229)+f(1077)+f(1901)),this["_dispatchCloseEv"+f(906)](o.bZlpI(_e,o[f(1112)],{code:m[f(1385)],reason:A}));let I=f(1682)+b+(f(1123)+f(1418)+f(1384)+"ed");this[f(1618)+"hErrorEv"+f(906)](he(o[f(1809)],{message:I,code:He[f(1889)+f(1543)+"R"]})),this[f(1685)+f(1585)]?.[f(1546)+f(1099)+f(1489)](),this[f(1238)+f(960)]?.[f(1001)+"nter"]();return}if(m[f(1385)]!==1e3&&!m[f(1724)]){let b=this[f(1685)+f(1585)]?.[f(1865)+"ntEndpoint"]();this[f(1618)+f(918)+f(906)](o.GXQcn(_e,o[f(1112)],{code:m[f(1385)],reason:f(1221)+f(899)+"d, unkno"+f(980)+"n, hostname: "+b})),this[f(1685)+f(1585)]?.["resetEndpointCon"+f(1489)](),this[f(1238)+f(960)]?.[f(1001)+f(1926)]();return}this[f(1618)+"hCloseEv"+f(906)](m),this[f(1685)+f(1585)]?.[f(1546)+f(1099)+f(1489)](),this[f(1238)+"sCounter"]?.[f(1001)+f(1926)]()},this[n(1471)]=null,this[n(616)]=null,this.onmessage=null,this.onopen=null,this[n(610)+n(1945)]=null,this["onReceiv"+n(1259)]=null,this[n(1633)+n(1038)+n(1022)+"ct"]=null,this._handleOnLine=this[n(722)+"nLine"][n(1030)](this),this[n(722)+n(1789)]=this[n(722)+n(1789)][n(1030)](this),this[n(1692)+n(1106)]=this["_handleP"+n(1106)][n(1030)](this),this[n(1692)+n(1414)]=this[n(1692)+"ageShow"][n(1030)](this),this._options={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(774)](1,0),service:0,logIDGenerator:c,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1412)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:"CONTINUE",env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:x,ws:h}=t,g=Array[n(1108)](x)?x:e[n(1110)](e[n(1025)],typeof x)?[x]:[];if(!g||g[n(1931)]===0)throw new Error(n(576)+n(1825)+n(1083));if(!la(h))throw new Error(e[n(1570)]);if(Object[n(773)](this._options,t),this[n(1685)+"tManager"]=new ys(g,this[n(577)][n(492)+"es"]),this["_pingLos"+n(960)]=new pa(this._options[n(1e3)+n(1565)]),this._options[n(882)+n(1223)]){if(e[n(660)](e[n(714)],e[n(618)]))return VEgxxJ[n(1908)](_0x302796,_0x100d95)&&(VEgxxJ[n(1678)](_0x42f018,VEgxxJ[n(1085)])||VEgxxJ[n(1678)](_0x47712d,VEgxxJ[n(1134)]))?!0:_0x24a45e in _0x1c9798;this[n(1949)]=!0,this._connect()}this[n(577)]["listenNe"+n(939)+n(911)]&&(this._isMiniTT||this[n(1156)+"X"]?this[n(1802)+n(1233)+n(1978)]():this[n(1814)+"er"]&&this["_initGlo"+n(1428)+n(914)]())}[r(722)+"nLine"](){let t=r;this[t(577)]["disableA"+t(1766)+"nect"]||this[t(1322)+t(1411)]||this[t(922)+t(1945)]()}[r(722)+r(1789)](){let t=r;this["_destroy"+t(1008)+"t"]();let n=e[t(707)](ir,t(1663)+"t",{message:t(1742)+t(1305)+" reconnect"});this["onStopIm"+t(1038)+t(1022)+"ct"]&&this[t(1633)+t(1038)+t(1022)+"ct"](n)}[r(919)+"balEvent"+r(914)](){let t=r;this[t(1814)+"er"]&&window[t(1642)+t(914)](e[t(1042)],this["_handleO"+t(1287)]),this[t(1814)+"er"]&&window[t(1642)+"Listener"](t(1150),this[t(722)+t(1789)]),this[t(1814)+"er"]&&window["addEvent"+t(914)](e[t(1591)],this[t(1692)+t(1106)]),this._isBrowser&&window[t(1642)+t(914)](e[t(907)],this[t(1692)+t(1414)])}[r(1441)+r(1428)+r(914)](){let t=r;this[t(1814)+"er"]&&window[t(1012)+"entListe"+t(1166)](e[t(1042)],this[t(722)+t(1287)]),this._isBrowser&&window[t(1012)+t(1977)+t(1166)](e[t(1733)],this[t(722)+t(1789)]),this[t(1814)+"er"]&&window[t(1012)+t(1977)+t(1166)](e[t(1591)],this._handlePageHide),this[t(1814)+"er"]&&window[t(1012)+"entListe"+t(1166)](e[t(907)],this[t(1692)+t(1414)])}[r(1692)+r(1106)](t){let n=r;!t[n(1522)+"d"]&&(this._isBrowser&&window[n(1012)+n(1977)+n(1166)](e.EGpMQ,this["_handleP"+n(1106)]),this._isBrowser&&window[n(1012)+n(1977)+n(1166)](e.rjfZS,this[n(1692)+"ageShow"]),this[n(1700)]()),this._isBrowser&&window[n(1012)+n(1977)+"ner"](e.iUBZs,this["_handleO"+n(1287)]),this[n(1814)+"er"]&&window[n(1012)+n(1977)+"ner"](e[n(1733)],this[n(722)+"ffLine"])}["_handleP"+r(1414)](t){let n=r;t[n(1522)+"d"]&&(this[n(1643)+"orOnline"]()&&(!this[n(795)]||e[n(1672)](this[n(795)][n(1913)+"te"],this.OPEN)||this[n(795)][n(1913)+"te"]!==this[n(1139)+"NG"])&&this["_handleO"+n(1287)](),this[n(1814)+"er"]&&window[n(1642)+n(914)](e.iUBZs,this[n(722)+n(1287)]),this[n(1814)+"er"]&&window[n(1642)+n(914)](n(1150),this[n(722)+"ffLine"]))}async[r(736)+r(1121)](t){let n=r,{fpID:o,deviceID:x,bddID:h,ttwID:g,accessKey:m,aID:f,customParams:y={},enableAutoAck:b,enableQoS:A,QoSLevel:I,env:L}=this[n(577)],V,ee,M;this[n(1814)+"er"]||this._isMiniWX||this._isMiniTT?(V=location&&e.WTRXw(e[n(1694)],location.protocol)?n(955):n(1247),ee=t.replace(/((^ws)|(^http))((?:[s]*:\/\/))/,""),M=/^wss(.*:\/\/)/[n(516)](t)?t:""+V+ee):(V=e[n(866)],ee=t.replace(/(^http)((?:[s]*:\/\/))/,""),M=/(^ws)((?:[s]*:\/\/))/[n(516)](ee)?ee:""+V+ee);let X=h?n(1504):g?e[n(1109)]:e[n(929)],re=h||g||x;if(e[n(1297)](!re,!X))throw new Error(e[n(1880)]);let Ie=e[n(1110)](e.hgQsB,typeof y)?await e[n(1129)](y):y,Xa=L?e[n(889)](ga,L[n(1528)],L.xTTEnv):{},lr=Object.assign({device_platform:e[n(1177)],version_code:e.YGreA,access_key:m,fpid:o,aid:f,[X]:re,xsack:b?1:0,xaack:b?1:0,xsqos:A?1:0,qos_level:A?I:void 0,qos_sdk_version:2,...Xa},Ie),Ya=Object[n(709)](lr).reduce((hr,gr)=>lr[gr]!==void 0?""+hr+(hr?"&":"?")+gr+"="+lr[gr]:hr,"");return M+n(1451)+Ya}async _connect(){let t=r,n={pzEsW:function(o,x){return e[D(1656)](o,x)}};if(e[t(1292)](t(1876),e[t(558)])){if(this._connectLock||this[t(1322)+t(1411)])return;this["_connect"+t(1290)]=!0;try{let o=this[t(1685)+"tManager"]?.[t(1154)+t(731)+t(1529)+t(1838)+t(716)](),{timeoutInterval:x}=this._options;if(o)if(e[t(1470)](e[t(761)],t(1826))){let g=this[t(1750)][t(1781)+t(637)](this[t(1288)]);return _0x12acc0[t(1938)](NbKfHJ[t(614)](g,"{}"))[_0x30da73]}else{let g=this[t(1685)+t(1585)]?.getCurrentEndpoint(),m=this[t(1685)+t(1585)]?.[t(843)+t(566)+t(1675)+t(1756)+"unt"](),f=this._endpointManager?.[t(1865)+t(602)+t(1015)+t(1174)]();if(m){let y=t(1682)+g+(t(1653)+", max re"+t(1077)+t(784)+t(883)+t(1806)+t(1086))+m+(t(1079)+"y"),b=e[t(748)](he,t(1024),{message:y,code:He[t(1889)+t(1543)+"R"]});this[t(1979)](y),this[t(1618)+t(1732)+t(906)](b),this[t(1792)]=await this[t(736)+t(1121)](m),this[t(1979)]("connect "+m+" "+f+t(580)),this[t(1372)+t(1508)+"rs"]()}else{let y="connect "+g+(" timeout"+t(1229)+t(1077)+t(1901));this[t(1979)](y),this[t(1618)+t(1732)+t(906)](he(e[t(590)],{message:y,code:He[t(1889)+"IES_ERROR"]}));return}}else{let g=this[t(1685)+t(1585)]?.[t(1865)+t(602)+t(507)+"ateCount"](),m=this[t(1685)+t(1585)]?.["getCurre"+t(602)+"ntTriesC"+t(1174)]();this._url=await this[t(736)+t(1121)](e[t(965)](g,"")),this[t(1979)](t(1682)+g+" "+m+t(580)),this[t(1372)+t(1508)+"rs"]()}if(this._isInit)this[t(1949)]=!1;else{let g=ir(e[t(943)],{message:e[t(803)]});this[t(610)+t(1945)]&&this[t(610)+t(1945)](g)}let h=this[t(1685)+t(1585)]?.[t(1865)+t(602)+"ntTriesCount"]()||0;e[t(1630)](h,1)&&await this[t(696)](e[t(1664)](h,1)),this[t(1979)](t(1221)+"ng url: "+this._url+(t(979)+t(1853))+this._protocols),this._ws=e[t(1404)](da,{url:this[t(1792)],protocols:[this._protocols],headers:this._options["miniProg"+t(1476)+"s"][t(1387)+t(1924)]},this._options.ws),(this[t(1814)+"er"]||this[t(816)+"r"])&&this[t(795)]&&(this[t(795)][t(658)+"pe"]=this._binaryType),this._addWsListeners(),this[t(1575)+t(1351)+t(855)]=e[t(1754)](setTimeout,this[t(1594)+"ut"].bind(this),x)}catch(o){throw this[t(1575)+t(1290)]=!1,o}}else return _0x19447b===_0xf5af0f?_0x4fab17:new _0xdeff9b(e[t(710)](e[t(1054)](e[t(1429)](e[t(1683)](_0x514783.call(_0x29d657,0),e[t(1767)](_0x580216[t(1903)](_0x36a49d,1),8)),_0x348f6d.call(_0x100fe6,2)<<16),e.dQxUl(_0x47d430[t(1903)](_0x2878e3,3),24)),0),e.DPXkn(e[t(888)](_0x1edd7f.call(_0x4d6109,4)|_0x4f8ebe[t(1903)](_0x358178,5)<<8,_0x55acb5[t(1903)](_0x1f341c,6)<<16),_0x17b1c4[t(1903)](_0xed7095,7)<<24)>>>0,!0)}[r(788)+r(1090)](){let t=r;e.dbgri(clearTimeout,this["_connect"+t(1351)+"utId"]),this[t(1575)+t(1351)+t(855)]=null}[r(1152)+r(1269)](){let t=r;e[t(1698)](clearTimeout,this[t(1227)+"gTimeoutId"]),e[t(945)](clearTimeout,this[t(1179)+t(586)+t(997)]),this["_pingPon"+t(487)+"Id"]=null,this["_reconne"+t(586)+t(997)]=null}[r(1979)](...t){let n=r;e[n(1589)]===e[n(1367)]?this["_addWsLi"+n(928)]():this[n(577)][n(1180)]&&console.log[n(1606)](console,[e[n(491)],...t])}[r(1068)+"rvalValue"](t){let n=r;if(e.zwFSQ(n(623),e[n(1175)])){let{initReconnectInterval:o,maxReconnectInterval:x,reconnectIntervalGrowFactor:h}=this[n(577)],g=e.aLGHA(o,Math[n(1753)](h,e[n(1664)](t,1)));return e[n(770)](g,x)?x:g}else _0x5733d5=_0x3763b1&&e[n(739)](e[n(1694)],_0x4780c9.protocol)?n(955):n(1247),_0x3340e0=_0x2126a2[n(1220)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),_0x3de7b3=/^wss(.*:\/\/)/.test(_0xd9ba0d)?_0x453177:""+_0x4ad9f5+_0x5d4658}_ping(){let t=r;if(this[t(795)]&&e[t(885)](this[t(795)][t(1913)+"te"],this[t(1139)+"NG"])){this[t(1152)+"ngTimer"](),this["_pingPon"+t(487)+"Id"]=e.fHebm(setTimeout,this[t(1422)].bind(this),this[t(577)][t(872)+"rval"]);return}if(!this[t(795)]||e[t(1835)](this[t(795)][t(1913)+"te"],this[t(1512)]))return void this[t(922)+"econnect"]();this._ws&&this._ws[t(1407)]("hi"),this[t(1179)+t(586)+t(997)]=e[t(719)](setTimeout,this["_handleR"+t(1945)+t(681)][t(1030)](this),this[t(577)][t(1763)+t(1631)+t(1225)])}[r(922)+r(1945)+r(681)](){let t=r;this[t(1238)+"sCounter"]?.addCount(),this[t(967)](t(550)+t(1888)+"t",e.dkHLr),this[t(1238)+"sCounter"]?.["checkRea"+t(595)+"nt"]()?this["_handleR"+t(1945)]():this[t(1422)]()}[r(1643)+"orOnline"](){let t=r;return this._isMiniTT||this[t(1156)+"X"]?this["_miniNav"+t(486)+t(1624)]:(this._isBrowser||this._isWorker)&&this[t(577)]["listenNetworkCha"+t(911)]?navigator[t(1350)]:!0}["_handleR"+r(1945)](){let t=r;!this[t(1643)+t(570)]()||this[t(1322)+"osed"]||(this["_endpoin"+t(1585)]?.["resetEndpointCon"+t(1489)](),this[t(1238)+t(960)]?.[t(1001)+t(1926)](),this[t(795)]?this["_disconn"+t(1273)](1001,e.NgdRZ,!0):this._connect())}["_onPageN"+r(1233)+r(1978)](){let t=r;if(e.fjGEi===e.fjGEi)this[t(1472)+"T"]?tt[t(1620)+t(820)+t(542)](({isConnected:n})=>{let o=t;this[o(1255)+o(486)+o(1624)]=n,n?this["_handleO"+o(1287)]():this["_handleO"+o(1789)]()}):this[t(1156)+"X"]&&wx["onNetwor"+t(820)+t(542)](({isConnected:n})=>{let o=t;this[o(1255)+o(486)+o(1624)]=n,n?this[o(722)+o(1287)]():this[o(722)+o(1789)]()});else return this[t(1618)+t(581)+t(1714)](_0x45c265),_0x3fd81c()}_wait(t){let n={wAmEX:function(o,x,h){return o(x,h)}};return new Promise(o=>{let x=D;n[x(1914)](setTimeout,o,this[x(1068)+x(1383)+"e"](t))})}[r(1634)+r(1273)](t=1e3,n="",o=!1){let x=r;this._ws&&this[x(512)+x(1008)+"t"](t,n,o)}[r(1594)+"ut"](){let t=r,n=this[t(1685)+t(1585)]?.getCurrentEndpoint();this[t(1979)](t(1682)+n+t(1653)),this[t(1634)+"ect"](1001,e[t(1375)],!0)}[r(717)](t){let n=r,o=e[n(1415)](sr,t);this[n(795)]&&e[n(1584)](this[n(795)].readyState,this[n(1512)])&&(this[n(795)]&&this[n(795)][n(1407)](o),this._debug(e.RfLGc,t))}[r(1372)+r(1508)+"rs"](){let t=r,n=e[t(1391)][t(865)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(795)][t(1012)+t(1977)+t(1166)](e[t(590)],this[t(1511)]);continue;case"1":this[t(795)]["removeEventListe"+t(1166)](t(1706),this._onMessage);continue;case"2":if(!this[t(795)])return;continue;case"3":this._ws[t(1012)+t(1977)+t(1166)]("open",this[t(849)]);continue;case"4":this[t(795)][t(1012)+"entListe"+t(1166)](e.DltZa,this[t(1455)]);continue}break}}["_addWsLi"+r(928)](){let t=r,n={mBoHC:function(o,x){return e[D(1969)](o,x)},jGasY:function(o,x){return e[D(1343)](o,x)},sagoU:e[t(1515)],byAIp:e[t(1759)],oyCPx:function(o,x){return e[t(942)](o,x)},BJCbu:t(1157),iAzAi:function(o,x){return e[t(1722)](o,x)}};if(e[t(1984)](t(1300),e[t(1933)])){let o=(t(964)+"3")[t(865)]("|"),x=0;for(;;){switch(o[x++]){case"0":this[t(795)][t(1642)+t(914)](e.rRZOr,this[t(849)]);continue;case"1":if(!this[t(795)])return;continue;case"2":this[t(795)][t(1642)+"Listener"](t(1700),this[t(1455)]);continue;case"3":this[t(795)]["addEvent"+t(914)]("error",this[t(1511)]);continue;case"4":this[t(795)][t(1642)+t(914)](e[t(1699)],this[t(549)+"ge"]);continue}break}}else{if(jXdcsn.mBoHC(_0x306576,_0x12214b)){if(jXdcsn[t(1597)](_0x41715c,jXdcsn.sagoU))return _0x553e0e.get(_0x24f74e);if(_0x34e979===jXdcsn.byAIp)return _0x2e0dea[t(1608)+t(1097)]||_0x4d0d65[t(750)](_0x509e17);if(jXdcsn[t(1303)](_0x55b82d,jXdcsn.BJCbu))return _0x3898d2[t(1608)+"oreNames"][1]?void 0:_0xad09f1[t(1608)+"ore"](_0x40357f[t(1608)+t(1097)][0])}return jXdcsn[t(1266)](_0x4f5891,_0x4f6b92[_0x411e04])}}[r(754)+r(776)](t=1e3,n=""){let o=r;try{if(e[o(519)]===o(1276))this[o(795)]&&this[o(795)][o(1700)](t,n);else return o(1132)+"_"+this[o(680)]}catch{}}["_destroy"+r(1008)+"t"](t=1e3,n="",o=!1){let x=r;if(this["_clearPi"+x(1269)](),this[x(788)+x(1090)](),this["_removeW"+x(1508)+"rs"](),this[x(754)+x(776)](1e3,n),this[x(1575)+x(1290)]=!1,o&&this[x(1643)+x(570)]()&&!this[x(1322)+x(1411)]){if(this["_endpoin"+x(1585)]?.[x(758)+x(1296)+"es"]()){let g=this[x(1685)+x(1585)]?.[x(1865)+x(602)+"nt"]();this[x(1618)+x(918)+"ent"](_e(e[x(567)],{code:1006,reason:x(1682)+g+(x(1653)+x(1229)+x(1077)+x(1901)),wasClean:!0}))}else{let g=this[x(577)][x(1663)+x(1262)+"ptor"](t,n);this[x(1618)+x(918)+x(906)](e.olNtd(_e,e[x(567)],{code:t,reason:n,wasClean:!0,willReconnect:g})),g&&this[x(1575)]()}return}this["_navigat"+x(570)]()||this[x(1322)+"osed"]?this[x(1618)+x(918)+x(906)](e[x(1980)](_e,e[x(567)],{code:t,reason:e[x(505)]})):this["_dispatchCloseEv"+x(906)](_e(e[x(567)],{code:1006,reason:e.sIzWw})),this._ws=null,this._endpointManager?.[x(1546)+x(1099)+x(1489)](),this[x(1238)+x(960)]?.["resetCou"+x(1926)]()}[r(1618)+r(957)+"nt"](t){let n=r;this[n(967)](e[n(1687)],t),this[n(1070)]&&this[n(1070)](t)}[r(1618)+r(581)+"Event"](t){let n=r;this[n(967)](e[n(1699)],t),this[n(1356)+"e"]&&this[n(1356)+"e"](t)}[r(1618)+r(630)+"ageEvent"](t){let n=r;this.emit(e[n(1082)],t),this[n(1165)+n(1259)]&&this[n(1165)+n(1259)](t)}["_dispatc"+r(1732)+r(906)](t){let n=r;this[n(967)](e[n(590)],t),this.onerror&&this[n(616)](t)}["_dispatchCloseEv"+r(906)](t){let n=r;this.emit(e.DltZa,t),this[n(1471)]&&this[n(1471)](t)}get[r(658)+"pe"](){let t=r;return this._ws?this._ws[t(658)+"pe"]:this["_binaryT"+t(1961)]}set[r(658)+"pe"](t){let n=r;this[n(1794)+n(1961)]=t,this._ws&&(this._ws[n(658)+"pe"]=t)}get[r(1975)+"nt"](){let t=r;return this[t(1685)+t(1585)]?.[t(1865)+t(602)+"ntTriesC"+t(1174)]()||0}get["buffered"+r(768)](){let t=r,n=this["_message"+t(815)].reduce((o,x)=>(o+=x&&x.byteLength||0,o),0);return e[t(1128)](n,this[t(795)]?this._ws[t(1946)+t(768)]:0)}get[r(604)+"ns"](){let t=r;return this._ws?this._ws[t(604)+"ns"]:""}get[r(1896)](){let t=r;return this._ws?this[t(795)][t(1896)]:""}get[r(1913)+"te"](){let t=r;return this[t(795)]?this[t(795)].readyState:this._options[t(882)+t(1223)]?this[t(1139)+"NG"]:this.CLOSED}get url(){let t=r;return this[t(795)]?this[t(795)][t(1583)]:this[t(1792)]}[r(1700)](t=1e3,n){let o=r,x=(o(1393)+o(1493)).split("|"),h=0;for(;;){switch(x[h++]){case"0":this[o(1152)+o(1269)]();continue;case"1":this[o(512)+"WebSocket"](t,n);continue;case"2":this[o(1322)+o(1411)]=!0;continue;case"3":this[o(788)+o(1090)]();continue;case"4":if(e[o(1501)](this[o(795)][o(1913)+"te"],this[o(916)])||e[o(1133)](this._ws[o(1913)+"te"],this[o(1636)]))return void this._debug(e.VBtjE);continue;case"5":this[o(1441)+o(1428)+o(914)]();continue;case"6":this[o(676)+o(1408)]?.[o(1952)]();continue;case"7":if(!this[o(795)])return void this[o(1979)](e[o(737)]);continue}break}}async[r(1407)](t,n){let o=r,x={tcTwL:function(M,X){return e[D(786)](M,X)},TUTBT:function(M,X){return e.LMWoc(M,X)},suZOe:function(M,X){return e[D(1526)](M,X)},lcZHX:function(M,X){return e.chTJD(M,X)},wZIle:function(M,X){return e.Gkqhy(M,X)}};if(t==null)throw new Error(e[o(1509)]);e.DVhxY==typeof t&&(t=JSON[o(619)+"y"](t)),e.nupSJ("string",typeof t)&&!e[o(568)](t,ArrayBuffer)&&!(t[o(1839)]&&e[o(1969)](t.buffer,ArrayBuffer))&&(t=JSON[o(619)+"y"](t));let h=await Es(t),g=e.DRCfX(ha,t),{method:m=0,service:f=this._options[o(1143)],logID:y=this[o(577)][o(1987)+"erator"](),headers:b=this[o(577)][o(976)],payloadEncoding:A=this[o(577)][o(1260)+o(1327)],payloadType:I=this[o(577)][o(1182)+o(1961)],logIDNew:L=this[o(577)][o(1050)+o(715)][o(1041)+o(1243)+"teLogIDNew"]?e.pHkeD(a,this[o(577)][o(1050)+o(715)][o(1772)]):""}=n||{};if(!f)throw new Error(e[o(1560)]);let V={SeqID:B[o(1590)+"er"](this[o(1353)]++),LogID:B[o(1590)+"er"](y),service:f,method:m,headers:b,payloadEncoding:e[o(1614)](A,Object)?A[o(1894)]?A[o(1894)]:"":A,payloadType:e.yCJYw(I,Object)?I[o(728)]?I.type:g:I||g,payload:h,LogIDNew:L},ee=sr(V);if(this[o(795)]&&this[o(795)][o(1913)+"te"]===this[o(1512)])this[o(795)]&&this[o(795)][o(1407)](ee),this._debug(e.TeUmZ,V);else if(e.FdguP(this[o(1059)+o(815)].length,this[o(577)][o(1660)+"geQueueL"+o(1469)]))if(e[o(1267)]===o(1052))this[o(1059)+o(815)].push(ee),this._debug(e[o(875)],V);else return function(M,...X){let re=o,Ie=_0x67a676.call(gjOsPl[re(1347)](_0x130b92,this),M,...X);return _0x108056[re(1142)](Ie,M[re(874)]?M[re(874)]():[M]),gjOsPl.tcTwL(_0x5ac00a,Ie)};else{if(e[o(1566)](e[o(1937)],e[o(1937)]))return _0x936f32[o(895)](_0x6a0d66)||(_0x53655e=_0x5a57c9.fromNumber(_0x25ed7a)),gjOsPl[o(981)](this[o(949)],_0x591722[o(949)])&&gjOsPl[o(1485)](gjOsPl[o(1557)](this[o(1562)],31),1)&&gjOsPl[o(669)](gjOsPl[o(1557)](_0x2dc76c.high,31),1)?!1:gjOsPl[o(1485)](this[o(1562)],_0xdb99f0[o(1562)])&&gjOsPl[o(1485)](this[o(1302)],_0x24246c[o(1302)]);this["_message"+o(815)].shift(),this[o(1059)+o(815)][o(613)](ee)}return{seqID:this[o(1353)],logID:y,logIDNew:L}}async reconnect(t){let n=r,{url:o}=t||{},x=Array[n(1108)](o)?o:e[n(982)](n(1491),typeof o)?[o]:[];t&&Object[n(773)](this._options,t),x&&x[n(1931)]?this[n(1685)+n(1585)]=new ys(x,this[n(577)][n(492)+"es"]):this[n(1685)+"tManager"]?.[n(1546)+n(1099)+n(1489)](),this[n(1238)+n(960)]?.["resetCou"+n(1926)](this._options[n(1e3)+n(1565)]),this[n(1322)+n(1411)]=!1,this[n(795)]&&this[n(795)][n(1913)+"te"]!==this[n(916)]?this[n(1634)+"ect"](1e3,e[n(733)],!0):(this[n(1949)]=!0,this[n(1575)]())}async[r(1023)](){let t=r;if(!this["_connect"+t(1290)]){let n=e[t(1761)].split("|"),o=0;for(;;){switch(n[o++]){case"0":this["_readyCl"+t(1411)]=!1;continue;case"1":this[t(1575)]();continue;case"2":this[t(1949)]=!0;continue;case"3":this["_endpoin"+t(1585)]?.[t(1546)+"pointCon"+t(1489)]();continue;case"4":this[t(1238)+t(960)]?.["resetCou"+t(1926)]();continue}break}}}[r(1642)+"Listener"](t,n){let o=r;if(e[o(1246)](e[o(721)],e[o(721)]))return!!this._qosDB;this.on(t,n)}dispatchEvent(t){let n=r;if(n(1647)!==e[n(1043)]){let{type:o}=t;this[n(967)](o,t)}else{this[n(1152)+n(1269)](),this[n(1227)+n(487)+"Id"]=_0x1b78d9(this._ping[n(1030)](this),this._options[n(872)+"rval"]);return}}[r(1012)+"entListe"+r(1166)](t,n){this.off(t,n)}pingOnce(){let t={bSlHn:function(n,o){return n||o}};return new Promise((n,o)=>{let x=D,h={BQOWu:e[x(1716)],CmnOk:function(g,m){return e[x(1577)](g,m)},oldcs:x(550)+x(927)+"s"};if(e[x(1366)](e[x(1344)],e[x(1342)])){this["_clearPi"+x(1269)](),this[x(1227)+x(487)+"Id"]=setTimeout(this[x(1422)][x(1030)](this),this[x(577)]["pingInte"+x(1679)]);let g=()=>{let f=x;n(f(1658)),this[f(1424)]("ping_once_success",g),this.off(h[f(787)],m)},m=()=>{let f=x;h[f(1306)](o,f(1285)),this[f(1424)](h[f(1033)],g),this[f(1424)](h[f(787)],m)};this.on(e[x(1080)],g),this.on(x(550)+x(1888)+"t",m),this[x(1422)]()}else{let g=this[x(1750)][x(1095)](this._prefix),m=_0x3ce6a8[x(1938)](Aobdgq[x(1348)](g,"{}"));return _0x3a4965[x(709)](m)}})}}})(),Z[S(823)+"oseEvent"]=$[S(823)+"oseEvent"],Z[S(1564)+"rorEvent"]=$[S(1564)+S(615)],Z[S(1779)+"e"]=$.ErrorCode,Z[S(1714)]=$[S(1714)],Z.FWS=$[S(1352)],Z[S(766)+S(1740)+S(493)]=$[S(766)+"MessageE"+S(493)],Z.MessageEvent=$[S(1740)+S(493)],Z[S(838)+"t"]=$[S(838)+"t"],Z[S(1986)+S(1340)]=$[S(1986)+"tEvent"],Z[S(1639)+S(1240)]=$[S(1639)+S(1240)],Z[S(826)+S(615)]=$[S(826)+S(615)],Z[S(1360)+S(1011)+"nt"]=$[S(1360)+S(1011)+"nt"],Z.createOpenEvent=$[S(1799)+S(1770)],Z[S(1709)+S(1919)+S(493)]=$[S(1709)+S(1919)+S(493)],Z[S(1807)+"rame"]=$[S(1807)+S(485)],Z["encodeFr"+S(1202)]=$[S(1827)+S(1202)];for(kn in $)[S(823)+S(1240),S(1564)+S(615),S(1779)+"e",S(1714),S(1352),S(766)+S(1740)+"vent",S(1740)+S(493),S(838)+"t",S(1986)+"tEvent","createCl"+S(1240),S(826)+"rorEvent",S(1360)+"ssageEvent",S(1799)+S(1770),"createRe"+S(1919)+S(493),S(1807)+S(485),S(1827)+S(1202)][S(1935)](kn)===-1&&(Z[kn]=$[kn]);var kn;Object["definePr"+S(775)](Z,"__esModule",{value:!0})});var Be=ce((Wl,Ni)=>{"use strict";var Ii=["nodebuffer","arraybuffer","fragments"],Li=typeof Blob<"u";Li&&Ii.push("blob");Ni.exports={BINARY_TYPES:Ii,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Li,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Ft=ce((Jl,Rn)=>{"use strict";var{EMPTY_BUFFER:Vx}=Be(),kr=Buffer[Symbol.species];function Xx(r,e){if(r.length===0)return Vx;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let c=0;c<r.length;c++){let u=r[c];i.set(u,a),a+=u.length}return a<e?new kr(i.buffer,i.byteOffset,a):i}function Ri(r,e,i,a,c){for(let u=0;u<c;u++)i[a+u]=r[u]^e[u&3]}function Mi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function Yx(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 kr(r):ArrayBuffer.isView(r)?e=new kr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),Pr.readOnly=!1),e}Rn.exports={concat:Xx,mask:Ri,toArrayBuffer:Yx,toBuffer:Pr,unmask:Mi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=Y("bufferutil");Rn.exports.mask=function(e,i,a,c,u){u<48?Ri(e,i,a,c,u):r.mask(e,i,a,c,u)},Rn.exports.unmask=function(e,i){e.length<32?Mi(e,i):r.unmask(e,i)}}catch{}});var zi=ce((Vl,Bi)=>{"use strict";var Oi=Symbol("kDone"),Dr=Symbol("kRun"),Tr=class{constructor(e){this[Oi]=()=>{this.pending--,this[Dr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Dr]()}[Dr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Oi])}}};Bi.exports=Tr});var _t=ce((Xl,Hi)=>{"use strict";var Ut=Y("zlib"),qi=Ft(),$x=zi(),{kStatusCode:Fi}=Be(),Zx=Buffer[Symbol.species],Qx=Buffer.from([0,0,255,255]),On=Symbol("permessage-deflate"),ze=Symbol("total-length"),pt=Symbol("callback"),We=Symbol("buffers"),mt=Symbol("error"),Mn,Ir=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,!Mn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Mn=new $x(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[pt];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(c=>!(i.serverNoContextTakeover===!1&&c.server_no_context_takeover||c.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>c.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!c.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 c=i[a];if(c.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(c=c[0],a==="client_max_window_bits"){if(c!==!0){let u=+c;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${c}`);c=u}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${c}`)}else if(a==="server_max_window_bits"){let u=+c;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${c}`);c=u}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(c!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${c}`)}else throw new Error(`Unknown parameter "${a}"`);i[a]=c})}),e}decompress(e,i,a){Mn.add(c=>{this._decompress(e,i,(u,d)=>{c(),a(u,d)})})}compress(e,i,a){Mn.add(c=>{this._compress(e,i,(u,d)=>{c(),a(u,d)})})}_decompress(e,i,a){let c=this._isServer?"client":"server";if(!this._inflate){let u=`${c}_max_window_bits`,d=typeof this.params[u]!="number"?Ut.Z_DEFAULT_WINDOWBITS:this.params[u];this._inflate=Ut.createInflateRaw({...this._options.zlibInflateOptions,windowBits:d}),this._inflate[On]=this,this._inflate[ze]=0,this._inflate[We]=[],this._inflate.on("error",tc),this._inflate.on("data",Ui)}this._inflate[pt]=a,this._inflate.write(e),i&&this._inflate.write(Qx),this._inflate.flush(()=>{let u=this._inflate[mt];if(u){this._inflate.close(),this._inflate=null,a(u);return}let d=qi.concat(this._inflate[We],this._inflate[ze]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ze]=0,this._inflate[We]=[],i&&this.params[`${c}_no_context_takeover`]&&this._inflate.reset()),a(null,d)})}_compress(e,i,a){let c=this._isServer?"server":"client";if(!this._deflate){let u=`${c}_max_window_bits`,d=typeof this.params[u]!="number"?Ut.Z_DEFAULT_WINDOWBITS:this.params[u];this._deflate=Ut.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:d}),this._deflate[ze]=0,this._deflate[We]=[],this._deflate.on("data",ec)}this._deflate[pt]=a,this._deflate.write(e),this._deflate.flush(Ut.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let u=qi.concat(this._deflate[We],this._deflate[ze]);i&&(u=new Zx(u.buffer,u.byteOffset,u.length-4)),this._deflate[pt]=null,this._deflate[ze]=0,this._deflate[We]=[],i&&this.params[`${c}_no_context_takeover`]&&this._deflate.reset(),a(null,u)})}};Hi.exports=Ir;function ec(r){this[We].push(r),this[ze]+=r.length}function Ui(r){if(this[ze]+=r.length,this[On]._maxPayload<1||this[ze]<=this[On]._maxPayload){this[We].push(r);return}this[mt]=new RangeError("Max payload size exceeded"),this[mt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[mt][Fi]=1009,this.removeListener("data",Ui),this.reset()}function tc(r){if(this[On]._inflate=null,this[mt]){this[pt](this[mt]);return}r[Fi]=1007,this[pt](r)}});var wt=ce((Yl,Bn)=>{"use strict";var{isUtf8:Ki}=Y("buffer"),{hasBlob:nc}=Be(),rc=[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 sc(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Lr(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 ic(r){return nc&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}Bn.exports={isBlob:ic,isValidStatusCode:sc,isValidUTF8:Lr,tokenChars:rc};if(Ki)Bn.exports.isValidUTF8=function(r){return r.length<24?Lr(r):Ki(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=Y("utf-8-validate");Bn.exports.isValidUTF8=function(e){return e.length<32?Lr(e):r(e)}}catch{}});var Br=ce(($l,Yi)=>{"use strict";var{Writable:oc}=Y("stream"),Gi=_t(),{BINARY_TYPES:ac,EMPTY_BUFFER:ji,kStatusCode:xc,kWebSocket:cc}=Be(),{concat:Nr,toArrayBuffer:uc,unmask:fc}=Ft(),{isValidStatusCode:dc,isValidUTF8:Wi}=wt(),zn=Buffer[Symbol.species],ge=0,Ji=1,Vi=2,Xi=3,Rr=4,Mr=5,qn=6,Or=class extends oc{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||ac[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[cc]=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=ge}_write(e,i,a){if(this._opcode===8&&this._state==ge)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 zn(a.buffer,a.byteOffset+e,a.length-e),new zn(a.buffer,a.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let a=this._buffers[0],c=i.length-e;e>=a.length?i.set(this._buffers.shift(),c):(i.set(new Uint8Array(a.buffer,a.byteOffset,e),c),this._buffers[0]=new zn(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 ge:this.getInfo(e);break;case Ji:this.getPayloadLength16(e);break;case Vi:this.getPayloadLength64(e);break;case Xi:this.getMask();break;case Rr:this.getData(e);break;case Mr:case qn: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 c=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(c);return}let a=(i[0]&64)===64;if(a&&!this._extensions[Gi.extensionName]){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(this._fin=(i[0]&128)===128,this._opcode=i[0]&15,this._payloadLength=i[1]&127,this._opcode===0){if(a){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(!this._fragmented){let c=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let c=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let c=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(c);return}if(a){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let c=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(c);return}}else{let c=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(i[1]&128)===128,this._isServer){if(!this._masked){let c=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(c);return}}else if(this._masked){let c=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(c);return}this._payloadLength===126?this._state=Ji:this._payloadLength===127?this._state=Vi: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 c=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(c);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=Xi:this._state=Rr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Rr}getData(e){let i=ji;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&&fc(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[Gi.extensionName].decompress(e,this._fin,(c,u)=>{if(c)return i(c);if(u.length){if(this._messageLength+=u.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let d=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(d);return}this._fragments.push(u)}this.dataMessage(i),this._state===ge&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=ge;return}let i=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let c;this._binaryType==="nodebuffer"?c=Nr(a,i):this._binaryType==="arraybuffer"?c=uc(Nr(a,i)):this._binaryType==="blob"?c=new Blob(a):c=a,this._allowSynchronousEvents?(this.emit("message",c,!0),this._state=ge):(this._state=qn,setImmediate(()=>{this.emit("message",c,!0),this._state=ge,this.startLoop(e)}))}else{let c=Nr(a,i);if(!this._skipUTF8Validation&&!Wi(c)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(u);return}this._state===Mr||this._allowSynchronousEvents?(this.emit("message",c,!1),this._state=ge):(this._state=qn,setImmediate(()=>{this.emit("message",c,!1),this._state=ge,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,ji),this.end();else{let a=e.readUInt16BE(0);if(!dc(a)){let u=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(u);return}let c=new zn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Wi(c)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(u);return}this._loop=!1,this.emit("conclude",a,c),this.end()}this._state=ge;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=ge):(this._state=qn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=ge,this.startLoop(i)}))}createError(e,i,a,c,u){this._loop=!1,this._errored=!0;let d=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(d,this.createError),d.code=u,d[xc]=c,d}};Yi.exports=Or});var Fr=ce((Ql,Qi)=>{"use strict";var{Duplex:Zl}=Y("stream"),{randomFillSync:lc}=Y("crypto"),$i=_t(),{EMPTY_BUFFER:hc,kWebSocket:gc,NOOP:pc}=Be(),{isBlob:yt,isValidStatusCode:mc}=wt(),{mask:Zi,toBuffer:Qe}=Ft(),pe=Symbol("kByteLength"),_c=Buffer.alloc(4),Fn=8*1024,et,bt=Fn,ye=0,wc=1,yc=2,zr=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=ye,this.onerror=pc,this[gc]=void 0}static frame(e,i){let a,c=!1,u=2,d=!1;i.mask&&(a=i.maskBuffer||_c,i.generateMask?i.generateMask(a):(bt===Fn&&(et===void 0&&(et=Buffer.alloc(Fn)),lc(et,0,Fn),bt=0),a[0]=et[bt++],a[1]=et[bt++],a[2]=et[bt++],a[3]=et[bt++]),d=(a[0]|a[1]|a[2]|a[3])===0,u=6);let l;typeof e=="string"?(!i.mask||d)&&i[pe]!==void 0?l=i[pe]:(e=Buffer.from(e),l=e.length):(l=e.length,c=i.mask&&i.readOnly&&!d);let p=l;l>=65536?(u+=8,p=127):l>125&&(u+=2,p=126);let _=Buffer.allocUnsafe(c?l+u:u);return _[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(_[0]|=64),_[1]=p,p===126?_.writeUInt16BE(l,2):p===127&&(_[2]=_[3]=0,_.writeUIntBE(l,4,6)),i.mask?(_[1]|=128,_[u-4]=a[0],_[u-3]=a[1],_[u-2]=a[2],_[u-1]=a[3],d?[_,e]:c?(Zi(e,a,_,u,l),[_]):(Zi(e,a,e,0,l),[_,e])):[_,e]}close(e,i,a,c){let u;if(e===void 0)u=hc;else{if(typeof e!="number"||!mc(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)u=Buffer.allocUnsafe(2),u.writeUInt16BE(e,0);else{let l=Buffer.byteLength(i);if(l>123)throw new RangeError("The message must not be greater than 123 bytes");u=Buffer.allocUnsafe(2+l),u.writeUInt16BE(e,0),typeof i=="string"?u.write(i,2):u.set(i,2)}}let d={[pe]:u.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ye?this.enqueue([this.dispatch,u,!1,d,c]):this.sendFrame(r.frame(u,d),c)}ping(e,i,a){let c,u;if(typeof e=="string"?(c=Buffer.byteLength(e),u=!1):yt(e)?(c=e.size,u=!1):(e=Qe(e),c=e.length,u=Qe.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[pe]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:u,rsv1:!1};yt(e)?this._state!==ye?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==ye?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}pong(e,i,a){let c,u;if(typeof e=="string"?(c=Buffer.byteLength(e),u=!1):yt(e)?(c=e.size,u=!1):(e=Qe(e),c=e.length,u=Qe.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[pe]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:u,rsv1:!1};yt(e)?this._state!==ye?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==ye?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}send(e,i,a){let c=this._extensions[$i.extensionName],u=i.binary?2:1,d=i.compress,l,p;typeof e=="string"?(l=Buffer.byteLength(e),p=!1):yt(e)?(l=e.size,p=!1):(e=Qe(e),l=e.length,p=Qe.readOnly),this._firstFragment?(this._firstFragment=!1,d&&c&&c.params[c._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=l>=c._threshold),this._compress=d):(d=!1,u=0),i.fin&&(this._firstFragment=!0);let _={[pe]:l,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:u,readOnly:p,rsv1:d};yt(e)?this._state!==ye?this.enqueue([this.getBlobData,e,this._compress,_,a]):this.getBlobData(e,this._compress,_,a):this._state!==ye?this.enqueue([this.dispatch,e,this._compress,_,a]):this.dispatch(e,this._compress,_,a)}getBlobData(e,i,a,c){this._bufferedBytes+=a[pe],this._state=yc,e.arrayBuffer().then(u=>{if(this._socket.destroyed){let l=new Error("The socket was closed while the blob was being read");process.nextTick(qr,this,l,c);return}this._bufferedBytes-=a[pe];let d=Qe(u);i?this.dispatch(d,i,a,c):(this._state=ye,this.sendFrame(r.frame(d,a),c),this.dequeue())}).catch(u=>{process.nextTick(bc,this,u,c)})}dispatch(e,i,a,c){if(!i){this.sendFrame(r.frame(e,a),c);return}let u=this._extensions[$i.extensionName];this._bufferedBytes+=a[pe],this._state=wc,u.compress(e,a.fin,(d,l)=>{if(this._socket.destroyed){let p=new Error("The socket was closed while data was being compressed");qr(this,p,c);return}this._bufferedBytes-=a[pe],this._state=ye,a.readOnly=!1,this.sendFrame(r.frame(l,a),c),this.dequeue()})}dequeue(){for(;this._state===ye&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][pe],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][pe],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)}};Qi.exports=zr;function qr(r,e,i){typeof i=="function"&&i(e);for(let a=0;a<r._queue.length;a++){let c=r._queue[a],u=c[c.length-1];typeof u=="function"&&u(e)}}function bc(r,e,i){qr(r,e,i),r.onerror(e)}});var xo=ce((eh,ao)=>{"use strict";var{kForOnEventAttribute:Ht,kListener:Ur}=Be(),eo=Symbol("kCode"),to=Symbol("kData"),no=Symbol("kError"),ro=Symbol("kMessage"),so=Symbol("kReason"),vt=Symbol("kTarget"),io=Symbol("kType"),oo=Symbol("kWasClean"),qe=class{constructor(e){this[vt]=null,this[io]=e}get target(){return this[vt]}get type(){return this[io]}};Object.defineProperty(qe.prototype,"target",{enumerable:!0});Object.defineProperty(qe.prototype,"type",{enumerable:!0});var nt=class extends qe{constructor(e,i={}){super(e),this[eo]=i.code===void 0?0:i.code,this[so]=i.reason===void 0?"":i.reason,this[oo]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[eo]}get reason(){return this[so]}get wasClean(){return this[oo]}};Object.defineProperty(nt.prototype,"code",{enumerable:!0});Object.defineProperty(nt.prototype,"reason",{enumerable:!0});Object.defineProperty(nt.prototype,"wasClean",{enumerable:!0});var St=class extends qe{constructor(e,i={}){super(e),this[no]=i.error===void 0?null:i.error,this[ro]=i.message===void 0?"":i.message}get error(){return this[no]}get message(){return this[ro]}};Object.defineProperty(St.prototype,"error",{enumerable:!0});Object.defineProperty(St.prototype,"message",{enumerable:!0});var Kt=class extends qe{constructor(e,i={}){super(e),this[to]=i.data===void 0?null:i.data}get data(){return this[to]}};Object.defineProperty(Kt.prototype,"data",{enumerable:!0});var vc={addEventListener(r,e,i={}){for(let c of this.listeners(r))if(!i[Ht]&&c[Ur]===e&&!c[Ht])return;let a;if(r==="message")a=function(u,d){let l=new Kt("message",{data:d?u:u.toString()});l[vt]=this,Un(e,this,l)};else if(r==="close")a=function(u,d){let l=new nt("close",{code:u,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});l[vt]=this,Un(e,this,l)};else if(r==="error")a=function(u){let d=new St("error",{error:u,message:u.message});d[vt]=this,Un(e,this,d)};else if(r==="open")a=function(){let u=new qe("open");u[vt]=this,Un(e,this,u)};else return;a[Ht]=!!i[Ht],a[Ur]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Ur]===e&&!i[Ht]){this.removeListener(r,i);break}}};ao.exports={CloseEvent:nt,ErrorEvent:St,Event:qe,EventTarget:vc,MessageEvent:Kt};function Un(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Hn=ce((th,co)=>{"use strict";var{tokenChars:Gt}=wt();function Pe(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function Sc(r){let e=Object.create(null),i=Object.create(null),a=!1,c=!1,u=!1,d,l,p=-1,_=-1,v=-1,w=0;for(;w<r.length;w++)if(_=r.charCodeAt(w),d===void 0)if(v===-1&&Gt[_]===1)p===-1&&(p=w);else if(w!==0&&(_===32||_===9))v===-1&&p!==-1&&(v=w);else if(_===59||_===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${w}`);v===-1&&(v=w);let P=r.slice(p,v);_===44?(Pe(e,P,i),i=Object.create(null)):d=P,p=v=-1}else throw new SyntaxError(`Unexpected character at index ${w}`);else if(l===void 0)if(v===-1&&Gt[_]===1)p===-1&&(p=w);else if(_===32||_===9)v===-1&&p!==-1&&(v=w);else if(_===59||_===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${w}`);v===-1&&(v=w),Pe(i,r.slice(p,v),!0),_===44&&(Pe(e,d,i),i=Object.create(null),d=void 0),p=v=-1}else if(_===61&&p!==-1&&v===-1)l=r.slice(p,w),p=v=-1;else throw new SyntaxError(`Unexpected character at index ${w}`);else if(c){if(Gt[_]!==1)throw new SyntaxError(`Unexpected character at index ${w}`);p===-1?p=w:a||(a=!0),c=!1}else if(u)if(Gt[_]===1)p===-1&&(p=w);else if(_===34&&p!==-1)u=!1,v=w;else if(_===92)c=!0;else throw new SyntaxError(`Unexpected character at index ${w}`);else if(_===34&&r.charCodeAt(w-1)===61)u=!0;else if(v===-1&&Gt[_]===1)p===-1&&(p=w);else if(p!==-1&&(_===32||_===9))v===-1&&(v=w);else if(_===59||_===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${w}`);v===-1&&(v=w);let P=r.slice(p,v);a&&(P=P.replace(/\\/g,""),a=!1),Pe(i,l,P),_===44&&(Pe(e,d,i),i=Object.create(null),d=void 0),l=void 0,p=v=-1}else throw new SyntaxError(`Unexpected character at index ${w}`);if(p===-1||u||_===32||_===9)throw new SyntaxError("Unexpected end of input");v===-1&&(v=w);let C=r.slice(p,v);return d===void 0?Pe(e,C,i):(l===void 0?Pe(i,C,!0):a?Pe(i,l,C.replace(/\\/g,"")):Pe(i,l,C),Pe(e,d,i)),e}function Ec(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(c=>{let u=a[c];return Array.isArray(u)||(u=[u]),u.map(d=>d===!0?c:`${c}=${d}`).join("; ")})).join("; ")).join(", ")}).join(", ")}co.exports={format:Ec,parse:Sc}});var Wn=ce((sh,vo)=>{"use strict";var Cc=Y("events"),Ac=Y("https"),kc=Y("http"),lo=Y("net"),Pc=Y("tls"),{randomBytes:Dc,createHash:Tc}=Y("crypto"),{Duplex:nh,Readable:rh}=Y("stream"),{URL:Hr}=Y("url"),Je=_t(),Ic=Br(),Lc=Fr(),{isBlob:Nc}=wt(),{BINARY_TYPES:uo,CLOSE_TIMEOUT:Rc,EMPTY_BUFFER:Kn,GUID:Mc,kForOnEventAttribute:Kr,kListener:Oc,kStatusCode:Bc,kWebSocket:Q,NOOP:ho}=Be(),{EventTarget:{addEventListener:zc,removeEventListener:qc}}=xo(),{format:Fc,parse:Uc}=Hn(),{toBuffer:Hc}=Ft(),go=Symbol("kAborted"),Gr=[8,13],Fe=["CONNECTING","OPEN","CLOSING","CLOSED"],Kc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,F=class r extends Cc{constructor(e,i,a){super(),this._binaryType=uo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Kn,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]),po(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){uo.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 c=new Ic({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),u=new Lc(e,this._extensions,a.generateMask);this._receiver=c,this._sender=u,this._socket=e,c[Q]=this,u[Q]=this,e[Q]=this,c.on("conclude",Wc),c.on("drain",Jc),c.on("error",Vc),c.on("message",Xc),c.on("ping",Yc),c.on("pong",$c),u.onerror=Zc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",wo),e.on("data",jn),e.on("end",yo),e.on("error",bo),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[Je.extensionName]&&this._extensions[Je.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){le(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())}),_o(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){jr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Kn,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){jr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Kn,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){jr(this,e,a);return}let c={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[Je.extensionName]||(c.compress=!1),this._sender.send(e||Kn,c,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){le(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:Fe.indexOf("CONNECTING")});Object.defineProperty(F.prototype,"CONNECTING",{enumerable:!0,value:Fe.indexOf("CONNECTING")});Object.defineProperty(F,"OPEN",{enumerable:!0,value:Fe.indexOf("OPEN")});Object.defineProperty(F.prototype,"OPEN",{enumerable:!0,value:Fe.indexOf("OPEN")});Object.defineProperty(F,"CLOSING",{enumerable:!0,value:Fe.indexOf("CLOSING")});Object.defineProperty(F.prototype,"CLOSING",{enumerable:!0,value:Fe.indexOf("CLOSING")});Object.defineProperty(F,"CLOSED",{enumerable:!0,value:Fe.indexOf("CLOSED")});Object.defineProperty(F.prototype,"CLOSED",{enumerable:!0,value:Fe.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[Kr])return e[Oc];return null},set(e){for(let i of this.listeners(r))if(i[Kr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Kr]:!0})}})});F.prototype.addEventListener=zc;F.prototype.removeEventListener=qc;vo.exports=F;function po(r,e,i,a){let c={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Rc,protocolVersion:Gr[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=c.autoPong,r._closeTimeout=c.closeTimeout,!Gr.includes(c.protocolVersion))throw new RangeError(`Unsupported protocol version: ${c.protocolVersion} (supported versions: ${Gr.join(", ")})`);let u;if(e instanceof Hr)u=e;else try{u=new Hr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}u.protocol==="http:"?u.protocol="ws:":u.protocol==="https:"&&(u.protocol="wss:"),r._url=u.href;let d=u.protocol==="wss:",l=u.protocol==="ws+unix:",p;if(u.protocol!=="ws:"&&!d&&!l?p=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:l&&!u.pathname?p="The URL's pathname is empty":u.hash&&(p="The URL contains a fragment identifier"),p){let N=new SyntaxError(p);if(r._redirects===0)throw N;Gn(r,N);return}let _=d?443:80,v=Dc(16).toString("base64"),w=d?Ac.request:kc.request,C=new Set,P;if(c.createConnection=c.createConnection||(d?jc:Gc),c.defaultPort=c.defaultPort||_,c.port=u.port||_,c.host=u.hostname.startsWith("[")?u.hostname.slice(1,-1):u.hostname,c.headers={...c.headers,"Sec-WebSocket-Version":c.protocolVersion,"Sec-WebSocket-Key":v,Connection:"Upgrade",Upgrade:"websocket"},c.path=u.pathname+u.search,c.timeout=c.handshakeTimeout,c.perMessageDeflate&&(P=new Je({...c.perMessageDeflate,isServer:!1,maxPayload:c.maxPayload}),c.headers["Sec-WebSocket-Extensions"]=Fc({[Je.extensionName]:P.offer()})),i.length){for(let N of i){if(typeof N!="string"||!Kc.test(N)||C.has(N))throw new SyntaxError("An invalid or duplicated subprotocol was specified");C.add(N)}c.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(c.origin&&(c.protocolVersion<13?c.headers["Sec-WebSocket-Origin"]=c.origin:c.headers.Origin=c.origin),(u.username||u.password)&&(c.auth=`${u.username}:${u.password}`),l){let N=c.path.split(":");c.socketPath=N[0],c.path=N[1]}let T;if(c.followRedirects){if(r._redirects===0){r._originalIpc=l,r._originalSecure=d,r._originalHostOrSocketPath=l?c.socketPath:u.host;let N=a&&a.headers;if(a={...a,headers:{}},N)for(let[z,ae]of Object.entries(N))a.headers[z.toLowerCase()]=ae}else if(r.listenerCount("redirect")===0){let N=l?r._originalIpc?c.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:u.host===r._originalHostOrSocketPath;(!N||r._originalSecure&&!d)&&(delete c.headers.authorization,delete c.headers.cookie,N||delete c.headers.host,c.auth=void 0)}c.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(c.auth).toString("base64")),T=r._req=w(c),r._redirects&&r.emit("redirect",r.url,T)}else T=r._req=w(c);c.timeout&&T.on("timeout",()=>{le(r,T,"Opening handshake has timed out")}),T.on("error",N=>{T===null||T[go]||(T=r._req=null,Gn(r,N))}),T.on("response",N=>{let z=N.headers.location,ae=N.statusCode;if(z&&c.followRedirects&&ae>=300&&ae<400){if(++r._redirects>c.maxRedirects){le(r,T,"Maximum redirects exceeded");return}T.abort();let te;try{te=new Hr(z,e)}catch{let ue=new SyntaxError(`Invalid URL: ${z}`);Gn(r,ue);return}po(r,te,i,a)}else r.emit("unexpected-response",T,N)||le(r,T,`Unexpected server response: ${N.statusCode}`)}),T.on("upgrade",(N,z,ae)=>{if(r.emit("upgrade",N),r.readyState!==F.CONNECTING)return;T=r._req=null;let te=N.headers.upgrade;if(te===void 0||te.toLowerCase()!=="websocket"){le(r,z,"Invalid Upgrade header");return}let be=Tc("sha1").update(v+Mc).digest("base64");if(N.headers["sec-websocket-accept"]!==be){le(r,z,"Invalid Sec-WebSocket-Accept header");return}let ue=N.headers["sec-websocket-protocol"],k;if(ue!==void 0?C.size?C.has(ue)||(k="Server sent an invalid subprotocol"):k="Server sent a subprotocol but none was requested":C.size&&(k="Server sent no subprotocol"),k){le(r,z,k);return}ue&&(r._protocol=ue);let q=N.headers["sec-websocket-extensions"];if(q!==void 0){if(!P){le(r,z,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let W;try{W=Uc(q)}catch{le(r,z,"Invalid Sec-WebSocket-Extensions header");return}let ne=Object.keys(W);if(ne.length!==1||ne[0]!==Je.extensionName){le(r,z,"Server indicated an extension that was not requested");return}try{P.accept(W[Je.extensionName])}catch{le(r,z,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[Je.extensionName]=P}r.setSocket(z,ae,{allowSynchronousEvents:c.allowSynchronousEvents,generateMask:c.generateMask,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation})}),c.finishRequest?c.finishRequest(T,r):T.end()}function Gn(r,e){r._readyState=F.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function Gc(r){return r.path=r.socketPath,lo.connect(r)}function jc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=lo.isIP(r.host)?"":r.host),Pc.connect(r)}function le(r,e,i){r._readyState=F.CLOSING;let a=new Error(i);Error.captureStackTrace(a,le),e.setHeader?(e[go]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Gn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function jr(r,e,i){if(e){let a=Nc(e)?e.size:Hc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Fe[r.readyState]})`);process.nextTick(i,a)}}function Wc(r,e){let i=this[Q];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[Q]!==void 0&&(i._socket.removeListener("data",jn),process.nextTick(mo,i._socket),r===1005?i.close():i.close(r,e))}function Jc(){let r=this[Q];r.isPaused||r._socket.resume()}function Vc(r){let e=this[Q];e._socket[Q]!==void 0&&(e._socket.removeListener("data",jn),process.nextTick(mo,e._socket),e.close(r[Bc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function fo(){this[Q].emitClose()}function Xc(r,e){this[Q].emit("message",r,e)}function Yc(r){let e=this[Q];e._autoPong&&e.pong(r,!this._isServer,ho),e.emit("ping",r)}function $c(r){this[Q].emit("pong",r)}function mo(r){r.resume()}function Zc(r){let e=this[Q];e.readyState!==F.CLOSED&&(e.readyState===F.OPEN&&(e._readyState=F.CLOSING,_o(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function _o(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function wo(){let r=this[Q];if(this.removeListener("close",wo),this.removeListener("data",jn),this.removeListener("end",yo),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[Q]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",fo),r._receiver.on("finish",fo))}function jn(r){this[Q]._receiver.write(r)||this.pause()}function yo(){let r=this[Q];r._readyState=F.CLOSING,r._receiver.end(),this.end()}function bo(){let r=this[Q];this.removeListener("error",bo),this.on("error",ho),r&&(r._readyState=F.CLOSING,this.destroy())}});var Ao=ce((oh,Co)=>{"use strict";var ih=Wn(),{Duplex:Qc}=Y("stream");function So(r){r.emit("close")}function eu(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Eo(r){this.removeListener("error",Eo),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function tu(r,e){let i=!0,a=new Qc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(u,d){let l=!d&&a._readableState.objectMode?u.toString():u;a.push(l)||r.pause()}),r.once("error",function(u){a.destroyed||(i=!1,a.destroy(u))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(c,u){if(r.readyState===r.CLOSED){u(c),process.nextTick(So,a);return}let d=!1;r.once("error",function(p){d=!0,u(p)}),r.once("close",function(){d||u(c),process.nextTick(So,a)}),i&&r.terminate()},a._final=function(c){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(c)});return}r._socket!==null&&(r._socket._writableState.finished?(c(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){c()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(c,u,d){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(c,u,d)});return}r.send(c,d)},a.on("end",eu),a.on("error",Eo),a}Co.exports=tu});var Wr=ce((ah,ko)=>{"use strict";var{tokenChars:nu}=wt();function ru(r){let e=new Set,i=-1,a=-1,c=0;for(c;c<r.length;c++){let d=r.charCodeAt(c);if(a===-1&&nu[d]===1)i===-1&&(i=c);else if(c!==0&&(d===32||d===9))a===-1&&i!==-1&&(a=c);else if(d===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${c}`);a===-1&&(a=c);let l=r.slice(i,a);if(e.has(l))throw new SyntaxError(`The "${l}" subprotocol is duplicated`);e.add(l),i=a=-1}else throw new SyntaxError(`Unexpected character at index ${c}`)}if(i===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let u=r.slice(i,c);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);return e.add(u),e}ko.exports={parse:ru}});var Ro=ce((ch,No)=>{"use strict";var su=Y("events"),Jn=Y("http"),{Duplex:xh}=Y("stream"),{createHash:iu}=Y("crypto"),Po=Hn(),rt=_t(),ou=Wr(),au=Wn(),{CLOSE_TIMEOUT:xu,GUID:cu,kWebSocket:uu}=Be(),fu=/^[+/0-9A-Za-z]{22}==$/,Do=0,To=1,Lo=2,Jr=class extends su{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:xu,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:au,...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=Jn.createServer((a,c)=>{let u=Jn.STATUS_CODES[426];c.writeHead(426,{"Content-Length":u.length,"Content-Type":"text/plain"}),c.end(u)}),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=du(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(c,u,d)=>{this.handleUpgrade(c,u,d,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Do}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===Lo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(jt,this);return}if(e&&this.once("close",e),this._state!==To)if(this._state=To,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(jt,this):process.nextTick(jt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{jt(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,c){i.on("error",Io);let u=e.headers["sec-websocket-key"],d=e.headers.upgrade,l=+e.headers["sec-websocket-version"];if(e.method!=="GET"){st(this,e,i,405,"Invalid HTTP method");return}if(d===void 0||d.toLowerCase()!=="websocket"){st(this,e,i,400,"Invalid Upgrade header");return}if(u===void 0||!fu.test(u)){st(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(l!==13&&l!==8){st(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Wt(i,400);return}let p=e.headers["sec-websocket-protocol"],_=new Set;if(p!==void 0)try{_=ou.parse(p)}catch{st(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let v=e.headers["sec-websocket-extensions"],w={};if(this.options.perMessageDeflate&&v!==void 0){let C=new rt({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let P=Po.parse(v);P[rt.extensionName]&&(C.accept(P[rt.extensionName]),w[rt.extensionName]=C)}catch{st(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let C={origin:e.headers[`${l===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(C,(P,T,N,z)=>{if(!P)return Wt(i,T||401,N,z);this.completeUpgrade(w,u,_,e,i,a,c)});return}if(!this.options.verifyClient(C))return Wt(i,401)}this.completeUpgrade(w,u,_,e,i,a,c)}completeUpgrade(e,i,a,c,u,d,l){if(!u.readable||!u.writable)return u.destroy();if(u[uu])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Do)return Wt(u,503);let _=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${iu("sha1").update(i+cu).digest("base64")}`],v=new this.options.WebSocket(null,void 0,this.options);if(a.size){let w=this.options.handleProtocols?this.options.handleProtocols(a,c):a.values().next().value;w&&(_.push(`Sec-WebSocket-Protocol: ${w}`),v._protocol=w)}if(e[rt.extensionName]){let w=e[rt.extensionName].params,C=Po.format({[rt.extensionName]:[w]});_.push(`Sec-WebSocket-Extensions: ${C}`),v._extensions=e}this.emit("headers",_,c),u.write(_.concat(`\r
|
|
8
|
+
var $0=Object.create;var _r=Object.defineProperty;var Z0=Object.getOwnPropertyDescriptor;var Q0=Object.getOwnPropertyNames;var ea=Object.getPrototypeOf,ta=Object.prototype.hasOwnProperty;var Z=(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 Le=(r,e)=>()=>(r&&(e=r(r=0)),e);var fe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Is=(r,e)=>{for(var i in e)_r(r,i,{get:e[i],enumerable:!0})},na=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of Q0(e))!ta.call(r,x)&&x!==i&&_r(r,x,{get:()=>e[x],enumerable:!(a=Z0(e,x))||a.enumerable});return r};var Be=(r,e,i)=>(i=r!=null?$0(ea(r)):{},na(e||!r||!r.__esModule?_r(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as ra,mkdir as sa,readFile as ia,rename as Rs,writeFile as Ns}from"node:fs/promises";import{dirname as oa}from"node:path";async function ut(r){try{let e=await ia(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function tn(r,e,i){await sa(oa(r),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
|
|
9
|
+
`,x=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await Ns(x,a,{encoding:"utf8",mode:i.mode}):await Ns(x,a,"utf8"),await Rs(x,r),i?.mode!==void 0&&await ra(r,i.mode)}catch(f){await Rs(x,x).catch(()=>{});let{rm:l}=await import("node:fs/promises");throw await l(x,{force:!0}).catch(()=>{}),f}}var nn=Le(()=>{"use strict"});function Os(r){return sn[Ls]<=sn[r]}function wr(r){Bs={...r}}function rn(r,e,i,a){if(sn[r]<sn[Ls])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...Bs,...a});r==="error"||r==="warn"?xa.write(`${x}
|
|
10
|
+
`):aa.write(`${x}
|
|
11
|
+
`)}function B(r){return{debug:(e,i)=>rn("debug",r,e,i),info:(e,i)=>rn("info",r,e,i),warn:(e,i)=>rn("warn",r,e,i),error:(e,i)=>rn("error",r,e,i),child:e=>B(`${r}.${e}`)}}var sn,Ls,aa,xa,Bs,J=Le(()=>{"use strict";sn={debug:10,info:20,warn:30,error:40},Ls=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),aa=process.stdout,xa=process.stderr,Bs={}});import{homedir as ca}from"node:os";import{join as ie}from"node:path";function V(r){let e=r??ca(),i=ie(e,".coze"),a=ie(i,"bridge"),x=ie(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:x,libEntry:ie(x,"index.js"),pidFile:ie(a,"bridge.pid"),portFile:ie(a,"bridge.port"),tokenFile:ie(a,"bridge.token"),logFile:ie(a,"bridge.log"),installLock:ie(a,"install.lock"),configFile:ie(a,"config.json"),agentsRoot:ie(i,"agents")}}function Oe(r,e=V()){let i=ie(e.agentsRoot,r);return{root:i,config:ie(i,"config.json"),workspace:ie(i,"workspace"),logs:ie(i,"logs")}}var de=Le(()=>{"use strict"});var xn={};Is(xn,{AGENT_CONFIG_FILE_MODE:()=>on,enforceAgentConfigMode:()=>da,loadAgentConfig:()=>le,persistAgentSessions:()=>yr,persistAgentSkills:()=>an,saveAgentConfig:()=>be});import{chmod as fa,stat as ua}from"node:fs/promises";function le(r,e){return ut(Oe(r,e).config)}function be(r,e){return tn(Oe(r.agentId,e).config,r,{mode:on})}async function da(r,e){if(process.platform==="win32")return;let i=Oe(r,e).config;try{let a=await ua(i);if(!a.isFile())return;let x=a.mode&511;x!==on&&(await fa(i,on),zs.warn("agent config mode auto-corrected to 0600",{path:i,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;zs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function yr(r,e,i){let a=await le(r,i);a&&(a.sessions=Object.fromEntries(e),await be(a,i))}async function an(r,e,i){let a=await le(r,i);a&&(a.skills=e,await be(a,i))}var zs,on,We=Le(()=>{"use strict";nn();J();de();zs=B("agent-config"),on=384});var Ri=fe(ee=>{"use strict";function Ln(){let r=["AvHPBM4","Ae1LC3nHz2u","wM9Vrgq","Cvbmrva","x3bHDgHlzxK","AgnNB2W","AvHZDK0","x29Uq2XVC2u","C1jRzu8","A0jMDvm","CvrSC2m","DcbVzIbYyw4","ihzHBgLKigq","zNjHBwvuExa","rNHUy1a","x2HHBMrSzu8","tLb1zKO","BfrrAfG","vfzxyxe","zMX1C2HfEha","s0nRzxG","x29UrxjYB3i","DNzgtgK","yw1LoIa","q0Xpu0ve","Ewnty0S","yvHlAfO","BMDIuMy","vMrAyLi","C3vIC3rYAw4","CMvKDwnL","yMrFzgLK","Ee9sB0O","r3PVvNK","ywWGy3vYC28","sgL0A1C","u2HdB2e","DxbNCMfKzw4","DfPsy1m","sgndALq","uu15BNO","yKf4qvC","EhjwBuy","Cgf5Bg9Hza","y3DJsfK","vKX6EKq","AhvlCw8","BwLZzq","z3f3uLK","D2v0yMi","rvDmEKi","x2jPBMfYEvq","z3jlr1O","rxnRy04","AeP4yvK","rxLWr3O","yxnJCMLWDa","DvL2uwq","D1PVC0C","yw51Ce1LC3m","BgLTAxq","EgvuB2K","EeDbDu4","BgvY","vMvYA28","Avnhshe","rg9Ozxy","yxKSihrYEsa","AgLwEgq","BNruCMLLC0m","ihrPBwvVDxq","jMPZy2fSBgi","BgDUtw8","t1bftG","CMvJzxzPzwq","B2nRzxrgywK","yvzmB0G","zMLSzw5HBwu","AgX2CuK","zNvOwu4","q291BNq","svjXzwW","Dg9cExrLC0W","x2rLC3rYB3K","ywnOzwq","zsbHihn0CMK","BhjiELu","D3m6lY8","EMXLD3G","CMvWBgfJzui","ru52q1K","s2P0the","zhzWBeu","EgjWqvC","y2f0y2G","AMnxvvG","ENbYrxK","rxzLBNq","wLDryxu","qvLmqwy","AwDAtwO","uxr3Ave","quD0z0e","t1bftL9fuLi","BMX6vhm","uxzsBvm","ruHIsMW","rgvYs1K","tg9zyMy","ver4Cui","tvD3t3q","CLjYu2m","EMXNAxi","tejouwG","CNnVCKzPBgu","ywDLrxzLBNq","Evn2Aem","mtb8nNW0FdK","Cernq3a","A1rPCuW","DgLLCKPtt04","yKf3BMu","rxbtuuq","thj3rfK","uK1KAum","zxmGCMvHy2G","t3D0whu","CMvJB25Uzwm","EfPdC2G","DKj3sMy","igfYCMf5yNu","mZi0otK1mfbgD1fQzW","tLrbtKy","uKPcwhe","C1LYuMG","svrorhK","x2LZsw5PDa","BeHyuNm","r0v4qui","rgvKAwnHDgu","EKDJzeK","B3jRzxjhBg8","zxvWz0S","wNvozg4","z2v0u3rVCMe","rwDsB1i","CgvYC2LZDgu","yvLYy2G","CNnxwM0","DeLPCMS","t2jQzwn0","uKjWtgK","BNz5D0m","zMXVB3i","uLjpuG","ChjVDg9JB2W","x2LUDgvYDMe","wwnAzgi","BxjfChC","C29YDa","Euv0uuq","qLH0v3i","BwXkze4","x0rctMfTzq","D3jPDgu","vePXvw8","B0n5rhi","q0Xpu0LorW","sNr5A1u","CMLQEKi","Ae9Wzw5fDMu","tfbMtxO","ChjVDg90Exa","u2vYDMLJzvC","x2TLEvbHDgG","y3jyvuK","zfvcwNq","zNjVBuj5Dgu","y29UDgLUDwu","BMfoChy","y29UDgv4Da","tNPcug0","Aw47y2HHCNm","whrUvNy","su5tvefova","vxbKyxrLq28","thfqwwm","qu10vMO","x2LZtM9Kzq","yNbjCKW","v2LUzg93","uvforxu","x2rPC2nVBM4","vMfpDLK","Ahnhyxm","sNLjCfa","x29WDgLVBNm","qKrVuLa","r0Pyu0O","sgr4CwW","EMTXze4","yNrtrNu","qw5ytMi","mZu5mdu5mezyy2vvra","x3DZsw5ZDge","mhWZFdr8mNW","ywDL","lcbxzwjtB2m","tMznENe","teruzg8","z2v2v0C","qKrWwxu","wKLhDLe","zgvMAw5Luhi","CfbXBe4","AK1xrhG","wLDfBMG","AKHjrwq","ruTHBe8","vxvmwKe","vvPzAhy","CMrWqwS","vKTkBeu","zxjYB3i","AxnszwfKEq","x194x21Zz18","uhjPBwfYEuS","BhPYqw0","z2ruBhe","qKXJA1i","rfrcrhm","sg5Nzfu","CM53ugm","ysbTDxn0igi","q3rKExm","z3fJtgS","Durluxm","BNrbBMrvCgq","yuvnqwG","whfJDhC","BeTyBMe","Ahr0Ca","yMH2wLO","vKLyELu","B25TzxnZywC","CKjsrfy","Dwn5zxq","B3bLBKrc","yw9xww8","tgDdBLy","B3vUDa","vhfgvfm","AwLduK4","ALfrDvO","wKnMsKi","Aw50zwDLCIa","rg9UweK","Dw50","vu5lrg8","zvvYBa","vfbpBeS","B3jRig9MzMW","CNjPCfy","vuvwsNC","BxDUzve","Dg9iyxnO","wfr5Cgu","s0zHD28","zvDAwvy","sLnptLa","ELnPrLm","B21etfe","nxWWFdj8m3W","BwDyB2O","twvrs00","Du9xyMO","Chjvt28","q29Kzq","B2jey0q","wgn4AKu","BhfUBhu","AKn5tu8","zufnr20","EwvfAhy","zw5HyMXLvhi","DcbSAw1PDa","s2HvCui","v1nLsLy","ihn1y2nLC3m","y3zpu20","u25mBgm","uMvHzcbWyxm","wvD3A0C","B0X0ENG","B3bLCNr5tMe","sxrzvxm","tMrcAMG","EfvZzuvUDG","EM5nBey","BgPWEMK","y3vYC29Yx24","q3vZDg9Trxi","zw1tEwm","suXyEwy","z1fNu2q","weTesLm","A05wDwW","A1HMu1y","y3vYCMvUDeK","v0zMz08","DNbjAuq","x2rItMfTzq","z3fqCeS","tg9JAW","vw5Oyw5KBgu","y3jLyxrLtwu","yw5ZzM9YBvq","B09JtMG","DxHWrvG","yMLUyxj5vhK","tufyx1jfvfi","rLjptLrjrvi","Dg1vwvK","DNndtvC","BMvLzf9Hy2S","zw1LBNq","yKHXwKC","vhP6vNO","BM94BKO","B25dBg9Zzq","ufrPzNG","B2LUDfjLywm","CMvZzxrfBMq","BKvWzvG","ywrKrxzLBNq","yw1L","AvfAww8","zez5tg0","x2zVCM1HDeu","y2XLyxjtDg8","AgfZt3DUuhi","zxjHDg9Y","D3jPDgvvAw4","y2PuEva","qKHryvu","Dw5KzwzPBMu","AxnrB1nby2S","DwHZwwC","EgDvEM0","DeLK","B3jLtMfTzxm","sKvmBLm","AgfUz2u","q0Lbwgu","CM9fugq","CMvHzhLtDge","m0LiseDYAa","C2vUza","B25tDg9Wsw0","DgfYz2v0","wevuAwS","Ce1SBuG","BMrWB2LUDfq","tffPu0m","v3bMrwK","AhLizfy","zxH0ugf5Bg8","zhDYCvy","vhHkqwK","vgLru0m","z2nduMy","qKHfywq","tg1wtKO","Bg9IywXty28","wKHfsfe","tgHLuxK","BM9Uzv9UB24","ywnR","ywrK","C3bSAxq","v0PsBeu","sxHeBKm","zgfyDeK","wKPZBKe","ALDlv0W","Bg1bEwK","C2v0sxrLBq","x3bPBMC","zfnLAK8","u3D2z0O","DKrjC24","D1H1tLy","AMndAe0","y2vZC0HHBMq","z2vjBMzVu3K","AenSB3nLrxy","AgvHzgvY","rMHru3e","CgjICdi","BMnLq2XVC2u","x2nSzwfYvgK","Eg1wA0i","tKfwDg0","s3feELe","tfPADvG","EwDcB0y","tMXmDha","B0LtvKm","CYbPBNn0yw4","Bevkq04","De1HBMfNzxi","mNW0Fdf8m3W","CMvTB3zLrxy","DMjVChq","C3vIyxjYyxK","BgnfCMS","sxDfB3e","ywnRtxnNswq","B25LCNjVCG","v1jmv24","uxHkr1a","sev5sNm","r09VB3u","x2n1CNnVCKy","BKzwB2S","vvrUruy","Cwjcq0i","BeHHBMrSzxi","BxzOueK","ywnOzwqSihC","DxrMofDYAxq","C2v0","tfv2zKi","B25JBg9Zzq","vKrhrgG","ufvhB2O","zgvIDwC","BMDuAw1LCG","EMj6CvK","B0TXy2O","s1rLsKq","CMLLC0nVDw4","zMLN","Bwu6ia","D2Hwrfm","uLDoC0e","CMHRD24","zxj2AwnL","zMzLCG","y3jLyxrLrxi","Bwf4tg9ZC0m","BhzxreS","CLzRrgu","r3HqCgi","rNjVBNrPzxi","BKzdD2m","EMXSsfG","z2v0qwXSs2u","qvzbt3m","DMvY","EwHxs3e","BKDXsuC","tLHAEK0","CIb0DhDjra","q2fOuNi","tMrKDfa","zKrsDgS","CMveuuS","reLPs2i","ihjLy29UBMu","qxnLqM8","wxjdBLq","DfDtwgC","CwP0zum","n3WWFdz8nq","EKLlyMu","BvnvANu","tgLZDgvUzxi","Bg9Nsurhzw4","DMnbyxq","t3rerwi","zgLZCgf0y2G","t0DfAwe","ufjwExe","B2zMBgLUzq","ALfouLG","Dg9tDhjPBMC","mhWYFdn8mxW","BezSDxnO","u2f4ENG","DgvZDa","A01qAwq","r0XQve4","t3bOzNu","yw95zuW","r0jkzhK","vKvOEui","BK5ZB2e","BuzvCvq","Aw5KzxG","y2fSBa","D1LIBKq","ufbpvNe","rLDt","uMjUveG","EMjSrMy","wvDRsgi","ywnRx2LK","yKDnDLG","CMvHzfvjBNq","A2v5","z2TZz0K","vK9Xtvu","B2fK","ChjVy2vZCW","zNjVBu51Bwi","rgHiDxC","zM5ss24","EffXywK","qMHRzhu","rvnHv1u","DMLLue0","zxPwDeC","zg9Uzq","BM14rKe","ywnRx2nVzgu","DMvUDa","BLr6q3u","sfbmzfu","rNjwshm","tMHyAKm","ChbfC2W","CM5Kre8","D2LSBfjLy28","DMfSDwvZ","swvsD0y","Aw9eCxi","y3jLyxrLrwW","BfP2yMG","CNzHBfzHBhu","vfHfB0i","D2z5CeS","C2vUzf9Hy2S","zePfBLO","BMDLza","zNj1tw4","D1noBM8","zxjFBxnNAwq","C2v0zgi","z1biCw8","EM9irNu","B2jQzwn0u3q","DxjOveS","tfnOBKe","BKLYBMq","mhWYFdn8nhW","CNnVCL92ywW","qKHAvgW","u2TPCcbWyxm","EeDkAeG","t2jbrwm","BfLgEe4","BKzsy1y","zvH3qLO","z2v0q3vYCMu","s1f5yvi","BKXPBMu","BwfW","tM9Pywu","C2fNzq","AxfwyxK","u0ndrK8","yKzJwvG","sgPPv3O","DgvmB2Djre4","A0f0zhy","q2ruBMm","vgjRALm","ug1fveC","CMvHC29U","BMv3vMvYC2K","vgvcsfK","B0XjrNm","r3PsAhK","Aw9UvgLTzw8","zgvS","x2LZqNjVD3m","sff2Dxi","y29UBMvJDeu","BvD4vMy","BvLNCuC","B1fvywi","ywPkwwu","qun6D0C","D3rKBw8","r0nuvMe","yMLUyxj5","ChrVCG","zwn0","Ec1TC2CTy3u","zhvHvwS","zxvwvLy","A2v5CW","DxbKyxrLq3u","ExbL","AgHlB2O","CMfTzq","r0HYqu4","wxLPzLy","BwvZ","DvvNEuO","u0LVDgC","rKLmrv9ot1q","AxHfuum","BNrLCG","Ew5Qy0m","ve5Wsfi","yMXVy2TLza","D3vjsgW","yxjOvxG","sgnwwhG","Fdj8mxW1","tKfvB00","CMvWBgfJzq","v1jhEwe","y3jLyxrLt3a","uvbmzeW","BePOzeK","DKvjuvq","s3bRy0C","r0zzDfq","ufv3v1a","BxPoqvO","yw5Nzq","wLLKtLO","Cg93","se1OC2W","x3nLBMrby2S","CM92AwrLihC","tfnosKS","BMfTzq","x2HHBMrSzvi","AxnFywnR","B29zvMC","yxrHlcbKyxq","tLjksxG","ywrKt25L","rLj0zKG","DMfS","ywXS","x25HDMLNyxq","qK9Zy08","vgLTzw91Da","uxjJreC","Dxnltxu","AxnbCNjHEq","AwrI","CMvZB2X2zq","A2v0ignVBNm","D2fZq2XLyw4","rg5kDhy","DLDuDeS","EfPUyvi","C2DPza","Berpt0S","q21Kswi","A1PjzMm","s1rkCKG","C0jf","yNL0zxm","ugfkDKG","Ec1TC2CTCw8","AKH4wui","DMvYC2LVBG","AxnAzxjV","EMXhD1m","BgLUzq","rwP3DgK","Ae5Ov1e","v0nKzMm","rgnTD08","EKf5q3O","CLvtDum","yK9qDxe","AKLsuKG","qNzVu28","DKrswMy","DeLUDgvYy2u","re9hvfu","z0P1A3q","ugDltuq","C0fAuuy","A25lEvO","A1n6DeO","yMjsB0m","ywDLsgLKzq","EMD6rxO","BMrLEa","zxjFCw9Zx2e","y2Lbuxi","zfDYvwy","yxGGCMv0CMK","CeDmtgC","t3DQqwW","q3vZDg9Tq2W","qwncugq","yvzoqLy","tNDmuKy","zgvSzxrLrge","EgniC24","vw5PBxbSzw0","AgvHzgvYCW","sKvJzxO","Dxrjza","zw50tgLZDgu","s2XuwwS","CNLuve0","q29UzMLN","Dev2zw50","rfjAqu4","vhb3wfy","Cg9PBNrdB24","z2f2rvG","rLniuM0","qxPQsMS","BgLUzw5V","x2rPC3bHDgm","zw50zwqGDhK","zw5PAwq","y29SBM8","ru5Pwfi","txHcs3u","C0nHAuG","ENfgsNe","EuvKwg4","zMDLu1i","qw1VDw50","yNbcshe","q3n1tuq","AuDKwhq","zNvUy3rPB24","uxvLDwu","Du9TC08","AgvKtwf4uMu","tNzhA3a","s1jTC24","t2fkveO","t3vUqMy","C3PyAMW","BfLLCNi","tuvtu0fhrv8","CMvHzhDYAxq","u2vXsuq","swvqwxa","q0fcq2e","DeHXBwm","ihbYB3rVy28","CM92AwrLige","tg9Nsuq","CMvTB3zLq2G","DwXHCg0","BvrAswC","BvDtwu4","uhPeqNK","BwvZDwm","vK1cBvi","x29UtwvZC2e","C3fjBLu","vePnCg4","y2HLy2Tszwe","DgLUzYbZzxi","qNnxqMK","zfHQvg4","vMTwB3u","CNzyCwu","BMjcueK","qwrYEwy","EwzIBgK","zKTHEgC","BwfUDwfSihi","Dg9oDw1Izxi","zKXyww4","Avfgs3e","yMP5tw4","igzPzwXKoIa","DKXUuw0","y2HnyxHuCMK","t0nMDNu","EgzRsMS","seTYweC","ru9ZreW","ndLnCgjuqMG","zunev2W","ChnXuMm","rxLVEwq","BhHAA2y","EvHzu0G","BML0AwfSAxO","s1rcuhO","tKX5vxO","BKHsvwy","B25ozxr3B3i","AK90u00","wvPHuNG","x2DLDeLUDgu","txfku0C","D24GCMvHC28","x2nSzwfYugK","DufmCgi","CMvUDevUzha","BKnntg4","v2TTwhu","t2TYzfq","BvDUv1y","rM5jCwe","yvbKyLe","x3bPBMDmB3m","AKLUChO","r0XREw8","ChvPDfa","Cw9Z","CgLUz0XVC3m","sw52q0e","AKvXwgy","DND4Afi","zLrlrvi","DMXACKS","BerdzgG","qwLTwLK","x29UvgLTzw8","CuHUtg0","CfvyD2G","otmXodu4wuHtEuvX","r2L6z3G","yKzfD0G","uhP1AKu","yvroANq","EvjLy29UBMu","uezOyMG","AMPlBKi","A1n0yxr1C0m","y29UBMvJDfm","zgf0yq","A2Hxv3a","BLjkDg8","EgnbCxC","zwPUBfC","ign1CNnVCIa","BMzrvMy","y3jzzwW","zw5KCg9PBNq","C3rVCcbPBw0","t0DWBw8","u3rYyxrLz3K","B3jpBMXPBMu","s0PuuwS","yMv5zwe","C3rLBMvYCW","se5ACxi","ENDzuNu","y3vYCMvUDeu","vwPMtvu","zxjYtM8","uNzWz1O","y09Tu20","yxjsvfK","mtf8mhW3FdG","x2LZtwLUAvq","BwLUzW","BMvY","qxLJDvG","wM1kDK0","EKzbEg4","vLrArLi","reTUCNy","u3DNvKG","A0zNA2C","ueHYC1u","mZa3ntKWrhz2tvLA","CgLUz0LUDgu","yM9KEq","zgvJB2rLzey","sfPWDei","v1nQtKu","AfzqyKK","zhDyDKS","BwvKAwf0zwW","Aw5JBhvKzxm","Cwfcsxi","rMT3tgO","y29Kzq","yLzYzxq","CeD6rLe","wvj5BvO","x3vYBa","uuHdug4","zNjVBujPDhm","C0Tcywu","CMfTugfYyw0","x2DLBMvYyxq","DuzyvM4","x2n1CNnVCK0","x3nLCuLK","DwDmAMq","A0PvD1O","v3nRwwK","CgLUz1rPBwu","x3DZ","z2v0qwXS","x2vUzhbVAw4","tMTKtuK","zhLpAvm","tM5Uu0u","x1fVu01HBMe","x3bYzwzPEa","AejNv3a","Dw5ZAwDUzwq","zNjVBunOyxi","BwvZC2fNzq","B2nRzxq","x3bPBMDqB24","B3bLBG","z2vY","BM5Ly3q","tg9NsurozxC","rxjYB3jdB2q","DefIzNe","s3n2v0K","AxnmB25N","rvDNqKm","tMfTzq","z2v0t3DUuhi","yxnZAwDU","q0nyvg0","CYbWyxjHBxm","CLv6r0y","zhLwzgK","yuz1s2W","Axnby2TdBgu","u05ov08","AgzSDhG","B2zM","t1PsBMS","x3jLBw92zvC","rg5czg8","zw1PDa","zMzMzG","qvHvsNy","pxv0zI04","v0jbr0u","zMLSDgvY","rgLJs2i","CKPbDuq","thPksLe","AM9PBG","BNvTyMvY","ihrPBwvZ","DuPzAgq","EevyqMO","x2LUAxrhBg8","uhvlrxC","AxjLza","y3vYC29Yx2y","suvtx0vsuK8","zufJAW","ruXrEMi","zxjYtxnN","t2X3u1O","EfzNCNO","vwnhu1C","sfr6z2i","D3bPs20","rvjst1i","yNL0zuXLBMC","igzHAwWSig0","AePsq0y","mNW0Fdf8mhW","uenfDM8","yMjsENC","swTrsNu","rKzNs3G","AwXK","sMjgC1m","sLrPvxK","tMfTr2y","x2nVBM5Ly3q","thzgENK","yM9L","CK9kq1a","zLHxDuS","DhzWBwu","v1jOzLu","y3juCMK","vMHXA3O","BMCGB3iGyw4","Fdj8nNWXFde","A0z6tNq","rM9KuK8","ihrVihjLDhi","vvvSzMK","CvLTyMu","x2HHBMrSzva","whLjt3m","y3ruAw1LB3u","CfbmtMq","A01yyKC","wMrTsum","A1DoBMq","ELf3svO","C3jJ","vxD6z0i","CMfUzg9T","uvDYuKW","mMDSq2jwAa","tLDNzeW","C3bSAwnL","BMDjDve","z0rgtKK","DxjfyNu","yNL0zu9MzNm","DwHwD0O","EsbJBg9Zzwq","vu1luey","t2XKCuK","tujuDe0","BMnVzgLUzW","EufVr0S","z2v0s2v5","y3jLyxrLt2i","tfzSDMK","CwH4D20","B3btExa","txbdtuO","r0jIug0","C2vYDMLJzq","rwXes2S","ywDLu2HVDW","zfDVCMTLCKC","y2XLyxi","v2LNu1y","wKvSy2e","Cg9PBNrbBMq","y1bNB1G","wLDIteq","CwPcBNy","x2LUAxrqCM8","DKPny04","yvrTBum","AgLNAa","r25JBgm","quDQANy","CLjnEuy","AMzjz2O","v1DZsu4","se5Wu24","x3nVy2TLDa","AhnWA00","yMfSu2nVCgu","sxPiu1K","AwXLtMfTzq","x29UugfNzu4","vLf3v1C","qunRB1q","CMfNzvn5BMm","y3P2wxK","AhLUvKq","yK9VyKe","x3fVC0rc","ywXSzwqGBxu","B25SAw5L","y29UBMvJDgK","y3zwshi","EMzesvG","o2nOyxjZzxq","rLDwDxe","Cgu6ia","ALjsyNq","sg1Yz2i","y2HnyxHdB3u","lcbTyxGGCMu","r1zis0e","CgLUz19VBMm","v1r1tvy","uvH6tem","ugHxzge","v0fVy1O","uMXIExC","Ef9MCM9UDgK","zv9ZDwnJzxm","AgfZ","DwrqAhG","yMXUy3y","vgHRC2K","qLP4ANK","Aw5L","mdaWma","u3nhs3K","yuXICLe","DxjS","qufduLK","ELzRqLG","u3bnq2u","EuPYvfC","x3DHAxq","ywrKq291BNq","uxzfzfq","AwP4uuO","zw5NDgG","thPcwu4","tM9ou3O","qKPZsNG","CLnkDuG","Aw5Lza","su5IAxq","Axbhr0e","AfD0qMi","EfvhzwW","uer6wva","tfvXEKG","seHlvK4","s3LXC0y","yw1Lu3bHy2u","qLvcs0C","DgHLBG","rNfhwvC","zLb6BLC","qMnttMi","zLDQtha","y29Uy2f0","BMCGzMfPBgu","BxDuAMK","AuLTEgi","yxbWBgLJyxq","Bhrbvhi","Aw1LCYbPBIa","B3v0sw50zxi","qK9dtuK","tw9KDwXL","BNrfBMrWB2K","C3rVCMu","DLDyzLK","zNjVBuHHC2G","sK5ssxu","D291v3O","yxbWBhK","x21PBMLoyxy","C3vJy2vZCW","Aw9Ul2PZB24","B0XiC2K","zw5XDwv1zq","B0zLEMO","x3jLywr5q2W","z0v1zxC","zxjFywnRx20","zw5fDMvUDa","C2v0u3rVCMe","BKDmtMi","Cgf5Bg9Hzfq","yMTtBvm","yw1PEwy","ywjVCNq","AMfgELG","weTXv1u","DhjPzxm","zw5ut3y","AKDiqwO","sgD0y3C","C2HkDey","zcWG","Dw5RBM93BIa","yNvMzMvYzwq","yxzqD1m","Bhf5q1q","zMPsvK0","ywrzzhy","zvvHB0S","zuXxCwO","Duvjz08","zMzmAw5L","zxq9DxrMltG","BMrTtNy","A2P2qxK","txjJzwK","D1r6t3O","zwnVBM5Ly3q","zxHWB3j0CW","tKfusvzfx0u","AgjKr0S","DxvNB0i","t1bAv3i","qvPevum","q1LZCgy","uNzmDge","BhnWthe","wKXhswu","wgPZu0W","C0Xf","ChvZAa","vMDMzxq","tLLlDeS","C3rHCNq","C3zLsu4","x3bYB3rVy28","CNjVCK1LC3m","u2fhzeq","EgvVtLi","wMvqEfK","CNLRv1K","wgvtvwi","ruX1BMK","vLnzshC","rNfRCMG","BfrPBwvVDxq","v0nJsuW","BwvY","rfL3tha","Cg94q0y","x2rYB3bhBg8","yLDhB1O","uMvJB25Uzwm","B2nRzxrtDwm","DMfSDwu","v2HQDM4","C0vQrhK","x2nYzwf0zvm","v2fnEK0","u1zRzwi","v2vPEgLUsLm","yMfSrxzLBNq","ENHICfi","Dw9Orfa","C0XPC3rLBMu","y3jLyxrLq2W","CMvQzwn0","Fdn8oxW1Fdq","y0LtCvO","Eu5twK4","C3rYAw5N","yxbWzw5Kq2G","z2v0","yKXkCKK","x2n1CNnVCK4","DxHRvKG","yNrmB2u","vM1urw8","C3rYAw5NAwy","EfLRzKK","yxjYyxLIDwy","CgXLyxnLiha","rNzsz08","uhzuB3i","z1rPBwvVDxq","suTLA2m","Bg9NsurozxC","svf6AhK","q2nss0O","reHxy24","Dgv4DfbHEwW","ywXPzcb1CMW","mtb8mtf8oxW","uMPJv0i","D0nRAuG","B09vs0S","r01OufG","A2HpDgS","AevYCM9Yrxy","x3jLy29UBMu","DvvZExO","y1zdvey","z3HftMW","r29tCvy","y3vYC29YlNm","y3r4","EfDgDMK","sLnkqva","AxnrB1nnzxm","s3rZvhC","B3nLrxzLBNq","tNHXAvi","v1j0DLa","CxfAEhO","CMv1uw0","C2XPy2u","DLHUDNu","CM92AwrLigi","tvn5B2q","s29yEgG","ufPSB2C","CwLeA0K","DhjPzxmGCMu","AKL0t3y","EKvwz2G","x21LC3nHz2u","zwvKzwq","AwrZtLC","qMH6zu0","A0LZExC","mxWY","z1zPCve","CgfNzwHPzgu","CNzHBa","t2forxu","ywHfr1u","CMvHzg9UBhK","mxW3Fdj8ohW","mhWZ","q09otKvdveK","yu9Rs04","Dg9mB3DLCKm","v0rWufK","vwv5D2K","A3byvgC","B3bLCNr5","Aw9U","v2vIu29JA2u","qvrnDhG","DwvMsNa","CNnVCL9Uyw0","z2v0sxrLBq","id4G","B3nLza","vNHYtNG","yxv0B21HDgK","y09Wzw4","Efrurw52","zwTNA3y","uhPbC0y","rfvOrw4","BKLJwfa","zhD2Afe","z2v0q3vYC28","Dg9Y","mtiWnZqWng1msgX5BW","BIWGAg9ZDg4","yM5izee","sLjMtNO","mZe3mti1nKflzhjbCW","DgLTzw91Da","B2XKvMvYC2K","yNvMzMvY","C2nYAxb0","tevOuNK","wLr3Dfi","B25szwnLAxy","Dg9hzw5LCMe","qxDIy2y","vufQv2S","tNfivgO","q2jftxi","quXm","wej2Bva","u2TqzgS","DgrpuMS","x2LZtwLUAvC","uefKALK","y29UC3rYDwm","q0L5y0u","zxjFDhrS","C2vYDMvYvgK","B25tDgfYDfi","x2XPC3rLBMu","v0flufC","zw50","z1PltxK","uu9Ssva","yxKSig5LDhC","qwjVCNrfCNi","yw5Hz2vY","u0DcDe8","ywXSB2nvBNm","x2fKzfDZtgK","BwvZC2fNzv8","Dg9cExrLCW","y2XVC2uSihC","vg9VvvC","mdaWmdaWmda","BMCGDxjSoIa","sxjbEg8","txLZtK4","B3r6rxC","tw1IBhG","t3rlCha","uKjor1m","zM9YrwfJAa","C2HPzNq","y2f2qKO","rgrLzui","ywXSq3vYC28","D3nZoI8V","Bg55ufC","teXxvKi","EevztgK","D2LKzfq","y21TB3q","ru9LzhC","suX6z3a","B2zMC2v0","zgvSzxrL","ChvUsNa","weL6CxC","quDtA2G","ug90vuy","sMXvANm","r05uA1K","y2zbsKC","s3Lzs0S","CMv0CNLdB3u","C2vYDMLJzs0","qxPqAxe","CffvvuK","CMvZzxrdB3u","uLLcsu0","yLHKyMC","swrLDKu","zwXowfi","yvjSqNe","C2v0q3vYC28","CM9YrxzLBNq","zNjVBNrPzxi","zw5HyMXLuw8","sMX2BeO","A3LMCvC","zw5JB2rLrNi","mNWWFdf8m3W","AefJA01LC3m","uKneANa","zvjOqvK","z29fDKu","swvRsLe","yvDWz1e","B21mDvm","ywzL","AwDHDg9Yt24","swHPtuC","vxfUCKy","x2LUAxq","s05HwNy","v1DmDKq","yMfJA3vWigu","z29PBMCGyxC","qMfNA2e","y29UBMvJDa","yxnL","Dg9cExrLC0i","y3jLyxrLuMu","EejnD04","Cgf5Bg9Hzeu","uLHpwhq","r2PeuLK","u2HHCMvKv28","tenhA0S","DNfYtuK","Dgv4Dc9WBge","nNW0Fde","AhH3tge","ignVzgu6ia","y2uGBM90igK","y2XVC2u","y2XVC2veqG","Eg5nzLO","BxnN","v3nxCKu","BxnNsuq","s3HSAhO","tgL0DhO","ANvyA0i","AKnTBg0","wvbXBha","sKDRwM8","DKvYAe8","rwTLrwO","ufHUtKG","AeHzwui","m3W0Fdv8mhW","BM93","uM55Dg8","u05zCNm","tvrwvhe","r01kq24","Cg1nyLC","DxzqA0e","DuLns1C","zxH0zw5ZAw8","DMP2Ahi","qKfpzLe","vMvlAwy","sgXOuuu","lcbOB3n0BMe","CYbHBhjLywq","z1jOtfO","s1ffv2G","B3bLBIa","m3WX","x29Ut3bLBG","y0rlvLK","zxjFCw9Z","icSG","ywr2yw5Jzq","rfjevu0","CwnLzui","sgXTuhy","AenTsxm","CNboBuS","DhDVCMTdAge","z2vtEw5J","ywnRDxbfBMq","v0voEKO","CKztCu8","s2TkzLi","FdH8m3WWFdC","Cg9W","uhn1s3q","uNDfBu4","D2HUyMG","y3vYC29Y","CfLtzu4","y0jsuNi","uNLnCwS","yMLUza","tKTHwwO","y3vYDMfSDwu","DMjZwvu","C0DZufa","zM9Yy2u","l3DZl3yY","qvjrwKi","A0TTr2O","B25VCgvU","CKzyC28","s1LxsMO","Aw5KzxHpzG","shbIAKu","Chv0","Aw5PDcbrB1m","BKvsuxy","t3bLBKv2zw4","AhPZyNK","twvZC2fNzuu","uwrcCfq","q3Pyzei","s0jnvee","u1DOweq","CeDRr1u","twLZC2LUzYa","vgTpCNu","DMLJzuLeig8","zuDnrNu","Dhr3Awq","BMXwze8","B25nzxnZywC","AM9KCwe","q3DUEKG","y1DPrxC","BuPRsMe","CMvZDwX0","yw1hy0G","C3PXrey","zxrxB3jRq2G","AgHuEvu","vfz0A1u","CMvXDwLYzwq","BhrPCgXLihq","Bwf4uMv0CMK","z0nuwha","Bhm6ia","BMDQrwi","BgvUz3rO","t1LLt08","CKzcv1O","wK1MA3i","Bg93","sfnzweG","wMffv2C","zv90Aw1LB3u","y2HHCKnVzgu","rvPwyuy","uw1zufy","C2v0y3vYC28","Cg9pueK","y3vZDg9Tshq","CgfYC2u","rfjYDva","B3L6Cg0","A3Lyuhy","Bwv0Ag9K","mxW0Fdn8mNW","yLbdA2q","B25fCNjVCG","quDxwhK","y291BNq","x2LZv29YA2u","u3D6AeC","DgHHBIbSB2m","zMLUza","vgDltMW","ELjlEfe","C3nHz2vfDMu","yMTSCNO","C0nVDw50zxi","y29UBMvJDca","x19LC01Vzhu","yvHVt3O","uvr4C2W","Dgz4ww8","D0D4tKm","sMfSqwO","x2rLyNvN","AfH0qLi","Cujhugi","Bg9N","vKHpwhm","rvvbChm","yu9cAhy","rhzbrM4","s0zutfm","ywX3yxLZ","EfzuvNG","mtmWnZiWnxvTDwLqqq","qNDJDKy","AwXSihvZzsa","zw5JB2rPBMC","DhLWzq","DejyB2u","txHHzMe","s0DsDe4","wvrhwxG","wKLzvvu","CgfNzxnOB3C"];return Ln=function(){return r},Ln()}var E=k;(function(r,e){let i=k,a=r();for(;;)try{if(parseInt(i(1376))/1*(parseInt(i(1195))/2)+parseInt(i(719))/3*(parseInt(i(1695))/4)+-parseInt(i(566))/5+parseInt(i(1241))/6*(parseInt(i(1154))/7)+-parseInt(i(1699))/8+-parseInt(i(1980))/9+parseInt(i(494))/10===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Ln,657789);var Lx=Object[E(576)+E(1675)],Bx=Object[E(1294)+E(657)+E(972)],ki=(r,e)=>function(){return r&&(e=(0,r[{nIrnd:function(f,l){return f(l)}}[E(917)](Bx,r)[0]])(r=0)),e},Ox=(r,e)=>{let i=E,a={xVgrz:function(f,l,h,m){return f(l,h,m)}};for(var x in e)a[i(1331)](Lx,r,x,{get:e[x],enumerable:!0})};function zx(){return vi||(vi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Mx(){let r=E;return Si||(Si=[IDBCursor.prototype[r(1860)],IDBCursor[r(535)+"e"][r(541)],IDBCursor[r(535)+"e"]["continue"+r(589)+"ey"]])}function qx(r){let e=E,i={rijzB:e(1509),FxncP:function(x,f){return x(f)},kTiqL:function(x){return x()},UZYhv:function(x,f){return x!==f},WRGya:e(1870),UjfMU:e(2081),QAcBW:function(x,f){return x-f},WFfgO:function(x,f){return x instanceof f}},a=new Promise((x,f)=>{let l=e,h={FWVuq:function(b,D){return i.QAcBW(b,D)}},m=()=>{let b=k;r[b(775)+"entListe"+b(1232)](i[b(532)],y),r[b(775)+"entListener"](b(586),S)},y=()=>{let b=k;i[b(2005)](x,Te(r.result)),i[b(2110)](m)},S=()=>{let b=k;if(i[b(583)](i[b(987)],i[b(1224)]))i[b(2005)](f,r[b(586)]),m();else{let D=_0x5d6360.substring(0,h[b(1437)](4,_0x4e1bad[_0x4e5f20].length)),R=D[b(1491)](_0x4299d0[_0x5865e4]);_0x3af903[b(1560)](R)}};r[l(697)+"Listener"]("success",y),r[l(697)+l(840)]("error",S)});return a.then(x=>{let f=e;i[f(672)](x,IDBCursor)&&Dr[f(794)](x,r)})[e(2085)](()=>{}),On.set(a,r),a}function Kx(r){let e=E,i={AycuX:function(x,f){return x===f},ILXyf:e(1737),kyXPv:e(916),jGHAj:"complete",GxPpb:e(586),vvFLi:e(1997),nRJto:function(x,f){return x(f)},znYKV:e(1729)+"or",jRRbt:function(x){return x()},nHNwt:function(x,f){return x(f)},bbRzw:function(x){return x()},YTGYx:"abort"};if(Bn[e(1452)](r))return;let a=new Promise((x,f)=>{let l=e,h={XyIOs:function(b){return i[k(1439)](b)},hfltx:function(b,D){return i.nHNwt(b,D)},eLWqj:function(b){return i[k(1341)](b)}},m=()=>{let b=k;if(i[b(1233)](i[b(666)],i[b(1946)]))return this[b(1418)][b(1845)+"ns"];r[b(775)+"entListe"+b(1232)](i[b(1528)],y),r[b(775)+b(1077)+"ner"](i[b(816)],S),r[b(775)+b(1077)+b(1232)](b(1523),S)},y=()=>{let b=k;x(),h[b(1365)](m)},S=()=>{let b=k;i[b(1233)](i[b(2013)],i[b(2013)])?(i[b(1207)](f,r[b(586)]||new DOMException(b(1729)+"or",i.znYKV)),i[b(1439)](m)):(this[b(499)]=!1,h[b(1303)](_0x211246,this[b(1348)+"ionTimeo"+b(1076)]),h[b(1539)](_0x3288d6))};r["addEvent"+l(840)](i[l(1528)],y),r[l(697)+l(840)](i[l(816)],S),r[l(697)+l(840)](i[l(1988)],S)});Bn.set(r,a)}function Ux(r){zn={WCdfc:function(a,x){return a(x)}}[E(1042)](r,zn)}function Fx(r){let e=E,i={CLJxi:"going away, try "+e(2118)+e(1133)+e(822),FnIqa:function(a,x){return a(x)},iBHty:e(1895),GVHKA:e(741),ulapm:e(1760),EHbJl:e(1602),xEXBj:"getKey",urhTK:e(1271),ELQzb:e(1952),OCfvu:function(a){return a()},sCaiH:"PzujE",EOiZt:function(a,x){return a(x)},qOebT:function(a,x){return a<x},XcxjE:function(a,x){return a===x},HKrXG:"DHpjU",oOcNh:function(a,x){return a(x)},aRlBq:function(a,x){return a===x},uJYhd:function(a,x){return a in x},sbbGL:e(914)+e(713),JcmbB:function(a,x){return a===x},rcczC:e(1971),PXnNH:e(639)};if(i[e(1778)](r,IDBDatabase[e(535)+"e"]["transact"+e(1676)])&&!i[e(1320)](i.sbbGL,IDBTransaction[e(535)+"e"]))if(i.JcmbB(i.rcczC,i[e(1834)])){if(!this[e(1013)+e(1217)]()||this[e(1514)+e(1683)])return;this[e(1272)+e(773)]?.[e(695)+e(1084)+"fig"](),this[e(1179)+"sCounter"]?.[e(1773)+e(977)](),this[e(1270)]?this._disconnect(1001,i.CLJxi,!0):this[e(1348)]()}else return function(a,...x){let f=e,l=r[f(863)](i.FnIqa(Ht,this),a,...x);return kr.set(l,a.sort?a[f(522)]():[a]),Te(l)};return i[e(1150)](Mx)[e(1250)](r)?function(...a){let x=e;if(x(1198)===i[x(1095)])return r[x(1507)](i[x(1177)](Ht,this),a),i.EOiZt(Te,Dr[x(1602)](this));{let f=("4|5|2|0|"+x(1855))[x(742)]("|"),l=0;for(;;){switch(f[l++]){case"0":_0x2578b2=[i.iBHty,i[x(1443)],i[x(1123)],x(1401)];continue;case"1":_0x3c241c(h=>({...h,get:(m,y,S)=>_0x52f089(m,y)||h[x(1602)](m,y,S),has:(m,y)=>!!_0x4cb7ff(m,y)||h.has(m,y)}));continue;case"2":_0x20ad14=[i[x(2097)],i[x(1321)],i[x(915)],"getAllKeys",i[x(1328)]];continue;case"3":_0x485834=new _0x387a18;continue;case"4":_0x4fdea9();continue;case"5":i[x(1150)](_0x186aa8);continue}break}}}:function(...a){let x=e;if(i[x(642)](i[x(1152)],x(1469))){let f=this[x(1723)+"rs"][_0x486a34];if(f)for(let l=0;i.qOebT(l,f[x(1929)]);)f[l].fn===_0x4a23c6?f[x(1378)](l,1):++l}else return i[x(680)](Te,r[x(1507)](Ht(this),a))}}function Hx(r){let e=E,i={FyvkM:function(a,x){return a===x},lgnMo:"function",FAeRF:function(a,x){return a instanceof x},sQTPH:function(a,x){return a(x)},fPznW:function(a,x,f){return a(x,f)},RyMqk:function(a){return a()}};return i.FyvkM(typeof r,i[e(2063)])?Fx(r):(i.FAeRF(r,IDBTransaction)&&i.sQTPH(Kx,r),i[e(1488)](Di,r,i[e(1880)](zx))?new Proxy(r,zn):r)}function Te(r){let e=E,i={vAkaZ:function(x,f){return x instanceof f},kMPid:function(x,f){return x(f)},sYrRh:function(x,f){return x(f)},KTJrH:function(x,f){return x!==f}};if(i.vAkaZ(r,IDBRequest))return i[e(854)](qx,r);if(Rn.has(r))return Rn[e(1602)](r);let a=i[e(497)](Hx,r);return i[e(1030)](a,r)&&(Rn.set(r,a),On[e(794)](a,r)),a}var Di,vi,Si,Dr,Bn,kr,Rn,On,zn,Ht,Ei=ki({"node_modules/idb/build/wrap-idb-value.js"(){let r=E,e={XKDJS:function(i,a){return i instanceof a},fLXYn:function(i,a){return i===a},LoYbf:r(571),wYbnD:r(886),Bhkdu:function(i,a){return i===a},enTOv:r(1502),UAjWk:function(i,a){return i===a},AYLAf:function(i,a){return i in a}};Di=(i,a)=>a.some(x=>i instanceof x),Dr=new WeakMap,Bn=new WeakMap,kr=new WeakMap,Rn=new WeakMap,On=new WeakMap,zn={get(i,a,x){let f=r,l={gEuew:function(h){return h()}};if(e[f(668)](i,IDBTransaction))if(e.fLXYn(e[f(2099)],e.LoYbf)){if(a===e.wYbnD)return Bn.get(i);if(e[f(1144)](a,"objectStoreNames"))return i[f(914)+"oreNames"]||kr.get(i);if(e[f(882)](a,e.enTOv))return x[f(914)+f(713)][1]?void 0:x[f(914)+"ore"](x[f(914)+f(713)][0])}else _0xf043c(),FSRWfE[f(1515)](_0x1464be);return Te(i[a])},set(i,a,x){return i[a]=x,!0},has(i,a){let x=r;return i instanceof IDBTransaction&&(e.Bhkdu(a,e[x(864)])||e[x(1709)](a,e[x(1527)]))?!0:e[x(2090)](a,i)}},Ht=i=>On[r(1602)](i)}}),Pi={};Ox(Pi,{deleteDB:()=>Gx,openDB:()=>jx,unwrap:()=>Ht,wrap:()=>Te});function jx(r,e,{blocked:i,upgrade:a,blocking:x,terminated:f}={}){let l=E,h={jCyMO:function(S,b,D,R,N){return S(b,D,R,N)},ILzgp:function(S,b){return S(b)},bOPuq:l(1820),KhkKy:"versionc"+l(715),PVPwR:function(S,b){return S(b)},WRtvP:l(2028)+l(1656),uogbm:"blocked"},m=indexedDB.open(r,e),y=h.PVPwR(Te,m);return a&&m[l(697)+l(840)](h[l(1642)],S=>{let b=l;h[b(644)](a,h[b(1758)](Te,m[b(1917)]),S[b(1701)+"on"],S[b(943)+"on"],Te(m["transact"+b(1676)]))}),i&&m[l(697)+"Listener"](h.uogbm,()=>i()),y.then(S=>{let b=l;f&&S[b(697)+"Listener"](h[b(1046)],()=>f()),x&&S[b(697)+b(840)](h.KhkKy,()=>x())})[l(2085)](()=>{}),y}function k(r,e){r=r-493;let i=Ln(),a=i[r];if(k.oOBqHE===void 0){var x=function(m){let y="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",S="",b="";for(let D=0,R,N,L=0;N=m.charAt(L++);~N&&(R=D%4?R*64+N:N,D++%4)?S+=String.fromCharCode(255&R>>(-2*D&6)):0)N=y.indexOf(N);for(let D=0,R=S.length;D<R;D++)b+="%"+("00"+S.charCodeAt(D).toString(16)).slice(-2);return decodeURIComponent(b)};k.EhXxTz=x,k.GmKFKS={},k.oOBqHE=!0}let f=i[0],l=r+f,h=k.GmKFKS[l];return h?a=h:(a=k.EhXxTz(a),k.GmKFKS[l]=a),a}function Gx(r,{blocked:e}={}){let i=E,a={mgXoj:function(f,l){return f(l)}},x=indexedDB[i(1071)+"tabase"](r);return e&&x[i(697)+"Listener"](i(980),()=>e()),a[i(636)](Te,x)[i(1486)](()=>{})}function Ci(r,e){let i=E,a={yfbli:function(m,y,S){return m(y,S)},cISqZ:function(m,y,S){return m(y,S)},NWAAL:function(m,y){return m(y)},IkQJu:i(1114)+"e",VxrNx:i(1666),tBXoe:function(m,y){return m in y},DnJtv:function(m,y){return m===y},MxBKu:i(827)};if(!(r instanceof IDBDatabase&&!a[i(1985)](e,r)&&a[i(1023)](typeof e,i(1600)))){if(a[i(1094)]===a.MxBKu)return;a[i(1140)](_0xbcc55f,_0x3c13e5,24),a[i(1598)](_0x59e8a9,_0xafaf4b,a.NWAAL(_0x2e2110,_0x84d773))}if(Nn[i(1602)](e))return Nn[i(1602)](e);let x=e[i(986)](/FromIndex$/,""),f=e!==x,l=Ii[i(1250)](x);if(!a.tBXoe(x,(f?IDBIndex:IDBObjectStore).prototype)||!(l||Ti.includes(x)))return;let h=async function(m,...y){let S=i,b=this["transact"+S(1676)](m,l?a[S(1342)]:a[S(1684)]),D=b[S(1502)];return f&&(D=D[S(862)](y[S(1747)]())),(await Promise[S(1012)]([D[x](...y),l&&b[S(886)]]))[0]};return Nn[i(794)](e,h),h}var Ti,Ii,Nn,Wx=ki({"node_modules/idb/build/index.js"(){let r=E,e={OcqBT:r(1836)+r(1660),oyzpm:"clear",IdevE:function(x){return x()},DUhEn:r(1390),IKekc:"getAll",ZLGIe:r(820)+"ys",CsuMD:r(1952)},i=e.OcqBT[r(742)]("|"),a=0;for(;;){switch(i[a++]){case"0":Ii=[r(1895),r(741),r(1760),e[r(1945)]];continue;case"1":Nn=new Map;continue;case"2":Ux(x=>({...x,get:(f,l,h)=>Ci(f,l)||x[r(1602)](f,l,h),has:(f,l)=>!!Ci(f,l)||x[r(1452)](f,l)}));continue;case"3":e[r(1776)](Ei);continue;case"4":e.IdevE(Ei);continue;case"5":Ti=[r(1602),e[r(1690)],e[r(1615)],e[r(1557)],e[r(1101)]];continue}break}}}),Jx={idb:function(r){let e=E;r[e(1548)]=Promise[e(1020)]().then(()=>(Wx(),Pi))[e(1486)](function(i){return i})}},Ai={};function Pe(r){let e=E,i={iImxb:function(f,l){return f!==l}};var a=Ai[r];if(i[e(1494)](void 0,a))return a[e(1548)];var x=Ai[r]={exports:{}};return Jx[r](x,x[e(1548)],Pe),x.exports}(()=>{let r=E,e={cOmSm:function(i,a){return i+a},eniid:function(i,a){return i!==a},OGpmo:r(1393)};Pe.d=(i,a)=>{let x=r,f={BHZTl:function(h,m){return e[k(1227)](h,m)}};if(e[x(1091)](e[x(1215)],e[x(1215)])){let h=_0x593b97(_0xf266bc,_0x373d58);return _0x16fff6[x(1032)][x(777)](h,f[x(920)](h,_0xf9f9e8))}else for(var l in a)Pe.o(a,l)&&!Pe.o(i,l)&&Object.defineProperty(i,l,{enumerable:!0,get:a[l]})}})(),(()=>{let r=E;Pe.o=(e,i)=>Object.prototype[r(703)+r(1675)][r(863)](e,i)})(),(()=>{let r=E,e={NLyUz:r(708)+"d",KtsTw:r(1500),wGxNC:r(1963)+"le"};Pe.r=i=>{let a=r;e[a(1162)]!=typeof Symbol&&Symbol.toStringTag&&Object[a(576)+a(1675)](i,Symbol[a(849)+"Tag"],{value:e[a(1639)]}),Object[a(576)+a(1675)](i,e[a(1967)],{value:!0})}})();var Q={};(()=>{let r=E,e={vsCMW:function(s,t){return s(t)},QdBpT:function(s,t){return s+t},hXtBR:function(s,t){return s+t},Ophfu:function(s,t){return s+t},OaJTJ:function(s,t){return s+t},XJwvn:function(s,t){return s(t)},UuLZA:function(s,t,n){return s(t,n)},RWNsA:r(1477),jcWUX:function(s,t){return s(t)},HHKVN:function(s,t){return s+t},kKmGj:function(s,t){return s+t},bkSmS:r(1458),aTNjt:r(1309),szXjl:r(1738)+r(1738)+r(1738)+r(1738),PgKMD:function(s,t){return s+t},WRLWn:function(s,t){return s+t},iGdXt:function(s,t){return s>t},UNKDo:function(s,t){return s<t},PvTor:function(s,t){return s!==t},grKGZ:r(1330),nGqIG:function(s,t){return s<t},ndmNv:function(s,t){return s-t},DIiKb:function(s,t){return s===t},igZMj:r(625),tfxYo:function(s,t){return s<t},Gnclc:function(s,t){return s!==t},kWNnd:function(s,t,n){return s(t,n)},bVret:function(s,t){return s!==t},RvpgZ:r(1266),ObAEc:function(s,t){return s|t},ryTTM:function(s,t){return s===t},zyJHK:"wzUsT",uUsyz:"Kkdtx",NnnSE:function(s,t){return s(t)},pMlmH:function(s,t){return s>>>t},BUBKG:function(s,t){return s(t)},CSVEl:function(s,t){return s(t)},hNhWQ:r(1906)+"required"+r(1147)+r(873),Verko:r(1906)+"required"+r(1147)+r(1584),XNGfA:function(s,t){return s&t},qceeB:function(s){return s()},TgKNl:function(s,t){return s(t)},wCkiH:"success",NlLtp:r(586),KQyaR:function(s,t){return s(t)},RCDjp:function(s){return s()},gRhLZ:r(1281),ACkoT:"open",DKnrv:r(1820),nFVok:function(s,t,n,o){return s(t,n,o)},YyifV:function(s,t){return s!==t},oOUKK:"DakMR",kFzNt:function(s,t,n){return s(t,n)},fuhYN:function(s,t,n){return s(t,n)},SWhXD:function(s,t){return s(t)},PzDBy:function(s,t){return s!==t},vpIiD:function(s,t,n){return s(t,n)},LUqzH:function(s){return s()},JlUjs:function(s,t,n){return s(t,n)},JbFsS:function(s,t){return s(t)},HEyJs:function(s,t,n){return s(t,n)},ezVtG:function(s,t){return s!==t},Ueywi:function(s,t){return s!==t},bLJrI:r(645),Totts:r(868),fKaxg:function(s,t,n){return s(t,n)},GHrAN:function(s,t,n){return s(t,n)},fjRVM:function(s,t){return s!==t},whVDS:function(s,t,n){return s(t,n)},DRruP:function(s,t){return s!==t},GQRwZ:r(760),cvOSm:"OTvaM",crXUI:function(s,t,n){return s(t,n)},cdTEm:function(s,t,n){return s(t,n)},zFAxn:function(s,t,n){return s(t,n)},TqFTS:function(s,t,n){return s(t,n)},PPnuF:function(s,t){return s(t)},blncv:function(s,t){return s(t)},cPgoX:function(s,t,n){return s(t,n)},AMtVj:function(s,t){return s(t)},GzoVy:function(s,t){return s(t)},zVkBX:function(s,t){return s(t)},WsWrE:function(s,t,n){return s(t,n)},Luvdx:function(s,t){return s(t)},hyHdV:function(s,t,n){return s(t,n)},PmETG:function(s,t){return s(t)},PTifx:function(s,t){return s(t)},gavEX:function(s,t,n){return s(t,n)},QrcDG:function(s,t){return s(t)},ARQZB:function(s,t){return s&t},BsWBi:"Missing "+r(1923)+r(1147)+r(1115),WAKPW:function(s,t){return s===t},btLoe:"Missing "+r(1923)+r(1147)+r(1121),dHkRD:r(1906)+r(1923)+r(1147)+"service",eCDWl:r(1906)+r(1923)+" field: "+r(1947),VKJlE:function(s,t,n){return s(t,n)},WCcIL:r(1073)+r(1090)+r(1438),xNVWT:function(s,t){return s>>t},BDpYu:function(s,t){return s>=t},aXoOz:r(921)+r(648),xcAqw:function(s,t,n){return s(t,n)},hWtBb:function(s,t){return s!==t},SIotg:r(1519),LvFzy:function(s,t){return s+t},xfJik:r(1585),gdTlq:function(s,t){return s*t},ejnlW:function(s,t){return s>t},hJxaY:function(s,t){return s+t},rVkDe:r(654)+"t limit",PotUF:function(s,t,n){return s(t,n)},VLzzD:function(s,t){return s+t},bhvZZ:function(s,t){return s(t)},YWwkG:"unknown "+r(942),SkPdk:r(935),ySvhC:r(1951),Vikbk:function(s,t,n){return s(t,n)},dwvhQ:function(s,t){return s|t},rBRDV:function(s,t){return s<<t},HTzgb:function(s,t){return s<t},kjvAy:r(2115),WaMzM:r(1456),QmYPV:function(s,t){return s+t},SNNWO:function(s,t){return s&t},dwXvK:function(s,t){return s(t)},Hmrgb:function(s,t){return s+t},rSJuH:function(s,t){return s&t},dGQVx:function(s,t){return s&t},PDzYP:function(s,t){return s<t},qRuVi:function(s,t){return s(t)},idsNW:function(s,t){return s==t},CzXdB:function(s,t){return s&t},omLuS:function(s,t){return s>=t},aWpgQ:function(s,t){return s+t},qiDkI:function(s,t){return s|t},qPLEP:function(s,t){return s|t},sAZQF:function(s,t){return s&t},LVlvi:function(s,t){return s&t},rOJCP:function(s,t){return s<t},urEbu:function(s,t){return s<=t},reDQK:function(s,t){return s+t},NWgdL:function(s,t){return s+t},DJeNS:function(s,t){return s|t},CzNlU:function(s,t){return s<<t},WpfEi:function(s,t,n){return s(t,n)},DerKY:function(s,t){return s&t},CYspf:r(2118)+"t",sLVvp:r(1563),OZRnk:function(s,t){return s<t},TJMpn:function(s,t){return s<t},vBwJf:function(s,t){return s<t},wetbb:function(s,t,n){return s(t,n)},psqRc:function(s,t){return s<<t},GigBA:r(1754),KYWJj:function(s,t){return s<t},NTANF:function(s,t){return s>>t},tIJik:function(s,t){return s|t},eXwBZ:function(s,t){return s&t},daXtI:function(s,t){return s|t},fWjLp:function(s,t){return s&t},PFhbh:function(s,t){return s|t},rJAuD:function(s,t){return s&t},emSyc:function(s,t){return s&t},SwgVH:function(s,t){return s<t},dnRwV:function(s,t){return s<t},AGtgA:function(s,t){return s<<t},NamGf:function(s,t){return s&t},arRTY:function(s,t){return s&t},bpIrL:function(s,t){return s>=t},jIRRH:function(s,t,n){return s(t,n)},KBMTA:function(s,t){return s(t)},juXkB:function(s,t){return s||t},jWKWL:function(s,t){return s&t},puitP:function(s,t){return s>>>t},hQJLa:r(1413),xbpAW:function(s,t){return s(t)},VdZbR:r(1698),dXjTn:function(s,t){return s&t},NAVtm:function(s,t){return s<<t},LBfkF:r(1740),XjsSL:r(1646),FqGYW:function(s,t){return s<<t},punJp:r(1083),IxDnC:function(s,t){return s&t},ucyet:function(s,t){return s<<t},Noiae:function(s,t){return s&t},AimZY:function(s,t){return s&t},mlJdN:function(s,t){return s&t},ngbRf:function(s,t){return s(t)},VOqMU:function(s,t){return s&t},hcgol:function(s,t){return s&t},ElDKk:function(s,t){return s|t},YRymZ:function(s,t){return s>>>t},bWGoZ:function(s,t){return s|t},QQNEu:function(s,t){return s===t},yeEhv:function(s,t){return s+t},wXuNV:function(s,t){return s&t},UwzgB:function(s,t){return s+t},iiCRN:function(s,t){return s|t},iQZYo:function(s,t){return s&t},ngjEb:function(s,t){return s!==t},tvpme:function(s,t){return s&t},IhiMG:function(s,t){return s>>>t},HcCjT:function(s,t){return s+t},OPZWr:function(s,t){return s>>>t},uiEwB:function(s,t){return s&t},JGkZo:function(s,t){return s|t},oKqcj:function(s,t){return s|t},dFyLm:function(s,t){return s>>>t},KCkex:function(s,t){return s&t},wTzOz:function(s,t){return s|t},HFkcm:function(s,t){return s&t},KqDzQ:function(s,t){return s&t},WRhfU:r(1561),euVVV:function(s,t){return s|t},rhkwn:r(798),bnHdA:r(1168),TNpHR:function(s,t){return s===t},GFYtT:r(1529),VSYHw:function(s,t){return s|t},VDOPD:function(s,t){return s|t},arhUx:function(s,t){return s<<t},XETik:function(s,t){return s<<t},jCmlm:function(s,t){return s<<t},ETVfJ:function(s,t){return s|t},pmMbW:function(s,t){return s<<t},ZCfJB:function(s,t){return s<<t},bGMvX:function(s,t){return s<<t},CcRKJ:function(s,t){return s|t},CCXTm:function(s,t){return s<<t},gqykZ:function(s,t){return s|t},AGSkh:function(s,t){return s<<t},vbopt:function(s,t){return s|t},zIKbe:function(s,t){return s|t},qjBnv:function(s,t){return s<<t},lcErk:function(s,t){return s<<t},LpURQ:function(s,t){return s>>>t},HPLdU:function(s,t){return s|t},Ejwti:function(s,t){return s|t},mTZIg:function(s,t){return s&t},pPqlN:function(s,t){return s>>>t},sKBae:function(s,t){return s&t},uaJQY:function(s,t){return s>>>t},dvplE:function(s,t){return s>>>t},hsGas:function(s,t){return s(t)},dyVdi:function(s,t){return s>=t},SwvgJ:function(s,t){return s|t},aTmmC:function(s,t){return s%t},KsvWI:function(s,t){return s>>>t},WigSV:function(s,t){return s>>>t},xmpla:function(s,t){return s*t},gqwRY:function(s,t){return s===t},cDKVY:function(s,t){return s&t},TVWaq:function(s,t){return s>>>t},gPHqo:function(s,t){return s&t},Eyoyd:function(s,t){return s&t},aYrch:function(s,t){return s+t},jjKnB:function(s,t){return s>>>t},VaOvY:function(s,t){return s>>>t},FkwLj:function(s,t){return s<<t},ZmJvM:function(s,t){return s|t},hynVD:function(s,t){return s===t},HMhsl:function(s,t){return s===t},OaNEu:function(s,t){return s===t},uxpEX:function(s,t,n){return s(t,n)},HlmPv:"lnkyK",SLTor:r(1181),OunBf:function(s,t){return s===t},Ohivd:function(s,t){return s===t},xnMfZ:function(s,t){return s+t},huKqo:function(s,t){return s+t},cfqiv:function(s,t){return s>>>t},xZCsh:function(s,t){return s&t},LZZuX:function(s,t){return s>>>t},aEMAh:function(s,t){return s&t},Ldbxg:function(s,t){return s>>>t},KQEWh:function(s,t){return s&t},zQwIZ:function(s,t){return s>>>t},beyea:function(s,t){return s&t},dWrUf:r(1549)+r(517),NPufJ:r(1669)+"NG_ERROR",mJkJa:"MAX_RETR"+r(1326)+"R",NwLRF:r(1113)+r(1335),wZosG:r(2094)+"OR",hsXoe:r(524),BhzeM:"4|5|1|2|"+r(1668),wouWz:function(s,t){return s|t},UMKPF:function(s,t){return s&t},NrLIh:function(s,t){return s&t},znMlF:function(s,t){return s!==t},WSeJV:"citcT",WKijB:r(973),peEIB:r(635)+r(1816),Kxlhz:r(774)+"0",WWLvD:r(1214)+"ediately"+r(832)+"ct",OldqI:r(1263),nIcXP:function(s,t){return s<=t},ljpzi:function(s,t){return s>=t},OkrdT:function(s,t){return s<<t},SnLlc:function(s,t){return s&t},lYerr:function(s,t){return s|t},cWiEw:function(s,t){return s&t},EZVaF:function(s,t){return s<<t},lvWDK:function(s,t){return s+t},ZTwtR:function(s,t){return s!==t},CwnzH:"gWwMM",ACzwG:r(1082),ioDqr:function(s,t){return s===t},OtlqY:r(880),PsOaD:function(s,t){return s>=t},VBcbC:r(1229)+r(1597)+r(1358)+"0",uzrKM:function(s,t){return s<t},bpBHq:function(s,t,n,o){return s(t,n,o)},ieHUL:function(s,t){return s|t},uOWbj:function(s,t){return s>>>t},ZIYUU:function(s,t){return s|t},pGkGU:function(s,t){return s<t},BHEad:function(s,t){return s|t},tHqmc:function(s,t){return s|t},NhXjC:function(s,t){return s&t},czvYy:function(s,t){return s===t},DYwLp:function(s,t){return s+t},yhWKq:function(s,t){return s+t},ngIuQ:function(s,t){return s===t},cjTyP:function(s,t,n){return s(t,n)},EypGz:function(s,t){return s!==t},hhTyU:r(1367),UEVJw:r(496),hlvqI:function(s,t,n){return s(t,n)},dwrqV:r(1734)+"id",TXEoB:function(s,t){return s!==t},LzBYN:r(2114),PuKEw:function(s,t,n){return s(t,n)},PHrsU:function(s,t,n){return s(t,n)},nCMLn:function(s,t){return s===t},fgeSR:"mSUju",IePYp:function(s,t,n){return s(t,n)},amiyf:function(s,t){return s instanceof t},Bagka:r(1002),iqVay:function(s,t){return s>>t},rFBWZ:function(s,t){return s>=t},iQFKq:function(s,t){return s!==t},FvRgO:r(1363),roEPd:r(708)+"d",ZIGvQ:"2|3|0|1|4",qqZxz:function(s,t){return s!=t},KFTLS:function(s,t){return s<t},EOedw:function(s,t){return s<t},GzRhy:function(s,t){return s===t},SGBtO:function(s,t){return s&t},zlGwS:function(s,t){return s+t},JNRIu:r(2112),jQNRX:"next() c"+r(1431)+r(1924)+r(1497)+r(877),fruMn:function(s,t){return s(t)},ZElca:function(s,t){return s===t},PJBtW:function(s,t){return s&t},KTeJD:function(s,t){return s-t},PzAsF:function(s,t){return s<t},nTzCu:function(s,t){return s|t},TVtkU:function(s,t){return s<<t},UnbAa:function(s,t){return s|t},KvKrp:function(s,t){return s|t},klxyH:function(s,t){return s<<t},HSYXH:function(s,t){return s&t},AZDUC:function(s,t){return s&t},yEdXn:function(s,t){return s&t},Saxzx:function(s,t){return s===t},SwzhG:r(1672),IIGFu:r(1727),kNVul:function(s,t){return s|t},kJUwZ:function(s,t){return s|t},ENiXR:function(s,t){return s>>t},gQgSd:function(s,t){return s&t},FodRO:function(s,t){return s+t},BhgTE:"4|1|5|2|0|3",mrEpw:function(s,t){return s&t},BGanU:function(s,t){return s>>t},ekgkv:function(s,t){return s|t},vbsYU:function(s,t){return s<<t},SNYrs:function(s,t){return s&t},uYvQd:function(s,t){return s|t},IdGyw:function(s,t){return s>>t},RbnTH:function(s,t){return s&t},LCGkK:r(1600),WAocZ:function(s,t){return s(t)},KRmsn:function(s,t,n,o){return s(t,n,o)},PCEvo:function(s,t){return s instanceof t},OtKpp:function(s,t){return s==t},TiQSC:r(1815)+r(545)+r(1542),DOGTU:r(1350),lYFxN:"ppe",xWFvi:"TMILf",DRDUM:function(s,t){return s!==t},gksgI:r(562),jTIJd:r(1710),rncjC:r(1703),eXLyc:r(2062)+"ack=fron"+r(2111)+"P",LgCnV:function(s,t){return s(t)},KGRtN:r(2017),LPfMz:function(s,t,n,o){return s(t,n,o)},jfIgj:function(s,t){return s===t},szqDF:r(879),JalAj:function(s,t){return s!==t},NKaYj:r(1799),uIMKW:function(s,t){return s<<t},YWkHb:function(s,t){return s|t},VIXzU:function(s,t){return s<<t},ToOvn:function(s,t){return s!==t},Dohev:r(1832),UUlfi:r(2092),bjyMn:function(s,t){return s===t},vDIsn:r(857),duaUk:r(1999),QvRmS:r(1151),hspkM:function(s,t){return s||t},ciAQr:r(1432),JEcez:r(847),xUGel:"pageshow",uohDP:r(1551),rdpAk:function(s,t){return s||t},jEqXf:function(s,t){return s||t},KTBPz:r(1273),YcZdb:r(836),uhsYg:"received",lqnlu:r(1462),NRJIx:function(s,t){return s!==t},DonXI:r(1650),YLEcU:r(2029),bOobA:function(s,t){return s||t},hbdGK:function(s,t){return s||t},Vhqkz:function(s,t){return s||t},RXOXt:function(s,t){return s!=t},kMXbG:function(s,t){return s*t},SsGKy:function(s,t){return s===t},FrVHs:r(1743),tAbfq:function(s,t){return s(t)},lrHzU:r(1648),QHCPn:function(s,t){return s(t)},ITNDy:function(s,t){return s<t},IQzhy:r(544),DHWcn:function(s,t){return s>t},weMCa:function(s,t){return s!==t},IwEoq:r(1027),EpSQD:function(s,t,n,o){return s(t,n,o)},ZuNdn:r(1450)+r(1858),BOCMI:function(s,t,n,o){return s(t,n,o)},hiVxd:r(1450)+"er_is_ack",BJsJx:function(s,t,n){return s(t,n)},uhVwJ:r(1450)+r(1516)+r(1026),DdeeB:function(s,t,n,o){return s(t,n,o)},QIXJq:r(687),idlQY:function(s,t){return s&&t},Adryf:r(870),GMhPX:function(s,t){return s||t},VeKif:r(1043),dSejO:function(s,t){return s(t)},cvVHr:function(s,t){return s instanceof t},XIVTe:r(1495)+r(1510),lJhdI:r(1495)+r(1510)+r(1436)+r(1311),QpNlc:"none_none",lHXRs:r(959),wpiKm:function(s,t){return s+t},dyOiS:function(s,t){return s&t},eRsoI:function(s,t){return s>>>t},ZMfkr:function(s,t){return s>>>t},khOtk:function(s,t){return s<<t},rUzGF:r(1846),OtZGG:"OHGPf",VMBmR:function(s,t){return s(t)},rIAOs:function(s,t){return s+t},ZaEWg:function(s,t){return s+t},xZnaR:function(s,t){return s+t},jaFzX:function(s,t){return s+t},gViqQ:function(s,t){return s+t},aOkKN:"index ou"+r(2002)+"ge: ",mYgqG:r(1859),MulER:function(s,t){return s||t},QkgVu:r(1682),bHqZG:r(1339)+"3",vWTtK:function(s,t){return s!=t},FSHRm:r(618)+"too large",IqrfN:r(861),qaBIr:function(s,t,n){return s(t,n)},mwTji:function(s,t){return s+t},KlTYk:function(s,t){return s<t},xGAuN:r(505),poxCF:"CyEVJ",SCCFO:r(2001),smXBC:r(850)+"4",HcVXx:function(s,t){return s<t},yNSZN:function(s,t){return s+t},tWSXg:function(s,t,n,o){return s(t,n,o)},CIAXe:function(s,t){return s+t},Fqkrh:function(s,t){return s<<t},EWLzB:function(s,t){return s+t},eDAco:function(s,t){return s<<t},Awbcf:function(s,t){return s+t},TPULV:function(s,t){return s+t},rUSuC:function(s,t){return s|t},hjHJf:function(s,t){return s<<t},aYAUe:function(s,t){return s+t},poOPI:function(s,t){return s<<t},kBfuS:"RFEKr",vqrMI:function(s,t){return s>>>t},rpNmK:function(s,t){return s+t},BDoRP:function(s,t){return s+t},oISVC:function(s,t){return s+t},kODZW:function(s,t){return s&t},cmmot:function(s,t){return s>>>t},XtnVv:function(s,t){return s+t},RwEmN:function(s,t){return s&t},UqnrF:function(s,t){return s+t},jqHhv:function(s,t){return s+t},TeBHY:r(1622)+r(1667)+"5|3|4|6|0",rFXso:function(s,t){return s|t},OGEia:function(s,t){return s|t},noxnJ:function(s,t){return s<t},Shvme:function(s,t){return s|t},nlzTs:function(s,t){return s>t},YPqlp:function(s,t,n,o){return s(t,n,o)},hVPbI:function(s,t){return s<<t},RjcWB:function(s,t){return s>>>t},mWnWV:function(s,t){return s>>>t},XType:function(s,t){return s&t},yAoGK:function(s,t){return s|t},XKqWU:"nERQv",ELuni:function(s,t,n,o){return s(t,n,o)},GExAB:r(1397),mesuc:function(s,t){return s(t)},ltATr:r(1325)+"ile_name",aLbrQ:function(s,t,n,o){return s(t,n,o)},BvoSo:r(1632),NMtIo:r(975)+"_EXIST",tfxkB:function(s,t,n){return s(t,n)},kpXTg:r(1750)+"rValues",gDFNI:r(1712),bbRoC:function(s,t,n,o){return s(t,n,o)},KUJNX:r(547),vLnQm:"CONTINUE",oFezj:r(911),NXZzM:function(s,t){return s(t)},HNpSn:r(1940)+"r",NYKtK:r(834),GJXSJ:function(s,t){return s||t},iXinn:r(579),zllHX:r(592),zfDIX:function(s,t){return s||t},xVTVx:"code",nhcyH:r(1005),MGrGn:r(1450)+r(910),elNXR:function(s,t){return s(t)},vEIQT:function(s,t,n){return s(t,n)},yNERC:r(1450)+r(1720),PPOVq:r(1034)+"s",amGcH:r(962)+r(1680)+"e",GCTVa:function(s,t){return s(t)},VkVou:function(s,t){return s>t},GBbPm:"jSFED",LzJJQ:function(s,t){return s===t},YIclb:r(985),nFRcV:r(768),sveIN:function(s,t){return s+t},kIsyw:function(s){return s()},Mrcei:r(1087),lEJCN:r(1986),gqcLk:function(s){return s()},jcChM:function(s,t){return s!==t},cBRRr:r(2103),jHxYB:function(s){return s()},VTZFR:function(s){return s()},ESaWU:function(s,t){return s&&t},ndJLw:function(s){return s()},XuRof:function(s,t){return s===t},gqPpK:r(1472),mWSYN:function(s,t){return s!==t},VQwWW:"VcDRQ",GBJdy:"ruQTs",aoWYo:function(s,t){return s!==t},xmVkB:r(1592),gZKMy:function(s,t,n){return s(t,n)},rsWZm:function(s,t){return s===t},KoXxh:r(1978),gJukt:"auto",nvywC:function(s,t,n){return s(t,n)},xeToi:function(s,t){return s!==t},ShCoa:function(s,t,n){return s(t,n)},cwcHY:function(s,t){return s!==t},EoDch:function(s,t,n){return s(t,n)},SoDdg:function(s,t,n){return s(t,n)},PAdjY:function(s,t){return s!==t},CABCa:r(761),AHFrR:function(s,t){return s/t},kFgkg:function(s,t){return s==t},nXYEU:function(s,t){return s===t},XeSUb:r(1611)+"rovide v"+r(1621),QXzLC:function(s,t){return s(t)},nlVdO:r(1662),eRhAY:function(s,t){return s>>>t},zAyCz:function(s,t){return s|t},xBMwN:function(s,t){return s|t},IekJQ:function(s,t){return s|t},GLjTN:function(s,t){return s<<t},LmVNJ:function(s,t){return s>>>t},zoHFu:function(s,t){return s<<t},dUBZt:r(1165),INbit:r(1847),wtdmo:function(s,t){return s!==t},lQIFE:"https:",nHRUf:r(1751),ynjcC:r(2078),JSJAP:r(1833),WWsIN:"device_id",WSjNE:r(1611)+r(1647)+"ddID, de"+r(1908)+r(826),JTiUy:function(s,t){return s==t},oojVJ:r(1103),uALpb:function(s){return s()},obDcD:function(s,t,n){return s(t,n)},NmjLM:"fws_1.0.0",tIirk:function(s,t,n){return s(t,n)},hJRCF:r(1065),vlZrK:function(s,t){return s>t},fxRgf:function(s,t){return s&t},wospY:function(s,t){return s!==t},DTBDs:r(2082),vwtoB:r(684)+">",bklrz:function(s,t){return s*t},kZIfc:function(s,t){return s instanceof t},mWxVf:function(s,t){return s===t},rnwPc:r(1312),lnyPW:function(s,t,n){return s(t,n)},KyYKK:function(s,t){return s!==t},BRrHF:function(s,t){return s===t},aVNBV:r(590),HDMKI:r(1700),rRMyF:function(s){return s()},swxci:function(s,t){return s===t},QvEdT:r(1447),fTKER:r(1766),oLtzx:r(1802)+r(2058)+r(2118)+r(1133)+r(822),nbBPI:function(s,t,n){return s(t,n)},IeRwF:function(s,t){return s(t)},Rnyto:r(1786)+"4",cVCTF:"1|0|2|4|3",BNKzT:function(s,t,n,o){return s(t,n,o)},naNpv:r(1883),oLHsi:function(s,t,n){return s(t,n)},eWZYV:function(s,t){return s!==t},VMZaI:r(1976),zwYRu:function(s,t,n){return s(t,n)},HmEia:function(s,t){return s instanceof t},ZdmIC:"zuHRP",GjDRY:r(740),ATMtx:function(s,t){return s!==t},PUwWP:r(2033),AzPiq:r(785),KpkcG:r(1753),lZvbh:function(s,t){return s!==t},gCTXp:r(549),opSyp:r(1314),RvLta:r(1948)+r(837),eGMFu:"close, w"+r(771)+r(1819)+r(1160)+"ed",pGzFQ:r(1736)+r(1851)+r(1384),BwcvF:function(s,t){return s<t},ZWbLD:function(s,t){return s&t},Thksi:function(s,t){return s>>t},rykWY:function(s,t){return s|t},knKyZ:function(s,t){return s&t},qtddd:r(1611)+r(1120)+r(2003)+r(1007)+r(596)+r(2076)+r(1357)+r(493)+r(811),shJtF:function(s,t){return s==t},yJrTW:function(s,t){return s!=t},CmdIb:function(s,t){return s(t)},GMJCn:function(s,t){return s instanceof t},hzsby:function(s,t){return s(t)},RmGne:"YYRWm",UsigB:"sent",hxwLa:r(1352),MpCMJ:r(1489),zGcdI:function(s,t){return s==t},adYdv:r(1142)+r(1547)+"ing",wlfbN:"ping_onc"+r(1936)+"t",MWwOt:"\0\0\0\0\0\0\0\0",qbBCB:function(s,t){return s*t},viePM:r(553),bXdbg:function(s,t){return s===t},Littz:function(s,t){return s!=t},bZaWw:function(s,t){return s===t},PsuKt:r(502)+r(1400)+r(736)+"pe",qHnLm:"Object",BOscO:function(s,t){return s===t},IRqel:r(1812)+"rkerGlobalScope",RYBIM:r(536)+r(504)+r(1420),zbzqY:function(s,t){return s!=t},AVAOs:function(s,t,n){return s(t,n)},mzNAZ:r(588)+"qos__"};Pe.r(Q),Pe.d(Q,{FWS:()=>Y0,CustomErrorEvent:()=>gs,createCloseEvent:()=>we,ReconnectEvent:()=>hs,createErrorEvent:()=>ge,decodedFrame:()=>cs,createOpenEvent:()=>bs,CustomCloseEvent:()=>ps,createReconnectEvent:()=>cr,FrontierMessageEvent:()=>_s,encodeFrame:()=>xr,createMessageEvent:()=>ys,OpenEvent:()=>ws,ErrorCode:()=>je,Event:()=>xt,MessageEvent:()=>ms});let i="";function a(s=""){let t=r,n="02",o=""+Date.now(),c=i||(i=e[t(686)](m,s)),d=Math[t(1374)]()[t(849)](16).slice(-6);return e[t(1901)](e[t(1970)](n,o),c)+d}function x(){let s=r;return e[s(856)](1e4*Date[s(1837)](),Math[s(516)](1e4*Math.random()))}function f(s){let t=r;return e[t(1109)](e[t(686)](Array,8)[t(1317)]("0"),parseInt(s,10)[t(849)](2))[t(1645)](-8)}function l(s){let t=r;return(e.XJwvn(Array,4)[t(1317)]("0")+e.UuLZA(parseInt,s,2).toString(16))[t(1645)](-4)}function h(s){let t=r;if(e[t(808)]!==e[t(808)])return _0x57caf7[t(1972)](_0x2ff1f0),!1;{let n=s[t(742)](/\./)[t(930)](d=>f(d)),o=[];return o[0]=e[t(2086)](l,e[t(1482)](n[0],n[1])),o[1]=e[t(2086)](l,e[t(1889)](n[2],n[3])),[t(1458),e[t(1521)],e.bkSmS,e[t(1521)],e[t(1521)],e[t(1199)],o[0],o[1]].join("")}}function m(s){let t=r,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(853)](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(853)](s);return n?h(s):o?y(s):e[t(1111)]}function y(s){let t=r,n={EgRoR:function(_,w){return _===w},CIycE:t(586),MTVTq:function(_,w){return _ instanceof w},oCyDr:function(_,w){return e[t(1053)](_,w)},HQvur:function(_,w){return _+w},uIKdt:function(_,w){return e[t(782)](_,w)}},o="",c=[],d=0,g=0,p=!0,u=e[t(1521)];if(e[t(1102)](s[t(1893)]("::"),-1)){let _=s[t(742)]("::");for(let v=0;e.UNKDo(v,_[t(1929)]);v++){let A=_[v];if(e[t(1102)](A.indexOf(":"),0))if(e.PvTor(t(887),e[t(2043)])){let P=A[t(742)](":");p&&(d=P[t(1929)]),g+=P[t(1929)];for(let T=0;e[t(824)](T,P[t(1929)]);T++)if(e[t(1613)](4,P[T].length)){let M=u[t(2020)+"g"](0,e[t(1543)](4,P[T][t(1929)])),O=M[t(1491)](P[T]);c.push(O)}else c[t(1560)](P[T]);p=!1}else _0x35db59.o=(P,T)=>_0x5b7bea.prototype[t(703)+t(1675)][t(863)](P,T);else{if(e[t(1613)](4,A[t(1929)]))if(e.DIiKb(t(625),e[t(2091)])){let P=u[t(2020)+"g"](0,e[t(1543)](4,A[t(1929)])),T=P.concat(A);c[t(1560)](T)}else{let P=this[t(1723)+"rs"][_0x1f7cb4];if(P)P[t(1645)]().forEach(T=>T.fn[t(1507)](T[t(1635)],_0xd8c100));else if(n[t(508)](n[t(1719)],_0x4edb17)&&!this[t(781)]){let T=_0x299c0e.length&&_0x2943da[0];if(n[t(1840)](T,_0x30480b))throw T;let M=new _0x29b206(n[t(529)](t(677)+"d error.",T?n[t(950)](n.uIKdt(" (",T.message),")"):""));throw M[t(543)]=T,T}return this}else c[t(1560)](A);p&&(d+=1),g+=1,p=!1}}let w="";for(let v=0;e[t(1966)](v,e.ndmNv(8,g));v++)w=w[t(1491)](u);for(let v=0;v<c[t(1929)];v++)e.DIiKb(v,d)&&(o=o.concat(w)),o=o[t(1491)](c[v]);return o}{let _=s[t(742)](":");for(let w=0;e[t(824)](w,_.length);w++){let v=_[w];if(e.Gnclc(4,_[w][t(1929)])){let A=u[t(2020)+"g"](0,4-_[w][t(1929)]),P=A[t(1491)](v);o=o[t(1491)](P)}else o=o[t(1491)](v)}return o}}function S(s,t){let n=r,o=s[n(873)];e[n(1412)](void 0,o)&&(e[n(582)]($,t,10),e[n(1370)](Ce,t,o));let c=s[n(1584)];if(e[n(1254)](void 0,c))if(e[n(831)](e[n(1226)],n(895))){let{type:d}=_0x44e1dc;this[n(1308)](d,_0x4efa72)}else $(t,18),Ce(t,c)}function b(s){let t=r;if(e[t(1079)](e.zyJHK,e[t(1630)]))this[t(1291)]=!0,this[t(1933)]=e.ObAEc(0,_0x3b299d),this[t(1411)]=e[t(923)](0,_0x13f797),this[t(1279)]=!!_0x47c285;else{let n={};e:for(;!e[t(2086)](Re,s);){let o=e[t(1275)](W,s);switch(e[t(724)](o,3)){case 0:break e;case 1:n[t(873)]=Ee(s,e[t(1485)](W,s));break;case 2:n[t(1584)]=e[t(582)](Ee,s,e.CSVEl(W,s));break;default:e[t(582)](xe,s,7&o)}}if(n[t(873)]===void 0)throw new Error(e[t(1041)]);if(e.ryTTM(void 0,n[t(1584)]))throw new Error(e[t(2055)]);return n}}function D(s){let t=r;if(e[t(831)]("QsbWK",t(894)))return _0x41c957[t(872)+"8"]?{value:_0x3619a7[t(872)+"8"](_0x2f8e5c),offset:_0x2710b7+1}:{value:e.XNGfA(255,_0x27e179[_0x2984af]),offset:_0x4a5c4a+1};{let n=e[t(1862)](ue);return e[t(582)](R,s,n),e.TgKNl(Y,n)}}function R(s,t){let n=r,o={crTri:function(O,z,te){return e[k(1370)](O,z,te)},kyfqW:function(O,z,te){return e[k(1370)](O,z,te)},vvWjh:function(O,z,te,Ae){return e[k(787)](O,z,te,Ae)}},c=s[n(1115)];e.Gnclc(void 0,c)&&(e[n(1370)]($,t,8),e[n(1370)](Dt,t,c));let d=s[n(1121)];e[n(971)](void 0,d)&&(e[n(1370)]($,t,16),e.kWNnd(Dt,t,d));let g=s[n(1397)];if(g!==void 0)if(e[n(1625)]!=="yrRut")$(t,24),e[n(1359)](Dt,t,e[n(928)](re,g));else{let O={Bbrlw:awzzIK[n(1624)],JrWMM:awzzIK[n(769)],tmUYY:function(U,ye){return U(ye)},MBTtM:function(U){return U()},NtyFb:function(U,ye){let It=n;return awzzIK[It(928)](U,ye)},xcHsn:function(U){let ye=n;return awzzIK[ye(1788)](U)}},z=()=>{let U=n;_0x234006[U(775)+U(1077)+U(1232)](O.Bbrlw,te),_0x40a55c[U(775)+U(1077)+U(1232)](O.JrWMM,Ae)},te=()=>{let U=n;O[U(685)](_0x50c8d8,_0x5d2377(_0x391216[U(1917)])),O[U(1387)](z)},Ae=()=>{let U=n;O.NtyFb(_0x36b756,_0x5177df[U(586)]),O[U(1072)](z)};_0x1d7450[n(697)+n(840)](awzzIK[n(1624)],te),_0x2bf172[n(697)+n(840)](n(586),Ae)}let p=s[n(1947)];e[n(1613)](void 0,p)&&(e.fuhYN($,t,32),Dt(t,e[n(1904)](re,p)));let u=s.headers;if(e[n(1126)](void 0,u))for(let O of u){e[n(673)]($,t,42);let z=e.LUqzH(ue);e[n(1765)](S,O,z),e[n(1370)]($,t,z[n(2051)]),e[n(1370)](Qt,t,z),e[n(1345)](I,z)}let _=s["payloadE"+n(1388)];_!==void 0&&(e[n(784)]($,t,50),Ce(t,_));let w=s.payloadType;if(e[n(885)](void 0,w))if(e[n(1673)](e[n(1603)],e.Totts))e.fKaxg($,t,58),e[n(582)](Ce,t,w);else{let O=(n(568)+"1")[n(742)]("|"),z=0;for(;;){switch(O[z++]){case"0":if(!this[n(1270)])return;continue;case"1":this[n(1270)]["removeEv"+n(1077)+n(1232)](e.NlLtp,this[n(2012)]);continue;case"2":this[n(1270)]["removeEventListe"+n(1232)](e[n(1852)],this._onMessage);continue;case"3":this[n(1270)][n(775)+"entListe"+n(1232)](e.ACkoT,this[n(1856)]);continue;case"4":this[n(1270)][n(775)+n(1077)+n(1232)](e.DKnrv,this[n(1998)]);continue}break}}let v=s[n(2034)];e[n(1412)](void 0,v)&&(e[n(970)]($,t,66),e[n(2070)]($,t,v[n(1929)]),e.fuhYN(Zt,t,v));let A=s[n(1287)];e.fjRVM(void 0,A)&&(e[n(1370)]($,t,74),e.whVDS(Ce,t,A));let P=s[n(1721)+n(1231)];if(e[n(1944)](void 0,P))if(e.GQRwZ===e[n(652)]){let{offset:O}=o[n(1355)](_0x4d046d,_0x2aec69,_0x3e40a7);_0x349518=O;let z={cursor_name:"",cursor:0,service:0},{value:te,offset:Ae}=o.crTri(_0x19bf99,_0x386f68,_0x12f0c2);z[n(1397)]=te,_0xc2438c=Ae;let{value:U,offset:ye}=o[n(1784)](_0x2fb7c6,_0x1cedf5,_0x29a2da);_0x32adf2=ye,z[n(663)+"ame"]=o.vvWjh(_0x3f2c42,_0x55c8a5,_0x193ef0,_0x1cc0af+U),_0x2bb702+=U;let{value:It,offset:Rt}=o[n(1784)](_0x30da06,_0x15e317,_0x81b3b2);z[n(1877)]=It[n(1143)](),_0x44ff7a=Rt,_0x45e702[n(1560)](z)}else $(t,82),e[n(807)](Ce,t,P);let T=s[n(1825)];e[n(1613)](void 0,T)&&(e[n(538)]($,t,90),e.cdTEm(Ce,t,T));let M=s[n(2004)+"e"];e[n(971)](void 0,M)&&(e[n(1235)]($,t,96),e[n(614)](Dt,t,e[n(1275)](re,M)))}function N(s){return e[r(1345)](L,H(s))}function L(s){let t=r,n={};e:for(;!e.PPnuF(Re,s);){let o=e[t(1454)](W,s);switch(e[t(724)](o,3)){case 0:break e;case 1:n[t(1115)]=Ne(s,!0);break;case 2:n[t(1121)]=e[t(1405)](Ne,s,!0);break;case 3:n[t(1397)]=e[t(550)](W,s);break;case 4:n.method=e[t(2024)](W,s);break;case 5:{let c=e[t(2024)](F,s);(n[t(1074)]||(n[t(1074)]=[])).push(e.zVkBX(b,s)),s[t(2051)]=c;break}case 6:n[t(1809)+t(1388)]=e[t(1824)](Ee,s,e[t(928)](W,s));break;case 7:n["payloadT"+t(967)]=Ee(s,W(s));break;case 8:n.payload=kt(s,e.Luvdx(W,s));break;case 9:n.LogIDNew=e.hyHdV(Ee,s,e[t(941)](W,s));break;case 10:n.serverTiming=Ee(s,e[t(693)](W,s));break;case 11:n[t(1825)]=e[t(1085)](Ee,s,W(s));break;case 12:n[t(2004)+"e"]=e[t(1016)](W,s);break;default:e.HEyJs(xe,s,e[t(1888)](7,o))}}if(e.DIiKb(void 0,n[t(1115)]))throw new Error(e[t(1134)]);if(e[t(1724)](void 0,n.LogID))throw new Error(e[t(1606)]);if(e[t(1724)](void 0,n.service))throw new Error(e.dHkRD);if(e[t(1724)](void 0,n[t(1947)]))throw new Error(e[t(1155)]);return n}function F(s){let t=r,n=e.NnnSE(W,s),o=s[t(2051)];return s[t(2051)]=e.kKmGj(s[t(1759)],n),o}function xe(s,t){let n=r;switch(t){case 0:for(;e[n(1888)](128,ce(s)););break;case 2:se(s,e[n(1957)](W,s));break;case 5:se(s,4);break;case 1:e[n(585)](se,s,8);break;default:throw new Error(e[n(1576)]+t)}}function re(s){let t=r;return s|=0,{low:s,high:e.xNVWT(s,31),unsigned:e[t(574)](s,0)}}let Se=[];function ue(){let s=r,t=Se[s(1873)]();return t?(t[s(1759)]=t[s(2051)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function I(s){Se[r(1560)](s)}function H(s){return{bytes:s,offset:0,limit:s[r(1929)]}}function Y(s){let t=r,n=s[t(1032)],o=s[t(2051)];return n[t(1929)]===o?n:n[t(777)](0,o)}function se(s,t){let n=r;if(e.kKmGj(s.offset,t)>s[n(2051)])throw new Error(e[n(1964)]);s.offset+=t}function Re(s){let t=r,n={zkHkq:function(o,c,d){return e[k(1208)](o,c,d)}};if(e[t(1478)](e[t(974)],e[t(974)])){let o=n.zkHkq(_0x40d6b3,t(586),{message:_0xef4a27[t(1281)],code:_0x816acb.MESSAGE_ERROR,error:_0x408b17});this[t(1089)+t(1628)+t(1725)](o)}else return e.BDpYu(s.offset,s.limit)}function _e(s,t){let n=r,o=s[n(1032)],c=s[n(1759)],d=s[n(2051)],g=e[n(1349)](c,t);if(g>o[n(1929)]){if(e[n(1079)](e.xfJik,n(1654)))return _0x449f0c+=_0x5fe3b6&&_0x216877.byteLength||0,_0x5fdd8;{let p=new Uint8Array(e[n(591)](2,g));p[n(794)](o),s.bytes=p}}return s[n(1759)]=g,e[n(1209)](g,d)&&(s[n(2051)]=g),c}function $e(s,t){let n=r,o=s.offset;if(e.ejnlW(e[n(2045)](o,t),s[n(2051)]))throw new Error(e[n(815)]);return s[n(1759)]+=t,o}function kt(s,t){let n=r,o=e[n(1764)]($e,s,t);return s[n(1032)][n(777)](o,e[n(2036)](o,t))}function Zt(s,t){let n=r;if(e[n(1714)]!==e[n(2107)]){let o=e.Vikbk(_e,s,t[n(1929)]);s[n(1032)][n(794)](t,o)}else _0xe9cfa5[n(1781)+n(632)]=void 0,e[n(605)](_0x814f79,e[n(655)])}function Ee(s,t){let n=r,o={ItYUs:function(_,w){return e[k(782)](_,w)},zgzEz:function(_,w){return _+w},CdTnc:function(_,w){return _&w},AXUJv:function(_,w){return e[k(1692)](_,w)},LDTdo:function(_,w){return e[k(608)](_,w)},Rlbyw:function(_,w){return _<w},lTQhX:function(_,w){return e.QrcDG(_,w)}},c=$e(s,t),d=String[n(1280)+n(640)],g=s.bytes,p="\uFFFD",u="";for(let _=0;e[n(1333)](_,t);_++)if(e[n(1079)](e[n(1544)],e[n(1588)]))_0x558996=_0x445534[o[n(658)](o[n(1059)](_0x516d35,_0x24d97f),1)],o[n(939)](192,_0x15b8bd)!==128?_0x22d68c+=_0x3aac4e:(_0x56552d=o[n(1310)](o[n(572)](o.CdTnc(31,_0x543a5d),6),o[n(939)](63,_0x1260f6)),o[n(1449)](_0x881717,128)?_0x48e19f+=_0x218010:(_0x3f0b29+=o[n(2008)](_0x4a3743,_0x295068),_0x5ed7ae++));else{let w=g[e[n(1939)](_,c)],v,A,P,T;e[n(1302)](128,w)===0?u+=e[n(1248)](d,w):e[n(831)](e[n(1302)](224,w),192)?e[n(1440)](_,1)>=t?u+=p:(v=g[e[n(1440)](e[n(1901)](_,c),1)],(192&v)!==128?u+=p:(T=e[n(608)](e[n(1474)](31,w),6)|e.dGQVx(63,v),e[n(1480)](T,128)?u+=p:(u+=e.qRuVi(d,T),_++))):e[n(1657)](e[n(1902)](240,w),224)?e[n(1793)](_+2,t)?u+=p:(v=g[e.aWpgQ(e.hJxaY(_,c),1)],A=g[e[n(1792)](e[n(1053)](_,c),2)],e[n(885)](e.rSJuH(e.qiDkI(v,A<<8),49344),32896)?u+=p:(T=e.qPLEP(e[n(608)](e[n(1054)](15,w),12),e[n(608)](e[n(1888)](63,v),6))|e[n(1392)](63,A),e[n(1351)](T,2048)||e.BDpYu(T,55296)&&e.urEbu(T,57343)?u+=p:(u+=d(T),_+=2))):(248&w)==240?e[n(1793)](e[n(1349)](_,3),t)?u+=p:(v=g[_+c+1],A=g[e[n(830)](e[n(1377)](_,c),2)],P=g[_+c+3],e[n(1613)](e.LVlvi(e[n(1651)](e.DJeNS(v,e.CzNlU(A,8)),P<<16),12632256),8421504)?u+=p:(T=e.ObAEc(e[n(1692)](e[n(1692)](e[n(1888)](7,w)<<18,e[n(608)](63&v,12)),e.CzNlU(e[n(1302)](63,A),6)),63&P),T<65536||e[n(1209)](T,1114111)?u+=p:(T-=65536,u+=e[n(727)](d,(T>>10)+55296,e.WRLWn(e[n(2098)](1023,T),56320)),_+=3))):u+=p}return u}function Ce(s,t){let n=r,o=t[n(1929)],c=0;for(let p=0;e[n(1305)](p,o);p++){let u=t[n(1937)+"At"](p);e[n(574)](u,55296)&&u<=56319&&e[n(856)](p,1)<o&&(u=e[n(608)](u,10)+t.charCodeAt(++p)-56613888),c+=e.TJMpn(u,128)?1:u<2048?2:e[n(2120)](u,65536)?3:4}e.cdTEm($,s,c);let d=e[n(2040)](_e,s,c),g=s.bytes;for(let p=0;e[n(2120)](p,o);p++){let u=t.charCodeAt(p);if(e[n(1793)](u,55296)&&e[n(1381)](u,56319)&&p+1<o&&(u=e[n(1543)](e[n(1901)](e[n(1156)](u,10),t.charCodeAt(++p)),56613888)),e[n(2120)](u,128))g[d++]=u;else if(e[n(1724)](e.GigBA,e.GigBA))e[n(1351)](u,2048)?g[d++]=e[n(923)](e[n(1474)](u>>6,31),192):(e.KYWJj(u,65536)?g[d++]=e[n(923)](e[n(495)](u,12)&15,224):(g[d++]=e.tIJik(e.eXwBZ(u>>18,7),240),g[d++]=e[n(745)](e[n(1490)](u>>12,63),128)),g[d++]=e[n(1201)](e[n(1315)](u>>6,63),128)),g[d++]=e[n(665)](63,u)|128;else{let _=e[n(2070)](_0x366e92,e[n(1554)],{message:e.sLVvp});this.onStartReconnect&&this.onStartReconnect(_)}}}function Qt(s,t){let n=r,o=e[n(727)](_e,s,t[n(2051)]),c=s[n(1032)],d=t[n(1032)];for(let g=0,p=t[n(2051)];e[n(1238)](g,p);g++)c[g+o]=d[g]}function ce(s){let t=r;return s[t(1032)][e[t(1359)]($e,s,1)]}function en(s,t){let n=r,o=e[n(1405)](_e,s,1);s[n(1032)][o]=t}function W(s){let t=r,n=0,o=0,c;do c=e.qRuVi(ce,s),e.dnRwV(n,32)&&(o|=e[t(2093)](e[t(1347)](127,c),n)),n+=7;while(e[t(1228)](128,c));return o}function $(s,t){let n=r;for(t>>>=0;e[n(552)](t,128);)e[n(1047)](en,s,e[n(923)](127&t,128)),t>>>=7;e[n(1824)](en,s,t)}function Ne(s,t){let n=r,o={XkdoR:function(c,d){return e.TgKNl(c,d)},Rewnn:function(c,d){return e[k(1828)](c,d)},SaGdD:function(c,d){return c>>>d},goEvE:function(c,d){return e.XNGfA(c,d)},weAeC:function(c,d){return e[k(747)](c,d)},HFhAQ:function(c,d){return c&d},crYel:function(c,d){return e[k(1182)](c,d)}};if(e[n(1478)](e.hQJLa,n(1413)))return o.XkdoR(_0x1f476a,_0x18362b);{let c=0,d=0,g=0,p;if(p=e[n(2084)](ce,s),c=e[n(1474)](127,p),128&p){if(e[n(1079)](n(1755),e[n(2019)])){let u=this[n(1430)]["getStora"+n(1867)](this[n(1277)]);return _0x1a13b3[n(1943)](o.Rewnn(u,"{}"))[_0x4d8979]}else if(p=ce(s),c|=e[n(608)](e.dXjTn(127,p),7),e[n(1347)](128,p)&&(p=e.AMtVj(ce,s),c|=e[n(765)](e[n(1474)](127,p),14),e[n(1902)](128,p)))if(e[n(831)](e.LBfkF,e[n(1558)])){let u=this.high,_=this.low;return[o[n(1567)](u,24),o[n(1567)](u,16)&255,o[n(1790)](u>>>8,255),o.weAeC(255,u),o.SaGdD(_,24),o.HFhAQ(o[n(1567)](_,16),255),o[n(1212)](_,8)&255,255&_]}else p=e[n(605)](ce,s),c|=e[n(1487)](e[n(1392)](127,p),21),e[n(665)](128,p)&&(e.ryTTM(e.punJp,e[n(1761)])?(p=ce(s),d=e[n(744)](127,p),128&p&&(p=e[n(686)](ce,s),d|=e[n(609)](e[n(926)](127,p),7),e[n(1135)](128,p)&&(p=e[n(1463)](ce,s),d|=(127&p)<<14,e[n(931)](128,p)&&(p=ce(s),d|=e[n(1156)](e[n(1191)](127,p),21),e[n(525)](128,p)&&(p=e[n(2018)](ce,s),g=e[n(875)](127,p),e[n(1302)](128,p)&&(p=ce(s),g|=e[n(765)](e[n(1996)](127,p),7))))))):_0x3ef0c8=awzzIK[n(1903)](_0x350032,_0xd874f5))}return{low:e.PFhbh(c,e.NAVtm(d,28)),high:e[n(1398)](e[n(724)](d,4),e[n(609)](g,24)),unsigned:t}}}function Dt(s,t){let n=r,o=e[n(1182)](t[n(1933)],0),c=e[n(1256)](e[n(1581)](e[n(724)](t[n(1933)],28),e[n(765)](t[n(1411)],4)),0),d=e.YRymZ(t[n(1411)],24),g=e.DIiKb(0,d)?e[n(554)](0,c)?e[n(1966)](o,16384)?o<128?1:2:o<2097152?3:4:e[n(1305)](c,16384)?e[n(1966)](c,128)?5:6:e[n(621)](c,2097152)?7:8:e[n(824)](d,128)?9:10,p=e[n(728)](_e,s,g),u=s.bytes;switch(g){case 10:u[e[n(646)](p,9)]=e[n(754)](e.YRymZ(d,7),1);case 9:u[e[n(1373)](p,8)]=g!==9?e[n(923)](128,d):127&d;case 8:u[e[n(1373)](p,7)]=g!==8?e[n(615)](e[n(1256)](c,21),128):e[n(699)](c>>>21,127);case 7:u[p+6]=e[n(1928)](7,g)?e[n(615)](c>>>14,128):e[n(1353)](e[n(1796)](c,14),127);case 6:u[e[n(2030)](p,5)]=e[n(1673)](6,g)?e[n(1581)](e.OPZWr(c,7),128):e.uiEwB(c>>>7,127);case 5:u[e[n(856)](p,4)]=e[n(885)](5,g)?128|c:e[n(1996)](127,c);case 4:u[e[n(1377)](p,3)]=e[n(1536)](4,g)?e[n(1831)](o>>>21,128):o>>>21&127;case 3:u[e[n(2036)](p,2)]=g!==3?e[n(802)](e[n(700)](o,14),128):e[n(2011)](o>>>14,127);case 2:u[e[n(782)](p,1)]=g!==2?e[n(1546)](e.puitP(o,7),128):e.HFkcm(e[n(1182)](o,7),127);case 1:u[p]=e[n(1928)](1,g)?128|o:e[n(766)](127,o)}}function cs(s){let t=r;if(e[t(1928)](e[t(1354)],t(1561)))_0x390664[t(1560)](_0x1a7461);else return N(s)}function xr(s){return e.XJwvn(D,s)}let fs=65536,a0=e[r(2101)],at=e[r(1960)](fs,fs),us=e[r(789)](at,at),ds=us/2,He=String.prototype[r(1937)+"At"];class K{constructor(t,n,o){let c=r;this[c(1291)]=!0,this[c(1933)]=e[c(1398)](0,t),this[c(1411)]=e[c(964)](0,n),this[c(1279)]=!!o}static[r(1291)](t){let n=r;if(e.hWtBb(e[n(809)],e[n(1697)]))return t&&e[n(979)](!0,t[n(1291)]);_0x4c9f53(_0x184d29,this[n(1167)+n(902)+"e"](_0x1ceac6))}static[r(1259)](t,n,o){let c=r;if(e[c(993)]!==e[c(993)])this["_initPro"+c(2038)]=null;else return new K(t,n,o)}static[r(540)+"s"](t,n,o){let c=r;return o?K[c(540)+c(1559)](t,n):K[c(540)+c(1031)](t,n)}static[r(540)+r(1559)](t,n){let o=r;return new K(e[o(1573)](e.VDOPD(t[0]|e.arhUx(t[1],8),e[o(723)](t[2],16)),e[o(1829)](t[3],24)),e.ETVfJ(e.tIJik(e.tIJik(t[4],e[o(1842)](t[5],8)),e[o(617)](t[6],16)),e[o(871)](t[7],24)),n)}static[r(540)+r(1031)](t,n){let o=r;return new K(e[o(1398)](e[o(1618)](t[4]<<24,e.CCXTm(t[5],16)),t[6]<<8)|t[7],e[o(745)](e[o(1581)](e.gqykZ(t[0]<<24,e[o(2093)](t[1],16)),e.AGSkh(t[2],8)),t[3]),n)}static[r(1504)](t){let n=r;return t===a0?ls:new K(e[n(700)](e[n(802)](e.vbopt(e[n(838)](He[n(863)](t,0),e[n(1407)](He[n(863)](t,1),8)),e[n(778)](He[n(863)](t,2),16)),He[n(863)](t,3)<<24),0),e.LpURQ(e[n(891)](e[n(1040)](He[n(863)](t,4)|He[n(863)](t,5)<<8,e[n(982)](He[n(863)](t,6),16)),e[n(778)](He[n(863)](t,7),24)),0),!0)}[r(628)](){let t=r;return String[t(1280)+t(640)](e.mTZIg(255,this[t(1933)]),e[t(1474)](this[t(1933)]>>>8,255),e.eXwBZ(e[t(700)](this[t(1933)],16),255),e[t(577)](this[t(1933)],24),e[t(1260)](255,this[t(1411)]),e[t(1996)](e.uaJQY(this[t(1411)],8),255),e[t(1392)](e[t(1552)](this.high,16),255),e[t(2083)](this[t(1411)],24))}static[r(878)+"er"](t,n=!0){let o=r;if(e[o(557)](isNaN,t))return n?x0:ls;if(n){if(e[o(1299)](t,us))return f0}else{if(e[o(1381)](t,-ds))return u0;if(e[o(552)](e[o(646)](t,1),ds))return c0}return K.fromBits(e[o(752)](e[o(1410)](t,at),0),e[o(1831)](t/at,0),n)}[r(1143)](){let t=r;return this[t(1279)]?e.KsvWI(this.high,0)*at+e[t(1402)](this.low,0):e.xmpla(this.high,at)+e[t(1290)](this[t(1933)],0)}[r(1037)](){let t=r;return this[t(1411)]===0&&e[t(2039)](0,this.low)}[r(741)](t){let n=r;K.isLong(t)||(t=K[n(878)+"er"](t));let o=e.pPqlN(this[n(1411)],16),c=65535&this[n(1411)],d=e[n(1290)](this[n(1933)],16),g=e[n(1857)](65535,this[n(1933)]),p=e[n(2009)](t[n(1411)],16),u=e[n(912)](65535,t.high),_=t[n(1933)]>>>16,w=e[n(1157)](65535,t[n(1933)]),v=0,A=0,P=0,T=0;return T+=e[n(510)](g,w),P+=T>>>16,T&=65535,P+=d+_,A+=e[n(1202)](P,16),P&=65535,A+=e[n(1970)](c,u),v+=e[n(556)](A,16),A&=65535,v+=e[n(510)](o,p),v&=65535,K.fromBits(e[n(891)](e[n(1252)](P,16),T),e[n(1234)](e.AGSkh(v,16),A),this[n(1279)])}equals(t){let n=r;return K[n(1291)](t)||(t=K[n(878)+"er"](t)),e[n(1536)](this.unsigned,t[n(1279)])&&e.ryTTM(this[n(1411)]>>>31,1)&&e[n(1428)](e[n(1202)](t[n(1411)],31),1)?!1:e[n(999)](this[n(1411)],t[n(1411)])&&e[n(1664)](this[n(1933)],t[n(1933)])}[r(1009)](){let t=r;if(e[t(554)](e[t(1863)],e.SLTor)){if(this[t(1272)+t(773)]?.[t(1132)+t(1149)+"es"]()){let o=this[t(1272)+t(773)]?.[t(927)+t(1501)+"nt"]();this[t(1089)+t(758)+t(1725)](e[t(681)](_0x1c908b,e[t(1237)],{code:1006,reason:"connect "+o+(t(2061)+", max re"+t(1652)+t(2075)),wasClean:!0}))}else{let o=this._options[t(2118)+t(1050)+t(960)](_0xfa5b5c,_0x1f957e);this[t(1089)+"hCloseEvent"](e[t(807)](_0x118be3,e[t(1237)],{code:_0x493223,reason:_0x54b13d,wasClean:!0,willReconnect:o})),o&&this[t(1348)]()}return}else return e[t(1110)](-1,this[t(1933)])&&e[t(1724)](-1,this[t(1411)])?K[t(1259)](0,0,this.unsigned):e.Ohivd(-1,this[t(1933)])?K[t(1259)](0,e[t(1822)](this[t(1411)],1),this[t(1279)]):K.fromBits(e.huKqo(this.low,1),this.high,this.unsigned)}[r(1735)](t){return t?this[r(2073)+"E"]():this.toBytesBE()}[r(2073)+"E"](){let t=r,n=this[t(1411)],o=this[t(1933)];return[e.HFkcm(255,o),e.cfqiv(o,8)&255,e.WigSV(o,16)&255,e[t(700)](o,24),e[t(525)](255,n),n>>>8&255,e[t(724)](n,16)&255,e[t(724)](n,24)]}[r(1806)+"E"](){let t=r,n=this[t(1411)],o=this[t(1933)];return[e[t(1402)](n,24),e[t(1392)](e[t(577)](n,16),255),e.xZCsh(e[t(767)](n,8),255),e[t(601)](255,n),e.Ldbxg(o,24),e[t(1853)](e[t(724)](o,16),255),e[t(1302)](e[t(1371)](o,8),255),e[t(1219)](255,o)]}}let ls=new K(0,0,!1),x0=new K(0,0,!0),c0=K.fromBits(-1,2147483647,!1),f0=K[r(1259)](-1,-1,!0),u0=K[r(1259)](0,-2147483648,!1);var je=(function(s){let t=r;return s[s[e[t(1063)]]=5001]=e[t(1063)],s[s[e[t(2007)]]=5002]=e[t(2007)],s[s[e[t(1916)]]=5003]=e[t(1916)],s[s[e[t(1070)]]=5004]="MESSAGE_ERROR",s[s[e[t(2049)]]=5005]=e[t(2049)],s})({});class xt{constructor(t){let n=r,o={bFEwH:function(c,d){return c+d},Xqctw:function(c,d){return e.ejnlW(c,d)}};if(e[n(1110)](n(524),e.hsXoe))this[n(1984)]=t,this[n(722)]=null;else{let c=_0x1ba637[n(1032)],d=_0x33e040[n(1759)],g=_0x53e467[n(2051)],p=XSPafZ[n(1197)](d,_0x583c12);if(p>c.length){let u=new _0x1dd17e(2*p);u.set(c),_0x180d2d.bytes=u}return _0x500ca1[n(1759)]=p,XSPafZ[n(602)](p,g)&&(_0x25563f[n(2051)]=p),d}}}class hs extends xt{constructor(t,n){let o=r;super(t),this[o(1281)]=n&&n[o(1281)]||null}}class gs extends xt{constructor(t,n){let o=r,c={uefJp:e[o(1658)],jInpz:function(d,g){return e[o(1506)](d,g)},TzzVz:function(d,g){return e[o(912)](d,g)},zSiFS:function(d,g){return e.bWGoZ(d,g)},LEhRy:function(d,g){return d>>g},zqFJq:function(d,g){return e[o(1385)](d,g)},QxJGP:function(d,g){return e[o(1053)](d,g)},vwxhR:function(d,g){return d<<g},AnXNb:function(d,g){return e.NrLIh(d,g)}};if(e[o(661)](e[o(650)],e.WKijB)){let d=e.peEIB[o(742)]("|"),g=0;for(;;){switch(d[g++]){case"0":this[o(586)]=n&&n[o(586)]||null;continue;case"1":this[o(1253)]=n&&n[o(1253)]||5001;continue;case"2":this.colno=n&&n[o(1092)]||0;continue;case"3":this[o(2068)]=n&&n[o(2068)]||"";continue;case"4":this[o(1281)]=n&&n[o(1281)]||"";continue;case"5":super(t);continue;case"6":this.lineno=n&&n[o(1088)]||0;continue}break}}else{let d=c[o(1679)][o(742)]("|"),g=0;for(;;){switch(d[g++]){case"0":_0x4b75c1[_0x40167b++]=c[o(1180)](c[o(690)](_0x1ae29e>>6,63),128);continue;case"1":_0x24f051[_0x3825de++]=c[o(633)](_0xa856f9>>18,240);continue;case"2":_0x3787b9[_0x309078++]=c[o(1180)](c[o(690)](c[o(1704)](_0xae611,12),63),128);continue;case"3":_0x18aed0[_0x4d77cc++]=c.zqFJq(63,_0x50088d)|128;continue;case"4":_0x1603cd=c[o(783)](65536,c[o(1187)](c[o(1096)](1023,_0x23b0c8),10))+c[o(565)](1023,_0x79678);continue;case"5":++_0x49fee4;continue}break}}}}class ps extends xt{constructor(t,n){let o=r,c=e[o(1826)][o(742)]("|"),d=0;for(;;){switch(c[d++]){case"0":this[o(896)+o(1286)]=n&&n[o(896)+o(1286)]||!1;continue;case"1":this[o(942)]=n&&n[o(942)]||"";continue;case"2":super(t);continue;case"3":this[o(1022)]=n&&n[o(1022)]||!1;continue;case"4":this[o(1253)]=n&&n[o(1253)]||0;continue}break}}}class ms extends xt{constructor(t,n){let o=r;super(t),this[o(1205)]=n&&n.data||null}}class _s extends ms{constructor(t,n){let o=r;super(t),this.data=n&&n[o(1205)]||null,this[o(1281)]=n&&n.message||null}}class ws extends xt{constructor(t,n){let o=r;super(t),this[o(1205)]=n&&n.data||null}}function ge(s,{message:t,code:n,error:o}){let c=r,d={OwtXu:e[c(1554)],IzHSY:e.WWLvD};if(e[c(1664)](e[c(1386)],e.OldqI))return new gs(s,{message:t,code:n,error:o});{this[c(2074)+c(1677)+"t"]();let g=_0x301830(d[c(2117)],{message:d[c(1421)]});this[c(721)+"mediatelyReconnect"]&&this[c(721)+c(1249)+c(1200)+"ct"](g)}}function we(s,{code:t,reason:n,wasClean:o,willReconnect:c}){return new ps(s,{code:t,reason:n,wasClean:o,willReconnect:c})}function ys(s,{data:t,message:n}){return new _s(s,{data:t,message:n})}function bs(s,{data:t}){return new ws(s,{data:t})}function cr(s,{message:t}){return new hs(s,{message:t})}class vs{constructor(t,n){let o=r;this[o(1213)+"s"]=t,this.maxRetries=n,this.currentIndex=0,this[o(1223)+o(725)+o(804)+"t"]=0}["resetEndpointCon"+r(805)](){let t=r;this[t(671)+t(1060)]=0,this[t(1223)+t(725)+"riesCount"]=0}resetTries(){let t=r;if(e[t(1705)](e[t(1914)],e[t(956)]))this[t(1223)+t(725)+t(804)+"t"]=0;else{if(e[t(1543)](_0x1e72ce,_0x28c81b)<1)return"";let n="";for(let o=_0xda5689;e[t(1892)](o,_0x10010f);){let c=_0x35d8ef[o++];if(e[t(1691)](c,127))n+=_0x1e0a0d[t(1280)+"Code"](c);else if(e[t(662)](c,192)&&c<224)n+=_0x720c89[t(1280)+t(640)](e[t(1175)](e[t(653)](31,c),6)|e[t(1124)](63,_0xd8bae4[o++]));else if(c>=224&&e[t(1333)](c,240))n+=_0xbb7d5f[t(1280)+t(640)](e[t(609)](15&c,12)|e[t(1829)](63&_0x28347a[o++],6)|63&_0xeb255[o++]);else if(e[t(662)](c,240)){let d=e[t(1112)](e[t(752)](e[t(871)](7&c,18),e[t(1915)](63,_0x4b1950[o++])<<12)|e[t(1938)](63&_0x26bfa2[o++],6),63&_0x7fca2b[o++])-65536;n+=_0x46c81e[t(1280)+t(640)](e[t(1440)](55296,d>>10)),n+=_0x14c860[t(1280)+t(640)](e.lvWDK(56320,e[t(912)](1023,d)))}}return n}}[r(927)+r(1501)+"nt"](){let t=r,n={HXBiu:t(586)};if(e[t(899)](e.OtlqY,t(880)))return this[t(1213)+"s"][this[t(671)+"ndex"]];{let o={YZaRx:n.HXBiu},c=_0x294604.buffer.slice(_0xffd3e1[t(1382)+"et"],_0x15eb70[t(1336)+"th"]+_0x3dea2c.byteOffset);this[t(1418)]&&this[t(1418)][t(720)]({data:c,fail:d=>{let g=t;this[g(1308)](o[g(1166)],_0xd6da0d(o[g(1166)],{message:this[g(701)+g(1566)+g(569)](d)}))}})}}[r(927)+r(1501)+r(2060)+"ount"](){return this[r(1223)+"ndpointTriesCount"]}["checkRea"+r(1149)+"es"](){let t=r;return!!(e.PsOaD(this[t(671)+t(1060)],this.endpoints.length)||this["currentI"+t(1060)]===this.endpoints.length-1&&e.ryTTM(this[t(1223)+t(725)+"riesCount"],this[t(1925)+"es"]))}["checkCurrentEndp"+r(694)+r(1106)+r(1526)](){let t=r;return e[t(1657)](this[t(671)+t(1060)],this[t(1213)+"s"].length)?!0:this[t(1223)+t(725)+"riesCount"]>this[t(1925)+"es"]}[r(2080)+r(1868)+r(1404)+r(548)+r(620)](){let t=r;return this[t(1223)+t(725)+"riesCount"]=1,this[t(671)+t(1060)]++,this[t(1213)+"s"][this["currentI"+t(1060)]]}[r(927)+r(1501)+"ntAndUpdateCount"](){let t=r;return this[t(1223)+t(725)+"riesCount"]++,this.getCurrentEndpoint()}}let ct=(e[r(1810)](e[r(717)],typeof globalThis)&&e[r(884)]===globalThis[r(1718)+r(1694)][r(1003)]||typeof window<"u"&&e[r(1775)](e[r(884)],window[r(1718)+r(1694)][r(1003)]))&&e[r(1827)](r(708)+"d",typeof document),Ze=e[r(1024)](r(708)+"d",typeof globalThis)&&(e[r(1459)](r(513),globalThis[r(1718)+"tor"].name)||e.bZaWw(e[r(1874)],globalThis[r(1718)+r(1694)].name))&&e[r(1643)](e.roEPd,typeof tt),Pt=(e[r(717)]!=typeof globalThis&&e[r(1193)]===globalThis["construc"+r(1694)].name||e[r(1530)]("undefined",typeof globalThis)||e[r(1024)](e.roEPd,typeof globalThis)&&!!globalThis[r(1590)+"Bridge"])&&e[r(1465)](e[r(717)],typeof wx),Tt=e.vWTtK(e[r(717)],typeof globalThis)&&(e[r(1014)](e[r(1874)],globalThis["construc"+r(1694)].name)||e[r(2072)]===globalThis[r(1718)+r(1694)].name||e[r(1774)]===globalThis[r(1718)+"tor"][r(1003)])&&e[r(717)]!=typeof self,d0=e[r(1810)](r(708)+"d",typeof globalThis)&&e[r(1193)]===globalThis[r(1718)+r(1694)][r(1003)]&&e.roEPd!=typeof global&&e[r(1193)]===global[r(1718)+r(1694)][r(1003)]&&e.roEPd!=typeof process&&!!process[r(1036)];class fr{constructor(){let t=r,n={reuQm:e.VBcbC,jriyp:function(o,c){return e.uzrKM(o,c)},CfJgk:function(o,c){return e.ejnlW(o,c)},kXfSV:function(o,c,d,g){return e[k(1100)](o,c,d,g)},VDGDh:function(o,c){return o>>>c},XIzqw:function(o,c){return e.ieHUL(o,c)},QWrRL:function(o,c){return e.arhUx(o,c)},ZHEHQ:function(o,c){return e[k(1618)](o,c)},lmAyi:function(o,c){return e.NrLIh(o,c)},otzEw:function(o,c){return e[k(638)](o,c)},InvCA:function(o,c){return e.ZIYUU(o,c)},AseBo:function(o,c){return e[k(1763)](o,c)},QPLdL:function(o,c){return e[k(653)](o,c)},YWxgW:function(o,c){return e[k(1905)](o,c)},vcAat:function(o,c){return e[k(824)](o,c)},LBNQh:function(o,c){return e[k(734)](o,c)},fDRtk:function(o,c){return e[k(1118)](o,c)},EOsDL:function(o,c){return e[k(893)](o,c)}};if(e[t(1427)](t(1713),t(580))){let o=n[t(1644)][t(742)]("|"),c=0;for(;;){switch(o[c++]){case"0":if(n.jriyp(_0x1107cf[_0x4be0af++],128))return{value:_0x2158c6?_0x4b5808:0|_0x19fedc,offset:_0x38adb4};continue;case"1":if(n.CfJgk(_0x5cf6a9+=5,_0x100618.length))throw _0xb5629b=_0x51cb4a.length,n[t(670)](_0x1927c2,_0xd5beff,10,_0x3122db[t(1929)]);continue;case"2":_0x59e097=n.VDGDh(n[t(1762)](_0x3a3528,n[t(1375)](15&_0x147ee5[_0xfc20d8],28)),0);continue;case"3":_0x36bd4=n[t(737)](_0x5a59c8,n[t(1375)](n[t(748)](127,_0x3bcee4[_0x53e0d9]),14))>>>0;continue;case"4":if(n.jriyp(_0x5f2c6f[_0xa57f83++],128))return{value:_0x22a2c5?_0x46832d:n[t(1762)](0,_0x264af2),offset:_0x5a3749};continue;case"5":_0x142d02=n[t(1742)](n[t(1185)](_0x1a7e2f,n[t(833)](127&_0x40d258[_0x545872],21)),0);continue;case"6":if(n.jriyp(_0x37641c[_0x42267a++],128))return{value:_0x25c3f0?_0x5e7bfc:n[t(1762)](0,_0x49e485),offset:_0x2665d6};continue;case"7":_0x467d71=n[t(797)](_0x3f62be|n[t(833)](n[t(989)](127,_0x54a9b5[_0x3e800a]),7),0);continue;case"8":if(n.YWxgW(_0x3a5098[_0x2d78b5++],128))return{value:_0x52886d?_0x5c1908:n[t(1762)](0,_0xdccdd2),offset:_0x175467};continue;case"9":if(n[t(842)](_0x4f4285[_0x381ab8++],128))return{value:_0x6fc0b0?_0x58e6ba:n[t(2104)](0,_0x1bf542),offset:_0xf3b5a5};continue;case"10":return{value:_0x2c6850?_0x2cec64:n[t(829)](0,_0x2b8393),offset:_0x2a7f8c};case"11":_0x530155=n.VDGDh(n[t(1153)](127,_0x937687[_0x5f333e]),0);continue}break}}else this[t(1723)+"rs"]={}}[r(1308)](t,...n){let o=r,c={HNZqr:function(d,g){return d>g}};if(e[o(1254)](o(1641),o(1641))){let d=_0x5d568a[o(1759)];if(lEoZGP[o(1221)](d+_0xec9b5a,_0x514e1f[o(2051)]))throw new _0x258980(o(654)+o(648));return _0x592d17.offset+=_0x3676a2,d}else{let d=this[o(1723)+"rs"][t];if(d)d.slice()[o(1746)](g=>g.fn.apply(g[o(1635)],n));else if(e[o(1724)](e.NlLtp,t)&&!this.onerror){let g=n[o(1929)]&&n[0];if(g instanceof Error)throw g;let p=new Error(e[o(1349)](o(677)+"d error.",g?e[o(1578)](e[o(823)](" (",g.message),")"):""));throw p[o(543)]=g,g}return this}}[r(1304)](t,n){let o=r;if(e[o(1379)](void 0,t))this[o(1723)+"rs"]={};else if(n===void 0)this[o(1723)+"rs"][t]=null;else{let c=this._listeners[t];if(c)for(let d=0;e[o(1131)](d,c[o(1929)]);)c[d].fn===n?c[o(1378)](d,1):++d}return this}on(t,n,o){let c=r,d={Gizgx:function(g,p){return g===p},xgUzm:function(g,p){return e[k(1254)](g,p)},AcBPd:function(g,p,u){return e[k(706)](g,p,u)}};if(e[c(2046)](e[c(1921)],e[c(626)]))return(this[c(1723)+"rs"][t]||(this._listeners[t]=[]))[c(1560)]({fn:n,ctx:o||this}),this;if(this[c(1270)]&&d[c(1196)](this._ws[c(718)+"te"],this[c(1669)+"NG"])){this[c(1170)+c(800)](),this["_pingPon"+c(1614)+"Id"]=_0x4cae94(this[c(750)].bind(this),this[c(559)][c(1242)+"rval"]);return}if(!this[c(1270)]||d[c(711)](this[c(1270)][c(718)+"te"],this.OPEN))return void this[c(1004)+c(1547)]();this[c(1270)]&&this[c(1270)].send("hi"),this[c(1629)+c(1366)+c(712)]=d[c(1068)](_0x49b366,this[c(1004)+c(1547)+c(1015)][c(1881)](this),this[c(559)][c(1269)+c(1498)+c(1011)])}}class l0 extends fr{[r(701)+r(1566)+"age"](t){let n=r;if(e[n(903)](e[n(1471)],n(945)))return t[n(1329)]||t[n(1225)]?("message: "+(t.errMsg||"")+n(1818)+(t.errNo||"")).trim():JSON[n(1608)+"y"](t);this["_interva"+n(1575)+"Id"]=null,this._interval=36e5,this._qosDB=e[n(2069)](_0x57adb7,n(1183),e[n(730)])}constructor(t,n,o){let c=r;super(),this[c(1418)]=null,Pt&&wx[c(1204)+c(1282)]&&(this._socket=wx["connectS"+c(1282)]({url:t,protocols:n,header:o,fail:this[c(1587)+c(2066)+"lHandler"].bind(this),success:this[c(1587)+c(1583)+c(756)+c(2054)][c(1881)](this)})),Ze&&tt[c(1204)+c(1282)]&&(this[c(1418)]=tt[c(1204)+"ocket"]({url:t,protocols:n,header:o,fail:this[c(1587)+c(2066)+c(790)][c(1881)](this),success:this["_createS"+c(1583)+c(756)+"ler"][c(1881)](this)}))}[r(1587)+r(1583)+r(756)+r(2054)](){let t=r;Promise[t(1020)]()[t(1486)](()=>{this["_addWsLi"+t(1220)]()})}[r(1587)+r(2066)+r(790)](t){let n=r,o={LQiSC:function(c,d,g){return e[k(1323)](c,d,g)},JyIpP:e[n(769)],pDMCp:function(c,d,g){return c(d,g)},tdORk:e[n(1237)]};Promise[n(1020)]()[n(1486)](()=>{let c=n,d=o[c(726)](ge,o[c(558)],{message:this["_formatE"+c(1566)+"age"](t)});this.emit(o.JyIpP,d);let g=o[c(2109)](we,o[c(1715)],{reason:this["_formatE"+c(1566)+c(569)](t)});this[c(1308)](o[c(1715)],g)})}_addWsListeners(){let t=r,n={DnBdo:e[t(1425)],TkOru:function(o,c,d){return e[t(1240)](o,c,d)},JlvlJ:e[t(769)]};this[t(1418)].onOpen(o=>{let c=t;this[c(1308)](n[c(1307)],n[c(1907)](bs,c(1284),{...o,data:o[c(1329)]||""}))}),this[t(1418)][t(692)](o=>{let c=t;this[c(1308)](c(1820),we(e.DKnrv,{...o}))}),this[t(1418)][t(1912)+"e"](o=>{let c=t;this[c(1308)](e[c(1852)],ys(c(1281),{...o}))}),this[t(1418)][t(1950)](o=>{let c=t;this[c(1308)](n[c(1783)],n.TkOru(ge,n[c(1783)],{...o,message:o[c(1329)]||""}))})}[r(720)](t){let n=r,o={HpbjE:function(c,d,g){return c(d,g)},xYkfI:function(c,d,g){return e[k(614)](c,d,g)},nfQVf:"error"};if(e.amiyf(t,Uint8Array))if(e[n(1803)]!==e.Bagka)NoNgDO.HpbjE(_0x19d2cc,_0x3640e5,90),NoNgDO[n(1894)](_0x381794,_0x3ba6ff,_0x21dca1);else{let c=t[n(1702)][n(1645)](t.byteOffset,e[n(782)](t[n(1336)+"th"],t[n(1382)+"et"]));this._socket&&this[n(1418)][n(720)]({data:c,fail:d=>{let g=n;this[g(1308)](g(586),o[g(1609)](ge,o[g(1211)],{message:this["_formatErrorMess"+g(569)](d)}))}})}else this[n(1418)]&&this[n(1418)].send({data:t,fail:c=>{let d=n,g={hhKoj:function(p,u){return e.SWhXD(p,u)}};if(e[d(1173)](d(839),e[d(1098)]))this[d(1308)](e[d(769)],e[d(1116)](ge,e.NlLtp,{message:this[d(701)+d(1566)+d(569)](c)}));else{let p={wuIHl:function(u,_){let w=d;return KmZStU[w(968)](u,_)}};return function(u,..._){let w=d,v=_0x421a17[w(863)](p[w(981)](_0x4f0087,this),u,..._);return _0xc82653[w(794)](v,u.sort?u[w(522)]():[u]),p[w(981)](_0x24cbdd,v)}}}})}[r(1820)](t,n){let o=r;this[o(1418)]&&this._socket[o(1820)]({code:t,reason:n})}["addEvent"+r(840)](t,n){this.on(t,n)}[r(775)+"entListener"](t,n){this[r(1304)](t,n)}get[r(718)+"te"](){let t=r;return this[t(1418)][t(718)+"te"]}get[r(682)+"pe"](){let t=r;return this[t(1418)][t(682)+"pe"]}set[r(682)+"pe"](t){}get[r(1461)](){let t=r;return this[t(1418)][t(1461)]}get[r(518)](){let t=r;return this[t(1418)][t(518)]}get[r(1845)+"ns"](){return this._socket.extensions}get[r(1533)+r(1099)](){let t=r;return e.iQFKq(e[t(1612)],t(1363))?(_0x57995a|=0,{low:_0x4bae86,high:e[t(933)](_0x46c274,31),unsigned:e[t(1931)](_0x56c097,0)}):0}}function h0(s,t){let n=r;if(t)return new t(s.url,s[n(518)]);if(e.juXkB(Pt,Ze))return new l0(s[n(1461)],s[n(518)],s[n(1074)]);if((ct||Tt)&&e[n(717)]!=typeof WebSocket&&WebSocket)return new WebSocket(s[n(1461)],s[n(518)+"s"])}function g0(s){let t=r,n=e[t(575)][t(742)]("|"),o=0;for(;;){switch(n[o++]){case"0":if(Ze&&tt[t(1204)+t(1282)])return!0;continue;case"1":if(e.juXkB(ct,Tt)&&e.qqZxz(e[t(717)],typeof WebSocket)&&WebSocket)return!0;continue;case"2":if(s)return!0;continue;case"3":if(Pt&&wx[t(1204)+t(1282)])return!0;continue;case"4":return!1}break}}function Ss(s,t,n){let o=r,c={TxJAi:function(p,u){return e.KFTLS(p,u)},HngdU:function(p,u){return e[k(1757)](p,u)},iSGHq:function(p,u){return e[k(946)](p,u)},pUXwh:function(p,u){return e.SGBtO(p,u)},WJRlE:function(p,u){return e.zlGwS(p,u)},gevWG:o(1849),WkmXu:e[o(1505)],LheQy:e[o(848)]},d=-1;async function g(p){let u=o,_={aPdbQ:function(w,v){return c[k(731)](w,v)},nFCwc:function(w,v){return c[k(594)](w,v)},WskYi:function(w,v){return c[k(2056)](w,v)},RBpLi:function(w,v){return c[k(1194)](w,v)},uxkVH:function(w,v){return c[k(1194)](w,v)},SVkeb:function(w,v){return c[k(743)](w,v)}};if(c[u(2056)](c[u(573)],c[u(1174)])){let w=0,v=0;for(let A=0;_[u(1178)](A,_0x4f0b4f[u(1929)]);++A)v=_0x2d1e80[u(1937)+"At"](A),_[u(1178)](v,128)?w+=1:_[u(818)](v,2048)?w+=2:_[u(1268)](_[u(514)](64512,v),55296)&&_[u(1268)](_[u(1605)](64512,_0x1b8af1[u(1937)+"At"](_[u(1589)](A,1))),56320)?(++A,w+=4):w+=3;return w}else return p<=d?Promise[u(1596)](new Error(c[u(738)])):(d=p,c[u(2056)](p,n[u(1929)])?Promise[u(1020)]():n[p][u(1881)](s)(t,g.bind(null,p+1)))}e[o(908)](g,0)}function Es(s){let t=r,n=0,o=0;for(let c=0;e[t(1757)](c,s[t(1929)]);++c)o=s.charCodeAt(c),e[t(1305)](o,128)?n+=1:e.pGkGU(o,2048)?n+=2:e[t(1403)](64512&o,55296)&&e[t(1664)](e.PJBtW(64512,s[t(1937)+"At"](e[t(1109)](c,1))),56320)?(++c,n+=4):n+=3;return n}function Cs(s,t,n){let o=r;if(e[o(803)](n,t)<1)return"";let c="";for(let d=t;d<n;){let g=s[d++];if(e[o(1691)](g,127))c+=String[o(1280)+o(640)](g);else if(e[o(1299)](g,192)&&e[o(1689)](g,224))c+=String[o(1280)+o(640)](e[o(890)](e[o(1922)](e[o(2119)](31,g),6),63&s[d++]));else if(e[o(662)](g,224)&&e.uzrKM(g,240))c+=String[o(1280)+o(640)](e.UnbAa(e.KvKrp(e.klxyH(e[o(1934)](15,g),12),e[o(1553)](63,s[d++])<<6),e[o(1097)](63,s[d++])));else if(e[o(1299)](g,240))if(e[o(852)](e[o(1954)],e.IIGFu))this[o(1308)](e[o(769)],e[o(706)](_0xf1998f,o(586),{message:this[o(701)+o(1566)+"age"](_0x55ac54)}));else{let p=e.KTeJD(e.euVVV(e[o(669)](e[o(1267)](e[o(1888)](7,g)<<18,e.FqGYW(e[o(1054)](63,s[d++]),12)),e[o(1553)](63,s[d++])<<6),e[o(1392)](63,s[d++])),65536);c+=String[o(1280)+"Code"](55296+e[o(1093)](p,10)),c+=String[o(1280)+o(640)](e[o(2030)](56320,1023&p))}}return c}function ur(s,t,n){let o=r,c=n,d,g;for(let p=0;e.EOedw(p,s[o(1929)]);++p)if(d=s[o(1937)+"At"](p),e[o(1351)](d,128))t[n++]=d;else if(d<2048)t[n++]=e.dwvhQ(d>>6,192),t[n++]=e[o(745)](e[o(667)](63,d),128);else if(e.nCMLn(e[o(1731)](64512,d),55296)&&e.cWiEw(64512,g=s[o(1937)+"At"](e[o(1360)](p,1)))===56320){let u=e.BhgTE[o(742)]("|"),_=0;for(;;){switch(u[_++]){case"0":t[n++]=e[o(521)](e.BGanU(d,6),63)|128;continue;case"1":++p;continue;case"2":t[n++]=e[o(1688)](e.wXuNV(d>>12,63),128);continue;case"3":t[n++]=e[o(615)](e[o(1857)](63,d),128);continue;case"4":d=e[o(1373)](65536,e[o(1884)](e[o(1839)](1023,d),10))+e[o(1260)](1023,g);continue;case"5":t[n++]=e.oKqcj(d>>18,240);continue}break}}else t[n++]=e[o(2048)](e.IdGyw(d,12),224),t[n++]=e.zIKbe(e[o(867)](d>>6,63),128),t[n++]=e[o(1989)](e.SGBtO(63,d),128);return e.KTeJD(n,c)}async function As(s){let t=r;if(e[t(1813)]==typeof s){let n=new Uint8Array(e[t(1448)](Es,s));return e[t(1108)](ur,s,n,0),n}return e[t(1340)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(1702)],s.byteOffset,s[t(1336)+"th"])}function p0(s){let t=r;try{return e[t(1643)](e[t(1813)],typeof s)&&(s instanceof ArrayBuffer||s.buffer&&e[t(1340)](s[t(1702)],ArrayBuffer))||e[t(1813)]!=typeof s?"":(JSON[t(1943)](s),t(1495)+"ion/json")}catch{return e[t(1744)](e[t(1813)],typeof s)?e.TiQSC:""}}let m0=(s,t)=>{let n=r;switch(s){case e[n(1051)]:case e[n(924)]:return{["x-use-"+s]:1,"x-tt-env":t};default:return{}}};class _0{constructor(t){let n=r;this[n(813)+n(613)]=t,this[n(1952)]=0}[r(1467)](){this.count++}[r(1132)+r(1441)+"nt"](){let t=r;return e.bpIrL(this[t(1952)],this[t(813)+"ount"])}[r(1773)+"nter"](t=0){let n=r;this["maxLossC"+n(613)]=t,this.count=0}}async function w0(s){let t=r,n={VzXKD:function(o,c){return e[k(550)](o,c)},Ctdys:function(o,c){return e[k(1543)](o,c)},uEIgO:e[t(1636)],wSNno:t(1532)+"reason",TPOlK:function(o,c){return e[t(1861)](o,c)},NvGkp:e[t(874)],qMjDK:function(o,c){return o(c)},TDdMG:e.jTIJd,jMWDx:e.rncjC,uOmsO:function(o,c){return o+c},MysNN:e.eXLyc};return new Promise(o=>{let c=t,d={CbEMr:function(g,p){return g!==p},mvhPI:function(g,p){return n[k(597)](g,p)},cfAJG:n[c(1540)],JtykU:c(1913),oQUab:function(g,p){return n.VzXKD(g,p)},jQZVY:n[c(909)]};if(n.TPOlK(n[c(1107)],n[c(1107)])){let g=UDJkTR.VzXKD(_0x61b1b9,_0x26ea9b),p=_0x26c56d[c(2051)];return _0x152f9f[c(2051)]=_0x563968[c(1759)]+g,p}else{if(!ct)return n.qMjDK(o,n[c(909)]);try{if(n[c(623)](n.TDdMG,n.TDdMG))return new _0x226da8(_0x30b07b,{message:_0x2d62a3,code:_0x10cc44,error:_0x5e1789});{let g=document[c(900)+c(688)](n[c(578)]);window.frontierJSONP=p=>{let u=c,_={vWXfY:function(w,v){return d[k(1711)](w,v)},aFuKl:function(w,v){return d[k(791)](w,v)}};if(d[u(1711)](d[u(1767)],d[u(531)]))document[u(1243)][u(1122)+u(1344)](g),window[u(1781)+u(632)]=void 0,d[u(954)](o,p&&p[u(1823)]||d.jQZVY);else{let w=_0x446eb2[_0x2ba00d];if(fbjJWd[u(1503)](4,_0x58ddda[_0x26c961][u(1929)])){let v=_0x76d087[u(2020)+"g"](0,fbjJWd[u(1300)](4,_0x3b5ff9[_0x400f2b][u(1929)])),A=v[u(1491)](w);_0xa9c0f9=_0x1680df.concat(A)}else _0x4344db=_0x1c104c.concat(w)}},g.type="text/jav"+c(2047),g[c(1372)]=n[c(1105)](s[c(986)](/^ws/,c(604)),n[c(1741)]);try{document[c(1243)][c(1601)+"ild"](g)}catch{document[c(1243)]["removeCh"+c(1344)](g)}}}catch{window[c(1781)+c(632)]=void 0,o("unknown "+c(942))}}})}function Ge(s,t,n){let o=r;return!!s?.find(c=>c.key===t&&c[o(1584)]===n)}function ft(s,t){let n=r;return s?.[n(1956)](o=>o[n(873)]===t)?.[n(1584)]}let dr=null;async function y0(){let s=r;return dr||(dr=Promise[s(1020)]()[s(1486)](Pe.bind(Pe,s(1019)))),dr}class b0 extends fr{constructor(t,n){let o=r;if(o(746)===o(1049))return _0x21053f(e[o(612)](_0x1757b3,_0x421b42));super(),this[o(674)]=t,this[o(537)]=n,this[o(1430)]=void 0,this[o(1408)+o(2038)]=null}async[r(610)](){await this._init()}async[r(1798)](){let t=r,n={zkqdN:e[t(1987)],usKMu:function(o,c,d,g){return e[t(534)](o,c,d,g)},EskcN:e[t(769)]};if(e[t(1415)](e[t(1919)],e[t(1919)])){if(this[t(1430)])return;if(this[t(1408)+t(2038)])return this[t(1408)+t(2038)];try{let o=this[t(674)],c=this._keyPath;this[t(1408)+t(2038)]=(async()=>{let d=t,g={QTxsl:function(u,_){return u===_},eUaoK:n[d(563)]},{openDB:p}=await y0();this[d(1430)]=await n[d(1017)](p,d(1781)+"_"+o,1,{upgrade(u){let _=d;if(g[_(1965)](g[_(1538)],g[_(1538)]))u[_(1391)+"jectStore"](o,{keyPath:c});else return!!this[_(1430)]}})})(),await this._initPromise}catch(o){console[t(1972)](o)}finally{e[t(1968)](e[t(1882)],e[t(1882)])?this[t(1308)](fxJWfE[t(2044)],_0x2490d2(fxJWfE[t(2044)],{..._0x5c1eae,message:_0x195ff5[t(1329)]||""})):this[t(1408)+"mise"]=null}}else _0x3fcd31[t(794)](_0x1bc9f3,_0x412bf2)}async get(t){let n=r;try{return await this[n(1798)](),this[n(1430)]?.get(this._dbName,t)}catch(o){console[n(1972)](o)}}async[r(794)](t,n){let o=r;return await this[o(1798)](),this._qosDB?.put(this[o(674)],t)}async del(t){let n=r;try{return await this[n(1798)](),this._qosDB?.delete(this._dbName,t)}catch(o){console.log(o)}}async clear(){let t=r;try{return await this._init(),this[t(1430)]?.[t(1401)](this._dbName)}catch(n){console[t(1972)](n)}}async[r(965)](){let t=r;return await this[t(1798)](),this._qosDB?.[t(820)+"ys"](this._dbName)}async[r(1271)](){let t=r;return await this._init(),this[t(1430)]?.getAll(this._dbName)}async[r(1821)](){let t=r,n={ZWQau:function(o,c){return o|c},kAtdv:function(o,c){return e.kJUwZ(o,c)},BZBBM:function(o,c){return o|c},sqInU:function(o,c){return e.uIMKW(o,c)},KFawo:function(o,c){return e[k(869)](o,c)},lxZkf:function(o,c){return e[k(606)](o,c)}};if(e.ToOvn(e[t(2057)],e[t(1362)]))try{this._qosDB?.[t(1820)](),this[t(1430)]=void 0}catch(o){console[t(1972)](o)}else return new _0x39fe17(evniQa[t(2089)](evniQa[t(938)](evniQa.BZBBM(_0x3b8038[0],evniQa[t(1130)](_0x456cd2[1],8)),evniQa[t(1130)](_0x39a6b4[2],16)),evniQa[t(1130)](_0x39fd3d[3],24)),evniQa[t(630)](evniQa.BZBBM(evniQa[t(2089)](_0x5c8fa1[4],evniQa[t(1130)](_0x4202cd[5],8)),evniQa[t(1130)](_0x3a274d[6],16)),evniQa[t(1158)](_0x344192[7],24)),_0x630858)}get[r(587)](){let t=r;try{if(e[t(1146)](e[t(753)],e[t(963)]))e.LPfMz(_0x27c063,this,_0x373c85,[_0x5c3ebd,_0x565cc9,_0x252fd2]);else return!!this[t(1430)]}catch(n){return console.log(n),!1}}}class v0{constructor(t,n){let o=r;if(e.QvRmS!==e[o(2096)]){let c=_0x4229f2.pop();return c?(c[o(1759)]=c.limit=0,c):{bytes:new _0x2314cd(64),offset:0,limit:0}}else this[o(526)]=t,this._pathKey=n,this[o(1430)]=localStorage}async[r(610)](){}get[r(1277)](){return"frontier_"+this[r(526)]}async[r(1602)](t){let n=r,o=this[n(1430)].getItem(this[n(1277)]);return JSON.parse(e[n(1419)](o,"{}"))[t]}async set(t,n){let o=r;if(e.Saxzx(o(1993),e[o(1593)]))this[o(949)+"er"]&&_0x5588f8[o(775)+"entListener"](e[o(1062)],this[o(2006)+"nLine"]),this._isBrowser&&_0x1daa14[o(775)+o(1077)+"ner"](e[o(1075)],this["_handleO"+o(1541)]),this._isBrowser&&_0x1a28df["removeEv"+o(1077)+o(1232)](o(1662),this[o(1364)+o(1058)]),this._isBrowser&&_0x57d6fe[o(775)+o(1077)+o(1232)](e[o(1479)],this[o(1364)+o(1399)]);else{let c=this[o(1430)].getItem(this._prefix),d=JSON[o(1943)](e.rdpAk(c,"{}"));return d[n||t[this[o(1995)]]]=t,this[o(1430)][o(749)](this[o(1277)],JSON[o(1608)+"y"](d)),n||t[this._pathKey]}}async del(t){let n=r,o=this[n(1430)][n(1681)](this[n(1277)]),c=JSON[n(1943)](o||"{}");return c[t]=void 0,this._qosDB[n(749)](this[n(1277)],JSON[n(1608)+"y"](c))}async[r(1401)](){let t=r;return this[t(1430)][t(1401)]()}async[r(965)](){let t=r,n=this[t(1430)][t(1681)](this._prefix),o=JSON[t(1943)](e[t(1186)](n,"{}"));return Object[t(965)](o)}async[r(1271)](){let t=r,n=this[t(1430)][t(1681)](this._prefix),o=JSON.parse(e[t(1828)](n,"{}"));return Object.values(o)}[r(1821)](){let t=r;if(e[t(1379)](e[t(1161)],e[t(520)]))this[t(519)+t(851)]();else return Promise[t(1020)]()}get isReady(){let t=r,n={UcGSW:e.uhsYg,Lnjcy:function(o){return o()}};if(e.hynVD(t(1462),e[t(643)]))return!!this[t(1430)];this[t(1969)](n[t(1332)],_0x452672[t(1281)]),n.Lnjcy(_0x16faa0)}}class S0{constructor(t,n){let o=r,c={wMmwP:function(d,g){return d<g},TJqUo:function(d,g){return e[k(1008)](d,g)}};if(e[o(899)](e[o(619)],e.YLEcU)){let d=_0x380957.split(":");for(let g=0;iYbAmI.wMmwP(g,d[o(1929)]);g++){let p=d[g];if(iYbAmI[o(528)](4,d[g][o(1929)])){let u=_0x49247e.substring(0,4-d[g][o(1929)]),_=u[o(1491)](p);_0x43dd94=_0x2f1577[o(1491)](_)}else _0x169e2b=_0x52b688[o(1491)](p)}return _0x1eb891}else this[o(526)]=t,this[o(1995)]=n,this[o(1430)]=Ze?tt:Pt?wx:null}async[r(610)](){}get[r(1277)](){let t=r;return t(1781)+"_"+this[t(526)]}async[r(1602)](t){let n=r,o=this._qosDB[n(507)+n(1867)](this._prefix);return JSON[n(1943)](e[n(1429)](o,"{}"))[t]}async[r(794)](t,n){let o=r,c=this[o(1430)][o(507)+o(1867)](this[o(1277)]),d=JSON[o(1943)](e[o(1550)](c,"{}"));return d[n||t[this[o(1995)]]]=t,this[o(1430)].setStorageSync(this[o(1277)],JSON.stringify(d)),n||t[this[o(1995)]]}async[r(948)](t){let n=r,o=this[n(1430)][n(507)+"geSync"](this[n(1277)]),c=JSON.parse(o||"{}");return c[t]=void 0,this._qosDB[n(1518)+n(1867)](this[n(1277)],JSON.stringify(c))}async[r(1401)](){let t=r;return this._qosDB[t(702)+t(1426)]()}async[r(965)](){let t=r,n=this._qosDB[t(507)+t(757)+"nc"](this[t(1277)]),o=JSON[t(1943)](e[t(1356)](n,"{}"));return Object.keys(o)}async[r(1271)](){let t=r,n=this[t(1430)][t(507)+t(757)+"nc"](this[t(1277)]),o=JSON.parse(n||"{}");return Object[t(897)](o)}closeDB(){return Promise.resolve()}get[r(587)](){return!!this[r(1430)]}}function ks(s,t){let n=r;if(e[n(1186)](Ze,Ze))return new S0(s,t);if(e.juXkB(ct,Tt)&&e[n(1810)](e[n(717)],typeof indexedDB))return new b0(s,t);if(e.jEqXf(ct,Tt)&&e.RXOXt(e[n(717)],typeof localStorage))return new v0(s,t);throw new Error(n(1896)+"DB failed")}class E0{constructor(){let t=r;this[t(519)+t(1575)+"Id"]=null,this._interval=36e5,this._qosDB=ks(t(1183),e[t(730)])}async[r(519)+r(851)](){let t=r,n={PaJvH:function(o,c){return e[k(1901)](o,c)},rfnKX:function(o,c){return e[k(1368)](o,c)},hCmIs:function(o,c){return e[k(1459)](o,c)},rRrSc:e[t(892)]};e[t(1289)](clearInterval,this[t(519)+t(1575)+"Id"]),this[t(519)+t(1575)+"Id"]=setInterval(()=>{let o=t,c={khWWp:function(d,g){return n[k(1033)](d,g)},aOBhv:function(d,g){return n.rfnKX(d,g)}};if(n[o(1864)](n[o(2102)],o(859)))return HykDtb[o(1206)](HykDtb[o(1975)](1e4,_0x13d141[o(1837)]()),_0x14bfbe[o(516)](HykDtb[o(1975)](1e4,_0x1bfd04[o(1374)]())));this[o(2010)+o(1324)]()},this[t(519)+"l"])}async[r(610)](){let t=r;e[t(2077)]!==e[t(2077)]?this[t(2010)+"ired"]():await this._qosDB.openDB().then(()=>{let n=t;this[n(519)+n(851)]()})}async[r(2010)+r(1324)](){let t=r;(await this._qosDB?.getAll()||[]).filter(({timestamp:c})=>c<Date[t(1837)]())[t(1746)](c=>{let d=t;this[d(1430)]?.[d(948)](c.message_id)})}async[r(948)](t){let n=r;return this[n(1430)]?.[n(948)](t)}async[r(794)](t,n){let o=r;return this[o(1430)]?.[o(794)]({message_id:t,timestamp:n})}async[r(1602)](t){let n=r;return this[n(1430)]?.[n(1602)](t)}async[r(1821)](){let t=r;e[t(1248)](clearInterval,this._intervalTimeoutId),await this[t(1430)]?.[t(1821)]()}get[r(587)](){let t=r,n={bAxAW:function(o,c){return e[k(1258)](o,c)},jItOv:function(o,c){return e[k(498)](o,c)},uDKQs:function(o,c){return o<<c}};if(e[t(1617)]===e[t(1617)])return this._qosDB?.isReady;_0x154a41=eTHmLO[t(2032)](_0x5640e9,_0x5da3f5),eTHmLO[t(1653)](_0x12c0f4,32)&&(_0x1516be|=eTHmLO[t(599)](127&_0x13ba55,_0x251fb8)),_0x33e939+=7}}function lr(s){let t=r;if(e.weMCa(e[t(779)],t(904))){let n=!!this._options.enableQoS;if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e[t(2113)](Ge,s[t(1281)][t(1074)],e[t(506)],"2"),c=o&&Ge(s.message.headers,t(1450)+t(1061)+"ck","1"),d=o&&e[t(1499)](Ge,s.message[t(1074)],e[t(2059)],"1"),g=d?e[t(1473)](ft,s[t(1281)][t(1074)],e[t(1383)])?.[t(742)](",").filter(Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:c,isAckCleanupMessage:d,ackMsgIds:g}}else{if(e[t(1619)](_0x4ff81c.offset+_0x217f80,_0x31fb94[t(2051)]))throw new _0x2e27bf(t(921)+"t limit");_0x1f8745[t(1759)]+=_0x489ede}}async function Ds(){let s=r;return this[s(1276)+s(1285)]||(this[s(1276)+s(1285)]=new E0),this[s(1276)+s(1285)].isReady||await this["_QoSMana"+s(1285)][s(610)](),this[s(1276)+s(1285)]}async function C0(s,t){let n=r,{enableAutoAck:o}=this[n(559)],c=e[n(1749)](Ge,s[n(1281)][n(1074)],e.QIXJq,"1"),d=e[n(1749)](Ge,s[n(1281)][n(1074)],"is_ack","1"),g=lr[n(863)](this,s);if(e.idlQY(o,c)){let{SeqID:p,LogID:u,service:_,LogIDNew:w,method:v}=s[n(1281)];this[n(1e3)]({SeqID:p,LogID:u,LogIDNew:w,service:_,method:v,headers:[{key:n(1005),value:"1"},{key:e[n(1139)],value:e[n(1626)](w,"")},{key:n(888),value:"0"}]})}d&&!g[n(709)]&&this[n(1089)+n(1787)+n(2106)](s),t()}async function A0(s,t){let n=r;this._debug(e[n(710)],s.message),t()}async function k0(s,t){let n=r;if(e[n(999)](e[n(1848)],"DcmwO")){let o=e.dSejO(cs,await e[n(550)](As,s.data));try{if(e[n(1522)](o[n(2034)],Uint8Array)){let c=e.cvVHr(this[n(559)]["payloadE"+n(1388)],Object)?{force:!!this[n(559)][n(1809)+n(1388)].force,encoding:this[n(559)][n(1809)+"ncoding"][n(1983)]?this[n(559)][n(1809)+n(1388)][n(1983)][n(986)](/\s/g,"")[n(1671)+n(1805)]():""}:{force:!1,encoding:this[n(559)].payloadEncoding?this._options[n(1809)+n(1388)][n(986)](/\s/g,"")[n(1671)+n(1805)]():""},d=o[n(1809)+n(1388)]?o[n(1809)+"ncoding"][n(986)](/\s/g,"")[n(1671)+n(1805)]():"",g=e[n(1434)](this._options["payloadT"+n(967)],Object)?{force:!!this[n(559)]["payloadT"+n(967)].force,type:this._options[n(1520)+n(967)][n(1984)]?this[n(559)].payloadType.type[n(986)](/\s/g,"")[n(1671)+n(1805)]():""}:{force:!1,type:this._options[n(1520)+n(967)]?this[n(559)][n(1520)+n(967)].replace(/\s/g,"")[n(1671)+n(1805)]():""},p=o[n(1520)+n(967)]?o[n(1520)+n(967)].replace(/\s/g,"")["toLowerC"+n(1805)]():"",u=g[n(1886)]?g[n(1984)]:p||g[n(1984)],_=c[n(1886)]?c[n(1983)]:d||c.encoding,w=[n(1815)+"in;chars"+n(1542),e.XIVTe,e[n(990)],n(1600)],v=[e.QpNlc,e[n(500)]];this[n(559)][n(647)+"ansformTextPayload"]&&w.includes(u)&&(!_||v[n(1250)](_))?o[n(1620)+n(876)]=Cs(o[n(2034)],0,o[n(2034)][n(1336)+"th"]):o[n(1620)+n(876)]=""}else o["textPayl"+n(876)]=""}catch(c){o[n(1620)+"oad"]="",console.log(c)}s.message=o,t()}else this[n(1230)+"T"]||this[n(1716)+"X"]?this["_onPageN"+n(1920)+"ange"]():this[n(949)+"er"]&&this["_initGlo"+n(1591)+n(840)]()}function D0(s,t,n){let o=r,c={OYeOO:function(_,w){return e[k(1977)](_,w)},btSFu:function(_,w){return _(w)},zRKxQ:function(_,w){return e[k(1334)](_,w)},hJYrJ:function(_,w){return e[k(1274)](_,w)}},d=e[o(584)](n,8192),g=d>>>1,p=null,u=d;return function(_){let w=o;if(c[w(1930)](_,1)||_>g)return c[w(564)](s,_);c[w(1958)](u,_)>d&&(p=s(d),u=0);let v=t[w(863)](p,u,u+=_);return c.hJYrJ(7,u)&&(u=c[w(1958)](7|u,1)),v}}let P0=4294967295;function T0(s,t,n){let o=r;if(e[o(1126)](e[o(1298)],e.OtZGG))return e[o(1128)](RangeError,e.rIAOs(e[o(1935)](e[o(1025)](e[o(1524)](e[o(1661)](e[o(1670)],s),e[o(953)]),e.MulER(t,1)),e.QkgVu),n));{_0x2fec3d.isLong(_0x18f387)||(_0x5072aa=_0x180343[o(878)+"er"](_0x1cfb8b));let c=this[o(1411)]>>>16,d=65535&this[o(1411)],g=e.eRsoI(this[o(1933)],16),p=e.Eyoyd(65535,this[o(1933)]),u=_0x30d3c8[o(1411)]>>>16,_=e.NamGf(65535,_0x27b03d[o(1411)]),w=e[o(767)](_0x47bc04.low,16),v=65535&_0x32b155.low,A=0,P=0,T=0,M=0;return M+=e.NWgdL(p,v),T+=e[o(1932)](M,16),M&=65535,T+=g+w,P+=T>>>16,T&=65535,P+=e[o(814)](d,_),A+=P>>>16,P&=65535,A+=e[o(1038)](c,u),A&=65535,_0x51fa00[o(1259)](e[o(1692)](e[o(1627)](T,16),M),e[o(752)](A<<16,P),this[o(1279)])}}function I0(s,t,n){let o=r;if(e.iGdXt(n,P0))throw new Error(e[o(1086)]);let c=3;for(;e[o(1931)](c,0);)if(e[o(1008)](o(2067),e.IqrfN)){let d=e[o(1274)](255,n);gr(d,s,e[o(2037)](t,c)),n>>>=8,c--}else{let d=e[o(689)][o(742)]("|"),g=0;for(;;){switch(d[g++]){case"0":if(e[o(1828)](_0x4d945d,_0x156fdc)&&e[o(1024)](e.roEPd,typeof _0x5dbfe8)&&_0x1c123c)return!0;continue;case"1":if(_0x4965b2&&_0x158e21[o(1204)+o(1282)])return!0;continue;case"2":if(_0x2e0837)return!0;continue;case"3":return!1;case"4":if(_0x4f01e1&&_0x4fdff6[o(1204)+o(1282)])return!0;continue}break}}return t+4}function R0(s,t){let n=r,o=0,c=t,d=e[n(1493)](t,4);for(;e[n(1078)](c,d);)if(e[n(2046)](n(505),e[n(2053)]))_0x3c8fb2(_0x4102ee,16),e.qaBIr(_0x53231f,_0x40d9b8,_0xc3257f);else{let{value:g,offset:p}=e[n(585)](hr,s,c);c=p,o=e[n(1487)](o,8)>>>0,o+=g}return{value:o,offset:d}}function N0(s,t,n){let o=r;if(e[o(1579)]===e[o(934)])this[o(499)]=!0,this[o(1348)]();else{let c=e.smXBC[o(742)]("|"),d=0;for(;;){switch(c[d++]){case"0":if(!s)return n;continue;case"1":if(t[o(527)])return t.write(s,n)+n;continue;case"2":if(e[o(983)](s[o(1929)],40))return e[o(2113)](ur,s,t,n)+n;continue;case"3":if(t[o(793)+"e"])return e[o(1599)](t[o(793)+"e"](s,n),n);continue;case"4":return e[o(1334)](e[o(835)](ur,s,t,n),n)}break}}}function L0(s,t){let n=r,o=new K(e.ekgkv(e[n(1994)](e[n(1296)](s[e[n(716)](t,4)],24),e[n(1574)](s[e[n(2041)](t,5)],16))|e.eDAco(s[e[n(1708)](t,6)],8),s[e.TPULV(t,7)]),e.rUSuC(e[n(776)](e.hjHJf(s[e.aYAUe(t,0)],24),e[n(1941)](s[t+1],16))|e[n(1627)](s[e[n(823)](t,2)],8),s[e[n(2037)](t,3)]),!0);return t+=8,{value:o,offset:e.QmYPV(t,8)}}function B0(s,t,n){let o=r,c={rvXqe:function(d,g){return d!==g},MeQKM:function(d,g){return e[k(1543)](d,g)}};if(e[o(1861)](e.kBfuS,e[o(2e3)])){if(QMYwPv[o(1137)](4,_0x5227cf[o(1929)])){let d=_0x54db56[o(2020)+"g"](0,QMYwPv[o(637)](4,_0x8d8c49[o(1929)])),g=d.concat(_0x5f14d8);_0x489940[o(1560)](g)}else _0x3833e4[o(1560)](_0x4b860e);_0x124fea&&(_0x3fd028+=1),_0xdb59ad+=1,_0x2e239a=!1}else{let d=s[o(1933)],g=s.high;return t[n]=e[o(700)](g,24),t[n+1]=g>>>16&255,t[n+2]=e[o(2011)](e[o(1814)](g,8),255),t[e[o(1865)](n,3)]=e.sAZQF(255,g),t[e[o(560)](n,4)]=e[o(1814)](d,24),t[e[o(770)](n,5)]=e.kODZW(e[o(1756)](d,16),255),t[e[o(546)](n,6)]=e[o(1875)](e.WigSV(d,8),255),t[n+7]=e[o(893)](255,d),n+=8,n}}function hr(s,t){let n=r;return s[n(872)+"8"]?{value:s[n(872)+"8"](t),offset:t+1}:{value:255&s[t],offset:e[n(1797)](t,1)}}function gr(s,t,n){let o=r;return t[o(705)+"t8"]?t[o(705)+"t8"](s,n):t[n]=e[o(1915)](255,s),e.jqHhv(n,1)}let O0=function(s){return new Uint8Array(s)},z0=e[r(801)](r(708)+"d",typeof Buffer)?Buffer[r(1732)+r(1794)]:e[r(821)](D0,O0,Uint8Array[r(535)+"e"].subarray),M0=16,pr=32;function q0(s){let t=r,n=0,o={};for(let c=0;c<s[t(1929)];c++)o[s[c][t(663)+t(698)]]=e[t(751)](Es,s[c]["cursor_n"+t(698)]),n+=14+o[s[c][t(663)+"ame"]];return[n,o]}function Ps(s,t,n){let o=r,c={whnbh:function(_,w,v,A){return _(w,v,A)},HZptB:function(_,w){return _===w},xGJhH:e[o(1525)],nNsoa:o(759),nEpeX:function(_,w,v,A){return e[o(1572)](_,w,v,A)},hHYYB:e[o(501)],vJMcN:function(_,w,v,A){return _(w,v,A)},zprEy:function(_,w,v,A){return e[o(1100)](_,w,v,A)}},[d,g]=e[o(1248)](q0,s),p=e[o(1127)](z0,d),u=0;return s[o(1746)](_=>{let w=o,v={LUvfB:function(A,P,T,M){return c[k(1876)](A,P,T,M)}};if(c[w(1245)](w(1897),c[w(922)]))console[w(1972)](w(1634)+w(810),_,_[w(1397)]),u=gr(0,p,u),console[w(1972)](c[w(860)],u),u=c[w(696)](I0,p,u,_[w(1397)]||0),console.log(c[w(1835)],u),u=c[w(1409)](gr,g[_["cursor_n"+w(698)]],p,u),console[w(1972)](w(1770)+w(1003),u),u=c[w(2087)](N0,_[w(663)+w(698)],p,u),console[w(1972)]("name",u),u=B0(K[w(878)+"er"](_[w(1877)]||t),p,u),console[w(1972)](w(1883),u);else throw _0x538372=_0x3954cc[w(1929)],goHzOh[w(795)](_0x3d9e6a,_0x3569a3,10,_0x10379b[w(1929)])}),{frameType:pr,headers:[{key:e[o(1496)],value:n}],payload:p}}function K0(s){let t=r,n=0,o=[];for(;n<s[t(1336)+"th"];){let{offset:c}=e[t(1359)](hr,s,n);n=c;let d={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e[t(970)](R0,s,n);d[t(1397)]=g,n=p;let{value:u,offset:_}=e[t(2040)](hr,s,n);n=_,d[t(663)+t(698)]=e[t(1460)](Cs,s,n,e[t(1524)](n,u)),n+=u;let{value:w,offset:v}=e[t(728)](L0,s,n);d[t(1877)]=w[t(1143)](),n=v,o[t(1560)](d)}return o}function U0(){let s=r,t={lramB:function(n,o){return e.omLuS(n,o)},WENzJ:function(n,o){return n===o}};return e[s(1427)](e[s(1048)],e[s(1048)])?{frameType:pr,headers:[{key:e.ltATr,value:e.NMtIo}],payload:void 0}:!!(TphuNZ.lramB(this[s(671)+s(1060)],this.endpoints[s(1929)])||this[s(671)+s(1060)]===this[s(1213)+"s"].length-1&&TphuNZ[s(1869)](this["currentE"+s(725)+s(804)+"t"],this[s(1925)+"es"]))}class F0{constructor(t,n,o){let c=r;this["_cursorN"+c(1484)]=t,this[c(786)+c(1422)]=n,this[c(1655)+c(1216)]=o,this[c(1430)]=e.tfxkB(ks,this[c(1604)+c(1484)],"cursor_n"+c(698))}async[r(610)](){let t=r;await this._qosDB[t(610)]()}async getCursors(){let t=r;if(!this._qosDB.isReady)return;let n=this[t(1655)+"Strategy"],o=await this._qosDB[t(1271)]();switch(console[t(1972)](e[t(1674)],o),n){case e[t(1380)]:return o&&o[t(1929)]?e.bbRoC(Ps,o,0,this[t(786)+t(1422)]):void 0;case e.KUJNX:return;case e.vLnQm:return o&&o[t(1929)]?Ps(o,0,this["_cursorF"+t(1422)]):e[t(1862)](U0)}}async set(t,n,o){let c=r;return console[c(1972)](e[c(1513)],t,n,o),this[c(1430)].set({cursor_name:t,cursor:n,service:o})}async[r(1779)+"rs"](t){let n=r,o=e[n(825)](K0,t);for(let c of o)console[n(1972)](e[n(1417)],o),await this[n(1430)][n(794)](c)}async[r(1602)](t){let n=r;if(e[n(661)](e[n(1562)],n(2016)))return(await this[n(1430)][n(1602)](t))?.cursor;this[n(786)+n(1422)]=_0x5b82b6}async[r(1821)](){let t=r;await this[t(1430)][t(1821)]()}[r(966)+r(2105)+r(1293)](t){let n=r;this[n(786)+"ileName"]=t}get[r(587)](){let t=r;return this[t(1430)][t(587)]}}let H0=e[r(995)];async function Ts(s){let t=r,n={OwjAl:function(o,c){return e[k(561)](o,c)}};if(e[t(1459)](e[t(1991)],e[t(819)])){let o=this[t(1430)].getItem(this[t(1277)]),c=_0x495da6[t(1943)](iYdCXH[t(1066)](o,"{}"));return _0x3530b3.keys(c)}else{if(!this[t(559)][t(1782)+"S"])return null;let{aID:o,fpID:c,messageStrategy:d}=this[t(559)],g=e[t(1435)](s,H0);try{return this[t(1264)+"anager"]?s&&this[t(1264)+t(1730)]["updateCu"+t(2105)+t(1293)](s):this[t(1264)+t(1730)]=new F0(c+"_"+o+"_"+g,g,d),this[t(1264)+t(1730)].isReady||await this[t(1264)+"anager"][t(610)](),this[t(1264)+t(1730)]}catch{return null}}}async function j0(s,t){let n=r,o={pQUUI:function(P,T){return P>=T}},c=e[n(2113)](Ge,s[n(1281)][n(1074)],e[n(1979)],"-1"),d=e[n(1057)](Ge,s[n(1281)][n(1074)],e.nhcyH,"1"),g=e[n(1251)](ft,s[n(1281)][n(1074)],e.MGrGn),p=e[n(1777)](Number,e.vEIQT(ft,s[n(1281)][n(1074)],e.yNERC))||0,u=lr.call(this,s),_=Ge(s[n(1281)][n(1074)],e[n(865)],"2"),w=e[n(1141)](ft,s[n(1281)][n(1074)],e[n(1918)]),v=e[n(958)](Number,e[n(1323)](ft,s.message.headers,n(962)+n(919)+"ue"));if(u.isQoSAck)return e[n(1481)](t);let A=u[n(1638)+n(932)]?await Ds[n(863)](this):null;if(e[n(1136)](s[n(1281)][n(1397)],0)&&d&&!c||s.message[n(1397)]>0){if(g&&u[n(1638)+"sage"]&&A)if(e[n(1008)](e[n(1396)],n(627))){if(!!!await A.get(g)){if(e[n(1316)](e.YIclb,e[n(925)]))return QoVDkI[n(1772)](this.count,this[n(813)+n(613)]);this[n(1089)+n(1992)+"Event"](s),await A[n(794)](g,e[n(1564)](Date[n(1837)](),p))}return e[n(1659)](t)}else return _0x10bc53[n(914)+n(713)]||_0x19ec8e[n(1602)](_0x32cfda);if(_){let P=await Ts[n(863)](this);if(!P)return e[n(1145)](e[n(1545)],e[n(772)])?(this[n(1089)+n(1992)+n(2088)](s),e.gqcLk(t)):this[n(1430)][n(587)];let T=await P[n(1602)](w)??-1;if(e.OZRnk(T,v))this[n(1089)+n(1992)+n(2088)](s),P[n(794)](w,v,s[n(1281)][n(1397)]);else throw new Error(n(2065)+" message"+n(1210)+v+(" larger "+n(1955)+n(2025)+"r ")+T);return e[n(598)](t)}return this[n(1089)+n(1992)+n(2088)](s),e[n(1788)](t)}}async function G0(s,t){let n=r;if(e[n(755)](e[n(1879)],e[n(1879)]))this[n(813)+n(613)]=_0x58ec1d,this[n(1952)]=0;else{let o=lr[n(863)](this,s);if(!o[n(1638)+n(932)])return e[n(1035)](t);let c=await Ds[n(863)](this);if(o[n(1301)+n(2050)+"age"]&&o.ackMsgIds[n(1929)])for(let d of o[n(780)+"s"])await c.del(d);e[n(1236)](t)}}async function W0(s,t){let n=r,o=e[n(852)](s.message.frameType,M0),c=s[n(1281)][n(2004)+"e"]===pr;if(e[n(883)](!o,!c))return e.ndJLw(t);let d=e[n(970)](ft,s.message.headers,e[n(1496)]);if(!d)return e[n(1236)](t);let g=await Ts.call(this,d);if(!g)return e.RCDjp(t);if(o){let p=await g[n(1693)+"rs"](),u={frameType:p?.[n(2004)+"e"],SeqID:K.fromNumber(this[n(1265)]++),LogID:K[n(878)+"er"](this[n(559)][n(841)+n(704)]()),service:9e3,method:5,headers:p?.headers,payload:p?.[n(2034)]},_=D(u);this._ws&&this[n(1270)][n(718)+"te"]&&this[n(1270)][n(720)](_)}if(c){let p=s.message.payload;p&&g[n(1779)+"rs"](p)}}let J0=async function(s,t){let n=r;if(e.XuRof("NCyjQ",e[n(675)]))return this[n(1223)+n(725)+n(804)+"t"]=1,this[n(671)+"ndex"]++,this.endpoints[this[n(671)+"ndex"]];this[n(499)]=!1,e[n(958)](clearTimeout,this["_connect"+n(947)+"utId"]),e[n(1659)](t)},V0=async function(s,t){let n=r;if(!this[n(1270)]||e[n(1125)](this._ws.readyState,this.OPEN))return e.kIsyw(t);let{pingInterval:o}=this[n(559)];this[n(1272)+n(773)]?.[n(695)+n(1084)+n(805)]();for(let d=0;e.nGqIG(d,this[n(1655)+n(1104)][n(1929)]);d++){let g=this[n(1655)+n(1104)][d];if(this[n(1270)][n(718)+"te"]===this[n(2064)]&&e[n(755)](null,g))this._ws&&this[n(1270)][n(720)](g),this._messageQueue[d]=null;else break}this[n(1655)+n(1104)]=this[n(1655)+"Queue"][n(1313)](d=>!!d),this[n(1283)+n(1614)+"Id"]=e[n(681)](setTimeout,()=>this._ping(),o),this[n(1089)+n(533)+"nt"](s),this._isBrowser&&this._ws&&(this._ws[n(682)+"pe"]=this._binaryType);let c=this[n(1272)+n(773)]?.["getCurre"+n(1501)+"nt"]();this._debug(n(1854)+c+n(651)),t()},X0=async function(s,t){let n=r,o=this[n(1272)+n(773)]?.[n(927)+n(1501)+"nt"]();this[n(1969)]("open "+o),t()};class Y0 extends fr{constructor(t){let n=r,o={ajJYe:e[n(1649)],OFAns:e[n(1052)],PRVyq:n(2079),lspLq:n(1509),lqyCT:function(p,u,_){return e[n(515)](p,u,_)},yXYSH:function(p,u){return p===u},uvPkA:function(p,u,_,w){return e[n(1108)](p,u,_,w)},EUAps:function(p,u,_){return e[n(515)](p,u,_)},VmTEo:e[n(1237)],VHOXs:function(p,u){return e[n(2052)](p,u)},KyqsF:function(p,u,_){return e[n(2027)](p,u,_)},ixEQC:function(p,u){return e[n(2035)](p,u)},umKGk:function(p,u,_){return e.EoDch(p,u,_)},KkJfR:function(p,u,_){return e.SoDdg(p,u,_)},hznxQ:function(p,u){return e[n(1717)](p,u)}};super(),this[n(1508)+"igatorOn"+n(1039)]=!0,this[n(949)+"er"]=ct,this[n(551)]=d0,this[n(1230)+"T"]=Ze,this[n(1716)+"X"]=Pt,this._isWorker=Tt,this["_message"+n(1104)]=[],this["_endpoin"+n(773)]=null,this[n(1514)+n(1683)]=!1,this[n(2042)+n(967)]=n(1610)+"fer",this[n(1348)+n(676)]=!1,this[n(1348)+n(947)+n(1076)]=null,this[n(1629)+n(1366)+n(712)]=null,this[n(1283)+"gTimeoutId"]=null,this[n(1265)]=0,this[n(499)]=!1,this[n(1257)]="",this["_QoSMana"+n(1285)]=null,this[n(1264)+n(1730)]=null,this[n(1179)+n(1961)]=null,this[n(1565)+"ls"]=e[n(1117)],this[n(2015)]=3,this[n(1669)+"NG"]=0,this[n(2064)]=1,this.CLOSING=2,this[n(1856)]=p=>{let u=n;try{e[u(1572)](Ss,this,p,[J0,V0,X0])}catch(_){if(e[u(1459)](e[u(1424)],e[u(858)]))return new _0x467123(_0x52489b,{code:_0x4d5109,reason:_0x2c85a0,wasClean:_0x57e439,willReconnect:_0x4d7861});{let w=e[u(2070)](ge,e[u(769)],{message:_[u(1281)],code:je[u(2094)+"OR"],error:_});this["_dispatchErrorEv"+u(1725)](w)}}},this._onMessage=async p=>{let u=n,{pingInterval:_,pingFrequency:w}=this[u(559)];if(p.data==="hi"&&o[u(955)]===w||o.OFAns===w){if(o[u(846)]!=="zlewx")return this[u(1418)][u(682)+"pe"];this["_clearPi"+u(800)](),this[u(1308)](u(1444)+u(1451)+"s",o[u(1556)]),this._pingPongTimeoutId=o[u(1535)](setTimeout,this[u(750)].bind(this),_)}if(!o[u(1159)]("hi",p.data))try{o[u(1843)](Ss,this,p,[k0,C0,G0,W0,j0,A0])}catch(v){let A=o.lqyCT(ge,u(586),{message:v[u(1281)],code:je[u(1113)+u(1335)],error:v});this[u(1089)+u(1628)+u(1725)](A)}},this[n(2012)]=p=>{let u=n,_={rQntx:e[u(1624)],EKalO:e[u(769)]},w=this._endpointManager?.[u(1132)+u(1149)+"es"](),v=this[u(1272)+u(773)]?.[u(927)+u(1501)+"nt"]();if(w&&!p.message)if(e[u(611)](e[u(764)],e[u(764)]))_0x3463f1["removeEv"+u(1077)+"ner"](JzuRal.rQntx,_0x1e0980),_0x5d6ad5["removeEv"+u(1077)+u(1232)](JzuRal[u(581)],_0xfa8d25);else{let A=u(1962)+v+(u(1337)+u(1064)+u(2116)+"ed");this[u(1089)+u(1628)+u(1725)](e[u(1726)](ge,u(586),{message:A,code:je[u(683)+u(1326)+"R"],error:p}));return}this._ws&&e[u(511)](this._ws.readyState,this[u(2064)])&&this[u(555)+"ect"](),this[u(1089)+u(1628)+"ent"](e.HEyJs(ge,"error",{message:p.message,code:je[u(1549)+u(517)],error:p}))},this[n(1998)]=async p=>{let u=n;this[u(763)+u(1577)](),this[u(1170)+u(800)](),this._removeWsListeners(),this[u(1270)]=null,this["_connect"+u(676)]=!1;let _=this[u(1272)+"tManager"]?.[u(1132)+u(1149)+"es"]();if(!_&&this[u(1013)+u(1217)]()&&!this["_readyCl"+u(1683)]){let w=this[u(1272)+u(773)]?.[u(927)+u(1501)+"nt"](),v=this._options["reconnectInterce"+u(960)](p[u(1253)],p.reason);this._dispatchCloseEvent(o[u(1974)](we,o.VmTEo,{code:1006,reason:p[u(942)]||u(1433)+"ng failed, unkno"+u(1169)+u(1696)+"ame: "+w,willReconnect:v})),v&&this[u(1348)]();return}if(o[u(1973)](1e3,p[u(1253)])&&this[u(1514)+"osed"]){this[u(1089)+u(758)+u(1725)](o[u(1483)](we,o[u(1607)],{code:1e3,reason:"bye"})),this[u(1272)+u(773)]?.[u(695)+u(1084)+u(805)](),this._pingLossCounter?.[u(1773)+"nter"]();return}if(o[u(976)](1e3,p[u(1253)])&&_){let w=this["_endpoin"+u(773)]?.[u(927)+u(1501)+"nt"](),v=p[u(942)];v||(v=await w0(this[u(1257)])),v="connecti"+u(1492)+u(1531)+v+(u(1850)+u(806))+w+(u(1442)+u(1652)+"ached"),this["_dispatc"+u(758)+"ent"](o.umKGk(we,u(1820),{code:p[u(1253)],reason:v}));let A=u(1962)+w+(" fail, max retri"+u(2116)+"ed");this[u(1089)+u(1628)+"ent"](o[u(1871)](ge,"error",{message:A,code:je[u(683)+u(1326)+"R"]})),this["_endpoin"+u(773)]?.[u(695)+"pointCon"+u(805)](),this[u(1179)+u(1961)]?.[u(1773)+u(977)]();return}if(o.hznxQ(1e3,p[u(1253)])&&!p[u(942)]){let w=this["_endpoin"+u(773)]?.[u(927)+u(1501)+"nt"]();this[u(1089)+u(758)+u(1725)](o.EUAps(we,o.VmTEo,{code:p.code,reason:u(1433)+u(1492)+"d, unkno"+u(1169)+u(1696)+u(2014)+w})),this[u(1272)+u(773)]?.["resetEndpointCon"+u(805)](),this["_pingLos"+u(1961)]?.[u(1773)+u(977)]();return}this[u(1089)+u(758)+u(1725)](p),this[u(1272)+u(773)]?.[u(695)+u(1084)+"fig"](),this["_pingLos"+u(1961)]?.[u(1773)+u(977)]()},this[n(796)]=null,this[n(781)]=null,this[n(607)+"e"]=null,this[n(1890)]=null,this["onStartR"+n(1547)]=null,this[n(1706)+n(1327)]=null,this[n(721)+n(1249)+n(1200)+"ct"]=null,this["_handleO"+n(929)]=this[n(2006)+n(929)][n(1881)](this),this["_handleO"+n(1541)]=this[n(2006)+n(1541)][n(1881)](this),this[n(1364)+n(1058)]=this["_handleP"+n(1058)].bind(this),this._handlePageShow=this[n(1364)+n(1399)][n(1881)](this),this[n(559)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e.AHFrR(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(1052)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e[n(1148)],env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:d}=t,g=Array[n(1018)](c)?c:e[n(1239)](n(1600),typeof c)?[c]:[];if(!g||e.nXYEU(0,g[n(1929)]))throw new Error(e[n(1571)]);if(!e[n(1446)](g0,d))throw new Error(n(1611)+n(1001)+n(1297)+n(570)+n(1021)+"tructor is undef"+n(1475));Object.assign(this[n(559)],t),this[n(1272)+n(773)]=new vs(g,this[n(559)][n(1925)+"es"]),this[n(1179)+n(1961)]=new _0(this._options[n(1184)+n(2071)]),this[n(559)][n(1685)+"cOpen"]&&(this[n(499)]=!0,this[n(1348)]()),this[n(559)]["listenNe"+n(1866)+n(907)]&&(this[n(1230)+"T"]||this[n(1716)+"X"]?this[n(1423)+n(1920)+n(996)]():this[n(949)+"er"]&&this[n(1322)+n(1591)+n(840)]())}[r(2006)+"nLine"](){let t=r;this[t(559)].disableAutoReconnect||this[t(1514)+t(1683)]||this[t(1004)+t(1547)]()}[r(2006)+r(1541)](){let t=r;this["_destroy"+t(1677)+"t"]();let n=e.xcAqw(cr,e.CYspf,{message:e[t(1800)]});this[t(721)+t(1249)+"yReconnect"]&&this[t(721)+"mediatel"+t(1200)+"ct"](n)}[r(1322)+r(1591)+r(840)](){let t=r;this[t(949)+"er"]&&window[t(697)+t(840)](e[t(1062)],this[t(2006)+"nLine"]),this._isBrowser&&window["addEvent"+t(840)](t(847),this[t(2006)+t(1541)]),this[t(949)+"er"]&&window[t(697)+t(840)](e[t(1911)],this[t(1364)+t(1058)]),this[t(949)+"er"]&&window[t(697)+"Listener"](e[t(1479)],this[t(1364)+"ageShow"])}[r(1580)+r(1591)+"Listener"](){let t=r;this[t(949)+"er"]&&window[t(775)+t(1077)+t(1232)](e.ciAQr,this["_handleO"+t(929)]),this[t(949)+"er"]&&window[t(775)+t(1077)+t(1232)](t(847),this._handleOffLine),this[t(949)+"er"]&&window[t(775)+t(1077)+t(1232)](e[t(1911)],this["_handleP"+t(1058)]),this[t(949)+"er"]&&window[t(775)+t(1077)+t(1232)](t(1990),this["_handleP"+t(1399)])}[r(1364)+r(1058)](t){let n=r;!t.persisted&&(this[n(949)+"er"]&&window[n(775)+"entListe"+n(1232)](e[n(1911)],this[n(1364)+n(1058)]),this[n(949)+"er"]&&window["removeEv"+n(1077)+n(1232)](e[n(1479)],this._handlePageShow),this[n(1820)]()),this[n(949)+"er"]&&window[n(775)+n(1077)+n(1232)](e[n(1062)],this["_handleO"+n(929)]),this[n(949)+"er"]&&window[n(775)+n(1077)+n(1232)](e[n(1075)],this[n(2006)+"ffLine"])}[r(1364)+"ageShow"](t){let n=r;if(e[n(611)](e[n(539)],e[n(1476)]))t[n(509)+"d"]&&(this[n(1013)+"orOnline"]()&&(!this._ws||e.ngjEb(this[n(1270)][n(718)+"te"],this[n(2064)])||e[n(957)](this._ws[n(718)+"te"],this[n(1669)+"NG"]))&&this[n(2006)+"nLine"](),this[n(949)+"er"]&&window.addEventListener(n(1432),this[n(2006)+n(929)]),this[n(949)+"er"]&&window[n(697)+"Listener"](e.JEcez,this[n(2006)+n(1541)]));else return _0x3a8693===_0x3c0573?_0x325d96:new _0x360998(e[n(1789)](e[n(1044)](e[n(1808)](e[n(1791)](_0x42033f[n(863)](_0x404bda,0),e.poOPI(_0x29ed4d.call(_0x4db99a,1),8)),e[n(855)](_0x336a68[n(863)](_0x2587a5,2),16)),e[n(1844)](_0x140516[n(863)](_0x7b3e89,3),24)),0),e[n(735)](e[n(734)](_0x281455.call(_0x27cc98,4)|e[n(1884)](_0x3c9b2d.call(_0x312a72,5),8)|_0xa6218[n(863)](_0x4ad31d,6)<<16,e[n(913)](_0x8856f4[n(863)](_0x166f0b,7),24)),0),!0)}async[r(1262)+"eUrl"](t){let n=r,{fpID:o,deviceID:c,bddID:d,ttwID:g,accessKey:p,aID:u,customParams:_={},enableAutoAck:w,enableQoS:v,QoSLevel:A,env:P}=this._options,T,M,O;this._isBrowser||this[n(1716)+"X"]||this[n(1230)+"T"]?(T=location&&e.lQIFE==location[n(518)]?e.nHRUf:e[n(978)],M=t[n(986)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),O=/^wss(.*:\/\/)/[n(853)](t)?t:""+T+M):e[n(1637)]!==e[n(1637)]?(_0xa9337c.body[n(1122)+"ild"](_0x4d5878),_0x335c97[n(1781)+n(632)]=void 0,e.LgCnV(_0x4fcdd2,_0x4f835e&&_0x327dd2[n(1823)]||e[n(655)])):(T=e[n(1163)],M=t[n(986)](/(^http)((?:[s]*:\/\/))/,""),O=/(^ws)((?:[s]*:\/\/))/[n(853)](M)?M:""+T+M);let z=d?n(2022):g?n(1910):e[n(1416)],te=d||g||c;if(e.zfDIX(!te,!z))throw new Error(e[n(1246)]);let Ae=e[n(1346)](e.oojVJ,typeof _)?await e[n(1171)](_):_,U=P?e[n(641)](m0,P[n(660)],P[n(1687)]):{},ye=Object[n(1295)]({device_platform:"web",version_code:e.NmjLM,access_key:p,fpid:o,aid:u,[z]:te,xsack:w?1:0,xaack:w?1:0,xsqos:v?1:0,qos_level:v?A:void 0,qos_sdk_version:2,...U},Ae),It=Object[n(965)](ye)[n(2021)]((Rt,mr)=>ye[mr]!==void 0?""+Rt+(Rt?"&":"?")+mr+"="+ye[mr]:Rt,"");return O+n(1887)+It}async[r(1348)](){let t=r,n={pYSeN:function(o,c,d){return e[k(512)](o,c,d)}};if(e[t(1008)](e[t(1338)],t(1065))){let o=XUyIjZ[t(1878)](_0x2d890b,_0x44adc7,1);_0x5e858d[t(1032)][o]=_0x37fe10}else{if(this["_connect"+t(676)]||this[t(1514)+t(1683)])return;this["_connect"+t(676)]=!0;try{let o=this[t(1272)+t(773)]?.["checkCur"+t(1172)+t(694)+t(1106)+t(1526)](),{timeoutInterval:c}=this[t(559)];if(o){let g=this[t(1272)+"tManager"]?.[t(927)+t(1501)+"nt"](),p=this["_endpoin"+t(773)]?.[t(2080)+t(1868)+t(1404)+"UpdateCo"+t(620)](),u=this[t(1272)+"tManager"]?.[t(927)+t(1501)+"ntTriesCount"]();if(p){let _=t(1962)+g+(t(2061)+t(1442)+t(1652)+t(792)+t(1982)+t(1801)+"ndpoint ")+p+(t(1361)+"y"),w=ge(e[t(769)],{message:_,code:je[t(683)+"IES_ERROR"]});this[t(1969)](_),this[t(1089)+t(1628)+t(1725)](w),this[t(1257)]=await this[t(1262)+t(622)](p),this[t(1969)]("connect "+p+" "+u+t(1319)),this[t(1306)+t(1594)+"rs"]()}else{let _=t(1962)+g+(t(2061)+", max re"+t(1652)+t(2075));this[t(1969)](_),this["_dispatc"+t(1628)+"ent"](e[t(538)](ge,e[t(769)],{message:_,code:je[t(683)+t(1326)+"R"]}));return}}else{let g=this[t(1272)+t(773)]?.[t(927)+t(1501)+t(600)+"ateCount"](),p=this[t(1272)+"tManager"]?.["getCurrentEndpoi"+t(2060)+t(613)]();this[t(1257)]=await this[t(1262)+t(622)](g||""),this[t(1969)](t(1962)+g+" "+p+t(1319)),this[t(1306)+t(1594)+"rs"]()}if(this[t(499)])this[t(499)]=!1;else{let g=e[t(1824)](cr,e[t(1554)],{message:t(1563)});this[t(1722)+t(1547)]&&this["onStartR"+t(1547)](g)}let d=this[t(1272)+t(773)]?.[t(927)+t(1501)+"ntTriesC"+t(613)]()||0;e[t(1189)](d,1)&&await this[t(1466)](e[t(803)](d,1)),this[t(1969)](t(1433)+t(1739)+this[t(1257)]+(t(1119)+t(1927))+this[t(1565)+"ls"]),this._ws=e[t(681)](h0,{url:this._url,protocols:[this[t(1565)+"ls"]],headers:this[t(559)]["miniProg"+t(1261)+"s"][t(1942)+"tpHeader"]},this[t(559)].ws),(this[t(949)+"er"]||this[t(1953)+"r"])&&this._ws&&(this[t(1270)].binaryType=this[t(2042)+t(967)]),this[t(1733)+t(1220)](),this[t(1348)+t(947)+t(1076)]=e[t(991)](setTimeout,this[t(1192)+"ut"][t(1881)](this),c)}catch(o){throw this["_connect"+t(676)]=!1,o}}}[r(763)+r(1577)](){let t=r;clearTimeout(this[t(1348)+t(947)+t(1076)]),this[t(1348)+t(947)+"utId"]=null}[r(1170)+r(800)](){let t=r;e[t(1127)](clearTimeout,this[t(1283)+t(1614)+"Id"]),clearTimeout(this[t(1629)+t(1366)+"tId"]),this[t(1283)+"gTimeoutId"]=null,this[t(1629)+t(1366)+t(712)]=null}_debug(...t){let n=r,o={kSztJ:function(c,d){return e.KYWJj(c,d)},xORoJ:function(c,d){return e[k(1136)](c,d)},TbkjS:function(c,d){return e[k(557)](c,d)},FRtfH:function(c,d){return e.Hmrgb(c,d)},KhUqB:function(c,d){return e.fxRgf(c,d)},DEjqo:function(c,d){return e[k(823)](c,d)},nkdnV:function(c,d){return c|d}};if(e.wospY(e[n(593)],e[n(593)])){if(JyoBjv[n(1056)](_0x49c6b8,1)||JyoBjv[n(2023)](_0x461e2b,_0x192f8f))return JyoBjv[n(940)](_0x5e3525,_0x2ac34e);JyoBjv.xORoJ(JyoBjv[n(1010)](_0x9456e9,_0x49620c),_0x14e71f)&&(_0x23cf21=JyoBjv[n(940)](_0xd00785,_0x3ee2c3),_0x45f370=0);let c=_0x44c4dc[n(863)](_0x14f2dc,_0x5c4b5c,_0x479824+=_0xadf58d);return JyoBjv[n(649)](7,_0xb1de3f)&&(_0x5be804=JyoBjv.DEjqo(JyoBjv.nkdnV(7,_0x3f9a2b),1)),c}else this._options[n(799)]&&console.log[n(1507)](console,[e.vwtoB,...t])}[r(1167)+r(902)+"e"](t){let n=r,{initReconnectInterval:o,maxReconnectInterval:c,reconnectIntervalGrowFactor:d}=this._options,g=e.bklrz(o,Math[n(998)](d,t-1));return e[n(1189)](g,c)?c:g}[r(750)](){let t=r,n={BHQaU:function(o,c){return e[k(1029)](o,c)},TDxqB:function(o,c){return e[k(1340)](o,c)},RBNGS:e[t(732)],ZYdNZ:"application/json;charset"+t(1311),lKXna:e[t(1813)],tzLkQ:e[t(500)],CZteQ:function(o,c,d,g){return e[t(1830)](o,c,d,g)}};if(this[t(1270)]&&e[t(952)](this[t(1270)][t(718)+"te"],this.CONNECTING))if(e[t(1673)](e[t(595)],e[t(595)]))if(_0x5b8b19[t(2034)]instanceof _0x173838){let o=msZZbd[t(707)](this[t(559)][t(1809)+t(1388)],_0x22fb8e)?{force:!!this[t(559)][t(1809)+"ncoding"][t(1886)],encoding:this[t(559)][t(1809)+t(1388)][t(1983)]?this[t(559)].payloadEncoding[t(1983)][t(986)](/\s/g,"")["toLowerC"+t(1805)]():""}:{force:!1,encoding:this._options[t(1809)+t(1388)]?this[t(559)][t(1809)+t(1388)].replace(/\s/g,"")[t(1671)+t(1805)]():""},c=_0x4946b4[t(1809)+t(1388)]?_0x108d6c[t(1809)+t(1388)][t(986)](/\s/g,"")[t(1671)+"ase"]():"",d=msZZbd[t(2100)](this[t(559)][t(1520)+t(967)],_0x2bf96c)?{force:!!this[t(559)][t(1520)+t(967)].force,type:this[t(559)][t(1520)+t(967)][t(1984)]?this[t(559)][t(1520)+t(967)].type[t(986)](/\s/g,"").toLowerCase():""}:{force:!1,type:this[t(559)].payloadType?this[t(559)][t(1520)+t(967)][t(986)](/\s/g,"")[t(1671)+"ase"]():""},g=_0x25460a[t(1520)+t(967)]?_0x56591d["payloadT"+t(967)][t(986)](/\s/g,"")["toLowerC"+t(1805)]():"",p=d[t(1886)]?d.type:g||d[t(1984)],u=o[t(1886)]?o[t(1983)]:c||o.encoding,_=[msZZbd[t(1745)],t(1495)+t(1510),msZZbd[t(997)],msZZbd[t(603)]],w=[t(739)+"e",msZZbd.tzLkQ];this[t(559)][t(647)+t(679)+t(729)+"ad"]&&_.includes(p)&&(!u||w[t(1250)](u))?_0x2fa549[t(1620)+t(876)]=msZZbd.CZteQ(_0xae831a,_0xe64d2c[t(2034)],0,_0x3c75ad[t(2034)].byteLength):_0x3e9d50[t(1620)+t(876)]=""}else _0x540528[t(1620)+t(876)]="";else{this[t(1170)+t(800)](),this["_pingPon"+t(1614)+"Id"]=e[t(1752)](setTimeout,this[t(750)].bind(this),this[t(559)]["pingInte"+t(1663)]);return}if(!this[t(1270)]||e[t(1768)](this[t(1270)][t(718)+"te"],this[t(2064)]))return void this[t(1004)+t(1547)]();this[t(1270)]&&this[t(1270)][t(720)]("hi"),this[t(1629)+t(1366)+t(712)]=setTimeout(this[t(1004)+"econnectTimeout"][t(1881)](this),this[t(559)][t(1269)+"outInter"+t(1011)])}[r(1004)+r(1547)+r(1015)](){let t=r;if(e.BRrHF(e[t(1069)],t(906))){let n=_0x2188a6[t(1281)].payload;n&&_0x533040[t(1779)+"rs"](n)}else this["_pingLos"+t(1961)]?.[t(1467)](),this[t(1308)](t(1444)+t(1936)+"t",e.HDMKI),this[t(1179)+t(1961)]?.[t(1132)+t(1441)+"nt"]()?this[t(1004)+t(1547)]():this[t(750)]()}["_navigat"+r(1217)](){let t=r;if(e.swxci(e[t(1468)],e[t(1188)]))awzzIK[t(1289)](_0x2d2805,awzzIK[t(612)](_0x1b1aca,_0x1fa4ad[t(1917)])),awzzIK[t(1414)](_0x5c208e);else return this[t(1230)+"T"]||this[t(1716)+"X"]?this[t(1508)+t(1795)+t(1039)]:(this[t(949)+"er"]||this[t(1953)+"r"])&&this[t(559)]["listenNetworkCha"+t(907)]?navigator.onLine:!0}[r(1004)+"econnect"](){let t=r;!this[t(1013)+"orOnline"]()||this["_readyCl"+t(1683)]||(this[t(1272)+t(773)]?.[t(695)+t(1084)+"fig"](),this["_pingLos"+t(1961)]?.[t(1773)+"nter"](),this._ws?this[t(555)+"ect"](1001,e[t(656)],!0):this._connect())}["_onPageN"+r(1920)+r(996)](){let t=r;this[t(1230)+"T"]?tt["onNetwor"+t(1203)+t(715)](({isConnected:n})=>{let o=t;this[o(1508)+o(1795)+o(1039)]=n,n?this[o(2006)+o(929)]():this["_handleO"+o(1541)]()}):this[t(1716)+"X"]&&wx[t(1164)+"kStatusChange"](({isConnected:n})=>{let o=t;this[o(1508)+o(1795)+o(1039)]=n,n?this[o(2006)+o(929)]():this[o(2006)+o(1541)]()})}[r(1466)](t){return new Promise(n=>{e[k(1138)](setTimeout,n,this._getIntervalValue(t))})}[r(555)+r(961)](t=1e3,n="",o=!1){let c=r;this[c(1270)]&&this["_destroy"+c(1677)+"t"](t,n,o)}[r(1192)+"ut"](){let t=r,n=this[t(1272)+t(773)]?.[t(927)+t(1501)+"nt"]();this[t(1969)]("connect "+n+t(2061)),this[t(555)+"ect"](1001,"timeout, try reconnecting",!0)}_sendAck(t){let n=r,o=e[n(898)](xr,t);this[n(1270)]&&e[n(1079)](this._ws[n(718)+"te"],this[n(2064)])&&(this[n(1270)]&&this._ws[n(720)](o),this[n(1969)](n(905),t))}[r(1306)+r(1594)+"rs"](){let t=r,n=e[t(1838)][t(742)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(1270)][t(775)+t(1077)+t(1232)](e.ACkoT,this[t(1856)]);continue;case"1":this[t(1270)][t(775)+t(1077)+"ner"](e[t(1237)],this[t(1998)]);continue;case"2":if(!this[t(1270)])return;continue;case"3":this[t(1270)][t(775)+t(1077)+t(1232)](e[t(1852)],this[t(1129)+"ge"]);continue;case"4":this[t(1270)]["removeEventListe"+t(1232)](e[t(769)],this._onError);continue}break}}["_addWsLi"+r(1220)](){let t=r,n=e[t(1631)][t(742)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(1270)][t(697)+"Listener"](t(1284),this[t(1856)]);continue;case"1":if(!this[t(1270)])return;continue;case"2":this[t(1270)][t(697)+t(840)](e[t(1237)],this[t(1998)]);continue;case"3":this[t(1270)]["addEvent"+t(840)](e[t(769)],this[t(2012)]);continue;case"4":this[t(1270)][t(697)+"Listener"](t(1281),this[t(1129)+"ge"]);continue}break}}[r(567)+"nceClose"](t=1e3,n=""){let o=r;try{this[o(1270)]&&this[o(1270)][o(1820)](t,n)}catch{}}[r(2074)+r(1677)+"t"](t=1e3,n="",o=!1){let c=r,d={ZePxY:c(1770)+c(1003),xeoNR:function(g,p,u,_){return e.BNKzT(g,p,u,_)},udPhx:"name",SpMCe:e[c(542)],NddtP:function(g,p,u,_){return g(p,u,_)},FFgKx:function(g,p,u,_){return e.nFVok(g,p,u,_)},HjiWz:function(g,p){return g(p)},xQqai:c(1325)+"ile_name"};if(this[c(1170)+"ngTimer"](),this._clearTimer(),this[c(1306)+c(1594)+"rs"](),this[c(567)+c(762)](1e3,n),this[c(1348)+c(676)]=!1,o&&this[c(1013)+c(1217)]()&&!this[c(1514)+c(1683)]){if(this["_endpoin"+c(773)]?.[c(1132)+"chMaxTries"]()){let p=this[c(1272)+"tManager"]?.[c(927)+"ntEndpoint"]();this[c(1089)+c(758)+c(1725)](e[c(1511)](we,e[c(1237)],{code:1006,reason:c(1962)+p+(c(2061)+c(1442)+c(1652)+c(2075)),wasClean:!0}))}else if(e[c(631)](e.VMZaI,c(1976))){let p={JELnS:c(2108)+c(1872)+c(984),OtDEb:HUsmpu[c(1569)],yEtQD:function(A,P,T,M){let O=c;return HUsmpu[O(1568)](A,P,T,M)},UTnEF:HUsmpu[c(1453)],KJTQk:HUsmpu[c(1464)],sGsPP:function(A,P,T,M){let O=c;return HUsmpu[O(828)](A,P,T,M)},ahEGU:function(A,P,T,M){let O=c;return HUsmpu[O(1343)](A,P,T,M)}},[u,_]=HUsmpu[c(936)](_0x1bcbef,_0x50c13a),w=HUsmpu[c(936)](_0x274b63,u),v=0;return _0x5b1110[c(1746)](A=>{let P=c,T=p[P(714)][P(742)]("|"),M=0;for(;;){switch(T[M++]){case"0":_0x692604[P(1972)](p[P(843)],v);continue;case"1":v=p[P(523)](_0x1cc862,_0x1d7674[P(878)+"er"](A[P(1877)]||_0x5d8049),w,v);continue;case"2":_0x2b2e80[P(1972)](p[P(788)],v);continue;case"3":v=_0xd90c73(_[A[P(663)+P(698)]],w,v);continue;case"4":_0x1ff141[P(1972)]("header",v);continue;case"5":_0x3a3039.log(p[P(1218)],v);continue;case"6":v=p[P(523)](_0x1a02a8,0,w,v);continue;case"7":v=p[P(1885)](_0x1ec0ed,A[P(663)+P(698)],w,v);continue;case"8":_0x4f7317.log(P(1397),v);continue;case"9":v=p[P(1665)](_0x2b879c,w,v,A[P(1397)]||0);continue;case"10":_0x1368b5[P(1972)](P(1634)+"ervice",A,A.service);continue}break}}),{frameType:_0xa2057e,headers:[{key:HUsmpu[c(881)],value:_0x2931e0}],payload:w}}else{let p=this[c(559)][c(2118)+c(1050)+"ptor"](t,n);this["_dispatc"+c(758)+"ent"](we(e.DKnrv,{code:t,reason:n,wasClean:!0,willReconnect:p})),p&&this._connect()}return}this[c(1013)+"orOnline"]()||this[c(1514)+"osed"]?this[c(1089)+c(758)+"ent"](we(e[c(1237)],{code:t,reason:"bye"})):this[c(1089)+c(758)+c(1725)](e[c(1222)](we,e.DKnrv,{code:1006,reason:"going aw"+c(1728)+c(624)+c(1457)})),this._ws=null,this[c(1272)+c(773)]?.[c(695)+c(1084)+c(805)](),this[c(1179)+"sCounter"]?.[c(1773)+c(977)]()}[r(1089)+r(533)+"nt"](t){let n=r,o={ooYVg:function(c,d){return e[k(1239)](c,d)},sEjDy:n(1600),BPOpo:function(c,d){return c(d)},EWgBC:function(c,d,g,p){return c(d,g,p)},QMynz:function(c,d){return e.HmEia(c,d)}};if(e[n(1110)](e.ZdmIC,e[n(1369)]))this[n(1308)](n(1284),t),this.onopen&&this[n(1890)](t);else{if(zXHrrg[n(1006)](zXHrrg[n(1586)],typeof _0x1cbcfc)){let c=new _0x38ec7d(zXHrrg.BPOpo(_0x30d7a1,_0x52f786));return zXHrrg[n(1292)](_0x4a59dd,_0xaf3ff2,c,0),c}return zXHrrg[n(2031)](_0x1e8798,_0x258627)?new _0x5383e4(_0x1ee6c9):new _0x2cd7ff(_0x4efec2[n(1702)],_0x52b0f4[n(1382)+"et"],_0x28fd26[n(1336)+"th"])}}[r(1089)+r(1992)+r(2088)](t){let n=r;this[n(1308)](n(1281),t),this.onmessage&&this[n(607)+"e"](t)}[r(1089)+r(1787)+"ageEvent"](t){let n=r;this[n(1308)](e[n(1811)],t),this[n(1706)+n(1327)]&&this[n(1706)+n(1327)](t)}[r(1089)+r(1628)+"ent"](t){let n=r;this[n(1308)](e[n(769)],t),this[n(781)]&&this[n(781)](t)}[r(1089)+"hCloseEv"+r(1725)](t){let n=r,o={lDCdh:function(d,g,p,u){return d(g,p,u)}};if(e[n(1678)](e[n(994)],e.PUwWP))for(var c in _0x27a7b4)GPTZiP[n(1190)](_0xff20ef,_0x279963,c,{get:_0x35ef9f[c],enumerable:!0});else this[n(1308)](e[n(1237)],t),this[n(796)]&&this[n(796)](t)}get[r(682)+"pe"](){let t=r;return e[t(1705)](e[t(1771)],e[t(992)])?this._ws?this._ws[t(682)+"pe"]:this[t(2042)+t(967)]:_0x5105e3[t(1032)][e[t(1405)](_0x5baa79,_0xbbf828,1)]}set[r(682)+"pe"](t){let n=r;this[n(2042)+n(967)]=t,this[n(1270)]&&(this[n(1270)].binaryType=t)}get[r(1769)+"nt"](){let t=r;return this._endpointManager?.[t(927)+"ntEndpoi"+t(2060)+t(613)]()||0}get["buffered"+r(1099)](){let t=r,n=this[t(1655)+t(1104)][t(2021)]((o,c)=>{let d=t,g={bPCkd:function(p,u){return p==u},jQQuZ:e[d(1813)],QNNaM:e[d(732)]};return e[d(901)](e[d(1926)],e[d(1394)])?(o+=c&&c[d(1336)+"th"]||0,o):DgRRzN[d(1949)](DgRRzN[d(616)],typeof _0x1fe38f)?DgRRzN.QNNaM:""},0);return e.CIAXe(n,this[t(1270)]?this[t(1270)][t(1533)+t(1099)]:0)}get extensions(){let t=r;return this[t(1270)]?this[t(1270)][t(1845)+"ns"]:""}get[r(518)](){let t=r;return this._ws?this._ws[t(518)]:""}get[r(718)+"te"](){let t=r;return this[t(1270)]?this._ws[t(718)+"te"]:this[t(559)][t(1685)+t(1686)]?this[t(1669)+"NG"]:this[t(2015)]}get[r(1461)](){let t=r;return this._ws?this._ws[t(1461)]:this[t(1257)]}[r(1820)](t=1e3,n){let o=r,c=e[o(1555)].split("|"),d=0;for(;;){switch(c[d++]){case"0":if(!this[o(1270)])return void this[o(1969)](e[o(1909)]);continue;case"1":this[o(1514)+o(1683)]=!0;continue;case"2":this[o(1580)+o(1591)+o(840)]();continue;case"3":this[o(1170)+o(800)]();continue;case"4":this[o(763)+"mer"]();continue;case"5":this[o(2074)+o(1677)+"t"](t,n);continue;case"6":if(this._ws[o(718)+"te"]===this.CLOSED||e[o(952)](this._ws[o(718)+"te"],this[o(530)]))return void this[o(1969)](e[o(1255)]);continue;case"7":this[o(1276)+"ger"]?.[o(1821)]();continue}break}}async[r(720)](t,n){let o=r,c={avPwS:function(O,z){return e[k(1981)](O,z)},gcCRf:function(O,z){return e[k(1406)](O,z)},HitkW:function(O,z){return e[k(1455)](O,z)},hBgWp:function(O,z){return e[k(1570)](O,z)},GoSqV:function(O,z){return e[k(1055)](O,z)},omDLQ:function(O,z){return O>>z}};if(e[o(1346)](null,t))throw new Error(e.qtddd);e[o(1530)](o(1318),typeof t)&&(t=JSON[o(1608)+"y"](t)),e[o(1465)](e[o(1813)],typeof t)&&!(t instanceof ArrayBuffer)&&!(t.buffer&&t.buffer instanceof ArrayBuffer)&&(t=JSON[o(1608)+"y"](t));let d=await e[o(1777)](As,t),g=e[o(1275)](p0,t),{method:p=0,service:u=this[o(559)][o(1397)],logID:_=this[o(559)]["logIDGen"+o(704)](),headers:w=this._options[o(1074)],payloadEncoding:v=this[o(559)][o(1809)+"ncoding"],payloadType:A=this[o(559)][o(1520)+"ype"],logIDNew:P=this._options[o(1616)+o(1080)]["enableAu"+o(1707)+o(937)+"ew"]?e[o(1028)](a,this[o(559)]["logIDNew"+o(1080)].userIp):""}=e.zfDIX(n,{});if(!u)throw new Error(o(1611)+o(1120)+" valid s"+o(810));let T={SeqID:K[o(878)+"er"](this._seqId++),LogID:K[o(878)+"er"](_),service:u,method:p,headers:w,payloadEncoding:e[o(1340)](v,Object)?v[o(1983)]?v.encoding:"":v,payloadType:e[o(1841)](A,Object)?A[o(1984)]?A[o(1984)]:g:A||g,payload:d,LogIDNew:P},M=e[o(1899)](xr,T);return this[o(1270)]&&e[o(946)](this[o(1270)].readyState,this[o(2064)])?e.RmGne!=="YYRWm"?(this[o(813)+"ount"]=_0x105a0e,this[o(1952)]=0):(this._ws&&this._ws[o(720)](M),this._debug(e.UsigB,T)):this["_message"+o(1104)][o(1929)]<this._options["maxMessageQueueL"+o(1470)]?(this._messageQueue[o(1560)](M),this[o(1969)](o(1512),T)):e[o(1817)]!==e[o(1817)]?(jlOcoU[o(1534)](_0x4b2bff,65536)?_0xbe3d98[_0x16128f++]=jlOcoU[o(733)](jlOcoU[o(2026)](_0x18ccc6,12),15)|224:(_0x4f0fb8[_0x5e1070++]=jlOcoU.hBgWp(jlOcoU[o(1633)](_0x3e6f8e>>18,7),240),_0x12be09[_0x18613c++]=jlOcoU.hBgWp(jlOcoU.GoSqV(jlOcoU[o(634)](_0x3823dd,12),63),128)),_0x967da9[_0x1c7d51++]=jlOcoU[o(1278)](jlOcoU[o(2026)](_0x59705a,6)&63,128)):(this[o(1655)+o(1104)].shift(),this[o(1655)+o(1104)][o(1560)](M)),{seqID:this[o(1265)],logID:_,logIDNew:P}}async[r(2118)+"t"](t){let n=r;if(e.jfIgj(n(1489),e[n(1395)])){let{url:o}=t||{},c=Array[n(1018)](o)?o:e[n(503)](n(1600),typeof o)?[o]:[];t&&Object[n(1295)](this[n(559)],t),c&&c.length?this[n(1272)+n(773)]=new vs(c,this[n(559)][n(1925)+"es"]):this["_endpoin"+n(773)]?.[n(695)+n(1084)+"fig"](),this[n(1179)+n(1961)]?.[n(1773)+n(977)](this[n(559)][n(1184)+n(2071)]),this["_readyCl"+n(1683)]=!1,this[n(1270)]&&e[n(2035)](this[n(1270)][n(718)+"te"],this[n(2015)])?this[n(555)+n(961)](1e3,e[n(1537)],!0):(this[n(499)]=!0,this[n(1348)]())}else return this[n(1430)]?.get(_0x3f4003)}async[r(1804)](){let t=r;if(!this[t(1348)+"Lock"]){let n=(t(918)+"1").split("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(1272)+t(773)]?.[t(695)+t(1084)+t(805)]();continue;case"1":this[t(1348)]();continue;case"2":this[t(1179)+"sCounter"]?.[t(1773)+t(977)]();continue;case"3":this[t(1514)+t(1683)]=!1;continue;case"4":this[t(499)]=!0;continue}break}}}[r(697)+r(840)](t,n){this.on(t,n)}[r(844)+r(2088)](t){let n=r,{type:o}=t;this[n(1308)](o,t)}[r(775)+r(1077)+"ner"](t,n){this[r(1304)](t,n)}pingOnce(){let t=r,n={Vkgpc:e[t(1624)],fNPlv:e.wlfbN,nVPDP:t(1700),cavBJ:function(o,c,d){return e[t(1323)](o,c,d)},WTuMV:t(1444)+t(1451)+"s"};return new Promise((o,c)=>{let d=t,g={OBBNs:n.nVPDP,NdBjh:d(1444)+d(1936)+"t"};this[d(1170)+d(800)](),this[d(1283)+"gTimeoutId"]=n[d(1748)](setTimeout,this[d(750)][d(1881)](this),this._options[d(1242)+d(1663)]);let p=()=>{let _=d;o(n.Vkgpc),this[_(1304)]("ping_onc"+_(1451)+"s",p),this.off(n.fNPlv,u)},u=()=>{let _=d;c(g.OBBNs),this[_(1304)](_(1444)+_(1451)+"s",p),this[_(1304)](g[_(659)],u)};this.on(n[d(1445)],p),this.on(d(1444)+"e_timeout",u),this[d(750)]()})}}})(),ee["CustomCl"+E(1640)]=Q[E(1067)+E(1640)],ee[E(664)+E(1780)]=Q[E(664)+E(1780)],ee.ErrorCode=Q[E(1288)+"e"],ee.Event=Q[E(2088)],ee[E(866)]=Q[E(866)],ee["Frontier"+E(1900)+E(889)]=Q[E(817)+E(1900)+"vent"],ee["MessageE"+E(889)]=Q[E(1900)+"vent"],ee[E(1898)+"t"]=Q[E(1898)+"t"],ee[E(1582)+"tEvent"]=Q["Reconnec"+E(1081)],ee[E(1595)+E(1640)]=Q[E(1595)+E(1640)],ee["createEr"+E(1780)]=Q[E(812)+E(1780)],ee["createMe"+E(1959)+"nt"]=Q[E(678)+"ssageEvent"],ee[E(988)+E(1517)]=Q[E(988)+"enEvent"],ee["createRe"+E(951)+"vent"]=Q[E(1807)+E(951)+E(889)],ee[E(1244)+E(969)]=Q[E(1244)+E(969)],ee[E(1785)+E(698)]=Q[E(1785)+"ame"];for(In in Q)["CustomCl"+E(1640),E(664)+E(1780),E(1288)+"e",E(2088),E(866),"Frontier"+E(1900)+E(889),E(1900)+E(889),"OpenEvent","Reconnec"+E(1081),"createCloseEvent",E(812)+"rorEvent",E(678)+E(1959)+"nt","createOp"+E(1517),E(1807)+"connectE"+E(889),E(1244)+"rame","encodeFr"+E(698)][E(1893)](In)===-1&&(ee[In]=Q[In]);var In;Object[E(576)+E(1675)](ee,E(1963)+"le",{value:!0})});var qe=fe((Wl,Bi)=>{"use strict";var Ni=["nodebuffer","arraybuffer","fragments"],Li=typeof Blob<"u";Li&&Ni.push("blob");Bi.exports={BINARY_TYPES:Ni,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Li,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var jt=fe((Jl,Mn)=>{"use strict";var{EMPTY_BUFFER:Vx}=qe(),Pr=Buffer[Symbol.species];function Xx(r,e){if(r.length===0)return Vx;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 Pr(i.buffer,i.byteOffset,a):i}function Oi(r,e,i,a,x){for(let f=0;f<x;f++)i[a+f]=r[f]^e[f&3]}function zi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function Yx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function Tr(r){if(Tr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new Pr(r):ArrayBuffer.isView(r)?e=new Pr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),Tr.readOnly=!1),e}Mn.exports={concat:Xx,mask:Oi,toArrayBuffer:Yx,toBuffer:Tr,unmask:zi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=Z("bufferutil");Mn.exports.mask=function(e,i,a,x,f){f<48?Oi(e,i,a,x,f):r.mask(e,i,a,x,f)},Mn.exports.unmask=function(e,i){e.length<32?zi(e,i):r.unmask(e,i)}}catch{}});var Ki=fe((Vl,qi)=>{"use strict";var Mi=Symbol("kDone"),Ir=Symbol("kRun"),Rr=class{constructor(e){this[Mi]=()=>{this.pending--,this[Ir]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Ir]()}[Ir](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Mi])}}};qi.exports=Rr});var yt=fe((Xl,ji)=>{"use strict";var Gt=Z("zlib"),Ui=jt(),$x=Ki(),{kStatusCode:Fi}=qe(),Zx=Buffer[Symbol.species],Qx=Buffer.from([0,0,255,255]),Kn=Symbol("permessage-deflate"),Ke=Symbol("total-length"),_t=Symbol("callback"),Ve=Symbol("buffers"),wt=Symbol("error"),qn,Nr=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,!qn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;qn=new $x(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[_t];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){qn.add(x=>{this._decompress(e,i,(f,l)=>{x(),a(f,l)})})}compress(e,i,a){qn.add(x=>{this._compress(e,i,(f,l)=>{x(),a(f,l)})})}_decompress(e,i,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,l=typeof this.params[f]!="number"?Gt.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=Gt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:l}),this._inflate[Kn]=this,this._inflate[Ke]=0,this._inflate[Ve]=[],this._inflate.on("error",tc),this._inflate.on("data",Hi)}this._inflate[_t]=a,this._inflate.write(e),i&&this._inflate.write(Qx),this._inflate.flush(()=>{let f=this._inflate[wt];if(f){this._inflate.close(),this._inflate=null,a(f);return}let l=Ui.concat(this._inflate[Ve],this._inflate[Ke]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ke]=0,this._inflate[Ve]=[],i&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,l)})}_compress(e,i,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,l=typeof this.params[f]!="number"?Gt.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=Gt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:l}),this._deflate[Ke]=0,this._deflate[Ve]=[],this._deflate.on("data",ec)}this._deflate[_t]=a,this._deflate.write(e),this._deflate.flush(Gt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=Ui.concat(this._deflate[Ve],this._deflate[Ke]);i&&(f=new Zx(f.buffer,f.byteOffset,f.length-4)),this._deflate[_t]=null,this._deflate[Ke]=0,this._deflate[Ve]=[],i&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};ji.exports=Nr;function ec(r){this[Ve].push(r),this[Ke]+=r.length}function Hi(r){if(this[Ke]+=r.length,this[Kn]._maxPayload<1||this[Ke]<=this[Kn]._maxPayload){this[Ve].push(r);return}this[wt]=new RangeError("Max payload size exceeded"),this[wt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[wt][Fi]=1009,this.removeListener("data",Hi),this.reset()}function tc(r){if(this[Kn]._inflate=null,this[wt]){this[_t](this[wt]);return}r[Fi]=1007,this[_t](r)}});var bt=fe((Yl,Un)=>{"use strict";var{isUtf8:Gi}=Z("buffer"),{hasBlob:nc}=qe(),rc=[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 sc(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Lr(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 ic(r){return nc&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}Un.exports={isBlob:ic,isValidStatusCode:sc,isValidUTF8:Lr,tokenChars:rc};if(Gi)Un.exports.isValidUTF8=function(r){return r.length<24?Lr(r):Gi(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=Z("utf-8-validate");Un.exports.isValidUTF8=function(e){return e.length<32?Lr(e):r(e)}}catch{}});var qr=fe(($l,Zi)=>{"use strict";var{Writable:oc}=Z("stream"),Wi=yt(),{BINARY_TYPES:ac,EMPTY_BUFFER:Ji,kStatusCode:xc,kWebSocket:cc}=qe(),{concat:Br,toArrayBuffer:fc,unmask:uc}=jt(),{isValidStatusCode:dc,isValidUTF8:Vi}=bt(),Fn=Buffer[Symbol.species],pe=0,Xi=1,Yi=2,$i=3,Or=4,zr=5,Hn=6,Mr=class extends oc{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||ac[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[cc]=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=pe}_write(e,i,a){if(this._opcode===8&&this._state==pe)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 Fn(a.buffer,a.byteOffset+e,a.length-e),new Fn(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 Fn(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 pe:this.getInfo(e);break;case Xi:this.getPayloadLength16(e);break;case Yi:this.getPayloadLength64(e);break;case $i:this.getMask();break;case Or:this.getData(e);break;case zr:case Hn: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[Wi.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=Xi: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=$i:this._state=Or}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Or}getData(e){let i=Ji;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&&uc(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=zr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Wi.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 l=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(l);return}this._fragments.push(f)}this.dataMessage(i),this._state===pe&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=pe;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=fc(Br(a,i)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=pe):(this._state=Hn,setImmediate(()=>{this.emit("message",x,!0),this._state=pe,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===zr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=pe):(this._state=Hn,setImmediate(()=>{this.emit("message",x,!1),this._state=pe,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Ji),this.end();else{let a=e.readUInt16BE(0);if(!dc(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(f);return}let x=new Fn(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=pe;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=pe):(this._state=Hn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=pe,this.startLoop(i)}))}createError(e,i,a,x,f){this._loop=!1,this._errored=!0;let l=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(l,this.createError),l.code=f,l[xc]=x,l}};Zi.exports=Mr});var Fr=fe((Ql,to)=>{"use strict";var{Duplex:Zl}=Z("stream"),{randomFillSync:lc}=Z("crypto"),Qi=yt(),{EMPTY_BUFFER:hc,kWebSocket:gc,NOOP:pc}=qe(),{isBlob:vt,isValidStatusCode:mc}=bt(),{mask:eo,toBuffer:nt}=jt(),me=Symbol("kByteLength"),_c=Buffer.alloc(4),jn=8*1024,rt,St=jn,ve=0,wc=1,yc=2,Kr=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=ve,this.onerror=pc,this[gc]=void 0}static frame(e,i){let a,x=!1,f=2,l=!1;i.mask&&(a=i.maskBuffer||_c,i.generateMask?i.generateMask(a):(St===jn&&(rt===void 0&&(rt=Buffer.alloc(jn)),lc(rt,0,jn),St=0),a[0]=rt[St++],a[1]=rt[St++],a[2]=rt[St++],a[3]=rt[St++]),l=(a[0]|a[1]|a[2]|a[3])===0,f=6);let h;typeof e=="string"?(!i.mask||l)&&i[me]!==void 0?h=i[me]:(e=Buffer.from(e),h=e.length):(h=e.length,x=i.mask&&i.readOnly&&!l);let m=h;h>=65536?(f+=8,m=127):h>125&&(f+=2,m=126);let y=Buffer.allocUnsafe(x?h+f:f);return y[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(y[0]|=64),y[1]=m,m===126?y.writeUInt16BE(h,2):m===127&&(y[2]=y[3]=0,y.writeUIntBE(h,4,6)),i.mask?(y[1]|=128,y[f-4]=a[0],y[f-3]=a[1],y[f-2]=a[2],y[f-1]=a[3],l?[y,e]:x?(eo(e,a,y,f,h),[y]):(eo(e,a,e,0,h),[y,e])):[y,e]}close(e,i,a,x){let f;if(e===void 0)f=hc;else{if(typeof e!="number"||!mc(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 l={[me]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ve?this.enqueue([this.dispatch,f,!1,l,x]):this.sendFrame(r.frame(f,l),x)}ping(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):vt(e)?(x=e.size,f=!1):(e=nt(e),x=e.length,f=nt.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let l={[me]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};vt(e)?this._state!==ve?this.enqueue([this.getBlobData,e,!1,l,a]):this.getBlobData(e,!1,l,a):this._state!==ve?this.enqueue([this.dispatch,e,!1,l,a]):this.sendFrame(r.frame(e,l),a)}pong(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):vt(e)?(x=e.size,f=!1):(e=nt(e),x=e.length,f=nt.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let l={[me]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};vt(e)?this._state!==ve?this.enqueue([this.getBlobData,e,!1,l,a]):this.getBlobData(e,!1,l,a):this._state!==ve?this.enqueue([this.dispatch,e,!1,l,a]):this.sendFrame(r.frame(e,l),a)}send(e,i,a){let x=this._extensions[Qi.extensionName],f=i.binary?2:1,l=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):vt(e)?(h=e.size,m=!1):(e=nt(e),h=e.length,m=nt.readOnly),this._firstFragment?(this._firstFragment=!1,l&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(l=h>=x._threshold),this._compress=l):(l=!1,f=0),i.fin&&(this._firstFragment=!0);let y={[me]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:m,rsv1:l};vt(e)?this._state!==ve?this.enqueue([this.getBlobData,e,this._compress,y,a]):this.getBlobData(e,this._compress,y,a):this._state!==ve?this.enqueue([this.dispatch,e,this._compress,y,a]):this.dispatch(e,this._compress,y,a)}getBlobData(e,i,a,x){this._bufferedBytes+=a[me],this._state=yc,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Ur,this,h,x);return}this._bufferedBytes-=a[me];let l=nt(f);i?this.dispatch(l,i,a,x):(this._state=ve,this.sendFrame(r.frame(l,a),x),this.dequeue())}).catch(f=>{process.nextTick(bc,this,f,x)})}dispatch(e,i,a,x){if(!i){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Qi.extensionName];this._bufferedBytes+=a[me],this._state=wc,f.compress(e,a.fin,(l,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Ur(this,m,x);return}this._bufferedBytes-=a[me],this._state=ve,a.readOnly=!1,this.sendFrame(r.frame(h,a),x),this.dequeue()})}dequeue(){for(;this._state===ve&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][me],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][me],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)}};to.exports=Kr;function Ur(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 bc(r,e,i){Ur(r,e,i),r.onerror(e)}});var fo=fe((eh,co)=>{"use strict";var{kForOnEventAttribute:Wt,kListener:Hr}=qe(),no=Symbol("kCode"),ro=Symbol("kData"),so=Symbol("kError"),io=Symbol("kMessage"),oo=Symbol("kReason"),Et=Symbol("kTarget"),ao=Symbol("kType"),xo=Symbol("kWasClean"),Ue=class{constructor(e){this[Et]=null,this[ao]=e}get target(){return this[Et]}get type(){return this[ao]}};Object.defineProperty(Ue.prototype,"target",{enumerable:!0});Object.defineProperty(Ue.prototype,"type",{enumerable:!0});var st=class extends Ue{constructor(e,i={}){super(e),this[no]=i.code===void 0?0:i.code,this[oo]=i.reason===void 0?"":i.reason,this[xo]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[no]}get reason(){return this[oo]}get wasClean(){return this[xo]}};Object.defineProperty(st.prototype,"code",{enumerable:!0});Object.defineProperty(st.prototype,"reason",{enumerable:!0});Object.defineProperty(st.prototype,"wasClean",{enumerable:!0});var Ct=class extends Ue{constructor(e,i={}){super(e),this[so]=i.error===void 0?null:i.error,this[io]=i.message===void 0?"":i.message}get error(){return this[so]}get message(){return this[io]}};Object.defineProperty(Ct.prototype,"error",{enumerable:!0});Object.defineProperty(Ct.prototype,"message",{enumerable:!0});var Jt=class extends Ue{constructor(e,i={}){super(e),this[ro]=i.data===void 0?null:i.data}get data(){return this[ro]}};Object.defineProperty(Jt.prototype,"data",{enumerable:!0});var vc={addEventListener(r,e,i={}){for(let x of this.listeners(r))if(!i[Wt]&&x[Hr]===e&&!x[Wt])return;let a;if(r==="message")a=function(f,l){let h=new Jt("message",{data:l?f:f.toString()});h[Et]=this,Gn(e,this,h)};else if(r==="close")a=function(f,l){let h=new st("close",{code:f,reason:l.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[Et]=this,Gn(e,this,h)};else if(r==="error")a=function(f){let l=new Ct("error",{error:f,message:f.message});l[Et]=this,Gn(e,this,l)};else if(r==="open")a=function(){let f=new Ue("open");f[Et]=this,Gn(e,this,f)};else return;a[Wt]=!!i[Wt],a[Hr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Hr]===e&&!i[Wt]){this.removeListener(r,i);break}}};co.exports={CloseEvent:st,ErrorEvent:Ct,Event:Ue,EventTarget:vc,MessageEvent:Jt};function Gn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Wn=fe((th,uo)=>{"use strict";var{tokenChars:Vt}=bt();function Ie(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function Sc(r){let e=Object.create(null),i=Object.create(null),a=!1,x=!1,f=!1,l,h,m=-1,y=-1,S=-1,b=0;for(;b<r.length;b++)if(y=r.charCodeAt(b),l===void 0)if(S===-1&&Vt[y]===1)m===-1&&(m=b);else if(b!==0&&(y===32||y===9))S===-1&&m!==-1&&(S=b);else if(y===59||y===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${b}`);S===-1&&(S=b);let R=r.slice(m,S);y===44?(Ie(e,R,i),i=Object.create(null)):l=R,m=S=-1}else throw new SyntaxError(`Unexpected character at index ${b}`);else if(h===void 0)if(S===-1&&Vt[y]===1)m===-1&&(m=b);else if(y===32||y===9)S===-1&&m!==-1&&(S=b);else if(y===59||y===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${b}`);S===-1&&(S=b),Ie(i,r.slice(m,S),!0),y===44&&(Ie(e,l,i),i=Object.create(null),l=void 0),m=S=-1}else if(y===61&&m!==-1&&S===-1)h=r.slice(m,b),m=S=-1;else throw new SyntaxError(`Unexpected character at index ${b}`);else if(x){if(Vt[y]!==1)throw new SyntaxError(`Unexpected character at index ${b}`);m===-1?m=b:a||(a=!0),x=!1}else if(f)if(Vt[y]===1)m===-1&&(m=b);else if(y===34&&m!==-1)f=!1,S=b;else if(y===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${b}`);else if(y===34&&r.charCodeAt(b-1)===61)f=!0;else if(S===-1&&Vt[y]===1)m===-1&&(m=b);else if(m!==-1&&(y===32||y===9))S===-1&&(S=b);else if(y===59||y===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${b}`);S===-1&&(S=b);let R=r.slice(m,S);a&&(R=R.replace(/\\/g,""),a=!1),Ie(i,h,R),y===44&&(Ie(e,l,i),i=Object.create(null),l=void 0),h=void 0,m=S=-1}else throw new SyntaxError(`Unexpected character at index ${b}`);if(m===-1||f||y===32||y===9)throw new SyntaxError("Unexpected end of input");S===-1&&(S=b);let D=r.slice(m,S);return l===void 0?Ie(e,D,i):(h===void 0?Ie(i,D,!0):a?Ie(i,h,D.replace(/\\/g,"")):Ie(i,h,D),Ie(e,l,i)),e}function Ec(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(l=>l===!0?x:`${x}=${l}`).join("; ")})).join("; ")).join(", ")}).join(", ")}uo.exports={format:Ec,parse:Sc}});var Yn=fe((sh,Eo)=>{"use strict";var Cc=Z("events"),Ac=Z("https"),kc=Z("http"),go=Z("net"),Dc=Z("tls"),{randomBytes:Pc,createHash:Tc}=Z("crypto"),{Duplex:nh,Readable:rh}=Z("stream"),{URL:jr}=Z("url"),Xe=yt(),Ic=qr(),Rc=Fr(),{isBlob:Nc}=bt(),{BINARY_TYPES:lo,CLOSE_TIMEOUT:Lc,EMPTY_BUFFER:Jn,GUID:Bc,kForOnEventAttribute:Gr,kListener:Oc,kStatusCode:zc,kWebSocket:ne,NOOP:po}=qe(),{EventTarget:{addEventListener:Mc,removeEventListener:qc}}=fo(),{format:Kc,parse:Uc}=Wn(),{toBuffer:Fc}=jt(),mo=Symbol("kAborted"),Wr=[8,13],Fe=["CONNECTING","OPEN","CLOSING","CLOSED"],Hc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,G=class r extends Cc{constructor(e,i,a){super(),this._binaryType=lo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Jn,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]),_o(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){lo.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 Ic({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new Rc(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[ne]=this,f[ne]=this,e[ne]=this,x.on("conclude",Wc),x.on("drain",Jc),x.on("error",Vc),x.on("message",Xc),x.on("ping",Yc),x.on("pong",$c),f.onerror=Zc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",bo),e.on("data",Xn),e.on("end",vo),e.on("error",So),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[Xe.extensionName]&&this._extensions[Xe.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){he(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())}),yo(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){Jr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Jn,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){Jr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Jn,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){Jr(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[Xe.extensionName]||(x.compress=!1),this._sender.send(e||Jn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){he(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(G,"CONNECTING",{enumerable:!0,value:Fe.indexOf("CONNECTING")});Object.defineProperty(G.prototype,"CONNECTING",{enumerable:!0,value:Fe.indexOf("CONNECTING")});Object.defineProperty(G,"OPEN",{enumerable:!0,value:Fe.indexOf("OPEN")});Object.defineProperty(G.prototype,"OPEN",{enumerable:!0,value:Fe.indexOf("OPEN")});Object.defineProperty(G,"CLOSING",{enumerable:!0,value:Fe.indexOf("CLOSING")});Object.defineProperty(G.prototype,"CLOSING",{enumerable:!0,value:Fe.indexOf("CLOSING")});Object.defineProperty(G,"CLOSED",{enumerable:!0,value:Fe.indexOf("CLOSED")});Object.defineProperty(G.prototype,"CLOSED",{enumerable:!0,value:Fe.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(G.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(G.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Gr])return e[Oc];return null},set(e){for(let i of this.listeners(r))if(i[Gr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Gr]:!0})}})});G.prototype.addEventListener=Mc;G.prototype.removeEventListener=qc;Eo.exports=G;function _o(r,e,i,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Lc,protocolVersion:Wr[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,!Wr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Wr.join(", ")})`);let f;if(e instanceof jr)f=e;else try{f=new jr(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 l=f.protocol==="wss:",h=f.protocol==="ws+unix:",m;if(f.protocol!=="ws:"&&!l&&!h?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!f.pathname?m="The URL's pathname is empty":f.hash&&(m="The URL contains a fragment identifier"),m){let L=new SyntaxError(m);if(r._redirects===0)throw L;Vn(r,L);return}let y=l?443:80,S=Pc(16).toString("base64"),b=l?Ac.request:kc.request,D=new Set,R;if(x.createConnection=x.createConnection||(l?Gc:jc),x.defaultPort=x.defaultPort||y,x.port=f.port||y,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":S,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(R=new Xe({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=Kc({[Xe.extensionName]:R.offer()})),i.length){for(let L of i){if(typeof L!="string"||!Hc.test(L)||D.has(L))throw new SyntaxError("An invalid or duplicated subprotocol was specified");D.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 N;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=l,r._originalHostOrSocketPath=h?x.socketPath:f.host;let L=a&&a.headers;if(a={...a,headers:{}},L)for(let[F,xe]of Object.entries(L))a.headers[F.toLowerCase()]=xe}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&&!l)&&(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")),N=r._req=b(x),r._redirects&&r.emit("redirect",r.url,N)}else N=r._req=b(x);x.timeout&&N.on("timeout",()=>{he(r,N,"Opening handshake has timed out")}),N.on("error",L=>{N===null||N[mo]||(N=r._req=null,Vn(r,L))}),N.on("response",L=>{let F=L.headers.location,xe=L.statusCode;if(F&&x.followRedirects&&xe>=300&&xe<400){if(++r._redirects>x.maxRedirects){he(r,N,"Maximum redirects exceeded");return}N.abort();let re;try{re=new jr(F,e)}catch{let ue=new SyntaxError(`Invalid URL: ${F}`);Vn(r,ue);return}_o(r,re,i,a)}else r.emit("unexpected-response",N,L)||he(r,N,`Unexpected server response: ${L.statusCode}`)}),N.on("upgrade",(L,F,xe)=>{if(r.emit("upgrade",L),r.readyState!==G.CONNECTING)return;N=r._req=null;let re=L.headers.upgrade;if(re===void 0||re.toLowerCase()!=="websocket"){he(r,F,"Invalid Upgrade header");return}let Se=Tc("sha1").update(S+Bc).digest("base64");if(L.headers["sec-websocket-accept"]!==Se){he(r,F,"Invalid Sec-WebSocket-Accept header");return}let ue=L.headers["sec-websocket-protocol"],I;if(ue!==void 0?D.size?D.has(ue)||(I="Server sent an invalid subprotocol"):I="Server sent a subprotocol but none was requested":D.size&&(I="Server sent no subprotocol"),I){he(r,F,I);return}ue&&(r._protocol=ue);let H=L.headers["sec-websocket-extensions"];if(H!==void 0){if(!R){he(r,F,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Y;try{Y=Uc(H)}catch{he(r,F,"Invalid Sec-WebSocket-Extensions header");return}let se=Object.keys(Y);if(se.length!==1||se[0]!==Xe.extensionName){he(r,F,"Server indicated an extension that was not requested");return}try{R.accept(Y[Xe.extensionName])}catch{he(r,F,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[Xe.extensionName]=R}r.setSocket(F,xe,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(N,r):N.end()}function Vn(r,e){r._readyState=G.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function jc(r){return r.path=r.socketPath,go.connect(r)}function Gc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=go.isIP(r.host)?"":r.host),Dc.connect(r)}function he(r,e,i){r._readyState=G.CLOSING;let a=new Error(i);Error.captureStackTrace(a,he),e.setHeader?(e[mo]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Vn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Jr(r,e,i){if(e){let a=Nc(e)?e.size:Fc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Fe[r.readyState]})`);process.nextTick(i,a)}}function Wc(r,e){let i=this[ne];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[ne]!==void 0&&(i._socket.removeListener("data",Xn),process.nextTick(wo,i._socket),r===1005?i.close():i.close(r,e))}function Jc(){let r=this[ne];r.isPaused||r._socket.resume()}function Vc(r){let e=this[ne];e._socket[ne]!==void 0&&(e._socket.removeListener("data",Xn),process.nextTick(wo,e._socket),e.close(r[zc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function ho(){this[ne].emitClose()}function Xc(r,e){this[ne].emit("message",r,e)}function Yc(r){let e=this[ne];e._autoPong&&e.pong(r,!this._isServer,po),e.emit("ping",r)}function $c(r){this[ne].emit("pong",r)}function wo(r){r.resume()}function Zc(r){let e=this[ne];e.readyState!==G.CLOSED&&(e.readyState===G.OPEN&&(e._readyState=G.CLOSING,yo(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function yo(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function bo(){let r=this[ne];if(this.removeListener("close",bo),this.removeListener("data",Xn),this.removeListener("end",vo),r._readyState=G.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[ne]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",ho),r._receiver.on("finish",ho))}function Xn(r){this[ne]._receiver.write(r)||this.pause()}function vo(){let r=this[ne];r._readyState=G.CLOSING,r._receiver.end(),this.end()}function So(){let r=this[ne];this.removeListener("error",So),this.on("error",po),r&&(r._readyState=G.CLOSING,this.destroy())}});var Do=fe((oh,ko)=>{"use strict";var ih=Yn(),{Duplex:Qc}=Z("stream");function Co(r){r.emit("close")}function ef(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Ao(r){this.removeListener("error",Ao),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function tf(r,e){let i=!0,a=new Qc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,l){let h=!l&&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(Co,a);return}let l=!1;r.once("error",function(m){l=!0,f(m)}),r.once("close",function(){l||f(x),process.nextTick(Co,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,l){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,l)});return}r.send(x,l)},a.on("end",ef),a.on("error",Ao),a}ko.exports=tf});var Vr=fe((ah,Po)=>{"use strict";var{tokenChars:nf}=bt();function rf(r){let e=new Set,i=-1,a=-1,x=0;for(x;x<r.length;x++){let l=r.charCodeAt(x);if(a===-1&&nf[l]===1)i===-1&&(i=x);else if(x!==0&&(l===32||l===9))a===-1&&i!==-1&&(a=x);else if(l===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}Po.exports={parse:rf}});var Oo=fe((ch,Bo)=>{"use strict";var sf=Z("events"),$n=Z("http"),{Duplex:xh}=Z("stream"),{createHash:of}=Z("crypto"),To=Wn(),it=yt(),af=Vr(),xf=Yn(),{CLOSE_TIMEOUT:cf,GUID:ff,kWebSocket:uf}=qe(),df=/^[+/0-9A-Za-z]{22}==$/,Io=0,Ro=1,Lo=2,Xr=class extends sf{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:cf,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:xf,...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=$n.createServer((a,x)=>{let f=$n.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=lf(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,l)=>{this.handleUpgrade(x,f,l,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Io}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===Lo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Xt,this);return}if(e&&this.once("close",e),this._state!==Ro)if(this._state=Ro,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(Xt,this):process.nextTick(Xt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Xt(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",No);let f=e.headers["sec-websocket-key"],l=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){ot(this,e,i,405,"Invalid HTTP method");return}if(l===void 0||l.toLowerCase()!=="websocket"){ot(this,e,i,400,"Invalid Upgrade header");return}if(f===void 0||!df.test(f)){ot(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){ot(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Yt(i,400);return}let m=e.headers["sec-websocket-protocol"],y=new Set;if(m!==void 0)try{y=af.parse(m)}catch{ot(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let S=e.headers["sec-websocket-extensions"],b={};if(this.options.perMessageDeflate&&S!==void 0){let D=new it({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let R=To.parse(S);R[it.extensionName]&&(D.accept(R[it.extensionName]),b[it.extensionName]=D)}catch{ot(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,(R,N,L,F)=>{if(!R)return Yt(i,N||401,L,F);this.completeUpgrade(b,f,y,e,i,a,x)});return}if(!this.options.verifyClient(D))return Yt(i,401)}this.completeUpgrade(b,f,y,e,i,a,x)}completeUpgrade(e,i,a,x,f,l,h){if(!f.readable||!f.writable)return f.destroy();if(f[uf])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Io)return Yt(f,503);let y=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${of("sha1").update(i+ff).digest("base64")}`],S=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&&(y.push(`Sec-WebSocket-Protocol: ${b}`),S._protocol=b)}if(e[it.extensionName]){let b=e[it.extensionName].params,D=To.format({[it.extensionName]:[b]});y.push(`Sec-WebSocket-Extensions: ${D}`),S._extensions=e}this.emit("headers",y,x),f.write(y.concat(`\r
|
|
12
12
|
`).join(`\r
|
|
13
|
-
`)),
|
|
14
|
-
`+Object.keys(a).map(
|
|
13
|
+
`)),f.removeListener("error",No),S.setSocket(f,l,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(S),S.on("close",()=>{this.clients.delete(S),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Xt,this)})),h(S,x)}};Bo.exports=Xr;function lf(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 Xt(r){r._state=Lo,r.emit("close")}function No(){this.destroy()}function Yt(r,e,i,a){i=i||$n.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} ${$n.STATUS_CODES[e]}\r
|
|
14
|
+
`+Object.keys(a).map(x=>`${x}: ${a[x]}`).join(`\r
|
|
15
15
|
`)+`\r
|
|
16
16
|
\r
|
|
17
|
-
`+i)}function
|
|
17
|
+
`+i)}function ot(r,e,i,a,x,f){if(r.listenerCount("wsClientError")){let l=new Error(x);Error.captureStackTrace(l,ot),r.emit("wsClientError",l,i,e)}else Yt(i,a,x,f)}});import{spawn as Lf}from"node:child_process";import{existsSync as Bf,openSync as Of}from"node:fs";import{mkdir as zf}from"node:fs/promises";import{dirname as Mf}from"node:path";import{fileURLToPath as qf}from"node:url";function Zr(r=V()){return Bf(r.libEntry)?r.libEntry:qf(new URL("../index.ts",import.meta.url))}async function Xo(r={}){let e=r.paths??V(),i=r.entryOverride??Zr(e);await zf(Mf(e.logFile),{recursive:!0});let a=Of(e.logFile,"a"),f=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],l=Lf(process.execPath,f,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(l.unref(),typeof l.pid!="number")throw new Error("failed to spawn daemon (no pid)");return Kf.info("daemon spawned",{pid:l.pid,entry:i}),{pid:l.pid,entry:i}}var Kf,Qr=Le(()=>{"use strict";J();de();Kf=B("spawn-daemon")});import{spawn as Vf}from"node:child_process";import{mkdir as Xf,unlink as Yf,writeFile as $f}from"node:fs/promises";import{dirname as Zf,join as Qf}from"node:path";function rr(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function e0(r,e){return new Promise((i,a)=>{let x=Vf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var nr,ns,rs,t0=Le(()=>{"use strict";J();nr=B("supervisor.launchd"),ns="ai.coze.bridge",rs={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>${ns}</string>
|
|
23
23
|
<key>ProgramArguments</key>
|
|
24
24
|
<array>
|
|
25
|
-
<string>${
|
|
26
|
-
<string>${
|
|
25
|
+
<string>${rr(r.nodeBin)}</string>
|
|
26
|
+
<string>${rr(r.entry)}</string>
|
|
27
27
|
<string>--daemon</string>
|
|
28
28
|
</array>
|
|
29
29
|
<key>RunAtLoad</key>
|
|
@@ -33,12 +33,12 @@ var $a=Object.create;var pr=Object.defineProperty;var Za=Object.getOwnPropertyDe
|
|
|
33
33
|
<key>ThrottleInterval</key>
|
|
34
34
|
<integer>10</integer>
|
|
35
35
|
<key>StandardOutPath</key>
|
|
36
|
-
<string>${
|
|
36
|
+
<string>${rr(r.logFile)}</string>
|
|
37
37
|
<key>StandardErrorPath</key>
|
|
38
|
-
<string>${
|
|
38
|
+
<string>${rr(r.logFile)}</string>
|
|
39
39
|
</dict>
|
|
40
40
|
</plist>
|
|
41
|
-
`},configPath(r){return
|
|
41
|
+
`},configPath(r){return Qf(r.homeDir,"Library","LaunchAgents",`${ns}.plist`)},async install(r){let e=this.configPath(r);await Xf(Zf(e),{recursive:!0}),await $f(e,this.renderConfig(r),"utf8"),nr.info("plist written",{plistPath:e}),await e0("launchctl",["load","-w",e]),nr.info("launchd job loaded",{label:ns})},async uninstall(r){let e=this.configPath(r);await e0("launchctl",["unload","-w",e]).catch(i=>nr.warn("launchctl unload failed (ignored)",{err:String(i)})),await Yf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),nr.info("launchd job removed",{plistPath:e})}}});import{spawn as eu}from"node:child_process";import{mkdir as tu,unlink as nu,writeFile as ru}from"node:fs/promises";import{dirname as su,join as iu}from"node:path";function or(r,e){return new Promise((i,a)=>{let x=eu(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var sr,ir,ss,n0=Le(()=>{"use strict";J();sr=B("supervisor.systemd"),ir="coze-bridge.service",ss={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 iu(r.homeDir,".config","systemd","user",ir)},async install(r){let e=this.configPath(r);await tu(su(e),{recursive:!0}),await ru(e,this.renderConfig(r),"utf8"),sr.info("systemd unit written",{unitPath:e}),await or("systemctl",["--user","daemon-reload"]),await or("systemctl",["--user","enable","--now",ir]),sr.info("systemd unit enabled",{unitName:ir})},async uninstall(r){let e=this.configPath(r);await or("systemctl",["--user","disable","--now",ir]).catch(i=>sr.warn("systemctl disable failed (ignored)",{err:String(i)})),await nu(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await or("systemctl",["--user","daemon-reload"]).catch(()=>{}),sr.info("systemd unit removed",{unitPath:e})}}});import{spawn as ou}from"node:child_process";import{join as au}from"node:path";function r0(r,e){return new Promise((i,a)=>{let x=ou(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var is,ar,os,s0=Le(()=>{"use strict";J();is=B("supervisor.taskscheduler"),ar="CozeBridge",os={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,21 +76,21 @@ WantedBy=default.target
|
|
|
76
76
|
</Exec>
|
|
77
77
|
</Actions>
|
|
78
78
|
</Task>
|
|
79
|
-
`},configPath(r){return
|
|
79
|
+
`},configPath(r){return au(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await r0("schtasks",["/Create","/SC","ONLOGON","/TN",ar,"/TR",e,"/RU",r.userName,"/F"]),is.info("task scheduler entry created",{task:ar})},async uninstall(r){await r0("schtasks",["/Delete","/TN",ar,"/F"]).catch(e=>is.warn("schtasks /Delete failed (ignored)",{err:String(e)})),is.info("task scheduler entry removed",{task:ar})}}});var as={};Is(as,{buildContext:()=>uu,getSupervisor:()=>fu,launchdSupervisor:()=>rs,systemdSupervisor:()=>ss,taskSchedulerSupervisor:()=>os});import{homedir as xu,userInfo as cu}from"node:os";function fu(r=process.platform){switch(r){case"darwin":return rs;case"linux":return ss;case"win32":return os;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function uu(){let r=V();return{nodeBin:process.execPath,entry:Zr(r),logFile:r.logFile,homeDir:xu(),userName:cu().username}}var xs=Le(()=>{"use strict";de();Qr();t0();n0();s0()});We();J();import{readdir as _a}from"node:fs/promises";import{mkdir as la,writeFile as ha}from"node:fs/promises";import{join as ga}from"node:path";var pa={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function dt(r,e,i,a){await la(r,{recursive:!0});let x=pa[e],f=ga(r,x),l=ma(e,i,a);return await ha(f,l,"utf8"),f}function ma(r,e,i){let a=`# Coze Agent: ${e}
|
|
80
80
|
|
|
81
81
|
> framework: \`${r}\`
|
|
82
82
|
|
|
83
|
-
`,
|
|
83
|
+
`,x=i?.trim()?i.endsWith(`
|
|
84
84
|
`)?i:`${i}
|
|
85
85
|
`:`_No instructions provided._
|
|
86
86
|
`;return`${a}---
|
|
87
87
|
|
|
88
|
-
${
|
|
89
|
-
`)}}function br(r){return`coze-session-${r.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function Ys(r,e){if(!r.modelToken||It(r.model))return null;let i=yr(e),a={baseUrl:`${wr}/v1`,api:"openai-completions",apiKey:r.modelToken,models:[{id:r.model,name:r.model,reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192,api:"openai-completions"}]};return Object.keys(i).length>0&&(a.headers=i),a}function $s(r,e){if(!r.modelToken)return[];let i=yr(e),a=[];for(let[c,u]of Object.entries(i))a.push("-c",`model_providers.coze.http_headers.${c}="${u}"`);return a}var ie=R("agent-handlers"),Zs=5*1024*1024,D0=1,T0=6,I0=new Set(["node_modules",".git",".coze","dist","build",".next"]),un=class{constructor(e){this.opts=e}opts;async listSkills(e){Me(e._meta,"_agent/listSkills");let i=ft(e._meta),a=await this.loadAgentCfg(i),c=a?.workspace??Re(i).workspace,u=a?.skills??[],d=[];for(let l of u){let p=Oe(c,l.relPath,"SKILL.md");await C0(p).then(v=>v.isFile()).catch(()=>!1)&&d.push({skillId:l.skillId,skillName:l.skillName,downloadUrl:l.downloadUrl??"",...l.description?{description:l.description}:{},...l.version?{version:l.version}:{}})}return{skills:d}}async addSkills(e){Me(e._meta,"_agent/addSkills");let i=ft(e._meta),a=await this.requireAgentCfg(i),c=e.skills??[],u=[...a.skills??[]],d=new Map(u.map((p,_)=>[p.skillId,_])),l=[];for(let p of c){if(!p.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let _=L0(p.skillName),v=N0(a.framework),w=Oe(v,_),C=Oe(a.workspace,w);await v0(C,{recursive:!0});let P=await O0(p.downloadUrl);z0(P)?await q0(P,C):await A0(Oe(C,"SKILL.md"),P.toString("utf8"),"utf8");let T={skillId:p.skillId,skillName:p.skillName,relPath:w,installedAt:Date.now(),...p.description?{description:p.description}:{},...p.version?{version:p.version}:{},...p.downloadUrl?{downloadUrl:p.downloadUrl}:{}},N=d.get(p.skillId);N!==void 0?u[N]=T:(d.set(p.skillId,u.length),u.push(T)),l.push(p),ie.info("skill installed",{agentId:i,skillId:p.skillId,skillName:p.skillName,relPath:w})}return await nn(i,u),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:l}}async removeSkills(e){Me(e._meta,"_agent/removeSkills");let i=ft(e._meta),a=await this.requireAgentCfg(i),c=new Set(e.skillIds??[]),u=a.skills??[],d=[];for(let l of u){if(!c.has(l.skillId)){d.push(l);continue}let p=Oe(a.workspace,l.relPath);await E0(p,{recursive:!0,force:!0}),ie.info("skill removed",{agentId:i,skillId:l.skillId,relPath:l.relPath})}return await nn(i,d),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[c,u]of a.sessions)if(!(!u.downstream||!u.acpSessionId)){u.loadingSession=!0;try{await u.downstream.sessionLoad({sessionId:u.acpSessionId,cwd:a.workspace}),ie.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:c,acpId:u.acpSessionId})}catch(d){ie.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:c,acpId:u.acpSessionId,err:String(d)})}finally{u.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return ie.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await de(i);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(ie.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await we(a),await ut(a.workspace,a.framework,i,e.cozeIdentity),ie.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 E("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await de(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await we(a),ie.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}):(ie.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Me(e._meta,"_agent/switchModel"),!e.agentId)throw new E("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:dt,a=await de(e.agentId);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await we(a),ie.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let c=this.opts.agents.get(e.agentId);if(!c)return ie.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};c.model=i;let u=[];for(let[d,l]of c.allSessionQueues())u.push(l.enqueue(async()=>{let p=c.sessions.get(d);p?.downstream&&(await p.downstream.stop(`switchModel: ${i}`).catch(()=>{}),p.downstream=void 0)}));return await Promise.all(u),ie.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i,cloudSessions:u.length}),{ok:!0}}async resetAgent(e){if(Me(e._meta,Ce.RESET),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Ce.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,Ce.RESET,e.reason),{ok:!0}}async repairAgent(e){if(Me(e._meta,Ce.REPAIR),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Ce.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new E("IPC_BAD_REQUEST",`${Ce.REPAIR} only allowed for openclaw, got ${i.framework}`);if(i&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,i.workspace)}catch(a){ie.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(a)})}return await this.runDetailSync(e.agentId,Ce.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,a){if(!this.opts.detailSyncer){ie.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(c){ie.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:a,err:String(c)})}}async getFileTree(e){Me(e._meta,"_agent/getFileTree");let i=e._meta,a=ft(i),c=await this.resolveWorkspace(a),u=e.filePath??"",d=this.safeJoin(c,u),l=await vr(d).catch(()=>null);if(!l)throw new E("IPC_BAD_REQUEST",`path not found: ${u}`);if(l.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${u}`);let p=U0(e.depth);return l.isDirectory()?{tree:await ri(c,d,u,p)}:{tree:[{name:H0(u),path:si(u||"."),isDir:!1,size:l.size,modifiedAt:Math.floor(l.mtimeMs)}]}}async getFileContent(e){Me(e._meta,"_agent/getFileContent");let i=ft(e._meta),a=await this.resolveWorkspace(i);if(!e.filePath)throw new E("IPC_BAD_REQUEST","filePath required");let c=this.safeJoin(a,e.filePath),u=await vr(c).catch(()=>null);if(!u||!u.isFile())throw new E("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(u.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(u.size>Zs)throw new E("IPC_BAD_REQUEST",`file too large: ${u.size} bytes (max ${Zs})`);let d=await ei(c);return d.includes(0)?{content:d.toString("base64"),encoding:"base64",size:u.size}:{content:d.toString("utf8"),encoding:"utf-8",size:u.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await de(e).catch(()=>null))?.workspace??Re(e).workspace}safeJoin(e,i){let a=P0(e,i||"."),c=ti(e,a);if(c.startsWith("..")||c===".."||c.startsWith(`..${ni}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return de(e)}async requireAgentCfg(e){let i=await this.loadAgentCfg(e);if(!i)throw new E("AGENT_NOT_FOUND",`no config for agent: ${e}`);return i}};function L0(r){let e=Tt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new E("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function N0(r){return r==="claude-code"?Oe(".claude","skills"):Oe(".agents","skills")}var R0=3e4,M0=50*1024*1024,fn=3e4;async function O0(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);cn(e);let i=B0(r);return cn(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await ei(e);return cn(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),R0);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new E("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let c=await a.arrayBuffer();return cn(c.byteLength),Buffer.from(c)}finally{clearTimeout(i)}}throw new E("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function cn(r){if(r>M0)throw new E("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function B0(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new E("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 z0(r){return r.length>=2&&r[0]===31&&r[1]===139}async function q0(r,e){await F0(r),await new Promise((i,a)=>{let c=Qs("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),u="";c.stderr?.on("data",l=>{u+=String(l)});let d=setTimeout(()=>{c.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar extract timeout (${fn}ms)`))},fn);c.on("error",l=>{clearTimeout(d),a(new E("IPC_BAD_REQUEST",`tar spawn failed: ${l.message}`,{cause:l}))}),c.on("exit",l=>{clearTimeout(d),l===0?i():a(new E("IPC_BAD_REQUEST",`tar exit ${l}${u?`: ${u.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)})}async function F0(r){let e=await new Promise((i,a)=>{let c=Qs("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),u="",d="";c.stdout?.on("data",p=>{u+=String(p)}),c.stderr?.on("data",p=>{d+=String(p)});let l=setTimeout(()=>{c.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar list timeout (${fn}ms)`))},fn);c.on("error",p=>{clearTimeout(l),a(new E("IPC_BAD_REQUEST",`tar list spawn failed: ${p.message}`))}),c.on("exit",p=>{clearTimeout(l),p===0?i(u):a(new E("IPC_BAD_REQUEST",`tar list exit ${p}${d?`: ${d.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)});for(let i of e.split(`
|
|
90
|
-
`)){let a=i.trim();if(!a)continue;let
|
|
91
|
-
`}var
|
|
92
|
-
`);this.buffer=i.pop()??"";let a=[];for(let c of i){let u=c.replace(/\r$/,"").trim();if(u)try{a.push(JSON.parse(u))}catch(d){this.onError?.({line:u,error:d})}}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 ui={"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","_agent/genModelToken":"agent.genModelToken","_agent/reset":"agent.reset","_agent/repair":"agent.repair","session/request_permission":"session.requestPermission",initialize:"initialize"},Cd=Object.fromEntries(Object.entries(ui).map(([r,e])=>[e,r])),W0={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":[],"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.genModelToken":["agentId","sessionId"],"agent.reset":["agentId"],"agent.repair":["agentId"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},ht=class{seq=0;next(e,i){this.seq+=1;let a=ui[e]??J0(e),c=W0[a]??[],u=[a,String(this.seq)];if(c.length>0){let d=c.map(p=>ci(i?.[p]??"")),l=V0(d).join(":");l&&u.push(l)}else i&&Object.values(i).some(d=>d)&&u.push(Object.values(i).filter(Boolean).map(d=>ci(String(d))).join(":"));return u.join("_")}reset(){this.seq=0}};function J0(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function ci(r){return r.replace(/[:_\s]+/g,"-")}function V0(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}H();var Y0=3e4;function fi(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var je=class{constructor(e){this.opts=e;this.log=R(`downstream.${this.constructor.name}`),this.decoder=new mn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new ht;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new E("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=X0(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 c of this.decoder.push(a))this.dispatch(c)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),i.on("exit",(a,c)=>{this.stopped=!0,this.failAllPending(new E("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${c})`));for(let u of this.exitHandlers)u(a,c)}),i.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new E("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(u=>i.once("exit",()=>u()));fi(i.pid,"SIGTERM");let c=setTimeout(()=>{i.killed||fi(i.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(c)}}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){!this.child||this.stopped||this.writeFrame(ln("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(lt(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($e(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=Y0){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let c=this.idAllocator.next(e),u=Nt(c,e,i),d=a>0&&Number.isFinite(a);return new Promise((l,p)=>{let _=d?setTimeout(()=>{this.pending.delete(c),p(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(c,{resolve:l,reject:p,timer:_,method:e});try{this.writeFrame(u)}catch(v){_&&clearTimeout(_),this.pending.delete(c),p(v)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new E("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(xi(e))}dispatch(e){if(gn(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(ai(e.error)):i.resolve(e.result);return}if(oi(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(ii(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($e(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($e(e.id,pn(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var $0="@agentclientprotocol/claude-agent-acp@latest";function Z0(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 _n=class extends je{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",$0],c={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(c)}sanitizeEnv(e){return Z0(e)}};import{mkdtempSync as Q0,rmSync as ex}from"node:fs";import{tmpdir as tx}from"node:os";import{join as nx}from"node:path";var rx="@zed-industries/codex-acp@latest",wn=class extends je{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=e.command??"npx",a=e.args??["-y",rx],c=e.extraArgs?[...a,...e.extraArgs]:a,u=e.isolateCodexHome?Q0(nx(tx(),"coze-bridge-codex-home-")):void 0,d=u?{...e.env??{},CODEX_HOME:u}:e.env,l={command:i,args:c,cwd:e.cwd,...d?{env:d}:{}};super(l),this.authMethodId=e.authMethodId,this.codexHomeDir=u}async initialize(e){let i=await super.initialize(e);return this.authMethodId&&await this.call("authenticate",{methodId:this.authMethodId}),i}async stop(e){if(await super.stop(e),this.codexHomeDir)try{ex(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Rt=class extends je{framework="openclaw";agentId;sessionName;slashModelOnStart;constructor(e){let i=e.sessionName??"default",a=["acp","--session",`agent:${e.agentId}:${i}`];e.gatewayToken&&a.push("--token",e.gatewayToken);let c={command:e.command,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(c),this.agentId=e.agentId,this.sessionName=i,this.slashModelOnStart=e.slashModelOnStart}async afterSessionEstablished(e){this.slashModelOnStart&&(this.log.info("switching session to per-session provider via /model",{agentId:this.agentId,sessionName:this.sessionName,slash:this.slashModelOnStart}),await this.sessionPrompt({sessionId:e,prompt:[{type:"text",text:`/model ${this.slashModelOnStart}`}]}))}get acpSessionName(){return this.sessionName}};H();fe();var gt=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 yn=class{agentId;framework;workspace;deployType;sessions=new Map;sessionQueues=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local"}getSessionQueue(e){let i=this.sessionQueues.get(e);return i||(i=new gt,this.sessionQueues.set(e,i)),i}allSessionQueues(){return this.sessionQueues.entries()}async dispose(e){this.status="stopped";let i=new Error(`AgentSession disposed${e?`: ${e}`:""}`);for(let a of this.sessionQueues.values())a.dispose(i);this.sessionQueues.clear(),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,a]of this.sessions)Mt(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function Mt(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}import{spawn as sx}from"node:child_process";import{homedir as ix}from"node:os";import{join as ox}from"node:path";Zt();H();async function hi(){let r=ox(ix(),".openclaw/openclaw.json");return(await ct(r))?.gateway?.auth?.token??""}var di=R("openclaw.config"),ax=[0,5e3,5e3],li="models.providers.",bn="agents.defaults.models",vn=class{command;env;retryDelaysMs;queue=new gt;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??ax}async withRetry(e,i){let a;for(let c=0;c<this.retryDelaysMs.length;c++){let u=this.retryDelaysMs[c]??0;u>0&&await new Promise(d=>setTimeout(d,u));try{return await i()}catch(d){a=d,di.warn("openclaw cli failed, will retry",{label:e,attempt:c+1,err:String(d)})}}throw new E("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${a?.message??"unknown"}`)}runCli(e){return new Promise((i,a)=>{let c=sx(this.command,e,{stdio:["ignore","pipe","pipe"],env:this.env}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?i():a(new Error(`exit ${d}: ${u.trim().slice(0,500)}`))})})}async runCliTolerant(e,i){try{await this.runCli(e)}catch(a){let c=String(a);if(i.some(u=>c.includes(u)))return;throw a}}async bestEffortUnset(e,i){try{await this.queue.enqueue(()=>this.withRetry(e,()=>this.runCli(["config","unset",i])))}catch(a){di.warn(`${e} failed (best-effort)`,{configPath:i,err:String(a)})}}ensureProvider(e,i){return this.queue.enqueue(()=>this.withRetry(`config set models.providers.${e}`,()=>this.runCli(["config","set",`${li}${e}`,JSON.stringify(i),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${li}${e}`)}addModelToAllowlist(e,i){let a={[e]:i?{alias:i}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${bn}[${e}]`,()=>this.runCli(["config","set",bn,JSON.stringify(a),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${bn}[${e}]`,`${bn}.${e}`)}ensureAgent(e,i,a){let c=["agents","add",e,"--workspace",i,"--non-interactive"];return a&&c.push("--model",a),this.queue.enqueue(()=>this.withRetry(`agents add ${e}`,()=>this.runCliTolerant(c,["already exists","already registered"])))}deleteAgent(e){return this.queue.enqueue(()=>this.withRetry(`agents delete ${e}`,()=>this.runCliTolerant(["agents","delete",e,"--force"],["not found","does not exist"])))}};var Ze=R("agent-manager"),cx=(r,e,i,a,c,u,d)=>{switch(r){case"claude-code":{let l=c?{...Ws(c),...Xs(c,d)}:void 0;return new _n({cwd:i,...l&&Object.keys(l).length>0?{env:l}:{}})}case"codex":{let l=c?[...Js(c),...$s(c,d)]:[],p=c?Vs(c):void 0,_=!!c;return new wn({cwd:i,...l.length>0?{extraArgs:l}:{},...p&&Object.keys(p).length>0?{env:p}:{},..._?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new Rt({command:e,cwd:i,agentId:a,...u?{sessionName:Tt(u)}:{}})}};function gi(r){return r==="claude-code"||r==="codex"}var ux={path:"",version:"cloud-deployed"},fx={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},dx=2e4,Sn=class{paths;config;registry;factory;createTimeoutMs;openclawConfigCache;ensuredProviders=new Set;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??cx,this.createTimeoutMs=e.createTimeoutMs??dx}getOpenclawConfig(){if(!this.openclawConfigCache){let e=this.config.frameworksCache?.openclaw;if(!e?.path)throw new E("AGENT_SPAWN_FAILED","openclaw binary not detected on this machine");this.openclawConfigCache=new vn({command:e.path})}return this.openclawConfigCache}async createAgent(e){if(!e.agentId)throw new E("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new E("IPC_BAD_REQUEST","framework required");let i=Dt(e._meta)==="cloud";this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new E("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")Ze.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(C=>Ze.warn("dispose stale agent failed (ignored)",{err:String(C)})),this.registry.unregister(e.agentId);else return Ze.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!(i&&gi(e.framework))&&!this.config.frameworksCache?.[e.framework])throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let u=Re(e.agentId,this.paths),d=e.workspace??u.workspace,l=Dt(e._meta),p=new AbortController,_=setTimeout(()=>p.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),v,w=!1;try{let C=()=>{if(p.signal.aborted)throw p.signal.reason instanceof Error?p.signal.reason:new E("AGENT_TIMEOUT","_agent/create aborted")};await Sr(u.root,{recursive:!0}),await Sr(d,{recursive:!0}),await Sr(u.logs,{recursive:!0}),C(),await ut(d,e.framework,e.agentId,e.cozeIdentity),C();let P=await de(e.agentId,this.paths).catch(()=>null),T=js({model:e.model??P?.model});if(v=new yn({agentId:e.agentId,framework:e.framework,workspace:d,model:T.model??dt,deployType:l}),v.status="ok",P?.sessions){for(let[ae,te]of Object.entries(P.sessions))v.sessions.set(ae,{acpSessionId:te.acpSessionId,modelToken:te.modelToken,tokenGeneratedAt:te.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let z=Object.keys(P.sessions).length;z>0&&Ze.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:z})}this.registry.register(v),w=!0;let N={agentId:e.agentId,framework:e.framework,workspace:d,cozeIdentity:e.cozeIdentity,createdAt:P?.createdAt??Date.now(),sessions:P?.sessions??{},model:T.model};return l==="cloud"&&(N.deployType="cloud"),P?.skills&&(N.skills=P.skills),P?.agentName&&(N.agentName=P.agentName),P?.description&&(N.description=P.description),await we(N,this.paths),e.framework==="openclaw"&&await this.getOpenclawConfig().ensureAgent(e.agentId,d),Ze.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:l}),{ok:!0,agentId:e.agentId,workspace:d,framework:e.framework}}catch(C){throw Ze.error("agent create failed, rolling back",{agentId:e.agentId,err:String(C)}),w&&v&&(await v.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await xx(u.root,{recursive:!0,force:!0}).catch(P=>Ze.warn("rm agent dir failed (ignored)",{err:String(P)})),C instanceof E?C:new E("AGENT_SPAWN_FAILED",String(C),{cause:C})}finally{clearTimeout(_)}}async spawnSessionDownstream(e,i,a,c){let d=this.config.frameworksCache?.[e.framework];if(!d)if(e.deployType==="cloud"&&gi(e.framework))d=ux;else throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let l=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,p;e.framework==="openclaw"?p=await this.buildOpenclawDownstream({session:e,modelConfig:l,cloudSessionId:a,cozeEnv:c,command:d.path}):p=this.factory(e.framework,d.path,e.workspace,e.agentId,l,a,c);try{return await p.start(),await p.initialize(fx),p}catch(_){throw await p.stop("spawnSessionDownstream failed").catch(()=>{}),_ instanceof E?_:new E("AGENT_SPAWN_FAILED",_ instanceof Error?_.message:String(_),{cause:_})}}async buildOpenclawDownstream(e){let{session:i,modelConfig:a,cloudSessionId:c,cozeEnv:u,command:d}=e,l=Tt(c),p=await hi(),_=a?.modelToken&&!It(a.model)?Ys(a,u):null,v;if(_){let w=br(c),C=`${w}/${a.model}`;if(!this.ensuredProviders.has(C)){let P=this.getOpenclawConfig();await P.ensureProvider(w,_),await P.addModelToAllowlist(C),this.ensuredProviders.add(C)}v=C}return new Rt({command:d,cwd:i.workspace,agentId:i.agentId,sessionName:l,...p?{gatewayToken:p}:{},...v?{slashModelOnStart:v}:{}})}async openclawRepair(e,i){let a=this.getOpenclawConfig();await a.deleteAgent(e),await a.ensureAgent(e,i)}async cleanupOpenclawSessionProviders(e){if(e.framework!=="openclaw"||!this.openclawConfigCache)return;let i=this.openclawConfigCache;for(let a of e.sessions.keys()){let c=br(a),u=`${c}/${e.model}`;this.ensuredProviders.delete(u),await i.removeProvider(c),await i.removeModelFromAllowlist(u)}}};H();import{spawn as lx}from"node:child_process";import{constants as pi,access as hx}from"node:fs/promises";import{delimiter as gx,join as px}from"node:path";var mx=R("framework-detector"),mi={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},_x=[".exe",".cmd",".bat",".ps1"],Ot=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??lx,access:e.access??hx}}async detect(e){let i=mi[e],a=await this.which(i);if(!a)return mx.debug("framework binary not found",{framework:e,bin:i}),null;let c=await this.probeVersion(a);return{path:a,version:c}}async detectAll(){let e=await Promise.all(Object.keys(mi).map(async a=>[a,await this.detect(a)])),i={};for(let[a,c]of e)c&&(i[a]=c);return i}async which(e){let i=this.env.pathEnv.split(gx).filter(Boolean),a=this.env.platform==="win32"?["",..._x]:[""];for(let c of i)for(let u of a){let d=px(c,e+u);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?pi.F_OK:pi.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",c=!1,u,d=l=>{c||(c=!0,u&&clearTimeout(u),i(l.trim()||"unknown"))};try{let l=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});u=setTimeout(()=>{l.kill("SIGKILL"),d("unknown")},5e3),l.stdout?.on("data",p=>{a+=p.toString("utf8")}),l.on("error",()=>d("unknown")),l.on("close",()=>{let p=bx(a).split(/\r?\n/)[0]??"";d(p)})}catch{d("unknown")}})}},yx=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function bx(r){return r.replace(yx,"")}Zt();fe();var vx=10*6e4;function _i(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?vx:e}function En(r){return ct(r??K().configFile)}function Bt(r,e){return $t(e??K().configFile,r)}import{randomBytes as Sx}from"node:crypto";Ge();H();var G=R("core"),Ex=3e4,Cx=3e4,Cn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new ht;pendingUpstream=new Map;pendingBridge=new Map;currentCozeEnv;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=_i(e.bridgeConfig)}registerExtension(e,i){this.extensions[e]=i}getCozeEnv(){return this.currentCozeEnv}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),G.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){G.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),G.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){G.warn("onAgentRegister handler threw (ignored)",{agentId:e.agentId,err:String(a)})}}onAgentRegister(e){return this.registerHandlers.add(e),()=>this.registerHandlers.delete(e)}registerHandlers=new Set;unregister(e){this.agents.delete(e)}reviveIfDisconnected(e){this.disconnectedAgents.delete(e)&&G.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,a){let c=a.downstream;c&&(c.onUpdate(u=>{a.loadingSession||this.forwardUpdate(e,u)}),c.onAgentRequest(u=>{this.handleAgentRequest(e,c,u)}),c.onExit((u,d)=>{G.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:u,signal:d}),Mt(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(gn(e)){this.handleUpstreamResponse(e);return}if(!("method"in e)||typeof e.method!="string")return;let i="id"in e&&e.id!==void 0?e.id:null,a=e.params?._meta?.cozeEnv;a&&(this.currentCozeEnv=a);try{if(e.method.startsWith("_agent/")){let c=this.extensions[e.method];if(!c){i!==null?await this.sendError(i,j.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):G.warn("drop notification: extension not registered",{method:e.method});return}let u=await c(e,this);i!==null&&await this.upstream.send(lt(i,u));return}if(e.method.startsWith("session/")){let c=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(lt(i,c));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(lt(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,j.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):G.warn("drop unknown notification",{method:e.method})}catch(c){G.error("handleFrame failed",{method:e.method,err:String(c)}),i!==null&&await this.upstream.send($e(i,pn(c)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new E("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new E("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let c=this.agents.get(a);if(!c)throw this.disconnectedAgents.has(a)?new E("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new E("AGENT_NOT_FOUND",`agent not found: ${a}`);let u=typeof i.sessionId=="string"?i.sessionId:void 0;if(e.method==="session/cancel"||e.method==="session/new"||!u)return this.dispatchSessionCall(c,e.method,i);let d=Date.now(),l=!1;try{let p=await c.getSessionQueue(u).enqueue(()=>this.dispatchSessionCall(c,e.method,i));return l=!0,p}finally{G.info("session call done",{agentId:c.agentId,method:e.method,durationMs:Date.now()-d,ok:l})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:c}=Os(a);switch(i){case"session/new":{let u=Ax();return G.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:u}),{sessionId:u}}case"session/load":{let u=c;return G.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:u.sessionId}),{}}case"session/prompt":{let u=c,d=u.sessionId;if(!d)throw new E("IPC_BAD_REQUEST","session/prompt: missing sessionId");let l=await this.ensureRuntime(e,d);if(l.replySeq=0,await this.ensureDownstream(e,d,l),!l.downstream||!l.acpSessionId)throw new E("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let p=a._meta?.cozeTriggerMsgId;p?e.activeTriggers.set(l.acpSessionId,p):e.activeTriggers.delete(l.acpSessionId);try{let _=await l.downstream.sessionPrompt({...u,sessionId:l.acpSessionId});return l.lastActiveAt=Date.now(),_}finally{e.activeTriggers.delete(l.acpSessionId),l.downstream?.isAlive()&&this.armIdleTimer(e,d,l)}}case"session/cancel":{let d=c.sessionId;if(!d)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let l=e.sessions.get(d);return l?.downstream?.isAlive()&&l.acpSessionId&&await l.downstream.sessionCancel({sessionId:l.acpSessionId}),{ok:!0}}default:throw new E("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}async ensureRuntime(e,i){let a=e.sessions.get(i);if(a)return a;let u={modelToken:e.deployType==="cloud"?await this.requestSessionToken(e.agentId,i):"",tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1,replySeq:0};return e.sessions.set(i,u),await this.persistSessionMapping(e),u}async requestSessionToken(e,i){let a={sessionId:i,_meta:{cozeAgentId:e}};try{let c=await this.sendRequest(Ce.GEN_MODEL_TOKEN,a,Cx);if(!c?.modelToken)throw new E("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return c.modelToken}catch(c){throw c instanceof E&&c.code==="MODEL_TOKEN_GEN_FAILED"?c:new E("MODEL_TOKEN_GEN_FAILED",c instanceof Error?c.message:String(c),{cause:c})}}async ensureDownstream(e,i,a){if(Mt(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new E("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let c=await this.sessionSpawner(e,a.modelToken,i,this.currentCozeEnv);if(a.downstream=c,this.attachRuntimeHooks(e,i,a),a.acpSessionId){a.loadingSession=!0;try{await c.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),G.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId})}catch(u){G.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId,err:String(u)}),a.acpSessionId=void 0;let d=await c.sessionNew({cwd:e.workspace});a.acpSessionId=d.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let u=await c.sessionNew({cwd:e.workspace});a.acpSessionId=u.sessionId,await this.persistSessionMapping(e)}c.afterSessionEstablished&&a.acpSessionId&&await c.afterSessionEstablished(a.acpSessionId)}armIdleTimer(e,i,a){Mt(a),a.idleTimer=setTimeout(()=>{G.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let c=a.downstream;a.downstream=void 0,a.idleTimer=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),c&&c.stop("idle timeout").catch(u=>G.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(u)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}forwardUpdate(e,i){let a=i.sessionId,c=this.reverseSessionId(e,a);if(!c){G.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let u=e.sessions.get(c);if(!u){G.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:c});return}let d={cozeAgentId:e.agentId,cozeReplySeqID:++u.replySeq},l=e.activeTriggers.get(a);l&&(d.cozeTriggerMsgId=l),this.upstream.send(ln("session/update",{...i,sessionId:c,_meta:d})).catch(p=>G.warn("forward update failed",{agentId:e.agentId,err:String(p)}))}handleAgentRequest(e,i,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,i,a);return}G.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),i.respondAgentRequestError(a.id,{code:j.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}forwardPermissionRequest(e,i,a){let c=this.upstreamIds.next("session/request_permission"),u=a.params??{},l=u.sessionId,p=l?e.activeTriggers.get(l):void 0,_={cozeAgentId:e.agentId};p&&(_.cozeTriggerMsgId=p);let v=l?this.reverseSessionId(e,l):void 0,w={...u,...v?{sessionId:v}:{},_meta:_};this.pendingUpstream.set(c,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),this.upstream.send(Nt(c,"session/request_permission",w)).catch(C=>{this.pendingUpstream.delete(c),G.error("forward permission request failed",{agentId:e.agentId,err:String(C)}),i.respondAgentRequestError(a.id,{code:j.INTERNAL_ERROR,message:`upstream send failed: ${String(C)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),e.error?i.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.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 hn(e.error)):a.resolve(e.result);return}G.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=Ex){let c=this.upstreamIds.next(e);return new Promise((u,d)=>{let l=setTimeout(()=>{this.pendingBridge.delete(c),d(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(c,{method:e,resolve:u,reject:d,timer:l}),this.upstream.send(Nt(c,e,i)).catch(p=>{let _=this.pendingBridge.get(c);_&&(clearTimeout(_.timer),this.pendingBridge.delete(c)),d(p)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[a,c]of e.sessions){let u={modelToken:c.modelToken,tokenGeneratedAt:c.tokenGeneratedAt};c.acpSessionId&&(u.acpSessionId=c.acpSessionId),i.set(a,u)}await _r(e.agentId,i,this.paths)}catch(i){G.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[a,c]of e.sessions.entries())if(c.acpSessionId===i)return a}sendError(e,i,a){return this.upstream.send($e(e,{code:i,message:a}))}};function Ax(){return Sx(16).toString("hex")}H();fe();import{randomBytes as kx}from"node:crypto";import{chmod as Px,mkdir as Dx,writeFile as wi}from"node:fs/promises";import{createServer as Tx}from"node:http";import{dirname as Ix}from"node:path";var Lx=1e6,Er=R("ipc"),An=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??K()}async start(){this.token=kx(32).toString("hex");let e=Tx((a,c)=>{this.dispatch(a,c)});this.server=e,await new Promise((a,c)=>{e.once("error",c),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(),Er.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(c=>c?a(c):i())}),this.server=null)}async persistAuthFiles(){await Dx(Ix(this.paths.portFile),{recursive:!0}),await wi(this.paths.portFile,String(this.port),"utf8"),await wi(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await Px(this.paths.tokenFile,384)}catch(e){Er.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){zt(i,401,{error:"unauthorized"});return}let c=`${e.method} ${(e.url??"").split("?")[0]}`,u=this.routes.get(c);if(!u){zt(i,404,{error:"not found"});return}let d=null;if(e.method==="POST")try{d=await Nx(e)}catch(l){zt(i,400,{error:"invalid json",detail:String(l)});return}try{let l=await u.handler(d,e);zt(i,200,l??{ok:!0})}catch(l){Er.error("IPC handler failed",{key:c,err:String(l)}),zt(i,500,{error:l instanceof Error?l.message:String(l)})}}};function zt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function Nx(r){let e=[],i=0;for await(let c of r){let u=c;if(i+=u.length,i>Lx)throw new Error("body too large");e.push(u)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Fo=Ne(Ti(),1);var lu=Ne(Ao(),1),hu=Ne(Hn(),1),gu=Ne(_t(),1),pu=Ne(Br(),1),mu=Ne(Fr(),1),_u=Ne(Wr(),1),Mo=Ne(Wn(),1),wu=Ne(Ro(),1);var Oo=Mo.default;H();var oe=R("upstream.frontier"),zo="application/json",qo="none",Vn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){oe.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:qs,...an(this.opts.ppeOverride)};class i extends Oo{constructor(l){super(l,zs,{headers:e})}send(l,...p){if(Rs("debug"))try{let _;typeof l=="string"?_=Buffer.from(l,"utf8"):l instanceof Buffer?_=l:l instanceof ArrayBuffer?_=new Uint8Array(l):ArrayBuffer.isView(l)?_=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):_=new Uint8Array(0);let v=Buffer.from(_.slice(0,128)).toString("hex");oe.debug("WS raw frame out",{bytes:_.byteLength,headHex:v})}catch(_){oe.warn("WS raw frame dump failed",{err:String(_)})}super.send(l,...p)}}let a=Hs(this.opts.urlOverride),c={url:a,ws:i,fpID:Bs,aID:on,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:zo,force:!0},payloadEncoding:{encoding:qo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},u=new Fo.FWS(c);u.onopen=()=>{this.opened=!0,this.openCount+=1;let d=this.openCount===1;oe.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:d,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:d})).catch(l=>oe.warn("onConnect handler threw (ignored)",{err:String(l)}))},u.onclose=d=>{this.opened=!1,oe.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},u.onerror=d=>{oe.warn("frontier error",{code:d.code,msg:d.message})},u.onmessage=d=>this.handleMessage(d),this.fws=u,await u.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){oe.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new E("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),c=e;oe.info("frontier frame out",{method:c.method,jsonrpcId:c.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:zo,payloadEncoding:qo})}catch(u){throw new E("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(u)}`,{cause:u})}}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){oe.debug("drop non-adapter frontier frame",{service:i});return}let a=vu(e);if(!a){oe.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){oe.debug("frame received but no onFrame handler",{size:a.length});return}let c;try{c=JSON.parse(a)}catch(u){oe.warn("frontier message JSON parse failed",{err:String(u),head:a.slice(0,80)});return}oe.info("frontier frame in",{logid:bu(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:c.id}),Promise.resolve(this.handler(c)).catch(u=>oe.warn("frontier frame handler threw",{err:String(u)}))}};function bu(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function vu(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}}H();var Vr=R("upstream.switchable"),Xn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;Vr.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(c){throw Vr.error("swap target start failed, reverting",{err:String(c)}),this.inner=a,c}await a.stop(i??"swapped").catch(c=>Vr.warn("previous upstream stop threw (ignored)",{err:String(c)}))}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()}};H();var Xr=R("upstream"),Jt=class{handler=null;async start(){Xr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Xr.info("NoopUpstream stopped",{reason:e})}async send(e){Xr.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)}};H();fe();H();fe();import{execSync as Su}from"node:child_process";import{readFileSync as Uo,unlinkSync as Eu}from"node:fs";import{mkdir as Cu,readFile as Ho,unlink as Ko,writeFile as Au}from"node:fs/promises";import{dirname as ku}from"node:path";var Pu=R("single-instance"),Yn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??K().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&&(Pu.warn("removing stale pid file",{stalePid:e}),await Ko(this.pidFile).catch(()=>{})),await Cu(ku(this.pidFile),{recursive:!0}),await Au(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Ho(this.pidFile,"utf8")).trim()===String(process.pid)&&await Ko(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Ho(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{process.kill(e,0)}catch(i){return i.code==="EPERM"}return this.matchesDaemonTitle(e)}matchesDaemonTitle(e){try{let i=Uo(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=Su(`ps -o command= -p ${e}`,{stdio:["ignore","pipe","ignore"],timeout:1e3}).toString();return i.trim()?i.includes("coze-bridge-daemon")||i.includes("lib/index.js"):!1}catch{return!0}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Uo(this.pidFile,"utf8").trim()===String(process.pid)&&Eu(this.pidFile)}catch{}})}};var O=R("daemon"),Du="coze-bridge-daemon";async function Wo(){let r=new Yn({processTitle:Du}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await En(),a=i??{};mr({pid:process.pid}),O.info(i?"loaded bridge config":"initialized bridge config");try{let k=new Ot;a.frameworksCache=await k.detectAll(),O.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(k){O.warn("framework detection failed",{err:String(k)})}await Bt(a);let c=new Xn(new Jt),u=K(),d=null,l=new Cn({upstream:c,paths:u,bridgeConfig:a,sessionSpawner:async(k,q,W,ne)=>{if(!d)throw new Error("agentManager not ready");return d.spawnSessionDownstream(k,q,W,ne)}});await Iu(u,l);let p=new Sn({paths:u,config:a,registry:l});d=p;let _,v,w=null,C=null;l.registerExtension("_agent/create",async k=>p.createAgent(k.params)),l.registerExtension("_agent/health",async()=>({ok:!0}));let P={},T=new un({agents:l.agents,disposeAndMarkDisconnected:async(k,q)=>{let W=l.agents.get(k);W&&(await p.cleanupOpenclawSessionProviders(W).catch(ne=>O.warn("cleanup openclaw providers failed (ignored)",{agentId:k,err:String(ne)})),await W.dispose(`disconnect: ${q}`).catch(ne=>O.warn("dispose during disconnect failed (ignored)",{agentId:k,err:String(ne)})),W.status="disconnected",l.unregister(k)),l.disconnectedAgents.add(k)},detailSyncer:async k=>{if(!P.ref)throw new Error("agent-detail-sync not initialized yet");await P.ref.syncOne(k)},openclawRepair:async(k,q)=>{await p.openclawRepair(k,q)}});l.registerExtension("_agent/listSkills",k=>T.listSkills(k.params)),l.registerExtension("_agent/addSkills",k=>T.addSkills(k.params)),l.registerExtension("_agent/removeSkills",k=>T.removeSkills(k.params)),l.registerExtension("_agent/getFileTree",k=>T.getFileTree(k.params)),l.registerExtension("_agent/getFileContent",k=>T.getFileContent(k.params)),l.registerExtension("_agent/update",k=>T.updateAgent(k.params)),l.registerExtension("_agent/disconnect",k=>T.disconnectAgent(k.params)),l.registerExtension("_agent/switchModel",k=>T.switchModel(k.params)),l.registerExtension("_agent/reset",k=>T.resetAgent(k.params)),l.registerExtension("_agent/repair",k=>T.repairAgent(k.params));let N=new sn({paths:u,handlers:T,sendDetail:k=>l.sendRequest("_agent/detail",k)});P.ref=N,c.onConnect(({initial:k})=>{O.info("frontier upstream connected, triggering detail sync",{initial:k}),N.syncAll(k?"initial-connect":"reconnect").catch(q=>O.warn("detail sync top-level error (ignored)",{err:String(q)}))});let z=new An({paths:u,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...l.agents.keys()],deviceId:w??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async k=>{let q=k,W=q?.privatecode,ne=q?.pairing_code;if(!W||!ne)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let De=xn(q.env),me=q.handshake_url,Xe=q.frontier_url,Ct=Tu(q.env,me,Xe),Vt=!!_&&_!==W,ve=v!==void 0&&v!==Ct,Se=Vt||ve;if(Se){O.warn("pair config switched, resetting agents",{pcChanged:Vt,envChanged:ve,previousPc:_?Go(_):"",nextPc:Go(W),previousEnvKey:v??"",nextEnvKey:Ct});for(let U of[...l.agents.values()])await U.dispose("pair config switch").catch(()=>{}),l.agents.delete(U.agentId);await c.swap(new Jt,"pair switch").catch(()=>{})}let Xt=await Gs({privatecode:W,...me?{endpoint:me}:{},ppeOverride:De});w=Xt.deviceId,mr({deviceId:w,pid:process.pid});let xe=new Vn({handshake:Xt,privatecode:W,...Xe?{urlOverride:Xe}:{},ppeOverride:De});await c.swap(xe,"pair");let Yt=Object.keys(a.frameworksCache??{});try{let U=await l.sendRequest("_agent/pair",{pairCode:ne,patToken:W,frameworks:Yt,_meta:{cozeDeviceId:w}});O.info("_agent/pair ok",{pairResult:U}),_=W,v=Ct,C||(C=new dn({core:l,getDeviceId:()=>w??""})),C.start(),Se&&jo(u,p).catch(Te=>O.warn("post-pair-switch auto-revive error (ignored)",{err:String(Te)}));let J;return q.agent_id&&(J=await Lu(q.agent_id,u,p,Te=>l.sendRequest("_agent/detail",Te)).catch(Te=>(O.error("--agent-id ensureAgent failed",{agentId:q.agent_id,err:String(Te)}),{ok:!1,agentId:q.agent_id??"",note:String(Te)}))),{ok:!0,note:"paired with cloud",...J?{agent:J}:{}}}catch(U){return O.error("_agent/pair failed",{err:String(U)}),{ok:!1,note:`pair failed: ${String(U)}`}}}},{method:"POST",path:"/_agent/create",handler:async k=>{let q=k;return{ok:!0,result:await p.createAgent(q)}}},{method:"POST",path:"/refresh",handler:async()=>{O.info("IPC /refresh: re-detecting frameworks");let k=new Ot;return a.frameworksCache=await k.detectAll(),await Bt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(O.info("IPC /shutdown received"),setImmediate(()=>{ue.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:ae,token:te}=await z.start();await l.start(),jo(u,p).catch(k=>O.warn("auto-revive top-level error (ignored)",{err:String(k)}));let be=null,ue={port:ae,token:te,core:l,ipc:z,shutdown(k){return be||(O.info("daemon shutdown",{reason:k}),be=(async()=>{C?.stop(),await l.stop(k),await z.stop(),await r.release()})(),be)}};for(let k of["SIGTERM","SIGINT"])process.on(k,()=>{ue.shutdown(k).then(()=>process.exit(0))});return O.info("daemon ready",{port:ae,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),ue}function Go(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function Tu(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function Iu(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:c,enforceAgentConfigMode:u}=await Promise.resolve().then(()=>(Ge(),rn));for(let d of a){await u(d,r).catch(l=>O.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(l)}));try{let l=await c(d,r);l?.disconnectedAt&&(e.disconnectedAgents.add(d),O.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:l.disconnectedAt,reason:l.disconnectReason??""}))}catch(l){O.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(l)})}}}async function Lu(r,e,i,a){let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Ge(),rn)),u=await c(r,e);if(u){O.info("--agent-id: local config found, reconnecting",{agentId:r,framework:u.framework,hadDisconnect:!!u.disconnectedAt});let _={agentId:u.agentId,framework:u.framework,...u.cozeIdentity?{cozeIdentity:u.cozeIdentity}:{},...u.model?{model:u.model}:{}};return await i.createAgent(_),{ok:!0,agentId:r,note:u.disconnectedAt?"revived from local config":"connected from local config"}}O.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let d=await a({_meta:{cozeAgentId:r}});if(!d.framework)throw new E("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 l={agentId:d.agentId,framework:d.framework,...d.cozeIdentity?{cozeIdentity:d.cozeIdentity}:{},...d.model?{model:d.model}:{},...d.deployType?{_meta:{cozeDeployType:d.deployType}}:{}};await i.createAgent(l);let p=d.deployType==="cloud"&&d.framework==="openclaw";return{ok:!0,agentId:r,note:p?"cloud agent acknowledged":"created from cloud detail"}}async function jo(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:c}=await Promise.resolve().then(()=>(Ge(),rn));O.info("auto-revive: scanning local agents on startup",{count:a.length});let u=0,d=0;for(let l of a){let p;try{p=await c(l,r)}catch(_){O.warn("auto-revive: load config failed (skipping)",{agentId:l,err:String(_)}),d+=1;continue}if(!p){d+=1;continue}if(p.disconnectedAt){O.info("auto-revive: skip disconnected agent",{agentId:l,disconnectedAt:p.disconnectedAt}),d+=1;continue}try{O.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:l,framework:p.framework}),await e.createAgent({agentId:p.agentId,framework:p.framework,...p.cozeIdentity?{cozeIdentity:p.cozeIdentity}:{},...p.model?{model:p.model}:{},...p.deployType?{_meta:{cozeDeployType:p.deployType}}:{}}),u+=1}catch(_){O.warn("auto-revive: createAgent failed (skipping)",{agentId:l,framework:p.framework,err:String(_)}),d+=1}}return O.info("auto-revive: done",{revived:u,skipped:d,total:a.length}),{revived:u,skipped:d,total:a.length}}$r();fe();import{readFile as Vo}from"node:fs/promises";var Ve=class{paths;constructor(e){this.paths=e??K()}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:Uu(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([Vo(this.paths.portFile,"utf8"),Vo(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),c=i.trim();return!Number.isFinite(a)||a<=0||!c?null:{port:a,token:c}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let a=i.body!==void 0,c={Authorization:`Bearer ${e.token}`};a&&(c["content-type"]="application/json");let u=new AbortController,d=setTimeout(()=>u.abort(),i.timeoutMs??5e3);try{let l=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:c,body:a?JSON.stringify(i.body):void 0,signal:u.signal}),p=await l.text();return{status:l.status,body:Fu(p)}}finally{clearTimeout(d)}}};function Fu(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function Uu(r){return r instanceof Error?r.message:String(r)}H();fe();import{copyFile as Xo,mkdir as Hu,readFile as Zr,writeFile as Ku}from"node:fs/promises";import{dirname as Gu,resolve as Qr,sep as $n}from"node:path";import{fileURLToPath as ju}from"node:url";H();fe();var Yo=R("dist-install");function Wu(r){let e=ju(r),i=Gu(e),a=`${$n}src${$n}`;if(i.includes(a)||i.endsWith(`${$n}src${$n}cli`))return null;let c=Qr(i,"index.js"),u=Qr(i,"..","package.json");return{dist:c,pkgJson:u}}async function $o(r={}){let e=r.paths??K(),i=Wu(import.meta.url),a=r.sourceDist??i?.dist,c=r.sourcePackageJson??i?.pkgJson;if(!a||!c)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let u;try{u=JSON.parse(await Zr(c,"utf8")).version??"unknown"}catch(w){return Yo.warn("cannot read source package.json,skip dist install",{err:String(w)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(w)}`}}let d=await En(e.configFile)??{},l=d.libVersion;if(l===u)try{return await Zr(e.libEntry),{kind:"already-current",libVersion:u}}catch{}await Hu(e.libDir,{recursive:!0}),await Xo(a,e.libEntry),await Xo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let p=Qr(e.libDir,"package.json"),_=`${JSON.stringify({type:"module"},null,2)}
|
|
93
|
-
`;return await
|
|
88
|
+
${x}`}var ke=B("agent-detail-sync"),cn=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await _a(i)}catch(x){ke.info("agents dir not found, skip detail sync",{root:i,err:String(x)});return}ke.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){ke.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}ke.info("detail sync done",{reason:e})}async syncOne(e){let i=await le(e,this.opts.paths);if(!i){ke.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(l){ke.warn("detail RPC failed, using local data",{agentId:e,err:String(l)});return}if(a.agentId&&a.agentId!==e){ke.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&&ke.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){ke.debug("detail sync: no diff",{agentId:e});return}await be(i,this.opts.paths),ke.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:i.agentName}),f&&(await dt(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};We();import{spawn as ti}from"node:child_process";import{lstat as Er,mkdir as va,readFile as ni,readdir as Sa,rm as Ea,stat as Ca,writeFile as Aa}from"node:fs/promises";import{join as Me,normalize as ka,relative as ri,resolve as Da,sep as si}from"node:path";var De={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",RESET:"_agent/reset",REPAIR:"_agent/repair",DELETE:"_agent/delete"};function Nt(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Ms(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function lt(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)}};J();de();function ze(r,e){if(Nt(r)!=="cloud")throw new C("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function Lt(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}J();var fn="1008033",qs="1289";var Ks="pbbp2",Us="https://www.coze.cn",Fs="/api/coze_claw/resource/get_frontier_key",wa="https://www.coze.cn",ya="wss://frontier.coze.cn";function Hs(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??wa}function js(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??ya}function un(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}function dn(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Gs=B("handshake");async function Ws(r){let e=Hs(r.endpoint),i=r.timeoutMs??1e4,a=`${ba(e)}${Fs}?aid=${encodeURIComponent(fn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...un(r.ppeOverride)},f=new AbortController,l=setTimeout(()=>f.abort(),i);Gs.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:x,signal:f.signal}),m=h.headers.get("x-tt-logid")??"",y=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let R=await h.text().catch(()=>"");throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${R.slice(0,200)}`)}let S=await h.json();if(S.code!==void 0&&S.code!==0)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${S.code} msg=${S.msg??"-"} logid=${m}`);let b=S.data?.access_key,D=S.data?.device_id;if(!b||!D)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(S)}`);return Gs.info("handshake ok",{remoteDeviceId:D,logid:m,traceId:y}),{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(l)}}function ba(r){return r.endsWith("/")?r.slice(0,-1):r}var br="https://llm-gateway.coze.cn",ht="auto";function Js(r){return{model:r.model??ht,...r.modelToken?{modelToken:r.modelToken}:{}}}function Bt(r){return!r||r===ht}function Vs(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=br,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),Bt(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Xs(r){let e=[];return Bt(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_providers.coze.name="coze"'),e.push("-c",`model_providers.coze.base_url="${br}/v1"`),e.push("-c",'model_providers.coze.env_key="OPENAI_API_KEY"'),e.push("-c",'model_providers.coze.wire_api="responses"'),e.push("-c","model_providers.coze.requires_openai_auth=false"),e.push("-c","model_providers.coze.supports_websockets=false"),e.push("-c",'model_provider="coze"')),e}function Ys(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}function vr(r){let{ttEnv:e,usePpe:i}=dn(r),a={};return e&&(a["x-tt-env"]=e),i&&(a["x-use-ppe"]=i),a}function $s(r,e){if(!r.modelToken)return{};let i=vr(e);return Object.keys(i).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(i).map(([x,f])=>`${x}:${f}`).join(`
|
|
89
|
+
`)}}function Sr(r){return`coze-session-${r.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function Zs(r,e){if(!r.modelToken||Bt(r.model))return null;let i=vr(e),a={baseUrl:`${br}/v1`,api:"openai-completions",apiKey:r.modelToken,models:[{id:r.model,name:r.model,reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192,api:"openai-completions"}]};return Object.keys(i).length>0&&(a.headers=i),a}function Qs(r,e){if(!r.modelToken)return[];let i=vr(e),a=[];for(let[x,f]of Object.entries(i))a.push("-c",`model_providers.coze.http_headers.${x}="${f}"`);return a}var oe=B("agent-handlers"),ei=5*1024*1024,Pa=1,Ta=6,Ia=new Set(["node_modules",".git",".coze","dist","build",".next"]),hn=class{constructor(e){this.opts=e}opts;async listSkills(e){ze(e._meta,"_agent/listSkills");let i=lt(e._meta),a=await this.loadAgentCfg(i),x=a?.workspace??Oe(i).workspace,f=a?.skills??[],l=[];for(let h of f){let m=Me(x,h.relPath,"SKILL.md");await Ca(m).then(S=>S.isFile()).catch(()=>!1)&&l.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:l}}async addSkills(e){ze(e._meta,"_agent/addSkills");let i=lt(e._meta),a=await this.requireAgentCfg(i),x=e.skills??[],f=[...a.skills??[]],l=new Map(f.map((m,y)=>[m.skillId,y])),h=[];for(let m of x){if(!m.skillName)throw new C("IPC_BAD_REQUEST","skill missing skillName");let y=Ra(m.skillName),S=Na(a.framework),b=Me(S,y),D=Me(a.workspace,b);await va(D,{recursive:!0});let R=await Oa(m.downloadUrl);Ma(R)?await qa(R,D):await Aa(Me(D,"SKILL.md"),R.toString("utf8"),"utf8");let N={skillId:m.skillId,skillName:m.skillName,relPath:b,installedAt:Date.now(),...m.description?{description:m.description}:{},...m.version?{version:m.version}:{},...m.downloadUrl?{downloadUrl:m.downloadUrl}:{}},L=l.get(m.skillId);L!==void 0?f[L]=N:(l.set(m.skillId,f.length),f.push(N)),h.push(m),oe.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:b})}return await an(i,f),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){ze(e._meta,"_agent/removeSkills");let i=lt(e._meta),a=await this.requireAgentCfg(i),x=new Set(e.skillIds??[]),f=a.skills??[],l=[];for(let h of f){if(!x.has(h.skillId)){l.push(h);continue}let m=Me(a.workspace,h.relPath);await Ea(m,{recursive:!0,force:!0}),oe.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await an(i,l),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)if(!(!f.downstream||!f.acpSessionId)){f.loadingSession=!0;try{await f.downstream.sessionLoad({sessionId:f.acpSessionId,cwd:a.workspace}),oe.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId})}catch(l){oe.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId,err:String(l)})}finally{f.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return oe.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await le(i);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(oe.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await be(a),await dt(a.workspace,a.framework,i,e.cozeIdentity),oe.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 le(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await be(a),oe.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}):(oe.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(ze(e._meta,"_agent/switchModel"),!e.agentId)throw new C("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:ht,a=await le(e.agentId);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await be(a),oe.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let x=this.opts.agents.get(e.agentId);if(!x)return oe.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};x.model=i;let f=[];for(let[l,h]of x.allSessionQueues())f.push(h.enqueue(async()=>{let m=x.sessions.get(l);m?.downstream&&(await m.downstream.stop(`switchModel: ${i}`).catch(()=>{}),m.downstream=void 0)}));return await Promise.all(f),oe.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i,cloudSessions:f.length}),{ok:!0}}async resetAgent(e){if(ze(e._meta,De.RESET),!e.agentId)throw new C("IPC_BAD_REQUEST",`${De.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,De.RESET,e.reason),{ok:!0}}async repairAgent(e){if(ze(e._meta,De.REPAIR),!e.agentId)throw new C("IPC_BAD_REQUEST",`${De.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new C("IPC_BAD_REQUEST",`${De.REPAIR} only allowed for openclaw, got ${i.framework}`);if(i&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,i.workspace)}catch(a){oe.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(a)})}return await this.runDetailSync(e.agentId,De.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,a){if(!this.opts.detailSyncer){oe.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(x){oe.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:a,err:String(x)})}}async getFileTree(e){ze(e._meta,"_agent/getFileTree");let i=e._meta,a=lt(i),x=await this.resolveWorkspace(a),f=e.filePath??"",l=this.safeJoin(x,f),h=await Er(l).catch(()=>null);if(!h)throw new C("IPC_BAD_REQUEST",`path not found: ${f}`);if(h.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${f}`);let m=Ua(e.depth);return h.isDirectory()?{tree:await ii(x,l,f,m)}:{tree:[{name:Fa(f),path:oi(f||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){ze(e._meta,"_agent/getFileContent");let i=lt(e._meta),a=await this.resolveWorkspace(i);if(!e.filePath)throw new C("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await Er(x).catch(()=>null);if(!f||!f.isFile())throw new C("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(f.size>ei)throw new C("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${ei})`);let l=await ni(x);return l.includes(0)?{content:l.toString("base64"),encoding:"base64",size:f.size}:{content:l.toString("utf8"),encoding:"utf-8",size:f.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await le(e).catch(()=>null))?.workspace??Oe(e).workspace}safeJoin(e,i){let a=Da(e,i||"."),x=ri(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${si}`))throw new C("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return le(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 Ra(r){let e=Lt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new C("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function Na(r){return r==="claude-code"?Me(".claude","skills"):Me(".agents","skills")}var La=3e4,Ba=50*1024*1024,gn=3e4;async function Oa(r){if(!r)throw new C("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);ln(e);let i=za(r);return ln(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await ni(e);return ln(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),La);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();return ln(x.byteLength),Buffer.from(x)}finally{clearTimeout(i)}}throw new C("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function ln(r){if(r>Ba)throw new C("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function za(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 qa(r,e){await Ka(r),await new Promise((i,a)=>{let x=ti("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",h=>{f+=String(h)});let l=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar extract timeout (${gn}ms)`))},gn);x.on("error",h=>{clearTimeout(l),a(new C("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(l),h===0?i():a(new C("IPC_BAD_REQUEST",`tar exit ${h}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Ka(r){let e=await new Promise((i,a)=>{let x=ti("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),f="",l="";x.stdout?.on("data",m=>{f+=String(m)}),x.stderr?.on("data",m=>{l+=String(m)});let h=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar list timeout (${gn}ms)`))},gn);x.on("error",m=>{clearTimeout(h),a(new C("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),x.on("exit",m=>{clearTimeout(h),m===0?i(f):a(new C("IPC_BAD_REQUEST",`tar list exit ${m}${l?`: ${l.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)});for(let i of e.split(`
|
|
90
|
+
`)){let a=i.trim();if(!a)continue;let x=a.charCodeAt(0);if(x!==45&&x!==100)throw new C("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let l=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!l)continue;if(l.startsWith("/"))throw new C("IPC_BAD_REQUEST",`tar entry absolute path: ${l}`);if(l.split(/[/\\]/).some(m=>m===".."))throw new C("IPC_BAD_REQUEST",`tar entry contains '..': ${l}`)}}async function ii(r,e,i,a){if(a<=0)return[];let x;try{x=await Sa(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let l of x){if(Ia.has(l.name)||l.isSymbolicLink())continue;let h=Me(e,l.name),m=ka(Me(i,l.name)),y=null;try{y=await Er(h)}catch{continue}if(y.isSymbolicLink())continue;let S={name:l.name,path:oi(ri(r,h)),isDir:y.isDirectory(),size:y.size,modifiedAt:Math.floor(y.mtimeMs)};y.isDirectory()&&a>1&&(S.children=await ii(r,h,m,a-1)),f.push(S)}return f.sort((l,h)=>l.isDir!==h.isDir?l.isDir?-1:1:l.name.localeCompare(h.name)),f}function Ua(r){return!r||r<=0?Pa:Math.min(r,Ta)}function Fa(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function oi(r){return r.split(si).join("/")}J();var Ot=B("agent-health-reporter"),Ha=1e4,pn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??Ha}opts;timer=null;inFlight=!1;unsubscribeRegister=null;intervalMs;start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs),this.timer.unref?.(),this.unsubscribeRegister=this.opts.core.onAgentRegister(()=>{this.tick()}),Ot.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Ot.info("heartbeat stopped"))}async tick(){if(this.inFlight){Ot.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Ot.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let i=[];for(let x of this.opts.core.agents.values()){let f=ja(x);f&&i.push({agentId:x.agentId,status:f})}if(i.length===0)return;let a={agents:i,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(x){Ot.warn("heartbeat batch send failed",{count:i.length,err:String(x)})}}finally{this.inFlight=!1}}};function ja(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}We();import{mkdir as Cr,rm as xx}from"node:fs/promises";import{spawn as Xa}from"node:child_process";function zt(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function mn(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function gt(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Qe(r,e){return{jsonrpc:"2.0",id:r,error:e}}var _n=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)}},X={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_TOKEN_GEN_FAILED:-32009};function ai(r){return"method"in r&&"id"in r&&r.id!==void 0}function xi(r){return"method"in r&&!("id"in r)}function wn(r){return!("method"in r)&&"id"in r}var Ga={AGENT_NOT_FOUND:X.AGENT_NOT_FOUND,AGENT_BUSY:X.AGENT_BUSY,AGENT_DISCONNECTED:X.AGENT_DISCONNECTED,AGENT_TIMEOUT:X.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:X.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:X.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:X.INTERNAL_ERROR,BRIDGE_INTERNAL:X.INTERNAL_ERROR,IPC_AUTH_FAILED:X.INTERNAL_ERROR,IPC_BAD_REQUEST:X.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:X.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:X.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:X.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:X.INTERNAL_ERROR};function yn(r){return r instanceof C?{code:Ga[r.code]??X.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:X.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function ci(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 fi(r){return`${JSON.stringify(r)}
|
|
91
|
+
`}var bn=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(`
|
|
92
|
+
`);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(l){this.onError?.({line:f,error:l})}}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 di={"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","_agent/genModelToken":"agent.genModelToken","_agent/reset":"agent.reset","_agent/repair":"agent.repair","session/request_permission":"session.requestPermission",initialize:"initialize"},Cd=Object.fromEntries(Object.entries(di).map(([r,e])=>[e,r])),Wa={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":[],"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.genModelToken":["agentId","sessionId"],"agent.reset":["agentId"],"agent.repair":["agentId"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},pt=class{seq=0;next(e,i){this.seq+=1;let a=di[e]??Ja(e),x=Wa[a]??[],f=[a,String(this.seq)];if(x.length>0){let l=x.map(m=>ui(i?.[m]??"")),h=Va(l).join(":");h&&f.push(h)}else i&&Object.values(i).some(l=>l)&&f.push(Object.values(i).filter(Boolean).map(l=>ui(String(l))).join(":"));return f.join("_")}reset(){this.seq=0}};function Ja(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function ui(r){return r.replace(/[:_\s]+/g,"-")}function Va(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}J();var Ya=3e4;function li(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Je=class{constructor(e){this.opts=e;this.log=B(`downstream.${this.constructor.name}`),this.decoder=new bn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new pt;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=Xa(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()));li(i.pid,"SIGTERM");let x=setTimeout(()=>{i.killed||li(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){!this.child||this.stopped||this.writeFrame(mn("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(gt(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(Qe(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=Ya){if(!this.child||this.stopped)return Promise.reject(new C("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=zt(x,e,i),l=a>0&&Number.isFinite(a);return new Promise((h,m)=>{let y=l?setTimeout(()=>{this.pending.delete(x),m(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:h,reject:m,timer:y,method:e});try{this.writeFrame(f)}catch(S){y&&clearTimeout(y),this.pending.delete(x),m(S)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new C("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(fi(e))}dispatch(e){if(wn(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(ci(e.error)):i.resolve(e.result);return}if(xi(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(ai(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(Qe(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(Qe(e.id,yn(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var $a="@agentclientprotocol/claude-agent-acp@latest";function Za(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 vn=class extends Je{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",$a],x={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return Za(e)}};import{mkdtempSync as Qa,rmSync as ex}from"node:fs";import{tmpdir as tx}from"node:os";import{join as nx}from"node:path";var rx="@zed-industries/codex-acp@latest",Sn=class extends Je{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=e.command??"npx",a=e.args??["-y",rx],x=e.extraArgs?[...a,...e.extraArgs]:a,f=e.isolateCodexHome?Qa(nx(tx(),"coze-bridge-codex-home-")):void 0,l=f?{...e.env??{},CODEX_HOME:f}:e.env,h={command:i,args:x,cwd:e.cwd,...l?{env:l}:{}};super(h),this.authMethodId=e.authMethodId,this.codexHomeDir=f}async initialize(e){let i=await super.initialize(e);return this.authMethodId&&await this.call("authenticate",{methodId:this.authMethodId}),i}async stop(e){if(await super.stop(e),this.codexHomeDir)try{ex(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Mt=class extends Je{framework="openclaw";agentId;sessionName;slashModelOnStart;constructor(e){let i=e.sessionName??"default",a=["acp","--session",`agent:${e.agentId}:${i}`];e.gatewayToken&&a.push("--token",e.gatewayToken);let x={command:e.command,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x),this.agentId=e.agentId,this.sessionName=i,this.slashModelOnStart=e.slashModelOnStart}async afterSessionEstablished(e){this.slashModelOnStart&&(this.log.info("switching session to per-session provider via /model",{agentId:this.agentId,sessionName:this.sessionName,slash:this.slashModelOnStart}),await this.sessionPrompt({sessionId:e,prompt:[{type:"text",text:`/model ${this.slashModelOnStart}`}]}))}get acpSessionName(){return this.sessionName}};J();de();var mt=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 En=class{agentId;framework;workspace;deployType;sessions=new Map;sessionQueues=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local"}getSessionQueue(e){let i=this.sessionQueues.get(e);return i||(i=new mt,this.sessionQueues.set(e,i)),i}allSessionQueues(){return this.sessionQueues.entries()}async dispose(e){this.status="stopped";let i=new Error(`AgentSession disposed${e?`: ${e}`:""}`);for(let a of this.sessionQueues.values())a.dispose(i);this.sessionQueues.clear(),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,a]of this.sessions)qt(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function qt(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}import{spawn as sx}from"node:child_process";import{homedir as ix}from"node:os";import{join as ox}from"node:path";nn();J();async function pi(){let r=ox(ix(),".openclaw/openclaw.json");return(await ut(r))?.gateway?.auth?.token??""}var hi=B("openclaw.config"),ax=[0,5e3,5e3],gi="models.providers.",Cn="agents.defaults.models",An=class{command;env;retryDelaysMs;queue=new mt;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??ax}async withRetry(e,i){let a;for(let x=0;x<this.retryDelaysMs.length;x++){let f=this.retryDelaysMs[x]??0;f>0&&await new Promise(l=>setTimeout(l,f));try{return await i()}catch(l){a=l,hi.warn("openclaw cli failed, will retry",{label:e,attempt:x+1,err:String(l)})}}throw new C("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${a?.message??"unknown"}`)}runCli(e){return new Promise((i,a)=>{let x=sx(this.command,e,{stdio:["ignore","pipe","pipe"],env:this.env}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`exit ${l}: ${f.trim().slice(0,500)}`))})})}async runCliTolerant(e,i){try{await this.runCli(e)}catch(a){let x=String(a);if(i.some(f=>x.includes(f)))return;throw a}}async bestEffortUnset(e,i){try{await this.queue.enqueue(()=>this.withRetry(e,()=>this.runCli(["config","unset",i])))}catch(a){hi.warn(`${e} failed (best-effort)`,{configPath:i,err:String(a)})}}ensureProvider(e,i){return this.queue.enqueue(()=>this.withRetry(`config set models.providers.${e}`,()=>this.runCli(["config","set",`${gi}${e}`,JSON.stringify(i),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${gi}${e}`)}addModelToAllowlist(e,i){let a={[e]:i?{alias:i}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${Cn}[${e}]`,()=>this.runCli(["config","set",Cn,JSON.stringify(a),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${Cn}[${e}]`,`${Cn}.${e}`)}ensureAgent(e,i,a){let x=["agents","add",e,"--workspace",i,"--non-interactive"];return a&&x.push("--model",a),this.queue.enqueue(()=>this.withRetry(`agents add ${e}`,()=>this.runCliTolerant(x,["already exists","already registered"])))}deleteAgent(e){return this.queue.enqueue(()=>this.withRetry(`agents delete ${e}`,()=>this.runCliTolerant(["agents","delete",e,"--force"],["not found","does not exist"])))}};var et=B("agent-manager"),cx=(r,e,i,a,x,f,l)=>{switch(r){case"claude-code":{let h=x?{...Vs(x),...$s(x,l)}:void 0;return new vn({cwd:i,...h&&Object.keys(h).length>0?{env:h}:{}})}case"codex":{let h=x?[...Xs(x),...Qs(x,l)]:[],m=x?Ys(x):void 0,y=!!x;return new Sn({cwd:i,...h.length>0?{extraArgs:h}:{},...m&&Object.keys(m).length>0?{env:m}:{},...y?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new Mt({command:e,cwd:i,agentId:a,...f?{sessionName:Lt(f)}:{}})}};function mi(r){return r==="claude-code"||r==="codex"}var fx={path:"",version:"cloud-deployed"},ux={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},dx=2e4,kn=class{paths;config;registry;factory;createTimeoutMs;openclawConfigCache;ensuredProviders=new Set;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??cx,this.createTimeoutMs=e.createTimeoutMs??dx}getOpenclawConfig(){if(!this.openclawConfigCache){let e=this.config.frameworksCache?.openclaw;if(!e?.path)throw new C("AGENT_SPAWN_FAILED","openclaw binary not detected on this machine");this.openclawConfigCache=new An({command:e.path})}return this.openclawConfigCache}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");let i=Nt(e._meta)==="cloud";this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new C("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")et.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(D=>et.warn("dispose stale agent failed (ignored)",{err:String(D)})),this.registry.unregister(e.agentId);else return et.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!(i&&mi(e.framework))&&!this.config.frameworksCache?.[e.framework])throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let f=Oe(e.agentId,this.paths),l=e.workspace??f.workspace,h=Nt(e._meta),m=new AbortController,y=setTimeout(()=>m.abort(new C("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),S,b=!1;try{let D=()=>{if(m.signal.aborted)throw m.signal.reason instanceof Error?m.signal.reason:new C("AGENT_TIMEOUT","_agent/create aborted")};await Cr(f.root,{recursive:!0}),await Cr(l,{recursive:!0}),await Cr(f.logs,{recursive:!0}),D(),await dt(l,e.framework,e.agentId,e.cozeIdentity),D();let R=await le(e.agentId,this.paths).catch(()=>null),N=Js({model:e.model??R?.model});if(S=new En({agentId:e.agentId,framework:e.framework,workspace:l,model:N.model??ht,deployType:h}),S.status="ok",R?.sessions){for(let[xe,re]of Object.entries(R.sessions))S.sessions.set(xe,{acpSessionId:re.acpSessionId,modelToken:re.modelToken,tokenGeneratedAt:re.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let F=Object.keys(R.sessions).length;F>0&&et.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:F})}this.registry.register(S),b=!0;let L={agentId:e.agentId,framework:e.framework,workspace:l,cozeIdentity:e.cozeIdentity,createdAt:R?.createdAt??Date.now(),sessions:R?.sessions??{},model:N.model};return h==="cloud"&&(L.deployType="cloud"),R?.skills&&(L.skills=R.skills),R?.agentName&&(L.agentName=R.agentName),R?.description&&(L.description=R.description),await be(L,this.paths),e.framework==="openclaw"&&await this.getOpenclawConfig().ensureAgent(e.agentId,l),et.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:h}),{ok:!0,agentId:e.agentId,workspace:l,framework:e.framework}}catch(D){throw et.error("agent create failed, rolling back",{agentId:e.agentId,err:String(D)}),b&&S&&(await S.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await xx(f.root,{recursive:!0,force:!0}).catch(R=>et.warn("rm agent dir failed (ignored)",{err:String(R)})),D instanceof C?D:new C("AGENT_SPAWN_FAILED",String(D),{cause:D})}finally{clearTimeout(y)}}async spawnSessionDownstream(e,i,a,x){let l=this.config.frameworksCache?.[e.framework];if(!l)if(e.deployType==="cloud"&&mi(e.framework))l=fx;else throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let h=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,m;e.framework==="openclaw"?m=await this.buildOpenclawDownstream({session:e,modelConfig:h,cloudSessionId:a,cozeEnv:x,command:l.path}):m=this.factory(e.framework,l.path,e.workspace,e.agentId,h,a,x);try{return await m.start(),await m.initialize(ux),m}catch(y){throw await m.stop("spawnSessionDownstream failed").catch(()=>{}),y instanceof C?y:new C("AGENT_SPAWN_FAILED",y instanceof Error?y.message:String(y),{cause:y})}}async buildOpenclawDownstream(e){let{session:i,modelConfig:a,cloudSessionId:x,cozeEnv:f,command:l}=e,h=Lt(x),m=await pi(),y=a?.modelToken&&!Bt(a.model)?Zs(a,f):null,S;if(y){let b=Sr(x),D=`${b}/${a.model}`;if(!this.ensuredProviders.has(D)){let R=this.getOpenclawConfig();await R.ensureProvider(b,y),await R.addModelToAllowlist(D),this.ensuredProviders.add(D)}S=D}return new Mt({command:l,cwd:i.workspace,agentId:i.agentId,sessionName:h,...m?{gatewayToken:m}:{},...S?{slashModelOnStart:S}:{}})}async openclawRepair(e,i){let a=this.getOpenclawConfig();await a.deleteAgent(e),await a.ensureAgent(e,i)}async cleanupOpenclawSessionProviders(e){if(e.framework!=="openclaw"||!this.openclawConfigCache)return;let i=this.openclawConfigCache;for(let a of e.sessions.keys()){let x=Sr(a),f=`${x}/${e.model}`;this.ensuredProviders.delete(f),await i.removeProvider(x),await i.removeModelFromAllowlist(f)}}};J();import{spawn as lx}from"node:child_process";import{constants as _i,access as hx}from"node:fs/promises";import{delimiter as gx,join as px}from"node:path";var mx=B("framework-detector"),wi={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},_x=[".exe",".cmd",".bat",".ps1"],Kt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??lx,access:e.access??hx}}async detect(e){let i=wi[e],a=await this.which(i);if(!a)return mx.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(wi).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(gx).filter(Boolean),a=this.env.platform==="win32"?["",..._x]:[""];for(let x of i)for(let f of a){let l=px(x,e+f);if(await this.isExecutable(l))return l}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?_i.F_OK:_i.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,l=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"),l("unknown")},5e3),h.stdout?.on("data",m=>{a+=m.toString("utf8")}),h.on("error",()=>l("unknown")),h.on("close",()=>{let m=bx(a).split(/\r?\n/)[0]??"";l(m)})}catch{l("unknown")}})}},yx=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function bx(r){return r.replace(yx,"")}nn();de();var vx=10*6e4;function yi(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?vx:e}function Dn(r){return ut(r??V().configFile)}function Ut(r,e){return tn(e??V().configFile,r)}import{randomBytes as Sx}from"node:crypto";We();J();var j=B("core"),Ex=3e4,Cx=3e4,Pn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new pt;pendingUpstream=new Map;pendingBridge=new Map;currentCozeEnv;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=yi(e.bridgeConfig)}registerExtension(e,i){this.extensions[e]=i}getCozeEnv(){return this.currentCozeEnv}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),j.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){j.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),j.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){j.warn("onAgentRegister handler threw (ignored)",{agentId:e.agentId,err:String(a)})}}onAgentRegister(e){return this.registerHandlers.add(e),()=>this.registerHandlers.delete(e)}registerHandlers=new Set;unregister(e){this.agents.delete(e)}reviveIfDisconnected(e){this.disconnectedAgents.delete(e)&&j.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,a){let x=a.downstream;x&&(x.onUpdate(f=>{a.loadingSession||this.forwardUpdate(e,f)}),x.onAgentRequest(f=>{this.handleAgentRequest(e,x,f)}),x.onExit((f,l)=>{j.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:f,signal:l}),qt(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(wn(e)){this.handleUpstreamResponse(e);return}if(!("method"in e)||typeof e.method!="string")return;let i="id"in e&&e.id!==void 0?e.id:null,a=e.params?._meta?.cozeEnv;a&&(this.currentCozeEnv=a);try{if(e.method.startsWith("_agent/")){let x=this.extensions[e.method];if(!x){i!==null?await this.sendError(i,X.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):j.warn("drop notification: extension not registered",{method:e.method});return}let f=await x(e,this);i!==null&&await this.upstream.send(gt(i,f));return}if(e.method.startsWith("session/")){let x=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(gt(i,x));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(gt(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,X.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):j.warn("drop unknown notification",{method:e.method})}catch(x){j.error("handleFrame failed",{method:e.method,err:String(x)}),i!==null&&await this.upstream.send(Qe(i,yn(x)))}}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}`);let f=typeof i.sessionId=="string"?i.sessionId:void 0;if(e.method==="session/cancel"||e.method==="session/new"||!f)return this.dispatchSessionCall(x,e.method,i);let l=Date.now(),h=!1;try{let m=await x.getSessionQueue(f).enqueue(()=>this.dispatchSessionCall(x,e.method,i));return h=!0,m}finally{j.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-l,ok:h})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:x}=Ms(a);switch(i){case"session/new":{let f=Ax();return j.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:f}),{sessionId:f}}case"session/load":{let f=x;return j.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:f.sessionId}),{}}case"session/prompt":{let f=x,l=f.sessionId;if(!l)throw new C("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,l);if(h.replySeq=0,await this.ensureDownstream(e,l,h),!h.downstream||!h.acpSessionId)throw new C("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let m=a._meta?.cozeTriggerMsgId;m?e.activeTriggers.set(h.acpSessionId,m):e.activeTriggers.delete(h.acpSessionId);try{let y=await h.downstream.sessionPrompt({...f,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),y}finally{e.activeTriggers.delete(h.acpSessionId),h.downstream?.isAlive()&&this.armIdleTimer(e,l,h)}}case"session/cancel":{let l=x.sessionId;if(!l)throw new C("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(l);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.acpSessionId}),{ok:!0}}default:throw new C("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}async ensureRuntime(e,i){let a=e.sessions.get(i);if(a)return a;let f={modelToken:e.deployType==="cloud"?await this.requestSessionToken(e.agentId,i):"",tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1,replySeq:0};return e.sessions.set(i,f),await this.persistSessionMapping(e),f}async requestSessionToken(e,i){let a={sessionId:i,_meta:{cozeAgentId:e}};try{let x=await this.sendRequest(De.GEN_MODEL_TOKEN,a,Cx);if(!x?.modelToken)throw new C("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return x.modelToken}catch(x){throw x instanceof C&&x.code==="MODEL_TOKEN_GEN_FAILED"?x:new C("MODEL_TOKEN_GEN_FAILED",x instanceof Error?x.message:String(x),{cause:x})}}async ensureDownstream(e,i,a){if(qt(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new C("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let x=await this.sessionSpawner(e,a.modelToken,i,this.currentCozeEnv);if(a.downstream=x,this.attachRuntimeHooks(e,i,a),a.acpSessionId){a.loadingSession=!0;try{await x.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),j.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId})}catch(f){j.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId,err:String(f)}),a.acpSessionId=void 0;let l=await x.sessionNew({cwd:e.workspace});a.acpSessionId=l.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let f=await x.sessionNew({cwd:e.workspace});a.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}x.afterSessionEstablished&&a.acpSessionId&&await x.afterSessionEstablished(a.acpSessionId)}armIdleTimer(e,i,a){if(qt(a),this.isRuntimeBusy(e,a)){j.debug("skip idle timer: runtime busy (in-flight turn / pending permission)",{agentId:e.agentId,cloudId:i});return}a.idleTimer=setTimeout(()=>{if(a.idleTimer=void 0,this.isRuntimeBusy(e,a)){j.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:i}),this.armIdleTimer(e,i,a);return}j.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let x=a.downstream;a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),x&&x.stop("idle timeout").catch(f=>j.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(f)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}isRuntimeBusy(e,i){if(i.acpSessionId&&e.activeTriggers.has(i.acpSessionId))return!0;let a=i.downstream;if(!a)return!1;for(let x of this.pendingUpstream.values())if(x.downstream===a)return!0;return!1}forwardUpdate(e,i){let a=i.sessionId,x=this.reverseSessionId(e,a);if(!x){j.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let f=e.sessions.get(x);if(!f){j.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:x});return}let l={cozeAgentId:e.agentId,cozeReplySeqID:++f.replySeq},h=e.activeTriggers.get(a);h&&(l.cozeTriggerMsgId=h),this.upstream.send(mn("session/update",{...i,sessionId:x,_meta:l})).catch(m=>j.warn("forward update failed",{agentId:e.agentId,err:String(m)}))}handleAgentRequest(e,i,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,i,a);return}j.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),i.respondAgentRequestError(a.id,{code:X.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}forwardPermissionRequest(e,i,a){let x=this.upstreamIds.next("session/request_permission"),f=a.params??{},h=f.sessionId,m=h?e.activeTriggers.get(h):void 0,y={cozeAgentId:e.agentId};m&&(y.cozeTriggerMsgId=m);let S=h?this.reverseSessionId(e,h):void 0,b={...f,...S?{sessionId:S}:{},_meta:y};this.pendingUpstream.set(x,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),this.upstream.send(zt(x,"session/request_permission",b)).catch(D=>{this.pendingUpstream.delete(x),j.error("forward permission request failed",{agentId:e.agentId,err:String(D)}),i.respondAgentRequestError(a.id,{code:X.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),e.error?i.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.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 _n(e.error)):a.resolve(e.result);return}j.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=Ex){let x=this.upstreamIds.next(e);return new Promise((f,l)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),l(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:l,timer:h}),this.upstream.send(zt(x,e,i)).catch(m=>{let y=this.pendingBridge.get(x);y&&(clearTimeout(y.timer),this.pendingBridge.delete(x)),l(m)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[a,x]of e.sessions){let f={modelToken:x.modelToken,tokenGeneratedAt:x.tokenGeneratedAt};x.acpSessionId&&(f.acpSessionId=x.acpSessionId),i.set(a,f)}await yr(e.agentId,i,this.paths)}catch(i){j.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[a,x]of e.sessions.entries())if(x.acpSessionId===i)return a}sendError(e,i,a){return this.upstream.send(Qe(e,{code:i,message:a}))}};function Ax(){return Sx(16).toString("hex")}J();de();import{randomBytes as kx}from"node:crypto";import{chmod as Dx,mkdir as Px,writeFile as bi}from"node:fs/promises";import{createServer as Tx}from"node:http";import{dirname as Ix}from"node:path";var Rx=1e6,Ar=B("ipc"),Tn=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??V()}async start(){this.token=kx(32).toString("hex");let e=Tx((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(),Ar.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 Px(Ix(this.paths.portFile),{recursive:!0}),await bi(this.paths.portFile,String(this.port),"utf8"),await bi(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await Dx(this.paths.tokenFile,384)}catch(e){Ar.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Ft(i,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){Ft(i,404,{error:"not found"});return}let l=null;if(e.method==="POST")try{l=await Nx(e)}catch(h){Ft(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await f.handler(l,e);Ft(i,200,h??{ok:!0})}catch(h){Ar.error("IPC handler failed",{key:x,err:String(h)}),Ft(i,500,{error:h instanceof Error?h.message:String(h)})}}};function Ft(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function Nx(r){let e=[],i=0;for await(let x of r){let f=x;if(i+=f.length,i>Rx)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Fo=Be(Ri(),1);var hf=Be(Do(),1),gf=Be(Wn(),1),pf=Be(yt(),1),mf=Be(qr(),1),_f=Be(Fr(),1),wf=Be(Vr(),1),zo=Be(Yn(),1),yf=Be(Oo(),1);var Mo=zo.default;J();var ae=B("upstream.frontier"),Ko="application/json",Uo="none",Zn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ae.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:Us,...un(this.opts.ppeOverride)};class i extends Mo{constructor(h){super(h,Ks,{headers:e})}send(h,...m){if(Os("debug"))try{let y;typeof h=="string"?y=Buffer.from(h,"utf8"):h instanceof Buffer?y=h:h instanceof ArrayBuffer?y=new Uint8Array(h):ArrayBuffer.isView(h)?y=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):y=new Uint8Array(0);let S=Buffer.from(y.slice(0,128)).toString("hex");ae.debug("WS raw frame out",{bytes:y.byteLength,headHex:S})}catch(y){ae.warn("WS raw frame dump failed",{err:String(y)})}super.send(h,...m)}}let a=js(this.opts.urlOverride),x={url:a,ws:i,fpID:qs,aID:fn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:Ko,force:!0},payloadEncoding:{encoding:Uo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new Fo.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let l=this.openCount===1;ae.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:l,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:l})).catch(h=>ae.warn("onConnect handler threw (ignored)",{err:String(h)}))},f.onclose=l=>{this.opened=!1,ae.info("frontier closed",{code:l.code,reason:l.reason,willReconnect:l.willReconnect})},f.onerror=l=>{ae.warn("frontier error",{code:l.code,msg:l.message})},f.onmessage=l=>this.handleMessage(l),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){ae.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;ae.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:Ko,payloadEncoding:Uo})}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){ae.debug("drop non-adapter frontier frame",{service:i});return}let a=Sf(e);if(!a){ae.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ae.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){ae.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}ae.info("frontier frame in",{logid:vf(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>ae.warn("frontier frame handler threw",{err:String(f)}))}};function vf(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function Sf(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}}J();var Yr=B("upstream.switchable"),Qn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;Yr.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 Yr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(i??"swapped").catch(x=>Yr.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()}};J();var $r=B("upstream"),$t=class{handler=null;async start(){$r.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){$r.info("NoopUpstream stopped",{reason:e})}async send(e){$r.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)}};J();de();J();de();import{execSync as Ef}from"node:child_process";import{readFileSync as Ho,unlinkSync as Cf}from"node:fs";import{mkdir as Af,readFile as jo,unlink as Go,writeFile as kf}from"node:fs/promises";import{dirname as Df}from"node:path";var Pf=B("single-instance"),er=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??V().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&&(Pf.warn("removing stale pid file",{stalePid:e}),await Go(this.pidFile).catch(()=>{})),await Af(Df(this.pidFile),{recursive:!0}),await kf(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await jo(this.pidFile,"utf8")).trim()===String(process.pid)&&await Go(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await jo(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{process.kill(e,0)}catch(i){return i.code==="EPERM"}return this.matchesDaemonTitle(e)}matchesDaemonTitle(e){try{let i=Ho(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=Ef(`ps -o command= -p ${e}`,{stdio:["ignore","pipe","ignore"],timeout:1e3}).toString();return i.trim()?i.includes("coze-bridge-daemon")||i.includes("lib/index.js"):!1}catch{return!0}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Ho(this.pidFile,"utf8").trim()===String(process.pid)&&Cf(this.pidFile)}catch{}})}};var q=B("daemon"),Tf="coze-bridge-daemon";async function Vo(){let r=new er({processTitle:Tf}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await Dn(),a=i??{};wr({pid:process.pid}),q.info(i?"loaded bridge config":"initialized bridge config");try{let I=new Kt;a.frameworksCache=await I.detectAll(),q.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(I){q.warn("framework detection failed",{err:String(I)})}await Ut(a);let x=new Qn(new $t),f=V(),l=null,h=new Pn({upstream:x,paths:f,bridgeConfig:a,sessionSpawner:async(I,H,Y,se)=>{if(!l)throw new Error("agentManager not ready");return l.spawnSessionDownstream(I,H,Y,se)}});await Rf(f,h);let m=new kn({paths:f,config:a,registry:h});l=m;let y,S,b=null,D=null;h.registerExtension("_agent/create",async I=>m.createAgent(I.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let R={},N=new hn({agents:h.agents,disposeAndMarkDisconnected:async(I,H)=>{let Y=h.agents.get(I);Y&&(await m.cleanupOpenclawSessionProviders(Y).catch(se=>q.warn("cleanup openclaw providers failed (ignored)",{agentId:I,err:String(se)})),await Y.dispose(`disconnect: ${H}`).catch(se=>q.warn("dispose during disconnect failed (ignored)",{agentId:I,err:String(se)})),Y.status="disconnected",h.unregister(I)),h.disconnectedAgents.add(I)},detailSyncer:async I=>{if(!R.ref)throw new Error("agent-detail-sync not initialized yet");await R.ref.syncOne(I)},openclawRepair:async(I,H)=>{await m.openclawRepair(I,H)}});h.registerExtension("_agent/listSkills",I=>N.listSkills(I.params)),h.registerExtension("_agent/addSkills",I=>N.addSkills(I.params)),h.registerExtension("_agent/removeSkills",I=>N.removeSkills(I.params)),h.registerExtension("_agent/getFileTree",I=>N.getFileTree(I.params)),h.registerExtension("_agent/getFileContent",I=>N.getFileContent(I.params)),h.registerExtension("_agent/update",I=>N.updateAgent(I.params)),h.registerExtension("_agent/disconnect",I=>N.disconnectAgent(I.params)),h.registerExtension("_agent/switchModel",I=>N.switchModel(I.params)),h.registerExtension("_agent/reset",I=>N.resetAgent(I.params)),h.registerExtension("_agent/repair",I=>N.repairAgent(I.params));let L=new cn({paths:f,handlers:N,sendDetail:I=>h.sendRequest("_agent/detail",I)});R.ref=L,x.onConnect(({initial:I})=>{q.info("frontier upstream connected, triggering detail sync",{initial:I}),L.syncAll(I?"initial-connect":"reconnect").catch(H=>q.warn("detail sync top-level error (ignored)",{err:String(H)}))});let F=new Tn({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:b??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async I=>{let H=I,Y=H?.privatecode,se=H?.pairing_code;if(!Y||!se)throw new C("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let Re=dn(H.env),_e=H.handshake_url,$e=H.frontier_url,kt=If(H.env,_e,$e),Zt=!!y&&y!==Y,Ee=S!==void 0&&S!==kt,Ce=Zt||Ee;if(Ce){q.warn("pair config switched, resetting agents",{pcChanged:Zt,envChanged:Ee,previousPc:y?Wo(y):"",nextPc:Wo(Y),previousEnvKey:S??"",nextEnvKey:kt});for(let W of[...h.agents.values()])await W.dispose("pair config switch").catch(()=>{}),h.agents.delete(W.agentId);await x.swap(new $t,"pair switch").catch(()=>{})}let Qt=await Ws({privatecode:Y,..._e?{endpoint:_e}:{},ppeOverride:Re});b=Qt.deviceId,wr({deviceId:b,pid:process.pid});let ce=new Zn({handshake:Qt,privatecode:Y,...$e?{urlOverride:$e}:{},ppeOverride:Re});await x.swap(ce,"pair");let en=Object.keys(a.frameworksCache??{});try{let W=await h.sendRequest("_agent/pair",{pairCode:se,patToken:Y,frameworks:en,_meta:{cozeDeviceId:b}});q.info("_agent/pair ok",{pairResult:W}),y=Y,S=kt,D||(D=new pn({core:h,getDeviceId:()=>b??""})),D.start(),Ce&&Jo(f,m).catch(Ne=>q.warn("post-pair-switch auto-revive error (ignored)",{err:String(Ne)}));let $;return H.agent_id&&($=await Nf(H.agent_id,f,m,Ne=>h.sendRequest("_agent/detail",Ne)).catch(Ne=>(q.error("--agent-id ensureAgent failed",{agentId:H.agent_id,err:String(Ne)}),{ok:!1,agentId:H.agent_id??"",note:String(Ne)}))),{ok:!0,note:"paired with cloud",...$?{agent:$}:{}}}catch(W){return q.error("_agent/pair failed",{err:String(W)}),{ok:!1,note:`pair failed: ${String(W)}`}}}},{method:"POST",path:"/_agent/create",handler:async I=>{let H=I;return{ok:!0,result:await m.createAgent(H)}}},{method:"POST",path:"/refresh",handler:async()=>{q.info("IPC /refresh: re-detecting frameworks");let I=new Kt;return a.frameworksCache=await I.detectAll(),await Ut(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(q.info("IPC /shutdown received"),setImmediate(()=>{ue.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:xe,token:re}=await F.start();await h.start(),Jo(f,m).catch(I=>q.warn("auto-revive top-level error (ignored)",{err:String(I)}));let Se=null,ue={port:xe,token:re,core:h,ipc:F,shutdown(I){return Se||(q.info("daemon shutdown",{reason:I}),Se=(async()=>{D?.stop(),await h.stop(I),await F.stop(),await r.release()})(),Se)}};for(let I of["SIGTERM","SIGINT"])process.on(I,()=>{ue.shutdown(I).then(()=>process.exit(0))});return q.info("daemon ready",{port:xe,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),ue}function Wo(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function If(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function Rf(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(()=>(We(),xn));for(let l of a){await f(l,r).catch(h=>q.warn("enforceAgentConfigMode failed (ignored)",{agentId:l,err:String(h)}));try{let h=await x(l,r);h?.disconnectedAt&&(e.disconnectedAgents.add(l),q.info("agent marked disconnected on startup",{agentId:l,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){q.warn("failed to load agent config on startup, skipping",{agentId:l,err:String(h)})}}}async function Nf(r,e,i,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(We(),xn)),f=await x(r,e);if(f){q.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let y={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{}};return await i.createAgent(y),{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 l=await a({_meta:{cozeAgentId:r}});if(!l.framework)throw new C("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:l.agentId,framework:l.framework,...l.cozeIdentity?{cozeIdentity:l.cozeIdentity}:{},...l.model?{model:l.model}:{},...l.deployType?{_meta:{cozeDeployType:l.deployType}}:{}};await i.createAgent(h);let m=l.deployType==="cloud"&&l.framework==="openclaw";return{ok:!0,agentId:r,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function Jo(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(()=>(We(),xn));q.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,l=0;for(let h of a){let m;try{m=await x(h,r)}catch(y){q.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(y)}),l+=1;continue}if(!m){l+=1;continue}if(m.disconnectedAt){q.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),l+=1;continue}try{q.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:h,framework:m.framework}),await e.createAgent({agentId:m.agentId,framework:m.framework,...m.cozeIdentity?{cozeIdentity:m.cozeIdentity}:{},...m.model?{model:m.model}:{},...m.deployType?{_meta:{cozeDeployType:m.deployType}}:{}}),f+=1}catch(y){q.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(y)}),l+=1}}return q.info("auto-revive: done",{revived:f,skipped:l,total:a.length}),{revived:f,skipped:l,total:a.length}}Qr();de();import{readFile as Yo}from"node:fs/promises";var Ye=class{paths;constructor(e){this.paths=e??V()}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:Ff(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([Yo(this.paths.portFile,"utf8"),Yo(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,l=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}),m=await h.text();return{status:h.status,body:Uf(m)}}finally{clearTimeout(l)}}};function Uf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function Ff(r){return r instanceof Error?r.message:String(r)}J();de();import{copyFile as $o,mkdir as Hf,readFile as es,writeFile as jf}from"node:fs/promises";import{dirname as Gf,resolve as ts,sep as tr}from"node:path";import{fileURLToPath as Wf}from"node:url";J();de();var Zo=B("dist-install");function Jf(r){let e=Wf(r),i=Gf(e),a=`${tr}src${tr}`;if(i.includes(a)||i.endsWith(`${tr}src${tr}cli`))return null;let x=ts(i,"index.js"),f=ts(i,"..","package.json");return{dist:x,pkgJson:f}}async function Qo(r={}){let e=r.paths??V(),i=Jf(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 es(x,"utf8")).version??"unknown"}catch(b){return Zo.warn("cannot read source package.json,skip dist install",{err:String(b)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(b)}`}}let l=await Dn(e.configFile)??{},h=l.libVersion;if(h===f)try{return await es(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await Hf(e.libDir,{recursive:!0}),await $o(a,e.libEntry),await $o(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=ts(e.libDir,"package.json"),y=`${JSON.stringify({type:"module"},null,2)}
|
|
93
|
+
`;return await es(m,"utf8").catch(()=>null)!==y&&await jf(m,y),l.libVersion=f,await Ut(l,e.configFile),Zo.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 du=B("cli");function At(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 lu(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}=At(i,"--pat-token");i=x;let{value:f,rest:l}=At(i,"--pair-code");i=l;let{value:h,rest:m}=At(i,"--env");i=m;let{value:y,rest:S}=At(i,"--handshake-url");i=S;let{value:b,rest:D}=At(i,"--frontier-url");i=D;let{value:R}=At(i,"--agent-id");if(!a||!f)return{mode:"help"};let N={mode:"pair",privatecode:a,pairingCode:f};return h&&(N.env=h),y&&(N.handshakeUrl=y),b&&(N.frontierUrl=b),R&&(N.agentId=R),N}var hu=`
|
|
94
94
|
coze-bridge - local bridge daemon for cloud Agent Service
|
|
95
95
|
|
|
96
96
|
Usage:
|
|
@@ -117,35 +117,35 @@ Auto-connect agent (optional):
|
|
|
117
117
|
|
|
118
118
|
Internal:
|
|
119
119
|
<node> <entry> --daemon daemon mode (OS supervisor only)
|
|
120
|
-
`.trimStart();async function
|
|
121
|
-
`),1;if(a.kind==="stale")return await
|
|
122
|
-
`),1;let
|
|
123
|
-
${JSON.stringify(
|
|
124
|
-
`),0}async function
|
|
125
|
-
`),0;if(a.kind==="stale")return await
|
|
120
|
+
`.trimStart();async function i0(r=process.argv,e={}){let i=lu(r);switch(i.mode){case"help":return process.stdout.write(hu),0;case"daemon":{try{await Vo()}catch(a){return du.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return gu(e);case"stop":return pu(e);case"refresh":return mu(e);case"uninstall":return _u(e);case"install-service":return wu();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),yu(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function o0(r){let{unlink:e}=await import("node:fs/promises");await Promise.all([e(r.pidFile).catch(()=>{}),e(r.portFile).catch(()=>{}),e(r.tokenFile).catch(()=>{})])}async function gu(r){let e=r.paths??V(),i=new Ye(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
|
|
121
|
+
`),1;if(a.kind==="stale")return await o0(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
|
|
122
|
+
`),1;let x=await i.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
|
|
123
|
+
${JSON.stringify(x.body,null,2)}
|
|
124
|
+
`),0}async function pu(r){let e=r.paths??V(),i=new Ye(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
|
|
125
|
+
`),0;if(a.kind==="stale")return await o0(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
|
|
126
126
|
`),0;try{return await i.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
|
|
127
|
-
`),0}catch(
|
|
128
|
-
`),1}}async function
|
|
127
|
+
`),0}catch(x){return process.stdout.write(`coze-bridge: stop failed: ${String(x)}
|
|
128
|
+
`),1}}async function mu(r){let e=new Ye(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
|
|
129
129
|
`),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
|
|
130
130
|
${JSON.stringify(a.body,null,2)}
|
|
131
131
|
`),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
|
|
132
132
|
`),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
|
|
133
|
-
`),1}}async function
|
|
134
|
-
`);try{await e.request({method:"POST",path:"/shutdown"})}catch(
|
|
135
|
-
`)}await new Promise(
|
|
136
|
-
`)}catch(
|
|
137
|
-
`)}let a=r.paths??
|
|
138
|
-
`)}catch(
|
|
133
|
+
`),1}}async function _u(r){let e=new Ye(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
|
|
134
|
+
`);try{await e.request({method:"POST",path:"/shutdown"})}catch(f){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(f)}
|
|
135
|
+
`)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:l}=await Promise.resolve().then(()=>(xs(),as)),h=f();await h.uninstall(l()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
|
|
136
|
+
`)}catch(f){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(f)}
|
|
137
|
+
`)}let a=r.paths??V(),{rm:x}=await import("node:fs/promises");try{await x(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
|
|
138
|
+
`)}catch(f){return process.stderr.write(`coze-bridge: remove failed: ${String(f)}
|
|
139
139
|
`),1}return process.stdout.write(`coze-bridge: uninstalled
|
|
140
|
-
`),0}async function
|
|
140
|
+
`),0}async function wu(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(xs(),as)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
|
|
141
141
|
`),await i.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
|
|
142
142
|
`),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
|
|
143
|
-
`),1}}async function
|
|
144
|
-
`),(await
|
|
145
|
-
`)}let
|
|
146
|
-
`),await
|
|
147
|
-
`),1;let
|
|
148
|
-
`),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(
|
|
149
|
-
`),1)}catch(
|
|
150
|
-
`),1}}async function
|
|
143
|
+
`),1}}async function yu(r,e,i,a={},x){let f=new Ye(i.paths),l=i.spawnDaemon??Xo;if(!i.skipDistInstall){let y=await Qo({paths:i.paths});y.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${y.fromVersion} \u2192 ${y.toVersion}
|
|
144
|
+
`),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(b=>setTimeout(b,500)))):y.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${y.libVersion}
|
|
145
|
+
`)}let h=await f.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
|
|
146
|
+
`),await l({paths:i.paths}),h=await bu(f,i.waitTimeoutMs??1e4,i.sleep??vu),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
|
|
147
|
+
`),1;let m={privatecode:r,pairing_code:e};a.env&&(m.env=a.env),a.handshakeUrl&&(m.handshake_url=a.handshakeUrl),a.frontierUrl&&(m.frontier_url=a.frontierUrl),x&&(m.agent_id=x);try{let y=await f.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return y.status===200&&y.body?.ok?(process.stdout.write(`coze-bridge: paired (${y.body.note??"ok"})
|
|
148
|
+
`),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(y.body)}
|
|
149
|
+
`),1)}catch(y){return process.stderr.write(`coze-bridge: pair failed: ${String(y)}
|
|
150
|
+
`),1}}async function bu(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 vu(r){return new Promise(e=>setTimeout(e,r))}i0(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
|
|
151
151
|
`),process.exit(1)});
|