coze-bridge 0.1.20 → 0.1.22

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.
Files changed (2) hide show
  1. package/dist/index.js +56 -56
  2. 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 s0=Object.create;var wr=Object.defineProperty;var o0=Object.getOwnPropertyDescriptor;var a0=Object.getOwnPropertyNames;var x0=Object.getPrototypeOf,c0=Object.prototype.hasOwnProperty;var Y=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,s)=>(typeof require<"u"?require:e)[s]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Pe=(n,e)=>()=>(n&&(e=n(n=0)),e);var oe=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Li=(n,e)=>{for(var s in e)wr(n,s,{get:e[s],enumerable:!0})},u0=(n,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of a0(e))!c0.call(n,x)&&x!==s&&wr(n,x,{get:()=>e[x],enumerable:!(a=o0(e,x))||a.enumerable});return n};var Te=(n,e,s)=>(s=n!=null?s0(x0(n)):{},u0(e||!n||!n.__esModule?wr(s,"default",{value:n,enumerable:!0}):s,n));import{chmod as f0,mkdir as d0,readFile as l0,rename as Oi,writeFile as Bi}from"node:fs/promises";import{dirname as h0}from"node:path";async function xt(n){try{let e=await l0(n,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Zt(n,e,s){await d0(h0(n),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
9
- `,x=`${n}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{s?.mode!==void 0?await Bi(x,a,{encoding:"utf8",mode:s.mode}):await Bi(x,a,"utf8"),await Oi(x,n),s?.mode!==void 0&&await f0(n,s.mode)}catch(c){await Oi(x,x).catch(()=>{});let{rm:f}=await import("node:fs/promises");throw await f(x,{force:!0}).catch(()=>{}),c}}var $t=Pe(()=>{"use strict"});function qi(n){return Qt[Mi]<=Qt[n]}function _r(n){zi={...n}}function Xt(n,e,s,a){if(Qt[n]<Qt[Mi])return;let x=JSON.stringify({ts:new Date().toISOString(),level:n,module:e,msg:s,...zi,...a});n==="error"||n==="warn"?p0.write(`${x}
10
- `):g0.write(`${x}
11
- `)}function R(n){return{debug:(e,s)=>Xt("debug",n,e,s),info:(e,s)=>Xt("info",n,e,s),warn:(e,s)=>Xt("warn",n,e,s),error:(e,s)=>Xt("error",n,e,s),child:e=>R(`${n}.${e}`)}}var Qt,Mi,g0,p0,zi,F=Pe(()=>{"use strict";Qt={debug:10,info:20,warn:30,error:40},Mi=(()=>{let n=process.env.COZE_BRIDGE_LOG_LEVEL;return n==="debug"||n==="info"||n==="warn"||n==="error"?n:"info"})(),g0=process.stdout,p0=process.stderr,zi={}});import{homedir as m0}from"node:os";import{join as te}from"node:path";function G(n){let e=n??m0(),s=te(e,".coze"),a=te(s,"bridge"),x=te(a,"lib");return{cozeRoot:s,bridgeRoot:a,libDir:x,libEntry:te(x,"index.js"),pidFile:te(a,"bridge.pid"),portFile:te(a,"bridge.port"),tokenFile:te(a,"bridge.token"),logFile:te(a,"bridge.log"),installLock:te(a,"install.lock"),configFile:te(a,"config.json"),agentsRoot:te(s,"agents")}}function Ie(n,e=G()){let s=te(e.agentsRoot,n);return{root:s,config:te(s,"config.json"),workspace:te(s,"workspace"),logs:te(s,"logs")}}var ce=Pe(()=>{"use strict"});var nn={};Li(nn,{AGENT_CONFIG_FILE_MODE:()=>en,enforceAgentConfigMode:()=>y0,loadAgentConfig:()=>ue,persistAgentSessions:()=>yr,persistAgentSkills:()=>tn,saveAgentConfig:()=>me});import{chmod as w0,stat as _0}from"node:fs/promises";function ue(n,e){return xt(Ie(n,e).config)}function me(n,e){return Zt(Ie(n.agentId,e).config,n,{mode:en})}async function y0(n,e){if(process.platform==="win32")return;let s=Ie(n,e).config;try{let a=await _0(s);if(!a.isFile())return;let x=a.mode&511;x!==en&&(await w0(s,en),Ui.warn("agent config mode auto-corrected to 0600",{path:s,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;Ui.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:s,err:String(a)})}}async function yr(n,e,s){let a=await ue(n,s);a&&(a.sessions=Object.fromEntries(e),await me(a,s))}async function tn(n,e,s){let a=await ue(n,s);a&&(a.skills=e,await me(a,s))}var Ui,en,Fe=Pe(()=>{"use strict";$t();F();ce();Ui=R("agent-config"),en=384});var Ms=oe($=>{"use strict";var E=N;(function(n,e){let s=N,a=n();for(;;)try{if(parseInt(s(578))/1+parseInt(s(1640))/2+parseInt(s(1432))/3*(parseInt(s(1708))/4)+-parseInt(s(864))/5*(-parseInt(s(1339))/6)+-parseInt(s(1346))/7+parseInt(s(1492))/8*(-parseInt(s(1994))/9)+-parseInt(s(1019))/10*(parseInt(s(1938))/11)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Rn,644387);var Yx=Object[E(1729)+"operty"],Zx=Object[E(677)+E(1211)+E(1178)],Rs=(n,e)=>function(){return n&&(e=(0,n[Zx(n)[0]])(n=0)),e},$x=(n,e)=>{let s=E,a={naFBq:function(c,f,l,m){return c(f,l,m)}};for(var x in e)a[s(1670)](Yx,n,x,{get:e[x],enumerable:!0})};function Xx(){return Ds||(Ds=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Rn(){let n=["twv5qNK","Ee5qBge","uu9WvLm","tvbowhq","ywnkDK0","r3vuAu0","Aunzt2i","wLDuCNO","y1vOwuG","yw5ZzM9YBvq","yw5pCxC","yvruBKW","q0jRu0S","rgrVyLe","wejADxG","twLZC2LUzYa","shPpEgi","y3jLyxrLuMu","t2rqvKy","sw9Azhy","zvvYBa","mJKYDgzxqxvJ","txP0D20","D0rvCNu","x0rctMfTzq","BgLTAxq","tKfusvzfx0u","tg9JAW","CM92AwrLige","zxjFAxnFywm","qM1tC28","z3HdtLO","AgvHzgvY","DhjPzxm","Ae9srgy","zLfMzMq","Ec1TC2CTy3u","AwrI","uM1ktei","DgvZDa","wgHeBKO","DKn1EvG","zgvMAw5Luhi","zgv2AwnLx2K","DvLAqM4","u1rjtLu","x3nLBMrby2S","qNncwKG","EwDHC2K","AefJA01LC3m","shvtswS","z2j0Bem","y2HLy2Tszwe","rfnJC3a","CMvTB3zLrxy","sKzkswu","D3bNqxm","zwrPyxrLBhK","t0HLy2e","C2v0","zNjVBujPDhm","yw5Hz2vY","DeDts3G","Efrurw52","vffWBu0","BM5Ly3q","BuDRu2m","y29UDgLUDwu","vMT1BLa","BuHiy1K","r29Ms0W","DxnLCKLW","q3DNA2O","EeDqDfe","AgH3zxy","zcWGDw5RBM8","C3vJy2vZCW","y2TWtfC","CM5zt3m","x3bPBMDmB3m","y3jLyxrLq2W","v3rtD3y","C3bSAxq","yNn1z0u","wvPyD2y","BM93","vu5OrK4","ANzRu0y","z0ntuxi","Cg93","zeXtzxu","CgLUz0XVC3m","y1L3qLi","z2v0q3vYCMu","Bwv0Ag9K","AwPsv3y","ELzfvxC","zxjFCw9Z","y1jJvgK","AgvHzgvYCW","rfvvCe0","Cgf5Bg9Hzfq","q3jHr0O","Aw9U","x2n1CNnVCK0","Dw5KzwzPBMu","sxn1Dfm","y0DZEvK","aaaaaaaaaaa","y29UDgv4Da","zxblz1y","rwTTCKG","vwXhEhq","Ec1TC2CTCw8","C2vYDMLJzq","rgTHs0W","zMvY","yxnZAwDU","AMTXvLm","CMfTzq","sK1Mv3K","B3nLza","v3bpwKS","Cej6D1O","Bu1yB0q","BuTeteC","BgvY","DgLTzw91Da","wfDnAuq","EvPxAee","wuTorM8","wgLXBuO","A3nIswq","tKTpDK8","y2PgDui","AMTnsgu","zxjYtxnN","v0rOt28","zNDMEgO","EvzrDKK","B25nzxnZywC","zxH0zw5ZAw8","zNvcvNu","yNL0zxm","q25xvee","q09oveLovuu","CeTruKS","A2r2suq","C2DStM0","v1rgt2q","B3bLBKrc","DMLNsu0","AwXLtMfTzq","rMvYAw8","Ae1LC3nHz2u","r0PIzKe","q0PcDfu","tvvqrKO","B25pCgvU","z2zdDfy","z2v0u3rVCMe","qw1VDw50","t29dtfe","DgLUzYbZzxi","BwLUAvbYB2C","CujPs0C","zMzmAw5L","BgXbDKW","y3vYC29Y","AgLNAa","zhDlrMG","AMzHB28","tfbPsM8","vM9MC2y","Dg9Y","Be9XreW","rezkEge","y2XVC2uSihC","yxzxt2O","Agrgruq","AujuAvq","sw1RuNu","r0XREhO","Aw1qEKS","y2vZC0HHBMq","AvLwB1y","r1ztB3m","C2HPzNq","wK5QtMG","B2LUDfjLywm","tfPvuvu","yxv0B21HDgK","A1Dpwvi","yMrFzgLK","CMvJzxzPzwq","D0fVuuK","tuLNsue","C3rYAw5N","Dg9tDhjPBMC","y0LUrKe","CIb0DhDjra","t3rWBvm","BeruuNe","AK9MtLu","quPcu0m","uKL0v1u","z1nerfa","y2fSBa","wgD6wwK","ywXty29Wzq","zNjVBNrPzxi","yLDOEhC","twXYBgG","BMXIA0K","tLnPsey","ihbYB3rVy28","zNjVBu51Bwi","se1nwM8","BeTZAuS","yLjIAvC","rKjYuMS","DgvmwNi","DLbZBKi","Cw1YzMG","B1fWAvu","tNDZtLq","C0nVDw50zxi","BLHUz2S","DLvys1y","D2zqtwG","yMLUza","wePVDfi","zg9Uzq","y2rxwK8","qNLLq0q","zgvSzxrL","D1rQuMC","CMvXDwLYzwq","BMfTzq","A2PAwKe","t2jYyKu","AgvKtwf4uMu","x29UtwvZC2e","yNLL","zxLnru0","tKDFrvjst1i","x2fKzfDZtgK","CMvKDwnL","BKvYtuy","DgLLCKPtt04","ugvbq0u","ntyXqNrdwKru","BMrWB2LUDfq","C3rVCcbPBw0","tw9KDwXL","EM9buxK","r3LivNG","AwXSihvZzsa","AxnFywnR","D24GCMvHC28","x3jLywr5q2W","y1bpAKS","zhrtvKu","B1n6uvm","uuTct3K","s2TuAfq","s05uqKS","nhWXFdv8mG","zw5KCg9PBNq","Bg93","B2fK","EK5zrgW","yurduhO","ufrZquq","ihn1y2nLC3m","C3PzBMi","DhjPBq","DwjiC2m","EvDvu1O","rxnoBfa","txvxAvy","zgvS","CvfltNm","zMveD2u","A21mvhK","wvDHCKW","DhPmC3q","yu5yu3e","tMPsu1G","yMfJA3vWigu","B0r1zgq","vNLuq2O","x2LZsw5PDa","DhLWzq","zg9iEu8","Bg9yyxu","BgLUzw5V","BuzQq0W","Aw5N","sM9NsMe","qNjWvvu","Aw50zwDLCIa","DMfSDwu","uLblv1O","Eujpv24","A2jezha","B2nRzxq","ndeWnffRtKv5qq","zMzLCG","sKLyBgq","uwHQyuS","C3rYAw5NAwy","Bw9NBwC","BwvY","zw50","sNnRt0C","C0nNtNC","lcbTyxGGCMu","D0L3DLu","zfDVCMTLCKC","zeLwEKq","rxjYB3jdB2q","CMnfEgq","DcbVzIbYyw4","x2nSzwfYugK","DxbKyxrLq3u","q1biBvu","mhWYFdr8m3W","CNfYCwS","Aw5L","y29Kzq","vKPmAeK","y2XVC2veqG","q1LADKq","DhDVCMTdAge","rvbhwem","Bg9Nsurhzw4","werlqNa","DNrrwNK","BfH6rgO","BMDXs3i","y29Uy2f0","zwzvz2K","z2v0qwXS","sejmBeO","ChjVDg90Exa","C0vUsLK","rwH2ENe","ChbL","CxPzwfi","vhbmDge","BwvZC2fNztO","q1zTswC","zNjVBunOyxi","sg9nCuy","A0TAEfy","ywXOwfC","Be5NAxe","vLHHvLu","q0nbAxe","CeDpv1a","Ag1xwLq","AhPeBem","ignVzgu6ia","C0jf","ChfyA1i","Dhr6DgG","yNvMzMvY","ruXnqxm","DgLSCKy","vxPVr2O","CMfTugfYyw0","zMjpDLy","Aw1LCYbPBIa","uuz6ufC","AufctgC","v0Pnt1q","v2XkDxq","r0rnAwK","zLv4r3C","Bg9NsurozxC","C3jJ","x2nVBM5Ly3q","nhWXFdj8mhW","CMvUDevUzha","zeTHqwS","ruH4v0G","y291BNq","DurfuuO","y3r4","swnVu0i","DhnAvNm","BMv4DcGPigm","yxrLq291BNq","qwDrDwy","y2nfC28","B3jRzxjhBg8","y29UBMvJDgK","B2nRzxrgywK","y29UBMvJDeu","zw5XDwv1zq","vgfN","Au1gtee","y1fzwhO","v0zyzfe","yvDIvNu","qvfYuMm","Dw5RBM93BIa","tLfIs2q","tvb1zfm","BefvuKu","Bw1rDwK","t1DeBgK","BxLxzK8","twvZC2fNzuu","Cgj2tu0","B2nRzxrtDwm","vvPYBNe","uLfSuvm","y2HLy2TdDxi","refTAhu","Dhr3Awq","DgXLD1a","qMjcr20","A1Lurxu","rMzfwwK","t3HiDNK","DfHsugW","zfPctLy","mtaZmJK2ohHjAwLZqG","yxrHlcbKyxq","EfriEwS","AMrlAeK","sgjjBha","z3fezMS","wvbKwNy","ywDLsgLKzq","sfDnuvi","CfLrwgC","zeH4DM0","sg9PwKO","EKrKqMW","AxnszwfKEq","sfnsBha","yw1Rvxm","CxHvB1y","DeLWswu","rKPiCwG","AKnSBvG","uMTADhe","AwDHDg9Yt24","sMnRA2e","uwLKwgu","C3nHz2vfDMu","DgfYz2v0","CM1tAhm","wLH3CgW","vgHTAfi","rgPHDwe","yMLZDuG","zxmGCMvHy2G","CMvHzfvjBNq","C3vdzuG","yMXVy2TLza","Bg9IywXty28","B2Xfu0S","yNDKwu4","ywnRx2LK","rgvKAwnHDgu","DhDqAva","ywnR","zxjHDg9Y","zw5NDgG","Ew9Huxq","Cg9PBNrbBMq","u0Hgwhm","v09NzK0","DKXVDfG","z3fwDKy","CgLUz1rPBwu","zw50zwqGDhK","B0PptMi","q0rtt1u","z3fJBfi","Cw9Zx18","B05Zz0G","t0DXqu8","z2u6ia","C2XPy2u","r3fbvfm","s3vjquC","u2HHCMvKv28","sMrHy1m","C25myKW","wNHjqwW","CNnNAwK","uMvJB25Uzwm","uujQs2S","ExbL","D1HZqLO","wvjMu2y","B25tDg9Wsw0","x3bYB3rVy28","u3zHqw8","B25JBg9Zzq","BMnLq2XVC2u","wxnvvM8","zxj2AwnL","yw1Lu3bHy2u","qKH0ru8","D3zOELe","BNruCMLLC0m","Dg9oDw1Izxi","x2DLBMvYyxq","AhfuDNu","CwLTvfG","ufvnBfe","CuPZzLG","BLbPy0O","s0f2CeO","Bwf4twvZC2e","uw5SvKC","CgjsrK0","C0DTrgi","CgLUz0LUDgu","sxvxs3i","sg9iEK0","x3nLCuLK","z2v0t3DUuhi","D1ffChK","EvnjuwW","AhPVC1O","wfjVCK4","BgLZDgvUtMu","x2LUAxrqCM8","vgLmufK","CvDAzwm","yM9KEq","tMf2Cwu","tfPtBw4","v2nxq2W","AM9PBG","Dg9cExrLCW","nhWYFdn8mhW","B2zMC2v0","BhrPCgXLihq","t2nhsMi","EKjvu2m","D2fZq2XLyw4","y3jLyxrLt3a","C2fNzq","sNb4sfK","mxWZFdr8mNW","D2nmte8","CgjICdi","DKXkBvC","zxjFywnRx20","qwn0Dfi","r25TD2C","shvyvwK","Dg9cExrLC0i","Cej4ze4","yxnL","y29UC3rYDwm","DxDbzLO","zxHQA3u","CMvTB3zLq2G","z2LcB3G","yNHTt0u","re9ku2C","Aw5JBhvKzxm","DwL2tvK","B3bLBIa","AxjLza","rvjst1i","ywDL","yw1LoIa","igzHAwWSig0","DuH5tg4","Dxrjza","y1zMBMC","Cgf5Bg9Hzeu","u2vXsuq","uLLSCMS","zgrjrcWGzgu","x3DZsw5ZDge","quvuD3y","qvjmwvy","uLjpuG","De5xAeO","yxrPqwW","x2rItMfTzq","u3rYyxrLz3K","C2v0q3vYC28","zM9Yy2u","D0nMDuu","Aw5KzxHpzG","x29UvgLTzw8","EvjLy29UBMu","tNbYuxq","vgPSuxe","qLPpwLu","s1PlywS","q2LkAgm","zu1kwNO","tgLZDgvUzxi","zgvJB2rLzey","ywrKt25L","B25tDgfYDfi","Aw47y2HHCNm","De1HBMfNzxi","zMXVB3i","DwvtqMW","vwjdru4","DK5Org4","qwTqshu","A2nOB1m","C1rmtwO","x0vysvnu","Dxb1zKW","x2n1CNnVCK4","zuf0r00","u2vYDMLJzvC","zfnjC1q","Cfnbzey","yNvMzMvYzwq","zNjVBuj5Dgu","x25HDMLNyxq","zMX1C2HfEha","BNzXruC","Fdn8mxW0","zxjYB3i","BMDuAw1LCG","DhjHBNnHy3q","y2XLyxjtDg8","Bwf4uMv0CMK","yxrVrva","ysbTDxn0igi","v2v6tMq","qML5DK4","q3vZDg9Tq2W","wMHiqLu","BNrLCG","ANL5B2S","AwLsC2G","DvjOt0q","A2v5","v3rlqxm","C2vUzf9Hy2S","zfD0Chq","B2jctxO","zNvUy3rPB24","AMjsAMy","nxW3Fdz8mG","Cw9Z","DKLgvhK","A2v5CW","Dg9VigXHCMC","C2DPza","q3foA3q","DNHxsfK","yxb2rvC","DgLTzw91DcW","CMvQzwn0","BhveEwW","ChrVCG","CNjVCK1LC3m","rwz2qwy","ihrPBwvVDxq","ugTWrLK","ufjLyLa","vMzAwKW","D2vI","zuDTwKy","CgXLyxnLiha","BMnVzgLUzW","qNvXwMK","t294C0O","ueDdy1u","C29Tzq","x2n1CNnVCKy","q0Hvsve","lcbOB3n0BMe","B2jQzwn0u3q","z3flA3a","zxjYtM8","CYbPBNn0yw4","yKTwAw8","ywWGy3vYC28","suvtx0vsuK8","y3buwu0","x3bPBMDqB24","uNzeBu4","BMvJDa","CujWr3O","AxmGDw5Kzwy","igXHCMDLCIa","r3vQyu4","q05mz0O","x29UrxjYB3i","DgfIyxnL","rvLysfO","x2rPC3bHDgm","m3WY","DePyEKm","BKXPDfi","zw5JB2rLrNi","sNrQv0K","rxzLBNq","DMfSDwvZ","uK1JuxG","CLzHBhvLCW","BgvUz3rO","Cg9PBNrdB24","yvnPAvu","nta5nZC0nxjgt2jyDq","zw1LBNq","B25ozxr3B3i","DwD3tw0","A1rwqMq","Dg9hzw5LCMe","qLvxAe4","uND3CeG","s0XQD3e","Dxr2rwO","yuzfD0O","uNDMtu4","wNfJr04","mhW1Fdj8mxW","u3Pqu1C","C3vIyxjYyxK","y09Wzw4","sxPKtLq","uNLcyxK","CNzHBa","BLHVzwy","werVtgC","q0Xpu0ve","zMzMzG","z2vjBMzVu3K","sfPMwfq","x3jLy29UBMu","A0H1DMy","y2zzvuS","CMfUzg9T","sKvOq3e","z2v0sxrLBq","zM56q1K","C2v0y3vYC28","sLfHA2G","q09KCwm","rvvdqKy","q09otKvdveK","ywDLu2HVDW","v2rLvMq","ihrYEsbYzwm","y3jLyxrLt2i","v0T0C24","y2z4AhO","t21PBeG","CgfNzwHPzgu","wvDlsvu","tLDds1m","DxnOAM4","tg9NsurozxC","rfvvvuO","t2jgyM8","Bu54z1y","s0Pdqum","v0f1vwG","BLnxtMq","AfnszNK","y3vYCMvUDeK","x2zVCM1HDeu","sMXxAuS","q1nABeW","DhD5BfO","DxjS","weLjwNO","ALbeu2O","rwPqDhi","EKzSAxy","z05dywS","EunUBLm","oxW3Fdb8nNW","CKHMC2y","EuLruxG","CgvYC2LZDgu","rLjptLrjrvi","wuLywMO","mNWXmhW1FdG","x3fVC0rc","tLrJzNK","C29YDa","EKnMz0S","DMvUDa","A0TgrhK","wwjLyw8","zwnVBM5Ly3q","vfvPvvi","Dg9sENm","A2v0ignVBNm","t2zJsfG","uNDrwNu","C2v0sxrLBq","rMXUq3e","zgf0yq","tLvhA2y","BLvoshK","rvbLyMe","rKvfuKK","r21Vtxe","r2Tny24","q3DzzwS","EuLkrKi","x2rYB3bhBg8","Ahf5wvK","C3blrxa","A01eEui","uLHABeu","x2rPC2nVBM4","CMzQC28","s3nVt2S","sgPjyK8","rw5es1C","CwvPrKK","DKXkvuq","BezSDxnO","zgvSzxrLrge","C3nJzwm","ufLzuhu","DeLK","DNLmBva","ELH0C0G","s214u0e","q0Xpu0LorW","AhvsveS","zvbqAwS","reTRq1G","wMXiAMG","BNrfBMrWB2K","t2jQzwn0","l3DZl3yY","ihzHBgLKigq","BML0AwfSAxO","wfvUuvK","sNfovxC","sLnptLa","zw1PDa","tfb5sw4","Cujoqxy","z2vY","z29PBMCGyxC","yKreAwS","shn2wxu","nhWWFdj8mxW","z2v0q3vYC28","q1PXrNO","BMv3vMvYC2K","ywXSzwqGBxu","x29Uq2XVC2u","zv90Aw1LB3u","A1PiALq","DLzTDei","ihzHBgLKihm","x2rLC3rYB3K","Bg9N","ChjVy2vZCW","t3bLBKv2zw4","swDgseG","mtuYmZmWvMrLte5f","tuvtu0fhrv8","DxfvC3i","x2HHBMrSzva","BfzJD3y","ywrKq291BNq","BKHZuwq","uMn3r2e","x194x21Zz18","y2HHCKnVzgu","u0zlBem","B25dBg9Zzq","x3nVy2TLDa","s2HRCwO","BwvZC2fNzv8","DLLfDfC","BM1JB0y","x2LZtwLUAvC","yxv0BW","EwPTwxu","ywnRtxnNswq","DeTzBg4","rMDny1O","wLbKA3i","u1rWz2K","uhjPBwfYEuS","shbprue","tKretNa","tMfoB2y","s2PmBgy","t25uBwm","tfnRwvO","AgfZ","x3jLBw92zvC","BNrbBMrvCgq","Aw5Lza","B0jlEfe","tMLQEu0","u0nkrgi","r1j5Buy","AwPKB0i","Dfrxzey","C0jkEwy","yMfSu2nVCgu","zw5HyMXLuw8","CNzHBfzHBhu","uxvLDwu","tNzZrfG","z1rPBwvVDxq","CMTLCKDSB2i","CezJExO","wwD4DNG","CM96t3K","q29Kzq","C3vIC3rYAw4","t2Lcq24","vuXpq00","C0XPC3rLBMu","wenSBK0","x3DZ","zcWG","zezREK0","y0jPCM4","sMjNtMq","ywzL","t1v3vxK","CMvZzxruCMK","D3jPDgvvAw4","Bur0wK8","s2TxEuy","qMzIqLu","CMvHC29U","DgvmB2Djre4","BMCGzMfPBgu","rNnJCMe","wxDLyNi","wgTvrge","y2nHy1a","s1rqu2S","v1j5vfm","zM9YrwfJAa","BxDkwxa","z1zMy28","Ehzuv1K","vxzcyM0","sgv0sKC","vNLAD1u","C3rWDMi","CwzpwKG","wLf4rwC","A2r4AK0","zw50tgLZDgu","B2zMBgLUzq","z1PfuK0","y3jLyxrLrwW","DwnVvwS","yw1L","CMfNzvn5BMm","CgfYC2u","A2fSrgW","whjcrNC","AxnAzxjV","Bgztwxa","BMrWB2LUDca","y3ruAw1LB3u","ANvxDLm","s3LcBwO","CMLLC0nVDw4","AuzOwgO","z3ndwMi","DxnLq2y","x2LUAxrhBg8","CgLUz19VBMm","zhDtAKq","q1jyEMG","vgLTzw91Da","A1PlDgi","y3vYCMvUDeu","r3bcr3G","zfvUBe0","BxnN","Aw9Ul2PZB24","uvjNvfa","CxLpDeq","wMPxBxa","BMDLza","u0nxweO","EMzrz2G","ihjLy29UBMu","Bhfmwfm","zNfQt0C","sMPvzeO","ign1CNnVCIa","whHev2u","AK5WzwK","C0r3wgO","A3bTB3K","y3vYC29Yx24","reXAtgS","rKnZD1O","CMvZB2X2zq","B3jLtMfTzxm","sKPzyw4","yxf1wem","EwjOsui","zNbcBNK","zeT6EKy","qKnnuxu","z0rJzgW","BwLZzq","x3bPBMC","rxbxC1y","BKTtr1K","uNfqDg8","yuD1BKC","r3H5rMy","x3vYBa","AwXK","rerpCMS","BwvZ","wwfZDfm","Exj5vNK","zhDvs0u","BNvTyMvY","rerkufm","DhjuzuK","zePfqNC","txfqBgG","B25Uzwn0Aw4","CMvZzxrfBMq","AwjgEhe","CLLvuLy","AuDmALa","z1Hjq2G","rerjENa","zgLZCgf0y2G","pxv0zI04","CenPsei","B2XKvMvYC2K","C2vYDMvYvgK","B25VCgvU","zxnzzKq","uLjrBwi","DhbizwfKzxi","y2XVC2u","q2TPBuy","Dg9iyxnO","BwvKAwf0zwW","u2vsvLG","Ahr0Chm6","BgzzDNi","rNbHsK4","B3bLCNr5tMe","rfrJru0","x2TLEvbHDgG","CfvzCK0","vgLduLK","x19LC01Vzhu","qu5VtgO","CMrVthq","Ae9Wzw5fDMu","AgfZt3DUuhi","q3H5zw4","C21fshu","q3j0Aha","x3bHDgHlzxK","CMXutKm","BeHHBMrSzxi","refmsxy","z05bAhO","zxHWB3j0CW","m3W0","tg9Nsuq","vNPIAxG","Ec11C2uT","tuv1sMG","lcbxzwjtB2m","ihrPBwvZ","rgDhC0y","Bwu6ia","DhrUwwq","zsbHihn0CMK","rLDt","y29SBM8","vNf2vvu","x3DHAxq","Efbwzhi","shviAhG","BKXPBMu","vfjWrgO","DuP1tee","r1Ljr3a","x2LZqNjVD3m","vxLksgS","vgfWuwu","ChrMC0y","Au51D1e","BgLUzq","AeTjrNq","v2vIu29JA2u","CLPfD3u","s01szwm","uKjNree","z1HIzLy","x2vUzhbVAw4","B3nNqKC","yxnqAg0","vw9LvKe","z2vrDwv1zuW","ELjczLu","qMvnEhe","yxbWBgLJyxq","CNnVCL9Uyw0","zg1bs1e","DLLeAha","AxnrB1nnzxm","ihrVihjLDhi","DvDwBw4","B3Liq3q","v2vPEgLUsLm","u3vzvLi","ywnOzwqSihC","Eervr0e","Dev2zw50","BMrLEa","zu9eDLi","DxPPuKy","uxDwr08","CefQs1a","z1jPB08","BfjjD3C","zMLN","AfrOvfO","B25TzxnZywC","CenXzeG","AevYCM9Yrxy","D0Pvr0i","Dgv4Dc9WBge","CwfxEwO","x2LZtwLUAvq","AeHgDNy","B3bLBG","z2v0","tLbusK4","C2vYDMLJzs0","z1z6uw0","txj1Cvq","yw5YyvC","CvvmAxO","whziuxu","zNjHBwvuExa","mdaWmdaWmda","wKPJvha","ywDLrxzLBNq","DufzrwO","B3nLrxzLBNq","Dhj1y3rVCIa","x1fVu01HBMe","wvvlshu","vw5PBxbSzw0","Dg9cExrLC0W","txDvywe","x21PBMLoyxy","twHktwi","Avnvs2K","zw5HyMXLvhi","C2v0zgi","B3jpBMXPBMu","ANz3zxy","rNjVBNrPzxi","Ef9MCM9UDgK","BLzhzKO","y3vYC29Yx2y","AwXLx25HBwu","zNb5Cwm","EwHlq3m","uvDZsKG","B3v0sw50zxi","ywrKrxzLBNq","Aw5KzxGGB3u","nLHoBMvwEG","ruXctuq","Bxr5Cu4","BfrPBwvVDxq","CMvJzwL2zwq","qwHmvg4","EKPVsvG","nJaYmdC4nfjZv3LVrq","C0Xf","EKzgDhi","x2nYzwf0zvm","EvPVEum","DxrMofDYAxq","CgzUqLq","wLPoC2W","B3bLCNr5","CM9YrxzLBNq","vLPjBwW","ywXSB2nvBNm","BxnNsuq","DMrIALy","v2TOs1e","qxjhrhi","DhbOzem","ywnOzwq","Dgv4DfbHEwW","BMnNzw4","C0TsCee","A1n0yxr1C0m","ExPZs0e","x2jPBMfYEvq","BhL4AhO","uevrD1i","ELnczui","rMzbBvq","Ce5MDg0","ruvwvNe","quXm","y2HnyxHuCMK","zw5JB2rPBMC","y2fwuNy","vw5Oyw5KBgu","reiGzMfPBgu","yM9Uy0u","t1bftG","t1bftL9fuLi","y2XLyxi","zufJAW","q29UzMLN","t2HQvgW","zerrBgq","yMfSrxzLBNq","x2LZv29YA2u","C3rLBMvYCW","DeLUDgvYy2u","Bu1TB3O","vgX5A3q","uenLBu4","B25mAw5L","thzKBuu","CMvWBgfJzq","C2vUza","qMjjA0u","BKXkuwm","AefutLK","EsbJBg9Zzwq","EgXYEuu","tfvtDhO","DhjPzxmGCMu","C0rNv3a","Dg9mB3DLCKm","qwjVCNrfCNi","qMfHvLu","igfYCMf5yNu","EfvZzuvUDG","q1PVqKq","zMLUza","z2v0qwXSs2u","q3vZDg9Trxi","EKTLreW","zNj0tLu","Bwf4tg9ZC0m","igzPzwXKoIa","Cgf5Bg9Hza","Aw5PDcbrB1m","DvLqwwW","u2TPCcbWyxm","wfj0D0O","uNfRBxq","q05nrxy","EgXRCe8","x2HHBMrSzvi","y3vZDg9Tshq","ndm4nJLJqM9VwM0","suHuCNm","yNbTtfC","vfb6Agi","DMvYC2LVBMm","AxPuqxa","ywr2yw5Jzq","y2n6wu0","CMvZzxrdB3u","CwnStKS","tLLps0e","suLhEM0","BwvZC2fNzq","rfbpAee","tuPSrgG","x29WDgLVBNm","vhLVvvm","zKXWz2G","qwLqCK4","twnWuvq","uuHfuLq","Dw5ZAwDUzwq","wwDktuG","rurquhi","EMP1qKm","sMHxwuS","zhD1BLy","ywnRx2nVzgu","yunnq0O","rgPSvxC","zxzAq00","t0DotLi","C2nIvLu","BMvY","ChvZAa","icSG","z2vtEw5J","yMLUyxj5vhK","CYbHBhjLywq","CgLUz09Uy2u","zgLZywjSzue","AxnbCNjHEq","CxHtz0O","DgHLBG","v1rdBfu","qurbvNu","y3jLyxrLrxi","quvqDuO","BgXgsg4","qM9mzgy","AxnrB1nby2S","C3rVCMu","zunvAuS","ugTWwwK","yxvbuM0","x2LUDgvYDMe","s3nzDeK","vvnqq3C","zgvIDwC","yxGGCMv0CMK","mtyXmZzhDNvIqNu","Bhm6ia","ugvjCgS","yuzxCLu","v0XPvNK","EK1Mwve","tun3A1C","x2nSzwfYvgK","y2r3yMy","Bwjxv3u","y29PrNC","CMvHzhLtDge","zw5HyMXLqxu","y29UBMvJDfm","uNnvr2K","D3nZoI8V","CM92AwrLigi","C2nYAxb0","vgfdAKq","CMvJB25Uzwm","twHgCfq","rNrnCu4","wNjUr2m","r0D0Deu","x3bYzwzPEa","sKDgt3K","B3jRig9MzMW","CNnVCKzPBgu","AxvzC1C","ru5RANC","B3vUDa","DwDnv2i","AgfUz2u","AvbHv0O","x2LUAxq","qMPSAuW","ALzWvNi","uxnkvgy","zNjVBuHHC2G","CgneAM0","sfL2A3e","yNL0zu9MzNm","t1vlAM0","Avjes2O","CLrKs2S","CMvZDwX0","zwvKzwq","s3PTDwe","wLblz0e","D0DUs2S","y3vYDMfSDwu","AMnwtgy","sgLbEhq","C0DbBfa","zKTcz1O","zv9ZDwnJzxm","t2LPzKO","rM1ez1G","zMLSzw5HBwu","EKTtv1m","rfzpEwG","sMHtuNu","tuLPEKC","z0nir3O","y29TCgXLDgu","zwnHtwK","BNbMvfu","s3Lrzwu","wvf3rem","x21LC3nHz2u","zxjFDhrS","zxq9DxrMltG","uLDAzM8","A3j3rha","tgrsy28","x2XPC3rLBMu","A2XSuvi","zMLSDgvY","wMfMCKy","y2uGBM90igK","x2rLyNvN","suftrhK","we1Yr0K","u2z5Cu4","EwjMv2K","qw95AKm","AenSB3nLrxy","wgHvwee","sgLizeu","y1n2vKi","t1LVvhe","y2f0y2G","t0LTtuK","BvHlzha","yw5Nzq","C1bLrNm","BuL3Ce8","B25szwnLAxy","sMffCgm","B25LCNjVCG","A09eALi","wNLgwgK","D0Tms2O","BLHcuhG","qvvTCuG","o2nOyxjZzxq","y29UBMvJDca","rKLmrv9ot1q","mxWZFdb8mNW","tMfTzq","tgPrshq","yNrPrwG","rwDgzKe","ufDTvwe","AhnHAK4","C2v0u3rVCMe","AxnmB25N","y1zxC20","A01MB1K","CMf4qM0","D3jPDgu","rwPjteC","t1vusNC","BKH3DwS","ywjVCNq","zxrxB3jRq2G","s3vSBMi","Cg9W","uffgu3O","x29UugfNzu4","ywnRDxbfBMq","id4G","y2HnyxHdB3u","thPStxe","BLndCxO","tvrnz3y","Aw9UvgLTzw8","zxH0ugf5Bg8","z0LIEeO","r1bIqKi","yxbWBhK","wenMvfK","D3jSrfO","sgfrCKG","zxzICKC","zMPvuMK","BMzPre4","zwn0","mtyYmJC2DwDjveTK","C1bkv3a","AvHqq1u","v0DUDgm","x29Ut3bLBG","yxjYyxLIDwy","mhWY","CNnVCL92ywW","vKvvtuS","yNL0zuXLBMC","tvnQqMy","BIWGAg9ZDg4","y3vYC29YlNm","s0zJzKm","y29UBMvJDa","y3jLyxrLtwu","tMrOEhK","vLPrteu","zw5fDMvUDa","y012CgO","t05Uuum","BePJvMq","x2HHBMrSzu8","DuD3yw0","ywX3yxLZ","B25SAw5L","A1rQwKi","r1HutgG","su5tvefova","rvLLBvG","BMfgqNe","tufyx1jfvfi","rer4uw4","qNjwqLG","C2vUDa","uwXNDfG","tKjNB0q","zhrfDuC","D3PvuMC","whrWwfm","yxnJCMLWDa","Ae9fC1C","qxfOt0S","B2zM","ChjVDg9JB2W","uevivMW","CM9mwM4"];return Rn=function(){return n},Rn()}function N(n,e){n=n-500;let s=Rn(),a=s[n];if(N.OZfyCa===void 0){var x=function(m){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",b="",_="";for(let S=0,k,P,I=0;P=m.charAt(I++);~P&&(k=S%4?k*64+P:P,S++%4)?b+=String.fromCharCode(255&k>>(-2*S&6)):0)P=w.indexOf(P);for(let S=0,k=b.length;S<k;S++)_+="%"+("00"+b.charCodeAt(S).toString(16)).slice(-2);return decodeURIComponent(_)};N.fMkcbb=x,N.HJTnaU={},N.OZfyCa=!0}let c=s[0],f=n+c,l=N.HJTnaU[f];return l?a=l:(a=N.fMkcbb(a),N.HJTnaU[f]=a),a}function Qx(){let n=E;return ks||(ks=[IDBCursor.prototype[n(1438)],IDBCursor[n(2032)+"e"][n(1754)],IDBCursor[n(2032)+"e"][n(1754)+n(1044)+"ey"]])}function ec(n){let e=E,s={UbCEN:function(x,c){return x(c)},KMRec:function(x){return x()},CSZlL:"success",lAURE:e(780),kWOYR:function(x,c){return x instanceof c},oDudd:function(x,c){return x!==c},iiVUN:"XUltW"},a=new Promise((x,c)=>{let f=e,l={TPzhb:f(1501),AEkqk:s[f(924)],CRXzh:s[f(559)],nHsQd:function(_,S){return s[f(762)](_,S)},HLCtC:function(_){return s[f(1260)](_)}},m=()=>{let _=f;if(l.TPzhb===l[_(1435)])n[_(1741)+_(1110)+_(1465)](l.AEkqk,w),n[_(1741)+_(1110)+_(1465)](l[_(1133)],b);else try{this[_(940)]?.close(),this._qosDB=void 0}catch(S){_0x5e36a6.log(S)}},w=()=>{let _=f;l[_(1025)](x,Ce(n[_(1537)])),l.HLCtC(m)},b=()=>{let _=f;s[_(762)](c,n.error),s[_(1260)](m)};n["addEvent"+f(754)](f(1763),w),n[f(1337)+f(754)](f(780),b)});return a[e(1475)](x=>{let c=e;if(s[c(1879)](x,IDBCursor)){if(s[c(1977)](s.iiVUN,s.iiVUN))return null;Tr.set(x,n)}}).catch(()=>{}),Ln[e(1746)](a,n),a}function tc(n){let e=E,s={jkMHe:function(x){return x()},oFyKU:function(x,c){return x(c)},wcLLO:"AbortError",iABLg:function(x,c){return x|c},IsutS:function(x,c){return x&c},ChUwh:function(x,c){return x>>c},VdfXl:function(x,c){return x>>c},apJpQ:function(x,c){return x!==c},HjIbO:e(1145),HpOEA:e(1556),DUUpM:e(780)};if(Nn[e(1051)](n))return;let a=new Promise((x,c)=>{let f=e,l={krwDp:function(_,S){return s[N(524)](_,S)},HuSIk:function(_,S){return s[N(1793)](_,S)},OcGJb:function(_,S){return s.ChUwh(_,S)},GGttE:function(_,S){return s.VdfXl(_,S)},kHzWF:function(_,S){return s.apJpQ(_,S)},FlnCq:s[f(972)],GWafU:s.HpOEA,vLJUD:s[f(1787)],kTVBd:f(1616)},m=()=>{let _=f;l.kHzWF(l[_(954)],_(1587))?(n[_(1741)+_(1110)+"ner"](l.GWafU,w),n[_(1741)+_(1110)+"ner"](l[_(975)],b),n[_(1741)+_(1110)+_(1465)](l[_(868)],b)):(_0x266464[_0x863e3d++]=l.krwDp(l[_(1737)](l[_(695)](_0xe35f19,18),7),240),_0x1b0b2d[_0x3d8855++]=l[_(1565)](l[_(1737)](l[_(1515)](_0x27d3c8,12),63),128))},w=()=>{s[f(1822)](x),m()},b=()=>{let _=f;s.oFyKU(c,n[_(780)]||new DOMException(s[_(702)],s[_(702)])),m()};n[f(1337)+"Listener"](s[f(1045)],w),n[f(1337)+"Listener"](s[f(1787)],b),n["addEvent"+f(754)](f(1616),b)});Nn[e(1746)](n,a)}function nc(n){On={ZXzRx:function(s,a){return s(a)}}.ZXzRx(n,On)}function rc(n){let e=E,s={zKSWS:function(a,x){return a(x)},AgQuf:function(a,x){return a(x)},HoHzM:function(a,x){return a===x},LiYMl:function(a,x){return a in x},XWMiD:e(832)+"oreNames"};return s[e(675)](n,IDBDatabase[e(2032)+"e"][e(782)+e(1790)])&&!s.LiYMl(s[e(1815)],IDBTransaction[e(2032)+"e"])?function(a,...x){let c=e,f=n[c(1894)](zt(this),a,...x);return Pr[c(1746)](f,a[c(942)]?a[c(942)]():[a]),Ce(f)}:Qx()[e(719)](n)?function(...a){let x=e;return n[x(1632)](s[x(1551)](zt,this),a),s[x(1551)](Ce,Tr[x(1301)](this))}:function(...a){let x=e;return s[x(543)](Ce,n[x(1632)](s[x(1551)](zt,this),a))}}function ic(n){let e=E,s={LZSmn:function(a,x){return a instanceof x},wXsBZ:function(a,x,c){return a(x,c)},qaWyj:function(a){return a()}};return typeof n===e(800)?rc(n):(s[e(688)](n,IDBTransaction)&&tc(n),s[e(648)](Ns,n,s[e(1297)](Xx))?new Proxy(n,On):n)}function Ce(n){let e=E,s={RRQmb:function(x,c){return x instanceof c},twPiP:function(x,c){return x(c)},KTPSk:function(x,c){return x(c)},uqUsr:function(x,c){return x!==c},npfTU:"zZRab"};if(s[e(1201)](n,IDBRequest))return s[e(618)](ec,n);if(Tn.has(n))return Tn[e(1301)](n);let a=s[e(1097)](ic,n);return s[e(1021)](a,n)&&(s[e(1558)]===e(1536)?_0x36a710[e(1746)](_0x1e6dbb,_0x385e18):(Tn.set(n,a),Ln.set(a,n))),a}var Ns,Ds,ks,Tr,Nn,Pr,Tn,Ln,On,zt,Ps=Rs({"node_modules/idb/build/wrap-idb-value.js"(){let n=E,e={JjUdJ:function(s,a){return s instanceof a},nUNHy:function(s,a){return s===a},QGTmq:n(1919),xhfmf:n(832)+n(1160),cekge:function(s,a){return s===a},xPVdr:"hqTvu",ybfWi:function(s,a){return s(a)},Ferio:function(s,a){return s===a},ULOCM:function(s,a){return s===a},GPbBB:n(1483),WFXdQ:function(s,a){return s in a}};Ns=(s,a)=>a[n(828)](x=>s instanceof x),Tr=new WeakMap,Nn=new WeakMap,Pr=new WeakMap,Tn=new WeakMap,Ln=new WeakMap,On={get(s,a,x){let c=n;if(e[c(1150)](s,IDBTransaction)){if(e[c(957)](a,e.QGTmq))return Nn[c(1301)](s);if(e[c(957)](a,e.xhfmf))return e.cekge(c(663),e[c(1245)])?s[c(832)+c(1160)]||Pr.get(s):this[c(1031)].extensions;if(a==="store")return x[c(832)+c(1160)][1]?void 0:x[c(832)+"ore"](x[c(832)+c(1160)][0])}return e[c(1576)](Ce,s[a])},set(s,a,x){return s[a]=x,!0},has(s,a){let x=n;return e[x(1150)](s,IDBTransaction)&&(e[x(1840)](a,x(1919))||e[x(1075)](a,e[x(1631)]))?!0:e[x(553)](a,s)}},zt=s=>Ln[n(1301)](s)}}),Ls={};$x(Ls,{deleteDB:()=>oc,openDB:()=>sc,unwrap:()=>zt,wrap:()=>Ce});function sc(n,e,{blocked:s,upgrade:a,blocking:x,terminated:c}={}){let f=E,l={BiyvN:function(b,_,S,k,P){return b(_,S,k,P)},OoCLQ:function(b,_){return b(_)},JQakh:function(b,_){return b(_)},ePPik:"complete",scbVU:f(1777),NBqpN:"versionc"+f(1524),gVzQm:function(b,_){return b(_)}},m=indexedDB.open(n,e),w=l[f(1304)](Ce,m);return a&&m[f(1337)+f(754)]("upgraden"+f(1538),b=>{let _=f;l[_(788)](a,l[_(1849)](Ce,m[_(1537)]),b[_(1197)+"on"],b[_(1007)+"on"],l[_(898)](Ce,m["transact"+_(1790)]))}),s&&m[f(1337)+f(754)]("blocked",()=>s()),w[f(1475)](b=>{let _=f,S={dKzzF:l[_(986)]};l[_(1464)]===l[_(1464)]?(c&&b[_(1337)+_(754)](_(1203),()=>c()),x&&b[_(1337)+_(754)](l.NBqpN,()=>x())):(_0x8b75c3["removeEv"+_(1110)+_(1465)](MTCEiz[_(1165)],_0x321233),_0x42b71a[_(1741)+_(1110)+_(1465)](_(780),_0x70b2de),_0x2d3ae0["removeEv"+_(1110)+"ner"]("abort",_0x3d471e))})[f(1583)](()=>{}),w}function oc(n,{blocked:e}={}){let s=E,a={yzsKA:function(c,f){return c(f)}},x=indexedDB[s(977)+s(849)](n);return e&&x["addEvent"+s(754)](s(612),()=>e()),a[s(1368)](Ce,x)[s(1475)](()=>{})}function Ts(n,e){let s=E,a={alQBv:"readwrite",CqNkt:"readonly",zSBeB:function(m,w){return m in w},BsBZH:function(m,w){return m===w},BarbI:s(1884)};if(!(n instanceof IDBDatabase&&!a[s(1372)](e,n)&&a[s(1734)](typeof e,a.BarbI)))return;if(In[s(1301)](e))return In[s(1301)](e);let x=e.replace(/FromIndex$/,""),c=e!==x,f=Bs[s(719)](x);if(!(x in(c?IDBIndex:IDBObjectStore)[s(2032)+"e"])||!(f||Os[s(719)](x)))return;let l=async function(m,...w){let b=s,_=this["transact"+b(1790)](m,f?a.alQBv:a[b(808)]),S=_[b(1483)];return c&&(S=S.index(w[b(1874)]())),(await Promise.all([S[x](...w),f&&_.done]))[0]};return In[s(1746)](e,l),l}var Os,Bs,In,ac=Rs({"node_modules/idb/build/index.js"(){let n=E,e={PeIpk:"getKey",ngqKr:n(2030),WGntc:"getAllKeys",wCfuE:n(536),ytxLM:function(x,c){return x(c)},BjliL:"put",qULiz:"add",XiqmJ:"delete",jMGms:function(x){return x()}},s=("1|5|0|4|"+n(852)).split("|"),a=0;for(;;){switch(s[a++]){case"0":Os=[n(1301),e[n(1494)],e[n(2027)],e[n(1643)],e[n(744)]];continue;case"1":Ps();continue;case"2":e.ytxLM(nc,x=>({...x,get:(c,f,l)=>Ts(c,f)||x.get(c,f,l),has:(c,f)=>!!Ts(c,f)||x[n(1051)](c,f)}));continue;case"3":In=new Map;continue;case"4":Bs=[e[n(1527)],e[n(1307)],e[n(1818)],n(1385)];continue;case"5":e.jMGms(Ps);continue}break}}}),xc={idb:function(n){let e=E,s={gXICh:e(911),Fvsqa:e(1943)};n[e(1229)]=Promise[e(1159)]()[e(1475)](()=>(ac(),Ls)).then(function(a){let x=e;if(s[x(1192)]===s.Fvsqa)_0x11da46.d=(c,f)=>{let l=x;for(var m in f)_0x243ab3.o(f,m)&&!_0x1e70af.o(c,m)&&_0x1ab468[l(1729)+l(1354)](c,m,{enumerable:!0,get:f[m]})};else return a})}},Is={};function Ee(n){let e=E,s={RqPto:e(701)+"0",stpvb:function(l,m){return l!==m}},a=s[e(1172)][e(1769)]("|"),x=0;for(;;){switch(a[x++]){case"0":return f[e(1229)];case"1":var c=Is[n];continue;case"2":xc[n](f,f.exports,Ee);continue;case"3":if(s[e(1106)](void 0,c))return c.exports;continue;case"4":var f=Is[n]={exports:{}};continue}break}}Ee.d=(n,e)=>{let s=N;for(var a in e)Ee.o(e,a)&&!Ee.o(n,a)&&Object[s(1729)+"operty"](n,a,{enumerable:!0,get:e[a]})},(()=>{let n=E;Ee.o=(e,s)=>Object[n(2032)+"e"][n(1220)+n(1354)][n(1894)](e,s)})(),(()=>{let n=E,e={HWMQR:function(s,a){return s!=a},JhSRu:n(1792)+"d",EsNlP:n(1941),COdqc:"__esModule"};Ee.r=s=>{let a=n;e[a(586)](e[a(1553)],typeof Symbol)&&Symbol[a(1885)+"Tag"]&&Object.defineProperty(s,Symbol[a(1885)+a(550)],{value:e[a(1966)]}),Object[a(1729)+a(1354)](s,e[a(899)],{value:!0})}})();var Z={};(()=>{let n=E,e={NTcfy:n(797),EUCBF:function(r,t){return r===t},CPHmU:n(1215),fisUA:n(1974),CiJhc:function(r,t){return r(t)},jNpei:function(r,t){return r+t},SDGui:function(r,t){return r+t},FfAmT:function(r,t){return r+t},lRIww:function(r,t){return r*t},sEnJY:function(r,t){return r+t},fLpgh:function(r,t,i){return r(t,i)},vNhDn:function(r,t){return r+t},ThmhR:function(r,t,i){return r(t,i)},tzLst:function(r,t){return r(t)},LPiJo:function(r,t){return r(t)},cSvVB:function(r,t){return r+t},anOqw:"0000",FBrRk:n(887),SFKlC:function(r,t){return r(t)},bKvTl:n(1310)+n(1310)+n(1310)+n(1310),dZBNV:function(r,t){return r>=t},BbIkE:n(710),kODjR:function(r,t){return r>t},sTLMj:function(r,t){return r<t},oNsgH:function(r,t){return r!==t},xvTWY:n(872),GqATS:function(r,t){return r>t},ELMAs:function(r,t){return r<t},XDKBp:function(r,t){return r!==t},iPaWJ:n(1510),ENkjw:function(r,t){return r-t},PEQwR:function(r,t){return r!==t},wIwvU:n(685),kbDdp:function(r,t){return r-t},zFFtr:function(r,t){return r!==t},vaSok:"dzpmB",PkpYi:function(r,t,i){return r(t,i)},YWKIU:"aqwep",zVEUw:function(r,t,i){return r(t,i)},PTsAD:function(r,t){return r(t)},tphdC:function(r,t){return r>>>t},WHstf:function(r,t,i){return r(t,i)},FpaJN:function(r,t,i){return r(t,i)},LUStz:function(r,t,i){return r(t,i)},HSRlp:function(r,t){return r&t},wKLKj:function(r,t){return r===t},OdPVF:"Missing "+n(1924)+n(1421)+n(1989),mMXoD:function(r){return r()},cdwbf:function(r,t){return r(t)},yryVy:function(r,t){return r&t},dHxvm:function(r,t,i){return r(t,i)},aquXC:function(r,t,i){return r(t,i)},sDgWp:function(r,t,i){return r(t,i)},jcVLf:function(r,t,i){return r(t,i)},teLZr:function(r,t,i){return r(t,i)},mNxgV:function(r,t){return r(t)},gDcdl:function(r,t){return r!==t},EqunA:function(r,t,i){return r(t,i)},uYPYl:function(r,t,i){return r(t,i)},lOqDL:function(r,t,i){return r(t,i)},doHyO:function(r,t){return r(t)},XtpXS:function(r,t,i){return r(t,i)},anraW:function(r,t,i){return r(t,i)},HsvYu:function(r,t){return r!==t},fpBny:n(1873),MPNXt:function(r,t){return r!==t},YgJMH:function(r,t){return r!==t},gfCtV:function(r,t,i){return r(t,i)},VqvUU:function(r,t){return r!==t},WLiVy:"DOCoC",eMJZz:n(551),myWfO:function(r,t){return r(t)},ubHsc:function(r,t){return r(t)},EDPPr:function(r,t){return r(t)},vtQZy:function(r,t,i){return r(t,i)},vyLmP:function(r,t){return r(t)},XBZux:function(r,t){return r(t)},HuHhx:function(r,t,i){return r(t,i)},qQKNs:function(r,t){return r(t)},ROUSU:function(r,t,i){return r(t,i)},iNuwQ:function(r,t,i){return r(t,i)},tIpIe:function(r,t){return r(t)},ZXwpl:function(r,t){return r(t)},spKEp:function(r,t,i){return r(t,i)},NwsNT:n(1702)+n(1924)+n(1421)+n(731),sVbIn:function(r,t){return r===t},HZfXT:"Missing "+n(1924)+n(1421)+n(1231),zJoIX:function(r,t){return r===t},TUXaG:n(1702)+n(1924)+n(1421)+n(1801),VJLhI:function(r,t){return r===t},Gnmwg:function(r,t){return r(t)},Djaua:function(r,t,i){return r(t,i)},qimTX:n(1318)+n(629)+"pe: ",tilrF:function(r,t){return r>>t},gNAhz:function(r,t){return r>=t},BoLdf:n(1300),IgFHH:n(1444),XRtwJ:n(780),LzlMq:n(644),Ygxvx:function(r,t){return r>t},FZebK:n(1425)+"t limit",tNWhJ:function(r,t){return r*t},eCUiK:function(r,t){return r+t},YQwDC:function(r,t,i){return r(t,i)},caVRv:function(r,t){return r<t},NUGkf:function(r,t){return r&t},cYwBR:function(r,t){return r>=t},BmSso:function(r,t){return r&t},dwunV:function(r,t){return r|t},ygasi:function(r,t){return r<<t},pGqMR:function(r,t){return r(t)},XvHQu:function(r,t){return r>=t},cVWsm:function(r,t){return r+t},CnWTA:function(r,t){return r+t},yoaQt:function(r,t){return r&t},pNftm:function(r,t){return r|t},EkmrH:function(r,t){return r<<t},fuBVu:function(r,t){return r&t},kMfoY:function(r,t){return r<<t},wAoQI:function(r,t){return r&t},BbBGm:function(r,t){return r<=t},OImMI:function(r,t){return r==t},ZafrF:function(r,t){return r+t},dDQld:function(r,t){return r+t},wzURg:function(r,t){return r+t},dwKFh:function(r,t){return r|t},auARm:function(r,t){return r<<t},dJEBw:function(r,t){return r|t},vLJmW:function(r,t){return r|t},tsZVs:function(r,t){return r&t},EpWsV:function(r,t){return r<<t},Mlrlh:function(r,t){return r&t},bWhxw:function(r,t){return r<t},aGunG:function(r,t){return r+t},GRymF:function(r,t){return r<=t},SvaAo:function(r,t){return r<t},mmQui:function(r,t){return r+t},dSIsT:function(r,t){return r-t},ccEso:function(r,t){return r+t},YPdZv:function(r,t){return r<t},esYfD:function(r,t){return r<t},JMfWy:n(1098),vfuHy:function(r,t){return r>=t},BHtEO:function(r,t){return r<=t},TjlQq:function(r,t){return r<<t},xlkpO:function(r,t){return r<t},GXTLh:function(r,t){return r&t},FtMqN:function(r,t){return r&t},AhLTn:function(r,t){return r>>t},jdKhI:function(r,t){return r>t},kKFDy:n(943),KkThT:n(736),xAhuC:function(r,t){return r<t},ZPdkr:function(r,t){return r+t},USPCw:function(r,t){return r!==t},gVfco:function(r,t,i){return r(t,i)},SfyqN:function(r,t,i){return r(t,i)},VEUMK:function(r,t){return r>=t},kdvID:function(r,t){return r&t},xNPla:function(r,t){return r<=t},luDyl:function(r,t){return r===t},AJBSC:function(r,t){return r-t},fqjOG:function(r,t){return r&t},foiQe:function(r,t){return r&t},trTeI:function(r,t){return r&t},ZZNsl:"GZtIw",gxCNZ:function(r,t){return r<<t},MUPFJ:function(r,t){return r&t},NaNof:function(r,t){return r&t},cQYXz:function(r,t){return r&t},jISKP:function(r,t){return r<<t},iBTiT:function(r,t){return r&t},Rihxp:function(r,t){return r&t},VyTCj:function(r,t){return r&t},qxSgJ:function(r,t){return r===t},pKQRK:n(1904),DDOrk:"olVuY",AQrRc:function(r,t){return r<<t},XhUXA:function(r,t){return r>>>t},sscec:function(r,t){return r<<t},sPJWp:function(r,t){return r>>>t},mtyqN:function(r,t){return r<<t},giBox:function(r,t){return r>>>t},kYTEu:function(r,t){return r<t},SHFXs:function(r,t){return r|t},DALIv:function(r,t){return r|t},TiLPY:function(r,t){return r>>>t},sBJyf:function(r,t){return r|t},NBgoD:function(r,t){return r!==t},lNgiq:function(r,t){return r|t},CVmIg:function(r,t){return r&t},EjPtr:function(r,t){return r+t},dIVzD:function(r,t){return r|t},Rbmtx:function(r,t){return r+t},OmilH:function(r,t){return r>>>t},AUmqH:function(r,t){return r>>>t},DTcEM:function(r,t){return r<<t},TapQe:function(r,t){return r+t},XCfTY:function(r,t){return r+t},NprQt:function(r,t){return r+t},pqXkR:function(r,t){return r|t},ldhJM:function(r,t){return r|t},jvwev:function(r,t){return r|t},PGCcU:n(1375),CNLgJ:function(r,t){return r|t},DkaKL:function(r,t){return r===t},UTEnk:n(1650),aTTnL:function(r,t){return r|t},PEHVl:function(r,t){return r===t},KFcfC:function(r,t){return r|t},asPhm:function(r,t){return r|t},UWPgH:function(r,t){return r<<t},RmJLB:function(r,t){return r<<t},oQpiU:function(r,t){return r<<t},cUhYH:function(r,t){return r|t},DDIzp:function(r,t){return r|t},QsJTf:function(r,t){return r<<t},DVOyh:function(r,t){return r|t},tzKcW:function(r,t){return r<<t},gqclR:function(r,t){return r|t},BZOZU:function(r,t){return r|t},QKBOy:function(r,t){return r===t},apvEW:function(r,t){return r|t},fnzCY:function(r,t){return r<<t},nPicJ:function(r,t){return r|t},MGqiQ:function(r,t){return r<<t},roLZn:function(r,t){return r<<t},TpLta:function(r,t){return r>>>t},aCMCJ:function(r,t){return r&t},ttnYd:function(r,t){return r>>>t},ijRWv:function(r,t){return r<t},EKHze:function(r,t){return r|t},DFJxa:function(r,t){return r&t},rdoLt:function(r,t){return r&t},yVQvI:function(r,t){return r+t},TQpmM:function(r,t){return r+t},lDTRq:function(r,t){return r>>t},bxUwy:function(r,t){return r>>t},bKVio:function(r,t){return r|t},JFJIe:function(r,t){return r&t},UZrnq:function(r,t){return r(t)},lfSYp:function(r,t){return r===t},uGwam:"gRioO",QgRfL:function(r,t){return r<=t},OhjTl:function(r,t){return r%t},sGmDb:function(r,t){return r|t},acJvM:function(r,t){return r/t},hATNY:function(r,t){return r>>>t},GxyFf:function(r,t){return r>>>t},RWZfo:function(r,t){return r+t},SuYVR:function(r,t,i,o){return r(t,i,o)},ZMraE:function(r,t){return r+t},kuQqr:n(1872),cPOjK:function(r,t){return r>>>t},qmrfh:function(r,t){return r&t},szYnb:function(r,t){return r+t},TRpDj:function(r,t){return r>>>t},jClmX:function(r,t){return r>>>t},zjuBC:function(r,t){return r+t},pCqdH:function(r,t){return r+t},JSBEp:function(r,t){return r<<t},juWvS:function(r,t){return r|t},RwwpH:function(r,t){return r!==t},RQlQS:function(r,t){return r===t},RvDmN:function(r,t){return r===t},HbIlp:function(r,t){return r===t},aBZSB:function(r,t){return r+t},aDCPz:function(r,t){return r&t},gCSQr:function(r,t){return r&t},eEDGe:function(r,t){return r>>>t},rZEwu:function(r,t){return r&t},SCJDb:function(r,t){return r>>>t},DdobQ:function(r,t){return r&t},jEEPd:function(r,t){return r&t},JdacS:function(r,t){return r>>>t},aFEwJ:function(r,t){return r&t},WcWCl:function(r,t){return r&t},suCeH:function(r,t){return r&t},MwUaa:function(r,t){return r&t},pGOWP:function(r,t){return r>>>t},QBjKk:function(r,t){return r>>>t},wfPMh:function(r,t){return r&t},smRuf:n(877)+n(1230),nlbkI:"NATIVE_E"+n(737),vLotX:"MESSAGE_ERROR",IHTrs:"MAX_RETR"+n(838)+"R",exjku:"OPEN_ERROR",EdExJ:n(901)+n(1932),aSiiU:n(1203),SAmXs:function(r,t){return r===t},NKmtK:n(1396),rmShs:n(583),ueSBl:n(1600)+"4",mKDLG:function(r,t){return r|t},lqLXS:function(r,t){return r<<t},vCuyX:function(r,t){return r&t},LvdmE:function(r,t){return r<t},pYQXg:n(1196),ecaMi:function(r,t,i){return r(t,i)},bisuH:function(r,t){return r>>>t},OUwUy:function(r,t){return r<<t},AkPHu:function(r,t){return r===t},JICwj:n(1183),EfvAf:n(1249),waDQl:function(r,t){return r(t)},hzosZ:n(1814),WTFOd:n(1131)+"e_timeout",UoeVA:function(r,t){return r!==t},DOJSg:"GDYQg",XClnM:n(1657),fjDRt:function(r,t){return r>=t},kMDyB:function(r,t){return r===t},Ehvzq:function(r,t){return r instanceof t},yIQQx:n(1380)+"d error.",inGhM:function(r,t){return r+t},VZIml:"Tqvia",HBLlJ:function(r,t,i){return r(t,i)},CHUIQ:function(r,t,i){return r(t,i)},nErMF:function(r,t,i){return r(t,i)},lXzDj:n(1436)+n(1524),yhKCs:function(r,t){return r===t},nXoef:n(1566),FAhbi:n(1108),RBgDA:n(1556),TKDPS:n(1616),VJVYP:function(r){return r()},KNTBK:function(r,t){return r(t)},KdsAx:n(1443),ZPKgA:"boe",olTVf:"ppe",CBkSK:function(r,t){return r===t},WOgfM:n(1991),ybhIB:n(1302),CGSua:n(1987),sKRpA:function(r,t){return r||t},MPudS:function(r,t){return r!=t},gXbfV:"undefined",fwfxj:function(r,t){return r+t},yZWhA:function(r,t){return r+t},ijdoB:function(r,t){return r+t},sRCeI:function(r,t){return r+t},HYvkq:function(r,t){return r+t},mIwpO:function(r,t){return r!==t},CNMEv:function(r,t){return r|t},PUMlQ:function(r,t){return r<<t},gNCak:function(r,t){return r|t},gCHGz:function(r,t){return r&t},lVcwv:function(r,t){return r<<t},SERDY:function(r,t){return r&t},Cxyen:function(r,t){return r>>t},ArGDr:function(r,t){return r<=t},nWKOg:n(541)+n(1008)+n(694)+n(522)+n(1016),efUgi:function(r,t){return r===t},KAvpJ:function(r,t){return r+t},ibFxq:n(1821),Kulnb:n(1317),sDwXj:function(r,t){return r(t)},rHfsf:n(1111),QRgTP:"pageshow",GofKL:"close, w"+n(1470)+n(1404),xKNQZ:n(1864)+n(835)+n(1571)+n(993)+"ed",Crthp:n(1759),zDdBl:n(1394),bqNYo:function(r,t){return r<t},yCnnS:function(r,t){return r===t},jkqVS:function(r,t){return r&t},LPyIn:function(r,t){return r===t},BeMxq:function(r,t){return r&t},gZERM:function(r,t){return r+t},nKSGY:function(r,t){return r!==t},uivMY:n(1081),dwSjD:function(r,t){return r<t},nLJQc:function(r,t){return r&t},ANoLj:function(r,t){return r&t},STINU:function(r,t){return r<t},BUWhN:function(r,t){return r&t},DKkCX:function(r,t){return r-t},HtGpX:function(r,t){return r|t},pBzwZ:function(r,t){return r|t},uHyLn:function(r,t){return r|t},pEJZC:function(r,t){return r&t},pFcyz:function(r,t){return r&t},RcwGa:function(r,t){return r>>t},iGLjP:function(r,t){return r instanceof t},rqrqk:n(1296)+n(758)+n(1563),nLitR:n(1270)+n(1140),nRJmA:"applicat"+n(1140)+n(1597)+"=utf-8",dwUKE:n(1884),llFHn:"none_none",HaQrH:"binary",ZVYvz:function(r,t,i,o){return r(t,i,o)},NrdgP:function(r,t){return r<t},CYZvD:n(1445),AQWbi:function(r,t){return r<t},IoZdv:function(r,t){return r<t},DgGsF:function(r,t){return r|t},gbtlC:function(r,t){return r===t},tJXzC:function(r,t){return r&t},feDwe:"4|5|3|1|"+n(1646),GLkxz:function(r,t){return r&t},PYYPu:function(r,t){return r|t},RwQZu:function(r,t){return r&t},GYIGp:function(r,t){return r+t},staDT:function(r,t){return r&t},cjmrH:function(r,t){return r>>t},ZhHBU:function(r,t){return r|t},rcExd:function(r,t){return r&t},hzDlC:function(r,t){return r-t},HEetp:function(r,t){return r(t)},AiPrN:function(r,t){return r<<t},EYXHZ:"YKNFo",pRiLq:"RLqfP",XxDWe:function(r,t){return r(t)},LSkYZ:function(r,t){return r instanceof t},kdxjM:n(674),oyHCt:function(r,t){return r!=t},ZhMpB:function(r,t){return r instanceof t},dKaAk:function(r,t){return r!=t},JogJa:function(r,t){return r!==t},aauIH:n(867),JlWiK:n(556)+"reason",GujaN:"text/jav"+n(1680),izTAp:"http",icIlG:"&jscallback=fron"+n(1936)+"P",fpyqc:function(r,t){return r(t)},huRTK:n(1615),OWZYQ:"NYOKA",uziRF:function(r,t){return r|t},NTmlZ:function(r,t){return r!==t},QFzPW:n(906),smEHu:function(r,t){return r>>>t},zFliv:function(r,t){return r>>>t},Nliqg:function(r,t){return r<<t},YZXwf:function(r,t){return r>>>t},zLdxI:function(r,t){return r===t},ZmWaf:function(r,t){return r<t},ZIAQA:function(r,t){return r<t},rfjso:function(r,t){return r<t},mGkSc:function(r,t){return r<t},XgzYi:function(r,t){return r&t},KkWyF:function(r,t){return r+t},vRwpi:function(r,t){return r!==t},oBKxQ:function(r,t){return r&t},bDDik:function(r,t){return r|t},FCswZ:function(r,t){return r>>>t},MEuJh:function(r,t){return r>>>t},bRbiW:function(r,t){return r|t},xGPtQ:function(r,t){return r+t},VfZZL:function(r,t){return r!==t},QwVGO:function(r,t){return r|t},okdTb:function(r,t){return r>>>t},fdCeb:function(r,t){return r!==t},UnHjf:function(r,t){return r|t},FfEYi:function(r,t){return r!==t},cRcTi:function(r,t){return r>>>t},lfYvr:function(r,t){return r|t},RMcQx:function(r,t){return r+t},ZNjNh:function(r){return r()},raxBm:function(r,t){return r!==t},hOEsW:n(557),OWDli:n(505),ttzth:function(r,t){return r(t)},fBaZx:function(r){return r()},CkimF:function(r,t){return r!==t},hHFvv:n(1281),XRorN:function(r,t){return r!==t},QWsJH:n(1330),CZqFz:function(r,t){return r+t},XDoLg:function(r,t){return r(t)},JqNUw:function(r,t){return r===t},jpATf:n(1352),ActtR:n(2003),JhWYK:n(507),JtjWI:function(r,t){return r||t},pUYrM:function(r,t){return r&t},CJBtU:function(r,t){return r!==t},ZxIAl:n(1892),MCwkW:function(r,t){return r<t},wpgAs:function(r,t){return r(t)},EtsHT:function(r,t){return r>t},EgFfA:function(r,t){return r+t},BuqZi:function(r,t){return r||t},wrlDZ:function(r,t){return r!==t},GmoMq:n(907),UzoGj:function(r,t){return r||t},DjlUw:function(r,t){return r|t},uAYEj:function(r,t){return r|t},aihqQ:function(r,t){return r<<t},DUUUJ:function(r,t){return r<<t},aPVIF:function(r,t){return r<<t},WkhKQ:function(r,t){return r|t},qyOtD:function(r,t){return r|t},uRhOD:function(r,t){return r<<t},OtpmS:n(580),PWmUa:function(r,t){return r||t},vIFTy:function(r,t){return r||t},epKgV:function(r,t){return r||t},ucoUk:function(r,t){return r!=t},EYemX:"eHWkn",coiFw:function(r,t,i){return r(t,i)},qxUoV:n(803),toRzs:"message_id",ptfsF:function(r,t,i){return r(t,i)},nvqEG:function(r,t){return r|t},GkMcn:function(r,t){return r<<t},mDtZO:function(r,t){return r<<t},nSCqz:function(r,t){return r<<t},RXZlE:function(r,t){return r&t},oFfGF:function(r,t){return r<t},pUBuK:function(r,t){return r>t},pbvMM:function(r,t){return r+t},OpaHA:function(r,t){return r&t},zoAQy:n(1534),MDrgo:function(r,t){return r(t)},Vzbix:function(r,t,i,o){return r(t,i,o)},CwYek:"x_fronti"+n(1784),tUroB:n(1329)+"er_qos_ack",lJcVd:n(1329)+n(1716)+"k",BWoSf:"x_fronti"+n(705)+n(807),UvBbm:function(r,t){return r instanceof t},kVeEp:"objectSt"+n(1160),oJONb:function(r,t){return r===t},pSAdF:n(1483),UyJHk:n(912),vACRw:"xkgFc",NvsDX:n(1137),fUxGw:function(r,t,i,o){return r(t,i,o)},YvSDu:"need_ack",WezNd:n(1945),yWUSZ:n(616),WtSwv:function(r,t){return r||t},cMvpj:n(1459),HzOxb:function(r,t){return r+t},HoiZJ:function(r,t){return r<<t},gsCZb:function(r,t){return r|t},QHERT:function(r,t){return r<<t},cpTYM:function(r,t){return r&t},XerRy:function(r,t){return r>=t},wvhzQ:"XNvzg",FmDgX:function(r){return r()},TUiUR:function(r,t){return r instanceof t},mFjCL:n(1322),Rstad:"cuUOI",YastS:function(r){return r()},WTClU:function(r,t){return r(t)},hKIFt:n(1041),vYDhp:function(r,t){return r&t},hqyYY:function(r,t){return r||t},RrCBc:function(r,t){return r>>>t},LILXK:function(r,t){return r(t)},lEPAk:function(r,t){return r+t},Tlykt:function(r,t){return r+t},uEGRy:n(1338)+n(2010)+n(636),tXRPl:function(r,t){return r>=t},upufL:function(r,t){return r+t},ugMWb:function(r,t){return r<t},JEhCq:n(2014)+"1",loXau:function(r,t){return r<t},vUXKV:function(r,t){return r+t},yARED:function(r,t,i,o){return r(t,i,o)},MuWiV:function(r,t){return r+t},BUrqm:function(r,t){return r+t},LZUQU:function(r,t){return r|t},wGnKk:function(r,t){return r+t},jPDSj:function(r,t){return r+t},wzghz:function(r,t){return r+t},Ywebr:function(r,t){return r|t},jbRjf:function(r,t){return r|t},aFWrU:function(r,t){return r+t},PkpFY:function(r,t){return r+t},RkZtq:function(r,t){return r<<t},bpmLW:function(r,t){return r+t},eGmZF:function(r,t){return r+t},NijyM:function(r,t){return r&t},OfcHX:function(r,t){return r>>>t},YRfSf:function(r,t){return r+t},WSNCr:function(r,t){return r&t},XTDqA:function(r,t){return r>>>t},JbgNd:function(r,t){return r+t},dwHev:function(r,t){return r&t},zMfYQ:function(r,t){return r+t},EiyNy:function(r,t){return r&t},evbrG:function(r,t){return r+t},atiAl:function(r,t){return r>>>t},ZyFXi:function(r,t){return r<t},ZeQmK:function(r,t){return r|t},YWarL:function(r,t){return r<<t},IPFXt:function(r,t){return r<t},Iukpe:function(r,t){return r<t},XUnQY:function(r,t){return r<t},btiEh:n(933)+n(939)+n(779),flUFo:"service",IcoSB:"name",Ybeao:n(1542),EnDKW:n(1411),KsoOk:n(1166),ZEKGU:function(r,t){return r(t)},rozOy:n(1331)+n(1332),llAvL:function(r,t){return r<t},xlryE:function(r,t,i){return r(t,i)},ZuxPZ:function(r,t,i){return r(t,i)},uDEQJ:function(r,t,i,o){return r(t,i,o)},vxWHY:function(r,t){return r+t},KyQee:function(r,t,i){return r(t,i)},HetJG:n(1156)+n(1115),VPaZy:"allCurso"+n(860),McpQT:n(1376),QnlVG:n(1832),zKeDL:function(r){return r()},etHHJ:function(r,t){return r!==t},Ndhxy:n(1740),DDxQn:n(1893),hdFED:n(1325),HoMqF:function(r,t){return r(t)},OYoTq:n(1870),eSYvB:n(897)+"r",WAuUh:function(r,t){return r!==t},wDUru:n(1038),KyBmj:function(r,t){return r||t},cSWtQ:function(r,t,i){return r(t,i)},fKBgZ:"code",tlewP:function(r,t,i){return r(t,i)},kmLTy:n(1329)+"er_msgid",LUhjl:function(r,t){return r(t)},cczYM:function(r,t,i){return r(t,i)},nHZLf:n(1800)+"s",OiBCn:n(1723)+n(1271)+"e",wQqxF:function(r){return r()},kHuvf:function(r,t){return r>t},ncgen:function(r,t){return r!==t},dUnlM:n(1186),hsajN:function(r){return r()},jyyok:function(r){return r()},QhjaK:function(r,t){return r===t},zwDbw:function(r,t){return r(t)},RsUGi:function(r){return r()},iIoeG:function(r){return r()},sGAlP:function(r){return r()},KsYtI:function(r,t){return r===t},tKYln:n(1773),XhDnJ:function(r,t,i){return r(t,i)},kllQR:function(r,t){return r===t},KJCAC:n(796),nmcoF:function(r,t){return r===t},pcDjm:n(1664),cGsyY:"auto",ZqcGN:n(1131)+n(1547)+"s",osgBG:"success",JaEpc:function(r,t,i,o){return r(t,i,o)},XrBFw:function(r,t){return r===t},PQFSz:n(1852),EPGXC:n(1930),mfNZZ:function(r,t){return r!==t},twylZ:function(r,t){return r!==t},xRDlj:n(1207),lKsiK:n(1614),MJlDh:function(r,t){return r(t)},SzPSW:function(r,t,i){return r(t,i)},CDSOU:function(r,t){return r!==t},fQffd:function(r,t,i){return r(t,i)},ukQVs:function(r,t,i){return r(t,i)},iSUKi:function(r,t){return r>t},MIgIA:n(1988)+"too large",hSRfy:function(r,t){return r>=t},QlgtX:n(1645)+n(1803),fjURi:n(703),enoYV:function(r,t){return r/t},JGFOy:function(r,t){return r===t},GDMii:n(823)+"rovide valid url",ccacP:function(r,t){return r(t)},oSzQS:n(823)+"rovide ws params"+n(1235)+n(950)+n(1315)+n(844)+n(1054),PRebP:"RWgzy",STpgi:n(1511)+"t",kalDl:n(909),jOfNU:n(1665),ySIQl:n(1865),JpxHY:n(1842),iRDKj:function(r,t){return r!==t},ZrnGc:function(r,t){return r==t},snLbL:n(1208),bwdYN:n(1507),nXBPx:n(1880),URpaK:n(570),hThTZ:n(1730)+"d",Niiry:n(823)+n(1508)+n(733)+"viceID o"+n(1887),ckpLW:"function",xjCLt:function(r){return r()},iiRsh:n(821),NKOvO:"fws_1.0.0",JIXld:n(873),KmxSA:function(r,t,i){return r(t,i)},CraGJ:"start",AqhOK:function(r,t,i){return r(t,i)},OvgDJ:function(r,t,i){return r(t,i)},vigIM:function(r,t){return r(t)},KZKak:function(r,t){return r(t)},Fscra:n(937)+">",HiAxt:function(r,t){return r!==t},ObrbE:n(1001)+"ay, try reconnec"+n(1850)+"ver",wbmCJ:n(811)+n(904)+n(1187)+"g",BfbBU:n(692)+"1",CwLAc:n(532)+"3",zXtsH:function(r,t){return r!==t},mXKdp:n(1990),eyMEM:n(1001)+"ay, netw"+n(1518)+n(2016),HuXUi:n(619),eAtGM:function(r,t){return r<<t},MIizG:function(r,t){return r(t)},kZHjT:function(r,t){return r<<t},yZoyC:n(1520),IzdNT:"xToSY",zNYDl:function(r,t,i){return r(t,i)},lOpJi:function(r,t){return r!==t},ZlHjh:n(1630),Rqkmt:n(1926),WpOZK:function(r,t){return r===t},dFkzM:n(823)+"rovide a"+n(992)+n(579)+n(786)+n(1240)+"ng or an"+n(1412)+n(1995),cdWZO:n(1182),uYZBn:function(r,t){return r(t)},PADxo:function(r,t){return r(t)},boncE:function(r,t){return r(t)},KuIAG:n(823)+n(1715)+n(1013)+"ervice",RyBay:function(r,t){return r instanceof t},yEmVH:function(r,t){return r(t)},dtEuG:n(1674),TyoUS:n(549),XkfzC:function(r,t){return r==t},XMrGI:"manual r"+n(947)+n(1985),UxxSj:function(r,t){return r(t)},XIIZz:function(r,t){return r>t},KjLlf:function(r,t){return r===t},qJsfX:n(1755),XJotR:n(1795),bsugE:function(r,t){return r*t},caTtb:function(r,t){return r/t},WDhOo:"Window",KSShN:function(r,t){return r===t},tGSKx:function(r,t){return r!=t},LjQHt:function(r,t){return r!=t},XkUDa:function(r,t){return r===t},WdeVd:n(617)+n(2006)+n(613)+"pe",EPeba:function(r,t){return r!=t},FEERI:n(990),gvvAw:function(r,t){return r!=t},gqKkp:function(r,t){return r!=t},NifQU:function(r,t){return r===t},HmhbZ:n(640)+n(1068)+n(1896),RwfMN:function(r,t){return r===t},eODvR:function(r,t){return r!=t},GuTiM:function(r,t){return r===t},KLCap:n(1027)+n(633)};Ee.r(Z),Ee.d(Z,{FWS:()=>t0,CustomErrorEvent:()=>mi,createCloseEvent:()=>pe,ReconnectEvent:()=>pi,createErrorEvent:()=>de,decodedFrame:()=>fi,createOpenEvent:()=>Si,CustomCloseEvent:()=>wi,createReconnectEvent:()=>ar,FrontierMessageEvent:()=>yi,encodeFrame:()=>or,createMessageEvent:()=>bi,OpenEvent:()=>vi,ErrorCode:()=>qe,Event:()=>it,MessageEvent:()=>_i});let s="";function a(r=""){let t=n;if(e[t(900)](e[t(2013)],e.fisUA))this[t(1078)]&&this[t(1078)][t(1400)](_0x435bbc),this[t(1572)](e.NTcfy,_0x2a4c2b);else{let o=""+Date.now(),u=s||(s=e.CiJhc(m,r)),h=Math[t(893)]()[t(1885)](16)[t(637)](-6);return e[t(1153)](e.SDGui("02"+o,u),h)}}function x(){let r=n;return e.FfAmT(e[r(1289)](1e4,Date[r(1772)]()),Math[r(760)](1e4*Math[r(893)]()))}function c(r){let t=n;return e[t(2033)](e.CiJhc(Array,8)[t(690)]("0"),e[t(1449)](parseInt,r,10)[t(1885)](2)).slice(-8)}function f(r){let t=n;return e[t(763)](Array(4).join("0"),e[t(606)](parseInt,r,2)[t(1885)](16)).slice(-4)}function l(r){let t=n,i=r[t(1769)](/\./).map(h=>c(h)),o=[];return o[0]=e[t(1973)](f,i[0]+i[1]),o[1]=e[t(1859)](f,e.cSvVB(i[2],i[3])),[e[t(1697)],e.anOqw,e[t(1697)],e[t(1697)],"0000",e[t(1907)],o[0],o[1]][t(690)]("")}function m(r){let t=n,i=/(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(1726)](r),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(1726)](r);return i?e[t(1029)](l,r):o?e[t(1029)](w,r):e.bKvTl}function w(r){let t=n,i={JEtmP:t(1763),qFqeT:t(780)};if(e[t(900)](e[t(1401)],t(1539)))this.on(_0x3ab7a5,_0x516f15);else{let o="",u=[],h=0,p=0,g=!0,d=e[t(1697)];if(e.kODjR(r.indexOf("::"),-1)){let y=r[t(1769)]("::");for(let A=0;e[t(766)](A,y.length);A++){if(e[t(634)](e.xvTWY,e[t(1102)]))return this[t(1136)+"ndpointTriesCount"]++,this[t(1780)+t(989)+"nt"]();{let L=y[A];if(e[t(638)](L.indexOf(":"),0)){let T=L[t(1769)](":");g&&(h=T[t(861)]),p+=T[t(861)];for(let O=0;e[t(517)](O,T[t(861)]);O++)if(e[t(2024)](4,T[O][t(861)]))if(e[t(1525)]!=="NPWUs"){let j=d.substring(0,e[t(1521)](4,T[O][t(861)])),xe=j[t(2028)](T[O]);u[t(1466)](xe)}else _0x2bedbb[t(1741)+t(1110)+"ner"](AtbdRZ.JEtmP,_0x4dc52e),_0x240428[t(1741)+t(1110)+"ner"](AtbdRZ.qFqeT,_0xba746e);else u[t(1466)](T[O]);g=!1}else if(e[t(1371)](e[t(2005)],e[t(2005)])){if(e[t(577)](_0x175aea,_0x52fdee))return _0x20f37c}else{if(e[t(2024)](4,L.length)){let T=d[t(1073)+"g"](0,e[t(1521)](4,L[t(861)])),O=T.concat(L);u[t(1466)](O)}else u[t(1466)](L);g&&(h+=1),p+=1,g=!1}}}let v="";for(let A=0;A<8-p;A++)v=v.concat(d);for(let A=0;A<u[t(861)];A++)A===h?(o=o[t(2028)](v),o=o[t(2028)](u[A])):o=o.concat(u[A]);return o}{let y=r.split(":");for(let v=0;e[t(517)](v,y[t(861)]);v++){let A=y[v];if(y[v][t(861)]!==4){let L=d[t(1073)+"g"](0,e.kbDdp(4,y[v][t(861)])),T=L[t(2028)](A);o=o[t(2028)](T)}else o=o[t(2028)](A)}return o}}}function b(r,t){let i=n;if(e.zFFtr(e.vaSok,"dzpmB")){let o=_0x257a97(_0x125bfb,_0x3060eb[i(861)]);_0x263d39[i(1830)][i(1746)](_0x48bf00,o)}else{let o=r.key;o!==void 0&&(V(t,10),e[i(1485)](ve,t,o));let u=r[i(1989)];e[i(1371)](void 0,u)&&(e.XDKBp(e[i(910)],e[i(910)])?_0x3de42b[i(1159)]()[i(1475)](()=>{let h=i;this[h(1933)+h(1392)]()}):(e[i(1783)](V,t,18),e[i(1485)](ve,t,u)))}}function _(r){let t=n,i={};e:for(;!e[t(1960)](De,r);){let o=K(r);switch(e[t(1362)](o,3)){case 0:break e;case 1:i.key=e.WHstf(ye,r,e.PTsAD(K,r));break;case 2:i.value=e[t(1210)](ye,r,e.tzLst(K,r));break;default:e[t(1406)](ie,r,e[t(592)](7,o))}}if(e[t(1594)](void 0,i[t(795)]))throw new Error("Missing "+t(1924)+" field: "+t(795));if(e[t(900)](void 0,i[t(1989)]))throw new Error(e[t(1705)]);return i}function S(r){let t=e.mMXoD(ae);return k(r,t),e.CiJhc(J,t)}function k(r,t){let i=n,o=r[i(731)];e.oNsgH(void 0,o)&&(e[i(588)](V,t,8),e[i(1162)](Et,t,o));let u=r.LogID;u!==void 0&&(e[i(588)](V,t,16),e[i(1408)](Et,t,u));let h=r[i(1801)];e[i(1348)](void 0,h)&&(V(t,24),e[i(1543)](Et,t,e.SFKlC(Q,h)));let p=r[i(1781)];p!==void 0&&(e[i(1908)](V,t,32),Et(t,e[i(916)](Q,p)));let g=r.headers;if(e.gDcdl(void 0,g))for(let j of g){e.EqunA(V,t,42);let xe=e[i(1811)](ae);e[i(1783)](b,j,xe),e.uYPYl(V,t,xe[i(1712)]),e[i(1862)](Vt,t,xe),e[i(1981)](D,xe)}let d=r[i(730)+i(824)];d!==void 0&&(V(t,50),e.FpaJN(ve,t,d));let y=r[i(1788)+i(647)];e.oNsgH(void 0,y)&&(e[i(1679)](V,t,58),e.zVEUw(ve,t,y));let v=r.payload;e[i(1348)](void 0,v)&&(e[i(1485)](V,t,66),V(t,v[i(861)]),e[i(1306)](Jt,t,v));let A=r[i(913)];if(e[i(1003)](void 0,A))if(e[i(1167)](i(1873),e[i(1164)])){let j=0,xe=0,at;do at=e.cdwbf(_0x2bdfc8,_0x380743),j<32&&(xe|=e[i(1180)](127,at)<<j),j+=7;while(128&at);return xe}else e.XtpXS(V,t,74),e[i(1424)](ve,t,A);let L=r[i(1198)+"ming"];e[i(1690)](void 0,L)&&(e[i(1485)](V,t,82),e[i(588)](ve,t,L));let T=r.msgID;e[i(1371)](void 0,T)&&(e[i(1406)](V,t,90),e.fLpgh(ve,t,T));let O=r[i(1309)+"e"];e.YgJMH(void 0,O)&&(e[i(1846)](V,t,96),e[i(1783)](Et,t,e[i(1859)](Q,O)))}function P(r){let t=n;if(e.VqvUU(e[t(1496)],e[t(753)]))return e[t(916)](I,e[t(562)](q,r));this[t(1031)]&&this[t(1031)][t(1203)]({code:_0x3db914,reason:_0x41f1ed})}function I(r){let t=n,i={};e:for(;!e[t(1964)](De,r);){let o=e[t(1455)](K,r);switch(e[t(1362)](o,3)){case 0:break e;case 1:i.SeqID=e.FpaJN(ke,r,!0);break;case 2:i[t(1231)]=e.vtQZy(ke,r,!0);break;case 3:i[t(1801)]=e[t(752)](K,r);break;case 4:i[t(1781)]=e[t(916)](K,r);break;case 5:{let u=e[t(981)](z,r);(i[t(1786)]||(i[t(1786)]=[]))[t(1466)](e[t(1701)](_,r)),r[t(1712)]=u;break}case 6:i["payloadE"+t(824)]=ye(r,e[t(981)](K,r));break;case 7:i["payloadT"+t(647)]=e[t(1246)](ye,r,K(r));break;case 8:i[t(1422)]=St(r,e[t(1969)](K,r));break;case 9:i.LogIDNew=e.uYPYl(ye,r,e[t(1455)](K,r));break;case 10:i[t(1198)+"ming"]=e.ROUSU(ye,r,K(r));break;case 11:i[t(1358)]=e[t(1255)](ye,r,e[t(595)](K,r));break;case 12:i[t(1309)+"e"]=e[t(605)](K,r);break;default:e[t(966)](ie,r,7&o)}}if(i.SeqID===void 0)throw new Error(e[t(1912)]);if(e.sVbIn(void 0,i[t(1231)]))throw new Error(e[t(889)]);if(e[t(1345)](void 0,i[t(1801)]))throw new Error(e.TUXaG);if(e[t(2018)](void 0,i[t(1781)]))throw new Error(t(1702)+"required"+t(1421)+"method");return i}function z(r){let t=n,i=e[t(1964)](K,r),o=r[t(1712)];return r[t(1712)]=e.SDGui(r[t(693)],i),o}function ie(r,t){let i=n;switch(t){case 0:for(;e[i(1180)](128,se(r)););break;case 2:ee(r,e[i(707)](K,r));break;case 5:e[i(607)](ee,r,4);break;case 1:e[i(1162)](ee,r,8);break;default:throw new Error(e[i(1581)](e[i(664)],t))}}function Q(r){return r|=0,{low:r,high:e.tilrF(r,31),unsigned:e.gNAhz(r,0)}}let _e=[];function ae(){let r=n;if(e[r(900)](e[r(1625)],e[r(1625)])){let t=_e[r(1619)]();return t?(t[r(693)]=t[r(1712)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}else{if(!this[r(1078)])return;this[r(1078)][r(1741)+r(1110)+r(1465)](e[r(1481)],this[r(1644)]),this[r(1078)][r(1741)+r(1110)+r(1465)]("close",this[r(1009)]),this[r(1078)][r(1741)+r(1110)+r(1465)](e[r(1018)],this[r(1929)+"ge"]),this[r(1078)][r(1741)+r(1110)+r(1465)](e.XRtwJ,this[r(848)])}}function D(r){_e[n(1466)](r)}function q(r){return{bytes:r,offset:0,limit:r.length}}function J(r){let t=n,i=r[t(1830)],o=r[t(1712)];return e[t(2018)](i[t(861)],o)?i:i[t(879)](0,o)}function ee(r,t){let i=n;if(e[i(1070)](e[i(763)](r[i(693)],t),r[i(1712)]))throw new Error(e.FZebK);r[i(693)]+=t}function De(r){let t=n;return e[t(1228)](r[t(693)],r[t(1712)])}function ge(r,t){let i=n,o=r.bytes,u=r[i(693)],h=r[i(1712)],p=e.jNpei(u,t);if(e[i(1592)](p,o[i(861)])){let g=new Uint8Array(e[i(738)](2,p));g.set(o),r[i(1830)]=g}return r.offset=p,p>h&&(r[i(1712)]=p),u}function Je(r,t){let i=n,o=r[i(693)];if(e[i(1484)](o,t)>r[i(1712)])throw new Error("Read past limit");return r.offset+=t,o}function St(r,t){let i=n,o=e[i(1560)](Je,r,t);return r[i(1830)][i(879)](o,e[i(1484)](o,t))}function Jt(r,t){let i=n,o=e[i(1783)](ge,r,t[i(861)]);r.bytes[i(1746)](t,o)}function ye(r,t){let i=n,o=Je(r,t),u=String.fromCharCode,h=r[i(1830)],p="\uFFFD",g="";for(let d=0;e[i(1379)](d,t);d++){let y=h[d+o],v,A,L,T;e.HSRlp(128,y)===0?g+=u(y):e.EUCBF(e[i(956)](224,y),192)?e[i(1779)](d+1,t)?g+=p:(v=h[e.SDGui(e[i(1153)](d,o),1)],e.zFFtr(e[i(1717)](192,v),128)?g+=p:(T=e[i(1458)](e[i(1735)](31&y,6),e[i(1180)](63,v)),e[i(517)](T,128)?g+=p:(g+=e.pGqMR(u,T),d++))):(240&y)==224?e[i(1308)](d+2,t)?g+=p:(v=h[e[i(1609)](d,o)+1],A=h[e[i(1831)](d+o,2)],e.HsvYu(e[i(622)](e[i(1458)](v,A<<8),49344),32896)?g+=p:(T=e[i(1374)](e[i(1798)](e.fuBVu(15,y),12),e[i(1610)](e.wAoQI(63,v),6))|63&A,e[i(1379)](T,2048)||e[i(577)](T,55296)&&e[i(572)](T,57343)?g+=p:(g+=u(T),d+=2))):e[i(1584)](e[i(1717)](248,y),240)?e.XvHQu(e.ZafrF(d,3),t)?g+=p:(v=h[e.dDQld(d,o)+1],A=h[e[i(1678)](e[i(1570)](d,o),2)],L=h[e[i(1609)](d+o,3)],e.HSRlp(e[i(1857)](v|e.auARm(A,8),e[i(1798)](L,16)),12632256)!==8421504?g+=p:(T=e[i(1374)](e[i(1185)](e[i(704)](e[i(540)](7,y)<<18,e[i(1486)](63&v,12)),e[i(1170)](e[i(1899)](63,A),6)),63&L),T<65536||e[i(1592)](T,1114111)?g+=p:(T-=65536,g+=e.YQwDC(u,e[i(1831)](e[i(518)](T,10),55296),e[i(1609)](1023&T,56320)),d+=3))):g+=p}return g}function ve(r,t){let i=n,o={kTjZB:function(d,y){return e[N(1898)](d,y)},gqVvF:function(d,y){return e[N(1500)](d,y)},xIGsY:function(d,y){return e[N(1173)](d,y)}},u=t[i(861)],h=0;for(let d=0;e[i(517)](d,u);d++){let y=t[i(1028)+"At"](d);y>=55296&&e[i(1058)](y,56319)&&e[i(652)](e[i(560)](d,1),u)&&(y=e[i(772)](e[i(544)](e[i(1486)](y,10),t.charCodeAt(++d)),56613888)),h+=e.YPdZv(y,128)?1:e[i(652)](y,2048)?2:e[i(1200)](y,65536)?3:4}e[i(1862)](V,r,h);let p=ge(r,h),g=r[i(1830)];for(let d=0;e.sTLMj(d,u);d++)if(e[i(2018)](e[i(1807)],i(1098))){let y=t.charCodeAt(d);e.vfuHy(y,55296)&&e[i(658)](y,56319)&&e[i(544)](d,1)<u&&(y=e.vNhDn(e[i(749)](y,10),t.charCodeAt(++d))-56613888),e[i(1429)](y,128)?g[p++]=y:(e[i(584)](y,2048)?g[p++]=e[i(1857)](e.NUGkf(y>>6,31),192):(e[i(1200)](y,65536)?g[p++]=e[i(1185)](e[i(1667)](e.tilrF(y,12),15),224):(g[p++]=e[i(1857)](e[i(1513)](e[i(518)](y,18),7),240),g[p++]=e.dwKFh(e.fuBVu(e[i(518)](y,12),63),128)),g[p++]=e.pNftm(e.AhLTn(y,6)&63,128)),g[p++]=e[i(1899)](63,y)|128)}else{let y=0,v={};for(let A=0;o[i(1666)](A,_0x865270[i(861)]);A++)v[_0xdb4475[A][i(1156)+i(1115)]]=o[i(627)](_0x5b2afb,_0x39e235[A][i(1156)+"ame"]),y+=o.xIGsY(14,v[_0x4c21e4[A]["cursor_n"+i(1115)]]);return[y,v]}}function Vt(r,t){let i=n,o={Mztwm:function(u,h){return u<h},EjILG:function(u,h){return e.jdKhI(u,h)},jVpVr:function(u,h){return u(h)},CCAiq:function(u,h){return u+h},ONnQC:function(u,h){return u(h)},pbRFM:function(u,h){return e.wAoQI(u,h)},ObFbo:function(u,h){return e.pNftm(u,h)}};if(e.oNsgH(e[i(945)],e[i(1952)])){let u=e.vtQZy(ge,r,t[i(1712)]),h=r[i(1830)],p=t[i(1830)];for(let g=0,d=t[i(1712)];e.xAhuC(g,d);g++)h[e[i(1042)](g,u)]=p[g]}else{if(o[i(1709)](_0x21f4eb,1)||o[i(1613)](_0x1509ce,_0x193146))return o[i(1528)](_0x93a3ca,_0xc7a96);o[i(508)](_0x40fd35,_0x2482b7)>_0x12fa19&&(_0x184cf9=o[i(1660)](_0x19cea5,_0x43f675),_0x47c3e4=0);let u=_0x1445f9[i(1894)](_0xb7d28d,_0x48ddda,_0x51c247+=_0x21c294);return o[i(671)](7,_0x1e31ec)&&(_0x3a372d=o[i(915)](7,_0x10d73b)+1),u}}function se(r){let t=n;return e[t(1489)](t(1858),t(1858))?_0x195fcb[t(1159)]():r[t(1830)][e[t(1101)](Je,r,1)]}function Yt(r,t){let i=n,o=e[i(1575)](ge,r,1);r[i(1830)][o]=t}function K(r){let t=n,i=0,o=0,u;do u=e.CiJhc(se,r),e[t(1898)](i,32)&&(o|=e[t(1486)](e[t(1180)](127,u),i)),i+=7;while(e[t(1667)](128,u));return o}function V(r,t){let i=n;for(t>>>=0;e[i(1648)](t,128);)Yt(r,e[i(1834)](127,t)|128),t>>>=7;e.gfCtV(Yt,r,t)}function ke(r,t){let i=n,o={oyFym:function(d,y){return e[N(1891)](d,y)}},u=0,h=0,p=0,g;if(g=se(r),u=e.fuBVu(127,g),e[i(956)](128,g)&&(g=e[i(1455)](se,r),u|=e[i(592)](127,g)<<7,e[i(1149)](128,g)&&(g=se(r),u|=e[i(749)](e.foiQe(127,g),14),e[i(1184)](128,g))))if(e[i(2018)](e[i(1353)],"GZtIw")){if(g=e[i(1500)](se,r),u|=e[i(749)](127&g,21),e[i(592)](128,g)&&(g=se(r),h=e[i(1513)](127,g),e.yoaQt(128,g)&&(g=e[i(1859)](se,r),h|=e[i(1718)](e[i(1844)](127,g),7),e[i(1047)](128,g)&&(g=se(r),h|=e.EpWsV(e[i(552)](127,g),14),e[i(1882)](128,g)&&(g=e[i(1455)](se,r),h|=e.jISKP(e[i(1867)](127,g),21),e.Rihxp(128,g)&&(g=e[i(1455)](se,r),p=e[i(1978)](127,g),e[i(540)](128,g))))))){if(e[i(1474)](e[i(1833)],e[i(1177)]))return e[i(1688)](_0x571483,_0x45190a)?_0x1fd367.reject(new _0x4d812f(i(541)+"alled mu"+i(694)+"imes in process")):(_0x2f6ff1=_0x551692,e[i(813)](_0x3c089e,_0x1d0a82[i(861)])?_0x5545f7.resolve():_0x51fca4[_0x3490af].bind(_0x173fe7)(_0x595ee9,_0x1b9e7c[i(1917)](null,e[i(560)](_0x292b3d,1))));g=se(r),p|=e.FtMqN(127,g)<<7}}else{let d=_0x21e5d5.substring(0,Pcafbp.oyFym(4,_0x50388a[_0x2e7fd6][i(861)])),y=d[i(2028)](_0x2f0565);_0x50688e=_0x9b81a4[i(2028)](y)}return{low:e[i(704)](u,e.AQrRc(h,28)),high:e[i(1579)](h,4)|e[i(978)](p,24),unsigned:t}}function Et(r,t){let i=n,o=e[i(1579)](t[i(1956)],0),u=e[i(1579)](e[i(1374)](e.sPJWp(t.low,28),e[i(1341)](t[i(1856)],4)),0),h=e.giBox(t.high,24),p=h===0?u===0?o<16384?e[i(573)](o,128)?1:2:e[i(1379)](o,2097152)?3:4:e.ELMAs(u,16384)?u<128?5:6:e[i(573)](u,2097152)?7:8:e.xlkpO(h,128)?9:10,g=ge(r,p),d=r.bytes;switch(p){case 10:d[g+9]=e[i(1180)](h>>>7,1);case 9:d[e[i(1389)](g,8)]=p!==9?e[i(624)](128,h):127&h;case 8:d[g+7]=e[i(2024)](8,p)?e[i(624)](u>>>21,128):u>>>21&127;case 7:d[e.cVWsm(g,6)]=p!==7?e[i(1227)](e[i(684)](u,14),128):e.giBox(u,14)&127;case 6:d[g+5]=p!==6?e[i(1458)](e[i(1362)](u,7),128):e[i(716)](u,7)&127;case 5:d[e[i(1609)](g,4)]=e[i(1243)](5,p)?e[i(1061)](128,u):e.HSRlp(127,u);case 4:d[e.cVWsm(g,3)]=e[i(1676)](4,p)?e[i(506)](e[i(1362)](o,21),128):e[i(501)](o>>>21,127);case 3:d[e[i(929)](g,2)]=e[i(1167)](3,p)?e[i(2007)](e[i(1579)](o,14),128):e[i(1184)](e.XhUXA(o,14),127);case 2:d[e.Rbmtx(g,1)]=e[i(1676)](2,p)?e.pNftm(e[i(908)](o,7),128):e[i(1596)](o,7)&127;case 1:d[g]=p!==1?128|o:e[i(552)](127,o)}}function fi(r){let t=n;if(e[t(1454)](e[t(827)],t(1375))){let i=new _0x1dcf4c(e[t(1185)](e[t(506)](e.dIVzD(e[t(1212)](_0x1dd8d7[e.sEnJY(_0x5de990,4)],24),_0x2a8c5a[e.TapQe(_0x4e909d,5)]<<16),_0x1800e6[e[t(1633)](_0x26a4b8,6)]<<8),_0x2dcedc[e[t(748)](_0x548ceb,7)]),e[t(514)](e.ldhJM(e[t(1327)](_0x2aee7e[e.XCfTY(_0x10f80d,0)]<<24,e[t(749)](_0x1f72a2[_0xc84f4e+1],16)),_0x256c1c[e[t(1831)](_0x4e37e8,2)]<<8),_0x26e85b[e.FfAmT(_0x827284,3)]),!0);return _0x12baa5+=8,{value:i,offset:_0x30b6dd+8}}else return e[t(1981)](P,r)}function or(r){return S(r)}let di=65536,da=e[n(1918)],rt=e[n(1289)](di,di),li=e[n(1770)](rt,rt),hi=e.caTtb(li,2),ze=String[n(2032)+"e"][n(1028)+"At"];class M{constructor(t,i,o){let u=n,h={vPsnB:function(p,g,d){return e[N(1783)](p,g,d)},FTtsF:function(p,g){return e[N(847)](p,g)}};e[u(1802)](u(1650),e.UTEnk)?(this[u(1608)]=!0,this[u(1956)]=e[u(1698)](0,t),this[u(1856)]=e[u(847)](0,i),this[u(1453)]=!!o):(hdzQZY[u(1909)](_0x510fe9,_0x1ff262,hdzQZY.FTtsF(127&_0x33e512,128)),_0x53c03e>>>=7)}static[n(1608)](t){return t&&e[n(1685)](!0,t.isLong)}static[n(1747)](t,i,o){return new M(t,i,o)}static[n(775)+"s"](t,i,o){let u=n;return o?M[u(775)+u(1347)](t,i):M[u(775)+u(513)](t,i)}static[n(775)+n(1347)](t,i){let o=n;return new M(e.jvwev(e[o(1653)](e[o(1265)](t[0],e.UWPgH(t[1],8)),e.RmJLB(t[2],16)),e[o(1911)](t[3],24)),e[o(1695)](e[o(1193)](e[o(514)](t[4],e[o(1170)](t[5],8)),e[o(1529)](t[6],16)),e[o(555)](t[7],24)),i)}static[n(775)+n(513)](t,i){let o=n;return new M(e[o(1552)](e[o(1193)](e.auARm(t[4],24)|e.tzKcW(t[5],16),e[o(1798)](t[6],8)),t[7]),e[o(1193)](e[o(632)](e[o(750)](t[0]<<24,e[o(1341)](t[1],16)),t[2]<<8),t[3]),i)}static[n(1530)](t){let i=n;return e[i(1951)](t,da)?gi:new M(e.TiLPY(e[i(1327)](e[i(810)](e[i(1552)](ze[i(1894)](t,0),ze[i(1894)](t,1)<<8),e[i(896)](ze.call(t,2),16)),ze[i(1894)](t,3)<<24),0),e.giBox(e[i(667)](e[i(1857)](ze.call(t,4),e.MGqiQ(ze[i(1894)](t,5),8))|e[i(1686)](ze[i(1894)](t,6),16),e[i(1486)](ze[i(1894)](t,7),24)),0),!0)}[n(1205)](){let t=n;return String["fromChar"+t(1072)](e[t(1184)](255,this[t(1956)]),e[t(2037)](this.low,8)&255,e[t(1460)](e[t(716)](this[t(1956)],16),255),e[t(1239)](this[t(1956)],24),255&this[t(1856)],e.iBTiT(this[t(1856)]>>>8,255),e[t(1149)](e[t(2037)](this[t(1856)],16),255),this.high>>>24)}static fromNumber(t,i=!0){let o=n;if(e[o(566)](isNaN,t))return i?la:gi;if(i){if(t>=li)return ga}else if(e.lfSYp(o(1288),e[o(1663)])){if(e.QgRfL(t,-hi))return pa;if(e[o(1779)](e[o(763)](t,1),hi))return ha}else _0x48f30c=_0x4402cb[o(1028)+"At"](_0x36627d),e.SvaAo(_0x28b5f5,128)?_0x45ee92[_0x1282f4++]=_0x1bf7e6:e.ijRWv(_0x4f56f5,2048)?(_0x52581e[_0x585cae++]=e.EKHze(e[o(1344)](_0x5776e3,6),192),_0x28bb23[_0x14ee9b++]=e.cUhYH(e[o(1513)](63,_0x53cb96),128)):e[o(2018)](e[o(1863)](64512,_0x3ffd72),55296)&&e[o(1685)](e[o(1218)](64512,_0x70c58e=_0xffe459[o(1028)+"At"](_0x3e5455+1)),56320)?(_0x530c3d=e[o(1826)](e[o(1751)](65536,e.fnzCY(e[o(1717)](1023,_0x3bdd44),10)),1023&_0x99cabf),++_0x577a45,_0x411cb5[_0x34a6df++]=e.lDTRq(_0x184c69,18)|240,_0x49e0ca[_0x16f464++]=e.bxUwy(_0x5be72b,12)&63|128,_0x11aa96[_0x55b7a0++]=e[o(750)](e[o(1978)](_0x133ec1>>6,63),128),_0x452eea[_0x13c8e4++]=e[o(1227)](e.DFJxa(63,_0xa6b2d7),128)):(_0x52897f[_0x1b6701++]=e[o(836)](e[o(1889)](_0x436efc,12),224),_0x34dad5[_0x49f991++]=e[o(1265)](e[o(622)](_0x4217b0>>6,63),128),_0xb9ab5d[_0x40e3a1++]=e[o(1552)](e[o(1742)](63,_0x2e9107),128));return M[o(1747)](e[o(514)](e[o(1388)](t,rt),0),e[o(672)](e[o(1691)](t,rt),0),i)}[n(661)](){let t=n;return this[t(1453)]?e[t(1042)](e[t(738)](e[t(1403)](this.high,0),rt),e[t(1174)](this[t(1956)],0)):e[t(1564)](this[t(1856)]*rt,this[t(1956)]>>>0)}[n(1120)](){let t=n;return e[t(1345)](0,this[t(1856)])&&e[t(1802)](0,this[t(1956)])}add(t){let i=n,o={kZKtb:function(u,h){return u&h},JcUOh:function(u,h,p,g){return e.SuYVR(u,h,p,g)},jvkSF:function(u,h){return e.ZMraE(u,h)}};if(e.kuQqr!=="iYVoV"){let u=o[i(1135)](255,_0x52cf70);o.JcUOh(_0x164dd0,u,_0x3d6c70,o[i(1774)](_0xf0bfd9,_0x137ee7)),_0x15ac2f>>>=8,_0x318563--}else{M[i(1608)](t)||(t=M[i(1903)+"er"](t));let u=e[i(1948)](this[i(1856)],16),h=e.Mlrlh(65535,this.high),p=e[i(1403)](this[i(1956)],16),g=65535&this.low,d=t[i(1856)]>>>16,y=e[i(1910)](65535,t[i(1856)]),v=e.XhUXA(t[i(1956)],16),A=e[i(1717)](65535,t.low),L=0,T=0,O=0,j=0;return j+=e[i(1962)](g,A),O+=e[i(1248)](j,16),j&=65535,O+=e.ZMraE(p,v),T+=e[i(597)](O,16),O&=65535,T+=e[i(1456)](h,y),L+=T>>>16,T&=65535,L+=e[i(1293)](u,d),L&=65535,M.fromBits(e[i(847)](e.JSBEp(O,16),j),e[i(1124)](e[i(1798)](L,16),T),this[i(1453)])}}equals(t){let i=n;return M[i(1608)](t)||(t=M.fromNumber(t)),e[i(871)](this[i(1453)],t[i(1453)])&&e.VJLhI(this[i(1856)]>>>31,1)&&e[i(567)](t[i(1856)]>>>31,1)?!1:e[i(841)](this[i(1856)],t[i(1856)])&&e[i(582)](this[i(1956)],t.low)}[n(756)](){let t=n;return this[t(1956)]===-1&&this.high===-1?M[t(1747)](0,0,this[t(1453)]):this.low===-1?M[t(1747)](0,this[t(1856)]+1,this[t(1453)]):M[t(1747)](e.aBZSB(this[t(1956)],1),this.high,this[t(1453)])}[n(691)](t){return t?this[n(1319)+"E"]():this.toBytesBE()}[n(1319)+"E"](){let t=n,i=this[t(1856)],o=this[t(1956)];return[e[t(1959)](255,o),e[t(1775)](e.eEDGe(o,8),255),e[t(1259)](o>>>16,255),e[t(1057)](o,24),e[t(1700)](255,i),e.jEEPd(e.JdacS(i,8),255),e[t(874)](i>>>16,255),e[t(1248)](i,24)]}[n(709)+"E"](){let t=n,i=this[t(1856)],o=this.low;return[e.giBox(i,24),e[t(689)](e[t(1641)](i,16),255),e[t(611)](e[t(1057)](i,8),255),e[t(1320)](255,i),e[t(509)](o,24),e.WcWCl(e[t(646)](o,16),255),e[t(1916)](o>>>8,255),255&o]}}let gi=new M(0,0,!1),la=new M(0,0,!0),ha=M[n(1747)](-1,2147483647,!1),ga=M[n(1747)](-1,-1,!0),pa=M.fromBits(0,-2147483648,!1);var qe=(function(r){let t=n,i=e.smRuf[t(1769)]("|"),o=0;for(;;){switch(i[o++]){case"0":r[r[t(1713)+"RROR"]=5001]=e[t(1900)];continue;case"1":r[r[e[t(626)]]=5004]=e[t(626)];continue;case"2":r[r[e[t(1433)]]=5003]=e[t(1433)];continue;case"3":r[r[e[t(714)]]=5005]=e.exjku;continue;case"4":return r;case"5":r[r[e.EdExJ]=5002]=e.EdExJ;continue}break}})({});class it{constructor(t){let i=n;this.type=t,this[i(603)]=null}}class pi extends it{constructor(t,i){let o=n;super(t),this[o(1444)]=i&&i[o(1444)]||null}}class mi extends it{constructor(t,i){let o=n,u={sglNm:function(h,p,g){return e.iNuwQ(h,p,g)},iCYOb:e[o(863)]};if(e.SAmXs(e.NKmtK,e[o(604)])){if(this[o(1263)+"tManager"]?.["checkRea"+o(1377)+"es"]()){let p=this[o(1263)+o(759)]?.[o(1780)+"ntEndpoint"]();this[o(851)+o(1578)+o(2001)](u[o(1835)](_0x762394,u[o(1693)],{code:1006,reason:o(1598)+p+(o(817)+o(2004)+o(1407)+o(1363)),wasClean:!0}))}else{let p=this[o(1447)][o(1511)+o(1393)+o(814)](_0x269bd5,_0x50cb2a);this["_dispatc"+o(1578)+"ent"](u[o(1835)](_0x5efb53,u[o(1693)],{code:_0x51e842,reason:_0x2fd6fd,wasClean:!0,willReconnect:p})),p&&this._connect()}return}else super(t),this[o(780)]=i&&i[o(780)]||null,this[o(1242)]=i&&i[o(1242)]||0,this.filename=i&&i[o(1550)]||"",this[o(1983)]=i&&i[o(1983)]||0,this[o(1444)]=i&&i[o(1444)]||"",this.code=i&&i[o(2017)]||5001}}class wi extends it{constructor(t,i){let o=n,u=e[o(761)][o(1769)]("|"),h=0;for(;;){switch(u[h++]){case"0":this[o(1090)]=i&&i[o(1090)]||"";continue;case"1":super(t);continue;case"2":this[o(697)]=i&&i[o(697)]||!1;continue;case"3":this.code=i&&i[o(2017)]||0;continue;case"4":this["willReco"+o(1752)]=i&&i.willReconnect||!1;continue}break}}}class _i extends it{constructor(t,i){let o=n;o(535)===e[o(587)]?(_0x290a1f=e[o(1812)](e[o(1148)](e[o(1728)](31,_0x76f823),6),e.wAoQI(63,_0xca1a4d)),e[o(1398)](_0x107b44,128)?_0x5e1b48+=_0x52efd2:(_0x5cf4de+=e.ZXwpl(_0x309633,_0x396858),_0x384d98++)):(super(t),this[o(955)]=i&&i.data||null)}}class yi extends _i{constructor(t,i){let o=n;super(t),this[o(955)]=i&&i[o(955)]||null,this.message=i&&i[o(1444)]||null}}class vi extends it{constructor(t,i){let o=n;super(t),this.data=i&&i[o(955)]||null}}function de(r,{message:t,code:i,error:o}){return new mi(r,{message:t,code:i,error:o})}function pe(r,{code:t,reason:i,wasClean:o,willReconnect:u}){return new wi(r,{code:t,reason:i,wasClean:o,willReconnect:u})}function bi(r,{data:t,message:i}){return new yi(r,{data:t,message:i})}function Si(r,{data:t}){return new vi(r,{data:t})}function ar(r,{message:t}){return new pi(r,{message:t})}class Ei{constructor(t,i){let o=n,u={qBNAv:function(h,p,g){return e[N(1557)](h,p,g)},QidXe:function(h,p){return e[N(608)](h,p)},syiKn:function(h,p){return e[N(1084)](h,p)}};if(e[o(764)](e.JICwj,e[o(816)])){let{value:h,offset:p}=u[o(999)](_0x4ac7ae,_0x1ed467,_0x56767b);_0x4c7814=p,_0xfd5f5e=u[o(601)](u.syiKn(_0x3406f6,8),0),_0x399cff+=h}else this.endpoints=t,this.maxRetries=i,this[o(921)+o(1283)]=0,this[o(1136)+o(1939)+o(1126)+"t"]=0}[n(1188)+n(862)+n(1290)](){let t=n;this[t(921)+"ndex"]=0,this[t(1136)+t(1939)+t(1126)+"t"]=0}[n(1085)+"es"](){let t=n;this[t(1136)+t(1939)+t(1126)+"t"]=0}["getCurre"+n(989)+"nt"](){let t=n;if(e.UoeVA(e[t(718)],e[t(1077)]))return this[t(1955)+"s"][this[t(921)+t(1283)]];e.waDQl(_0x48478c,e[t(680)]),this[t(1683)](t(1131)+t(1547)+"s",_0x50ee38),this[t(1683)](e.WTFOd,_0xa985a0)}[n(1780)+n(989)+n(660)+"ount"](){let t=n;return this[t(1136)+"ndpointT"+t(1126)+"t"]}[n(1739)+n(1377)+"es"](){let t=n;return!!(e.fjDRt(this["currentI"+t(1283)],this.endpoints.length)||e[t(967)](this[t(921)+t(1283)],e[t(1992)](this.endpoints[t(861)],1))&&e.kMDyB(this[t(1136)+t(1939)+t(1126)+"t"],this[t(784)+"es"]))}["checkCur"+n(533)+n(1876)+n(1928)+"tries"](){let t=n;return this[t(921)+t(1283)]==this[t(1955)+"s"][t(861)]?!0:e[t(638)](this[t(1136)+"ndpointT"+t(1126)+"t"],this[t(784)+"es"])}["replaceB"+n(1622)+"pointAndUpdateCount"](){let t=n;return this[t(1136)+t(1939)+t(1126)+"t"]=1,this[t(921)+t(1283)]++,this[t(1955)+"s"][this[t(921)+t(1283)]]}[n(1780)+"ntEndpoi"+n(1053)+n(542)](){let t=n;return this[t(1136)+t(1939)+"riesCount"]++,this[t(1780)+"ntEndpoint"]()}}let st=(e.MPudS(e.gXbfV,typeof globalThis)&&e[n(1824)]===globalThis["construc"+n(1861)][n(1925)]||n(1792)+"d"!=typeof window&&e.KSShN(e[n(1824)],window[n(712)+"tor"][n(1925)]))&&e[n(1749)](e[n(1262)],typeof document),Ve=e[n(1602)](n(1792)+"d",typeof globalThis)&&(e[n(1095)]("Object",globalThis[n(712)+"tor"][n(1925)])||e[n(764)](e[n(903)],globalThis[n(712)+n(1861)][n(1925)]))&&e[n(958)](e[n(1262)],typeof tt),Ct=(e[n(534)]("undefined",typeof globalThis)&&e[n(959)]===globalThis[n(712)+n(1861)][n(1925)]||typeof globalThis>"u"||e.gvvAw(e[n(1262)],typeof globalThis)&&!!globalThis[n(1278)+"Bridge"])&&e[n(833)](e[n(1262)],typeof wx),At=e[n(1262)]!=typeof globalThis&&(e[n(2018)](e.WdeVd,globalThis[n(712)+n(1861)].name)||e.NifQU(e.HmhbZ,globalThis.constructor[n(1925)])||e[n(875)](n(771)+n(545)+n(1062),globalThis[n(712)+n(1861)].name))&&e[n(1284)](e[n(1262)],typeof self),ma=e[n(1749)](e[n(1262)],typeof globalThis)&&e.FEERI===globalThis[n(712)+n(1861)][n(1925)]&&e[n(1749)](e[n(1262)],typeof global)&&e[n(1692)]("Object",global[n(712)+"tor"][n(1925)])&&e.gXbfV!=typeof process&&!!process.version;class xr{constructor(){let t=n;this[t(1567)+"rs"]={}}[n(997)](t,...i){let o=n,u=this[o(1567)+"rs"][t];if(u)u[o(637)]()[o(1099)](h=>h.fn[o(1632)](h[o(538)],i));else if(e[o(1121)](e[o(1426)],t)&&!this[o(1591)]){let h=i[o(861)]&&i[0];if(e[o(2034)](h,Error))throw h;let p=new Error(e[o(1293)](e[o(935)],h?e.inGhM(" (",h[o(1444)])+")":""));throw p[o(1796)]=h,h}return this}[n(1683)](t,i){let o=n;if(e[o(967)](void 0,t))this[o(1567)+"rs"]={};else if(i===void 0)this[o(1567)+"rs"][t]=null;else{let u=this[o(1567)+"rs"][t];if(u)for(let h=0;h<u.length;)e[o(567)](u[h].fn,i)?u.splice(h,1):++h}return this}on(t,i,o){let u=n;return(this[u(1567)+"rs"][t]||(this._listeners[t]=[]))[u(1466)]({fn:i,ctx:o||this}),this}}class wa extends xr{["_formatE"+n(815)+n(724)](t){let i=n;return t[i(1823)]||t[i(834)]?(i(500)+" "+(t.errMsg||"")+i(512)+(t[i(834)]||""))[i(1963)]():JSON.stringify(t)}constructor(t,i,o){let u=n;super(),this[u(1031)]=null,Ct&&wx[u(1505)+u(1993)]&&(this[u(1031)]=wx["connectS"+u(1993)]({url:t,protocols:i,header:o,fail:this[u(1349)+u(547)+u(1226)][u(1917)](this),success:this["_createSocketSuc"+u(1871)+u(1813)][u(1917)](this)})),Ve&&tt[u(1505)+"ocket"]&&(this[u(1031)]=tt[u(1505)+u(1993)]({url:t,protocols:i,header:o,fail:this[u(1349)+u(547)+u(1226)][u(1917)](this),success:this[u(1349)+u(565)+"cessHandler"][u(1917)](this)}))}[n(1349)+n(565)+"cessHand"+n(1813)](){let t=n,i={qclNK:t(909),ImkRu:"pageshow"};e[t(1489)](e[t(1356)],t(1060))?Promise[t(1159)]()[t(1475)](()=>{let o=t;this[o(1933)+o(1392)]()}):(this[t(1251)+"er"]&&_0x3aa7ed[t(1741)+t(1110)+t(1465)](i[t(1441)],this["_handleP"+t(585)]),this._isBrowser&&_0x4bcf1e["removeEventListe"+t(1465)](i[t(1868)],this[t(1022)+t(902)]),this.close())}[n(1349)+"ocketFai"+n(1226)](t){let i=n,o={yIJFB:e.XRtwJ,qBpGz:e[i(863)]};Promise[i(1159)]().then(()=>{let u=i,h=de(o.yIJFB,{message:this[u(922)+u(815)+u(724)](t)});this[u(997)](o[u(963)],h);let p=pe("close",{reason:this[u(922)+u(815)+u(724)](t)});this[u(997)](o[u(843)],p)})}[n(1933)+n(1392)](){let t=n,i={atoEP:e.aSiiU,FJHqh:function(o,u,h){return e[N(830)](o,u,h)},ZJcTp:e.IgFHH,OoxsJ:function(o,u,h){return e[N(1935)](o,u,h)}};this._socket[t(1845)](o=>{let u=t;this[u(997)](e[u(1481)],e[u(2031)](Si,e[u(1481)],{...o,data:o[u(1823)]||""}))}),this._socket[t(1030)](o=>{let u=t;this[u(997)](i[u(785)],i[u(596)](pe,u(1203),{...o}))}),this[t(1031)][t(1827)+"e"](o=>{let u=t;this[u(997)](i[u(1311)],i[u(826)](bi,i[u(1311)],{...o}))}),this._socket.onError(o=>{let u=t;this[u(997)](u(780),e[u(2025)](de,e.XRtwJ,{...o,message:o[u(1823)]||""}))})}[n(1400)](t){let i=n;if(t instanceof Uint8Array){let o=t[i(516)][i(637)](t[i(1533)+"et"],t[i(1649)+"th"]+t[i(1533)+"et"]);this[i(1031)]&&this._socket[i(1400)]({data:o,fail:u=>{let h=i;this.emit(e[h(1426)],e.lOqDL(de,e[h(1426)],{message:this[h(922)+h(815)+h(724)](u)}))}})}else this[i(1031)]&&this._socket[i(1400)]({data:t,fail:o=>{let u=i;this[u(997)](e[u(1426)],e[u(1783)](de,u(780),{message:this[u(922)+u(815)+u(724)](o)}))}})}[n(1203)](t,i){let o=n;this[o(1031)]&&this[o(1031)][o(1203)]({code:t,reason:i})}[n(1337)+n(754)](t,i){let o=n;e[o(1334)](e[o(884)],e.FAhbi)?(_0x5e6a1b&&_0x2542d2["addEvent"+o(754)](wfvZsA.aSiiU,()=>_0xd61372()),_0x17d28f&&_0x4280cb.addEventListener(wfvZsA[o(2026)],()=>_0x5c3caa())):this.on(t,i)}[n(1741)+n(1110)+"ner"](t,i){this.off(t,i)}get[n(1503)+"te"](){let t=n,i={WlJut:e[t(1261)],OGqAO:e.TKDPS,kpmoy:function(o){return e.VJVYP(o)},zRBfU:function(o,u){return e[t(1953)](o,u)},ADAVu:t(1410)+"or"};if(e[t(813)](t(1340),e.KdsAx)){let o=()=>{let p=t;_0xd68f68[p(1741)+p(1110)+p(1465)](WEtvRU[p(526)],u),_0x105602[p(1741)+"entListe"+p(1465)](p(780),h),_0x5756b8["removeEv"+p(1110)+p(1465)](WEtvRU[p(635)],h)},u=()=>{let p=t;_0x4b9b7f(),WEtvRU[p(1155)](o)},h=()=>{let p=t;WEtvRU[p(1268)](_0x51b896,_0x35b2c1.error||new _0x32b3b8(WEtvRU[p(1477)],WEtvRU[p(1477)])),o()};_0xd98165[t(1337)+t(754)](wfvZsA[t(1261)],u),_0x15a8e0[t(1337)+t(754)](wfvZsA[t(1426)],h),_0x3cb41c[t(1337)+"Listener"]("abort",h)}else return this._socket[t(1503)+"te"]}get[n(1469)+"pe"](){let t=n;return this[t(1031)][t(1469)+"pe"]}set[n(1469)+"pe"](t){}get url(){let t=n;return this[t(1031)][t(926)]}get[n(1684)](){let t=n;if(e[t(1699)](e[t(625)],e[t(1163)]))switch(_0x16805c){case e[t(1540)]:case e.olTVf:return{[t(1233)+_0x3109e3]:1,"x-tt-env":_0x48c330};default:return{}}else return this[t(1031)][t(1684)]}get[n(1828)+"ns"](){let t=n;return this[t(1031)][t(1828)+"ns"]}get[n(774)+n(1848)](){return 0}}function _a(r,t){let i=n;if(i(735)!==e.CGSua){if(t)return new t(r[i(926)],r[i(1684)]);if(Ct||Ve)return new wa(r.url,r[i(1684)],r[i(1786)]);if(e[i(1366)](st,At)&&e[i(558)](e[i(1262)],typeof WebSocket)&&WebSocket)return new WebSocket(r[i(926)],r[i(1684)+"s"])}else{let o=this._qosDB[i(1847)+i(888)+"nc"](this[i(1516)]),u=_0x3cd538[i(1117)](o||"{}");return _0x2c6c06.keys(u)}}function ya(r){let t=n;return!!(r||Ct&&wx[t(1505)+t(1993)]||Ve&&tt[t(1505)+t(1993)]||e[t(1366)](st,At)&&t(1792)+"d"!=typeof WebSocket&&WebSocket)}function Ci(r,t,i){let o=n;if(e[o(1189)]===e[o(1618)])_0x341111=_0x5c4419[e[o(1825)](_0x3b29a3,_0x572c0a)+1],_0xf522e2=_0x5adf45[e[o(1816)](e[o(1059)](_0x458178,_0x531d97),2)],_0x264f20=_0x3f55c8[e.sRCeI(e[o(1532)](_0x68739e,_0x361b00),3)],e.mIwpO(e[o(1428)](_0x323bf8|_0x645a69<<8,e[o(665)](_0x1a6fc7,16))&12632256,8421504)?_0x44b59e+=_0x38b282:(_0xc662c2=e[o(931)](e[o(1653)](e[o(1555)](7,_0x287286)<<18,e[o(1978)](63,_0x2391c0)<<12),e.lVcwv(e.SERDY(63,_0x500fc2),6))|e[o(1717)](63,_0x4a9db9),e[o(517)](_0x567486,65536)||e.jdKhI(_0x578f93,1114111)?_0x4aa218+=_0xdfe00d:(_0x311a42-=65536,_0x3eb606+=_0x5dba0e(e.wzURg(e.Cxyen(_0x53c0fe,10),55296),e[o(1581)](1023&_0x367818,56320)),_0x4902fa+=3));else{let u=-1;async function h(p){let g=o;return e[g(1361)](p,u)?Promise[g(812)](new Error(e.nWKOg)):(u=p,e[g(2029)](p,i[g(861)])?Promise.resolve():i[p][g(1917)](r)(t,h[g(1917)](null,e[g(668)](p,1))))}e[o(1154)](h,0)}}function Ai(r){let t=n,i={wJUGB:"online",vYEtW:e.rHfsf,IASDy:t(909),MeyBy:e[t(1141)],nQryB:function(o,u){return e[t(1594)](o,u)},zBUSc:e[t(1757)],evZCM:e.xKNQZ};if(e[t(582)](e[t(1223)],e[t(590)]))this._isBrowser&&_0x58eec2[t(1337)+"Listener"](i[t(1295)],this[t(1662)+t(1247)]),this[t(1251)+"er"]&&_0x7a7a77[t(1337)+"Listener"](i[t(1034)],this[t(1662)+t(1853)]),this[t(1251)+"er"]&&_0x25d378[t(1337)+t(754)](i[t(1573)],this["_handleP"+t(585)]),this._isBrowser&&_0x56ee8b[t(1337)+t(754)](i[t(1687)],this["_handleP"+t(902)]);else{let o=0,u=0;for(let h=0;e.bqNYo(h,r[t(861)]);++h)if(u=r[t(1028)+"At"](h),e[t(1782)](u,128))o+=1;else if(e[t(1782)](u,2048))o+=2;else if(e[t(932)](e[t(1805)](64512,u),55296)&&e[t(998)](e[t(1269)](64512,r.charCodeAt(e[t(1112)](h,1))),56320))if(e[t(1171)]("cBirn",e[t(720)])){let p=("0|1|4|3|"+t(802)).split("|"),g=0;for(;;){switch(p[g++]){case"0":this[t(1947)+t(1808)]=!0;continue;case"1":this[t(1499)+"mer"]();continue;case"2":this[t(1014)+t(1258)+"t"](_0x21b4db,_0x1f0196);continue;case"3":this[t(964)+t(1390)+t(754)]();continue;case"4":this[t(2011)+"ngTimer"]();continue;case"5":this["_QoSMana"+t(1e3)]?.[t(2019)]();continue;case"6":if(this._ws[t(1503)+"te"]===this[t(886)]||i.nQryB(this._ws[t(1503)+"te"],this[t(984)]))return void this[t(1572)](i[t(696)]);continue;case"7":if(!this._ws)return void this[t(1572)](i[t(1462)]);continue}break}}else++h,o+=4;else o+=3;return o}}function Di(r,t,i){let o=n;if(e.caVRv(e[o(772)](i,t),1))return"";let u="";for(let h=t;e[o(1132)](h,i);){let p=r[h++];if(p<=127)u+=String[o(502)+o(1072)](p);else if(p>=192&&e[o(1200)](p,224))u+=String[o(502)+o(1072)](e.pNftm(e[o(1402)](31,p)<<6,e[o(1217)](63,r[h++])));else if(e[o(577)](p,224)&&e[o(1732)](p,240))u+=String[o(502)+o(1072)](e[o(1227)](e[o(1061)](e[o(1700)](15,p)<<12,(63&r[h++])<<6),e[o(870)](63,r[h++])));else if(p>=240){let g=e[o(987)](e.HtGpX(e[o(1810)](e[o(727)](e[o(1725)](e.pEJZC(7,p),18),e[o(1742)](63,r[h++])<<12),e[o(1069)](63,r[h++])<<6),e[o(1844)](63,r[h++])),65536);u+=String[o(502)+o(1072)](e[o(1609)](55296,e[o(1026)](g,10))),u+=String[o(502)+o(1072)](56320+(1023&g))}}return u}function cr(r,t,i){let o=n,u=i,h,p;for(let g=0;e.NrdgP(g,r[o(861)]);++g)if(e[o(1588)](e[o(2020)],e[o(2020)])){let d=this._options[o(730)+o(824)]instanceof _0x560f7e?{force:!!this[o(1447)][o(730)+o(824)][o(743)],encoding:this[o(1447)][o(730)+"ncoding"][o(1378)]?this[o(1447)][o(730)+o(824)][o(1378)][o(1399)](/\s/g,"")[o(1409)+o(711)]():""}:{force:!1,encoding:this._options[o(730)+o(824)]?this[o(1447)][o(730)+o(824)].replace(/\s/g,"")[o(1409)+o(711)]():""},y=_0x2ddf77["payloadE"+o(824)]?_0x5a8adc[o(730)+o(824)].replace(/\s/g,"")[o(1409)+o(711)]():"",v=e[o(1191)](this[o(1447)][o(1788)+o(647)],_0x4e5fa8)?{force:!!this[o(1447)]["payloadT"+o(647)].force,type:this._options[o(1788)+"ype"][o(1980)]?this[o(1447)][o(1788)+o(647)][o(1980)].replace(/\s/g,"")[o(1409)+o(711)]():""}:{force:!1,type:this[o(1447)][o(1788)+"ype"]?this[o(1447)][o(1788)+o(647)][o(1399)](/\s/g,"")[o(1409)+o(711)]():""},A=_0x3fdc56[o(1788)+o(647)]?_0x4dba53[o(1788)+o(647)][o(1399)](/\s/g,"")["toLowerC"+o(711)]():"",L=v[o(743)]?v[o(1980)]:A||v[o(1980)],T=d[o(743)]?d[o(1378)]:y||d[o(1378)],O=[e[o(2015)],e.nLitR,e.nRJmA,e[o(1181)]],j=[e[o(1480)],e[o(1635)]];this[o(1447)]["enableTr"+o(1696)+o(1629)+"ad"]&&O[o(719)](L)&&(!T||j[o(719)](T))?_0x310b61[o(1364)+o(1957)]=e.ZVYvz(_0x47f00a,_0x36c066.payload,0,_0x293271[o(1422)][o(1649)+"th"]):_0x5251eb.textPayload=""}else if(h=r[o(1028)+"At"](g),e.AQWbi(h,128))t[i++]=h;else if(e[o(1706)](h,2048))t[i++]=e[o(1237)](e[o(1026)](h,6),192),t[i++]=e[o(1695)](63&h,128);else if(e[o(1738)](e[o(689)](64512,h),55296)&&e[o(967)](e.tJXzC(64512,p=r[o(1028)+"At"](e.EjPtr(g,1))),56320)){let d=e[o(1970)][o(1769)]("|"),y=0;for(;;){switch(d[y++]){case"0":t[i++]=e[o(1061)](e[o(1869)](e[o(1344)](h,6),63),128);continue;case"1":t[i++]=e[o(979)](e[o(1829)](e[o(1889)](h,12),63),128);continue;case"2":t[i++]=e[o(952)](63,h)|128;continue;case"3":t[i++]=e.lDTRq(h,18)|240;continue;case"4":h=e[o(1250)](65536,e[o(1084)](e[o(1916)](1023,h),10))+e.staDT(1023,p);continue;case"5":++g;continue}break}}else t[i++]=e[o(672)](e.cjmrH(h,12),224),t[i++]=e[o(790)](e[o(2009)](h>>6,63),128),t[i++]=e[o(1185)](63&h,128);return e[o(511)](i,u)}async function ki(r){let t=n;if(e[t(567)](t(1817),e[t(850)])){if(e.OImMI("string",typeof r))if(e.pRiLq==="RLqfP"){let i=new Uint8Array(e[t(1152)](Ai,r));return e.SuYVR(cr,r,i,0),i}else return _0x2bd75f[t(1015)](_0x253a06),!1;return e[t(1050)](r,ArrayBuffer)?new Uint8Array(r):new Uint8Array(r[t(516)],r[t(1533)+"et"],r[t(1649)+"th"])}else _0x2e76b8=e.HEetp(_0x571239,_0x5d8e31),_0x44d039|=e[t(1450)](127&_0x188769,7)}function va(r){let t=n;if(e[t(1171)](e[t(1109)],e[t(1109)]))this[t(1078)]&&this[t(1078)].send(_0x25c691),this[t(1561)+t(1065)][_0x45ecc7]=null;else try{return e[t(1277)](e.dwUKE,typeof r)&&(e[t(1191)](r,ArrayBuffer)||r[t(516)]&&e.ZhMpB(r[t(516)],ArrayBuffer))||e.dKaAk("string",typeof r)?"":(JSON[t(1117)](r),e[t(854)])}catch{return e[t(1584)](e[t(1181)],typeof r)?e[t(2015)]:""}}let ba=(r,t)=>{let i=n;switch(r){case e[i(1540)]:case i(2035):return{[i(1233)+r]:1,"x-tt-env":t};default:return{}}};class Sa{constructor(t){let i=n;this[i(1420)+"ount"]=t,this[i(536)]=0}[n(1024)](){let t=n;this[t(536)]++}[n(1739)+"chMaxCount"](){let t=n;return this[t(536)]>=this["maxLossC"+t(1522)]}[n(1440)+"nter"](t=0){let i=n;if(e[i(1986)](e.aauIH,i(798)))this[i(1420)+i(1522)]=t,this[i(536)]=0;else return!!this[i(940)]}}async function Ea(r){let t=n,i={cInFA:function(o,u){return o<u},vVmtB:function(o,u){return o!==u},qeiFI:function(o,u){return e.dSIsT(o,u)},dmAKQ:function(o,u){return e.UZrnq(o,u)},kKZxV:t(556)+t(1090)};if(e[t(1266)](e[t(985)],e[t(985)])){let o=_0x5c5f2b[t(1769)](":");_0x436030&&(_0x3abb5f=o[t(861)]),_0x568334+=o[t(861)];for(let u=0;EFMWoj[t(1886)](u,o.length);u++)if(EFMWoj[t(1012)](4,o[u][t(861)])){let h=_0x2bf9f2.substring(0,EFMWoj[t(974)](4,o[u][t(861)])),p=h[t(2028)](o[u]);_0x13ef99.push(p)}else _0x33b7a8.push(o[u]);_0x12828d=!1}else return new Promise(o=>{let u=t;if(!st)return o(e.JlWiK);try{let h=document[u(1113)+u(865)](u(1509));window[u(1897)+"JSONP"]=p=>{let g=u;document.body.removeChild(h),window[g(1897)+g(996)]=void 0,i[g(1272)](o,p&&p[g(1139)]||i[g(504)])},h.type=e[u(846)],h[u(530)]=e[u(1962)](r.replace(/^ws/,e[u(1437)]),e.icIlG);try{document[u(686)]["appendCh"+u(1176)](h)}catch{document.body[u(715)+"ild"](h)}}catch{window[u(1897)+u(996)]=void 0,e.fpyqc(o,"unknown reason")}})}function Ue(r,t,i){let o=n;return!!r?.[o(1415)](u=>u[o(795)]===t&&u[o(1989)]===i)}function ot(r,t){let i=n;return r?.[i(1415)](o=>o[i(795)]===t)?.[i(1989)]}let ur=null;async function Ca(){let r=n;if(e.OWZYQ===r(1442))return ur||(ur=Promise[r(1159)]()[r(1475)](Ee[r(1917)](Ee,r(1724)))),ur;this[r(1447)][r(1490)]&&_0x1cfaa0.log.apply(_0x1c6a38,["FRONTIER>",..._0x1723c7])}class Aa extends xr{constructor(t,i){let o=n;super(),this[o(740)]=t,this._keyPath=i,this[o(940)]=void 0,this["_initPro"+o(1168)]=null}async[n(1837)](){let t=n,i={UlGxt:function(o,u){return e.uziRF(o,u)},wTjRg:function(o,u){return e.DDIzp(o,u)}};e.NTmlZ(e[t(523)],"WKtsn")?(this[t(1608)]=!0,this[t(1956)]=CEVHEY[t(1799)](0,_0x5ecd20),this.high=CEVHEY[t(1923)](0,_0x4d4283),this[t(1453)]=!!_0x4125da):await this[t(1526)]()}async _init(){let t=n,i={vdbjV:function(o,u){return e[N(956)](o,u)},ZjWmp:function(o,u){return e[N(859)](o,u)},iFhXj:function(o){return e[N(1875)](o)},cfYUK:function(o,u,h,p){return e.SuYVR(o,u,h,p)}};if(!this[t(940)]){if(this[t(683)+"mise"])return this[t(683)+t(1168)];try{if(e[t(1611)](e[t(1681)],e[t(1681)]))return _0x3f3d43.readUInt8?{value:_0x5ae9a6[t(610)+"8"](_0xd8ee9d),offset:_0x4ce573+1}:{value:i[t(1359)](255,_0x3646cb[_0x229a87]),offset:i[t(1143)](_0x32a691,1)};{let o=this[t(740)],u=this[t(1213)];this[t(683)+t(1168)]=(async()=>{let h=t,{openDB:p}=await i[h(1127)](Ca);this[h(940)]=await i[h(892)](p,h(1897)+"_"+o,1,{upgrade(g){g[h(905)+"jectStore"](o,{keyPath:u})}})})(),await this[t(683)+t(1168)]}}catch(o){console[t(1015)](o)}finally{if(e[t(634)]("alhXW",e[t(561)])){let o=e.smEHu(_0x490fc3[t(1956)],0),u=e.bisuH(e.zFliv(_0x1c4a1f.low,28)|e.Nliqg(_0x1a91cb[t(1856)],4),0),h=e[t(1771)](_0x4be91a[t(1856)],24),p=e.zLdxI(0,h)?e[t(841)](0,u)?e[t(1706)](o,16384)?e.xlkpO(o,128)?1:2:o<2097152?3:4:e.ZmWaf(u,16384)?e.ZIAQA(u,128)?5:6:e[t(970)](u,2097152)?7:8:e[t(1753)](h,128)?9:10,g=e[t(606)](_0x28e2e9,_0x2518e8,p),d=_0x15656c[t(1830)];switch(p){case 10:d[e[t(1373)](g,9)]=e[t(1895)](h>>>7,1);case 9:d[e[t(1088)](g,8)]=e.vRwpi(9,p)?128|h:e[t(1055)](127,h);case 8:d[e.sEnJY(g,7)]=p!==8?e.bDDik(e[t(930)](u,21),128):e.pEJZC(e[t(1403)](u,21),127);case 7:d[e[t(1373)](g,6)]=e.YgJMH(7,p)?u>>>14|128:e[t(1916)](e[t(1158)](u,14),127);case 6:d[g+5]=p!==6?e[t(1002)](e[t(1158)](u,7),128):e[t(540)](e[t(1234)](u,7),127);case 5:d[e[t(1456)](g,4)]=e[t(1690)](5,p)?e[t(1906)](128,u):e.Mlrlh(127,u);case 4:d[e.xGPtQ(g,3)]=e[t(820)](4,p)?e[t(1286)](e[t(1239)](o,21),128):e.okdTb(o,21)&127;case 3:d[e[t(1816)](g,2)]=e.fdCeb(3,p)?e.UnHjf(e.eEDGe(o,14),128):e[t(641)](o,14)&127;case 2:d[g+1]=e[t(574)](2,p)?e[t(2007)](e[t(1222)](o,7),128):e.CVmIg(e[t(1785)](o,7),127);case 1:d[g]=e[t(1266)](1,p)?e[t(1209)](128,o):127&o}}else this[t(683)+t(1168)]=null}}}async[n(1301)](t){let i=n;try{return await this._init(),this[i(940)]?.[i(1301)](this[i(740)],t)}catch(o){console[i(1015)](o)}}async[n(1746)](t,i){let o=n;return await this[o(1526)](),this[o(940)]?.put(this[o(740)],t)}async[n(1968)](t){let i=n;try{return await this[i(1526)](),this[i(940)]?.[i(1922)](this[i(740)],t)}catch(o){console[i(1015)](o)}}async[n(1385)](){let t=n;try{return await this[t(1526)](),this._qosDB?.clear(this[t(740)])}catch(i){console[t(1015)](i)}}async[n(805)](){let t=n;if(e[t(1204)](t(521),e[t(1299)]))return await this[t(1526)](),this[t(940)]?.[t(1416)+"ys"](this._dbName);wfvZsA.tIpIe(_0x129f79,wfvZsA[t(515)](_0x160cb5,_0x53de77[t(1537)])),wfvZsA.fBaZx(_0x41356b)}async[n(2030)](){let t=n;return await this[t(1526)](),this[t(940)]?.[t(2030)](this[t(740)])}async closeDB(){let t=n;if(e[t(681)](e[t(1335)],e[t(1335)])){let i=new _0xeb6101(2*_0x30da52);i[t(1746)](_0x3ba721),_0x3c9b68[t(1830)]=i}else try{this[t(940)]?.[t(1203)](),this[t(940)]=void 0}catch(i){console[t(1015)](i)}}get isReady(){let t=n;try{return!!this[t(940)]}catch(i){return console[t(1015)](i),!1}}}class Da{constructor(t,i){let o=n;if(e[o(995)](o(687),e.jpATf))return e[o(1006)](e[o(885)](_0x572b69,8)[o(690)]("0"),e[o(1783)](_0x1406ad,_0x580947,10)[o(1885)](2))[o(637)](-8);this[o(1711)]=t,this[o(1224)]=i,this[o(940)]=localStorage}async[n(1837)](){}get[n(1516)](){let t=n;return t(1897)+"_"+this[t(1711)]}async[n(1301)](t){let i=n,o=this._qosDB.getItem(this[i(1516)]);return JSON[i(1117)](o||"{}")[t]}async set(t,i){let o=n,u=this[o(940)][o(895)](this._prefix),h=JSON.parse(u||"{}");return h[i||t[this[o(1224)]]]=t,this[o(940)][o(953)](this[o(1516)],JSON[o(1998)+"y"](h)),i||t[this[o(1224)]]}async[n(1968)](t){let i=n,o=this[i(940)].getItem(this[i(1516)]),u=JSON[i(1117)](e[i(1366)](o,"{}"));return u[t]=void 0,this[i(940)][i(953)](this._prefix,JSON.stringify(u))}async[n(1385)](){let t=n,i={vUvof:function(o,u){return e[N(772)](o,u)},ByeCD:function(o,u){return o>u}};if(e[t(1474)](e[t(706)],e[t(1457)])){let{initReconnectInterval:o,maxReconnectInterval:u,reconnectIntervalGrowFactor:h}=this[t(1447)],p=o*_0x543f61.pow(h,i.vUvof(_0xbc47b2,1));return i[t(1921)](p,u)?u:p}else return this[t(940)][t(1385)]()}async[n(805)](){let t=n,i={RrrOm:e[t(863)]};if(e[t(820)](t(1100),t(1100))){let o=this[t(1263)+"tManager"]?.[t(1780)+"ntEndpoint"]();this[t(851)+t(1578)+t(2001)](_0x102c35(i.RrrOm,{code:1006,reason:t(1598)+o+(t(817)+t(2004)+t(1407)+"ached"),wasClean:!0}))}else{let o=this._qosDB[t(895)](this[t(1516)]),u=JSON[t(1117)](e.JtjWI(o,"{}"));return Object[t(805)](u)}}async[n(2030)](){let t=n,i=this[t(940)][t(895)](this[t(1516)]),o=JSON[t(1117)](i||"{}");return Object[t(858)](o)}[n(2019)](){return Promise[n(1159)]()}get[n(591)](){let t=n,i={JskOG:function(o,u){return o|u},RYlrk:function(o,u){return e[N(1829)](o,u)},nSWNd:function(o,u){return e[N(1221)](o,u)},kchoS:function(o,u){return e[N(1214)](o,u)}};if(e[t(1843)](t(1161),e[t(643)]))return!!this[t(940)];_0x1bc680<65536?_0x374c34[_0x31a8bf++]=mcYtEk[t(2002)](mcYtEk[t(732)](mcYtEk[t(919)](_0x4df54f,12),15),224):(_0x497522[_0x29fc8e++]=mcYtEk[t(732)](mcYtEk[t(919)](_0x28594c,18),7)|240,_0x23af2d[_0xb858c4++]=mcYtEk[t(2002)](mcYtEk[t(765)](mcYtEk[t(919)](_0x11c4e1,12),63),128)),_0x5ad62d[_0x4846a9++]=mcYtEk[t(2002)](mcYtEk[t(919)](_0x4499f9,6)&63,128)}}class ka{constructor(t,i){this._DBName=t,this._pathKey=i,this._qosDB=Ve?tt:Ct?wx:null}async openDB(){}get[n(1516)](){let t=n;if(e[t(1634)](e[t(960)],"cfxhz")){let i={rYURV:function(g,d){return e[t(1498)](g,d)},obBMz:function(g,d){return g>d},OiifJ:function(g,d){return e[t(1743)](g,d)},jVMcO:function(g,d){return e.EtsHT(g,d)},OHeca:function(g,d){return e[t(1604)](g,d)},MhFpT:function(g,d){return e.dJEBw(g,d)}},o=e[t(825)](_0x5399da,8192),u=o>>>1,h=null,p=o;return function(g){let d=t;if(i[d(1190)](g,1)||i[d(799)](g,u))return i[d(1548)](_0x1ece67,g);i.jVMcO(p+g,o)&&(h=i[d(1548)](_0x174648,o),p=0);let y=_0x268d50[d(1894)](h,p,p+=g);return 7&p&&(p=i[d(1745)](i[d(1512)](7,p),1)),y}}else return t(1897)+"_"+this[t(1711)]}async[n(1301)](t){let i=n,o=this[i(940)].getStorageSync(this[i(1516)]);return JSON[i(1117)](o||"{}")[t]}async set(t,i){let o=n,u=this[o(940)][o(1847)+o(1468)](this._prefix),h=JSON[o(1117)](u||"{}");return h[i||t[this[o(1224)]]]=t,this[o(940)][o(1607)+"geSync"](this[o(1516)],JSON[o(1998)+"y"](h)),i||t[this[o(1224)]]}async[n(1968)](t){let i=n,o=this[i(940)][i(1847)+i(1468)](this[i(1516)]),u=JSON[i(1117)](e[i(519)](o,"{}"));return u[t]=void 0,this[i(940)][i(1607)+"geSync"](this._prefix,JSON[i(1998)+"y"](u))}async clear(){let t=n;return e[t(1888)]!=="xTHyk"?new _0x3d78bd(e[t(1461)](e[t(1285)](e[t(1313)](e.aihqQ(_0x43f040[4],24),e[t(914)](_0x2af917[5],16)),e.aPVIF(_0x528787[6],8)),_0x538e11[7]),e[t(1360)](e[t(1142)](e[t(794)](_0x1d48d7[0],24),_0x275772[1]<<16)|e[t(1911)](_0x8b1476[2],8),_0x3650cf[3]),_0x77305b):this[t(940)][t(783)+t(1116)]()}async[n(805)](){let t=n,i=this[t(940)][t(1847)+t(888)+"nc"](this[t(1516)]),o=JSON.parse(e[t(1605)](i,"{}"));return Object.keys(o)}async[n(2030)](){let t=n,i=this._qosDB[t(1847)+t(888)+"nc"](this[t(1516)]),o=JSON[t(1117)](e[t(519)](i,"{}"));return Object[t(858)](o)}closeDB(){return Promise[n(1159)]()}get[n(591)](){return!!this[n(940)]}}function Pi(r,t){let i=n;if(e[i(804)](Ve,Ve))return new ka(r,t);if(e[i(1797)](st,At)&&e[i(1114)](e[i(1262)],typeof indexedDB))return new Aa(r,t);if(e[i(856)](st,At)&&e[i(1114)](e.gXbfV,typeof localStorage))return new Da(r,t);throw new Error(i(1423)+i(1381)+"d")}class Pa{constructor(){let t=n;if(e[t(900)](e[t(1669)],e[t(1669)]))this[t(1487)+t(1342)+"Id"]=null,this[t(1487)+"l"]=36e5,this._qosDB=e[t(1502)](Pi,e[t(594)],e[t(949)]);else return e[t(566)](_0x4460a9,_0x5dc31a)}async[n(1487)+n(976)](){let t=n;e[t(1969)](clearInterval,this[t(1487)+t(1342)+"Id"]),this[t(1487)+t(1342)+"Id"]=e[t(1254)](setInterval,()=>{this[t(777)+"ired"]()},this[t(1487)+"l"])}async[n(1837)](){let t=n;await this[t(940)][t(1837)]()[t(1475)](()=>{let i=t;this[i(1487)+i(976)]()})}async[n(777)+n(722)](){let t=n;(await this[t(940)]?.getAll()||[])[t(1569)](({timestamp:u})=>u<Date[t(1772)]())[t(1099)](u=>{let h=t;this[h(940)]?.[h(1968)](u[h(1033)+"id"])})}async[n(1968)](t){let i=n;if(i(1419)!==i(2036))return this[i(940)]?.[i(1968)](t);_0x40e5cf[_0x1996a6[_0x5b6167][i(1156)+i(1115)]]=_0x50f55d(_0x32a273[_0x9f48fa].cursor_name),_0x5f7074+=e.CnWTA(14,_0x5ddc21[_0x18a774[_0x3455db][i(1156)+i(1115)]])}async[n(1746)](t,i){let o=n;return this._qosDB?.[o(1746)]({message_id:t,timestamp:i})}async[n(1301)](t){let i=n;if(e.RvDmN(e[i(1942)],i(1534)))return this[i(940)]?.get(t);_0x5d57f3=e[i(778)](e[i(961)](7&_0x174f65,18)|e[i(1087)](63&_0x26ba17,12),e[i(1626)](e[i(968)](63,_0x268724),6))|63&_0x1f8221,e.oFfGF(_0x2cbb40,65536)||e.pUBuK(_0x11c459,1114111)?_0x3ce7fd+=_0x44ea40:(_0x3cdf6f-=65536,_0x3bed4b+=e[i(1485)](_0x17a6a1,e[i(564)](_0x1d4a96>>10,55296),e.OpaHA(1023,_0xd5f54f)+56320),_0x3537b0+=3)}async closeDB(){let t=n;e.MDrgo(clearInterval,this["_interva"+t(1342)+"Id"]),await this[t(940)]?.closeDB()}get isReady(){let t=n;return this[t(940)]?.[t(591)]}}function fr(r){let t=n,i=!!this[t(1447)].enableQoS;if(!i)return{enabled:i,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e[t(1232)](Ue,r.message[t(1786)],e[t(962)],"2"),u=o&&Ue(r.message[t(1786)],e.tUroB,"1"),h=o&&e[t(1232)](Ue,r[t(1444)][t(1786)],e[t(1661)],"1"),p=h?e[t(1255)](ot,r[t(1444)][t(1786)],e.BWoSf)?.split(",")[t(1569)](Boolean)||[]:[];return{enabled:i,isQoSMessage:o,isQoSAck:u,isAckCleanupMessage:h,ackMsgIds:p}}async function Ti(){let r=n;if(e[r(1252)]!==e.vACRw)return this[r(1316)+r(1e3)]||(this["_QoSMana"+r(1e3)]=new Pa),this[r(1316)+r(1e3)][r(591)]||await this[r(1316)+r(1e3)][r(1837)](),this[r(1316)+"ger"];if(wfvZsA[r(1103)](_0x317f3a,_0x1309d6)){if(wfvZsA[r(1121)](_0xf47a10,r(1919)))return _0x52d24d[r(1301)](_0x3f3ca8);if(wfvZsA[r(932)](_0x10cec1,wfvZsA.kVeEp))return _0x208d33.objectStoreNames||_0x36736[r(1301)](_0x169c32);if(wfvZsA[r(630)](_0x3014e4,wfvZsA[r(773)]))return _0x2d33e8[r(832)+r(1160)][1]?void 0:_0x58c59c.objectStore(_0xe4b41f[r(832)+r(1160)][0])}return wfvZsA[r(515)](_0x4f93ea,_0x2434e9[_0x57dee0])}async function Ta(r,t){let i=n;if(e.NvsDX===e[i(1066)]){let{enableAutoAck:o}=this[i(1447)],u=e[i(528)](Ue,r[i(1444)][i(1786)],e.YvSDu,"1"),h=Ue(r.message[i(1786)],e[i(787)],"1"),p=fr[i(1894)](this,r);if(o&&u){let{SeqID:g,LogID:d,service:y,LogIDNew:v,method:A}=r[i(1444)];this[i(1733)]({SeqID:g,LogID:d,LogIDNew:v,service:y,method:A,headers:[{key:e.WezNd,value:"1"},{key:e[i(1965)],value:e[i(1768)](v,"")},{key:e[i(1659)],value:"0"}]})}h&&!p[i(1482)]&&this[i(851)+i(1736)+i(1312)](r),t()}else _0x5a1101.frontierJSONP=void 0,_0x4401aa(e[i(923)])}async function Ia(r,t){let i=n;e[i(630)](i(1819),e[i(659)])?(_0x4af405=_0x4d7771[e[i(564)](e[i(1703)](_0x53ad6d,_0x11cc52),1)],_0x4be47d=_0x3c9eb8[e[i(763)](_0x2903f4+_0xb2f667,2)],e[i(1959)](_0x3f018c|e[i(589)](_0x205f76,8),49344)!==32896?_0x5e98f6+=_0x4db948:(_0x464c08=e[i(1128)](e[i(1452)](e[i(853)](15,_0x47766d),12)|e.roLZn(e[i(839)](63,_0x5b09fe),6),e.gCHGz(63,_0x19e5a2)),e.LvdmE(_0x403575,2048)||e.XerRy(_0x4bcd79,55296)&&e[i(658)](_0x35025d,57343)?_0x16930d+=_0x39836f:(_0x5d14ea+=e.XxDWe(_0xf5a0ee,_0x2e2160),_0x31bba4+=2))):(this._debug(i(1343),r[i(1444)]),e[i(1549)](t))}async function Ra(r,t){let i=n,o=fi(await ki(r[i(955)]));try{if(e[i(948)](o.payload,Uint8Array)){if(e[i(1984)]===e.Rstad)return"frontier_"+this[i(1711)];{let u=e[i(1050)](this[i(1447)][i(730)+i(824)],Object)?{force:!!this._options[i(730)+i(824)][i(743)],encoding:this[i(1447)][i(730)+i(824)][i(1378)]?this[i(1447)][i(730)+"ncoding"][i(1378)][i(1399)](/\s/g,"")[i(1409)+"ase"]():""}:{force:!1,encoding:this[i(1447)][i(730)+i(824)]?this._options["payloadE"+i(824)][i(1399)](/\s/g,"")[i(1409)+i(711)]():""},h=o["payloadE"+i(824)]?o.payloadEncoding.replace(/\s/g,"")[i(1409)+i(711)]():"",p=e[i(2034)](this[i(1447)]["payloadT"+i(647)],Object)?{force:!!this[i(1447)].payloadType[i(743)],type:this[i(1447)][i(1788)+i(647)][i(1980)]?this[i(1447)][i(1788)+"ype"].type[i(1399)](/\s/g,"").toLowerCase():""}:{force:!1,type:this[i(1447)].payloadType?this._options[i(1788)+i(647)].replace(/\s/g,"")[i(1409)+i(711)]():""},g=o[i(1788)+i(647)]?o[i(1788)+i(647)][i(1399)](/\s/g,"")[i(1409)+i(711)]():"",d=p[i(743)]?p.type:g||p[i(1980)],y=u[i(743)]?u.encoding:h||u[i(1378)],v=[i(1296)+i(758)+i(1563),e[i(854)],"applicat"+i(1140)+i(1597)+i(1195),i(1884)],A=[e[i(1480)],e[i(1635)]];this[i(1447)][i(1324)+i(1696)+"extPayload"]&&v[i(719)](d)&&(!y||A.includes(y))?o[i(1364)+i(1957)]=Di(o[i(1422)],0,o[i(1422)][i(1649)+"th"]):o[i(1364)+i(1957)]=""}}else o[i(1364)+i(1957)]=""}catch(u){o[i(1364)+i(1957)]="",console[i(1015)](u)}r[i(1444)]=o,e[i(1179)](t)}function Na(r,t,i){let o=n,u={CZoBD:function(y,v){return e[N(1379)](y,v)},tipET:function(y,v){return e[N(638)](y,v)},YsUVo:function(y,v){return e[N(1476)](y,v)},VyZwU:function(y,v){return e[N(1676)](y,v)},nXngk:e[o(1257)],rnYOs:function(y,v){return e[o(1273)](y,v)},BrVBX:function(y,v){return e[o(1193)](y,v)}},h=e[o(965)](i,8192),p=e.RrCBc(h,1),g=null,d=h;return function(y){let v=o;if(u[v(1414)](y,1)||u.tipET(y,p))return u[v(655)](r,y);if(d+y>h){if(u[v(1105)](u[v(1914)],u[v(1914)]))return this._socket.url;g=r(h),d=0}let A=t.call(g,d,d+=y);return u[v(1765)](7,d)&&(d=u[v(1673)](7,d)+1),A}}let La=4294967295;function Oa(r,t,i){let o=n;return e.LILXK(RangeError,e[o(929)](e.lEPAk(e[o(1609)](e[o(1250)](e[o(1395)](e.uEGRy,r),o(1467)),t||1),o(1623)),i))}function Ba(r,t,i){let o=n;if(e[o(581)](i,La))throw new Error(o(1988)+o(806)+"e");let u=3;for(;e[o(576)](u,0);){let h=e[o(1805)](255,i);lr(h,r,e[o(859)](t,u)),i>>>=8,u--}return t+4}function Ma(r,t){let i=n,o=0,u=t,h=e[i(768)](t,4);for(;e[i(1523)](u,h);){let{value:p,offset:g}=e[i(2025)](dr,r,u);u=g,o=e.eEDGe(e.GkMcn(o,8),0),o+=p}return{value:o,offset:h}}function za(r,t,i){let o=n,u=e[o(894)][o(1769)]("|"),h=0;for(;;){switch(u[h++]){case"0":if(!r)return i;continue;case"1":return e[o(1484)](e.Vzbix(cr,r,t,i),i);case"2":if(e[o(1982)](r[o(861)],40))return e[o(1915)](e.yARED(cr,r,t,i),i);continue;case"3":if(t[o(1612)])return e[o(1967)](t[o(1612)](r,i),i);continue;case"4":if(t[o(1351)+"e"])return e.BUrqm(t[o(1351)+"e"](r,i),i);continue}break}}function qa(r,t){let i=n,o=new M(e[i(1877)](e[i(1360)](e.JSBEp(r[e[i(1541)](t,4)],24),r[e[i(928)](t,5)]<<16)|e[i(589)](r[e.wzghz(t,6)],8),r[t+7]),e[i(1094)](e[i(801)](r[e[i(1495)](t,0)]<<24|e[i(1023)](r[e[i(818)](t,1)],16),e[i(598)](r[t+2],8)),r[e[i(1434)](t,3)]),!0);return t+=8,{value:o,offset:e[i(929)](t,8)}}function Ua(r,t,i){let o=n,u=r[o(1956)],h=r[o(1856)];return t[i]=e.SCJDb(h,24),t[e[o(822)](i,1)]=e[o(1056)](e[o(951)](h,16),255),t[e[o(649)](i,2)]=e[o(930)](h,8)&255,t[i+3]=e.WSNCr(255,h),t[i+4]=u>>>24,t[i+5]=e.aFEwJ(e.XTDqA(u,16),255),t[e[o(1082)](i,6)]=e.dwHev(u>>>8,255),t[e[o(2033)](i,7)]=255&u,i+=8,i}function dr(r,t){let i=n;return r[i(610)+"8"]?{value:r[i(610)+"8"](t),offset:e[i(1497)](t,1)}:{value:e[i(1320)](255,r[t]),offset:e[i(1570)](t,1)}}function lr(r,t,i){let o=n;return t.writeUint8?t[o(1086)+"t8"](r,i):t[i]=e.EiyNy(255,r),e[o(1636)](i,1)}let Fa=function(r){return new Uint8Array(r)},Ha=e[n(1262)]!=typeof Buffer?Buffer[n(1357)+n(1083)]:e[n(1162)](Na,Fa,Uint8Array[n(2032)+"e"][n(879)]),Ka=16,hr=32;function ja(r){let t=n,i=0,o={};for(let u=0;e[t(994)](u,r[t(861)]);u++)o[r[u][t(1156)+"ame"]]=Ai(r[u][t(1156)+t(1115)]),i+=14+o[r[u][t(1156)+t(1115)]];return[i,o]}function Ii(r,t,i){let o=n,u={wHfOw:e[o(1603)],WJMOT:function(h,p,g,d){return e[o(1232)](h,p,g,d)},mogmg:e.flUFo,VbVgo:e[o(539)],lyxhz:e[o(946)],cieIJ:function(h,p,g,d){return h(p,g,d)},pAjKP:function(h,p,g,d){return e[o(1279)](h,p,g,d)},uwAfZ:function(h,p,g,d){return h(p,g,d)}};if(e[o(973)]!==e[o(971)]){let[h,p]=e.ZEKGU(ja,r),g=e[o(595)](Ha,h),d=0;return r[o(1099)](y=>{let v=o,A=u.wHfOw[v(1769)]("|"),L=0;for(;;){switch(A[L++]){case"0":console[v(1015)](v(1719),d);continue;case"1":d=u[v(525)](Ua,M[v(1903)+"er"](y[v(1855)]||t),g,d);continue;case"2":console[v(1015)](u[v(1999)],d);continue;case"3":console[v(1015)](u.VbVgo,d);continue;case"4":console.log(u[v(1370)],d);continue;case"5":console[v(1015)](v(1303)+v(1925),d);continue;case"6":d=Ba(g,d,y[v(1801)]||0);continue;case"7":d=u.cieIJ(lr,0,g,d);continue;case"8":d=u[v(1287)](za,y[v(1156)+v(1115)],g,d);continue;case"9":console[v(1015)](v(1652)+v(656),y,y[v(1801)]);continue;case"10":d=u[v(713)](lr,p[y[v(1156)+"ame"]],g,d);continue}break}}),{frameType:hr,headers:[{key:e[o(1071)],value:i}],payload:g}}else wfvZsA[o(1179)](_0xc9968e),_0x2229c8()}function Ga(r){let t=n,i=0,o=[];for(;e[t(1854)](i,r[t(1649)+"th"]);){let{offset:u}=e[t(1405)](dr,r,i);i=u;let h={cursor_name:"",cursor:0,service:0},{value:p,offset:g}=e.ZuxPZ(Ma,r,i);h[t(1801)]=p,i=g;let{value:d,offset:y}=e.zVEUw(dr,r,i);i=y,h.cursor_name=e[t(537)](Di,r,i,e[t(809)](i,d)),i+=d;let{value:v,offset:A}=qa(r,i);h[t(1855)]=v.toNumber(),i=A,o[t(1466)](h)}return o}function Wa(){let r=n;return{frameType:hr,headers:[{key:e[r(1071)],value:r(1599)+r(767)}],payload:void 0}}class Ja{constructor(t,i,o){let u=n;this[u(769)+u(657)]=t,this["_cursorF"+u(1839)]=i,this[u(1561)+u(741)]=o,this._qosDB=e[u(1559)](Pi,this[u(769)+u(657)],e[u(1104)])}async[n(1837)](){let t=n;await this._qosDB[t(1837)]()}async[n(1005)+"rs"](){let t=n;if(!this[t(940)][t(591)])return;let i=this._messageStrategy,o=await this[t(940)].getAll();switch(console.log(e.VPaZy,o),i){case e[t(1451)]:return o&&o[t(861)]?Ii(o,0,this[t(829)+t(1839)]):void 0;case t(1668):return;case e[t(670)]:return o&&o[t(861)]?Ii(o,0,this[t(829)+"ileName"]):e[t(1418)](Wa)}}async[n(1746)](t,i,o){let u=n;return e.etHHJ(e[u(1656)],e[u(1672)])?(console[u(1015)](e[u(1866)],t,i,o),this[u(940)][u(1746)]({cursor_name:t,cursor:i,service:o})):wfvZsA[u(1743)](_0x54eb85,_0x57bbf8[u(1632)](_0x495036(this),_0x433e0e))}async[n(742)+"rs"](t){let i=n,o=e[i(503)](Ga,t);for(let u of o){if(e[i(1582)]!==i(1870))return!!this[i(940)];console.log(e.eSYvB,o),await this[i(940)][i(1746)](u)}}async get(t){let i=n,o={mgLFt:i(1131)+i(1010)+"t"};if(e[i(918)](e[i(1710)],"DKBrZ"))return(await this[i(940)][i(1301)](t))?.[i(1855)];_0x843b12(i(1763)),this[i(1683)]("ping_once_success",_0x37e7ec),this[i(1683)](o.mgLFt,_0x5526aa)}async[n(2019)](){let t=n;await this[t(940)][t(2019)]()}[n(2012)+n(1519)+n(1601)](t){let i=n;this[i(829)+i(1839)]=t}get[n(591)](){let t=n;return this[t(940)][t(591)]}}let Va=e.KLCap;async function Ri(r){let t=n;if(!this[t(1447)][t(1063)+"S"])return null;let{aID:i,fpID:o,messageStrategy:u}=this[t(1447)],h=e[t(1125)](r,Va);try{return this[t(1791)+t(1748)]?r&&this["_cursorM"+t(1748)]["updateCursorFile"+t(1601)](r):this["_cursorM"+t(1748)]=new Ja(o+"_"+i+"_"+h,h,u),this["_cursorM"+t(1748)][t(591)]||await this[t(1791)+t(1748)].openDB(),this[t(1791)+t(1748)]}catch{return null}}async function Ya(r,t){let i=n,o={iXPCU:function(T,O,j){return e.cSWtQ(T,O,j)},NDDNp:e.HetJG},u=Ue(r.message[i(1786)],e[i(1546)],"-1"),h=e[i(528)](Ue,r[i(1444)][i(1786)],e[i(787)],"1"),p=e[i(571)](ot,r[i(1444)].headers,e[i(1971)]),g=e.LUhjl(Number,e.cczYM(ot,r.message[i(1786)],i(1329)+i(1562)))||0,d=fr.call(this,r),y=e[i(1232)](Ue,r[i(1444)][i(1786)],e.nHZLf,"2"),v=ot(r[i(1444)][i(1786)],e[i(1074)]),A=e[i(515)](Number,e[i(1783)](ot,r[i(1444)][i(1786)],i(1723)+i(1647)+"ue"));if(d.isQoSAck)return e.wQqxF(t);let L=d[i(1274)+"sage"]?await Ti[i(1894)](this):null;if(e[i(1592)](r[i(1444)][i(1801)],0)&&h&&!u||e[i(891)](r[i(1444)][i(1801)],0))if(e[i(1365)](i(1186),e[i(1138)]))this[i(769)+"ameSpace"]=_0x4bdce4,this[i(829)+"ileName"]=_0x4efe40,this["_message"+i(741)]=_0x49c2df,this._qosDB=pBDEIF[i(1642)](_0x44cc1d,this[i(769)+"ameSpace"],pBDEIF[i(1046)]);else{if(p&&d[i(1274)+"sage"]&&L)return!!!await L[i(1301)](p)&&(this[i(851)+i(1841)+"Event"](r),await L[i(1746)](p,e[i(1760)](Date[i(1772)](),g))),t();if(y){let T=await Ri[i(1894)](this);if(!T)return this["_dispatc"+i(1841)+i(857)](r),e[i(1606)](t);let O=await T[i(1301)](v)??-1;if(e[i(573)](O,A))this["_dispatchMessage"+i(857)](r),T[i(1746)](v,A,r[i(1444)].service);else throw new Error(i(1881)+" message"+i(1151)+A+(i(845)+"than loc"+i(837)+"r ")+O);return e[i(1418)](t)}return this[i(851)+i(1841)+"Event"](r),e.FmDgX(t)}}async function Za(r,t){let i=n,o=fr[i(1894)](this,r);if(!o[i(1274)+i(699)])return t();let u=await Ti.call(this);if(o["isAckCleanupMess"+i(724)]&&o.ackMsgIds.length)for(let h of o[i(1039)+"s"])await u[i(1968)](h);e[i(792)](t)}async function $a(r,t){let i=n,o=e[i(998)](r[i(1444)][i(1309)+"e"],Ka),u=e[i(1997)](r.message.frameType,hr);if(!o&&!u)return t();let h=ot(r.message[i(1786)],i(1331)+"ile_name");if(!h)return e.VJVYP(t);let p=await Ri.call(this,h);if(!p)return e[i(1811)](t);if(o){let g=await p[i(1005)+"rs"](),d={frameType:g?.["frameType"],SeqID:M[i(1903)+"er"](this[i(676)]++),LogID:M[i(1903)+"er"](this[i(1447)][i(2023)+i(620)]()),service:9e3,method:5,headers:g?.headers,payload:g?.payload},y=e.zwDbw(S,d);this[i(1078)]&&this[i(1078)][i(1503)+"te"]&&this[i(1078)][i(1400)](y)}if(u){let g=r[i(1444)][i(1422)];g&&p.setCursors(g)}}let Xa=async function(r,t){let i=n;this[i(1979)]=!1,e[i(1743)](clearTimeout,this[i(531)+i(1628)+"utId"]),e[i(1506)](t)},Qa=async function(r,t){let i=n;if(!this[i(1078)]||e[i(574)](this[i(1078)].readyState,this.OPEN))return e[i(1545)](t);let{pingInterval:o}=this._options;this["_endpoin"+i(759)]?.["resetEnd"+i(862)+i(1290)]();for(let h=0;e[i(970)](h,this["_message"+i(1065)][i(861)]);h++)if(e[i(1488)](e[i(1040)],e[i(1040)])){let p=this["_message"+i(1065)][h];if(this._ws.readyState===this.OPEN&&e[i(1365)](null,p))this._ws&&this[i(1078)][i(1400)](p),this[i(1561)+i(1065)][h]=null;else break}else{let p=this[i(1263)+"tManager"]?.[i(1780)+i(989)+"nt"]();this[i(1572)](i(721)+p),e.iIoeG(_0xced9b0)}this["_message"+i(1065)]=this["_message"+i(1065)].filter(h=>!!h),this[i(840)+i(1067)+"Id"]=e[i(1727)](setTimeout,()=>this[i(1169)](),o),this[i(851)+i(1219)+"nt"](r),this._isBrowser&&this[i(1078)]&&(this._ws[i(1469)+"pe"]=this[i(1369)+i(647)]);let u=this[i(1263)+i(759)]?.[i(1780)+i(989)+"nt"]();this[i(1572)](i(721)+u+i(1961)),e[i(792)](t)},e0=async function(r,t){let i=n,o=this["_endpoin"+i(759)]?.getCurrentEndpoint();this[i(1572)](i(721)+o),t()};class t0 extends xr{constructor(t){let i=n,o={dtSVE:function(g,d,y){return e.ukQVs(g,d,y)},mHHcY:e[i(1426)],MruqT:function(g,d){return e[i(1323)](g,d)},rlTNC:e[i(1883)],zfQgh:function(g,d){return e[i(920)](g,d)},MjHkT:function(g,d){return e[i(1059)](g,d)},hhwev:i(1627),HiHdE:function(g,d,y){return e.XhDnJ(g,d,y)},AoyjC:function(g,d){return e[i(900)](g,d)}};super(),this[i(1321)+"igatorOn"+i(1256)]=!0,this[i(1251)+"er"]=st,this._isNode=ma,this[i(1298)+"T"]=Ve,this[i(1036)+"X"]=Ct,this[i(1391)+"r"]=At,this["_message"+i(1065)]=[],this["_endpoin"+i(759)]=null,this[i(1947)+"osed"]=!1,this[i(1369)+i(647)]=e[i(1675)],this["_connect"+i(1714)]=!1,this[i(531)+i(1628)+"utId"]=null,this[i(890)+i(1123)+i(980)]=null,this[i(840)+"gTimeoutId"]=null,this[i(676)]=0,this[i(1979)]=!1,this._url="",this[i(1316)+i(1e3)]=null,this[i(1791)+i(1748)]=null,this[i(1766)+i(1913)]=null,this._protocols=e[i(1637)],this.CLOSED=3,this.CONNECTING=0,this.OPEN=1,this[i(984)]=2,this[i(1644)]=g=>{let d=i;try{Ci(this,g,[Xa,Qa,e0])}catch(y){let v=o[d(1949)](de,o[d(1756)],{message:y[d(1444)],code:qe[d(1384)+"OR"],error:y});this[d(851)+d(1294)+"ent"](v)}},this[i(1929)+"ge"]=async g=>{let d=i;if(e[d(1568)](d(510),e[d(917)]))return new _0x2c54c1(_0x42a899,{message:_0x39d885});{let{pingInterval:y,pingFrequency:v}=this[d(1447)];if((e[d(1035)]("hi",g[d(955)])&&e.zJoIX(e[d(1531)],v)||e[d(1794)]===v)&&(this[d(2011)+"ngTimer"](),this[d(997)](e[d(876)],e[d(1264)]),this[d(840)+d(1067)+"Id"]=e.ThmhR(setTimeout,this[d(1169)].bind(this),y)),g.data==="hi")return;try{e[d(1590)](Ci,this,g,[Ra,Ta,Za,$a,Ya,Ia])}catch(A){if(e[d(1119)](d(575),"OxHvy")){let L=e[d(1935)](de,e[d(1426)],{message:A[d(1444)],code:qe[d(1020)+d(723)],error:A});this[d(851)+d(1294)+d(2001)](L)}else{let L=_0x2512a5[d(1444)].payload;L&&_0x5ae568[d(742)+"rs"](L)}}}},this[i(848)]=g=>{let d=i,y={Vofsf:function(v,A){return o[N(1305)](v,A)},qfOZH:o[d(1225)],hORDf:function(v,A){return o[d(1146)](v,A)},NjRSX:function(v,A){return o.MjHkT(v,A)}};if(o[d(1761)]!==o[d(1761)]){if(PKOgiT[d(1860)](_0x5bfa91,_0x4f7e26))throw new _0x5b772b(PKOgiT[d(1107)]);let v=3;for(;PKOgiT[d(1721)](v,0);){let A=255&_0x4e5d49;_0x5b9da4(A,_0x4d5149,_0x2a638c+v),_0x2cb479>>>=8,v--}return PKOgiT[d(1975)](_0xd196f9,4)}else{let v=this[d(1263)+"tManager"]?.[d(1739)+d(1377)+"es"](),A=this[d(1263)+"tManager"]?.[d(1780)+"ntEndpoint"]();if(v&&!g[d(1444)]){let L=d(1598)+A+(d(726)+d(1491)+d(609)+"ed");this._dispatchErrorEvent(o[d(1580)](de,o.mHHcY,{message:L,code:qe[d(1671)+"IES_ERROR"],error:g}));return}this[d(1078)]&&o[d(1577)](this[d(1078)][d(1503)+"te"],this[d(1383)])&&this._disconnect(),this["_dispatc"+d(1294)+"ent"](de(o.mHHcY,{message:g[d(1444)],code:qe[d(1713)+"RROR"],error:g}))}},this[i(1009)]=async g=>{let d=i;this[d(1499)+d(2e3)](),this["_clearPi"+d(781)](),this._removeWsListeners(),this[d(1078)]=null,this[d(531)+d(1714)]=!1;let y=this[d(1263)+d(759)]?.[d(1739)+d(1377)+"es"]();if(!y&&this["_navigat"+d(1326)]()&&!this[d(1947)+d(1808)])if(e[d(1620)]!==e[d(1620)])this[d(940)]?.[d(1968)](_0x3dfd95[d(1033)+"id"]);else{let v=this[d(1263)+d(759)]?.[d(1780)+"ntEndpoint"](),A=this[d(1447)][d(1511)+d(1393)+d(814)](g.code,g[d(1090)]);this["_dispatc"+d(1578)+d(2001)](e[d(2025)](pe,"close",{code:1006,reason:g.reason||d(546)+d(1092)+d(1762)+d(1946)+d(1651)+d(725)+v,willReconnect:A})),A&&this[d(531)]();return}if(e[d(1454)](1e3,g[d(2017)])&&this[d(1947)+d(1808)]){this[d(851)+"hCloseEvent"](pe(e.aSiiU,{code:1e3,reason:e.EPGXC})),this[d(1263)+d(759)]?.["resetEnd"+d(862)+d(1290)](),this[d(1766)+d(1913)]?.[d(1440)+d(791)]();return}if(e.mfNZZ(1e3,g[d(2017)])&&y)if(e[d(925)](e.xRDlj,e[d(1905)])){let v=this[d(1263)+d(759)]?.[d(1780)+"ntEndpoint"](),A=g[d(1090)];A||(A=await e[d(1446)](Ea,this[d(1175)])),A=d(546)+d(1092)+d(1079)+A+(d(831)+d(1238))+v+(d(2004)+"tries re"+d(1363)),this[d(851)+d(1578)+d(2001)](e[d(878)](pe,e[d(863)],{code:g[d(2017)],reason:A}));let L=d(1598)+v+(" fail, max retri"+d(609)+"ed");this[d(851)+d(1294)+d(2001)](de(e[d(1426)],{message:L,code:qe[d(1671)+d(838)+"R"]})),this[d(1263)+d(759)]?.[d(1188)+d(862)+d(1290)](),this[d(1766)+d(1913)]?.[d(1440)+d(791)]();return}else return _0x428b23;if(e[d(631)](1e3,g.code)&&!g.reason){let v=this[d(1263)+d(759)]?.[d(1780)+d(989)+"nt"]();this[d(851)+d(1578)+d(2001)](e[d(1722)](pe,e[d(863)],{code:g.code,reason:d(546)+d(1092)+"d, unkno"+d(1946)+d(1651)+"ame: "+v})),this[d(1263)+d(759)]?.[d(1188)+d(862)+"fig"](),this[d(1766)+d(1913)]?.[d(1440)+d(791)]();return}this["_dispatc"+d(1578)+d(2001)](g),this[d(1263)+d(759)]?.[d(1188)+d(862)+d(1290)](),this[d(1766)+d(1913)]?.[d(1440)+d(791)]()},this[i(653)]=null,this[i(1591)]=null,this.onmessage=null,this.onopen=null,this["onStartR"+i(947)]=null,this["onReceiv"+i(1386)]=null,this[i(650)+i(1206)+i(747)+"ct"]=null,this["_handleO"+i(1247)]=this[i(1662)+i(1247)][i(1917)](this),this[i(1662)+"ffLine"]=this[i(1662)+"ffLine"][i(1917)](this),this[i(1022)+"ageHide"]=this[i(1022)+"ageHide"][i(1917)](this),this[i(1022)+i(902)]=this[i(1022)+"ageShow"][i(1917)](this),this[i(1447)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e.enoYV(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:i(1037),pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:i(1832),env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:u,ws:h}=t,p=Array[i(1473)](u)?u:e.OImMI(i(1884),typeof u)?[u]:[];if(!p||e[i(1517)](0,p[i(861)]))throw new Error(e[i(527)]);if(!e[i(1096)](ya,h))throw new Error(e[i(1950)]);Object[i(1804)](this[i(1447)],t),this["_endpoin"+i(759)]=new Ei(p,this[i(1447)].maxRetries),this._pingLossCounter=new Sa(this[i(1447)][i(1778)+"Count"]),this._options[i(1878)+i(880)]&&(this[i(1979)]=!0,this[i(531)]()),this[i(1447)][i(682)+i(2021)+i(1144)]&&(this[i(1298)+"T"]||this[i(1036)+"X"]?this[i(1621)+i(1617)+i(1586)]():this[i(1251)+"er"]&&this[i(1130)+"balEvent"+i(754)]())}[n(1662)+"nLine"](){let t=n;if(e.JGFOy(e[t(819)],e.PRebP)){if(this[t(1447)][t(1472)+"utoRecon"+t(842)]||this[t(1947)+t(1808)])return;this[t(1430)+t(947)]()}else try{return!!this[t(940)]}catch(i){return _0xe5050b[t(1015)](i),!1}}[n(1662)+"ffLine"](){let t=n;this[t(1014)+t(1258)+"t"]();let i=e[t(1101)](ar,e[t(1043)],{message:t(1940)+t(1744)+t(1147)+"ct"});this[t(650)+t(1206)+t(747)+"ct"]&&this[t(650)+"mediatel"+t(747)+"ct"](i)}[n(1130)+n(1390)+n(754)](){let t=n;this[t(1251)+"er"]&&window[t(1337)+"Listener"]("online",this[t(1662)+t(1247)]),this[t(1251)+"er"]&&window.addEventListener(t(1111),this[t(1662)+t(1853)]),this._isBrowser&&window[t(1337)+t(754)](e[t(1118)],this[t(1022)+"ageHide"]),this[t(1251)+"er"]&&window[t(1337)+t(754)](e.QRgTP,this[t(1022)+"ageShow"])}["_dropGlo"+n(1390)+n(754)](){let t=n;this._isBrowser&&window[t(1741)+t(1110)+"ner"](e[t(1890)],this[t(1662)+t(1247)]),this[t(1251)+"er"]&&window[t(1741)+t(1110)+t(1465)](t(1111),this[t(1662)+"ffLine"]),this[t(1251)+"er"]&&window["removeEv"+t(1110)+t(1465)]("pagehide",this._handlePageHide),this[t(1251)+"er"]&&window[t(1741)+t(1110)+t(1465)](e.QRgTP,this._handlePageShow)}[n(1022)+n(585)](t){let i=n;!t[i(936)+"d"]&&(this._isBrowser&&window[i(1741)+i(1110)+i(1465)](i(909),this[i(1022)+i(585)]),this._isBrowser&&window[i(1741)+i(1110)+"ner"](e[i(1141)],this[i(1022)+i(902)]),this[i(1203)]()),this[i(1251)+"er"]&&window[i(1741)+"entListe"+i(1465)](e[i(1890)],this[i(1662)+"nLine"]),this[i(1251)+"er"]&&window[i(1741)+i(1110)+i(1465)](e[i(934)],this[i(1662)+i(1853)])}[n(1022)+n(902)](t){let i=n;if(e[i(932)](e[i(679)],e[i(700)])){let o=this[i(940)][i(1847)+i(888)+"nc"](this[i(1516)]),u=_0x1eafa5[i(1117)](o||"{}");return _0xac8c72[i(858)](u)}else t[i(936)+"d"]&&(this[i(776)+i(1326)]()&&(!this[i(1078)]||e[i(1535)](this[i(1078)].readyState,this.OPEN)||e.zFFtr(this[i(1078)][i(1503)+"te"],this[i(901)+"NG"]))&&this[i(1662)+i(1247)](),this._isBrowser&&window[i(1337)+i(754)](e[i(1890)],this["_handleO"+i(1247)]),this[i(1251)+"er"]&&window[i(1337)+i(754)](e[i(934)],this[i(1662)+i(1853)]))}async["_generat"+n(1707)](t){let i=n,{fpID:o,deviceID:u,bddID:h,ttwID:p,accessKey:g,aID:d,customParams:y={},enableAutoAck:v,enableQoS:A,QoSLevel:L,env:T}=this[i(1447)],O,j,xe;this._isBrowser||this[i(1036)+"X"]||this[i(1298)+"T"]?(O=location&&e[i(1514)](e[i(642)],location[i(1684)])?e[i(615)]:"ws://",j=t[i(1399)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),xe=/^wss(.*:\/\/)/[i(1726)](t)?t:""+O+j):(O=e[i(615)],j=t[i(1399)](/(^http)((?:[s]*:\/\/))/,""),xe=/(^ws)((?:[s]*:\/\/))/[i(1726)](j)?j:""+O+j);let at=h?e[i(1595)]:p?e.URpaK:e[i(1291)],Ni=h||p||u;if(!Ni||!at)throw new Error(e.Niiry);let n0=e[i(1514)](e[i(1764)],typeof y)?await e.xjCLt(y):y,r0=T?e[i(1210)](ba,T[i(1413)],T[i(1750)]):{},gr=Object[i(1804)]({device_platform:e[i(793)],version_code:e[i(1820)],access_key:g,fpid:o,aid:d,[at]:Ni,xsack:v?1:0,xaack:v?1:0,xsqos:A?1:0,qos_level:A?L:void 0,qos_sdk_version:2,...r0},n0),i0=Object[i(805)](gr).reduce((pr,mr)=>gr[mr]!==void 0?""+pr+(pr?"&":"?")+mr+"="+gr[mr]:pr,"");return xe+i(991)+i0}async[n(531)](){let t=n;if(!(this[t(531)+"Lock"]||this._readyClosed)){this[t(531)+t(1714)]=!0;try{if(e.LPyIn(t(873),e[t(1996)])){let i=this[t(1263)+t(759)]?.[t(568)+t(533)+"ointReac"+t(1928)+t(1720)](),{timeoutInterval:o}=this[t(1447)];if(i){let h=this["_endpoin"+t(759)]?.[t(1780)+"ntEndpoint"](),p=this[t(1263)+t(759)]?.["replaceBackupEnd"+t(623)+"UpdateCount"](),g=this[t(1263)+t(759)]?.[t(1780)+"ntEndpoi"+t(660)+t(1522)]();if(p){let d=t(1598)+h+(t(817)+t(2004)+t(1407)+t(1280)+t(1944)+t(1976)+t(1122))+p+(t(1275)+"y"),y=e[t(983)](de,t(780),{message:d,code:qe[t(1671)+t(838)+"R"]});this[t(1572)](d),this["_dispatc"+t(1294)+t(2001)](y),this._url=await this[t(662)+"eUrl"](p),this[t(1572)]("connect "+p+" "+g+" times"),this[t(1052)+"sListeners"]()}else{let d=t(1598)+h+(" timeout"+t(2004)+"tries re"+t(1363));this[t(1572)](d),this["_dispatc"+t(1294)+t(2001)](de(e[t(1426)],{message:d,code:qe.MAX_RETRIES_ERROR}));return}}else{let h=this[t(1263)+t(759)]?.["getCurre"+t(989)+t(1053)+t(542)](),p=this["_endpoin"+t(759)]?.[t(1780)+t(989)+t(660)+t(1522)]();this[t(1175)]=await this[t(662)+t(1707)](h||""),this[t(1572)](t(1598)+h+" "+p+t(1236)),this[t(1052)+t(1076)+"rs"]()}if(this[t(1979)])this[t(1979)]=!1;else{let h=e[t(1306)](ar,t(1511)+"t",{message:e[t(1789)]});this[t(757)+"econnect"]&&this[t(757)+t(947)](h)}let u=this[t(1263)+t(759)]?.[t(1780)+"ntEndpoi"+t(660)+t(1522)]()||0;u>1&&await this[t(1244)](u-1),this[t(1572)](t(546)+"ng url: "+this[t(1175)]+(t(1902)+t(1493))+this[t(651)+"ls"]),this._ws=e[t(1682)](_a,{url:this[t(1175)],protocols:[this[t(651)+"ls"]],headers:this[t(1447)][t(1851)+t(520)+"s"][t(1431)+t(1202)]},this[t(1447)].ws),(this._isBrowser||this[t(1391)+"r"])&&this._ws&&(this[t(1078)][t(1469)+"pe"]=this[t(1369)+t(647)]),this[t(1933)+t(1392)](),this[t(531)+t(1628)+t(728)]=e.OvgDJ(setTimeout,this[t(746)+"ut"][t(1917)](this),o)}else _0xa054cf[t(686)][t(715)+t(1176)](_0x1342cb),_0x4e0f29[t(1897)+t(996)]=void 0,e.mNxgV(_0x187502,_0x57f7ca&&_0x195a2f[t(1139)]||e[t(923)])}catch(i){throw this[t(531)+t(1714)]=!1,i}}}_clearTimer(){let t=n;e[t(1838)](clearTimeout,this[t(531)+t(1628)+t(728)]),this[t(531)+t(1628)+t(728)]=null}[n(2011)+n(781)](){let t=n;e[t(1333)](clearTimeout,this["_pingPon"+t(1067)+"Id"]),e[t(751)](clearTimeout,this[t(890)+t(1123)+t(980)]),this[t(840)+t(1067)+"Id"]=null,this[t(890)+t(1123)+"tId"]=null}_debug(...t){let i=n;this[i(1447)][i(1490)]&&console[i(1015)][i(1632)](console,[e[i(1093)],...t])}["_getInte"+n(1064)+"e"](t){let i=n,{initReconnectInterval:o,maxReconnectInterval:u,reconnectIntervalGrowFactor:h}=this[i(1447)],p=o*Math[i(1776)](h,e.hzDlC(t,1));return e[i(1323)](p,u)?u:p}_ping(){let t=n;if(this[t(1078)]&&e[t(1517)](this[t(1078)][t(1503)+"te"],this.CONNECTING)){this[t(2011)+t(781)](),this[t(840)+t(1067)+"Id"]=e[t(1485)](setTimeout,this._ping[t(1917)](this),this[t(1447)][t(673)+t(883)]);return}if(!this._ws||e[t(1544)](this._ws[t(1503)+"te"],this[t(1383)]))return void this[t(1430)+t(947)]();this._ws&&this._ws[t(1400)]("hi"),this[t(890)+t(1123)+t(980)]=e[t(1682)](setTimeout,this[t(1430)+t(947)+t(1134)][t(1917)](this),this._options[t(628)+t(1336)+"val"])}[n(1430)+n(947)+n(1134)](){let t=n;this[t(1766)+"sCounter"]?.[t(1024)](),this[t(997)](e[t(1836)],t(1814)),this[t(1766)+t(1913)]?.[t(1739)+t(1624)+"nt"]()?this["_handleR"+t(947)]():this[t(1169)]()}["_navigat"+n(1326)](){let t=n;return this[t(1298)+"T"]||this[t(1036)+"X"]?this[t(1321)+t(599)+t(1256)]:(this[t(1251)+"er"]||this[t(1391)+"r"])&&this[t(1447)]["listenNe"+t(2021)+"nged"]?navigator[t(1397)]:!0}[n(1430)+"econnect"](){let t=n;!this[t(776)+"orOnline"]()||this[t(1947)+t(1808)]||(this._endpointManager?.[t(1188)+t(862)+t(1290)](),this[t(1766)+t(1913)]?.[t(1440)+t(791)](),this._ws?this[t(969)+t(1639)](1001,e[t(1927)],!0):this[t(531)]())}[n(1621)+n(1617)+"ange"](){let t=n;this[t(1298)+"T"]?tt[t(866)+t(1367)+t(1524)](({isConnected:i})=>{let o=t;this[o(1321)+o(599)+o(1256)]=i,i?this[o(1662)+o(1247)]():this["_handleO"+o(1853)]()}):this._isMiniWX&&wx["onNetwor"+t(1367)+t(1524)](({isConnected:i})=>{let o=t;this[o(1321)+o(599)+"line"]=i,i?this[o(1662)+o(1247)]():this["_handleO"+o(1853)]()})}[n(1244)](t){return new Promise(i=>{setTimeout(i,this["_getInte"+N(1064)+"e"](t))})}[n(969)+n(1639)](t=1e3,i="",o=!1){let u=n;this[u(1078)]&&this[u(1014)+u(1258)+"t"](t,i,o)}[n(746)+"ut"](){let t=n,i=this[t(1263)+t(759)]?.getCurrentEndpoint();this[t(1572)](t(1598)+i+" timeout"),this["_disconn"+t(1639)](1001,e.wbmCJ,!0)}[n(1733)](t){let i=n,o=e[i(605)](or,t);this[i(1078)]&&e.oJONb(this[i(1078)][i(1503)+"te"],this[i(1383)])&&(this[i(1078)]&&this._ws[i(1400)](o),this._debug(e[i(941)],t))}[n(1052)+n(1076)+"rs"](){let t=n,i=e[t(1089)][t(1769)]("|"),o=0;for(;;){switch(i[o++]){case"0":this[t(1078)]["removeEv"+t(1110)+"ner"](e[t(1018)],this[t(1929)+"ge"]);continue;case"1":this[t(1078)][t(1741)+t(1110)+t(1465)](t(780),this._onError);continue;case"2":this[t(1078)][t(1741)+t(1110)+t(1465)](e[t(1481)],this[t(1644)]);continue;case"3":this[t(1078)][t(1741)+t(1110)+"ner"](e[t(863)],this._onClose);continue;case"4":if(!this[t(1078)])return;continue}break}}[n(1933)+"steners"](){let t=n,i=e.CwLAc[t(1769)]("|"),o=0;for(;;){switch(i[o++]){case"0":this[t(1078)][t(1337)+t(754)](e[t(1018)],this[t(1929)+"ge"]);continue;case"1":this[t(1078)][t(1337)+t(754)](t(1300),this[t(1644)]);continue;case"2":this[t(1078)][t(1337)+t(754)](e[t(863)],this[t(1009)]);continue;case"3":this[t(1078)][t(1337)+"Listener"](e[t(1426)],this[t(848)]);continue;case"4":if(!this._ws)return;continue}break}}[n(734)+n(654)](t=1e3,i=""){let o=n;try{this[o(1078)]&&this[o(1078)].close(t,i)}catch{}}[n(1014)+n(1258)+"t"](t=1e3,i="",o=!1){let u=n,h={ikLMk:function(p,g){return e[N(1152)](p,g)}};if(this["_clearPi"+u(781)](),this[u(1499)+u(2e3)](),this[u(1052)+u(1076)+"rs"](),this[u(734)+u(654)](1e3,i),this[u(531)+u(1714)]=!1,o&&this[u(776)+"orOnline"]()&&!this[u(1947)+"osed"]){if(e[u(982)](e[u(1585)],"RPKWZ"))return _0x36b59c&&(_0xe1db54=(0,_0x9891ce[VwvhXJ.ikLMk(_0x266f10,_0x5765af)[0]])(_0x5145ae=0)),_0x6c4346;if(this[u(1263)+u(759)]?.[u(1739)+u(1377)+"es"]()){let g=this[u(1263)+u(759)]?.[u(1780)+u(989)+"nt"]();this["_dispatc"+u(1578)+u(2001)](e[u(571)](pe,e.aSiiU,{code:1006,reason:u(1598)+g+(" timeout"+u(2004)+u(1407)+"ached"),wasClean:!0}))}else{let g=this[u(1447)]["reconnec"+u(1393)+u(814)](t,i);this["_dispatchCloseEv"+u(2001)](pe(e[u(863)],{code:t,reason:i,wasClean:!0,willReconnect:g})),g&&this[u(531)]()}return}this[u(776)+"orOnline"]()||this[u(1947)+"osed"]?this[u(851)+u(1578)+u(2001)](pe(e[u(863)],{code:t,reason:e[u(2022)]})):this[u(851)+"hCloseEv"+u(2001)](pe("close",{code:1006,reason:e[u(1931)]})),this[u(1078)]=null,this["_endpoin"+u(759)]?.[u(1188)+"pointCon"+u(1290)](),this["_pingLos"+u(1913)]?.["resetCou"+u(791)]()}[n(851)+n(1219)+"nt"](t){let i=n;this[i(997)](e[i(1481)],t),this[i(1199)]&&this.onopen(t)}[n(851)+n(1841)+n(857)](t){let i=n;this[i(997)](e[i(1018)],t),this[i(1292)+"e"]&&this[i(1292)+"e"](t)}[n(851)+n(1736)+n(1312)](t){let i=n;this[i(997)](e[i(708)],t),this[i(1589)+"eAck"]&&this["onReceiv"+i(1386)](t)}[n(851)+n(1294)+"ent"](t){let i=n;i(1520)===e[i(1350)]?(this.emit(e[i(1426)],t),this[i(1591)]&&this[i(1591)](t)):(_0x4bcb0f=e[i(1960)](_0x4541be,_0x11b283),_0x2c8861|=e[i(770)](127&_0x4ea3db,21),128&_0x1e2f2b&&(_0x38059c=e[i(1476)](_0x57bcff,_0x5d8a0e),_0x5dceb4=e[i(1460)](127,_0x4722c9),e[i(1829)](128,_0x3f96ee)&&(_0x100a88=e[i(1554)](_0xd2cd2c,_0x504ee0),_0x4eeb51|=e[i(1011)](127&_0x6950f1,7))))}[n(851)+"hCloseEvent"](t){let i=n;this[i(997)](e[i(863)],t),this[i(653)]&&this.onclose(t)}get[n(1469)+"pe"](){let t=n;return this._ws?this[t(1078)][t(1469)+"pe"]:this[t(1369)+t(647)]}set[n(1469)+"pe"](t){let i=n;this[i(1369)+"ype"]=t,this[i(1078)]&&(this[i(1078)][i(1469)+"pe"]=t)}get retryCount(){let t=n;return this[t(1263)+t(759)]?.[t(1780)+"ntEndpoi"+t(660)+t(1522)]()||0}get[n(774)+n(1848)](){let t=n;if(e.PEHVl(e[t(881)],"xToSY")){let i=this[t(1561)+"Queue"][t(1934)]((o,u)=>(o+=u&&u[t(1649)+"th"]||0,o),0);return e[t(1253)](i,this[t(1078)]?this._ws[t(774)+t(1848)]:0)}else return this[t(1031)][t(1684)]}get[n(1828)+"ns"](){let t=n;return this[t(1078)]?this[t(1078)][t(1828)+"ns"]:""}get protocol(){let t=n,i={cVfng:t(780),NSiHF:function(o,u,h){return e[t(1958)](o,u,h)}};if(e.lOpJi(e[t(988)],e[t(1427)]))return this[t(1078)]?this[t(1078)][t(1684)]:"";{let o=_0x31ad2e[t(516)][t(637)](_0x3c5760[t(1533)+"et"],e[t(1609)](_0x304a1a[t(1649)+"th"],_0x1dcc62[t(1533)+"et"]));this[t(1031)]&&this[t(1031)].send({data:o,fail:u=>{let h=t;this.emit(vceaWS[h(729)],vceaWS[h(1901)](_0x2fb803,vceaWS[h(729)],{message:this[h(922)+h(815)+"age"](u)}))}})}}get[n(1503)+"te"](){let t=n;return this[t(1078)]?this._ws[t(1503)+"te"]:this[t(1447)]["automati"+t(880)]?this[t(901)+"NG"]:this.CLOSED}get url(){return this[n(1078)]?this._ws.url:this._url}close(t=1e3,i){let o=n,u=("3|6|0|7|"+o(1954))[o(1769)]("|"),h=0;for(;;){switch(u[h++]){case"0":this[o(2011)+o(781)]();continue;case"1":if(!this[o(1078)])return void this[o(1572)]("close, w"+o(835)+o(1571)+"nitialized");continue;case"2":this[o(1014)+o(1258)+"t"](t,i);continue;case"3":this["_readyCl"+o(1808)]=!0;continue;case"4":this[o(1316)+o(1e3)]?.[o(2019)]();continue;case"5":if(e[o(1809)](this[o(1078)][o(1503)+"te"],this[o(886)])||e.sVbIn(this[o(1078)][o(1503)+"te"],this[o(984)]))return void this[o(1572)](e[o(1757)]);continue;case"6":this["_clearTi"+o(2e3)]();continue;case"7":this[o(964)+o(1390)+"Listener"]();continue}break}}async[n(1400)](t,i){let o=n;if(e[o(1514)](null,t))throw new Error(e[o(1080)]);e[o(1514)](e[o(1920)],typeof t)&&(t=JSON[o(1998)+"y"](t)),e[o(558)](e[o(1181)],typeof t)&&!e[o(1191)](t,ArrayBuffer)&&!(t[o(516)]&&e.UvBbm(t[o(516)],ArrayBuffer))&&(t=JSON.stringify(t));let u=await e[o(1731)](ki,t),h=e.PADxo(va,t),{method:p=0,service:g=this[o(1447)].service,logID:d=this._options[o(2023)+"erator"](),headers:y=this[o(1447)][o(1786)],payloadEncoding:v=this[o(1447)][o(730)+o(824)],payloadType:A=this._options[o(1788)+o(647)],logIDNew:L=this[o(1447)][o(529)+"Config"][o(1504)+o(869)+o(1091)+"ew"]?e[o(1382)](a,this[o(1447)][o(529)+o(1387)][o(1758)]):""}=e[o(1366)](i,{});if(!g)throw new Error(e[o(639)]);let T={SeqID:M[o(1903)+"er"](this._seqId++),LogID:M[o(1903)+"er"](d),service:g,method:p,headers:y,payloadEncoding:v instanceof Object?v[o(1378)]?v.encoding:"":v,payloadType:e[o(882)](A,Object)?A[o(1980)]?A[o(1980)]:h:A||h,payload:u,LogIDNew:L},O=e.yEmVH(or,T);return this._ws&&this[o(1078)][o(1503)+"te"]===this[o(1383)]?(this[o(1078)]&&this[o(1078)][o(1400)](O),this._debug(e[o(1677)],T)):e[o(994)](this[o(1561)+o(1065)][o(861)],this[o(1447)][o(669)+o(1267)+o(621)])?(this[o(1561)+o(1065)].push(O),this._debug(e[o(1448)],T)):(this[o(1561)+"Queue"][o(1874)](),this[o(1561)+o(1065)].push(O)),{seqID:this._seqId,logID:d,logIDNew:L}}async reconnect(t){let i=n,{url:o}=e[i(825)](t,{}),u=Array.isArray(o)?o:e.XkfzC(e[i(1181)],typeof o)?[o]:[];t&&Object[i(1804)](this._options,t),u&&u[i(861)]?this[i(1263)+i(759)]=new Ei(u,this[i(1447)][i(784)+"es"]):this["_endpoin"+i(759)]?.["resetEnd"+i(862)+i(1290)](),this[i(1766)+i(1913)]?.[i(1440)+i(791)](this[i(1447)][i(1778)+"Count"]),this[i(1947)+i(1808)]=!1,this[i(1078)]&&this[i(1078)][i(1503)+"te"]!==this[i(886)]?this[i(969)+"ect"](1e3,e[i(1574)],!0):(this._isInit=!0,this[i(531)]())}async[n(1654)](){let t=n;if(!this["_connect"+t(1714)]){let i=(t(1004)+"3").split("|"),o=0;for(;;){switch(i[o++]){case"0":this["_pingLos"+t(1913)]?.resetCounter();continue;case"1":this[t(1979)]=!0;continue;case"2":this[t(1947)+t(1808)]=!1;continue;case"3":this._connect();continue;case"4":this[t(1263)+t(759)]?.[t(1188)+"pointConfig"]();continue}break}}}[n(1337)+n(754)](t,i){this.on(t,i)}[n(1194)+n(857)](t){let i=n,{type:o}=t;this[i(997)](o,t)}[n(1741)+n(1110)+n(1465)](t,i){this[n(1683)](t,i)}[n(1471)](){let t=n,i={olESK:function(o,u){return e[N(1831)](o,u)},nfiDN:function(o,u){return e[N(927)](o,u)},aWbVu:function(o,u){return e.ZXwpl(o,u)},AEPuJ:"ping_onc"+t(1547)+"s"};if(e[t(1048)]("bHYsb",e[t(666)])){let o=_0x262060[t(1830)],u=_0x5a9e53.offset,h=_0x47a04d[t(1712)],p=tERpHe[t(614)](u,_0x4bf689);if(p>o[t(861)]){let g=new _0x131d36(2*p);g[t(1746)](o),_0x2393c8.bytes=g}return _0x58813e.offset=p,tERpHe[t(1638)](p,h)&&(_0x31ffc4.limit=p),u}else return new Promise((o,u)=>{let h=t,p={amkUs:function(y,v){return e.UxxSj(y,v)},DvVDC:h(1763),rTyPY:e.ZqcGN,wQEpy:e.WTFOd};this[h(2011)+h(781)](),this._pingPongTimeoutId=e[h(1439)](setTimeout,this[h(1169)][h(1917)](this),this[h(1447)][h(673)+h(883)]);let g=()=>{let y=h;p[y(593)](o,p.DvVDC),this[y(1683)](p.rTyPY,g),this[y(1683)](p[y(678)],d)},d=()=>{let y=h;i[y(554)](u,y(1814)),this[y(1683)](i[y(1479)],g),this.off(y(1131)+y(1010)+"t",d)};this.on(e[h(876)],g),this.on(e[h(1836)],d),this._ping()})}}})(),$[E(789)+E(1314)]=Z.CustomCloseEvent,$[E(1417)+E(1355)]=Z[E(1417)+E(1355)],$[E(2008)+"e"]=Z[E(2008)+"e"],$.Event=Z[E(857)],$[E(1241)]=Z.FWS,$[E(1328)+"MessageE"+E(944)]=Z[E(1328)+"MessageE"+E(944)],$.MessageEvent=Z[E(563)+E(944)],$.OpenEvent=Z[E(1017)+"t"],$[E(645)+E(1282)]=Z.ReconnectEvent,$[E(1767)+E(1314)]=Z[E(1767)+E(1314)],$["createEr"+E(1355)]=Z[E(1478)+E(1355)],$[E(1655)+E(602)+"nt"]=Z[E(1655)+E(602)+"nt"],$[E(698)+E(1658)]=Z["createOp"+E(1658)],$[E(1704)+"connectE"+E(944)]=Z["createRe"+E(548)+E(944)],$[E(755)+E(1806)]=Z["decodedF"+E(1806)],$[E(855)+E(1115)]=Z[E(855)+E(1115)];for(Pn in Z)["CustomCloseEvent",E(1417)+E(1355),E(2008)+"e",E(857),E(1241),"Frontier"+E(563)+E(944),E(563)+E(944),E(1017)+"t",E(645)+E(1282),"createCloseEvent","createEr"+E(1355),E(1655)+E(602)+"nt",E(698)+"enEvent",E(1704)+E(548)+"vent",E(755)+E(1806),E(855)+E(1115)][E(745)](Pn)===-1&&($[Pn]=Z[Pn]);var Pn;Object[E(1729)+E(1354)]($,E(1216)+"le",{value:!0})});var Le=oe((hh,Us)=>{"use strict";var zs=["nodebuffer","arraybuffer","fragments"],qs=typeof Blob<"u";qs&&zs.push("blob");Us.exports={BINARY_TYPES:zs,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:qs,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var qt=oe((gh,Bn)=>{"use strict";var{EMPTY_BUFFER:cc}=Le(),Ir=Buffer[Symbol.species];function uc(n,e){if(n.length===0)return cc;if(n.length===1)return n[0];let s=Buffer.allocUnsafe(e),a=0;for(let x=0;x<n.length;x++){let c=n[x];s.set(c,a),a+=c.length}return a<e?new Ir(s.buffer,s.byteOffset,a):s}function Fs(n,e,s,a,x){for(let c=0;c<x;c++)s[a+c]=n[c]^e[c&3]}function Hs(n,e){for(let s=0;s<n.length;s++)n[s]^=e[s&3]}function fc(n){return n.length===n.buffer.byteLength?n.buffer:n.buffer.slice(n.byteOffset,n.byteOffset+n.length)}function Rr(n){if(Rr.readOnly=!0,Buffer.isBuffer(n))return n;let e;return n instanceof ArrayBuffer?e=new Ir(n):ArrayBuffer.isView(n)?e=new Ir(n.buffer,n.byteOffset,n.byteLength):(e=Buffer.from(n),Rr.readOnly=!1),e}Bn.exports={concat:uc,mask:Fs,toArrayBuffer:fc,toBuffer:Rr,unmask:Hs};if(!process.env.WS_NO_BUFFER_UTIL)try{let n=Y("bufferutil");Bn.exports.mask=function(e,s,a,x,c){c<48?Fs(e,s,a,x,c):n.mask(e,s,a,x,c)},Bn.exports.unmask=function(e,s){e.length<32?Hs(e,s):n.unmask(e,s)}}catch{}});var Gs=oe((ph,js)=>{"use strict";var Ks=Symbol("kDone"),Nr=Symbol("kRun"),Lr=class{constructor(e){this[Ks]=()=>{this.pending--,this[Nr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Nr]()}[Nr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Ks])}}};js.exports=Lr});var pt=oe((mh,Ys)=>{"use strict";var Ut=Y("zlib"),Ws=qt(),dc=Gs(),{kStatusCode:Js}=Le(),lc=Buffer[Symbol.species],hc=Buffer.from([0,0,255,255]),zn=Symbol("permessage-deflate"),Oe=Symbol("total-length"),ht=Symbol("callback"),je=Symbol("buffers"),gt=Symbol("error"),Mn,Or=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 s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Mn=new dc(s)}}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[ht];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let s=this._options,a=e.find(x=>!(s.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(s.serverMaxWindowBits===!1||typeof s.serverMaxWindowBits=="number"&&s.serverMaxWindowBits>x.server_max_window_bits)||typeof s.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return s.serverNoContextTakeover&&(a.server_no_context_takeover=!0),s.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof s.serverMaxWindowBits=="number"&&(a.server_max_window_bits=s.serverMaxWindowBits),typeof s.clientMaxWindowBits=="number"?a.client_max_window_bits=s.clientMaxWindowBits:(a.client_max_window_bits===!0||s.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let s=e[0];if(this._options.clientNoContextTakeover===!1&&s.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!s.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(s.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&s.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return s}normalizeParams(e){return e.forEach(s=>{Object.keys(s).forEach(a=>{let x=s[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 c=+x;if(!Number.isInteger(c)||c<8||c>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=c}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let c=+x;if(!Number.isInteger(c)||c<8||c>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=c}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}"`);s[a]=x})}),e}decompress(e,s,a){Mn.add(x=>{this._decompress(e,s,(c,f)=>{x(),a(c,f)})})}compress(e,s,a){Mn.add(x=>{this._compress(e,s,(c,f)=>{x(),a(c,f)})})}_decompress(e,s,a){let x=this._isServer?"client":"server";if(!this._inflate){let c=`${x}_max_window_bits`,f=typeof this.params[c]!="number"?Ut.Z_DEFAULT_WINDOWBITS:this.params[c];this._inflate=Ut.createInflateRaw({...this._options.zlibInflateOptions,windowBits:f}),this._inflate[zn]=this,this._inflate[Oe]=0,this._inflate[je]=[],this._inflate.on("error",pc),this._inflate.on("data",Vs)}this._inflate[ht]=a,this._inflate.write(e),s&&this._inflate.write(hc),this._inflate.flush(()=>{let c=this._inflate[gt];if(c){this._inflate.close(),this._inflate=null,a(c);return}let f=Ws.concat(this._inflate[je],this._inflate[Oe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Oe]=0,this._inflate[je]=[],s&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,f)})}_compress(e,s,a){let x=this._isServer?"server":"client";if(!this._deflate){let c=`${x}_max_window_bits`,f=typeof this.params[c]!="number"?Ut.Z_DEFAULT_WINDOWBITS:this.params[c];this._deflate=Ut.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:f}),this._deflate[Oe]=0,this._deflate[je]=[],this._deflate.on("data",gc)}this._deflate[ht]=a,this._deflate.write(e),this._deflate.flush(Ut.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let c=Ws.concat(this._deflate[je],this._deflate[Oe]);s&&(c=new lc(c.buffer,c.byteOffset,c.length-4)),this._deflate[ht]=null,this._deflate[Oe]=0,this._deflate[je]=[],s&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,c)})}};Ys.exports=Or;function gc(n){this[je].push(n),this[Oe]+=n.length}function Vs(n){if(this[Oe]+=n.length,this[zn]._maxPayload<1||this[Oe]<=this[zn]._maxPayload){this[je].push(n);return}this[gt]=new RangeError("Max payload size exceeded"),this[gt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[gt][Js]=1009,this.removeListener("data",Vs),this.reset()}function pc(n){if(this[zn]._inflate=null,this[gt]){this[ht](this[gt]);return}n[Js]=1007,this[ht](n)}});var mt=oe((wh,qn)=>{"use strict";var{isUtf8:Zs}=Y("buffer"),{hasBlob:mc}=Le(),wc=[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 _c(n){return n>=1e3&&n<=1014&&n!==1004&&n!==1005&&n!==1006||n>=3e3&&n<=4999}function Br(n){let e=n.length,s=0;for(;s<e;)if((n[s]&128)===0)s++;else if((n[s]&224)===192){if(s+1===e||(n[s+1]&192)!==128||(n[s]&254)===192)return!1;s+=2}else if((n[s]&240)===224){if(s+2>=e||(n[s+1]&192)!==128||(n[s+2]&192)!==128||n[s]===224&&(n[s+1]&224)===128||n[s]===237&&(n[s+1]&224)===160)return!1;s+=3}else if((n[s]&248)===240){if(s+3>=e||(n[s+1]&192)!==128||(n[s+2]&192)!==128||(n[s+3]&192)!==128||n[s]===240&&(n[s+1]&240)===128||n[s]===244&&n[s+1]>143||n[s]>244)return!1;s+=4}else return!1;return!0}function yc(n){return mc&&typeof n=="object"&&typeof n.arrayBuffer=="function"&&typeof n.type=="string"&&typeof n.stream=="function"&&(n[Symbol.toStringTag]==="Blob"||n[Symbol.toStringTag]==="File")}qn.exports={isBlob:yc,isValidStatusCode:_c,isValidUTF8:Br,tokenChars:wc};if(Zs)qn.exports.isValidUTF8=function(n){return n.length<24?Br(n):Zs(n)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let n=Y("utf-8-validate");qn.exports.isValidUTF8=function(e){return e.length<32?Br(e):n(e)}}catch{}});var Fr=oe((_h,ro)=>{"use strict";var{Writable:vc}=Y("stream"),$s=pt(),{BINARY_TYPES:bc,EMPTY_BUFFER:Xs,kStatusCode:Sc,kWebSocket:Ec}=Le(),{concat:Mr,toArrayBuffer:Cc,unmask:Ac}=qt(),{isValidStatusCode:Dc,isValidUTF8:Qs}=mt(),Un=Buffer[Symbol.species],le=0,eo=1,to=2,no=3,zr=4,qr=5,Fn=6,Ur=class extends vc{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||bc[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ec]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=le}_write(e,s,a){if(this._opcode===8&&this._state==le)return a();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(a)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let a=this._buffers[0];return this._buffers[0]=new Un(a.buffer,a.byteOffset+e,a.length-e),new Un(a.buffer,a.byteOffset,e)}let s=Buffer.allocUnsafe(e);do{let a=this._buffers[0],x=s.length-e;e>=a.length?s.set(this._buffers.shift(),x):(s.set(new Uint8Array(a.buffer,a.byteOffset,e),x),this._buffers[0]=new Un(a.buffer,a.byteOffset+e,a.length-e)),e-=a.length}while(e>0);return s}startLoop(e){this._loop=!0;do switch(this._state){case le:this.getInfo(e);break;case eo:this.getPayloadLength16(e);break;case to:this.getPayloadLength64(e);break;case no:this.getMask();break;case zr:this.getData(e);break;case qr:case Fn:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let s=this.consume(2);if((s[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=(s[0]&64)===64;if(a&&!this._extensions[$s.extensionName]){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._fin=(s[0]&128)===128,this._opcode=s[0]&15,this._payloadLength=s[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=(s[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=eo:this._payloadLength===127?this._state=to: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 s=this.consume(8),a=s.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)+s.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 s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(s);return}this._masked?this._state=no:this._state=zr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=zr}getData(e){let s=Xs;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}s=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&Ac(s,this._mask)}if(this._opcode>7){this.controlMessage(s,e);return}if(this._compressed){this._state=qr,this.decompress(s,e);return}s.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(s)),this.dataMessage(e)}decompress(e,s){this._extensions[$s.extensionName].decompress(e,this._fin,(x,c)=>{if(x)return s(x);if(c.length){if(this._messageLength+=c.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let f=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");s(f);return}this._fragments.push(c)}this.dataMessage(s),this._state===le&&this.startLoop(s)})}dataMessage(e){if(!this._fin){this._state=le;return}let s=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=Mr(a,s):this._binaryType==="arraybuffer"?x=Cc(Mr(a,s)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=le):(this._state=Fn,setImmediate(()=>{this.emit("message",x,!0),this._state=le,this.startLoop(e)}))}else{let x=Mr(a,s);if(!this._skipUTF8Validation&&!Qs(x)){let c=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(c);return}this._state===qr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=le):(this._state=Fn,setImmediate(()=>{this.emit("message",x,!1),this._state=le,this.startLoop(e)}))}}controlMessage(e,s){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Xs),this.end();else{let a=e.readUInt16BE(0);if(!Dc(a)){let c=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");s(c);return}let x=new Un(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Qs(x)){let c=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");s(c);return}this._loop=!1,this.emit("conclude",a,x),this.end()}this._state=le;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=le):(this._state=Fn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=le,this.startLoop(s)}))}createError(e,s,a,x,c){this._loop=!1,this._errored=!0;let f=new e(a?`Invalid WebSocket frame: ${s}`:s);return Error.captureStackTrace(f,this.createError),f.code=c,f[Sc]=x,f}};ro.exports=Ur});var jr=oe((vh,oo)=>{"use strict";var{Duplex:yh}=Y("stream"),{randomFillSync:kc}=Y("crypto"),io=pt(),{EMPTY_BUFFER:Pc,kWebSocket:Tc,NOOP:Ic}=Le(),{isBlob:wt,isValidStatusCode:Rc}=mt(),{mask:so,toBuffer:$e}=qt(),he=Symbol("kByteLength"),Nc=Buffer.alloc(4),Hn=8*1024,Xe,_t=Hn,we=0,Lc=1,Oc=2,Hr=class n{constructor(e,s,a){this._extensions=s||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=we,this.onerror=Ic,this[Tc]=void 0}static frame(e,s){let a,x=!1,c=2,f=!1;s.mask&&(a=s.maskBuffer||Nc,s.generateMask?s.generateMask(a):(_t===Hn&&(Xe===void 0&&(Xe=Buffer.alloc(Hn)),kc(Xe,0,Hn),_t=0),a[0]=Xe[_t++],a[1]=Xe[_t++],a[2]=Xe[_t++],a[3]=Xe[_t++]),f=(a[0]|a[1]|a[2]|a[3])===0,c=6);let l;typeof e=="string"?(!s.mask||f)&&s[he]!==void 0?l=s[he]:(e=Buffer.from(e),l=e.length):(l=e.length,x=s.mask&&s.readOnly&&!f);let m=l;l>=65536?(c+=8,m=127):l>125&&(c+=2,m=126);let w=Buffer.allocUnsafe(x?l+c:c);return w[0]=s.fin?s.opcode|128:s.opcode,s.rsv1&&(w[0]|=64),w[1]=m,m===126?w.writeUInt16BE(l,2):m===127&&(w[2]=w[3]=0,w.writeUIntBE(l,4,6)),s.mask?(w[1]|=128,w[c-4]=a[0],w[c-3]=a[1],w[c-2]=a[2],w[c-1]=a[3],f?[w,e]:x?(so(e,a,w,c,l),[w]):(so(e,a,e,0,l),[w,e])):[w,e]}close(e,s,a,x){let c;if(e===void 0)c=Pc;else{if(typeof e!="number"||!Rc(e))throw new TypeError("First argument must be a valid error code number");if(s===void 0||!s.length)c=Buffer.allocUnsafe(2),c.writeUInt16BE(e,0);else{let l=Buffer.byteLength(s);if(l>123)throw new RangeError("The message must not be greater than 123 bytes");c=Buffer.allocUnsafe(2+l),c.writeUInt16BE(e,0),typeof s=="string"?c.write(s,2):c.set(s,2)}}let f={[he]:c.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==we?this.enqueue([this.dispatch,c,!1,f,x]):this.sendFrame(n.frame(c,f),x)}ping(e,s,a){let x,c;if(typeof e=="string"?(x=Buffer.byteLength(e),c=!1):wt(e)?(x=e.size,c=!1):(e=$e(e),x=e.length,c=$e.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let f={[he]:x,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:9,readOnly:c,rsv1:!1};wt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,f,a]):this.getBlobData(e,!1,f,a):this._state!==we?this.enqueue([this.dispatch,e,!1,f,a]):this.sendFrame(n.frame(e,f),a)}pong(e,s,a){let x,c;if(typeof e=="string"?(x=Buffer.byteLength(e),c=!1):wt(e)?(x=e.size,c=!1):(e=$e(e),x=e.length,c=$e.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let f={[he]:x,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:10,readOnly:c,rsv1:!1};wt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,f,a]):this.getBlobData(e,!1,f,a):this._state!==we?this.enqueue([this.dispatch,e,!1,f,a]):this.sendFrame(n.frame(e,f),a)}send(e,s,a){let x=this._extensions[io.extensionName],c=s.binary?2:1,f=s.compress,l,m;typeof e=="string"?(l=Buffer.byteLength(e),m=!1):wt(e)?(l=e.size,m=!1):(e=$e(e),l=e.length,m=$e.readOnly),this._firstFragment?(this._firstFragment=!1,f&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(f=l>=x._threshold),this._compress=f):(f=!1,c=0),s.fin&&(this._firstFragment=!0);let w={[he]:l,fin:s.fin,generateMask:this._generateMask,mask:s.mask,maskBuffer:this._maskBuffer,opcode:c,readOnly:m,rsv1:f};wt(e)?this._state!==we?this.enqueue([this.getBlobData,e,this._compress,w,a]):this.getBlobData(e,this._compress,w,a):this._state!==we?this.enqueue([this.dispatch,e,this._compress,w,a]):this.dispatch(e,this._compress,w,a)}getBlobData(e,s,a,x){this._bufferedBytes+=a[he],this._state=Oc,e.arrayBuffer().then(c=>{if(this._socket.destroyed){let l=new Error("The socket was closed while the blob was being read");process.nextTick(Kr,this,l,x);return}this._bufferedBytes-=a[he];let f=$e(c);s?this.dispatch(f,s,a,x):(this._state=we,this.sendFrame(n.frame(f,a),x),this.dequeue())}).catch(c=>{process.nextTick(Bc,this,c,x)})}dispatch(e,s,a,x){if(!s){this.sendFrame(n.frame(e,a),x);return}let c=this._extensions[io.extensionName];this._bufferedBytes+=a[he],this._state=Lc,c.compress(e,a.fin,(f,l)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Kr(this,m,x);return}this._bufferedBytes-=a[he],this._state=we,a.readOnly=!1,this.sendFrame(n.frame(l,a),x),this.dequeue()})}dequeue(){for(;this._state===we&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,s){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],s),this._socket.uncork()):this._socket.write(e[0],s)}};oo.exports=Hr;function Kr(n,e,s){typeof s=="function"&&s(e);for(let a=0;a<n._queue.length;a++){let x=n._queue[a],c=x[x.length-1];typeof c=="function"&&c(e)}}function Bc(n,e,s){Kr(n,e,s),n.onerror(e)}});var po=oe((bh,go)=>{"use strict";var{kForOnEventAttribute:Ft,kListener:Gr}=Le(),ao=Symbol("kCode"),xo=Symbol("kData"),co=Symbol("kError"),uo=Symbol("kMessage"),fo=Symbol("kReason"),yt=Symbol("kTarget"),lo=Symbol("kType"),ho=Symbol("kWasClean"),Be=class{constructor(e){this[yt]=null,this[lo]=e}get target(){return this[yt]}get type(){return this[lo]}};Object.defineProperty(Be.prototype,"target",{enumerable:!0});Object.defineProperty(Be.prototype,"type",{enumerable:!0});var Qe=class extends Be{constructor(e,s={}){super(e),this[ao]=s.code===void 0?0:s.code,this[fo]=s.reason===void 0?"":s.reason,this[ho]=s.wasClean===void 0?!1:s.wasClean}get code(){return this[ao]}get reason(){return this[fo]}get wasClean(){return this[ho]}};Object.defineProperty(Qe.prototype,"code",{enumerable:!0});Object.defineProperty(Qe.prototype,"reason",{enumerable:!0});Object.defineProperty(Qe.prototype,"wasClean",{enumerable:!0});var vt=class extends Be{constructor(e,s={}){super(e),this[co]=s.error===void 0?null:s.error,this[uo]=s.message===void 0?"":s.message}get error(){return this[co]}get message(){return this[uo]}};Object.defineProperty(vt.prototype,"error",{enumerable:!0});Object.defineProperty(vt.prototype,"message",{enumerable:!0});var Ht=class extends Be{constructor(e,s={}){super(e),this[xo]=s.data===void 0?null:s.data}get data(){return this[xo]}};Object.defineProperty(Ht.prototype,"data",{enumerable:!0});var Mc={addEventListener(n,e,s={}){for(let x of this.listeners(n))if(!s[Ft]&&x[Gr]===e&&!x[Ft])return;let a;if(n==="message")a=function(c,f){let l=new Ht("message",{data:f?c:c.toString()});l[yt]=this,Kn(e,this,l)};else if(n==="close")a=function(c,f){let l=new Qe("close",{code:c,reason:f.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});l[yt]=this,Kn(e,this,l)};else if(n==="error")a=function(c){let f=new vt("error",{error:c,message:c.message});f[yt]=this,Kn(e,this,f)};else if(n==="open")a=function(){let c=new Be("open");c[yt]=this,Kn(e,this,c)};else return;a[Ft]=!!s[Ft],a[Gr]=e,s.once?this.once(n,a):this.on(n,a)},removeEventListener(n,e){for(let s of this.listeners(n))if(s[Gr]===e&&!s[Ft]){this.removeListener(n,s);break}}};go.exports={CloseEvent:Qe,ErrorEvent:vt,Event:Be,EventTarget:Mc,MessageEvent:Ht};function Kn(n,e,s){typeof n=="object"&&n.handleEvent?n.handleEvent.call(n,s):n.call(e,s)}});var jn=oe((Sh,mo)=>{"use strict";var{tokenChars:Kt}=mt();function Ae(n,e,s){n[e]===void 0?n[e]=[s]:n[e].push(s)}function zc(n){let e=Object.create(null),s=Object.create(null),a=!1,x=!1,c=!1,f,l,m=-1,w=-1,b=-1,_=0;for(;_<n.length;_++)if(w=n.charCodeAt(_),f===void 0)if(b===-1&&Kt[w]===1)m===-1&&(m=_);else if(_!==0&&(w===32||w===9))b===-1&&m!==-1&&(b=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);b===-1&&(b=_);let k=n.slice(m,b);w===44?(Ae(e,k,s),s=Object.create(null)):f=k,m=b=-1}else throw new SyntaxError(`Unexpected character at index ${_}`);else if(l===void 0)if(b===-1&&Kt[w]===1)m===-1&&(m=_);else if(w===32||w===9)b===-1&&m!==-1&&(b=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);b===-1&&(b=_),Ae(s,n.slice(m,b),!0),w===44&&(Ae(e,f,s),s=Object.create(null),f=void 0),m=b=-1}else if(w===61&&m!==-1&&b===-1)l=n.slice(m,_),m=b=-1;else throw new SyntaxError(`Unexpected character at index ${_}`);else if(x){if(Kt[w]!==1)throw new SyntaxError(`Unexpected character at index ${_}`);m===-1?m=_:a||(a=!0),x=!1}else if(c)if(Kt[w]===1)m===-1&&(m=_);else if(w===34&&m!==-1)c=!1,b=_;else if(w===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${_}`);else if(w===34&&n.charCodeAt(_-1)===61)c=!0;else if(b===-1&&Kt[w]===1)m===-1&&(m=_);else if(m!==-1&&(w===32||w===9))b===-1&&(b=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);b===-1&&(b=_);let k=n.slice(m,b);a&&(k=k.replace(/\\/g,""),a=!1),Ae(s,l,k),w===44&&(Ae(e,f,s),s=Object.create(null),f=void 0),l=void 0,m=b=-1}else throw new SyntaxError(`Unexpected character at index ${_}`);if(m===-1||c||w===32||w===9)throw new SyntaxError("Unexpected end of input");b===-1&&(b=_);let S=n.slice(m,b);return f===void 0?Ae(e,S,s):(l===void 0?Ae(s,S,!0):a?Ae(s,l,S.replace(/\\/g,"")):Ae(s,l,S),Ae(e,f,s)),e}function qc(n){return Object.keys(n).map(e=>{let s=n[e];return Array.isArray(s)||(s=[s]),s.map(a=>[e].concat(Object.keys(a).map(x=>{let c=a[x];return Array.isArray(c)||(c=[c]),c.map(f=>f===!0?x:`${x}=${f}`).join("; ")})).join("; ")).join(", ")}).join(", ")}mo.exports={format:qc,parse:zc}});var Vn=oe((Ah,Po)=>{"use strict";var Uc=Y("events"),Fc=Y("https"),Hc=Y("http"),yo=Y("net"),Kc=Y("tls"),{randomBytes:jc,createHash:Gc}=Y("crypto"),{Duplex:Eh,Readable:Ch}=Y("stream"),{URL:Wr}=Y("url"),Ge=pt(),Wc=Fr(),Jc=jr(),{isBlob:Vc}=mt(),{BINARY_TYPES:wo,CLOSE_TIMEOUT:Yc,EMPTY_BUFFER:Gn,GUID:Zc,kForOnEventAttribute:Jr,kListener:$c,kStatusCode:Xc,kWebSocket:X,NOOP:vo}=Le(),{EventTarget:{addEventListener:Qc,removeEventListener:eu}}=po(),{format:tu,parse:nu}=jn(),{toBuffer:ru}=qt(),bo=Symbol("kAborted"),Vr=[8,13],Me=["CONNECTING","OPEN","CLOSING","CLOSED"],iu=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,H=class n extends Uc{constructor(e,s,a){super(),this._binaryType=wo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Gn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=n.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,s===void 0?s=[]:Array.isArray(s)||(typeof s=="object"&&s!==null?(a=s,s=[]):s=[s]),So(this,e,s,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){wo.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,s,a){let x=new Wc({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),c=new Jc(e,this._extensions,a.generateMask);this._receiver=x,this._sender=c,this._socket=e,x[X]=this,c[X]=this,e[X]=this,x.on("conclude",au),x.on("drain",xu),x.on("error",cu),x.on("message",uu),x.on("ping",fu),x.on("pong",du),c.onerror=lu,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),s.length>0&&e.unshift(s),e.on("close",Ao),e.on("data",Jn),e.on("end",Do),e.on("error",ko),this._readyState=n.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=n.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ge.extensionName]&&this._extensions[Ge.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=n.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,s){if(this.readyState!==n.CLOSED){if(this.readyState===n.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===n.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=n.CLOSING,this._sender.close(e,s,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Co(this)}}pause(){this.readyState===n.CONNECTING||this.readyState===n.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,s,a){if(this.readyState===n.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=s=void 0):typeof s=="function"&&(a=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==n.OPEN){Yr(this,e,a);return}s===void 0&&(s=!this._isServer),this._sender.ping(e||Gn,s,a)}pong(e,s,a){if(this.readyState===n.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=s=void 0):typeof s=="function"&&(a=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==n.OPEN){Yr(this,e,a);return}s===void 0&&(s=!this._isServer),this._sender.pong(e||Gn,s,a)}resume(){this.readyState===n.CONNECTING||this.readyState===n.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,s,a){if(this.readyState===n.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof s=="function"&&(a=s,s={}),typeof e=="number"&&(e=e.toString()),this.readyState!==n.OPEN){Yr(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...s};this._extensions[Ge.extensionName]||(x.compress=!1),this._sender.send(e||Gn,x,a)}terminate(){if(this.readyState!==n.CLOSED){if(this.readyState===n.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=n.CLOSING,this._socket.destroy())}}};Object.defineProperty(H,"CONNECTING",{enumerable:!0,value:Me.indexOf("CONNECTING")});Object.defineProperty(H.prototype,"CONNECTING",{enumerable:!0,value:Me.indexOf("CONNECTING")});Object.defineProperty(H,"OPEN",{enumerable:!0,value:Me.indexOf("OPEN")});Object.defineProperty(H.prototype,"OPEN",{enumerable:!0,value:Me.indexOf("OPEN")});Object.defineProperty(H,"CLOSING",{enumerable:!0,value:Me.indexOf("CLOSING")});Object.defineProperty(H.prototype,"CLOSING",{enumerable:!0,value:Me.indexOf("CLOSING")});Object.defineProperty(H,"CLOSED",{enumerable:!0,value:Me.indexOf("CLOSED")});Object.defineProperty(H.prototype,"CLOSED",{enumerable:!0,value:Me.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(n=>{Object.defineProperty(H.prototype,n,{enumerable:!0})});["open","error","close","message"].forEach(n=>{Object.defineProperty(H.prototype,`on${n}`,{enumerable:!0,get(){for(let e of this.listeners(n))if(e[Jr])return e[$c];return null},set(e){for(let s of this.listeners(n))if(s[Jr]){this.removeListener(n,s);break}typeof e=="function"&&this.addEventListener(n,e,{[Jr]:!0})}})});H.prototype.addEventListener=Qc;H.prototype.removeEventListener=eu;Po.exports=H;function So(n,e,s,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Yc,protocolVersion:Vr[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(n._autoPong=x.autoPong,n._closeTimeout=x.closeTimeout,!Vr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Vr.join(", ")})`);let c;if(e instanceof Wr)c=e;else try{c=new Wr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}c.protocol==="http:"?c.protocol="ws:":c.protocol==="https:"&&(c.protocol="wss:"),n._url=c.href;let f=c.protocol==="wss:",l=c.protocol==="ws+unix:",m;if(c.protocol!=="ws:"&&!f&&!l?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:l&&!c.pathname?m="The URL's pathname is empty":c.hash&&(m="The URL contains a fragment identifier"),m){let I=new SyntaxError(m);if(n._redirects===0)throw I;Wn(n,I);return}let w=f?443:80,b=jc(16).toString("base64"),_=f?Fc.request:Hc.request,S=new Set,k;if(x.createConnection=x.createConnection||(f?ou:su),x.defaultPort=x.defaultPort||w,x.port=c.port||w,x.host=c.hostname.startsWith("[")?c.hostname.slice(1,-1):c.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":b,Connection:"Upgrade",Upgrade:"websocket"},x.path=c.pathname+c.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(k=new Ge({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=tu({[Ge.extensionName]:k.offer()})),s.length){for(let I of s){if(typeof I!="string"||!iu.test(I)||S.has(I))throw new SyntaxError("An invalid or duplicated subprotocol was specified");S.add(I)}x.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(c.username||c.password)&&(x.auth=`${c.username}:${c.password}`),l){let I=x.path.split(":");x.socketPath=I[0],x.path=I[1]}let P;if(x.followRedirects){if(n._redirects===0){n._originalIpc=l,n._originalSecure=f,n._originalHostOrSocketPath=l?x.socketPath:c.host;let I=a&&a.headers;if(a={...a,headers:{}},I)for(let[z,ie]of Object.entries(I))a.headers[z.toLowerCase()]=ie}else if(n.listenerCount("redirect")===0){let I=l?n._originalIpc?x.socketPath===n._originalHostOrSocketPath:!1:n._originalIpc?!1:c.host===n._originalHostOrSocketPath;(!I||n._originalSecure&&!f)&&(delete x.headers.authorization,delete x.headers.cookie,I||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),P=n._req=_(x),n._redirects&&n.emit("redirect",n.url,P)}else P=n._req=_(x);x.timeout&&P.on("timeout",()=>{fe(n,P,"Opening handshake has timed out")}),P.on("error",I=>{P===null||P[bo]||(P=n._req=null,Wn(n,I))}),P.on("response",I=>{let z=I.headers.location,ie=I.statusCode;if(z&&x.followRedirects&&ie>=300&&ie<400){if(++n._redirects>x.maxRedirects){fe(n,P,"Maximum redirects exceeded");return}P.abort();let Q;try{Q=new Wr(z,e)}catch{let ae=new SyntaxError(`Invalid URL: ${z}`);Wn(n,ae);return}So(n,Q,s,a)}else n.emit("unexpected-response",P,I)||fe(n,P,`Unexpected server response: ${I.statusCode}`)}),P.on("upgrade",(I,z,ie)=>{if(n.emit("upgrade",I),n.readyState!==H.CONNECTING)return;P=n._req=null;let Q=I.headers.upgrade;if(Q===void 0||Q.toLowerCase()!=="websocket"){fe(n,z,"Invalid Upgrade header");return}let _e=Gc("sha1").update(b+Zc).digest("base64");if(I.headers["sec-websocket-accept"]!==_e){fe(n,z,"Invalid Sec-WebSocket-Accept header");return}let ae=I.headers["sec-websocket-protocol"],D;if(ae!==void 0?S.size?S.has(ae)||(D="Server sent an invalid subprotocol"):D="Server sent a subprotocol but none was requested":S.size&&(D="Server sent no subprotocol"),D){fe(n,z,D);return}ae&&(n._protocol=ae);let q=I.headers["sec-websocket-extensions"];if(q!==void 0){if(!k){fe(n,z,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let J;try{J=nu(q)}catch{fe(n,z,"Invalid Sec-WebSocket-Extensions header");return}let ee=Object.keys(J);if(ee.length!==1||ee[0]!==Ge.extensionName){fe(n,z,"Server indicated an extension that was not requested");return}try{k.accept(J[Ge.extensionName])}catch{fe(n,z,"Invalid Sec-WebSocket-Extensions header");return}n._extensions[Ge.extensionName]=k}n.setSocket(z,ie,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(P,n):P.end()}function Wn(n,e){n._readyState=H.CLOSING,n._errorEmitted=!0,n.emit("error",e),n.emitClose()}function su(n){return n.path=n.socketPath,yo.connect(n)}function ou(n){return n.path=void 0,!n.servername&&n.servername!==""&&(n.servername=yo.isIP(n.host)?"":n.host),Kc.connect(n)}function fe(n,e,s){n._readyState=H.CLOSING;let a=new Error(s);Error.captureStackTrace(a,fe),e.setHeader?(e[bo]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Wn,n,a)):(e.destroy(a),e.once("error",n.emit.bind(n,"error")),e.once("close",n.emitClose.bind(n)))}function Yr(n,e,s){if(e){let a=Vc(e)?e.size:ru(e).length;n._socket?n._sender._bufferedBytes+=a:n._bufferedAmount+=a}if(s){let a=new Error(`WebSocket is not open: readyState ${n.readyState} (${Me[n.readyState]})`);process.nextTick(s,a)}}function au(n,e){let s=this[X];s._closeFrameReceived=!0,s._closeMessage=e,s._closeCode=n,s._socket[X]!==void 0&&(s._socket.removeListener("data",Jn),process.nextTick(Eo,s._socket),n===1005?s.close():s.close(n,e))}function xu(){let n=this[X];n.isPaused||n._socket.resume()}function cu(n){let e=this[X];e._socket[X]!==void 0&&(e._socket.removeListener("data",Jn),process.nextTick(Eo,e._socket),e.close(n[Xc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",n))}function _o(){this[X].emitClose()}function uu(n,e){this[X].emit("message",n,e)}function fu(n){let e=this[X];e._autoPong&&e.pong(n,!this._isServer,vo),e.emit("ping",n)}function du(n){this[X].emit("pong",n)}function Eo(n){n.resume()}function lu(n){let e=this[X];e.readyState!==H.CLOSED&&(e.readyState===H.OPEN&&(e._readyState=H.CLOSING,Co(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",n)))}function Co(n){n._closeTimer=setTimeout(n._socket.destroy.bind(n._socket),n._closeTimeout)}function Ao(){let n=this[X];if(this.removeListener("close",Ao),this.removeListener("data",Jn),this.removeListener("end",Do),n._readyState=H.CLOSING,!this._readableState.endEmitted&&!n._closeFrameReceived&&!n._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);n._receiver.write(e)}n._receiver.end(),this[X]=void 0,clearTimeout(n._closeTimer),n._receiver._writableState.finished||n._receiver._writableState.errorEmitted?n.emitClose():(n._receiver.on("error",_o),n._receiver.on("finish",_o))}function Jn(n){this[X]._receiver.write(n)||this.pause()}function Do(){let n=this[X];n._readyState=H.CLOSING,n._receiver.end(),this.end()}function ko(){let n=this[X];this.removeListener("error",ko),this.on("error",vo),n&&(n._readyState=H.CLOSING,this.destroy())}});var No=oe((kh,Ro)=>{"use strict";var Dh=Vn(),{Duplex:hu}=Y("stream");function To(n){n.emit("close")}function gu(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Io(n){this.removeListener("error",Io),this.destroy(),this.listenerCount("error")===0&&this.emit("error",n)}function pu(n,e){let s=!0,a=new hu({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return n.on("message",function(c,f){let l=!f&&a._readableState.objectMode?c.toString():c;a.push(l)||n.pause()}),n.once("error",function(c){a.destroyed||(s=!1,a.destroy(c))}),n.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,c){if(n.readyState===n.CLOSED){c(x),process.nextTick(To,a);return}let f=!1;n.once("error",function(m){f=!0,c(m)}),n.once("close",function(){f||c(x),process.nextTick(To,a)}),s&&n.terminate()},a._final=function(x){if(n.readyState===n.CONNECTING){n.once("open",function(){a._final(x)});return}n._socket!==null&&(n._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(n._socket.once("finish",function(){x()}),n.close()))},a._read=function(){n.isPaused&&n.resume()},a._write=function(x,c,f){if(n.readyState===n.CONNECTING){n.once("open",function(){a._write(x,c,f)});return}n.send(x,f)},a.on("end",gu),a.on("error",Io),a}Ro.exports=pu});var Zr=oe((Ph,Lo)=>{"use strict";var{tokenChars:mu}=mt();function wu(n){let e=new Set,s=-1,a=-1,x=0;for(x;x<n.length;x++){let f=n.charCodeAt(x);if(a===-1&&mu[f]===1)s===-1&&(s=x);else if(x!==0&&(f===32||f===9))a===-1&&s!==-1&&(a=x);else if(f===44){if(s===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);let l=n.slice(s,a);if(e.has(l))throw new SyntaxError(`The "${l}" subprotocol is duplicated`);e.add(l),s=a=-1}else throw new SyntaxError(`Unexpected character at index ${x}`)}if(s===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let c=n.slice(s,x);if(e.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);return e.add(c),e}Lo.exports={parse:wu}});var Fo=oe((Ih,Uo)=>{"use strict";var _u=Y("events"),Yn=Y("http"),{Duplex:Th}=Y("stream"),{createHash:yu}=Y("crypto"),Oo=jn(),et=pt(),vu=Zr(),bu=Vn(),{CLOSE_TIMEOUT:Su,GUID:Eu,kWebSocket:Cu}=Le(),Au=/^[+/0-9A-Za-z]{22}==$/,Bo=0,Mo=1,qo=2,$r=class extends _u{constructor(e,s){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Su,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:bu,...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=Yn.createServer((a,x)=>{let c=Yn.STATUS_CODES[426];x.writeHead(426,{"Content-Length":c.length,"Content-Type":"text/plain"}),x.end(c)}),this._server.listen(e.port,e.host,e.backlog,s)):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:(x,c,f)=>{this.handleUpgrade(x,c,f,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Bo}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===qo){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!==Mo)if(this._state=Mo,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 s=this._server;this._removeListeners(),this._removeListeners=this._server=null,s.close(()=>{jt(this)})}}shouldHandle(e){if(this.options.path){let s=e.url.indexOf("?");if((s!==-1?e.url.slice(0,s):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,s,a,x){s.on("error",zo);let c=e.headers["sec-websocket-key"],f=e.headers.upgrade,l=+e.headers["sec-websocket-version"];if(e.method!=="GET"){nt(this,e,s,405,"Invalid HTTP method");return}if(f===void 0||f.toLowerCase()!=="websocket"){nt(this,e,s,400,"Invalid Upgrade header");return}if(c===void 0||!Au.test(c)){nt(this,e,s,400,"Missing or invalid Sec-WebSocket-Key header");return}if(l!==13&&l!==8){nt(this,e,s,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Gt(s,400);return}let m=e.headers["sec-websocket-protocol"],w=new Set;if(m!==void 0)try{w=vu.parse(m)}catch{nt(this,e,s,400,"Invalid Sec-WebSocket-Protocol header");return}let b=e.headers["sec-websocket-extensions"],_={};if(this.options.perMessageDeflate&&b!==void 0){let S=new et({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let k=Oo.parse(b);k[et.extensionName]&&(S.accept(k[et.extensionName]),_[et.extensionName]=S)}catch{nt(this,e,s,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let S={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(S,(k,P,I,z)=>{if(!k)return Gt(s,P||401,I,z);this.completeUpgrade(_,c,w,e,s,a,x)});return}if(!this.options.verifyClient(S))return Gt(s,401)}this.completeUpgrade(_,c,w,e,s,a,x)}completeUpgrade(e,s,a,x,c,f,l){if(!c.readable||!c.writable)return c.destroy();if(c[Cu])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Bo)return Gt(c,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${yu("sha1").update(s+Eu).digest("base64")}`],b=new this.options.WebSocket(null,void 0,this.options);if(a.size){let _=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;_&&(w.push(`Sec-WebSocket-Protocol: ${_}`),b._protocol=_)}if(e[et.extensionName]){let _=e[et.extensionName].params,S=Oo.format({[et.extensionName]:[_]});w.push(`Sec-WebSocket-Extensions: ${S}`),b._extensions=e}this.emit("headers",w,x),c.write(w.concat(`\r
8
+ var i0=Object.create;var _r=Object.defineProperty;var o0=Object.getOwnPropertyDescriptor;var a0=Object.getOwnPropertyNames;var c0=Object.getPrototypeOf,x0=Object.prototype.hasOwnProperty;var X=(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 Te=(r,e)=>()=>(r&&(e=r(r=0)),e);var ce=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ns=(r,e)=>{for(var i in e)_r(r,i,{get:e[i],enumerable:!0})},u0=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of a0(e))!x0.call(r,c)&&c!==i&&_r(r,c,{get:()=>e[c],enumerable:!(a=o0(e,c))||a.enumerable});return r};var Re=(r,e,i)=>(i=r!=null?i0(c0(r)):{},u0(e||!r||!r.__esModule?_r(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as d0,mkdir as f0,readFile as l0,rename as Ls,writeFile as Os}from"node:fs/promises";import{dirname as h0}from"node:path";async function xt(r){try{let e=await l0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Xt(r,e,i){await f0(h0(r),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
9
+ `,c=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await Os(c,a,{encoding:"utf8",mode:i.mode}):await Os(c,a,"utf8"),await Ls(c,r),i?.mode!==void 0&&await d0(r,i.mode)}catch(u){await Ls(c,c).catch(()=>{});let{rm:d}=await import("node:fs/promises");throw await d(c,{force:!0}).catch(()=>{}),u}}var Zt=Te(()=>{"use strict"});function zs(r){return en[Bs]<=en[r]}function yr(r){Ms={...r}}function Qt(r,e,i,a){if(en[r]<en[Bs])return;let c=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...Ms,...a});r==="error"||r==="warn"?p0.write(`${c}
10
+ `):g0.write(`${c}
11
+ `)}function N(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=>N(`${r}.${e}`)}}var en,Bs,g0,p0,Ms,G=Te(()=>{"use strict";en={debug:10,info:20,warn:30,error:40},Bs=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),g0=process.stdout,p0=process.stderr,Ms={}});import{homedir as m0}from"node:os";import{join as re}from"node:path";function j(r){let e=r??m0(),i=re(e,".coze"),a=re(i,"bridge"),c=re(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:c,libEntry:re(c,"index.js"),pidFile:re(a,"bridge.pid"),portFile:re(a,"bridge.port"),tokenFile:re(a,"bridge.token"),logFile:re(a,"bridge.log"),installLock:re(a,"install.lock"),configFile:re(a,"config.json"),agentsRoot:re(i,"agents")}}function Ne(r,e=j()){let i=re(e.agentsRoot,r);return{root:i,config:re(i,"config.json"),workspace:re(i,"workspace"),logs:re(i,"logs")}}var ue=Te(()=>{"use strict"});var rn={};Ns(rn,{AGENT_CONFIG_FILE_MODE:()=>tn,enforceAgentConfigMode:()=>y0,loadAgentConfig:()=>de,persistAgentSessions:()=>br,persistAgentSkills:()=>nn,saveAgentConfig:()=>we});import{chmod as w0,stat as _0}from"node:fs/promises";function de(r,e){return xt(Ne(r,e).config)}function we(r,e){return Xt(Ne(r.agentId,e).config,r,{mode:tn})}async function y0(r,e){if(process.platform==="win32")return;let i=Ne(r,e).config;try{let a=await _0(i);if(!a.isFile())return;let c=a.mode&511;c!==tn&&(await w0(i,tn),qs.warn("agent config mode auto-corrected to 0600",{path:i,from:c.toString(8)}))}catch(a){if(a.code==="ENOENT")return;qs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function br(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 qs,tn,Ke=Te(()=>{"use strict";Zt();G();ue();qs=N("agent-config"),tn=384});var Mi=ce(Y=>{"use strict";var S=D;(function(r,e){let i=D,a=r();for(;;)try{if(parseInt(i(966))/1*(parseInt(i(1250))/2)+parseInt(i(295))/3+parseInt(i(630))/4*(-parseInt(i(1273))/5)+-parseInt(i(968))/6*(parseInt(i(1191))/7)+-parseInt(i(186))/8+-parseInt(i(1471))/9+-parseInt(i(993))/10*(-parseInt(i(1352))/11)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Nn,468857);var $c=Object["definePr"+S(1524)],Xc=Object[S(1294)+"opertyNa"+S(1434)],Ri=(r,e)=>function(){return r&&(e=(0,r[{fObui:function(u,d){return u(d)}}[S(580)](Xc,r)[0]])(r=0)),e},Zc=(r,e)=>{let i=S,a={nYuXT:function(u,d,h,m){return u(d,h,m)}};for(var c in e)a[i(757)]($c,r,c,{get:e[c],enumerable:!0})};function Nn(){let r=["vhbhzwy","B2jQzwn0u3q","ysbTDxn0igi","z2v0t3DUuhi","DuvKrKK","x29WDgLVBNm","qwvvCwq","nNWXmhW3FdG","y3jLyxrLq2W","CM92AwrLihC","x29UtwvZC2e","ww9Zq1G","wxHwugG","z2v0u3rVCMe","yxjYyxLIDwy","BxnNsuq","yxPwqxe","BgfMrLm","shvTBvm","B3vUDa","DMvYC2LVBMm","uxjpq0G","Dw50","Cg1AsuW","ihrVihjLDhi","zw5XDwv1zq","DxnLCKLW","r1nduwq","vNzez3q","AxnAzxjV","ufrhyNi","DKLgtNq","zxnqC20","DMfS","CMfUzg9T","zcbLCNjVCI4","A3fyDKm","ywnOzwqSihC","x29Uq2XVC2u","Cw9TEgK","mdaWma","q29UzMLN","wujpv0y","t2XyBxy","vKjqBgm","Axnby2TdBgu","zg5qu1y","D1jrALq","vfPJD1u","ruLmwvy","BNrLCG","tg9eDe4","x2TLEvbHDgG","D3jPDgvvAw4","B21ds2q","zw50","BKTdsLG","v0r3yMK","DMLJzuLeig8","z29PBNq","v25ZA0i","nJG1ndfcwLnJuhG","ChrVCG","A29lC0O","zgf0yq","swnLAKG","C3bSAxq","wgL2Duq","rhvMDhC","v0fWC0q","zgvJB2rLzey","C2vUzf9Hy2S","rK1NEgm","B0PPEvq","z0P1DMq","rxjYB3jdB2q","qwjVCNrfCNi","CMvTB3zLrxy","Dg9mB3DLCKm","qu1fqMq","B25TzxnZywC","AxnFywnR","zw5JB2rPBMC","Dhj1y3rVCIa","C3bSAwnL","nNW1Fdm","Cgnstxi","D1DdAu8","CMfTzq","CMLLC0nVDw4","y2HLy2TdDxi","Ef9MCM9UDgK","z2zLCLK","CMvZzxrfBMq","zNjVBunOyxi","A1LisuG","q09oveLovuu","sNbHsLC","y29UC3rYDwm","A21br04","AxLdrKK","Cgf5Bg9Hzfq","EgPAtK0","uurXEwS","yw1L","zxmGCMvHy2G","A0X4sgu","AvL3Dxi","CMvWBgfJzq","qufuELC","vhrruxq","CgLUz19VBMm","DMfSDwu","uxbSEKW","yxnL","Dg9oDw1Izxi","vfbXsgS","yMLUza","Bg9N","qw1VDw50","q0rfvey","zhDItLK","uvHdwuC","u25Nu2W","tfLAtNC","DM1zEKm","D2vI","uLPQree","yNv5Agy","DgfIyxnL","rKDIuKm","ywXSB2nvBNm","Dgv4DfbHEwW","EfvZzuvUDG","qM5ZqNy","wfDowLO","u01ACMi","DuDIExm","CgvYC2LZDgu","u2HHCMvKv28","wxvtu0y","EgHbqNK","t1HdCui","BwvZ","uu1LEKW","txDbsMK","rvzHtLm","x2n1CNnVCK0","qNzIr1q","CMfNzvn5BMm","tgzrA2S","ref0q0G","v0zLCMu","zxj2AwnL","tuTLt2G","sLjtqwe","DuXLDvq","D2PIy3u","zw5NDgG","DfHPwNa","y1DiChK","D3jnrgG","ENH0Cxu","uuTpz1e","yMXVy2TLza","x2nSzwfYugK","AgvHzgvYCW","zgv2AwnLx2K","C2v0sxrLBq","A2v5CW","yMXmqxC","AgjtCNy","DMnsAxm","z0PIruS","A3PHquO","zxzRu3u","AxnmB25N","zw5HyMXLvhi","zwnVBM5Ly3q","BM5cvwO","nde0odu1qLjxt05L","x2n1CNnVCK4","yxKSihrYEsa","v093C2W","zMvY","yKnstfG","qwnorg8","zgvIDwC","Aw47y2HHCNm","DuX2A0O","CgfNzxnOB3C","y0zoufO","CM9YrxzLBNq","ANHXzvC","y09Wzw4","C0jf","z0vbEgK","CMvHzhDYAxq","EhrmDMG","t0HXEha","ChbL","DNjtyw0","ywXty29Wzq","BwfW","B1brt1u","DeLK","y3jLyxrLuMu","CNnVCL9Uyw0","y29Uy2f0","u2PIA3e","y29TCgXLDgu","CNDSthy","BKPIreC","u2Ptuue","yw5Nzq","y3jLyxrLt2i","x2LUAxrqCM8","zMnxtMm","x3nLBMrby2S","Chn2Dwm","yLDwBvm","CgfYC2u","u2HkCeC","A3jRrw8","wwfIweK","Cg93","yxKSig5LDhC","ywrKq291BNq","AgD5suu","x2vUzhbVAw4","A1zhv0G","ANbPqNu","C29Tzq","B3bLCNr5","A1LuuKC","zMLN","sgzYqMK","zxH0zw5ZAw8","Agn4BfC","uwnJBei","BwfADMW","B0vYvMK","uM5LA0G","twr0rNq","vML4uuy","AgfUz2u","werSwLK","wxnuEw8","rNzIC3u","B25qBLG","rw5lruO","ufzpwvu","Dxrjza","B3jpBMXPBMu","AeLwr20","sMvmt1K","vgLTzw91Da","ELvjDwi","seXhwKG","BIWGAg9ZDg4","C3vJy2vZCW","x19LC01Vzhu","AfzbCxC","rgnNweK","sxzbsw4","DgHLBG","r3DJzKC","C0HdvuC","yMfSrxzLBNq","v2LUzg93","Dev2zw50","AxnrB1nnzxm","EfDYvuO","x3bYB3rVy28","DK5NAK8","CgPkzfO","BMCGzMfPBgu","Dvnhwva","zMzLCG","zuH2B2u","x2jPBMfYEvq","DgLTzw91DcW","zg9Uzq","EM5mvhC","uuXjzfO","qK1Puxy","tvbszfa","BgvY","yMfSu2nVCgu","x2LZv29YA2u","Au5Zsxy","y0jSwvy","C3rVCMu","CgLUz09Uy2u","yNL0zxm","zvjQsgO","igzHAwWSig0","Dfn2wuW","y2XLyxi","Aw5L","qur6v3y","zezMB1a","uhLxswy","DgLTzw91Da","sKvuu2S","zgLZCgf0y2G","B25JBg9Zzq","BwvZC2fNztO","zhL3Auu","zcWGDw5RBM8","AvPIy3O","rxjhEeq","C3vIC3rYAw4","y01Orve","vKL3wvG","sKnkqMq","rMjeEMi","r1jhBgG","tKzPq3i","A1vnDgG","ueHwy2O","C0XPC3rLBMu","BfbAEuC","AufkDeC","CfzhEeS","qwHWtfm","Bwf4uMv0CMK","tKDQsgC","y29UBMvJDa","u0nmvNm","q0Xpu0ve","v2PfEhq","ywjVCNq","ndC4nZC2mgz6rNzrsa","Dg9tDhjPBMC","DxjS","zg1JuMO","rvjst1i","DM9Hsxy","DhjPBq","wNfPsvi","ANLJAwu","EuzvCLK","tg9Nsuq","ywzL","DxbKyxrLq3u","BMvLzf9Hy2S","ihzHBgLKigq","rhzzu3C","DwPNqNa","x21PBMLoyxy","B3jLtMfTzxm","AurYDhm","x2rLyNvN","vu9kALC","zxHWB3j0CW","CNzHBfzHBhu","z2v0qwXS","Bwf4tg9ZC0m","zwj2ugu","vM9VCgC","Ee5TtKW","BwvKAwf0zwW","rfrKsKe","z2u6ia","ugLPyNC","sMX4A2u","x3bHDgHlzxK","ChL2vKG","tKfusvzfx0u","zhbXsxe","sePgrvO","DKD5y3a","v0H5Ege","BeHHBMrSzxi","ywX3yxLZ","vxbKyxrLq28","EsbJBg9Zzwq","Eg5HvgO","yLLSs1a","Bxjcufe","x3jLy29UBMu","zwvKzwq","Bg5UzM0","AgfLB1y","CMvXDwLYzwq","wvnSwxe","BMDuAw1LCG","v0z2EvO","y3jkr0q","tuvtu0fhrv8","DxrMofDYAxq","DhjPzxmGCMu","yNPYyKu","x2fKzfDZtgK","svnYDwS","shryAei","zM9Yy2u","y2HnyxHdB3u","BMLAswi","B2zM","ihrPBwvVDxq","C2vYDMLJzq","wwXNBuu","q291BNq","C2XPy2u","B2nRzxrtDwm","zLr0D2K","EKfvvxq","qujjs2S","CvrUwNm","yxnZAwDU","Dgv4Dc9Qyxy","DcbSAw1PDa","mdaWmdaWmda","v2rQqui","yw51Ce1LC3m","u3zsDgG","yxbWzw5Kq2G","CMvHzhLtDge","ywnRtxnNswq","y2f0y2G","A2v5","sLLgzfK","wgfTt3G","q0f5ENa","v0X0Au8","A0vfEvC","z2vrDwv1zuW","zxrZtg8","zfDuu2C","uxntDgC","vMj2thq","zcWG","tuXluwO","B25SAw5L","qunOuNu","CNrjD3O","zxjYtxnN","wM9pBM8","sfPgsNy","BwfUDwfSihi","mJiYnti1mezXwfncDW","u0Thv0W","yM9KEq","EujeBKy","B3zTt1i","zwvtv2m","uwfltwS","ywDL","zwrPyxrLBhK","DgfYz2v0","x2rLC3rYB3K","Au9dy3q","Efbds1u","C2TcAwm","vw5Oyw5KBgu","q25eyKe","DgDVzLy","uLvmCuS","DgPYs08","Aw5Lza","CeTsAwS","y3vYC29Yx24","DhLWzq","sLbLDfu","y29SBM8","ugn3zeG","Bg9Nsurhzw4","ruXfuge","sur6De8","EwPPCLK","BMCGDxjSoIa","CMv0CNLdB3u","BwvY","tMH1s1e","C2fNzq","BMH1Evm","B25tDg9Wsw0","BvrVveS","Dg9hzw5LCMe","wNneqKS","CeHNt3K","uLjpuG","y3vYCMvUDeK","Eurdy3C","zNvUy3rPB24","EvDSsuy","x21LC3nHz2u","mxW0Fdb8mNW","sLDvu3i","BMrWB2LUDfq","B3jL","zNr1DKS","runxBe8","Bgvov0m","y2HJzNq","D3vfzxi","B1bryMm","sNnXuMO","ALnPr1O","ywr2yw5Jzq","swXlrgS","vhnUq2q","v3bguKC","s0jlv2O","BxnN","quXm","ywTvrgm","r050wwy","A2v0ignVBNm","s2D0q1K","zenbquq","ywnRDxbfBMq","CMvHzfvjBNq","yxrLq291BNq","u3rYyxrLz3K","BKXPBMu","z2vtEw5J","zwn0","tw9KDwXL","t2jQzwn0","t1bftG","q3vZDg9Trxi","zMLSDgvY","wuTdBw8","s01Ru28","CwrJuem","yNLL","AxjxzwG","C0Xmy2C","wMTurfy","y2niDwW","n3WXFdz8nhW","Cg9PBNrbBMq","zw5qtLu","uKDtAxm","x2n1CNnVCKy","A1n0yxr1C0m","CMvKDwnL","zxjFDhrS","Dg5xwe4","DgHHBIbSB2m","C2v0","CwLyA1C","y0TsAfu","tufyx1jfvfi","B2fK","yKP1wMC","AgvHzgvY","BfzhB2K","tNrnvMK","wKTUB1O","u0vVz0O","C2v0u3rVCMe","DxncwM0","x1fVu01HBMe","C0v2rwG","DvLTy2G","EevtyKy","qKHmt3G","rMXVt2C","nhWWFdj8mxW","zw5JB2rLrNi","sfDNB2W","ywnRx2nVzgu","tNDtCMq","ChjVDg9JB2W","rNDKEM0","ALPbvwW","q3vZDg9Tq2W","EvjLy29UBMu","q09otKvdveK","ywrKrxzLBNq","u3jgBvG","x194x21Zz18","BMrLEa","sezbzvq","Benwveu","t0XxELu","Ec1TC2CTCw8","DMzAqM8","zvDUq2G","B3nLza","wvPmENm","rhnNBfC","Dg9cExrLC0W","o2nOyxjZzxq","Dw5KzwzPBMu","t3bLBKv2zw4","C2zfDfO","swD2veq","x3nLCuLK","Dg9VigXHCMC","wMDrvKC","rgvsy08","D05bv0K","D1rQrfK","yvHiAMi","vLnADK4","sfrxyNq","rwLVugG","teXxtvy","ve15Dxi","vgfLq1e","BM5Ly3q","EK5KDha","Chv0","ywnRpwzYB24","BNzzB1C","ywXSzwqGBxu","CgHSAxO","uLLnA1G","D3m6lY8","AwrI","zMDYrhi","uxvLDwu","yNvSwxC","zgLRsLu","BNvTyMvY","wg9Qwe8","DgzYzuC","AvnuAvC","x2LZsw5PDa","CYbWyxjHBxm","twHhtNu","x2XPC3rLBMu","y3vYCMvUDeu","EhzAAwm","igfYCMf5yNu","rK5rB0G","B3j3s20","z2fZBhG","sfvwAee","AgvKtwf4uMu","AuzcrLe","zw5HyMXLuw8","rgvKAwnHDgu","lcbTyxGGCMu","BeTfu0O","x2HHBMrSzvi","DNHZC00","t2LQC00","Aw5KzxHpzG","uLHSB3i","r2vjsxC","uMvJB25Uzwm","C3vIyxjYyxK","C3rLBMvYCW","v090weK","x29UugfNzu4","wfnXsxC","BwLUAvbYB2C","zNjVBNrPzxi","zw5KCg9PBNq","zuflrhe","DwLwsKW","CK9TyMC","BNrfBMrWB2K","wgTiwKe","CM92AwrLihy","C3jJ","EfPzsgO","CMvQzwn0","Ce5rqNq","uhDss3e","zNjHBwvuExa","D1ruvKi","mNW1Fdb8mW","sfnLv0m","twLZC2LUzYa","tvzqsgq","vMDpy1y","De1Vy2i","wujlvva","u2H3A3u","z2TOrgG","sK1Zz24","zfDVCMTLCKC","sg1JtKO","BgLUzq","y29UDgv4Da","BwLZzq","x2HHBMrSzu8","C2vUza","DxbNCMfKzw4","AwXSihvZzsa","Aw5JBhvKzxm","q0nTv0K","nxWWFdf8mNW","AKfbA2u","zgvSzxrLrge","C25fuxG","r2TWqMS","ChvZAa","uNb2t0C","rvH3Be4","C2v0q3vYC28","Dg9fqva","thf2y2S","vgvgr0S","z2nMsLu","y29UBMvJDca","CgLUz1rPBwu","A0HMBhi","B2XKvMvYC2K","z3nbwMK","ueLWCwK","DenfsMm","sLnptLa","zw5fDMvUDa","yMHZA2m","zwzirxC","B2nRzxq","BNfVzgi","BLnkrwy","t0j5t1e","B2zMBgLUzq","y09Xs2e","BNrbBMrvCgq","DMfSDwvZ","uKjIwNi","AevYCM9Yrxy","AxjLza","tNPlvLK","sxHJBKO","sNrrD2K","zK9IDwK","tg9NsurozxC","x29UvgLTzw8","x3bPBMC","tgvwsNG","zK9crva","y3jLyxrLtwu","z1DewNK","BMnLq2XVC2u","Bg9NsurozxC","CvnHDwy","u3DZr2q","suHur2G","Cg1XBhO","q05NvhO","uKzWtve","reHpsM8","Fdr8mhWY","aaaaaaaaaaa","zNjVBujPDhm","Eff0Chi","Dgzysfa","y2X1zMm","yMLUyxj5","AfziuM4","x2LUAxrhBg8","y3vYC29Y","zMLPsMO","zu5rCfC","Cgu6ia","Bu1Irhm","DcbVzIbYyw4","CMvZzxruCMK","y2HnyxHuCMK","rM5RuuO","y3vZDg9Tshq","y29UBMvJDgK","CvL3zKC","x2nYzwf0zvm","CwHxvwC","y0rMAwm","yxv0B21HDgK","CwnJweq","wgvtDMi","x2LUAxq","uw1ODhm","ywDLrxzLBNq","zw50zwqGDhK","BKTIuKi","sxjhBey","mtK5nJrcCvPYEei","CKvSs1O","BNruCMLLC0m","x2LZtwLUAvq","y29Kzq","q3jUsNC","EezIq0S","s2vWuKe","rvL6y2W","vMfNy2K","igXHCMDLCIa","A3nvvhO","r01uv08","zLf4tNC","wfztzKW","r0nczhC","x3jLywr5q2W","ywDLu2HVDW","wvvUsNq","vLflDeS","v3DUA1O","rLDt","s2DwDuu","CNPOwwC","zuXZzNK","svf6Bva","BvvywuC","z2v0q3vYCMu","BwvZC2fNzv8","sNHxtMS","zgvS","EvHIBNy","Ee5RD24","qujdCMq","wM1sDxu","DuX1tKW","Aez1wuu","EwPSCfO","Chn6C1i","BNf2u3K","vMfYrhG","ihrPBwvZ","zw1LBNq","thjQtKu","Dg9Y","z3jNyNO","C2vUDa","v1jzA1u","y291BNq","z2v0sxrLBq","se9Kvuq","EM5drhC","B25dBg9Zzq","z3n2qKG","t1LfBvC","x2DLDeLUDgu","z2vY","Du1PsuW","r0zsCxm","AwDdCLu","q0r2sMO","Dw5tsg4","zgzoAhi","C2rhyuC","DhjPzxm","vMHfCKy","sLjKzKq","Ew1NzwK","r1v2s1C","tMHUyu0","zNnky3O","Bwrurgy","x2zVCM1HDeu","C2nYAxb0","vuPcs2q","EK9ksxC","we14ENG","tNfrsM0","zgrjrcWGzgu","rwPTEwG","rLfRu00","y3jLyxrLrxi","CMn0weO","swDMBhi","De1HBMfNzxi","CNjMDgq","x3fVC0rc","rwToB3a","DKnAwxK","B3nLrxzLBNq","EgrTCgy","CNjVCK1LC3m","CLzHBhvLCW","x3DHAxq","y3ruAw1LB3u","r2PAywm","rNjVBNrPzxi","Dgv4Dc9WBge","AxnbCNjHEq","DLbMrvi","Dej3DuS","Cgf5Bg9Hzeu","sK9bvMW","vKH1zeu","C0nVDw50zxi","EwfUAey","rujtEum","rLLeyMm","DMvY","mxWZFdj8mta","m3W0","C3nHz2vfDMu","sM5lvKi","CMvHC29U","Dg9iyxnO","tgrLuLe","BxLjzgW","DKDXzLG","DxjquLm","zgvMAw5Luhi","wfz4r2O","C3rYAw5N","rerwrNG","zvrYAhm","ywrKt25L","ywDLsgLKzq","DgLLCKPtt04","BLL1wfq","zxjFCw9Z","zw1PDa","AM9PBG","zhjurMq","yNL0zuXLBMC","DMTRCMu","D24GCMvHC28","ihjLy29UBMu","u2TPCcbWyxm","AvjovNq","yNPYA2i","tg5XCgq","yxbWBgLJyxq","wLbpB1i","C1fezuu","Bw1ktNm","D2fZq2XLyw4","A2jitfK","tffhsxq","sNPeqLu","CMvHzg9UBhK","AKvpALa","x3bPBMDqB24","quDvBeq","CM9zBKe","zMLUza","EuzyBxy","x0vysvnu","BMrWB2LUDca","v1bHwg8","Exntz2e","C2HPzNq","q05Nq2W","s1Diquu","Cw9wzeC","Aw9UvgLTzw8","CgjICdi","Cw9Z","DeLUDgvYy2u","sxjhuM4","u3v3Dhq","wuDtC00","x29UrxjYB3i","yNvMzMvYzwq","q0DbzLq","t2PQAxm","x2rItMfTzq","D1vRq00","BhDhtuq","q0zHC0O","vgXPALy","yMLUyxj5vhK","C3rHCNq","B3bLBIa","y2fSBa","y29UBMvJDeu","CNnVCKzPBgu","EuHuCNq","C3rYAw5NAwy","quH5wfi","y3vYC29Yx2y","x2LZqNjVD3m","BgLZDgvUtMu","q3LAwLu","mhWYFdn8nhW","y29UDgLUDwu","q0vsAgm","vhHgBw8","zufJAW","B0fvCfK","C29YDa","DeTpsfi","Aw50zwDLCIa","thHdzK0","whfzuui","x2LZtwLUAvC","r2Xztvu","yxGGCMv0CMK","BgvUz3rO","uwrhBLy","zxLVzg8","B25nzxnZywC","sM16ENi","u05cELq","Aw9Ul2PZB24","t2nJCuq","z01KzfG","ywnR","DhDVCMTdAge","z2nnB0C","EMDowMO","zMLSzw5HBwu","Bwf4twvZC2e","vgTfqui","rKLmrv9ot1q","Ae1LC3nHz2u","u2zAAMS","veLXB0m","vwTqr1y","Dw5ZAwDUzwq","uLrXueK","BMnVzgLUzW","CMfTugfYyw0","Fdf8oxWZFdu","uunjvK4","qw1ZDeu","DxfxtfK","BMvJDa","DhjHBNnHy3q","v3DXEwW","x3bPBMDmB3m","DuLYzfq","zNjVBuj5Dgu","EvfVq2e","y1fgqxC","EgfmBK0","x2LUDgvYDMe","CKXiCgK","teHbzvm","CMv4zuO","zLHJEvq","twnbzNq","yNLJDKK","uhjPBwfYEuS","AwPXyu8","t0reEM8","ihzHBgLKihm","x2nSzwfYvgK","BgT4D3C","q29Kzq","x2DLBMvYyxq","DvHRrNi","CMvJzxzPzwq","y0fmA0i","B25tDgfYDfi","BMvY","tKvezxq","AujsBKm","mxW0Fdn8nxW","CMvWBgfJzui","CMvUDevUzha","wxLiy2K","vNvgB1u","ihrYEsbYzwm","B2npwLy","x25HDMLNyxq","DhbizwfKzxi","zMX1C2HfEha","DMzZDM4","EvnuwhC","B25szwnLAxy","D2LSBfjLy28","z1bbB1K","ihn1y2nLC3m","ChjVDg90Exa","CIb0DhDjra","rxzLBNq","Bwv0Ag9K","B1v1EKG","ign1CNnVCIa","ExHtB0S","BMfTzq","zxq9DxrMltG","BfrPBwvVDxq","igzPzwXKoIa","EvbsCNi","DMvUDa","CNnVCL92ywW","Cw9Zx18","uLDhzxq","v05XEvO","x0rctMfTzq","quTnvxu","C2vYDMvYvgK","DMH2zee","z1vSDui","zennrLK","z2v0","CNvHCwO","yxv0BW","AwDHDg9Yt24","uwnrDe4","swPPvhe","CKvzA1a","r01jAfa","DwjmDva","yw5Hz2vY","x3jLBw92zvC","seTptMS","CwnVwM4","B25mAw5L","DKzwwMq","zxH0ugf5Bg8","x3DZ","yMfJA3vWigu","CMvZDwX0","AKrjww8","BMCGB3iGyw4","v0fpAuO","C2vYDMLJzs0","sw1qtLa","C2DPza","zv90Aw1LB3u","x29Ut3bLBG","uLDmDgm","Au5hu0C","uu1Zy1a","BwvZC2fNzq","ndmZmxHUAgzNrq","zMT4AeW","mJi3nffcD1zSBq","wuzZAgC","reXcBNe","m3W1","yMrFzgLK","B0vTrNG","zMzmAw5L","AwXK","DNDhC2G","x3vYBa","vxPrvNK","v2vPEgLUsLm","DwfWCeG","zw5HyMXLqxu","vMH5A2q","Ahr0Ca","ywrxweq","suvtx0vsuK8","wfrhsgu","BfHWsvy","yLjLz0W","Cw1dDKu","tKvQAuW","B3jRig9MzMW","yKfntLa","mty3mhfOD0XcDq","qLPYwK0","B3bLBKrc","lcbOB3n0BMe","ywrK","C2n0qKS","zv9ZDwnJzxm","vw5PBxbSzw0","Ec1TC2CTy3u","wMD3EK4","AuDlvvy","A1LxA2S","pxv0zI04","ueLeCgq","twzjAhm","B3jRzxjhBg8","ALjlBhG","r3vswvC","s1znAg0","v3bNzKW","qLL4uKi","x3DZsw5ZDge","vfHmC1e","z2vjBMzVu3K","ywnOzwq","B25LCNjVCG","tg9JAW","CMvZB2X2zq","yKT3C3C","EKP5yvy","jMPZy2fSBgi","y3vYC29YlNm","zxrxB3jRq2G","zMXVB3i","A3DbrxO","AgLNAa","t3bzCha","Dg9cExrLC0i","Dgvzv1m","vxjmrwG","q0Xpu0LorW","x3nVy2TLDa","C0Xf","uKPxuK0","tgLZDgvUzxi","DgLUzYbZzxi","AfnvsMO","s0j0yMO","EM5mr0C","B2Dft3e","z29PBMCGyxC","B2zMC2v0","ugrwEKC","B1Dhr2W","A1Pcq0S","DgvZDa","Axriv20","DfvMz1a","yxvssgO","A0P5yuy","z1rPBwvVDxq","x2nVBM5Ly3q","CNzHBa","D2D5Cvy","BwXQsu4","Aw9QBgW","r0zewg0","id4G","CLrgvhO","yNPZwvu","z1zgyNi","u25fzvy","AxmGDw5Kzwy","qwPzrLa","zNvjDxu","Dvz3uKO","CMvZzxrdB3u","BvPfqLy","yNvMzMvY","u2vXsuq","se5sz0S","rwXesxm","zxjFBxnNAwq","zsbHihn0CMK","END3uM0","rKvjtLi","CgXLyxnLiha","BM93","Be1RC0W","ywXPzcb1CMW","CM92AwrLige","B3vvBNO","zgfHCeO","Ew9KwNq","Efrurw52","rwPHqNy","Dw5RBM93BIa","AwXLtMfTzq","zMP1Egu","rLjptLrjrvi","rMHRsLe","veHbvw8","Cg9PBNrdB24","zxjYtM8","whf6q2W","tg9qDuu","zxjFAxnFywm","DKDqs1K","C0LguMi","ufzKuuG","rhrfzLy","Dhr3Awq","wM1xq0S","y05UEvK","Egj1vNC","v0fSCw4","BgLUzw5V","DKPAt3i","AvH2r0W","CMvTB3zLq2G","BwjcCwK","re5Yre0","tKPJEhC","D3nZoI8V","ugrQrw4","yxbWBhK","BezSDxnO","AxnrB1nby2S","AKzKyMC","rMTzAM4","CxzbuNy","AxDhu2m","CwDsswO","BwLUzW","zxjYB3i","DLbUDM4","tvrHD0W","nhWWFdf8mNW","shP4quu","su5tvefova","zw50tgLZDgu","v25QCe8","rhPuvgC","s01hq2q","sNfswNu","x2rPC3bHDgm","yxvgBNy","txDptve","ENr3whu","Dfj1rvG","D2fKuLC","qNjPzgDL","yLLqww0","DxDjy0O","rvbpseq","uMreuKu","EfnSEwu","tenAEey","rLjIvNu","CgfNzwHPzgu","AwLlEfO","Chrqu0C","z2nzCwq","qurbCxK","AwrmDKy","q0Dsq2O","y3r4","yw1Lu3bHy2u","sxnlBuq","C0HUy0G","yNL0zu9MzNm","ExbL","icSG","AMPiC2W","zxf1ywXZ","EwHmsw0","yLfOAxK","vfbxAge","ve1TBvK","uKPcsgi","C2T3Bwy","zfrbC2K","zezqBxm","vw5KyvO","B2nRzxrgywK","wNnTEwC","y1DJEMm","uhbtC3C","ChjVy2vZCW","AwvhC2i","BMT6CxK","wengD1y","AMTUzMK","uMPPCKC","EvjAz3q","yNfNz0W","wKLqzxK","y3vYDMfSDwu","mtqWmZvvre9Py1i","Cgf5Bg9Hza","tKjrBNG","ugHUuey","wvDvtM8","Aw5KzxG","y29UBMvJDfm","y2XVC2veqG","EgXNDKO","zvvYBa","AefJA01LC3m","s0nbB3O","B3v0sw50zxi","zxjHDg9Y","twvZC2fNzuu","AwXLx25HBwu","tvz2zKS","z2v0q3vYC28","zfnfsxK","BujJC1i","B2LUDfjLywm","B25VCgvU","Aw9U","uLbnueK","vuPMtKG","x3bYzwzPEa","t1bftL9fuLi","rhrVEeW","CxbPy3u","y2vZC0HHBMq","DMvYC2LVBG","Bwu6ia","y2XVC2u","AxnszwfKEq","CMvJB25Uzwm","Bhm6ia","y2HHCKnVzgu","Cu1vv20","l3DZl3yY","D3jPDgu","ENDssha","y3jLyxrLrwW","BM9szuS","qNvXEeC","yxrHlcbKyxq","BNnzCxy","AwDjzem","r1zOEKK","Bg93","DKjur3a","y29OzwW","tgLnu0C","B25ozxr3B3i","y2uGBM90igK","DuDhweK","x2rPC2nVBM4","DKvhCxG","zM9YrwfJAa","swT1DfC","mtC4D2Tkwgrm","CgLUz0LUDgu","zNjVBu51Bwi","uu5nyui","ignVzgu6ia","CgLUz0XVC3m","ywWGy3vYC28","u2vYDMLJzvC","Aw1LCYbPBIa","B3bLBG","y2XLyxjtDg8","A3jYtvC","wvrdze0","z2v0qwXSs2u","Cen1Chy","x2rYB3bhBg8","u2jQA2u","BgLTAxq","CLDiA0W","tujKB24","sKDxB2u","tKDFrvjst1i","txfIDxu","mJK1Awzur3vu","x2HHBMrSzva","AMnhugS","ihbYB3rVy28","y3jLyxrLt3a","Evnytxe","y2HLy2Tszwe","C2v0zgi","t011tNG","v2vIu29JA2u","BwzqBvy","AenSB3nLrxy","zMXXwgW","zxjFCw9Zx2e","s3n3wuu","ywnRx2LK","r2T6zfC","zMzMzG"];return Nn=function(){return r},Nn()}function Qc(){return Pi||(Pi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ex(){let r=S;return ki||(ki=[IDBCursor[r(912)+"e"][r(354)],IDBCursor[r(912)+"e"][r(823)],IDBCursor[r(912)+"e"]["continue"+r(881)+"ey"]])}function tx(r){let e=S,i={RTqPI:e(1551),TPWha:function(c,u){return c(u)},YnXct:function(c){return c()},ouUnz:function(c,u){return c(u)},QcQtN:function(c){return c()},nnBUj:function(c,u){return c instanceof u}},a=new Promise((c,u)=>{let d=e,h={voaIv:function(y,A){return i[D(1084)](y,A)},MBdon:function(y){return i[D(939)](y)}},m=()=>{let y=D;r[y(1368)+"entListener"](i[y(858)],w),r[y(1368)+y(1133)+y(893)](y(1127),_)},w=()=>{let y=D;i[y(1170)](c,i[y(1170)](Ae,r[y(953)])),i.YnXct(m)},_=()=>{let y=D;h[y(191)](u,r[y(1127)]),h[y(1269)](m)};r[d(426)+d(1037)](i[d(858)],w),r[d(426)+d(1037)]("error",_)});return a[e(1556)](c=>{let u=e;i[u(1470)](c,IDBCursor)&&Ir[u(396)](c,r)})[e(274)](()=>{}),On[e(396)](a,r),a}function nx(r){let e=S,i={ZgQVG:e(1501),mbBqi:e(1127),xPCKU:e(185),qiXkW:function(c){return c()},kYHIH:function(c,u){return c(u)},WwnkZ:e(1367)+"or"};if(Ln.has(r))return;let a=new Promise((c,u)=>{let d=e,h=()=>{let _=D;r[_(1368)+_(1133)+_(893)](i[_(447)],m),r[_(1368)+"entListe"+_(893)](i[_(1113)],w),r[_(1368)+_(1133)+_(893)](i[_(307)],w)},m=()=>{i[D(397)](c),i.qiXkW(h)},w=()=>{let _=D;i[_(1386)](u,r[_(1127)]||new DOMException(i.WwnkZ,i[_(650)])),i[_(397)](h)};r["addEvent"+d(1037)](d(1501),m),r[d(426)+d(1037)](i[d(1113)],w),r.addEventListener(i[d(307)],w)});Ln[e(396)](r,a)}function rx(r){Bn=r(Bn)}function sx(r){let e=S,i={VuFoU:function(a,c){return a(c)},OrCMT:function(a,c){return a!==c},ZhhRl:"rScxX",tCEJc:function(a,c){return a(c)},LCZxF:function(a,c){return a===c},zELIW:function(a,c){return a in c},nqodb:e(1292)+e(204),LYZNw:function(a){return a()}};return i[e(1150)](r,IDBDatabase[e(912)+"e"][e(866)+e(1213)])&&!i.zELIW(i[e(567)],IDBTransaction[e(912)+"e"])?function(a,...c){let u=e,d=r[u(812)](i[u(900)](qt,this),a,...c);return Dr.set(d,a.sort?a[u(828)]():[a]),i[u(900)](Ae,d)}:i[e(1415)](ex)[e(540)](r)?function(...a){let c=e;return i.OrCMT("rScxX",i.ZhhRl)?(this[c(480)+c(344)+c(1380)+"t"]++,this[c(657)+c(511)+"nt"]()):(r[c(1118)](i[c(900)](qt,this),a),i[c(900)](Ae,Ir.get(this)))}:function(...a){let c=e;return i[c(900)](Ae,r[c(1118)](i[c(561)](qt,this),a))}}function ix(r){let e=S,i={lKESJ:"function",OlXmv:function(a,c){return a(c)},bycvI:function(a,c){return a instanceof c},MoHqo:function(a,c){return a(c)},AjYFP:function(a,c,u){return a(c,u)},zwVGW:function(a){return a()}};return typeof r===i[e(492)]?i[e(1334)](sx,r):(i[e(880)](r,IDBTransaction)&&i.MoHqo(nx,r),i[e(1066)](Ni,r,i.zwVGW(Qc))?new Proxy(r,Bn):r)}function Ae(r){let e=S,i={UFedB:function(c,u){return c instanceof u},DeRcO:function(c,u){return c(u)},tgofV:function(c,u){return c!==u}};if(i.UFedB(r,IDBRequest))return i[e(448)](tx,r);if(Tn.has(r))return Tn.get(r);let a=i[e(448)](ix,r);return i[e(311)](a,r)&&(Tn.set(r,a),On[e(396)](a,r)),a}var Ni,Pi,ki,Ir,Ln,Dr,Tn,On,Bn,qt,Di=Ri({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={akUDc:function(i,a){return i===a},KgVuE:r(1573),IBYTM:function(i,a){return i===a},IDztO:r(1292)+r(204),lwGMD:function(i,a){return i===a},wRQjT:r(1583),BvbGT:function(i,a){return i(a)},HTWbt:r(781),PMfpa:function(i,a){return i instanceof a},aRzWU:function(i,a){return i===a},WOwsl:function(i,a){return i in a}};Ni=(i,a)=>a[r(1523)](c=>i instanceof c),Ir=new WeakMap,Ln=new WeakMap,Dr=new WeakMap,Tn=new WeakMap,On=new WeakMap,Bn={get(i,a,c){let u=r;if(i instanceof IDBTransaction){if(e[u(361)](a,e[u(652)]))return Ln[u(935)](i);if(e.IBYTM(a,e[u(323)]))return i[u(1292)+u(204)]||Dr[u(935)](i);if(e.lwGMD(a,e[u(1338)]))return c[u(1292)+u(204)][1]?void 0:c.objectStore(c[u(1292)+u(204)][0])}return e[u(1439)](Ae,i[a])},set(i,a,c){return i[a]=c,!0},has(i,a){let c=r;return e[c(806)](e[c(453)],e[c(453)])?e.PMfpa(i,IDBTransaction)&&(e[c(806)](a,e.KgVuE)||e.aRzWU(a,e[c(1338)]))?!0:e[c(1474)](a,i):new _0x3b80a4(_0x554620,_0x265c40,_0x34a655)}},qt=i=>On[r(935)](i)}}),Li={};Zc(Li,{deleteDB:()=>ax,openDB:()=>ox,unwrap:()=>qt,wrap:()=>Ae});function ox(r,e,{blocked:i,upgrade:a,blocking:c,terminated:u}={}){let d=S,h={XPxPU:function(_,y,A,k,T){return _(y,A,k,T)},NGEAU:function(_,y){return _(y)},noWfx:function(_,y){return _(y)},HfrBi:d(1455)},m=indexedDB[d(1259)](r,e),w=h.noWfx(Ae,m);return a&&m["addEvent"+d(1037)](d(538)+d(235),_=>{let y=d;h.XPxPU(a,h.NGEAU(Ae,m[y(953)]),_[y(558)+"on"],_.newVersion,h.NGEAU(Ae,m[y(866)+y(1213)]))}),i&&m[d(426)+d(1037)](h[d(1527)],()=>i()),w[d(1556)](_=>{let y=d;u&&_[y(426)+y(1037)](y(1223),()=>u()),c&&_["addEvent"+y(1037)](y(1311)+y(1536),()=>c())}).catch(()=>{}),w}function D(r,e){r=r-185;let i=Nn(),a=i[r];if(D.mDUnnp===void 0){var c=function(m){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",_="",y="";for(let A=0,k,T,R=0;T=m.charAt(R++);~T&&(k=A%4?k*64+T:T,A++%4)?_+=String.fromCharCode(255&k>>(-2*A&6)):0)T=w.indexOf(T);for(let A=0,k=_.length;A<k;A++)y+="%"+("00"+_.charCodeAt(A).toString(16)).slice(-2);return decodeURIComponent(y)};D.FOzkfp=c,D.zBZjkY={},D.mDUnnp=!0}let u=i[0],d=r+u,h=D.zBZjkY[d];return h?a=h:(a=D.FOzkfp(a),D.zBZjkY[d]=a),a}function ax(r,{blocked:e}={}){let i=S,a={KBtbj:"blocked",hSyFl:function(u,d){return u(d)}},c=indexedDB[i(544)+i(1420)](r);return e&&c[i(426)+i(1037)](a[i(1040)],()=>e()),a.hSyFl(Ae,c)[i(1556)](()=>{})}function Ii(r,e){let i=S,a={xbuVw:function(m,w){return m===w},zgNZj:i(1327),clufc:i(1488)+"e",chcft:i(778),NEDet:function(m,w){return m instanceof w},zNdtp:i(751),kLxHe:function(m,w){return m in w}};if(!(a[i(894)](r,IDBDatabase)&&!(e in r)&&a[i(1107)](typeof e,a[i(459)])))return;if(Rn[i(935)](e))return Rn[i(935)](e);let c=e.replace(/FromIndex$/,""),u=e!==c,d=Bi[i(540)](c);if(!a[i(1397)](c,(u?IDBIndex:IDBObjectStore)[i(912)+"e"])||!(d||Oi[i(540)](c)))return;let h=async function(m,...w){let _=i;if(a[_(1107)](a[_(848)],a[_(848)])){let y=this["transact"+_(1213)](m,d?a[_(602)]:a[_(349)]),A=y[_(1583)];return u&&(A=A[_(1196)](w[_(789)]())),(await Promise.all([A[c](...w),d&&y[_(1573)]]))[0]}else return _0x5461fb[_(1020)]()};return Rn.set(e,h),h}var Oi,Bi,Rn,cx=Ri({"node_modules/idb/build/index.js"(){let r=S,e={HSeWC:r(342)+r(971),TsnCd:"get",zwwRm:"getKey",jEOjP:r(210),iXrKA:r(1263)+"ys",QplzL:r(678),qoVdG:r(997),QDqyk:function(c){return c()},sQDeE:function(c,u){return c(u)}},i=e[r(522)][r(1357)]("|"),a=0;for(;;){switch(i[a++]){case"0":Oi=[e[r(356)],e[r(1077)],e[r(779)],e.iXrKA,e[r(1404)]];continue;case"1":Di();continue;case"2":Bi=[r(460),e[r(792)],"delete",r(1589)];continue;case"3":Rn=new Map;continue;case"4":e[r(1394)](Di);continue;case"5":e[r(772)](rx,c=>({...c,get:(u,d,h)=>Ii(u,d)||c[r(935)](u,d,h),has:(u,d)=>!!Ii(u,d)||c.has(u,d)}));continue}break}}}),xx={idb:function(r){let e=S;r[e(208)]=Promise.resolve().then(()=>(cx(),Li))[e(1556)](function(i){return i})}},Ti={};function Ce(r){let e=S,i={OpYpp:function(u,d){return u!==d}};var a=Ti[r];if(i[e(1029)](void 0,a))return a[e(208)];var c=Ti[r]={exports:{}};return xx[r](c,c[e(208)],Ce),c[e(208)]}Ce.d=(r,e)=>{let i=D;for(var a in e)Ce.o(e,a)&&!Ce.o(r,a)&&Object["definePr"+i(1524)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;Ce.o=(e,i)=>Object.prototype["hasOwnPr"+r(1524)][r(812)](e,i)})(),(()=>{let r=S,e={GlYMU:function(i,a){return i&a},fcWNc:function(i,a){return i&a},AATzW:function(i,a){return i>>>a},empmZ:function(i,a){return i===a},VBPlc:r(351),WIDgq:r(441)+"d",nvYoW:r(373)};Ce.r=i=>{let a=r,c={xNkwn:function(u,d){return u&d},CBpZX:function(u,d){return e[D(834)](u,d)},iBRnC:function(u,d){return u>>>d},Shwku:function(u,d){return e[D(1508)](u,d)},VgOcV:function(u,d){return e[D(1400)](u,d)}};if(e.empmZ(a(1182),e[a(1335)])){let u=Y.high,d=Y.low;return[255&d,c.xNkwn(d>>>8,255),c.CBpZX(c[a(895)](d,16),255),d>>>24,c.CBpZX(255,u),c[a(662)](c[a(895)](u,8),255),c[a(528)](c[a(895)](u,16),255),c[a(525)](u,24)]}else e.WIDgq!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:e[a(462)]}),Object[a(749)+"operty"](i,"__esModule",{value:!0})}})();var Z={};(()=>{let r=S,e={Wwqyl:function(s,t){return s(t)},FRbVu:function(s,t){return s+t},sHCUG:function(s,t){return s+t},nsYqv:function(s,t){return s*t},Ejmyh:function(s,t){return s(t)},CGRCj:function(s,t){return s(t)},gMddX:function(s,t,n){return s(t,n)},JWUSr:r(642),YsTyo:"CoAna",WPYoB:function(s,t){return s(t)},bWVmS:function(s,t){return s+t},vGPKY:function(s,t){return s+t},nSJEf:"0000",tBwuK:r(703),fTtwi:r(265)+"ascript",ymgei:r(983),rEYkP:r(1023)+"ack=fron"+r(756)+"P",tUfgP:function(s,t){return s(t)},sdGaG:r(1089)+r(743),VHGqh:function(s,t){return s>t},dywiE:function(s,t){return s<t},yxSoK:function(s,t){return s>t},mdTDf:function(s,t){return s<t},FMgxc:function(s,t){return s!==t},WnjpO:function(s,t){return s===t},QMscP:r(620),YKCmo:function(s,t){return s-t},snEQx:function(s,t){return s!==t},cOqKa:function(s,t){return s-t},mrBPQ:function(s,t){return s<t},hSUJj:function(s,t){return s<t},gcfJU:function(s,t){return s-t},fiiJj:function(s,t){return s!==t},cFNPZ:function(s,t,n){return s(t,n)},znLGG:function(s,t){return s!==t},eNQpW:function(s,t,n){return s(t,n)},lMksL:function(s,t){return s>>>t},bCRLX:function(s,t,n){return s(t,n)},DTdJA:function(s,t){return s(t)},AChRu:function(s,t){return s(t)},Fwdzm:function(s,t,n){return s(t,n)},JCJBd:r(523)+r(238)+r(922)+r(275),loSPn:r(523)+r(238)+r(922)+r(1403),znLTw:function(s,t,n){return s(t,n)},JeLOY:function(s,t){return s(t)},VleeX:function(s,t){return s>t},leNWC:function(s,t){return s&t},UkPGV:function(s,t,n,o){return s(t,n,o)},nxcat:r(1462),EioPh:function(s,t){return s!==t},wadRW:r(324),RJWRM:function(s,t){return s!==t},jptqS:function(s,t){return s!==t},wuEer:function(s,t,n){return s(t,n)},IcejH:function(s,t,n){return s(t,n)},bzsYU:function(s,t){return s(t)},qccXD:function(s,t,n){return s(t,n)},EYzcl:function(s,t){return s!==t},KgtCY:function(s){return s()},uBRlV:function(s,t,n){return s(t,n)},ErGxD:function(s,t){return s===t},GRGlh:r(1592),RPMPI:function(s,t){return s!==t},CDvJj:"euCcR",xSlye:function(s,t,n){return s(t,n)},tSvYL:function(s,t,n){return s(t,n)},gkhDh:"nfgym",jycie:function(s,t,n){return s(t,n)},DHOJo:function(s,t,n){return s(t,n)},uIrdT:function(s,t){return s!==t},VQKtK:function(s,t){return s!==t},igIdC:r(827),JPetU:r(388),OYEmW:function(s,t,n){return s(t,n)},dikJU:function(s,t,n){return s(t,n)},ZoOno:function(s,t,n){return s(t,n)},nhuyS:function(s,t){return s(t)},goint:function(s,t){return s(t)},lkxww:function(s,t,n){return s(t,n)},McAft:function(s,t){return s(t)},jknfi:function(s,t,n){return s(t,n)},NGjHg:function(s,t,n){return s(t,n)},GCBdw:function(s,t,n){return s(t,n)},LiMSG:function(s,t){return s(t)},NPoqF:function(s,t){return s(t)},pmZIL:r(523)+r(238)+" field: SeqID",RJBHb:function(s,t){return s===t},rDsUi:r(523)+r(238)+" field: "+r(255),QLIdZ:"Missing required field: method",VarDx:function(s,t){return s&t},mMbDs:function(s,t){return s(t)},uVwRJ:function(s,t,n){return s(t,n)},JFCJQ:r(1e3)+r(627)+r(609),yBDnF:function(s,t){return s>>t},xdmpf:"error",hjZQq:function(s,t,n){return s(t,n)},cWczc:function(s,t){return s===t},ElTqA:r(1453),OgqYr:"cwGUA",onPnX:r(1223),unSHn:r(1240),ZgwzN:function(s,t){return s===t},WFere:function(s,t){return s+t},fXHRM:r(766)+r(266),bKwsw:function(s,t){return s+t},AKcgf:function(s,t){return s!==t},nkzqy:"pWPST",QXCYG:"OoFpD",YZLzs:function(s,t,n){return s(t,n)},PwRKq:function(s,t){return s===t},eRjHj:function(s,t){return s<t},ZkTDV:function(s,t){return s<t},FYDbc:function(s,t){return s===t},AcNDo:function(s,t){return s&t},iiKxZ:function(s,t){return s&t},crJGD:function(s,t){return s<<t},TXLsQ:function(s,t){return s<t},LoDtN:function(s,t){return s(t)},WDwbi:function(s,t){return s==t},iZbcz:function(s,t){return s!==t},TpGef:r(241),WnskB:r(669),MhGNu:function(s,t){return s+t},ySTXw:function(s,t){return s|t},vGycp:function(s,t){return s<<t},AHyXR:function(s,t){return s>=t},rzhYg:function(s,t){return s<=t},FGbRC:function(s,t){return s!==t},RjirG:r(1519),AMEBd:function(s,t){return s(t)},EnKEJ:function(s,t){return s+t},Fvbsu:function(s,t){return s+t},MwOMQ:function(s,t){return s+t},EBSyC:function(s,t){return s+t},ovmOR:function(s,t){return s+t},NqQJm:function(s,t){return s|t},DzTTg:function(s,t){return s|t},GSCQd:function(s,t){return s<<t},RULqK:function(s,t){return s|t},XkHZA:function(s,t){return s&t},YxVPh:function(s,t){return s<<t},qpicu:function(s,t){return s&t},pmqlz:function(s,t){return s&t},gsAZi:function(s,t){return s<t},vNgjO:function(s,t,n){return s(t,n)},uMiIL:function(s,t){return s>>t},WLtiO:function(s,t){return s>=t},VhErF:function(s,t){return s<=t},PIDpd:function(s,t){return s-t},Ojjis:function(s,t){return s<t},sCtRC:function(s,t,n){return s(t,n)},sIFRb:function(s,t){return s<t},EPOHD:function(s,t){return s>=t},cQfow:function(s,t){return s-t},NtMVi:function(s,t){return s+t},rtIwz:function(s,t){return s<t},eTrhs:function(s,t){return s&t},gWDZy:function(s,t){return s!==t},fIxaT:r(732),IjiTq:function(s,t){return s|t},bJuZg:function(s,t){return s&t},tnWXN:function(s,t){return s|t},XVSfL:function(s,t){return s&t},LrjNE:function(s,t){return s|t},bQhiy:function(s,t){return s|t},GUvKW:function(s,t,n){return s(t,n)},PdjEn:function(s,t){return s<t},qhWUg:function(s,t){return s+t},NKwUJ:r(202),HWgol:function(s,t){return s<t},Vagci:function(s,t,n){return s(t,n)},fsJcz:function(s,t){return s<t},bXFiG:function(s,t){return s>t},lPZyG:function(s,t){return s+t},ZqiIR:function(s,t){return s(t)},bYlKP:function(s,t){return s|t},UTAim:"BZbWl",iSTiW:r(973),ABIKk:function(s,t){return s&t},TIqoC:function(s,t){return s<<t},CnDbA:function(s,t){return s&t},CAyzp:function(s,t){return s<<t},bgrrf:function(s,t){return s<<t},ISruk:function(s,t){return s&t},TkEAB:"tbuSv",uSGYP:function(s,t){return s(t)},fXcyT:function(s,t){return s<<t},hwSVs:function(s,t){return s&t},opTAV:r(1358),RXlor:function(s,t){return s&t},tjrKO:function(s,t){return s(t)},maZvl:function(s,t){return s<<t},ABCrd:function(s,t){return s&t},itHWm:function(s,t){return s<<t},KHNwX:function(s,t){return s<<t},hVAqw:function(s,t){return s|t},MVPHd:function(s,t){return s>>>t},JqRZu:function(s,t){return s>>>t},LxCfM:function(s,t){return s<<t},xaLnM:function(s,t){return s===t},dzOWn:function(s,t){return s<t},DAtCH:function(s,t,n){return s(t,n)},SrFmX:function(s,t){return s+t},ZmRuu:function(s,t){return s>>>t},XqYQB:function(s,t){return s|t},Voopg:function(s,t){return s&t},JxWNk:function(s,t){return s+t},uYmch:function(s,t){return s+t},Piibw:function(s,t){return s!==t},xESbF:function(s,t){return s|t},iGKUV:function(s,t){return s>>>t},qSauf:function(s,t){return s>>>t},ljrUx:function(s,t){return s!==t},BMiQv:function(s,t){return s|t},mZEBV:function(s,t){return s&t},OXCqB:function(s,t){return s>>>t},RGSis:function(s,t){return s|t},QrOCH:function(s,t){return s>>>t},esPsm:function(s,t){return s&t},oPQOU:function(s,t){return s>>>t},lXpIV:function(s,t){return s!==t},GeIIw:function(s,t){return s===t},YuSSF:r(752),QCIVN:"XlNxs",toEAP:function(s,t){return s(t)},vmYzC:function(s,t){return s<<t},rLHpi:function(s,t){return s<<t},daapJ:function(s,t){return s|t},Jmzzr:function(s,t){return s|t},pKxCQ:function(s,t){return s|t},rOmbg:function(s,t){return s>>>t},WHyxa:function(s,t){return s|t},PHVcj:function(s,t){return s|t},wgyqV:function(s,t){return s<<t},pyvVH:function(s,t){return s>>>t},BuqxG:function(s,t){return s>=t},KCAoz:function(s,t){return s<=t},TggTB:function(s,t){return s%t},vJZOr:function(s,t){return s|t},znCDw:function(s,t){return s/t},uLvkJ:function(s,t){return s>>>t},noReK:function(s,t){return s>>>t},Jlxke:function(s,t){return s===t},PIpqi:function(s,t){return s&t},yanhF:function(s,t){return s&t},ysSga:function(s,t){return s<<t},roYnA:function(s,t){return s!==t},OByOQ:function(s,t){return s===t},mBcsR:function(s,t){return s>>>t},bRegL:function(s,t){return s===t},sLLcg:function(s,t){return s&t},vCZYy:function(s,t){return s>>>t},vPfER:function(s,t){return s>>>t},vhvdA:function(s,t){return s&t},uLeuT:function(s,t){return s>>>t},XVxGj:function(s,t){return s===t},uqWLY:r(1620),WAOiJ:function(s,t){return s&t},ADAqy:function(s,t){return s&t},pVGxK:r(896)+"0|2",MKeOh:r(1217)+"OR",JETSk:r(222)+r(336),kmAGN:r(399)+r(985)+"R",CERhc:r(425)+r(1271),SfZjk:r(243)+"ERROR",KMGCd:r(629),PhnPF:r(1130)+"3",SnEeV:function(s,t){return s===t},WApsD:r(352),bqggL:r(1013),ijqaO:"2|1|4|0|3",wUkCM:r(508),ftuvK:function(s,t){return s-t},fOBEP:function(s,t){return s>t},TMmmY:r(1573),YFshg:function(s,t){return s===t},LHpab:"objectSt"+r(204),yDCcw:function(s,t){return s===t},blLAw:r(1061),xhABy:function(s,t){return s instanceof t},XTGHe:function(s,t){return s+t},Vhykd:r(309)+r(1326),AEUtH:function(s,t){return s<t},iIWvI:function(s,t){return s===t},YSlYq:function(s,t,n){return s(t,n)},dCMFY:function(s,t,n){return s(t,n)},iojll:r(1259),xvZic:function(s,t,n){return s(t,n)},NEjiL:r(965),yhLIm:function(s,t){return s!==t},eyodo:r(636),iNGSG:function(s,t){return s===t},aMpVX:r(1262),IrGRn:r(1193),flqXl:function(s,t,n){return s(t,n)},usBZm:function(s,t){return s>t},FbDzb:function(s,t){return s===t},yodZt:r(930),kbHLY:function(s,t){return s instanceof t},GaNpk:r(818)+"ile_name",yFXmv:r(852)+r(785),gcMoG:r(976),VixQF:function(s,t){return s||t},gEAxi:r(441)+"d",VHudE:"1|0|2|3|4",yPRrr:function(s,t){return s||t},YabXI:function(s,t){return s!=t},zOJIw:function(s,t){return s<=t},qYwfG:"next() c"+r(463)+"ltiple t"+r(1258)+r(1181),TxFmo:function(s,t){return s<t},pszsR:function(s,t){return s<t},sHncH:function(s,t){return s&t},GwcfG:function(s,t){return s<t},qcoZn:function(s,t){return s>=t},pHgOy:function(s,t){return s<t},myIdl:function(s,t){return s|t},kJyaF:function(s,t){return s>=t},yQoCa:function(s,t){return s|t},OijsM:function(s,t){return s|t},QNMaB:function(s,t){return s&t},ZsDBK:function(s,t){return s&t},CyZZU:function(s,t){return s&t},eLsfy:function(s,t){return s&t},grgbz:function(s,t){return s!=t},CCmWI:r(751),IQzmP:"applicat"+r(842),hcxlW:r(676),sctBK:r(306),bhskc:function(s,t){return s>>t},DLBnq:function(s,t){return s|t},GMIhP:function(s,t){return s===t},pjJdZ:function(s,t){return s===t},xZYHj:"fVxsb",Lqvck:"sxWAM",suFJk:r(542)+r(740),hRmOO:function(s,t){return s&t},pcRMr:function(s,t){return s&t},PVOYU:function(s,t){return s|t},LbkvR:function(s,t){return s+t},WpFRG:function(s,t){return s&t},PcwdH:function(s,t){return s|t},AXxEl:function(s,t){return s&t},IsKmD:function(s,t){return s&t},VSZvN:function(s,t,n,o){return s(t,n,o)},eWnCh:function(s,t){return s!=t},oZFIg:function(s,t){return s instanceof t},ODDzo:function(s,t){return s instanceof t},bAMNP:function(s,t){return s!=t},KVMhm:r(727)+r(1479)+r(920),xuPVH:"boe",LQGIt:"stop imm"+r(303)+r(765)+"ct",MwAJi:function(s,t){return s===t},OMuNx:r(773),iNsIv:function(s,t){return s(t)},grMIv:function(s,t){return s+t},AmstE:r(1465),xNmNL:function(s,t){return s(t)},IvAIn:function(s,t){return s(t)},GzQvo:r(1545),EILYV:function(s,t,n){return s(t,n)},XSqIw:r(365),fgrDr:r(467),YlgmE:function(s,t,n,o){return s(t,n,o)},IjqPk:"success",SNBzT:function(s,t){return s!==t},pNQBt:r(1426),oOrcV:r(1268),iXvGL:r(1103),GNtYf:function(s,t,n){return s(t,n)},ltijy:function(s,t){return s+t},mFcxp:r(1510),RnekH:function(s,t){return s!==t},RWGet:r(288),NhuKQ:r(570),yFUrY:function(s,t){return s!==t},vcRis:r(355),onfme:"JfKsE",TZcwU:"TOXhb",vrSam:"kwqQZ",iRNVt:function(s,t){return s(t)},MPRdP:r(380),qTnZs:r(790),wNAWI:function(s,t){return s||t},mToTK:r(1031),fuIuu:r(1398),OHqxp:function(s,t){return s||t},DtoxL:r(1275),IbgQY:function(s,t){return s||t},dSEIy:function(s,t){return s||t},nKbRB:r(717),pKRik:r(382),HNRgK:function(s,t){return s||t},KBKWj:function(s,t){return s!=t},rctXJ:r(795),vcvHN:function(s,t){return s(t)},qiQmJ:function(s,t,n){return s(t,n)},uEdFI:function(s,t){return s+t},gVFbr:r(1231),IHTGh:function(s,t){return s-t},gferY:function(s,t){return s&t},OccqD:function(s,t){return s|t},azVAq:function(s,t){return s&t},iDrts:r(464),gAdcG:function(s,t,n,o){return s(t,n,o)},CrnJw:r(1382)+r(758),GkpBk:function(s,t,n,o){return s(t,n,o)},XqUWl:r(1382)+r(1286)+"ck",NzKVY:function(s,t,n,o){return s(t,n,o)},DNrDM:r(1382)+"er_ack_m"+r(959),orwKm:function(s,t){return s(t)},eeSWc:r(293),jpiBu:function(s,t,n,o){return s(t,n,o)},hVHRn:r(199),cMhEQ:function(s,t,n,o){return s(t,n,o)},fQxNw:r(1372),kVGWH:function(s,t){return s&&t},omCKd:r(1288),JkbOf:function(s,t){return s||t},AhpLS:"received",ocOZV:function(s,t){return s instanceof t},RpvOG:function(s,t){return s===t},kwAEz:r(398),SEogJ:function(s,t){return s!==t},dnPSV:r(656),KlAsr:"DBTOv",WpgfL:function(s,t){return s instanceof t},ElDIs:r(770)+r(842)+r(440)+r(1005),WRYkU:"none_none",IkutW:function(s,t,n,o){return s(t,n,o)},auRHj:function(s,t){return s>t},RZjDA:function(s,t){return s(t)},xnaTj:function(s,t){return s>t},TlijV:function(s,t){return s+t},QRKuj:function(s,t){return s||t},PpSsw:function(s,t){return s>>>t},lnnfm:function(s,t){return s!==t},fsZLh:r(829),THAUo:function(s,t){return s+t},CNgTz:"index ou"+r(611)+r(217),LeVJx:r(1165),hyPBs:function(s,t){return s||t},vPnvn:function(s,t){return s&t},HummS:function(s,t,n,o){return s(t,n,o)},skBic:function(s,t){return s+t},IxcnJ:function(s,t,n){return s(t,n)},LhEiz:"4|1|3|2|0",OOnel:function(s,t){return s+t},rwlLv:function(s,t,n,o){return s(t,n,o)},LHAeS:function(s,t){return s+t},mfPmV:function(s,t,n,o){return s(t,n,o)},ccHul:function(s,t){return s+t},yWlIF:function(s,t){return s+t},EKvhq:function(s,t){return s|t},wTjDY:function(s,t){return s<<t},QKOgQ:function(s,t){return s+t},ZKyjj:function(s,t){return s<<t},iwGSc:function(s,t){return s+t},kgVbb:function(s,t){return s+t},MscWo:function(s,t){return s+t},wTTVB:function(s,t){return s|t},AXUVN:function(s,t){return s<<t},UlpKB:function(s,t){return s+t},dWTSg:function(s,t){return s+t},GjZac:function(s,t){return s>>>t},SngSl:function(s,t){return s+t},dFPms:function(s,t){return s&t},CGAfT:function(s,t){return s+t},GFDXm:function(s,t){return s+t},gsvBH:function(s,t){return s&t},NwSrd:function(s,t){return s&t},lAMtm:function(s,t){return s&t},gJbEK:function(s,t){return s|t},zUIub:function(s,t){return s>>t},XojXO:function(s,t){return s===t},JGWoe:r(451),NJcxw:r(1046),rElKZ:function(s,t){return s!==t},YosCX:function(s,t){return s!==t},DRCCE:function(s,t){return s>>>t},IsEHg:function(s,t){return s|t},UloIV:function(s,t){return s&t},xWrUJ:function(s,t){return s|t},fkxhL:function(s,t){return s>>>t},mtLCZ:function(s,t){return s|t},SVBxF:function(s,t){return s<<t},CDETF:function(s,t){return s>>>t},JRdfD:function(s,t){return s&t},kYTRG:function(s,t){return s|t},pCupv:function(s,t){return s===t},ptPSG:r(1466),nJbDG:function(s,t){return s|t},JtQwi:function(s,t){return s!==t},wrMDh:"QWdzW",gcYqd:"JOxue",RWVrx:function(s,t){return s(t)},WAlqn:function(s,t){return s+t},TbXao:r(739)+"|7|4|9|6|8|5|0",DEjkR:r(1190),ROtCV:r(1024)+"ervice",bmFhL:function(s,t,n,o){return s(t,n,o)},uXkFr:r(919),vGqfX:function(s,t){return s(t)},gOHHJ:function(s,t){return s<t},XDlZY:function(s,t,n){return s(t,n)},EVaNS:function(s,t,n,o){return s(t,n,o)},Duftw:function(s,t,n){return s(t,n)},jFdbg:function(s,t,n){return s(t,n)},DvYSw:function(s,t){return s===t},KMkSo:r(1321),uappH:"allCurso"+r(722),gaslx:r(360),drTFd:function(s,t,n,o){return s(t,n,o)},rexeJ:r(1132),QMezL:r(1387),EjaBv:function(s,t,n,o){return s(t,n,o)},ZmWCK:r(1280),efHEw:function(s,t){return s|t},SqlkZ:function(s,t){return s<<t},uGGXI:function(s,t){return s<<t},RjCxG:function(s,t){return s<<t},XMxzx:function(s,t){return s|t},MdtFt:function(s,t){return s===t},dmcRj:r(1412),MLKQj:r(763),mljIN:function(s,t,n){return s(t,n)},yjlpZ:function(s,t){return s||t},ogEOq:r(455),HFAeT:function(s,t,n,o){return s(t,n,o)},mCIfX:r(634),JnKVB:"x_fronti"+r(1075),kUMth:function(s,t){return s(t)},kYWkk:r(1382)+r(393),odQcx:function(s,t,n,o){return s(t,n,o)},eHvoe:r(433)+"s",FloOg:r(1001)+r(1498)+"e",adWXD:function(s,t,n){return s(t,n)},QIOUJ:"x-msg-cu"+r(925)+"ue",HtXhB:function(s){return s()},wWCiO:function(s,t){return s<t},FtciR:function(s){return s()},WjExt:function(s,t,n){return s(t,n)},UJfNH:function(s){return s()},qmCvE:function(s,t){return s!==t},RjTYz:function(s,t){return s<t},HOdUD:function(s,t){return s===t},gUluB:function(s){return s()},bulYw:function(s,t,n){return s(t,n)},NFiCr:function(s,t,n){return s(t,n)},bzrkb:r(1425),HmcNJ:function(s){return s()},EXwlN:r(207),xlgvJ:function(s,t,n){return s(t,n)},WNqyZ:function(s,t){return s===t},KepRA:r(1614),sEvEh:function(s,t){return s!==t},Igflr:function(s,t,n){return s(t,n)},XamOx:function(s,t){return s!==t},jSiGZ:function(s,t,n){return s(t,n)},uwIcJ:function(s,t,n){return s(t,n)},iyCFI:r(228),auFnv:"pIwbk",cNnyY:r(794),qvARv:r(937),vEGqx:function(s,t){return s===t},FwdRg:r(1079)+r(1300)+r(477)+", WebSoc"+r(363)+r(1374)+r(1065)+r(314),ZPOoR:function(s,t,n){return s(t,n)},mwrRe:r(1225)+"t",YyHci:r(1481),dTAsi:r(1152),qomxi:r(466),yHTrt:r(972),RFpMQ:r(1104),lafFS:r(1458)+"d",Zsmyg:function(s,t,n){return s(t,n)},VAuJB:r(1417),oJqRZ:function(s,t,n){return s(t,n)},TXYHv:function(s,t){return s||t},hFuYE:function(s,t,n){return s(t,n)},rrftd:r(810),GVhzI:function(s,t){return s>t},FQkSM:function(s,t){return s-t},qgRIj:function(s,t){return s(t)},SMZrb:"WGRjF",UrLEh:r(1092)+">",igCrU:function(s,t){return s===t},oTpRp:"vtFvh",IXVZC:function(s,t){return s>t},MfIhs:function(s,t,n,o){return s(t,n,o)},YBOWF:"dCVVT",WEzxw:r(1402)+r(960)+"t",XeSvb:r(1594),GNTKM:r(1043)+r(1473)+r(1225)+r(1038)+r(738),JzDBU:r(1450),tMocb:"xAjMn",ebvPe:r(270),ySXMq:function(s,t,n,o){return s(t,n,o)},RYMkX:r(255),FkYjn:r(1572)+r(901)+"onnecting",jjHsl:r(1362),CFasJ:r(822)+"1",oUuzH:function(s,t){return s!==t},AeUqd:r(1141),CYOJw:function(s,t,n){return s(t,n)},cohel:"PdVzG",krkEo:function(s,t,n){return s(t,n)},JYFdY:function(s,t,n){return s(t,n)},JpaJW:r(1043)+r(1517)+r(991)+r(1590),lVGoi:r(1093),Qmhts:function(s,t){return s(t)},OzKSe:function(s,t){return s!==t},vxssM:r(457),HzxAE:function(s,t){return s|t},APQGM:"SiSjK",krrMW:r(509),efFvQ:r(1142),GkzdW:r(386)+r(521),iFBFQ:function(s,t){return s===t},GuRYW:"close, ws instan"+r(1244)+"nitialized",RBbZr:"please p"+r(1083)+r(200)+r(1235)+r(1293)+r(1076)+r(955)+r(482)+r(1569),zAUUt:r(472),YGSsM:function(s,t){return s!=t},sREcf:function(s,t){return s(t)},GTWJD:function(s,t){return s(t)},LoPuE:function(s,t){return s instanceof t},zJyaV:function(s,t){return s===t},LdeRQ:"LrNEO",btpOA:function(s,t){return s||t},yRZgt:function(s,t){return s==t},VPSjG:function(s,t){return s!==t},eBaWQ:r(294)+r(1469)+"ing",HJFEZ:"1|0|4|2|3",aTxZs:function(s,t,n){return s(t,n)},QcclB:function(s,t){return s(t)},SKGWL:r(598),bYPYm:function(s,t){return s*t},YBKUP:r(1560),vfsvn:function(s,t){return s===t},KswYE:r(374),idLvF:r(490)+r(531)+"lobalScope",GFRqs:function(s,t){return s!=t},tfXHP:function(s,t){return s===t},ADzWv:r(1257)+r(1008)+r(1579),TtQQt:function(s,t){return s!=t},ITwwy:function(s,t){return s===t},uLuNL:function(s,t){return s===t},gPAoY:function(s,t,n){return s(t,n)},TGCao:r(428)+r(926)};Ce.r(Z),Ce.d(Z,{FWS:()=>t0,CustomErrorEvent:()=>ms,createCloseEvent:()=>me,ReconnectEvent:()=>ps,createErrorEvent:()=>le,decodedFrame:()=>ds,createOpenEvent:()=>Ss,CustomCloseEvent:()=>ws,createReconnectEvent:()=>cr,FrontierMessageEvent:()=>ys,encodeFrame:()=>ar,createMessageEvent:()=>vs,OpenEvent:()=>bs,ErrorCode:()=>Ue,Event:()=>ot,MessageEvent:()=>_s});let i="";function a(s=""){let t=r,n="02",o=""+Date[t(1080)](),x=i||(i=e[t(867)](m,s)),l=Math[t(1325)]().toString(16)[t(258)](-6);return e.FRbVu(e[t(1151)](e[t(1151)](n,o),x),l)}function c(){let s=r;return e[s(1558)](e.nsYqv(1e4,Date.now()),Math[s(1026)](e[s(1236)](1e4,Math[s(1325)]())))}function u(s){let t=r;return e[t(1151)](e[t(709)](Array,8)[t(760)]("0"),parseInt(s,10)[t(187)](2)).slice(-8)}function d(s){let t=r;return e.FRbVu(e[t(1158)](Array,4).join("0"),e.gMddX(parseInt,s,2).toString(16))[t(258)](-4)}function h(s){let t=r;if(e[t(343)]!==e[t(1538)]){let n=s[t(1357)](/\./)[t(1494)](l=>u(l)),o=[];return o[0]=e.WPYoB(d,e[t(1511)](n[0],n[1])),o[1]=d(e[t(1100)](n[2],n[3])),[e[t(568)],e[t(568)],e[t(568)],t(1331),t(1331),t(1290),o[0],o[1]][t(760)]("")}else return _0x9432c0["objectSt"+t(204)]||_0x25bd17[t(935)](_0x5658b1)}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(1048)](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]))/.test(s);return n?h(s):o?w(s):"00000000"+t(267)+t(267)+"00000000"}function w(s){let t=r,n={plPWc:function(b,v){return e.tUfgP(b,v)},niZIb:e[t(693)]},o="",x=[],l=0,g=0,p=!0,f="0000";if(e.VHGqh(s[t(496)]("::"),-1)){let b=s[t(1357)]("::");for(let C=0;e[t(1599)](C,b[t(836)]);C++){let I=b[C];if(e[t(918)](I[t(496)](":"),0)){let O=I.split(":");p&&(l=O.length),g+=O[t(836)];for(let L=0;e[t(701)](L,O[t(836)]);L++)if(e[t(1363)](4,O[L][t(836)]))if(e[t(1134)](e[t(964)],e.QMscP)){let B=f[t(1603)+"g"](0,e.YKCmo(4,O[L][t(836)])),Q=B[t(1499)](O[L]);x[t(547)](Q)}else{let B=_0x21ffcb[t(1232)+t(672)](e[t(730)]);_0x40d8c1[t(506)+t(562)]=Q=>{let $=t;_0x349a1a[$(297)][$(1112)+$(975)](B),_0x1c19f9["frontier"+$(562)]=void 0,n.plPWc(_0x4db6ac,Q&&Q[$(359)]||n[$(252)])},B[t(317)]=e[t(260)],B.src=_0x5a6961[t(1399)](/^ws/,e[t(697)])+e[t(941)];try{_0x16e771.body[t(271)+t(975)](B)}catch{_0x10d54f[t(297)][t(1112)+"ild"](B)}}else x[t(547)](O[L]);p=!1}else{if(e[t(545)](4,I[t(836)]))if(e[t(545)](t(704),t(954))){let O=f[t(1603)+"g"](0,e[t(571)](4,I.length)),L=O[t(1499)](I);x.push(L)}else return this[t(480)+t(344)+t(1380)+"t"];else x[t(547)](I);p&&(l+=1),g+=1,p=!1}}let v="";for(let C=0;e.mrBPQ(C,e[t(378)](8,g));C++)v=v[t(1499)](f);for(let C=0;e[t(233)](C,x[t(836)]);C++)e[t(1134)](C,l)?(o=o.concat(v),o=o.concat(x[C])):o=o[t(1499)](x[C]);return o}{let b=s[t(1357)](":");for(let v=0;e[t(1039)](v,b.length);v++){let C=b[v];if(e[t(1363)](4,b[v][t(836)])){let I=f.substring(0,e[t(554)](4,b[v][t(836)])),O=I[t(1499)](C);o=o[t(1499)](O)}else o=o[t(1499)](C)}return o}}function _(s,t){let n=r,o=s.key;e[n(607)](void 0,o)&&(e[n(1482)](V,t,10),e[n(1482)](ve,t,o));let x=s.value;e.znLGG(void 0,x)&&(e[n(1482)](V,t,18),e[n(608)](ve,t,x))}function y(s){let t=r,n={};e:for(;!e[t(1050)](ke,s);){let o=e[t(1050)](H,s);switch(e[t(1081)](o,3)){case 0:break e;case 1:n[t(275)]=e.bCRLX(be,s,e[t(216)](H,s));break;case 2:n[t(1403)]=e[t(608)](be,s,e[t(289)](H,s));break;default:e[t(421)](oe,s,7&o)}}if(e[t(1134)](void 0,n[t(275)]))throw new Error(e[t(1606)]);if(e[t(1134)](void 0,n[t(1403)]))throw new Error(e.loSPn);return n}function A(s){let t=r,n=xe();return e[t(1574)](k,s,n),e[t(1546)](J,n)}function k(s,t){let n=r,o={BZrZM:function(l,g){return e.VleeX(l,g)},LtflP:n(830)+n(446)+"e",isOvN:function(l,g){return l>=g},ubLuP:function(l,g){return e[n(348)](l,g)},WOtXI:function(l,g,p,f){return e[n(856)](l,g,p,f)},DGnNn:function(l,g){return e[n(1558)](l,g)},wjbcu:function(l,g){return l+g}};if(n(1462)!==e.nxcat)this[n(476)]=!0,this[n(1054)]();else{let l=s.SeqID;if(e[n(454)](void 0,l))if(e[n(1143)]!==e.wadRW){if(o[n(994)](_0x5bee0c,_0x58db7f))throw new _0x3c63d9(o.LtflP);let $=3;for(;o.isOvN($,0);){let Ie=o[n(943)](255,_0x573375);o[n(502)](_0x1d4ae9,Ie,_0x4f782e,o.DGnNn(_0x19f8ad,$)),_0x1ca22a>>>=8,$--}return o[n(1448)](_0x5cf8cc,4)}else e[n(1476)](V,t,8),e[n(1482)](Ct,t,l);let g=s[n(196)];e[n(1036)](void 0,g)&&(e[n(1476)](V,t,16),e[n(608)](Ct,t,g));let p=s[n(255)];e.jptqS(void 0,p)&&(e[n(350)](V,t,24),e[n(1356)](Ct,t,e[n(1062)](te,p)));let f=s[n(915)];f!==void 0&&(V(t,32),e[n(622)](Ct,t,e[n(1546)](te,f)));let b=s[n(1457)];if(e[n(638)](void 0,b))for(let $ of b){e[n(1574)](V,t,42);let Ie=e.KgtCY(xe);_($,Ie),e[n(844)](V,t,Ie.limit),e.uBRlV(Yt,t,Ie),e[n(289)](P,Ie)}let v=s["payloadE"+n(859)];if(e[n(1036)](void 0,v))if(e[n(1602)](e[n(1608)],e[n(1608)]))V(t,50),e[n(421)](ve,t,v);else for(var x in _0x168721)VbOySU[n(502)](_0x1e0f73,_0x1036e5,x,{get:_0x5976b1[x],enumerable:!0});let C=s["payloadT"+n(1164)];e[n(545)](void 0,C)&&(V(t,58),ve(t,C));let I=s[n(1192)];if(I!==void 0){if(e[n(1214)](e.CDvJj,e[n(690)]))return this._socket[n(1528)+"ns"];e[n(1149)](V,t,66),V(t,I[n(836)]),e[n(1588)](Vt,t,I)}let O=s[n(581)];if(O!==void 0)if(e[n(1134)](e.gkhDh,e[n(529)]))e[n(194)](V,t,74),e.DHOJo(ve,t,O);else return new _0x29cfcd(_0x3149a0,{message:_0x1a39e3});let L=s[n(931)+n(1126)];e[n(869)](void 0,L)&&(e[n(1588)](V,t,82),ve(t,L));let B=s.msgID;if(e[n(1214)](void 0,B))if(e[n(649)](e[n(1237)],e[n(318)]))e[n(684)](V,t,90),ve(t,B);else{let $=new _0x373154(e[n(1236)](2,_0x4107d8));$[n(396)](_0xb343f2),_0x4fb73f[n(1585)]=$}let Q=s[n(519)+"e"];e[n(869)](void 0,Q)&&(e.dikJU(V,t,96),e[n(292)](Ct,t,e[n(330)](te,Q)))}}function T(s){let t=r;return e.tUfgP(R,e[t(1350)](F,s))}function R(s){let t=r,n={};e:for(;!ke(s);){let o=H(s);switch(e[t(1081)](o,3)){case 0:break e;case 1:n[t(1072)]=e[t(1476)](De,s,!0);break;case 2:n[t(196)]=e.lkxww(De,s,!0);break;case 3:n[t(255)]=H(s);break;case 4:n.method=e.McAft(H,s);break;case 5:{let x=e[t(1050)](q,s);(n.headers||(n.headers=[]))[t(547)](e[t(1062)](y,s)),s.limit=x;break}case 6:n[t(731)+"ncoding"]=e[t(471)](be,s,e[t(1062)](H,s));break;case 7:n["payloadT"+t(1164)]=e[t(1185)](be,s,H(s));break;case 8:n[t(1192)]=e.cFNPZ(Et,s,e[t(1158)](H,s));break;case 9:n[t(581)]=e[t(1618)](be,s,H(s));break;case 10:n[t(931)+t(1126)]=e[t(645)](be,s,e[t(1350)](H,s));break;case 11:n[t(1306)]=e[t(471)](be,s,e[t(1242)](H,s));break;case 12:n[t(519)+"e"]=e.NPoqF(H,s);break;default:oe(s,7&o)}}if(e[t(1602)](void 0,n.SeqID))throw new Error(e[t(1314)]);if(e.RJBHb(void 0,n.LogID))throw new Error("Missing "+t(238)+" field: "+t(196));if(e[t(1602)](void 0,n[t(255)]))throw new Error(e.rDsUi);if(n[t(915)]===void 0)throw new Error(e[t(1575)]);return n}function q(s){let t=r,n=e.CGRCj(H,s),o=s[t(1267)];return s[t(1267)]=s.offset+n,o}function oe(s,t){let n=r;switch(t){case 0:for(;e[n(670)](128,e[n(610)](ae,s)););break;case 2:e[n(292)](ne,s,H(s));break;case 5:e[n(1068)](ne,s,4);break;case 1:e[n(1618)](ne,s,8);break;default:throw new Error(e.JFCJQ+t)}}function te(s){let t=r;return s|=0,{low:s,high:e[t(298)](s,31),unsigned:s>=0}}let ye=[];function xe(){let s=r,t={gJuvd:e[s(720)],Sjbkq:function(n,o,x){return e.hjZQq(n,o,x)}};if(e[s(1179)](e.ElTqA,e.OgqYr))this[s(759)](t[s(1365)],t[s(1500)](_0x217a60,t[s(1365)],{message:this[s(702)+"rrorMess"+s(302)](_0x3cf098)}));else{let n=ye.pop();return n?(n.offset=n.limit=0,n):{bytes:new Uint8Array(64),offset:0,limit:0}}}function P(s){let t=r;e[t(1041)](e.unSHn,e[t(691)])?(_0x1d5746&&_0x49a088[t(426)+t(1037)](WjnquI[t(1540)],()=>_0x37801b()),_0x16b6f8&&_0x159e21[t(426)+t(1037)](t(1311)+"hange",()=>_0x1d3e54())):ye[t(547)](s)}function F(s){return{bytes:s,offset:0,limit:s[r(836)]}}function J(s){let t=r,n=s.bytes,o=s[t(1267)];return e[t(1002)](n[t(836)],o)?n:n[t(500)](0,o)}function ne(s,t){let n=r;if(e.yxSoK(e[n(1443)](s[n(1044)],t),s.limit))throw new Error(e.fXHRM);s.offset+=t}function ke(s){let t=r;return s[t(1044)]>=s[t(1267)]}function pe(s,t){let n=r,o=s[n(1585)],x=s[n(1044)],l=s[n(1267)],g=e[n(1021)](x,t);if(g>o[n(836)]){let p=new Uint8Array(2*g);p[n(396)](o),s.bytes=p}return s[n(1044)]=g,g>l&&(s.limit=g),x}function $e(s,t){let n=r,o={ZPXgB:e[n(720)],vdNuy:function(x,l,g){return e[n(684)](x,l,g)},ruaqj:function(x,l){return x+l}};if(e.AKcgf(n(444),e[n(1183)])){let x=s[n(1044)];if(e[n(1021)](x,t)>s[n(1267)])throw new Error("Read pas"+n(266));return s[n(1044)]+=t,x}else{let x={PyWIf:o.ZPXgB,slbCU:function(g,p,f){return o.vdNuy(g,p,f)}},l=_0x12191c[n(1071)][n(258)](_0x28567b[n(1163)+"et"],o[n(936)](_0x5899dc[n(762)+"th"],_0x1a0d50[n(1163)+"et"]));this[n(1034)]&&this[n(1034)][n(537)]({data:l,fail:g=>{let p=n;this.emit(x.PyWIf,x.slbCU(_0x3148e0,x[p(1593)],{message:this["_formatE"+p(721)+p(302)](g)}))}})}}function Et(s,t){let n=r,o={euWAx:function(x){return e[D(364)](x)}};if(e[n(1172)](e[n(1413)],e[n(1413)])){let x=$e(s,t);return s[n(1585)][n(500)](x,e[n(1151)](x,t))}else this[n(476)]=!1,_0x16a899(this[n(1054)+n(793)+n(1543)]),o.euWAx(_0x1c118e)}function Vt(s,t){let n=r,o=e.YZLzs(pe,s,t[n(836)]);s[n(1585)][n(396)](t,o)}function be(s,t){let n=r,o={PZRuu:function(b,v){return e.CGRCj(b,v)}},x=e.IcejH($e,s,t),l=String["fromChar"+n(887)],g=s[n(1585)],p="\uFFFD",f="";for(let b=0;e[n(384)](b,t);b++){let v=g[b+x],C,I,O,L;if(e[n(737)](128&v,0))f+=l(v);else if(e.cWczc(e[n(1477)](224,v),192))e[n(1443)](b,1)>=t?f+=p:(C=g[e[n(1511)](b+x,1)],e[n(869)](e[n(1153)](192,C),128)?f+=p:(L=e[n(242)](e.leNWC(31,v),6)|e[n(670)](63,C),e[n(1015)](L,128)?f+=p:(f+=e.LoDtN(l,L),b++)));else if(e[n(1348)](240&v,224))if(e[n(1558)](b,2)>=t)f+=p;else if(e.iZbcz(e[n(1291)],e[n(1351)]))if(C=g[e[n(478)](e[n(1151)](b,x),1)],I=g[b+x+2],e[n(1601)](e.leNWC(C|e.crJGD(I,8),49344),32896))f+=p;else if(L=e.ySTXw((15&v)<<12,e[n(225)](e[n(670)](63,C),6))|e.VarDx(63,I),e[n(1586)](L,2048)||e[n(817)](L,55296)&&e[n(653)](L,57343))f+=p;else if(e[n(1421)](e[n(1186)],e.RjirG)){let B=new _0xa44acd(o.PZRuu(_0x30d343,_0x15df65));return _0x2aa328(_0x51b189,B,0),B}else f+=e[n(1370)](l,L),b+=2;else{if(e[n(518)](void 0,_0x83c1c0))this[n(479)+"rs"]={};else if(_0x1af374===void 0)this._listeners[_0x32b127]=null;else{let B=this._listeners[_0x5e182f];if(B)for(let Q=0;e[n(1586)](Q,B[n(836)]);)B[Q].fn===_0x5cd812?B[n(1375)](Q,1):++Q}return this}else e.VarDx(248,v)==240?e[n(1021)](b,3)>=t?f+=p:(C=g[e[n(1541)](e[n(1539)](b,x),1)],I=g[e[n(1140)](e[n(736)](b,x),2)],O=g[e[n(299)](b,x)+3],(e[n(707)](e[n(1135)](C,e[n(1318)](I,8)),O<<16)&12632256)!==8421504?f+=p:(L=e[n(312)](e[n(707)](e[n(225)](e[n(512)](7,v),18),e.leNWC(63,C)<<12)|e[n(1303)](e[n(1219)](63,I),6),e[n(593)](63,O)),e[n(559)](L,65536)||e.yxSoK(L,1114111)?f+=p:(L-=65536,f+=e[n(1565)](l,e[n(1021)](e.uMiIL(L,10),55296),(1023&L)+56320),b+=3))):f+=p}return f}function ve(s,t){let n=r,o=t.length,x=0;for(let p=0;e.mdTDf(p,o);p++){let f=t[n(1227)+"At"](p);e[n(279)](f,55296)&&e[n(695)](f,56319)&&e[n(1586)](e[n(1539)](p,1),o)&&(f=e[n(1006)](e[n(1511)](e[n(242)](f,10),t.charCodeAt(++p)),56613888)),x+=e[n(384)](f,128)?1:e[n(803)](f,2048)?2:e[n(384)](f,65536)?3:4}V(s,x);let l=e.sCtRC(pe,s,x),g=s[n(1585)];for(let p=0;e[n(1101)](p,o);p++){let f=t[n(1227)+"At"](p);if(e[n(1147)](f,55296)&&f<=56319&&e[n(1599)](p+1,o)&&(f=e.cQfow(e[n(404)](f<<10,t.charCodeAt(++p)),56613888)),e[n(290)](f,128))g[l++]=f;else{if(e[n(803)](f,2048))g[l++]=e[n(1477)](e[n(687)](f,6),31)|192;else{if(f<65536)g[l++]=e.RULqK(e[n(753)](f>>12,15),224);else{if(e[n(587)]("JOAVl",e.fIxaT))return(this._listeners[_0x2eb1e7]||(this._listeners[_0x11767d]=[]))[n(547)]({fn:_0x4d6fd1,ctx:_0x413bb6||this}),this;g[l++]=e.IjiTq(e[n(401)](e[n(687)](f,18),7),240),g[l++]=e[n(394)](e[n(644)](f>>12,63),128)}g[l++]=e[n(673)](f>>6&63,128)}g[l++]=e.bQhiy(e.leNWC(63,f),128)}}}function Yt(s,t){let n=r,o=e[n(698)](pe,s,t.limit),x=s[n(1585)],l=t[n(1585)];for(let g=0,p=t[n(1267)];e[n(1117)](g,p);g++)x[g+o]=l[g]}function ae(s){return s[r(1585)][e.YZLzs($e,s,1)]}function $t(s,t){let n=r;if(e[n(1602)](e.NKwUJ,n(202))){let o=pe(s,1);s[n(1585)][o]=t}else return _0x54bad2[n(367)+"8"]?{value:_0x4a1383[n(367)+"8"](_0x103b46),offset:e[n(619)](_0x15cbf3,1)}:{value:e[n(348)](255,_0x359a41[_0x5c583e]),offset:_0x10586b+1}}function H(s){let t=r,n=0,o=0,x;do x=ae(s),e[t(417)](n,32)&&(o|=e[t(593)](127,x)<<n),n+=7;while(128&x);return o}function V(s,t){let n=r;for(t>>>=0;t>=128;)e.cFNPZ($t,s,e[n(1135)](e[n(401)](127,t),128)),t>>>=7;e[n(1618)]($t,s,t)}function De(s,t){let n=r,o={FnkQJ:function(x,l,g){return e[D(639)](x,l,g)},haeoV:e.onPnX,JRSAa:function(x,l){return e[D(700)](x,l)},cQFAw:function(x,l){return e.bXFiG(x,l)},ImPNP:function(x,l){return e[D(1613)](x,l)},SgBDz:function(x,l){return e.ZqiIR(x,l)},PJopA:function(x,l){return e[D(232)](x,l)},MVvfK:function(x,l){return x||l},QdGnV:function(x,l){return x>>>l}};if(e.RJBHb(e.UTAim,e[n(475)]))this[n(203)+n(938)+n(533)]=_0x4cdec2,_0x3a81b7?this["_handleO"+n(370)]():this[n(536)+n(974)]();else{let x=0,l=0,g=0,p;if(p=ae(s),x=e[n(262)](127,p),128&p&&(p=e[n(1050)](ae,s),x|=e[n(855)](e[n(1477)](127,p),7),e[n(310)](128,p)&&(p=e[n(1158)](ae,s),x|=e[n(278)](e[n(1477)](127,p),14),128&p&&(p=e[n(1342)](ae,s),x|=e.bgrrf(e[n(248)](127,p),21),128&p&&(p=e[n(1546)](ae,s),l=127&p,e[n(512)](128,p)))))){if(e[n(1363)](e[n(851)],e[n(851)])){let f=this[n(1296)][n(1225)+n(796)+"ptor"](_0x26f1ed,_0x2dd72a);this[n(1138)+n(1284)+n(1346)](o[n(614)](_0x22eeb9,o[n(237)],{code:_0xef637b,reason:_0x5a2642,wasClean:!0,willReconnect:f})),f&&this._connect()}else if(p=e.uSGYP(ae,s),l|=e[n(878)](e.hwSVs(127,p),7),128&p)if(n(1358)===e.opTAV)p=e[n(879)](ae,s),l|=e[n(855)](e[n(512)](127,p),14),e[n(497)](128,p)&&(p=e[n(313)](ae,s),l|=e[n(1531)](e[n(663)](127,p),21),128&p&&(p=e[n(313)](ae,s),g=e[n(593)](127,p),128&p&&(p=ae(s),g|=e[n(1049)](e.CnDbA(127,p),7))));else{let f=o[n(1207)](_0x42756e,8192),b=o[n(837)](f,1),v=null,C=f;return function(I){let O=n;if(o[O(1446)](I,1)||I>b)return _0x3ac57f(I);o[O(872)](o.ImPNP(C,I),f)&&(v=o.SgBDz(_0x564687,f),C=0);let L=_0x1e10a1[O(812)](v,C,C+=I);return 7&C&&(C=o[O(958)](o.PJopA(7,C),1)),L}}}return{low:x|e.KHNwX(l,28),high:e[n(1553)](e[n(524)](l,4),g<<24),unsigned:t}}}function Ct(s,t){let n=r,o=e[n(1137)](t[n(1239)],0),x=(t[n(1239)]>>>28|e[n(831)](t[n(1028)],4))>>>0,l=e.JqRZu(t[n(1028)],24),g=e[n(873)](0,l)?x===0?e[n(559)](o,16384)?o<128?1:2:e[n(417)](o,2097152)?3:4:e.dzOWn(x,16384)?e.PdjEn(x,128)?5:6:e.mrBPQ(x,2097152)?7:8:e[n(803)](l,128)?9:10,p=e[n(1442)](pe,s,g),f=s[n(1585)];switch(g){case 10:f[e[n(427)](p,9)]=e.VarDx(e[n(664)](l,7),1);case 9:f[e[n(1443)](p,8)]=g!==9?e[n(832)](128,l):e[n(213)](127,l);case 8:f[e[n(659)](p,7)]=e[n(649)](8,g)?x>>>21|128:e[n(348)](x>>>21,127);case 7:f[e.uYmch(p,6)]=e[n(218)](7,g)?e[n(707)](e[n(1137)](x,14),128):e[n(497)](e[n(1081)](x,14),127);case 6:f[p+5]=e[n(638)](6,g)?e[n(412)](e[n(1003)](x,7),128):e[n(590)](x,7)&127;case 5:f[e[n(299)](p,4)]=e[n(649)](5,g)?e[n(940)](128,x):127&x;case 4:f[e[n(1151)](p,3)]=e.ljrUx(4,g)?e.xESbF(o>>>21,128):o>>>21&127;case 3:f[e[n(736)](p,2)]=g!==3?e[n(1576)](o>>>14,128):e.mZEBV(e[n(1433)](o,14),127);case 2:f[p+1]=e[n(869)](2,g)?e[n(389)](e[n(1312)](o,7),128):e[n(1323)](e.oPQOU(o,7),127);case 1:f[p]=e[n(987)](1,g)?e.BMiQv(128,o):e[n(1219)](127,o)}}function ds(s){return e.CGRCj(T,s)}function ar(s){let t=r,n={vhQMD:function(o,x){return o(x)},OLWzU:function(o,x){return e[D(659)](o,x)}};if(e[t(498)](e[t(1431)],e[t(862)])){let o=nBbWdd.vhQMD(_0x5c63ce,_0x2d76eb),x=_0x1713fa[t(1267)];return _0xb0317a[t(1267)]=nBbWdd[t(432)](_0xb8e439[t(1044)],o),x}else return e.toEAP(A,s)}let fs=65536,fa=e[r(296)],it=e.nsYqv(fs,fs),ls=e[r(1145)](it,it),hs=e[r(681)](ls,2),Fe=String.prototype.charCodeAt;class z{constructor(t,n,o){let x=r;this[x(1467)]=!0,this[x(1239)]=e[x(232)](0,t),this.high=e[x(832)](0,n),this[x(857)]=!!o}static[r(1467)](t){return t&&t[r(1467)]===!0}static[r(599)](t,n,o){return new z(t,n,o)}static[r(870)+"s"](t,n,o){return o?z["fromByte"+r(1035)](t,n):z.fromBytesBE(t,n)}static[r(870)+"sLE"](t,n){let o=r;return new z(e.bQhiy(e[o(1576)](e[o(232)](t[0],e[o(1416)](t[1],8)),e[o(875)](t[2],16)),e[o(855)](t[3],24)),e[o(232)](t[4]|e[o(1303)](t[5],8)|t[6]<<16,e[o(1531)](t[7],24)),n)}static["fromByte"+r(1486)](t,n){let o=r;return new z(e[o(1553)](e.XqYQB(e[o(1085)](t[4]<<24,t[5]<<16),t[6]<<8),t[7]),e[o(840)](e.pKxCQ(e[o(1169)](e[o(1318)](t[0],24),e[o(1531)](t[1],16)),t[2]<<8),t[3]),n)}static fromHash(t){let n=r;return e[n(1602)](t,fa)?gs:new z(e[n(510)](e[n(226)](e[n(312)](Fe[n(812)](t,0),e[n(278)](Fe[n(812)](t,1),8)),e[n(831)](Fe[n(812)](t,2),16))|Fe[n(812)](t,3)<<24,0),e[n(664)](e.PHVcj(e.IjiTq(Fe[n(812)](t,4),e[n(878)](Fe.call(t,5),8))|e.TIqoC(Fe[n(812)](t,6),16),e[n(1056)](Fe[n(812)](t,7),24)),0),!0)}[r(744)](){let t=r;return String[t(1385)+t(887)](e[t(670)](255,this[t(1239)]),this[t(1239)]>>>8&255,e[t(664)](this.low,16)&255,e[t(221)](this[t(1239)],24),e[t(644)](255,this.high),e[t(1137)](this[t(1028)],8)&255,e[t(644)](this[t(1028)]>>>16,255),this[t(1028)]>>>24)}static[r(1252)+"er"](t,n=!0){let o=r;if(e[o(551)](isNaN,t))return n?la:gs;if(n){if(e[o(1234)](t,ls))return ga}else{if(e[o(1202)](t,-hs))return pa;if(t+1>=hs)return ha}return z[o(599)](e[o(1576)](e.TggTB(t,it),0),e[o(1110)](e[o(681)](t,it),0),n)}[r(1406)](){let t=r;return this.unsigned?e[t(1613)](e[t(1236)](e[t(1480)](this[t(1028)],0),it),e[t(1233)](this[t(1239)],0)):e.Fvbsu(this[t(1028)]*it,e.pyvVH(this[t(1239)],0))}[r(1320)](){let t=r;return e[t(219)](0,this[t(1028)])&&this.low===0}[r(997)](t){let n=r;z[n(1467)](t)||(t=z.fromNumber(t));let o=e[n(1081)](this[n(1028)],16),x=e[n(560)](65535,this[n(1028)]),l=e.lMksL(this.low,16),g=65535&this[n(1239)],p=t.high>>>16,f=e[n(670)](65535,t[n(1028)]),b=e[n(1433)](t.low,16),v=e[n(735)](65535,t[n(1239)]),C=0,I=0,O=0,L=0;return L+=e[n(299)](g,v),O+=e[n(524)](L,16),L&=65535,O+=l+b,I+=e[n(1495)](O,16),O&=65535,I+=x+f,C+=e[n(664)](I,16),I&=65535,C+=o+p,C&=65535,z[n(599)](e[n(226)](e[n(788)](O,16),L),e[n(1553)](C<<16,I),this[n(857)])}[r(1167)](t){let n=r;return z.isLong(t)||(t=z[n(1252)+"er"](t)),e.roYnA(this[n(857)],t.unsigned)&&e[n(1137)](this.high,31)===1&&e[n(569)](e[n(1210)](t.high,31),1)?!1:this.high===t[n(1028)]&&e.PwRKq(this.low,t[n(1239)])}[r(754)](){let t=r;return e[t(988)](-1,this.low)&&this[t(1028)]===-1?z[t(599)](0,0,this[t(857)]):this[t(1239)]===-1?z.fromBits(0,e[t(478)](this[t(1028)],1),this[t(857)]):z[t(599)](e[t(619)](this.low,1),this[t(1028)],this[t(857)])}toBytes(t){return t?this.toBytesLE():this[r(1030)+"E"]()}[r(439)+"E"](){let t=r,n=this[t(1028)],o=this[t(1239)];return[e[t(1323)](255,o),e[t(383)](e[t(718)](o,8),255),e[t(512)](e[t(664)](o,16),255),e.vPfER(o,24),255&n,e.esPsm(n>>>8,255),e[t(932)](e[t(1081)](n,16),255),e[t(1447)](n,24)]}[r(1030)+"E"](){let t=r;if(e[t(750)](t(1407),e[t(864)]))this.on(_0x189863,_0x1166c1);else{let n=this[t(1028)],o=this[t(1239)];return[n>>>24,e[t(310)](e[t(590)](n,16),255),e[t(956)](e[t(729)](n,8),255),255&n,e.uLvkJ(o,24),e[t(753)](o>>>16,255),e[t(1480)](o,8)&255,e[t(1156)](255,o)]}}}let gs=new z(0,0,!1),la=new z(0,0,!0),ha=z[r(599)](-1,2147483647,!1),ga=z[r(599)](-1,-1,!0),pa=z[r(599)](0,-2147483648,!1);var Ue=(function(s){let t=r,n=e[t(1615)][t(1357)]("|"),o=0;for(;;){switch(n[o++]){case"0":s[s[e[t(1445)]]=5005]=e[t(1445)];continue;case"1":s[s[e[t(1595)]]=5001]=e[t(1595)];continue;case"2":return s;case"3":s[s[e[t(1390)]]=5003]=e[t(1390)];continue;case"4":s[s[e[t(824)]]=5002]=e[t(824)];continue;case"5":s[s[e[t(854)]]=5004]=e.SfZjk;continue}break}})({});class ot{constructor(t){let n=r;e[n(1136)]!==e[n(1136)]?(_0x41c46c(_0x37f002,50),_0x5021a2(_0x3a3a74,_0x13a220)):(this[n(317)]=t,this[n(304)]=null)}}class ps extends ot{constructor(t,n){let o=r;super(t),this[o(965)]=n&&n.message||null}}class ms extends ot{constructor(t,n){let o=r,x=(o(415)+o(1376)).split("|"),l=0;for(;;){switch(x[l++]){case"0":this[o(1127)]=n&&n.error||null;continue;case"1":this[o(849)]=n&&n.filename||"";continue;case"2":this.colno=n&&n[o(319)]||0;continue;case"3":this[o(634)]=n&&n[o(634)]||5001;continue;case"4":super(t);continue;case"5":this[o(965)]=n&&n.message||"";continue;case"6":this[o(1109)]=n&&n[o(1109)]||0;continue}break}}}class ws extends ot{constructor(t,n){let o=r,x=e[o(1194)][o(1357)]("|"),l=0;for(;;){switch(x[l++]){case"0":this.code=n&&n[o(634)]||0;continue;case"1":this[o(743)]=n&&n[o(743)]||"";continue;case"2":this[o(774)]=n&&n.wasClean||!1;continue;case"3":this[o(909)+"nnect"]=n&&n[o(909)+o(458)]||!1;continue;case"4":super(t);continue}break}}}class _s extends ot{constructor(t,n){let o=r;super(t),this[o(1355)]=n&&n[o(1355)]||null}}class ys extends _s{constructor(t,n){let o=r;super(t),this[o(1355)]=n&&n[o(1355)]||null,this.message=n&&n[o(965)]||null}}class bs extends ot{constructor(t,n){let o=r;super(t),this[o(1355)]=n&&n.data||null}}function le(s,{message:t,code:n,error:o}){return new ms(s,{message:t,code:n,error:o})}function me(s,{code:t,reason:n,wasClean:o,willReconnect:x}){return new ws(s,{code:t,reason:n,wasClean:o,willReconnect:x})}function vs(s,{data:t,message:n}){return new ys(s,{data:t,message:n})}function Ss(s,{data:t}){return new bs(s,{data:t})}function cr(s,{message:t}){return new ps(s,{message:t})}class Es{constructor(t,n){let o=r;e[o(1064)](e[o(1360)],e[o(1188)])?this[o(253)](_0x290f3a,_0x1c1004):(this[o(507)+"s"]=t,this.maxRetries=n,this["currentI"+o(429)]=0,this[o(480)+o(344)+o(1380)+"t"]=0)}["resetEnd"+r(1095)+"fig"](){let t=r;if(e.ljrUx(e[t(805)],t(1605)))this[t(337)+t(429)]=0,this[t(480)+"ndpointT"+t(1380)+"t"]=0;else{let n=e[t(882)].split("|"),o=0;for(;;){switch(n[o++]){case"0":this._isInit=!0;continue;case"1":this[t(868)+t(734)]?.[t(1069)+t(1341)]();continue;case"2":this["_endpoin"+t(714)]?.[t(1384)+t(1095)+"fig"]();continue;case"3":this[t(1054)]();continue;case"4":this._readyClosed=!1;continue}break}}}[r(612)+"es"](){let t=r;this[t(480)+t(344)+t(1380)+"t"]=0}[r(657)+r(511)+"nt"](){return this[r(507)+"s"][this.currentIndex]}["getCurre"+r(511)+r(632)+r(1310)](){let t=r;return this[t(480)+t(344)+t(1380)+"t"]}[r(1279)+"chMaxTries"](){let t=r;return!!(e[t(817)](this[t(337)+t(429)],this[t(507)+"s"][t(836)])||this[t(337)+t(429)]===e[t(346)](this.endpoints[t(836)],1)&&e[t(988)](this["currentE"+t(344)+t(1380)+"t"],this[t(1617)+"es"]))}[r(1381)+r(898)+r(1211)+r(487)+r(694)](){let t=r;return this[t(337)+t(429)]==this.endpoints[t(836)]?!0:e[t(585)](this[t(480)+"ndpointTriesCount"],this[t(1617)+"es"])}[r(897)+r(366)+r(387)+r(229)+r(1313)](){let t=r;return this["currentE"+t(344)+t(1380)+"t"]=1,this[t(337)+t(429)]++,this.endpoints[this["currentI"+t(429)]]}["getCurrentEndpointAndUpd"+r(368)](){let t=r;if(e[t(338)](e[t(1461)],e[t(1461)]))return this["currentE"+t(344)+"riesCount"]++,this[t(657)+"ntEndpoint"]();if(WjnquI[t(1602)](_0x6be0c9,WjnquI[t(1171)]))return _0x4c983a[t(935)](_0x288c1d);if(WjnquI[t(969)](_0x122bac,WjnquI.LHpab))return _0x546a9b[t(1292)+t(204)]||_0x5f0445.get(_0x448273);if(WjnquI[t(750)](_0x365217,t(1583)))return _0x55a3a8[t(1292)+t(204)][1]?void 0:_0x5772f1[t(1292)+t(345)](_0x2b6908[t(1292)+t(204)][0])}}let at=(e[r(675)]("undefined",typeof globalThis)&&e[r(750)](e[r(527)],globalThis.constructor[r(919)])||e[r(1487)]!=typeof window&&e[r(906)](e.YBKUP,window[r(1389)+r(674)][r(919)]))&&e[r(1515)](r(441)+"d",typeof document),Xe=e.gEAxi!=typeof globalThis&&(e[r(1287)]===globalThis[r(1389)+r(674)][r(919)]||e.idLvF===globalThis[r(1389)+r(674)][r(919)])&&e[r(1487)]!=typeof tt,At=(e[r(799)](e[r(1487)],typeof globalThis)&&e.KswYE===globalThis["construc"+r(674)][r(919)]||r(441)+"d"==typeof globalThis||e.YGSsM(e.gEAxi,typeof globalThis)&&!!globalThis[r(979)+r(1144)])&&e.grgbz(r(441)+"d",typeof wx),Pt=e[r(688)](e[r(1487)],typeof globalThis)&&(e[r(601)](e[r(1157)],globalThis[r(1389)+r(674)][r(919)])||e.MwAJi(r(1430)+"rkerGlob"+r(1493),globalThis[r(1389)+r(674)].name)||e[r(1591)]===globalThis[r(1389)+r(674)][r(919)])&&e[r(1401)]("undefined",typeof self),ma=e[r(992)](e.gEAxi,typeof globalThis)&&e.ITwwy(e[r(1287)],globalThis[r(1389)+r(674)][r(919)])&&e[r(1487)]!=typeof global&&e[r(665)](e[r(1287)],global["construc"+r(674)][r(919)])&&e[r(1487)]!=typeof process&&!!process[r(1221)];class xr{constructor(){this._listeners={}}[r(759)](t,...n){let o=r,x=this[o(479)+"rs"][t];if(x)x[o(258)]().forEach(l=>l.fn.apply(l[o(1159)],n));else if(e.xdmpf===t&&!this[o(1018)]){let l=n[o(836)]&&n[0];if(e[o(1432)](l,Error))throw l;let g=new Error(e[o(986)](e[o(982)],l?e.vGPKY(e[o(1539)](" (",l[o(965)]),")"):""));throw g[o(534)]=l,l}return this}off(t,n){let o=r;if(t===void 0)this._listeners={};else if(e[o(219)](void 0,n))this._listeners[t]=null;else{let x=this[o(479)+"rs"][t];if(x)for(let l=0;e.AEUtH(l,x[o(836)]);)e.iIWvI(x[l].fn,n)?x.splice(l,1):++l}return this}on(t,n,o){let x=r;return(this._listeners[t]||(this[x(479)+"rs"][t]=[])).push({fn:n,ctx:o||this}),this}}class wa extends xr{[r(702)+r(721)+r(302)](t){let n=r;return t[n(291)]||t[n(1096)]?("message: "+(t[n(291)]||"")+n(1254)+(t.errNo||""))[n(192)]():JSON[n(816)+"y"](t)}constructor(t,n,o){let x=r;super(),this._socket=null,At&&wx.connectSocket&&(this._socket=wx[x(1197)+x(566)]({url:t,protocols:n,header:o,fail:this[x(618)+x(1177)+"lHandler"][x(1408)](this),success:this[x(618)+x(259)+"cessHandler"][x(1408)](this)})),Xe&&tt[x(1197)+x(566)]&&(this[x(1034)]=tt[x(1197)+x(566)]({url:t,protocols:n,header:o,fail:this[x(618)+x(1177)+"lHandler"][x(1408)](this),success:this["_createS"+x(259)+x(1220)+"ler"][x(1408)](this)}))}[r(618)+"ocketSuc"+r(1220)+r(1578)](){let t=r;Promise[t(1020)]()[t(1556)](()=>{let n=t;this[n(247)+n(501)]()})}["_createSocketFai"+r(227)](t){let n=r;Promise[n(1020)]()[n(1556)](()=>{let o=n,x=e[o(239)](le,e[o(720)],{message:this[o(702)+o(721)+"age"](t)});this.emit(e[o(720)],x);let l=e[o(934)](me,"close",{reason:this[o(702)+o(721)+o(302)](t)});this[o(759)](o(1223),l)})}[r(247)+r(501)](){let t=r;this[t(1034)].onOpen(n=>{let o=t;this[o(759)](e[o(1058)],e[o(481)](Ss,o(1259),{...n,data:n.errMsg||""}))}),this._socket[t(682)](n=>{let o=t;this[o(759)](e[o(1540)],e[o(608)](me,e[o(1540)],{...n}))}),this._socket[t(839)+"e"](n=>{let o=t;this[o(759)](e.NEjiL,e[o(1565)](vs,e[o(990)],{...n}))}),this._socket.onError(n=>{let o=t;this[o(759)](e[o(720)],le(e.xdmpf,{...n,message:n[o(291)]||""}))})}[r(537)](t){let n=r,o={FEINR:function(x,l){return x==l},ESyfD:function(x,l){return e[D(408)](x,l)}};if(e[n(1607)](e[n(1086)],"AKMUu"))if(e[n(775)](t,Uint8Array)){let x=t[n(1071)][n(258)](t[n(1163)+"et"],e[n(619)](t.byteLength,t[n(1163)+"et"]));this[n(1034)]&&this[n(1034)][n(537)]({data:x,fail:l=>{let g=n;if(e[g(1168)](e[g(838)],e[g(838)]))return _0x470ef6[g(291)]||_0x5a29fa[g(1096)]?(g(1598)+" "+(_0x4414eb[g(291)]||"")+g(1254)+(_0xa6efed[g(1096)]||"")).trim():_0x119885.stringify(_0x305a39);this[g(759)](e[g(720)],e[g(608)](le,e[g(720)],{message:this[g(702)+"rrorMess"+g(302)](l)}))}})}else this[n(1034)]&&this._socket.send({data:t,fail:x=>{let l=n;e[l(963)](e.aMpVX,e[l(797)])?this.on(_0x3194d8,_0x4cbc46):this.emit(l(1127),e[l(1285)](le,e[l(720)],{message:this[l(702)+l(721)+l(302)](x)}))}});else return iiPNMi[n(1078)](this["currentI"+n(429)],this[n(507)+"s"][n(836)])?!0:iiPNMi.ESyfD(this[n(480)+n(344)+n(1380)+"t"],this[n(1617)+"es"])}[r(1223)](t,n){let o=r;this[o(1034)]&&this[o(1034)][o(1223)]({code:t,reason:n})}[r(426)+"Listener"](t,n){this.on(t,n)}["removeEventListe"+r(893)](t,n){let o=r;if(e[o(518)](e[o(847)],e.gcMoG))this[o(253)](t,n);else return{frameType:_0x5909be,headers:[{key:e.GaNpk,value:e[o(784)]}],payload:void 0}}get[r(272)+"te"](){return this[r(1034)].readyState}get[r(809)+"pe"](){let t=r;return this[t(1034)][t(809)+"pe"]}set[r(809)+"pe"](t){}get url(){return this[r(1034)].url}get[r(420)](){let t=r;return this._socket[t(420)]}get[r(1528)+"ns"](){let t=r;return this[t(1034)][t(1528)+"ns"]}get[r(801)+r(1410)](){return 0}}function _a(s,t){let n=r;if(t)return new t(s[n(188)],s[n(420)]);if(e[n(1535)](At,Xe))return new wa(s[n(188)],s[n(420)],s[n(1457)]);if(e[n(1535)](at,Pt)&&e[n(1487)]!=typeof WebSocket&&WebSocket)return new WebSocket(s.url,s[n(420)+"s"])}function ya(s){let t=r,n=e[t(733)].split("|"),o=0;for(;;){switch(n[o++]){case"0":if(At&&wx[t(1197)+t(566)])return!0;continue;case"1":if(s)return!0;continue;case"2":if(Xe&&tt[t(1197)+t(566)])return!0;continue;case"3":if(e[t(923)](at,Pt)&&e.YabXI(e.gEAxi,typeof WebSocket)&&WebSocket)return!0;continue;case"4":return!1}break}}function Cs(s,t,n){let o=-1;async function x(l){let g=D;return e[g(705)](l,o)?Promise[g(516)](new Error(e[g(617)])):(o=l,l===n[g(836)]?Promise[g(1020)]():n[l].bind(s)(t,x[g(1408)](null,e.WFere(l,1))))}e.CGRCj(x,0)}function As(s){let t=r,n=0,o=0;for(let x=0;e[t(825)](x,s[t(836)]);++x)o=s[t(1227)+"At"](x),e[t(668)](o,128)?n+=1:o<2048?n+=2:e.GeIIw(e[t(1162)](64512,o),55296)&&e[t(1002)](e[t(1070)](64512,s[t(1227)+"At"](x+1)),56320)?(++x,n+=4):n+=3;return n}function Ps(s,t,n){let o=r;if(e[o(1006)](n,t)<1)return"";let x="";for(let l=t;e[o(1557)](l,n);){let g=s[l++];if(g<=127)x+=String[o(1385)+o(887)](g);else if(e[o(947)](g,192)&&e[o(335)](g,224))x+=String[o(1385)+o(887)](e[o(746)](e[o(788)](31&g,6),e.esPsm(63,s[l++])));else if(e[o(1052)](g,224)&&e[o(335)](g,240))x+=String[o(1385)+o(887)](e[o(871)](e.OijsM(e[o(1156)](15,g)<<12,e[o(348)](63,s[l++])<<6),e[o(1253)](63,s[l++])));else if(g>=240){let p=e[o(378)](e[o(495)](e[o(871)](e.rLHpi(e[o(334)](7,g),18)|e[o(831)](e[o(956)](63,s[l++]),12),e[o(1049)](e[o(821)](63,s[l++]),6)),e[o(1477)](63,s[l++])),65536);x+=String[o(1385)+o(887)](e.SrFmX(55296,e[o(687)](p,10))),x+=String[o(1385)+o(887)](e.MhGNu(56320,e[o(654)](1023,p)))}}return x}function ur(s,t,n){let o=r,x={uaTaB:e[o(1529)]};if(e.yDCcw(e[o(998)],o(347)))this[o(951)]&&this[o(951)][o(537)](_0x1a67dd),this[o(206)](x.uaTaB,_0x253473);else{let l=n,g,p;for(let f=0;e[o(1101)](f,s.length);++f)if(g=s[o(1227)+"At"](f),e[o(701)](g,128))t[n++]=g;else if(e[o(668)](g,2048))t[n++]=e[o(746)](e[o(564)](g,6),192),t[n++]=e[o(970)](63&g,128);else if(e[o(942)](e[o(1219)](64512,g),55296)&&e[o(1566)](64512&(p=s[o(1227)+"At"](f+1)),56320))if(e[o(782)](e[o(515)],e[o(552)])){let b=e.suFJk[o(1357)]("|"),v=0;for(;;){switch(b[v++]){case"0":++f;continue;case"1":t[n++]=e[o(1085)](g>>18,240);continue;case"2":t[n++]=e.hRmOO(e[o(564)](g,12),63)|128;continue;case"3":t[n++]=e[o(1169)](e[o(1377)](e.yBDnF(g,6),63),128);continue;case"4":t[n++]=e[o(1542)](63&g,128);continue;case"5":g=e.LbkvR(e.sHCUG(65536,e[o(278)](e[o(1377)](1023,g),10)),e[o(357)](1023,p));continue}break}}else return e.grgbz(o(751),typeof _0x1691b5)&&(_0x5b037d instanceof _0x2644e4||_0x4f113f.buffer&&e[o(775)](_0x237106[o(1071)],_0x1b9d5e))||e[o(1515)](e[o(541)],typeof _0x5f3c34)?"":(_0x22c6e9[o(1512)](_0x2082ea),e[o(655)]);else t[n++]=e[o(1169)](g>>12,224),t[n++]=e[o(320)](e.AXxEl(g>>6,63),128),t[n++]=e[o(1161)](63,g)|128;return n-l}}async function ks(s){let t=r;if(e.CCmWI==typeof s){let n=new Uint8Array(e.ZqiIR(As,s));return e[t(452)](ur,s,n,0),n}return s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s[t(1071)],s.byteOffset,s[t(762)+"th"])}function ba(s){let t=r;try{return e[t(435)](t(751),typeof s)&&(e.oZFIg(s,ArrayBuffer)||s[t(1071)]&&e[t(883)](s[t(1071)],ArrayBuffer))||e[t(992)](e.CCmWI,typeof s)?"":(JSON[t(1512)](s),e[t(655)])}catch{return e[t(541)]==typeof s?e.KVMhm:""}}let va=(s,t)=>{let n=r;switch(s){case e.xuPVH:case n(1491):return{["x-use-"+s]:1,"x-tt-env":t};default:return{}}};class Sa{constructor(t){let n=r;if(e[n(1436)](e.OMuNx,e[n(1281)]))this[n(211)+"ount"]=t,this[n(678)]=0;else{this[n(305)+"WebSocket"]();let o=_0x5d62f1("reconnect",{message:e[n(776)]});this[n(331)+n(215)+n(424)+"ct"]&&this[n(331)+"mediatel"+n(424)+"ct"](o)}}[r(1518)](){let t=r;this[t(678)]++}["checkRea"+r(251)+"nt"](){let t=r;return this.count>=this[t(211)+t(1310)]}[r(1069)+"nter"](t=0){this.maxLossCount=t,this.count=0}}async function Ea(s){let t={ksUTz:function(n,o){return e[D(1555)](n,o)}};return new Promise(n=>{let o=D;if(!at)return e[o(1581)](n,e.sdGaG);try{let x=document[o(1232)+o(672)](e[o(730)]);window[o(506)+o(562)]=l=>{let g=o;document[g(297)][g(1112)+g(975)](x),window["frontier"+g(562)]=void 0,t[g(641)](n,l&&l.msg||"unknown "+g(743))},x[o(317)]=e[o(260)],x[o(514)]=e.grMIv(s[o(1399)](/^ws/,e.ymgei),"&jscallb"+o(461)+o(756)+"P");try{if(e.snEQx(e[o(863)],e.AmstE)){this[o(1456)+o(240)](),this._pingPongTimeoutId=_0xe94204(this._ping[o(1408)](this),this._options[o(1251)+o(1055)]);return}else document[o(297)]["appendCh"+o(975)](x)}catch{document[o(297)][o(1112)+"ild"](x)}}catch{window["frontier"+o(562)]=void 0,e[o(214)](n,e.sdGaG)}})}function Ge(s,t,n){let o=r;if(e.GzQvo!==o(280))return!!s?.[o(783)](x=>x[o(275)]===t&&x[o(1403)]===n);_0x8e967[o(1409)](_0x5bed20)}function ct(s,t){let n=r;return s?.[n(783)](o=>o[n(275)]===t)?.[n(1403)]}let dr=null;async function Ca(){let s=r,t={UndaZ:function(n,o,x){return e[D(1340)](n,o,x)},etsLo:s(1223)};if(s(1347)!==e[s(504)])return dr||(dr=Promise[s(1020)]().then(Ce[s(1408)](Ce,e[s(468)]))),dr;{let n=_0x12d1f6(s(1127),{message:this[s(702)+s(721)+s(302)](_0x3e510f)});this[s(759)]("error",n);let o=xOvZYA[s(1176)](_0x40fba4,xOvZYA[s(282)],{reason:this[s(702)+s(721)+s(302)](_0x36a03b)});this[s(759)](xOvZYA[s(282)],o)}}class Aa extends xr{constructor(t,n){let o=r;super(),this[o(804)]=t,this[o(1343)]=n,this[o(716)]=void 0,this[o(1507)+o(535)]=null}async openDB(){await this[r(624)]()}async[r(624)](){let t=r,n={fjuxe:function(o,x,l,g){return e[D(256)](o,x,l,g)},Mqbuu:e.IjqPk,jZAUl:e[t(720)]};if(!this._qosDB){if(this["_initPro"+t(535)])return this[t(1507)+t(535)];try{let o=this[t(804)],x=this[t(1343)];this[t(1507)+t(535)]=(async()=>{let l=t,{openDB:g}=await Ca();this[l(716)]=await n[l(1091)](g,l(506)+"_"+o,1,{upgrade(p){p[l(1506)+"jectStore"](o,{keyPath:x})}})})(),await this["_initPro"+t(535)]}catch(o){e[t(841)](t(1582),e[t(517)])?console[t(1409)](o):(_0x414022[t(1368)+"entListe"+t(893)](XnXpDf[t(1272)],_0x1a7272),_0xb5d63[t(1368)+t(1133)+"ner"](XnXpDf[t(422)],_0x5639e1))}finally{this[t(1507)+t(535)]=null}}}async[r(935)](t){let n=r;try{return await this[n(624)](),this[n(716)]?.[n(935)](this[n(804)],t)}catch(o){console[n(1409)](o)}}async set(t,n){let o=r,x={dfNhr:function(l,g){return e.yPRrr(l,g)}};if(e[o(942)](e.oOrcV,e[o(1111)])){let l=this[o(716)][o(679)](this._prefix);return _0x589d68[o(1512)](x[o(692)](l,"{}"))[_0x282428]}else return await this._init(),this[o(716)]?.[o(460)](this[o(804)],t)}async[r(660)](t){let n=r;try{return await this[n(624)](),this._qosDB?.delete(this[n(804)],t)}catch(o){console[n(1409)](o)}}async[r(1589)](){let t=r;try{return await this[t(624)](),this._qosDB?.[t(1589)](this[t(804)])}catch(n){console[t(1409)](n)}}async[r(1460)](){let t=r;if(e[t(1421)](e.mFcxp,t(431)))return await this._init(),this[t(716)]?.[t(1263)+"ys"](this[t(804)]);{let{offset:n}=e[t(886)](_0x303f9a,_0x94bbc9,_0x1bf061);_0x4a68d0=n;let o={cursor_name:"",cursor:0,service:0},{value:x,offset:l}=e.OYEmW(_0x334a75,_0x589505,_0x144984);o.service=x,_0x490dc7=l;let{value:g,offset:p}=e[t(362)](_0x3c1b5a,_0x57c695,_0xb00c16);_0x20d1ec=p,o[t(316)+t(1395)]=e[t(856)](_0x36e031,_0x8deb09,_0x20ad3c,e.ltijy(_0xa97060,g)),_0x2a512d+=g;let{value:f,offset:b}=e.dCMFY(_0x5825c8,_0x24b759,_0x56ca6d);o[t(606)]=f.toNumber(),_0x5856d3=b,_0x2320d2[t(547)](o)}}async[r(210)](){let t=r;return await this._init(),this[t(716)]?.[t(210)](this._dbName)}async[r(1198)](){let t=r,n={buyhf:function(o,x){return e.ljrUx(o,x)},tfreG:function(o,x){return e[D(1533)](o,x)},urPRS:e.RWGet,Suwtt:e[t(328)]};try{e.yFUrY(e[t(1463)],e.onfme)?(this[t(716)]?.[t(1223)](),this[t(716)]=void 0):_0x569d77.persisted&&(this["_navigat"+t(1544)]()&&(!this._ws||n[t(1419)](this[t(951)].readyState,this[t(375)])||n[t(474)](this._ws[t(272)+"te"],this[t(425)+"NG"]))&&this[t(536)+t(370)](),this[t(819)+"er"]&&_0xfbf8a0["addEvent"+t(1037)](n[t(748)],this[t(536)+t(370)]),this[t(819)+"er"]&&_0x25ecf2[t(426)+"Listener"](n[t(798)],this[t(536)+t(974)]))}catch(o){console[t(1409)](o)}}get[r(1224)](){let t=r;try{return!!this[t(716)]}catch(n){return console[t(1409)](n),!1}}}class Pa{constructor(t,n){let o=r;this[o(929)]=t,this._pathKey=n,this._qosDB=localStorage}async openDB(){}get[r(1216)](){let t=r,n={VvDgt:function(o,x,l){return e[D(362)](o,x,l)},vfZBo:function(o,x,l){return o(x,l)},wGTvI:function(o,x){return e[D(551)](o,x)}};if(e[t(1339)]!==e[t(1492)])return t(506)+"_"+this[t(929)];XdxPWh[t(1319)](_0x1239bc,_0x158b58,96),XdxPWh[t(434)](_0x435ff6,_0x242c4d,XdxPWh.wGTvI(_0x25859c,_0x3b2d4e))}async[r(935)](t){let n=r,o={mXEbH:function(x,l){return e[D(767)](x,l)},oJiyT:function(x,l){return e.xNmNL(x,l)}};{let x=this[n(716)].getItem(this[n(1216)]);return JSON[n(1512)](x||"{}")[t]}}async[r(396)](t,n){let o=r,x=this[o(716)].getItem(this[o(1216)]),l=JSON.parse(e.VixQF(x,"{}"));return l[n||t[this[o(220)]]]=t,this[o(716)][o(1459)](this[o(1216)],JSON[o(816)+"y"](l)),n||t[this._pathKey]}async[r(660)](t){let n=r;if(e[n(1577)]===e[n(263)])return this._ws?this._ws[n(420)]:"";{let o=this[n(716)].getItem(this[n(1216)]),x=JSON[n(1512)](e[n(923)](o,"{}"));return x[t]=void 0,this[n(716)].setItem(this[n(1216)],JSON[n(816)+"y"](x))}}async[r(1589)](){let t=r;return this[t(716)][t(1589)]()}async[r(1460)](){let t=r,n=this._qosDB[t(679)](this[t(1216)]),o=JSON[t(1512)](e[t(449)](n,"{}"));return Object[t(1460)](o)}async[r(210)](){let t=r;if(e[t(638)](e.mToTK,e[t(332)])){let x="3|2|1|0|4"[t(1357)]("|"),l=0;for(;;){switch(x[l++]){case"0":_0x5d2fbb[_0x2e3e73](n,n.exports,_0x7c2a5b);continue;case"1":var n=_0x3a33c1[_0x4beecc]={exports:{}};continue;case"2":if(WjnquI[t(195)](void 0,o))return o[t(208)];continue;case"3":var o=_0x15ac21[_0x1c3d16];continue;case"4":return n[t(208)]}break}}else{let x=this[t(716)][t(679)](this[t(1216)]),l=JSON.parse(e[t(1535)](x,"{}"));return Object[t(573)](l)}}[r(1198)](){let t=r;return t(553)===e[t(1067)]?new _0x364a57(_0x57f6d5,{code:_0x6916dc,reason:_0x3531dd,wasClean:_0x1eba26,willReconnect:_0x2ee9be}):Promise[t(1020)]()}get[r(1224)](){return!!this[r(716)]}}class ka{constructor(t,n){let o=r;this[o(929)]=t,this[o(220)]=n,this[o(716)]=Xe?tt:At?wx:null}async[r(995)](){}get[r(1216)](){return r(506)+"_"+this._DBName}async[r(935)](t){let n=r,o=this[n(716)][n(1304)+n(371)](this._prefix);return JSON.parse(e.wNAWI(o,"{}"))[t]}async[r(396)](t,n){let o=r,x=this[o(716)]["getStora"+o(371)](this._prefix),l=JSON[o(1512)](e[o(1535)](x,"{}"));return l[n||t[this[o(220)]]]=t,this[o(716)][o(407)+o(371)](this._prefix,JSON[o(816)+"y"](l)),n||t[this[o(220)]]}async[r(660)](t){let n=r,o=this._qosDB[n(1304)+n(371)](this[n(1216)]),x=JSON[n(1512)](e[n(1490)](o,"{}"));return x[t]=void 0,this[n(716)]["setStora"+n(371)](this._prefix,JSON.stringify(x))}async clear(){let t=r;if(e[t(841)](t(301),e[t(1218)]))return this[t(716)][t(1260)+t(1440)]();_0x195b68[t(396)](_0xf2e04d,_0x2f00fe)}async[r(1460)](){let t=r,n=this[t(716)][t(1304)+t(1016)+"nc"](this[t(1216)]),o=JSON.parse(e.IbgQY(n,"{}"));return Object[t(1460)](o)}async getAll(){let t=r,n=this[t(716)][t(1304)+t(1016)+"nc"](this._prefix),o=JSON[t(1512)](e[t(1209)](n,"{}"));return Object[t(573)](o)}[r(1198)](){let t=r;if(e[t(628)]===e[t(315)])_0x4b2dfb=_0x11ba49[t(1499)](_0x460006),_0x1d8b4d=_0x138318[t(1499)](_0x3211e8[_0xd9dcc9]);else return Promise[t(1020)]()}get[r(1224)](){return!!this._qosDB}}function Ds(s,t){let n=r;if(e[n(1073)](Xe,Xe))return new ka(s,t);if((at||Pt)&&e.bAMNP("undefined",typeof indexedDB))return new Aa(s,t);if(e[n(1490)](at,Pt)&&e[n(358)](e.gEAxi,typeof localStorage))return new Pa(s,t);throw new Error("init QoSDB failed")}class Da{constructor(){let t=r;this[t(874)+t(921)+"Id"]=null,this[t(874)+"l"]=36e5,this[t(716)]=e[t(1476)](Ds,e[t(712)],"message_id")}async[r(874)+r(1119)](){let t=r;e.vcvHN(clearInterval,this._intervalTimeoutId),this["_interva"+t(921)+"Id"]=e.qiQmJ(setInterval,()=>{let n=t;this[n(905)+n(576)]()},this[t(874)+"l"])}async[r(995)](){let t=r;await this[t(716)][t(995)]().then(()=>{let n=t;this[n(874)+n(1119)]()})}async flushExpired(){let t=r,n={vLELL:function(o,x){return e[D(1295)](o,x)},SjSQA:function(o,x){return o(x)},QefgP:function(o,x,l){return e.flqXl(o,x,l)}};if(t(1231)!==e[t(1063)])return zbETFi.vLELL(zbETFi[t(1504)](_0x57d385,4)[t(760)]("0"),zbETFi.QefgP(_0x4aba83,_0x5104bc,2)[t(187)](16))[t(258)](-4);(await this[t(716)]?.[t(210)]()||[]).filter(({timestamp:l})=>l<Date.now())[t(1248)](l=>{let g=t;this._qosDB?.del(l[g(658)+"id"])})}async del(t){return this[r(716)]?.del(t)}async[r(396)](t,n){let o=r;if(e[o(205)]===o(464))return this._qosDB?.[o(396)]({message_id:t,timestamp:n});{let x=_0x5a0b54[o(1227)+"At"](_0x22cbca);x>=55296&&x<=56319&&_0x2dc755+1<_0x4d2f78&&(x=e[o(592)]((x<<10)+_0x55dfdd[o(1227)+"At"](++_0x42c0fc),56613888)),e[o(335)](x,128)?_0x235be6[_0x5d2def++]=x:(e[o(1101)](x,2048)?_0x30da6c[_0x6a83ce++]=e.yQoCa(e[o(564)](x,6)&31,192):(e.PdjEn(x,65536)?_0x3f01c6[_0x368c35++]=e[o(907)](e[o(1162)](e[o(687)](x,12),15),224):(_0x13804d[_0xa14956++]=e[o(320)](e[o(1383)](e[o(564)](x,18),7),240),_0x2bd884[_0x3116f1++]=e[o(746)](e.pcRMr(e[o(564)](x,12),63),128)),_0x494a9a[_0x4c3e1e++]=e[o(843)](e[o(1307)](e[o(687)](x,6),63),128)),_0x8fef66[_0x3f625f++]=e[o(832)](e[o(1161)](63,x),128))}}async[r(935)](t){let n=r;return this[n(716)]?.[n(935)](t)}async[r(1198)](){let t=r;e[t(551)](clearInterval,this[t(874)+t(921)+"Id"]),await this[t(716)]?.[t(1198)]()}get isReady(){let t=r;return this._qosDB?.[t(1224)]}}function fr(s){let t=r,n=!!this._options.enableQoS;if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e.gAdcG(Ge,s.message[t(1457)],e[t(635)],"2"),x=o&&e[t(546)](Ge,s.message[t(1457)],e.XqUWl,"1"),l=o&&e[t(577)](Ge,s[t(965)].headers,t(1382)+t(1099)+"k","1"),g=l?e.ZoOno(ct,s.message[t(1457)],e[t(1114)])?.[t(1357)](",").filter(Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:x,isAckCleanupMessage:l,ackMsgIds:g}}async function Is(){let s=r;return e[s(300)]!==e[s(300)]?e[s(484)](_0x6b7a05,e[s(193)](_0x118b40,_0x4c575a)):(this[s(409)+s(686)]||(this[s(409)+"ger"]=new Da),this[s(409)+"ger"][s(1224)]||await this[s(409)+s(686)].openDB(),this[s(409)+s(686)])}async function Ia(s,t){let n=r,{enableAutoAck:o}=this[n(1296)],x=e[n(1522)](Ge,s[n(965)][n(1457)],e[n(604)],"1"),l=e[n(1604)](Ge,s[n(965)][n(1457)],e[n(643)],"1"),g=fr[n(812)](this,s);if(e[n(1521)](o,x)){let{SeqID:p,LogID:f,service:b,LogIDNew:v,method:C}=s.message;this[n(1509)]({SeqID:p,LogID:f,LogIDNew:v,service:b,method:C,headers:[{key:e[n(643)],value:"1"},{key:e[n(1345)],value:e.JkbOf(v,"")},{key:n(418),value:"0"}]})}l&&!g[n(1120)]&&this[n(1138)+n(1201)+n(626)](s),e[n(364)](t)}async function Ta(s,t){let n=r;this._debug(e[n(1616)],s[n(965)]),t()}async function Ra(s,t){let n=r,o={LfQkk:function(x,l){return e[D(902)](x,l)},kHflr:e[n(1011)],DOdby:e[n(655)],aefia:"none_none",xQtpr:function(x,l,g,p){return e[n(452)](x,l,g,p)},WPaXo:function(x,l){return e.cOqKa(x,l)}};if(e[n(548)]("DqlOq",e[n(1027)])){let x=o[n(1441)](this._options[n(731)+n(859)],_0x3b36b0)?{force:!!this[n(1296)][n(731)+n(859)][n(250)],encoding:this._options[n(731)+n(859)].encoding?this[n(1296)][n(731)+n(859)][n(1373)][n(1399)](/\s/g,"")["toLowerC"+n(1405)]():""}:{force:!1,encoding:this[n(1296)][n(731)+n(859)]?this[n(1296)]["payloadE"+n(859)][n(1399)](/\s/g,"")[n(1369)+n(1405)]():""},l=_0x5b8894.payloadEncoding?_0x2d1d57["payloadE"+n(859)][n(1399)](/\s/g,"")[n(1369)+"ase"]():"",g=o[n(1441)](this[n(1296)]["payloadT"+n(1164)],_0x54ab97)?{force:!!this[n(1296)]["payloadT"+n(1164)][n(250)],type:this._options[n(1392)+n(1164)].type?this[n(1296)][n(1392)+n(1164)][n(317)][n(1399)](/\s/g,"").toLowerCase():""}:{force:!1,type:this[n(1296)][n(1392)+n(1164)]?this[n(1296)][n(1392)+"ype"][n(1399)](/\s/g,"")[n(1369)+"ase"]():""},p=_0x12acbd[n(1392)+n(1164)]?_0x163618[n(1392)+n(1164)][n(1399)](/\s/g,"")[n(1369)+"ase"]():"",f=g[n(250)]?g[n(317)]:p||g.type,b=x[n(250)]?x.encoding:l||x[n(1373)],v=[o[n(557)],o.DOdby,n(770)+"ion/json"+n(440)+n(1005),"string"],C=[o.aefia,"binary"];this[n(1296)][n(1468)+"ansformT"+n(950)+"ad"]&&v.includes(f)&&(!b||C[n(540)](b))?_0x1c96a9[n(1423)+n(400)]=o[n(600)](_0x2a69cf,_0x1ba97b[n(1192)],0,_0x1293b0.payload[n(762)+"th"]):_0x49c29d[n(1423)+n(400)]=""}else{let x=ds(await ks(s[n(1355)]));try{if(x[n(1192)]instanceof Uint8Array)if(e[n(406)](e[n(1337)],e.KlAsr)){let l=this[n(1296)][n(731)+n(859)]instanceof Object?{force:!!this[n(1296)]["payloadE"+n(859)][n(250)],encoding:this[n(1296)][n(731)+"ncoding"][n(1373)]?this[n(1296)][n(731)+n(859)][n(1373)][n(1399)](/\s/g,"")["toLowerC"+n(1405)]():""}:{force:!1,encoding:this[n(1296)][n(731)+n(859)]?this[n(1296)][n(731)+n(859)][n(1399)](/\s/g,"")[n(1369)+n(1405)]():""},g=x[n(731)+n(859)]?x[n(731)+n(859)][n(1399)](/\s/g,"")[n(1369)+"ase"]():"",p=e[n(1012)](this._options[n(1392)+"ype"],Object)?{force:!!this._options[n(1392)+n(1164)][n(250)],type:this._options[n(1392)+"ype"][n(317)]?this[n(1296)]["payloadT"+n(1164)][n(317)].replace(/\s/g,"")["toLowerC"+n(1405)]():""}:{force:!1,type:this._options.payloadType?this[n(1296)][n(1392)+n(1164)].replace(/\s/g,"")[n(1369)+n(1405)]():""},f=x.payloadType?x[n(1392)+n(1164)].replace(/\s/g,"").toLowerCase():"",b=p[n(250)]?p[n(317)]:f||p[n(317)],v=l[n(250)]?l[n(1373)]:g||l.encoding,C=["text/pla"+n(1479)+n(920),e[n(655)],e[n(1074)],e[n(541)]],I=[e[n(677)],n(603)];this._options[n(1468)+"ansformT"+n(950)+"ad"]&&C[n(540)](b)&&(!v||I[n(540)](v))?x[n(1423)+n(400)]=e[n(1249)](Ps,x.payload,0,x[n(1192)].byteLength):x[n(1423)+n(400)]=""}else{let l=_0x73bbf8[n(1603)+"g"](0,jzNfBk[n(787)](4,_0x4a9098[n(836)])),g=l[n(1499)](_0x18adc2);_0x59a4a1[n(547)](g)}else x[n(1423)+"oad"]=""}catch(l){x[n(1423)+n(400)]="",console[n(1409)](l)}s.message=x,t()}}function Na(s,t,n){let o=r,x=e.QRKuj(n,8192),l=e[o(1180)](x,1),g=null,p=x;return function(f){let b=o;if(e[b(1599)](f,1)||e[b(1051)](f,l))return e[b(1418)](s,f);e[b(231)](e[b(808)](p,f),x)&&(g=e[b(867)](s,x),p=0);let v=t[b(812)](g,p,p+=f);return 7&p&&(p=e[b(970)](7,p)+1),v}}let La=4294967295;function Oa(s,t,n){let o=r;if(e[o(236)](e.fsZLh,e.fsZLh)){if(e[o(541)]==typeof _0x2846c6){let x=new _0x4f52f0(_0x4d5199(_0x5550d3));return e.gAdcG(_0x6f0383,_0x19dc8e,x,0),x}return e.xhABy(_0x5844d5,_0x1c66e6)?new _0x432b9e(_0x2fb08f):new _0x43fee8(_0x5c4762[o(1071)],_0x32faa2.byteOffset,_0x113922.byteLength)}else return e[o(879)](RangeError,e[o(411)](e[o(1094)](e[o(1558)](e[o(1021)](e[o(594)],s)+e[o(584)],e.hyPBs(t,1)),o(1060)),n))}function Ba(s,t,n){let o=r;if(n>La)throw new Error(o(830)+"too large");let x=3;for(;x>=0;){let l=e[o(1128)](255,n);e[o(1309)](hr,l,s,e[o(1140)](t,x)),n>>>=8,x--}return e[o(308)](t,4)}function Ma(s,t){let n=r,o=0,x=t,l=t+4;for(;e[n(1039)](x,l);){let{value:g,offset:p}=e[n(578)](lr,s,x);x=p,o=e[n(242)](o,8)>>>0,o+=g}return{value:o,offset:l}}function za(s,t,n){let o=r,x=e.LhEiz[o(1357)]("|"),l=0;for(;;){switch(x[l++]){case"0":return e.OOnel(e[o(1502)](ur,s,t,n),n);case"1":if(e[o(233)](s.length,40))return e[o(876)](e[o(1283)](ur,s,t,n),n);continue;case"2":if(t[o(1230)])return e[o(385)](t.write(s,n),n);continue;case"3":if(t[o(244)+"e"])return e[o(340)](t[o(244)+"e"](s,n),n);continue;case"4":if(!s)return n;continue}break}}function qa(s,t){let n=r,o=new z(e.EKvhq(e.yQoCa(e[n(450)](s[e[n(1454)](t,4)],24)|e.ZKyjj(s[e[n(1124)](t,5)],16),s[e.kgVbb(t,6)]<<8),s[e.MscWo(t,7)]),e.xESbF(e[n(520)](e.AXUVN(s[e[n(1454)](t,0)],24),s[e.UlpKB(t,1)]<<16)|e[n(242)](s[t+2],8),s[e[n(736)](t,3)]),!0);return t+=8,{value:o,offset:e[n(283)](t,8)}}function Fa(s,t,n){let o=r,x=s[o(1239)],l=s[o(1028)];return t[n]=e[o(725)](l,24),t[e[o(385)](n,1)]=e[o(334)](l>>>16,255),t[e[o(1414)](n,2)]=e[o(1175)](e[o(718)](l,8),255),t[e[o(1558)](n,3)]=255&l,t[e[o(802)](n,4)]=e[o(664)](x,24),t[e[o(1059)](n,5)]=e[o(644)](e[o(1233)](x,16),255),t[e[o(478)](n,6)]=e[o(683)](e[o(1081)](x,8),255),t[n+7]=e[o(419)](255,x),n+=8,n}function lr(s,t){let n=r;return s[n(367)+"8"]?{value:s[n(367)+"8"](t),offset:t+1}:{value:e.lAMtm(255,s[t]),offset:e[n(299)](t,1)}}function hr(s,t,n){let o=r;return t[o(1344)+"t8"]?t.writeUint8(s,n):t[n]=e[o(735)](255,s),e.EnKEJ(n,1)}let Ua=function(s){let t=r;if(e[t(473)](e[t(1270)],e[t(1115)]))_0x503fbc[_0x2cf9e0++]=e[t(1611)](e[t(298)](_0x10c707,12),224),_0x10b418[_0x282c2f++]=e.gJbEK(e[t(1548)](_0x5f474b,6)&63,128),_0xbcac73[_0x37ce8f++]=e.RGSis(63&_0x3721cd,128);else return new Uint8Array(s)},Ga=e[r(675)](e[r(1487)],typeof Buffer)?Buffer[r(1422)+r(197)]:e[r(910)](Na,Ua,Uint8Array[r(912)+"e"][r(500)]);(()=>{let s=r,t={cALkB:function(n,o){return e[D(1503)](n,o)},WdjAB:function(n,o){return e[D(1110)](n,o)},sKoKt:function(n,o){return e.CyZZU(n,o)}};if(e[s(579)](e[s(1452)],e[s(1155)])){let n=4294967295;return function(o,x,l=!0){let g=s,p={QsStg:function(f,b){return e[D(631)](f,b)},waawD:function(f,b){return e[D(1302)](f,b)},KFDYW:e[g(328)]};if(n=e[g(310)](127,o[x])>>>0,o[x++]<128)return{value:l?n:0|n,offset:x};if(n=e.DRCCE(e.IsEHg(n,e[g(875)](127&o[x],7)),0),o[x++]<128)return{value:l?n:e.RGSis(0,n),offset:x};if(n=e[g(1233)](e[g(1464)](n,e[g(878)](e.UloIV(127,o[x]),14)),0),o[x++]<128)return{value:l?n:e[g(1563)](0,n),offset:x};if(n=e[g(967)](e.mtLCZ(n,e.SVBxF(e[g(644)](127,o[x]),21)),0),o[x++]<128)return{value:l?n:0|n,offset:x};if(n=e[g(1411)](n|e[g(696)](15,o[x])<<28,0),e[g(559)](o[x++],128))return{value:l?n:e[g(1525)](0,n),offset:x};if(e[g(585)](x+=5,o[g(836)])){if(e[g(1264)](e.ptPSG,e[g(1154)]))throw x=o[g(836)],e[g(1249)](Oa,x,10,o[g(836)]);this[g(903)+g(1544)]()&&(!this[g(951)]||p[g(284)](this[g(951)].readyState,this[g(375)])||p.waawD(this[g(951)][g(272)+"te"],this.CONNECTING))&&this._handleOnLine(),this[g(819)+"er"]&&_0xb013d8["addEvent"+g(1037)](g(288),this[g(536)+g(370)]),this._isBrowser&&_0x321b8f[g(426)+g(1037)](p.KFDYW,this[g(536)+"ffLine"])}return{value:l?n:0|n,offset:x}}}else _0x521413[_0x2ed277++]=PdAXUL[s(891)](_0x881dc3>>6,192),_0x551842[_0x2180e6++]=PdAXUL[s(268)](PdAXUL.sKoKt(63,_0x27b07f),128)})();let Ka=16,gr=32;function Ha(s){let t=r,n=0,o={};for(let x=0;e[t(417)](x,s[t(836)]);x++)o[s[x][t(316)+t(1395)]]=e.RWVrx(As,s[x][t(316)+t(1395)]),n+=e[t(1108)](14,o[s[x][t(316)+t(1395)]]);return[n,o]}function Ts(s,t,n){let o=r,x={gaCeS:e.TbXao,zTRcx:e.DEjkR,PVdQH:e.ROtCV,YWUNo:function(b,v,C,I){return e.bmFhL(b,v,C,I)},KWHAE:function(b,v,C,I){return e.UkPGV(b,v,C,I)},UzQVy:o(255),xtLvh:e[o(889)],RdDRE:"service-"+o(919)},[l,g]=e[o(747)](Ha,s),p=Ga(l),f=0;return s[o(1248)](b=>{let v=o,C=x.gaCeS[v(1357)]("|"),I=0;for(;;){switch(C[I++]){case"0":console[v(1409)](x.zTRcx,f);continue;case"1":console.log(x[v(1102)],b,b.service);continue;case"2":console.log(v(402),f);continue;case"3":f=x[v(1195)](hr,0,p,f);continue;case"4":f=x[v(1195)](hr,g[b[v(316)+v(1395)]],p,f);continue;case"5":f=Fa(z[v(1252)+"er"](b.cursor||t),p,f);continue;case"6":f=x[v(791)](za,b[v(316)+v(1395)],p,f);continue;case"7":console[v(1409)](x[v(978)],f);continue;case"8":console[v(1409)](x[v(1489)],f);continue;case"9":console[v(1409)](x[v(1148)],f);continue;case"10":f=x[v(1195)](Ba,p,f,b[v(255)]||0);continue}break}}),{frameType:gr,headers:[{key:o(818)+o(1206),value:n}],payload:p}}function ja(s){let t=r,n=0,o=[];for(;e.gOHHJ(n,s.byteLength);){let{offset:x}=e.XDlZY(lr,s,n);n=x;let l={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e.GUvKW(Ma,s,n);l[t(255)]=g,n=p;let{value:f,offset:b}=e[t(684)](lr,s,n);n=b,l.cursor_name=e[t(1437)](Ps,s,n,e[t(1100)](n,f)),n+=f;let{value:v,offset:C}=e[t(1359)](qa,s,n);l[t(606)]=v[t(1406)](),n=C,o[t(547)](l)}return o}function Wa(){let s=r;return{frameType:gr,headers:[{key:e.GaNpk,value:e[s(784)]}],payload:void 0}}class Ja{constructor(t,n,o){let x=r;e[x(201)](x(1484),e[x(379)])?e[x(1121)](_0x4da140,_0x29395f,this[x(685)+x(209)+"e"](_0x9ff9c4)):(this[x(1472)+x(1160)]=t,this._cursorFileName=n,this[x(341)+x(369)]=o,this[x(716)]=e[x(596)](Ds,this[x(1472)+x(1160)],"cursor_n"+x(1395)))}async openDB(){let t=r;await this[t(716)][t(995)]()}async[r(1208)+"rs"](){let t=r;if(!this[t(716)][t(1224)])return;let n=this[t(341)+t(369)],o=await this[t(716)][t(210)]();switch(console[t(1409)](e[t(980)],o),n){case e[t(485)]:return o&&o[t(836)]?e[t(761)](Ts,o,0,this._cursorFileName):void 0;case e[t(877)]:return;case e[t(1435)]:return o&&o.length?e[t(1088)](Ts,o,0,this["_cursorF"+t(1090)]):Wa()}}async set(t,n,o){let x=r;return console[x(1409)](e[x(1105)],t,n,o),this[x(716)][x(396)]({cursor_name:t,cursor:n,service:o})}async[r(550)+"rs"](t){let n=r,o=ja(t);for(let x of o)console[n(1409)]("setcursor",o),await this._qosDB.set(x)}async[r(935)](t){let n=r;return(await this[n(716)][n(935)](t))?.[n(606)]}async[r(1198)](){let t=r;await this[t(716)][t(1198)]()}["updateCu"+r(814)+"Name"](t){let n=r;this[n(390)+n(1090)]=t}get isReady(){let t=r;return e[t(1534)](e[t(189)],e[t(287)])?new _0x30640c(e[t(1611)](e[t(907)](e[t(565)](_0x1bb437[0],e.SqlkZ(_0xab737f[1],8)),e[t(1245)](_0x149e8d[2],16)),e.RjCxG(_0x355173[3],24)),e[t(1110)](e[t(970)](e[t(706)](_0x4e5d4e[4],_0x28f314[5]<<8),_0xe4867[6]<<16),_0x4ef38a[7]<<24),_0x40defa):this._qosDB[t(1224)]}}let Va=e.TGCao;async function Rs(s){let t=r,n={DsglW:function(p,f,b){return e[D(1057)](p,f,b)}};if(!this[t(1296)][t(489)+"S"])return null;let{aID:o,fpID:x,messageStrategy:l}=this[t(1296)],g=e[t(667)](s,Va);try{if(this[t(1438)+t(944)])if(e.bRegL(t(455),e[t(1042)]))s&&this[t(1438)+t(944)][t(198)+t(814)+"Name"](s);else return new _0x4ebc04(p=>{let f=t;n[f(438)](_0x14a412,p,this[f(685)+f(209)+"e"](_0x5a6a30))});else this[t(1438)+"anager"]=new Ja(x+"_"+o+"_"+g,g,l);return this["_cursorM"+t(944)][t(1224)]||await this[t(1438)+"anager"][t(995)](),this[t(1438)+"anager"]}catch{return null}}async function Ya(s,t){let n=r,o=e[n(430)](Ge,s[n(965)][n(1457)],e.mCIfX,"-1"),x=e[n(1522)](Ge,s[n(965)][n(1457)],e[n(643)],"1"),l=e[n(1537)](ct,s.message[n(1457)],e[n(742)]),g=e[n(1610)](Number,e[n(362)](ct,s[n(965)][n(1457)],e[n(1004)]))||0,p=fr.call(this,s),f=e.odQcx(Ge,s[n(965)][n(1457)],e[n(1570)],"2"),b=ct(s.message.headers,e[n(414)]),v=e[n(867)](Number,e[n(984)](ct,s[n(965)][n(1457)],e.QIOUJ));if(p[n(1120)])return e[n(364)](t);let C=p[n(1562)+n(329)]?await Is[n(812)](this):null;if(e[n(1051)](s[n(965)][n(255)],0)&&x&&!o||e[n(1051)](s[n(965)][n(255)],0)){if(l&&p["isQoSMes"+n(329)]&&C)return!!!await C[n(935)](l)&&(this[n(1138)+n(853)+n(914)](s),await C.set(l,Date[n(1080)]()+g)),e[n(249)](t);if(f){let I=await Rs[n(812)](this);if(!I)return this[n(1138)+n(853)+"Event"](s),t();let O=await I[n(935)](b)??-1;if(e[n(1378)](O,v))if(e[n(1302)](n(246),n(543)))this._dispatchMessageEvent(s),I[n(396)](b,v,s.message[n(255)]);else return e.VhErF(_0x56b1a8,_0x39b306)?_0x6b28cc[n(516)](new _0x886571(e[n(617)])):(_0x429bb3=_0x17aafe,_0x5c0f7d===_0xaf0846[n(836)]?_0x3b91a9[n(1020)]():_0x37a306[_0x235c85][n(1408)](_0x69c92)(_0x55551f,_0x3a354d[n(1408)](null,_0x1d73a8+1)));else throw new Error(n(890)+" message"+n(917)+v+(n(640)+n(395)+n(1256)+"r ")+O);return e.KgtCY(t)}return this[n(1138)+n(853)+n(914)](s),t()}}async function $a(s,t){let n=r,o=fr[n(812)](this,s);if(!o[n(1562)+"sage"])return e.FtciR(t);let x=await Is[n(812)](this);if(o[n(1336)+n(269)+n(302)]&&o[n(273)+"s"][n(836)])for(let l of o.ackMsgIds)await x[n(660)](l);t()}async function Xa(s,t){let n=r,o=s[n(965)][n(519)+"e"]===Ka,x=e[n(1566)](s[n(965)][n(519)+"e"],gr);if(e[n(1521)](!o,!x))return t();let l=e[n(1622)](ct,s[n(965)][n(1457)],e.GaNpk);if(!l)return e[n(249)](t);let g=await Rs.call(this,l);if(!g)return e[n(1215)](t);if(o){let p=await g.getCursors(),f={frameType:p?.[n(519)+"e"],SeqID:z.fromNumber(this[n(445)]++),LogID:z.fromNumber(this._options[n(321)+n(1204)]()),service:9e3,method:5,headers:p?.[n(1457)],payload:p?.[n(1192)]},b=A(f);this[n(951)]&&this._ws.readyState&&this[n(951)][n(537)](b)}if(x){let p=s[n(965)][n(1192)];p&&g[n(550)+"rs"](p)}}let Za=async function(s,t){let n=r;this[n(476)]=!1,clearTimeout(this[n(1054)+n(793)+"utId"]),e[n(364)](t)},Qa=async function(s,t){let n=r;if(!this._ws||e[n(989)](this[n(951)].readyState,this[n(375)]))return e.HtXhB(t);let{pingInterval:o}=this[n(1296)];this[n(1520)+n(714)]?.[n(1384)+n(1095)+"fig"]();for(let l=0;e.RjTYz(l,this[n(341)+n(469)][n(836)]);l++){let g=this[n(341)+"Queue"][l];if(e[n(680)](this[n(951)][n(272)+"te"],this[n(375)])&&g!==null)this[n(951)]&&this[n(951)][n(537)](g),this[n(341)+n(469)][l]=null;else break}this._messageQueue=this[n(341)+n(469)][n(377)](l=>!!l),this[n(780)+n(1053)+"Id"]=e[n(437)](setTimeout,()=>this[n(583)](),o),this[n(1138)+"hOpenEvent"](s),this[n(819)+"er"]&&this[n(951)]&&(this[n(951)][n(809)+"pe"]=this[n(1571)+n(1164)]);let x=this["_endpoin"+n(714)]?.[n(657)+"ntEndpoint"]();this[n(206)](n(811)+x+n(911)),e[n(933)](t)},e0=async function(s,t){let n=r,o={vFVZd:function(x,l,g){return e[D(470)](x,l,g)},CrAJT:function(x,l,g){return e[D(1609)](x,l,g)},BHLOx:function(x,l){return e[D(1242)](x,l)}};if(e[n(201)](e[n(768)],n(769)))BzfTkO[n(949)](_0x346e03,_0x3dd79e,24),BzfTkO.CrAJT(_0x5c38b1,_0x92df24,BzfTkO[n(413)](_0x4ccdec,_0x311c12));else{let x=this[n(1520)+n(714)]?.[n(657)+n(511)+"nt"]();this[n(206)](n(811)+x),e[n(532)](t)}};class t0 extends xr{constructor(t){let n=r,o={HLGZH:function(p,f){return e[D(473)](p,f)},skwmf:e[n(1391)],XCFwV:n(937),ZIPey:e[n(1139)],yXbnv:n(1551),cWHpy:function(p,f,b){return e[n(645)](p,f,b)},NhnaM:function(p,f){return e[n(1436)](p,f)},JMsgn:function(p,f,b,v){return e.HFAeT(p,f,b,v)},FFkxr:e[n(720)],ELEPa:function(p,f){return e.OHqxp(p,f)}};super(),this[n(203)+"igatorOn"+n(533)]=!0,this[n(819)+"er"]=at,this._isNode=ma,this[n(633)+"T"]=Xe,this._isMiniWX=At,this[n(1580)+"r"]=Pt,this[n(341)+n(469)]=[],this[n(1520)+n(714)]=null,this[n(646)+n(436)]=!1,this[n(1571)+"ype"]=n(1305)+n(1475),this[n(1054)+n(1019)]=!1,this[n(1054)+n(793)+"utId"]=null,this[n(234)+"ctTimeoutId"]=null,this[n(780)+n(1053)+"Id"]=null,this._seqId=0,this._isInit=!1,this[n(977)]="",this[n(409)+n(686)]=null,this[n(1438)+n(944)]=null,this[n(868)+n(734)]=null,this[n(1564)+"ls"]=e[n(1106)],this[n(1621)]=3,this[n(425)+"NG"]=0,this[n(375)]=1,this[n(1033)]=2,this[n(961)]=p=>{let f=n;try{e[f(856)](Cs,this,p,[Za,Qa,e0])}catch(b){if(e[f(1134)](e[f(549)],f(223)))return this[f(1520)+f(714)]?.["getCurre"+f(511)+"ntTriesCount"]()||0;{let v=le(e[f(720)],{message:b[f(965)],code:Ue[f(1217)+"OR"],error:b});this[f(1138)+f(575)+"ent"](v)}}},this._onMessage=async p=>{let f=n,{pingInterval:b,pingFrequency:v}=this[f(1296)];if((p[f(1355)]==="hi"&&o[f(1549)](o[f(1173)],v)||o[f(1549)](o[f(1184)],v))&&(o[f(1189)]!==o[f(1189)]?(this[f(341)+f(469)].shift(),this[f(341)+f(469)][f(547)](_0x18da11)):(this[f(1456)+f(240)](),this[f(759)](f(1402)+f(999)+"s",o[f(661)]),this[f(780)+"gTimeoutId"]=o[f(1451)](setTimeout,this[f(583)][f(1408)](this),b))),!o[f(699)]("hi",p[f(1355)]))try{o[f(530)](Cs,this,p,[Ra,Ia,$a,Xa,Ya,Ta])}catch(C){let I=o[f(1451)](le,o.FFkxr,{message:C[f(965)],code:Ue[f(243)+f(190)],error:C});this[f(1138)+f(575)+f(1346)](I)}},this[n(800)]=p=>{let f=n,b=this[f(1520)+"tManager"]?.[f(1279)+f(613)+"es"](),v=this[f(1520)+f(714)]?.[f(657)+f(511)+"nt"]();if(b&&!p[f(965)]){let C=f(555)+v+(" fail, max retri"+f(1396)+"ed");this[f(1138)+f(575)+"ent"](e[f(1199)](le,e[f(720)],{message:C,code:Ue.MAX_RETRIES_ERROR,error:p}));return}this[f(951)]&&e.WNqyZ(this._ws[f(272)+"te"],this.OPEN)&&this[f(1246)+f(372)](),this["_dispatc"+f(575)+"ent"](le(e[f(720)],{message:p[f(965)],code:Ue[f(222)+"RROR"],error:p}))},this[n(1329)]=async p=>{let f=n;this[f(885)+f(327)](),this[f(1456)+f(240)](),this[f(945)+"sListeners"](),this._ws=null,this[f(1054)+f(1019)]=!1;let b=this[f(1520)+"tManager"]?.["checkRea"+f(613)+"es"]();if(!b&&this[f(903)+"orOnline"]()&&!this[f(646)+"osed"])if(e[f(637)]==="PHEhd"){let v=this._qosDB[f(679)](this[f(1216)]),C=_0x59de93[f(1512)](seCEHz[f(322)](v,"{}"));return C[_0x163975]=void 0,this._qosDB[f(1459)](this[f(1216)],_0x563196.stringify(C))}else{let v=this[f(1520)+f(714)]?.[f(657)+f(511)+"nt"](),C=this[f(1296)]["reconnec"+f(796)+"ptor"](p[f(634)],p[f(743)]);this["_dispatchCloseEv"+f(1346)](e[f(1622)](me,e[f(1540)],{code:1006,reason:p[f(743)]||f(616)+"ng faile"+f(1600)+f(764)+f(1550)+"ame: "+v,willReconnect:C})),C&&this[f(1054)]();return}if(e[f(410)](1e3,p[f(634)])&&this[f(646)+f(436)]){this[f(1138)+f(1284)+"ent"](e[f(713)](me,e.onPnX,{code:1e3,reason:f(381)})),this[f(1520)+"tManager"]?.["resetEndpointCon"+f(1526)](),this["_pingLos"+f(734)]?.[f(1069)+f(1341)]();return}if(e[f(277)](1e3,p.code)&&b){let v=this[f(1520)+"tManager"]?.[f(657)+f(511)+"nt"](),C=p.reason;C||(C=await e[f(1342)](Ea,this[f(977)])),C="connecti"+f(1567)+f(286)+C+(f(996)+f(1222))+v+(f(491)+"tries re"+f(1017)),this[f(1138)+"hCloseEv"+f(1346)](e[f(353)](me,e[f(1540)],{code:p.code,reason:C}));let I=f(555)+v+(f(1587)+f(835)+f(1396)+"ed");this["_dispatc"+f(575)+f(1346)](e[f(1146)](le,f(1127),{message:I,code:Ue[f(399)+f(985)+"R"]})),this[f(1520)+f(714)]?.[f(1384)+f(1095)+f(1526)](),this[f(868)+"sCounter"]?.["resetCou"+f(1341)]();return}if(e[f(579)](1e3,p[f(634)])&&!p.reason){let v=this[f(1520)+"tManager"]?.["getCurre"+f(511)+"nt"]();this[f(1138)+"hCloseEv"+f(1346)](me(e[f(1540)],{code:p[f(634)],reason:f(616)+"ng faile"+f(1600)+f(764)+f(1550)+"ame: "+v})),this[f(1520)+f(714)]?.["resetEnd"+f(1095)+f(1526)](),this[f(868)+f(734)]?.["resetCou"+f(1341)]();return}this[f(1138)+f(1284)+f(1346)](p),this[f(1520)+f(714)]?.[f(1384)+f(1095)+f(1526)](),this[f(868)+f(734)]?.[f(1069)+"nter"]()},this[n(1597)]=null,this[n(1018)]=null,this[n(1371)+"e"]=null,this[n(1212)]=null,this[n(892)+n(1469)]=null,this[n(908)+n(826)]=null,this[n(331)+"mediatel"+n(424)+"ct"]=null,this[n(536)+n(370)]=this[n(536)+"nLine"][n(1408)](this),this[n(536)+n(974)]=this[n(536)+n(974)][n(1408)](this),this["_handleP"+n(755)]=this[n(1274)+n(755)][n(1408)](this),this[n(1274)+n(647)]=this._handlePageShow[n(1408)](this),this[n(1296)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength: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(1123)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e[n(1435)],env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:x,ws:l}=t,g=Array.isArray(x)?x:e[n(541)]==typeof x?[x]:[];if(!g||e[n(1247)](0,g[n(836)]))throw new Error(n(1079)+n(513)+n(1082));if(!e[n(1568)](ya,l))throw new Error(e.FwdRg);Object[n(264)](this[n(1296)],t),this[n(1520)+"tManager"]=new Es(g,this[n(1296)][n(1617)+"es"]),this[n(868)+n(734)]=new Sa(this._options[n(1255)+n(257)]),this._options[n(621)+"cOpen"]&&(this[n(476)]=!0,this._connect()),this[n(1296)][n(820)+"tworkChanged"]&&(this[n(633)+"T"]||this[n(833)+"X"]?this[n(503)+n(1025)+n(1505)]():this._isBrowser&&this[n(605)+"balEvent"+n(1037)]())}[r(536)+"nLine"](){let t=r;this[t(1296)]["disableAutoRecon"+t(865)]||this["_readyCl"+t(436)]||this[t(493)+"econnect"]()}[r(536)+"ffLine"](){let t=r;this["_destroy"+t(1282)+"t"]();let n=e[t(771)](cr,e.mwrRe,{message:e[t(776)]});this["onStopImmediatel"+t(424)+"ct"]&&this[t(331)+t(215)+t(424)+"ct"](n)}[r(605)+"balEvent"+r(1037)](){let t=r;this._isBrowser&&window[t(426)+t(1037)](e[t(927)],this[t(536)+"nLine"]),this[t(819)+"er"]&&window.addEventListener(e.NhuKQ,this[t(536)+t(974)]),this._isBrowser&&window["addEvent"+t(1037)]("pagehide",this[t(1274)+t(755)]),this[t(819)+"er"]&&window[t(426)+t(1037)](e[t(899)],this[t(1274)+t(647)])}[r(1265)+"balEvent"+r(1037)](){let t=r;this._isBrowser&&window[t(1368)+t(1133)+t(893)](e[t(927)],this._handleOnLine),this[t(819)+"er"]&&window[t(1368)+"entListe"+t(893)](e.NhuKQ,this[t(536)+t(974)]),this[t(819)+"er"]&&window[t(1368)+t(1133)+t(893)](e[t(1174)],this[t(1274)+"ageHide"]),this[t(819)+"er"]&&window["removeEv"+t(1133)+t(893)](e[t(899)],this._handlePageShow)}["_handleP"+r(755)](t){let n=r;!t[n(1429)+"d"]&&(this._isBrowser&&window[n(1368)+"entListe"+n(893)](n(1152),this[n(1274)+n(755)]),this[n(819)+"er"]&&window["removeEv"+n(1133)+n(893)](e[n(899)],this[n(1274)+"ageShow"]),this.close()),this[n(819)+"er"]&&window[n(1368)+"entListe"+n(893)](e.RWGet,this[n(536)+"nLine"]),this[n(819)+"er"]&&window.removeEventListener(e[n(328)],this[n(536)+n(974)])}[r(1274)+r(647)](t){let n=r;t[n(1429)+"d"]&&(this[n(903)+n(1544)]()&&(!this[n(951)]||e[n(579)](this[n(951)][n(272)+"te"],this.OPEN)||e.XamOx(this[n(951)][n(272)+"te"],this[n(425)+"NG"]))&&this[n(536)+n(370)](),this._isBrowser&&window[n(426)+n(1037)]("online",this[n(536)+n(370)]),this[n(819)+"er"]&&window[n(426)+n(1037)](e.NhuKQ,this[n(536)+n(974)]))}async["_generat"+r(1200)](t){let n=r,{fpID:o,deviceID:x,bddID:l,ttwID:g,accessKey:p,aID:f,customParams:b={},enableAutoAck:v,enableQoS:C,QoSLevel:I,env:O}=this[n(1296)],L,B,Q;this[n(819)+"er"]||this._isMiniWX||this[n(633)+"T"]?(L=location&&location[n(420)]=="https:"?n(1116):e[n(1330)],B=t[n(1399)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),Q=/^wss(.*:\/\/)/[n(1048)](t)?t:""+L+B):(L=n(1116),B=t[n(1399)](/(^http)((?:[s]*:\/\/))/,""),Q=/(^ws)((?:[s]*:\/\/))/[n(1048)](B)?B:""+L+B);let $=l?e[n(815)]:g?e[n(595)]:e[n(1308)],Ie=l||g||x;if(!Ie||!$)throw new Error(n(1079)+"rovide b"+n(708)+n(1349)+n(913));let n0=n(339)==typeof b?await e.FtciR(b):b,r0=O?e[n(1178)](va,O[n(1424)],O[n(1087)]):{},pr=Object[n(264)]({device_platform:e.VAuJB,version_code:"fws_1.0.0",access_key:p,fpid:o,aid:f,[$]:Ie,xsack:v?1:0,xaack:v?1:0,xsqos:C?1:0,qos_level:C?I:void 0,qos_sdk_version:2,...r0},n0),s0=Object[n(1460)](pr)[n(392)]((mr,wr)=>pr[wr]!==void 0?""+mr+(mr?"&":"?")+wr+"="+pr[wr]:mr,"");return Q+n(1229)+s0}async[r(1054)](){let t=r;if(!(this[t(1054)+t(1019)]||this[t(646)+t(436)])){this[t(1054)+"Lock"]=!0;try{let n=this[t(1520)+t(714)]?.[t(1381)+"rentEndp"+t(1211)+"hedMaxRe"+t(694)](),{timeoutInterval:o}=this[t(1296)];if(n){let l=this[t(1520)+t(714)]?.[t(657)+t(511)+"nt"](),g=this["_endpoin"+t(714)]?.[t(897)+"ackupEnd"+t(387)+t(229)+t(1313)](),p=this[t(1520)+"tManager"]?.[t(657)+t(511)+t(632)+t(1310)]();if(g){let f=t(555)+l+(t(254)+t(491)+t(245)+t(1328)+t(539)+t(952)+t(786))+g+(t(1315)+"y"),b=e.oJqRZ(le,e.xdmpf,{message:f,code:Ue["MAX_RETR"+t(985)+"R"]});this[t(206)](f),this[t(1138)+t(575)+t(1346)](b),this[t(977)]=await this[t(888)+t(1200)](g),this[t(206)](t(555)+g+" "+p+t(671)),this[t(945)+t(1612)+"rs"]()}else{let f="connect "+l+(t(254)+t(491)+"tries re"+t(1017));this[t(206)](f),this[t(1138)+t(575)+"ent"](e[t(481)](le,e[t(720)],{message:f,code:Ue[t(399)+t(985)+"R"]}));return}}else{let l=this._endpointManager?.[t(657)+"ntEndpoi"+t(572)+"ateCount"](),g=this[t(1520)+t(714)]?.[t(657)+"ntEndpoi"+t(632)+t(1310)]();this._url=await this["_generat"+t(1200)](e.TXYHv(l,"")),this[t(206)](t(555)+l+" "+g+" times"),this[t(945)+t(1612)+"rs"]()}if(this._isInit)this[t(476)]=!1;else{let l=e[t(666)](cr,e.mwrRe,{message:e[t(715)]});this.onStartReconnect&&this[t(892)+t(1469)](l)}let x=this[t(1520)+t(714)]?.[t(657)+t(511)+t(632)+t(1310)]()||0;e[t(1238)](x,1)&&await this._wait(e[t(710)](x,1)),this[t(206)](t(616)+t(325)+this[t(977)]+(t(1276)+t(1226))+this._protocols),this[t(951)]=e[t(353)](_a,{url:this[t(977)],protocols:[this[t(1564)+"ls"]],headers:this[t(1296)][t(505)+t(860)+"s"][t(615)+t(904)]},this._options.ws),(this[t(819)+"er"]||this[t(1580)+"r"])&&this[t(951)]&&(this[t(951)][t(809)+"pe"]=this[t(1571)+"ype"]),this[t(247)+t(501)](),this[t(1054)+t(793)+t(1543)]=e.uVwRJ(setTimeout,this[t(582)+"ut"].bind(this),o)}catch(n){throw this[t(1054)+t(1019)]=!1,n}}}[r(885)+r(327)](){let t=r,n={oErVi:function(o,x){return e[D(1125)](o,x)}};if(e[t(1427)]===t(1129)){let o={RWLtc:function(x,l){let g=t;return CNGMDy[g(1532)](x,l)}};return function(x,...l){let g=t,p=_0x1dfba4[g(812)](_0x3af3c2(this),x,...l);return _0x27e33c[g(396)](p,x[g(828)]?x[g(828)]():[x]),o[g(962)](_0x12e4a6,p)}}else clearTimeout(this[t(1054)+"ionTimeo"+t(1543)]),this[t(1054)+t(793)+"utId"]=null}[r(1456)+r(240)](){let t=r;clearTimeout(this[t(780)+t(1053)+"Id"]),e.uSGYP(clearTimeout,this[t(234)+t(724)+"tId"]),this["_pingPon"+t(1053)+"Id"]=null,this[t(234)+"ctTimeou"+t(1496)]=null}[r(206)](...t){let n=r;this._options[n(1478)]&&console[n(1409)][n(1118)](console,[e[n(1032)],...t])}["_getInte"+r(209)+"e"](t){let n=r;if(e[n(689)](n(443),e.oTpRp))return new _0x19cd4b(_0x32659f,{data:_0x41f9ff,message:_0x306472});{let{initReconnectInterval:o,maxReconnectInterval:x,reconnectIntervalGrowFactor:l}=this[n(1296)],g=e[n(1236)](o,Math[n(1516)](l,e[n(571)](t,1)));return e.IXVZC(g,x)?x:g}}_ping(){let t=r,n={nLIrj:function(o,x){return o<x},vIFNt:function(o,x,l){return o(x,l)},BoUPG:function(o,x,l,g){return e[D(1007)](o,x,l,g)},qMUWm:function(o,x){return e[D(802)](o,x)}};if(this[t(951)]&&this._ws[t(272)+"te"]===this[t(425)+"NG"])if(e[t(1214)](e[t(1333)],e[t(1333)])){let o=0,x=[];for(;ljUkWg.nLIrj(o,_0x1aa2a4[t(762)+"th"]);){let{offset:l}=ljUkWg[t(1322)](_0x255cf8,_0x439c68,o);o=l;let g={cursor_name:"",cursor:0,service:0},{value:p,offset:f}=_0x4a0bc7(_0x49ae69,o);g[t(255)]=p,o=f;let{value:b,offset:v}=_0x27fb74(_0x3cbd1f,o);o=v,g[t(316)+"ame"]=ljUkWg.BoUPG(_0x15e0c4,_0x31efdf,o,ljUkWg[t(1228)](o,b)),o+=b;let{value:C,offset:I}=_0x51dd64(_0x1ebf93,o);g[t(606)]=C[t(1406)](),o=I,x[t(547)](g)}return x}else{this[t(1456)+"ngTimer"](),this[t(780)+t(1053)+"Id"]=e[t(1359)](setTimeout,this[t(583)][t(1408)](this),this[t(1296)][t(1251)+t(1055)]);return}if(!this[t(951)]||e[t(1363)](this[t(951)].readyState,this[t(375)]))return void this[t(493)+t(1469)]();this[t(951)]&&this[t(951)][t(537)]("hi"),this["_reconnectTimeou"+t(1496)]=e.jycie(setTimeout,this[t(493)+t(1469)+t(1547)][t(1408)](this),this[t(1296)][t(556)+t(1203)+t(1324)])}["_handleR"+r(1469)+r(1547)](){let t=r;this[t(868)+t(734)]?.[t(1518)](),this[t(759)](e.WEzxw,e[t(623)]),this[t(868)+t(734)]?.[t(1279)+t(251)+"nt"]()?this[t(493)+t(1469)]():this[t(583)]()}[r(903)+r(1544)](){let t=r;return this[t(633)+"T"]||this[t(833)+"X"]?this[t(203)+t(938)+t(533)]:(this[t(819)+"er"]||this[t(1580)+"r"])&&this[t(1296)]["listenNe"+t(846)+"nged"]?navigator[t(948)]:!0}["_handleR"+r(1469)](){let t=r;!this[t(903)+t(1544)]()||this[t(646)+t(436)]||(this[t(1520)+"tManager"]?.[t(1384)+t(1095)+t(1526)](),this[t(868)+"sCounter"]?.["resetCou"+t(1341)](),this[t(951)]?this["_disconn"+t(372)](1001,e.GNTKM,!0):this[t(1054)]())}[r(503)+r(1025)+r(1505)](){let t=r;this[t(633)+"T"]?tt["onNetwor"+t(391)+t(1536)](({isConnected:n})=>{let o=t;this[o(203)+o(938)+o(533)]=n,n?this[o(536)+o(370)]():this[o(536)+o(974)]()}):this[t(833)+"X"]&&wx[t(1243)+t(391)+t(1536)](({isConnected:n})=>{let o=t;if(e[o(942)](e[o(777)],e[o(526)]))return this[o(716)]?.[o(660)](_0x16daea);this[o(203)+o(938)+o(533)]=n,n?this["_handleO"+o(370)]():this[o(536)+"ffLine"]()})}[r(723)](t){let n=r,o={saqUt:n(1298)+n(861)+n(597),ShJpG:function(x,l,g,p){return e[n(1278)](x,l,g,p)},XqzCl:e[n(465)],SwsGd:n(1190),KYDrK:e[n(889)],jRKlx:n(1024)+"ervice",HKONk:function(x,l,g,p){return e[n(1278)](x,l,g,p)}};return new Promise(x=>{let l=n;if(e.ErGxD(e[l(212)],e[l(212)]))setTimeout(x,this[l(685)+l(209)+"e"](t));else{let g=o.saqUt[l(1357)]("|"),p=0;for(;;){switch(g[p++]){case"0":_0x37a8fe=bfBtxI[l(1513)](_0x36cfba,_0x5b9521[l(1252)+"er"](_0x49d0f6[l(606)]||_0xf6cac9),_0x4bae9f,_0xd91d39);continue;case"1":_0x4cd0af[l(1409)](bfBtxI[l(1097)],_0x2d7401);continue;case"2":_0x40aaa9[l(1409)](bfBtxI[l(591)],_0x881029);continue;case"3":_0x4cbae7[l(1409)](l(957)+l(919),_0x3d92ac);continue;case"4":_0xfad75[l(1409)](bfBtxI.KYDrK,_0x2c6dc2);continue;case"5":_0x3cf2f4=_0x5ab47d(_0x47dad1[l(316)+l(1395)],_0x4134c8,_0x21e090);continue;case"6":_0xf5a71c[l(1409)](bfBtxI[l(1009)],_0x5c1ac9,_0x41d04d[l(255)]);continue;case"7":_0x724c1b[l(1409)](l(402),_0x720c67);continue;case"8":_0x3fcd40=_0x2c2f5d(_0x8a1597,_0x1fffc5,_0x462157[l(255)]||0);continue;case"9":_0x3c5c76=bfBtxI[l(946)](_0x18dc5d,_0x251cf0[_0x43af9a[l(316)+l(1395)]],_0x4934fa,_0x226b78);continue;case"10":_0x365224=bfBtxI.HKONk(_0x55ca34,0,_0x2552f0,_0x672d75);continue}break}}})}[r(1246)+r(372)](t=1e3,n="",o=!1){let x=r;this._ws&&this[x(305)+x(1282)+"t"](t,n,o)}_onTimeout(){let t=r,n=this[t(1520)+t(714)]?.[t(657)+"ntEndpoint"]();this[t(206)](t(555)+n+" timeout"),this["_disconn"+t(372)](1001,e[t(1122)],!0)}[r(1509)](t){let n=r,o=e[n(1242)](ar,t);this[n(951)]&&e[n(498)](this[n(951)][n(272)+"te"],this[n(375)])&&(this[n(951)]&&this._ws.send(o),this[n(206)](e[n(1166)],t))}[r(945)+"sListeners"](){let t=r;this._ws&&(this[t(951)][t(1368)+t(1133)+t(893)](e.iojll,this[t(961)]),this[t(951)][t(1368)+t(1133)+"ner"](e.onPnX,this[t(1329)]),this._ws[t(1368)+t(1133)+t(893)](e.NEjiL,this[t(1301)+"ge"]),this[t(951)][t(1368)+t(1133)+"ner"](e[t(720)],this[t(800)]))}[r(247)+r(501)](){let t=r,n=e[t(807)][t(1357)]("|"),o=0;for(;;){switch(n[o++]){case"0":if(!this[t(951)])return;continue;case"1":this[t(951)].addEventListener(e[t(720)],this[t(800)]);continue;case"2":this[t(951)][t(426)+t(1037)](e[t(1058)],this[t(961)]);continue;case"3":this._ws[t(426)+t(1037)]("close",this._onClose);continue;case"4":this._ws[t(426)+"Listener"]("message",this[t(1301)+"ge"]);continue}break}}[r(1014)+r(588)](t=1e3,n=""){let o=r;if(e[o(916)](e[o(1297)],e[o(1297)]))this.emit(e[o(1058)],_0x277e1e),this[o(1212)]&&this[o(1212)](_0x42c8ef);else try{this[o(951)]&&this._ws[o(1223)](t,n)}catch{}}[r(305)+"WebSocket"](t=1e3,n="",o=!1){let x=r,l={Sbjke:function(g,p,f){return e.CYOJw(g,p,f)},xjZNM:e.onPnX};if(this[x(1456)+"ngTimer"](),this[x(885)+"mer"](),this[x(945)+x(1612)+"rs"](),this[x(1014)+"nceClose"](1e3,n),this[x(1054)+"Lock"]=!1,o&&this[x(903)+x(1544)]()&&!this["_readyCl"+x(436)]){if(this[x(1520)+"tManager"]?.[x(1279)+x(613)+"es"]())if(x(1045)===e[x(1241)]){let p=this[x(1520)+x(714)]?.["getCurre"+x(511)+"nt"]();this[x(1138)+x(1284)+x(1346)](e[x(1514)](me,x(1223),{code:1006,reason:x(555)+p+(x(254)+", max re"+x(245)+"ached"),wasClean:!0}))}else{if(this["_endpoin"+x(714)]?.[x(1279)+x(613)+"es"]()){let f=this[x(1520)+x(714)]?.[x(657)+x(511)+"nt"]();this[x(1138)+x(1284)+x(1346)](l[x(1266)](_0xeeec5e,l[x(1393)],{code:1006,reason:x(555)+f+(x(254)+x(491)+x(245)+x(1017)),wasClean:!0}))}else{let f=this[x(1296)][x(1225)+x(796)+x(1353)](_0x46a9c4,_0x110a10);this[x(1138)+"hCloseEv"+x(1346)](l.Sbjke(_0x4cf9ff,l[x(1393)],{code:_0x515380,reason:_0x4b8cfb,wasClean:!0,willReconnect:f})),f&&this[x(1054)]()}return}else{let p=this[x(1296)][x(1225)+"tInterceptor"](t,n);this[x(1138)+x(1284)+x(1346)](e[x(276)](me,x(1223),{code:t,reason:n,wasClean:!0,willReconnect:p})),p&&this[x(1054)]()}return}this[x(903)+x(1544)]()||this[x(646)+x(436)]?this[x(1138)+x(1284)+x(1346)](e[x(1178)](me,e.onPnX,{code:t,reason:x(381)})):this["_dispatc"+x(1284)+x(1346)](me(e[x(1540)],{code:1006,reason:e[x(1388)]})),this._ws=null,this[x(1520)+x(714)]?.[x(1384)+x(1095)+x(1526)](),this[x(868)+x(734)]?.[x(1069)+x(1341)]()}[r(1138)+"hOpenEvent"](t){let n=r;if(e[n(928)](e[n(403)],e[n(403)]))this[n(759)](e.iojll,t),this[n(1212)]&&this[n(1212)](t);else return!!this[n(716)]}[r(1138)+r(853)+"Event"](t){let n=r;this[n(759)](e[n(990)],t),this[n(1371)+"e"]&&this[n(1371)+"e"](t)}[r(1138)+"hAckMess"+r(626)](t){let n=r;this.emit(n(845),t),this[n(908)+n(826)]&&this["onReceiv"+n(826)](t)}[r(1138)+r(575)+"ent"](t){let n=r;this[n(759)](e[n(720)],t),this[n(1018)]&&this[n(1018)](t)}[r(1138)+r(1284)+r(1346)](t){let n=r;this.emit(e.onPnX,t),this[n(1597)]&&this.onclose(t)}get[r(809)+"pe"](){let t=r;return this._ws?this[t(951)][t(809)+"pe"]:this[t(1571)+t(1164)]}set[r(809)+"pe"](t){let n=r,o={kZBCK:function(x,l,g){return e[D(470)](x,l,g)},DcgXI:function(x,l){return e[D(625)](x,l)}};if(e.OzKSe(e[n(494)],e[n(494)])){let x=_0x19cdc5();return QMWKXW[n(1047)](_0x3d3e01,_0x5b4d17,x),QMWKXW[n(1554)](_0x2b315f,x)}else this["_binaryT"+n(1164)]=t,this._ws&&(this[n(951)][n(809)+"pe"]=t)}get[r(326)+"nt"](){let t=r;return this[t(1520)+"tManager"]?.[t(657)+"ntEndpoi"+t(632)+t(1310)]()||0}get["buffered"+r(1410)](){let t=r;return this[t(341)+"Queue"][t(392)]((o,x)=>(o+=x&&x[t(762)+"th"]||0,o),0)+(this[t(951)]?this[t(951)][t(801)+t(1410)]:0)}get[r(1528)+"ns"](){let t=r;return this[t(951)]?this._ws[t(1528)+"ns"]:""}get[r(420)](){let t=r;return this._ws?this._ws[t(420)]:""}get[r(272)+"te"](){let t=r,n={RDXXE:function(o,x){return e[D(1131)](o,x)},FNQoH:function(o,x){return e[D(843)](o,x)},koKsJ:function(o,x){return o<<x},uGbys:function(o,x){return e[D(1070)](o,x)},BuAOr:function(o,x){return e[D(653)](o,x)}};if(e[t(1601)](t(405),e.APQGM))return this._ws?this[t(951)][t(272)+"te"]:this[t(1296)][t(621)+t(1485)]?this.CONNECTING:this[t(1621)];_0x515cf5=VCnkoB.RDXXE(VCnkoB[t(483)](VCnkoB[t(1354)](VCnkoB[t(1428)](15,_0xbee6e9),12),VCnkoB[t(1354)](VCnkoB[t(1428)](63,_0x169540),6)),VCnkoB[t(1428)](63,_0x7d00f1)),_0x379ac2<2048||_0x3680aa>=55296&&VCnkoB.BuAOr(_0x45dcc4,57343)?_0x377855+=_0x5397a7:(_0x2d7cc3+=_0x1894e0(_0x1a6aa2),_0x103e7b+=2)}get url(){let t=r;return this[t(951)]?this[t(951)].url:this[t(977)]}close(t=1e3,n){let o=r,x={HUVhA:function(l,g){return e[D(1147)](l,g)}};if(e[o(1261)]===e.efFvQ)return eCIfPw[o(486)](this.count,this[o(211)+o(1310)]);{let l=e[o(1289)].split("|"),g=0;for(;;){switch(l[g++]){case"0":if(e[o(488)](this[o(951)][o(272)+"te"],this[o(1621)])||this[o(951)][o(272)+"te"]===this.CLOSING)return void this._debug("close, ws alread"+o(230));continue;case"1":this[o(885)+o(327)]();continue;case"2":this[o(409)+o(686)]?.[o(1198)]();continue;case"3":this._destroyWebSocket(t,n);continue;case"4":this[o(1265)+o(1559)+o(1037)]();continue;case"5":if(!this[o(951)])return void this._debug(e[o(1010)]);continue;case"6":this[o(1456)+o(240)]();continue;case"7":this[o(646)+o(436)]=!0;continue}break}}}async[r(537)](t,n){let o=r,x={VbvLt:function(Q,$){return e.WDwbi(Q,$)},qQAbk:e[o(541)],uYBbG:e[o(1011)]};if(t==null)throw new Error(e[o(574)]);e[o(1348)](e[o(261)],typeof t)&&(t=JSON[o(816)+"y"](t)),e.YGSsM(o(751),typeof t)&&!(t instanceof ArrayBuffer)&&!(t[o(1071)]&&t[o(1071)]instanceof ArrayBuffer)&&(t=JSON[o(816)+"y"](t));let l=await e[o(1555)](ks,t),g=e.sREcf(ba,t),{method:p=0,service:f=this[o(1296)][o(255)],logID:b=this[o(1296)][o(321)+o(1204)](),headers:v=this[o(1296)][o(1457)],payloadEncoding:C=this[o(1296)][o(731)+o(859)],payloadType:I=this[o(1296)].payloadType,logIDNew:O=this[o(1296)][o(589)+o(1332)][o(981)+o(333)+"teLogIDNew"]?e.GTWJD(a,this[o(1296)][o(589)+o(1332)][o(1317)]):""}=n||{};if(!f)throw new Error(o(1079)+"rovide a"+o(884)+o(1444));let L={SeqID:z[o(1252)+"er"](this[o(445)]++),LogID:z[o(1252)+"er"](b),service:f,method:p,headers:v,payloadEncoding:e[o(1098)](C,Object)?C.encoding?C.encoding:"":C,payloadType:e[o(1432)](I,Object)?I[o(317)]?I[o(317)]:g:I||g,payload:l,LogIDNew:O},B=e[o(214)](ar,L);if(this[o(951)]&&e[o(1436)](this[o(951)].readyState,this[o(375)]))this[o(951)]&&this[o(951)][o(537)](B),this[o(206)](e.hcxlW,L);else if(this[o(341)+o(469)][o(836)]<this._options[o(850)+o(281)+o(1449)])this[o(341)+o(469)][o(547)](B),this._debug(o(1316),L);else if(e[o(1022)](e[o(745)],e[o(745)]))this[o(341)+"Queue"][o(789)](),this[o(341)+o(469)][o(547)](B);else return iuVcwZ[o(285)](iuVcwZ.qQAbk,typeof _0x7f4e14)?iuVcwZ.uYBbG:"";return{seqID:this._seqId,logID:b,logIDNew:O}}async[r(1225)+"t"](t){let n=r,{url:o}=e.btpOA(t,{}),x=Array[n(728)](o)?o:e[n(1187)](e[n(541)],typeof o)?[o]:[];t&&Object[n(264)](this._options,t),x&&x[n(836)]?this[n(1520)+n(714)]=new Es(x,this[n(1296)][n(1617)+"es"]):this[n(1520)+"tManager"]?.["resetEnd"+n(1095)+n(1526)](),this._pingLossCounter?.[n(1069)+n(1341)](this[n(1296)]["pingLoss"+n(257)]),this[n(646)+n(436)]=!1,this[n(951)]&&e.VPSjG(this[n(951)][n(272)+"te"],this[n(1621)])?this["_disconn"+n(372)](1e3,e.eBaWQ,!0):(this[n(476)]=!0,this[n(1054)]())}async[r(1619)](){let t=r;if(!this[t(1054)+t(1019)]){let n=e[t(224)][t(1357)]("|"),o=0;for(;;){switch(n[o++]){case"0":this._pingLossCounter?.[t(1069)+"nter"]();continue;case"1":this[t(1520)+t(714)]?.[t(1384)+"pointCon"+t(1526)]();continue;case"2":this[t(476)]=!0;continue;case"3":this[t(1054)]();continue;case"4":this["_readyCl"+t(436)]=!1;continue}break}}}[r(426)+r(1037)](t,n){this.on(t,n)}[r(1596)+r(914)](t){let n=r,{type:o}=t;this[n(759)](o,t)}[r(1368)+"entListe"+r(893)](t,n){this[r(253)](t,n)}[r(1584)](){let t={eSIDC:function(n,o){return e[D(1530)](n,o)},YUnJt:"success"};return new Promise((n,o)=>{let x=D,l={TMyur:e.WEzxw};this[x(1456)+x(240)](),this[x(780)+x(1053)+"Id"]=e.aTxZs(setTimeout,this._ping[x(1408)](this),this._options[x(1251)+x(1055)]);let g=()=>{let f=x;t.eSIDC(n,t[f(648)]),this[f(253)](f(1402)+f(999)+"s",g),this.off("ping_onc"+f(960)+"t",p)},p=()=>{let f=x;o(f(1594)),this[f(253)](f(1402)+f(999)+"s",g),this.off(l[f(456)],p)};this.on(x(1402)+"e_success",g),this.on(x(1402)+x(960)+"t",p),this[x(583)]()})}}})(),Y[S(423)+S(719)]=Z[S(423)+S(719)],Y[S(376)+S(1483)]=Z[S(376)+"rorEvent"],Y[S(1366)+"e"]=Z[S(1366)+"e"],Y[S(914)]=Z.Event,Y[S(651)]=Z.FWS,Y[S(726)+S(1205)+S(924)]=Z[S(726)+"MessageE"+S(924)],Y[S(1205)+S(924)]=Z[S(1205)+S(924)],Y[S(442)+"t"]=Z.OpenEvent,Y[S(499)+S(1561)]=Z["Reconnec"+S(1561)],Y[S(1299)+S(719)]=Z.createCloseEvent,Y["createEr"+S(1483)]=Z[S(711)+S(1483)],Y[S(586)+S(741)+"nt"]=Z.createMessageEvent,Y[S(1277)+S(563)]=Z["createOp"+S(563)],Y[S(1497)+S(813)+S(924)]=Z[S(1497)+S(813)+S(924)],Y["decodedF"+S(1379)]=Z["decodedF"+S(1379)],Y.encodeFrame=Z[S(416)+S(1395)];for(In in Z)[S(423)+"oseEvent",S(376)+S(1483),S(1366)+"e",S(914),"FWS",S(726)+"MessageEvent","MessageE"+S(924),S(442)+"t",S(499)+S(1561),"createCl"+S(719),"createEr"+S(1483),S(586)+S(741)+"nt",S(1277)+"enEvent",S(1497)+S(813)+S(924),S(1361)+S(1379),S(416)+"ame"][S(496)](In)===-1&&(Y[In]=Z[In]);var In;Object[S(749)+S(1524)](Y,S(1552)+"le",{value:!0})});var Be=ce((ph,Fi)=>{"use strict";var zi=["nodebuffer","arraybuffer","fragments"],qi=typeof Blob<"u";qi&&zi.push("blob");Fi.exports={BINARY_TYPES:zi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:qi,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Ft=ce((mh,Mn)=>{"use strict";var{EMPTY_BUFFER:ux}=Be(),Tr=Buffer[Symbol.species];function dx(r,e){if(r.length===0)return ux;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let c=0;c<r.length;c++){let u=r[c];i.set(u,a),a+=u.length}return a<e?new Tr(i.buffer,i.byteOffset,a):i}function Ui(r,e,i,a,c){for(let u=0;u<c;u++)i[a+u]=r[u]^e[u&3]}function Gi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function fx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function Rr(r){if(Rr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new Tr(r):ArrayBuffer.isView(r)?e=new Tr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),Rr.readOnly=!1),e}Mn.exports={concat:dx,mask:Ui,toArrayBuffer:fx,toBuffer:Rr,unmask:Gi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=X("bufferutil");Mn.exports.mask=function(e,i,a,c,u){u<48?Ui(e,i,a,c,u):r.mask(e,i,a,c,u)},Mn.exports.unmask=function(e,i){e.length<32?Gi(e,i):r.unmask(e,i)}}catch{}});var ji=ce((wh,Hi)=>{"use strict";var Ki=Symbol("kDone"),Nr=Symbol("kRun"),Lr=class{constructor(e){this[Ki]=()=>{this.pending--,this[Nr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Nr]()}[Nr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Ki])}}};Hi.exports=Lr});var mt=ce((_h,Yi)=>{"use strict";var Ut=X("zlib"),Wi=Ft(),lx=ji(),{kStatusCode:Ji}=Be(),hx=Buffer[Symbol.species],gx=Buffer.from([0,0,255,255]),qn=Symbol("permessage-deflate"),Me=Symbol("total-length"),gt=Symbol("callback"),Je=Symbol("buffers"),pt=Symbol("error"),zn,Or=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,!zn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;zn=new lx(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[gt];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){zn.add(c=>{this._decompress(e,i,(u,d)=>{c(),a(u,d)})})}compress(e,i,a){zn.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[qn]=this,this._inflate[Me]=0,this._inflate[Je]=[],this._inflate.on("error",mx),this._inflate.on("data",Vi)}this._inflate[gt]=a,this._inflate.write(e),i&&this._inflate.write(gx),this._inflate.flush(()=>{let u=this._inflate[pt];if(u){this._inflate.close(),this._inflate=null,a(u);return}let d=Wi.concat(this._inflate[Je],this._inflate[Me]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Me]=0,this._inflate[Je]=[],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[Me]=0,this._deflate[Je]=[],this._deflate.on("data",px)}this._deflate[gt]=a,this._deflate.write(e),this._deflate.flush(Ut.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let u=Wi.concat(this._deflate[Je],this._deflate[Me]);i&&(u=new hx(u.buffer,u.byteOffset,u.length-4)),this._deflate[gt]=null,this._deflate[Me]=0,this._deflate[Je]=[],i&&this.params[`${c}_no_context_takeover`]&&this._deflate.reset(),a(null,u)})}};Yi.exports=Or;function px(r){this[Je].push(r),this[Me]+=r.length}function Vi(r){if(this[Me]+=r.length,this[qn]._maxPayload<1||this[Me]<=this[qn]._maxPayload){this[Je].push(r);return}this[pt]=new RangeError("Max payload size exceeded"),this[pt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[pt][Ji]=1009,this.removeListener("data",Vi),this.reset()}function mx(r){if(this[qn]._inflate=null,this[pt]){this[gt](this[pt]);return}r[Ji]=1007,this[gt](r)}});var wt=ce((yh,Fn)=>{"use strict";var{isUtf8:$i}=X("buffer"),{hasBlob:_x}=Be(),yx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function bx(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Br(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 vx(r){return _x&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}Fn.exports={isBlob:vx,isValidStatusCode:bx,isValidUTF8:Br,tokenChars:yx};if($i)Fn.exports.isValidUTF8=function(r){return r.length<24?Br(r):$i(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=X("utf-8-validate");Fn.exports.isValidUTF8=function(e){return e.length<32?Br(e):r(e)}}catch{}});var Ur=ce((bh,ro)=>{"use strict";var{Writable:Sx}=X("stream"),Xi=mt(),{BINARY_TYPES:Ex,EMPTY_BUFFER:Zi,kStatusCode:Cx,kWebSocket:Ax}=Be(),{concat:Mr,toArrayBuffer:Px,unmask:kx}=Ft(),{isValidStatusCode:Dx,isValidUTF8:Qi}=wt(),Un=Buffer[Symbol.species],he=0,eo=1,to=2,no=3,zr=4,qr=5,Gn=6,Fr=class extends Sx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Ex[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ax]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=he}_write(e,i,a){if(this._opcode===8&&this._state==he)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 Un(a.buffer,a.byteOffset+e,a.length-e),new Un(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 Un(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 he:this.getInfo(e);break;case eo:this.getPayloadLength16(e);break;case to:this.getPayloadLength64(e);break;case no:this.getMask();break;case zr:this.getData(e);break;case qr:case Gn: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[Xi.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=eo:this._payloadLength===127?this._state=to: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=no:this._state=zr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=zr}getData(e){let i=Zi;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&&kx(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=qr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Xi.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===he&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=he;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=Mr(a,i):this._binaryType==="arraybuffer"?c=Px(Mr(a,i)):this._binaryType==="blob"?c=new Blob(a):c=a,this._allowSynchronousEvents?(this.emit("message",c,!0),this._state=he):(this._state=Gn,setImmediate(()=>{this.emit("message",c,!0),this._state=he,this.startLoop(e)}))}else{let c=Mr(a,i);if(!this._skipUTF8Validation&&!Qi(c)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(u);return}this._state===qr||this._allowSynchronousEvents?(this.emit("message",c,!1),this._state=he):(this._state=Gn,setImmediate(()=>{this.emit("message",c,!1),this._state=he,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Zi),this.end();else{let a=e.readUInt16BE(0);if(!Dx(a)){let u=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(u);return}let c=new Un(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Qi(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=he;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=he):(this._state=Gn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=he,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[Cx]=c,d}};ro.exports=Fr});var Hr=ce((Sh,oo)=>{"use strict";var{Duplex:vh}=X("stream"),{randomFillSync:Ix}=X("crypto"),so=mt(),{EMPTY_BUFFER:Tx,kWebSocket:Rx,NOOP:Nx}=Be(),{isBlob:_t,isValidStatusCode:Lx}=wt(),{mask:io,toBuffer:Qe}=Ft(),ge=Symbol("kByteLength"),Ox=Buffer.alloc(4),Kn=8*1024,et,yt=Kn,_e=0,Bx=1,Mx=2,Gr=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=_e,this.onerror=Nx,this[Rx]=void 0}static frame(e,i){let a,c=!1,u=2,d=!1;i.mask&&(a=i.maskBuffer||Ox,i.generateMask?i.generateMask(a):(yt===Kn&&(et===void 0&&(et=Buffer.alloc(Kn)),Ix(et,0,Kn),yt=0),a[0]=et[yt++],a[1]=et[yt++],a[2]=et[yt++],a[3]=et[yt++]),d=(a[0]|a[1]|a[2]|a[3])===0,u=6);let h;typeof e=="string"?(!i.mask||d)&&i[ge]!==void 0?h=i[ge]:(e=Buffer.from(e),h=e.length):(h=e.length,c=i.mask&&i.readOnly&&!d);let m=h;h>=65536?(u+=8,m=127):h>125&&(u+=2,m=126);let w=Buffer.allocUnsafe(c?h+u:u);return w[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(w[0]|=64),w[1]=m,m===126?w.writeUInt16BE(h,2):m===127&&(w[2]=w[3]=0,w.writeUIntBE(h,4,6)),i.mask?(w[1]|=128,w[u-4]=a[0],w[u-3]=a[1],w[u-2]=a[2],w[u-1]=a[3],d?[w,e]:c?(io(e,a,w,u,h),[w]):(io(e,a,e,0,h),[w,e])):[w,e]}close(e,i,a,c){let u;if(e===void 0)u=Tx;else{if(typeof e!="number"||!Lx(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 h=Buffer.byteLength(i);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");u=Buffer.allocUnsafe(2+h),u.writeUInt16BE(e,0),typeof i=="string"?u.write(i,2):u.set(i,2)}}let d={[ge]:u.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==_e?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):_t(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={[ge]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:u,rsv1:!1};_t(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==_e?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):_t(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={[ge]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:u,rsv1:!1};_t(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==_e?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}send(e,i,a){let c=this._extensions[so.extensionName],u=i.binary?2:1,d=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):_t(e)?(h=e.size,m=!1):(e=Qe(e),h=e.length,m=Qe.readOnly),this._firstFragment?(this._firstFragment=!1,d&&c&&c.params[c._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=h>=c._threshold),this._compress=d):(d=!1,u=0),i.fin&&(this._firstFragment=!0);let w={[ge]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:u,readOnly:m,rsv1:d};_t(e)?this._state!==_e?this.enqueue([this.getBlobData,e,this._compress,w,a]):this.getBlobData(e,this._compress,w,a):this._state!==_e?this.enqueue([this.dispatch,e,this._compress,w,a]):this.dispatch(e,this._compress,w,a)}getBlobData(e,i,a,c){this._bufferedBytes+=a[ge],this._state=Mx,e.arrayBuffer().then(u=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Kr,this,h,c);return}this._bufferedBytes-=a[ge];let d=Qe(u);i?this.dispatch(d,i,a,c):(this._state=_e,this.sendFrame(r.frame(d,a),c),this.dequeue())}).catch(u=>{process.nextTick(zx,this,u,c)})}dispatch(e,i,a,c){if(!i){this.sendFrame(r.frame(e,a),c);return}let u=this._extensions[so.extensionName];this._bufferedBytes+=a[ge],this._state=Bx,u.compress(e,a.fin,(d,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Kr(this,m,c);return}this._bufferedBytes-=a[ge],this._state=_e,a.readOnly=!1,this.sendFrame(r.frame(h,a),c),this.dequeue()})}dequeue(){for(;this._state===_e&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][ge],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][ge],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)}};oo.exports=Gr;function Kr(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 zx(r,e,i){Kr(r,e,i),r.onerror(e)}});var po=ce((Eh,go)=>{"use strict";var{kForOnEventAttribute:Gt,kListener:jr}=Be(),ao=Symbol("kCode"),co=Symbol("kData"),xo=Symbol("kError"),uo=Symbol("kMessage"),fo=Symbol("kReason"),bt=Symbol("kTarget"),lo=Symbol("kType"),ho=Symbol("kWasClean"),ze=class{constructor(e){this[bt]=null,this[lo]=e}get target(){return this[bt]}get type(){return this[lo]}};Object.defineProperty(ze.prototype,"target",{enumerable:!0});Object.defineProperty(ze.prototype,"type",{enumerable:!0});var nt=class extends ze{constructor(e,i={}){super(e),this[ao]=i.code===void 0?0:i.code,this[fo]=i.reason===void 0?"":i.reason,this[ho]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[ao]}get reason(){return this[fo]}get wasClean(){return this[ho]}};Object.defineProperty(nt.prototype,"code",{enumerable:!0});Object.defineProperty(nt.prototype,"reason",{enumerable:!0});Object.defineProperty(nt.prototype,"wasClean",{enumerable:!0});var vt=class extends ze{constructor(e,i={}){super(e),this[xo]=i.error===void 0?null:i.error,this[uo]=i.message===void 0?"":i.message}get error(){return this[xo]}get message(){return this[uo]}};Object.defineProperty(vt.prototype,"error",{enumerable:!0});Object.defineProperty(vt.prototype,"message",{enumerable:!0});var Kt=class extends ze{constructor(e,i={}){super(e),this[co]=i.data===void 0?null:i.data}get data(){return this[co]}};Object.defineProperty(Kt.prototype,"data",{enumerable:!0});var qx={addEventListener(r,e,i={}){for(let c of this.listeners(r))if(!i[Gt]&&c[jr]===e&&!c[Gt])return;let a;if(r==="message")a=function(u,d){let h=new Kt("message",{data:d?u:u.toString()});h[bt]=this,Hn(e,this,h)};else if(r==="close")a=function(u,d){let h=new nt("close",{code:u,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[bt]=this,Hn(e,this,h)};else if(r==="error")a=function(u){let d=new vt("error",{error:u,message:u.message});d[bt]=this,Hn(e,this,d)};else if(r==="open")a=function(){let u=new ze("open");u[bt]=this,Hn(e,this,u)};else return;a[Gt]=!!i[Gt],a[jr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[jr]===e&&!i[Gt]){this.removeListener(r,i);break}}};go.exports={CloseEvent:nt,ErrorEvent:vt,Event:ze,EventTarget:qx,MessageEvent:Kt};function Hn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var jn=ce((Ch,mo)=>{"use strict";var{tokenChars:Ht}=wt();function Pe(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function Fx(r){let e=Object.create(null),i=Object.create(null),a=!1,c=!1,u=!1,d,h,m=-1,w=-1,_=-1,y=0;for(;y<r.length;y++)if(w=r.charCodeAt(y),d===void 0)if(_===-1&&Ht[w]===1)m===-1&&(m=y);else if(y!==0&&(w===32||w===9))_===-1&&m!==-1&&(_=y);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);_===-1&&(_=y);let k=r.slice(m,_);w===44?(Pe(e,k,i),i=Object.create(null)):d=k,m=_=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(h===void 0)if(_===-1&&Ht[w]===1)m===-1&&(m=y);else if(w===32||w===9)_===-1&&m!==-1&&(_=y);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);_===-1&&(_=y),Pe(i,r.slice(m,_),!0),w===44&&(Pe(e,d,i),i=Object.create(null),d=void 0),m=_=-1}else if(w===61&&m!==-1&&_===-1)h=r.slice(m,y),m=_=-1;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(c){if(Ht[w]!==1)throw new SyntaxError(`Unexpected character at index ${y}`);m===-1?m=y:a||(a=!0),c=!1}else if(u)if(Ht[w]===1)m===-1&&(m=y);else if(w===34&&m!==-1)u=!1,_=y;else if(w===92)c=!0;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(w===34&&r.charCodeAt(y-1)===61)u=!0;else if(_===-1&&Ht[w]===1)m===-1&&(m=y);else if(m!==-1&&(w===32||w===9))_===-1&&(_=y);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);_===-1&&(_=y);let k=r.slice(m,_);a&&(k=k.replace(/\\/g,""),a=!1),Pe(i,h,k),w===44&&(Pe(e,d,i),i=Object.create(null),d=void 0),h=void 0,m=_=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(m===-1||u||w===32||w===9)throw new SyntaxError("Unexpected end of input");_===-1&&(_=y);let A=r.slice(m,_);return d===void 0?Pe(e,A,i):(h===void 0?Pe(i,A,!0):a?Pe(i,h,A.replace(/\\/g,"")):Pe(i,h,A),Pe(e,d,i)),e}function Ux(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(", ")}mo.exports={format:Ux,parse:Fx}});var Yn=ce((kh,Do)=>{"use strict";var Gx=X("events"),Kx=X("https"),Hx=X("http"),yo=X("net"),jx=X("tls"),{randomBytes:Wx,createHash:Jx}=X("crypto"),{Duplex:Ah,Readable:Ph}=X("stream"),{URL:Wr}=X("url"),Ve=mt(),Vx=Ur(),Yx=Hr(),{isBlob:$x}=wt(),{BINARY_TYPES:wo,CLOSE_TIMEOUT:Xx,EMPTY_BUFFER:Wn,GUID:Zx,kForOnEventAttribute:Jr,kListener:Qx,kStatusCode:eu,kWebSocket:ee,NOOP:bo}=Be(),{EventTarget:{addEventListener:tu,removeEventListener:nu}}=po(),{format:ru,parse:su}=jn(),{toBuffer:iu}=Ft(),vo=Symbol("kAborted"),Vr=[8,13],qe=["CONNECTING","OPEN","CLOSING","CLOSED"],ou=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,K=class r extends Gx{constructor(e,i,a){super(),this._binaryType=wo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Wn,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]),So(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){wo.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 Vx({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),u=new Yx(e,this._extensions,a.generateMask);this._receiver=c,this._sender=u,this._socket=e,c[ee]=this,u[ee]=this,e[ee]=this,c.on("conclude",xu),c.on("drain",uu),c.on("error",du),c.on("message",fu),c.on("ping",lu),c.on("pong",hu),u.onerror=gu,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",Ao),e.on("data",Vn),e.on("end",Po),e.on("error",ko),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[Ve.extensionName]&&this._extensions[Ve.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,i){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,i,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Co(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){Yr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Wn,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){Yr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Wn,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){Yr(this,e,a);return}let c={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[Ve.extensionName]||(c.compress=!1),this._sender.send(e||Wn,c,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(K,"CONNECTING",{enumerable:!0,value:qe.indexOf("CONNECTING")});Object.defineProperty(K.prototype,"CONNECTING",{enumerable:!0,value:qe.indexOf("CONNECTING")});Object.defineProperty(K,"OPEN",{enumerable:!0,value:qe.indexOf("OPEN")});Object.defineProperty(K.prototype,"OPEN",{enumerable:!0,value:qe.indexOf("OPEN")});Object.defineProperty(K,"CLOSING",{enumerable:!0,value:qe.indexOf("CLOSING")});Object.defineProperty(K.prototype,"CLOSING",{enumerable:!0,value:qe.indexOf("CLOSING")});Object.defineProperty(K,"CLOSED",{enumerable:!0,value:qe.indexOf("CLOSED")});Object.defineProperty(K.prototype,"CLOSED",{enumerable:!0,value:qe.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(K.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(K.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Jr])return e[Qx];return null},set(e){for(let i of this.listeners(r))if(i[Jr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Jr]:!0})}})});K.prototype.addEventListener=tu;K.prototype.removeEventListener=nu;Do.exports=K;function So(r,e,i,a){let c={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Xx,protocolVersion:Vr[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,!Vr.includes(c.protocolVersion))throw new RangeError(`Unsupported protocol version: ${c.protocolVersion} (supported versions: ${Vr.join(", ")})`);let u;if(e instanceof Wr)u=e;else try{u=new Wr(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:",h=u.protocol==="ws+unix:",m;if(u.protocol!=="ws:"&&!d&&!h?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!u.pathname?m="The URL's pathname is empty":u.hash&&(m="The URL contains a fragment identifier"),m){let R=new SyntaxError(m);if(r._redirects===0)throw R;Jn(r,R);return}let w=d?443:80,_=Wx(16).toString("base64"),y=d?Kx.request:Hx.request,A=new Set,k;if(c.createConnection=c.createConnection||(d?cu:au),c.defaultPort=c.defaultPort||w,c.port=u.port||w,c.host=u.hostname.startsWith("[")?u.hostname.slice(1,-1):u.hostname,c.headers={...c.headers,"Sec-WebSocket-Version":c.protocolVersion,"Sec-WebSocket-Key":_,Connection:"Upgrade",Upgrade:"websocket"},c.path=u.pathname+u.search,c.timeout=c.handshakeTimeout,c.perMessageDeflate&&(k=new Ve({...c.perMessageDeflate,isServer:!1,maxPayload:c.maxPayload}),c.headers["Sec-WebSocket-Extensions"]=ru({[Ve.extensionName]:k.offer()})),i.length){for(let R of i){if(typeof R!="string"||!ou.test(R)||A.has(R))throw new SyntaxError("An invalid or duplicated subprotocol was specified");A.add(R)}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}`),h){let R=c.path.split(":");c.socketPath=R[0],c.path=R[1]}let T;if(c.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=d,r._originalHostOrSocketPath=h?c.socketPath:u.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[q,oe]of Object.entries(R))a.headers[q.toLowerCase()]=oe}else if(r.listenerCount("redirect")===0){let R=h?r._originalIpc?c.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:u.host===r._originalHostOrSocketPath;(!R||r._originalSecure&&!d)&&(delete c.headers.authorization,delete c.headers.cookie,R||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=y(c),r._redirects&&r.emit("redirect",r.url,T)}else T=r._req=y(c);c.timeout&&T.on("timeout",()=>{fe(r,T,"Opening handshake has timed out")}),T.on("error",R=>{T===null||T[vo]||(T=r._req=null,Jn(r,R))}),T.on("response",R=>{let q=R.headers.location,oe=R.statusCode;if(q&&c.followRedirects&&oe>=300&&oe<400){if(++r._redirects>c.maxRedirects){fe(r,T,"Maximum redirects exceeded");return}T.abort();let te;try{te=new Wr(q,e)}catch{let xe=new SyntaxError(`Invalid URL: ${q}`);Jn(r,xe);return}So(r,te,i,a)}else r.emit("unexpected-response",T,R)||fe(r,T,`Unexpected server response: ${R.statusCode}`)}),T.on("upgrade",(R,q,oe)=>{if(r.emit("upgrade",R),r.readyState!==K.CONNECTING)return;T=r._req=null;let te=R.headers.upgrade;if(te===void 0||te.toLowerCase()!=="websocket"){fe(r,q,"Invalid Upgrade header");return}let ye=Jx("sha1").update(_+Zx).digest("base64");if(R.headers["sec-websocket-accept"]!==ye){fe(r,q,"Invalid Sec-WebSocket-Accept header");return}let xe=R.headers["sec-websocket-protocol"],P;if(xe!==void 0?A.size?A.has(xe)||(P="Server sent an invalid subprotocol"):P="Server sent a subprotocol but none was requested":A.size&&(P="Server sent no subprotocol"),P){fe(r,q,P);return}xe&&(r._protocol=xe);let F=R.headers["sec-websocket-extensions"];if(F!==void 0){if(!k){fe(r,q,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let J;try{J=su(F)}catch{fe(r,q,"Invalid Sec-WebSocket-Extensions header");return}let ne=Object.keys(J);if(ne.length!==1||ne[0]!==Ve.extensionName){fe(r,q,"Server indicated an extension that was not requested");return}try{k.accept(J[Ve.extensionName])}catch{fe(r,q,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[Ve.extensionName]=k}r.setSocket(q,oe,{allowSynchronousEvents:c.allowSynchronousEvents,generateMask:c.generateMask,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation})}),c.finishRequest?c.finishRequest(T,r):T.end()}function Jn(r,e){r._readyState=K.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function au(r){return r.path=r.socketPath,yo.connect(r)}function cu(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=yo.isIP(r.host)?"":r.host),jx.connect(r)}function fe(r,e,i){r._readyState=K.CLOSING;let a=new Error(i);Error.captureStackTrace(a,fe),e.setHeader?(e[vo]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Jn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Yr(r,e,i){if(e){let a=$x(e)?e.size:iu(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${qe[r.readyState]})`);process.nextTick(i,a)}}function xu(r,e){let i=this[ee];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[ee]!==void 0&&(i._socket.removeListener("data",Vn),process.nextTick(Eo,i._socket),r===1005?i.close():i.close(r,e))}function uu(){let r=this[ee];r.isPaused||r._socket.resume()}function du(r){let e=this[ee];e._socket[ee]!==void 0&&(e._socket.removeListener("data",Vn),process.nextTick(Eo,e._socket),e.close(r[eu])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function _o(){this[ee].emitClose()}function fu(r,e){this[ee].emit("message",r,e)}function lu(r){let e=this[ee];e._autoPong&&e.pong(r,!this._isServer,bo),e.emit("ping",r)}function hu(r){this[ee].emit("pong",r)}function Eo(r){r.resume()}function gu(r){let e=this[ee];e.readyState!==K.CLOSED&&(e.readyState===K.OPEN&&(e._readyState=K.CLOSING,Co(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Co(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Ao(){let r=this[ee];if(this.removeListener("close",Ao),this.removeListener("data",Vn),this.removeListener("end",Po),r._readyState=K.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[ee]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",_o),r._receiver.on("finish",_o))}function Vn(r){this[ee]._receiver.write(r)||this.pause()}function Po(){let r=this[ee];r._readyState=K.CLOSING,r._receiver.end(),this.end()}function ko(){let r=this[ee];this.removeListener("error",ko),this.on("error",bo),r&&(r._readyState=K.CLOSING,this.destroy())}});var No=ce((Ih,Ro)=>{"use strict";var Dh=Yn(),{Duplex:pu}=X("stream");function Io(r){r.emit("close")}function mu(){!this.destroyed&&this._writableState.finished&&this.destroy()}function To(r){this.removeListener("error",To),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function wu(r,e){let i=!0,a=new pu({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(u,d){let h=!d&&a._readableState.objectMode?u.toString():u;a.push(h)||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(Io,a);return}let d=!1;r.once("error",function(m){d=!0,u(m)}),r.once("close",function(){d||u(c),process.nextTick(Io,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",mu),a.on("error",To),a}Ro.exports=wu});var $r=ce((Th,Lo)=>{"use strict";var{tokenChars:_u}=wt();function yu(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&&_u[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 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 ${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}Lo.exports={parse:yu}});var Uo=ce((Nh,Fo)=>{"use strict";var bu=X("events"),$n=X("http"),{Duplex:Rh}=X("stream"),{createHash:vu}=X("crypto"),Oo=jn(),rt=mt(),Su=$r(),Eu=Yn(),{CLOSE_TIMEOUT:Cu,GUID:Au,kWebSocket:Pu}=Be(),ku=/^[+/0-9A-Za-z]{22}==$/,Bo=0,Mo=1,qo=2,Xr=class extends bu{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Cu,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Eu,...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,c)=>{let u=$n.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=Bo}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===qo){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!==Mo)if(this._state=Mo,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",zo);let u=e.headers["sec-websocket-key"],d=e.headers.upgrade,h=+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||!ku.test(u)){st(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==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 m=e.headers["sec-websocket-protocol"],w=new Set;if(m!==void 0)try{w=Su.parse(m)}catch{st(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let _=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&_!==void 0){let A=new rt({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let k=Oo.parse(_);k[rt.extensionName]&&(A.accept(k[rt.extensionName]),y[rt.extensionName]=A)}catch{st(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let A={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(A,(k,T,R,q)=>{if(!k)return Wt(i,T||401,R,q);this.completeUpgrade(y,u,w,e,i,a,c)});return}if(!this.options.verifyClient(A))return Wt(i,401)}this.completeUpgrade(y,u,w,e,i,a,c)}completeUpgrade(e,i,a,c,u,d,h){if(!u.readable||!u.writable)return u.destroy();if(u[Pu])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Bo)return Wt(u,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${vu("sha1").update(i+Au).digest("base64")}`],_=new this.options.WebSocket(null,void 0,this.options);if(a.size){let y=this.options.handleProtocols?this.options.handleProtocols(a,c):a.values().next().value;y&&(w.push(`Sec-WebSocket-Protocol: ${y}`),_._protocol=y)}if(e[rt.extensionName]){let y=e[rt.extensionName].params,A=Oo.format({[rt.extensionName]:[y]});w.push(`Sec-WebSocket-Extensions: ${A}`),_._extensions=e}this.emit("headers",w,c),u.write(w.concat(`\r
12
12
  `).join(`\r
13
- `)),c.removeListener("error",zo),b.setSocket(c,f,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(b),b.on("close",()=>{this.clients.delete(b),this._shouldEmitClose&&!this.clients.size&&process.nextTick(jt,this)})),l(b,x)}};Uo.exports=$r;function Du(n,e){for(let s of Object.keys(e))n.on(s,e[s]);return function(){for(let a of Object.keys(e))n.removeListener(a,e[a])}}function jt(n){n._state=qo,n.emit("close")}function zo(){this.destroy()}function Gt(n,e,s,a){s=s||Yn.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...a},n.once("finish",n.destroy),n.end(`HTTP/1.1 ${e} ${Yn.STATUS_CODES[e]}\r
14
- `+Object.keys(a).map(x=>`${x}: ${a[x]}`).join(`\r
13
+ `)),u.removeListener("error",zo),_.setSocket(u,d,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(_),_.on("close",()=>{this.clients.delete(_),this._shouldEmitClose&&!this.clients.size&&process.nextTick(jt,this)})),h(_,c)}};Fo.exports=Xr;function Du(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 jt(r){r._state=qo,r.emit("close")}function zo(){this.destroy()}function Wt(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(c=>`${c}: ${a[c]}`).join(`\r
15
15
  `)+`\r
16
16
  \r
17
- `+s)}function nt(n,e,s,a,x,c){if(n.listenerCount("wsClientError")){let f=new Error(x);Error.captureStackTrace(f,nt),n.emit("wsClientError",f,s,e)}else Gt(s,a,x,c)}});import{spawn as Vu}from"node:child_process";import{existsSync as Yu,openSync as Zu}from"node:fs";import{mkdir as $u}from"node:fs/promises";import{dirname as Xu}from"node:path";import{fileURLToPath as Qu}from"node:url";function ei(n=G()){return Yu(n.libEntry)?n.libEntry:Qu(new URL("../index.ts",import.meta.url))}async function ea(n={}){let e=n.paths??G(),s=n.entryOverride??ei(e);await $u(Xu(e.logFile),{recursive:!0});let a=Zu(e.logFile,"a"),c=s.endsWith(".ts")?["--import","tsx/esm",s,"--daemon"]:[s,"--daemon"],f=Vu(process.execPath,c,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(f.unref(),typeof f.pid!="number")throw new Error("failed to spawn daemon (no pid)");return ef.info("daemon spawned",{pid:f.pid,entry:s}),{pid:f.pid,entry:s}}var ef,ti=Pe(()=>{"use strict";F();ce();ef=R("spawn-daemon")});import{spawn as cf}from"node:child_process";import{mkdir as uf,unlink as ff,writeFile as df}from"node:fs/promises";import{dirname as lf,join as hf}from"node:path";function tr(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function sa(n,e){return new Promise((s,a)=>{let x=cf(n,e,{stdio:["ignore","pipe","pipe"]}),c="";x.stderr?.on("data",f=>{c+=f.toString("utf8")}),x.on("error",a),x.on("close",f=>{f===0?s():a(new Error(`${n} ${e.join(" ")} exited ${f}: ${c.trim()}`))})})}var er,ii,si,oa=Pe(()=>{"use strict";F();er=R("supervisor.launchd"),ii="ai.coze.bridge",si={platform:"darwin",renderConfig(n){return`<?xml version="1.0" encoding="UTF-8"?>
17
+ `+i)}function st(r,e,i,a,c,u){if(r.listenerCount("wsClientError")){let d=new Error(c);Error.captureStackTrace(d,st),r.emit("wsClientError",d,i,e)}else Wt(i,a,c,u)}});import{spawn as $u}from"node:child_process";import{existsSync as Xu,openSync as Zu}from"node:fs";import{mkdir as Qu}from"node:fs/promises";import{dirname as ed}from"node:path";import{fileURLToPath as td}from"node:url";function es(r=j()){return Xu(r.libEntry)?r.libEntry:td(new URL("../index.ts",import.meta.url))}async function ea(r={}){let e=r.paths??j(),i=r.entryOverride??es(e);await Qu(ed(e.logFile),{recursive:!0});let a=Zu(e.logFile,"a"),u=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],d=$u(process.execPath,u,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(d.unref(),typeof d.pid!="number")throw new Error("failed to spawn daemon (no pid)");return nd.info("daemon spawned",{pid:d.pid,entry:i}),{pid:d.pid,entry:i}}var nd,ts=Te(()=>{"use strict";G();ue();nd=N("spawn-daemon")});import{spawn as ud}from"node:child_process";import{mkdir as dd,unlink as fd,writeFile as ld}from"node:fs/promises";import{dirname as hd,join as gd}from"node:path";function nr(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ia(r,e){return new Promise((i,a)=>{let c=ud(r,e,{stdio:["ignore","pipe","pipe"]}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var tr,ss,is,oa=Te(()=>{"use strict";G();tr=N("supervisor.launchd"),ss="ai.coze.bridge",is={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>${ii}</string>
22
+ <string>${ss}</string>
23
23
  <key>ProgramArguments</key>
24
24
  <array>
25
- <string>${tr(n.nodeBin)}</string>
26
- <string>${tr(n.entry)}</string>
25
+ <string>${nr(r.nodeBin)}</string>
26
+ <string>${nr(r.entry)}</string>
27
27
  <string>--daemon</string>
28
28
  </array>
29
29
  <key>RunAtLoad</key>
@@ -33,65 +33,65 @@ var s0=Object.create;var wr=Object.defineProperty;var o0=Object.getOwnPropertyDe
33
33
  <key>ThrottleInterval</key>
34
34
  <integer>10</integer>
35
35
  <key>StandardOutPath</key>
36
- <string>${tr(n.logFile)}</string>
36
+ <string>${nr(r.logFile)}</string>
37
37
  <key>StandardErrorPath</key>
38
- <string>${tr(n.logFile)}</string>
38
+ <string>${nr(r.logFile)}</string>
39
39
  </dict>
40
40
  </plist>
41
- `},configPath(n){return hf(n.homeDir,"Library","LaunchAgents",`${ii}.plist`)},async install(n){let e=this.configPath(n);await uf(lf(e),{recursive:!0}),await df(e,this.renderConfig(n),"utf8"),er.info("plist written",{plistPath:e}),await sa("launchctl",["load","-w",e]),er.info("launchd job loaded",{label:ii})},async uninstall(n){let e=this.configPath(n);await sa("launchctl",["unload","-w",e]).catch(s=>er.warn("launchctl unload failed (ignored)",{err:String(s)})),await ff(e).catch(s=>{if(s.code!=="ENOENT")throw s}),er.info("launchd job removed",{plistPath:e})}}});import{spawn as gf}from"node:child_process";import{mkdir as pf,unlink as mf,writeFile as wf}from"node:fs/promises";import{dirname as _f,join as yf}from"node:path";function ir(n,e){return new Promise((s,a)=>{let x=gf(n,e,{stdio:["ignore","pipe","pipe"]}),c="";x.stderr?.on("data",f=>{c+=f.toString("utf8")}),x.on("error",a),x.on("close",f=>{f===0?s():a(new Error(`${n} ${e.join(" ")} exited ${f}: ${c.trim()}`))})})}var nr,rr,oi,aa=Pe(()=>{"use strict";F();nr=R("supervisor.systemd"),rr="coze-bridge.service",oi={platform:"linux",renderConfig(n){return`[Unit]
41
+ `},configPath(r){return gd(r.homeDir,"Library","LaunchAgents",`${ss}.plist`)},async install(r){let e=this.configPath(r);await dd(hd(e),{recursive:!0}),await ld(e,this.renderConfig(r),"utf8"),tr.info("plist written",{plistPath:e}),await ia("launchctl",["load","-w",e]),tr.info("launchd job loaded",{label:ss})},async uninstall(r){let e=this.configPath(r);await ia("launchctl",["unload","-w",e]).catch(i=>tr.warn("launchctl unload failed (ignored)",{err:String(i)})),await fd(e).catch(i=>{if(i.code!=="ENOENT")throw i}),tr.info("launchd job removed",{plistPath:e})}}});import{spawn as pd}from"node:child_process";import{mkdir as md,unlink as wd,writeFile as _d}from"node:fs/promises";import{dirname as yd,join as bd}from"node:path";function ir(r,e){return new Promise((i,a)=>{let c=pd(r,e,{stdio:["ignore","pipe","pipe"]}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var rr,sr,os,aa=Te(()=>{"use strict";G();rr=N("supervisor.systemd"),sr="coze-bridge.service",os={platform:"linux",renderConfig(r){return`[Unit]
42
42
  Description=Coze Bridge daemon
43
43
  After=network.target
44
44
 
45
45
  [Service]
46
46
  Type=simple
47
- ExecStart=${n.nodeBin} ${n.entry} --daemon
47
+ ExecStart=${r.nodeBin} ${r.entry} --daemon
48
48
  Restart=always
49
49
  RestartSec=3
50
- StandardOutput=append:${n.logFile}
51
- StandardError=append:${n.logFile}
50
+ StandardOutput=append:${r.logFile}
51
+ StandardError=append:${r.logFile}
52
52
 
53
53
  [Install]
54
54
  WantedBy=default.target
55
- `},configPath(n){return yf(n.homeDir,".config","systemd","user",rr)},async install(n){let e=this.configPath(n);await pf(_f(e),{recursive:!0}),await wf(e,this.renderConfig(n),"utf8"),nr.info("systemd unit written",{unitPath:e}),await ir("systemctl",["--user","daemon-reload"]),await ir("systemctl",["--user","enable","--now",rr]),nr.info("systemd unit enabled",{unitName:rr})},async uninstall(n){let e=this.configPath(n);await ir("systemctl",["--user","disable","--now",rr]).catch(s=>nr.warn("systemctl disable failed (ignored)",{err:String(s)})),await mf(e).catch(s=>{if(s.code!=="ENOENT")throw s}),await ir("systemctl",["--user","daemon-reload"]).catch(()=>{}),nr.info("systemd unit removed",{unitPath:e})}}});import{spawn as vf}from"node:child_process";import{join as bf}from"node:path";function xa(n,e){return new Promise((s,a)=>{let x=vf(n,e,{stdio:["ignore","pipe","pipe"],shell:!1}),c="";x.stderr?.on("data",f=>{c+=f.toString("utf8")}),x.on("error",a),x.on("close",f=>{f===0?s():a(new Error(`${n} ${e.join(" ")} exited ${f}: ${c.trim()}`))})})}var ai,sr,xi,ca=Pe(()=>{"use strict";F();ai=R("supervisor.taskscheduler"),sr="CozeBridge",xi={platform:"win32",renderConfig(n){return`<?xml version="1.0" encoding="UTF-16"?>
55
+ `},configPath(r){return bd(r.homeDir,".config","systemd","user",sr)},async install(r){let e=this.configPath(r);await md(yd(e),{recursive:!0}),await _d(e,this.renderConfig(r),"utf8"),rr.info("systemd unit written",{unitPath:e}),await ir("systemctl",["--user","daemon-reload"]),await ir("systemctl",["--user","enable","--now",sr]),rr.info("systemd unit enabled",{unitName:sr})},async uninstall(r){let e=this.configPath(r);await ir("systemctl",["--user","disable","--now",sr]).catch(i=>rr.warn("systemctl disable failed (ignored)",{err:String(i)})),await wd(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await ir("systemctl",["--user","daemon-reload"]).catch(()=>{}),rr.info("systemd unit removed",{unitPath:e})}}});import{spawn as vd}from"node:child_process";import{join as Sd}from"node:path";function ca(r,e){return new Promise((i,a)=>{let c=vd(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var as,or,cs,xa=Te(()=>{"use strict";G();as=N("supervisor.taskscheduler"),or="CozeBridge",cs={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>
59
59
  </RegistrationInfo>
60
60
  <Triggers>
61
61
  <LogonTrigger>
62
- <UserId>${n.userName}</UserId>
62
+ <UserId>${r.userName}</UserId>
63
63
  </LogonTrigger>
64
64
  </Triggers>
65
65
  <Principals>
66
66
  <Principal>
67
- <UserId>${n.userName}</UserId>
67
+ <UserId>${r.userName}</UserId>
68
68
  <LogonType>InteractiveToken</LogonType>
69
69
  <RunLevel>LeastPrivilege</RunLevel>
70
70
  </Principal>
71
71
  </Principals>
72
72
  <Actions>
73
73
  <Exec>
74
- <Command>${n.nodeBin}</Command>
75
- <Arguments>"${n.entry}" --daemon</Arguments>
74
+ <Command>${r.nodeBin}</Command>
75
+ <Arguments>"${r.entry}" --daemon</Arguments>
76
76
  </Exec>
77
77
  </Actions>
78
78
  </Task>
79
- `},configPath(n){return bf(n.homeDir,".coze","bridge","task.xml")},async install(n){let e=`"${n.nodeBin}" "${n.entry}" --daemon`;await xa("schtasks",["/Create","/SC","ONLOGON","/TN",sr,"/TR",e,"/RU",n.userName,"/F"]),ai.info("task scheduler entry created",{task:sr})},async uninstall(n){await xa("schtasks",["/Delete","/TN",sr,"/F"]).catch(e=>ai.warn("schtasks /Delete failed (ignored)",{err:String(e)})),ai.info("task scheduler entry removed",{task:sr})}}});var ci={};Li(ci,{buildContext:()=>Af,getSupervisor:()=>Cf,launchdSupervisor:()=>si,systemdSupervisor:()=>oi,taskSchedulerSupervisor:()=>xi});import{homedir as Sf,userInfo as Ef}from"node:os";function Cf(n=process.platform){switch(n){case"darwin":return si;case"linux":return oi;case"win32":return xi;default:throw new Error(`unsupported platform for OS supervisor: ${n}`)}}function Af(){let n=G();return{nodeBin:process.execPath,entry:ei(n),logFile:n.logFile,homeDir:Sf(),userName:Ef().username}}var ui=Pe(()=>{"use strict";ce();ti();oa();aa();ca()});Fe();F();import{readdir as A0}from"node:fs/promises";import{mkdir as v0,writeFile as b0}from"node:fs/promises";import{join as S0}from"node:path";var E0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function ct(n,e,s,a){await v0(n,{recursive:!0});let x=E0[e],c=S0(n,x),f=C0(e,s,a);return await b0(c,f,"utf8"),c}function C0(n,e,s){let a=`# Coze Agent: ${e}
79
+ `},configPath(r){return Sd(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await ca("schtasks",["/Create","/SC","ONLOGON","/TN",or,"/TR",e,"/RU",r.userName,"/F"]),as.info("task scheduler entry created",{task:or})},async uninstall(r){await ca("schtasks",["/Delete","/TN",or,"/F"]).catch(e=>as.warn("schtasks /Delete failed (ignored)",{err:String(e)})),as.info("task scheduler entry removed",{task:or})}}});var xs={};Ns(xs,{buildContext:()=>Pd,getSupervisor:()=>Ad,launchdSupervisor:()=>is,systemdSupervisor:()=>os,taskSchedulerSupervisor:()=>cs});import{homedir as Ed,userInfo as Cd}from"node:os";function Ad(r=process.platform){switch(r){case"darwin":return is;case"linux":return os;case"win32":return cs;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function Pd(){let r=j();return{nodeBin:process.execPath,entry:es(r),logFile:r.logFile,homeDir:Ed(),userName:Cd().username}}var us=Te(()=>{"use strict";ue();ts();oa();aa();xa()});Ke();G();import{readdir as A0}from"node:fs/promises";import{mkdir as b0,writeFile as v0}from"node:fs/promises";import{join as S0}from"node:path";var E0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function ut(r,e,i,a){await b0(r,{recursive:!0});let c=E0[e],u=S0(r,c),d=C0(e,i,a);return await v0(u,d,"utf8"),u}function C0(r,e,i){let a=`# Coze Agent: ${e}
80
80
 
81
- > framework: \`${n}\`
81
+ > framework: \`${r}\`
82
82
 
83
- `,x=s?.trim()?s.endsWith(`
84
- `)?s:`${s}
83
+ `,c=i?.trim()?i.endsWith(`
84
+ `)?i:`${i}
85
85
  `:`_No instructions provided._
86
86
  `;return`${a}---
87
87
 
88
- ${x}`}var be=R("agent-detail-sync"),rn=class{constructor(e){this.opts=e}opts;async syncAll(e){let s=this.opts.paths.agentsRoot,a;try{a=await A0(s)}catch(x){be.info("agents dir not found, skip detail sync",{root:s,err:String(x)});return}be.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(c){be.warn("detail sync failed for agent, skipping",{agentId:x,err:String(c)})}be.info("detail sync done",{reason:e})}async syncOne(e){let s=await ue(e,this.opts.paths);if(!s){be.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(f){be.warn("detail RPC failed, using local data",{agentId:e,err:String(f)});return}if(a.agentId&&a.agentId!==e){be.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,c=!1;if(a.agentName&&a.agentName!==s.agentName&&(s.agentName=a.agentName,x=!0),a.description!==void 0&&a.description!==s.description&&(s.description=a.description,x=!0),a.cozeIdentity&&a.cozeIdentity!==s.cozeIdentity&&(s.cozeIdentity=a.cozeIdentity,x=!0,c=!0),a.deployType&&be.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){be.debug("detail sync: no diff",{agentId:e});return}await me(s,this.opts.paths),be.info("detail sync: config updated",{agentId:e,identityChanged:c,agentName:s.agentName}),c&&(await ct(s.workspace,s.framework,e,s.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Fe();import{spawn as is}from"node:child_process";import{lstat as Er,mkdir as T0,readFile as ss,readdir as I0,rm as R0,stat as N0,writeFile as L0}from"node:fs/promises";import{join as Ne,normalize as O0,relative as os,resolve as B0,sep as as}from"node:path";var Se={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 Dt(n){return n?.cozeDeployType==="cloud"?"cloud":"local"}function Fi(n){let{_meta:e,...s}=n;return{stripped:s,meta:e}}function ut(n){if(!n?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return n.cozeAgentId}var C=class extends Error{code;retriable;cause;constructor(e,s,a){super(s),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};F();ce();function Re(n,e){if(Dt(n)!=="cloud")throw new C("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function kt(n){return n.replace(/[^A-Za-z0-9._-]+/g,"-")}F();var sn="1008033",Hi="1289";var Ki="pbbp2",ji="https://www.coze.cn",Gi="/api/coze_claw/resource/get_frontier_key",D0="https://www.coze.cn",k0="wss://frontier.coze.cn";function Wi(n){return n??process.env.COZE_BRIDGE_HANDSHAKE_URL??D0}function Ji(n){return n??process.env.COZE_BRIDGE_FRONTIER_URL??k0}function on(n){let e={},s=n?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=n?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return s&&(e["x-tt-env"]=s),a&&(e["x-use-ppe"]=a),e}function an(n){return n?n.startsWith("boe_")?{ttEnv:n}:{ttEnv:n,usePpe:"1"}:{}}var Vi=R("handshake");async function Yi(n){let e=Wi(n.endpoint),s=n.timeoutMs??1e4,a=`${P0(e)}${Gi}?aid=${encodeURIComponent(sn)}`,x={Authorization:`Bearer ${n.privatecode}`,Accept:"application/json",...on(n.ppeOverride)},c=new AbortController,f=setTimeout(()=>c.abort(),s);Vi.info("frontier key handshake",{base:e});try{let l=await fetch(a,{method:"GET",headers:x,signal:c.signal}),m=l.headers.get("x-tt-logid")??"",w=l.headers.get("x-tt-trace-id")??"";if(!l.ok){let k=await l.text().catch(()=>"");throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${l.status} logid=${m}: ${k.slice(0,200)}`)}let b=await l.json();if(b.code!==void 0&&b.code!==0)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${b.code} msg=${b.msg??"-"} logid=${m}`);let _=b.data?.access_key,S=b.data?.device_id;if(!_||!S)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(b)}`);return Vi.info("handshake ok",{remoteDeviceId:S,logid:m,traceId:w}),{accessKey:_,deviceId:S}}catch(l){throw l instanceof C?l:l.name==="AbortError"?new C("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${s}ms)`):new C("UPSTREAM_HANDSHAKE_FAILED",String(l),{cause:l})}finally{clearTimeout(f)}}function P0(n){return n.endsWith("/")?n.slice(0,-1):n}var vr="https://llm-gateway.coze.cn",He="auto";function Zi(n){return{model:n.model??He,...n.modelToken?{modelToken:n.modelToken}:{}}}function Pt(n){return!n||n===He}function $i(n){let e={};return n.modelToken?(e.ANTHROPIC_BASE_URL=vr,e.ANTHROPIC_AUTH_TOKEN=n.modelToken,e.ANTHROPIC_MODEL=n.model||He):Pt(n.model)||(e.ANTHROPIC_MODEL=n.model),e}function Xi(n){let e=[];return n.modelToken?e.push("-c",`model="${n.model||He}"`):Pt(n.model)||e.push("-c",`model="${n.model}"`),n.modelToken&&(e.push("-c",'model_providers.coze.name="coze"'),e.push("-c",`model_providers.coze.base_url="${vr}/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 Qi(n){return n.modelToken?{OPENAI_API_KEY:n.modelToken}:{}}function br(n){let{ttEnv:e,usePpe:s}=an(n),a={};return e&&(a["x-tt-env"]=e),s&&(a["x-use-ppe"]=s),a}function es(n,e){if(!n.modelToken)return{};let s=br(e);return Object.keys(s).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(s).map(([x,c])=>`${x}:${c}`).join(`
89
- `)}}function Sr(n){return`coze-session-${n.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function ts(n,e){if(!n.modelToken||Pt(n.model))return null;let s=br(e),a={baseUrl:`${vr}/v1`,api:"openai-completions",apiKey:n.modelToken,models:[{id:n.model,name:n.model,reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192,api:"openai-completions"}]};return Object.keys(s).length>0&&(a.headers=s),a}function ns(n,e){if(!n.modelToken)return[];let s=br(e),a=[];for(let[x,c]of Object.entries(s))a.push("-c",`model_providers.coze.http_headers.${x}="${c}"`);return a}var ne=R("agent-handlers"),rs=5*1024*1024,M0=1,z0=6,q0=new Set(["node_modules",".git",".coze","dist","build",".next"]),cn=class{constructor(e){this.opts=e}opts;async listSkills(e){Re(e._meta,"_agent/listSkills");let s=ut(e._meta),a=await this.loadAgentCfg(s),x=a?.workspace??Ie(s).workspace,c=a?.skills??[],f=[];for(let l of c){let m=Ne(x,l.relPath,"SKILL.md");await N0(m).then(b=>b.isFile()).catch(()=>!1)&&f.push({skillId:l.skillId,skillName:l.skillName,downloadUrl:l.downloadUrl??"",...l.description?{description:l.description}:{},...l.version?{version:l.version}:{}})}return{skills:f}}async addSkills(e){Re(e._meta,"_agent/addSkills");let s=ut(e._meta),a=await this.requireAgentCfg(s),x=e.skills??[],c=[...a.skills??[]],f=new Map(c.map((m,w)=>[m.skillId,w])),l=[];for(let m of x){if(!m.skillName)throw new C("IPC_BAD_REQUEST","skill missing skillName");let w=U0(m.skillName),b=F0(a.framework),_=Ne(b,w),S=Ne(a.workspace,_);await T0(S,{recursive:!0});let k=await j0(m.downloadUrl);W0(k)?await J0(k,S):await L0(Ne(S,"SKILL.md"),k.toString("utf8"),"utf8");let P={skillId:m.skillId,skillName:m.skillName,relPath:_,installedAt:Date.now(),...m.description?{description:m.description}:{},...m.version?{version:m.version}:{},...m.downloadUrl?{downloadUrl:m.downloadUrl}:{}},I=f.get(m.skillId);I!==void 0?c[I]=P:(f.set(m.skillId,c.length),c.push(P)),l.push(m),ne.info("skill installed",{agentId:s,skillId:m.skillId,skillName:m.skillName,relPath:_})}return await tn(s,c),await this.reloadAgentSessions(s,"skills-added"),{installedSkills:l}}async removeSkills(e){Re(e._meta,"_agent/removeSkills");let s=ut(e._meta),a=await this.requireAgentCfg(s),x=new Set(e.skillIds??[]),c=a.skills??[],f=[];for(let l of c){if(!x.has(l.skillId)){f.push(l);continue}let m=Ne(a.workspace,l.relPath);await R0(m,{recursive:!0,force:!0}),ne.info("skill removed",{agentId:s,skillId:l.skillId,relPath:l.relPath})}return await tn(s,f),await this.reloadAgentSessions(s,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,s){return this.reloadAgentSessions(e,s)}async reloadAgentSessions(e,s){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex"){for(let[x,c]of a.sessions)if(!(!c.downstream||!c.acpSessionId)){c.loadingSession=!0;try{await c.downstream.sessionLoad({sessionId:c.acpSessionId,cwd:a.workspace}),ne.info("session reloaded",{reason:s,agentId:e,framework:a.framework,cloudId:x,acpId:c.acpSessionId})}catch(f){ne.warn("session reload failed",{reason:s,agentId:e,framework:a.framework,cloudId:x,acpId:c.acpSessionId,err:String(f)})}finally{c.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return ne.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let s=e.agentId,a=await ue(s);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${s}`);return a.cozeIdentity===e.cozeIdentity?(ne.info("_agent/update: cozeIdentity unchanged, noop",{agentId:s}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await me(a),await ct(a.workspace,a.framework,s,e.cozeIdentity),ne.info("_agent/update: cozeIdentity rewritten",{agentId:s,framework:a.framework}),await this.reloadAgentSessions(s,"identity-changed"),{ok:!0})}async disconnectAgent(e){let s=e.agentId;if(!s)throw new C("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await ue(s);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await me(a),ne.info("agent disconnected",{agentId:s,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(s,e.reason??"disconnect"),{ok:!0}):(ne.warn("_agent/disconnect: agent not found, ignoring",{agentId:s}),{ok:!0})}async switchModel(e){if(Re(e._meta,"_agent/switchModel"),!e.agentId)throw new C("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let s=e.model?.trim()?e.model:He,a=await ue(e.agentId);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=s,await me(a),ne.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:s,reason:e.reason??""});let x=this.opts.agents.get(e.agentId);if(!x)return ne.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};x.model=s;let c=[];for(let[f,l]of x.allSessionQueues())c.push(l.enqueue(async()=>{let m=x.sessions.get(f);m?.downstream&&(await m.downstream.stop(`switchModel: ${s}`).catch(()=>{}),m.downstream=void 0)}));return await Promise.all(c),ne.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:s,cloudSessions:c.length}),{ok:!0}}async resetAgent(e){if(Re(e._meta,Se.RESET),!e.agentId)throw new C("IPC_BAD_REQUEST",`${Se.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,Se.RESET,e.reason),{ok:!0}}async repairAgent(e){if(Re(e._meta,Se.REPAIR),!e.agentId)throw new C("IPC_BAD_REQUEST",`${Se.REPAIR}: missing agentId`);let s=await this.loadAgentCfg(e.agentId);if(s&&s.framework!=="openclaw")throw new C("IPC_BAD_REQUEST",`${Se.REPAIR} only allowed for openclaw, got ${s.framework}`);if(s&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,s.workspace)}catch(a){ne.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(a)})}return await this.runDetailSync(e.agentId,Se.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,s,a){if(!this.opts.detailSyncer){ne.warn("detailSyncer not wired, skipping sync",{method:s,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(x){ne.warn("detail sync failed (ignored)",{method:s,agentId:e,reason:a,err:String(x)})}}async getFileTree(e){Re(e._meta,"_agent/getFileTree");let s=e._meta,a=ut(s),x=await this.resolveWorkspace(a),c=e.filePath??"",f=this.safeJoin(x,c),l=await Er(f).catch(()=>null);if(!l)throw new C("IPC_BAD_REQUEST",`path not found: ${c}`);if(l.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${c}`);let m=Y0(e.depth);return l.isDirectory()?{tree:await xs(x,f,c,m)}:{tree:[{name:Z0(c),path:cs(c||"."),isDir:!1,size:l.size,modifiedAt:Math.floor(l.mtimeMs)}]}}async getFileContent(e){Re(e._meta,"_agent/getFileContent");let s=ut(e._meta),a=await this.resolveWorkspace(s);if(!e.filePath)throw new C("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),c=await Er(x).catch(()=>null);if(!c||!c.isFile())throw new C("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(c.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(c.size>rs)throw new C("IPC_BAD_REQUEST",`file too large: ${c.size} bytes (max ${rs})`);let f=await ss(x);return f.includes(0)?{content:f.toString("base64"),encoding:"base64",size:c.size}:{content:f.toString("utf8"),encoding:"utf-8",size:c.size}}async resolveWorkspace(e){let s=this.opts.agents.get(e);return s?s.workspace:(await ue(e).catch(()=>null))?.workspace??Ie(e).workspace}safeJoin(e,s){let a=B0(e,s||"."),x=os(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${as}`))throw new C("IPC_BAD_REQUEST",`path escapes workspace: ${s}`);return a}loadAgentCfg(e){return ue(e)}async requireAgentCfg(e){let s=await this.loadAgentCfg(e);if(!s)throw new C("AGENT_NOT_FOUND",`no config for agent: ${e}`);return s}};function U0(n){let e=kt(n.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new C("IPC_BAD_REQUEST",`invalid skill name: ${n}`);return e}function F0(n){return n==="claude-code"?Ne(".claude","skills"):Ne(".agents","skills")}var H0=3e4,K0=50*1024*1024,un=3e4;async function j0(n){if(!n)throw new C("IPC_BAD_REQUEST","skill missing downloadUrl");if(n.startsWith("data:")){let e=Math.floor(n.length*3/4);xn(e);let s=G0(n);return xn(s.length),s}if(n.startsWith("file:")){let e=new URL(n).pathname,s=await ss(e);return xn(s.length),s}if(n.startsWith("http://")||n.startsWith("https://")){let e=new AbortController,s=setTimeout(()=>e.abort(),H0);try{let a=await fetch(n,{signal:e.signal});if(!a.ok)throw new C("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${n}`);let x=await a.arrayBuffer();return xn(x.byteLength),Buffer.from(x)}finally{clearTimeout(s)}}throw new C("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${n.slice(0,80)}`)}function xn(n){if(n>K0)throw new C("IPC_BAD_REQUEST",`skill too large: ${n} bytes`)}function G0(n){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(n);if(!e)throw new C("IPC_BAD_REQUEST","bad data URL");let s=!!e[2],a=e[3]??"";return s?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function W0(n){return n.length>=2&&n[0]===31&&n[1]===139}async function J0(n,e){await V0(n),await new Promise((s,a)=>{let x=is("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),c="";x.stderr?.on("data",l=>{c+=String(l)});let f=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar extract timeout (${un}ms)`))},un);x.on("error",l=>{clearTimeout(f),a(new C("IPC_BAD_REQUEST",`tar spawn failed: ${l.message}`,{cause:l}))}),x.on("exit",l=>{clearTimeout(f),l===0?s():a(new C("IPC_BAD_REQUEST",`tar exit ${l}${c?`: ${c.trim().slice(0,200)}`:""}`))}),x.stdin?.end(n)})}async function V0(n){let e=await new Promise((s,a)=>{let x=is("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),c="",f="";x.stdout?.on("data",m=>{c+=String(m)}),x.stderr?.on("data",m=>{f+=String(m)});let l=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar list timeout (${un}ms)`))},un);x.on("error",m=>{clearTimeout(l),a(new C("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),x.on("exit",m=>{clearTimeout(l),m===0?s(c):a(new C("IPC_BAD_REQUEST",`tar list exit ${m}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(n)});for(let s of e.split(`
90
- `)){let a=s.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 f=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!f)continue;if(f.startsWith("/"))throw new C("IPC_BAD_REQUEST",`tar entry absolute path: ${f}`);if(f.split(/[/\\]/).some(m=>m===".."))throw new C("IPC_BAD_REQUEST",`tar entry contains '..': ${f}`)}}async function xs(n,e,s,a){if(a<=0)return[];let x;try{x=await I0(e,{withFileTypes:!0})}catch{return[]}let c=[];for(let f of x){if(q0.has(f.name)||f.isSymbolicLink())continue;let l=Ne(e,f.name),m=O0(Ne(s,f.name)),w=null;try{w=await Er(l)}catch{continue}if(w.isSymbolicLink())continue;let b={name:f.name,path:cs(os(n,l)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&a>1&&(b.children=await xs(n,l,m,a-1)),c.push(b)}return c.sort((f,l)=>f.isDir!==l.isDir?f.isDir?-1:1:f.name.localeCompare(l.name)),c}function Y0(n){return!n||n<=0?M0:Math.min(n,z0)}function Z0(n){if(!n||n==="."||n==="/")return".";let e=n.split(/[/\\]/);return e[e.length-1]||"."}function cs(n){return n.split(as).join("/")}F();var Tt=R("agent-health-reporter"),$0=1e4,fn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??$0}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()}),Tt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Tt.info("heartbeat stopped"))}async tick(){if(this.inFlight){Tt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Tt.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let s=[];for(let x of this.opts.core.agents.values()){let c=X0(x);c&&s.push({agentId:x.agentId,status:c})}if(s.length===0)return;let a={agents:s,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(x){Tt.warn("heartbeat batch send failed",{count:s.length,err:String(x)})}}finally{this.inFlight=!1}}};function X0(n){return n.status==="error"?"error":n.activeTriggers.size>0?"busy":n.status==="ok"?"online":null}Fe();import{mkdir as Ar,rm as Ex}from"node:fs/promises";F();import{execFile as Q0}from"node:child_process";import{promisify as ex}from"node:util";var fs=ex(Q0),It=R("agents.acp-installer"),tx={"claude-code":{npmPackage:"@agentclientprotocol/claude-agent-acp",binary:"claude-agent-acp"},codex:{npmPackage:"@zed-industries/codex-acp",binary:"codex-acp"}},nx=5e4,rx=5e3,ix=5*6e4,ln=new Map,dn=new Map,Cr=new Map;async function us(n){let e=process.platform==="win32"?"where":"which";try{let{stdout:s}=await fs(e,[n],{timeout:rx});return s.split(`
91
- `)[0]?.trim()||void 0}catch{return}}async function sx(n){It.info("npm install -g start",{npmPackage:n}),await fs("npm",["install","-g",`${n}@latest`],{timeout:nx,maxBuffer:10*1024*1024}),It.info("npm install -g done",{npmPackage:n})}async function ds(n){let e=tx[n];if(!e)return;let s=ln.get(n);if(s)return s;let a=dn.get(n);if(a&&Date.now()-a<ix)return;let x=Cr.get(n);if(x)return x;let c=(async()=>{let f=await us(e.binary);if(f)return ln.set(n,f),It.info("acp wrapper found on PATH",{binary:e.binary,path:f}),f;try{await sx(e.npmPackage)}catch(m){It.warn("acp wrapper install failed (will fallback to npx)",{npmPackage:e.npmPackage,err:String(m)}),dn.set(n,Date.now());return}let l=await us(e.binary);if(!l){It.warn("acp wrapper installed but binary not found on PATH",{binary:e.binary}),dn.set(n,Date.now());return}return ln.set(n,l),dn.delete(n),l})().finally(()=>{Cr.delete(n)});return Cr.set(n,c),c}function hn(n){return ln.get(n)}import{spawn as ux}from"node:child_process";function Rt(n,e,s){return s===void 0?{jsonrpc:"2.0",id:n,method:e}:{jsonrpc:"2.0",id:n,method:e,params:s}}function gn(n,e){return e===void 0?{jsonrpc:"2.0",method:n}:{jsonrpc:"2.0",method:n,params:e}}function ft(n,e){return{jsonrpc:"2.0",id:n,result:e}}function Ye(n,e){return{jsonrpc:"2.0",id:n,error:e}}var pn=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)}},W={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 ls(n){return"method"in n&&"id"in n&&n.id!==void 0}function hs(n){return"method"in n&&!("id"in n)}function mn(n){return!("method"in n)&&"id"in n}var ox={AGENT_NOT_FOUND:W.AGENT_NOT_FOUND,AGENT_BUSY:W.AGENT_BUSY,AGENT_DISCONNECTED:W.AGENT_DISCONNECTED,AGENT_TIMEOUT:W.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:W.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:W.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:W.INTERNAL_ERROR,BRIDGE_INTERNAL:W.INTERNAL_ERROR,IPC_AUTH_FAILED:W.INTERNAL_ERROR,IPC_BAD_REQUEST:W.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:W.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:W.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:W.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:W.INTERNAL_ERROR};function wn(n){return n instanceof C?{code:ox[n.code]??W.INTERNAL_ERROR,message:n.message,data:{bridgeCode:n.code,retriable:n.retriable}}:{code:W.INTERNAL_ERROR,message:n instanceof Error?n.message:String(n)}}function gs(n){let e=n.data,s=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new C(s,n.message,{retriable:e?.retriable??!1,cause:n.data})}function ps(n){return`${JSON.stringify(n)}
92
- `}var _n=class{buffer="";onError;constructor(e={}){this.onError=e.onError}push(e){this.buffer+=typeof e=="string"?e:e.toString("utf8");let s=this.buffer.split(`
93
- `);this.buffer=s.pop()??"";let a=[];for(let x of s){let c=x.replace(/\r$/,"").trim();if(c)try{a.push(JSON.parse(c))}catch(f){this.onError?.({line:c,error:f})}}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(s){return this.onError?.({line:e,error:s}),[]}}};var ws={"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"},jd=Object.fromEntries(Object.entries(ws).map(([n,e])=>[e,n])),ax={"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:[]},dt=class{seq=0;next(e,s){this.seq+=1;let a=ws[e]??xx(e),x=ax[a]??[],c=[a,String(this.seq)];if(x.length>0){let f=x.map(m=>ms(s?.[m]??"")),l=cx(f).join(":");l&&c.push(l)}else s&&Object.values(s).some(f=>f)&&c.push(Object.values(s).filter(Boolean).map(f=>ms(String(f))).join(":"));return c.join("_")}reset(){this.seq=0}};function xx(n){return n.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function ms(n){return n.replace(/[:_\s]+/g,"-")}function cx(n){let e=n.length;for(;e>0&&!n[e-1];)e-=1;return n.slice(0,e)}F();var fx=3e4;function _s(n,e){if(!(typeof n!="number"||n<=0))try{process.platform==="win32"?process.kill(n,e):process.kill(-n,e)}catch{}}var Ke=class{constructor(e){this.opts=e;this.log=R(`downstream.${this.constructor.name}`),this.decoder=new _n({onError:s=>this.log.warn("decode line failed",{line:s.line})})}opts;child;decoder;pending=new Map;idAllocator=new dt;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",s=ux(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=s,s.stdout?.setEncoding("utf8"),s.stdout?.on("data",a=>{for(let x of this.decoder.push(a))this.dispatch(x)}),s.stderr?.setEncoding("utf8"),s.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),s.on("exit",(a,x)=>{this.stopped=!0,this.failAllPending(new C("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let c of this.exitHandlers)c(a,x)}),s.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:s.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 s=this.child,a=new Promise(c=>s.once("exit",()=>c()));_s(s.pid,"SIGTERM");let x=setTimeout(()=>{s.killed||_s(s.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(gn("session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,s){if(!(!this.child||this.stopped))try{this.writeFrame(ft(e,s))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,s){if(!(!this.child||this.stopped))try{this.writeFrame(Ye(e,s))}catch(a){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(a)})}}onExit(e){this.exitHandlers.push(e)}call(e,s,a=fx){if(!this.child||this.stopped)return Promise.reject(new C("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),c=Rt(x,e,s),f=a>0&&Number.isFinite(a);return new Promise((l,m)=>{let w=f?setTimeout(()=>{this.pending.delete(x),m(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:l,reject:m,timer:w,method:e});try{this.writeFrame(c)}catch(b){w&&clearTimeout(w),this.pending.delete(x),m(b)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new C("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(ps(e))}dispatch(e){if(mn(e)){let s=e.id!==null?this.pending.get(e.id):void 0;if(!s){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),s.timer&&clearTimeout(s.timer),e.error?s.reject(gs(e.error)):s.resolve(e.result);return}if(hs(e)){if(e.method==="session/update")for(let s of this.updateHandlers)Promise.resolve(s(e.params)).catch(a=>this.log.warn("update handler failed",{err:String(a)}));else this.log.debug("unknown notification",{method:e.method});return}if(ls(e)){let s=e;this.handleAgentRequest(s).catch(a=>this.log.error("agent request handler failed",{method:s.method,err:String(a)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(Ye(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let s of this.agentRequestHandlers)try{await s(e)}catch(a){this.log.error("agentRequestHandler threw",{method:e.method,err:String(a)});try{this.writeFrame(Ye(e.id,wn(a)))}catch{}}}failAllPending(e){for(let s of this.pending.values())s.timer&&clearTimeout(s.timer),s.reject(e);this.pending.clear()}};var dx="@agentclientprotocol/claude-agent-acp@latest";function lx(n){let e={};for(let[s,a]of Object.entries(n))a!==void 0&&(s.startsWith("CLAUDE")||s==="AI_AGENT"||s==="BAGGAGE"||(e[s]=a));return e}var yn=class extends Ke{framework="claude-code";constructor(e){let s=hn("claude-code"),[a,x]=s?[s,[]]:["npx",["-y",dx]],c=e.command??a,f=e.args??x,l={command:c,args:f,cwd:e.cwd,...e.env?{env:e.env}:{}};super(l)}sanitizeEnv(e){return lx(e)}};import{mkdtempSync as hx,rmSync as gx}from"node:fs";import{tmpdir as px}from"node:os";import{join as mx}from"node:path";var _x="@zed-industries/codex-acp@latest",vn=class extends Ke{framework="codex";authMethodId;codexHomeDir;constructor(e){let s=hn("codex"),[a,x]=s?[s,[]]:["npx",["-y",_x]],c=e.command??a,f=e.args??x,l=e.extraArgs?[...f,...e.extraArgs]:f,m=e.isolateCodexHome?hx(mx(px(),"coze-bridge-codex-home-")):void 0,w=m?{...e.env??{},CODEX_HOME:m}:e.env,b={command:c,args:l,cwd:e.cwd,...w?{env:w}:{}};super(b),this.authMethodId=e.authMethodId,this.codexHomeDir=m}async initialize(e){let s=await super.initialize(e);return this.authMethodId&&await this.call("authenticate",{methodId:this.authMethodId}),s}async stop(e){if(await super.stop(e),this.codexHomeDir)try{gx(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Nt=class extends Ke{framework="openclaw";agentId;sessionName;slashModelOnStart;constructor(e){let s=e.sessionName??"default",a=["acp","--session",`agent:${e.agentId}:${s}`];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=s,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}};F();ce();var lt=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((s,a)=>{this.slots.push({task:e,resolve:s,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 s=await e.task();e.resolve(s)}catch(s){e.reject(s)}}}finally{this.running=!1}}}};var bn=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 s=this.sessionQueues.get(e);return s||(s=new lt,this.sessionQueues.set(e,s)),s}allSessionQueues(){return this.sessionQueues.entries()}async dispose(e){this.status="stopped";let s=new Error(`AgentSession disposed${e?`: ${e}`:""}`);for(let a of this.sessionQueues.values())a.dispose(s);this.sessionQueues.clear(),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let s=[];for(let[,a]of this.sessions)Lt(a),a.downstream&&(s.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(s),this.activeTriggers.clear()}};function Lt(n){n.idleTimer&&(clearTimeout(n.idleTimer),n.idleTimer=void 0)}import{spawn as yx}from"node:child_process";import{homedir as vx}from"node:os";import{join as bx}from"node:path";$t();F();async function bs(){let n=bx(vx(),".openclaw/openclaw.json");return(await xt(n))?.gateway?.auth?.token??""}var ys=R("openclaw.config"),Sx=[0,5e3,5e3],vs="models.providers.",Sn="agents.defaults.models",En=class{command;env;retryDelaysMs;queue=new lt;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??Sx}async withRetry(e,s){let a;for(let x=0;x<this.retryDelaysMs.length;x++){let c=this.retryDelaysMs[x]??0;c>0&&await new Promise(f=>setTimeout(f,c));try{return await s()}catch(f){a=f,ys.warn("openclaw cli failed, will retry",{label:e,attempt:x+1,err:String(f)})}}throw new C("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${a?.message??"unknown"}`)}runCli(e){return new Promise((s,a)=>{let x=yx(this.command,e,{stdio:["ignore","pipe","pipe"],env:this.env}),c="";x.stderr?.on("data",f=>{c+=f.toString("utf8")}),x.on("error",a),x.on("close",f=>{f===0?s():a(new Error(`exit ${f}: ${c.trim().slice(0,500)}`))})})}async runCliTolerant(e,s){try{await this.runCli(e)}catch(a){let x=String(a);if(s.some(c=>x.includes(c)))return;throw a}}async bestEffortUnset(e,s){try{await this.queue.enqueue(()=>this.withRetry(e,()=>this.runCli(["config","unset",s])))}catch(a){ys.warn(`${e} failed (best-effort)`,{configPath:s,err:String(a)})}}ensureProvider(e,s){return this.queue.enqueue(()=>this.withRetry(`config set models.providers.${e}`,()=>this.runCli(["config","set",`${vs}${e}`,JSON.stringify(s),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${vs}${e}`)}addModelToAllowlist(e,s){let a={[e]:s?{alias:s}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${Sn}[${e}]`,()=>this.runCli(["config","set",Sn,JSON.stringify(a),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${Sn}[${e}]`,`${Sn}.${e}`)}ensureAgent(e,s,a){let x=["agents","add",e,"--workspace",s,"--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 Ze=R("agent-manager"),Cx=(n,e,s,a,x,c,f)=>{switch(n){case"claude-code":{let l=x?{...$i(x),...es(x,f)}:void 0;return new yn({cwd:s,...l&&Object.keys(l).length>0?{env:l}:{}})}case"codex":{let l=x?[...Xi(x),...ns(x,f)]:[],m=x?Qi(x):void 0,w=!!x;return new vn({cwd:s,...l.length>0?{extraArgs:l}:{},...m&&Object.keys(m).length>0?{env:m}:{},...w?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new Nt({command:e,cwd:s,agentId:a,...c?{sessionName:kt(c)}:{}})}};function Dr(n){return n==="claude-code"||n==="codex"}var Ax={path:"",version:"cloud-deployed"},Dx={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},kx=6e4,Cn=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??kx}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 En({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 s=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 C("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(S=>Ze.warn("dispose stale agent failed (ignored)",{err:String(S)})),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(!(s&&Dr(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`);s&&Dr(e.framework)&&await ds(e.framework);let c=Ie(e.agentId,this.paths),f=e.workspace??c.workspace,l=Dt(e._meta),m=new AbortController,w=setTimeout(()=>m.abort(new C("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),b,_=!1;try{let S=()=>{if(m.signal.aborted)throw m.signal.reason instanceof Error?m.signal.reason:new C("AGENT_TIMEOUT","_agent/create aborted")};await Ar(c.root,{recursive:!0}),await Ar(f,{recursive:!0}),await Ar(c.logs,{recursive:!0}),S(),await ct(f,e.framework,e.agentId,e.cozeIdentity),S();let k=await ue(e.agentId,this.paths).catch(()=>null),P=Zi({model:e.model??k?.model});if(b=new bn({agentId:e.agentId,framework:e.framework,workspace:f,model:P.model??He,deployType:l}),b.status="ok",k?.sessions){for(let[ie,Q]of Object.entries(k.sessions))b.sessions.set(ie,{acpSessionId:Q.acpSessionId,modelToken:Q.modelToken,tokenGeneratedAt:Q.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let z=Object.keys(k.sessions).length;z>0&&Ze.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:z})}this.registry.register(b),_=!0;let I={agentId:e.agentId,framework:e.framework,workspace:f,cozeIdentity:e.cozeIdentity,createdAt:k?.createdAt??Date.now(),sessions:k?.sessions??{},model:P.model};return l==="cloud"&&(I.deployType="cloud"),k?.skills&&(I.skills=k.skills),k?.agentName&&(I.agentName=k.agentName),k?.description&&(I.description=k.description),await me(I,this.paths),e.framework==="openclaw"&&await this.getOpenclawConfig().ensureAgent(e.agentId,f),Ze.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:l}),{ok:!0,agentId:e.agentId,workspace:f,framework:e.framework}}catch(S){throw Ze.error("agent create failed, rolling back",{agentId:e.agentId,err:String(S)}),_&&b&&(await b.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Ex(c.root,{recursive:!0,force:!0}).catch(k=>Ze.warn("rm agent dir failed (ignored)",{err:String(k)})),S instanceof C?S:new C("AGENT_SPAWN_FAILED",String(S),{cause:S})}finally{clearTimeout(w)}}async spawnSessionDownstream(e,s,a,x){let f=this.config.frameworksCache?.[e.framework];if(!f)if(e.deployType==="cloud"&&Dr(e.framework))f=Ax;else throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let l=e.deployType==="cloud"?{model:e.model,modelToken:s}:void 0,m;e.framework==="openclaw"?m=await this.buildOpenclawDownstream({session:e,modelConfig:l,cloudSessionId:a,cozeEnv:x,command:f.path}):m=this.factory(e.framework,f.path,e.workspace,e.agentId,l,a,x);try{return await m.start(),await m.initialize(Dx),m}catch(w){throw await m.stop("spawnSessionDownstream failed").catch(()=>{}),w instanceof C?w:new C("AGENT_SPAWN_FAILED",w instanceof Error?w.message:String(w),{cause:w})}}async buildOpenclawDownstream(e){let{session:s,modelConfig:a,cloudSessionId:x,cozeEnv:c,command:f}=e,l=kt(x),m=await bs(),w=a?.modelToken&&!Pt(a.model)?ts(a,c):null,b;if(w){let _=Sr(x),S=`${_}/${a.model}`;if(!this.ensuredProviders.has(S)){let k=this.getOpenclawConfig();await k.ensureProvider(_,w),await k.addModelToAllowlist(S),this.ensuredProviders.add(S)}b=S}return new Nt({command:f,cwd:s.workspace,agentId:s.agentId,sessionName:l,...m?{gatewayToken:m}:{},...b?{slashModelOnStart:b}:{}})}async openclawRepair(e,s){let a=this.getOpenclawConfig();await a.deleteAgent(e),await a.ensureAgent(e,s)}async cleanupOpenclawSessionProviders(e){if(e.framework!=="openclaw"||!this.openclawConfigCache)return;let s=this.openclawConfigCache;for(let a of e.sessions.keys()){let x=Sr(a),c=`${x}/${e.model}`;this.ensuredProviders.delete(c),await s.removeProvider(x),await s.removeModelFromAllowlist(c)}}};F();import{spawn as Px}from"node:child_process";import{constants as Ss,access as Tx}from"node:fs/promises";import{delimiter as Ix,join as Rx}from"node:path";var Nx=R("framework-detector"),Es={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Lx=[".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??Px,access:e.access??Tx}}async detect(e){let s=Es[e],a=await this.which(s);if(!a)return Nx.debug("framework binary not found",{framework:e,bin:s}),null;let x=await this.probeVersion(a);return{path:a,version:x}}async detectAll(){let e=await Promise.all(Object.keys(Es).map(async a=>[a,await this.detect(a)])),s={};for(let[a,x]of e)x&&(s[a]=x);return s}async which(e){let s=this.env.pathEnv.split(Ix).filter(Boolean),a=this.env.platform==="win32"?["",...Lx]:[""];for(let x of s)for(let c of a){let f=Rx(x,e+c);if(await this.isExecutable(f))return f}return null}async isExecutable(e){try{let s=this.env.platform==="win32"?Ss.F_OK:Ss.X_OK;return await this.env.access(e,s),!0}catch{return!1}}async probeVersion(e){return new Promise(s=>{let a="",x=!1,c,f=l=>{x||(x=!0,c&&clearTimeout(c),s(l.trim()||"unknown"))};try{let l=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});c=setTimeout(()=>{l.kill("SIGKILL"),f("unknown")},5e3),l.stdout?.on("data",m=>{a+=m.toString("utf8")}),l.on("error",()=>f("unknown")),l.on("close",()=>{let m=Bx(a).split(/\r?\n/)[0]??"";f(m)})}catch{f("unknown")}})}},Ox=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Bx(n){return n.replace(Ox,"")}$t();ce();var Mx=10*6e4;function Cs(n){let e=n?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?Mx:e}function An(n){return xt(n??G().configFile)}function Bt(n,e){return Zt(e??G().configFile,n)}import{randomBytes as zx}from"node:crypto";Fe();F();var U=R("core"),qx=3e4,Ux=3e4,Dn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new dt;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=Cs(e.bridgeConfig)}registerExtension(e,s){this.extensions[e]=s}getCozeEnv(){return this.currentCozeEnv}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),U.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){U.info("Core stopping",{reason:e}),await Promise.all([...this.agents.values()].map(s=>s.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),U.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let s of this.registerHandlers)try{s(e.agentId)}catch(a){U.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)&&U.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,s,a){let x=a.downstream;x&&(x.onUpdate(c=>{a.loadingSession||this.forwardUpdate(e,c)}),x.onAgentRequest(c=>{this.handleAgentRequest(e,x,c)}),x.onExit((c,f)=>{U.info("session runtime exited",{agentId:e.agentId,cloudId:s,code:c,signal:f}),Lt(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(mn(e)){this.handleUpstreamResponse(e);return}if(!("method"in e)||typeof e.method!="string")return;let s="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){s!==null?await this.sendError(s,W.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):U.warn("drop notification: extension not registered",{method:e.method});return}let c=await x(e,this);s!==null&&await this.upstream.send(ft(s,c));return}if(e.method.startsWith("session/")){let x=await this.routeSessionMethod(e);s!==null&&await this.upstream.send(ft(s,x));return}if(e.method==="initialize"){s!==null&&await this.upstream.send(ft(s,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}s!==null?await this.sendError(s,W.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):U.warn("drop unknown notification",{method:e.method})}catch(x){U.error("handleFrame failed",{method:e.method,err:String(x)}),s!==null&&await this.upstream.send(Ye(s,wn(x)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new C("IPC_BAD_REQUEST",`${e.method} requires params`);let s=e.params,a=s._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 c=typeof s.sessionId=="string"?s.sessionId:void 0;if(e.method==="session/cancel"||e.method==="session/new"||!c)return this.dispatchSessionCall(x,e.method,s);let f=Date.now(),l=!1;try{let m=await x.getSessionQueue(c).enqueue(()=>this.dispatchSessionCall(x,e.method,s));return l=!0,m}finally{U.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-f,ok:l})}}async dispatchSessionCall(e,s,a){e.lastActiveAt=Date.now();let{stripped:x}=Fi(a);switch(s){case"session/new":{let c=Fx();return U.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:c}),{sessionId:c}}case"session/load":{let c=x;return U.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:c.sessionId}),{}}case"session/prompt":{let c=x,f=c.sessionId;if(!f)throw new C("IPC_BAD_REQUEST","session/prompt: missing sessionId");let l=await this.ensureRuntime(e,f);if(l.replySeq=0,await this.ensureDownstream(e,f,l),!l.downstream||!l.acpSessionId)throw new C("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let m=a._meta?.cozeTriggerMsgId;m?e.activeTriggers.set(l.acpSessionId,m):e.activeTriggers.delete(l.acpSessionId);try{let w=await l.downstream.sessionPrompt({...c,sessionId:l.acpSessionId});return l.lastActiveAt=Date.now(),w}finally{e.activeTriggers.delete(l.acpSessionId),l.downstream?.isAlive()&&this.armIdleTimer(e,f,l)}}case"session/cancel":{let f=x.sessionId;if(!f)throw new C("IPC_BAD_REQUEST","session/cancel: missing sessionId");let l=e.sessions.get(f);return l?.downstream?.isAlive()&&l.acpSessionId&&await l.downstream.sessionCancel({sessionId:l.acpSessionId}),{ok:!0}}default:throw new C("IPC_BAD_REQUEST",`session method not supported: ${s}`)}}async ensureRuntime(e,s){let a=e.sessions.get(s);if(a)return a;let c={modelToken:e.deployType==="cloud"?await this.requestSessionToken(e.agentId,s):"",tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1,replySeq:0};return e.sessions.set(s,c),await this.persistSessionMapping(e),c}async requestSessionToken(e,s){let a={sessionId:s,_meta:{cozeAgentId:e}};try{let x=await this.sendRequest(Se.GEN_MODEL_TOKEN,a,Ux);if(!x?.modelToken)throw new C("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${s})`);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,s,a){if(Lt(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,s,this.currentCozeEnv);if(a.downstream=x,this.attachRuntimeHooks(e,s,a),a.acpSessionId){a.loadingSession=!0;try{await x.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),U.info("session restored via session/load",{agentId:e.agentId,cloudId:s,acpId:a.acpSessionId})}catch(c){U.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:s,acpId:a.acpSessionId,err:String(c)}),a.acpSessionId=void 0;let f=await x.sessionNew({cwd:e.workspace});a.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let c=await x.sessionNew({cwd:e.workspace});a.acpSessionId=c.sessionId,await this.persistSessionMapping(e)}x.afterSessionEstablished&&a.acpSessionId&&await x.afterSessionEstablished(a.acpSessionId)}armIdleTimer(e,s,a){if(Lt(a),this.isRuntimeBusy(e,a)){U.debug("skip idle timer: runtime busy (in-flight turn / pending permission)",{agentId:e.agentId,cloudId:s});return}a.idleTimer=setTimeout(()=>{if(a.idleTimer=void 0,this.isRuntimeBusy(e,a)){U.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:s}),this.armIdleTimer(e,s,a);return}U.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:s});let x=a.downstream;a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),x&&x.stop("idle timeout").catch(c=>U.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:s,err:String(c)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}isRuntimeBusy(e,s){if(s.acpSessionId&&e.activeTriggers.has(s.acpSessionId))return!0;let a=s.downstream;if(!a)return!1;for(let x of this.pendingUpstream.values())if(x.downstream===a)return!0;return!1}forwardUpdate(e,s){let a=s.sessionId,x=this.reverseSessionId(e,a);if(!x){U.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let c=e.sessions.get(x);if(!c){U.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:x});return}let f={cozeAgentId:e.agentId,cozeReplySeqID:++c.replySeq},l=e.activeTriggers.get(a);l&&(f.cozeTriggerMsgId=l),this.upstream.send(gn("session/update",{...s,sessionId:x,_meta:f})).catch(m=>U.warn("forward update failed",{agentId:e.agentId,err:String(m)}))}handleAgentRequest(e,s,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,s,a);return}U.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),s.respondAgentRequestError(a.id,{code:W.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}forwardPermissionRequest(e,s,a){let x=this.upstreamIds.next("session/request_permission"),c=a.params??{},l=c.sessionId,m=l?e.activeTriggers.get(l):void 0,w={cozeAgentId:e.agentId};m&&(w.cozeTriggerMsgId=m);let b=l?this.reverseSessionId(e,l):void 0,_={...c,...b?{sessionId:b}:{},_meta:w};this.pendingUpstream.set(x,{agentRequestId:a.id,agentId:e.agentId,downstream:s,method:a.method}),this.upstream.send(Rt(x,"session/request_permission",_)).catch(S=>{this.pendingUpstream.delete(x),U.error("forward permission request failed",{agentId:e.agentId,err:String(S)}),s.respondAgentRequestError(a.id,{code:W.INTERNAL_ERROR,message:`upstream send failed: ${String(S)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let s=this.pendingUpstream.get(e.id);if(s){this.pendingUpstream.delete(e.id),e.error?s.downstream.respondAgentRequestError(s.agentRequestId,e.error):s.downstream.respondAgentRequest(s.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 pn(e.error)):a.resolve(e.result);return}U.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,s,a=qx){let x=this.upstreamIds.next(e);return new Promise((c,f)=>{let l=setTimeout(()=>{this.pendingBridge.delete(x),f(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:c,reject:f,timer:l}),this.upstream.send(Rt(x,e,s)).catch(m=>{let w=this.pendingBridge.get(x);w&&(clearTimeout(w.timer),this.pendingBridge.delete(x)),f(m)})})}async persistSessionMapping(e){if(this.paths)try{let s=new Map;for(let[a,x]of e.sessions){let c={modelToken:x.modelToken,tokenGeneratedAt:x.tokenGeneratedAt};x.acpSessionId&&(c.acpSessionId=x.acpSessionId),s.set(a,c)}await yr(e.agentId,s,this.paths)}catch(s){U.warn("persist session mapping failed",{agentId:e.agentId,err:String(s)})}}reverseSessionId(e,s){for(let[a,x]of e.sessions.entries())if(x.acpSessionId===s)return a}sendError(e,s,a){return this.upstream.send(Ye(e,{code:s,message:a}))}};function Fx(){return zx(16).toString("hex")}F();ce();import{randomBytes as Hx}from"node:crypto";import{chmod as Kx,mkdir as jx,writeFile as As}from"node:fs/promises";import{createServer as Gx}from"node:http";import{dirname as Wx}from"node:path";var Jx=1e6,kr=R("ipc"),kn=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(s=>[`${s.method} ${s.path}`,s])),this.paths=e.paths??G()}async start(){this.token=Hx(32).toString("hex");let e=Gx((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 s=e.address();if(!s||typeof s!="object")throw new Error("failed to obtain IPC port");return this.port=s.port,await this.persistAuthFiles(),kr.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((s,a)=>{e.close(x=>x?a(x):s())}),this.server=null)}async persistAuthFiles(){await jx(Wx(this.paths.portFile),{recursive:!0}),await As(this.paths.portFile,String(this.port),"utf8"),await As(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await Kx(this.paths.tokenFile,384)}catch(e){kr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,s){if(e.headers.authorization!==`Bearer ${this.token}`){Mt(s,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,c=this.routes.get(x);if(!c){Mt(s,404,{error:"not found"});return}let f=null;if(e.method==="POST")try{f=await Vx(e)}catch(l){Mt(s,400,{error:"invalid json",detail:String(l)});return}try{let l=await c.handler(f,e);Mt(s,200,l??{ok:!0})}catch(l){kr.error("IPC handler failed",{key:x,err:String(l)}),Mt(s,500,{error:l instanceof Error?l.message:String(l)})}}};function Mt(n,e,s){n.statusCode=e,n.setHeader("content-type","application/json"),n.end(JSON.stringify(s))}async function Vx(n){let e=[],s=0;for await(let x of n){let c=x;if(s+=c.length,s>Jx)throw new Error("body too large");e.push(c)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Jo=Te(Ms(),1);var ku=Te(No(),1),Pu=Te(jn(),1),Tu=Te(pt(),1),Iu=Te(Fr(),1),Ru=Te(jr(),1),Nu=Te(Zr(),1),Ho=Te(Vn(),1),Lu=Te(Fo(),1);var Ko=Ho.default;F();var re=R("upstream.frontier"),Go="application/json",Wo="none",Zn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){re.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:ji,...on(this.opts.ppeOverride)};class s extends Ko{constructor(l){super(l,Ki,{headers:e})}send(l,...m){if(qi("debug"))try{let w;typeof l=="string"?w=Buffer.from(l,"utf8"):l instanceof Buffer?w=l:l instanceof ArrayBuffer?w=new Uint8Array(l):ArrayBuffer.isView(l)?w=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):w=new Uint8Array(0);let b=Buffer.from(w.slice(0,128)).toString("hex");re.debug("WS raw frame out",{bytes:w.byteLength,headHex:b})}catch(w){re.warn("WS raw frame dump failed",{err:String(w)})}super.send(l,...m)}}let a=Ji(this.opts.urlOverride),x={url:a,ws:s,fpID:Hi,aID:sn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:Go,force:!0},payloadEncoding:{encoding:Wo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},c=new Jo.FWS(x);c.onopen=()=>{this.opened=!0,this.openCount+=1;let f=this.openCount===1;re.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:f,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:f})).catch(l=>re.warn("onConnect handler threw (ignored)",{err:String(l)}))},c.onclose=f=>{this.opened=!1,re.info("frontier closed",{code:f.code,reason:f.reason,willReconnect:f.willReconnect})},c.onerror=f=>{re.warn("frontier error",{code:f.code,msg:f.message})},c.onmessage=f=>this.handleMessage(f),this.fws=c,await c.connect()}async stop(e){let s=this.fws;if(s){this.fws=null,this.opened=!1;try{s.close(1e3,e??"bridge shutdown")}catch(a){re.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let s=this.fws;if(!s)throw new C("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;re.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await s.send(a,{service:33555712,method:1,payloadType:Go,payloadEncoding:Wo})}catch(c){throw new C("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(c)}`,{cause:c})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let s=e.message?.service;if(s!==33555712){re.debug("drop non-adapter frontier frame",{service:s});return}let a=Mu(e);if(!a){re.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){re.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(c){re.warn("frontier message JSON parse failed",{err:String(c),head:a.slice(0,80)});return}re.info("frontier frame in",{logid:Bu(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(c=>re.warn("frontier frame handler threw",{err:String(c)}))}};function Bu(n){return n?n.high===0?String(n.low>>>0):`${n.high.toString(16)}${(n.low>>>0).toString(16).padStart(8,"0")}`:""}function Mu(n){let e=n.message;if(e?.textPayload)return e.textPayload;let s=e?.payload;if(!s)return null;try{return Buffer.from(s).toString("utf8")}catch{return null}}F();var Xr=R("upstream.switchable"),$n=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,s){if(this.inner===e)return;Xr.info("swap upstream",{reason:s});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 Xr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(s??"swapped").catch(x=>Xr.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()}};F();var Qr=R("upstream"),Wt=class{handler=null;async start(){Qr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Qr.info("NoopUpstream stopped",{reason:e})}async send(e){Qr.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)}};F();ce();F();ce();import{execSync as zu}from"node:child_process";import{readFileSync as Vo,unlinkSync as qu}from"node:fs";import{mkdir as Uu,readFile as Yo,unlink as Zo,writeFile as Fu}from"node:fs/promises";import{dirname as Hu}from"node:path";var Ku=R("single-instance"),Xn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??G().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&&(Ku.warn("removing stale pid file",{stalePid:e}),await Zo(this.pidFile).catch(()=>{})),await Uu(Hu(this.pidFile),{recursive:!0}),await Fu(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Yo(this.pidFile,"utf8")).trim()===String(process.pid)&&await Zo(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Yo(this.pidFile,"utf8"),s=Number.parseInt(e.trim(),10);return Number.isFinite(s)&&s>0?s:null}catch(e){if(e.code==="ENOENT")return null;throw e}}isAlive(e){try{process.kill(e,0)}catch(s){return s.code==="EPERM"}return this.matchesDaemonTitle(e)}matchesDaemonTitle(e){try{let s=Vo(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(s.includes("coze-bridge-daemon")||s.includes("lib/index.js"))}catch{}try{let s=zu(`ps -o command= -p ${e}`,{stdio:["ignore","pipe","ignore"],timeout:1e3}).toString();return s.trim()?s.includes("coze-bridge-daemon")||s.includes("lib/index.js"):!1}catch{return!0}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Vo(this.pidFile,"utf8").trim()===String(process.pid)&&qu(this.pidFile)}catch{}})}};var B=R("daemon"),ju="coze-bridge-daemon";async function Qo(){let n=new Xn({processTitle:ju}),e=await n.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let s=await An(),a=s??{};_r({pid:process.pid}),B.info(s?"loaded bridge config":"initialized bridge config");try{let D=new Ot;a.frameworksCache=await D.detectAll(),B.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(D){B.warn("framework detection failed",{err:String(D)})}await Bt(a);let x=new $n(new Wt),c=G(),f=null,l=new Dn({upstream:x,paths:c,bridgeConfig:a,sessionSpawner:async(D,q,J,ee)=>{if(!f)throw new Error("agentManager not ready");return f.spawnSessionDownstream(D,q,J,ee)}});await Wu(c,l);let m=new Cn({paths:c,config:a,registry:l});f=m;let w,b,_=null,S=null;l.registerExtension("_agent/create",async D=>m.createAgent(D.params)),l.registerExtension("_agent/health",async()=>({ok:!0}));let k={},P=new cn({agents:l.agents,disposeAndMarkDisconnected:async(D,q)=>{let J=l.agents.get(D);J&&(await m.cleanupOpenclawSessionProviders(J).catch(ee=>B.warn("cleanup openclaw providers failed (ignored)",{agentId:D,err:String(ee)})),await J.dispose(`disconnect: ${q}`).catch(ee=>B.warn("dispose during disconnect failed (ignored)",{agentId:D,err:String(ee)})),J.status="disconnected",l.unregister(D)),l.disconnectedAgents.add(D)},detailSyncer:async D=>{if(!k.ref)throw new Error("agent-detail-sync not initialized yet");await k.ref.syncOne(D)},openclawRepair:async(D,q)=>{await m.openclawRepair(D,q)}});l.registerExtension("_agent/listSkills",D=>P.listSkills(D.params)),l.registerExtension("_agent/addSkills",D=>P.addSkills(D.params)),l.registerExtension("_agent/removeSkills",D=>P.removeSkills(D.params)),l.registerExtension("_agent/getFileTree",D=>P.getFileTree(D.params)),l.registerExtension("_agent/getFileContent",D=>P.getFileContent(D.params)),l.registerExtension("_agent/update",D=>P.updateAgent(D.params)),l.registerExtension("_agent/disconnect",D=>P.disconnectAgent(D.params)),l.registerExtension("_agent/switchModel",D=>P.switchModel(D.params)),l.registerExtension("_agent/reset",D=>P.resetAgent(D.params)),l.registerExtension("_agent/repair",D=>P.repairAgent(D.params));let I=new rn({paths:c,handlers:P,sendDetail:D=>l.sendRequest("_agent/detail",D)});k.ref=I,x.onConnect(({initial:D})=>{B.info("frontier upstream connected, triggering detail sync",{initial:D}),I.syncAll(D?"initial-connect":"reconnect").catch(q=>B.warn("detail sync top-level error (ignored)",{err:String(q)}))});let z=new kn({paths:c,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...l.agents.keys()],deviceId:_??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async D=>{let q=D,J=q?.privatecode,ee=q?.pairing_code;if(!J||!ee)throw new C("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let De=an(q.env),ge=q.handshake_url,Je=q.frontier_url,St=Gu(q.env,ge,Je),Jt=!!w&&w!==J,ye=b!==void 0&&b!==St,ve=Jt||ye;if(ve){B.warn("pair config switched, resetting agents",{pcChanged:Jt,envChanged:ye,previousPc:w?$o(w):"",nextPc:$o(J),previousEnvKey:b??"",nextEnvKey:St});for(let K of[...l.agents.values()])await K.dispose("pair config switch").catch(()=>{}),l.agents.delete(K.agentId);await x.swap(new Wt,"pair switch").catch(()=>{})}let Vt=await Yi({privatecode:J,...ge?{endpoint:ge}:{},ppeOverride:De});_=Vt.deviceId,_r({deviceId:_,pid:process.pid});let se=new Zn({handshake:Vt,privatecode:J,...Je?{urlOverride:Je}:{},ppeOverride:De});await x.swap(se,"pair");let Yt=Object.keys(a.frameworksCache??{});try{let K=await l.sendRequest("_agent/pair",{pairCode:ee,patToken:J,frameworks:Yt,_meta:{cozeDeviceId:_}});B.info("_agent/pair ok",{pairResult:K}),w=J,b=St,S||(S=new fn({core:l,getDeviceId:()=>_??""})),S.start(),ve&&Xo(c,m).catch(ke=>B.warn("post-pair-switch auto-revive error (ignored)",{err:String(ke)}));let V;return q.agent_id&&(V=await Ju(q.agent_id,c,m,ke=>l.sendRequest("_agent/detail",ke)).catch(ke=>(B.error("--agent-id ensureAgent failed",{agentId:q.agent_id,err:String(ke)}),{ok:!1,agentId:q.agent_id??"",note:String(ke)}))),{ok:!0,note:"paired with cloud",...V?{agent:V}:{}}}catch(K){return B.error("_agent/pair failed",{err:String(K)}),{ok:!1,note:`pair failed: ${String(K)}`}}}},{method:"POST",path:"/_agent/create",handler:async D=>{let q=D;return{ok:!0,result:await m.createAgent(q)}}},{method:"POST",path:"/refresh",handler:async()=>{B.info("IPC /refresh: re-detecting frameworks");let D=new Ot;return a.frameworksCache=await D.detectAll(),await Bt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(B.info("IPC /shutdown received"),setImmediate(()=>{ae.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:ie,token:Q}=await z.start();await l.start(),Xo(c,m).catch(D=>B.warn("auto-revive top-level error (ignored)",{err:String(D)}));let _e=null,ae={port:ie,token:Q,core:l,ipc:z,shutdown(D){return _e||(B.info("daemon shutdown",{reason:D}),_e=(async()=>{S?.stop(),await l.stop(D),await z.stop(),await n.release()})(),_e)}};for(let D of["SIGTERM","SIGINT"])process.on(D,()=>{ae.shutdown(D).then(()=>process.exit(0))});return B.info("daemon ready",{port:ie,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),ae}function $o(n){return n.length<=8?"***":`${n.slice(0,4)}***${n.slice(-4)}`}function Gu(n,e,s){return`${n??""}|${e??""}|${s??""}`}async function Wu(n,e){let{readdir:s}=await import("node:fs/promises"),a;try{a=await s(n.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:c}=await Promise.resolve().then(()=>(Fe(),nn));for(let f of a){await c(f,n).catch(l=>B.warn("enforceAgentConfigMode failed (ignored)",{agentId:f,err:String(l)}));try{let l=await x(f,n);l?.disconnectedAt&&(e.disconnectedAgents.add(f),B.info("agent marked disconnected on startup",{agentId:f,disconnectedAt:l.disconnectedAt,reason:l.disconnectReason??""}))}catch(l){B.warn("failed to load agent config on startup, skipping",{agentId:f,err:String(l)})}}}async function Ju(n,e,s,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Fe(),nn)),c=await x(n,e);if(c){B.info("--agent-id: local config found, reconnecting",{agentId:n,framework:c.framework,hadDisconnect:!!c.disconnectedAt});let w={agentId:c.agentId,framework:c.framework,...c.cozeIdentity?{cozeIdentity:c.cozeIdentity}:{},...c.model?{model:c.model}:{}};return await s.createAgent(w),{ok:!0,agentId:n,note:c.disconnectedAt?"revived from local config":"connected from local config"}}B.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:n});let f=await a({_meta:{cozeAgentId:n}});if(!f.framework)throw new C("AGENT_NOT_FOUND",`agent ${n} \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:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{},...f.deployType?{_meta:{cozeDeployType:f.deployType}}:{}};await s.createAgent(l);let m=f.deployType==="cloud"&&f.framework==="openclaw";return{ok:!0,agentId:n,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function Xo(n,e){let{readdir:s}=await import("node:fs/promises"),a;try{a=await s(n.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(()=>(Fe(),nn));B.info("auto-revive: scanning local agents on startup",{count:a.length});let c=0,f=0;for(let l of a){let m;try{m=await x(l,n)}catch(w){B.warn("auto-revive: load config failed (skipping)",{agentId:l,err:String(w)}),f+=1;continue}if(!m){f+=1;continue}if(m.disconnectedAt){B.info("auto-revive: skip disconnected agent",{agentId:l,disconnectedAt:m.disconnectedAt}),f+=1;continue}try{B.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:l,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}}:{}}),c+=1}catch(w){B.warn("auto-revive: createAgent failed (skipping)",{agentId:l,framework:m.framework,err:String(w)}),f+=1}}return B.info("auto-revive: done",{revived:c,skipped:f,total:a.length}),{revived:c,skipped:f,total:a.length}}ti();ce();import{readFile as ta}from"node:fs/promises";var We=class{paths;constructor(e){this.paths=e??G()}async probe(e=1e3){let s=await this.readAuth();if(!s)return{kind:"not-running"};try{let a=await this.fetch(s,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...s}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:nf(a)}}}async request(e){let s=await this.readAuth();if(!s)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(s,e)}async readAuth(){try{let[e,s]=await Promise.all([ta(this.paths.portFile,"utf8"),ta(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=s.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,s){let a=s.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let c=new AbortController,f=setTimeout(()=>c.abort(),s.timeoutMs??5e3);try{let l=await fetch(`http://127.0.0.1:${e.port}${s.path}`,{method:s.method,headers:x,body:a?JSON.stringify(s.body):void 0,signal:c.signal}),m=await l.text();return{status:l.status,body:tf(m)}}finally{clearTimeout(f)}}};function tf(n){if(!n)return null;try{return JSON.parse(n)}catch{return n}}function nf(n){return n instanceof Error?n.message:String(n)}F();ce();import{copyFile as na,mkdir as rf,readFile as ni,writeFile as sf}from"node:fs/promises";import{dirname as of,resolve as ri,sep as Qn}from"node:path";import{fileURLToPath as af}from"node:url";F();ce();var ra=R("dist-install");function xf(n){let e=af(n),s=of(e),a=`${Qn}src${Qn}`;if(s.includes(a)||s.endsWith(`${Qn}src${Qn}cli`))return null;let x=ri(s,"index.js"),c=ri(s,"..","package.json");return{dist:x,pkgJson:c}}async function ia(n={}){let e=n.paths??G(),s=xf(import.meta.url),a=n.sourceDist??s?.dist,x=n.sourcePackageJson??s?.pkgJson;if(!a||!x)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let c;try{c=JSON.parse(await ni(x,"utf8")).version??"unknown"}catch(_){return ra.warn("cannot read source package.json,skip dist install",{err:String(_)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(_)}`}}let f=await An(e.configFile)??{},l=f.libVersion;if(l===c)try{return await ni(e.libEntry),{kind:"already-current",libVersion:c}}catch{}await rf(e.libDir,{recursive:!0}),await na(a,e.libEntry),await na(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=ri(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
94
- `;return await ni(m,"utf8").catch(()=>null)!==w&&await sf(m,w),f.libVersion=c,await Bt(f,e.configFile),ra.info("dist installed",{libEntry:e.libEntry,fromVersion:l,toVersion:c}),l?{kind:"version-changed",fromVersion:l,toVersion:c,libEntry:e.libEntry}:{kind:"first-install",libVersion:c,libEntry:e.libEntry}}var Df=R("cli");function bt(n,e){let s=[],a;for(let x=0;x<n.length;x++){let c=n[x];if(c===e){a=n[x+1],x+=1;continue}if(c.startsWith(`${e}=`)){a=c.slice(e.length+1);continue}s.push(c)}return{value:a,rest:s}}function kf(n){let e=n.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 s=e,{value:a,rest:x}=bt(s,"--pat-token");s=x;let{value:c,rest:f}=bt(s,"--pair-code");s=f;let{value:l,rest:m}=bt(s,"--env");s=m;let{value:w,rest:b}=bt(s,"--handshake-url");s=b;let{value:_,rest:S}=bt(s,"--frontier-url");s=S;let{value:k}=bt(s,"--agent-id");if(!a||!c)return{mode:"help"};let P={mode:"pair",privatecode:a,pairingCode:c};return l&&(P.env=l),w&&(P.handshakeUrl=w),_&&(P.frontierUrl=_),k&&(P.agentId=k),P}var Pf=`
88
+ ${c}`}var Se=N("agent-detail-sync"),sn=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await A0(i)}catch(c){Se.info("agents dir not found, skip detail sync",{root:i,err:String(c)});return}Se.info("starting detail sync",{reason:e,count:a.length});for(let c of a)try{await this.syncOne(c)}catch(u){Se.warn("detail sync failed for agent, skipping",{agentId:c,err:String(u)})}Se.info("detail sync done",{reason:e})}async syncOne(e){let i=await de(e,this.opts.paths);if(!i){Se.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(d){Se.warn("detail RPC failed, using local data",{agentId:e,err:String(d)});return}if(a.agentId&&a.agentId!==e){Se.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let c=!1,u=!1;if(a.agentName&&a.agentName!==i.agentName&&(i.agentName=a.agentName,c=!0),a.description!==void 0&&a.description!==i.description&&(i.description=a.description,c=!0),a.cozeIdentity&&a.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=a.cozeIdentity,c=!0,u=!0),a.deployType&&Se.info("detail.deployType",{agentId:e,deployType:a.deployType}),!c){Se.debug("detail sync: no diff",{agentId:e});return}await we(i,this.opts.paths),Se.info("detail sync: config updated",{agentId:e,identityChanged:u,agentName:i.agentName}),u&&(await ut(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ke();import{spawn as ri}from"node:child_process";import{lstat as Cr,mkdir as I0,readFile as si,readdir as T0,rm as R0,stat as N0,writeFile as L0}from"node:fs/promises";import{join as Oe,normalize as O0,relative as ii,resolve as B0,sep as oi}from"node:path";var Ee={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 kt(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Fs(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function dt(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var E=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)}};G();ue();function Le(r,e){if(kt(r)!=="cloud")throw new E("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function Dt(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}G();var on="1008033",Us="1289";var Gs="pbbp2",Ks="https://www.coze.cn",Hs="/api/coze_claw/resource/get_frontier_key",P0="https://www.coze.cn",k0="wss://frontier.coze.cn";function js(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??P0}function Ws(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??k0}function an(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 cn(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Js=N("handshake");async function Vs(r){let e=js(r.endpoint),i=r.timeoutMs??1e4,a=`${D0(e)}${Hs}?aid=${encodeURIComponent(on)}`,c={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...an(r.ppeOverride)},u=new AbortController,d=setTimeout(()=>u.abort(),i);Js.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:c,signal:u.signal}),m=h.headers.get("x-tt-logid")??"",w=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let k=await h.text().catch(()=>"");throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${k.slice(0,200)}`)}let _=await h.json();if(_.code!==void 0&&_.code!==0)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${_.code} msg=${_.msg??"-"} logid=${m}`);let y=_.data?.access_key,A=_.data?.device_id;if(!y||!A)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(_)}`);return Js.info("handshake ok",{remoteDeviceId:A,logid:m,traceId:w}),{accessKey:y,deviceId:A}}catch(h){throw h instanceof E?h:h.name==="AbortError"?new E("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new E("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(d)}}function D0(r){return r.endsWith("/")?r.slice(0,-1):r}var vr="https://llm-gateway.coze.cn",He="auto";function Ys(r){return{model:r.model??He,...r.modelToken?{modelToken:r.modelToken}:{}}}function It(r){return!r||r===He}function $s(r){let e={};return r.modelToken?(e.ANTHROPIC_BASE_URL=vr,e.ANTHROPIC_AUTH_TOKEN=r.modelToken,e.ANTHROPIC_MODEL=r.model||He):It(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Xs(r){let e=[];return r.modelToken?e.push("-c",`model="${r.model||He}"`):It(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="${vr}/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 Zs(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}function Sr(r){let{ttEnv:e,usePpe:i}=cn(r),a={};return e&&(a["x-tt-env"]=e),i&&(a["x-use-ppe"]=i),a}function Qs(r,e){if(!r.modelToken)return{};let i=Sr(e);return Object.keys(i).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(i).map(([c,u])=>`${c}:${u}`).join(`
89
+ `)}}function Er(r){return`coze-session-${r.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function ei(r,e){if(!r.modelToken||It(r.model))return null;let i=Sr(e),a={baseUrl:`${vr}/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 ti(r,e){if(!r.modelToken)return[];let i=Sr(e),a=[];for(let[c,u]of Object.entries(i))a.push("-c",`model_providers.coze.http_headers.${c}="${u}"`);return a}var se=N("agent-handlers"),ni=5*1024*1024,M0=1,z0=6,q0=new Set(["node_modules",".git",".coze","dist","build",".next"]),un=class{constructor(e){this.opts=e}opts;async listSkills(e){Le(e._meta,"_agent/listSkills");let i=dt(e._meta),a=await this.loadAgentCfg(i),c=a?.workspace??Ne(i).workspace,u=a?.skills??[],d=[];for(let h of u){let m=Oe(c,h.relPath,"SKILL.md");await N0(m).then(_=>_.isFile()).catch(()=>!1)&&d.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:d}}async addSkills(e){Le(e._meta,"_agent/addSkills");let i=dt(e._meta),a=await this.requireAgentCfg(i),c=e.skills??[],u=[...a.skills??[]],d=new Map(u.map((m,w)=>[m.skillId,w])),h=[];for(let m of c){if(!m.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let w=F0(m.skillName),_=U0(a.framework),y=Oe(_,w),A=Oe(a.workspace,y);await I0(A,{recursive:!0});let k=await H0(m.downloadUrl);W0(k)?await J0(k,A):await L0(Oe(A,"SKILL.md"),k.toString("utf8"),"utf8");let T={skillId:m.skillId,skillName:m.skillName,relPath:y,installedAt:Date.now(),...m.description?{description:m.description}:{},...m.version?{version:m.version}:{},...m.downloadUrl?{downloadUrl:m.downloadUrl}:{}},R=d.get(m.skillId);R!==void 0?u[R]=T:(d.set(m.skillId,u.length),u.push(T)),h.push(m),se.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:y})}return await nn(i,u),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){Le(e._meta,"_agent/removeSkills");let i=dt(e._meta),a=await this.requireAgentCfg(i),c=new Set(e.skillIds??[]),u=a.skills??[],d=[];for(let h of u){if(!c.has(h.skillId)){d.push(h);continue}let m=Oe(a.workspace,h.relPath);await R0(m,{recursive:!0,force:!0}),se.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.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}),se.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:c,acpId:u.acpSessionId})}catch(d){se.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 se.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?(se.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),se.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),se.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}):(se.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Le(e._meta,"_agent/switchModel"),!e.agentId)throw new E("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:He,a=await de(e.agentId);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await we(a),se.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let c=this.opts.agents.get(e.agentId);if(!c)return se.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};c.model=i;let u=[];for(let[d,h]of c.allSessionQueues())u.push(h.enqueue(async()=>{let m=c.sessions.get(d);m?.downstream&&(await m.downstream.stop(`switchModel: ${i}`).catch(()=>{}),m.downstream=void 0)}));return await Promise.all(u),se.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(Le(e._meta,Ee.RESET),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Ee.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,Ee.RESET,e.reason),{ok:!0}}async repairAgent(e){if(Le(e._meta,Ee.REPAIR),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Ee.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new E("IPC_BAD_REQUEST",`${Ee.REPAIR} only allowed for openclaw, got ${i.framework}`);if(i&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,i.workspace)}catch(a){se.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(a)})}return await this.runDetailSync(e.agentId,Ee.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,a){if(!this.opts.detailSyncer){se.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(c){se.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:a,err:String(c)})}}async getFileTree(e){Le(e._meta,"_agent/getFileTree");let i=e._meta,a=dt(i),c=await this.resolveWorkspace(a),u=e.filePath??"",d=this.safeJoin(c,u),h=await Cr(d).catch(()=>null);if(!h)throw new E("IPC_BAD_REQUEST",`path not found: ${u}`);if(h.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${u}`);let m=Y0(e.depth);return h.isDirectory()?{tree:await ai(c,d,u,m)}:{tree:[{name:$0(u),path:ci(u||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Le(e._meta,"_agent/getFileContent");let i=dt(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 Cr(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>ni)throw new E("IPC_BAD_REQUEST",`file too large: ${u.size} bytes (max ${ni})`);let d=await si(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??Ne(e).workspace}safeJoin(e,i){let a=B0(e,i||"."),c=ii(e,a);if(c.startsWith("..")||c===".."||c.startsWith(`..${oi}`))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 F0(r){let e=Dt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new E("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function U0(r){return r==="claude-code"?Oe(".claude","skills"):Oe(".agents","skills")}var G0=3e4,K0=50*1024*1024,dn=3e4;async function H0(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);xn(e);let i=j0(r);return xn(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await si(e);return xn(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),G0);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 xn(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 xn(r){if(r>K0)throw new E("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function j0(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 W0(r){return r.length>=2&&r[0]===31&&r[1]===139}async function J0(r,e){await V0(r),await new Promise((i,a)=>{let c=ri("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),u="";c.stderr?.on("data",h=>{u+=String(h)});let d=setTimeout(()=>{c.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar extract timeout (${dn}ms)`))},dn);c.on("error",h=>{clearTimeout(d),a(new E("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),c.on("exit",h=>{clearTimeout(d),h===0?i():a(new E("IPC_BAD_REQUEST",`tar exit ${h}${u?`: ${u.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)})}async function V0(r){let e=await new Promise((i,a)=>{let c=ri("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),u="",d="";c.stdout?.on("data",m=>{u+=String(m)}),c.stderr?.on("data",m=>{d+=String(m)});let h=setTimeout(()=>{c.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar list timeout (${dn}ms)`))},dn);c.on("error",m=>{clearTimeout(h),a(new E("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),c.on("exit",m=>{clearTimeout(h),m===0?i(u):a(new E("IPC_BAD_REQUEST",`tar list exit ${m}${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 c=a.charCodeAt(0);if(c!==45&&c!==100)throw new E("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let d=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!d)continue;if(d.startsWith("/"))throw new E("IPC_BAD_REQUEST",`tar entry absolute path: ${d}`);if(d.split(/[/\\]/).some(m=>m===".."))throw new E("IPC_BAD_REQUEST",`tar entry contains '..': ${d}`)}}async function ai(r,e,i,a){if(a<=0)return[];let c;try{c=await T0(e,{withFileTypes:!0})}catch{return[]}let u=[];for(let d of c){if(q0.has(d.name)||d.isSymbolicLink())continue;let h=Oe(e,d.name),m=O0(Oe(i,d.name)),w=null;try{w=await Cr(h)}catch{continue}if(w.isSymbolicLink())continue;let _={name:d.name,path:ci(ii(r,h)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&a>1&&(_.children=await ai(r,h,m,a-1)),u.push(_)}return u.sort((d,h)=>d.isDir!==h.isDir?d.isDir?-1:1:d.name.localeCompare(h.name)),u}function Y0(r){return!r||r<=0?M0:Math.min(r,z0)}function $0(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function ci(r){return r.split(oi).join("/")}G();var Tt=N("agent-health-reporter"),X0=1e4,fn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??X0}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()}),Tt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Tt.info("heartbeat stopped"))}async tick(){if(this.inFlight){Tt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Tt.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let i=[];for(let c of this.opts.core.agents.values()){let u=Z0(c);u&&i.push({agentId:c.agentId,status:u})}if(i.length===0)return;let a={agents:i,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(c){Tt.warn("heartbeat batch send failed",{count:i.length,err:String(c)})}}finally{this.inFlight=!1}}};function Z0(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}Ke();import{mkdir as Pr,rm as Cc}from"node:fs/promises";G();import{execFile as Q0}from"node:child_process";import{promisify as ec}from"node:util";var ui=ec(Q0),Rt=N("agents.acp-installer"),tc={"claude-code":{npmPackage:"@agentclientprotocol/claude-agent-acp",binary:"claude-agent-acp"},codex:{npmPackage:"@zed-industries/codex-acp",binary:"codex-acp"}},nc=5e4,rc=5e3,sc=5*6e4,hn=new Map,ln=new Map,Ar=new Map;async function xi(r){let e=process.platform==="win32"?"where":"which";try{let{stdout:i}=await ui(e,[r],{timeout:rc});return i.split(`
91
+ `)[0]?.trim()||void 0}catch{return}}async function ic(r){Rt.info("npm install -g start",{npmPackage:r}),await ui("npm",["install","-g",`${r}@latest`],{timeout:nc,maxBuffer:10*1024*1024}),Rt.info("npm install -g done",{npmPackage:r})}async function di(r){let e=tc[r];if(!e)return;let i=hn.get(r);if(i)return i;let a=ln.get(r);if(a&&Date.now()-a<sc)return;let c=Ar.get(r);if(c)return c;let u=(async()=>{let d=await xi(e.binary);if(d)return hn.set(r,d),Rt.info("acp wrapper found on PATH",{binary:e.binary,path:d}),d;try{await ic(e.npmPackage)}catch(m){Rt.warn("acp wrapper install failed (will fallback to npx)",{npmPackage:e.npmPackage,err:String(m)}),ln.set(r,Date.now());return}let h=await xi(e.binary);if(!h){Rt.warn("acp wrapper installed but binary not found on PATH",{binary:e.binary}),ln.set(r,Date.now());return}return hn.set(r,h),ln.delete(r),h})().finally(()=>{Ar.delete(r)});return Ar.set(r,u),u}function gn(r){return hn.get(r)}import{spawn as uc}from"node:child_process";function Nt(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function pn(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function ft(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ze(r,e){return{jsonrpc:"2.0",id:r,error:e}}var mn=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)}},W={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 fi(r){return"method"in r&&"id"in r&&r.id!==void 0}function li(r){return"method"in r&&!("id"in r)}function wn(r){return!("method"in r)&&"id"in r}var oc={AGENT_NOT_FOUND:W.AGENT_NOT_FOUND,AGENT_BUSY:W.AGENT_BUSY,AGENT_DISCONNECTED:W.AGENT_DISCONNECTED,AGENT_TIMEOUT:W.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:W.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:W.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:W.INTERNAL_ERROR,BRIDGE_INTERNAL:W.INTERNAL_ERROR,IPC_AUTH_FAILED:W.INTERNAL_ERROR,IPC_BAD_REQUEST:W.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:W.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:W.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:W.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:W.INTERNAL_ERROR};function _n(r){return r instanceof E?{code:oc[r.code]??W.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:W.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function hi(r){let e=r.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new E(i,r.message,{retriable:e?.retriable??!1,cause:r.data})}function gi(r){return`${JSON.stringify(r)}
92
+ `}var yn=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(`
93
+ `);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 mi={"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"},Wf=Object.fromEntries(Object.entries(mi).map(([r,e])=>[e,r])),ac={"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:[]},lt=class{seq=0;next(e,i){this.seq+=1;let a=mi[e]??cc(e),c=ac[a]??[],u=[a,String(this.seq)];if(c.length>0){let d=c.map(m=>pi(i?.[m]??"")),h=xc(d).join(":");h&&u.push(h)}else i&&Object.values(i).some(d=>d)&&u.push(Object.values(i).filter(Boolean).map(d=>pi(String(d))).join(":"));return u.join("_")}reset(){this.seq=0}};function cc(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function pi(r){return r.replace(/[:_\s]+/g,"-")}function xc(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}G();var dc=3e4,fc=50,lc=20;function wi(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=N(`downstream.${this.constructor.name}`),this.decoder=new yn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new lt;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;stderrRing=[];sanitizeEnv(e){return e}async start(){if(this.child)throw new E("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=uc(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=>{let c=a.trimEnd();this.stderrRing.push(c),this.stderrRing.length>fc&&this.stderrRing.shift(),this.log.debug("stderr",{text:c})}),i.on("exit",(a,c)=>{this.stopped=!0,(a!==0||c!==null)&&this.stderrRing.length>0&&this.log.warn("downstream exited abnormally, recent stderr",{code:a,signal:c,recentStderr:this.stderrRing.slice(-lc)}),this.failAllPending(new E("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${c})`));for(let d of this.exitHandlers)d(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()));wi(i.pid,"SIGTERM");let c=setTimeout(()=>{i.killed||wi(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(pn("session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(ft(e,i))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(Ze(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=dc){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((h,m)=>{let w=d?setTimeout(()=>{this.pending.delete(c),m(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(c,{resolve:h,reject:m,timer:w,method:e});try{this.writeFrame(u)}catch(_){w&&clearTimeout(w),this.pending.delete(c),m(_)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new E("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(gi(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?(this.log.warn("downstream returned error frame",{id:e.id,method:i.method,code:e.error.code,message:e.error.message,data:e.error.data}),i.reject(hi(e.error))):i.resolve(e.result);return}if(li(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(fi(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(Ze(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(Ze(e.id,_n(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var hc="@agentclientprotocol/claude-agent-acp@latest";function gc(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 bn=class extends je{framework="claude-code";constructor(e){let i=gn("claude-code"),[a,c]=i?[i,[]]:["npx",["-y",hc]],u=e.command??a,d=e.args??c,h={command:u,args:d,cwd:e.cwd,...e.env?{env:e.env}:{}};super(h)}sanitizeEnv(e){return gc(e)}};import{mkdtempSync as pc,rmSync as mc}from"node:fs";import{tmpdir as wc}from"node:os";import{join as _c}from"node:path";var yc="@zed-industries/codex-acp@latest",vn=class extends je{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=gn("codex"),[a,c]=i?[i,[]]:["npx",["-y",yc]],u=e.command??a,d=e.args??c,h=e.extraArgs?[...d,...e.extraArgs]:d,m=e.isolateCodexHome?pc(_c(wc(),"coze-bridge-codex-home-")):void 0,w=m?{...e.env??{},CODEX_HOME:m}:e.env,_={command:u,args:h,cwd:e.cwd,...w?{env:w}:{}};super(_),this.authMethodId=e.authMethodId,this.codexHomeDir=m}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{mc(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Lt=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}};G();ue();var ht=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 Sn=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 ht,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)Ot(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function Ot(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}import{spawn as bc}from"node:child_process";import{homedir as vc}from"node:os";import{join as Sc}from"node:path";Zt();G();async function bi(){let r=Sc(vc(),".openclaw/openclaw.json");return(await xt(r))?.gateway?.auth?.token??""}var _i=N("openclaw.config"),Ec=[0,5e3,5e3],yi="models.providers.",En="agents.defaults.models",Cn=class{command;env;retryDelaysMs;queue=new ht;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??Ec}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,_i.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=bc(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){_i.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",`${yi}${e}`,JSON.stringify(i),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${yi}${e}`)}addModelToAllowlist(e,i){let a={[e]:i?{alias:i}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${En}[${e}]`,()=>this.runCli(["config","set",En,JSON.stringify(a),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${En}[${e}]`,`${En}.${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 We=N("agent-manager"),Ac=(r,e,i,a,c,u,d)=>{switch(r){case"claude-code":{let h=c?{...$s(c),...Qs(c,d)}:void 0;return new bn({cwd:i,...h&&Object.keys(h).length>0?{env:h}:{}})}case"codex":{let h=c?[...Xs(c),...ti(c,d)]:[],m=c?Zs(c):void 0,w=!!c;return new vn({cwd:i,...h.length>0?{extraArgs:h}:{},...m&&Object.keys(m).length>0?{env:m}:{},...w?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new Lt({command:e,cwd:i,agentId:a,...u?{sessionName:Dt(u)}:{}})}};function vi(r){return r==="claude-code"||r==="codex"}var Pc={path:"",version:"cloud-deployed"},kc={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},Dc=6e4,An=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??Ac,this.createTimeoutMs=e.createTimeoutMs??Dc}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 Cn({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=kt(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")We.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(A=>We.warn("dispose stale agent failed (ignored)",{err:String(A)})),this.registry.unregister(e.agentId);else return We.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!i&&!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`);i&&vi(e.framework)&&await di(e.framework);let u=Ne(e.agentId,this.paths),d=e.workspace??u.workspace,h=kt(e._meta),m=new AbortController,w=setTimeout(()=>m.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),_,y=!1;try{let A=()=>{if(m.signal.aborted)throw m.signal.reason instanceof Error?m.signal.reason:new E("AGENT_TIMEOUT","_agent/create aborted")};await Pr(u.root,{recursive:!0}),await Pr(d,{recursive:!0}),await Pr(u.logs,{recursive:!0}),A(),await ut(d,e.framework,e.agentId,e.cozeIdentity),A();let k=await de(e.agentId,this.paths).catch(()=>null),T=Ys({model:e.model??k?.model});if(_=new Sn({agentId:e.agentId,framework:e.framework,workspace:d,model:T.model??He,deployType:h}),_.status="ok",k?.sessions){for(let[oe,te]of Object.entries(k.sessions))_.sessions.set(oe,{acpSessionId:te.acpSessionId,modelToken:te.modelToken,tokenGeneratedAt:te.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let q=Object.keys(k.sessions).length;q>0&&We.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:q})}this.registry.register(_),y=!0;let R={agentId:e.agentId,framework:e.framework,workspace:d,cozeIdentity:e.cozeIdentity,createdAt:k?.createdAt??Date.now(),sessions:k?.sessions??{},model:T.model};return h==="cloud"&&(R.deployType="cloud"),k?.skills&&(R.skills=k.skills),k?.agentName&&(R.agentName=k.agentName),k?.description&&(R.description=k.description),await we(R,this.paths),e.framework==="openclaw"&&(this.config.frameworksCache?.openclaw?.path?await this.getOpenclawConfig().ensureAgent(e.agentId,d):We.warn("openclaw binary not on this machine, skip agents add (will fail at session/prompt)",{agentId:e.agentId})),We.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:h}),{ok:!0,agentId:e.agentId,workspace:d,framework:e.framework}}catch(A){throw We.error("agent create failed, rolling back",{agentId:e.agentId,err:String(A)}),y&&_&&(await _.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Cc(u.root,{recursive:!0,force:!0}).catch(k=>We.warn("rm agent dir failed (ignored)",{err:String(k)})),A instanceof E?A:new E("AGENT_SPAWN_FAILED",String(A),{cause:A})}finally{clearTimeout(w)}}async spawnSessionDownstream(e,i,a,c){let d=this.config.frameworksCache?.[e.framework];if(!d)if(e.deployType==="cloud"&&vi(e.framework))d=Pc;else throw new E("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:c,command:d.path}):m=this.factory(e.framework,d.path,e.workspace,e.agentId,h,a,c);try{return await m.start(),await m.initialize(kc),m}catch(w){throw await m.stop("spawnSessionDownstream failed").catch(()=>{}),w instanceof E?w:new E("AGENT_SPAWN_FAILED",w instanceof Error?w.message:String(w),{cause:w})}}async buildOpenclawDownstream(e){let{session:i,modelConfig:a,cloudSessionId:c,cozeEnv:u,command:d}=e,h=Dt(c),m=await bi(),w=a?.modelToken&&!It(a.model)?ei(a,u):null,_;if(w){let y=Er(c),A=`${y}/${a.model}`;if(!this.ensuredProviders.has(A)){let k=this.getOpenclawConfig();await k.ensureProvider(y,w),await k.addModelToAllowlist(A),this.ensuredProviders.add(A)}_=A}return new Lt({command:d,cwd:i.workspace,agentId:i.agentId,sessionName:h,...m?{gatewayToken:m}:{},..._?{slashModelOnStart:_}:{}})}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=Er(a),u=`${c}/${e.model}`;this.ensuredProviders.delete(u),await i.removeProvider(c),await i.removeModelFromAllowlist(u)}}};G();import{spawn as Ic}from"node:child_process";import{constants as Si,access as Tc}from"node:fs/promises";import{delimiter as Rc,join as Nc}from"node:path";var Lc=N("framework-detector"),Ei={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Oc=[".exe",".cmd",".bat",".ps1"],Bt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Ic,access:e.access??Tc}}async detect(e){let i=Ei[e],a=await this.which(i);if(!a)return Lc.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(Ei).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(Rc).filter(Boolean),a=this.env.platform==="win32"?["",...Oc]:[""];for(let c of i)for(let u of a){let d=Nc(c,e+u);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Si.F_OK:Si.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=h=>{c||(c=!0,u&&clearTimeout(u),i(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});u=setTimeout(()=>{h.kill("SIGKILL"),d("unknown")},5e3),h.stdout?.on("data",m=>{a+=m.toString("utf8")}),h.on("error",()=>d("unknown")),h.on("close",()=>{let m=Mc(a).split(/\r?\n/)[0]??"";d(m)})}catch{d("unknown")}})}},Bc=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Mc(r){return r.replace(Bc,"")}Zt();ue();var zc=10*6e4;function Ci(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?zc:e}function Pn(r){return xt(r??j().configFile)}function Mt(r,e){return Xt(e??j().configFile,r)}import{randomBytes as qc}from"node:crypto";Ke();G();var U=N("core"),Fc=3e4,Uc=3e4,kn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new lt;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=Ci(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(),U.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){U.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),U.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){U.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)&&U.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)=>{U.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:u,signal:d}),Ot(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 c=this.extensions[e.method];if(!c){i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):U.warn("drop notification: extension not registered",{method:e.method});return}let u=await c(e,this);i!==null&&await this.upstream.send(ft(i,u));return}if(e.method.startsWith("session/")){let c=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(ft(i,c));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(ft(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):U.warn("drop unknown notification",{method:e.method})}catch(c){U.error("handleFrame failed",{method:e.method,err:String(c)}),i!==null&&await this.upstream.send(Ze(i,_n(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(),h=!1;try{let m=await c.getSessionQueue(u).enqueue(()=>this.dispatchSessionCall(c,e.method,i));return h=!0,m}finally{U.info("session call done",{agentId:c.agentId,method:e.method,durationMs:Date.now()-d,ok:h})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:c}=Fs(a);switch(i){case"session/new":{let u=Gc();return U.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:u}),{sessionId:u}}case"session/load":{let u=c;return U.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 h=await this.ensureRuntime(e,d);if(h.replySeq=0,await this.ensureDownstream(e,d,h),!h.downstream||!h.acpSessionId)throw new E("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 w=await h.downstream.sessionPrompt({...u,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),w}finally{e.activeTriggers.delete(h.acpSessionId),h.downstream?.isAlive()&&this.armIdleTimer(e,d,h)}}case"session/cancel":{let d=c.sessionId;if(!d)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(d);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.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(Ee.GEN_MODEL_TOKEN,a,Uc);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(Ot(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}),U.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId})}catch(u){U.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){if(Ot(a),this.isRuntimeBusy(e,a)){U.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)){U.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:i}),this.armIdleTimer(e,i,a);return}U.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let c=a.downstream;a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),c&&c.stop("idle timeout").catch(u=>U.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(u)}))},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 c of this.pendingUpstream.values())if(c.downstream===a)return!0;return!1}forwardUpdate(e,i){let a=i.sessionId,c=this.reverseSessionId(e,a);if(!c){U.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let u=e.sessions.get(c);if(!u){U.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:c});return}let d={cozeAgentId:e.agentId,cozeReplySeqID:++u.replySeq},h=e.activeTriggers.get(a);h&&(d.cozeTriggerMsgId=h),this.upstream.send(pn("session/update",{...i,sessionId:c,_meta:d})).catch(m=>U.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}U.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),i.respondAgentRequestError(a.id,{code:W.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??{},h=u.sessionId,m=h?e.activeTriggers.get(h):void 0,w={cozeAgentId:e.agentId};m&&(w.cozeTriggerMsgId=m);let _=h?this.reverseSessionId(e,h):void 0,y={...u,..._?{sessionId:_}:{},_meta:w};this.pendingUpstream.set(c,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),this.upstream.send(Nt(c,"session/request_permission",y)).catch(A=>{this.pendingUpstream.delete(c),U.error("forward permission request failed",{agentId:e.agentId,err:String(A)}),i.respondAgentRequestError(a.id,{code:W.INTERNAL_ERROR,message:`upstream send failed: ${String(A)}`})})}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 mn(e.error)):a.resolve(e.result);return}U.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=Fc){let c=this.upstreamIds.next(e);return new Promise((u,d)=>{let h=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:h}),this.upstream.send(Nt(c,e,i)).catch(m=>{let w=this.pendingBridge.get(c);w&&(clearTimeout(w.timer),this.pendingBridge.delete(c)),d(m)})})}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 br(e.agentId,i,this.paths)}catch(i){U.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(Ze(e,{code:i,message:a}))}};function Gc(){return qc(16).toString("hex")}G();ue();import{randomBytes as Kc}from"node:crypto";import{chmod as Hc,mkdir as jc,writeFile as Ai}from"node:fs/promises";import{createServer as Wc}from"node:http";import{dirname as Jc}from"node:path";var Vc=1e6,kr=N("ipc"),Dn=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(i=>[`${i.method} ${i.path}`,i])),this.paths=e.paths??j()}async start(){this.token=Kc(32).toString("hex");let e=Wc((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(),kr.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 jc(Jc(this.paths.portFile),{recursive:!0}),await Ai(this.paths.portFile,String(this.port),"utf8"),await Ai(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await Hc(this.paths.tokenFile,384)}catch(e){kr.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 Yc(e)}catch(h){zt(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await u.handler(d,e);zt(i,200,h??{ok:!0})}catch(h){kr.error("IPC handler failed",{key:c,err:String(h)}),zt(i,500,{error:h instanceof Error?h.message:String(h)})}}};function zt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function Yc(r){let e=[],i=0;for await(let c of r){let u=c;if(i+=u.length,i>Vc)throw new Error("body too large");e.push(u)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Jo=Re(Mi(),1);var Iu=Re(No(),1),Tu=Re(jn(),1),Ru=Re(mt(),1),Nu=Re(Ur(),1),Lu=Re(Hr(),1),Ou=Re($r(),1),Go=Re(Yn(),1),Bu=Re(Uo(),1);var Ko=Go.default;G();var ie=N("upstream.frontier"),jo="application/json",Wo="none",Xn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ie.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:Ks,...an(this.opts.ppeOverride)};class i extends Ko{constructor(h){super(h,Gs,{headers:e})}send(h,...m){if(zs("debug"))try{let w;typeof h=="string"?w=Buffer.from(h,"utf8"):h instanceof Buffer?w=h:h instanceof ArrayBuffer?w=new Uint8Array(h):ArrayBuffer.isView(h)?w=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):w=new Uint8Array(0);let _=Buffer.from(w.slice(0,128)).toString("hex");ie.debug("WS raw frame out",{bytes:w.byteLength,headHex:_})}catch(w){ie.warn("WS raw frame dump failed",{err:String(w)})}super.send(h,...m)}}let a=Ws(this.opts.urlOverride),c={url:a,ws:i,fpID:Us,aID:on,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:jo,force:!0},payloadEncoding:{encoding:Wo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},u=new Jo.FWS(c);u.onopen=()=>{this.opened=!0,this.openCount+=1;let d=this.openCount===1;ie.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:d,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:d})).catch(h=>ie.warn("onConnect handler threw (ignored)",{err:String(h)}))},u.onclose=d=>{this.opened=!1,ie.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},u.onerror=d=>{ie.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){ie.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;ie.info("frontier frame out",{method:c.method,jsonrpcId:c.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:jo,payloadEncoding:Wo})}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){ie.debug("drop non-adapter frontier frame",{service:i});return}let a=qu(e);if(!a){ie.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ie.debug("frame received but no onFrame handler",{size:a.length});return}let c;try{c=JSON.parse(a)}catch(u){ie.warn("frontier message JSON parse failed",{err:String(u),head:a.slice(0,80)});return}ie.info("frontier frame in",{logid:zu(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:c.id}),Promise.resolve(this.handler(c)).catch(u=>ie.warn("frontier frame handler threw",{err:String(u)}))}};function zu(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function qu(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}}G();var Zr=N("upstream.switchable"),Zn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;Zr.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 Zr.error("swap target start failed, reverting",{err:String(c)}),this.inner=a,c}await a.stop(i??"swapped").catch(c=>Zr.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()}};G();var Qr=N("upstream"),Jt=class{handler=null;async start(){Qr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Qr.info("NoopUpstream stopped",{reason:e})}async send(e){Qr.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)}};G();ue();G();ue();import{execSync as Fu}from"node:child_process";import{readFileSync as Vo,unlinkSync as Uu}from"node:fs";import{mkdir as Gu,readFile as Yo,unlink as $o,writeFile as Ku}from"node:fs/promises";import{dirname as Hu}from"node:path";var ju=N("single-instance"),Qn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??j().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(ju.warn("removing stale pid file",{stalePid:e}),await $o(this.pidFile).catch(()=>{})),await Gu(Hu(this.pidFile),{recursive:!0}),await Ku(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Yo(this.pidFile,"utf8")).trim()===String(process.pid)&&await $o(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Yo(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=Vo(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=Fu(`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{Vo(this.pidFile,"utf8").trim()===String(process.pid)&&Uu(this.pidFile)}catch{}})}};var M=N("daemon"),Wu="coze-bridge-daemon";async function Qo(){let r=new Qn({processTitle:Wu}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await Pn(),a=i??{};yr({pid:process.pid}),M.info(i?"loaded bridge config":"initialized bridge config");try{let P=new Bt;a.frameworksCache=await P.detectAll(),M.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(P){M.warn("framework detection failed",{err:String(P)})}await Mt(a);let c=new Zn(new Jt),u=j(),d=null,h=new kn({upstream:c,paths:u,bridgeConfig:a,sessionSpawner:async(P,F,J,ne)=>{if(!d)throw new Error("agentManager not ready");return d.spawnSessionDownstream(P,F,J,ne)}});await Vu(u,h);let m=new An({paths:u,config:a,registry:h});d=m;let w,_,y=null,A=null;h.registerExtension("_agent/create",async P=>m.createAgent(P.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let k={},T=new un({agents:h.agents,disposeAndMarkDisconnected:async(P,F)=>{let J=h.agents.get(P);J&&(await m.cleanupOpenclawSessionProviders(J).catch(ne=>M.warn("cleanup openclaw providers failed (ignored)",{agentId:P,err:String(ne)})),await J.dispose(`disconnect: ${F}`).catch(ne=>M.warn("dispose during disconnect failed (ignored)",{agentId:P,err:String(ne)})),J.status="disconnected",h.unregister(P)),h.disconnectedAgents.add(P)},detailSyncer:async P=>{if(!k.ref)throw new Error("agent-detail-sync not initialized yet");await k.ref.syncOne(P)},openclawRepair:async(P,F)=>{await m.openclawRepair(P,F)}});h.registerExtension("_agent/listSkills",P=>T.listSkills(P.params)),h.registerExtension("_agent/addSkills",P=>T.addSkills(P.params)),h.registerExtension("_agent/removeSkills",P=>T.removeSkills(P.params)),h.registerExtension("_agent/getFileTree",P=>T.getFileTree(P.params)),h.registerExtension("_agent/getFileContent",P=>T.getFileContent(P.params)),h.registerExtension("_agent/update",P=>T.updateAgent(P.params)),h.registerExtension("_agent/disconnect",P=>T.disconnectAgent(P.params)),h.registerExtension("_agent/switchModel",P=>T.switchModel(P.params)),h.registerExtension("_agent/reset",P=>T.resetAgent(P.params)),h.registerExtension("_agent/repair",P=>T.repairAgent(P.params));let R=new sn({paths:u,handlers:T,sendDetail:P=>h.sendRequest("_agent/detail",P)});k.ref=R,c.onConnect(({initial:P})=>{M.info("frontier upstream connected, triggering detail sync",{initial:P}),R.syncAll(P?"initial-connect":"reconnect").catch(F=>M.warn("detail sync top-level error (ignored)",{err:String(F)}))});let q=new Dn({paths:u,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:y??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async P=>{let F=P,J=F?.privatecode,ne=F?.pairing_code;if(!J||!ne)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let ke=cn(F.env),pe=F.handshake_url,$e=F.frontier_url,Et=Ju(F.env,pe,$e),Vt=!!w&&w!==J,be=_!==void 0&&_!==Et,ve=Vt||be;if(ve){M.warn("pair config switched, resetting agents",{pcChanged:Vt,envChanged:be,previousPc:w?Xo(w):"",nextPc:Xo(J),previousEnvKey:_??"",nextEnvKey:Et});for(let H of[...h.agents.values()])await H.dispose("pair config switch").catch(()=>{}),h.agents.delete(H.agentId);await c.swap(new Jt,"pair switch").catch(()=>{})}let Yt=await Vs({privatecode:J,...pe?{endpoint:pe}:{},ppeOverride:ke});y=Yt.deviceId,yr({deviceId:y,pid:process.pid});let ae=new Xn({handshake:Yt,privatecode:J,...$e?{urlOverride:$e}:{},ppeOverride:ke});await c.swap(ae,"pair");let $t=Object.keys(a.frameworksCache??{});try{let H=await h.sendRequest("_agent/pair",{pairCode:ne,patToken:J,frameworks:$t,_meta:{cozeDeviceId:y}});M.info("_agent/pair ok",{pairResult:H}),w=J,_=Et,A||(A=new fn({core:h,getDeviceId:()=>y??""})),A.start(),ve&&Zo(u,m).catch(De=>M.warn("post-pair-switch auto-revive error (ignored)",{err:String(De)}));let V;return F.agent_id&&(V=await Yu(F.agent_id,u,m,De=>h.sendRequest("_agent/detail",De)).catch(De=>(M.error("--agent-id ensureAgent failed",{agentId:F.agent_id,err:String(De)}),{ok:!1,agentId:F.agent_id??"",note:String(De)}))),{ok:!0,note:"paired with cloud",...V?{agent:V}:{}}}catch(H){return M.error("_agent/pair failed",{err:String(H)}),{ok:!1,note:`pair failed: ${String(H)}`}}}},{method:"POST",path:"/_agent/create",handler:async P=>{let F=P;return{ok:!0,result:await m.createAgent(F)}}},{method:"POST",path:"/refresh",handler:async()=>{M.info("IPC /refresh: re-detecting frameworks");let P=new Bt;return a.frameworksCache=await P.detectAll(),await Mt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(M.info("IPC /shutdown received"),setImmediate(()=>{xe.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:oe,token:te}=await q.start();await h.start(),Zo(u,m).catch(P=>M.warn("auto-revive top-level error (ignored)",{err:String(P)}));let ye=null,xe={port:oe,token:te,core:h,ipc:q,shutdown(P){return ye||(M.info("daemon shutdown",{reason:P}),ye=(async()=>{A?.stop(),await h.stop(P),await q.stop(),await r.release()})(),ye)}};for(let P of["SIGTERM","SIGINT"])process.on(P,()=>{xe.shutdown(P).then(()=>process.exit(0))});return M.info("daemon ready",{port:oe,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),xe}function Xo(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function Ju(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function Vu(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(()=>(Ke(),rn));for(let d of a){await u(d,r).catch(h=>M.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(h)}));try{let h=await c(d,r);h?.disconnectedAt&&(e.disconnectedAgents.add(d),M.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){M.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(h)})}}}async function Yu(r,e,i,a){let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Ke(),rn)),u=await c(r,e);if(u){M.info("--agent-id: local config found, reconnecting",{agentId:r,framework:u.framework,hadDisconnect:!!u.disconnectedAt});let w={agentId:u.agentId,framework:u.framework,...u.cozeIdentity?{cozeIdentity:u.cozeIdentity}:{},...u.model?{model:u.model}:{}};return await i.createAgent(w),{ok:!0,agentId:r,note:u.disconnectedAt?"revived from local config":"connected from local config"}}M.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 h={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(h);let m=d.deployType==="cloud"&&d.framework==="openclaw";return{ok:!0,agentId:r,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function Zo(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(()=>(Ke(),rn));M.info("auto-revive: scanning local agents on startup",{count:a.length});let u=0,d=0;for(let h of a){let m;try{m=await c(h,r)}catch(w){M.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(w)}),d+=1;continue}if(!m){d+=1;continue}if(m.disconnectedAt){M.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),d+=1;continue}try{M.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}}:{}}),u+=1}catch(w){M.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(w)}),d+=1}}return M.info("auto-revive: done",{revived:u,skipped:d,total:a.length}),{revived:u,skipped:d,total:a.length}}ts();ue();import{readFile as ta}from"node:fs/promises";var Ye=class{paths;constructor(e){this.paths=e??j()}async probe(e=1e3){let i=await this.readAuth();if(!i)return{kind:"not-running"};try{let a=await this.fetch(i,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...i}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:sd(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([ta(this.paths.portFile,"utf8"),ta(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 h=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}),m=await h.text();return{status:h.status,body:rd(m)}}finally{clearTimeout(d)}}};function rd(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function sd(r){return r instanceof Error?r.message:String(r)}G();ue();import{copyFile as na,mkdir as id,readFile as ns,writeFile as od}from"node:fs/promises";import{dirname as ad,resolve as rs,sep as er}from"node:path";import{fileURLToPath as cd}from"node:url";G();ue();var ra=N("dist-install");function xd(r){let e=cd(r),i=ad(e),a=`${er}src${er}`;if(i.includes(a)||i.endsWith(`${er}src${er}cli`))return null;let c=rs(i,"index.js"),u=rs(i,"..","package.json");return{dist:c,pkgJson:u}}async function sa(r={}){let e=r.paths??j(),i=xd(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 ns(c,"utf8")).version??"unknown"}catch(y){return ra.warn("cannot read source package.json,skip dist install",{err:String(y)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(y)}`}}let d=await Pn(e.configFile)??{},h=d.libVersion;if(h===u)try{return await ns(e.libEntry),{kind:"already-current",libVersion:u}}catch{}await id(e.libDir,{recursive:!0}),await na(a,e.libEntry),await na(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=rs(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
94
+ `;return await ns(m,"utf8").catch(()=>null)!==w&&await od(m,w),d.libVersion=u,await Mt(d,e.configFile),ra.info("dist installed",{libEntry:e.libEntry,fromVersion:h,toVersion:u}),h?{kind:"version-changed",fromVersion:h,toVersion:u,libEntry:e.libEntry}:{kind:"first-install",libVersion:u,libEntry:e.libEntry}}var kd=N("cli");function St(r,e){let i=[],a;for(let c=0;c<r.length;c++){let u=r[c];if(u===e){a=r[c+1],c+=1;continue}if(u.startsWith(`${e}=`)){a=u.slice(e.length+1);continue}i.push(u)}return{value:a,rest:i}}function Dd(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:c}=St(i,"--pat-token");i=c;let{value:u,rest:d}=St(i,"--pair-code");i=d;let{value:h,rest:m}=St(i,"--env");i=m;let{value:w,rest:_}=St(i,"--handshake-url");i=_;let{value:y,rest:A}=St(i,"--frontier-url");i=A;let{value:k}=St(i,"--agent-id");if(!a||!u)return{mode:"help"};let T={mode:"pair",privatecode:a,pairingCode:u};return h&&(T.env=h),w&&(T.handshakeUrl=w),y&&(T.frontierUrl=y),k&&(T.agentId=k),T}var Id=`
95
95
  coze-bridge - local bridge daemon for cloud Agent Service
96
96
 
97
97
  Usage:
@@ -118,35 +118,35 @@ Auto-connect agent (optional):
118
118
 
119
119
  Internal:
120
120
  <node> <entry> --daemon daemon mode (OS supervisor only)
121
- `.trimStart();async function ua(n=process.argv,e={}){let s=kf(n);switch(s.mode){case"help":return process.stdout.write(Pf),0;case"daemon":{try{await Qo()}catch(a){return Df.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return Tf(e);case"stop":return If(e);case"refresh":return Rf(e);case"uninstall":return Nf(e);case"install-service":return Lf();case"pair":{let a={};return s.env&&(a.env=s.env),s.handshakeUrl&&(a.handshakeUrl=s.handshakeUrl),s.frontierUrl&&(a.frontierUrl=s.frontierUrl),Of(s.privatecode,s.pairingCode,e,a,s.agentId)}}}async function fa(n){let{unlink:e}=await import("node:fs/promises");await Promise.all([e(n.pidFile).catch(()=>{}),e(n.portFile).catch(()=>{}),e(n.tokenFile).catch(()=>{})])}async function Tf(n){let e=n.paths??G(),s=new We(e),a=await s.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
122
- `),1;if(a.kind==="stale")return await fa(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
123
- `),1;let x=await s.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
124
- ${JSON.stringify(x.body,null,2)}
125
- `),0}async function If(n){let e=n.paths??G(),s=new We(e),a=await s.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
126
- `),0;if(a.kind==="stale")return await fa(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
127
- `),0;try{return await s.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
128
- `),0}catch(x){return process.stdout.write(`coze-bridge: stop failed: ${String(x)}
129
- `),1}}async function Rf(n){let e=new We(n.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
121
+ `.trimStart();async function ua(r=process.argv,e={}){let i=Dd(r);switch(i.mode){case"help":return process.stdout.write(Id),0;case"daemon":{try{await Qo()}catch(a){return kd.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return Td(e);case"stop":return Rd(e);case"refresh":return Nd(e);case"uninstall":return Ld(e);case"install-service":return Od();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),Bd(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function da(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 Td(r){let e=r.paths??j(),i=new Ye(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
122
+ `),1;if(a.kind==="stale")return await da(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
123
+ `),1;let c=await i.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
124
+ ${JSON.stringify(c.body,null,2)}
125
+ `),0}async function Rd(r){let e=r.paths??j(),i=new Ye(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
126
+ `),0;if(a.kind==="stale")return await da(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
127
+ `),0;try{return await i.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
128
+ `),0}catch(c){return process.stdout.write(`coze-bridge: stop failed: ${String(c)}
129
+ `),1}}async function Nd(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)
130
130
  `),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
131
131
  ${JSON.stringify(a.body,null,2)}
132
132
  `),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
133
133
  `),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
134
- `),1}}async function Nf(n){let e=new We(n.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
135
- `);try{await e.request({method:"POST",path:"/shutdown"})}catch(c){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(c)}
136
- `)}await new Promise(c=>setTimeout(c,500))}if(!n.skipSupervisor)try{let{getSupervisor:c,buildContext:f}=await Promise.resolve().then(()=>(ui(),ci)),l=c();await l.uninstall(f()),process.stdout.write(`coze-bridge: ${l.platform} supervisor unregistered
137
- `)}catch(c){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(c)}
138
- `)}let a=n.paths??G(),{rm:x}=await import("node:fs/promises");try{await x(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
139
- `)}catch(c){return process.stderr.write(`coze-bridge: remove failed: ${String(c)}
134
+ `),1}}async function Ld(r){let e=new Ye(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
135
+ `);try{await e.request({method:"POST",path:"/shutdown"})}catch(u){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(u)}
136
+ `)}await new Promise(u=>setTimeout(u,500))}if(!r.skipSupervisor)try{let{getSupervisor:u,buildContext:d}=await Promise.resolve().then(()=>(us(),xs)),h=u();await h.uninstall(d()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
137
+ `)}catch(u){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(u)}
138
+ `)}let a=r.paths??j(),{rm:c}=await import("node:fs/promises");try{await c(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
139
+ `)}catch(u){return process.stderr.write(`coze-bridge: remove failed: ${String(u)}
140
140
  `),1}return process.stdout.write(`coze-bridge: uninstalled
141
- `),0}async function Lf(){try{let{getSupervisor:n,buildContext:e}=await Promise.resolve().then(()=>(ui(),ci)),s=n(),a=e();return process.stdout.write(`coze-bridge: installing ${s.platform} supervisor...
142
- `),await s.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
143
- `),0}catch(n){return process.stderr.write(`coze-bridge: --install-service failed: ${String(n)}
144
- `),1}}async function Of(n,e,s,a={},x){let c=new We(s.paths),f=s.spawnDaemon??ea;if(!s.skipDistInstall){let w=await ia({paths:s.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
145
- `),(await c.probe()).kind==="connected"&&(await c.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(_=>setTimeout(_,500)))):w.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${w.libVersion}
146
- `)}let l=await c.probe();if(l.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
147
- `),await f({paths:s.paths}),l=await Bf(c,s.waitTimeoutMs??1e4,s.sleep??Mf),l.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${l.kind}
148
- `),1;let m={privatecode:n,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 w=await c.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return w.status===200&&w.body?.ok?(process.stdout.write(`coze-bridge: paired (${w.body.note??"ok"})
141
+ `),0}async function Od(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(us(),xs)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
142
+ `),await i.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
143
+ `),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
144
+ `),1}}async function Bd(r,e,i,a={},c){let u=new Ye(i.paths),d=i.spawnDaemon??ea;if(!i.skipDistInstall){let w=await sa({paths:i.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
145
+ `),(await u.probe()).kind==="connected"&&(await u.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(y=>setTimeout(y,500)))):w.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${w.libVersion}
146
+ `)}let h=await u.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
147
+ `),await d({paths:i.paths}),h=await Md(u,i.waitTimeoutMs??1e4,i.sleep??zd),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
148
+ `),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),c&&(m.agent_id=c);try{let w=await u.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return w.status===200&&w.body?.ok?(process.stdout.write(`coze-bridge: paired (${w.body.note??"ok"})
149
149
  `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(w.body)}
150
150
  `),1)}catch(w){return process.stderr.write(`coze-bridge: pair failed: ${String(w)}
151
- `),1}}async function Bf(n,e,s){let a=Date.now()+e;for(;Date.now()<a;){let x=await n.probe(500);if(x.kind==="connected")return x;await s(200)}return n.probe(500)}function Mf(n){return new Promise(e=>setTimeout(e,n))}ua(process.argv).then(n=>process.exit(n),n=>{process.stderr.write(`fatal: ${n instanceof Error?n.stack??n.message:String(n)}
151
+ `),1}}async function Md(r,e,i){let a=Date.now()+e;for(;Date.now()<a;){let c=await r.probe(500);if(c.kind==="connected")return c;await i(200)}return r.probe(500)}function zd(r){return new Promise(e=>setTimeout(e,r))}ua(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
152
152
  `),process.exit(1)});