coze-bridge 0.1.19 → 0.1.21

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 +52 -51
  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 $0=Object.create;var _r=Object.defineProperty;var Z0=Object.getOwnPropertyDescriptor;var Q0=Object.getOwnPropertyNames;var ea=Object.getPrototypeOf,ta=Object.prototype.hasOwnProperty;var Z=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Le=(r,e)=>()=>(r&&(e=r(r=0)),e);var fe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Is=(r,e)=>{for(var i in e)_r(r,i,{get:e[i],enumerable:!0})},na=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of Q0(e))!ta.call(r,x)&&x!==i&&_r(r,x,{get:()=>e[x],enumerable:!(a=Z0(e,x))||a.enumerable});return r};var Be=(r,e,i)=>(i=r!=null?$0(ea(r)):{},na(e||!r||!r.__esModule?_r(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as ra,mkdir as sa,readFile as ia,rename as Rs,writeFile as Ns}from"node:fs/promises";import{dirname as oa}from"node:path";async function ut(r){try{let e=await ia(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function tn(r,e,i){await sa(oa(r),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
9
- `,x=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await Ns(x,a,{encoding:"utf8",mode:i.mode}):await Ns(x,a,"utf8"),await Rs(x,r),i?.mode!==void 0&&await ra(r,i.mode)}catch(f){await Rs(x,x).catch(()=>{});let{rm:l}=await import("node:fs/promises");throw await l(x,{force:!0}).catch(()=>{}),f}}var nn=Le(()=>{"use strict"});function Os(r){return sn[Ls]<=sn[r]}function wr(r){Bs={...r}}function rn(r,e,i,a){if(sn[r]<sn[Ls])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...Bs,...a});r==="error"||r==="warn"?xa.write(`${x}
10
- `):aa.write(`${x}
11
- `)}function B(r){return{debug:(e,i)=>rn("debug",r,e,i),info:(e,i)=>rn("info",r,e,i),warn:(e,i)=>rn("warn",r,e,i),error:(e,i)=>rn("error",r,e,i),child:e=>B(`${r}.${e}`)}}var sn,Ls,aa,xa,Bs,J=Le(()=>{"use strict";sn={debug:10,info:20,warn:30,error:40},Ls=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),aa=process.stdout,xa=process.stderr,Bs={}});import{homedir as ca}from"node:os";import{join as ie}from"node:path";function V(r){let e=r??ca(),i=ie(e,".coze"),a=ie(i,"bridge"),x=ie(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:x,libEntry:ie(x,"index.js"),pidFile:ie(a,"bridge.pid"),portFile:ie(a,"bridge.port"),tokenFile:ie(a,"bridge.token"),logFile:ie(a,"bridge.log"),installLock:ie(a,"install.lock"),configFile:ie(a,"config.json"),agentsRoot:ie(i,"agents")}}function Oe(r,e=V()){let i=ie(e.agentsRoot,r);return{root:i,config:ie(i,"config.json"),workspace:ie(i,"workspace"),logs:ie(i,"logs")}}var de=Le(()=>{"use strict"});var xn={};Is(xn,{AGENT_CONFIG_FILE_MODE:()=>on,enforceAgentConfigMode:()=>da,loadAgentConfig:()=>le,persistAgentSessions:()=>yr,persistAgentSkills:()=>an,saveAgentConfig:()=>be});import{chmod as fa,stat as ua}from"node:fs/promises";function le(r,e){return ut(Oe(r,e).config)}function be(r,e){return tn(Oe(r.agentId,e).config,r,{mode:on})}async function da(r,e){if(process.platform==="win32")return;let i=Oe(r,e).config;try{let a=await ua(i);if(!a.isFile())return;let x=a.mode&511;x!==on&&(await fa(i,on),zs.warn("agent config mode auto-corrected to 0600",{path:i,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;zs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function yr(r,e,i){let a=await le(r,i);a&&(a.sessions=Object.fromEntries(e),await be(a,i))}async function an(r,e,i){let a=await le(r,i);a&&(a.skills=e,await be(a,i))}var zs,on,We=Le(()=>{"use strict";nn();J();de();zs=B("agent-config"),on=384});var Ri=fe(ee=>{"use strict";function Ln(){let r=["AvHPBM4","Ae1LC3nHz2u","wM9Vrgq","Cvbmrva","x3bHDgHlzxK","AgnNB2W","AvHZDK0","x29Uq2XVC2u","C1jRzu8","A0jMDvm","CvrSC2m","DcbVzIbYyw4","ihzHBgLKigq","zNjHBwvuExa","rNHUy1a","x2HHBMrSzu8","tLb1zKO","BfrrAfG","vfzxyxe","zMX1C2HfEha","s0nRzxG","x29UrxjYB3i","DNzgtgK","yw1LoIa","q0Xpu0ve","Ewnty0S","yvHlAfO","BMDIuMy","vMrAyLi","C3vIC3rYAw4","CMvKDwnL","yMrFzgLK","Ee9sB0O","r3PVvNK","ywWGy3vYC28","sgL0A1C","u2HdB2e","DxbNCMfKzw4","DfPsy1m","sgndALq","uu15BNO","yKf4qvC","EhjwBuy","Cgf5Bg9Hza","y3DJsfK","vKX6EKq","AhvlCw8","BwLZzq","z3f3uLK","D2v0yMi","rvDmEKi","x2jPBMfYEvq","z3jlr1O","rxnRy04","AeP4yvK","rxLWr3O","yxnJCMLWDa","DvL2uwq","D1PVC0C","yw51Ce1LC3m","BgLTAxq","EgvuB2K","EeDbDu4","BgvY","vMvYA28","Avnhshe","rg9Ozxy","yxKSihrYEsa","AgLwEgq","BNruCMLLC0m","ihrPBwvVDxq","jMPZy2fSBgi","BgDUtw8","t1bftG","CMvJzxzPzwq","B2nRzxrgywK","yvzmB0G","zMLSzw5HBwu","AgX2CuK","zNvOwu4","q291BNq","svjXzwW","Dg9cExrLC0W","x2rLC3rYB3K","ywnOzwq","zsbHihn0CMK","BhjiELu","D3m6lY8","EMXLD3G","CMvWBgfJzui","ru52q1K","s2P0the","zhzWBeu","EgjWqvC","y2f0y2G","AMnxvvG","ENbYrxK","rxzLBNq","wLDryxu","qvLmqwy","AwDAtwO","uxr3Ave","quD0z0e","t1bftL9fuLi","BMX6vhm","uxzsBvm","ruHIsMW","rgvYs1K","tg9zyMy","ver4Cui","tvD3t3q","CLjYu2m","EMXNAxi","tejouwG","CNnVCKzPBgu","ywDLrxzLBNq","Evn2Aem","mtb8nNW0FdK","Cernq3a","A1rPCuW","DgLLCKPtt04","yKf3BMu","rxbtuuq","thj3rfK","uK1KAum","zxmGCMvHy2G","t3D0whu","CMvJB25Uzwm","EfPdC2G","DKj3sMy","igfYCMf5yNu","mZi0otK1mfbgD1fQzW","tLrbtKy","uKPcwhe","C1LYuMG","svrorhK","x2LZsw5PDa","BeHyuNm","r0v4qui","rgvKAwnHDgu","EKDJzeK","B3jRzxjhBg8","zxvWz0S","wNvozg4","z2v0u3rVCMe","rwDsB1i","CgvYC2LZDgu","yvLYy2G","CNnxwM0","DeLPCMS","t2jQzwn0","uKjWtgK","BNz5D0m","zMXVB3i","uLjpuG","ChjVDg9JB2W","x2LUDgvYDMe","wwnAzgi","BxjfChC","C29YDa","Euv0uuq","qLH0v3i","BwXkze4","x0rctMfTzq","D3jPDgu","vePXvw8","B0n5rhi","q0Xpu0LorW","sNr5A1u","CMLQEKi","Ae9Wzw5fDMu","tfbMtxO","ChjVDg90Exa","u2vYDMLJzvC","x2TLEvbHDgG","y3jyvuK","zfvcwNq","zNjVBuj5Dgu","y29UDgLUDwu","BMfoChy","y29UDgv4Da","tNPcug0","Aw47y2HHCNm","whrUvNy","su5tvefova","vxbKyxrLq28","thfqwwm","qu10vMO","x2LZtM9Kzq","yNbjCKW","v2LUzg93","uvforxu","x2rPC2nVBM4","vMfpDLK","Ahnhyxm","sNLjCfa","x29WDgLVBNm","qKrVuLa","r0Pyu0O","sgr4CwW","EMTXze4","yNrtrNu","qw5ytMi","mZu5mdu5mezyy2vvra","x3DZsw5ZDge","mhWZFdr8mNW","ywDL","lcbxzwjtB2m","tMznENe","teruzg8","z2v2v0C","qKrWwxu","wKLhDLe","zgvMAw5Luhi","CfbXBe4","AK1xrhG","wLDfBMG","AKHjrwq","ruTHBe8","vxvmwKe","vvPzAhy","CMrWqwS","vKTkBeu","zxjYB3i","AxnszwfKEq","x194x21Zz18","uhjPBwfYEuS","BhPYqw0","z2ruBhe","qKXJA1i","rfrcrhm","sg5Nzfu","CM53ugm","ysbTDxn0igi","q3rKExm","z3fJtgS","Durluxm","BNrbBMrvCgq","yuvnqwG","whfJDhC","BeTyBMe","Ahr0Ca","yMH2wLO","vKLyELu","B25TzxnZywC","CKjsrfy","Dwn5zxq","B3bLBKrc","yw9xww8","tgDdBLy","B3vUDa","vhfgvfm","AwLduK4","ALfrDvO","wKnMsKi","Aw50zwDLCIa","rg9UweK","Dw50","vu5lrg8","zvvYBa","vfbpBeS","B3jRig9MzMW","CNjPCfy","vuvwsNC","BxDUzve","Dg9iyxnO","wfr5Cgu","s0zHD28","zvDAwvy","sLnptLa","ELnPrLm","B21etfe","nxWWFdj8m3W","BwDyB2O","twvrs00","Du9xyMO","Chjvt28","q29Kzq","B2jey0q","wgn4AKu","BhfUBhu","AKn5tu8","zufnr20","EwvfAhy","zw5HyMXLvhi","DcbSAw1PDa","s2HvCui","v1nLsLy","ihn1y2nLC3m","y3zpu20","u25mBgm","uMvHzcbWyxm","wvD3A0C","B0X0ENG","B3bLCNr5tMe","sxrzvxm","tMrcAMG","EfvZzuvUDG","EM5nBey","BgPWEMK","y3vYC29Yx24","q3vZDg9Trxi","zw1tEwm","suXyEwy","z1fNu2q","weTesLm","A05wDwW","A1HMu1y","y3vYCMvUDeK","v0zMz08","DNbjAuq","x2rItMfTzq","z3fqCeS","tg9JAW","vw5Oyw5KBgu","y3jLyxrLtwu","yw5ZzM9YBvq","B09JtMG","DxHWrvG","yMLUyxj5vhK","tufyx1jfvfi","rLjptLrjrvi","Dg1vwvK","DNndtvC","BMvLzf9Hy2S","zw1LBNq","yKHXwKC","vhP6vNO","BM94BKO","B25dBg9Zzq","ufrPzNG","B2LUDfjLywm","CMvZzxrfBMq","BKvWzvG","ywrKrxzLBNq","yw1L","AvfAww8","zez5tg0","x2zVCM1HDeu","y2XLyxjtDg8","AgfZt3DUuhi","zxjHDg9Y","D3jPDgvvAw4","y2PuEva","qKHryvu","Dw5KzwzPBMu","AxnrB1nby2S","DwHZwwC","EgDvEM0","DeLK","B3jLtMfTzxm","sKvmBLm","AgfUz2u","q0Lbwgu","CM9fugq","CMvHzhLtDge","m0LiseDYAa","C2vUza","B25tDg9Wsw0","DgfYz2v0","wevuAwS","Ce1SBuG","BMrWB2LUDfq","tffPu0m","v3bMrwK","AhLizfy","zxH0ugf5Bg8","zhDYCvy","vhHkqwK","vgLru0m","z2nduMy","qKHfywq","tg1wtKO","Bg9IywXty28","wKHfsfe","tgHLuxK","BM9Uzv9UB24","ywnR","ywrK","C3bSAxq","v0PsBeu","sxHeBKm","zgfyDeK","wKPZBKe","ALDlv0W","Bg1bEwK","C2v0sxrLBq","x3bPBMC","zfnLAK8","u3D2z0O","DKrjC24","D1H1tLy","AMndAe0","y2vZC0HHBMq","z2vjBMzVu3K","AenSB3nLrxy","AgvHzgvY","rMHru3e","CgjICdi","BMnLq2XVC2u","x2nSzwfYvgK","Eg1wA0i","tKfwDg0","s3feELe","tfPADvG","EwDcB0y","tMXmDha","B0LtvKm","CYbPBNn0yw4","Bevkq04","De1HBMfNzxi","mNW0Fdf8m3W","CMvTB3zLrxy","DMjVChq","C3vIyxjYyxK","BgnfCMS","sxDfB3e","ywnRtxnNswq","B25LCNjVCG","v1jmv24","uxHkr1a","sev5sNm","r09VB3u","x2n1CNnVCKy","BKzwB2S","vvrUruy","Cwjcq0i","BeHHBMrSzxi","BxzOueK","ywnOzwqSihC","DxrMofDYAxq","C2v0","tfv2zKi","B25JBg9Zzq","vKrhrgG","ufvhB2O","zgvIDwC","BMDuAw1LCG","EMj6CvK","B0TXy2O","s1rLsKq","CMLLC0nVDw4","zMLN","Bwu6ia","D2Hwrfm","uLDoC0e","CMHRD24","zxj2AwnL","zMzLCG","y3jLyxrLrxi","Bwf4tg9ZC0m","BhzxreS","CLzRrgu","r3HqCgi","rNjVBNrPzxi","BKzdD2m","EMXSsfG","z2v0qwXSs2u","qvzbt3m","DMvY","EwHxs3e","BKDXsuC","tLHAEK0","CIb0DhDjra","q2fOuNi","tMrKDfa","zKrsDgS","CMveuuS","reLPs2i","ihjLy29UBMu","qxnLqM8","wxjdBLq","DfDtwgC","CwP0zum","n3WWFdz8nq","EKLlyMu","BvnvANu","tgLZDgvUzxi","Bg9Nsurhzw4","DMnbyxq","t3rerwi","zgLZCgf0y2G","t0DfAwe","ufjwExe","B2zMBgLUzq","ALfouLG","Dg9tDhjPBMC","mhWYFdn8mxW","BezSDxnO","u2f4ENG","DgvZDa","A01qAwq","r0XQve4","t3bOzNu","yw95zuW","r0jkzhK","vKvOEui","BK5ZB2e","BuzvCvq","Aw5KzxG","y2fSBa","D1LIBKq","ufbpvNe","rLDt","uMjUveG","EMjSrMy","wvDRsgi","ywnRx2LK","yKDnDLG","CMvHzfvjBNq","A2v5","z2TZz0K","vK9Xtvu","B2fK","ChjVy2vZCW","zNjVBu51Bwi","rgHiDxC","zM5ss24","EffXywK","qMHRzhu","rvnHv1u","DMLLue0","zxPwDeC","zg9Uzq","BM14rKe","ywnRx2nVzgu","DMvUDa","BLr6q3u","sfbmzfu","rNjwshm","tMHyAKm","ChbfC2W","CM5Kre8","D2LSBfjLy28","DMfSDwvZ","swvsD0y","Aw9eCxi","y3jLyxrLrwW","BfP2yMG","CNzHBfzHBhu","vfHfB0i","D2z5CeS","C2vUzf9Hy2S","zePfBLO","BMDLza","zNj1tw4","D1noBM8","zxjFBxnNAwq","C2v0zgi","z1biCw8","EM9irNu","B2jQzwn0u3q","DxjOveS","tfnOBKe","BKLYBMq","mhWYFdn8nhW","CNnVCL92ywW","qKHAvgW","u2TPCcbWyxm","EeDkAeG","t2jbrwm","BfLgEe4","BKzsy1y","zvH3qLO","z2v0q3vYCMu","s1f5yvi","BKXPBMu","BwfW","tM9Pywu","C2fNzq","AxfwyxK","u0ndrK8","yKzJwvG","sgPPv3O","DgvmB2Djre4","A0f0zhy","q2ruBMm","vgjRALm","ug1fveC","CMvHC29U","BMv3vMvYC2K","vgvcsfK","B0XjrNm","r3PsAhK","Aw9UvgLTzw8","zgvS","x2LZqNjVD3m","sff2Dxi","y29UBMvJDeu","BvD4vMy","BvLNCuC","B1fvywi","ywPkwwu","qun6D0C","D3rKBw8","r0nuvMe","yMLUyxj5","ChrVCG","zwn0","Ec1TC2CTy3u","zhvHvwS","zxvwvLy","A2v5CW","DxbKyxrLq3u","ExbL","AgHlB2O","CMfTzq","r0HYqu4","wxLPzLy","BwvZ","DvvNEuO","u0LVDgC","rKLmrv9ot1q","AxHfuum","BNrLCG","Ew5Qy0m","ve5Wsfi","yMXVy2TLza","D3vjsgW","yxjOvxG","sgnwwhG","Fdj8mxW1","tKfvB00","CMvWBgfJzq","v1jhEwe","y3jLyxrLt3a","uvbmzeW","BePOzeK","DKvjuvq","s3bRy0C","r0zzDfq","ufv3v1a","BxPoqvO","yw5Nzq","wLLKtLO","Cg93","se1OC2W","x3nLBMrby2S","CM92AwrLihC","tfnosKS","BMfTzq","x2HHBMrSzvi","AxnFywnR","B29zvMC","yxrHlcbKyxq","tLjksxG","ywrKt25L","rLj0zKG","DMfS","ywXS","x25HDMLNyxq","qK9Zy08","vgLTzw91Da","uxjJreC","Dxnltxu","AxnbCNjHEq","AwrI","CMvZB2X2zq","A2v0ignVBNm","D2fZq2XLyw4","rg5kDhy","DLDuDeS","EfPUyvi","C2DPza","Berpt0S","q21Kswi","A1PjzMm","s1rkCKG","C0jf","yNL0zxm","ugfkDKG","Ec1TC2CTCw8","AKH4wui","DMvYC2LVBG","AxnAzxjV","EMXhD1m","BgLUzq","rwP3DgK","Ae5Ov1e","v0nKzMm","rgnTD08","EKf5q3O","CLvtDum","yK9qDxe","AKLsuKG","qNzVu28","DKrswMy","DeLUDgvYy2u","re9hvfu","z0P1A3q","ugDltuq","C0fAuuy","A25lEvO","A1n6DeO","yMjsB0m","ywDLsgLKzq","EMD6rxO","BMrLEa","zxjFCw9Zx2e","y2Lbuxi","zfDYvwy","yxGGCMv0CMK","CeDmtgC","t3DQqwW","q3vZDg9Tq2W","qwncugq","yvzoqLy","tNDmuKy","zgvSzxrLrge","EgniC24","vw5PBxbSzw0","AgvHzgvYCW","sKvJzxO","Dxrjza","zw50tgLZDgu","s2XuwwS","CNLuve0","q29UzMLN","Dev2zw50","rfjAqu4","vhb3wfy","Cg9PBNrdB24","z2f2rvG","rLniuM0","qxPQsMS","BgLUzw5V","x2rPC3bHDgm","zw50zwqGDhK","zw5PAwq","y29SBM8","ru5Pwfi","txHcs3u","C0nHAuG","ENfgsNe","EuvKwg4","zMDLu1i","qw1VDw50","yNbcshe","q3n1tuq","AuDKwhq","zNvUy3rPB24","uxvLDwu","Du9TC08","AgvKtwf4uMu","tNzhA3a","s1jTC24","t2fkveO","t3vUqMy","C3PyAMW","BfLLCNi","tuvtu0fhrv8","CMvHzhDYAxq","u2vXsuq","swvqwxa","q0fcq2e","DeHXBwm","ihbYB3rVy28","CM92AwrLige","tg9Nsuq","CMvTB3zLq2G","DwXHCg0","BvrAswC","BvDtwu4","uhPeqNK","BwvZDwm","vK1cBvi","x29UtwvZC2e","C3fjBLu","vePnCg4","y2HLy2Tszwe","DgLUzYbZzxi","qNnxqMK","zfHQvg4","vMTwB3u","CNzyCwu","BMjcueK","qwrYEwy","EwzIBgK","zKTHEgC","BwfUDwfSihi","Dg9oDw1Izxi","zKXyww4","Avfgs3e","yMP5tw4","igzPzwXKoIa","DKXUuw0","y2HnyxHuCMK","t0nMDNu","EgzRsMS","seTYweC","ru9ZreW","ndLnCgjuqMG","zunev2W","ChnXuMm","rxLVEwq","BhHAA2y","EvHzu0G","BML0AwfSAxO","s1rcuhO","tKX5vxO","BKHsvwy","B25ozxr3B3i","AK90u00","wvPHuNG","x2DLDeLUDgu","txfku0C","D24GCMvHC28","x2nSzwfYugK","DufmCgi","CMvUDevUzha","BKnntg4","v2TTwhu","t2TYzfq","BvDUv1y","rM5jCwe","yvbKyLe","x3bPBMDmB3m","AKLUChO","r0XREw8","ChvPDfa","Cw9Z","CgLUz0XVC3m","sw52q0e","AKvXwgy","DND4Afi","zLrlrvi","DMXACKS","BerdzgG","qwLTwLK","x29UvgLTzw8","CuHUtg0","CfvyD2G","otmXodu4wuHtEuvX","r2L6z3G","yKzfD0G","uhP1AKu","yvroANq","EvjLy29UBMu","uezOyMG","AMPlBKi","A1n0yxr1C0m","y29UBMvJDfm","zgf0yq","A2Hxv3a","BLjkDg8","EgnbCxC","zwPUBfC","ign1CNnVCIa","BMzrvMy","y3jzzwW","zw5KCg9PBNq","C3rVCcbPBw0","t0DWBw8","u3rYyxrLz3K","B3jpBMXPBMu","s0PuuwS","yMv5zwe","C3rLBMvYCW","se5ACxi","ENDzuNu","y3vYCMvUDeu","vwPMtvu","zxjYtM8","uNzWz1O","y09Tu20","yxjsvfK","mtf8mhW3FdG","x2LZtwLUAvq","BwLUzW","BMvY","qxLJDvG","wM1kDK0","EKzbEg4","vLrArLi","reTUCNy","u3DNvKG","A0zNA2C","ueHYC1u","mZa3ntKWrhz2tvLA","CgLUz0LUDgu","yM9KEq","zgvJB2rLzey","sfPWDei","v1nQtKu","AfzqyKK","zhDyDKS","BwvKAwf0zwW","Aw5JBhvKzxm","Cwfcsxi","rMT3tgO","y29Kzq","yLzYzxq","CeD6rLe","wvj5BvO","x3vYBa","uuHdug4","zNjVBujPDhm","C0Tcywu","CMfTugfYyw0","x2DLBMvYyxq","DuzyvM4","x2n1CNnVCK0","x3nLCuLK","DwDmAMq","A0PvD1O","v3nRwwK","CgLUz1rPBwu","x3DZ","z2v0qwXS","x2vUzhbVAw4","tMTKtuK","zhLpAvm","tM5Uu0u","x1fVu01HBMe","x3bYzwzPEa","AejNv3a","Dw5ZAwDUzwq","zNjVBunOyxi","BwvZC2fNzq","B2nRzxq","x3bPBMDqB24","B3bLBG","z2vY","BM5Ly3q","tg9NsurozxC","rxjYB3jdB2q","DefIzNe","s3n2v0K","AxnmB25N","rvDNqKm","tMfTzq","z2v0t3DUuhi","yxnZAwDU","q0nyvg0","CYbWyxjHBxm","CLv6r0y","zhLwzgK","yuz1s2W","Axnby2TdBgu","u05ov08","AgzSDhG","B2zM","t1PsBMS","x3jLBw92zvC","rg5czg8","zw1PDa","zMzMzG","qvHvsNy","pxv0zI04","v0jbr0u","zMLSDgvY","rgLJs2i","CKPbDuq","thPksLe","AM9PBG","BNvTyMvY","ihrPBwvZ","DuPzAgq","EevyqMO","x2LUAxrhBg8","uhvlrxC","AxjLza","y3vYC29Yx2y","suvtx0vsuK8","zufJAW","ruXrEMi","zxjYtxnN","t2X3u1O","EfzNCNO","vwnhu1C","sfr6z2i","D3bPs20","rvjst1i","yNL0zuXLBMC","igzHAwWSig0","AePsq0y","mNW0Fdf8mhW","uenfDM8","yMjsENC","swTrsNu","rKzNs3G","AwXK","sMjgC1m","sLrPvxK","tMfTr2y","x2nVBM5Ly3q","thzgENK","yM9L","CK9kq1a","zLHxDuS","DhzWBwu","v1jOzLu","y3juCMK","vMHXA3O","BMCGB3iGyw4","Fdj8nNWXFde","A0z6tNq","rM9KuK8","ihrVihjLDhi","vvvSzMK","CvLTyMu","x2HHBMrSzva","whLjt3m","y3ruAw1LB3u","CfbmtMq","A01yyKC","wMrTsum","A1DoBMq","ELf3svO","C3jJ","vxD6z0i","CMfUzg9T","uvDYuKW","mMDSq2jwAa","tLDNzeW","C3bSAwnL","BMDjDve","z0rgtKK","DxjfyNu","yNL0zu9MzNm","DwHwD0O","EsbJBg9Zzwq","vu1luey","t2XKCuK","tujuDe0","BMnVzgLUzW","EufVr0S","z2v0s2v5","y3jLyxrLt2i","tfzSDMK","CwH4D20","B3btExa","txbdtuO","r0jIug0","C2vYDMLJzq","rwXes2S","ywDLu2HVDW","zfDVCMTLCKC","y2XLyxi","v2LNu1y","wKvSy2e","Cg9PBNrbBMq","y1bNB1G","wLDIteq","CwPcBNy","x2LUAxrqCM8","DKPny04","yvrTBum","AgLNAa","r25JBgm","quDQANy","CLjnEuy","AMzjz2O","v1DZsu4","se5Wu24","x3nVy2TLDa","AhnWA00","yMfSu2nVCgu","sxPiu1K","AwXLtMfTzq","x29UugfNzu4","vLf3v1C","qunRB1q","CMfNzvn5BMm","y3P2wxK","AhLUvKq","yK9VyKe","x3fVC0rc","ywXSzwqGBxu","B25SAw5L","y29UBMvJDgK","y3zwshi","EMzesvG","o2nOyxjZzxq","rLDwDxe","Cgu6ia","ALjsyNq","sg1Yz2i","y2HnyxHdB3u","lcbTyxGGCMu","r1zis0e","CgLUz19VBMm","v1r1tvy","uvH6tem","ugHxzge","v0fVy1O","uMXIExC","Ef9MCM9UDgK","zv9ZDwnJzxm","AgfZ","DwrqAhG","yMXUy3y","vgHRC2K","qLP4ANK","Aw5L","mdaWma","u3nhs3K","yuXICLe","DxjS","qufduLK","ELzRqLG","u3bnq2u","EuPYvfC","x3DHAxq","ywrKq291BNq","uxzfzfq","AwP4uuO","zw5NDgG","thPcwu4","tM9ou3O","qKPZsNG","CLnkDuG","Aw5Lza","su5IAxq","Axbhr0e","AfD0qMi","EfvhzwW","uer6wva","tfvXEKG","seHlvK4","s3LXC0y","yw1Lu3bHy2u","qLvcs0C","DgHLBG","rNfhwvC","zLb6BLC","qMnttMi","zLDQtha","y29Uy2f0","BMCGzMfPBgu","BxDuAMK","AuLTEgi","yxbWBgLJyxq","Bhrbvhi","Aw1LCYbPBIa","B3v0sw50zxi","qK9dtuK","tw9KDwXL","BNrfBMrWB2K","C3rVCMu","DLDyzLK","zNjVBuHHC2G","sK5ssxu","D291v3O","yxbWBhK","x21PBMLoyxy","C3vJy2vZCW","Aw9Ul2PZB24","B0XiC2K","zw5XDwv1zq","B0zLEMO","x3jLywr5q2W","z0v1zxC","zxjFywnRx20","zw5fDMvUDa","C2v0u3rVCMe","BKDmtMi","Cgf5Bg9Hzfq","yMTtBvm","yw1PEwy","ywjVCNq","AMfgELG","weTXv1u","DhjPzxm","zw5ut3y","AKDiqwO","sgD0y3C","C2HkDey","zcWG","Dw5RBM93BIa","yNvMzMvYzwq","yxzqD1m","Bhf5q1q","zMPsvK0","ywrzzhy","zvvHB0S","zuXxCwO","Duvjz08","zMzmAw5L","zxq9DxrMltG","BMrTtNy","A2P2qxK","txjJzwK","D1r6t3O","zwnVBM5Ly3q","zxHWB3j0CW","tKfusvzfx0u","AgjKr0S","DxvNB0i","t1bAv3i","qvPevum","q1LZCgy","uNzmDge","BhnWthe","wKXhswu","wgPZu0W","C0Xf","ChvZAa","vMDMzxq","tLLlDeS","C3rHCNq","C3zLsu4","x3bYB3rVy28","CNjVCK1LC3m","u2fhzeq","EgvVtLi","wMvqEfK","CNLRv1K","wgvtvwi","ruX1BMK","vLnzshC","rNfRCMG","BfrPBwvVDxq","v0nJsuW","BwvY","rfL3tha","Cg94q0y","x2rYB3bhBg8","yLDhB1O","uMvJB25Uzwm","B2nRzxrtDwm","DMfSDwu","v2HQDM4","C0vQrhK","x2nYzwf0zvm","v2fnEK0","u1zRzwi","v2vPEgLUsLm","yMfSrxzLBNq","ENHICfi","Dw9Orfa","C0XPC3rLBMu","y3jLyxrLq2W","CMvQzwn0","Fdn8oxW1Fdq","y0LtCvO","Eu5twK4","C3rYAw5N","yxbWzw5Kq2G","z2v0","yKXkCKK","x2n1CNnVCK4","DxHRvKG","yNrmB2u","vM1urw8","C3rYAw5NAwy","EfLRzKK","yxjYyxLIDwy","CgXLyxnLiha","rNzsz08","uhzuB3i","z1rPBwvVDxq","suTLA2m","Bg9NsurozxC","svf6AhK","q2nss0O","reHxy24","Dgv4DfbHEwW","ywXPzcb1CMW","mtb8mtf8oxW","uMPJv0i","D0nRAuG","B09vs0S","r01OufG","A2HpDgS","AevYCM9Yrxy","x3jLy29UBMu","DvvZExO","y1zdvey","z3HftMW","r29tCvy","y3vYC29YlNm","y3r4","EfDgDMK","sLnkqva","AxnrB1nnzxm","s3rZvhC","B3nLrxzLBNq","tNHXAvi","v1j0DLa","CxfAEhO","CMv1uw0","C2XPy2u","DLHUDNu","CM92AwrLigi","tvn5B2q","s29yEgG","ufPSB2C","CwLeA0K","DhjPzxmGCMu","AKL0t3y","EKvwz2G","x21LC3nHz2u","zwvKzwq","AwrZtLC","qMH6zu0","A0LZExC","mxWY","z1zPCve","CgfNzwHPzgu","CNzHBa","t2forxu","ywHfr1u","CMvHzg9UBhK","mxW3Fdj8ohW","mhWZ","q09otKvdveK","yu9Rs04","Dg9mB3DLCKm","v0rWufK","vwv5D2K","A3byvgC","B3bLCNr5","Aw9U","v2vIu29JA2u","qvrnDhG","DwvMsNa","CNnVCL9Uyw0","z2v0sxrLBq","id4G","B3nLza","vNHYtNG","yxv0B21HDgK","y09Wzw4","Efrurw52","zwTNA3y","uhPbC0y","rfvOrw4","BKLJwfa","zhD2Afe","z2v0q3vYC28","Dg9Y","mtiWnZqWng1msgX5BW","BIWGAg9ZDg4","yM5izee","sLjMtNO","mZe3mti1nKflzhjbCW","DgLTzw91Da","B2XKvMvYC2K","yNvMzMvY","C2nYAxb0","tevOuNK","wLr3Dfi","B25szwnLAxy","Dg9hzw5LCMe","qxDIy2y","vufQv2S","tNfivgO","q2jftxi","quXm","wej2Bva","u2TqzgS","DgrpuMS","x2LZtwLUAvC","uefKALK","y29UC3rYDwm","q0L5y0u","zxjFDhrS","C2vYDMvYvgK","B25tDgfYDfi","x2XPC3rLBMu","v0flufC","zw50","z1PltxK","uu9Ssva","yxKSig5LDhC","qwjVCNrfCNi","yw5Hz2vY","u0DcDe8","ywXSB2nvBNm","x2fKzfDZtgK","BwvZC2fNzv8","Dg9cExrLCW","y2XVC2uSihC","vg9VvvC","mdaWmdaWmda","BMCGDxjSoIa","sxjbEg8","txLZtK4","B3r6rxC","tw1IBhG","t3rlCha","uKjor1m","zM9YrwfJAa","C2HPzNq","y2f2qKO","rgrLzui","ywXSq3vYC28","D3nZoI8V","Bg55ufC","teXxvKi","EevztgK","D2LKzfq","y21TB3q","ru9LzhC","suX6z3a","B2zMC2v0","zgvSzxrL","ChvUsNa","weL6CxC","quDtA2G","ug90vuy","sMXvANm","r05uA1K","y2zbsKC","s3Lzs0S","CMv0CNLdB3u","C2vYDMLJzs0","qxPqAxe","CffvvuK","CMvZzxrdB3u","uLLcsu0","yLHKyMC","swrLDKu","zwXowfi","yvjSqNe","C2v0q3vYC28","CM9YrxzLBNq","zNjVBNrPzxi","zw5HyMXLuw8","sMX2BeO","A3LMCvC","zw5JB2rLrNi","mNWWFdf8m3W","AefJA01LC3m","uKneANa","zvjOqvK","z29fDKu","swvRsLe","yvDWz1e","B21mDvm","ywzL","AwDHDg9Yt24","swHPtuC","vxfUCKy","x2LUAxq","s05HwNy","v1DmDKq","yMfJA3vWigu","z29PBMCGyxC","qMfNA2e","y29UBMvJDa","yxnL","Dg9cExrLC0i","y3jLyxrLuMu","EejnD04","Cgf5Bg9Hzeu","uLHpwhq","r2PeuLK","u2HHCMvKv28","tenhA0S","DNfYtuK","Dgv4Dc9WBge","nNW0Fde","AhH3tge","ignVzgu6ia","y2uGBM90igK","y2XVC2u","y2XVC2veqG","Eg5nzLO","BxnN","v3nxCKu","BxnNsuq","s3HSAhO","tgL0DhO","ANvyA0i","AKnTBg0","wvbXBha","sKDRwM8","DKvYAe8","rwTLrwO","ufHUtKG","AeHzwui","m3W0Fdv8mhW","BM93","uM55Dg8","u05zCNm","tvrwvhe","r01kq24","Cg1nyLC","DxzqA0e","DuLns1C","zxH0zw5ZAw8","DMP2Ahi","qKfpzLe","vMvlAwy","sgXOuuu","lcbOB3n0BMe","CYbHBhjLywq","z1jOtfO","s1ffv2G","B3bLBIa","m3WX","x29Ut3bLBG","y0rlvLK","zxjFCw9Z","icSG","ywr2yw5Jzq","rfjevu0","CwnLzui","sgXTuhy","AenTsxm","CNboBuS","DhDVCMTdAge","z2vtEw5J","ywnRDxbfBMq","v0voEKO","CKztCu8","s2TkzLi","FdH8m3WWFdC","Cg9W","uhn1s3q","uNDfBu4","D2HUyMG","y3vYC29Y","CfLtzu4","y0jsuNi","uNLnCwS","yMLUza","tKTHwwO","y3vYDMfSDwu","DMjZwvu","C0DZufa","zM9Yy2u","l3DZl3yY","qvjrwKi","A0TTr2O","B25VCgvU","CKzyC28","s1LxsMO","Aw5KzxHpzG","shbIAKu","Chv0","Aw5PDcbrB1m","BKvsuxy","t3bLBKv2zw4","AhPZyNK","twvZC2fNzuu","uwrcCfq","q3Pyzei","s0jnvee","u1DOweq","CeDRr1u","twLZC2LUzYa","vgTpCNu","DMLJzuLeig8","zuDnrNu","Dhr3Awq","BMXwze8","B25nzxnZywC","AM9KCwe","q3DUEKG","y1DPrxC","BuPRsMe","CMvZDwX0","yw1hy0G","C3PXrey","zxrxB3jRq2G","AgHuEvu","vfz0A1u","CMvXDwLYzwq","BhrPCgXLihq","Bwf4uMv0CMK","z0nuwha","Bhm6ia","BMDQrwi","BgvUz3rO","t1LLt08","CKzcv1O","wK1MA3i","Bg93","sfnzweG","wMffv2C","zv90Aw1LB3u","y2HHCKnVzgu","rvPwyuy","uw1zufy","C2v0y3vYC28","Cg9pueK","y3vZDg9Tshq","CgfYC2u","rfjYDva","B3L6Cg0","A3Lyuhy","Bwv0Ag9K","mxW0Fdn8mNW","yLbdA2q","B25fCNjVCG","quDxwhK","y291BNq","x2LZv29YA2u","u3D6AeC","DgHHBIbSB2m","zMLUza","vgDltMW","ELjlEfe","C3nHz2vfDMu","yMTSCNO","C0nVDw50zxi","y29UBMvJDca","x19LC01Vzhu","yvHVt3O","uvr4C2W","Dgz4ww8","D0D4tKm","sMfSqwO","x2rLyNvN","AfH0qLi","Cujhugi","Bg9N","vKHpwhm","rvvbChm","yu9cAhy","rhzbrM4","s0zutfm","ywX3yxLZ","EfzuvNG","mtmWnZiWnxvTDwLqqq","qNDJDKy","AwXSihvZzsa","zw5JB2rPBMC","DhLWzq","DejyB2u","txHHzMe","s0DsDe4","wvrhwxG","wKLzvvu","CgfNzxnOB3C"];return Ln=function(){return r},Ln()}var E=k;(function(r,e){let i=k,a=r();for(;;)try{if(parseInt(i(1376))/1*(parseInt(i(1195))/2)+parseInt(i(719))/3*(parseInt(i(1695))/4)+-parseInt(i(566))/5+parseInt(i(1241))/6*(parseInt(i(1154))/7)+-parseInt(i(1699))/8+-parseInt(i(1980))/9+parseInt(i(494))/10===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Ln,657789);var Lx=Object[E(576)+E(1675)],Bx=Object[E(1294)+E(657)+E(972)],ki=(r,e)=>function(){return r&&(e=(0,r[{nIrnd:function(f,l){return f(l)}}[E(917)](Bx,r)[0]])(r=0)),e},Ox=(r,e)=>{let i=E,a={xVgrz:function(f,l,h,m){return f(l,h,m)}};for(var x in e)a[i(1331)](Lx,r,x,{get:e[x],enumerable:!0})};function zx(){return vi||(vi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Mx(){let r=E;return Si||(Si=[IDBCursor.prototype[r(1860)],IDBCursor[r(535)+"e"][r(541)],IDBCursor[r(535)+"e"]["continue"+r(589)+"ey"]])}function qx(r){let e=E,i={rijzB:e(1509),FxncP:function(x,f){return x(f)},kTiqL:function(x){return x()},UZYhv:function(x,f){return x!==f},WRGya:e(1870),UjfMU:e(2081),QAcBW:function(x,f){return x-f},WFfgO:function(x,f){return x instanceof f}},a=new Promise((x,f)=>{let l=e,h={FWVuq:function(b,D){return i.QAcBW(b,D)}},m=()=>{let b=k;r[b(775)+"entListe"+b(1232)](i[b(532)],y),r[b(775)+"entListener"](b(586),S)},y=()=>{let b=k;i[b(2005)](x,Te(r.result)),i[b(2110)](m)},S=()=>{let b=k;if(i[b(583)](i[b(987)],i[b(1224)]))i[b(2005)](f,r[b(586)]),m();else{let D=_0x5d6360.substring(0,h[b(1437)](4,_0x4e1bad[_0x4e5f20].length)),R=D[b(1491)](_0x4299d0[_0x5865e4]);_0x3af903[b(1560)](R)}};r[l(697)+"Listener"]("success",y),r[l(697)+l(840)]("error",S)});return a.then(x=>{let f=e;i[f(672)](x,IDBCursor)&&Dr[f(794)](x,r)})[e(2085)](()=>{}),On.set(a,r),a}function Kx(r){let e=E,i={AycuX:function(x,f){return x===f},ILXyf:e(1737),kyXPv:e(916),jGHAj:"complete",GxPpb:e(586),vvFLi:e(1997),nRJto:function(x,f){return x(f)},znYKV:e(1729)+"or",jRRbt:function(x){return x()},nHNwt:function(x,f){return x(f)},bbRzw:function(x){return x()},YTGYx:"abort"};if(Bn[e(1452)](r))return;let a=new Promise((x,f)=>{let l=e,h={XyIOs:function(b){return i[k(1439)](b)},hfltx:function(b,D){return i.nHNwt(b,D)},eLWqj:function(b){return i[k(1341)](b)}},m=()=>{let b=k;if(i[b(1233)](i[b(666)],i[b(1946)]))return this[b(1418)][b(1845)+"ns"];r[b(775)+"entListe"+b(1232)](i[b(1528)],y),r[b(775)+b(1077)+"ner"](i[b(816)],S),r[b(775)+b(1077)+b(1232)](b(1523),S)},y=()=>{let b=k;x(),h[b(1365)](m)},S=()=>{let b=k;i[b(1233)](i[b(2013)],i[b(2013)])?(i[b(1207)](f,r[b(586)]||new DOMException(b(1729)+"or",i.znYKV)),i[b(1439)](m)):(this[b(499)]=!1,h[b(1303)](_0x211246,this[b(1348)+"ionTimeo"+b(1076)]),h[b(1539)](_0x3288d6))};r["addEvent"+l(840)](i[l(1528)],y),r[l(697)+l(840)](i[l(816)],S),r[l(697)+l(840)](i[l(1988)],S)});Bn.set(r,a)}function Ux(r){zn={WCdfc:function(a,x){return a(x)}}[E(1042)](r,zn)}function Fx(r){let e=E,i={CLJxi:"going away, try "+e(2118)+e(1133)+e(822),FnIqa:function(a,x){return a(x)},iBHty:e(1895),GVHKA:e(741),ulapm:e(1760),EHbJl:e(1602),xEXBj:"getKey",urhTK:e(1271),ELQzb:e(1952),OCfvu:function(a){return a()},sCaiH:"PzujE",EOiZt:function(a,x){return a(x)},qOebT:function(a,x){return a<x},XcxjE:function(a,x){return a===x},HKrXG:"DHpjU",oOcNh:function(a,x){return a(x)},aRlBq:function(a,x){return a===x},uJYhd:function(a,x){return a in x},sbbGL:e(914)+e(713),JcmbB:function(a,x){return a===x},rcczC:e(1971),PXnNH:e(639)};if(i[e(1778)](r,IDBDatabase[e(535)+"e"]["transact"+e(1676)])&&!i[e(1320)](i.sbbGL,IDBTransaction[e(535)+"e"]))if(i.JcmbB(i.rcczC,i[e(1834)])){if(!this[e(1013)+e(1217)]()||this[e(1514)+e(1683)])return;this[e(1272)+e(773)]?.[e(695)+e(1084)+"fig"](),this[e(1179)+"sCounter"]?.[e(1773)+e(977)](),this[e(1270)]?this._disconnect(1001,i.CLJxi,!0):this[e(1348)]()}else return function(a,...x){let f=e,l=r[f(863)](i.FnIqa(Ht,this),a,...x);return kr.set(l,a.sort?a[f(522)]():[a]),Te(l)};return i[e(1150)](Mx)[e(1250)](r)?function(...a){let x=e;if(x(1198)===i[x(1095)])return r[x(1507)](i[x(1177)](Ht,this),a),i.EOiZt(Te,Dr[x(1602)](this));{let f=("4|5|2|0|"+x(1855))[x(742)]("|"),l=0;for(;;){switch(f[l++]){case"0":_0x2578b2=[i.iBHty,i[x(1443)],i[x(1123)],x(1401)];continue;case"1":_0x3c241c(h=>({...h,get:(m,y,S)=>_0x52f089(m,y)||h[x(1602)](m,y,S),has:(m,y)=>!!_0x4cb7ff(m,y)||h.has(m,y)}));continue;case"2":_0x20ad14=[i[x(2097)],i[x(1321)],i[x(915)],"getAllKeys",i[x(1328)]];continue;case"3":_0x485834=new _0x387a18;continue;case"4":_0x4fdea9();continue;case"5":i[x(1150)](_0x186aa8);continue}break}}}:function(...a){let x=e;if(i[x(642)](i[x(1152)],x(1469))){let f=this[x(1723)+"rs"][_0x486a34];if(f)for(let l=0;i.qOebT(l,f[x(1929)]);)f[l].fn===_0x4a23c6?f[x(1378)](l,1):++l}else return i[x(680)](Te,r[x(1507)](Ht(this),a))}}function Hx(r){let e=E,i={FyvkM:function(a,x){return a===x},lgnMo:"function",FAeRF:function(a,x){return a instanceof x},sQTPH:function(a,x){return a(x)},fPznW:function(a,x,f){return a(x,f)},RyMqk:function(a){return a()}};return i.FyvkM(typeof r,i[e(2063)])?Fx(r):(i.FAeRF(r,IDBTransaction)&&i.sQTPH(Kx,r),i[e(1488)](Di,r,i[e(1880)](zx))?new Proxy(r,zn):r)}function Te(r){let e=E,i={vAkaZ:function(x,f){return x instanceof f},kMPid:function(x,f){return x(f)},sYrRh:function(x,f){return x(f)},KTJrH:function(x,f){return x!==f}};if(i.vAkaZ(r,IDBRequest))return i[e(854)](qx,r);if(Rn.has(r))return Rn[e(1602)](r);let a=i[e(497)](Hx,r);return i[e(1030)](a,r)&&(Rn.set(r,a),On[e(794)](a,r)),a}var Di,vi,Si,Dr,Bn,kr,Rn,On,zn,Ht,Ei=ki({"node_modules/idb/build/wrap-idb-value.js"(){let r=E,e={XKDJS:function(i,a){return i instanceof a},fLXYn:function(i,a){return i===a},LoYbf:r(571),wYbnD:r(886),Bhkdu:function(i,a){return i===a},enTOv:r(1502),UAjWk:function(i,a){return i===a},AYLAf:function(i,a){return i in a}};Di=(i,a)=>a.some(x=>i instanceof x),Dr=new WeakMap,Bn=new WeakMap,kr=new WeakMap,Rn=new WeakMap,On=new WeakMap,zn={get(i,a,x){let f=r,l={gEuew:function(h){return h()}};if(e[f(668)](i,IDBTransaction))if(e.fLXYn(e[f(2099)],e.LoYbf)){if(a===e.wYbnD)return Bn.get(i);if(e[f(1144)](a,"objectStoreNames"))return i[f(914)+"oreNames"]||kr.get(i);if(e[f(882)](a,e.enTOv))return x[f(914)+f(713)][1]?void 0:x[f(914)+"ore"](x[f(914)+f(713)][0])}else _0xf043c(),FSRWfE[f(1515)](_0x1464be);return Te(i[a])},set(i,a,x){return i[a]=x,!0},has(i,a){let x=r;return i instanceof IDBTransaction&&(e.Bhkdu(a,e[x(864)])||e[x(1709)](a,e[x(1527)]))?!0:e[x(2090)](a,i)}},Ht=i=>On[r(1602)](i)}}),Pi={};Ox(Pi,{deleteDB:()=>Gx,openDB:()=>jx,unwrap:()=>Ht,wrap:()=>Te});function jx(r,e,{blocked:i,upgrade:a,blocking:x,terminated:f}={}){let l=E,h={jCyMO:function(S,b,D,R,N){return S(b,D,R,N)},ILzgp:function(S,b){return S(b)},bOPuq:l(1820),KhkKy:"versionc"+l(715),PVPwR:function(S,b){return S(b)},WRtvP:l(2028)+l(1656),uogbm:"blocked"},m=indexedDB.open(r,e),y=h.PVPwR(Te,m);return a&&m[l(697)+l(840)](h[l(1642)],S=>{let b=l;h[b(644)](a,h[b(1758)](Te,m[b(1917)]),S[b(1701)+"on"],S[b(943)+"on"],Te(m["transact"+b(1676)]))}),i&&m[l(697)+"Listener"](h.uogbm,()=>i()),y.then(S=>{let b=l;f&&S[b(697)+"Listener"](h[b(1046)],()=>f()),x&&S[b(697)+b(840)](h.KhkKy,()=>x())})[l(2085)](()=>{}),y}function k(r,e){r=r-493;let i=Ln(),a=i[r];if(k.oOBqHE===void 0){var x=function(m){let y="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",S="",b="";for(let D=0,R,N,L=0;N=m.charAt(L++);~N&&(R=D%4?R*64+N:N,D++%4)?S+=String.fromCharCode(255&R>>(-2*D&6)):0)N=y.indexOf(N);for(let D=0,R=S.length;D<R;D++)b+="%"+("00"+S.charCodeAt(D).toString(16)).slice(-2);return decodeURIComponent(b)};k.EhXxTz=x,k.GmKFKS={},k.oOBqHE=!0}let f=i[0],l=r+f,h=k.GmKFKS[l];return h?a=h:(a=k.EhXxTz(a),k.GmKFKS[l]=a),a}function Gx(r,{blocked:e}={}){let i=E,a={mgXoj:function(f,l){return f(l)}},x=indexedDB[i(1071)+"tabase"](r);return e&&x[i(697)+"Listener"](i(980),()=>e()),a[i(636)](Te,x)[i(1486)](()=>{})}function Ci(r,e){let i=E,a={yfbli:function(m,y,S){return m(y,S)},cISqZ:function(m,y,S){return m(y,S)},NWAAL:function(m,y){return m(y)},IkQJu:i(1114)+"e",VxrNx:i(1666),tBXoe:function(m,y){return m in y},DnJtv:function(m,y){return m===y},MxBKu:i(827)};if(!(r instanceof IDBDatabase&&!a[i(1985)](e,r)&&a[i(1023)](typeof e,i(1600)))){if(a[i(1094)]===a.MxBKu)return;a[i(1140)](_0xbcc55f,_0x3c13e5,24),a[i(1598)](_0x59e8a9,_0xafaf4b,a.NWAAL(_0x2e2110,_0x84d773))}if(Nn[i(1602)](e))return Nn[i(1602)](e);let x=e[i(986)](/FromIndex$/,""),f=e!==x,l=Ii[i(1250)](x);if(!a.tBXoe(x,(f?IDBIndex:IDBObjectStore).prototype)||!(l||Ti.includes(x)))return;let h=async function(m,...y){let S=i,b=this["transact"+S(1676)](m,l?a[S(1342)]:a[S(1684)]),D=b[S(1502)];return f&&(D=D[S(862)](y[S(1747)]())),(await Promise[S(1012)]([D[x](...y),l&&b[S(886)]]))[0]};return Nn[i(794)](e,h),h}var Ti,Ii,Nn,Wx=ki({"node_modules/idb/build/index.js"(){let r=E,e={OcqBT:r(1836)+r(1660),oyzpm:"clear",IdevE:function(x){return x()},DUhEn:r(1390),IKekc:"getAll",ZLGIe:r(820)+"ys",CsuMD:r(1952)},i=e.OcqBT[r(742)]("|"),a=0;for(;;){switch(i[a++]){case"0":Ii=[r(1895),r(741),r(1760),e[r(1945)]];continue;case"1":Nn=new Map;continue;case"2":Ux(x=>({...x,get:(f,l,h)=>Ci(f,l)||x[r(1602)](f,l,h),has:(f,l)=>!!Ci(f,l)||x[r(1452)](f,l)}));continue;case"3":e[r(1776)](Ei);continue;case"4":e.IdevE(Ei);continue;case"5":Ti=[r(1602),e[r(1690)],e[r(1615)],e[r(1557)],e[r(1101)]];continue}break}}}),Jx={idb:function(r){let e=E;r[e(1548)]=Promise[e(1020)]().then(()=>(Wx(),Pi))[e(1486)](function(i){return i})}},Ai={};function Pe(r){let e=E,i={iImxb:function(f,l){return f!==l}};var a=Ai[r];if(i[e(1494)](void 0,a))return a[e(1548)];var x=Ai[r]={exports:{}};return Jx[r](x,x[e(1548)],Pe),x.exports}(()=>{let r=E,e={cOmSm:function(i,a){return i+a},eniid:function(i,a){return i!==a},OGpmo:r(1393)};Pe.d=(i,a)=>{let x=r,f={BHZTl:function(h,m){return e[k(1227)](h,m)}};if(e[x(1091)](e[x(1215)],e[x(1215)])){let h=_0x593b97(_0xf266bc,_0x373d58);return _0x16fff6[x(1032)][x(777)](h,f[x(920)](h,_0xf9f9e8))}else for(var l in a)Pe.o(a,l)&&!Pe.o(i,l)&&Object.defineProperty(i,l,{enumerable:!0,get:a[l]})}})(),(()=>{let r=E;Pe.o=(e,i)=>Object.prototype[r(703)+r(1675)][r(863)](e,i)})(),(()=>{let r=E,e={NLyUz:r(708)+"d",KtsTw:r(1500),wGxNC:r(1963)+"le"};Pe.r=i=>{let a=r;e[a(1162)]!=typeof Symbol&&Symbol.toStringTag&&Object[a(576)+a(1675)](i,Symbol[a(849)+"Tag"],{value:e[a(1639)]}),Object[a(576)+a(1675)](i,e[a(1967)],{value:!0})}})();var Q={};(()=>{let r=E,e={vsCMW:function(s,t){return s(t)},QdBpT:function(s,t){return s+t},hXtBR:function(s,t){return s+t},Ophfu:function(s,t){return s+t},OaJTJ:function(s,t){return s+t},XJwvn:function(s,t){return s(t)},UuLZA:function(s,t,n){return s(t,n)},RWNsA:r(1477),jcWUX:function(s,t){return s(t)},HHKVN:function(s,t){return s+t},kKmGj:function(s,t){return s+t},bkSmS:r(1458),aTNjt:r(1309),szXjl:r(1738)+r(1738)+r(1738)+r(1738),PgKMD:function(s,t){return s+t},WRLWn:function(s,t){return s+t},iGdXt:function(s,t){return s>t},UNKDo:function(s,t){return s<t},PvTor:function(s,t){return s!==t},grKGZ:r(1330),nGqIG:function(s,t){return s<t},ndmNv:function(s,t){return s-t},DIiKb:function(s,t){return s===t},igZMj:r(625),tfxYo:function(s,t){return s<t},Gnclc:function(s,t){return s!==t},kWNnd:function(s,t,n){return s(t,n)},bVret:function(s,t){return s!==t},RvpgZ:r(1266),ObAEc:function(s,t){return s|t},ryTTM:function(s,t){return s===t},zyJHK:"wzUsT",uUsyz:"Kkdtx",NnnSE:function(s,t){return s(t)},pMlmH:function(s,t){return s>>>t},BUBKG:function(s,t){return s(t)},CSVEl:function(s,t){return s(t)},hNhWQ:r(1906)+"required"+r(1147)+r(873),Verko:r(1906)+"required"+r(1147)+r(1584),XNGfA:function(s,t){return s&t},qceeB:function(s){return s()},TgKNl:function(s,t){return s(t)},wCkiH:"success",NlLtp:r(586),KQyaR:function(s,t){return s(t)},RCDjp:function(s){return s()},gRhLZ:r(1281),ACkoT:"open",DKnrv:r(1820),nFVok:function(s,t,n,o){return s(t,n,o)},YyifV:function(s,t){return s!==t},oOUKK:"DakMR",kFzNt:function(s,t,n){return s(t,n)},fuhYN:function(s,t,n){return s(t,n)},SWhXD:function(s,t){return s(t)},PzDBy:function(s,t){return s!==t},vpIiD:function(s,t,n){return s(t,n)},LUqzH:function(s){return s()},JlUjs:function(s,t,n){return s(t,n)},JbFsS:function(s,t){return s(t)},HEyJs:function(s,t,n){return s(t,n)},ezVtG:function(s,t){return s!==t},Ueywi:function(s,t){return s!==t},bLJrI:r(645),Totts:r(868),fKaxg:function(s,t,n){return s(t,n)},GHrAN:function(s,t,n){return s(t,n)},fjRVM:function(s,t){return s!==t},whVDS:function(s,t,n){return s(t,n)},DRruP:function(s,t){return s!==t},GQRwZ:r(760),cvOSm:"OTvaM",crXUI:function(s,t,n){return s(t,n)},cdTEm:function(s,t,n){return s(t,n)},zFAxn:function(s,t,n){return s(t,n)},TqFTS:function(s,t,n){return s(t,n)},PPnuF:function(s,t){return s(t)},blncv:function(s,t){return s(t)},cPgoX:function(s,t,n){return s(t,n)},AMtVj:function(s,t){return s(t)},GzoVy:function(s,t){return s(t)},zVkBX:function(s,t){return s(t)},WsWrE:function(s,t,n){return s(t,n)},Luvdx:function(s,t){return s(t)},hyHdV:function(s,t,n){return s(t,n)},PmETG:function(s,t){return s(t)},PTifx:function(s,t){return s(t)},gavEX:function(s,t,n){return s(t,n)},QrcDG:function(s,t){return s(t)},ARQZB:function(s,t){return s&t},BsWBi:"Missing "+r(1923)+r(1147)+r(1115),WAKPW:function(s,t){return s===t},btLoe:"Missing "+r(1923)+r(1147)+r(1121),dHkRD:r(1906)+r(1923)+r(1147)+"service",eCDWl:r(1906)+r(1923)+" field: "+r(1947),VKJlE:function(s,t,n){return s(t,n)},WCcIL:r(1073)+r(1090)+r(1438),xNVWT:function(s,t){return s>>t},BDpYu:function(s,t){return s>=t},aXoOz:r(921)+r(648),xcAqw:function(s,t,n){return s(t,n)},hWtBb:function(s,t){return s!==t},SIotg:r(1519),LvFzy:function(s,t){return s+t},xfJik:r(1585),gdTlq:function(s,t){return s*t},ejnlW:function(s,t){return s>t},hJxaY:function(s,t){return s+t},rVkDe:r(654)+"t limit",PotUF:function(s,t,n){return s(t,n)},VLzzD:function(s,t){return s+t},bhvZZ:function(s,t){return s(t)},YWwkG:"unknown "+r(942),SkPdk:r(935),ySvhC:r(1951),Vikbk:function(s,t,n){return s(t,n)},dwvhQ:function(s,t){return s|t},rBRDV:function(s,t){return s<<t},HTzgb:function(s,t){return s<t},kjvAy:r(2115),WaMzM:r(1456),QmYPV:function(s,t){return s+t},SNNWO:function(s,t){return s&t},dwXvK:function(s,t){return s(t)},Hmrgb:function(s,t){return s+t},rSJuH:function(s,t){return s&t},dGQVx:function(s,t){return s&t},PDzYP:function(s,t){return s<t},qRuVi:function(s,t){return s(t)},idsNW:function(s,t){return s==t},CzXdB:function(s,t){return s&t},omLuS:function(s,t){return s>=t},aWpgQ:function(s,t){return s+t},qiDkI:function(s,t){return s|t},qPLEP:function(s,t){return s|t},sAZQF:function(s,t){return s&t},LVlvi:function(s,t){return s&t},rOJCP:function(s,t){return s<t},urEbu:function(s,t){return s<=t},reDQK:function(s,t){return s+t},NWgdL:function(s,t){return s+t},DJeNS:function(s,t){return s|t},CzNlU:function(s,t){return s<<t},WpfEi:function(s,t,n){return s(t,n)},DerKY:function(s,t){return s&t},CYspf:r(2118)+"t",sLVvp:r(1563),OZRnk:function(s,t){return s<t},TJMpn:function(s,t){return s<t},vBwJf:function(s,t){return s<t},wetbb:function(s,t,n){return s(t,n)},psqRc:function(s,t){return s<<t},GigBA:r(1754),KYWJj:function(s,t){return s<t},NTANF:function(s,t){return s>>t},tIJik:function(s,t){return s|t},eXwBZ:function(s,t){return s&t},daXtI:function(s,t){return s|t},fWjLp:function(s,t){return s&t},PFhbh:function(s,t){return s|t},rJAuD:function(s,t){return s&t},emSyc:function(s,t){return s&t},SwgVH:function(s,t){return s<t},dnRwV:function(s,t){return s<t},AGtgA:function(s,t){return s<<t},NamGf:function(s,t){return s&t},arRTY:function(s,t){return s&t},bpIrL:function(s,t){return s>=t},jIRRH:function(s,t,n){return s(t,n)},KBMTA:function(s,t){return s(t)},juXkB:function(s,t){return s||t},jWKWL:function(s,t){return s&t},puitP:function(s,t){return s>>>t},hQJLa:r(1413),xbpAW:function(s,t){return s(t)},VdZbR:r(1698),dXjTn:function(s,t){return s&t},NAVtm:function(s,t){return s<<t},LBfkF:r(1740),XjsSL:r(1646),FqGYW:function(s,t){return s<<t},punJp:r(1083),IxDnC:function(s,t){return s&t},ucyet:function(s,t){return s<<t},Noiae:function(s,t){return s&t},AimZY:function(s,t){return s&t},mlJdN:function(s,t){return s&t},ngbRf:function(s,t){return s(t)},VOqMU:function(s,t){return s&t},hcgol:function(s,t){return s&t},ElDKk:function(s,t){return s|t},YRymZ:function(s,t){return s>>>t},bWGoZ:function(s,t){return s|t},QQNEu:function(s,t){return s===t},yeEhv:function(s,t){return s+t},wXuNV:function(s,t){return s&t},UwzgB:function(s,t){return s+t},iiCRN:function(s,t){return s|t},iQZYo:function(s,t){return s&t},ngjEb:function(s,t){return s!==t},tvpme:function(s,t){return s&t},IhiMG:function(s,t){return s>>>t},HcCjT:function(s,t){return s+t},OPZWr:function(s,t){return s>>>t},uiEwB:function(s,t){return s&t},JGkZo:function(s,t){return s|t},oKqcj:function(s,t){return s|t},dFyLm:function(s,t){return s>>>t},KCkex:function(s,t){return s&t},wTzOz:function(s,t){return s|t},HFkcm:function(s,t){return s&t},KqDzQ:function(s,t){return s&t},WRhfU:r(1561),euVVV:function(s,t){return s|t},rhkwn:r(798),bnHdA:r(1168),TNpHR:function(s,t){return s===t},GFYtT:r(1529),VSYHw:function(s,t){return s|t},VDOPD:function(s,t){return s|t},arhUx:function(s,t){return s<<t},XETik:function(s,t){return s<<t},jCmlm:function(s,t){return s<<t},ETVfJ:function(s,t){return s|t},pmMbW:function(s,t){return s<<t},ZCfJB:function(s,t){return s<<t},bGMvX:function(s,t){return s<<t},CcRKJ:function(s,t){return s|t},CCXTm:function(s,t){return s<<t},gqykZ:function(s,t){return s|t},AGSkh:function(s,t){return s<<t},vbopt:function(s,t){return s|t},zIKbe:function(s,t){return s|t},qjBnv:function(s,t){return s<<t},lcErk:function(s,t){return s<<t},LpURQ:function(s,t){return s>>>t},HPLdU:function(s,t){return s|t},Ejwti:function(s,t){return s|t},mTZIg:function(s,t){return s&t},pPqlN:function(s,t){return s>>>t},sKBae:function(s,t){return s&t},uaJQY:function(s,t){return s>>>t},dvplE:function(s,t){return s>>>t},hsGas:function(s,t){return s(t)},dyVdi:function(s,t){return s>=t},SwvgJ:function(s,t){return s|t},aTmmC:function(s,t){return s%t},KsvWI:function(s,t){return s>>>t},WigSV:function(s,t){return s>>>t},xmpla:function(s,t){return s*t},gqwRY:function(s,t){return s===t},cDKVY:function(s,t){return s&t},TVWaq:function(s,t){return s>>>t},gPHqo:function(s,t){return s&t},Eyoyd:function(s,t){return s&t},aYrch:function(s,t){return s+t},jjKnB:function(s,t){return s>>>t},VaOvY:function(s,t){return s>>>t},FkwLj:function(s,t){return s<<t},ZmJvM:function(s,t){return s|t},hynVD:function(s,t){return s===t},HMhsl:function(s,t){return s===t},OaNEu:function(s,t){return s===t},uxpEX:function(s,t,n){return s(t,n)},HlmPv:"lnkyK",SLTor:r(1181),OunBf:function(s,t){return s===t},Ohivd:function(s,t){return s===t},xnMfZ:function(s,t){return s+t},huKqo:function(s,t){return s+t},cfqiv:function(s,t){return s>>>t},xZCsh:function(s,t){return s&t},LZZuX:function(s,t){return s>>>t},aEMAh:function(s,t){return s&t},Ldbxg:function(s,t){return s>>>t},KQEWh:function(s,t){return s&t},zQwIZ:function(s,t){return s>>>t},beyea:function(s,t){return s&t},dWrUf:r(1549)+r(517),NPufJ:r(1669)+"NG_ERROR",mJkJa:"MAX_RETR"+r(1326)+"R",NwLRF:r(1113)+r(1335),wZosG:r(2094)+"OR",hsXoe:r(524),BhzeM:"4|5|1|2|"+r(1668),wouWz:function(s,t){return s|t},UMKPF:function(s,t){return s&t},NrLIh:function(s,t){return s&t},znMlF:function(s,t){return s!==t},WSeJV:"citcT",WKijB:r(973),peEIB:r(635)+r(1816),Kxlhz:r(774)+"0",WWLvD:r(1214)+"ediately"+r(832)+"ct",OldqI:r(1263),nIcXP:function(s,t){return s<=t},ljpzi:function(s,t){return s>=t},OkrdT:function(s,t){return s<<t},SnLlc:function(s,t){return s&t},lYerr:function(s,t){return s|t},cWiEw:function(s,t){return s&t},EZVaF:function(s,t){return s<<t},lvWDK:function(s,t){return s+t},ZTwtR:function(s,t){return s!==t},CwnzH:"gWwMM",ACzwG:r(1082),ioDqr:function(s,t){return s===t},OtlqY:r(880),PsOaD:function(s,t){return s>=t},VBcbC:r(1229)+r(1597)+r(1358)+"0",uzrKM:function(s,t){return s<t},bpBHq:function(s,t,n,o){return s(t,n,o)},ieHUL:function(s,t){return s|t},uOWbj:function(s,t){return s>>>t},ZIYUU:function(s,t){return s|t},pGkGU:function(s,t){return s<t},BHEad:function(s,t){return s|t},tHqmc:function(s,t){return s|t},NhXjC:function(s,t){return s&t},czvYy:function(s,t){return s===t},DYwLp:function(s,t){return s+t},yhWKq:function(s,t){return s+t},ngIuQ:function(s,t){return s===t},cjTyP:function(s,t,n){return s(t,n)},EypGz:function(s,t){return s!==t},hhTyU:r(1367),UEVJw:r(496),hlvqI:function(s,t,n){return s(t,n)},dwrqV:r(1734)+"id",TXEoB:function(s,t){return s!==t},LzBYN:r(2114),PuKEw:function(s,t,n){return s(t,n)},PHrsU:function(s,t,n){return s(t,n)},nCMLn:function(s,t){return s===t},fgeSR:"mSUju",IePYp:function(s,t,n){return s(t,n)},amiyf:function(s,t){return s instanceof t},Bagka:r(1002),iqVay:function(s,t){return s>>t},rFBWZ:function(s,t){return s>=t},iQFKq:function(s,t){return s!==t},FvRgO:r(1363),roEPd:r(708)+"d",ZIGvQ:"2|3|0|1|4",qqZxz:function(s,t){return s!=t},KFTLS:function(s,t){return s<t},EOedw:function(s,t){return s<t},GzRhy:function(s,t){return s===t},SGBtO:function(s,t){return s&t},zlGwS:function(s,t){return s+t},JNRIu:r(2112),jQNRX:"next() c"+r(1431)+r(1924)+r(1497)+r(877),fruMn:function(s,t){return s(t)},ZElca:function(s,t){return s===t},PJBtW:function(s,t){return s&t},KTeJD:function(s,t){return s-t},PzAsF:function(s,t){return s<t},nTzCu:function(s,t){return s|t},TVtkU:function(s,t){return s<<t},UnbAa:function(s,t){return s|t},KvKrp:function(s,t){return s|t},klxyH:function(s,t){return s<<t},HSYXH:function(s,t){return s&t},AZDUC:function(s,t){return s&t},yEdXn:function(s,t){return s&t},Saxzx:function(s,t){return s===t},SwzhG:r(1672),IIGFu:r(1727),kNVul:function(s,t){return s|t},kJUwZ:function(s,t){return s|t},ENiXR:function(s,t){return s>>t},gQgSd:function(s,t){return s&t},FodRO:function(s,t){return s+t},BhgTE:"4|1|5|2|0|3",mrEpw:function(s,t){return s&t},BGanU:function(s,t){return s>>t},ekgkv:function(s,t){return s|t},vbsYU:function(s,t){return s<<t},SNYrs:function(s,t){return s&t},uYvQd:function(s,t){return s|t},IdGyw:function(s,t){return s>>t},RbnTH:function(s,t){return s&t},LCGkK:r(1600),WAocZ:function(s,t){return s(t)},KRmsn:function(s,t,n,o){return s(t,n,o)},PCEvo:function(s,t){return s instanceof t},OtKpp:function(s,t){return s==t},TiQSC:r(1815)+r(545)+r(1542),DOGTU:r(1350),lYFxN:"ppe",xWFvi:"TMILf",DRDUM:function(s,t){return s!==t},gksgI:r(562),jTIJd:r(1710),rncjC:r(1703),eXLyc:r(2062)+"ack=fron"+r(2111)+"P",LgCnV:function(s,t){return s(t)},KGRtN:r(2017),LPfMz:function(s,t,n,o){return s(t,n,o)},jfIgj:function(s,t){return s===t},szqDF:r(879),JalAj:function(s,t){return s!==t},NKaYj:r(1799),uIMKW:function(s,t){return s<<t},YWkHb:function(s,t){return s|t},VIXzU:function(s,t){return s<<t},ToOvn:function(s,t){return s!==t},Dohev:r(1832),UUlfi:r(2092),bjyMn:function(s,t){return s===t},vDIsn:r(857),duaUk:r(1999),QvRmS:r(1151),hspkM:function(s,t){return s||t},ciAQr:r(1432),JEcez:r(847),xUGel:"pageshow",uohDP:r(1551),rdpAk:function(s,t){return s||t},jEqXf:function(s,t){return s||t},KTBPz:r(1273),YcZdb:r(836),uhsYg:"received",lqnlu:r(1462),NRJIx:function(s,t){return s!==t},DonXI:r(1650),YLEcU:r(2029),bOobA:function(s,t){return s||t},hbdGK:function(s,t){return s||t},Vhqkz:function(s,t){return s||t},RXOXt:function(s,t){return s!=t},kMXbG:function(s,t){return s*t},SsGKy:function(s,t){return s===t},FrVHs:r(1743),tAbfq:function(s,t){return s(t)},lrHzU:r(1648),QHCPn:function(s,t){return s(t)},ITNDy:function(s,t){return s<t},IQzhy:r(544),DHWcn:function(s,t){return s>t},weMCa:function(s,t){return s!==t},IwEoq:r(1027),EpSQD:function(s,t,n,o){return s(t,n,o)},ZuNdn:r(1450)+r(1858),BOCMI:function(s,t,n,o){return s(t,n,o)},hiVxd:r(1450)+"er_is_ack",BJsJx:function(s,t,n){return s(t,n)},uhVwJ:r(1450)+r(1516)+r(1026),DdeeB:function(s,t,n,o){return s(t,n,o)},QIXJq:r(687),idlQY:function(s,t){return s&&t},Adryf:r(870),GMhPX:function(s,t){return s||t},VeKif:r(1043),dSejO:function(s,t){return s(t)},cvVHr:function(s,t){return s instanceof t},XIVTe:r(1495)+r(1510),lJhdI:r(1495)+r(1510)+r(1436)+r(1311),QpNlc:"none_none",lHXRs:r(959),wpiKm:function(s,t){return s+t},dyOiS:function(s,t){return s&t},eRsoI:function(s,t){return s>>>t},ZMfkr:function(s,t){return s>>>t},khOtk:function(s,t){return s<<t},rUzGF:r(1846),OtZGG:"OHGPf",VMBmR:function(s,t){return s(t)},rIAOs:function(s,t){return s+t},ZaEWg:function(s,t){return s+t},xZnaR:function(s,t){return s+t},jaFzX:function(s,t){return s+t},gViqQ:function(s,t){return s+t},aOkKN:"index ou"+r(2002)+"ge: ",mYgqG:r(1859),MulER:function(s,t){return s||t},QkgVu:r(1682),bHqZG:r(1339)+"3",vWTtK:function(s,t){return s!=t},FSHRm:r(618)+"too large",IqrfN:r(861),qaBIr:function(s,t,n){return s(t,n)},mwTji:function(s,t){return s+t},KlTYk:function(s,t){return s<t},xGAuN:r(505),poxCF:"CyEVJ",SCCFO:r(2001),smXBC:r(850)+"4",HcVXx:function(s,t){return s<t},yNSZN:function(s,t){return s+t},tWSXg:function(s,t,n,o){return s(t,n,o)},CIAXe:function(s,t){return s+t},Fqkrh:function(s,t){return s<<t},EWLzB:function(s,t){return s+t},eDAco:function(s,t){return s<<t},Awbcf:function(s,t){return s+t},TPULV:function(s,t){return s+t},rUSuC:function(s,t){return s|t},hjHJf:function(s,t){return s<<t},aYAUe:function(s,t){return s+t},poOPI:function(s,t){return s<<t},kBfuS:"RFEKr",vqrMI:function(s,t){return s>>>t},rpNmK:function(s,t){return s+t},BDoRP:function(s,t){return s+t},oISVC:function(s,t){return s+t},kODZW:function(s,t){return s&t},cmmot:function(s,t){return s>>>t},XtnVv:function(s,t){return s+t},RwEmN:function(s,t){return s&t},UqnrF:function(s,t){return s+t},jqHhv:function(s,t){return s+t},TeBHY:r(1622)+r(1667)+"5|3|4|6|0",rFXso:function(s,t){return s|t},OGEia:function(s,t){return s|t},noxnJ:function(s,t){return s<t},Shvme:function(s,t){return s|t},nlzTs:function(s,t){return s>t},YPqlp:function(s,t,n,o){return s(t,n,o)},hVPbI:function(s,t){return s<<t},RjcWB:function(s,t){return s>>>t},mWnWV:function(s,t){return s>>>t},XType:function(s,t){return s&t},yAoGK:function(s,t){return s|t},XKqWU:"nERQv",ELuni:function(s,t,n,o){return s(t,n,o)},GExAB:r(1397),mesuc:function(s,t){return s(t)},ltATr:r(1325)+"ile_name",aLbrQ:function(s,t,n,o){return s(t,n,o)},BvoSo:r(1632),NMtIo:r(975)+"_EXIST",tfxkB:function(s,t,n){return s(t,n)},kpXTg:r(1750)+"rValues",gDFNI:r(1712),bbRoC:function(s,t,n,o){return s(t,n,o)},KUJNX:r(547),vLnQm:"CONTINUE",oFezj:r(911),NXZzM:function(s,t){return s(t)},HNpSn:r(1940)+"r",NYKtK:r(834),GJXSJ:function(s,t){return s||t},iXinn:r(579),zllHX:r(592),zfDIX:function(s,t){return s||t},xVTVx:"code",nhcyH:r(1005),MGrGn:r(1450)+r(910),elNXR:function(s,t){return s(t)},vEIQT:function(s,t,n){return s(t,n)},yNERC:r(1450)+r(1720),PPOVq:r(1034)+"s",amGcH:r(962)+r(1680)+"e",GCTVa:function(s,t){return s(t)},VkVou:function(s,t){return s>t},GBbPm:"jSFED",LzJJQ:function(s,t){return s===t},YIclb:r(985),nFRcV:r(768),sveIN:function(s,t){return s+t},kIsyw:function(s){return s()},Mrcei:r(1087),lEJCN:r(1986),gqcLk:function(s){return s()},jcChM:function(s,t){return s!==t},cBRRr:r(2103),jHxYB:function(s){return s()},VTZFR:function(s){return s()},ESaWU:function(s,t){return s&&t},ndJLw:function(s){return s()},XuRof:function(s,t){return s===t},gqPpK:r(1472),mWSYN:function(s,t){return s!==t},VQwWW:"VcDRQ",GBJdy:"ruQTs",aoWYo:function(s,t){return s!==t},xmVkB:r(1592),gZKMy:function(s,t,n){return s(t,n)},rsWZm:function(s,t){return s===t},KoXxh:r(1978),gJukt:"auto",nvywC:function(s,t,n){return s(t,n)},xeToi:function(s,t){return s!==t},ShCoa:function(s,t,n){return s(t,n)},cwcHY:function(s,t){return s!==t},EoDch:function(s,t,n){return s(t,n)},SoDdg:function(s,t,n){return s(t,n)},PAdjY:function(s,t){return s!==t},CABCa:r(761),AHFrR:function(s,t){return s/t},kFgkg:function(s,t){return s==t},nXYEU:function(s,t){return s===t},XeSUb:r(1611)+"rovide v"+r(1621),QXzLC:function(s,t){return s(t)},nlVdO:r(1662),eRhAY:function(s,t){return s>>>t},zAyCz:function(s,t){return s|t},xBMwN:function(s,t){return s|t},IekJQ:function(s,t){return s|t},GLjTN:function(s,t){return s<<t},LmVNJ:function(s,t){return s>>>t},zoHFu:function(s,t){return s<<t},dUBZt:r(1165),INbit:r(1847),wtdmo:function(s,t){return s!==t},lQIFE:"https:",nHRUf:r(1751),ynjcC:r(2078),JSJAP:r(1833),WWsIN:"device_id",WSjNE:r(1611)+r(1647)+"ddID, de"+r(1908)+r(826),JTiUy:function(s,t){return s==t},oojVJ:r(1103),uALpb:function(s){return s()},obDcD:function(s,t,n){return s(t,n)},NmjLM:"fws_1.0.0",tIirk:function(s,t,n){return s(t,n)},hJRCF:r(1065),vlZrK:function(s,t){return s>t},fxRgf:function(s,t){return s&t},wospY:function(s,t){return s!==t},DTBDs:r(2082),vwtoB:r(684)+">",bklrz:function(s,t){return s*t},kZIfc:function(s,t){return s instanceof t},mWxVf:function(s,t){return s===t},rnwPc:r(1312),lnyPW:function(s,t,n){return s(t,n)},KyYKK:function(s,t){return s!==t},BRrHF:function(s,t){return s===t},aVNBV:r(590),HDMKI:r(1700),rRMyF:function(s){return s()},swxci:function(s,t){return s===t},QvEdT:r(1447),fTKER:r(1766),oLtzx:r(1802)+r(2058)+r(2118)+r(1133)+r(822),nbBPI:function(s,t,n){return s(t,n)},IeRwF:function(s,t){return s(t)},Rnyto:r(1786)+"4",cVCTF:"1|0|2|4|3",BNKzT:function(s,t,n,o){return s(t,n,o)},naNpv:r(1883),oLHsi:function(s,t,n){return s(t,n)},eWZYV:function(s,t){return s!==t},VMZaI:r(1976),zwYRu:function(s,t,n){return s(t,n)},HmEia:function(s,t){return s instanceof t},ZdmIC:"zuHRP",GjDRY:r(740),ATMtx:function(s,t){return s!==t},PUwWP:r(2033),AzPiq:r(785),KpkcG:r(1753),lZvbh:function(s,t){return s!==t},gCTXp:r(549),opSyp:r(1314),RvLta:r(1948)+r(837),eGMFu:"close, w"+r(771)+r(1819)+r(1160)+"ed",pGzFQ:r(1736)+r(1851)+r(1384),BwcvF:function(s,t){return s<t},ZWbLD:function(s,t){return s&t},Thksi:function(s,t){return s>>t},rykWY:function(s,t){return s|t},knKyZ:function(s,t){return s&t},qtddd:r(1611)+r(1120)+r(2003)+r(1007)+r(596)+r(2076)+r(1357)+r(493)+r(811),shJtF:function(s,t){return s==t},yJrTW:function(s,t){return s!=t},CmdIb:function(s,t){return s(t)},GMJCn:function(s,t){return s instanceof t},hzsby:function(s,t){return s(t)},RmGne:"YYRWm",UsigB:"sent",hxwLa:r(1352),MpCMJ:r(1489),zGcdI:function(s,t){return s==t},adYdv:r(1142)+r(1547)+"ing",wlfbN:"ping_onc"+r(1936)+"t",MWwOt:"\0\0\0\0\0\0\0\0",qbBCB:function(s,t){return s*t},viePM:r(553),bXdbg:function(s,t){return s===t},Littz:function(s,t){return s!=t},bZaWw:function(s,t){return s===t},PsuKt:r(502)+r(1400)+r(736)+"pe",qHnLm:"Object",BOscO:function(s,t){return s===t},IRqel:r(1812)+"rkerGlobalScope",RYBIM:r(536)+r(504)+r(1420),zbzqY:function(s,t){return s!=t},AVAOs:function(s,t,n){return s(t,n)},mzNAZ:r(588)+"qos__"};Pe.r(Q),Pe.d(Q,{FWS:()=>Y0,CustomErrorEvent:()=>gs,createCloseEvent:()=>we,ReconnectEvent:()=>hs,createErrorEvent:()=>ge,decodedFrame:()=>cs,createOpenEvent:()=>bs,CustomCloseEvent:()=>ps,createReconnectEvent:()=>cr,FrontierMessageEvent:()=>_s,encodeFrame:()=>xr,createMessageEvent:()=>ys,OpenEvent:()=>ws,ErrorCode:()=>je,Event:()=>xt,MessageEvent:()=>ms});let i="";function a(s=""){let t=r,n="02",o=""+Date.now(),c=i||(i=e[t(686)](m,s)),d=Math[t(1374)]()[t(849)](16).slice(-6);return e[t(1901)](e[t(1970)](n,o),c)+d}function x(){let s=r;return e[s(856)](1e4*Date[s(1837)](),Math[s(516)](1e4*Math.random()))}function f(s){let t=r;return e[t(1109)](e[t(686)](Array,8)[t(1317)]("0"),parseInt(s,10)[t(849)](2))[t(1645)](-8)}function l(s){let t=r;return(e.XJwvn(Array,4)[t(1317)]("0")+e.UuLZA(parseInt,s,2).toString(16))[t(1645)](-4)}function h(s){let t=r;if(e[t(808)]!==e[t(808)])return _0x57caf7[t(1972)](_0x2ff1f0),!1;{let n=s[t(742)](/\./)[t(930)](d=>f(d)),o=[];return o[0]=e[t(2086)](l,e[t(1482)](n[0],n[1])),o[1]=e[t(2086)](l,e[t(1889)](n[2],n[3])),[t(1458),e[t(1521)],e.bkSmS,e[t(1521)],e[t(1521)],e[t(1199)],o[0],o[1]].join("")}}function m(s){let t=r,n=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[t(853)](s),o=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[t(853)](s);return n?h(s):o?y(s):e[t(1111)]}function y(s){let t=r,n={EgRoR:function(_,w){return _===w},CIycE:t(586),MTVTq:function(_,w){return _ instanceof w},oCyDr:function(_,w){return e[t(1053)](_,w)},HQvur:function(_,w){return _+w},uIKdt:function(_,w){return e[t(782)](_,w)}},o="",c=[],d=0,g=0,p=!0,u=e[t(1521)];if(e[t(1102)](s[t(1893)]("::"),-1)){let _=s[t(742)]("::");for(let v=0;e.UNKDo(v,_[t(1929)]);v++){let A=_[v];if(e[t(1102)](A.indexOf(":"),0))if(e.PvTor(t(887),e[t(2043)])){let P=A[t(742)](":");p&&(d=P[t(1929)]),g+=P[t(1929)];for(let T=0;e[t(824)](T,P[t(1929)]);T++)if(e[t(1613)](4,P[T].length)){let M=u[t(2020)+"g"](0,e[t(1543)](4,P[T][t(1929)])),O=M[t(1491)](P[T]);c.push(O)}else c[t(1560)](P[T]);p=!1}else _0x35db59.o=(P,T)=>_0x5b7bea.prototype[t(703)+t(1675)][t(863)](P,T);else{if(e[t(1613)](4,A[t(1929)]))if(e.DIiKb(t(625),e[t(2091)])){let P=u[t(2020)+"g"](0,e[t(1543)](4,A[t(1929)])),T=P.concat(A);c[t(1560)](T)}else{let P=this[t(1723)+"rs"][_0x1f7cb4];if(P)P[t(1645)]().forEach(T=>T.fn[t(1507)](T[t(1635)],_0xd8c100));else if(n[t(508)](n[t(1719)],_0x4edb17)&&!this[t(781)]){let T=_0x299c0e.length&&_0x2943da[0];if(n[t(1840)](T,_0x30480b))throw T;let M=new _0x29b206(n[t(529)](t(677)+"d error.",T?n[t(950)](n.uIKdt(" (",T.message),")"):""));throw M[t(543)]=T,T}return this}else c[t(1560)](A);p&&(d+=1),g+=1,p=!1}}let w="";for(let v=0;e[t(1966)](v,e.ndmNv(8,g));v++)w=w[t(1491)](u);for(let v=0;v<c[t(1929)];v++)e.DIiKb(v,d)&&(o=o.concat(w)),o=o[t(1491)](c[v]);return o}{let _=s[t(742)](":");for(let w=0;e[t(824)](w,_.length);w++){let v=_[w];if(e.Gnclc(4,_[w][t(1929)])){let A=u[t(2020)+"g"](0,4-_[w][t(1929)]),P=A[t(1491)](v);o=o[t(1491)](P)}else o=o[t(1491)](v)}return o}}function S(s,t){let n=r,o=s[n(873)];e[n(1412)](void 0,o)&&(e[n(582)]($,t,10),e[n(1370)](Ce,t,o));let c=s[n(1584)];if(e[n(1254)](void 0,c))if(e[n(831)](e[n(1226)],n(895))){let{type:d}=_0x44e1dc;this[n(1308)](d,_0x4efa72)}else $(t,18),Ce(t,c)}function b(s){let t=r;if(e[t(1079)](e.zyJHK,e[t(1630)]))this[t(1291)]=!0,this[t(1933)]=e.ObAEc(0,_0x3b299d),this[t(1411)]=e[t(923)](0,_0x13f797),this[t(1279)]=!!_0x47c285;else{let n={};e:for(;!e[t(2086)](Re,s);){let o=e[t(1275)](W,s);switch(e[t(724)](o,3)){case 0:break e;case 1:n[t(873)]=Ee(s,e[t(1485)](W,s));break;case 2:n[t(1584)]=e[t(582)](Ee,s,e.CSVEl(W,s));break;default:e[t(582)](xe,s,7&o)}}if(n[t(873)]===void 0)throw new Error(e[t(1041)]);if(e.ryTTM(void 0,n[t(1584)]))throw new Error(e[t(2055)]);return n}}function D(s){let t=r;if(e[t(831)]("QsbWK",t(894)))return _0x41c957[t(872)+"8"]?{value:_0x3619a7[t(872)+"8"](_0x2f8e5c),offset:_0x2710b7+1}:{value:e.XNGfA(255,_0x27e179[_0x2984af]),offset:_0x4a5c4a+1};{let n=e[t(1862)](ue);return e[t(582)](R,s,n),e.TgKNl(Y,n)}}function R(s,t){let n=r,o={crTri:function(O,z,te){return e[k(1370)](O,z,te)},kyfqW:function(O,z,te){return e[k(1370)](O,z,te)},vvWjh:function(O,z,te,Ae){return e[k(787)](O,z,te,Ae)}},c=s[n(1115)];e.Gnclc(void 0,c)&&(e[n(1370)]($,t,8),e[n(1370)](Dt,t,c));let d=s[n(1121)];e[n(971)](void 0,d)&&(e[n(1370)]($,t,16),e.kWNnd(Dt,t,d));let g=s[n(1397)];if(g!==void 0)if(e[n(1625)]!=="yrRut")$(t,24),e[n(1359)](Dt,t,e[n(928)](re,g));else{let O={Bbrlw:awzzIK[n(1624)],JrWMM:awzzIK[n(769)],tmUYY:function(U,ye){return U(ye)},MBTtM:function(U){return U()},NtyFb:function(U,ye){let It=n;return awzzIK[It(928)](U,ye)},xcHsn:function(U){let ye=n;return awzzIK[ye(1788)](U)}},z=()=>{let U=n;_0x234006[U(775)+U(1077)+U(1232)](O.Bbrlw,te),_0x40a55c[U(775)+U(1077)+U(1232)](O.JrWMM,Ae)},te=()=>{let U=n;O[U(685)](_0x50c8d8,_0x5d2377(_0x391216[U(1917)])),O[U(1387)](z)},Ae=()=>{let U=n;O.NtyFb(_0x36b756,_0x5177df[U(586)]),O[U(1072)](z)};_0x1d7450[n(697)+n(840)](awzzIK[n(1624)],te),_0x2bf172[n(697)+n(840)](n(586),Ae)}let p=s[n(1947)];e[n(1613)](void 0,p)&&(e.fuhYN($,t,32),Dt(t,e[n(1904)](re,p)));let u=s.headers;if(e[n(1126)](void 0,u))for(let O of u){e[n(673)]($,t,42);let z=e.LUqzH(ue);e[n(1765)](S,O,z),e[n(1370)]($,t,z[n(2051)]),e[n(1370)](Qt,t,z),e[n(1345)](I,z)}let _=s["payloadE"+n(1388)];_!==void 0&&(e[n(784)]($,t,50),Ce(t,_));let w=s.payloadType;if(e[n(885)](void 0,w))if(e[n(1673)](e[n(1603)],e.Totts))e.fKaxg($,t,58),e[n(582)](Ce,t,w);else{let O=(n(568)+"1")[n(742)]("|"),z=0;for(;;){switch(O[z++]){case"0":if(!this[n(1270)])return;continue;case"1":this[n(1270)]["removeEv"+n(1077)+n(1232)](e.NlLtp,this[n(2012)]);continue;case"2":this[n(1270)]["removeEventListe"+n(1232)](e[n(1852)],this._onMessage);continue;case"3":this[n(1270)][n(775)+"entListe"+n(1232)](e.ACkoT,this[n(1856)]);continue;case"4":this[n(1270)][n(775)+n(1077)+n(1232)](e.DKnrv,this[n(1998)]);continue}break}}let v=s[n(2034)];e[n(1412)](void 0,v)&&(e[n(970)]($,t,66),e[n(2070)]($,t,v[n(1929)]),e.fuhYN(Zt,t,v));let A=s[n(1287)];e.fjRVM(void 0,A)&&(e[n(1370)]($,t,74),e.whVDS(Ce,t,A));let P=s[n(1721)+n(1231)];if(e[n(1944)](void 0,P))if(e.GQRwZ===e[n(652)]){let{offset:O}=o[n(1355)](_0x4d046d,_0x2aec69,_0x3e40a7);_0x349518=O;let z={cursor_name:"",cursor:0,service:0},{value:te,offset:Ae}=o.crTri(_0x19bf99,_0x386f68,_0x12f0c2);z[n(1397)]=te,_0xc2438c=Ae;let{value:U,offset:ye}=o[n(1784)](_0x2fb7c6,_0x1cedf5,_0x29a2da);_0x32adf2=ye,z[n(663)+"ame"]=o.vvWjh(_0x3f2c42,_0x55c8a5,_0x193ef0,_0x1cc0af+U),_0x2bb702+=U;let{value:It,offset:Rt}=o[n(1784)](_0x30da06,_0x15e317,_0x81b3b2);z[n(1877)]=It[n(1143)](),_0x44ff7a=Rt,_0x45e702[n(1560)](z)}else $(t,82),e[n(807)](Ce,t,P);let T=s[n(1825)];e[n(1613)](void 0,T)&&(e[n(538)]($,t,90),e.cdTEm(Ce,t,T));let M=s[n(2004)+"e"];e[n(971)](void 0,M)&&(e[n(1235)]($,t,96),e[n(614)](Dt,t,e[n(1275)](re,M)))}function N(s){return e[r(1345)](L,H(s))}function L(s){let t=r,n={};e:for(;!e.PPnuF(Re,s);){let o=e[t(1454)](W,s);switch(e[t(724)](o,3)){case 0:break e;case 1:n[t(1115)]=Ne(s,!0);break;case 2:n[t(1121)]=e[t(1405)](Ne,s,!0);break;case 3:n[t(1397)]=e[t(550)](W,s);break;case 4:n.method=e[t(2024)](W,s);break;case 5:{let c=e[t(2024)](F,s);(n[t(1074)]||(n[t(1074)]=[])).push(e.zVkBX(b,s)),s[t(2051)]=c;break}case 6:n[t(1809)+t(1388)]=e[t(1824)](Ee,s,e[t(928)](W,s));break;case 7:n["payloadT"+t(967)]=Ee(s,W(s));break;case 8:n.payload=kt(s,e.Luvdx(W,s));break;case 9:n.LogIDNew=e.hyHdV(Ee,s,e[t(941)](W,s));break;case 10:n.serverTiming=Ee(s,e[t(693)](W,s));break;case 11:n[t(1825)]=e[t(1085)](Ee,s,W(s));break;case 12:n[t(2004)+"e"]=e[t(1016)](W,s);break;default:e.HEyJs(xe,s,e[t(1888)](7,o))}}if(e.DIiKb(void 0,n[t(1115)]))throw new Error(e[t(1134)]);if(e[t(1724)](void 0,n.LogID))throw new Error(e[t(1606)]);if(e[t(1724)](void 0,n.service))throw new Error(e.dHkRD);if(e[t(1724)](void 0,n[t(1947)]))throw new Error(e[t(1155)]);return n}function F(s){let t=r,n=e.NnnSE(W,s),o=s[t(2051)];return s[t(2051)]=e.kKmGj(s[t(1759)],n),o}function xe(s,t){let n=r;switch(t){case 0:for(;e[n(1888)](128,ce(s)););break;case 2:se(s,e[n(1957)](W,s));break;case 5:se(s,4);break;case 1:e[n(585)](se,s,8);break;default:throw new Error(e[n(1576)]+t)}}function re(s){let t=r;return s|=0,{low:s,high:e.xNVWT(s,31),unsigned:e[t(574)](s,0)}}let Se=[];function ue(){let s=r,t=Se[s(1873)]();return t?(t[s(1759)]=t[s(2051)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function I(s){Se[r(1560)](s)}function H(s){return{bytes:s,offset:0,limit:s[r(1929)]}}function Y(s){let t=r,n=s[t(1032)],o=s[t(2051)];return n[t(1929)]===o?n:n[t(777)](0,o)}function se(s,t){let n=r;if(e.kKmGj(s.offset,t)>s[n(2051)])throw new Error(e[n(1964)]);s.offset+=t}function Re(s){let t=r,n={zkHkq:function(o,c,d){return e[k(1208)](o,c,d)}};if(e[t(1478)](e[t(974)],e[t(974)])){let o=n.zkHkq(_0x40d6b3,t(586),{message:_0xef4a27[t(1281)],code:_0x816acb.MESSAGE_ERROR,error:_0x408b17});this[t(1089)+t(1628)+t(1725)](o)}else return e.BDpYu(s.offset,s.limit)}function _e(s,t){let n=r,o=s[n(1032)],c=s[n(1759)],d=s[n(2051)],g=e[n(1349)](c,t);if(g>o[n(1929)]){if(e[n(1079)](e.xfJik,n(1654)))return _0x449f0c+=_0x5fe3b6&&_0x216877.byteLength||0,_0x5fdd8;{let p=new Uint8Array(e[n(591)](2,g));p[n(794)](o),s.bytes=p}}return s[n(1759)]=g,e[n(1209)](g,d)&&(s[n(2051)]=g),c}function $e(s,t){let n=r,o=s.offset;if(e.ejnlW(e[n(2045)](o,t),s[n(2051)]))throw new Error(e[n(815)]);return s[n(1759)]+=t,o}function kt(s,t){let n=r,o=e[n(1764)]($e,s,t);return s[n(1032)][n(777)](o,e[n(2036)](o,t))}function Zt(s,t){let n=r;if(e[n(1714)]!==e[n(2107)]){let o=e.Vikbk(_e,s,t[n(1929)]);s[n(1032)][n(794)](t,o)}else _0xe9cfa5[n(1781)+n(632)]=void 0,e[n(605)](_0x814f79,e[n(655)])}function Ee(s,t){let n=r,o={ItYUs:function(_,w){return e[k(782)](_,w)},zgzEz:function(_,w){return _+w},CdTnc:function(_,w){return _&w},AXUJv:function(_,w){return e[k(1692)](_,w)},LDTdo:function(_,w){return e[k(608)](_,w)},Rlbyw:function(_,w){return _<w},lTQhX:function(_,w){return e.QrcDG(_,w)}},c=$e(s,t),d=String[n(1280)+n(640)],g=s.bytes,p="\uFFFD",u="";for(let _=0;e[n(1333)](_,t);_++)if(e[n(1079)](e[n(1544)],e[n(1588)]))_0x558996=_0x445534[o[n(658)](o[n(1059)](_0x516d35,_0x24d97f),1)],o[n(939)](192,_0x15b8bd)!==128?_0x22d68c+=_0x3aac4e:(_0x56552d=o[n(1310)](o[n(572)](o.CdTnc(31,_0x543a5d),6),o[n(939)](63,_0x1260f6)),o[n(1449)](_0x881717,128)?_0x48e19f+=_0x218010:(_0x3f0b29+=o[n(2008)](_0x4a3743,_0x295068),_0x5ed7ae++));else{let w=g[e[n(1939)](_,c)],v,A,P,T;e[n(1302)](128,w)===0?u+=e[n(1248)](d,w):e[n(831)](e[n(1302)](224,w),192)?e[n(1440)](_,1)>=t?u+=p:(v=g[e[n(1440)](e[n(1901)](_,c),1)],(192&v)!==128?u+=p:(T=e[n(608)](e[n(1474)](31,w),6)|e.dGQVx(63,v),e[n(1480)](T,128)?u+=p:(u+=e.qRuVi(d,T),_++))):e[n(1657)](e[n(1902)](240,w),224)?e[n(1793)](_+2,t)?u+=p:(v=g[e.aWpgQ(e.hJxaY(_,c),1)],A=g[e[n(1792)](e[n(1053)](_,c),2)],e[n(885)](e.rSJuH(e.qiDkI(v,A<<8),49344),32896)?u+=p:(T=e.qPLEP(e[n(608)](e[n(1054)](15,w),12),e[n(608)](e[n(1888)](63,v),6))|e[n(1392)](63,A),e[n(1351)](T,2048)||e.BDpYu(T,55296)&&e.urEbu(T,57343)?u+=p:(u+=d(T),_+=2))):(248&w)==240?e[n(1793)](e[n(1349)](_,3),t)?u+=p:(v=g[_+c+1],A=g[e[n(830)](e[n(1377)](_,c),2)],P=g[_+c+3],e[n(1613)](e.LVlvi(e[n(1651)](e.DJeNS(v,e.CzNlU(A,8)),P<<16),12632256),8421504)?u+=p:(T=e.ObAEc(e[n(1692)](e[n(1692)](e[n(1888)](7,w)<<18,e[n(608)](63&v,12)),e.CzNlU(e[n(1302)](63,A),6)),63&P),T<65536||e[n(1209)](T,1114111)?u+=p:(T-=65536,u+=e[n(727)](d,(T>>10)+55296,e.WRLWn(e[n(2098)](1023,T),56320)),_+=3))):u+=p}return u}function Ce(s,t){let n=r,o=t[n(1929)],c=0;for(let p=0;e[n(1305)](p,o);p++){let u=t[n(1937)+"At"](p);e[n(574)](u,55296)&&u<=56319&&e[n(856)](p,1)<o&&(u=e[n(608)](u,10)+t.charCodeAt(++p)-56613888),c+=e.TJMpn(u,128)?1:u<2048?2:e[n(2120)](u,65536)?3:4}e.cdTEm($,s,c);let d=e[n(2040)](_e,s,c),g=s.bytes;for(let p=0;e[n(2120)](p,o);p++){let u=t.charCodeAt(p);if(e[n(1793)](u,55296)&&e[n(1381)](u,56319)&&p+1<o&&(u=e[n(1543)](e[n(1901)](e[n(1156)](u,10),t.charCodeAt(++p)),56613888)),e[n(2120)](u,128))g[d++]=u;else if(e[n(1724)](e.GigBA,e.GigBA))e[n(1351)](u,2048)?g[d++]=e[n(923)](e[n(1474)](u>>6,31),192):(e.KYWJj(u,65536)?g[d++]=e[n(923)](e[n(495)](u,12)&15,224):(g[d++]=e.tIJik(e.eXwBZ(u>>18,7),240),g[d++]=e[n(745)](e[n(1490)](u>>12,63),128)),g[d++]=e[n(1201)](e[n(1315)](u>>6,63),128)),g[d++]=e[n(665)](63,u)|128;else{let _=e[n(2070)](_0x366e92,e[n(1554)],{message:e.sLVvp});this.onStartReconnect&&this.onStartReconnect(_)}}}function Qt(s,t){let n=r,o=e[n(727)](_e,s,t[n(2051)]),c=s[n(1032)],d=t[n(1032)];for(let g=0,p=t[n(2051)];e[n(1238)](g,p);g++)c[g+o]=d[g]}function ce(s){let t=r;return s[t(1032)][e[t(1359)]($e,s,1)]}function en(s,t){let n=r,o=e[n(1405)](_e,s,1);s[n(1032)][o]=t}function W(s){let t=r,n=0,o=0,c;do c=e.qRuVi(ce,s),e.dnRwV(n,32)&&(o|=e[t(2093)](e[t(1347)](127,c),n)),n+=7;while(e[t(1228)](128,c));return o}function $(s,t){let n=r;for(t>>>=0;e[n(552)](t,128);)e[n(1047)](en,s,e[n(923)](127&t,128)),t>>>=7;e[n(1824)](en,s,t)}function Ne(s,t){let n=r,o={XkdoR:function(c,d){return e.TgKNl(c,d)},Rewnn:function(c,d){return e[k(1828)](c,d)},SaGdD:function(c,d){return c>>>d},goEvE:function(c,d){return e.XNGfA(c,d)},weAeC:function(c,d){return e[k(747)](c,d)},HFhAQ:function(c,d){return c&d},crYel:function(c,d){return e[k(1182)](c,d)}};if(e[n(1478)](e.hQJLa,n(1413)))return o.XkdoR(_0x1f476a,_0x18362b);{let c=0,d=0,g=0,p;if(p=e[n(2084)](ce,s),c=e[n(1474)](127,p),128&p){if(e[n(1079)](n(1755),e[n(2019)])){let u=this[n(1430)]["getStora"+n(1867)](this[n(1277)]);return _0x1a13b3[n(1943)](o.Rewnn(u,"{}"))[_0x4d8979]}else if(p=ce(s),c|=e[n(608)](e.dXjTn(127,p),7),e[n(1347)](128,p)&&(p=e.AMtVj(ce,s),c|=e[n(765)](e[n(1474)](127,p),14),e[n(1902)](128,p)))if(e[n(831)](e.LBfkF,e[n(1558)])){let u=this.high,_=this.low;return[o[n(1567)](u,24),o[n(1567)](u,16)&255,o[n(1790)](u>>>8,255),o.weAeC(255,u),o.SaGdD(_,24),o.HFhAQ(o[n(1567)](_,16),255),o[n(1212)](_,8)&255,255&_]}else p=e[n(605)](ce,s),c|=e[n(1487)](e[n(1392)](127,p),21),e[n(665)](128,p)&&(e.ryTTM(e.punJp,e[n(1761)])?(p=ce(s),d=e[n(744)](127,p),128&p&&(p=e[n(686)](ce,s),d|=e[n(609)](e[n(926)](127,p),7),e[n(1135)](128,p)&&(p=e[n(1463)](ce,s),d|=(127&p)<<14,e[n(931)](128,p)&&(p=ce(s),d|=e[n(1156)](e[n(1191)](127,p),21),e[n(525)](128,p)&&(p=e[n(2018)](ce,s),g=e[n(875)](127,p),e[n(1302)](128,p)&&(p=ce(s),g|=e[n(765)](e[n(1996)](127,p),7))))))):_0x3ef0c8=awzzIK[n(1903)](_0x350032,_0xd874f5))}return{low:e.PFhbh(c,e.NAVtm(d,28)),high:e[n(1398)](e[n(724)](d,4),e[n(609)](g,24)),unsigned:t}}}function Dt(s,t){let n=r,o=e[n(1182)](t[n(1933)],0),c=e[n(1256)](e[n(1581)](e[n(724)](t[n(1933)],28),e[n(765)](t[n(1411)],4)),0),d=e.YRymZ(t[n(1411)],24),g=e.DIiKb(0,d)?e[n(554)](0,c)?e[n(1966)](o,16384)?o<128?1:2:o<2097152?3:4:e[n(1305)](c,16384)?e[n(1966)](c,128)?5:6:e[n(621)](c,2097152)?7:8:e[n(824)](d,128)?9:10,p=e[n(728)](_e,s,g),u=s.bytes;switch(g){case 10:u[e[n(646)](p,9)]=e[n(754)](e.YRymZ(d,7),1);case 9:u[e[n(1373)](p,8)]=g!==9?e[n(923)](128,d):127&d;case 8:u[e[n(1373)](p,7)]=g!==8?e[n(615)](e[n(1256)](c,21),128):e[n(699)](c>>>21,127);case 7:u[p+6]=e[n(1928)](7,g)?e[n(615)](c>>>14,128):e[n(1353)](e[n(1796)](c,14),127);case 6:u[e[n(2030)](p,5)]=e[n(1673)](6,g)?e[n(1581)](e.OPZWr(c,7),128):e.uiEwB(c>>>7,127);case 5:u[e[n(856)](p,4)]=e[n(885)](5,g)?128|c:e[n(1996)](127,c);case 4:u[e[n(1377)](p,3)]=e[n(1536)](4,g)?e[n(1831)](o>>>21,128):o>>>21&127;case 3:u[e[n(2036)](p,2)]=g!==3?e[n(802)](e[n(700)](o,14),128):e[n(2011)](o>>>14,127);case 2:u[e[n(782)](p,1)]=g!==2?e[n(1546)](e.puitP(o,7),128):e.HFkcm(e[n(1182)](o,7),127);case 1:u[p]=e[n(1928)](1,g)?128|o:e[n(766)](127,o)}}function cs(s){let t=r;if(e[t(1928)](e[t(1354)],t(1561)))_0x390664[t(1560)](_0x1a7461);else return N(s)}function xr(s){return e.XJwvn(D,s)}let fs=65536,a0=e[r(2101)],at=e[r(1960)](fs,fs),us=e[r(789)](at,at),ds=us/2,He=String.prototype[r(1937)+"At"];class K{constructor(t,n,o){let c=r;this[c(1291)]=!0,this[c(1933)]=e[c(1398)](0,t),this[c(1411)]=e[c(964)](0,n),this[c(1279)]=!!o}static[r(1291)](t){let n=r;if(e.hWtBb(e[n(809)],e[n(1697)]))return t&&e[n(979)](!0,t[n(1291)]);_0x4c9f53(_0x184d29,this[n(1167)+n(902)+"e"](_0x1ceac6))}static[r(1259)](t,n,o){let c=r;if(e[c(993)]!==e[c(993)])this["_initPro"+c(2038)]=null;else return new K(t,n,o)}static[r(540)+"s"](t,n,o){let c=r;return o?K[c(540)+c(1559)](t,n):K[c(540)+c(1031)](t,n)}static[r(540)+r(1559)](t,n){let o=r;return new K(e[o(1573)](e.VDOPD(t[0]|e.arhUx(t[1],8),e[o(723)](t[2],16)),e[o(1829)](t[3],24)),e.ETVfJ(e.tIJik(e.tIJik(t[4],e[o(1842)](t[5],8)),e[o(617)](t[6],16)),e[o(871)](t[7],24)),n)}static[r(540)+r(1031)](t,n){let o=r;return new K(e[o(1398)](e[o(1618)](t[4]<<24,e.CCXTm(t[5],16)),t[6]<<8)|t[7],e[o(745)](e[o(1581)](e.gqykZ(t[0]<<24,e[o(2093)](t[1],16)),e.AGSkh(t[2],8)),t[3]),n)}static[r(1504)](t){let n=r;return t===a0?ls:new K(e[n(700)](e[n(802)](e.vbopt(e[n(838)](He[n(863)](t,0),e[n(1407)](He[n(863)](t,1),8)),e[n(778)](He[n(863)](t,2),16)),He[n(863)](t,3)<<24),0),e.LpURQ(e[n(891)](e[n(1040)](He[n(863)](t,4)|He[n(863)](t,5)<<8,e[n(982)](He[n(863)](t,6),16)),e[n(778)](He[n(863)](t,7),24)),0),!0)}[r(628)](){let t=r;return String[t(1280)+t(640)](e.mTZIg(255,this[t(1933)]),e[t(1474)](this[t(1933)]>>>8,255),e.eXwBZ(e[t(700)](this[t(1933)],16),255),e[t(577)](this[t(1933)],24),e[t(1260)](255,this[t(1411)]),e[t(1996)](e.uaJQY(this[t(1411)],8),255),e[t(1392)](e[t(1552)](this.high,16),255),e[t(2083)](this[t(1411)],24))}static[r(878)+"er"](t,n=!0){let o=r;if(e[o(557)](isNaN,t))return n?x0:ls;if(n){if(e[o(1299)](t,us))return f0}else{if(e[o(1381)](t,-ds))return u0;if(e[o(552)](e[o(646)](t,1),ds))return c0}return K.fromBits(e[o(752)](e[o(1410)](t,at),0),e[o(1831)](t/at,0),n)}[r(1143)](){let t=r;return this[t(1279)]?e.KsvWI(this.high,0)*at+e[t(1402)](this.low,0):e.xmpla(this.high,at)+e[t(1290)](this[t(1933)],0)}[r(1037)](){let t=r;return this[t(1411)]===0&&e[t(2039)](0,this.low)}[r(741)](t){let n=r;K.isLong(t)||(t=K[n(878)+"er"](t));let o=e.pPqlN(this[n(1411)],16),c=65535&this[n(1411)],d=e[n(1290)](this[n(1933)],16),g=e[n(1857)](65535,this[n(1933)]),p=e[n(2009)](t[n(1411)],16),u=e[n(912)](65535,t.high),_=t[n(1933)]>>>16,w=e[n(1157)](65535,t[n(1933)]),v=0,A=0,P=0,T=0;return T+=e[n(510)](g,w),P+=T>>>16,T&=65535,P+=d+_,A+=e[n(1202)](P,16),P&=65535,A+=e[n(1970)](c,u),v+=e[n(556)](A,16),A&=65535,v+=e[n(510)](o,p),v&=65535,K.fromBits(e[n(891)](e[n(1252)](P,16),T),e[n(1234)](e.AGSkh(v,16),A),this[n(1279)])}equals(t){let n=r;return K[n(1291)](t)||(t=K[n(878)+"er"](t)),e[n(1536)](this.unsigned,t[n(1279)])&&e.ryTTM(this[n(1411)]>>>31,1)&&e[n(1428)](e[n(1202)](t[n(1411)],31),1)?!1:e[n(999)](this[n(1411)],t[n(1411)])&&e[n(1664)](this[n(1933)],t[n(1933)])}[r(1009)](){let t=r;if(e[t(554)](e[t(1863)],e.SLTor)){if(this[t(1272)+t(773)]?.[t(1132)+t(1149)+"es"]()){let o=this[t(1272)+t(773)]?.[t(927)+t(1501)+"nt"]();this[t(1089)+t(758)+t(1725)](e[t(681)](_0x1c908b,e[t(1237)],{code:1006,reason:"connect "+o+(t(2061)+", max re"+t(1652)+t(2075)),wasClean:!0}))}else{let o=this._options[t(2118)+t(1050)+t(960)](_0xfa5b5c,_0x1f957e);this[t(1089)+"hCloseEvent"](e[t(807)](_0x118be3,e[t(1237)],{code:_0x493223,reason:_0x54b13d,wasClean:!0,willReconnect:o})),o&&this[t(1348)]()}return}else return e[t(1110)](-1,this[t(1933)])&&e[t(1724)](-1,this[t(1411)])?K[t(1259)](0,0,this.unsigned):e.Ohivd(-1,this[t(1933)])?K[t(1259)](0,e[t(1822)](this[t(1411)],1),this[t(1279)]):K.fromBits(e.huKqo(this.low,1),this.high,this.unsigned)}[r(1735)](t){return t?this[r(2073)+"E"]():this.toBytesBE()}[r(2073)+"E"](){let t=r,n=this[t(1411)],o=this[t(1933)];return[e.HFkcm(255,o),e.cfqiv(o,8)&255,e.WigSV(o,16)&255,e[t(700)](o,24),e[t(525)](255,n),n>>>8&255,e[t(724)](n,16)&255,e[t(724)](n,24)]}[r(1806)+"E"](){let t=r,n=this[t(1411)],o=this[t(1933)];return[e[t(1402)](n,24),e[t(1392)](e[t(577)](n,16),255),e.xZCsh(e[t(767)](n,8),255),e[t(601)](255,n),e.Ldbxg(o,24),e[t(1853)](e[t(724)](o,16),255),e[t(1302)](e[t(1371)](o,8),255),e[t(1219)](255,o)]}}let ls=new K(0,0,!1),x0=new K(0,0,!0),c0=K.fromBits(-1,2147483647,!1),f0=K[r(1259)](-1,-1,!0),u0=K[r(1259)](0,-2147483648,!1);var je=(function(s){let t=r;return s[s[e[t(1063)]]=5001]=e[t(1063)],s[s[e[t(2007)]]=5002]=e[t(2007)],s[s[e[t(1916)]]=5003]=e[t(1916)],s[s[e[t(1070)]]=5004]="MESSAGE_ERROR",s[s[e[t(2049)]]=5005]=e[t(2049)],s})({});class xt{constructor(t){let n=r,o={bFEwH:function(c,d){return c+d},Xqctw:function(c,d){return e.ejnlW(c,d)}};if(e[n(1110)](n(524),e.hsXoe))this[n(1984)]=t,this[n(722)]=null;else{let c=_0x1ba637[n(1032)],d=_0x33e040[n(1759)],g=_0x53e467[n(2051)],p=XSPafZ[n(1197)](d,_0x583c12);if(p>c.length){let u=new _0x1dd17e(2*p);u.set(c),_0x180d2d.bytes=u}return _0x500ca1[n(1759)]=p,XSPafZ[n(602)](p,g)&&(_0x25563f[n(2051)]=p),d}}}class hs extends xt{constructor(t,n){let o=r;super(t),this[o(1281)]=n&&n[o(1281)]||null}}class gs extends xt{constructor(t,n){let o=r,c={uefJp:e[o(1658)],jInpz:function(d,g){return e[o(1506)](d,g)},TzzVz:function(d,g){return e[o(912)](d,g)},zSiFS:function(d,g){return e.bWGoZ(d,g)},LEhRy:function(d,g){return d>>g},zqFJq:function(d,g){return e[o(1385)](d,g)},QxJGP:function(d,g){return e[o(1053)](d,g)},vwxhR:function(d,g){return d<<g},AnXNb:function(d,g){return e.NrLIh(d,g)}};if(e[o(661)](e[o(650)],e.WKijB)){let d=e.peEIB[o(742)]("|"),g=0;for(;;){switch(d[g++]){case"0":this[o(586)]=n&&n[o(586)]||null;continue;case"1":this[o(1253)]=n&&n[o(1253)]||5001;continue;case"2":this.colno=n&&n[o(1092)]||0;continue;case"3":this[o(2068)]=n&&n[o(2068)]||"";continue;case"4":this[o(1281)]=n&&n[o(1281)]||"";continue;case"5":super(t);continue;case"6":this.lineno=n&&n[o(1088)]||0;continue}break}}else{let d=c[o(1679)][o(742)]("|"),g=0;for(;;){switch(d[g++]){case"0":_0x4b75c1[_0x40167b++]=c[o(1180)](c[o(690)](_0x1ae29e>>6,63),128);continue;case"1":_0x24f051[_0x3825de++]=c[o(633)](_0xa856f9>>18,240);continue;case"2":_0x3787b9[_0x309078++]=c[o(1180)](c[o(690)](c[o(1704)](_0xae611,12),63),128);continue;case"3":_0x18aed0[_0x4d77cc++]=c.zqFJq(63,_0x50088d)|128;continue;case"4":_0x1603cd=c[o(783)](65536,c[o(1187)](c[o(1096)](1023,_0x23b0c8),10))+c[o(565)](1023,_0x79678);continue;case"5":++_0x49fee4;continue}break}}}}class ps extends xt{constructor(t,n){let o=r,c=e[o(1826)][o(742)]("|"),d=0;for(;;){switch(c[d++]){case"0":this[o(896)+o(1286)]=n&&n[o(896)+o(1286)]||!1;continue;case"1":this[o(942)]=n&&n[o(942)]||"";continue;case"2":super(t);continue;case"3":this[o(1022)]=n&&n[o(1022)]||!1;continue;case"4":this[o(1253)]=n&&n[o(1253)]||0;continue}break}}}class ms extends xt{constructor(t,n){let o=r;super(t),this[o(1205)]=n&&n.data||null}}class _s extends ms{constructor(t,n){let o=r;super(t),this.data=n&&n[o(1205)]||null,this[o(1281)]=n&&n.message||null}}class ws extends xt{constructor(t,n){let o=r;super(t),this[o(1205)]=n&&n.data||null}}function ge(s,{message:t,code:n,error:o}){let c=r,d={OwtXu:e[c(1554)],IzHSY:e.WWLvD};if(e[c(1664)](e[c(1386)],e.OldqI))return new gs(s,{message:t,code:n,error:o});{this[c(2074)+c(1677)+"t"]();let g=_0x301830(d[c(2117)],{message:d[c(1421)]});this[c(721)+"mediatelyReconnect"]&&this[c(721)+c(1249)+c(1200)+"ct"](g)}}function we(s,{code:t,reason:n,wasClean:o,willReconnect:c}){return new ps(s,{code:t,reason:n,wasClean:o,willReconnect:c})}function ys(s,{data:t,message:n}){return new _s(s,{data:t,message:n})}function bs(s,{data:t}){return new ws(s,{data:t})}function cr(s,{message:t}){return new hs(s,{message:t})}class vs{constructor(t,n){let o=r;this[o(1213)+"s"]=t,this.maxRetries=n,this.currentIndex=0,this[o(1223)+o(725)+o(804)+"t"]=0}["resetEndpointCon"+r(805)](){let t=r;this[t(671)+t(1060)]=0,this[t(1223)+t(725)+"riesCount"]=0}resetTries(){let t=r;if(e[t(1705)](e[t(1914)],e[t(956)]))this[t(1223)+t(725)+t(804)+"t"]=0;else{if(e[t(1543)](_0x1e72ce,_0x28c81b)<1)return"";let n="";for(let o=_0xda5689;e[t(1892)](o,_0x10010f);){let c=_0x35d8ef[o++];if(e[t(1691)](c,127))n+=_0x1e0a0d[t(1280)+"Code"](c);else if(e[t(662)](c,192)&&c<224)n+=_0x720c89[t(1280)+t(640)](e[t(1175)](e[t(653)](31,c),6)|e[t(1124)](63,_0xd8bae4[o++]));else if(c>=224&&e[t(1333)](c,240))n+=_0xbb7d5f[t(1280)+t(640)](e[t(609)](15&c,12)|e[t(1829)](63&_0x28347a[o++],6)|63&_0xeb255[o++]);else if(e[t(662)](c,240)){let d=e[t(1112)](e[t(752)](e[t(871)](7&c,18),e[t(1915)](63,_0x4b1950[o++])<<12)|e[t(1938)](63&_0x26bfa2[o++],6),63&_0x7fca2b[o++])-65536;n+=_0x46c81e[t(1280)+t(640)](e[t(1440)](55296,d>>10)),n+=_0x14c860[t(1280)+t(640)](e.lvWDK(56320,e[t(912)](1023,d)))}}return n}}[r(927)+r(1501)+"nt"](){let t=r,n={HXBiu:t(586)};if(e[t(899)](e.OtlqY,t(880)))return this[t(1213)+"s"][this[t(671)+"ndex"]];{let o={YZaRx:n.HXBiu},c=_0x294604.buffer.slice(_0xffd3e1[t(1382)+"et"],_0x15eb70[t(1336)+"th"]+_0x3dea2c.byteOffset);this[t(1418)]&&this[t(1418)][t(720)]({data:c,fail:d=>{let g=t;this[g(1308)](o[g(1166)],_0xd6da0d(o[g(1166)],{message:this[g(701)+g(1566)+g(569)](d)}))}})}}[r(927)+r(1501)+r(2060)+"ount"](){return this[r(1223)+"ndpointTriesCount"]}["checkRea"+r(1149)+"es"](){let t=r;return!!(e.PsOaD(this[t(671)+t(1060)],this.endpoints.length)||this["currentI"+t(1060)]===this.endpoints.length-1&&e.ryTTM(this[t(1223)+t(725)+"riesCount"],this[t(1925)+"es"]))}["checkCurrentEndp"+r(694)+r(1106)+r(1526)](){let t=r;return e[t(1657)](this[t(671)+t(1060)],this[t(1213)+"s"].length)?!0:this[t(1223)+t(725)+"riesCount"]>this[t(1925)+"es"]}[r(2080)+r(1868)+r(1404)+r(548)+r(620)](){let t=r;return this[t(1223)+t(725)+"riesCount"]=1,this[t(671)+t(1060)]++,this[t(1213)+"s"][this["currentI"+t(1060)]]}[r(927)+r(1501)+"ntAndUpdateCount"](){let t=r;return this[t(1223)+t(725)+"riesCount"]++,this.getCurrentEndpoint()}}let ct=(e[r(1810)](e[r(717)],typeof globalThis)&&e[r(884)]===globalThis[r(1718)+r(1694)][r(1003)]||typeof window<"u"&&e[r(1775)](e[r(884)],window[r(1718)+r(1694)][r(1003)]))&&e[r(1827)](r(708)+"d",typeof document),Ze=e[r(1024)](r(708)+"d",typeof globalThis)&&(e[r(1459)](r(513),globalThis[r(1718)+"tor"].name)||e.bZaWw(e[r(1874)],globalThis[r(1718)+r(1694)].name))&&e[r(1643)](e.roEPd,typeof tt),Pt=(e[r(717)]!=typeof globalThis&&e[r(1193)]===globalThis["construc"+r(1694)].name||e[r(1530)]("undefined",typeof globalThis)||e[r(1024)](e.roEPd,typeof globalThis)&&!!globalThis[r(1590)+"Bridge"])&&e[r(1465)](e[r(717)],typeof wx),Tt=e.vWTtK(e[r(717)],typeof globalThis)&&(e[r(1014)](e[r(1874)],globalThis["construc"+r(1694)].name)||e[r(2072)]===globalThis[r(1718)+r(1694)].name||e[r(1774)]===globalThis[r(1718)+"tor"][r(1003)])&&e[r(717)]!=typeof self,d0=e[r(1810)](r(708)+"d",typeof globalThis)&&e[r(1193)]===globalThis[r(1718)+r(1694)][r(1003)]&&e.roEPd!=typeof global&&e[r(1193)]===global[r(1718)+r(1694)][r(1003)]&&e.roEPd!=typeof process&&!!process[r(1036)];class fr{constructor(){let t=r,n={reuQm:e.VBcbC,jriyp:function(o,c){return e.uzrKM(o,c)},CfJgk:function(o,c){return e.ejnlW(o,c)},kXfSV:function(o,c,d,g){return e[k(1100)](o,c,d,g)},VDGDh:function(o,c){return o>>>c},XIzqw:function(o,c){return e.ieHUL(o,c)},QWrRL:function(o,c){return e.arhUx(o,c)},ZHEHQ:function(o,c){return e[k(1618)](o,c)},lmAyi:function(o,c){return e.NrLIh(o,c)},otzEw:function(o,c){return e[k(638)](o,c)},InvCA:function(o,c){return e.ZIYUU(o,c)},AseBo:function(o,c){return e[k(1763)](o,c)},QPLdL:function(o,c){return e[k(653)](o,c)},YWxgW:function(o,c){return e[k(1905)](o,c)},vcAat:function(o,c){return e[k(824)](o,c)},LBNQh:function(o,c){return e[k(734)](o,c)},fDRtk:function(o,c){return e[k(1118)](o,c)},EOsDL:function(o,c){return e[k(893)](o,c)}};if(e[t(1427)](t(1713),t(580))){let o=n[t(1644)][t(742)]("|"),c=0;for(;;){switch(o[c++]){case"0":if(n.jriyp(_0x1107cf[_0x4be0af++],128))return{value:_0x2158c6?_0x4b5808:0|_0x19fedc,offset:_0x38adb4};continue;case"1":if(n.CfJgk(_0x5cf6a9+=5,_0x100618.length))throw _0xb5629b=_0x51cb4a.length,n[t(670)](_0x1927c2,_0xd5beff,10,_0x3122db[t(1929)]);continue;case"2":_0x59e097=n.VDGDh(n[t(1762)](_0x3a3528,n[t(1375)](15&_0x147ee5[_0xfc20d8],28)),0);continue;case"3":_0x36bd4=n[t(737)](_0x5a59c8,n[t(1375)](n[t(748)](127,_0x3bcee4[_0x53e0d9]),14))>>>0;continue;case"4":if(n.jriyp(_0x5f2c6f[_0xa57f83++],128))return{value:_0x22a2c5?_0x46832d:n[t(1762)](0,_0x264af2),offset:_0x5a3749};continue;case"5":_0x142d02=n[t(1742)](n[t(1185)](_0x1a7e2f,n[t(833)](127&_0x40d258[_0x545872],21)),0);continue;case"6":if(n.jriyp(_0x37641c[_0x42267a++],128))return{value:_0x25c3f0?_0x5e7bfc:n[t(1762)](0,_0x49e485),offset:_0x2665d6};continue;case"7":_0x467d71=n[t(797)](_0x3f62be|n[t(833)](n[t(989)](127,_0x54a9b5[_0x3e800a]),7),0);continue;case"8":if(n.YWxgW(_0x3a5098[_0x2d78b5++],128))return{value:_0x52886d?_0x5c1908:n[t(1762)](0,_0xdccdd2),offset:_0x175467};continue;case"9":if(n[t(842)](_0x4f4285[_0x381ab8++],128))return{value:_0x6fc0b0?_0x58e6ba:n[t(2104)](0,_0x1bf542),offset:_0xf3b5a5};continue;case"10":return{value:_0x2c6850?_0x2cec64:n[t(829)](0,_0x2b8393),offset:_0x2a7f8c};case"11":_0x530155=n.VDGDh(n[t(1153)](127,_0x937687[_0x5f333e]),0);continue}break}}else this[t(1723)+"rs"]={}}[r(1308)](t,...n){let o=r,c={HNZqr:function(d,g){return d>g}};if(e[o(1254)](o(1641),o(1641))){let d=_0x5d568a[o(1759)];if(lEoZGP[o(1221)](d+_0xec9b5a,_0x514e1f[o(2051)]))throw new _0x258980(o(654)+o(648));return _0x592d17.offset+=_0x3676a2,d}else{let d=this[o(1723)+"rs"][t];if(d)d.slice()[o(1746)](g=>g.fn.apply(g[o(1635)],n));else if(e[o(1724)](e.NlLtp,t)&&!this.onerror){let g=n[o(1929)]&&n[0];if(g instanceof Error)throw g;let p=new Error(e[o(1349)](o(677)+"d error.",g?e[o(1578)](e[o(823)](" (",g.message),")"):""));throw p[o(543)]=g,g}return this}}[r(1304)](t,n){let o=r;if(e[o(1379)](void 0,t))this[o(1723)+"rs"]={};else if(n===void 0)this[o(1723)+"rs"][t]=null;else{let c=this._listeners[t];if(c)for(let d=0;e[o(1131)](d,c[o(1929)]);)c[d].fn===n?c[o(1378)](d,1):++d}return this}on(t,n,o){let c=r,d={Gizgx:function(g,p){return g===p},xgUzm:function(g,p){return e[k(1254)](g,p)},AcBPd:function(g,p,u){return e[k(706)](g,p,u)}};if(e[c(2046)](e[c(1921)],e[c(626)]))return(this[c(1723)+"rs"][t]||(this._listeners[t]=[]))[c(1560)]({fn:n,ctx:o||this}),this;if(this[c(1270)]&&d[c(1196)](this._ws[c(718)+"te"],this[c(1669)+"NG"])){this[c(1170)+c(800)](),this["_pingPon"+c(1614)+"Id"]=_0x4cae94(this[c(750)].bind(this),this[c(559)][c(1242)+"rval"]);return}if(!this[c(1270)]||d[c(711)](this[c(1270)][c(718)+"te"],this.OPEN))return void this[c(1004)+c(1547)]();this[c(1270)]&&this[c(1270)].send("hi"),this[c(1629)+c(1366)+c(712)]=d[c(1068)](_0x49b366,this[c(1004)+c(1547)+c(1015)][c(1881)](this),this[c(559)][c(1269)+c(1498)+c(1011)])}}class l0 extends fr{[r(701)+r(1566)+"age"](t){let n=r;if(e[n(903)](e[n(1471)],n(945)))return t[n(1329)]||t[n(1225)]?("message: "+(t.errMsg||"")+n(1818)+(t.errNo||"")).trim():JSON[n(1608)+"y"](t);this["_interva"+n(1575)+"Id"]=null,this._interval=36e5,this._qosDB=e[n(2069)](_0x57adb7,n(1183),e[n(730)])}constructor(t,n,o){let c=r;super(),this[c(1418)]=null,Pt&&wx[c(1204)+c(1282)]&&(this._socket=wx["connectS"+c(1282)]({url:t,protocols:n,header:o,fail:this[c(1587)+c(2066)+"lHandler"].bind(this),success:this[c(1587)+c(1583)+c(756)+c(2054)][c(1881)](this)})),Ze&&tt[c(1204)+c(1282)]&&(this[c(1418)]=tt[c(1204)+"ocket"]({url:t,protocols:n,header:o,fail:this[c(1587)+c(2066)+c(790)][c(1881)](this),success:this["_createS"+c(1583)+c(756)+"ler"][c(1881)](this)}))}[r(1587)+r(1583)+r(756)+r(2054)](){let t=r;Promise[t(1020)]()[t(1486)](()=>{this["_addWsLi"+t(1220)]()})}[r(1587)+r(2066)+r(790)](t){let n=r,o={LQiSC:function(c,d,g){return e[k(1323)](c,d,g)},JyIpP:e[n(769)],pDMCp:function(c,d,g){return c(d,g)},tdORk:e[n(1237)]};Promise[n(1020)]()[n(1486)](()=>{let c=n,d=o[c(726)](ge,o[c(558)],{message:this["_formatE"+c(1566)+"age"](t)});this.emit(o.JyIpP,d);let g=o[c(2109)](we,o[c(1715)],{reason:this["_formatE"+c(1566)+c(569)](t)});this[c(1308)](o[c(1715)],g)})}_addWsListeners(){let t=r,n={DnBdo:e[t(1425)],TkOru:function(o,c,d){return e[t(1240)](o,c,d)},JlvlJ:e[t(769)]};this[t(1418)].onOpen(o=>{let c=t;this[c(1308)](n[c(1307)],n[c(1907)](bs,c(1284),{...o,data:o[c(1329)]||""}))}),this[t(1418)][t(692)](o=>{let c=t;this[c(1308)](c(1820),we(e.DKnrv,{...o}))}),this[t(1418)][t(1912)+"e"](o=>{let c=t;this[c(1308)](e[c(1852)],ys(c(1281),{...o}))}),this[t(1418)][t(1950)](o=>{let c=t;this[c(1308)](n[c(1783)],n.TkOru(ge,n[c(1783)],{...o,message:o[c(1329)]||""}))})}[r(720)](t){let n=r,o={HpbjE:function(c,d,g){return c(d,g)},xYkfI:function(c,d,g){return e[k(614)](c,d,g)},nfQVf:"error"};if(e.amiyf(t,Uint8Array))if(e[n(1803)]!==e.Bagka)NoNgDO.HpbjE(_0x19d2cc,_0x3640e5,90),NoNgDO[n(1894)](_0x381794,_0x3ba6ff,_0x21dca1);else{let c=t[n(1702)][n(1645)](t.byteOffset,e[n(782)](t[n(1336)+"th"],t[n(1382)+"et"]));this._socket&&this[n(1418)][n(720)]({data:c,fail:d=>{let g=n;this[g(1308)](g(586),o[g(1609)](ge,o[g(1211)],{message:this["_formatErrorMess"+g(569)](d)}))}})}else this[n(1418)]&&this[n(1418)].send({data:t,fail:c=>{let d=n,g={hhKoj:function(p,u){return e.SWhXD(p,u)}};if(e[d(1173)](d(839),e[d(1098)]))this[d(1308)](e[d(769)],e[d(1116)](ge,e.NlLtp,{message:this[d(701)+d(1566)+d(569)](c)}));else{let p={wuIHl:function(u,_){let w=d;return KmZStU[w(968)](u,_)}};return function(u,..._){let w=d,v=_0x421a17[w(863)](p[w(981)](_0x4f0087,this),u,..._);return _0xc82653[w(794)](v,u.sort?u[w(522)]():[u]),p[w(981)](_0x24cbdd,v)}}}})}[r(1820)](t,n){let o=r;this[o(1418)]&&this._socket[o(1820)]({code:t,reason:n})}["addEvent"+r(840)](t,n){this.on(t,n)}[r(775)+"entListener"](t,n){this[r(1304)](t,n)}get[r(718)+"te"](){let t=r;return this[t(1418)][t(718)+"te"]}get[r(682)+"pe"](){let t=r;return this[t(1418)][t(682)+"pe"]}set[r(682)+"pe"](t){}get[r(1461)](){let t=r;return this[t(1418)][t(1461)]}get[r(518)](){let t=r;return this[t(1418)][t(518)]}get[r(1845)+"ns"](){return this._socket.extensions}get[r(1533)+r(1099)](){let t=r;return e.iQFKq(e[t(1612)],t(1363))?(_0x57995a|=0,{low:_0x4bae86,high:e[t(933)](_0x46c274,31),unsigned:e[t(1931)](_0x56c097,0)}):0}}function h0(s,t){let n=r;if(t)return new t(s.url,s[n(518)]);if(e.juXkB(Pt,Ze))return new l0(s[n(1461)],s[n(518)],s[n(1074)]);if((ct||Tt)&&e[n(717)]!=typeof WebSocket&&WebSocket)return new WebSocket(s[n(1461)],s[n(518)+"s"])}function g0(s){let t=r,n=e[t(575)][t(742)]("|"),o=0;for(;;){switch(n[o++]){case"0":if(Ze&&tt[t(1204)+t(1282)])return!0;continue;case"1":if(e.juXkB(ct,Tt)&&e.qqZxz(e[t(717)],typeof WebSocket)&&WebSocket)return!0;continue;case"2":if(s)return!0;continue;case"3":if(Pt&&wx[t(1204)+t(1282)])return!0;continue;case"4":return!1}break}}function Ss(s,t,n){let o=r,c={TxJAi:function(p,u){return e.KFTLS(p,u)},HngdU:function(p,u){return e[k(1757)](p,u)},iSGHq:function(p,u){return e[k(946)](p,u)},pUXwh:function(p,u){return e.SGBtO(p,u)},WJRlE:function(p,u){return e.zlGwS(p,u)},gevWG:o(1849),WkmXu:e[o(1505)],LheQy:e[o(848)]},d=-1;async function g(p){let u=o,_={aPdbQ:function(w,v){return c[k(731)](w,v)},nFCwc:function(w,v){return c[k(594)](w,v)},WskYi:function(w,v){return c[k(2056)](w,v)},RBpLi:function(w,v){return c[k(1194)](w,v)},uxkVH:function(w,v){return c[k(1194)](w,v)},SVkeb:function(w,v){return c[k(743)](w,v)}};if(c[u(2056)](c[u(573)],c[u(1174)])){let w=0,v=0;for(let A=0;_[u(1178)](A,_0x4f0b4f[u(1929)]);++A)v=_0x2d1e80[u(1937)+"At"](A),_[u(1178)](v,128)?w+=1:_[u(818)](v,2048)?w+=2:_[u(1268)](_[u(514)](64512,v),55296)&&_[u(1268)](_[u(1605)](64512,_0x1b8af1[u(1937)+"At"](_[u(1589)](A,1))),56320)?(++A,w+=4):w+=3;return w}else return p<=d?Promise[u(1596)](new Error(c[u(738)])):(d=p,c[u(2056)](p,n[u(1929)])?Promise[u(1020)]():n[p][u(1881)](s)(t,g.bind(null,p+1)))}e[o(908)](g,0)}function Es(s){let t=r,n=0,o=0;for(let c=0;e[t(1757)](c,s[t(1929)]);++c)o=s.charCodeAt(c),e[t(1305)](o,128)?n+=1:e.pGkGU(o,2048)?n+=2:e[t(1403)](64512&o,55296)&&e[t(1664)](e.PJBtW(64512,s[t(1937)+"At"](e[t(1109)](c,1))),56320)?(++c,n+=4):n+=3;return n}function Cs(s,t,n){let o=r;if(e[o(803)](n,t)<1)return"";let c="";for(let d=t;d<n;){let g=s[d++];if(e[o(1691)](g,127))c+=String[o(1280)+o(640)](g);else if(e[o(1299)](g,192)&&e[o(1689)](g,224))c+=String[o(1280)+o(640)](e[o(890)](e[o(1922)](e[o(2119)](31,g),6),63&s[d++]));else if(e[o(662)](g,224)&&e.uzrKM(g,240))c+=String[o(1280)+o(640)](e.UnbAa(e.KvKrp(e.klxyH(e[o(1934)](15,g),12),e[o(1553)](63,s[d++])<<6),e[o(1097)](63,s[d++])));else if(e[o(1299)](g,240))if(e[o(852)](e[o(1954)],e.IIGFu))this[o(1308)](e[o(769)],e[o(706)](_0xf1998f,o(586),{message:this[o(701)+o(1566)+"age"](_0x55ac54)}));else{let p=e.KTeJD(e.euVVV(e[o(669)](e[o(1267)](e[o(1888)](7,g)<<18,e.FqGYW(e[o(1054)](63,s[d++]),12)),e[o(1553)](63,s[d++])<<6),e[o(1392)](63,s[d++])),65536);c+=String[o(1280)+"Code"](55296+e[o(1093)](p,10)),c+=String[o(1280)+o(640)](e[o(2030)](56320,1023&p))}}return c}function ur(s,t,n){let o=r,c=n,d,g;for(let p=0;e.EOedw(p,s[o(1929)]);++p)if(d=s[o(1937)+"At"](p),e[o(1351)](d,128))t[n++]=d;else if(d<2048)t[n++]=e.dwvhQ(d>>6,192),t[n++]=e[o(745)](e[o(667)](63,d),128);else if(e.nCMLn(e[o(1731)](64512,d),55296)&&e.cWiEw(64512,g=s[o(1937)+"At"](e[o(1360)](p,1)))===56320){let u=e.BhgTE[o(742)]("|"),_=0;for(;;){switch(u[_++]){case"0":t[n++]=e[o(521)](e.BGanU(d,6),63)|128;continue;case"1":++p;continue;case"2":t[n++]=e[o(1688)](e.wXuNV(d>>12,63),128);continue;case"3":t[n++]=e[o(615)](e[o(1857)](63,d),128);continue;case"4":d=e[o(1373)](65536,e[o(1884)](e[o(1839)](1023,d),10))+e[o(1260)](1023,g);continue;case"5":t[n++]=e.oKqcj(d>>18,240);continue}break}}else t[n++]=e[o(2048)](e.IdGyw(d,12),224),t[n++]=e.zIKbe(e[o(867)](d>>6,63),128),t[n++]=e[o(1989)](e.SGBtO(63,d),128);return e.KTeJD(n,c)}async function As(s){let t=r;if(e[t(1813)]==typeof s){let n=new Uint8Array(e[t(1448)](Es,s));return e[t(1108)](ur,s,n,0),n}return e[t(1340)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(1702)],s.byteOffset,s[t(1336)+"th"])}function p0(s){let t=r;try{return e[t(1643)](e[t(1813)],typeof s)&&(s instanceof ArrayBuffer||s.buffer&&e[t(1340)](s[t(1702)],ArrayBuffer))||e[t(1813)]!=typeof s?"":(JSON[t(1943)](s),t(1495)+"ion/json")}catch{return e[t(1744)](e[t(1813)],typeof s)?e.TiQSC:""}}let m0=(s,t)=>{let n=r;switch(s){case e[n(1051)]:case e[n(924)]:return{["x-use-"+s]:1,"x-tt-env":t};default:return{}}};class _0{constructor(t){let n=r;this[n(813)+n(613)]=t,this[n(1952)]=0}[r(1467)](){this.count++}[r(1132)+r(1441)+"nt"](){let t=r;return e.bpIrL(this[t(1952)],this[t(813)+"ount"])}[r(1773)+"nter"](t=0){let n=r;this["maxLossC"+n(613)]=t,this.count=0}}async function w0(s){let t=r,n={VzXKD:function(o,c){return e[k(550)](o,c)},Ctdys:function(o,c){return e[k(1543)](o,c)},uEIgO:e[t(1636)],wSNno:t(1532)+"reason",TPOlK:function(o,c){return e[t(1861)](o,c)},NvGkp:e[t(874)],qMjDK:function(o,c){return o(c)},TDdMG:e.jTIJd,jMWDx:e.rncjC,uOmsO:function(o,c){return o+c},MysNN:e.eXLyc};return new Promise(o=>{let c=t,d={CbEMr:function(g,p){return g!==p},mvhPI:function(g,p){return n[k(597)](g,p)},cfAJG:n[c(1540)],JtykU:c(1913),oQUab:function(g,p){return n.VzXKD(g,p)},jQZVY:n[c(909)]};if(n.TPOlK(n[c(1107)],n[c(1107)])){let g=UDJkTR.VzXKD(_0x61b1b9,_0x26ea9b),p=_0x26c56d[c(2051)];return _0x152f9f[c(2051)]=_0x563968[c(1759)]+g,p}else{if(!ct)return n.qMjDK(o,n[c(909)]);try{if(n[c(623)](n.TDdMG,n.TDdMG))return new _0x226da8(_0x30b07b,{message:_0x2d62a3,code:_0x10cc44,error:_0x5e1789});{let g=document[c(900)+c(688)](n[c(578)]);window.frontierJSONP=p=>{let u=c,_={vWXfY:function(w,v){return d[k(1711)](w,v)},aFuKl:function(w,v){return d[k(791)](w,v)}};if(d[u(1711)](d[u(1767)],d[u(531)]))document[u(1243)][u(1122)+u(1344)](g),window[u(1781)+u(632)]=void 0,d[u(954)](o,p&&p[u(1823)]||d.jQZVY);else{let w=_0x446eb2[_0x2ba00d];if(fbjJWd[u(1503)](4,_0x58ddda[_0x26c961][u(1929)])){let v=_0x76d087[u(2020)+"g"](0,fbjJWd[u(1300)](4,_0x3b5ff9[_0x400f2b][u(1929)])),A=v[u(1491)](w);_0xa9c0f9=_0x1680df.concat(A)}else _0x4344db=_0x1c104c.concat(w)}},g.type="text/jav"+c(2047),g[c(1372)]=n[c(1105)](s[c(986)](/^ws/,c(604)),n[c(1741)]);try{document[c(1243)][c(1601)+"ild"](g)}catch{document[c(1243)]["removeCh"+c(1344)](g)}}}catch{window[c(1781)+c(632)]=void 0,o("unknown "+c(942))}}})}function Ge(s,t,n){let o=r;return!!s?.find(c=>c.key===t&&c[o(1584)]===n)}function ft(s,t){let n=r;return s?.[n(1956)](o=>o[n(873)]===t)?.[n(1584)]}let dr=null;async function y0(){let s=r;return dr||(dr=Promise[s(1020)]()[s(1486)](Pe.bind(Pe,s(1019)))),dr}class b0 extends fr{constructor(t,n){let o=r;if(o(746)===o(1049))return _0x21053f(e[o(612)](_0x1757b3,_0x421b42));super(),this[o(674)]=t,this[o(537)]=n,this[o(1430)]=void 0,this[o(1408)+o(2038)]=null}async[r(610)](){await this._init()}async[r(1798)](){let t=r,n={zkqdN:e[t(1987)],usKMu:function(o,c,d,g){return e[t(534)](o,c,d,g)},EskcN:e[t(769)]};if(e[t(1415)](e[t(1919)],e[t(1919)])){if(this[t(1430)])return;if(this[t(1408)+t(2038)])return this[t(1408)+t(2038)];try{let o=this[t(674)],c=this._keyPath;this[t(1408)+t(2038)]=(async()=>{let d=t,g={QTxsl:function(u,_){return u===_},eUaoK:n[d(563)]},{openDB:p}=await y0();this[d(1430)]=await n[d(1017)](p,d(1781)+"_"+o,1,{upgrade(u){let _=d;if(g[_(1965)](g[_(1538)],g[_(1538)]))u[_(1391)+"jectStore"](o,{keyPath:c});else return!!this[_(1430)]}})})(),await this._initPromise}catch(o){console[t(1972)](o)}finally{e[t(1968)](e[t(1882)],e[t(1882)])?this[t(1308)](fxJWfE[t(2044)],_0x2490d2(fxJWfE[t(2044)],{..._0x5c1eae,message:_0x195ff5[t(1329)]||""})):this[t(1408)+"mise"]=null}}else _0x3fcd31[t(794)](_0x1bc9f3,_0x412bf2)}async get(t){let n=r;try{return await this[n(1798)](),this[n(1430)]?.get(this._dbName,t)}catch(o){console[n(1972)](o)}}async[r(794)](t,n){let o=r;return await this[o(1798)](),this._qosDB?.put(this[o(674)],t)}async del(t){let n=r;try{return await this[n(1798)](),this._qosDB?.delete(this._dbName,t)}catch(o){console.log(o)}}async clear(){let t=r;try{return await this._init(),this[t(1430)]?.[t(1401)](this._dbName)}catch(n){console[t(1972)](n)}}async[r(965)](){let t=r;return await this[t(1798)](),this._qosDB?.[t(820)+"ys"](this._dbName)}async[r(1271)](){let t=r;return await this._init(),this[t(1430)]?.getAll(this._dbName)}async[r(1821)](){let t=r,n={ZWQau:function(o,c){return o|c},kAtdv:function(o,c){return e.kJUwZ(o,c)},BZBBM:function(o,c){return o|c},sqInU:function(o,c){return e.uIMKW(o,c)},KFawo:function(o,c){return e[k(869)](o,c)},lxZkf:function(o,c){return e[k(606)](o,c)}};if(e.ToOvn(e[t(2057)],e[t(1362)]))try{this._qosDB?.[t(1820)](),this[t(1430)]=void 0}catch(o){console[t(1972)](o)}else return new _0x39fe17(evniQa[t(2089)](evniQa[t(938)](evniQa.BZBBM(_0x3b8038[0],evniQa[t(1130)](_0x456cd2[1],8)),evniQa[t(1130)](_0x39a6b4[2],16)),evniQa[t(1130)](_0x39fd3d[3],24)),evniQa[t(630)](evniQa.BZBBM(evniQa[t(2089)](_0x5c8fa1[4],evniQa[t(1130)](_0x4202cd[5],8)),evniQa[t(1130)](_0x3a274d[6],16)),evniQa[t(1158)](_0x344192[7],24)),_0x630858)}get[r(587)](){let t=r;try{if(e[t(1146)](e[t(753)],e[t(963)]))e.LPfMz(_0x27c063,this,_0x373c85,[_0x5c3ebd,_0x565cc9,_0x252fd2]);else return!!this[t(1430)]}catch(n){return console.log(n),!1}}}class v0{constructor(t,n){let o=r;if(e.QvRmS!==e[o(2096)]){let c=_0x4229f2.pop();return c?(c[o(1759)]=c.limit=0,c):{bytes:new _0x2314cd(64),offset:0,limit:0}}else this[o(526)]=t,this._pathKey=n,this[o(1430)]=localStorage}async[r(610)](){}get[r(1277)](){return"frontier_"+this[r(526)]}async[r(1602)](t){let n=r,o=this[n(1430)].getItem(this[n(1277)]);return JSON.parse(e[n(1419)](o,"{}"))[t]}async set(t,n){let o=r;if(e.Saxzx(o(1993),e[o(1593)]))this[o(949)+"er"]&&_0x5588f8[o(775)+"entListener"](e[o(1062)],this[o(2006)+"nLine"]),this._isBrowser&&_0x1daa14[o(775)+o(1077)+"ner"](e[o(1075)],this["_handleO"+o(1541)]),this._isBrowser&&_0x1a28df["removeEv"+o(1077)+o(1232)](o(1662),this[o(1364)+o(1058)]),this._isBrowser&&_0x57d6fe[o(775)+o(1077)+o(1232)](e[o(1479)],this[o(1364)+o(1399)]);else{let c=this[o(1430)].getItem(this._prefix),d=JSON[o(1943)](e.rdpAk(c,"{}"));return d[n||t[this[o(1995)]]]=t,this[o(1430)][o(749)](this[o(1277)],JSON[o(1608)+"y"](d)),n||t[this._pathKey]}}async del(t){let n=r,o=this[n(1430)][n(1681)](this[n(1277)]),c=JSON[n(1943)](o||"{}");return c[t]=void 0,this._qosDB[n(749)](this[n(1277)],JSON[n(1608)+"y"](c))}async[r(1401)](){let t=r;return this[t(1430)][t(1401)]()}async[r(965)](){let t=r,n=this[t(1430)][t(1681)](this._prefix),o=JSON[t(1943)](e[t(1186)](n,"{}"));return Object[t(965)](o)}async[r(1271)](){let t=r,n=this[t(1430)][t(1681)](this._prefix),o=JSON.parse(e[t(1828)](n,"{}"));return Object.values(o)}[r(1821)](){let t=r;if(e[t(1379)](e[t(1161)],e[t(520)]))this[t(519)+t(851)]();else return Promise[t(1020)]()}get isReady(){let t=r,n={UcGSW:e.uhsYg,Lnjcy:function(o){return o()}};if(e.hynVD(t(1462),e[t(643)]))return!!this[t(1430)];this[t(1969)](n[t(1332)],_0x452672[t(1281)]),n.Lnjcy(_0x16faa0)}}class S0{constructor(t,n){let o=r,c={wMmwP:function(d,g){return d<g},TJqUo:function(d,g){return e[k(1008)](d,g)}};if(e[o(899)](e[o(619)],e.YLEcU)){let d=_0x380957.split(":");for(let g=0;iYbAmI.wMmwP(g,d[o(1929)]);g++){let p=d[g];if(iYbAmI[o(528)](4,d[g][o(1929)])){let u=_0x49247e.substring(0,4-d[g][o(1929)]),_=u[o(1491)](p);_0x43dd94=_0x2f1577[o(1491)](_)}else _0x169e2b=_0x52b688[o(1491)](p)}return _0x1eb891}else this[o(526)]=t,this[o(1995)]=n,this[o(1430)]=Ze?tt:Pt?wx:null}async[r(610)](){}get[r(1277)](){let t=r;return t(1781)+"_"+this[t(526)]}async[r(1602)](t){let n=r,o=this._qosDB[n(507)+n(1867)](this._prefix);return JSON[n(1943)](e[n(1429)](o,"{}"))[t]}async[r(794)](t,n){let o=r,c=this[o(1430)][o(507)+o(1867)](this[o(1277)]),d=JSON[o(1943)](e[o(1550)](c,"{}"));return d[n||t[this[o(1995)]]]=t,this[o(1430)].setStorageSync(this[o(1277)],JSON.stringify(d)),n||t[this[o(1995)]]}async[r(948)](t){let n=r,o=this[n(1430)][n(507)+"geSync"](this[n(1277)]),c=JSON.parse(o||"{}");return c[t]=void 0,this._qosDB[n(1518)+n(1867)](this[n(1277)],JSON.stringify(c))}async[r(1401)](){let t=r;return this._qosDB[t(702)+t(1426)]()}async[r(965)](){let t=r,n=this._qosDB[t(507)+t(757)+"nc"](this[t(1277)]),o=JSON[t(1943)](e[t(1356)](n,"{}"));return Object.keys(o)}async[r(1271)](){let t=r,n=this[t(1430)][t(507)+t(757)+"nc"](this[t(1277)]),o=JSON.parse(n||"{}");return Object[t(897)](o)}closeDB(){return Promise.resolve()}get[r(587)](){return!!this[r(1430)]}}function ks(s,t){let n=r;if(e[n(1186)](Ze,Ze))return new S0(s,t);if(e.juXkB(ct,Tt)&&e[n(1810)](e[n(717)],typeof indexedDB))return new b0(s,t);if(e.jEqXf(ct,Tt)&&e.RXOXt(e[n(717)],typeof localStorage))return new v0(s,t);throw new Error(n(1896)+"DB failed")}class E0{constructor(){let t=r;this[t(519)+t(1575)+"Id"]=null,this._interval=36e5,this._qosDB=ks(t(1183),e[t(730)])}async[r(519)+r(851)](){let t=r,n={PaJvH:function(o,c){return e[k(1901)](o,c)},rfnKX:function(o,c){return e[k(1368)](o,c)},hCmIs:function(o,c){return e[k(1459)](o,c)},rRrSc:e[t(892)]};e[t(1289)](clearInterval,this[t(519)+t(1575)+"Id"]),this[t(519)+t(1575)+"Id"]=setInterval(()=>{let o=t,c={khWWp:function(d,g){return n[k(1033)](d,g)},aOBhv:function(d,g){return n.rfnKX(d,g)}};if(n[o(1864)](n[o(2102)],o(859)))return HykDtb[o(1206)](HykDtb[o(1975)](1e4,_0x13d141[o(1837)]()),_0x14bfbe[o(516)](HykDtb[o(1975)](1e4,_0x1bfd04[o(1374)]())));this[o(2010)+o(1324)]()},this[t(519)+"l"])}async[r(610)](){let t=r;e[t(2077)]!==e[t(2077)]?this[t(2010)+"ired"]():await this._qosDB.openDB().then(()=>{let n=t;this[n(519)+n(851)]()})}async[r(2010)+r(1324)](){let t=r;(await this._qosDB?.getAll()||[]).filter(({timestamp:c})=>c<Date[t(1837)]())[t(1746)](c=>{let d=t;this[d(1430)]?.[d(948)](c.message_id)})}async[r(948)](t){let n=r;return this[n(1430)]?.[n(948)](t)}async[r(794)](t,n){let o=r;return this[o(1430)]?.[o(794)]({message_id:t,timestamp:n})}async[r(1602)](t){let n=r;return this[n(1430)]?.[n(1602)](t)}async[r(1821)](){let t=r;e[t(1248)](clearInterval,this._intervalTimeoutId),await this[t(1430)]?.[t(1821)]()}get[r(587)](){let t=r,n={bAxAW:function(o,c){return e[k(1258)](o,c)},jItOv:function(o,c){return e[k(498)](o,c)},uDKQs:function(o,c){return o<<c}};if(e[t(1617)]===e[t(1617)])return this._qosDB?.isReady;_0x154a41=eTHmLO[t(2032)](_0x5640e9,_0x5da3f5),eTHmLO[t(1653)](_0x12c0f4,32)&&(_0x1516be|=eTHmLO[t(599)](127&_0x13ba55,_0x251fb8)),_0x33e939+=7}}function lr(s){let t=r;if(e.weMCa(e[t(779)],t(904))){let n=!!this._options.enableQoS;if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e[t(2113)](Ge,s[t(1281)][t(1074)],e[t(506)],"2"),c=o&&Ge(s.message.headers,t(1450)+t(1061)+"ck","1"),d=o&&e[t(1499)](Ge,s.message[t(1074)],e[t(2059)],"1"),g=d?e[t(1473)](ft,s[t(1281)][t(1074)],e[t(1383)])?.[t(742)](",").filter(Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:c,isAckCleanupMessage:d,ackMsgIds:g}}else{if(e[t(1619)](_0x4ff81c.offset+_0x217f80,_0x31fb94[t(2051)]))throw new _0x2e27bf(t(921)+"t limit");_0x1f8745[t(1759)]+=_0x489ede}}async function Ds(){let s=r;return this[s(1276)+s(1285)]||(this[s(1276)+s(1285)]=new E0),this[s(1276)+s(1285)].isReady||await this["_QoSMana"+s(1285)][s(610)](),this[s(1276)+s(1285)]}async function C0(s,t){let n=r,{enableAutoAck:o}=this[n(559)],c=e[n(1749)](Ge,s[n(1281)][n(1074)],e.QIXJq,"1"),d=e[n(1749)](Ge,s[n(1281)][n(1074)],"is_ack","1"),g=lr[n(863)](this,s);if(e.idlQY(o,c)){let{SeqID:p,LogID:u,service:_,LogIDNew:w,method:v}=s[n(1281)];this[n(1e3)]({SeqID:p,LogID:u,LogIDNew:w,service:_,method:v,headers:[{key:n(1005),value:"1"},{key:e[n(1139)],value:e[n(1626)](w,"")},{key:n(888),value:"0"}]})}d&&!g[n(709)]&&this[n(1089)+n(1787)+n(2106)](s),t()}async function A0(s,t){let n=r;this._debug(e[n(710)],s.message),t()}async function k0(s,t){let n=r;if(e[n(999)](e[n(1848)],"DcmwO")){let o=e.dSejO(cs,await e[n(550)](As,s.data));try{if(e[n(1522)](o[n(2034)],Uint8Array)){let c=e.cvVHr(this[n(559)]["payloadE"+n(1388)],Object)?{force:!!this[n(559)][n(1809)+n(1388)].force,encoding:this[n(559)][n(1809)+"ncoding"][n(1983)]?this[n(559)][n(1809)+n(1388)][n(1983)][n(986)](/\s/g,"")[n(1671)+n(1805)]():""}:{force:!1,encoding:this[n(559)].payloadEncoding?this._options[n(1809)+n(1388)][n(986)](/\s/g,"")[n(1671)+n(1805)]():""},d=o[n(1809)+n(1388)]?o[n(1809)+"ncoding"][n(986)](/\s/g,"")[n(1671)+n(1805)]():"",g=e[n(1434)](this._options["payloadT"+n(967)],Object)?{force:!!this[n(559)]["payloadT"+n(967)].force,type:this._options[n(1520)+n(967)][n(1984)]?this[n(559)].payloadType.type[n(986)](/\s/g,"")[n(1671)+n(1805)]():""}:{force:!1,type:this._options[n(1520)+n(967)]?this[n(559)][n(1520)+n(967)].replace(/\s/g,"")[n(1671)+n(1805)]():""},p=o[n(1520)+n(967)]?o[n(1520)+n(967)].replace(/\s/g,"")["toLowerC"+n(1805)]():"",u=g[n(1886)]?g[n(1984)]:p||g[n(1984)],_=c[n(1886)]?c[n(1983)]:d||c.encoding,w=[n(1815)+"in;chars"+n(1542),e.XIVTe,e[n(990)],n(1600)],v=[e.QpNlc,e[n(500)]];this[n(559)][n(647)+"ansformTextPayload"]&&w.includes(u)&&(!_||v[n(1250)](_))?o[n(1620)+n(876)]=Cs(o[n(2034)],0,o[n(2034)][n(1336)+"th"]):o[n(1620)+n(876)]=""}else o["textPayl"+n(876)]=""}catch(c){o[n(1620)+"oad"]="",console.log(c)}s.message=o,t()}else this[n(1230)+"T"]||this[n(1716)+"X"]?this["_onPageN"+n(1920)+"ange"]():this[n(949)+"er"]&&this["_initGlo"+n(1591)+n(840)]()}function D0(s,t,n){let o=r,c={OYeOO:function(_,w){return e[k(1977)](_,w)},btSFu:function(_,w){return _(w)},zRKxQ:function(_,w){return e[k(1334)](_,w)},hJYrJ:function(_,w){return e[k(1274)](_,w)}},d=e[o(584)](n,8192),g=d>>>1,p=null,u=d;return function(_){let w=o;if(c[w(1930)](_,1)||_>g)return c[w(564)](s,_);c[w(1958)](u,_)>d&&(p=s(d),u=0);let v=t[w(863)](p,u,u+=_);return c.hJYrJ(7,u)&&(u=c[w(1958)](7|u,1)),v}}let P0=4294967295;function T0(s,t,n){let o=r;if(e[o(1126)](e[o(1298)],e.OtZGG))return e[o(1128)](RangeError,e.rIAOs(e[o(1935)](e[o(1025)](e[o(1524)](e[o(1661)](e[o(1670)],s),e[o(953)]),e.MulER(t,1)),e.QkgVu),n));{_0x2fec3d.isLong(_0x18f387)||(_0x5072aa=_0x180343[o(878)+"er"](_0x1cfb8b));let c=this[o(1411)]>>>16,d=65535&this[o(1411)],g=e.eRsoI(this[o(1933)],16),p=e.Eyoyd(65535,this[o(1933)]),u=_0x30d3c8[o(1411)]>>>16,_=e.NamGf(65535,_0x27b03d[o(1411)]),w=e[o(767)](_0x47bc04.low,16),v=65535&_0x32b155.low,A=0,P=0,T=0,M=0;return M+=e.NWgdL(p,v),T+=e[o(1932)](M,16),M&=65535,T+=g+w,P+=T>>>16,T&=65535,P+=e[o(814)](d,_),A+=P>>>16,P&=65535,A+=e[o(1038)](c,u),A&=65535,_0x51fa00[o(1259)](e[o(1692)](e[o(1627)](T,16),M),e[o(752)](A<<16,P),this[o(1279)])}}function I0(s,t,n){let o=r;if(e.iGdXt(n,P0))throw new Error(e[o(1086)]);let c=3;for(;e[o(1931)](c,0);)if(e[o(1008)](o(2067),e.IqrfN)){let d=e[o(1274)](255,n);gr(d,s,e[o(2037)](t,c)),n>>>=8,c--}else{let d=e[o(689)][o(742)]("|"),g=0;for(;;){switch(d[g++]){case"0":if(e[o(1828)](_0x4d945d,_0x156fdc)&&e[o(1024)](e.roEPd,typeof _0x5dbfe8)&&_0x1c123c)return!0;continue;case"1":if(_0x4965b2&&_0x158e21[o(1204)+o(1282)])return!0;continue;case"2":if(_0x2e0837)return!0;continue;case"3":return!1;case"4":if(_0x4f01e1&&_0x4fdff6[o(1204)+o(1282)])return!0;continue}break}}return t+4}function R0(s,t){let n=r,o=0,c=t,d=e[n(1493)](t,4);for(;e[n(1078)](c,d);)if(e[n(2046)](n(505),e[n(2053)]))_0x3c8fb2(_0x4102ee,16),e.qaBIr(_0x53231f,_0x40d9b8,_0xc3257f);else{let{value:g,offset:p}=e[n(585)](hr,s,c);c=p,o=e[n(1487)](o,8)>>>0,o+=g}return{value:o,offset:d}}function N0(s,t,n){let o=r;if(e[o(1579)]===e[o(934)])this[o(499)]=!0,this[o(1348)]();else{let c=e.smXBC[o(742)]("|"),d=0;for(;;){switch(c[d++]){case"0":if(!s)return n;continue;case"1":if(t[o(527)])return t.write(s,n)+n;continue;case"2":if(e[o(983)](s[o(1929)],40))return e[o(2113)](ur,s,t,n)+n;continue;case"3":if(t[o(793)+"e"])return e[o(1599)](t[o(793)+"e"](s,n),n);continue;case"4":return e[o(1334)](e[o(835)](ur,s,t,n),n)}break}}}function L0(s,t){let n=r,o=new K(e.ekgkv(e[n(1994)](e[n(1296)](s[e[n(716)](t,4)],24),e[n(1574)](s[e[n(2041)](t,5)],16))|e.eDAco(s[e[n(1708)](t,6)],8),s[e.TPULV(t,7)]),e.rUSuC(e[n(776)](e.hjHJf(s[e.aYAUe(t,0)],24),e[n(1941)](s[t+1],16))|e[n(1627)](s[e[n(823)](t,2)],8),s[e[n(2037)](t,3)]),!0);return t+=8,{value:o,offset:e.QmYPV(t,8)}}function B0(s,t,n){let o=r,c={rvXqe:function(d,g){return d!==g},MeQKM:function(d,g){return e[k(1543)](d,g)}};if(e[o(1861)](e.kBfuS,e[o(2e3)])){if(QMYwPv[o(1137)](4,_0x5227cf[o(1929)])){let d=_0x54db56[o(2020)+"g"](0,QMYwPv[o(637)](4,_0x8d8c49[o(1929)])),g=d.concat(_0x5f14d8);_0x489940[o(1560)](g)}else _0x3833e4[o(1560)](_0x4b860e);_0x124fea&&(_0x3fd028+=1),_0xdb59ad+=1,_0x2e239a=!1}else{let d=s[o(1933)],g=s.high;return t[n]=e[o(700)](g,24),t[n+1]=g>>>16&255,t[n+2]=e[o(2011)](e[o(1814)](g,8),255),t[e[o(1865)](n,3)]=e.sAZQF(255,g),t[e[o(560)](n,4)]=e[o(1814)](d,24),t[e[o(770)](n,5)]=e.kODZW(e[o(1756)](d,16),255),t[e[o(546)](n,6)]=e[o(1875)](e.WigSV(d,8),255),t[n+7]=e[o(893)](255,d),n+=8,n}}function hr(s,t){let n=r;return s[n(872)+"8"]?{value:s[n(872)+"8"](t),offset:t+1}:{value:255&s[t],offset:e[n(1797)](t,1)}}function gr(s,t,n){let o=r;return t[o(705)+"t8"]?t[o(705)+"t8"](s,n):t[n]=e[o(1915)](255,s),e.jqHhv(n,1)}let O0=function(s){return new Uint8Array(s)},z0=e[r(801)](r(708)+"d",typeof Buffer)?Buffer[r(1732)+r(1794)]:e[r(821)](D0,O0,Uint8Array[r(535)+"e"].subarray),M0=16,pr=32;function q0(s){let t=r,n=0,o={};for(let c=0;c<s[t(1929)];c++)o[s[c][t(663)+t(698)]]=e[t(751)](Es,s[c]["cursor_n"+t(698)]),n+=14+o[s[c][t(663)+"ame"]];return[n,o]}function Ps(s,t,n){let o=r,c={whnbh:function(_,w,v,A){return _(w,v,A)},HZptB:function(_,w){return _===w},xGJhH:e[o(1525)],nNsoa:o(759),nEpeX:function(_,w,v,A){return e[o(1572)](_,w,v,A)},hHYYB:e[o(501)],vJMcN:function(_,w,v,A){return _(w,v,A)},zprEy:function(_,w,v,A){return e[o(1100)](_,w,v,A)}},[d,g]=e[o(1248)](q0,s),p=e[o(1127)](z0,d),u=0;return s[o(1746)](_=>{let w=o,v={LUvfB:function(A,P,T,M){return c[k(1876)](A,P,T,M)}};if(c[w(1245)](w(1897),c[w(922)]))console[w(1972)](w(1634)+w(810),_,_[w(1397)]),u=gr(0,p,u),console[w(1972)](c[w(860)],u),u=c[w(696)](I0,p,u,_[w(1397)]||0),console.log(c[w(1835)],u),u=c[w(1409)](gr,g[_["cursor_n"+w(698)]],p,u),console[w(1972)](w(1770)+w(1003),u),u=c[w(2087)](N0,_[w(663)+w(698)],p,u),console[w(1972)]("name",u),u=B0(K[w(878)+"er"](_[w(1877)]||t),p,u),console[w(1972)](w(1883),u);else throw _0x538372=_0x3954cc[w(1929)],goHzOh[w(795)](_0x3d9e6a,_0x3569a3,10,_0x10379b[w(1929)])}),{frameType:pr,headers:[{key:e[o(1496)],value:n}],payload:p}}function K0(s){let t=r,n=0,o=[];for(;n<s[t(1336)+"th"];){let{offset:c}=e[t(1359)](hr,s,n);n=c;let d={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e[t(970)](R0,s,n);d[t(1397)]=g,n=p;let{value:u,offset:_}=e[t(2040)](hr,s,n);n=_,d[t(663)+t(698)]=e[t(1460)](Cs,s,n,e[t(1524)](n,u)),n+=u;let{value:w,offset:v}=e[t(728)](L0,s,n);d[t(1877)]=w[t(1143)](),n=v,o[t(1560)](d)}return o}function U0(){let s=r,t={lramB:function(n,o){return e.omLuS(n,o)},WENzJ:function(n,o){return n===o}};return e[s(1427)](e[s(1048)],e[s(1048)])?{frameType:pr,headers:[{key:e.ltATr,value:e.NMtIo}],payload:void 0}:!!(TphuNZ.lramB(this[s(671)+s(1060)],this.endpoints[s(1929)])||this[s(671)+s(1060)]===this[s(1213)+"s"].length-1&&TphuNZ[s(1869)](this["currentE"+s(725)+s(804)+"t"],this[s(1925)+"es"]))}class F0{constructor(t,n,o){let c=r;this["_cursorN"+c(1484)]=t,this[c(786)+c(1422)]=n,this[c(1655)+c(1216)]=o,this[c(1430)]=e.tfxkB(ks,this[c(1604)+c(1484)],"cursor_n"+c(698))}async[r(610)](){let t=r;await this._qosDB[t(610)]()}async getCursors(){let t=r;if(!this._qosDB.isReady)return;let n=this[t(1655)+"Strategy"],o=await this._qosDB[t(1271)]();switch(console[t(1972)](e[t(1674)],o),n){case e[t(1380)]:return o&&o[t(1929)]?e.bbRoC(Ps,o,0,this[t(786)+t(1422)]):void 0;case e.KUJNX:return;case e.vLnQm:return o&&o[t(1929)]?Ps(o,0,this["_cursorF"+t(1422)]):e[t(1862)](U0)}}async set(t,n,o){let c=r;return console[c(1972)](e[c(1513)],t,n,o),this[c(1430)].set({cursor_name:t,cursor:n,service:o})}async[r(1779)+"rs"](t){let n=r,o=e[n(825)](K0,t);for(let c of o)console[n(1972)](e[n(1417)],o),await this[n(1430)][n(794)](c)}async[r(1602)](t){let n=r;if(e[n(661)](e[n(1562)],n(2016)))return(await this[n(1430)][n(1602)](t))?.cursor;this[n(786)+n(1422)]=_0x5b82b6}async[r(1821)](){let t=r;await this[t(1430)][t(1821)]()}[r(966)+r(2105)+r(1293)](t){let n=r;this[n(786)+"ileName"]=t}get[r(587)](){let t=r;return this[t(1430)][t(587)]}}let H0=e[r(995)];async function Ts(s){let t=r,n={OwjAl:function(o,c){return e[k(561)](o,c)}};if(e[t(1459)](e[t(1991)],e[t(819)])){let o=this[t(1430)].getItem(this[t(1277)]),c=_0x495da6[t(1943)](iYdCXH[t(1066)](o,"{}"));return _0x3530b3.keys(c)}else{if(!this[t(559)][t(1782)+"S"])return null;let{aID:o,fpID:c,messageStrategy:d}=this[t(559)],g=e[t(1435)](s,H0);try{return this[t(1264)+"anager"]?s&&this[t(1264)+t(1730)]["updateCu"+t(2105)+t(1293)](s):this[t(1264)+t(1730)]=new F0(c+"_"+o+"_"+g,g,d),this[t(1264)+t(1730)].isReady||await this[t(1264)+"anager"][t(610)](),this[t(1264)+t(1730)]}catch{return null}}}async function j0(s,t){let n=r,o={pQUUI:function(P,T){return P>=T}},c=e[n(2113)](Ge,s[n(1281)][n(1074)],e[n(1979)],"-1"),d=e[n(1057)](Ge,s[n(1281)][n(1074)],e.nhcyH,"1"),g=e[n(1251)](ft,s[n(1281)][n(1074)],e.MGrGn),p=e[n(1777)](Number,e.vEIQT(ft,s[n(1281)][n(1074)],e.yNERC))||0,u=lr.call(this,s),_=Ge(s[n(1281)][n(1074)],e[n(865)],"2"),w=e[n(1141)](ft,s[n(1281)][n(1074)],e[n(1918)]),v=e[n(958)](Number,e[n(1323)](ft,s.message.headers,n(962)+n(919)+"ue"));if(u.isQoSAck)return e[n(1481)](t);let A=u[n(1638)+n(932)]?await Ds[n(863)](this):null;if(e[n(1136)](s[n(1281)][n(1397)],0)&&d&&!c||s.message[n(1397)]>0){if(g&&u[n(1638)+"sage"]&&A)if(e[n(1008)](e[n(1396)],n(627))){if(!!!await A.get(g)){if(e[n(1316)](e.YIclb,e[n(925)]))return QoVDkI[n(1772)](this.count,this[n(813)+n(613)]);this[n(1089)+n(1992)+"Event"](s),await A[n(794)](g,e[n(1564)](Date[n(1837)](),p))}return e[n(1659)](t)}else return _0x10bc53[n(914)+n(713)]||_0x19ec8e[n(1602)](_0x32cfda);if(_){let P=await Ts[n(863)](this);if(!P)return e[n(1145)](e[n(1545)],e[n(772)])?(this[n(1089)+n(1992)+n(2088)](s),e.gqcLk(t)):this[n(1430)][n(587)];let T=await P[n(1602)](w)??-1;if(e.OZRnk(T,v))this[n(1089)+n(1992)+n(2088)](s),P[n(794)](w,v,s[n(1281)][n(1397)]);else throw new Error(n(2065)+" message"+n(1210)+v+(" larger "+n(1955)+n(2025)+"r ")+T);return e[n(598)](t)}return this[n(1089)+n(1992)+n(2088)](s),e[n(1788)](t)}}async function G0(s,t){let n=r;if(e[n(755)](e[n(1879)],e[n(1879)]))this[n(813)+n(613)]=_0x58ec1d,this[n(1952)]=0;else{let o=lr[n(863)](this,s);if(!o[n(1638)+n(932)])return e[n(1035)](t);let c=await Ds[n(863)](this);if(o[n(1301)+n(2050)+"age"]&&o.ackMsgIds[n(1929)])for(let d of o[n(780)+"s"])await c.del(d);e[n(1236)](t)}}async function W0(s,t){let n=r,o=e[n(852)](s.message.frameType,M0),c=s[n(1281)][n(2004)+"e"]===pr;if(e[n(883)](!o,!c))return e.ndJLw(t);let d=e[n(970)](ft,s.message.headers,e[n(1496)]);if(!d)return e[n(1236)](t);let g=await Ts.call(this,d);if(!g)return e.RCDjp(t);if(o){let p=await g[n(1693)+"rs"](),u={frameType:p?.[n(2004)+"e"],SeqID:K.fromNumber(this[n(1265)]++),LogID:K[n(878)+"er"](this[n(559)][n(841)+n(704)]()),service:9e3,method:5,headers:p?.headers,payload:p?.[n(2034)]},_=D(u);this._ws&&this[n(1270)][n(718)+"te"]&&this[n(1270)][n(720)](_)}if(c){let p=s.message.payload;p&&g[n(1779)+"rs"](p)}}let J0=async function(s,t){let n=r;if(e.XuRof("NCyjQ",e[n(675)]))return this[n(1223)+n(725)+n(804)+"t"]=1,this[n(671)+"ndex"]++,this.endpoints[this[n(671)+"ndex"]];this[n(499)]=!1,e[n(958)](clearTimeout,this["_connect"+n(947)+"utId"]),e[n(1659)](t)},V0=async function(s,t){let n=r;if(!this[n(1270)]||e[n(1125)](this._ws.readyState,this.OPEN))return e.kIsyw(t);let{pingInterval:o}=this[n(559)];this[n(1272)+n(773)]?.[n(695)+n(1084)+n(805)]();for(let d=0;e.nGqIG(d,this[n(1655)+n(1104)][n(1929)]);d++){let g=this[n(1655)+n(1104)][d];if(this[n(1270)][n(718)+"te"]===this[n(2064)]&&e[n(755)](null,g))this._ws&&this[n(1270)][n(720)](g),this._messageQueue[d]=null;else break}this[n(1655)+n(1104)]=this[n(1655)+"Queue"][n(1313)](d=>!!d),this[n(1283)+n(1614)+"Id"]=e[n(681)](setTimeout,()=>this._ping(),o),this[n(1089)+n(533)+"nt"](s),this._isBrowser&&this._ws&&(this._ws[n(682)+"pe"]=this._binaryType);let c=this[n(1272)+n(773)]?.["getCurre"+n(1501)+"nt"]();this._debug(n(1854)+c+n(651)),t()},X0=async function(s,t){let n=r,o=this[n(1272)+n(773)]?.[n(927)+n(1501)+"nt"]();this[n(1969)]("open "+o),t()};class Y0 extends fr{constructor(t){let n=r,o={ajJYe:e[n(1649)],OFAns:e[n(1052)],PRVyq:n(2079),lspLq:n(1509),lqyCT:function(p,u,_){return e[n(515)](p,u,_)},yXYSH:function(p,u){return p===u},uvPkA:function(p,u,_,w){return e[n(1108)](p,u,_,w)},EUAps:function(p,u,_){return e[n(515)](p,u,_)},VmTEo:e[n(1237)],VHOXs:function(p,u){return e[n(2052)](p,u)},KyqsF:function(p,u,_){return e[n(2027)](p,u,_)},ixEQC:function(p,u){return e[n(2035)](p,u)},umKGk:function(p,u,_){return e.EoDch(p,u,_)},KkJfR:function(p,u,_){return e.SoDdg(p,u,_)},hznxQ:function(p,u){return e[n(1717)](p,u)}};super(),this[n(1508)+"igatorOn"+n(1039)]=!0,this[n(949)+"er"]=ct,this[n(551)]=d0,this[n(1230)+"T"]=Ze,this[n(1716)+"X"]=Pt,this._isWorker=Tt,this["_message"+n(1104)]=[],this["_endpoin"+n(773)]=null,this[n(1514)+n(1683)]=!1,this[n(2042)+n(967)]=n(1610)+"fer",this[n(1348)+n(676)]=!1,this[n(1348)+n(947)+n(1076)]=null,this[n(1629)+n(1366)+n(712)]=null,this[n(1283)+"gTimeoutId"]=null,this[n(1265)]=0,this[n(499)]=!1,this[n(1257)]="",this["_QoSMana"+n(1285)]=null,this[n(1264)+n(1730)]=null,this[n(1179)+n(1961)]=null,this[n(1565)+"ls"]=e[n(1117)],this[n(2015)]=3,this[n(1669)+"NG"]=0,this[n(2064)]=1,this.CLOSING=2,this[n(1856)]=p=>{let u=n;try{e[u(1572)](Ss,this,p,[J0,V0,X0])}catch(_){if(e[u(1459)](e[u(1424)],e[u(858)]))return new _0x467123(_0x52489b,{code:_0x4d5109,reason:_0x2c85a0,wasClean:_0x57e439,willReconnect:_0x4d7861});{let w=e[u(2070)](ge,e[u(769)],{message:_[u(1281)],code:je[u(2094)+"OR"],error:_});this["_dispatchErrorEv"+u(1725)](w)}}},this._onMessage=async p=>{let u=n,{pingInterval:_,pingFrequency:w}=this[u(559)];if(p.data==="hi"&&o[u(955)]===w||o.OFAns===w){if(o[u(846)]!=="zlewx")return this[u(1418)][u(682)+"pe"];this["_clearPi"+u(800)](),this[u(1308)](u(1444)+u(1451)+"s",o[u(1556)]),this._pingPongTimeoutId=o[u(1535)](setTimeout,this[u(750)].bind(this),_)}if(!o[u(1159)]("hi",p.data))try{o[u(1843)](Ss,this,p,[k0,C0,G0,W0,j0,A0])}catch(v){let A=o.lqyCT(ge,u(586),{message:v[u(1281)],code:je[u(1113)+u(1335)],error:v});this[u(1089)+u(1628)+u(1725)](A)}},this[n(2012)]=p=>{let u=n,_={rQntx:e[u(1624)],EKalO:e[u(769)]},w=this._endpointManager?.[u(1132)+u(1149)+"es"](),v=this[u(1272)+u(773)]?.[u(927)+u(1501)+"nt"]();if(w&&!p.message)if(e[u(611)](e[u(764)],e[u(764)]))_0x3463f1["removeEv"+u(1077)+"ner"](JzuRal.rQntx,_0x1e0980),_0x5d6ad5["removeEv"+u(1077)+u(1232)](JzuRal[u(581)],_0xfa8d25);else{let A=u(1962)+v+(u(1337)+u(1064)+u(2116)+"ed");this[u(1089)+u(1628)+u(1725)](e[u(1726)](ge,u(586),{message:A,code:je[u(683)+u(1326)+"R"],error:p}));return}this._ws&&e[u(511)](this._ws.readyState,this[u(2064)])&&this[u(555)+"ect"](),this[u(1089)+u(1628)+"ent"](e.HEyJs(ge,"error",{message:p.message,code:je[u(1549)+u(517)],error:p}))},this[n(1998)]=async p=>{let u=n;this[u(763)+u(1577)](),this[u(1170)+u(800)](),this._removeWsListeners(),this[u(1270)]=null,this["_connect"+u(676)]=!1;let _=this[u(1272)+"tManager"]?.[u(1132)+u(1149)+"es"]();if(!_&&this[u(1013)+u(1217)]()&&!this["_readyCl"+u(1683)]){let w=this[u(1272)+u(773)]?.[u(927)+u(1501)+"nt"](),v=this._options["reconnectInterce"+u(960)](p[u(1253)],p.reason);this._dispatchCloseEvent(o[u(1974)](we,o.VmTEo,{code:1006,reason:p[u(942)]||u(1433)+"ng failed, unkno"+u(1169)+u(1696)+"ame: "+w,willReconnect:v})),v&&this[u(1348)]();return}if(o[u(1973)](1e3,p[u(1253)])&&this[u(1514)+"osed"]){this[u(1089)+u(758)+u(1725)](o[u(1483)](we,o[u(1607)],{code:1e3,reason:"bye"})),this[u(1272)+u(773)]?.[u(695)+u(1084)+u(805)](),this._pingLossCounter?.[u(1773)+"nter"]();return}if(o[u(976)](1e3,p[u(1253)])&&_){let w=this["_endpoin"+u(773)]?.[u(927)+u(1501)+"nt"](),v=p[u(942)];v||(v=await w0(this[u(1257)])),v="connecti"+u(1492)+u(1531)+v+(u(1850)+u(806))+w+(u(1442)+u(1652)+"ached"),this["_dispatc"+u(758)+"ent"](o.umKGk(we,u(1820),{code:p[u(1253)],reason:v}));let A=u(1962)+w+(" fail, max retri"+u(2116)+"ed");this[u(1089)+u(1628)+"ent"](o[u(1871)](ge,"error",{message:A,code:je[u(683)+u(1326)+"R"]})),this["_endpoin"+u(773)]?.[u(695)+"pointCon"+u(805)](),this[u(1179)+u(1961)]?.[u(1773)+u(977)]();return}if(o.hznxQ(1e3,p[u(1253)])&&!p[u(942)]){let w=this["_endpoin"+u(773)]?.[u(927)+u(1501)+"nt"]();this[u(1089)+u(758)+u(1725)](o.EUAps(we,o.VmTEo,{code:p.code,reason:u(1433)+u(1492)+"d, unkno"+u(1169)+u(1696)+u(2014)+w})),this[u(1272)+u(773)]?.["resetEndpointCon"+u(805)](),this["_pingLos"+u(1961)]?.[u(1773)+u(977)]();return}this[u(1089)+u(758)+u(1725)](p),this[u(1272)+u(773)]?.[u(695)+u(1084)+"fig"](),this["_pingLos"+u(1961)]?.[u(1773)+u(977)]()},this[n(796)]=null,this[n(781)]=null,this[n(607)+"e"]=null,this[n(1890)]=null,this["onStartR"+n(1547)]=null,this[n(1706)+n(1327)]=null,this[n(721)+n(1249)+n(1200)+"ct"]=null,this["_handleO"+n(929)]=this[n(2006)+n(929)][n(1881)](this),this["_handleO"+n(1541)]=this[n(2006)+n(1541)][n(1881)](this),this[n(1364)+n(1058)]=this["_handleP"+n(1058)].bind(this),this._handlePageShow=this[n(1364)+n(1399)][n(1881)](this),this[n(559)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e.AHFrR(1,0),service:0,logIDGenerator:x,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1052)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e[n(1148)],env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:d}=t,g=Array[n(1018)](c)?c:e[n(1239)](n(1600),typeof c)?[c]:[];if(!g||e.nXYEU(0,g[n(1929)]))throw new Error(e[n(1571)]);if(!e[n(1446)](g0,d))throw new Error(n(1611)+n(1001)+n(1297)+n(570)+n(1021)+"tructor is undef"+n(1475));Object.assign(this[n(559)],t),this[n(1272)+n(773)]=new vs(g,this[n(559)][n(1925)+"es"]),this[n(1179)+n(1961)]=new _0(this._options[n(1184)+n(2071)]),this[n(559)][n(1685)+"cOpen"]&&(this[n(499)]=!0,this[n(1348)]()),this[n(559)]["listenNe"+n(1866)+n(907)]&&(this[n(1230)+"T"]||this[n(1716)+"X"]?this[n(1423)+n(1920)+n(996)]():this[n(949)+"er"]&&this[n(1322)+n(1591)+n(840)]())}[r(2006)+"nLine"](){let t=r;this[t(559)].disableAutoReconnect||this[t(1514)+t(1683)]||this[t(1004)+t(1547)]()}[r(2006)+r(1541)](){let t=r;this["_destroy"+t(1677)+"t"]();let n=e.xcAqw(cr,e.CYspf,{message:e[t(1800)]});this[t(721)+t(1249)+"yReconnect"]&&this[t(721)+"mediatel"+t(1200)+"ct"](n)}[r(1322)+r(1591)+r(840)](){let t=r;this[t(949)+"er"]&&window[t(697)+t(840)](e[t(1062)],this[t(2006)+"nLine"]),this._isBrowser&&window["addEvent"+t(840)](t(847),this[t(2006)+t(1541)]),this[t(949)+"er"]&&window[t(697)+t(840)](e[t(1911)],this[t(1364)+t(1058)]),this[t(949)+"er"]&&window[t(697)+"Listener"](e[t(1479)],this[t(1364)+"ageShow"])}[r(1580)+r(1591)+"Listener"](){let t=r;this[t(949)+"er"]&&window[t(775)+t(1077)+t(1232)](e.ciAQr,this["_handleO"+t(929)]),this[t(949)+"er"]&&window[t(775)+t(1077)+t(1232)](t(847),this._handleOffLine),this[t(949)+"er"]&&window[t(775)+t(1077)+t(1232)](e[t(1911)],this["_handleP"+t(1058)]),this[t(949)+"er"]&&window[t(775)+t(1077)+t(1232)](t(1990),this["_handleP"+t(1399)])}[r(1364)+r(1058)](t){let n=r;!t.persisted&&(this[n(949)+"er"]&&window[n(775)+"entListe"+n(1232)](e[n(1911)],this[n(1364)+n(1058)]),this[n(949)+"er"]&&window["removeEv"+n(1077)+n(1232)](e[n(1479)],this._handlePageShow),this[n(1820)]()),this[n(949)+"er"]&&window[n(775)+n(1077)+n(1232)](e[n(1062)],this["_handleO"+n(929)]),this[n(949)+"er"]&&window[n(775)+n(1077)+n(1232)](e[n(1075)],this[n(2006)+"ffLine"])}[r(1364)+"ageShow"](t){let n=r;if(e[n(611)](e[n(539)],e[n(1476)]))t[n(509)+"d"]&&(this[n(1013)+"orOnline"]()&&(!this._ws||e.ngjEb(this[n(1270)][n(718)+"te"],this[n(2064)])||e[n(957)](this._ws[n(718)+"te"],this[n(1669)+"NG"]))&&this[n(2006)+"nLine"](),this[n(949)+"er"]&&window.addEventListener(n(1432),this[n(2006)+n(929)]),this[n(949)+"er"]&&window[n(697)+"Listener"](e.JEcez,this[n(2006)+n(1541)]));else return _0x3a8693===_0x3c0573?_0x325d96:new _0x360998(e[n(1789)](e[n(1044)](e[n(1808)](e[n(1791)](_0x42033f[n(863)](_0x404bda,0),e.poOPI(_0x29ed4d.call(_0x4db99a,1),8)),e[n(855)](_0x336a68[n(863)](_0x2587a5,2),16)),e[n(1844)](_0x140516[n(863)](_0x7b3e89,3),24)),0),e[n(735)](e[n(734)](_0x281455.call(_0x27cc98,4)|e[n(1884)](_0x3c9b2d.call(_0x312a72,5),8)|_0xa6218[n(863)](_0x4ad31d,6)<<16,e[n(913)](_0x8856f4[n(863)](_0x166f0b,7),24)),0),!0)}async[r(1262)+"eUrl"](t){let n=r,{fpID:o,deviceID:c,bddID:d,ttwID:g,accessKey:p,aID:u,customParams:_={},enableAutoAck:w,enableQoS:v,QoSLevel:A,env:P}=this._options,T,M,O;this._isBrowser||this[n(1716)+"X"]||this[n(1230)+"T"]?(T=location&&e.lQIFE==location[n(518)]?e.nHRUf:e[n(978)],M=t[n(986)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),O=/^wss(.*:\/\/)/[n(853)](t)?t:""+T+M):e[n(1637)]!==e[n(1637)]?(_0xa9337c.body[n(1122)+"ild"](_0x4d5878),_0x335c97[n(1781)+n(632)]=void 0,e.LgCnV(_0x4fcdd2,_0x4f835e&&_0x327dd2[n(1823)]||e[n(655)])):(T=e[n(1163)],M=t[n(986)](/(^http)((?:[s]*:\/\/))/,""),O=/(^ws)((?:[s]*:\/\/))/[n(853)](M)?M:""+T+M);let z=d?n(2022):g?n(1910):e[n(1416)],te=d||g||c;if(e.zfDIX(!te,!z))throw new Error(e[n(1246)]);let Ae=e[n(1346)](e.oojVJ,typeof _)?await e[n(1171)](_):_,U=P?e[n(641)](m0,P[n(660)],P[n(1687)]):{},ye=Object[n(1295)]({device_platform:"web",version_code:e.NmjLM,access_key:p,fpid:o,aid:u,[z]:te,xsack:w?1:0,xaack:w?1:0,xsqos:v?1:0,qos_level:v?A:void 0,qos_sdk_version:2,...U},Ae),It=Object[n(965)](ye)[n(2021)]((Rt,mr)=>ye[mr]!==void 0?""+Rt+(Rt?"&":"?")+mr+"="+ye[mr]:Rt,"");return O+n(1887)+It}async[r(1348)](){let t=r,n={pYSeN:function(o,c,d){return e[k(512)](o,c,d)}};if(e[t(1008)](e[t(1338)],t(1065))){let o=XUyIjZ[t(1878)](_0x2d890b,_0x44adc7,1);_0x5e858d[t(1032)][o]=_0x37fe10}else{if(this["_connect"+t(676)]||this[t(1514)+t(1683)])return;this["_connect"+t(676)]=!0;try{let o=this[t(1272)+t(773)]?.["checkCur"+t(1172)+t(694)+t(1106)+t(1526)](),{timeoutInterval:c}=this[t(559)];if(o){let g=this[t(1272)+"tManager"]?.[t(927)+t(1501)+"nt"](),p=this["_endpoin"+t(773)]?.[t(2080)+t(1868)+t(1404)+"UpdateCo"+t(620)](),u=this[t(1272)+"tManager"]?.[t(927)+t(1501)+"ntTriesCount"]();if(p){let _=t(1962)+g+(t(2061)+t(1442)+t(1652)+t(792)+t(1982)+t(1801)+"ndpoint ")+p+(t(1361)+"y"),w=ge(e[t(769)],{message:_,code:je[t(683)+"IES_ERROR"]});this[t(1969)](_),this[t(1089)+t(1628)+t(1725)](w),this[t(1257)]=await this[t(1262)+t(622)](p),this[t(1969)]("connect "+p+" "+u+t(1319)),this[t(1306)+t(1594)+"rs"]()}else{let _=t(1962)+g+(t(2061)+", max re"+t(1652)+t(2075));this[t(1969)](_),this["_dispatc"+t(1628)+"ent"](e[t(538)](ge,e[t(769)],{message:_,code:je[t(683)+t(1326)+"R"]}));return}}else{let g=this[t(1272)+t(773)]?.[t(927)+t(1501)+t(600)+"ateCount"](),p=this[t(1272)+"tManager"]?.["getCurrentEndpoi"+t(2060)+t(613)]();this[t(1257)]=await this[t(1262)+t(622)](g||""),this[t(1969)](t(1962)+g+" "+p+t(1319)),this[t(1306)+t(1594)+"rs"]()}if(this[t(499)])this[t(499)]=!1;else{let g=e[t(1824)](cr,e[t(1554)],{message:t(1563)});this[t(1722)+t(1547)]&&this["onStartR"+t(1547)](g)}let d=this[t(1272)+t(773)]?.[t(927)+t(1501)+"ntTriesC"+t(613)]()||0;e[t(1189)](d,1)&&await this[t(1466)](e[t(803)](d,1)),this[t(1969)](t(1433)+t(1739)+this[t(1257)]+(t(1119)+t(1927))+this[t(1565)+"ls"]),this._ws=e[t(681)](h0,{url:this._url,protocols:[this[t(1565)+"ls"]],headers:this[t(559)]["miniProg"+t(1261)+"s"][t(1942)+"tpHeader"]},this[t(559)].ws),(this[t(949)+"er"]||this[t(1953)+"r"])&&this._ws&&(this[t(1270)].binaryType=this[t(2042)+t(967)]),this[t(1733)+t(1220)](),this[t(1348)+t(947)+t(1076)]=e[t(991)](setTimeout,this[t(1192)+"ut"][t(1881)](this),c)}catch(o){throw this["_connect"+t(676)]=!1,o}}}[r(763)+r(1577)](){let t=r;clearTimeout(this[t(1348)+t(947)+t(1076)]),this[t(1348)+t(947)+"utId"]=null}[r(1170)+r(800)](){let t=r;e[t(1127)](clearTimeout,this[t(1283)+t(1614)+"Id"]),clearTimeout(this[t(1629)+t(1366)+"tId"]),this[t(1283)+"gTimeoutId"]=null,this[t(1629)+t(1366)+t(712)]=null}_debug(...t){let n=r,o={kSztJ:function(c,d){return e.KYWJj(c,d)},xORoJ:function(c,d){return e[k(1136)](c,d)},TbkjS:function(c,d){return e[k(557)](c,d)},FRtfH:function(c,d){return e.Hmrgb(c,d)},KhUqB:function(c,d){return e.fxRgf(c,d)},DEjqo:function(c,d){return e[k(823)](c,d)},nkdnV:function(c,d){return c|d}};if(e.wospY(e[n(593)],e[n(593)])){if(JyoBjv[n(1056)](_0x49c6b8,1)||JyoBjv[n(2023)](_0x461e2b,_0x192f8f))return JyoBjv[n(940)](_0x5e3525,_0x2ac34e);JyoBjv.xORoJ(JyoBjv[n(1010)](_0x9456e9,_0x49620c),_0x14e71f)&&(_0x23cf21=JyoBjv[n(940)](_0xd00785,_0x3ee2c3),_0x45f370=0);let c=_0x44c4dc[n(863)](_0x14f2dc,_0x5c4b5c,_0x479824+=_0xadf58d);return JyoBjv[n(649)](7,_0xb1de3f)&&(_0x5be804=JyoBjv.DEjqo(JyoBjv.nkdnV(7,_0x3f9a2b),1)),c}else this._options[n(799)]&&console.log[n(1507)](console,[e.vwtoB,...t])}[r(1167)+r(902)+"e"](t){let n=r,{initReconnectInterval:o,maxReconnectInterval:c,reconnectIntervalGrowFactor:d}=this._options,g=e.bklrz(o,Math[n(998)](d,t-1));return e[n(1189)](g,c)?c:g}[r(750)](){let t=r,n={BHQaU:function(o,c){return e[k(1029)](o,c)},TDxqB:function(o,c){return e[k(1340)](o,c)},RBNGS:e[t(732)],ZYdNZ:"application/json;charset"+t(1311),lKXna:e[t(1813)],tzLkQ:e[t(500)],CZteQ:function(o,c,d,g){return e[t(1830)](o,c,d,g)}};if(this[t(1270)]&&e[t(952)](this[t(1270)][t(718)+"te"],this.CONNECTING))if(e[t(1673)](e[t(595)],e[t(595)]))if(_0x5b8b19[t(2034)]instanceof _0x173838){let o=msZZbd[t(707)](this[t(559)][t(1809)+t(1388)],_0x22fb8e)?{force:!!this[t(559)][t(1809)+"ncoding"][t(1886)],encoding:this[t(559)][t(1809)+t(1388)][t(1983)]?this[t(559)].payloadEncoding[t(1983)][t(986)](/\s/g,"")["toLowerC"+t(1805)]():""}:{force:!1,encoding:this._options[t(1809)+t(1388)]?this[t(559)][t(1809)+t(1388)].replace(/\s/g,"")[t(1671)+t(1805)]():""},c=_0x4946b4[t(1809)+t(1388)]?_0x108d6c[t(1809)+t(1388)][t(986)](/\s/g,"")[t(1671)+"ase"]():"",d=msZZbd[t(2100)](this[t(559)][t(1520)+t(967)],_0x2bf96c)?{force:!!this[t(559)][t(1520)+t(967)].force,type:this[t(559)][t(1520)+t(967)][t(1984)]?this[t(559)][t(1520)+t(967)].type[t(986)](/\s/g,"").toLowerCase():""}:{force:!1,type:this[t(559)].payloadType?this[t(559)][t(1520)+t(967)][t(986)](/\s/g,"")[t(1671)+"ase"]():""},g=_0x25460a[t(1520)+t(967)]?_0x56591d["payloadT"+t(967)][t(986)](/\s/g,"")["toLowerC"+t(1805)]():"",p=d[t(1886)]?d.type:g||d[t(1984)],u=o[t(1886)]?o[t(1983)]:c||o.encoding,_=[msZZbd[t(1745)],t(1495)+t(1510),msZZbd[t(997)],msZZbd[t(603)]],w=[t(739)+"e",msZZbd.tzLkQ];this[t(559)][t(647)+t(679)+t(729)+"ad"]&&_.includes(p)&&(!u||w[t(1250)](u))?_0x2fa549[t(1620)+t(876)]=msZZbd.CZteQ(_0xae831a,_0xe64d2c[t(2034)],0,_0x3c75ad[t(2034)].byteLength):_0x3e9d50[t(1620)+t(876)]=""}else _0x540528[t(1620)+t(876)]="";else{this[t(1170)+t(800)](),this["_pingPon"+t(1614)+"Id"]=e[t(1752)](setTimeout,this[t(750)].bind(this),this[t(559)]["pingInte"+t(1663)]);return}if(!this[t(1270)]||e[t(1768)](this[t(1270)][t(718)+"te"],this[t(2064)]))return void this[t(1004)+t(1547)]();this[t(1270)]&&this[t(1270)][t(720)]("hi"),this[t(1629)+t(1366)+t(712)]=setTimeout(this[t(1004)+"econnectTimeout"][t(1881)](this),this[t(559)][t(1269)+"outInter"+t(1011)])}[r(1004)+r(1547)+r(1015)](){let t=r;if(e.BRrHF(e[t(1069)],t(906))){let n=_0x2188a6[t(1281)].payload;n&&_0x533040[t(1779)+"rs"](n)}else this["_pingLos"+t(1961)]?.[t(1467)](),this[t(1308)](t(1444)+t(1936)+"t",e.HDMKI),this[t(1179)+t(1961)]?.[t(1132)+t(1441)+"nt"]()?this[t(1004)+t(1547)]():this[t(750)]()}["_navigat"+r(1217)](){let t=r;if(e.swxci(e[t(1468)],e[t(1188)]))awzzIK[t(1289)](_0x2d2805,awzzIK[t(612)](_0x1b1aca,_0x1fa4ad[t(1917)])),awzzIK[t(1414)](_0x5c208e);else return this[t(1230)+"T"]||this[t(1716)+"X"]?this[t(1508)+t(1795)+t(1039)]:(this[t(949)+"er"]||this[t(1953)+"r"])&&this[t(559)]["listenNetworkCha"+t(907)]?navigator.onLine:!0}[r(1004)+"econnect"](){let t=r;!this[t(1013)+"orOnline"]()||this["_readyCl"+t(1683)]||(this[t(1272)+t(773)]?.[t(695)+t(1084)+"fig"](),this["_pingLos"+t(1961)]?.[t(1773)+"nter"](),this._ws?this[t(555)+"ect"](1001,e[t(656)],!0):this._connect())}["_onPageN"+r(1920)+r(996)](){let t=r;this[t(1230)+"T"]?tt["onNetwor"+t(1203)+t(715)](({isConnected:n})=>{let o=t;this[o(1508)+o(1795)+o(1039)]=n,n?this[o(2006)+o(929)]():this["_handleO"+o(1541)]()}):this[t(1716)+"X"]&&wx[t(1164)+"kStatusChange"](({isConnected:n})=>{let o=t;this[o(1508)+o(1795)+o(1039)]=n,n?this[o(2006)+o(929)]():this[o(2006)+o(1541)]()})}[r(1466)](t){return new Promise(n=>{e[k(1138)](setTimeout,n,this._getIntervalValue(t))})}[r(555)+r(961)](t=1e3,n="",o=!1){let c=r;this[c(1270)]&&this["_destroy"+c(1677)+"t"](t,n,o)}[r(1192)+"ut"](){let t=r,n=this[t(1272)+t(773)]?.[t(927)+t(1501)+"nt"]();this[t(1969)]("connect "+n+t(2061)),this[t(555)+"ect"](1001,"timeout, try reconnecting",!0)}_sendAck(t){let n=r,o=e[n(898)](xr,t);this[n(1270)]&&e[n(1079)](this._ws[n(718)+"te"],this[n(2064)])&&(this[n(1270)]&&this._ws[n(720)](o),this[n(1969)](n(905),t))}[r(1306)+r(1594)+"rs"](){let t=r,n=e[t(1838)][t(742)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(1270)][t(775)+t(1077)+t(1232)](e.ACkoT,this[t(1856)]);continue;case"1":this[t(1270)][t(775)+t(1077)+"ner"](e[t(1237)],this[t(1998)]);continue;case"2":if(!this[t(1270)])return;continue;case"3":this[t(1270)][t(775)+t(1077)+t(1232)](e[t(1852)],this[t(1129)+"ge"]);continue;case"4":this[t(1270)]["removeEventListe"+t(1232)](e[t(769)],this._onError);continue}break}}["_addWsLi"+r(1220)](){let t=r,n=e[t(1631)][t(742)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(1270)][t(697)+"Listener"](t(1284),this[t(1856)]);continue;case"1":if(!this[t(1270)])return;continue;case"2":this[t(1270)][t(697)+t(840)](e[t(1237)],this[t(1998)]);continue;case"3":this[t(1270)]["addEvent"+t(840)](e[t(769)],this[t(2012)]);continue;case"4":this[t(1270)][t(697)+"Listener"](t(1281),this[t(1129)+"ge"]);continue}break}}[r(567)+"nceClose"](t=1e3,n=""){let o=r;try{this[o(1270)]&&this[o(1270)][o(1820)](t,n)}catch{}}[r(2074)+r(1677)+"t"](t=1e3,n="",o=!1){let c=r,d={ZePxY:c(1770)+c(1003),xeoNR:function(g,p,u,_){return e.BNKzT(g,p,u,_)},udPhx:"name",SpMCe:e[c(542)],NddtP:function(g,p,u,_){return g(p,u,_)},FFgKx:function(g,p,u,_){return e.nFVok(g,p,u,_)},HjiWz:function(g,p){return g(p)},xQqai:c(1325)+"ile_name"};if(this[c(1170)+"ngTimer"](),this._clearTimer(),this[c(1306)+c(1594)+"rs"](),this[c(567)+c(762)](1e3,n),this[c(1348)+c(676)]=!1,o&&this[c(1013)+c(1217)]()&&!this[c(1514)+c(1683)]){if(this["_endpoin"+c(773)]?.[c(1132)+"chMaxTries"]()){let p=this[c(1272)+"tManager"]?.[c(927)+"ntEndpoint"]();this[c(1089)+c(758)+c(1725)](e[c(1511)](we,e[c(1237)],{code:1006,reason:c(1962)+p+(c(2061)+c(1442)+c(1652)+c(2075)),wasClean:!0}))}else if(e[c(631)](e.VMZaI,c(1976))){let p={JELnS:c(2108)+c(1872)+c(984),OtDEb:HUsmpu[c(1569)],yEtQD:function(A,P,T,M){let O=c;return HUsmpu[O(1568)](A,P,T,M)},UTnEF:HUsmpu[c(1453)],KJTQk:HUsmpu[c(1464)],sGsPP:function(A,P,T,M){let O=c;return HUsmpu[O(828)](A,P,T,M)},ahEGU:function(A,P,T,M){let O=c;return HUsmpu[O(1343)](A,P,T,M)}},[u,_]=HUsmpu[c(936)](_0x1bcbef,_0x50c13a),w=HUsmpu[c(936)](_0x274b63,u),v=0;return _0x5b1110[c(1746)](A=>{let P=c,T=p[P(714)][P(742)]("|"),M=0;for(;;){switch(T[M++]){case"0":_0x692604[P(1972)](p[P(843)],v);continue;case"1":v=p[P(523)](_0x1cc862,_0x1d7674[P(878)+"er"](A[P(1877)]||_0x5d8049),w,v);continue;case"2":_0x2b2e80[P(1972)](p[P(788)],v);continue;case"3":v=_0xd90c73(_[A[P(663)+P(698)]],w,v);continue;case"4":_0x1ff141[P(1972)]("header",v);continue;case"5":_0x3a3039.log(p[P(1218)],v);continue;case"6":v=p[P(523)](_0x1a02a8,0,w,v);continue;case"7":v=p[P(1885)](_0x1ec0ed,A[P(663)+P(698)],w,v);continue;case"8":_0x4f7317.log(P(1397),v);continue;case"9":v=p[P(1665)](_0x2b879c,w,v,A[P(1397)]||0);continue;case"10":_0x1368b5[P(1972)](P(1634)+"ervice",A,A.service);continue}break}}),{frameType:_0xa2057e,headers:[{key:HUsmpu[c(881)],value:_0x2931e0}],payload:w}}else{let p=this[c(559)][c(2118)+c(1050)+"ptor"](t,n);this["_dispatc"+c(758)+"ent"](we(e.DKnrv,{code:t,reason:n,wasClean:!0,willReconnect:p})),p&&this._connect()}return}this[c(1013)+"orOnline"]()||this[c(1514)+"osed"]?this[c(1089)+c(758)+"ent"](we(e[c(1237)],{code:t,reason:"bye"})):this[c(1089)+c(758)+c(1725)](e[c(1222)](we,e.DKnrv,{code:1006,reason:"going aw"+c(1728)+c(624)+c(1457)})),this._ws=null,this[c(1272)+c(773)]?.[c(695)+c(1084)+c(805)](),this[c(1179)+"sCounter"]?.[c(1773)+c(977)]()}[r(1089)+r(533)+"nt"](t){let n=r,o={ooYVg:function(c,d){return e[k(1239)](c,d)},sEjDy:n(1600),BPOpo:function(c,d){return c(d)},EWgBC:function(c,d,g,p){return c(d,g,p)},QMynz:function(c,d){return e.HmEia(c,d)}};if(e[n(1110)](e.ZdmIC,e[n(1369)]))this[n(1308)](n(1284),t),this.onopen&&this[n(1890)](t);else{if(zXHrrg[n(1006)](zXHrrg[n(1586)],typeof _0x1cbcfc)){let c=new _0x38ec7d(zXHrrg.BPOpo(_0x30d7a1,_0x52f786));return zXHrrg[n(1292)](_0x4a59dd,_0xaf3ff2,c,0),c}return zXHrrg[n(2031)](_0x1e8798,_0x258627)?new _0x5383e4(_0x1ee6c9):new _0x2cd7ff(_0x4efec2[n(1702)],_0x52b0f4[n(1382)+"et"],_0x28fd26[n(1336)+"th"])}}[r(1089)+r(1992)+r(2088)](t){let n=r;this[n(1308)](n(1281),t),this.onmessage&&this[n(607)+"e"](t)}[r(1089)+r(1787)+"ageEvent"](t){let n=r;this[n(1308)](e[n(1811)],t),this[n(1706)+n(1327)]&&this[n(1706)+n(1327)](t)}[r(1089)+r(1628)+"ent"](t){let n=r;this[n(1308)](e[n(769)],t),this[n(781)]&&this[n(781)](t)}[r(1089)+"hCloseEv"+r(1725)](t){let n=r,o={lDCdh:function(d,g,p,u){return d(g,p,u)}};if(e[n(1678)](e[n(994)],e.PUwWP))for(var c in _0x27a7b4)GPTZiP[n(1190)](_0xff20ef,_0x279963,c,{get:_0x35ef9f[c],enumerable:!0});else this[n(1308)](e[n(1237)],t),this[n(796)]&&this[n(796)](t)}get[r(682)+"pe"](){let t=r;return e[t(1705)](e[t(1771)],e[t(992)])?this._ws?this._ws[t(682)+"pe"]:this[t(2042)+t(967)]:_0x5105e3[t(1032)][e[t(1405)](_0x5baa79,_0xbbf828,1)]}set[r(682)+"pe"](t){let n=r;this[n(2042)+n(967)]=t,this[n(1270)]&&(this[n(1270)].binaryType=t)}get[r(1769)+"nt"](){let t=r;return this._endpointManager?.[t(927)+"ntEndpoi"+t(2060)+t(613)]()||0}get["buffered"+r(1099)](){let t=r,n=this[t(1655)+t(1104)][t(2021)]((o,c)=>{let d=t,g={bPCkd:function(p,u){return p==u},jQQuZ:e[d(1813)],QNNaM:e[d(732)]};return e[d(901)](e[d(1926)],e[d(1394)])?(o+=c&&c[d(1336)+"th"]||0,o):DgRRzN[d(1949)](DgRRzN[d(616)],typeof _0x1fe38f)?DgRRzN.QNNaM:""},0);return e.CIAXe(n,this[t(1270)]?this[t(1270)][t(1533)+t(1099)]:0)}get extensions(){let t=r;return this[t(1270)]?this[t(1270)][t(1845)+"ns"]:""}get[r(518)](){let t=r;return this._ws?this._ws[t(518)]:""}get[r(718)+"te"](){let t=r;return this[t(1270)]?this._ws[t(718)+"te"]:this[t(559)][t(1685)+t(1686)]?this[t(1669)+"NG"]:this[t(2015)]}get[r(1461)](){let t=r;return this._ws?this._ws[t(1461)]:this[t(1257)]}[r(1820)](t=1e3,n){let o=r,c=e[o(1555)].split("|"),d=0;for(;;){switch(c[d++]){case"0":if(!this[o(1270)])return void this[o(1969)](e[o(1909)]);continue;case"1":this[o(1514)+o(1683)]=!0;continue;case"2":this[o(1580)+o(1591)+o(840)]();continue;case"3":this[o(1170)+o(800)]();continue;case"4":this[o(763)+"mer"]();continue;case"5":this[o(2074)+o(1677)+"t"](t,n);continue;case"6":if(this._ws[o(718)+"te"]===this.CLOSED||e[o(952)](this._ws[o(718)+"te"],this[o(530)]))return void this[o(1969)](e[o(1255)]);continue;case"7":this[o(1276)+"ger"]?.[o(1821)]();continue}break}}async[r(720)](t,n){let o=r,c={avPwS:function(O,z){return e[k(1981)](O,z)},gcCRf:function(O,z){return e[k(1406)](O,z)},HitkW:function(O,z){return e[k(1455)](O,z)},hBgWp:function(O,z){return e[k(1570)](O,z)},GoSqV:function(O,z){return e[k(1055)](O,z)},omDLQ:function(O,z){return O>>z}};if(e[o(1346)](null,t))throw new Error(e.qtddd);e[o(1530)](o(1318),typeof t)&&(t=JSON[o(1608)+"y"](t)),e[o(1465)](e[o(1813)],typeof t)&&!(t instanceof ArrayBuffer)&&!(t.buffer&&t.buffer instanceof ArrayBuffer)&&(t=JSON[o(1608)+"y"](t));let d=await e[o(1777)](As,t),g=e[o(1275)](p0,t),{method:p=0,service:u=this[o(559)][o(1397)],logID:_=this[o(559)]["logIDGen"+o(704)](),headers:w=this._options[o(1074)],payloadEncoding:v=this[o(559)][o(1809)+"ncoding"],payloadType:A=this[o(559)][o(1520)+"ype"],logIDNew:P=this._options[o(1616)+o(1080)]["enableAu"+o(1707)+o(937)+"ew"]?e[o(1028)](a,this[o(559)]["logIDNew"+o(1080)].userIp):""}=e.zfDIX(n,{});if(!u)throw new Error(o(1611)+o(1120)+" valid s"+o(810));let T={SeqID:K[o(878)+"er"](this._seqId++),LogID:K[o(878)+"er"](_),service:u,method:p,headers:w,payloadEncoding:e[o(1340)](v,Object)?v[o(1983)]?v.encoding:"":v,payloadType:e[o(1841)](A,Object)?A[o(1984)]?A[o(1984)]:g:A||g,payload:d,LogIDNew:P},M=e[o(1899)](xr,T);return this[o(1270)]&&e[o(946)](this[o(1270)].readyState,this[o(2064)])?e.RmGne!=="YYRWm"?(this[o(813)+"ount"]=_0x105a0e,this[o(1952)]=0):(this._ws&&this._ws[o(720)](M),this._debug(e.UsigB,T)):this["_message"+o(1104)][o(1929)]<this._options["maxMessageQueueL"+o(1470)]?(this._messageQueue[o(1560)](M),this[o(1969)](o(1512),T)):e[o(1817)]!==e[o(1817)]?(jlOcoU[o(1534)](_0x4b2bff,65536)?_0xbe3d98[_0x16128f++]=jlOcoU[o(733)](jlOcoU[o(2026)](_0x18ccc6,12),15)|224:(_0x4f0fb8[_0x5e1070++]=jlOcoU.hBgWp(jlOcoU[o(1633)](_0x3e6f8e>>18,7),240),_0x12be09[_0x18613c++]=jlOcoU.hBgWp(jlOcoU.GoSqV(jlOcoU[o(634)](_0x3823dd,12),63),128)),_0x967da9[_0x1c7d51++]=jlOcoU[o(1278)](jlOcoU[o(2026)](_0x59705a,6)&63,128)):(this[o(1655)+o(1104)].shift(),this[o(1655)+o(1104)][o(1560)](M)),{seqID:this[o(1265)],logID:_,logIDNew:P}}async[r(2118)+"t"](t){let n=r;if(e.jfIgj(n(1489),e[n(1395)])){let{url:o}=t||{},c=Array[n(1018)](o)?o:e[n(503)](n(1600),typeof o)?[o]:[];t&&Object[n(1295)](this[n(559)],t),c&&c.length?this[n(1272)+n(773)]=new vs(c,this[n(559)][n(1925)+"es"]):this["_endpoin"+n(773)]?.[n(695)+n(1084)+"fig"](),this[n(1179)+n(1961)]?.[n(1773)+n(977)](this[n(559)][n(1184)+n(2071)]),this["_readyCl"+n(1683)]=!1,this[n(1270)]&&e[n(2035)](this[n(1270)][n(718)+"te"],this[n(2015)])?this[n(555)+n(961)](1e3,e[n(1537)],!0):(this[n(499)]=!0,this[n(1348)]())}else return this[n(1430)]?.get(_0x3f4003)}async[r(1804)](){let t=r;if(!this[t(1348)+"Lock"]){let n=(t(918)+"1").split("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(1272)+t(773)]?.[t(695)+t(1084)+t(805)]();continue;case"1":this[t(1348)]();continue;case"2":this[t(1179)+"sCounter"]?.[t(1773)+t(977)]();continue;case"3":this[t(1514)+t(1683)]=!1;continue;case"4":this[t(499)]=!0;continue}break}}}[r(697)+r(840)](t,n){this.on(t,n)}[r(844)+r(2088)](t){let n=r,{type:o}=t;this[n(1308)](o,t)}[r(775)+r(1077)+"ner"](t,n){this[r(1304)](t,n)}pingOnce(){let t=r,n={Vkgpc:e[t(1624)],fNPlv:e.wlfbN,nVPDP:t(1700),cavBJ:function(o,c,d){return e[t(1323)](o,c,d)},WTuMV:t(1444)+t(1451)+"s"};return new Promise((o,c)=>{let d=t,g={OBBNs:n.nVPDP,NdBjh:d(1444)+d(1936)+"t"};this[d(1170)+d(800)](),this[d(1283)+"gTimeoutId"]=n[d(1748)](setTimeout,this[d(750)][d(1881)](this),this._options[d(1242)+d(1663)]);let p=()=>{let _=d;o(n.Vkgpc),this[_(1304)]("ping_onc"+_(1451)+"s",p),this.off(n.fNPlv,u)},u=()=>{let _=d;c(g.OBBNs),this[_(1304)](_(1444)+_(1451)+"s",p),this[_(1304)](g[_(659)],u)};this.on(n[d(1445)],p),this.on(d(1444)+"e_timeout",u),this[d(750)]()})}}})(),ee["CustomCl"+E(1640)]=Q[E(1067)+E(1640)],ee[E(664)+E(1780)]=Q[E(664)+E(1780)],ee.ErrorCode=Q[E(1288)+"e"],ee.Event=Q[E(2088)],ee[E(866)]=Q[E(866)],ee["Frontier"+E(1900)+E(889)]=Q[E(817)+E(1900)+"vent"],ee["MessageE"+E(889)]=Q[E(1900)+"vent"],ee[E(1898)+"t"]=Q[E(1898)+"t"],ee[E(1582)+"tEvent"]=Q["Reconnec"+E(1081)],ee[E(1595)+E(1640)]=Q[E(1595)+E(1640)],ee["createEr"+E(1780)]=Q[E(812)+E(1780)],ee["createMe"+E(1959)+"nt"]=Q[E(678)+"ssageEvent"],ee[E(988)+E(1517)]=Q[E(988)+"enEvent"],ee["createRe"+E(951)+"vent"]=Q[E(1807)+E(951)+E(889)],ee[E(1244)+E(969)]=Q[E(1244)+E(969)],ee[E(1785)+E(698)]=Q[E(1785)+"ame"];for(In in Q)["CustomCl"+E(1640),E(664)+E(1780),E(1288)+"e",E(2088),E(866),"Frontier"+E(1900)+E(889),E(1900)+E(889),"OpenEvent","Reconnec"+E(1081),"createCloseEvent",E(812)+"rorEvent",E(678)+E(1959)+"nt","createOp"+E(1517),E(1807)+"connectE"+E(889),E(1244)+"rame","encodeFr"+E(698)][E(1893)](In)===-1&&(ee[In]=Q[In]);var In;Object[E(576)+E(1675)](ee,E(1963)+"le",{value:!0})});var qe=fe((Wl,Bi)=>{"use strict";var Ni=["nodebuffer","arraybuffer","fragments"],Li=typeof Blob<"u";Li&&Ni.push("blob");Bi.exports={BINARY_TYPES:Ni,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Li,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var jt=fe((Jl,Mn)=>{"use strict";var{EMPTY_BUFFER:Vx}=qe(),Pr=Buffer[Symbol.species];function Xx(r,e){if(r.length===0)return Vx;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let x=0;x<r.length;x++){let f=r[x];i.set(f,a),a+=f.length}return a<e?new Pr(i.buffer,i.byteOffset,a):i}function Oi(r,e,i,a,x){for(let f=0;f<x;f++)i[a+f]=r[f]^e[f&3]}function zi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function Yx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function Tr(r){if(Tr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new Pr(r):ArrayBuffer.isView(r)?e=new Pr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),Tr.readOnly=!1),e}Mn.exports={concat:Xx,mask:Oi,toArrayBuffer:Yx,toBuffer:Tr,unmask:zi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=Z("bufferutil");Mn.exports.mask=function(e,i,a,x,f){f<48?Oi(e,i,a,x,f):r.mask(e,i,a,x,f)},Mn.exports.unmask=function(e,i){e.length<32?zi(e,i):r.unmask(e,i)}}catch{}});var Ki=fe((Vl,qi)=>{"use strict";var Mi=Symbol("kDone"),Ir=Symbol("kRun"),Rr=class{constructor(e){this[Mi]=()=>{this.pending--,this[Ir]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Ir]()}[Ir](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Mi])}}};qi.exports=Rr});var yt=fe((Xl,ji)=>{"use strict";var Gt=Z("zlib"),Ui=jt(),$x=Ki(),{kStatusCode:Fi}=qe(),Zx=Buffer[Symbol.species],Qx=Buffer.from([0,0,255,255]),Kn=Symbol("permessage-deflate"),Ke=Symbol("total-length"),_t=Symbol("callback"),Ve=Symbol("buffers"),wt=Symbol("error"),qn,Nr=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!qn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;qn=new $x(i)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[_t];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let i=this._options,a=e.find(x=>!(i.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>x.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return i.serverNoContextTakeover&&(a.server_no_context_takeover=!0),i.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof i.serverMaxWindowBits=="number"&&(a.server_max_window_bits=i.serverMaxWindowBits),typeof i.clientMaxWindowBits=="number"?a.client_max_window_bits=i.clientMaxWindowBits:(a.client_max_window_bits===!0||i.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let i=e[0];if(this._options.clientNoContextTakeover===!1&&i.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!i.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(i.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&i.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return i}normalizeParams(e){return e.forEach(i=>{Object.keys(i).forEach(a=>{let x=i[a];if(x.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(x=x[0],a==="client_max_window_bits"){if(x!==!0){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(x!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else throw new Error(`Unknown parameter "${a}"`);i[a]=x})}),e}decompress(e,i,a){qn.add(x=>{this._decompress(e,i,(f,l)=>{x(),a(f,l)})})}compress(e,i,a){qn.add(x=>{this._compress(e,i,(f,l)=>{x(),a(f,l)})})}_decompress(e,i,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,l=typeof this.params[f]!="number"?Gt.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=Gt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:l}),this._inflate[Kn]=this,this._inflate[Ke]=0,this._inflate[Ve]=[],this._inflate.on("error",tc),this._inflate.on("data",Hi)}this._inflate[_t]=a,this._inflate.write(e),i&&this._inflate.write(Qx),this._inflate.flush(()=>{let f=this._inflate[wt];if(f){this._inflate.close(),this._inflate=null,a(f);return}let l=Ui.concat(this._inflate[Ve],this._inflate[Ke]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ke]=0,this._inflate[Ve]=[],i&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,l)})}_compress(e,i,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,l=typeof this.params[f]!="number"?Gt.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=Gt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:l}),this._deflate[Ke]=0,this._deflate[Ve]=[],this._deflate.on("data",ec)}this._deflate[_t]=a,this._deflate.write(e),this._deflate.flush(Gt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=Ui.concat(this._deflate[Ve],this._deflate[Ke]);i&&(f=new Zx(f.buffer,f.byteOffset,f.length-4)),this._deflate[_t]=null,this._deflate[Ke]=0,this._deflate[Ve]=[],i&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};ji.exports=Nr;function ec(r){this[Ve].push(r),this[Ke]+=r.length}function Hi(r){if(this[Ke]+=r.length,this[Kn]._maxPayload<1||this[Ke]<=this[Kn]._maxPayload){this[Ve].push(r);return}this[wt]=new RangeError("Max payload size exceeded"),this[wt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[wt][Fi]=1009,this.removeListener("data",Hi),this.reset()}function tc(r){if(this[Kn]._inflate=null,this[wt]){this[_t](this[wt]);return}r[Fi]=1007,this[_t](r)}});var bt=fe((Yl,Un)=>{"use strict";var{isUtf8:Gi}=Z("buffer"),{hasBlob:nc}=qe(),rc=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function sc(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Lr(r){let e=r.length,i=0;for(;i<e;)if((r[i]&128)===0)i++;else if((r[i]&224)===192){if(i+1===e||(r[i+1]&192)!==128||(r[i]&254)===192)return!1;i+=2}else if((r[i]&240)===224){if(i+2>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||r[i]===224&&(r[i+1]&224)===128||r[i]===237&&(r[i+1]&224)===160)return!1;i+=3}else if((r[i]&248)===240){if(i+3>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||(r[i+3]&192)!==128||r[i]===240&&(r[i+1]&240)===128||r[i]===244&&r[i+1]>143||r[i]>244)return!1;i+=4}else return!1;return!0}function ic(r){return nc&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}Un.exports={isBlob:ic,isValidStatusCode:sc,isValidUTF8:Lr,tokenChars:rc};if(Gi)Un.exports.isValidUTF8=function(r){return r.length<24?Lr(r):Gi(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=Z("utf-8-validate");Un.exports.isValidUTF8=function(e){return e.length<32?Lr(e):r(e)}}catch{}});var qr=fe(($l,Zi)=>{"use strict";var{Writable:oc}=Z("stream"),Wi=yt(),{BINARY_TYPES:ac,EMPTY_BUFFER:Ji,kStatusCode:xc,kWebSocket:cc}=qe(),{concat:Br,toArrayBuffer:fc,unmask:uc}=jt(),{isValidStatusCode:dc,isValidUTF8:Vi}=bt(),Fn=Buffer[Symbol.species],pe=0,Xi=1,Yi=2,$i=3,Or=4,zr=5,Hn=6,Mr=class extends oc{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||ac[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[cc]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=pe}_write(e,i,a){if(this._opcode===8&&this._state==pe)return a();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(a)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let a=this._buffers[0];return this._buffers[0]=new Fn(a.buffer,a.byteOffset+e,a.length-e),new Fn(a.buffer,a.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let a=this._buffers[0],x=i.length-e;e>=a.length?i.set(this._buffers.shift(),x):(i.set(new Uint8Array(a.buffer,a.byteOffset,e),x),this._buffers[0]=new Fn(a.buffer,a.byteOffset+e,a.length-e)),e-=a.length}while(e>0);return i}startLoop(e){this._loop=!0;do switch(this._state){case pe:this.getInfo(e);break;case Xi:this.getPayloadLength16(e);break;case Yi:this.getPayloadLength64(e);break;case $i:this.getMask();break;case Or:this.getData(e);break;case zr:case Hn:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let i=this.consume(2);if((i[0]&48)!==0){let x=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(x);return}let a=(i[0]&64)===64;if(a&&!this._extensions[Wi.extensionName]){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._fin=(i[0]&128)===128,this._opcode=i[0]&15,this._payloadLength=i[1]&127,this._opcode===0){if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(!this._fragmented){let x=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let x=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(x);return}if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let x=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(x);return}}else{let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(i[1]&128)===128,this._isServer){if(!this._masked){let x=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(x);return}}else if(this._masked){let x=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(x);return}this._payloadLength===126?this._state=Xi:this._payloadLength===127?this._state=Yi:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let i=this.consume(8),a=i.readUInt32BE(0);if(a>Math.pow(2,21)-1){let x=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(x);return}this._payloadLength=a*Math.pow(2,32)+i.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(i);return}this._masked?this._state=$i:this._state=Or}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Or}getData(e){let i=Ji;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}i=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&uc(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=zr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Wi.extensionName].decompress(e,this._fin,(x,f)=>{if(x)return i(x);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let l=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(l);return}this._fragments.push(f)}this.dataMessage(i),this._state===pe&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=pe;return}let i=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let x;this._binaryType==="nodebuffer"?x=Br(a,i):this._binaryType==="arraybuffer"?x=fc(Br(a,i)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=pe):(this._state=Hn,setImmediate(()=>{this.emit("message",x,!0),this._state=pe,this.startLoop(e)}))}else{let x=Br(a,i);if(!this._skipUTF8Validation&&!Vi(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===zr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=pe):(this._state=Hn,setImmediate(()=>{this.emit("message",x,!1),this._state=pe,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Ji),this.end();else{let a=e.readUInt16BE(0);if(!dc(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(f);return}let x=new Fn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Vi(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(f);return}this._loop=!1,this.emit("conclude",a,x),this.end()}this._state=pe;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=pe):(this._state=Hn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=pe,this.startLoop(i)}))}createError(e,i,a,x,f){this._loop=!1,this._errored=!0;let l=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(l,this.createError),l.code=f,l[xc]=x,l}};Zi.exports=Mr});var Fr=fe((Ql,to)=>{"use strict";var{Duplex:Zl}=Z("stream"),{randomFillSync:lc}=Z("crypto"),Qi=yt(),{EMPTY_BUFFER:hc,kWebSocket:gc,NOOP:pc}=qe(),{isBlob:vt,isValidStatusCode:mc}=bt(),{mask:eo,toBuffer:nt}=jt(),me=Symbol("kByteLength"),_c=Buffer.alloc(4),jn=8*1024,rt,St=jn,ve=0,wc=1,yc=2,Kr=class r{constructor(e,i,a){this._extensions=i||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ve,this.onerror=pc,this[gc]=void 0}static frame(e,i){let a,x=!1,f=2,l=!1;i.mask&&(a=i.maskBuffer||_c,i.generateMask?i.generateMask(a):(St===jn&&(rt===void 0&&(rt=Buffer.alloc(jn)),lc(rt,0,jn),St=0),a[0]=rt[St++],a[1]=rt[St++],a[2]=rt[St++],a[3]=rt[St++]),l=(a[0]|a[1]|a[2]|a[3])===0,f=6);let h;typeof e=="string"?(!i.mask||l)&&i[me]!==void 0?h=i[me]:(e=Buffer.from(e),h=e.length):(h=e.length,x=i.mask&&i.readOnly&&!l);let m=h;h>=65536?(f+=8,m=127):h>125&&(f+=2,m=126);let y=Buffer.allocUnsafe(x?h+f:f);return y[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(y[0]|=64),y[1]=m,m===126?y.writeUInt16BE(h,2):m===127&&(y[2]=y[3]=0,y.writeUIntBE(h,4,6)),i.mask?(y[1]|=128,y[f-4]=a[0],y[f-3]=a[1],y[f-2]=a[2],y[f-1]=a[3],l?[y,e]:x?(eo(e,a,y,f,h),[y]):(eo(e,a,e,0,h),[y,e])):[y,e]}close(e,i,a,x){let f;if(e===void 0)f=hc;else{if(typeof e!="number"||!mc(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)f=Buffer.allocUnsafe(2),f.writeUInt16BE(e,0);else{let h=Buffer.byteLength(i);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");f=Buffer.allocUnsafe(2+h),f.writeUInt16BE(e,0),typeof i=="string"?f.write(i,2):f.set(i,2)}}let l={[me]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ve?this.enqueue([this.dispatch,f,!1,l,x]):this.sendFrame(r.frame(f,l),x)}ping(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):vt(e)?(x=e.size,f=!1):(e=nt(e),x=e.length,f=nt.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let l={[me]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};vt(e)?this._state!==ve?this.enqueue([this.getBlobData,e,!1,l,a]):this.getBlobData(e,!1,l,a):this._state!==ve?this.enqueue([this.dispatch,e,!1,l,a]):this.sendFrame(r.frame(e,l),a)}pong(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):vt(e)?(x=e.size,f=!1):(e=nt(e),x=e.length,f=nt.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let l={[me]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};vt(e)?this._state!==ve?this.enqueue([this.getBlobData,e,!1,l,a]):this.getBlobData(e,!1,l,a):this._state!==ve?this.enqueue([this.dispatch,e,!1,l,a]):this.sendFrame(r.frame(e,l),a)}send(e,i,a){let x=this._extensions[Qi.extensionName],f=i.binary?2:1,l=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):vt(e)?(h=e.size,m=!1):(e=nt(e),h=e.length,m=nt.readOnly),this._firstFragment?(this._firstFragment=!1,l&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(l=h>=x._threshold),this._compress=l):(l=!1,f=0),i.fin&&(this._firstFragment=!0);let y={[me]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:m,rsv1:l};vt(e)?this._state!==ve?this.enqueue([this.getBlobData,e,this._compress,y,a]):this.getBlobData(e,this._compress,y,a):this._state!==ve?this.enqueue([this.dispatch,e,this._compress,y,a]):this.dispatch(e,this._compress,y,a)}getBlobData(e,i,a,x){this._bufferedBytes+=a[me],this._state=yc,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Ur,this,h,x);return}this._bufferedBytes-=a[me];let l=nt(f);i?this.dispatch(l,i,a,x):(this._state=ve,this.sendFrame(r.frame(l,a),x),this.dequeue())}).catch(f=>{process.nextTick(bc,this,f,x)})}dispatch(e,i,a,x){if(!i){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Qi.extensionName];this._bufferedBytes+=a[me],this._state=wc,f.compress(e,a.fin,(l,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Ur(this,m,x);return}this._bufferedBytes-=a[me],this._state=ve,a.readOnly=!1,this.sendFrame(r.frame(h,a),x),this.dequeue()})}dequeue(){for(;this._state===ve&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][me],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][me],this._queue.push(e)}sendFrame(e,i){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],i),this._socket.uncork()):this._socket.write(e[0],i)}};to.exports=Kr;function Ur(r,e,i){typeof i=="function"&&i(e);for(let a=0;a<r._queue.length;a++){let x=r._queue[a],f=x[x.length-1];typeof f=="function"&&f(e)}}function bc(r,e,i){Ur(r,e,i),r.onerror(e)}});var fo=fe((eh,co)=>{"use strict";var{kForOnEventAttribute:Wt,kListener:Hr}=qe(),no=Symbol("kCode"),ro=Symbol("kData"),so=Symbol("kError"),io=Symbol("kMessage"),oo=Symbol("kReason"),Et=Symbol("kTarget"),ao=Symbol("kType"),xo=Symbol("kWasClean"),Ue=class{constructor(e){this[Et]=null,this[ao]=e}get target(){return this[Et]}get type(){return this[ao]}};Object.defineProperty(Ue.prototype,"target",{enumerable:!0});Object.defineProperty(Ue.prototype,"type",{enumerable:!0});var st=class extends Ue{constructor(e,i={}){super(e),this[no]=i.code===void 0?0:i.code,this[oo]=i.reason===void 0?"":i.reason,this[xo]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[no]}get reason(){return this[oo]}get wasClean(){return this[xo]}};Object.defineProperty(st.prototype,"code",{enumerable:!0});Object.defineProperty(st.prototype,"reason",{enumerable:!0});Object.defineProperty(st.prototype,"wasClean",{enumerable:!0});var Ct=class extends Ue{constructor(e,i={}){super(e),this[so]=i.error===void 0?null:i.error,this[io]=i.message===void 0?"":i.message}get error(){return this[so]}get message(){return this[io]}};Object.defineProperty(Ct.prototype,"error",{enumerable:!0});Object.defineProperty(Ct.prototype,"message",{enumerable:!0});var Jt=class extends Ue{constructor(e,i={}){super(e),this[ro]=i.data===void 0?null:i.data}get data(){return this[ro]}};Object.defineProperty(Jt.prototype,"data",{enumerable:!0});var vc={addEventListener(r,e,i={}){for(let x of this.listeners(r))if(!i[Wt]&&x[Hr]===e&&!x[Wt])return;let a;if(r==="message")a=function(f,l){let h=new Jt("message",{data:l?f:f.toString()});h[Et]=this,Gn(e,this,h)};else if(r==="close")a=function(f,l){let h=new st("close",{code:f,reason:l.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[Et]=this,Gn(e,this,h)};else if(r==="error")a=function(f){let l=new Ct("error",{error:f,message:f.message});l[Et]=this,Gn(e,this,l)};else if(r==="open")a=function(){let f=new Ue("open");f[Et]=this,Gn(e,this,f)};else return;a[Wt]=!!i[Wt],a[Hr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Hr]===e&&!i[Wt]){this.removeListener(r,i);break}}};co.exports={CloseEvent:st,ErrorEvent:Ct,Event:Ue,EventTarget:vc,MessageEvent:Jt};function Gn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Wn=fe((th,uo)=>{"use strict";var{tokenChars:Vt}=bt();function Ie(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function Sc(r){let e=Object.create(null),i=Object.create(null),a=!1,x=!1,f=!1,l,h,m=-1,y=-1,S=-1,b=0;for(;b<r.length;b++)if(y=r.charCodeAt(b),l===void 0)if(S===-1&&Vt[y]===1)m===-1&&(m=b);else if(b!==0&&(y===32||y===9))S===-1&&m!==-1&&(S=b);else if(y===59||y===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${b}`);S===-1&&(S=b);let R=r.slice(m,S);y===44?(Ie(e,R,i),i=Object.create(null)):l=R,m=S=-1}else throw new SyntaxError(`Unexpected character at index ${b}`);else if(h===void 0)if(S===-1&&Vt[y]===1)m===-1&&(m=b);else if(y===32||y===9)S===-1&&m!==-1&&(S=b);else if(y===59||y===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${b}`);S===-1&&(S=b),Ie(i,r.slice(m,S),!0),y===44&&(Ie(e,l,i),i=Object.create(null),l=void 0),m=S=-1}else if(y===61&&m!==-1&&S===-1)h=r.slice(m,b),m=S=-1;else throw new SyntaxError(`Unexpected character at index ${b}`);else if(x){if(Vt[y]!==1)throw new SyntaxError(`Unexpected character at index ${b}`);m===-1?m=b:a||(a=!0),x=!1}else if(f)if(Vt[y]===1)m===-1&&(m=b);else if(y===34&&m!==-1)f=!1,S=b;else if(y===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${b}`);else if(y===34&&r.charCodeAt(b-1)===61)f=!0;else if(S===-1&&Vt[y]===1)m===-1&&(m=b);else if(m!==-1&&(y===32||y===9))S===-1&&(S=b);else if(y===59||y===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${b}`);S===-1&&(S=b);let R=r.slice(m,S);a&&(R=R.replace(/\\/g,""),a=!1),Ie(i,h,R),y===44&&(Ie(e,l,i),i=Object.create(null),l=void 0),h=void 0,m=S=-1}else throw new SyntaxError(`Unexpected character at index ${b}`);if(m===-1||f||y===32||y===9)throw new SyntaxError("Unexpected end of input");S===-1&&(S=b);let D=r.slice(m,S);return l===void 0?Ie(e,D,i):(h===void 0?Ie(i,D,!0):a?Ie(i,h,D.replace(/\\/g,"")):Ie(i,h,D),Ie(e,l,i)),e}function Ec(r){return Object.keys(r).map(e=>{let i=r[e];return Array.isArray(i)||(i=[i]),i.map(a=>[e].concat(Object.keys(a).map(x=>{let f=a[x];return Array.isArray(f)||(f=[f]),f.map(l=>l===!0?x:`${x}=${l}`).join("; ")})).join("; ")).join(", ")}).join(", ")}uo.exports={format:Ec,parse:Sc}});var Yn=fe((sh,Eo)=>{"use strict";var Cc=Z("events"),Ac=Z("https"),kc=Z("http"),go=Z("net"),Dc=Z("tls"),{randomBytes:Pc,createHash:Tc}=Z("crypto"),{Duplex:nh,Readable:rh}=Z("stream"),{URL:jr}=Z("url"),Xe=yt(),Ic=qr(),Rc=Fr(),{isBlob:Nc}=bt(),{BINARY_TYPES:lo,CLOSE_TIMEOUT:Lc,EMPTY_BUFFER:Jn,GUID:Bc,kForOnEventAttribute:Gr,kListener:Oc,kStatusCode:zc,kWebSocket:ne,NOOP:po}=qe(),{EventTarget:{addEventListener:Mc,removeEventListener:qc}}=fo(),{format:Kc,parse:Uc}=Wn(),{toBuffer:Fc}=jt(),mo=Symbol("kAborted"),Wr=[8,13],Fe=["CONNECTING","OPEN","CLOSING","CLOSED"],Hc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,G=class r extends Cc{constructor(e,i,a){super(),this._binaryType=lo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Jn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,i===void 0?i=[]:Array.isArray(i)||(typeof i=="object"&&i!==null?(a=i,i=[]):i=[i]),_o(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){lo.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,i,a){let x=new Ic({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new Rc(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[ne]=this,f[ne]=this,e[ne]=this,x.on("conclude",Wc),x.on("drain",Jc),x.on("error",Vc),x.on("message",Xc),x.on("ping",Yc),x.on("pong",$c),f.onerror=Zc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",bo),e.on("data",Xn),e.on("end",vo),e.on("error",So),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Xe.extensionName]&&this._extensions[Xe.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,i){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){he(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,i,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),yo(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Jr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Jn,i,a)}pong(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Jr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Jn,i,a)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof i=="function"&&(a=i,i={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Jr(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[Xe.extensionName]||(x.compress=!1),this._sender.send(e||Jn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){he(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(G,"CONNECTING",{enumerable:!0,value:Fe.indexOf("CONNECTING")});Object.defineProperty(G.prototype,"CONNECTING",{enumerable:!0,value:Fe.indexOf("CONNECTING")});Object.defineProperty(G,"OPEN",{enumerable:!0,value:Fe.indexOf("OPEN")});Object.defineProperty(G.prototype,"OPEN",{enumerable:!0,value:Fe.indexOf("OPEN")});Object.defineProperty(G,"CLOSING",{enumerable:!0,value:Fe.indexOf("CLOSING")});Object.defineProperty(G.prototype,"CLOSING",{enumerable:!0,value:Fe.indexOf("CLOSING")});Object.defineProperty(G,"CLOSED",{enumerable:!0,value:Fe.indexOf("CLOSED")});Object.defineProperty(G.prototype,"CLOSED",{enumerable:!0,value:Fe.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(G.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(G.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Gr])return e[Oc];return null},set(e){for(let i of this.listeners(r))if(i[Gr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Gr]:!0})}})});G.prototype.addEventListener=Mc;G.prototype.removeEventListener=qc;Eo.exports=G;function _o(r,e,i,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Lc,protocolVersion:Wr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=x.autoPong,r._closeTimeout=x.closeTimeout,!Wr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Wr.join(", ")})`);let f;if(e instanceof jr)f=e;else try{f=new jr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}f.protocol==="http:"?f.protocol="ws:":f.protocol==="https:"&&(f.protocol="wss:"),r._url=f.href;let l=f.protocol==="wss:",h=f.protocol==="ws+unix:",m;if(f.protocol!=="ws:"&&!l&&!h?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!f.pathname?m="The URL's pathname is empty":f.hash&&(m="The URL contains a fragment identifier"),m){let L=new SyntaxError(m);if(r._redirects===0)throw L;Vn(r,L);return}let y=l?443:80,S=Pc(16).toString("base64"),b=l?Ac.request:kc.request,D=new Set,R;if(x.createConnection=x.createConnection||(l?Gc:jc),x.defaultPort=x.defaultPort||y,x.port=f.port||y,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":S,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(R=new Xe({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=Kc({[Xe.extensionName]:R.offer()})),i.length){for(let L of i){if(typeof L!="string"||!Hc.test(L)||D.has(L))throw new SyntaxError("An invalid or duplicated subprotocol was specified");D.add(L)}x.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(f.username||f.password)&&(x.auth=`${f.username}:${f.password}`),h){let L=x.path.split(":");x.socketPath=L[0],x.path=L[1]}let N;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=l,r._originalHostOrSocketPath=h?x.socketPath:f.host;let L=a&&a.headers;if(a={...a,headers:{}},L)for(let[F,xe]of Object.entries(L))a.headers[F.toLowerCase()]=xe}else if(r.listenerCount("redirect")===0){let L=h?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!L||r._originalSecure&&!l)&&(delete x.headers.authorization,delete x.headers.cookie,L||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),N=r._req=b(x),r._redirects&&r.emit("redirect",r.url,N)}else N=r._req=b(x);x.timeout&&N.on("timeout",()=>{he(r,N,"Opening handshake has timed out")}),N.on("error",L=>{N===null||N[mo]||(N=r._req=null,Vn(r,L))}),N.on("response",L=>{let F=L.headers.location,xe=L.statusCode;if(F&&x.followRedirects&&xe>=300&&xe<400){if(++r._redirects>x.maxRedirects){he(r,N,"Maximum redirects exceeded");return}N.abort();let re;try{re=new jr(F,e)}catch{let ue=new SyntaxError(`Invalid URL: ${F}`);Vn(r,ue);return}_o(r,re,i,a)}else r.emit("unexpected-response",N,L)||he(r,N,`Unexpected server response: ${L.statusCode}`)}),N.on("upgrade",(L,F,xe)=>{if(r.emit("upgrade",L),r.readyState!==G.CONNECTING)return;N=r._req=null;let re=L.headers.upgrade;if(re===void 0||re.toLowerCase()!=="websocket"){he(r,F,"Invalid Upgrade header");return}let Se=Tc("sha1").update(S+Bc).digest("base64");if(L.headers["sec-websocket-accept"]!==Se){he(r,F,"Invalid Sec-WebSocket-Accept header");return}let ue=L.headers["sec-websocket-protocol"],I;if(ue!==void 0?D.size?D.has(ue)||(I="Server sent an invalid subprotocol"):I="Server sent a subprotocol but none was requested":D.size&&(I="Server sent no subprotocol"),I){he(r,F,I);return}ue&&(r._protocol=ue);let H=L.headers["sec-websocket-extensions"];if(H!==void 0){if(!R){he(r,F,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Y;try{Y=Uc(H)}catch{he(r,F,"Invalid Sec-WebSocket-Extensions header");return}let se=Object.keys(Y);if(se.length!==1||se[0]!==Xe.extensionName){he(r,F,"Server indicated an extension that was not requested");return}try{R.accept(Y[Xe.extensionName])}catch{he(r,F,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[Xe.extensionName]=R}r.setSocket(F,xe,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(N,r):N.end()}function Vn(r,e){r._readyState=G.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function jc(r){return r.path=r.socketPath,go.connect(r)}function Gc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=go.isIP(r.host)?"":r.host),Dc.connect(r)}function he(r,e,i){r._readyState=G.CLOSING;let a=new Error(i);Error.captureStackTrace(a,he),e.setHeader?(e[mo]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Vn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Jr(r,e,i){if(e){let a=Nc(e)?e.size:Fc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Fe[r.readyState]})`);process.nextTick(i,a)}}function Wc(r,e){let i=this[ne];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[ne]!==void 0&&(i._socket.removeListener("data",Xn),process.nextTick(wo,i._socket),r===1005?i.close():i.close(r,e))}function Jc(){let r=this[ne];r.isPaused||r._socket.resume()}function Vc(r){let e=this[ne];e._socket[ne]!==void 0&&(e._socket.removeListener("data",Xn),process.nextTick(wo,e._socket),e.close(r[zc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function ho(){this[ne].emitClose()}function Xc(r,e){this[ne].emit("message",r,e)}function Yc(r){let e=this[ne];e._autoPong&&e.pong(r,!this._isServer,po),e.emit("ping",r)}function $c(r){this[ne].emit("pong",r)}function wo(r){r.resume()}function Zc(r){let e=this[ne];e.readyState!==G.CLOSED&&(e.readyState===G.OPEN&&(e._readyState=G.CLOSING,yo(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function yo(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function bo(){let r=this[ne];if(this.removeListener("close",bo),this.removeListener("data",Xn),this.removeListener("end",vo),r._readyState=G.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[ne]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",ho),r._receiver.on("finish",ho))}function Xn(r){this[ne]._receiver.write(r)||this.pause()}function vo(){let r=this[ne];r._readyState=G.CLOSING,r._receiver.end(),this.end()}function So(){let r=this[ne];this.removeListener("error",So),this.on("error",po),r&&(r._readyState=G.CLOSING,this.destroy())}});var Do=fe((oh,ko)=>{"use strict";var ih=Yn(),{Duplex:Qc}=Z("stream");function Co(r){r.emit("close")}function ef(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Ao(r){this.removeListener("error",Ao),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function tf(r,e){let i=!0,a=new Qc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,l){let h=!l&&a._readableState.objectMode?f.toString():f;a.push(h)||r.pause()}),r.once("error",function(f){a.destroyed||(i=!1,a.destroy(f))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,f){if(r.readyState===r.CLOSED){f(x),process.nextTick(Co,a);return}let l=!1;r.once("error",function(m){l=!0,f(m)}),r.once("close",function(){l||f(x),process.nextTick(Co,a)}),i&&r.terminate()},a._final=function(x){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(x)});return}r._socket!==null&&(r._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){x()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(x,f,l){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,l)});return}r.send(x,l)},a.on("end",ef),a.on("error",Ao),a}ko.exports=tf});var Vr=fe((ah,Po)=>{"use strict";var{tokenChars:nf}=bt();function rf(r){let e=new Set,i=-1,a=-1,x=0;for(x;x<r.length;x++){let l=r.charCodeAt(x);if(a===-1&&nf[l]===1)i===-1&&(i=x);else if(x!==0&&(l===32||l===9))a===-1&&i!==-1&&(a=x);else if(l===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);let h=r.slice(i,a);if(e.has(h))throw new SyntaxError(`The "${h}" subprotocol is duplicated`);e.add(h),i=a=-1}else throw new SyntaxError(`Unexpected character at index ${x}`)}if(i===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let f=r.slice(i,x);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);return e.add(f),e}Po.exports={parse:rf}});var Oo=fe((ch,Bo)=>{"use strict";var sf=Z("events"),$n=Z("http"),{Duplex:xh}=Z("stream"),{createHash:of}=Z("crypto"),To=Wn(),it=yt(),af=Vr(),xf=Yn(),{CLOSE_TIMEOUT:cf,GUID:ff,kWebSocket:uf}=qe(),df=/^[+/0-9A-Za-z]{22}==$/,Io=0,Ro=1,Lo=2,Xr=class extends sf{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:cf,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:xf,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=$n.createServer((a,x)=>{let f=$n.STATUS_CODES[426];x.writeHead(426,{"Content-Length":f.length,"Content-Type":"text/plain"}),x.end(f)}),this._server.listen(e.port,e.host,e.backlog,i)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=lf(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,l)=>{this.handleUpgrade(x,f,l,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Io}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Lo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Xt,this);return}if(e&&this.once("close",e),this._state!==Ro)if(this._state=Ro,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Xt,this):process.nextTick(Xt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Xt(this)})}}shouldHandle(e){if(this.options.path){let i=e.url.indexOf("?");if((i!==-1?e.url.slice(0,i):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,i,a,x){i.on("error",No);let f=e.headers["sec-websocket-key"],l=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){ot(this,e,i,405,"Invalid HTTP method");return}if(l===void 0||l.toLowerCase()!=="websocket"){ot(this,e,i,400,"Invalid Upgrade header");return}if(f===void 0||!df.test(f)){ot(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){ot(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Yt(i,400);return}let m=e.headers["sec-websocket-protocol"],y=new Set;if(m!==void 0)try{y=af.parse(m)}catch{ot(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let S=e.headers["sec-websocket-extensions"],b={};if(this.options.perMessageDeflate&&S!==void 0){let D=new it({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let R=To.parse(S);R[it.extensionName]&&(D.accept(R[it.extensionName]),b[it.extensionName]=D)}catch{ot(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let D={origin:e.headers[`${h===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(D,(R,N,L,F)=>{if(!R)return Yt(i,N||401,L,F);this.completeUpgrade(b,f,y,e,i,a,x)});return}if(!this.options.verifyClient(D))return Yt(i,401)}this.completeUpgrade(b,f,y,e,i,a,x)}completeUpgrade(e,i,a,x,f,l,h){if(!f.readable||!f.writable)return f.destroy();if(f[uf])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Io)return Yt(f,503);let y=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${of("sha1").update(i+ff).digest("base64")}`],S=new this.options.WebSocket(null,void 0,this.options);if(a.size){let b=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;b&&(y.push(`Sec-WebSocket-Protocol: ${b}`),S._protocol=b)}if(e[it.extensionName]){let b=e[it.extensionName].params,D=To.format({[it.extensionName]:[b]});y.push(`Sec-WebSocket-Extensions: ${D}`),S._extensions=e}this.emit("headers",y,x),f.write(y.concat(`\r
8
+ var o0=Object.create;var wr=Object.defineProperty;var a0=Object.getOwnPropertyDescriptor;var c0=Object.getOwnPropertyNames;var x0=Object.getPrototypeOf,u0=Object.prototype.hasOwnProperty;var V=(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 De=(r,e)=>()=>(r&&(e=r(r=0)),e);var oe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ns=(r,e)=>{for(var i in e)wr(r,i,{get:e[i],enumerable:!0})},f0=(r,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of c0(e))!u0.call(r,c)&&c!==i&&wr(r,c,{get:()=>e[c],enumerable:!(o=a0(e,c))||o.enumerable});return r};var Ie=(r,e,i)=>(i=r!=null?o0(x0(r)):{},f0(e||!r||!r.__esModule?wr(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as d0,mkdir as l0,readFile as h0,rename as Os,writeFile as Bs}from"node:fs/promises";import{dirname as g0}from"node:path";async function at(r){try{let e=await h0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Yt(r,e,i){await l0(g0(r),{recursive:!0});let o=`${JSON.stringify(e,null,2)}
9
+ `,c=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await Bs(c,o,{encoding:"utf8",mode:i.mode}):await Bs(c,o,"utf8"),await Os(c,r),i?.mode!==void 0&&await d0(r,i.mode)}catch(x){await Os(c,c).catch(()=>{});let{rm:f}=await import("node:fs/promises");throw await f(c,{force:!0}).catch(()=>{}),x}}var Xt=De(()=>{"use strict"});function qs(r){return Qt[Ms]<=Qt[r]}function _r(r){zs={...r}}function $t(r,e,i,o){if(Qt[r]<Qt[Ms])return;let c=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...zs,...o});r==="error"||r==="warn"?m0.write(`${c}
10
+ `):p0.write(`${c}
11
+ `)}function L(r){return{debug:(e,i)=>$t("debug",r,e,i),info:(e,i)=>$t("info",r,e,i),warn:(e,i)=>$t("warn",r,e,i),error:(e,i)=>$t("error",r,e,i),child:e=>L(`${r}.${e}`)}}var Qt,Ms,p0,m0,zs,U=De(()=>{"use strict";Qt={debug:10,info:20,warn:30,error:40},Ms=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),p0=process.stdout,m0=process.stderr,zs={}});import{homedir as w0}from"node:os";import{join as ee}from"node:path";function G(r){let e=r??w0(),i=ee(e,".coze"),o=ee(i,"bridge"),c=ee(o,"lib");return{cozeRoot:i,bridgeRoot:o,libDir:c,libEntry:ee(c,"index.js"),pidFile:ee(o,"bridge.pid"),portFile:ee(o,"bridge.port"),tokenFile:ee(o,"bridge.token"),logFile:ee(o,"bridge.log"),installLock:ee(o,"install.lock"),configFile:ee(o,"config.json"),agentsRoot:ee(i,"agents")}}function Te(r,e=G()){let i=ee(e.agentsRoot,r);return{root:i,config:ee(i,"config.json"),workspace:ee(i,"workspace"),logs:ee(i,"logs")}}var xe=De(()=>{"use strict"});var tn={};Ns(tn,{AGENT_CONFIG_FILE_MODE:()=>Zt,enforceAgentConfigMode:()=>b0,loadAgentConfig:()=>ue,persistAgentSessions:()=>yr,persistAgentSkills:()=>en,saveAgentConfig:()=>me});import{chmod as _0,stat as y0}from"node:fs/promises";function ue(r,e){return at(Te(r,e).config)}function me(r,e){return Yt(Te(r.agentId,e).config,r,{mode:Zt})}async function b0(r,e){if(process.platform==="win32")return;let i=Te(r,e).config;try{let o=await y0(i);if(!o.isFile())return;let c=o.mode&511;c!==Zt&&(await _0(i,Zt),Fs.warn("agent config mode auto-corrected to 0600",{path:i,from:c.toString(8)}))}catch(o){if(o.code==="ENOENT")return;Fs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(o)})}}async function yr(r,e,i){let o=await ue(r,i);o&&(o.sessions=Object.fromEntries(e),await me(o,i))}async function en(r,e,i){let o=await ue(r,i);o&&(o.skills=e,await me(o,i))}var Fs,Zt,Ue=De(()=>{"use strict";Xt();U();xe();Fs=L("agent-config"),Zt=384});var zi=oe(X=>{"use strict";var S=k;(function(r,e){let i=k,o=r();for(;;)try{if(-parseInt(i(1445))/1+-parseInt(i(1267))/2+parseInt(i(1127))/3*(-parseInt(i(759))/4)+-parseInt(i(591))/5+-parseInt(i(328))/6+parseInt(i(980))/7*(parseInt(i(563))/8)+-parseInt(i(187))/9*(-parseInt(i(1567))/10)===e)break;o.push(o.shift())}catch{o.push(o.shift())}})(Nn,813735);var Yc=Object.defineProperty,Xc=Object["getOwnPr"+S(532)+S(1052)],Ri=(r,e)=>function(){return r&&(e=(0,r[{mmnMx:function(x,f){return x(f)}}[S(648)](Xc,r)[0]])(r=0)),e},$c=(r,e)=>{let i=S,o={AtFXw:function(x,f,d,g){return x(f,d,g)}};for(var c in e)o[i(1575)](Yc,r,c,{get:e[c],enumerable:!0})};function Qc(){return Pi||(Pi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Zc(){let r=S;return Di||(Di=[IDBCursor[r(1148)+"e"][r(883)],IDBCursor[r(1148)+"e"][r(790)],IDBCursor[r(1148)+"e"].continuePrimaryKey])}function ex(r){let e=S,i={RZiWT:function(c,x){return c(x)},QXiUY:e(227),VHcuy:e(939),UzqyE:function(c,x){return c>>>x},ievEc:function(c,x){return c===x},lyzlo:function(c,x){return c<x},LAGaL:function(c,x,f){return c(x,f)},WhHKw:function(c,x){return c&x},fzHKW:function(c,x){return c>>>x},LCpfi:function(c,x){return c+x},hQGgE:function(c,x){return c|x},ImqYC:function(c,x){return c+x},LJvTd:function(c,x){return c!==x},bFtvl:function(c,x){return c&x},klnsU:function(c,x){return c>>>x},JSmso:function(c,x){return c+x},iATlG:function(c,x){return c!==x},xxZoC:function(c,x){return c|x},LLPEJ:function(c,x){return c>>>x},NaQal:function(c,x){return c|x},iVxWV:function(c,x){return c>>>x},DjVXE:function(c,x){return c>>>x},ZbuXt:function(c,x){return c&x},UFhkM:"JDRem",ENLoy:function(c,x){return c instanceof x}},o=new Promise((c,x)=>{let f=e,d={BEyez:i[f(1053)],VXjqL:i[f(735)],Mcudv:function(y){return y()}},g=()=>{let y=f;r[y(923)+"entListe"+y(231)](d[y(1035)],w),r[y(923)+y(1204)+"ner"](d[y(166)],b)},w=()=>{let y=f;i[y(1326)](c,i[y(1326)](Ee,r[y(585)])),g()},b=()=>{x(r[f(939)]),d.Mcudv(g)};r[f(1380)+f(934)](i.QXiUY,w),r[f(1380)+f(934)](i[f(735)],b)});return o[e(1e3)](c=>{let x=e,f={JzbFx:function(d,g){return d>>>g},YHhrO:function(d,g){return d|g},CPbam:function(d,g){return d<<g},wsQoJ:function(d,g){return i[k(600)](d,g)},zLEEE:function(d,g){return d===g},FUPst:function(d,g){return i[k(316)](d,g)},BfsVw:function(d,g){return i[k(1102)](d,g)},hgpCQ:function(d,g){return d<g},sHFGd:function(d,g){return i[k(1102)](d,g)},WcCmO:function(d,g,w){return i[k(990)](d,g,w)},HxoNE:function(d,g){return i[k(599)](d,g)},NSsIG:function(d,g){return i[k(874)](d,g)},vuCFR:function(d,g){return i.LCpfi(d,g)},DMNkq:function(d,g){return d!==g},Girpg:function(d,g){return i[k(1256)](d,g)},nnnBm:function(d,g){return i.ImqYC(d,g)},eHmFg:function(d,g){return d&g},AVLBs:function(d,g){return i[k(1260)](d,g)},BHUQi:function(d,g){return i[k(833)](d,g)},SpiUQ:function(d,g){return i[k(1260)](d,g)},ZPvUl:function(d,g){return d|g},XYsvN:function(d,g){return d>>>g},CtVuN:function(d,g){return i[k(439)](d,g)},hBfPO:function(d,g){return i.hQGgE(d,g)},uQKhw:function(d,g){return i.JSmso(d,g)},CgXam:function(d,g){return i[k(1128)](d,g)},iLGbi:function(d,g){return i[k(236)](d,g)},wNXcO:function(d,g){return i[k(907)](d,g)},FFVLL:function(d,g){return i[k(874)](d,g)},hekGm:function(d,g){return i[k(313)](d,g)},AERsB:function(d,g){return i[k(879)](d,g)},FwZUJ:function(d,g){return d&g},vylaR:function(d,g){return i[k(874)](d,g)},IvXXN:function(d,g){return i[k(1622)](d,g)},YORAI:function(d,g){return i[k(903)](d,g)},MxxHh:function(d,g){return i[k(1622)](d,g)}};if(i[x(1589)]!==i.UFhkM){let d=f[x(480)](_0x1f0f7a[x(371)],0),g=f[x(480)](f[x(850)](f.JzbFx(_0x499d54[x(371)],28),f[x(1602)](_0x324bd2[x(1075)],4)),0),w=f[x(873)](_0x9512c2.high,24),b=f[x(184)](0,w)?f[x(1086)](0,g)?f.BfsVw(d,16384)?f[x(1089)](d,128)?1:2:f.hgpCQ(d,2097152)?3:4:f[x(1585)](g,16384)?f[x(1089)](g,128)?5:6:f[x(1089)](g,2097152)?7:8:f[x(1089)](w,128)?9:10,y=f.WcCmO(_0x434caa,_0x34670b,b),C=_0x407e63[x(385)];switch(b){case 10:C[y+9]=f[x(1533)](f[x(1615)](w,7),1);case 9:C[f[x(1510)](y,8)]=f[x(455)](9,b)?f[x(411)](128,w):f[x(1533)](127,w);case 8:C[f[x(546)](y,7)]=b!==8?f[x(411)](f[x(1615)](g,21),128):f[x(1141)](f[x(873)](g,21),127);case 7:C[y+6]=f[x(1130)](7,b)?f[x(411)](g>>>14,128):f[x(1528)](f.wsQoJ(g,14),127);case 6:C[f.nnnBm(y,5)]=f.SpiUQ(6,b)?f[x(488)](f[x(935)](g,7),128):f[x(1528)](f[x(226)](g,7),127);case 5:C[y+4]=f[x(1130)](5,b)?f.hBfPO(128,g):127&g;case 4:C[f[x(302)](y,3)]=f[x(802)](4,b)?f[x(1034)](f[x(807)](d,21),128):f[x(1209)](d,21)&127;case 3:C[y+2]=f.DMNkq(3,b)?f[x(1404)](f[x(978)](d,14),128):f[x(1064)](f.vylaR(d,14),127);case 2:C[f[x(546)](y,1)]=f[x(1130)](2,b)?f[x(1119)](d,7)|128:f[x(961)](f[x(1289)](d,7),127);case 1:C[y]=b!==1?f[x(543)](128,d):127&d}}else i.ENLoy(c,IDBCursor)&&Dr[x(885)](c,r)})[e(1360)](()=>{}),Ln.set(o,r),o}function tx(r){let e=S,i={iblRm:function(c){return c()},RIUbs:e(1484),zMUxb:function(c,x){return c(x)},lmYtw:"AbortError",bcHfO:e(939),puPiv:e(889),RPERE:e(263)};if(Tn.has(r))return;let o=new Promise((c,x)=>{let f=e,d={BQNYN:f(889),GzaIG:i[f(747)]},g=()=>{let y=f;r[y(923)+y(1204)+"ner"](d[y(571)],w),r[y(923)+y(1204)+y(231)](d.GzaIG,b),r[y(923)+"entListe"+y(231)](y(263),b)},w=()=>{let y=f;i.iblRm(c),i[y(179)](g)},b=()=>{let y=f;if(i[y(474)]!==i[y(474)])return this[y(1438)][y(1110)+"te"];i[y(771)](x,r[y(939)]||new DOMException(i.lmYtw,i.lmYtw)),g()};r[f(1380)+f(934)](i[f(479)],w),r.addEventListener(i.bcHfO,b),r[f(1380)+"Listener"](i[f(1459)],b)});Tn.set(r,o)}function nx(r){Rn=r(Rn)}function rx(r){let e=S,i={HJhjH:function(o,c){return o(c)},YQlOy:function(o,c){return o(c)},uAWmQ:e(800)+e(667)};return r===IDBDatabase[e(1148)+"e"].transaction&&!(i[e(665)]in IDBTransaction[e(1148)+"e"])?function(o,...c){let x=e,f=r[x(1407)](i[x(1003)](Mt,this),o,...c);return Pr.set(f,o[x(651)]?o[x(651)]():[o]),Ee(f)}:Zc()[e(1131)](r)?function(...o){let c=e;return r.apply(Mt(this),o),i[c(1003)](Ee,Dr.get(this))}:function(...o){let c=e;return i.YQlOy(Ee,r.apply(i[c(293)](Mt,this),o))}}function sx(r){let e=S,i={PVYGI:e(1605),NFKns:function(o,c){return o(c)},bnNUb:function(o,c,x){return o(c,x)},MEavP:function(o){return o()}};return typeof r===i.PVYGI?i[e(413)](rx,r):(r instanceof IDBTransaction&&i[e(413)](tx,r),i.bnNUb(Ni,r,i[e(225)](Qc))?new Proxy(r,Rn):r)}function Ee(r){let e=S,i={mELsk:function(c,x){return c instanceof x},iTZkl:function(c,x){return c(x)},UBHuS:function(c,x){return c(x)},UiiBM:function(c,x){return c!==x}};if(i[e(1146)](r,IDBRequest))return i[e(475)](ex,r);if(Dn.has(r))return Dn[e(1621)](r);let o=i[e(1247)](sx,r);return i[e(1197)](o,r)&&(Dn[e(885)](r,o),Ln[e(885)](o,r)),o}var Ni,Pi,Di,Dr,Tn,Pr,Dn,Ln,Rn,Mt,Ii=Ri({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={pHJGD:r(1623),NdowV:function(i){return i()},LDjLl:function(i,o){return i instanceof o},VCTHN:function(i,o){return i===o},BdQmb:r(1125),Ascro:function(i,o){return i===o},hVZdB:"done",UyQJS:function(i,o){return i===o},UdCbN:"objectStoreNames",zlEcj:function(i,o){return i===o},rHNRM:r(396),hoPeB:function(i,o){return i(o)},rnYrl:function(i,o){return i instanceof o},fHOHe:function(i,o){return i in o}};Ni=(i,o)=>o[r(1409)](c=>i instanceof c),Dr=new WeakMap,Tn=new WeakMap,Pr=new WeakMap,Dn=new WeakMap,Ln=new WeakMap,Rn={get(i,o,c){let x=r,f={tVNBb:e[x(945)],nykOS:function(d){return e[x(1633)](d)}};if(e[x(462)](i,IDBTransaction))if(e[x(616)](e[x(1214)],e[x(1214)])){if(e[x(1040)](o,e[x(416)]))return Tn[x(1621)](i);if(e[x(866)](o,e[x(221)]))return i[x(800)+x(667)]||Pr[x(1621)](i);if(e[x(1016)](o,e.rHNRM))return c.objectStoreNames[1]?void 0:c[x(800)+x(1145)](c["objectSt"+x(667)][0])}else this[x(1343)](f[x(1101)],_0x507d31[x(1200)]),f.nykOS(_0x15ea62);return e.hoPeB(Ee,i[o])},set(i,o,c){return i[o]=c,!0},has(i,o){let c=r;return e[c(1636)](i,IDBTransaction)&&(e[c(1040)](o,e[c(416)])||e[c(616)](o,e[c(617)]))?!0:e[c(467)](o,i)}},Mt=i=>Ln[r(1621)](i)}}),Oi={};$c(Oi,{deleteDB:()=>ox,openDB:()=>ix,unwrap:()=>Mt,wrap:()=>Ee});function ix(r,e,{blocked:i,upgrade:o,blocking:c,terminated:x}={}){let f=S,d={uGmUO:function(b,y,C,P,I){return b(y,C,P,I)},pvHZk:function(b,y){return b(y)},yFKnc:f(1279)+f(346),heFWv:f(1548)+f(987),SkYqr:f(1461)},g=indexedDB.open(r,e),w=Ee(g);return o&&(f(1319)!==f(1319)?_0x53fe4a[f(251)](_0x1af02e):g[f(1380)+f(934)](d[f(859)],b=>{let y=f;d[y(1252)](o,d.pvHZk(Ee,g[y(585)]),b[y(465)+"on"],b[y(920)+"on"],Ee(g[y(770)+y(327)]))})),i&&g[f(1380)+f(934)](d.SkYqr,()=>i()),w[f(1e3)](b=>{let y=f;x&&b[y(1380)+y(934)](y(1403),()=>x()),c&&b[y(1380)+"Listener"](d.yFKnc,()=>c())})[f(1360)](()=>{}),w}function ox(r,{blocked:e}={}){let i=S,o={zdUtI:function(x,f){return x(f)}},c=indexedDB[i(738)+i(624)](r);return e&&c[i(1380)+i(934)](i(1461),()=>e()),o[i(902)](Ee,c)[i(1e3)](()=>{})}function Ti(r,e){let i=S,o={hHBOA:function(g,w){return g<w},IVQgq:function(g,w){return g<w},DRUrn:function(g,w){return g===w},KchkC:function(g,w){return g&w},AdrdJ:function(g,w){return g===w},Yfsjh:function(g,w){return g+w},OmxTr:function(g,w){return g!==w},fqrlj:i(1618),SRMkA:function(g,w){return g instanceof w},mGPru:function(g,w){return g in w},aECPe:"string"};if(!(o[i(1228)](r,IDBDatabase)&&!o[i(560)](e,r)&&o[i(968)](typeof e,o[i(1241)])))return;if(In[i(1621)](e))return In[i(1621)](e);let c=e[i(1317)](/FromIndex$/,""),x=e!==c,f=Mi[i(1131)](c);if(!o[i(560)](c,(x?IDBIndex:IDBObjectStore).prototype)||!(f||Bi[i(1131)](c)))return;let d=async function(g,...w){let b=i;if(o[b(996)](o[b(1639)],o[b(1639)])){let y=0,C=0;for(let P=0;P<_0x359af8[b(1620)];++P)C=_0x1a017a.charCodeAt(P),o[b(191)](C,128)?y+=1:o[b(214)](C,2048)?y+=2:o.DRUrn(o.KchkC(64512,C),55296)&&o[b(287)](64512&_0x12ab28.charCodeAt(o[b(642)](P,1)),56320)?(++P,y+=4):y+=3;return y}else{let y=this[b(770)+b(327)](g,f?"readwrite":"readonly"),C=y.store;return x&&(C=C[b(573)](w[b(1513)]())),(await Promise[b(797)]([C[c](...w),f&&y[b(1198)]]))[0]}};return In[i(885)](e,d),d}var Bi,Mi,In,ax=Ri({"node_modules/idb/build/index.js"(){let r=S,e={kOoNU:"2|0|4|5|"+r(1018),VbTfH:function(c){return c()},KwyZy:function(c,x){return c(x)},VKScH:function(c){return c()},RNAbm:r(1621),sfsKU:r(668),swatv:"getAll",vYfbA:r(701)+"ys",dHOmA:r(813),ihkpi:r(1581),knwsf:"add",fiWLO:r(1276)},i=e[r(1671)][r(460)]("|"),o=0;for(;;){switch(i[o++]){case"0":e[r(1600)](Ii);continue;case"1":e[r(549)](nx,c=>({...c,get:(x,f,d)=>Ti(x,f)||c[r(1621)](x,f,d),has:(x,f)=>!!Ti(x,f)||c[r(554)](x,f)}));continue;case"2":e[r(409)](Ii);continue;case"3":In=new Map;continue;case"4":Bi=[e[r(1046)],e[r(1002)],e[r(1275)],e[r(481)],e[r(1314)]];continue;case"5":Mi=[e[r(575)],e.knwsf,e.fiWLO,"clear"];continue}break}}}),cx={idb:function(r){let e=S;r[e(724)]=Promise.resolve()[e(1e3)](()=>(ax(),Oi)).then(function(i){return i})}},Li={};function Ce(r){let e=S,i={tlXBm:function(d,g){return d!==g}},o="4|1|0|3|2".split("|"),c=0;for(;;){switch(o[c++]){case"0":var x=Li[r]={exports:{}};continue;case"1":if(i[e(1668)](void 0,f))return f[e(724)];continue;case"2":return x[e(724)];case"3":cx[r](x,x[e(724)],Ce);continue;case"4":var f=Li[r];continue}break}}function k(r,e){r=r-156;let i=Nn(),o=i[r];if(k.TthaKT===void 0){var c=function(g){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",b="",y="";for(let C=0,P,I,T=0;I=g.charAt(T++);~I&&(P=C%4?P*64+I:I,C++%4)?b+=String.fromCharCode(255&P>>(-2*C&6)):0)I=w.indexOf(I);for(let C=0,P=b.length;C<P;C++)y+="%"+("00"+b.charCodeAt(C).toString(16)).slice(-2);return decodeURIComponent(y)};k.cfhaCy=c,k.wLlFbn={},k.TthaKT=!0}let x=i[0],f=r+x,d=k.wLlFbn[f];return d?o=d:(o=k.cfhaCy(o),k.wLlFbn[f]=o),o}function Nn(){let r=["ENDrqvu","zLDVswq","mJi4nZyWnLPeyMLpDa","Avnwy2K","y2HnyxHuCMK","DNrbCem","CNzHBa","Dvz6vNG","u2zUrMG","z2vrDwv1zuW","C3DHDhy","zgvSzxrL","werdr3u","yuLSBMS","DMvYC2LVBMm","s2rUr1m","rejhuwm","zNjVBuHHC2G","yLvJq0e","yw1LoIa","qw96txe","shvtz0S","x2vUzhbVAw4","uxvLDwu","txH4sgG","v3beD0O","z3bSBfK","CxLhs2i","wKD0s3C","yLfzy2q","B3fjt20","BgLZDgvUtMu","De12teG","A1n0yxr1C0m","x3jLBw92zvC","C2v0q3vYC28","Cgjwuhu","weP4zfa","wNz6s0O","D3nZoI8V","x2fKzfDZtgK","wNH2twm","DhLWzq","A2XMrLC","BNvTyMvY","A0foAhC","CNjVCK1LC3m","ywnRDxbfBMq","ugHctKW","zeHpBue","yNvMzMvYzwq","ueLkEMm","CMvWBgfJzq","vMjRt1G","r0HrBfe","t3Pgrvy","ihrPBwvZ","x3bPBMC","sw1xy3C","C0jf","zgv2AwnLx2K","uLPPv1q","DgLTzw91Da","AhLosNy","t1rvww4","AevYCM9Yrxy","CMvWBgfJzui","A0DqA3O","C2vUDa","BhrPCgXLihq","yw51Ce1LC3m","vufRze0","DezpzNi","ALfbzvO","DwTLzKm","AgvHzgvYCW","AxmGDw5Kzwy","B2zM","x2rLyNvN","BfH0v2e","zM9YrwfJAa","zxrxB3jRq2G","zw50zwqGDhK","v2f4vKq","yxv0BW","twLZC2LUzYa","tuzTyuW","zNjVBunOyxi","q0Xxrhq","y3r4","BNrLCG","wuLrAwG","CezOuwO","AwPVCMC","yxGGCMv0CMK","y2f0y2G","sKnmCfq","CMfTugfYyw0","AgzvB20","mtb8nxW4FdC","v2ncr0O","AK5jv1G","zNjVBujPDhm","swXdt0e","tg9JAW","uMPLshO","BerQyKW","r2TQqKO","DMvICu8","ChjVy2vZCW","zwvsCwC","EKDzwhi","zMXVB3i","C0n5Ahy","z2vtEw5J","ywrKrxzLBNq","swfpEMK","DMryqMO","wMfYywe","CNnVCL9Uyw0","wwfADui","tgzeDKW","BK1QwhG","C3vIC3rYAw4","t0XeD3G","tuPMvwu","zMX1C2HfEha","ruPyvey","uKzJqwi","CvbPEwm","rujKD2u","z1rPBwvVDxq","x2n1CNnVCK0","yvn0Afu","B25ozxr3B3i","C2fNzq","yMrFzgLK","A3DZEvC","y2XVC2u","AgvRr20","tKjfyvy","y2vZC0HHBMq","y2fSBa","tLrcuNu","C29Tzq","ywDLrxzLBNq","C3rHCNq","zw1PDa","x2HHBMrSzvi","x3jLywr5q2W","zw5KCg9PBNq","x19LC01Vzhu","Axbbtw8","x0vysvnu","y29Uy2f0","CM92AwrLihy","y3vYC29Yx24","DMfkAKe","qujMqui","BK5PCfe","y3vYCMvUDeu","ENLQu3a","qujswKq","D3jPDgvvAw4","CIb0DhDjra","ywnRtxnNswq","wxHzDfC","uK5xyKm","quHxAMe","y29UBMvJDa","C3rYAw5N","zgf0yq","zfDVCMTLCKC","x3nVy2TLDa","AwzxvNq","y3vYC29YlNm","vwjxq0y","qxnZAwK","AwXSihvZzsa","DxnLCKLW","mtu4mJqYmhv1sxLhvW","uLrlENK","qxbWBhO","D0L2s3y","q0Xpu0ve","ywrLyxe","sMP4wwW","Bg9IywXty28","CMfNzvn5BMm","wMPpywe","zKDpy0y","tfLPsee","s1rczwW","swfJv2m","uLbfuKu","y2ner0K","yMXVy2TLza","q3HrtgK","D3jPDgu","vhPLzei","DLbzvw0","BgLTAxq","whbPvxy","wwrZENG","B2vMB08","y29UBMvJDca","zw5NDgG","CujZrLy","qLPdqxG","AgHUB2K","tuvtu0fhrv8","s2rxr1a","qLbvqxK","CgLUz0LUDgu","v2LUzg93","te9MveC","EKHHsK8","yMDoBve","x2LZv29YA2u","zNf5Ceq","sfbmz1q","yLPJB1C","Ahr0Chm6","BwvKAwf0zwW","BfrPBwvVDxq","r1rqAfq","AuDsEwi","y29UBMvJDeu","wLDTsgG","x3nLBMrby2S","wvL1r1q","CLPuvhy","zMLSzw5HBwu","x3bHDgHlzxK","y2HHCKnVzgu","B2fK","mhW0Fdf8mNW","CgLUz19VBMm","zxDIuuO","yxzkyMW","x2DLBMvYyxq","CgLUz09Uy2u","D24GCMvHC28","AenJCwS","B09JrhC","DNvdrLi","q0XZyKG","AfLuwgu","C2HPzNq","AMTkDuy","yKnnt1y","x2LZtwLUAvC","y3jLyxrLq2W","y3vYDMfSDwu","Bg1oEhq","y3bOELi","AxnVqum","x3bYzwzPEa","zxmGCMvHy2G","CvrzufC","EuPvq0i","thLYv3m","AgfZt3DUuhi","qKHvuwK","x29Uq2XVC2u","BwfUDwfSihi","y3jLyxrLrxi","vw1QB0e","shHVtKu","CMvTB3zLq2G","yMfJA3vWigu","B0PAthe","wxn6uM4","wu9xCKu","z2v0q3vYCMu","zvD1wg8","z2rNswG","CxbyseO","BM5UDKq","AwHSvvu","twvZC2fNzuu","wwvsuuW","AMHsB08","DxbNCMfKzw4","BMrWB2LUDca","DNHIB0i","Ag9SD20","EvrxvLu","r05UtuW","wvvMzKu","AgXOEeG","zMzMzG","qw1VDw50","AxnmB25N","wMDKwKe","B0nPsu8","BgXsCuG","C0Xf","rNDnCe8","tejeB0u","r3ncDLq","yMfSrxzLBNq","mtbhtMfbtgC","Cw9Z","z21TA2C","AfPpAwW","vwTftgC","rKLRsfC","DKzUuvi","yvLVwwi","qxrgwhC","B0vgBue","yMLUza","BgLns24","q3vZDg9Trxi","DxrVuMvJB24","Chv0","BMvJDa","wgXdv3e","z1b3vge","C0Hgr2q","yLbwq0S","q1jzC1K","y29UBMvJDgK","vuzOA00","CNnVCL92ywW","uKHOB2u","AwDHDg9Yt24","B2nRzxrtDwm","BNnLsxy","zgrjrcWGzgu","Aw9Ul2PZB24","uKPswxC","Buv4zg4","AwXK","vMjuzKG","tgnqAeG","q1bIyw0","CMflvfC","z2vY","zNvUy3rPB24","CM9YrxzLBNq","wNjXzLi","qKPeB0S","ExvIv1K","ignVzgu6ia","rvntsNi","BNPywg8","mhWXFdn8mNW","DhjPzxm","tLnZsuC","tLzYvhq","Dg9oDw1Izxi","z014she","r0X5BKS","BgvUz3rO","z2v0","rgPwweu","CMvJzwL2zwq","zuH4weG","B3bLBIa","D3jzDKy","EMX0t2G","Ahfpt0y","qvDoyKq","v3nJDvK","su5tvefova","whnRy2K","tMrVD1y","zxjFDhrS","B3nLrxzLBNq","CM5zCMW","DxbKyxrLq3u","quTbrNu","zNfYBgO","x2HHBMrSzu8","Bg9Nsurhzw4","ywDL","zxvYr0u","CxfPuxi","BfroCNu","wLLKvKK","reiGzMfPBgu","Aw5KzxHpzG","D2TvCgK","zhf4r3i","yvv2BhO","x3bYB3rVy28","DuP3ze4","A29IuwK","tuTVv08","uw9cvMe","CMvZzxrfBMq","yuLjA0K","te9Nru4","yw1Lu3bHy2u","DhbizwfKzxi","s3LZBgK","B0jlANu","yKv4rw4","ywXntem","Dw5KzwzPBMu","DxrMofDYAxq","DgXyqM0","r2jnAKu","DMLJzuLeig8","A09VtLu","q3DkzMG","AgvHzgvY","sNnzzhi","wMfSEuq","CMrJvMy","zgLZCgf0y2G","D3HHrNi","A1zjEfC","BerLuey","lcbTyxGGCMu","u3rYyxrLz3K","thLyvMO","x29WDgLVBNm","yuLkB0m","DgvZDa","vLHQCuW","x3DZsw5ZDge","uxjdugW","x2LUAxrhBg8","DerNrxu","AxnbCNjHEq","Bg9NsurozxC","C2jlBLe","BgPdCvO","rNPnAgm","BNHVrw4","AhzlC0q","AenSB3nLrxy","AwjSuM0","ihjLy29UBMu","yNL0zu9MzNm","wNjpBMK","DMfSDwu","EKXfruu","zw5HyMXLqxu","x2rPC3bHDgm","ndy1nda4odftvgHivKi","rfbTuMi","Au9lrg8","AgPmDgS","AeHct0e","Dg9VigXHCMC","BhLSt1m","vMjNzuC","D2fZq2XLyw4","B1H2t00","Dg9tDhjPBMC","uhLjwha","Cw5ssg8","wu1Mrhy","q0TNwu0","Eujmt2u","C2v0u3rVCMe","CvfYrMu","u294BLm","Au9XDfG","ALrmAxC","s3HMueO","rNLVrvC","vw5Oyw5KBgu","DgLUzYbZzxi","CenXwuy","C2j6ANK","svzrz3e","Dxrjza","y2XVC2veqG","q0HXCNC","zgvJB2rLzey","z3vYEeG","x29UtwvZC2e","vwrdyK4","zcbLCNjVCI4","AgzgywS","C3v3sge","tuvHDLa","q3rwDu4","C3vJy2vZCW","Dwz3AwW","icSG","Cgf5Bg9Hzeu","BMvY","BM5Ly3q","uMjkt0m","t1bftL9fuLi","CYbWyxjHBxm","EhHAB0m","De5YvLO","lcbOB3n0BMe","x2rLC3rYB3K","BMDLza","ANPnBLi","DgnjthK","BerTBgG","BML0AwfSAxO","BND4BNG","seD1q2q","r0DuBLC","y29UC3rYDwm","C2vYDMLJzq","CgLUz1rPBwu","ChvZAa","D2L4qMK","q3vZDg9Tq2W","ze1NEwi","yuzksfm","yvzXveC","A2v5CW","z1rRtvu","tMzdy2C","uM1RDLG","B2zMBgLUzq","zvvYBa","ywjVCNq","ywWGy3vYC28","svLuBwW","z05Ar3m","DgLuv3a","zxjFywnRx20","BgnKEeC","x2TLEvbHDgG","y09OvNK","rfHYwue","CMvZzxrdB3u","BunzrfG","sg5OAhC","BKXPBMu","yNL0zuXLBMC","Dw5ZAwDUzwq","Aw5PDcbrB1m","B3bLBG","CgLUz0XVC3m","qKvetey","C2LUuw0","BxnNsuq","t25vCwy","BMrLEa","qwrYzeO","yxv0B21HDgK","u0zjqNq","mtb8mxWY","r1LIt1K","pxv0zI04","wvfSt3K","ign1CNnVCIa","B25tDg9Wsw0","Axbgsvy","t2jQzwn0","vuTrvM8","BM93","zw1LBNq","yvjrt2W","DvflAhC","DLrbqKm","uLHcBKm","tKfusvzfx0u","EwToA1y","CMvZB2X2zq","BgToEem","y0D5uw8","C2vUzf9Hy2S","CgXLyxnLiha","B2DzBxi","tMfrywW","x2LZsw5PDa","AMfyq3q","Awv2rwm","r2rSu1O","BwX3BMW","BNrfBMrWB2K","BMnVzgLUzW","CuPIwMu","x29UvgLTzw8","D3m6lY8","q2nlAgS","zwrPyxrLBhK","Bwf4uMv0CMK","Aw9U","ndu5mtmWogrxufLvqW","Ae9Wzw5fDMu","Efrurw52","rgncu0u","yMvkChK","q09otKvdveK","A1rdyuq","ihrVihjLDhi","AgvKtwf4uMu","yxnL","ywnR","zxjYtxnN","vxPLB0C","Dxnky3m","Bhm6ia","FdH8oxWWFdm","AwXLx25HBwu","m3W3Fdv8mhW","AgfUz2u","r3fUy2e","thblq2W","wLneufK","r3nzAK8","EKvjyvm","tg9NsurozxC","y3ruAw1LB3u","Dw5RBM93BIa","svzgAuO","z0r1r1q","CMfUzg9T","DxziBxG","BezfzKy","Cwrsrxa","u1vjsNi","A2v0ignVBNm","Dgv4Dc9Qyxy","v3vTsfC","zcWG","CMvJB25Uzwm","yvv0rwe","AMf5Duq","zxH0zw5ZAw8","Dgv4DfbHEwW","Bg93","yNfmv0u","BNrbBMrvCgq","Dg9cExrLC0i","zMzmAw5L","B25mAw5L","thrTDM8","igfYCMf5yNu","yxrLq291BNq","Dwjlv1e","DeLK","C0TfvxG","zuPRCKC","sKLLAK0","yNL0zxm","CfHjCgm","x2rPC2nVBM4","x29Ut3bLBG","yxPhC0e","yLfzzLe","tufyx1jfvfi","C0nbvum","v2XKuLi","zxjHDg9Y","zv90Aw1LB3u","C3rVCMu","EgHssMi","z0nuq2C","o2nOyxjZzxq","qNDptMq","B3jRzxjhBg8","ChjVDg9JB2W","vejLy1m","vMrsu0e","te5vD3u","sxnKteu","suvtx0vsuK8","A2zlsLm","vKTty0G","A2zeywq","r2LYCgC","BIWGAg9ZDg4","tKzlBNm","rKLAAw0","rvjst1i","AfzAzei","tg9Nsuq","ruHKEg4","BwLUzW","zu53rNi","zNjVBNrPzxi","q2nwuNG","tNnXwKO","BwLUAvbYB2C","CYbHBhjLywq","z3HLCKS","q2TjEMG","vuX2wvO","EKXOz3a","D09nsMW","x21LC3nHz2u","CYbPBNn0yw4","DcbSAw1PDa","whH6rMG","DuXnBgC","BMv4DcGPigm","q1bYvNe","zw5HyMXLuw8","A2XUC1u","ywLpBee","q25Pvwe","zufJAW","y29SBM8","yLfXCNO","AwrI","CgjICdi","zNjHBwvuExa","uerhCK0","q1v0zxi","q291BNq","t2rTqNi","DgLTzw91DcW","s2jnChe","q2fWv0K","re1oA3e","zfPRwKm","BgLUzq","yu5LBxC","u0DkzeS","C3bSAxq","svvHEgu","terQtgW","mhW1Fdj8m3W","BwXhugG","B2XKvMvYC2K","z2nMy1e","zKHpsgu","Ae1LC3nHz2u","z1vSwuS","zLHXr2e","yKnprhy","ihzHBgLKigq","ywrKq291BNq","uKLvyNm","AvrAA2W","DLLIzw4","zLrOAKW","DeLUDgvYy2u","ChvqAxy","sNPIrNG","DLLMyKe","A05kAum","l3DZl3yY","Aw50zwDLCIa","y2XVC2uSihC","zwrSrxy","q29Kzq","wLb2vwW","CKXtzK0","z2Txwgi","BK5mshu","C2vYDMvYvgK","x25HDMLNyxq","zgriu2G","vxbKyxrLq28","x2LZtwLUAvq","Dg9Y","BxnN","yNzfDvO","B3bLBKrc","sejKs0q","CwHgEem","wMXfEgC","y3jLyxrLt3a","tw9KDwXL","yNvMzMvY","EhnbAhC","qMzKqMS","wePhqw4","zMzLCG","s25rBxi","DMfS","A2vpAKe","x3bPBMDqB24","AgXysK0","mxWYFdr8nG","yMLUyxj5vhK","D1DTrvK","wLbRvNq","x2n1CNnVCK4","BwPIBvK","EffmvgC","BMvlrfq","CgfYC2u","BeHHBMrSzxi","ruzODK8","CNLSzem","EMjbqvG","EvHODha","rxfHyMu","y2HLy2TdDxi","B3bLCNr5tMe","zMLUza","u2LOzfm","ve5vvKq","y3jLyxrLtwu","y3vZDg9Tshq","mNW0Fdb8mxW","sKrLwxi","swD0z0G","ig1LC3nHz2u","Cwv0uNO","AejMue8","EhPnA0W","BgLUzw5V","BM5UqM0","ALLdExy","A2v5","s3D5wNK","AxnrB1nnzxm","Dg9cExrLC0W","B25TzxnZywC","B25LCNjVCG","AgfZ","DLzXzvK","x194x21Zz18","q09oveLovuu","rLDt","D29oExy","BuDqCNu","tMDTEM4","zLLwu1O","mJrPwK9pEuq","uMDVAw4","B25JBg9Zzq","rNjVBNrPzxi","y2XLyxi","BMfTzq","m3W0Fdz8mNW","vhrgtLq","qLfowu4","BgL6BgC","Aw5KzxG","CMfTzq","AwHRCgK","ChrVCG","tMjnAfa","uu5bDe0","Dhj1y3rVCIa","t3bLBKv2zw4","s3riq3a","lcbxzwjtB2m","yuzyqwW","yNfPrg8","CMvZDwX0","yuLowwu","igzPzwXKoIa","Ec11C2uT","D2X3u3i","C3rVCcbPBw0","ntqZmtq3mhHiAvnpvG","D0fSwvu","CNnVCKzPBgu","FdeXFdj8nNW","vu5Zv2O","C2XPy2u","zxjFAxnFywm","EvLvtMq","v2His3C","vxPXEuu","x2nSzwfYugK","ywzL","vgLTzw91Da","wgTeD0m","CMTLCKDSB2i","yK9hD0y","nhWYFdn8mhW","qw9yuwG","BgPPywu","AxnszwfKEq","C2j4v0G","ywnOzwqSihC","AhPdwNK","serhqwq","wu1bwhy","vKnuse4","CKHouK0","rxjYB3jdB2q","x21PBMLoyxy","u0PgCgG","zxrxv2G","B3vUDa","tuzWyKi","DgfIyxnL","t2zXuwW","B3nLza","twnHrxq","vw5PBxbSzw0","zwLgt1a","AKjLre8","ywfHEKm","zxj2AwnL","v3bJvue","CMLLC0nVDw4","ywnRx2LK","ANzXu0e","mNWZFdb8mxW","B25dBg9Zzq","ywffB0W","ywrKt25L","zgLZywjSzue","wwzZAMG","EvnSzg8","ALH3q3q","AxjuzfK","DvPYsMi","x2HHBMrSzva","Bw1UtxG","Chndww4","yNLL","C29YDa","DgHHBIbSB2m","CNzHBfzHBhu","igzHAwWSig0","ANnXweC","BMCGzMfPBgu","t1vzA0m","tMzoy0i","B25VCgvU","Auvru08","y3jLyxrLuMu","yxbWBhK","Dg9hzw5LCMe","q0Xpu0LorW","DufxBve","ENfOCgq","B3jLtMfTzxm","z2v0s2v5","yxKSig5LDhC","BwLZzq","q0nUseu","zw5JB2rLrNi","DwvQtM4","q1zYCK4","BwvZC2fNzv8","ze1kDgq","zNjVBuj5Dgu","B25SAw5L","DhjPzxmGCMu","EvjLy29UBMu","CMz2Buu","ug5nENa","Ag9iuMK","u1vksxK","B0jREuG","zgvIDwC","D2X3uNa","x3jLy29UBMu","CKfMquq","zM1LAwS","BKrUwuS","se9Nwgm","DgHisgm","yw5Hz2vY","rKLmrv9ot1q","rvbVsNK","z0TfC3e","BNruCMLLC0m","Dev2zw50","rwPeDxC","z2v0qwXSs2u","r2TtwLC","u2TPCcbWyxm","CMvJzxzPzwq","q29UzMLN","BNLnyuy","EeTIqxK","vgLntfC","ywDLsgLKzq","zeTcq3O","thvJBeK","zwPnyum","vwTgEKK","z2vjBMzVu3K","A25urNi","v0rJCMG","B05MDg0","B2LUDfjLywm","z2v0qwXS","DMHXy2S","DwrbEfi","AxbRDeW","rNjvEfi","zxHWB3j0CW","DfLmCvq","ueXWreO","C3rLBMvYCW","C3zSwKO","x3DHAxq","u1jLEee","ww9xvge","y2HnyxHdB3u","B2DrruK","B1PyAfe","vKHJDxK","yKLIqNe","vezZqMC","zgvSzxrLrge","AgHZEfq","yw5Nzq","qwLzB3u","DMvhthK","Dgv4Dc9WBge","BhnwA08","uKDIC0y","uerLCwi","yMnizK8","DMvUDa","rNf1Axe","rLjptLrjrvi","x2LZqNjVD3m","yK56B3C","AMvJDfn0B3i","CgLiEMe","jMPZy2fSBgi","x3bPBMDmB3m","DhDVCMTdAge","DMfSDwvZ","nfDrzKXuAa","uvvdrKm","B25nzxnZywC","nxWXmhW3Fdq","BefJueu","rwrguMm","zMLSDgvY","zM9Yy2u","q0HUB1O","FdeXFdL8mhW","ihn1y2nLC3m","DhjHBNnHy3q","EK1vEgi","y1b2sgu","zgvS","uefOuM0","Bg9N","y3jeExC","CvPmsLm","mdaWmdaWmda","ywDLu2HVDW","rxzhtum","vgTLz1m","ihzHBgLKihm","BNjqt3u","zxf1ywXZ","tMrsyvK","DNflDKq","svzev1i","DhjPBq","rfvwDgG","y29UDgLUDwu","z1vQD0q","x2LUAxrqCM8","y29Kzq","DMvYC2LVBG","q3fyyuG","rffMsuK","ywXS","ue92tuq","EK9otKu","B2jQzwn0u3q","CfLzugi","q2Dyyw0","AhrQvgC","BwvY","vxr0Cgu","rLDfsxa","D05yy08","y09Wzw4","s2rgzLi","v2TLwwS","yxbvufm","uMvHzcbWyxm","y291BNq","rvz2Cg0","t0vjq2m","v1b1tuS","x2LUDgvYDMe","rxzzyLu","EvnkvLG","ywHtvMK","D3jxwxO","C3nHz2vfDMu","sxzgv2u","ihrPBwvVDxq","rKnsBwK","ywXIz2G","ywXty29Wzq","BuD5q2O","x3vYBa","EM9UzMu","vuvbD2e","AeLir3O","yKz0DMW","Cg93","EKHKs0W","yK9vtxG","v1v6Exq","wxzvuui","ywfzt3i","sw9Rs0G","Dw50","s0XZu1C","zfjWrvq","tu9vuLC","whPyBwm","CgnKz2K","De9Kquq","ywrK","u0PbAuy","wuHOCK8","yLDftgm","tNvsseK","DNvdwwS","A0TbqLi","yM9KEq","B0PHyvG","x2rYB3bhBg8","BgXRwfG","Agvgv3y","uhHjzwS","rxvAzfe","EKrrDwi","yxKSihrYEsa","CK1Muva","EK9bque","vxLrsLm","C0XPC3rLBMu","Bwu6ia","ze9YuuC","zhznv2q","z0fdwKm","sMrUB1q","D3nrB0O","zNPis1C","yLvNrfq","vwPZqLm","BfzZrLG","uvjzCwi","Avz4v1y","ChbL","DNntzeK","B25szwnLAxy","ywr2yw5Jzq","y3jLyxrLt2i","C2v0","CfbRzLe","AvjSr3m","s2HRB0C","y29TCgXLDgu","zw5fDMvUDa","A29ZBMq","zNLpzxy","r2nPr1u","z0LxuLa","EwDIB0O","tNvst1u","uwnPvM0","x2n1CNnVCKy","DgvmB2Djre4","uLjpuG","suTQvhm","EMrvDeK","wMj1whq","B25Uzwn0Aw4","qM5ty0S","rfbowxG","teXqruO","BfLJuuu","u2vXsuq","A0jwCLa","DgfYz2v0","AxjLza","rxzLBNq","D2LSBfjLy28","yxP4weO","nNWZFdL8nhW","AxnAzxjV","CgfNzwHPzgu","t1bftG","BMv3vMvYC2K","ywnOzwq","DhHosuq","CMvTB3zLrxy","zw1YvNe","aaaaaaaaaaa","s2vzy0i","DhDRA2W","BwvZC2fNztO","BxHpzK0","vfHRDgG","EgPbvhO","Cg9PBNrbBMq","CgfNzxnOB3C","tgLZDgvUzxi","wfLZDK4","zeroAee","DMDUqNm","tfvJA24","zxjYB3i","z3zqExO","EgX1AK0","CMvHC29U","CgvYC2LZDgu","Ec1TC2CTy3u","CeHkr0q","y3vYCMvUDeK","zw5HyMXLvhi","r01IB0y","sxPtEem","sMXuAum","t0fVBe8","AK1Xsvq","q1rvwwy","z2v0u3rVCMe","Bwf4tg9ZC0m","yMLUyxj5","x1fVu01HBMe","m3W1Fdb8nhW","Exjtz2q","B25tDgfYDfi","wu9squK","DKrzEue","v0LsCLm","tKDFrvjst1i","s2XSsKu","B25pCgvU","vLDeteO","rfjvCM4","AM9PBG","DvvzB1q","CwrlzM0","y3vYC29Yx2y","C3L6wLO","tvjwue8","rfHRuMi","ywXPzcb1CMW","A2zqvKu","quvsC0i","x2zVCM1HDeu","mtK1ntK1ngPisvHkrG","zcWGDw5RBM8","uLDpr1m","B2zMC2v0","rK5Itva","rfzICNy","zwn0","zwvKzwq","uwDKuNO","x2nVBM5Ly3q","tefhyuW","BxzyA1e","C0nVDw50zxi","zw5JB2rPBMC","vLrpDNO","B3v0sw50zxi","t214vhi","Dfz1yMe","txfgAhO","DfztAe4","DgHLBG","ywnRpwzYB24","C2zZs1u","sePOAKG","DufJrKO","vLvkruW","Cgv0zLe","EfH5shq","Ahr0Ca","EgrgELG","igXHCMDLCIa","uMvJB25Uzwm","BKv5y3a","x2DLDeLUDgu","ueDWCuK","AwHgAhm","EMXfy2O","AwXLtMfTzq","m3WX","vhvQCMq","EunLreW","tNjrAwu","x2XPC3rLBMu","v2rKrwm","C2vYDMLJzs0","y3D1D3G","y3vYC29Y","DgvSrfO","yw1L","id4G","CMvUDevUzha","uNLkv08","BNf4qwK","D0DUCxO","AuXhyMK","qKv5zxO","ENvju3G","CMvHzfvjBNq","yxnZAwDU","x29UrxjYB3i","qxnJCM8","A3jzthq","sLnptLa","r0zhBuO","vgfN","DxjS","uK5byM0","C3rYAw5NAwy","CMvXDwLYzwq","EKzTu3u","wgvJq0S","EvfAB3e","BwvZ","uvHPvvK","sejfwNK","BfPpu0i","x2nSzwfYvgK","y0zsqxa","AuLprvm","uuvWs1O","zMjWBM4","BMCGDxjSoIa","EvPgAhK","sxvyDe8","rNDAvuO","EuLutMK","BezSDxnO","zgvMAw5Luhi","swvNzNm","y1DnD1a","Eufrru4","r1zewfa","zMLN","u2HHCMvKv28","BKHrCuG","AgLNAa","ru5euxy","Dg9mB3DLCKm","BgvY","ueLWqwK","B2nRzxq","C3bSAwnL","DgLLCKPtt04","Bwv0Ag9K","sM9KyMS","q3bUrhG","rLvqC3q","CuzbD2m","x2nYzwf0zvm","AgDWq1e","B2nRzxrgywK","CMvKDwnL","z29PBMCGyxC","rKL2DvG","x2jPBMfYEvq","sfLLvKO","BMnLq2XVC2u","BMDuAw1LCG","DMvY","tKPqBum","Ae14B1y","DfzoqMi","BhL6Bg8","te1gBMO","A1HfD0G","CM92AwrLihC","DhfYCwW","uxP2Egy","r09MA1i","v2fWu2G","CMvHzhLtDge","x2LUAxq","y1LPqvq","rLvwywy","ihrYEsbYzwm","EhfPsKm","CwvcrNq","De1HBMfNzxi","AvL1rMi","sxzywe4","qNLUvNO","qu9utxu","ihbYB3rVy28","u2TPDLe","Cg9PBNrdB24","C2Hluuq","z2v0sxrLBq","mtG1ndaXnvbSwfrjza","AufuBeC","z2v0q3vYC28","qvzmqNm","Aw5JBhvKzxm","C2vUza","EwvQCNy","Buzkr3G","q1rSrwS","wwHTv2G","CKThAMC","rgHyuNC","tejMwMu","EgXpEw8","zuHTrMC","zhLvr1a","Aw9UvgLTzw8","D0rwzhG","B3jL","BuvmC2S","rKHfrMK","ChjVDg90Exa","BM9Uzv9UB24","EvH1wvC","zMTXA0W","quXm","zxjYtM8","x2rItMfTzq","B3bLCNr5","v01YB2K","DunvDfG","x29UugfNzu4","rLzqvLO","s3Louuq","rK5WsK0","A2f5wu0","rgvKAwnHDgu","zNjVBu51Bwi","x3DZ","yM5yC1G","zwnVBM5Ly3q","BMrWB2LUDfq","wevXruS","r0zuvNe","B25fCNjVCG","AxnrB1nby2S","u1DotwO","tLHlu3G","wNHfB3O","y29UDgv4Da","Deflv1u","Dw5pDfe","Dwrqzei","y29UBMvJDfm","t21Lt00","tMXfA0m","swzqBKq","x3fVC0rc","veL0we4","x0rctMfTzq","zv9ZDwnJzxm","yMfSu2nVCgu","wu5ywve","nhWXFdy","quHquey","C3jJ","CMD1EuW","BuLiCKO","Cgf5Bg9Hzfq","C2v0sxrLBq","vwLPqK0","zg9Uzq","wNbyse4","BwvZC2fNzq","tuTTu3K","y2XLyxjtDg8","ywXSzwqGBxu","zw50tgLZDgu","yxbWBgLJyxq","y29SuKC","Cgf5Bg9Hza","qxj1A0S","rKzwteW","ue9PweK","whnJwwW","Cgu6ia","Aw1LCYbPBIa","qMrrBwi","y2HLy2Tszwe","ALrqDvG","tMfTzq","EKLZzNi","B3jRig9MzMW","C3vIyxjYyxK","Ew5WvuO","DNLdve8","zMvvz1q","EwzkD2e","s0jPDe4","x3nLCuLK","Ef9MCM9UDgK","u1jnA0e","zw50","uKfNB0C","tgT6tKG","ugjrsg4","q2zSwvi","qu1tDNC","mhWXFdj8m3W","BhnXsLm","ExbL","twXvu3y","BxfdtvO","wLHoBeW","yuvdugu","zLLbs2q","qNjPzgDL","C2HmEwC","B3jpBMXPBMu","wwrOCK8","vujiDvm","CgXqwue","rejoBfO","Afvgt2i","Ec1TC2CTCw8","DuDTvu8","D0fbAva","EwTgsNG","zxq9DxrMltG","Affhz0u","AK1wDxa","A1bdDwG","BwfW","teP2vgq","rhL3C2W","ENbVCwu","v2vIu29JA2u","t0XrwuC"];return Nn=function(){return r},Nn()}Ce.d=(r,e)=>{let i=k;for(var o in e)Ce.o(e,o)&&!Ce.o(r,o)&&Object[i(1067)+i(1155)](r,o,{enumerable:!0,get:e[o]})},(()=>{let r=S;Ce.o=(e,i)=>Object.prototype[r(1527)+r(1155)].call(e,i)})(),(()=>{let r=S,e={Uttpe:function(i,o){return i!=o},dOrQG:r(1666)+"d",zbAAX:r(505),gUjwD:r(1416)+"le"};Ce.r=i=>{let o=r;e[o(805)](e[o(869)],typeof Symbol)&&Symbol[o(197)+o(1044)]&&Object[o(1067)+o(1155)](i,Symbol[o(197)+o(1044)],{value:e[o(528)]}),Object[o(1067)+o(1155)](i,e[o(791)],{value:!0})}})();var Y={};(()=>{let r=S,e={wlwRp:function(s,t){return s===t},zONNE:r(948),OLDwx:r(1175),AiYou:function(s,t){return s+t},cWMwP:function(s,t){return s+t},KeYcB:function(s,t){return s+t},RGbsF:function(s,t){return s*t},LYiHA:r(627),gCTCg:function(s,t){return s(t)},HOgXc:function(s,t){return s+t},aUvlz:function(s,t){return s+t},IvFWe:function(s,t){return s(t)},SGJdK:function(s,t){return s+t},UbWCF:"0000",tOdAD:function(s,t){return s(t)},bUgDT:r(778)+"00000000"+r(778)+r(778),dMgyb:function(s,t){return s||t},lFEfF:function(s,t){return s!=t},NbMhP:r(1666)+"d",jBeDO:r(1205)+"ion/json",hyNJv:function(s,t){return s==t},oNftm:r(743)+"in;charset=utf-8",vFnQR:function(s,t){return s>t},RbJOC:function(s,t){return s!==t},LfDvL:r(1112),aSthU:function(s,t){return s<t},kosnd:r(539),krYLt:function(s,t){return s>t},lkNxC:function(s,t){return s<t},mlFmS:function(s,t){return s!==t},OdmBr:r(1019),qqiQr:function(s,t){return s!==t},SFIBt:function(s,t){return s-t},PDGrM:function(s,t){return s<t},ZgdZA:function(s,t){return s-t},IfPnD:function(s,t){return s<t},RJRYw:function(s,t){return s!==t},NfNcB:r(1561),nMjXx:function(s,t){return s===t},DBNlZ:r(162),HDGAd:function(s,t){return s!==t},QUCFC:function(s,t,n){return s(t,n)},MFmaL:function(s,t){return s(t)},RXBnC:function(s,t){return s>>>t},WddEc:function(s,t,n){return s(t,n)},ZSDPY:function(s,t){return s&t},GONtZ:r(1350)+"required"+r(587)+r(548),gkWXb:"Missing "+r(1048)+r(587)+"value",oCiIO:function(s){return s()},dMJtd:function(s,t){return s(t)},WMroi:function(s,t,n){return s(t,n)},xzMkL:r(1200),PIJzc:r(237),QiwQG:r(931),RjeHz:function(s,t){return s!==t},EZmvK:r(1074),sbKnQ:function(s,t){return s!==t},aVqTG:function(s,t,n){return s(t,n)},xdFzX:function(s,t){return s!==t},vuCYk:function(s,t,n){return s(t,n)},lDePF:function(s,t){return s(t)},BfdBk:function(s,t){return s!==t},NJPmC:function(s,t){return s!==t},mIHrJ:function(s){return s()},AKAFu:function(s,t,n){return s(t,n)},kfPVE:function(s,t,n){return s(t,n)},GciGU:function(s,t,n){return s(t,n)},fXqGa:function(s,t){return s!==t},RNWbC:function(s,t,n){return s(t,n)},bQqrz:function(s,t,n){return s(t,n)},feUgT:function(s,t,n){return s(t,n)},PIpAi:r(722),cdwXw:function(s,t,n){return s(t,n)},suwHa:function(s,t,n){return s(t,n)},GCMwy:function(s,t){return s(t)},fGOcF:function(s,t){return s===t},kANhw:r(1446),uVzVx:r(681),JsYdr:function(s,t,n){return s(t,n)},ukefC:function(s,t,n){return s(t,n)},yYUNd:function(s,t){return s(t)},veGLy:function(s,t){return s(t)},eiFOP:function(s,t,n){return s(t,n)},kGPkz:function(s,t){return s(t)},vtApC:function(s,t,n){return s(t,n)},TzedB:function(s,t){return s(t)},dRpET:function(s,t,n){return s(t,n)},thHHc:function(s,t){return s(t)},gvPyz:function(s,t){return s&t},AHWja:function(s,t){return s===t},KdWGP:r(1350)+r(1048)+" field: "+r(417),wixBi:function(s,t){return s===t},VJehl:"Missing "+r(1048)+" field: "+r(1083),pkJgn:function(s,t){return s(t)},htlrg:r(628)+r(1347)+r(1212),POvMD:function(s,t){return s>>t},bOGwF:function(s,t){return s>=t},tAKWU:function(s,t){return s===t},YoWTa:function(s,t){return s instanceof t},GTPhT:r(1205)+r(1596)+r(399)+r(292),iYuFb:r(1435),GNnML:r(1149)+"e",JIejM:function(s,t,n,a){return s(t,n,a)},ubKWQ:"oefoO",kBVrP:function(s,t){return s>t},qyGKb:r(703)+"t limit",WjQiS:function(s,t){return s*t},bCODv:r(678),gpllY:r(261),uejNn:r(918),unOtQ:r(739),yQZoq:r(812)+r(433),qZLJS:function(s,t,n){return s(t,n)},aIJoC:function(s,t){return s+t},WPuMK:function(s,t){return s||t},NTBRu:r(1530)+r(1167)+"ing",oBKju:function(s,t){return s===t},IaOzi:function(s,t){return s===t},aaazC:function(s,t){return s+t},NuROU:function(s,t){return s+t},yXuYW:function(s,t){return s&t},nyMaF:function(s,t){return s|t},hfUom:function(s,t){return s<<t},qPiyc:function(s,t){return s&t},WUzyt:function(s,t){return s<t},BJDoK:function(s,t){return s===t},TBecS:"IEtPO",nzXXo:function(s,t){return s(t)},rZTTv:function(s,t){return s+t},TItXN:"SrslY",dyUGP:function(s,t){return s+t},tyQyO:function(s,t){return s+t},FIkHW:function(s,t){return s+t},mqCMZ:function(s,t){return s|t},JjxYl:function(s,t){return s|t},POiXI:function(s,t){return s&t},IokKH:function(s,t){return s<<t},LyrWs:function(s,t){return s&t},tVShN:function(s,t){return s(t)},KyNQD:function(s,t){return s+t},kPCuh:function(s,t){return s|t},SkivQ:function(s,t){return s<<t},svlZJ:function(s,t){return s<<t},FCRmi:function(s,t){return s<<t},Ydszx:function(s,t){return s<<t},WscuY:function(s,t){return s&t},txNID:r(358),VpFbo:r(209),PLpDJ:function(s,t){return s>>t},ZrqfR:function(s,t){return s&t},RXAbU:function(s,t){return s<t},GLynK:function(s,t){return s+t},VbgeG:function(s,t){return s<t},bqiDo:function(s,t,n){return s(t,n)},aiOlA:function(s,t){return s<=t},nNLHu:function(s,t){return s<t},QEpKZ:function(s,t){return s-t},NXKSx:function(s,t){return s+t},uZrJb:function(s,t){return s<<t},FNbMP:r(454),petfQ:function(s,t){return s&t},tYLqT:function(s,t){return s|t},YrniR:r(355),qpXHJ:function(s,t){return s<t},JotkY:function(s,t,n){return s(t,n)},nrPOu:function(s,t){return s<t},WldRR:function(s,t){return s&t},hYTXe:function(s,t){return s&t},HBdKD:function(s){return s()},shLyg:r(702),liMKn:function(s,t,n){return s(t,n)},klfFW:function(s,t){return s|t},EnKdD:function(s,t,n){return s(t,n)},kFCEh:function(s,t){return s&t},CflYR:function(s,t){return s(t)},sinQm:function(s,t){return s&t},QrCPl:function(s,t){return s<<t},CTlEk:function(s,t){return s&t},sCAUC:function(s,t){return s&t},fkqkL:function(s,t){return s(t)},alMLC:function(s,t){return s<<t},tiTWp:function(s,t){return s&t},rLSfM:function(s,t){return s&t},fbpnn:function(s,t){return s(t)},Luxnm:function(s,t){return s&t},qBsFV:function(s,t){return s(t)},tFOfr:function(s,t){return s<<t},KnQmr:function(s,t){return s&t},hMxoV:function(s,t){return s&t},aINYe:function(s,t){return s<<t},QciVm:function(s,t){return s|t},kobQi:function(s,t){return s>>>t},rMfQP:function(s,t){return s<<t},dUNcv:function(s,t){return s>>>t},tMvLH:function(s,t){return s<<t},hfFak:function(s,t){return s===t},BnScK:function(s,t){return s<t},YNXYQ:function(s,t){return s<t},lmNxt:function(s,t){return s<t},kKABR:function(s,t,n){return s(t,n)},MKoWO:function(s,t){return s&t},Eqabe:function(s,t){return s+t},UvXhX:function(s,t){return s!==t},PbQHn:function(s,t){return s+t},zFmSu:function(s,t){return s!==t},RFcAb:function(s,t){return s|t},LOHLY:function(s,t){return s+t},oJaaX:function(s,t){return s!==t},BZCAx:function(s,t){return s|t},VbkOX:function(s,t){return s>>>t},ygboJ:function(s,t){return s!==t},EdFRc:function(s,t){return s+t},lpMBV:function(s,t){return s&t},jkJuF:function(s,t){return s!==t},GGTnW:function(s,t){return s>>>t},CHnoZ:function(s,t){return s>>>t},fYAKd:function(s,t){return s>>>t},hIHGz:function(s,t){return s&t},wAAiP:function(s,t){return s>>>t},gNZGs:function(s,t){return s&t},hqOOF:function(s,t){return s>>>t},yJUCB:function(s,t){return s!==t},mlwnl:function(s,t){return s|t},qdREp:function(s,t){return s&t},UjsBS:function(s,t){return s(t)},Gqnca:function(s,t){return s<<t},xlujM:function(s,t){return s|t},wlwSr:function(s,t){return s<<t},syzZZ:r(372),LBfZe:r(1611),CVrrN:function(s,t){return s|t},QgdRz:function(s,t){return s<<t},HYeVJ:function(s,t){return s|t},kVIxW:function(s,t){return s===t},wSSHu:function(s,t){return s<<t},pXIpc:function(s,t){return s|t},eNwFr:function(s,t){return s+t},cphzR:r(1036),ynpUJ:function(s,t){return s&t},TFsBg:function(s,t){return s&t},Uigis:function(s,t){return s&t},fYVSZ:function(s,t){return s>>>t},IacWc:function(s,t){return s&t},WumHW:function(s,t){return s>>>t},zDQub:function(s,t){return s(t)},OZUhm:function(s,t){return s%t},ZXNlL:function(s,t){return s*t},ewbQJ:function(s,t){return s+t},xWuVv:function(s,t){return s===t},YeRQL:function(s,t){return s===t},ABRZD:function(s,t){return s&t},YxYtW:function(s,t){return s>>>t},GbMjE:function(s,t){return s<<t},vdXBj:function(s,t){return s!==t},kTCaD:function(s,t){return s===t},JlTiC:function(s,t){return s>>>t},LOfTG:function(s,t){return s>>>t},YYuGT:function(s,t){return s===t},mlGPh:function(s,t){return s===t},aNdZY:function(s,t){return s===t},oBkyH:function(s,t){return s===t},iuJRn:function(s,t){return s+t},TNUVD:function(s,t){return s+t},SUIJr:function(s,t){return s&t},iOKDo:function(s,t){return s&t},HuSgK:function(s,t){return s&t},LSeNz:function(s,t){return s>>>t},jYCyv:function(s,t){return s>>>t},bfgSg:function(s,t){return s>>>t},psCYn:function(s,t){return s&t},XzXmc:function(s,t){return s>>>t},zGYXr:function(s,t){return s&t},gmmkg:function(s,t){return s&t},AMSvw:r(305)+r(900),VUJEL:r(333)+r(964),LcPhH:r(391)+"IES_ERROR",lAxtk:r(1475)+r(415),iRlGs:r(234)+"OR",edlEv:function(s,t){return s===t},lZOSB:r(821),kXEwH:"hAJfT",fThjL:r(463)+r(1190),avJbl:r(1235)+"4",AHPPF:function(s,t){return s===t},NVrTt:r(414),aNemw:function(s,t){return s<t},qQrFe:function(s,t){return s-t},ZPkVt:function(s,t){return s!==t},GsYjO:r(835),NjoNf:r(1392),Jldxb:r(1313),BPUAy:function(s,t){return s<t},tDgEu:function(s,t,n){return s(t,n)},Ngmzn:function(s,t,n,a){return s(t,n,a)},jTPuX:function(s,t){return s+t},ifWVt:r(1290),YvUQB:r(1231),ZYdVI:function(s,t,n){return s(t,n)},gPwTa:function(s,t){return s+t},lTNru:function(s,t){return s+t},qFAwc:function(s,t){return s&t},QqPDR:r(1364)+r(768)+r(569)+"1",nNipQ:function(s,t){return s>>>t},YUffE:function(s,t){return s|t},jMqIT:function(s,t){return s<t},nDnYK:function(s,t){return s<<t},holwm:function(s,t){return s&t},FIvuX:function(s,t){return s<t},hoHRi:function(s,t){return s|t},jTLiw:function(s,t){return s|t},XecCK:r(939),sbzjy:"eVmya",pMNKk:function(s,t){return s instanceof t},wJGue:r(210)+r(222),bJtpf:function(s,t){return s===t},UkELg:function(s,t){return s===t},dvMWd:function(s,t){return s===t},YIQih:r(331),TtFNT:function(s,t){return s===t},QvAIu:r(1246),VWDLJ:r(1403),zqhpd:r(280),zsllR:function(s,t,n){return s(t,n)},JCLpT:"utmNo",ejMaC:function(s,t){return s===t},vPYUm:r(830),ENDQv:function(s,t,n){return s(t,n)},jvqSA:function(s,t){return s instanceof t},MlUSv:function(s,t){return s===t},bZcoW:"lQMEc",SJFph:function(s,t){return s>=t},ArukK:function(s,t,n){return s(t,n)},OVCyy:r(826),jMVup:function(s,t){return s||t},lDjbL:function(s,t){return s||t},vebqO:r(1501)+"3",vhqck:function(s,t){return s||t},IzSxC:function(s,t){return s!=t},pCqYF:function(s,t){return s<t},SWNMj:function(s,t){return s===t},xqiJC:function(s,t){return s===t},yITNi:function(s,t){return s&t},QOSUq:function(s,t){return s+t},VdRSA:function(s,t){return s<t},zltOh:function(s,t){return s-t},KdFfR:function(s,t){return s>=t},rdcVf:function(s,t){return s<t},eHxXH:function(s,t){return s<<t},nnnvD:function(s,t){return s>=t},CLWDt:function(s,t){return s|t},CpnDx:function(s,t){return s|t},EjDuw:function(s,t){return s<<t},yAQEN:function(s,t){return s&t},RHhoe:function(s,t){return s<t},SUvhe:function(s,t){return s<t},IKjTs:function(s,t){return s>>t},knTFr:function(s,t){return s===t},xQLTg:function(s,t){return s===t},OLQYG:function(s,t){return s&t},Ovuhb:function(s,t){return s+t},xoNvP:function(s,t){return s|t},XxzFh:function(s,t){return s&t},oqIOm:function(s,t){return s==t},qdKfm:function(s,t){return s(t)},rRYsY:function(s,t,n,a){return s(t,n,a)},rhafF:function(s,t){return s instanceof t},CcKhk:"VUuEx",Dywsl:r(1179),irTdY:function(s,t){return s==t},xUZYu:"boe",wxaFr:r(880),iGRyb:function(s,t){return s===t},OfqQl:r(1649),ogQEI:r(354)+"reason",dDNhA:function(s,t){return s(t)},vgnBs:"script",oJZLq:r(363)+"ascript",ljCqZ:r(755)+r(1001)+r(1082)+"P",CRYsY:function(s,t){return s(t)},sZyJA:"pstVI",oZXhQ:"dFNBj",sbxWH:"rBaAX",zEIaS:function(s,t){return s!==t},cGyQo:"OEorf",sdSqZ:r(1524),vTABC:r(1021),bPVCK:function(s,t){return s|t},lylOS:function(s,t){return s<<t},NuRHI:function(s,t){return s|t},gdgIh:function(s,t){return s<<t},lQiDV:function(s,t){return s<<t},NfCcg:r(1043),hZoyn:r(1629),UNsWj:function(s,t){return s||t},ykNkV:function(s,t){return s||t},adeaq:"PcwPD",Applz:"GWLKK",crDyw:r(716),vqKvD:function(s,t){return s||t},HBEZy:function(s,t){return s(t)},neKDT:function(s,t){return s+t},hzCZy:r(499),woNyv:r(1285),EmsMa:function(s,t){return s||t},MqFhz:function(s,t){return s||t},jpmjV:r(1280),CRbRc:function(s,t){return s||t},IsdLE:r(279)+r(1647)+"d",PAhRm:function(s,t,n){return s(t,n)},yubWY:r(1568),EFhvO:r(675)+"id",yrSgd:function(s,t){return s&t},yTWVU:r(1537),XlCWq:function(s,t){return s(t)},DXkRb:function(s,t){return s(t)},UEAwa:r(227),BwONd:"ping_onc"+r(1187)+"s",uCUtX:"ping_onc"+r(395)+"t",LfxQH:r(271),LUckn:r(461),EBdwe:"x_frontier_qos",jaXCt:function(s,t,n,a){return s(t,n,a)},EVvpm:function(s,t,n,a){return s(t,n,a)},iEQSO:"x_fronti"+r(597)+"k",llkXX:r(1227)+r(268)+"sgid",DVbrv:function(s,t){return s<t},WOSWx:function(s,t){return s<t},XJxdP:function(s,t){return s&t},KLFrv:r(340),gIWRP:"need_ack",uLMlg:function(s,t,n,a){return s(t,n,a)},mvXkQ:"is_ack",eeRqg:function(s,t){return s&&t},GFTVq:r(635),cPvHe:"ack_code",ddHSh:"received",KtHCp:function(s){return s()},duisN:function(s,t){return s(t)},KllJE:function(s,t){return s(t)},aFXAl:function(s,t){return s instanceof t},yCeDL:function(s,t){return s instanceof t},rguyL:"binary",QoBVa:function(s,t){return s<t},bQYcd:function(s,t){return s>>>t},lFMoX:function(s,t){return s(t)},wrYvF:function(s,t){return s+t},ykFJx:function(s,t){return s+t},Rgoin:function(s,t){return s+t},bCMOV:"index out of range: ",GjcmJ:r(1029),UKQVo:r(202),TiMLW:function(s,t){return s>t},HPLgT:r(484)+r(192)+"e",CoMNV:function(s,t,n,a){return s(t,n,a)},YaZuB:function(s,t){return s+t},jXwCt:function(s,t){return s!==t},XxiwE:r(405),VXQCE:r(507),Assii:function(s,t,n){return s(t,n)},rQZoK:function(s,t){return s<<t},ZjOaa:r(607)+"1",eRpfV:function(s,t){return s+t},uUYoT:function(s,t,n,a){return s(t,n,a)},WapSh:function(s,t){return s+t},xJnpP:function(s,t){return s|t},TkegS:function(s,t){return s|t},oAUiR:function(s,t){return s+t},LfblZ:function(s,t){return s<<t},pFhQj:function(s,t){return s|t},FNpJM:function(s,t){return s+t},ImWcw:function(s,t){return s<<t},OEICc:function(s,t){return s===t},qhFxC:r(621),Ltmvo:function(s,t){return s&t},ihFhs:function(s,t){return s+t},vVqeY:function(s,t){return s&t},nqxAi:function(s,t){return s>>>t},bBccw:function(s,t){return s+t},jQAeZ:function(s,t){return s+t},ZZlga:function(s,t,n){return s(t,n)},ijorg:function(s,t,n,a){return s(t,n,a)},DPNYx:r(1598),esZLa:r(1662),DXrYA:function(s,t){return s&t},CwJfh:function(s,t){return s+t},wIvKv:function(s,t){return s<<t},Kemzs:function(s,t){return s<<t},lpOeB:function(s,t){return s>>>t},ogYmr:function(s,t){return s|t},kayYM:function(s,t){return s&t},Hnhhw:r(578),cwuwx:function(s,t){return s+t},ZWmHh:"8|5|7|0|"+r(916)+r(290),UibZk:function(s,t,n,a){return s(t,n,a)},LOgEN:r(1518),WIRrS:function(s,t,n,a){return s(t,n,a)},vyCTO:function(s,t,n,a){return s(t,n,a)},FUVaf:"service",xhRJb:r(1024)+r(568),EvYbU:"name",SoxnS:function(s,t){return s(t)},NsqZJ:r(972)+"ile_name",aFJHS:function(s,t){return s<t},RWOGS:function(s,t,n){return s(t,n)},lizlg:r(695)+r(1418),ljiae:function(s,t,n){return s(t,n)},kkaAO:r(1421)+"ame",RyJWO:"allCursorValues",PnMzp:r(1152),mFJGx:r(557),Iegfs:function(s){return s()},qnRHo:"setdb",xXyHt:function(s,t){return s*t},hCcqk:function(s,t){return s-t},pPkfQ:"lWeXi",KLsSW:function(s,t){return s(t)},SUJIy:"setcursor",MKmSy:function(s,t){return s!=t},wOMJl:r(1084),mUIpq:function(s,t){return s===t},MJfUe:r(242),UkFzI:function(s,t,n,a){return s(t,n,a)},YOWrE:"code",gKEsq:function(s,t,n){return s(t,n)},uAcFJ:"x_frontier_msgid",LuclI:"x_fronti"+r(1634),KzhjI:r(1251)+"s",wGnqz:function(s,t,n){return s(t,n)},IXNiD:r(944)+r(1384)+"e",IVDWR:function(s,t,n){return s(t,n)},HCwGt:r(944)+r(1590)+"ue",aIlnk:function(s,t){return s+t},vsSdI:function(s){return s()},lYcQE:function(s){return s()},fWoId:function(s){return s()},hWGZs:function(s){return s()},pbVPu:function(s,t){return s===t},lcdxG:function(s){return s()},DLDMw:function(s){return s()},srVNe:"RuRqo",bQYfQ:"kFjMe",FVPVZ:"KeKGq",GOfkR:function(s,t){return s(t)},CKgYM:function(s){return s()},ocNwd:function(s){return s()},bExEn:function(s,t){return s===t},mjbmY:function(s,t,n){return s(t,n)},PDeqb:function(s){return s()},kNJiC:function(s,t,n){return s(t,n)},lAcPE:function(s,t){return s!==t},ZxvMc:r(650),ipAMo:function(s,t,n){return s(t,n)},ZalyD:function(s,t){return s===t},NlEkC:"always",yzOuH:r(1349),JjPGb:r(446),aRQOl:function(s,t){return s/t},fnBxu:r(311)+r(1420)+r(976),AoXQh:function(s,t){return s(t)},gTkMU:r(311)+r(1105)+r(235)+r(582)+r(362)+r(579)+r(1341)+"ined",lsqJS:function(s,t){return s!==t},BEDLF:r(752),XDCGu:r(819),GYbOY:r(366)+"t",DOfma:r(590)+r(325)+r(180)+"ct",rhlZm:r(633),ZpXHN:"pageshow",BwHOv:function(s,t){return s!==t},oEFmA:r(671),zOAAA:r(1487),yfJwa:r(1304),nJPCr:r(323),ZBWzQ:r(1401),qeBFt:r(311)+"rovide b"+r(1595)+r(1670)+r(1429),gcfcQ:function(s,t){return s==t},ilsXA:"fws_1.0.0",ZlExg:r(1461),aaEoL:function(s,t){return s(t)},xKbAy:function(s,t){return s!==t},KxfPJ:"afzvP",beJpy:function(s,t,n){return s(t,n)},AOTMu:function(s,t){return s===t},YMAXv:r(1603),emrVq:function(s,t,n){return s(t,n)},CPrVq:r(1411),Zaraa:function(s,t){return s>t},PyIXp:function(s,t){return s-t},dZkZC:r(422),QRYqb:function(s,t){return s(t)},mTBNJ:function(s,t){return s*t},mOzqx:function(s,t){return s>t},iSVci:function(s,t){return s===t},RmkvX:r(1327),LBDoE:r(1092)+r(863)+r(366)+r(211)+r(1098),hlXJM:function(s,t){return s<<t},ahSVi:r(1329),GvQYd:function(s,t,n){return s(t,n)},OAolO:r(452)+r(1114)+r(904)+"g",Qzvxf:function(s,t){return s(t)},KhkoG:r(469),bnXsX:r(689),yXhtp:function(s,t){return s(t)},TQBkq:r(310),CxQLi:r(538)+"3",PGpqI:function(s,t){return s===t},XJGAn:function(s,t){return s===t},CHqrw:function(s,t,n,a){return s(t,n,a)},TXDxl:function(s,t,n){return s(t,n)},hUFOb:r(321),WcBGJ:r(200),NdRaY:function(s,t,n){return s(t,n)},rLpfX:r(1092)+r(669)+r(1219)+"ine",cFRAp:function(s,t,n){return s(t,n)},mCYDX:function(s,t){return s!==t},EeSRR:r(604),aYoYb:r(382),yMnab:function(s,t){return s>t},ivvqB:function(s,t){return s&t},Vtpdq:function(s,t){return s+t},bWELc:function(s,t){return s!==t},zyjSp:"FXVcb",vYben:r(345)+r(516),QxKxB:r(485)+r(425)+"y closed",LKQal:function(s,t){return s==t},Xskci:r(311)+"rovide a"+r(472)+"ata, data must be a string or an"+r(378)+r(510),ZGtKw:function(s,t){return s!=t},lDmlh:function(s,t){return s(t)},Krcsa:function(s,t){return s instanceof t},aIIkI:function(s,t){return s instanceof t},TJQvj:r(1333),xLbNC:function(s,t){return s<t},TXkth:"enqueue",hvKsD:r(1613)+"4",oOcDw:r(1372),YhmWh:"ToTlc",telDZ:function(s,t){return s===t},htjTg:"sGdmv",dCuRs:r(1482),BynVz:function(s,t){return s*t},sCyhv:function(s,t){return s*t},azxXJ:function(s,t){return s/t},SRexA:r(1479),ZrOni:function(s,t){return s!=t},IuXtO:function(s,t){return s===t},DBGQc:r(1163)+r(1437)+r(1452)+"pe",XscYl:function(s,t){return s!=t},apUPS:r(297),jhRoO:function(s,t){return s!=t},eJkrG:function(s,t){return s!=t},vaJjA:function(s,t){return s===t},oELFd:function(s,t){return s===t},zpoqe:"ServiceW"+r(401)+r(1188),MFpbB:function(s,t){return s!=t},OUYkC:function(s,t){return s===t},zHaJO:function(s,t){return s!=t},ZanQe:function(s,t){return s!=t}};Ce.r(Y),Ce.d(Y,{FWS:()=>n0,CustomErrorEvent:()=>ps,createCloseEvent:()=>pe,ReconnectEvent:()=>gs,createErrorEvent:()=>de,decodedFrame:()=>us,createOpenEvent:()=>vs,CustomCloseEvent:()=>ms,createReconnectEvent:()=>or,FrontierMessageEvent:()=>_s,encodeFrame:()=>ir,createMessageEvent:()=>bs,OpenEvent:()=>ys,ErrorCode:()=>qe,Event:()=>st,MessageEvent:()=>ws});let i="";function o(s=""){let t=r;if(e.wlwRp(e[t(799)],e[t(1389)]))return null;{let a=""+Date[t(299)](),u=i||(i=g(s)),p=Math[t(357)]()[t(197)](16)[t(596)](-6);return e[t(741)](e[t(1069)](e[t(926)]("02",a),u),p)}}function c(){let s=r;return e[s(745)](1e4,Date[s(299)]())+Math[s(1377)](1e4*Math[s(357)]())}function x(s){let t=r;return e[t(1456)]==="yrWHK"?_0x27cd32||(_0x39534f=[_0x4c89ff,_0x2028c4,_0xfb2cc7,_0x5333dd,_0x3d662c]):(e[t(398)](Array,8)[t(969)]("0")+parseInt(s,10).toString(2))[t(596)](-8)}function f(s){let t=r;return e[t(692)](e[t(398)](Array,4)[t(969)]("0"),parseInt(s,2)[t(197)](16)).slice(-4)}function d(s){let t=r,n=s.split(/\./)[t(1259)](p=>x(p)),a=[];return a[0]=e[t(398)](f,e[t(1651)](n[0],n[1])),a[1]=e[t(823)](f,e[t(459)](n[2],n[3])),[e.UbWCF,e[t(1441)],e[t(1441)],e[t(1441)],e[t(1441)],t(1556),a[0],a[1]][t(969)]("")}function g(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(165)](s),a=/(([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(165)](s);return n?e.tOdAD(d,s):a?w(s):e[t(875)]}function w(s){let t=r,n={keOjA:function(_,v){return _ instanceof v},yZFhy:function(_,v){return _ instanceof v},ipFIV:e[t(630)],lVsFX:function(_,v){return e[t(1328)](_,v)},DPmRb:e[t(717)]},a="",u=[],p=0,h=0,m=!0,l=e.UbWCF;if(e.vFnQR(s.indexOf("::"),-1))if(e.RbJOC(e[t(1386)],t(849))){let _=s[t(460)]("::");for(let A=0;e[t(1398)](A,_[t(1620)]);A++)if(e[t(687)](e[t(891)],t(539))){let N=_[A];if(e.krYLt(N[t(1648)](":"),0)){let R=N[t(460)](":");m&&(p=R[t(1620)]),h+=R[t(1620)];for(let O=0;e[t(308)](O,R.length);O++)if(e.mlFmS(4,R[O].length)){let ie=l[t(1388)+"g"](0,4-R[O][t(1620)]),ce=ie[t(1419)](R[O]);u[t(251)](ce)}else u[t(251)](R[O]);m=!1}else if(e[t(687)]("Tujrd",e[t(451)])){if(e[t(1644)](4,N.length)){let R=l.substring(0,e[t(289)](4,N[t(1620)])),O=R.concat(N);u[t(251)](O)}else u[t(251)](N);m&&(p+=1),h+=1,m=!1}else this[t(1165)]&&this[t(1165)].close(_0x33bd92,_0x219745)}else{if(_0x45198d)return new _0x26c2f8(_0x169ff3[t(1045)],_0x37b2ee[t(402)]);if(_0xebb754||_0x2d4ded)return new _0x300e97(_0x436ae9.url,_0x57c396[t(402)],_0x28cb46.headers);if(e[t(254)](_0x1c3036,_0x32bae7)&&e[t(359)](e[t(577)],typeof _0x52148a)&&_0x184f2f)return new _0xfe1c7e(_0x2f22a3[t(1045)],_0x5d5496[t(402)+"s"])}let v="";for(let A=0;e.PDGrM(A,e.ZgdZA(8,h));A++)v=v.concat(l);for(let A=0;e[t(308)](A,u[t(1620)]);A++)e[t(687)](A,p)&&(a=a[t(1419)](v)),a=a[t(1419)](u[A]);return a}else return this[t(1165)]?this[t(1165)][t(402)]:"";{let _=s[t(460)](":");for(let v=0;e[t(1183)](v,_.length);v++)if(e.RJRYw(e[t(658)],t(1138))){let A=_[v];if(e[t(233)](4,_[v][t(1620)])){let N=l[t(1388)+"g"](0,e[t(289)](4,_[v][t(1620)])),R=N[t(1419)](A);a=a[t(1419)](R)}else a=a[t(1419)](A)}else try{return t(1435)!=typeof _0x4dc93b&&(n[t(513)](_0x554fd4,_0x42fa3b)||_0x5d81f7[t(506)]&&n[t(1062)](_0x1aefa7[t(506)],_0x58ac6d))||typeof _0x24779b!="string"?"":(_0x485c8e[t(524)](_0x53d091),n[t(296)])}catch{return n[t(877)](t(1435),typeof _0x832a88)?n[t(188)]:""}return a}}function b(s,t){let n=r;if(e[n(1249)]!==e[n(1249)])return _0x88c35f&&e[n(1387)](!0,_0x52d4d2.isLong);{let a=s[n(548)];e[n(614)](void 0,a)&&(J(t,10),be(t,a));let u=s[n(183)];e[n(1644)](void 0,u)&&(J(t,18),e[n(760)](be,t,u))}}function y(s){let t=r,n={};e:for(;!ke(s);){let a=e.MFmaL(K,s);switch(e[t(304)](a,3)){case 0:break e;case 1:n[t(548)]=e.WddEc(ye,s,e[t(823)](K,s));break;case 2:n[t(183)]=e[t(1023)](ye,s,K(s));break;default:e[t(760)](re,s,e[t(349)](7,a))}}if(n[t(548)]===void 0)throw new Error(e.GONtZ);if(e[t(687)](void 0,n.value))throw new Error(e[t(490)]);return n}function C(s){let t=r,n=e[t(1560)](ae);return e[t(760)](P,s,n),e.dMJtd(j,n)}function P(s,t){let n=r;if(e[n(1644)](e[n(1316)],e.QiwQG)){let a=s.SeqID;e[n(1644)](void 0,a)&&(e[n(1370)]("nHQqH",e.EZmvK)?(this[n(520)+n(1660)]=_0x49a4ae,this._cursorFileName=_0x153778,this[n(431)+n(161)]=_0x41935b,this[n(1184)]=e[n(1156)](_0xb4bee3,this[n(520)+n(1660)],n(1421)+"ame")):(J(t,8),St(t,a)));let u=s[n(417)];e[n(173)](void 0,u)&&(e[n(256)](J,t,16),e[n(256)](St,t,u));let p=s[n(249)];e.xdFzX(void 0,p)&&(e[n(1156)](J,t,24),e.vuCYk(St,t,e[n(159)](Q,p)));let h=s.method;e.BfdBk(void 0,h)&&(e[n(760)](J,t,32),e.vuCYk(St,t,e[n(847)](Q,h)));let m=s.headers;if(e[n(1099)](void 0,m))for(let ie of m){J(t,42);let ce=e[n(1194)](ae);b(ie,ce),e.AKAFu(J,t,ce[n(1466)]),e[n(977)](Jt,t,ce),e.lDePF(D,ce)}let l=s["payloadE"+n(320)];e.NJPmC(void 0,l)&&(e[n(1023)](J,t,50),e[n(977)](be,t,l));let _=s["payloadT"+n(1237)];_!==void 0&&(e[n(893)](J,t,58),e[n(256)](be,t,_));let v=s[n(1207)];e[n(470)](void 0,v)&&(e.WMroi(J,t,66),e.RNWbC(J,t,v.length),e[n(1638)](jt,t,v));let A=s[n(352)];e[n(233)](void 0,A)&&(e[n(853)](J,t,74),e[n(444)](be,t,A));let N=s[n(492)+n(419)];e[n(508)](void 0,N)&&(e[n(1223)](J,t,82),e.kfPVE(be,t,N));let R=s[n(284)];R!==void 0&&(e[n(1079)]==="ipktL"?(J(t,90),e.cdwXw(be,t,R)):(this[n(1412)](e[n(544)],_0x173996),this[n(552)+"e"]&&this[n(552)+"e"](_0x3cb98e)));let O=s[n(447)+"e"];O!==void 0&&(J(t,96),e.suwHa(St,t,Q(O)))}else return new _0xfee87(_0x240748,{code:_0xd0e5c2,reason:_0x5dcfba,wasClean:_0x346c8d,willReconnect:_0x1608b5})}function I(s){return T(e.GCMwy(q,s))}function T(s){let t=r;if(e[t(1455)](e[t(1310)],e[t(1272)]))_0x27ca1b(_0xdc3803,10),e[t(256)](_0x2bb230,_0x37b59b,_0x3606d5);else{let n={};e:for(;!e[t(1351)](ke,s);){let a=K(s);switch(a>>>3){case 0:break e;case 1:n.SeqID=e[t(1674)](Pe,s,!0);break;case 2:n[t(417)]=e[t(1339)](Pe,s,!0);break;case 3:n[t(249)]=e.gCTCg(K,s);break;case 4:n[t(1083)]=e.IvFWe(K,s);break;case 5:{let u=e[t(598)](z,s);(n[t(1340)]||(n[t(1340)]=[]))[t(251)](y(s)),s[t(1466)]=u;break}case 6:n[t(230)+t(320)]=e[t(1023)](ye,s,e[t(742)](K,s));break;case 7:n[t(1195)+t(1237)]=e[t(760)](ye,s,e.yYUNd(K,s));break;case 8:n.payload=e[t(629)](vt,s,e[t(1332)](K,s));break;case 9:n.LogIDNew=e[t(1270)](ye,s,e.TzedB(K,s));break;case 10:n[t(492)+"ming"]=ye(s,K(s));break;case 11:n[t(284)]=e[t(843)](ye,s,e[t(693)](K,s));break;case 12:n.frameType=e[t(1351)](K,s);break;default:e[t(256)](re,s,e[t(940)](7,a))}}if(e[t(687)](void 0,n[t(909)]))throw new Error(t(1350)+"required field: "+t(909));if(e[t(1433)](void 0,n.LogID))throw new Error(e[t(1476)]);if(n.service===void 0)throw new Error(t(1350)+t(1048)+t(587)+t(249));if(e[t(252)](void 0,n.method))throw new Error(e.VJehl);return n}}function z(s){let t=r,n=K(s),a=s[t(1466)];return s.limit=e[t(1069)](s[t(983)],n),a}function re(s,t){let n=r;switch(t){case 0:for(;e[n(940)](128,se(s)););break;case 2:e[n(224)](Z,s,e.pkJgn(K,s));break;case 5:e[n(760)](Z,s,4);break;case 1:e.AKAFu(Z,s,8);break;default:throw new Error(e[n(1651)](e.htlrg,t))}}function Q(s){let t=r;return s|=0,{low:s,high:e[t(798)](s,31),unsigned:e[t(606)](s,0)}}let _e=[];function ae(){let s=r,t=_e.pop();return t?(t[s(983)]=t[s(1466)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function D(s){_e.push(s)}function q(s){return{bytes:s,offset:0,limit:s[r(1620)]}}function j(s){let t=r,n=s[t(385)],a=s[t(1466)];return e.tAKWU(n.length,a)?n:n[t(1220)](0,a)}function Z(s,t){let n=r,a={KTBel:function(u,p){return e[k(731)](u,p)},HzXIQ:n(743)+"in;chars"+n(1255),piHza:e[n(1490)],HGuCd:e[n(1118)],XEqEK:e[n(1553)],oSkHn:n(956),Fquiq:function(u,p,h,m){return e[n(384)](u,p,h,m)}};if(e.nMjXx(e[n(380)],n(1469))){if(e.kBVrP(e.SGJdK(s[n(983)],t),s[n(1466)]))throw new Error(e[n(1292)]);s[n(983)]+=t}else{let u=a[n(1457)](this[n(163)][n(230)+n(320)],_0x5485a0)?{force:!!this[n(163)][n(230)+"ncoding"].force,encoding:this[n(163)]["payloadE"+n(320)][n(993)]?this[n(163)][n(230)+n(320)][n(993)].replace(/\s/g,"")["toLowerC"+n(337)]():""}:{force:!1,encoding:this._options[n(230)+"ncoding"]?this[n(163)][n(230)+n(320)][n(1317)](/\s/g,"")["toLowerC"+n(337)]():""},p=_0x91a7e6[n(230)+n(320)]?_0x4591b8[n(230)+"ncoding"][n(1317)](/\s/g,"")[n(1077)+"ase"]():"",h=a[n(1457)](this._options.payloadType,_0x4d7f44)?{force:!!this._options[n(1195)+"ype"][n(766)],type:this[n(163)][n(1195)+n(1237)][n(1307)]?this[n(163)][n(1195)+n(1237)][n(1307)].replace(/\s/g,"")[n(1077)+n(337)]():""}:{force:!1,type:this[n(163)]["payloadT"+n(1237)]?this[n(163)][n(1195)+n(1237)].replace(/\s/g,"")[n(1077)+n(337)]():""},m=_0x5ef06f[n(1195)+n(1237)]?_0x132bf2[n(1195)+n(1237)][n(1317)](/\s/g,"")[n(1077)+"ase"]():"",l=h[n(766)]?h.type:m||h[n(1307)],_=u[n(766)]?u[n(993)]:p||u[n(993)],v=[a.HzXIQ,"applicat"+n(1596),a[n(754)],a[n(246)]],A=[a[n(1169)],a.oSkHn];this._options[n(947)+"ansformTextPayload"]&&v[n(1131)](l)&&(!_||A[n(1131)](_))?_0x206145["textPayl"+n(1500)]=a[n(749)](_0x216d8f,_0x9edf5a[n(1207)],0,_0x1b805b[n(1207)].byteLength):_0x2a62b3[n(370)+n(1500)]=""}}function ke(s){let t=r;return s[t(983)]>=s[t(1466)]}function ge(s,t){let n=r,a=s[n(385)],u=s.offset,p=s[n(1466)],h=e[n(459)](u,t);if(e[n(1041)](h,a[n(1620)])){let m=new Uint8Array(e.WjQiS(2,h));m[n(885)](a),s[n(385)]=m}return s[n(983)]=h,e[n(910)](h,p)&&(s[n(1466)]=h),u}function Ve(s,t){let n=r;if(e[n(173)](e[n(1178)],e[n(1178)]))this[n(751)+"er"]&&_0x1ae108[n(923)+"entListe"+n(231)](e.bCODv,this._handleOnLine),this._isBrowser&&_0x22de46[n(923)+n(1204)+n(231)](e[n(1291)],this[n(1640)+"ffLine"]),this[n(751)+"er"]&&_0x54e73a[n(923)+n(1204)+"ner"](e[n(673)],this["_handleP"+n(709)]),this[n(751)+"er"]&&_0x37d1b2[n(923)+n(1204)+n(231)](n(933),this._handlePageShow);else{let a=s[n(983)];if(e[n(741)](a,t)>s[n(1466)])throw new Error(e[n(1051)]);return s.offset+=t,a}}function vt(s,t){let n=r,a=e[n(777)](Ve,s,t);return s.bytes[n(1220)](a,e.aIJoC(a,t))}function jt(s,t){let n=r,a=ge(s,t[n(1620)]);s[n(385)][n(885)](t,a)}function ye(s,t){let n=r,a=e[n(1270)](Ve,s,t),u=String[n(1352)+n(487)],p=s[n(385)],h="\uFFFD",m="";for(let l=0;l<t;l++){let _=p[l+a],v,A,N,R;if(e.oBKju(e[n(349)](128,_),0))m+=e[n(676)](u,_);else if(e[n(1381)](224&_,192))if(e.aaazC(l,1)>=t)m+=h;else if(v=p[e[n(896)](e[n(1069)](l,a),1)],e.yXuYW(192,v)!==128)m+=h;else if(R=e[n(706)](e.hfUom(e[n(940)](31,_),6),e[n(1394)](63,v)),e[n(837)](R,128))m+=h;else if(e[n(1608)]("IEtPO",e[n(403)]))m+=e[n(1612)](u,R),l++;else{let O=this._qosDB[n(954)+n(714)+"nc"](this[n(1522)]),ie=_0x193ff1[n(524)](e.WPuMK(O,"{}"));return _0x28cc2a[n(257)](ie)}else if((240&_)==224)if(e[n(606)](e.rZTTv(l,2),t))m+=h;else if(e[n(1433)](e[n(1185)],e[n(1185)]))v=p[e[n(741)](e[n(1142)](l,a),1)],A=p[e.tyQyO(e[n(1572)](l,a),2)],e[n(233)](e.gvPyz(e.nyMaF(v,e[n(1363)](A,8)),49344),32896)?m+=h:(R=e.mqCMZ(e[n(1451)](e.hfUom(e.POiXI(15,_),12),e[n(840)](e[n(1526)](63,v),6)),e[n(1394)](63,A)),R<2048||e.bOGwF(R,55296)&&R<=57343?m+=h:(m+=e[n(999)](u,R),l+=2));else{let{url:O}=e[n(816)](_0x44c18f,{}),ie=_0x3ba679[n(171)](O)?O:e.hyNJv(e[n(1118)],typeof O)?[O]:[];_0x5d5c96&&_0x4c8a9c[n(1038)](this[n(163)],_0x4214d0),ie&&ie[n(1620)]?this["_endpoin"+n(1117)]=new _0x33be74(ie,this._options[n(326)+"es"]):this[n(1287)+"tManager"]?.[n(1657)+n(1124)+n(1072)](),this._pingLossCounter?.[n(273)+n(1355)](this[n(163)][n(281)+"Count"]),this[n(1414)+n(626)]=!1,this[n(1165)]&&e[n(173)](this[n(1165)][n(1110)+"te"],this[n(1449)])?this[n(387)+"ect"](1e3,e[n(1408)],!0):(this[n(314)]=!0,this[n(989)]())}else e[n(940)](248,_)==240?e.bOGwF(l+3,t)?m+=h:(v=p[e[n(1160)](e[n(1069)](l,a),1)],A=p[e[n(1160)](l+a,2)],N=p[e[n(896)](e[n(1160)](l,a),3)],e[n(349)](e.kPCuh(v|e[n(1123)](A,8),e.svlZJ(N,16)),12632256)!==8421504?m+=h:(R=e.nyMaF(e.JjxYl(e.FCRmi(7&_,18),e[n(825)](e[n(1394)](63,v),12))|e[n(1468)](e[n(1630)](63,A),6),e[n(1526)](63,N)),R<65536||R>1114111?m+=h:e[n(922)]===e.VpFbo?_0x434f28[n(775)](_0x57708f):(R-=65536,m+=e[n(1674)](u,e[n(1572)](e.PLpDJ(R,10),55296),e[n(1651)](e[n(1607)](1023,R),56320)),l+=3))):m+=h}return m}function be(s,t){let n=r,a={gxerK:function(l,_){return l(_)}},u=t[n(1620)],p=0;for(let l=0;e[n(837)](l,u);l++){let _=t.charCodeAt(l);e.bOGwF(_,55296)&&_<=56319&&e.RXAbU(e[n(1619)](l,1),u)&&(_=e[n(1559)](e[n(1123)](_,10)+t[n(1499)+"At"](++l),56613888)),p+=e[n(1183)](_,128)?1:e.VbgeG(_,2048)?2:_<65536?3:4}e[n(584)](J,s,p);let h=e[n(1674)](ge,s,p),m=s.bytes;for(let l=0;e[n(194)](l,u);l++){let _=t.charCodeAt(l);e.bOGwF(_,55296)&&e[n(440)](_,56319)&&e[n(491)](e[n(1572)](l,1),u)&&(_=e[n(1059)](e[n(1174)](e[n(646)](_,10),t.charCodeAt(++l)),56613888)),e.lkNxC(_,128)?m[h++]=_:e[n(1387)](e.FNbMP,e[n(984)])?(e[n(194)](_,2048)?m[h++]=e[n(1210)](e[n(726)](_,6),31)|192:(e.nNLHu(_,65536)?m[h++]=e[n(1006)](e[n(798)](_,12),15)|224:(m[h++]=e[n(706)](_>>18&7,240),m[h++]=e[n(725)](e[n(1607)](e[n(726)](_,12),63),128)),m[h++]=e.ZSDPY(e[n(798)](_,6),63)|128),m[h++]=e[n(706)](e[n(1006)](63,_),128)):_0x3de399(ViLMfD[n(426)](_0x18bc81,_0x3f6018[n(585)]),_0x23c599[n(465)+"on"],_0x9c94ef[n(920)+"on"],_0xfd4be(_0x270c3e[n(770)+n(327)]))}}function Jt(s,t){let n=r;if(e.xdFzX(e.YrniR,n(196))){let a=ge(s,t.limit),u=s[n(385)],p=t[n(385)];for(let h=0,m=t[n(1466)];e[n(1542)](h,m);h++)u[h+a]=p[h]}else _0x34336a[n(307)]()[n(1e3)](()=>{let a=n;this[a(1305)+a(727)]()})}function se(s){return s[r(385)][e.kfPVE(Ve,s,1)]}function Vt(s,t){let n=r,a=e.JotkY(ge,s,1);s[n(385)][a]=t}function K(s){let t=r,n=0,a=0,u;do u=e[t(598)](se,s),e[t(783)](n,32)&&(a|=e[t(1468)](e[t(393)](127,u),n)),n+=7;while(e.hYTXe(128,u));return a}function J(s,t){let n=r;for(t>>>=0;t>=128;)e[n(252)]("GkSZW",e[n(1244)])?(e[n(1578)](Vt,s,e.klfFW(127&t,128)),t>>>=7):(CSsDJD[n(693)](_0x9d436,_0x431a27[n(939)]),CSsDJD[n(501)](_0x59b347));e.EnKdD(Vt,s,t)}function Pe(s,t){let n=r,a=0,u=0,p=0,h;return h=e.yYUNd(se,s),a=e.kFCEh(127,h),e[n(1512)](128,h)&&(h=e[n(1233)](se,s),a|=e[n(728)](e[n(1150)](127,h),7),e[n(283)](128,h)&&(h=e[n(598)](se,s),a|=e[n(168)](e[n(1135)](127,h),14),e.sCAUC(128,h)&&(h=e[n(1151)](se,s),a|=e[n(1665)](e[n(267)](127,h),21),e.rLSfM(128,h)&&(h=e[n(1464)](se,s),u=127&h,e.WldRR(128,h)&&(h=e[n(1060)](se,s),u|=e[n(168)](e.Luxnm(127,h),7),e[n(1630)](128,h)&&(h=e[n(742)](se,s),u|=e[n(392)](127,h)<<14,128&h&&(h=e[n(1472)](se,s),u|=e[n(1337)](e[n(511)](127,h),21),e[n(1100)](128,h)&&(h=e[n(742)](se,s),p=e[n(283)](127,h),e.rLSfM(128,h)&&(h=e[n(693)](se,s),p|=e.rLSfM(127,h)<<7))))))))),{low:a|e[n(586)](u,28),high:e[n(897)](e[n(1654)](u,4),e.rMfQP(p,24)),unsigned:t}}function St(s,t){let n=r,a=e[n(304)](t[n(371)],0),u=e.dUNcv(t[n(371)]>>>28|e[n(1297)](t[n(1075)],4),0),p=t.high>>>24,h=e.IaOzi(0,p)?e[n(223)](0,u)?e.BnScK(a,16384)?e[n(1189)](a,128)?1:2:e.IfPnD(a,2097152)?3:4:u<16384?e.nrPOu(u,128)?5:6:e[n(905)](u,2097152)?7:8:e[n(1519)](p,128)?9:10,m=e[n(854)](ge,s,h),l=s[n(385)];switch(h){case 10:l[m+9]=e[n(1655)](p>>>7,1);case 9:l[e.Eqabe(m,8)]=e.UvXhX(9,h)?e[n(725)](128,p):127&p;case 8:l[e[n(1232)](m,7)]=e[n(1049)](8,h)?e[n(1393)](e[n(304)](u,21),128):e[n(1394)](u>>>21,127);case 7:l[e.LOHLY(m,6)]=e[n(856)](7,h)?e[n(1473)](u>>>14,128):e[n(489)](e[n(1318)](u,14),127);case 6:l[e[n(1174)](m,5)]=e[n(895)](6,h)?e.dUNcv(u,7)|128:e[n(392)](u>>>7,127);case 5:l[e[n(764)](m,4)]=h!==5?128|u:e.lpMBV(127,u);case 4:l[e[n(1496)](m,3)]=e[n(1514)](4,h)?e[n(1258)](e[n(247)](a,21),128):e[n(940)](e[n(767)](a,21),127);case 3:l[e.rZTTv(m,2)]=e.RjeHz(3,h)?e.RFcAb(e[n(1242)](a,14),128):e[n(832)](e.GGTnW(a,14),127);case 2:l[e[n(164)](m,1)]=e.ygboJ(2,h)?e[n(706)](e[n(1253)](a,7),128):e[n(266)](e[n(1628)](a,7),127);case 1:l[m]=e[n(1525)](1,h)?e[n(318)](128,a):e.qdREp(127,a)}}function us(s){return e[r(876)](I,s)}function ir(s){return C(s)}let fs=65536,la=r(925),rt=e[r(1120)](fs,fs),ds=e[r(1378)](rt,rt),ls=e[r(915)](ds,2),ze=String.prototype[r(1499)+"At"];class M{constructor(t,n,a){let u=r;this[u(1558)]=!0,this[u(371)]=e[u(318)](0,t),this.high=0|n,this[u(278)]=!!a}static[r(1558)](t){return t&&t[r(1558)]===!0}static[r(1367)](t,n,a){return new M(t,n,a)}static[r(677)+"s"](t,n,a){let u=r;return a?M[u(677)+u(1562)](t,n):M[u(677)+u(1324)](t,n)}static[r(677)+r(1562)](t,n){let a=r;return new M(e[a(725)](e[a(706)](e[a(725)](t[0],e.hfUom(t[1],8)),e[a(347)](t[2],16)),e[a(347)](t[3],24)),e[a(941)](e[a(1451)](e[a(1258)](t[4],e[a(589)](t[5],8)),e[a(840)](t[6],16)),e[a(1123)](t[7],24)),n)}static["fromByte"+r(1324)](t,n){let a=r;if(e.qqiQr(e[a(973)],e[a(1139)]))return new M(e.mqCMZ(e[a(674)](t[4]<<24|e[a(988)](t[5],16),t[6]<<8),t[7]),e[a(1258)](e[a(1095)](t[0]<<24,e[a(864)](t[1],16)),e[a(1468)](t[2],8))|t[3],n);_0x219812[a(775)](_0x183c98)}static[r(1282)](t){let n=r;return e[n(158)](t,la)?hs:new M((ze.call(t,0)|e.wSSHu(ze[n(1407)](t,1),8)|ze[n(1407)](t,2)<<16|e.tFOfr(ze[n(1407)](t,3),24))>>>0,e[n(1628)](e[n(1239)](e[n(386)](ze[n(1407)](t,4),e[n(825)](ze[n(1407)](t,5),8)),e[n(1665)](ze[n(1407)](t,6),16))|e.rMfQP(ze[n(1407)](t,7),24),0),!0)}toHash(){let t=r;return e.RbJOC(e[t(1520)],t(1036))?_0x396361[t(1037)+"8"]?{value:_0x160db2.readUInt8(_0xeb44c3),offset:e[t(1174)](_0x2a0c0f,1)}:{value:e[t(393)](255,_0x296fff[_0x18e83c]),offset:e[t(420)](_0x5a48d5,1)}:String[t(1352)+t(487)](e.ynpUJ(255,this[t(371)]),e.TFsBg(e[t(1654)](this[t(371)],8),255),e.Uigis(e[t(1253)](this[t(371)],16),255),e[t(562)](this[t(371)],24),e.sCAUC(255,this[t(1075)]),e[t(1394)](e.wAAiP(this[t(1075)],8),255),e[t(1458)](this[t(1075)]>>>16,255),e[t(364)](this.high,24))}static fromNumber(t,n=!0){let a=r;if(e[a(862)](isNaN,t))return n?ha:hs;if(n){if(t>=ds)return pa}else{if(e[a(440)](t,-ls))return ma;if(e[a(606)](e[a(1651)](t,1),ls))return ga}return M.fromBits(e.OZUhm(t,rt)|0,e[a(706)](t/rt,0),n)}[r(1617)](){let t=r;return this[t(278)]?e[t(420)](e[t(1240)](this[t(1075)]>>>0,rt),this.low>>>0):e[t(1503)](e[t(745)](this[t(1075)],rt),this[t(371)]>>>0)}[r(917)](){let t=r;return e.xWuVv(0,this[t(1075)])&&e[t(1546)](0,this[t(371)])}[r(848)](t){let n=r;M.isLong(t)||(t=M[n(1164)+"er"](t));let a=e[n(562)](this[n(1075)],16),u=e[n(1427)](65535,this.high),p=e[n(1431)](this.low,16),h=e[n(1458)](65535,this[n(371)]),m=e[n(1654)](t.high,16),l=e.kFCEh(65535,t[n(1075)]),_=t.low>>>16,v=e[n(737)](65535,t[n(371)]),A=0,N=0,R=0,O=0;return O+=e[n(459)](h,v),R+=e[n(247)](O,16),O&=65535,R+=e[n(896)](p,_),N+=e[n(1654)](R,16),R&=65535,N+=e[n(1174)](u,l),A+=e[n(1242)](N,16),N&=65535,A+=a+m,A&=65535,M[n(1367)](e[n(706)](e.rMfQP(R,16),O),e.GbMjE(A,16)|N,this.unsigned)}[r(784)](t){let n=r;return M[n(1558)](t)||(t=M.fromNumber(t)),e[n(1382)](this[n(278)],t[n(278)])&&e[n(334)](e[n(950)](this[n(1075)],31),1)&&e[n(1663)](e[n(1480)](t[n(1075)],31),1)?!1:e[n(1495)](this[n(1075)],t[n(1075)])&&e[n(1495)](this[n(371)],t[n(371)])}[r(640)](){let t=r;return e.mlGPh(-1,this.low)&&e.aNdZY(-1,this[t(1075)])?M[t(1367)](0,0,this[t(278)]):e[t(685)](-1,this[t(371)])?M[t(1367)](0,e.iuJRn(this.high,1),this.unsigned):M[t(1367)](e[t(535)](this[t(371)],1),this[t(1075)],this[t(278)])}toBytes(t){let n=r;return t?this[n(551)+"E"]():this[n(374)+"E"]()}[r(551)+"E"](){let t=r,n=this[t(1075)],a=this[t(371)];return[e[t(361)](255,a),e[t(189)](a>>>8,255),a>>>16&255,a>>>24,e[t(1286)](255,n),e[t(1150)](e.fYAKd(n,8),255),e[t(767)](n,16)&255,e[t(950)](n,24)]}[r(374)+"E"](){let t=r,n=this[t(1075)],a=this[t(371)];return[e.LSeNz(n,24),e[t(1630)](n>>>16,255),e[t(511)](e[t(547)](n,8),255),e[t(1286)](255,n),e.bfgSg(a,24),e.psCYn(e[t(845)](a,16),255),e[t(1376)](a>>>8,255),e[t(1569)](255,a)]}}let hs=new M(0,0,!1),ha=new M(0,0,!0),ga=M.fromBits(-1,2147483647,!1),pa=M[r(1367)](-1,-1,!0),ma=M[r(1367)](0,-2147483648,!1);var qe=(function(s){let t=r;return s[s[e[t(1234)]]=5001]=e[t(1234)],s[s[e.VUJEL]=5002]=e[t(1005)],s[s[e.LcPhH]=5003]=e[t(1601)],s[s[e.lAxtk]=5004]=e.lAxtk,s[s[e.iRlGs]=5005]=e[t(887)],s})({});class st{constructor(t){let n=r;this[n(1307)]=t,this[n(911)]=null}}class gs extends st{constructor(t,n){let a=r;super(t),this.message=n&&n[a(1200)]||null}}class ps extends st{constructor(t,n){let a=r;if(e[a(486)](e[a(1055)],e[a(1104)]))this._listeners={};else{let u=e[a(477)].split("|"),p=0;for(;;){switch(u[p++]){case"0":super(t);continue;case"1":this[a(1200)]=n&&n[a(1200)]||"";continue;case"2":this[a(443)]=n&&n.colno||0;continue;case"3":this[a(1497)]=n&&n[a(1497)]||"";continue;case"4":this[a(545)]=n&&n[a(545)]||0;continue;case"5":this.error=n&&n[a(939)]||null;continue;case"6":this[a(793)]=n&&n[a(793)]||5001;continue}break}}}}class ms extends st{constructor(t,n){let a=r,u=e[a(1504)][a(460)]("|"),p=0;for(;;){switch(u[p++]){case"0":super(t);continue;case"1":this[a(793)]=n&&n.code||0;continue;case"2":this[a(942)]=n&&n[a(942)]||"";continue;case"3":this[a(195)]=n&&n.wasClean||!1;continue;case"4":this["willReco"+a(232)]=n&&n[a(914)+a(232)]||!1;continue}break}}}class ws extends st{constructor(t,n){let a=r;e[a(1191)](e[a(1616)],e[a(1616)])?(super(t),this[a(1436)]=n&&n[a(1436)]||null):_0x30a5d9&&this[a(1397)+a(694)][a(1637)+"rsorFile"+a(1217)](_0x11af2b)}}class _s extends ws{constructor(t,n){let a=r;super(t),this.data=n&&n[a(1436)]||null,this[a(1200)]=n&&n.message||null}}class ys extends st{constructor(t,n){let a=r;super(t),this[a(1436)]=n&&n[a(1436)]||null}}function de(s,{message:t,code:n,error:a}){let u=r;if(e[u(519)](e[u(350)],e.NjoNf))return new ps(s,{message:t,code:n,error:a});{let p=_0x4b8411[u(460)](":");_0x30616a&&(_0x1df70c=p.length),_0x50f9e9+=p[u(1620)];for(let h=0;e[u(458)](h,p[u(1620)]);h++)if(e[u(1514)](4,p[h][u(1620)])){let m=_0x57aead[u(1388)+"g"](0,e[u(204)](4,p[h][u(1620)])),l=m[u(1419)](p[h]);_0x305b3e[u(251)](l)}else _0x373c78.push(p[h]);_0x1aa6b5=!1}}function pe(s,{code:t,reason:n,wasClean:a,willReconnect:u}){return new ms(s,{code:t,reason:n,wasClean:a,willReconnect:u})}function bs(s,{data:t,message:n}){let a=r;return e.kTCaD(e.Jldxb,a(1313))?new _s(s,{data:t,message:n}):e.hyNJv(e[a(1118)],typeof _0x5a3f8a)?e.oNftm:""}function vs(s,{data:t}){return new ys(s,{data:t})}function or(s,{message:t}){return new gs(s,{message:t})}class Ss{constructor(t,n){let a=r;this[a(1415)+"s"]=t,this[a(326)+"es"]=n,this[a(946)+a(286)]=0,this[a(1425)+a(1168)+"riesCount"]=0}[r(1657)+r(1124)+r(1072)](){let t=r;this["currentI"+t(286)]=0,this[t(1425)+t(1168)+t(634)+"t"]=0}resetTries(){let t=r;this[t(1425)+t(1168)+t(634)+"t"]=0}[r(1539)+r(319)+"nt"](){let t=r;return this[t(1415)+"s"][this[t(946)+"ndex"]]}[r(1539)+r(319)+r(698)+"ount"](){let t=r;return this[t(1425)+t(1168)+t(634)+"t"]}checkReachMaxTries(){let t=r;if(e[t(519)](e[t(1439)],e[t(838)]))return!!(e.bOGwF(this[t(946)+"ndex"],this[t(1415)+"s"][t(1620)])||e.kTCaD(this["currentI"+t(286)],this[t(1415)+"s"].length-1)&&this["currentE"+t(1168)+t(634)+"t"]===this[t(326)+"es"]);{let n=0,a=[];for(;e[t(1477)](n,_0x39f8c4.byteLength);){let{offset:u}=_0xa8a7ce(_0x151849,n);n=u;let p={cursor_name:"",cursor:0,service:0},{value:h,offset:m}=e[t(170)](_0x26d27f,_0x1e74b8,n);p.service=h,n=m;let{value:l,offset:_}=e[t(629)](_0x5b7439,_0x2d96ad,n);n=_,p[t(1421)+"ame"]=e[t(561)](_0x2520b3,_0x19819b,n,e.jTPuX(n,l)),n+=l;let{value:v,offset:A}=e[t(1023)](_0x117a7e,_0x20f01e,n);p[t(1026)]=v[t(1617)](),n=A,a.push(p)}return a}}[r(531)+r(1030)+r(718)+r(336)+"tries"](){let t=r;return e[t(1328)](this[t(946)+t(286)],this.endpoints.length)?!0:this[t(1425)+"ndpointT"+t(634)+"t"]>this[t(326)+"es"]}["replaceB"+r(1312)+r(932)+r(495)+r(841)](){let t=r;if(t(449)==="CUter")return this[t(1425)+"ndpointT"+t(634)+"t"]=1,this[t(946)+"ndex"]++,this[t(1415)+"s"][this.currentIndex];_0x4c66d6-=65536,_0x23ceba+=e[t(1646)](_0x511d3e,e[t(1584)](e[t(726)](_0x1a1805,10),55296),e[t(1645)](e[t(1087)](1023,_0x49d69a),56320)),_0x3da071+=3}[r(1539)+r(319)+r(373)+"ateCount"](){let t=r;return this[t(1425)+t(1168)+t(634)+"t"]++,this[t(1539)+"ntEndpoint"]()}}let it=(e[r(577)]!=typeof globalThis&&e[r(1121)](e[r(730)],globalThis[r(248)+r(497)][r(568)])||e[r(1293)](e.NbMhP,typeof window)&&e[r(1177)](r(1479),window[r(248)+r(497)][r(568)]))&&e[r(182)](e[r(577)],typeof document),Ye=e[r(1293)](e.NbMhP,typeof globalThis)&&(e[r(1063)](r(297),globalThis[r(248)+r(497)].name)||e[r(1281)]===globalThis[r(248)+r(497)][r(568)])&&e[r(1211)](e[r(577)],typeof tt),Ct=(e[r(577)]!=typeof globalThis&&e[r(464)](e[r(811)],globalThis["construc"+r(497)][r(568)])||e[r(645)](e[r(577)],typeof globalThis)||e[r(1547)](e[r(577)],typeof globalThis)&&!!globalThis["WeixinJS"+r(1243)])&&e.IzSxC(e[r(577)],typeof wx),Et=e[r(383)](r(1666)+"d",typeof globalThis)&&(e[r(252)]("Dedicate"+r(1437)+r(1452)+"pe",globalThis[r(248)+r(497)].name)||e[r(1422)](r(1073)+r(605)+r(827),globalThis[r(248)+r(497)].name)||e.oELFd(e[r(1262)],globalThis[r(248)+"tor"].name))&&e[r(623)](e[r(577)],typeof self),wa=r(1666)+"d"!=typeof globalThis&&e[r(657)](e[r(811)],globalThis["construc"+r(497)].name)&&e[r(577)]!=typeof global&&e[r(1608)](r(297),global[r(248)+r(497)].name)&&e[r(1481)](e[r(577)],typeof process)&&!!process[r(794)];class ar{constructor(){let t=r;this[t(1022)+"rs"]={}}[r(1412)](t,...n){let a=r,u={yejrv:e.QqPDR,nseIv:function(h,m){return e[k(1424)](h,m)},GsBvT:function(h,m){return e[k(1554)](h,m)},vATKq:function(h,m){return e[k(840)](h,m)},OnUqf:function(h,m){return e[k(1041)](h,m)},lsVkO:function(h,m){return e[k(952)](h,m)},mOngq:function(h,m){return e[k(691)](h,m)},udAxR:function(h,m){return e[k(1551)](h,m)},fmeik:function(h,m){return e[k(1093)](h,m)},kkPpP:function(h,m){return h<m},JdnoT:function(h,m){return e.hoHRi(h,m)},CniUa:function(h,m){return e.alMLC(h,m)},GlBFf:function(h,m){return h&m},VyLTA:function(h,m){return e[k(491)](h,m)},TzttX:function(h,m){return h&m},plPYA:function(h,m){return e.jTLiw(h,m)},uJwdN:function(h,m){return h<<m},GdlSZ:function(h,m){return h&m}},p=this[a(1022)+"rs"][t];if(p)p[a(596)]()[a(1345)](h=>h.fn[a(662)](h[a(1354)],n));else if(e[a(486)](e[a(1050)],t)&&!this[a(553)])if(e[a(334)](e.sbzjy,e[a(213)])){let h=n.length&&n[0];if(e.pMNKk(h,Error))throw h;let m=new Error(e[a(896)](e.wJGue,h?e[a(1160)](" ("+h[a(1200)],")"):""));throw m[a(1176)]=h,h}else{let h=4294967295;return function(m,l,_=!0){let v=a,A=u[v(1133)][v(460)]("|"),N=0;for(;;){switch(A[N++]){case"0":h=u[v(1594)](u[v(1565)](h,u.vATKq(127&m[l],21)),0);continue;case"1":return{value:_?h:u[v(1565)](0,h),offset:l};case"2":if(u[v(285)](l+=5,m[v(1620)]))throw l=m[v(1620)],_0x408739(l,10,m.length);continue;case"3":if(u[v(744)](m[l++],128))return{value:_?h:u[v(1565)](0,h),offset:l};continue;case"4":h=u.nseIv(u[v(1565)](h,u.mOngq(u[v(721)](15,m[l]),28)),0);continue;case"5":if(u[v(690)](m[l++],128))return{value:_?h:0|h,offset:l};continue;case"6":if(u.kkPpP(m[l++],128))return{value:_?h:u[v(872)](0,h),offset:l};continue;case"7":if(m[l++]<128)return{value:_?h:u[v(872)](0,h),offset:l};continue;case"8":h=u[v(1594)](u[v(872)](h,u[v(441)](u.GlBFf(127,m[l]),7)),0);continue;case"9":if(u.VyLTA(m[l++],128))return{value:_?h:u[v(872)](0,h),offset:l};continue;case"10":h=u[v(1594)](u.TzttX(127,m[l]),0);continue;case"11":h=u[v(1594)](u[v(1248)](h,u[v(1653)](u[v(317)](127,m[l]),14)),0);continue}break}}}return this}[r(1342)](t,n){let a=r;if(e.bJtpf(void 0,t))this[a(1022)+"rs"]={};else if(e[a(1571)](void 0,n))this[a(1022)+"rs"][t]=null;else{let u=this[a(1022)+"rs"][t];if(u)for(let p=0;e[a(1093)](p,u[a(1620)]);)u[p].fn===n?u[a(1081)](p,1):++p}return this}on(t,n,a){return(this[r(1022)+"rs"][t]||(this._listeners[t]=[])).push({fn:n,ctx:a||this}),this}}class _a extends ar{[r(979)+"rrorMess"+r(1642)](t){let n=r,a={gurxH:function(u){return e.HBdKD(u)},wdQSp:function(u){return u()}};if(e[n(870)](e[n(1356)],e.YIQih))return t[n(339)]||t[n(1153)]?(n(928)+" "+(t[n(339)]||"")+n(1610)+(t.errNo||""))[n(788)]():JSON[n(1047)+"y"](t);xmEUpn[n(219)](_0x181ea5),xmEUpn.wdQSp(_0x228f9d)}constructor(t,n,a){let u=r;super(),this[u(1438)]=null,Ct&&wx[u(1180)+u(1080)]&&(this._socket=wx["connectS"+u(1080)]({url:t,protocols:n,header:a,fail:this[u(1088)+u(1090)+u(525)][u(1577)](this),success:this[u(1088)+u(1593)+u(1406)+u(1078)][u(1577)](this)})),Ye&&tt[u(1180)+"ocket"]&&(this[u(1438)]=tt[u(1180)+u(1080)]({url:t,protocols:n,header:a,fail:this[u(1088)+u(1090)+u(525)].bind(this),success:this[u(1088)+u(1593)+u(1406)+u(1078)].bind(this)}))}[r(1088)+r(1593)+r(1406)+r(1078)](){let t=r;Promise[t(307)]()[t(1e3)](()=>{let n=t;this[n(1305)+n(727)]()})}["_createS"+r(1090)+r(525)](t){let n=r,a={lXtWa:function(u,p){return u&p},SWwXW:function(u,p){return e[k(570)](u,p)},pznyZ:e.QvAIu,kfDad:function(u,p,h){return e[k(893)](u,p,h)},hjLtk:e[n(1050)],wWmEY:e[n(967)]};Promise[n(307)]()[n(1e3)](()=>{let u=n,p={twkkl:function(h,m,l){return h(m,l)},wzqSJ:function(h,m){return a[k(1344)](h,m)}};if(a.SWwXW(a.pznyZ,a.pznyZ)){let h=a[u(410)](de,a[u(190)],{message:this[u(979)+u(1311)+u(1642)](t)});this[u(1412)]("error",h);let m=a[u(410)](pe,a[u(518)],{reason:this[u(979)+u(1311)+u(1642)](t)});this.emit(a.wWmEY,m)}else YzZCGX[u(927)](_0xd18607,_0x47bef8,YzZCGX.wzqSJ(127,_0x179701)|128),_0x2073a0>>>=7})}[r(1305)+r(727)](){let t=r,n={dKBCz:e[t(967)],CTUYf:function(a,u,p){return e.zsllR(a,u,p)},MOURW:function(a,u){return e[t(1644)](a,u)},zIsfr:e[t(1361)],ccDGI:e[t(1050)]};this[t(1438)][t(966)](a=>{let u=t;this[u(1412)](e.zqhpd,e[u(854)](vs,e[u(666)],{...a,data:a.errMsg||""}))}),this[t(1438)][t(638)](a=>{let u=t;this[u(1412)](n[u(710)],n[u(953)](pe,u(1403),{...a}))}),this[t(1438)][t(761)+"e"](a=>{let u=t;this[u(1412)](e[u(544)],e[u(256)](bs,e[u(544)],{...a}))}),this._socket[t(1171)](a=>{let u=t;n[u(844)](u(1265),n[u(1218)])?this[u(1412)](n[u(1460)],de(u(939),{...a,message:a[u(339)]||""})):this._isMiniTT||this[u(1516)+"X"]?this[u(1158)+"etWorkCh"+u(740)]():this[u(751)+"er"]&&this[u(169)+"balEvent"+u(934)]()})}[r(1132)](t){let n=r,a={tFfXu:function(u,p,h){return e[k(256)](u,p,h)}};if(e[n(636)](t,Uint8Array))if(e[n(1238)](e[n(1486)],e.bZcoW)){let u=t[n(506)].slice(t.byteOffset,e.TNUVD(t.byteLength,t[n(181)+"et"]));this[n(1438)]&&this[n(1438)][n(1132)]({data:u,fail:p=>{let h=n;this[h(1412)](h(939),a.tFfXu(de,h(939),{message:this["_formatE"+h(1311)+h(1642)](p)}))}})}else return this[n(1425)+n(1168)+"riesCount"]++,this[n(1539)+"ntEndpoint"]();else this[n(1438)]&&this[n(1438)].send({data:t,fail:u=>{let p=n;if(e[p(712)](e[p(1465)],e[p(1465)]))this[p(1412)](e[p(1050)],e[p(1076)](de,e[p(1050)],{message:this[p(979)+p(1311)+p(1642)](u)}));else return!!this[p(1184)]}})}[r(1403)](t,n){let a=r;this._socket&&this._socket[a(1403)]({code:t,reason:n})}[r(1380)+r(934)](t,n){this.on(t,n)}[r(923)+r(1204)+r(231)](t,n){this[r(1342)](t,n)}get readyState(){let t=r;return this[t(1438)][t(1110)+"te"]}get[r(517)+"pe"](){return this[r(1438)].binaryType}set[r(517)+"pe"](t){}get[r(1045)](){let t=r;return this._socket[t(1045)]}get[r(402)](){return this[r(1438)].protocol}get extensions(){let t=r;return this[t(1438)][t(369)+"ns"]}get[r(1315)+r(1557)](){return 0}}function ya(s,t){let n=r,a={VTOvz:function(u,p){return e[k(620)](u,p)},UmjoA:function(u,p,h){return e[k(1208)](u,p,h)},IlCOA:function(u,p){return e.tYLqT(u,p)},aUtEa:function(u,p,h){return e.aVqTG(u,p,h)}};if(e[n(1597)](e.OVCyy,e.OVCyy)){for(_0x2242d8>>>=0;WnqYtD[n(994)](_0x4564e5,128);)WnqYtD[n(1532)](_0xf7cc89,_0x51658a,WnqYtD[n(1368)](127&_0x5904e7,128)),_0x2ea7d2>>>=7;WnqYtD[n(367)](_0x1d08ba,_0x5d8a7b,_0x421526)}else{if(t)return new t(s[n(1045)],s[n(402)]);if(e[n(1257)](Ct,Ye))return new _a(s.url,s[n(402)],s[n(1340)]);if(e[n(1371)](it,Et)&&e[n(359)](e[n(577)],typeof WebSocket)&&WebSocket)return new WebSocket(s.url,s[n(402)+"s"])}}function ba(s){let t=r,n=e[t(1373)][t(460)]("|"),a=0;for(;;){switch(n[a++]){case"0":if(s)return!0;continue;case"1":if(Ye&&tt["connectS"+t(1080)])return!0;continue;case"2":if(e[t(720)](it,Et)&&e[t(949)](e[t(577)],typeof WebSocket)&&WebSocket)return!0;continue;case"3":return!1;case"4":if(Ct&&wx[t(1180)+t(1080)])return!0;continue}break}}function Cs(s,t,n){let a=r,u={eWuXo:function(m,l){return m<=l},OzFEV:function(m,l){return e.aaazC(m,l)}},p=-1;async function h(m){let l=k;return u[l(1540)](m,p)?Promise.reject(new Error(l(436)+l(1203)+l(1334)+l(1213)+l(1374))):(p=m,m===n.length?Promise[l(307)]():n[m][l(1577)](s)(t,h[l(1577)](null,u[l(1320)](m,1))))}e[a(598)](h,0)}function Es(s){let t=r,n=0,a=0;for(let u=0;u<s.length;++u)a=s[t(1499)+"At"](u),e[t(212)](a,128)?n+=1:e[t(1519)](a,2048)?n+=2:e[t(1173)](e[t(940)](64512,a),55296)&&e[t(1115)](e[t(1065)](64512,s[t(1499)+"At"](e.QOSUq(u,1))),56320)?(++u,n+=4):n+=3;return n}function As(s,t,n){let a=r;if(e[a(404)](e.zltOh(n,t),1))return"";let u="";for(let p=t;e[a(404)](p,n);)if(e[a(1099)](a(427),"MuLpP")){let h=s[p++];if(h<=127)u+=String[a(1352)+a(487)](h);else if(e[a(809)](h,192)&&e[a(1676)](h,224))u+=String[a(1352)+"Code"](e[a(1308)](e[a(1624)](31&h,6),e.ZrqfR(63,s[p++])));else if(h>=224&&h<240)u+=String.fromCharCode((15&h)<<12|(63&s[p++])<<6|e[a(1100)](63,s[p++]));else if(e[a(1543)](h,240)){let m=e[a(1627)](e[a(1353)](e[a(1085)](e[a(700)](e[a(360)](7,h),18),e[a(1087)](63,s[p++])<<12),e[a(168)](e[a(1427)](63,s[p++]),6))|e[a(1512)](63,s[p++]),65536);u+=String[a(1352)+a(487)](e.jTPuX(55296,m>>10)),u+=String[a(1352)+a(487)](56320+e[a(1070)](1023,m))}}else _0x43062=e[a(676)](_0x284d93,_0x1bc8ca),_0x345945=0;return u}function cr(s,t,n){let a=r,u=n,p,h;for(let m=0;m<s[a(1620)];++m)if(p=s[a(1499)+"At"](m),e[a(1591)](p,128))t[n++]=p;else if(e.SUvhe(p,2048))t[n++]=e[a(207)](e[a(901)](p,6),192),t[n++]=e[a(1258)](63&p,128);else if(e[a(715)](e[a(1100)](64512,p),55296)&&e[a(522)](e.ynpUJ(64512,h=s[a(1499)+"At"](m+1)),56320)){let l=(a(958)+"1|2")[a(460)]("|"),_=0;for(;;){switch(l[_++]){case"0":t[n++]=e.mlwnl(e.IKjTs(p,18),240);continue;case"1":t[n++]=e[a(1308)](e.gmmkg(p>>6,63),128);continue;case"2":t[n++]=e[a(1264)](63,p)|128;continue;case"3":p=e.Ovuhb(e.jTPuX(65536,e.gvPyz(1023,p)<<10),1023&h);continue;case"4":t[n++]=p>>12&63|128;continue;case"5":++m;continue}break}}else t[n++]=e[a(386)](p>>12,224),t[n++]=e.xoNvP(e[a(434)](e.IKjTs(p,6),63),128),t[n++]=63&p|128;return n-u}async function ks(s){let t=r;if(e[t(1295)]("string",typeof s)){let n=new Uint8Array(e[t(971)](Es,s));return e.rRYsY(cr,s,n,0),n}return e.rhafF(s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s.buffer,s[t(181)+"et"],s[t(277)+"th"])}function va(s){let t=r;try{return e[t(949)](e[t(1118)],typeof s)&&(e.jvqSA(s,ArrayBuffer)||s[t(506)]&&s.buffer instanceof ArrayBuffer)||e[t(949)](e[t(1118)],typeof s)?"":(JSON[t(524)](s),t(1205)+t(1596))}catch{if(e.RjeHz(e[t(324)],e[t(1261)]))return e[t(645)](e[t(1118)],typeof s)?e[t(717)]:"";this[t(813)]++}}let Sa=(s,t)=>{let n=r;switch(s){case e.xUZYu:case e[n(157)]:return{[n(588)+s]:1,"x-tt-env":t};default:return{}}};class Ca{constructor(t){let n=r;this["maxLossC"+n(622)]=t,this[n(813)]=0}[r(473)](){let t=r;if(e[t(1491)](e[t(625)],e[t(625)]))this[t(813)]++;else return this[t(1184)]?.get(_0x148060)}[r(1215)+r(732)+"nt"](){let t=r;return this.count>=this[t(955)+t(622)]}[r(273)+"nter"](t=0){let n=r;this["maxLossC"+n(622)]=t,this[n(813)]=0}}async function Ea(s){let t=r,n={KbMpq:e[t(733)],usJcs:function(a,u){return e[t(936)](a,u)},aaYOr:e[t(937)],xXeqc:e[t(1536)],IiLbU:function(a,u){return e[t(692)](a,u)},kwsyW:e[t(174)],tVuba:function(a,u){return e[t(1587)](a,u)}};return new Promise(a=>{let u=t,p={hlhxH:n[u(453)]};if(!it)return n[u(341)](a,n[u(453)]);try{let h=document["createEl"+u(300)](n[u(839)]);window[u(421)+"JSONP"]=m=>{let l=u;document.body[l(1534)+l(1599)](h),window[l(421)+"JSONP"]=void 0,a(m&&m[l(498)]||p[l(1555)])},h[u(1307)]=n.xXeqc,h[u(1192)]=n.IiLbU(s[u(1317)](/^ws/,u(1008)),n[u(1402)]);try{document[u(855)]["appendCh"+u(1599)](h)}catch{document[u(855)]["removeCh"+u(1599)](h)}}catch{window[u(421)+u(1042)]=void 0,n[u(997)](a,n[u(453)])}})}function Fe(s,t,n){let a=r;return!!s?.[a(533)](u=>u[a(548)]===t&&u[a(183)]===n)}function ot(s,t){let n=r;return s?.[n(533)](a=>a[n(548)]===t)?.[n(183)]}let xr=null;async function Aa(){let s=r;return xr||(xr=Promise[s(307)]()[s(1e3)](Ce.bind(Ce,s(445)))),xr}class ka extends ar{constructor(t,n){let a=r;super(),this[a(1154)]=t,this[a(270)]=n,this[a(1184)]=void 0,this[a(792)+a(670)]=null}async[r(500)](){await this[r(1111)]()}async[r(1111)](){let t=r,n={Aitdh:e.sZyJA,DQfII:e[t(734)],tqrql:e[t(611)],xCCZD:function(a){return a()}};if(!this[t(1184)]){if(this[t(792)+"mise"])return this[t(792)+t(670)];try{let a=this._dbName,u=this[t(270)];this[t(792)+"mise"]=(async()=>{let p=t,h={IgtgH:n.Aitdh};if(n[p(796)]!==n[p(1106)]){let{openDB:m}=await n.xCCZD(Aa);this[p(1184)]=await m(p(421)+"_"+a,1,{upgrade(l){let _=p;_(1643)===h[_(540)]?this.on(_0x5596d6,_0x3a8ef9):l[_(884)+_(753)+"e"](a,{keyPath:u})}})}else return _0x4d9458?.[p(533)](m=>m.key===_0x6e91d4)?.[p(183)]})(),await this[t(792)+t(670)]}catch(a){console.log(a)}finally{this[t(792)+t(670)]=null}}}async get(t){let n=r;try{return await this[n(1111)](),this[n(1184)]?.[n(1621)](this[n(1154)],t)}catch(a){console[n(775)](a)}}async[r(885)](t,n){let a=r;return e[a(351)](a(265),e[a(309)])?(await this._init(),this[a(1184)]?.[a(1581)](this[a(1154)],t)):_0x2c4ae8?_0x34ffdc[a(677)+a(1562)](_0x1f4d3e,_0x538745):_0x2564e3["fromByte"+a(1324)](_0xd09f71,_0x4e98bd)}async[r(773)](t){let n=r;try{return await this[n(1111)](),this[n(1184)]?.[n(1276)](this._dbName,t)}catch(a){if(e[n(1009)]("qTYPW",e.sdSqZ))return n(421)+"_"+this[n(1186)];console[n(775)](a)}}async clear(){let t=r;try{return await this[t(1111)](),this._qosDB?.[t(567)](this[t(1154)])}catch(n){console[t(775)](n)}}async[r(257)](){let t=r;if(e[t(303)]!==e[t(303)])this[t(619)+"igatorOn"+t(457)]=_0x1b1dda,_0x42850c?this[t(1640)+"nLine"]():this[t(1640)+"ffLine"]();else return await this[t(1111)](),this[t(1184)]?.[t(701)+"ys"](this[t(1154)])}async[r(719)](){let t=r;return await this._init(),this._qosDB?.[t(719)](this._dbName)}async[r(216)](){let t=r;try{this[t(1184)]?.[t(1403)](),this[t(1184)]=void 0}catch(n){console[t(775)](n)}}get[r(610)](){let t=r;if(e[t(1571)](e[t(259)],e.hZoyn))return new _0x3e50e7(e[t(683)](e[t(1586)](_0x4de2f9[0]|e[t(988)](_0x555d82[1],8),e[t(193)](_0x387cea[2],16)),e[t(691)](_0x1d87b3[3],24)),e[t(1085)](e[t(852)](e[t(1473)](_0x1c376f[4],e[t(1541)](_0x52f5ae[5],8)),e[t(840)](_0x25f006[6],16)),e.lQiDV(_0x2991b3[7],24)),_0x51e3f3);try{return!!this._qosDB}catch(n){return console[t(775)](n),!1}}}class Pa{constructor(t,n){let a=r;this[a(1186)]=t,this[a(1498)]=n,this[a(1184)]=localStorage}async[r(500)](){}get[r(1522)](){return r(421)+"_"+this._DBName}async[r(1621)](t){let n=r,a=this[n(1184)][n(1126)](this._prefix);return JSON.parse(e.lDjbL(a,"{}"))[t]}async[r(885)](t,n){let a=r,u=this[a(1184)][a(1126)](this[a(1522)]),p=JSON.parse(e[a(595)](u,"{}"));return p[n||t[this[a(1498)]]]=t,this[a(1184)][a(1196)](this[a(1522)],JSON[a(1047)+"y"](p)),n||t[this[a(1498)]]}async del(t){let n=r,a=this._qosDB[n(1126)](this._prefix),u=JSON[n(524)](e.ykNkV(a,"{}"));return u[t]=void 0,this[n(1184)][n(1196)](this[n(1522)],JSON[n(1047)+"y"](u))}async clear(){let t=r;return this[t(1184)][t(567)]()}async[r(257)](){let t=r,n=this[t(1184)][t(1126)](this[t(1522)]),a=JSON[t(524)](n||"{}");return Object[t(257)](a)}async[r(719)](){let t=r,n=this[t(1184)][t(1126)](this[t(1522)]),a=JSON.parse(e[t(595)](n,"{}"));return Object[t(758)](a)}[r(216)](){return Promise[r(307)]()}get isReady(){return!!this[r(1184)]}}class Da{constructor(t,n){let a=r;e[a(1387)](a(861),e[a(1450)])?(_0x6db3e9(_0x4459b9,18),_0x30837f(_0x52b46a,_0x22a713)):(this._DBName=t,this._pathKey=n,this[a(1184)]=Ye?tt:Ct?wx:null)}async[r(500)](){}get _prefix(){let t=r;return t(421)+"_"+this[t(1186)]}async[r(1621)](t){let n=r;if(e[n(1049)](e[n(1447)],e[n(776)])){let a=this[n(1184)]["getStora"+n(1379)](this[n(1522)]);return JSON[n(524)](e[n(786)](a,"{}"))[t]}else this.emit(e[n(1050)],e[n(760)](_0x5a7dd3,e[n(1050)],{message:this["_formatE"+n(1311)+n(1642)](_0x27cb28)}))}async[r(885)](t,n){let a=r,u={UAkdM:function(p,h){return e[k(1054)](p,h)},ySldo:function(p,h){return e[k(523)](p,h)}};if(e[a(613)]!==e[a(559)]){let p=this[a(1184)][a(954)+a(1379)](this._prefix),h=JSON[a(524)](p||"{}");return h[n||t[this._pathKey]]=t,this[a(1184)][a(203)+a(1379)](this[a(1522)],JSON[a(1047)+"y"](h)),n||t[this[a(1498)]]}else{let p=IoeXhm[a(1336)](_0xcb240c,_0x571815),h=_0x2316be[a(1466)];return _0x21ca91[a(1466)]=IoeXhm[a(643)](_0x1e8060[a(983)],p),h}}async[r(773)](t){let n=r,a=this[n(1184)].getStorageSync(this._prefix),u=JSON[n(524)](e.EmsMa(a,"{}"));return u[t]=void 0,this._qosDB[n(203)+n(1379)](this[n(1522)],JSON[n(1047)+"y"](u))}async[r(567)](){let t=r;return this[t(1184)][t(1202)+t(1453)]()}async[r(257)](){let t=r,n=this._qosDB[t(954)+t(714)+"nc"](this._prefix),a=JSON[t(524)](n||"{}");return Object[t(257)](a)}async getAll(){let t=r,n={WaxVD:function(a,u){return e[k(998)](a,u)}};if(e[t(1009)](e.jpmjV,e.jpmjV)){let a=this[t(1184)]["getStora"+t(1379)](this._prefix);return _0x31a3b0.parse(PrQDzo[t(1348)](a,"{}"))[_0x4ed58f]}else{let a=this[t(1184)][t(954)+t(714)+"nc"](this._prefix),u=JSON.parse(e.dMgyb(a,"{}"));return Object[t(758)](u)}}[r(216)](){return Promise[r(307)]()}get isReady(){return!!this[r(1184)]}}function Ps(s,t){let n=r;if(e.ykNkV(Ye,Ye))return new Da(s,t);if(e.CRbRc(it,Et)&&e.NbMhP!=typeof indexedDB)return new ka(s,t);if((it||Et)&&e.IzSxC(e.NbMhP,typeof localStorage))return new Pa(s,t);throw new Error(e[n(406)])}class Ia{constructor(){let t=r;this[t(817)+t(1489)+"Id"]=null,this[t(817)+"l"]=36e5,this[t(1184)]=e[t(774)](Ps,e[t(1609)],e[t(526)])}async[r(817)+r(1066)](){let t=r;e[t(693)](clearInterval,this[t(817)+"lTimeoutId"]),this[t(817)+t(1489)+"Id"]=e[t(1023)](setInterval,()=>{let n=t;this[n(1391)+n(912)]()},this[t(817)+"l"])}async[r(500)](){let t=r;await this._qosDB[t(500)]()[t(1e3)](()=>{let n=t;this[n(817)+n(1066)]()})}async[r(1391)+"ired"](){let t=r;if(e[t(1663)](t(368),e[t(1552)])){let n=this[t(1075)],a=this.low;return[255&a,e.yrSgd(e[t(304)](a,8),255),e[t(361)](e[t(304)](a,16),255),a>>>24,255&n,e[t(649)](e[t(1318)](n,8),255),e.CHnoZ(n,16)&255,e.jYCyv(n,24)]}else(await this[t(1184)]?.[t(719)]()||[])[t(765)](({timestamp:u})=>u<Date[t(299)]())[t(1345)](u=>{let p=t;this._qosDB?.del(u[p(675)+"id"])})}async[r(773)](t){let n=r;return this[n(1184)]?.[n(773)](t)}async[r(885)](t,n){return this[r(1184)]?.set({message_id:t,timestamp:n})}async[r(1621)](t){let n=r;return this[n(1184)]?.[n(1621)](t)}async[r(216)](){let t=r;e[t(1583)](clearInterval,this[t(817)+"lTimeoutId"]),await this[t(1184)]?.closeDB()}get[r(610)](){let t=r;if(e.xdFzX(e.LfxQH,e[t(938)]))return this[t(1184)]?.[t(610)];e[t(975)](_0x382695,e[t(831)]),this[t(1342)](e[t(400)],_0x125e2c),this.off(e[t(1157)],_0x4e156f)}}function ur(s){let t=r,n=!!this._options[t(438)+"S"];if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let a=Fe(s[t(1200)][t(1340)],e[t(1395)],"2"),u=a&&e[t(315)](Fe,s[t(1200)].headers,t(1227)+"er_qos_ack","1"),p=a&&e[t(814)](Fe,s[t(1200)][t(1340)],e[t(660)],"1"),h=p?e[t(1638)](ot,s.message.headers,e[t(858)])?.split(",")[t(765)](Boolean)||[]:[];return{enabled:n,isQoSMessage:a,isQoSAck:u,isAckCleanupMessage:p,ackMsgIds:h}}async function Ds(){let s=r;return this[s(957)+s(1604)]||(this[s(957)+"ger"]=new Ia),this["_QoSMana"+s(1604)][s(610)]||await this[s(957)+"ger"][s(500)](),this[s(957)+"ger"]}async function Ta(s,t){let n=r;if(e[n(715)](e.KLFrv,e.KLFrv)){let{enableAutoAck:a}=this[n(163)],u=e[n(384)](Fe,s[n(1200)][n(1340)],e[n(894)],"1"),p=e[n(435)](Fe,s.message[n(1340)],e[n(991)],"1"),h=ur[n(1407)](this,s);if(e[n(1375)](a,u)){let{SeqID:m,LogID:l,service:_,LogIDNew:v,method:A}=s[n(1200)];this[n(1494)]({SeqID:m,LogID:l,LogIDNew:v,service:_,method:A,headers:[{key:e[n(991)],value:"1"},{key:e[n(1170)],value:v||""},{key:e[n(772)],value:"0"}]})}p&&!h[n(1172)]&&this[n(186)+"hAckMessageEvent"](s),e[n(1560)](t)}else _0x5d39de=_0x59256c[n(1499)+"At"](_0x2de0bb),e[n(985)](_0x45f925,128)?_0x407107+=1:e.WOSWx(_0x56f625,2048)?_0x1c5ef8+=2:e[n(486)](e[n(1302)](64512,_0x27d908),55296)&&e[n(1433)](64512&_0x14a9a6[n(1499)+"At"](e[n(530)](_0x53963c,1)),56320)?(++_0x2b6b4d,_0x1ec64d+=4):_0x461f88+=3}async function La(s,t){let n=r;this[n(1343)](e[n(494)],s[n(1200)]),e[n(581)](t)}async function Ra(s,t){let n=r,a=e.duisN(us,await e[n(965)](ks,s[n(1436)]));try{if(e[n(583)](a.payload,Uint8Array)){let u=e[n(1020)](this[n(163)].payloadEncoding,Object)?{force:!!this[n(163)][n(230)+n(320)][n(766)],encoding:this[n(163)]["payloadE"+n(320)].encoding?this[n(163)][n(230)+n(320)][n(993)][n(1317)](/\s/g,"")[n(1077)+n(337)]():""}:{force:!1,encoding:this[n(163)][n(230)+n(320)]?this[n(163)][n(230)+"ncoding"][n(1317)](/\s/g,"")[n(1077)+"ase"]():""},p=a.payloadEncoding?a["payloadE"+n(320)].replace(/\s/g,"")[n(1077)+n(337)]():"",h=e[n(731)](this._options[n(1195)+n(1237)],Object)?{force:!!this[n(163)][n(1195)+n(1237)][n(766)],type:this[n(163)]["payloadT"+n(1237)][n(1307)]?this[n(163)]["payloadT"+n(1237)][n(1307)][n(1317)](/\s/g,"")[n(1077)+n(337)]():""}:{force:!1,type:this._options[n(1195)+n(1237)]?this[n(163)]["payloadT"+n(1237)][n(1317)](/\s/g,"")[n(1077)+n(337)]():""},m=a[n(1195)+"ype"]?a[n(1195)+"ype"].replace(/\s/g,"")[n(1077)+n(337)]():"",l=h.force?h[n(1307)]:m||h.type,_=u[n(766)]?u[n(993)]:p||u.encoding,v=[e.oNftm,n(1205)+n(1596),n(1205)+n(1596)+n(399)+n(292),e.iYuFb],A=[e.GNnML,e[n(1193)]];this[n(163)][n(947)+"ansformTextPayload"]&&v[n(1131)](l)&&(!_||A.includes(_))?a[n(370)+n(1500)]=e.EVvpm(As,a[n(1207)],0,a[n(1207)][n(277)+"th"]):a[n(370)+n(1500)]=""}else a["textPayl"+n(1500)]=""}catch(u){a[n(370)+"oad"]="",console[n(775)](u)}s[n(1200)]=a,e[n(501)](t)}function Na(s,t,n){let a=r,u=e.vhqck(n,8192),p=e[a(1294)](u,1),h=null,m=u;return function(l){let _=a;if(e[_(1656)](l,1)||e[_(910)](l,p))return e[_(598)](s,l);m+l>u&&(h=s(u),m=0);let v=t[_(1407)](h,m,m+=l);return e[_(266)](7,m)&&(m=e.eNwFr(7|m,1)),v}}let Oa=4294967295;function Ba(s,t,n){let a=r;return e.lFMoX(RangeError,e[a(1626)](e[a(1254)](e[a(564)](e[a(1515)]+s,a(229)),e[a(306)](t,1)),e.GjcmJ)+n)}function Ma(s,t,n){let a=r;if(e.SWNMj(e[a(298)],e[a(298)])){if(e[a(708)](n,Oa))throw new Error(e[a(1485)]);let u=3;for(;u>=0;){let p=e[a(1630)](255,n);e.CoMNV(dr,p,s,e[a(420)](t,u)),n>>>=8,u--}return e[a(1385)](t,4)}else _0x51c8c2[a(884)+"jectStore"](_0x4d65ce,{keyPath:_0x2e4bf3})}function za(s,t){let n=r,a=0,u=t,p=e.Rgoin(t,4);for(;e[n(1591)](u,p);)if(e[n(644)](e.XxiwE,e.VXQCE)){let{value:h,offset:m}=e[n(1442)](fr,s,u);u=m,a=e[n(1424)](e.rQZoK(a,8),0),a+=h}else throw this[n(989)+n(1369)]=!1,_0x42c9a3;return{value:a,offset:p}}function qa(s,t,n){let a=r,u=e[a(1454)][a(460)]("|"),p=0;for(;;){switch(u[p++]){case"0":if(t.write)return e.eRpfV(t[a(1463)](s,n),n);continue;case"1":return e[a(459)](e[a(970)](cr,s,t,n),n);case"2":if(e[a(1656)](s[a(1620)],40))return e[a(814)](cr,s,t,n)+n;continue;case"3":if(t[a(1667)+"e"])return e[a(1109)](t[a(1667)+"e"](s,n),n);continue;case"4":if(!s)return n;continue}break}}function Fa(s,t){let n=r,a=new M(e.xJnpP(e[n(386)](e[n(781)](e[n(1669)](s[e.oAUiR(t,4)],24),s[e[n(1160)](t,5)]<<16),e.LfblZ(s[e.GLynK(t,6)],8)),s[e[n(1584)](t,7)]),e[n(897)](e[n(1357)](s[e[n(1161)](t,0)]<<24,e[n(1323)](s[e[n(764)](t,1)],16))|e[n(1665)](s[e[n(1142)](t,2)],8),s[e[n(164)](t,3)]),!0);return t+=8,{value:a,offset:e[n(631)](t,8)}}function Ua(s,t,n){let a=r,u={mGyCj:function(p,h){return e[k(1233)](p,h)},MvNfz:"unknown reason"};if(e[a(815)](a(621),e[a(502)])){let p=s[a(371)],h=s[a(1075)];return t[n]=e[a(1424)](h,24),t[n+1]=e[a(959)](e.wAAiP(h,16),255),t[e.FIkHW(n,2)]=e[a(377)](h>>>8,255),t[n+3]=e.Uigis(255,h),t[e[a(1254)](n,4)]=e[a(950)](p,24),t[e[a(1015)](n,5)]=e[a(555)](e[a(1032)](p,16),255),t[e.bBccw(n,6)]=e[a(1526)](e[a(1480)](p,8),255),t[e.jQAeZ(n,7)]=255&p,n+=8,n}else _0x76efa5[a(421)+"JSONP"]=void 0,bwWHkN[a(828)](_0x3fb68f,bwWHkN.MvNfz)}function fr(s,t){let n=r,a={hhnoi:function(u,p,h){return e.ZZlga(u,p,h)},ryldC:function(u,p,h,m){return e[k(1358)](u,p,h,m)},vDYyA:function(u,p){return e[k(1254)](u,p)}};if(e[n(906)]===e.esZLa){let{offset:u}=a[n(1474)](_0x34651c,_0x288817,_0x2b00c2);_0x4cb3b1=u;let p={cursor_name:"",cursor:0,service:0},{value:h,offset:m}=a.hhnoi(_0x375ae7,_0x328279,_0x485a25);p[n(249)]=h,_0x426753=m;let{value:l,offset:_}=a[n(1474)](_0x5c29b2,_0x4806b1,_0x49a4c2);_0x5d3fbf=_,p[n(1421)+"ame"]=a[n(527)](_0x5799dd,_0x490c62,_0x5031cd,a[n(962)](_0x359269,l)),_0x29fd22+=l;let{value:v,offset:A}=_0x35c7db(_0x3a4bfd,_0x3c690d);p.cursor=v[n(1617)](),_0x186325=A,_0x5a8d46[n(251)](p)}else return s[n(1037)+"8"]?{value:s[n(1037)+"8"](t),offset:t+1}:{value:255&s[t],offset:t+1}}function dr(s,t,n){let a=r;return t.writeUint8?t[a(1428)+"t8"](s,n):t[n]=e[a(272)](255,s),e[a(1672)](n,1)}let Ha=function(s){return new Uint8Array(s)},Ka=e.ZanQe("undefined",typeof Buffer)?Buffer["allocUns"+r(602)]:Na(Ha,Uint8Array[r(1148)+"e"][r(1220)]);(()=>{let s=r,t={ULvYZ:function(n,a){return e[k(562)](n,a)},zLhgp:function(n,a){return e.kPCuh(n,a)},gACZC:function(n,a){return e.Kemzs(n,a)},XpiUv:function(n,a){return n&a},pcdgi:function(n,a){return e[k(448)](n,a)},WQXfQ:function(n,a){return e.TiMLW(n,a)},cFsRL:function(n,a){return e.lpOeB(n,a)},LpKCl:function(n,a){return e[k(312)](n,a)},NBEaV:function(n,a){return e[k(1162)](n,a)}};if(e[s(856)](e[s(275)],e.Hnhhw))_0x296b34=_0x215476(_0x569b1d),_0x51bbc1=e[s(959)](127,_0x540517),e[s(1221)](128,_0x57a480)&&(_0x4ebd46=e[s(1583)](_0x293ef3,_0x48bde2),_0x220c2e|=e[s(1448)](e[s(1065)](127,_0x2b0f5e),7));else{let n=4294967295;return function(a,u,p=!0){let h=s,m=(h(762)+h(343)+h(594)+"1")[h(460)]("|"),l=0;for(;;){switch(m[l++]){case"0":n=t[h(428)](t[h(429)](n,t[h(871)](t[h(1467)](127,a[u]),21)),0);continue;case"1":return{value:p?n:0|n,offset:u};case"2":if(t.pcdgi(a[u++],128))return{value:p?n:t[h(429)](0,n),offset:u};continue;case"3":if(t.pcdgi(a[u++],128))return{value:p?n:0|n,offset:u};continue;case"4":if(t[h(846)](a[u++],128))return{value:p?n:t[h(429)](0,n),offset:u};continue;case"5":n=t.ULvYZ(t[h(1467)](127,a[u]),0);continue;case"6":if(t.WQXfQ(u+=5,a[h(1620)]))throw u=a[h(1620)],Ba(u,10,a[h(1620)]);continue;case"7":n=t[h(428)](n|t.gACZC(t[h(1467)](127,a[u]),7),0);continue;case"8":n=t.ULvYZ(n|t.gACZC(127&a[u],14),0);continue;case"9":if(a[u++]<128)return{value:p?n:t[h(429)](0,n),offset:u};continue;case"10":if(a[u++]<128)return{value:p?n:t[h(429)](0,n),offset:u};continue;case"11":n=t.cFsRL(t[h(348)](n,t[h(871)](t[h(1405)](15,a[u]),28)),0);continue}break}}}})();let Ga=16,lr=32;function Wa(s){let t=r,n=0,a={};for(let u=0;e[t(491)](u,s.length);u++)a[s[u][t(1421)+t(1028)]]=e[t(862)](Es,s[u][t(1421)+"ame"]),n+=e[t(1025)](14,a[s[u][t(1421)+"ame"]]);return[n,a]}function Is(s,t,n){let a=r,[u,p]=e[a(1472)](Wa,s),h=e[a(205)](Ka,u),m=0;return s.forEach(l=>{let _=a,v=e[_(1493)][_(460)]("|"),A=0;for(;;){switch(v[A++]){case"0":m=Ma(h,m,l[_(249)]||0);continue;case"1":m=e.UibZk(Ua,M[_(1164)+"er"](l[_(1026)]||t),h,m);continue;case"2":console[_(775)](e[_(1659)],m);continue;case"3":m=e[_(963)](dr,p[l[_(1421)+"ame"]],h,m);continue;case"4":m=e[_(1222)](qa,l[_(1421)+"ame"],h,m);continue;case"5":m=e.Ngmzn(dr,0,h,m);continue;case"6":console[_(775)](e[_(1113)],m);continue;case"7":console[_(775)](_(1673),m);continue;case"8":console.log(_(1440)+_(632),l,l[_(249)]);continue;case"9":console[_(775)](e[_(397)],m);continue;case"10":console.log(e[_(818)],m);continue}break}}),{frameType:lr,headers:[{key:e[a(423)],value:n}],payload:h}}function ja(s){let t=r,n=0,a=[];for(;e[t(255)](n,s[t(277)+"th"]);){let{offset:u}=e.bQqrz(fr,s,n);n=u;let p={cursor_name:"",cursor:0,service:0},{value:h,offset:m}=e[t(1339)](za,s,n);p[t(249)]=h,n=m;let{value:l,offset:_}=e[t(774)](fr,s,n);n=_,p[t(1421)+t(1028)]=e[t(435)](As,s,n,e[t(1254)](n,l)),n+=l;let{value:v,offset:A}=e[t(982)](Fa,s,n);p[t(1026)]=v[t(1617)](),n=A,a[t(251)](p)}return a}function Ja(){let s=r;return{frameType:lr,headers:[{key:s(972)+s(344),value:e[s(572)]}],payload:void 0}}class Va{constructor(t,n,a){let u=r;this[u(520)+u(1660)]=t,this[u(898)+"ileName"]=n,this["_message"+u(161)]=a,this[u(1184)]=e[u(609)](Ps,this[u(520)+u(1660)],e.kkaAO)}async openDB(){let t=r;await this[t(1184)][t(500)]()}async[r(1129)+"rs"](){let t=r;if(!this._qosDB[t(610)])return;let n=this["_message"+t(161)],a=await this._qosDB.getAll();switch(console[t(775)](e[t(1031)],a),n){case e[t(682)]:return a&&a[t(1620)]?Is(a,0,this[t(898)+t(1017)]):void 0;case t(1631):return;case e[t(1134)]:return a&&a[t(1620)]?e[t(963)](Is,a,0,this[t(898)+t(1017)]):e[t(1068)](Ja)}}async set(t,n,a){let u=r;return console[u(775)](e[u(199)],t,n,a),this[u(1184)][u(885)]({cursor_name:t,cursor:n,service:a})}async[r(1300)+"rs"](t){let n=r,a={sLLUS:function(u,p){return e[k(1007)](u,p)},ABfAB:function(u,p){return e[k(1508)](u,p)},wAlYU:function(u,p){return u>p}};if(e[n(334)]("Awleg",e[n(886)])){let{initReconnectInterval:u,maxReconnectInterval:p,reconnectIntervalGrowFactor:h}=this._options,m=a.sLLUS(u,_0x257ed4[n(834)](h,a[n(1423)](_0x42b2f1,1)));return a[n(592)](m,p)?p:m}else{let u=e[n(842)](ja,t);for(let p of u)console[n(775)](e[n(684)],u),await this[n(1184)][n(885)](p)}}async[r(1621)](t){let n=r;return(await this[n(1184)].get(t))?.[n(1026)]}async[r(216)](){await this[r(1184)].closeDB()}[r(1637)+r(593)+r(1217)](t){let n=r,a={nxoEn:function(u,p){return e[k(816)](u,p)},bOUMx:function(u,p){return e[k(1201)](u,p)},GVDXP:e[n(577)],DcFoj:e[n(406)]};if(e[n(430)]!==n(929))this["_cursorF"+n(1017)]=t;else{if(XJjRqp[n(176)](_0x70746,_0x7ec75d))return new _0x33947c(_0x2b5dfb,_0x58dd67);if((_0x1e7997||_0x5ee4ab)&&XJjRqp[n(836)](XJjRqp[n(1071)],typeof _0x513e06))return new _0x22f5ea(_0x510c76,_0xf499b6);if(XJjRqp[n(176)](_0x531de9,_0x3c5d07)&&XJjRqp.bOUMx(XJjRqp[n(1071)],typeof _0x522274))return new _0x413799(_0x66f1,_0x4387e9);throw new _0x4211c2(XJjRqp.DcFoj)}}get[r(610)](){let t=r;return this[t(1184)][t(610)]}}let Ya=r(556)+"qos__";async function Ts(s){let t=r;if(!this._options[t(438)+"S"])return null;let{aID:n,fpID:a,messageStrategy:u}=this._options,p=s||Ya;try{if(this[t(1397)+t(694)])if(e.mUIpq(t(242),e[t(1390)]))s&&this[t(1397)+t(694)]["updateCu"+t(593)+"Name"](s);else return e[t(1216)](e[t(823)](_0x482764,4).join("0"),_0xc680a1(_0x1b0641,2)[t(197)](16))[t(596)](-4);else this["_cursorM"+t(694)]=new Va(a+"_"+n+"_"+p,p,u);return this["_cursorM"+t(694)][t(610)]||await this[t(1397)+t(694)].openDB(),this[t(1397)+t(694)]}catch{return null}}async function Xa(s,t){let n=r,a=e[n(713)](Fe,s[n(1200)][n(1340)],e[n(1538)],"-1"),u=Fe(s[n(1200)][n(1340)],e[n(991)],"1"),p=e[n(697)](ot,s[n(1200)].headers,e[n(1004)]),h=Number(ot(s.message[n(1340)],e[n(711)]))||0,m=ur[n(1407)](this,s),l=Fe(s[n(1200)][n(1340)],e.KzhjI,"2"),_=e.wGnqz(ot,s[n(1200)][n(1340)],e.IXNiD),v=e[n(693)](Number,e[n(787)](ot,s[n(1200)].headers,e.HCwGt));if(m[n(1172)])return e[n(1194)](t);let A=m["isQoSMes"+n(1400)]?await Ds.call(this):null;if(e[n(1573)](s[n(1200)][n(249)],0)&&u&&!a||s[n(1200)][n(249)]>0){if(p&&m[n(550)+n(1400)]&&A)return!!!await A[n(1621)](p)&&(this[n(186)+n(468)+n(913)](s),await A[n(885)](p,e[n(1278)](Date[n(299)](),h))),e[n(881)](t);if(l){let N=await Ts[n(1407)](this);if(!N)return this[n(186)+n(468)+n(913)](s),e[n(1068)](t);let R=await N.get(_)??-1;if(e[n(1093)](R,v))this[n(186)+n(468)+n(913)](s),N[n(885)](_,v,s[n(1200)][n(249)]);else throw new Error(n(704)+n(541)+n(294)+v+(n(1010)+n(652)+n(264)+"r ")+R);return e[n(908)](t)}return this[n(186)+n(468)+n(913)](s),t()}}async function $a(s,t){let n=r,a=ur.call(this,s);if(!a["isQoSMes"+n(1400)])return e[n(1266)](t);let u=await Ds.call(this);if(a["isAckCle"+n(1335)+n(1642)]&&a[n(1430)+"s"].length)for(let p of a[n(1430)+"s"])await u.del(p);e.hWGZs(t)}async function Qa(s,t){let n=r,a={PxIek:function(l,_,v){return e[k(1033)](l,_,v)}},u=e.tAKWU(s[n(1200)][n(447)+"e"],Ga),p=e.pbVPu(s.message[n(447)+"e"],lr);if(!u&&!p)return e[n(269)](t);let h=e[n(1208)](ot,s[n(1200)][n(1340)],e.NsqZJ);if(!h)return e[n(501)](t);let m=await Ts.call(this,h);if(!m)return e.DLDMw(t);if(u)if(e.kTCaD(e.srVNe,e[n(390)]))_0x4d825d[n(885)](_0x2af58d,_0x3af8a0);else{let l=await m.getCursors(),_={frameType:l?.["frameType"],SeqID:M[n(1164)+"er"](this[n(1226)]++),LogID:M.fromNumber(this[n(163)][n(1641)+n(394)]()),service:9e3,method:5,headers:l?.[n(1340)],payload:l?.[n(1207)]},v=C(_);this[n(1165)]&&this[n(1165)][n(1110)+"te"]&&this[n(1165)][n(1132)](v)}if(p)if(e[n(1301)](e[n(1159)],e[n(1159)])){let l=s[n(1200)][n(1207)];l&&m[n(1300)+"rs"](l)}else _0x37a11f(_0x12a3db,66),upJnce.PxIek(_0x28e586,_0x434347,_0x137805[n(1620)]),upJnce[n(860)](_0x1ac535,_0x5482bb,_0x3e0e06)}let Za=async function(s,t){let n=r;this[n(314)]=!1,e[n(1108)](clearTimeout,this[n(989)+n(1143)+"utId"]),e[n(201)](t)},e0=async function(s,t){let n=r;if(!this[n(1165)]||e.xdFzX(this[n(1165)][n(1110)+"te"],this[n(919)]))return e.ocNwd(t);let{pingInterval:a}=this[n(163)];this["_endpoin"+n(1117)]?.[n(1657)+n(1124)+n(1072)]();for(let p=0;e.aFJHS(p,this[n(431)+n(1288)].length);p++){let h=this["_message"+n(1288)][p];if(e[n(1664)](this[n(1165)][n(1110)+"te"],this[n(919)])&&e[n(1370)](null,h))this[n(1165)]&&this[n(1165)].send(h),this[n(431)+n(1288)][p]=null;else break}this[n(431)+n(1288)]=this[n(431)+"Queue"].filter(p=>!!p),this._pingPongTimeoutId=e[n(521)](setTimeout,()=>this[n(1322)](),a),this[n(186)+n(329)+"nt"](s),this[n(751)+"er"]&&this._ws&&(this[n(1165)][n(517)+"pe"]=this._binaryType);let u=this[n(1287)+"tManager"]?.[n(1539)+"ntEndpoint"]();this._debug(n(1625)+u+n(769)),e[n(746)](t)},t0=async function(s,t){let n=r,a=this["_endpoin"+n(1117)]?.[n(1539)+n(319)+"nt"]();this[n(1343)](n(1625)+a),e.ocNwd(t)};class n0 extends ar{constructor(t){let n=r,a={nwxnx:function(m,l){return e[k(1675)](m,l)},kfKJS:e[n(1182)],jNIWX:e.yzOuH,honWh:e[n(831)],EvGMC:e[n(1050)],WYuof:function(m,l,_){return m(l,_)},nEycp:function(m,l,_){return m(l,_)}};super(),this["_miniNav"+n(1592)+n(457)]=!0,this[n(751)+"er"]=it,this._isNode=wa,this[n(496)+"T"]=Ye,this[n(1516)+"X"]=Ct,this._isWorker=Et,this._messageQueue=[],this[n(1287)+n(1117)]=null,this[n(1414)+n(626)]=!1,this["_binaryT"+n(1237)]="arraybuffer",this._connectLock=!1,this["_connect"+n(1143)+n(215)]=null,this[n(688)+"ctTimeoutId"]=null,this[n(514)+n(1396)+"Id"]=null,this[n(1226)]=0,this._isInit=!1,this[n(829)]="",this[n(957)+n(1604)]=null,this[n(1397)+n(694)]=null,this._pingLossCounter=null,this._protocols=e.JjPGb,this[n(1449)]=3,this[n(333)+"NG"]=0,this.OPEN=1,this.CLOSING=2,this[n(388)]=m=>{let l=n;try{e[l(384)](Cs,this,m,[Za,e0,t0])}catch(_){let v=e[l(482)](de,e.XecCK,{message:_[l(1200)],code:qe[l(234)+"OR"],error:_});this[l(186)+"hErrorEv"+l(1229)](v)}},this[n(220)+"ge"]=async m=>{let l=n,{pingInterval:_,pingFrequency:v}=this._options;if((a[l(245)]("hi",m.data)&&a[l(245)](a[l(408)],v)||a[l(1366)]===v)&&(this[l(601)+l(1097)](),this[l(1412)](l(1502)+l(1187)+"s",a.honWh),this[l(514)+l(1396)+"Id"]=setTimeout(this._ping[l(1577)](this),_)),!a[l(245)]("hi",m.data))try{Cs(this,m,[Ra,Ta,$a,Qa,Xa,La])}catch(A){let N=de(a[l(780)],{message:A[l(1200)],code:qe[l(1475)+l(415)],error:A});this[l(186)+"hErrorEvent"](N)}},this[n(1039)]=m=>{let l=n,_=this["_endpoin"+l(1117)]?.[l(1215)+"chMaxTries"](),v=this[l(1287)+"tManager"]?.["getCurre"+l(319)+"nt"]();if(_&&!m[l(1200)]){let A="connect "+v+(" fail, max retri"+l(1523)+"ed");this[l(186)+l(1330)+l(1229)](a.WYuof(de,a[l(780)],{message:A,code:qe[l(391)+"IES_ERROR"],error:m}));return}this[l(1165)]&&a.nwxnx(this[l(1165)].readyState,this[l(919)])&&this[l(387)+l(986)](),this["_dispatc"+l(1330)+l(1229)](a[l(1012)](de,a[l(780)],{message:m[l(1200)],code:qe[l(305)+l(900)],error:m}))},this[n(1529)]=async m=>{let l=n;this[l(1056)+"mer"](),this["_clearPi"+l(1097)](),this[l(1299)+l(867)+"rs"](),this[l(1165)]=null,this[l(989)+l(1369)]=!1;let _=this[l(1287)+l(1117)]?.[l(1215)+"chMaxTries"]();if(!_&&this[l(493)+"orOnline"]()&&!this[l(1414)+"osed"]){let v=this[l(1287)+l(1117)]?.getCurrentEndpoint(),A=this[l(163)][l(366)+l(478)+l(576)](m[l(793)],m.reason);this[l(186)+"hCloseEv"+l(1229)](e[l(1646)](pe,"close",{code:1006,reason:m[l(942)]||l(1588)+l(656)+l(981)+l(1507)+"n, hostname: "+v,willReconnect:A})),A&&this._connect();return}if(e[l(763)](1e3,m[l(793)])&&this[l(1414)+"osed"]){this[l(186)+"hCloseEv"+l(1229)](e[l(1432)](pe,l(1403),{code:1e3,reason:e[l(1306)]})),this[l(1287)+l(1117)]?.[l(1657)+"pointCon"+l(1072)](),this[l(756)+l(992)]?.[l(273)+l(1355)]();return}if(m[l(793)]!==1e3&&_){let v=this[l(1287)+"tManager"]?.[l(1539)+"ntEndpoint"](),A=m.reason;A||(A=await e[l(1060)](Ea,this[l(829)])),A=l(1588)+l(656)+l(365)+A+(l(238)+l(868))+v+(l(160)+l(679)+l(921)),this[l(186)+"hCloseEvent"](e[l(1417)](pe,e.VWDLJ,{code:m[l(793)],reason:A}));let N="connect "+v+(l(654)+l(1359)+l(1523)+"ed");this[l(186)+l(1330)+l(1229)](de(e[l(1050)],{message:N,code:qe["MAX_RETR"+l(407)+"R"]})),this[l(1287)+l(1117)]?.["resetEnd"+l(1124)+l(1072)](),this[l(756)+l(992)]?.[l(273)+l(1355)]();return}if(m[l(793)]!==1e3&&!m[l(942)]){let v=this[l(1287)+"tManager"]?.[l(1539)+l(319)+"nt"]();this[l(186)+l(178)+l(1229)](pe(e[l(967)],{code:m[l(793)],reason:l(1588)+l(656)+l(981)+"wn reaso"+l(412)+l(1284)+v})),this[l(1287)+"tManager"]?.[l(1657)+l(1124)+l(1072)](),this["_pingLos"+l(992)]?.["resetCou"+l(1355)]();return}this["_dispatc"+l(178)+l(1229)](m),this[l(1287)+"tManager"]?.["resetEnd"+l(1124)+l(1072)](),this[l(756)+l(992)]?.[l(273)+l(1355)]()},this[n(565)]=null,this[n(553)]=null,this[n(552)+"e"]=null,this[n(659)]=null,this[n(960)+"econnect"]=null,this.onReceiveAck=null,this[n(295)+"mediatel"+n(680)+"ct"]=null,this[n(1640)+n(276)]=this[n(1640)+n(276)][n(1577)](this),this[n(1640)+"ffLine"]=this[n(1640)+n(375)][n(1577)](this),this[n(647)+n(709)]=this[n(647)+"ageHide"][n(1577)](this),this._handlePageShow=this[n(647)+n(779)].bind(this),this[n(163)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(301)](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:n(1349),pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:n(557),env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:u,ws:p}=t,h=Array[n(171)](u)?u:e[n(1118)]==typeof u?[u]:[];if(!h||h.length===0)throw new Error(e.fnBxu);if(!e[n(608)](ba,p))throw new Error(e[n(258)]);Object[n(1038)](this[n(163)],t),this[n(1287)+"tManager"]=new Ss(h,this[n(163)].maxRetries),this[n(756)+n(992)]=new Ca(this[n(163)][n(281)+n(450)]),this[n(163)][n(288)+n(808)]&&(this[n(314)]=!0,this[n(989)]()),this._options[n(1296)+n(757)+"nged"]&&(this._isMiniTT||this[n(1516)+"X"]?this[n(1158)+n(1346)+n(740)]():this._isBrowser&&this[n(169)+n(1566)+n(934)]())}[r(1640)+"nLine"](){let t=r;if(!e[t(1236)](e[t(282)],"bNzow")){if(this[t(163)][t(641)+t(1580)+t(1582)]||this["_readyCl"+t(626)])return;this._handleReconnect()}}[r(1640)+r(375)](){let t=r;if(e[t(1644)](e[t(1277)],e[t(1277)])){if(!this[t(1165)])return;this["_destroy"+t(1263)+"t"](_0x59adb2,_0x39d2d0,_0x10c650)}else{this["_destroy"+t(1263)+"t"]();let n=or(e[t(291)],{message:e.DOfma});this[t(295)+t(1488)+t(680)+"ct"]&&this["onStopIm"+t(1488)+t(680)+"ct"](n)}}[r(169)+"balEvent"+r(934)](){let t=r;e.rhlZm!==t(1140)?(this[t(751)+"er"]&&window[t(1380)+t(934)](t(678),this[t(1640)+t(276)]),this[t(751)+"er"]&&window["addEvent"+t(934)](e[t(1291)],this[t(1640)+t(375)]),this[t(751)+"er"]&&window[t(1380)+t(934)]("pagehide",this[t(647)+t(709)]),this._isBrowser&&window[t(1380)+t(934)](e[t(1199)],this[t(647)+t(779)])):(this[t(955)+t(622)]=_0x2a16f3,this[t(813)]=0)}[r(857)+r(1566)+r(934)](){let t=r;this[t(751)+"er"]&&window[t(923)+t(1204)+"ner"](e[t(471)],this[t(1640)+t(276)]),this[t(751)+"er"]&&window[t(923)+"entListe"+t(231)](e.gpllY,this[t(1640)+t(375)]),this[t(751)+"er"]&&window[t(923)+t(1204)+t(231)](e[t(673)],this[t(647)+t(709)]),this[t(751)+"er"]&&window[t(923)+t(1204)+t(231)](e.ZpXHN,this[t(647)+t(779)])}["_handleP"+r(709)](t){let n=r;!t[n(943)+"d"]&&(this[n(751)+"er"]&&window[n(923)+"entListe"+n(231)](e[n(673)],this[n(647)+n(709)]),this[n(751)+"er"]&&window[n(923)+n(1204)+"ner"](n(933),this[n(647)+"ageShow"]),this[n(1403)]()),this[n(751)+"er"]&&window[n(923)+n(1204)+n(231)](e[n(471)],this[n(1640)+"nLine"]),this[n(751)+"er"]&&window[n(923)+n(1204)+n(231)](e[n(1291)],this[n(1640)+n(375)])}[r(647)+r(779)](t){let n=r;t[n(943)+"d"]&&(this._navigatorOnline()&&(!this[n(1165)]||e[n(644)](this[n(1165)][n(1110)+"te"],this[n(919)])||e.BwHOv(this._ws[n(1110)+"te"],this.CONNECTING))&&this[n(1640)+n(276)](),this[n(751)+"er"]&&window[n(1380)+"Listener"](e[n(471)],this[n(1640)+n(276)]),this[n(751)+"er"]&&window.addEventListener("offline",this[n(1640)+"ffLine"]))}async["_generat"+r(262)](t){let n=r,a={aiqft:function(u,p){return u>=p}};if(e.xQLTg(e[n(1576)],e.oEFmA)){let{fpID:u,deviceID:p,bddID:h,ttwID:m,accessKey:l,aID:_,customParams:v={},enableAutoAck:A,enableQoS:N,QoSLevel:R,env:O}=this[n(163)],ie,ce,hr;this[n(751)+"er"]||this._isMiniWX||this[n(496)+"T"]?(ie=location&&e[n(1295)](e[n(865)],location.protocol)?e[n(1224)]:e.nJPCr,ce=t[n(1317)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),hr=/^wss(.*:\/\/)/[n(165)](t)?t:""+ie+ce):(ie=n(1304),ce=t.replace(/(^http)((?:[s]*:\/\/))/,""),hr=/(^ws)((?:[s]*:\/\/))/[n(165)](ce)?ce:""+ie+ce);let Ls=h?e.ZBWzQ:m?"ttwid":n(1325)+"d",Rs=h||m||p;if(e[n(816)](!Rs,!Ls))throw new Error(e[n(1116)]);let r0=e[n(466)]("function",typeof v)?await v():v,s0=O?e[n(1156)](Sa,O.xUseEnv,O[n(330)]):{},gr=Object[n(1038)]({device_platform:"web",version_code:e.ilsXA,access_key:l,fpid:u,aid:_,[Ls]:Rs,xsack:A?1:0,xaack:A?1:0,xsqos:N?1:0,qos_level:N?R:void 0,qos_sdk_version:2,...s0},r0),i0=Object[n(257)](gr)[n(1091)]((pr,mr)=>gr[mr]!==void 0?""+pr+(pr?"&":"?")+mr+"="+gr[mr]:pr,"");return hr+n(483)+i0}else if(BDEWFG.aiqft(_0x157ec,_0x1ea6e9))return _0x487b8d}async[r(989)](){let t=r;if(!(this._connectLock||this["_readyCl"+t(626)])){this[t(989)+t(1369)]=!0;try{if(e[t(707)]("sJRsb",e[t(208)])){let n=this[t(1287)+t(1117)]?.["checkCur"+t(1030)+t(718)+t(336)+t(1614)](),{timeoutInterval:a}=this._options;if(n){let p=this[t(1287)+"tManager"]?.[t(1539)+"ntEndpoint"](),h=this[t(1287)+t(1117)]?.[t(1331)+"ackupEnd"+t(932)+t(495)+t(841)](),m=this[t(1287)+"tManager"]?.[t(1539)+t(319)+t(698)+t(622)]();if(h){let l="connect "+p+(t(824)+t(160)+t(679)+t(612)+t(1443)+t(1535)+t(1549))+h+(t(335)+"y"),_=e[t(332)](de,e[t(1050)],{message:l,code:qe["MAX_RETR"+t(407)+"R"]});this._debug(l),this[t(186)+t(1330)+t(1229)](_),this[t(829)]=await this[t(1505)+"eUrl"](h),this[t(1343)](t(1470)+h+" "+m+t(1321)),this[t(1299)+t(867)+"rs"]()}else if(e[t(1121)](e[t(615)],t(1563)))this[t(314)]=!0,this._connect();else{let l=t(1470)+p+(t(824)+t(160)+t(679)+t(921));this[t(1343)](l),this[t(186)+"hErrorEv"+t(1229)](e[t(224)](de,e.XecCK,{message:l,code:qe[t(391)+t(407)+"R"]}));return}}else{let p=this[t(1287)+t(1117)]?.[t(1539)+t(319)+t(373)+t(379)](),h=this["_endpoin"+t(1117)]?.[t(1539)+"ntEndpointTriesCount"]();this[t(829)]=await this[t(1505)+"eUrl"](p||""),this[t(1343)](t(1470)+p+" "+h+" times"),this[t(1299)+t(867)+"rs"]()}if(this[t(314)])this[t(314)]=!1;else{let p=e[t(924)](or,e[t(291)],{message:e[t(437)]});this[t(960)+t(1167)]&&this["onStartR"+t(1167)](p)}let u=this[t(1287)+t(1117)]?.[t(1539)+"ntEndpoi"+t(698)+t(622)]()||0;e[t(1383)](u,1)&&await this[t(729)](e[t(198)](u,1)),this._debug(t(1588)+t(1061)+this[t(829)]+(t(1122)+t(342))+this._protocols),this[t(1165)]=e.kNJiC(ya,{url:this[t(829)],protocols:[this[t(1652)+"ls"]],headers:this[t(163)][t(424)+t(1362)+"s"][t(537)+t(1661)]},this[t(163)].ws),(this[t(751)+"er"]||this._isWorker)&&this[t(1165)]&&(this[t(1165)][t(517)+"pe"]=this[t(1094)+t(1237)]),this[t(1305)+t(727)](),this[t(989)+t(1143)+t(215)]=e[t(924)](setTimeout,this._onTimeout[t(1577)](this),a)}else{let n=_0x16e3e5[t(738)+t(624)](_0x20235e);return _0x77943f&&n[t(1380)+t(934)](CSsDJD[t(503)],()=>_0x2dfcb1()),CSsDJD[t(639)](_0xc918d2,n).then(()=>{})}}catch(n){throw this[t(989)+t(1369)]=!1,n}}}_clearTimer(){let t=r;e.dZkZC===e[t(456)]?(e[t(878)](clearTimeout,this["_connect"+t(1143)+"utId"]),this[t(989)+t(1143)+t(215)]=null):(_0x3d3e1e[t(923)+"entListe"+t(231)](CSsDJD[t(831)],_0x2c60d4),_0x47bb2a[t(923)+"entListe"+t(231)](CSsDJD[t(1050)],_0x3d734c))}[r(601)+r(1097)](){let t=r;e[t(847)](clearTimeout,this[t(514)+t(1396)+"Id"]),clearTimeout(this["_reconne"+t(353)+"tId"]),this[t(514)+t(1396)+"Id"]=null,this[t(688)+t(353)+"tId"]=null}[r(1343)](...t){let n=r;this._options[n(686)]&&console[n(775)].apply(console,[n(750)+">",...t])}["_getInte"+r(653)+"e"](t){let n=r,{initReconnectInterval:a,maxReconnectInterval:u,reconnectIntervalGrowFactor:p}=this[n(163)],h=e.mTBNJ(a,Math.pow(p,t-1));return e.mOzqx(h,u)?u:h}[r(1322)](){let t=r;if(this[t(1165)]&&e[t(1268)](this[t(1165)][t(1110)+"te"],this[t(333)+"NG"])){this[t(601)+"ngTimer"](),this[t(514)+t(1396)+"Id"]=setTimeout(this[t(1322)][t(1577)](this),this._options[t(1478)+t(1271)]);return}if(!this._ws||e[t(508)](this[t(1165)][t(1110)+"te"],this[t(919)]))return void this[t(1413)+t(1167)]();this._ws&&this._ws[t(1132)]("hi"),this[t(688)+t(353)+t(381)]=e[t(1646)](setTimeout,this["_handleR"+t(1167)+t(603)][t(1577)](this),this[t(163)][t(250)+t(995)+t(512)])}[r(1413)+r(1167)+"Timeout"](){let t=r;this[t(756)+t(992)]?.[t(473)](),this[t(1412)](e[t(1157)],e[t(260)]),this[t(756)+"sCounter"]?.[t(1215)+"chMaxCount"]()?this[t(1413)+t(1167)]():this[t(1322)]()}[r(493)+r(1245)](){let t=r;return this._isMiniTT||this[t(1516)+"X"]?this[t(619)+t(1592)+t(457)]:(this[t(751)+"er"]||this[t(1483)+"r"])&&this[t(163)][t(1296)+"tworkCha"+t(240)]?navigator[t(376)]:!0}[r(1413)+r(1167)](){let t=r;!this[t(493)+t(1245)]()||this[t(1414)+t(626)]||(this[t(1287)+t(1117)]?.[t(1657)+t(1124)+t(1072)](),this._pingLossCounter?.[t(273)+t(1355)](),this[t(1165)]?this[t(387)+t(986)](1001,e[t(1564)],!0):this[t(989)]())}[r(1158)+r(1346)+r(740)](){let t=r,n={FrUxR:function(a,u){return e[k(212)](a,u)},jsqXG:function(a,u,p){return e[k(609)](a,u,p)},rKGjg:function(a,u){return e[k(515)](a,u)},jzMnR:e[t(820)]};this[t(496)+"T"]?tt[t(1399)+t(1298)+t(346)](({isConnected:a})=>{let u=t;this[u(619)+u(1592)+u(457)]=a,a?this[u(1640)+u(276)]():this[u(1640)+u(375)]()}):this[t(1516)+"X"]&&wx.onNetworkStatusChange(({isConnected:a})=>{let u=t;if(u(806)!==n[u(241)])this["_miniNavigatorOn"+u(457)]=a,a?this[u(1640)+"nLine"]():this["_handleO"+u(375)]();else{let p=0,h=_0x176842,m=_0x3c2432+4;for(;zkpyPM[u(723)](h,m);){let{value:l,offset:_}=zkpyPM[u(655)](_0x940466,_0x4b634f,h);h=_,p=zkpyPM[u(1137)](p,8)>>>0,p+=l}return{value:p,offset:m}}})}[r(729)](t){let n={dqxGr:function(a,u,p){return e.GvQYd(a,u,p)}};return new Promise(a=>{let u=k;n[u(1650)](setTimeout,a,this[u(1013)+u(653)+"e"](t))})}[r(387)+r(986)](t=1e3,n="",a=!1){let u=r;this[u(1165)]&&this[u(239)+u(1263)+"t"](t,n,a)}[r(322)+"ut"](){let t=r,n=this[t(1287)+t(1117)]?.[t(1539)+t(319)+"nt"]();this[t(1343)](t(1470)+n+t(824)),this[t(387)+"ect"](1001,e[t(951)],!0)}[r(1494)](t){let n=r,a={MRVPO:e.RmkvX,nsGuo:e[n(1157)],MnZQi:function(u,p,h){return u(p,h)},isoAC:function(u,p){return e[n(1107)](u,p)},wDVdx:"ping_onc"+n(1187)+"s"};if(e[n(888)]!==e[n(1166)]){let u=e[n(529)](ir,t);this[n(1165)]&&this._ws[n(1110)+"te"]===this[n(919)]&&(this[n(1165)]&&this._ws[n(1132)](u),this[n(1343)](e.TQBkq,t))}else{let u={EPoJy:function(p,h){return a[n(1521)](p,h)},colRG:"success",DxIKj:a[n(1144)],pYYPb:a.nsGuo};return new _0x841e95((p,h)=>{let m=n,l={ufwil:a[m(974)],DjCQx:m(1502)+m(1187)+"s",KBitN:a.nsGuo};this[m(601)+"ngTimer"](),this[m(514)+"gTimeoutId"]=a.MnZQi(_0x135ce8,this[m(1322)][m(1577)](this),this[m(163)][m(1478)+"rval"]);let _=()=>{let A=m;u[A(696)](p,u[A(1206)]),this.off(u.DxIKj,_),this[A(1342)](u[A(801)],v)},v=()=>{let A=m;h(l[A(228)]),this.off(l.DjCQx,_),this[A(1342)](l[A(1225)],v)};this.on(m(1502)+m(1187)+"s",_),this.on(a.nsGuo,v),this._ping()})}}[r(1299)+r(867)+"rs"](){let t=r,n=e[t(1462)].split("|"),a=0;for(;;){switch(n[a++]){case"0":this[t(1165)][t(923)+t(1204)+t(231)](t(1403),this[t(1529)]);continue;case"1":this[t(1165)]["removeEv"+t(1204)+"ner"](e[t(544)],this._onMessage);continue;case"2":if(!this._ws)return;continue;case"3":this._ws[t(923)+t(1204)+t(231)](e[t(1050)],this[t(1039)]);continue;case"4":this[t(1165)][t(923)+t(1204)+t(231)](e[t(666)],this[t(388)]);continue}break}}["_addWsLi"+r(727)](){let t=r,n=(t(637)+"4")[t(460)]("|"),a=0;for(;;){switch(n[a++]){case"0":this[t(1165)]["addEvent"+t(934)](e[t(967)],this._onClose);continue;case"1":this[t(1165)][t(1380)+t(934)](e[t(544)],this[t(220)+"ge"]);continue;case"2":if(!this[t(1165)])return;continue;case"3":this[t(1165)].addEventListener(e[t(666)],this[t(388)]);continue;case"4":this._ws[t(1380)+t(934)]("error",this._onError);continue}break}}[r(167)+"nceClose"](t=1e3,n=""){let a=r;try{this._ws&&this[a(1165)][a(1403)](t,n)}catch{}}[r(239)+r(1263)+"t"](t=1e3,n="",a=!1){let u=r;if(this["_clearPi"+u(1097)](),this[u(1056)+"mer"](),this[u(1299)+"sListeners"](),this[u(167)+u(1096)](1e3,n),this[u(989)+u(1369)]=!1,a&&this[u(493)+u(1245)]()&&!this["_readyCl"+u(626)]){if(this[u(1287)+"tManager"]?.[u(1215)+u(1269)+"es"]())if(e[u(1250)]!==e[u(1365)]){let h=this[u(1287)+"tManager"]?.[u(1539)+u(319)+"nt"]();this[u(186)+u(178)+u(1229)](pe(e[u(967)],{code:1006,reason:"connect "+h+(u(824)+u(160)+u(679)+u(921)),wasClean:!0}))}else{let{pingInterval:h,pingFrequency:m}=this._options;if((e[u(1014)]("hi",_0x437baf[u(1436)])&&m==="always"||e[u(509)](e.yzOuH,m))&&(this[u(601)+u(1097)](),this[u(1412)](e[u(400)],e[u(831)]),this[u(514)+"gTimeoutId"]=e.EnKdD(_0x35c01b,this[u(1322)][u(1577)](this),h)),_0x56f17c.data==="hi")return;try{e[u(217)](_0x401310,this,_0x49673b,[_0x2d4e1c,_0x359677,_0x48f1d6,_0x4007e5,_0x315cd7,_0x55862e])}catch(l){let _=e.TXDxl(_0x398ec7,u(939),{message:l[u(1200)],code:_0x33f08f.MESSAGE_ERROR,error:l});this[u(186)+"hErrorEv"+u(1229)](_)}}else{let h=this[u(163)][u(366)+"tInterce"+u(576)](t,n);this[u(186)+u(178)+u(1229)](e.kfPVE(pe,u(1403),{code:t,reason:n,wasClean:!0,willReconnect:h})),h&&this[u(989)]()}return}this[u(493)+"orOnline"]()||this["_readyCl"+u(626)]?this[u(186)+u(178)+u(1229)](pe(e[u(967)],{code:t,reason:e[u(1306)]})):this["_dispatchCloseEv"+u(1229)](e[u(785)](pe,e[u(967)],{code:1006,reason:e.rLpfX})),this[u(1165)]=null,this[u(1287)+"tManager"]?.["resetEnd"+u(1124)+u(1072)](),this._pingLossCounter?.[u(273)+u(1355)]()}_dispatchOpenEvent(t){let n=r;this.emit(n(280),t),this[n(659)]&&this[n(659)](t)}["_dispatc"+r(468)+r(913)](t){let n=r;this.emit(e[n(544)],t),this[n(552)+"e"]&&this.onmessage(t)}["_dispatchAckMess"+r(1410)](t){let n=r;this[n(1412)](n(338),t),this[n(882)+n(442)]&&this["onReceiv"+n(442)](t)}[r(186)+"hErrorEv"+r(1229)](t){let n=r;this[n(1412)](e[n(1050)],t),this[n(553)]&&this[n(553)](t)}[r(186)+r(178)+r(1229)](t){let n=r;this[n(1412)](e[n(967)],t),this[n(565)]&&this[n(565)](t)}get[r(517)+"pe"](){let t=r;return this[t(1165)]?this[t(1165)][t(517)+"pe"]:this[t(1094)+t(1237)]}set[r(517)+"pe"](t){let n=r,a={CqXaH:function(u,p,h){return e[k(1057)](u,p,h)}};e[n(274)](e.EeSRR,e[n(1574)])?(this[n(1094)+"ype"]=t,this._ws&&(this[n(1165)][n(517)+"pe"]=t)):(hqmkrC[n(795)](_0x5bed50,_0x270440,50),hqmkrC[n(795)](_0x1d1c06,_0x3e1755,_0x41d59a))}get retryCount(){let t=r;return this[t(1287)+t(1117)]?.[t(1539)+"ntEndpoi"+t(698)+t(622)]()||0}get bufferedAmount(){let t=r,n=this[t(431)+t(1288)].reduce((a,u)=>(a+=u&&u.byteLength||0,a),0);return e[t(1338)](n,this._ws?this[t(1165)]["buffered"+t(1557)]:0)}get extensions(){let t=r;return this[t(1165)]?this[t(1165)][t(369)+"ns"]:""}get[r(402)](){let t=r;return this[t(1165)]?this[t(1165)][t(402)]:""}get readyState(){let t=r,n={CLsbH:function(a,u){return e.yMnab(a,u)},FzMhc:e.HPLgT,HJBvD:function(a,u){return e[k(620)](a,u)},bUcCA:function(a,u){return e.ivvqB(a,u)},ihlUU:function(a,u){return e.Vtpdq(a,u)}};if(e[t(851)](e[t(1426)],t(1181)))return this[t(1165)]?this[t(1165)][t(1110)+"te"]:this._options[t(288)+"cOpen"]?this[t(333)+"NG"]:this[t(1449)];{if(EceIWY[t(1511)](_0x341f7c,_0x48d3ef))throw new _0x97fb18(EceIWY[t(175)]);let a=3;for(;EceIWY.HJBvD(a,0);){let u=EceIWY[t(1283)](255,_0x37f3fc);_0x1cf881(u,_0x10f7e2,_0x473921+a),_0x562bbd>>>=8,a--}return EceIWY[t(1544)](_0x23c66e,4)}}get url(){let t=r;return this._ws?this[t(1165)][t(1045)]:this._url}[r(1403)](t=1e3,n){let a=r,u=e[a(476)][a(460)]("|"),p=0;for(;;){switch(u[p++]){case"0":this[a(857)+"balEvent"+a(934)]();continue;case"1":this[a(957)+"ger"]?.[a(216)]();continue;case"2":if(!this[a(1165)])return void this._debug("close, w"+a(432)+"ce not i"+a(244)+"ed");continue;case"3":this[a(1414)+a(626)]=!0;continue;case"4":if(e[a(715)](this[a(1165)][a(1110)+"te"],this.CLOSED)||e.mlGPh(this._ws[a(1110)+"te"],this[a(664)]))return void this[a(1343)](e.QxKxB);continue;case"5":this._clearPingTimer();continue;case"6":this[a(239)+a(1263)+"t"](t,n);continue;case"7":this[a(1056)+a(804)]();continue}break}}async[r(1132)](t,n){let a=r;if(e.LKQal(null,t))throw new Error(e[a(1632)]);a(1309)==typeof t&&(t=JSON[a(1047)+"y"](t)),e[a(1293)](e[a(1118)],typeof t)&&!(t instanceof ArrayBuffer)&&!(t[a(506)]&&t[a(506)]instanceof ArrayBuffer)&&(t=JSON[a(1047)+"y"](t));let u=await e[a(608)](ks,t),p=e[a(243)](va,t),{method:h=0,service:m=this[a(163)][a(249)],logID:l=this[a(163)][a(1641)+a(394)](),headers:_=this._options.headers,payloadEncoding:v=this[a(163)][a(230)+a(320)],payloadType:A=this[a(163)][a(1195)+a(1237)],logIDNew:N=this._options["logIDNew"+a(705)][a(185)+a(663)+a(899)+"ew"]?e.lDmlh(o,this[a(163)][a(172)+a(705)][a(1444)]):""}=n||{};if(!m)throw new Error("please provide a"+a(782)+a(632));let R={SeqID:M[a(1164)+"er"](this._seqId++),LogID:M[a(1164)+"er"](l),service:m,method:h,headers:_,payloadEncoding:e.Krcsa(v,Object)?v[a(993)]?v[a(993)]:"":v,payloadType:e[a(1658)](A,Object)?A.type?A.type:p:A||p,payload:u,LogIDNew:N},O=ir(R);return this[a(1165)]&&e[a(1121)](this[a(1165)].readyState,this[a(919)])?(this._ws&&this[a(1165)][a(1132)](O),this[a(1343)](e.TJQvj,R)):e.xLbNC(this[a(431)+a(1288)][a(1620)],this[a(163)]["maxMessa"+a(1274)+a(1471)])?(this[a(431)+a(1288)].push(O),this[a(1343)](e[a(930)],R)):(this[a(431)+a(1288)][a(1513)](),this[a(431)+a(1288)].push(O)),{seqID:this[a(1226)],logID:l,logIDNew:N}}async reconnect(t){let n=r,{url:a}=e[n(1371)](t,{}),u=Array[n(171)](a)?a:e.iYuFb==typeof a?[a]:[];t&&Object[n(1038)](this[n(163)],t),u&&u[n(1620)]?this[n(1287)+n(1117)]=new Ss(u,this[n(163)][n(326)+"es"]):this["_endpoin"+n(1117)]?.[n(1657)+"pointCon"+n(1072)](),this[n(756)+n(992)]?.[n(273)+n(1355)](this._options["pingLoss"+n(450)]),this["_readyCl"+n(626)]=!1,this[n(1165)]&&this._ws[n(1110)+"te"]!==this.CLOSED?this[n(387)+n(986)](1e3,e[n(1408)],!0):(this[n(314)]=!0,this._connect())}async[r(1434)](){let t=r;if(!this["_connect"+t(1369)]){let n=e[t(177)][t(460)]("|"),a=0;for(;;){switch(n[a++]){case"0":this[t(1287)+t(1117)]?.[t(1657)+t(1124)+"fig"]();continue;case"1":this[t(756)+t(992)]?.resetCounter();continue;case"2":this[t(314)]=!0;continue;case"3":this[t(1414)+t(626)]=!1;continue;case"4":this._connect();continue}break}}}[r(1380)+r(934)](t,n){this.on(t,n)}[r(156)+r(913)](t){let{type:n}=t;this.emit(n,t)}removeEventListener(t,n){let a=r;e[a(1509)]===e[a(1136)]?this[a(1184)]?.del(_0x454692.message_id):this[a(1342)](t,n)}[r(1506)](){let t=r,n={gDuGT:function(a,u){return a(u)},WkeYk:e[t(400)],qetRz:e[t(1157)],EHdxn:function(a,u){return a>>u},rtgSg:function(a,u){return e[t(1543)](a,u)},fyOev:function(a,u,p){return a(u,p)},jThnq:e[t(1050)],ZvzKJ:t(1403),iIOES:function(a,u){return e[t(1027)](a,u)},FHEFi:e[t(803)],azGsA:function(a,u){return e[t(936)](a,u)},hZOil:e.RmkvX,FBUAI:e.dCuRs};return new Promise((a,u)=>{let p=t,h={iOqtX:function(m,l,_){return n[k(892)](m,l,_)},vxboB:n.jThnq,LMFnj:n[p(1303)],SihdS:function(m,l){return n[p(1058)](m,l)},bIbBq:n[p(1147)],DUVth:function(m,l){return n[p(389)](m,l)},RAgoG:n[p(1570)],SfnFh:n[p(542)]};if(n[p(1058)](n.FBUAI,"bgNmQ")){this._clearPingTimer(),this[p(514)+p(1396)+"Id"]=setTimeout(this[p(1322)][p(1577)](this),this[p(163)][p(1478)+p(1271)]);let m=()=>{let _=p;n[_(356)](a,_(227)),this.off(n[_(810)],m),this.off(n[_(542)],l)},l=()=>{let _=p;if(h[_(534)](h[_(736)],"ghlDe")){let v=IWoQLO[_(206)](_0x5793d1,IWoQLO[_(1550)],{message:this["_formatE"+_(1311)+_(1642)](_0x253b16)});this.emit(IWoQLO[_(1550)],v);let A=IWoQLO[_(206)](_0x2a35e0,IWoQLO[_(1103)],{reason:this["_formatE"+_(1311)+_(1642)](_0x29f7c3)});this[_(1412)](_(1403),A)}else h[_(789)](u,h[_(1230)]),this[_(1342)](_(1502)+_(1187)+"s",m),this[_(1342)](h[_(1273)],l)};this.on(n.WkeYk,m),this.on(n[p(542)],l),this[p(1322)]()}else return _0x59d3a6|=0,{low:_0x778678,high:BQVyvH[p(418)](_0x4788e4,31),unsigned:BQVyvH.rtgSg(_0x281f96,0)}})}}})(),X[S(253)+S(1635)]=Y[S(253)+S(1635)],X[S(1579)+S(1606)]=Y[S(1579)+"rorEvent"],X[S(618)+"e"]=Y[S(618)+"e"],X[S(913)]=Y.Event,X[S(558)]=Y[S(558)],X[S(566)+S(1545)+S(748)]=Y[S(566)+S(1545)+S(748)],X[S(1545)+S(748)]=Y[S(1545)+S(748)],X[S(580)+"t"]=Y[S(580)+"t"],X[S(1011)+S(699)]=Y[S(1011)+S(699)],X.createCloseEvent=Y[S(1517)+S(1635)],X[S(1531)+S(1606)]=Y[S(1531)+S(1606)],X[S(536)+"ssageEvent"]=Y["createMe"+S(822)+"nt"],X["createOp"+S(890)]=Y[S(504)+S(890)],X[S(661)+S(1492)+S(748)]=Y["createRe"+S(1492)+S(748)],X[S(218)+S(574)]=Y[S(218)+"rame"],X[S(672)+S(1028)]=Y[S(672)+"ame"];for(Pn in Y)[S(253)+"oseEvent",S(1579)+S(1606),S(618)+"e",S(913),S(558),"Frontier"+S(1545)+S(748),S(1545)+S(748),"OpenEvent","Reconnec"+S(699),S(1517)+"oseEvent",S(1531)+S(1606),S(536)+"ssageEvent",S(504)+S(890),"createRe"+S(1492)+S(748),S(218)+S(574),S(672)+S(1028)][S(1648)](Pn)===-1&&(X[Pn]=Y[Pn]);var Pn;Object[S(1067)+"operty"](X,"__esModule",{value:!0})});var Ne=oe((gh,Ui)=>{"use strict";var qi=["nodebuffer","arraybuffer","fragments"],Fi=typeof Blob<"u";Fi&&qi.push("blob");Ui.exports={BINARY_TYPES:qi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Fi,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var zt=oe((ph,On)=>{"use strict";var{EMPTY_BUFFER:xx}=Ne(),Ir=Buffer[Symbol.species];function ux(r,e){if(r.length===0)return xx;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),o=0;for(let c=0;c<r.length;c++){let x=r[c];i.set(x,o),o+=x.length}return o<e?new Ir(i.buffer,i.byteOffset,o):i}function Hi(r,e,i,o,c){for(let x=0;x<c;x++)i[o+x]=r[x]^e[x&3]}function Ki(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 Tr(r){if(Tr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new Ir(r):ArrayBuffer.isView(r)?e=new Ir(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),Tr.readOnly=!1),e}On.exports={concat:ux,mask:Hi,toArrayBuffer:fx,toBuffer:Tr,unmask:Ki};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=V("bufferutil");On.exports.mask=function(e,i,o,c,x){x<48?Hi(e,i,o,c,x):r.mask(e,i,o,c,x)},On.exports.unmask=function(e,i){e.length<32?Ki(e,i):r.unmask(e,i)}}catch{}});var ji=oe((mh,Wi)=>{"use strict";var Gi=Symbol("kDone"),Lr=Symbol("kRun"),Rr=class{constructor(e){this[Gi]=()=>{this.pending--,this[Lr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Lr]()}[Lr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Gi])}}};Wi.exports=Rr});var gt=oe((wh,Xi)=>{"use strict";var qt=V("zlib"),Ji=zt(),dx=ji(),{kStatusCode:Vi}=Ne(),lx=Buffer[Symbol.species],hx=Buffer.from([0,0,255,255]),Mn=Symbol("permessage-deflate"),Oe=Symbol("total-length"),lt=Symbol("callback"),We=Symbol("buffers"),ht=Symbol("error"),Bn,Nr=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!Bn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Bn=new dx(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[lt];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,o=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(!o)throw new Error("None of the extension offers can be accepted");return i.serverNoContextTakeover&&(o.server_no_context_takeover=!0),i.clientNoContextTakeover&&(o.client_no_context_takeover=!0),typeof i.serverMaxWindowBits=="number"&&(o.server_max_window_bits=i.serverMaxWindowBits),typeof i.clientMaxWindowBits=="number"?o.client_max_window_bits=i.clientMaxWindowBits:(o.client_max_window_bits===!0||i.clientMaxWindowBits===!1)&&delete o.client_max_window_bits,o}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(o=>{let c=i[o];if(c.length>1)throw new Error(`Parameter "${o}" must have only a single value`);if(c=c[0],o==="client_max_window_bits"){if(c!==!0){let x=+c;if(!Number.isInteger(x)||x<8||x>15)throw new TypeError(`Invalid value for parameter "${o}": ${c}`);c=x}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${o}": ${c}`)}else if(o==="server_max_window_bits"){let x=+c;if(!Number.isInteger(x)||x<8||x>15)throw new TypeError(`Invalid value for parameter "${o}": ${c}`);c=x}else if(o==="client_no_context_takeover"||o==="server_no_context_takeover"){if(c!==!0)throw new TypeError(`Invalid value for parameter "${o}": ${c}`)}else throw new Error(`Unknown parameter "${o}"`);i[o]=c})}),e}decompress(e,i,o){Bn.add(c=>{this._decompress(e,i,(x,f)=>{c(),o(x,f)})})}compress(e,i,o){Bn.add(c=>{this._compress(e,i,(x,f)=>{c(),o(x,f)})})}_decompress(e,i,o){let c=this._isServer?"client":"server";if(!this._inflate){let x=`${c}_max_window_bits`,f=typeof this.params[x]!="number"?qt.Z_DEFAULT_WINDOWBITS:this.params[x];this._inflate=qt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:f}),this._inflate[Mn]=this,this._inflate[Oe]=0,this._inflate[We]=[],this._inflate.on("error",px),this._inflate.on("data",Yi)}this._inflate[lt]=o,this._inflate.write(e),i&&this._inflate.write(hx),this._inflate.flush(()=>{let x=this._inflate[ht];if(x){this._inflate.close(),this._inflate=null,o(x);return}let f=Ji.concat(this._inflate[We],this._inflate[Oe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Oe]=0,this._inflate[We]=[],i&&this.params[`${c}_no_context_takeover`]&&this._inflate.reset()),o(null,f)})}_compress(e,i,o){let c=this._isServer?"server":"client";if(!this._deflate){let x=`${c}_max_window_bits`,f=typeof this.params[x]!="number"?qt.Z_DEFAULT_WINDOWBITS:this.params[x];this._deflate=qt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:f}),this._deflate[Oe]=0,this._deflate[We]=[],this._deflate.on("data",gx)}this._deflate[lt]=o,this._deflate.write(e),this._deflate.flush(qt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let x=Ji.concat(this._deflate[We],this._deflate[Oe]);i&&(x=new lx(x.buffer,x.byteOffset,x.length-4)),this._deflate[lt]=null,this._deflate[Oe]=0,this._deflate[We]=[],i&&this.params[`${c}_no_context_takeover`]&&this._deflate.reset(),o(null,x)})}};Xi.exports=Nr;function gx(r){this[We].push(r),this[Oe]+=r.length}function Yi(r){if(this[Oe]+=r.length,this[Mn]._maxPayload<1||this[Oe]<=this[Mn]._maxPayload){this[We].push(r);return}this[ht]=new RangeError("Max payload size exceeded"),this[ht].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ht][Vi]=1009,this.removeListener("data",Yi),this.reset()}function px(r){if(this[Mn]._inflate=null,this[ht]){this[lt](this[ht]);return}r[Vi]=1007,this[lt](r)}});var pt=oe((_h,zn)=>{"use strict";var{isUtf8:$i}=V("buffer"),{hasBlob:mx}=Ne(),_x=[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 yx(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Or(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 bx(r){return mx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}zn.exports={isBlob:bx,isValidStatusCode:yx,isValidUTF8:Or,tokenChars:_x};if($i)zn.exports.isValidUTF8=function(r){return r.length<24?Or(r):$i(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=V("utf-8-validate");zn.exports.isValidUTF8=function(e){return e.length<32?Or(e):r(e)}}catch{}});var Fr=oe((yh,so)=>{"use strict";var{Writable:vx}=V("stream"),Qi=gt(),{BINARY_TYPES:Sx,EMPTY_BUFFER:Zi,kStatusCode:Cx,kWebSocket:Ex}=Ne(),{concat:Br,toArrayBuffer:Ax,unmask:kx}=zt(),{isValidStatusCode:Px,isValidUTF8:eo}=pt(),qn=Buffer[Symbol.species],le=0,to=1,no=2,ro=3,Mr=4,zr=5,Fn=6,qr=class extends vx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Sx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ex]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=le}_write(e,i,o){if(this._opcode===8&&this._state==le)return o();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(o)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let o=this._buffers[0];return this._buffers[0]=new qn(o.buffer,o.byteOffset+e,o.length-e),new qn(o.buffer,o.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let o=this._buffers[0],c=i.length-e;e>=o.length?i.set(this._buffers.shift(),c):(i.set(new Uint8Array(o.buffer,o.byteOffset,e),c),this._buffers[0]=new qn(o.buffer,o.byteOffset+e,o.length-e)),e-=o.length}while(e>0);return i}startLoop(e){this._loop=!0;do switch(this._state){case le:this.getInfo(e);break;case to:this.getPayloadLength16(e);break;case no:this.getPayloadLength64(e);break;case ro:this.getMask();break;case Mr:this.getData(e);break;case zr:case Fn: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 o=(i[0]&64)===64;if(o&&!this._extensions[Qi.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(o){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=o}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(o){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=to:this._payloadLength===127?this._state=no: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),o=i.readUInt32BE(0);if(o>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=o*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=ro:this._state=Mr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Mr}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=zr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Qi.extensionName].decompress(e,this._fin,(c,x)=>{if(c)return i(c);if(x.length){if(this._messageLength+=x.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let f=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(f);return}this._fragments.push(x)}this.dataMessage(i),this._state===le&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=le;return}let i=this._messageLength,o=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let c;this._binaryType==="nodebuffer"?c=Br(o,i):this._binaryType==="arraybuffer"?c=Ax(Br(o,i)):this._binaryType==="blob"?c=new Blob(o):c=o,this._allowSynchronousEvents?(this.emit("message",c,!0),this._state=le):(this._state=Fn,setImmediate(()=>{this.emit("message",c,!0),this._state=le,this.startLoop(e)}))}else{let c=Br(o,i);if(!this._skipUTF8Validation&&!eo(c)){let x=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(x);return}this._state===zr||this._allowSynchronousEvents?(this.emit("message",c,!1),this._state=le):(this._state=Fn,setImmediate(()=>{this.emit("message",c,!1),this._state=le,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Zi),this.end();else{let o=e.readUInt16BE(0);if(!Px(o)){let x=this.createError(RangeError,`invalid status code ${o}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(x);return}let c=new qn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!eo(c)){let x=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(x);return}this._loop=!1,this.emit("conclude",o,c),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(i)}))}createError(e,i,o,c,x){this._loop=!1,this._errored=!0;let f=new e(o?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(f,this.createError),f.code=x,f[Cx]=c,f}};so.exports=qr});var Kr=oe((vh,ao)=>{"use strict";var{Duplex:bh}=V("stream"),{randomFillSync:Dx}=V("crypto"),io=gt(),{EMPTY_BUFFER:Ix,kWebSocket:Tx,NOOP:Lx}=Ne(),{isBlob:mt,isValidStatusCode:Rx}=pt(),{mask:oo,toBuffer:$e}=zt(),he=Symbol("kByteLength"),Nx=Buffer.alloc(4),Un=8*1024,Qe,wt=Un,we=0,Ox=1,Bx=2,Ur=class r{constructor(e,i,o){this._extensions=i||{},o&&(this._generateMask=o,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=we,this.onerror=Lx,this[Tx]=void 0}static frame(e,i){let o,c=!1,x=2,f=!1;i.mask&&(o=i.maskBuffer||Nx,i.generateMask?i.generateMask(o):(wt===Un&&(Qe===void 0&&(Qe=Buffer.alloc(Un)),Dx(Qe,0,Un),wt=0),o[0]=Qe[wt++],o[1]=Qe[wt++],o[2]=Qe[wt++],o[3]=Qe[wt++]),f=(o[0]|o[1]|o[2]|o[3])===0,x=6);let d;typeof e=="string"?(!i.mask||f)&&i[he]!==void 0?d=i[he]:(e=Buffer.from(e),d=e.length):(d=e.length,c=i.mask&&i.readOnly&&!f);let g=d;d>=65536?(x+=8,g=127):d>125&&(x+=2,g=126);let w=Buffer.allocUnsafe(c?d+x:x);return w[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(w[0]|=64),w[1]=g,g===126?w.writeUInt16BE(d,2):g===127&&(w[2]=w[3]=0,w.writeUIntBE(d,4,6)),i.mask?(w[1]|=128,w[x-4]=o[0],w[x-3]=o[1],w[x-2]=o[2],w[x-1]=o[3],f?[w,e]:c?(oo(e,o,w,x,d),[w]):(oo(e,o,e,0,d),[w,e])):[w,e]}close(e,i,o,c){let x;if(e===void 0)x=Ix;else{if(typeof e!="number"||!Rx(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)x=Buffer.allocUnsafe(2),x.writeUInt16BE(e,0);else{let d=Buffer.byteLength(i);if(d>123)throw new RangeError("The message must not be greater than 123 bytes");x=Buffer.allocUnsafe(2+d),x.writeUInt16BE(e,0),typeof i=="string"?x.write(i,2):x.set(i,2)}}let f={[he]:x.length,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==we?this.enqueue([this.dispatch,x,!1,f,c]):this.sendFrame(r.frame(x,f),c)}ping(e,i,o){let c,x;if(typeof e=="string"?(c=Buffer.byteLength(e),x=!1):mt(e)?(c=e.size,x=!1):(e=$e(e),c=e.length,x=$e.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let f={[he]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:x,rsv1:!1};mt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,f,o]):this.getBlobData(e,!1,f,o):this._state!==we?this.enqueue([this.dispatch,e,!1,f,o]):this.sendFrame(r.frame(e,f),o)}pong(e,i,o){let c,x;if(typeof e=="string"?(c=Buffer.byteLength(e),x=!1):mt(e)?(c=e.size,x=!1):(e=$e(e),c=e.length,x=$e.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let f={[he]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:x,rsv1:!1};mt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,f,o]):this.getBlobData(e,!1,f,o):this._state!==we?this.enqueue([this.dispatch,e,!1,f,o]):this.sendFrame(r.frame(e,f),o)}send(e,i,o){let c=this._extensions[io.extensionName],x=i.binary?2:1,f=i.compress,d,g;typeof e=="string"?(d=Buffer.byteLength(e),g=!1):mt(e)?(d=e.size,g=!1):(e=$e(e),d=e.length,g=$e.readOnly),this._firstFragment?(this._firstFragment=!1,f&&c&&c.params[c._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(f=d>=c._threshold),this._compress=f):(f=!1,x=0),i.fin&&(this._firstFragment=!0);let w={[he]:d,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:x,readOnly:g,rsv1:f};mt(e)?this._state!==we?this.enqueue([this.getBlobData,e,this._compress,w,o]):this.getBlobData(e,this._compress,w,o):this._state!==we?this.enqueue([this.dispatch,e,this._compress,w,o]):this.dispatch(e,this._compress,w,o)}getBlobData(e,i,o,c){this._bufferedBytes+=o[he],this._state=Bx,e.arrayBuffer().then(x=>{if(this._socket.destroyed){let d=new Error("The socket was closed while the blob was being read");process.nextTick(Hr,this,d,c);return}this._bufferedBytes-=o[he];let f=$e(x);i?this.dispatch(f,i,o,c):(this._state=we,this.sendFrame(r.frame(f,o),c),this.dequeue())}).catch(x=>{process.nextTick(Mx,this,x,c)})}dispatch(e,i,o,c){if(!i){this.sendFrame(r.frame(e,o),c);return}let x=this._extensions[io.extensionName];this._bufferedBytes+=o[he],this._state=Ox,x.compress(e,o.fin,(f,d)=>{if(this._socket.destroyed){let g=new Error("The socket was closed while data was being compressed");Hr(this,g,c);return}this._bufferedBytes-=o[he],this._state=we,o.readOnly=!1,this.sendFrame(r.frame(d,o),c),this.dequeue()})}dequeue(){for(;this._state===we&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,i){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],i),this._socket.uncork()):this._socket.write(e[0],i)}};ao.exports=Ur;function Hr(r,e,i){typeof i=="function"&&i(e);for(let o=0;o<r._queue.length;o++){let c=r._queue[o],x=c[c.length-1];typeof x=="function"&&x(e)}}function Mx(r,e,i){Hr(r,e,i),r.onerror(e)}});var mo=oe((Sh,po)=>{"use strict";var{kForOnEventAttribute:Ft,kListener:Gr}=Ne(),co=Symbol("kCode"),xo=Symbol("kData"),uo=Symbol("kError"),fo=Symbol("kMessage"),lo=Symbol("kReason"),_t=Symbol("kTarget"),ho=Symbol("kType"),go=Symbol("kWasClean"),Be=class{constructor(e){this[_t]=null,this[ho]=e}get target(){return this[_t]}get type(){return this[ho]}};Object.defineProperty(Be.prototype,"target",{enumerable:!0});Object.defineProperty(Be.prototype,"type",{enumerable:!0});var Ze=class extends Be{constructor(e,i={}){super(e),this[co]=i.code===void 0?0:i.code,this[lo]=i.reason===void 0?"":i.reason,this[go]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[co]}get reason(){return this[lo]}get wasClean(){return this[go]}};Object.defineProperty(Ze.prototype,"code",{enumerable:!0});Object.defineProperty(Ze.prototype,"reason",{enumerable:!0});Object.defineProperty(Ze.prototype,"wasClean",{enumerable:!0});var yt=class extends Be{constructor(e,i={}){super(e),this[uo]=i.error===void 0?null:i.error,this[fo]=i.message===void 0?"":i.message}get error(){return this[uo]}get message(){return this[fo]}};Object.defineProperty(yt.prototype,"error",{enumerable:!0});Object.defineProperty(yt.prototype,"message",{enumerable:!0});var Ut=class extends Be{constructor(e,i={}){super(e),this[xo]=i.data===void 0?null:i.data}get data(){return this[xo]}};Object.defineProperty(Ut.prototype,"data",{enumerable:!0});var zx={addEventListener(r,e,i={}){for(let c of this.listeners(r))if(!i[Ft]&&c[Gr]===e&&!c[Ft])return;let o;if(r==="message")o=function(x,f){let d=new Ut("message",{data:f?x:x.toString()});d[_t]=this,Hn(e,this,d)};else if(r==="close")o=function(x,f){let d=new Ze("close",{code:x,reason:f.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});d[_t]=this,Hn(e,this,d)};else if(r==="error")o=function(x){let f=new yt("error",{error:x,message:x.message});f[_t]=this,Hn(e,this,f)};else if(r==="open")o=function(){let x=new Be("open");x[_t]=this,Hn(e,this,x)};else return;o[Ft]=!!i[Ft],o[Gr]=e,i.once?this.once(r,o):this.on(r,o)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Gr]===e&&!i[Ft]){this.removeListener(r,i);break}}};po.exports={CloseEvent:Ze,ErrorEvent:yt,Event:Be,EventTarget:zx,MessageEvent:Ut};function Hn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Kn=oe((Ch,wo)=>{"use strict";var{tokenChars:Ht}=pt();function Ae(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function qx(r){let e=Object.create(null),i=Object.create(null),o=!1,c=!1,x=!1,f,d,g=-1,w=-1,b=-1,y=0;for(;y<r.length;y++)if(w=r.charCodeAt(y),f===void 0)if(b===-1&&Ht[w]===1)g===-1&&(g=y);else if(y!==0&&(w===32||w===9))b===-1&&g!==-1&&(b=y);else if(w===59||w===44){if(g===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y);let P=r.slice(g,b);w===44?(Ae(e,P,i),i=Object.create(null)):f=P,g=b=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(d===void 0)if(b===-1&&Ht[w]===1)g===-1&&(g=y);else if(w===32||w===9)b===-1&&g!==-1&&(b=y);else if(w===59||w===44){if(g===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y),Ae(i,r.slice(g,b),!0),w===44&&(Ae(e,f,i),i=Object.create(null),f=void 0),g=b=-1}else if(w===61&&g!==-1&&b===-1)d=r.slice(g,y),g=b=-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}`);g===-1?g=y:o||(o=!0),c=!1}else if(x)if(Ht[w]===1)g===-1&&(g=y);else if(w===34&&g!==-1)x=!1,b=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)x=!0;else if(b===-1&&Ht[w]===1)g===-1&&(g=y);else if(g!==-1&&(w===32||w===9))b===-1&&(b=y);else if(w===59||w===44){if(g===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y);let P=r.slice(g,b);o&&(P=P.replace(/\\/g,""),o=!1),Ae(i,d,P),w===44&&(Ae(e,f,i),i=Object.create(null),f=void 0),d=void 0,g=b=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(g===-1||x||w===32||w===9)throw new SyntaxError("Unexpected end of input");b===-1&&(b=y);let C=r.slice(g,b);return f===void 0?Ae(e,C,i):(d===void 0?Ae(i,C,!0):o?Ae(i,d,C.replace(/\\/g,"")):Ae(i,d,C),Ae(e,f,i)),e}function Fx(r){return Object.keys(r).map(e=>{let i=r[e];return Array.isArray(i)||(i=[i]),i.map(o=>[e].concat(Object.keys(o).map(c=>{let x=o[c];return Array.isArray(x)||(x=[x]),x.map(f=>f===!0?c:`${c}=${f}`).join("; ")})).join("; ")).join(", ")}).join(", ")}wo.exports={format:Fx,parse:qx}});var Jn=oe((kh,Io)=>{"use strict";var Ux=V("events"),Hx=V("https"),Kx=V("http"),bo=V("net"),Gx=V("tls"),{randomBytes:Wx,createHash:jx}=V("crypto"),{Duplex:Eh,Readable:Ah}=V("stream"),{URL:Wr}=V("url"),je=gt(),Jx=Fr(),Vx=Kr(),{isBlob:Yx}=pt(),{BINARY_TYPES:_o,CLOSE_TIMEOUT:Xx,EMPTY_BUFFER:Gn,GUID:$x,kForOnEventAttribute:jr,kListener:Qx,kStatusCode:Zx,kWebSocket:$,NOOP:vo}=Ne(),{EventTarget:{addEventListener:eu,removeEventListener:tu}}=mo(),{format:nu,parse:ru}=Kn(),{toBuffer:su}=zt(),So=Symbol("kAborted"),Jr=[8,13],Me=["CONNECTING","OPEN","CLOSING","CLOSED"],iu=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,H=class r extends Ux{constructor(e,i,o){super(),this._binaryType=_o[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=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?(o=i,i=[]):i=[i]),Co(this,e,i,o)):(this._autoPong=o.autoPong,this._closeTimeout=o.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){_o.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,o){let c=new Jx({allowSynchronousEvents:o.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation}),x=new Vx(e,this._extensions,o.generateMask);this._receiver=c,this._sender=x,this._socket=e,c[$]=this,x[$]=this,e[$]=this,c.on("conclude",cu),c.on("drain",xu),c.on("error",uu),c.on("message",fu),c.on("ping",du),c.on("pong",lu),x.onerror=hu,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",ko),e.on("data",jn),e.on("end",Po),e.on("error",Do),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[je.extensionName]&&this._extensions[je.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,i){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){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,o=>{o||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Ao(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,i,o){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(o=e,e=i=void 0):typeof i=="function"&&(o=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Vr(this,e,o);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Gn,i,o)}pong(e,i,o){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(o=e,e=i=void 0):typeof i=="function"&&(o=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Vr(this,e,o);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Gn,i,o)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,i,o){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof i=="function"&&(o=i,i={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Vr(this,e,o);return}let c={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[je.extensionName]||(c.compress=!1),this._sender.send(e||Gn,c,o)}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(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(r=>{Object.defineProperty(H.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(H.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})}})});H.prototype.addEventListener=eu;H.prototype.removeEventListener=tu;Io.exports=H;function Co(r,e,i,o){let c={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Xx,protocolVersion:Jr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...o,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,!Jr.includes(c.protocolVersion))throw new RangeError(`Unsupported protocol version: ${c.protocolVersion} (supported versions: ${Jr.join(", ")})`);let x;if(e instanceof Wr)x=e;else try{x=new Wr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}x.protocol==="http:"?x.protocol="ws:":x.protocol==="https:"&&(x.protocol="wss:"),r._url=x.href;let f=x.protocol==="wss:",d=x.protocol==="ws+unix:",g;if(x.protocol!=="ws:"&&!f&&!d?g=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!x.pathname?g="The URL's pathname is empty":x.hash&&(g="The URL contains a fragment identifier"),g){let T=new SyntaxError(g);if(r._redirects===0)throw T;Wn(r,T);return}let w=f?443:80,b=Wx(16).toString("base64"),y=f?Hx.request:Kx.request,C=new Set,P;if(c.createConnection=c.createConnection||(f?au:ou),c.defaultPort=c.defaultPort||w,c.port=x.port||w,c.host=x.hostname.startsWith("[")?x.hostname.slice(1,-1):x.hostname,c.headers={...c.headers,"Sec-WebSocket-Version":c.protocolVersion,"Sec-WebSocket-Key":b,Connection:"Upgrade",Upgrade:"websocket"},c.path=x.pathname+x.search,c.timeout=c.handshakeTimeout,c.perMessageDeflate&&(P=new je({...c.perMessageDeflate,isServer:!1,maxPayload:c.maxPayload}),c.headers["Sec-WebSocket-Extensions"]=nu({[je.extensionName]:P.offer()})),i.length){for(let T of i){if(typeof T!="string"||!iu.test(T)||C.has(T))throw new SyntaxError("An invalid or duplicated subprotocol was specified");C.add(T)}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),(x.username||x.password)&&(c.auth=`${x.username}:${x.password}`),d){let T=c.path.split(":");c.socketPath=T[0],c.path=T[1]}let I;if(c.followRedirects){if(r._redirects===0){r._originalIpc=d,r._originalSecure=f,r._originalHostOrSocketPath=d?c.socketPath:x.host;let T=o&&o.headers;if(o={...o,headers:{}},T)for(let[z,re]of Object.entries(T))o.headers[z.toLowerCase()]=re}else if(r.listenerCount("redirect")===0){let T=d?r._originalIpc?c.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:x.host===r._originalHostOrSocketPath;(!T||r._originalSecure&&!f)&&(delete c.headers.authorization,delete c.headers.cookie,T||delete c.headers.host,c.auth=void 0)}c.auth&&!o.headers.authorization&&(o.headers.authorization="Basic "+Buffer.from(c.auth).toString("base64")),I=r._req=y(c),r._redirects&&r.emit("redirect",r.url,I)}else I=r._req=y(c);c.timeout&&I.on("timeout",()=>{fe(r,I,"Opening handshake has timed out")}),I.on("error",T=>{I===null||I[So]||(I=r._req=null,Wn(r,T))}),I.on("response",T=>{let z=T.headers.location,re=T.statusCode;if(z&&c.followRedirects&&re>=300&&re<400){if(++r._redirects>c.maxRedirects){fe(r,I,"Maximum redirects exceeded");return}I.abort();let Q;try{Q=new Wr(z,e)}catch{let ae=new SyntaxError(`Invalid URL: ${z}`);Wn(r,ae);return}Co(r,Q,i,o)}else r.emit("unexpected-response",I,T)||fe(r,I,`Unexpected server response: ${T.statusCode}`)}),I.on("upgrade",(T,z,re)=>{if(r.emit("upgrade",T),r.readyState!==H.CONNECTING)return;I=r._req=null;let Q=T.headers.upgrade;if(Q===void 0||Q.toLowerCase()!=="websocket"){fe(r,z,"Invalid Upgrade header");return}let _e=jx("sha1").update(b+$x).digest("base64");if(T.headers["sec-websocket-accept"]!==_e){fe(r,z,"Invalid Sec-WebSocket-Accept header");return}let ae=T.headers["sec-websocket-protocol"],D;if(ae!==void 0?C.size?C.has(ae)||(D="Server sent an invalid subprotocol"):D="Server sent a subprotocol but none was requested":C.size&&(D="Server sent no subprotocol"),D){fe(r,z,D);return}ae&&(r._protocol=ae);let q=T.headers["sec-websocket-extensions"];if(q!==void 0){if(!P){fe(r,z,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let j;try{j=ru(q)}catch{fe(r,z,"Invalid Sec-WebSocket-Extensions header");return}let Z=Object.keys(j);if(Z.length!==1||Z[0]!==je.extensionName){fe(r,z,"Server indicated an extension that was not requested");return}try{P.accept(j[je.extensionName])}catch{fe(r,z,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[je.extensionName]=P}r.setSocket(z,re,{allowSynchronousEvents:c.allowSynchronousEvents,generateMask:c.generateMask,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation})}),c.finishRequest?c.finishRequest(I,r):I.end()}function Wn(r,e){r._readyState=H.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function ou(r){return r.path=r.socketPath,bo.connect(r)}function au(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=bo.isIP(r.host)?"":r.host),Gx.connect(r)}function fe(r,e,i){r._readyState=H.CLOSING;let o=new Error(i);Error.captureStackTrace(o,fe),e.setHeader?(e[So]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Wn,r,o)):(e.destroy(o),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Vr(r,e,i){if(e){let o=Yx(e)?e.size:su(e).length;r._socket?r._sender._bufferedBytes+=o:r._bufferedAmount+=o}if(i){let o=new Error(`WebSocket is not open: readyState ${r.readyState} (${Me[r.readyState]})`);process.nextTick(i,o)}}function cu(r,e){let i=this[$];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[$]!==void 0&&(i._socket.removeListener("data",jn),process.nextTick(Eo,i._socket),r===1005?i.close():i.close(r,e))}function xu(){let r=this[$];r.isPaused||r._socket.resume()}function uu(r){let e=this[$];e._socket[$]!==void 0&&(e._socket.removeListener("data",jn),process.nextTick(Eo,e._socket),e.close(r[Zx])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function yo(){this[$].emitClose()}function fu(r,e){this[$].emit("message",r,e)}function du(r){let e=this[$];e._autoPong&&e.pong(r,!this._isServer,vo),e.emit("ping",r)}function lu(r){this[$].emit("pong",r)}function Eo(r){r.resume()}function hu(r){let e=this[$];e.readyState!==H.CLOSED&&(e.readyState===H.OPEN&&(e._readyState=H.CLOSING,Ao(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Ao(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function ko(){let r=this[$];if(this.removeListener("close",ko),this.removeListener("data",jn),this.removeListener("end",Po),r._readyState=H.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[$]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",yo),r._receiver.on("finish",yo))}function jn(r){this[$]._receiver.write(r)||this.pause()}function Po(){let r=this[$];r._readyState=H.CLOSING,r._receiver.end(),this.end()}function Do(){let r=this[$];this.removeListener("error",Do),this.on("error",vo),r&&(r._readyState=H.CLOSING,this.destroy())}});var No=oe((Dh,Ro)=>{"use strict";var Ph=Jn(),{Duplex:gu}=V("stream");function To(r){r.emit("close")}function pu(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Lo(r){this.removeListener("error",Lo),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function mu(r,e){let i=!0,o=new gu({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(x,f){let d=!f&&o._readableState.objectMode?x.toString():x;o.push(d)||r.pause()}),r.once("error",function(x){o.destroyed||(i=!1,o.destroy(x))}),r.once("close",function(){o.destroyed||o.push(null)}),o._destroy=function(c,x){if(r.readyState===r.CLOSED){x(c),process.nextTick(To,o);return}let f=!1;r.once("error",function(g){f=!0,x(g)}),r.once("close",function(){f||x(c),process.nextTick(To,o)}),i&&r.terminate()},o._final=function(c){if(r.readyState===r.CONNECTING){r.once("open",function(){o._final(c)});return}r._socket!==null&&(r._socket._writableState.finished?(c(),o._readableState.endEmitted&&o.destroy()):(r._socket.once("finish",function(){c()}),r.close()))},o._read=function(){r.isPaused&&r.resume()},o._write=function(c,x,f){if(r.readyState===r.CONNECTING){r.once("open",function(){o._write(c,x,f)});return}r.send(c,f)},o.on("end",pu),o.on("error",Lo),o}Ro.exports=mu});var Yr=oe((Ih,Oo)=>{"use strict";var{tokenChars:wu}=pt();function _u(r){let e=new Set,i=-1,o=-1,c=0;for(c;c<r.length;c++){let f=r.charCodeAt(c);if(o===-1&&wu[f]===1)i===-1&&(i=c);else if(c!==0&&(f===32||f===9))o===-1&&i!==-1&&(o=c);else if(f===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${c}`);o===-1&&(o=c);let d=r.slice(i,o);if(e.has(d))throw new SyntaxError(`The "${d}" subprotocol is duplicated`);e.add(d),i=o=-1}else throw new SyntaxError(`Unexpected character at index ${c}`)}if(i===-1||o!==-1)throw new SyntaxError("Unexpected end of input");let x=r.slice(i,c);if(e.has(x))throw new SyntaxError(`The "${x}" subprotocol is duplicated`);return e.add(x),e}Oo.exports={parse:_u}});var Ho=oe((Lh,Uo)=>{"use strict";var yu=V("events"),Vn=V("http"),{Duplex:Th}=V("stream"),{createHash:bu}=V("crypto"),Bo=Kn(),et=gt(),vu=Yr(),Su=Jn(),{CLOSE_TIMEOUT:Cu,GUID:Eu,kWebSocket:Au}=Ne(),ku=/^[+/0-9A-Za-z]{22}==$/,Mo=0,zo=1,Fo=2,Xr=class extends yu{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:Su,...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=Vn.createServer((o,c)=>{let x=Vn.STATUS_CODES[426];c.writeHead(426,{"Content-Length":x.length,"Content-Type":"text/plain"}),c.end(x)}),this._server.listen(e.port,e.host,e.backlog,i)):e.server&&(this._server=e.server),this._server){let o=this.emit.bind(this,"connection");this._removeListeners=Pu(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(c,x,f)=>{this.handleUpgrade(c,x,f,o)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Mo}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===Fo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Kt,this);return}if(e&&this.once("close",e),this._state!==zo)if(this._state=zo,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Kt,this):process.nextTick(Kt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Kt(this)})}}shouldHandle(e){if(this.options.path){let i=e.url.indexOf("?");if((i!==-1?e.url.slice(0,i):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,i,o,c){i.on("error",qo);let x=e.headers["sec-websocket-key"],f=e.headers.upgrade,d=+e.headers["sec-websocket-version"];if(e.method!=="GET"){nt(this,e,i,405,"Invalid HTTP method");return}if(f===void 0||f.toLowerCase()!=="websocket"){nt(this,e,i,400,"Invalid Upgrade header");return}if(x===void 0||!ku.test(x)){nt(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(d!==13&&d!==8){nt(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Gt(i,400);return}let g=e.headers["sec-websocket-protocol"],w=new Set;if(g!==void 0)try{w=vu.parse(g)}catch{nt(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let b=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&b!==void 0){let C=new et({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let P=Bo.parse(b);P[et.extensionName]&&(C.accept(P[et.extensionName]),y[et.extensionName]=C)}catch{nt(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let C={origin:e.headers[`${d===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(C,(P,I,T,z)=>{if(!P)return Gt(i,I||401,T,z);this.completeUpgrade(y,x,w,e,i,o,c)});return}if(!this.options.verifyClient(C))return Gt(i,401)}this.completeUpgrade(y,x,w,e,i,o,c)}completeUpgrade(e,i,o,c,x,f,d){if(!x.readable||!x.writable)return x.destroy();if(x[Au])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Mo)return Gt(x,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${bu("sha1").update(i+Eu).digest("base64")}`],b=new this.options.WebSocket(null,void 0,this.options);if(o.size){let y=this.options.handleProtocols?this.options.handleProtocols(o,c):o.values().next().value;y&&(w.push(`Sec-WebSocket-Protocol: ${y}`),b._protocol=y)}if(e[et.extensionName]){let y=e[et.extensionName].params,C=Bo.format({[et.extensionName]:[y]});w.push(`Sec-WebSocket-Extensions: ${C}`),b._extensions=e}this.emit("headers",w,c),x.write(w.concat(`\r
12
12
  `).join(`\r
13
- `)),f.removeListener("error",No),S.setSocket(f,l,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(S),S.on("close",()=>{this.clients.delete(S),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Xt,this)})),h(S,x)}};Bo.exports=Xr;function lf(r,e){for(let i of Object.keys(e))r.on(i,e[i]);return function(){for(let a of Object.keys(e))r.removeListener(a,e[a])}}function Xt(r){r._state=Lo,r.emit("close")}function No(){this.destroy()}function Yt(r,e,i,a){i=i||$n.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...a},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${$n.STATUS_CODES[e]}\r
14
- `+Object.keys(a).map(x=>`${x}: ${a[x]}`).join(`\r
13
+ `)),x.removeListener("error",qo),b.setSocket(x,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(Kt,this)})),d(b,c)}};Uo.exports=Xr;function Pu(r,e){for(let i of Object.keys(e))r.on(i,e[i]);return function(){for(let o of Object.keys(e))r.removeListener(o,e[o])}}function Kt(r){r._state=Fo,r.emit("close")}function qo(){this.destroy()}function Gt(r,e,i,o){i=i||Vn.STATUS_CODES[e],o={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...o},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${Vn.STATUS_CODES[e]}\r
14
+ `+Object.keys(o).map(c=>`${c}: ${o[c]}`).join(`\r
15
15
  `)+`\r
16
16
  \r
17
- `+i)}function ot(r,e,i,a,x,f){if(r.listenerCount("wsClientError")){let l=new Error(x);Error.captureStackTrace(l,ot),r.emit("wsClientError",l,i,e)}else Yt(i,a,x,f)}});import{spawn as Lf}from"node:child_process";import{existsSync as Bf,openSync as Of}from"node:fs";import{mkdir as zf}from"node:fs/promises";import{dirname as Mf}from"node:path";import{fileURLToPath as qf}from"node:url";function Zr(r=V()){return Bf(r.libEntry)?r.libEntry:qf(new URL("../index.ts",import.meta.url))}async function Xo(r={}){let e=r.paths??V(),i=r.entryOverride??Zr(e);await zf(Mf(e.logFile),{recursive:!0});let a=Of(e.logFile,"a"),f=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],l=Lf(process.execPath,f,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(l.unref(),typeof l.pid!="number")throw new Error("failed to spawn daemon (no pid)");return Kf.info("daemon spawned",{pid:l.pid,entry:i}),{pid:l.pid,entry:i}}var Kf,Qr=Le(()=>{"use strict";J();de();Kf=B("spawn-daemon")});import{spawn as Vf}from"node:child_process";import{mkdir as Xf,unlink as Yf,writeFile as $f}from"node:fs/promises";import{dirname as Zf,join as Qf}from"node:path";function rr(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function e0(r,e){return new Promise((i,a)=>{let x=Vf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var nr,ns,rs,t0=Le(()=>{"use strict";J();nr=B("supervisor.launchd"),ns="ai.coze.bridge",rs={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
17
+ `+i)}function nt(r,e,i,o,c,x){if(r.listenerCount("wsClientError")){let f=new Error(c);Error.captureStackTrace(f,nt),r.emit("wsClientError",f,i,e)}else Gt(i,o,c,x)}});import{spawn as Yu}from"node:child_process";import{existsSync as Xu,openSync as $u}from"node:fs";import{mkdir as Qu}from"node:fs/promises";import{dirname as Zu}from"node:path";import{fileURLToPath as ef}from"node:url";function Zr(r=G()){return Xu(r.libEntry)?r.libEntry:ef(new URL("../index.ts",import.meta.url))}async function ta(r={}){let e=r.paths??G(),i=r.entryOverride??Zr(e);await Qu(Zu(e.logFile),{recursive:!0});let o=$u(e.logFile,"a"),x=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],f=Yu(process.execPath,x,{detached:!0,stdio:["ignore",o,o],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(f.unref(),typeof f.pid!="number")throw new Error("failed to spawn daemon (no pid)");return tf.info("daemon spawned",{pid:f.pid,entry:i}),{pid:f.pid,entry:i}}var tf,es=De(()=>{"use strict";U();xe();tf=L("spawn-daemon")});import{spawn as uf}from"node:child_process";import{mkdir as ff,unlink as df,writeFile as lf}from"node:fs/promises";import{dirname as hf,join as gf}from"node:path";function er(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function oa(r,e){return new Promise((i,o)=>{let c=uf(r,e,{stdio:["ignore","pipe","pipe"]}),x="";c.stderr?.on("data",f=>{x+=f.toString("utf8")}),c.on("error",o),c.on("close",f=>{f===0?i():o(new Error(`${r} ${e.join(" ")} exited ${f}: ${x.trim()}`))})})}var Zn,rs,ss,aa=De(()=>{"use strict";U();Zn=L("supervisor.launchd"),rs="ai.coze.bridge",ss={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>${ns}</string>
22
+ <string>${rs}</string>
23
23
  <key>ProgramArguments</key>
24
24
  <array>
25
- <string>${rr(r.nodeBin)}</string>
26
- <string>${rr(r.entry)}</string>
25
+ <string>${er(r.nodeBin)}</string>
26
+ <string>${er(r.entry)}</string>
27
27
  <string>--daemon</string>
28
28
  </array>
29
29
  <key>RunAtLoad</key>
@@ -33,12 +33,12 @@ var $0=Object.create;var _r=Object.defineProperty;var Z0=Object.getOwnPropertyDe
33
33
  <key>ThrottleInterval</key>
34
34
  <integer>10</integer>
35
35
  <key>StandardOutPath</key>
36
- <string>${rr(r.logFile)}</string>
36
+ <string>${er(r.logFile)}</string>
37
37
  <key>StandardErrorPath</key>
38
- <string>${rr(r.logFile)}</string>
38
+ <string>${er(r.logFile)}</string>
39
39
  </dict>
40
40
  </plist>
41
- `},configPath(r){return Qf(r.homeDir,"Library","LaunchAgents",`${ns}.plist`)},async install(r){let e=this.configPath(r);await Xf(Zf(e),{recursive:!0}),await $f(e,this.renderConfig(r),"utf8"),nr.info("plist written",{plistPath:e}),await e0("launchctl",["load","-w",e]),nr.info("launchd job loaded",{label:ns})},async uninstall(r){let e=this.configPath(r);await e0("launchctl",["unload","-w",e]).catch(i=>nr.warn("launchctl unload failed (ignored)",{err:String(i)})),await Yf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),nr.info("launchd job removed",{plistPath:e})}}});import{spawn as eu}from"node:child_process";import{mkdir as tu,unlink as nu,writeFile as ru}from"node:fs/promises";import{dirname as su,join as iu}from"node:path";function or(r,e){return new Promise((i,a)=>{let x=eu(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var sr,ir,ss,n0=Le(()=>{"use strict";J();sr=B("supervisor.systemd"),ir="coze-bridge.service",ss={platform:"linux",renderConfig(r){return`[Unit]
41
+ `},configPath(r){return gf(r.homeDir,"Library","LaunchAgents",`${rs}.plist`)},async install(r){let e=this.configPath(r);await ff(hf(e),{recursive:!0}),await lf(e,this.renderConfig(r),"utf8"),Zn.info("plist written",{plistPath:e}),await oa("launchctl",["load","-w",e]),Zn.info("launchd job loaded",{label:rs})},async uninstall(r){let e=this.configPath(r);await oa("launchctl",["unload","-w",e]).catch(i=>Zn.warn("launchctl unload failed (ignored)",{err:String(i)})),await df(e).catch(i=>{if(i.code!=="ENOENT")throw i}),Zn.info("launchd job removed",{plistPath:e})}}});import{spawn as pf}from"node:child_process";import{mkdir as mf,unlink as wf,writeFile as _f}from"node:fs/promises";import{dirname as yf,join as bf}from"node:path";function rr(r,e){return new Promise((i,o)=>{let c=pf(r,e,{stdio:["ignore","pipe","pipe"]}),x="";c.stderr?.on("data",f=>{x+=f.toString("utf8")}),c.on("error",o),c.on("close",f=>{f===0?i():o(new Error(`${r} ${e.join(" ")} exited ${f}: ${x.trim()}`))})})}var tr,nr,is,ca=De(()=>{"use strict";U();tr=L("supervisor.systemd"),nr="coze-bridge.service",is={platform:"linux",renderConfig(r){return`[Unit]
42
42
  Description=Coze Bridge daemon
43
43
  After=network.target
44
44
 
@@ -52,7 +52,7 @@ StandardError=append:${r.logFile}
52
52
 
53
53
  [Install]
54
54
  WantedBy=default.target
55
- `},configPath(r){return iu(r.homeDir,".config","systemd","user",ir)},async install(r){let e=this.configPath(r);await tu(su(e),{recursive:!0}),await ru(e,this.renderConfig(r),"utf8"),sr.info("systemd unit written",{unitPath:e}),await or("systemctl",["--user","daemon-reload"]),await or("systemctl",["--user","enable","--now",ir]),sr.info("systemd unit enabled",{unitName:ir})},async uninstall(r){let e=this.configPath(r);await or("systemctl",["--user","disable","--now",ir]).catch(i=>sr.warn("systemctl disable failed (ignored)",{err:String(i)})),await nu(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await or("systemctl",["--user","daemon-reload"]).catch(()=>{}),sr.info("systemd unit removed",{unitPath:e})}}});import{spawn as ou}from"node:child_process";import{join as au}from"node:path";function r0(r,e){return new Promise((i,a)=>{let x=ou(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var is,ar,os,s0=Le(()=>{"use strict";J();is=B("supervisor.taskscheduler"),ar="CozeBridge",os={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
55
+ `},configPath(r){return bf(r.homeDir,".config","systemd","user",nr)},async install(r){let e=this.configPath(r);await mf(yf(e),{recursive:!0}),await _f(e,this.renderConfig(r),"utf8"),tr.info("systemd unit written",{unitPath:e}),await rr("systemctl",["--user","daemon-reload"]),await rr("systemctl",["--user","enable","--now",nr]),tr.info("systemd unit enabled",{unitName:nr})},async uninstall(r){let e=this.configPath(r);await rr("systemctl",["--user","disable","--now",nr]).catch(i=>tr.warn("systemctl disable failed (ignored)",{err:String(i)})),await wf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await rr("systemctl",["--user","daemon-reload"]).catch(()=>{}),tr.info("systemd unit removed",{unitPath:e})}}});import{spawn as vf}from"node:child_process";import{join as Sf}from"node:path";function xa(r,e){return new Promise((i,o)=>{let c=vf(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),x="";c.stderr?.on("data",f=>{x+=f.toString("utf8")}),c.on("error",o),c.on("close",f=>{f===0?i():o(new Error(`${r} ${e.join(" ")} exited ${f}: ${x.trim()}`))})})}var os,sr,as,ua=De(()=>{"use strict";U();os=L("supervisor.taskscheduler"),sr="CozeBridge",as={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
56
56
  <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
57
57
  <RegistrationInfo>
58
58
  <Description>Coze Bridge daemon</Description>
@@ -76,21 +76,22 @@ WantedBy=default.target
76
76
  </Exec>
77
77
  </Actions>
78
78
  </Task>
79
- `},configPath(r){return au(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await r0("schtasks",["/Create","/SC","ONLOGON","/TN",ar,"/TR",e,"/RU",r.userName,"/F"]),is.info("task scheduler entry created",{task:ar})},async uninstall(r){await r0("schtasks",["/Delete","/TN",ar,"/F"]).catch(e=>is.warn("schtasks /Delete failed (ignored)",{err:String(e)})),is.info("task scheduler entry removed",{task:ar})}}});var as={};Is(as,{buildContext:()=>uu,getSupervisor:()=>fu,launchdSupervisor:()=>rs,systemdSupervisor:()=>ss,taskSchedulerSupervisor:()=>os});import{homedir as xu,userInfo as cu}from"node:os";function fu(r=process.platform){switch(r){case"darwin":return rs;case"linux":return ss;case"win32":return os;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function uu(){let r=V();return{nodeBin:process.execPath,entry:Zr(r),logFile:r.logFile,homeDir:xu(),userName:cu().username}}var xs=Le(()=>{"use strict";de();Qr();t0();n0();s0()});We();J();import{readdir as _a}from"node:fs/promises";import{mkdir as la,writeFile as ha}from"node:fs/promises";import{join as ga}from"node:path";var pa={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function dt(r,e,i,a){await la(r,{recursive:!0});let x=pa[e],f=ga(r,x),l=ma(e,i,a);return await ha(f,l,"utf8"),f}function ma(r,e,i){let a=`# Coze Agent: ${e}
79
+ `},configPath(r){return Sf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await xa("schtasks",["/Create","/SC","ONLOGON","/TN",sr,"/TR",e,"/RU",r.userName,"/F"]),os.info("task scheduler entry created",{task:sr})},async uninstall(r){await xa("schtasks",["/Delete","/TN",sr,"/F"]).catch(e=>os.warn("schtasks /Delete failed (ignored)",{err:String(e)})),os.info("task scheduler entry removed",{task:sr})}}});var cs={};Ns(cs,{buildContext:()=>kf,getSupervisor:()=>Af,launchdSupervisor:()=>ss,systemdSupervisor:()=>is,taskSchedulerSupervisor:()=>as});import{homedir as Cf,userInfo as Ef}from"node:os";function Af(r=process.platform){switch(r){case"darwin":return ss;case"linux":return is;case"win32":return as;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function kf(){let r=G();return{nodeBin:process.execPath,entry:Zr(r),logFile:r.logFile,homeDir:Cf(),userName:Ef().username}}var xs=De(()=>{"use strict";xe();es();aa();ca();ua()});Ue();U();import{readdir as k0}from"node:fs/promises";import{mkdir as v0,writeFile as S0}from"node:fs/promises";import{join as C0}from"node:path";var E0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function ct(r,e,i,o){await v0(r,{recursive:!0});let c=E0[e],x=C0(r,c),f=A0(e,i,o);return await S0(x,f,"utf8"),x}function A0(r,e,i){let o=`# Coze Agent: ${e}
80
80
 
81
81
  > framework: \`${r}\`
82
82
 
83
- `,x=i?.trim()?i.endsWith(`
83
+ `,c=i?.trim()?i.endsWith(`
84
84
  `)?i:`${i}
85
85
  `:`_No instructions provided._
86
- `;return`${a}---
86
+ `;return`${o}---
87
87
 
88
- ${x}`}var ke=B("agent-detail-sync"),cn=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await _a(i)}catch(x){ke.info("agents dir not found, skip detail sync",{root:i,err:String(x)});return}ke.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){ke.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}ke.info("detail sync done",{reason:e})}async syncOne(e){let i=await le(e,this.opts.paths);if(!i){ke.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(l){ke.warn("detail RPC failed, using local data",{agentId:e,err:String(l)});return}if(a.agentId&&a.agentId!==e){ke.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,f=!1;if(a.agentName&&a.agentName!==i.agentName&&(i.agentName=a.agentName,x=!0),a.description!==void 0&&a.description!==i.description&&(i.description=a.description,x=!0),a.cozeIdentity&&a.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=a.cozeIdentity,x=!0,f=!0),a.deployType&&ke.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){ke.debug("detail sync: no diff",{agentId:e});return}await be(i,this.opts.paths),ke.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:i.agentName}),f&&(await dt(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};We();import{spawn as ti}from"node:child_process";import{lstat as Er,mkdir as va,readFile as ni,readdir as Sa,rm as Ea,stat as Ca,writeFile as Aa}from"node:fs/promises";import{join as Me,normalize as ka,relative as ri,resolve as Da,sep as si}from"node:path";var De={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",RESET:"_agent/reset",REPAIR:"_agent/repair",DELETE:"_agent/delete"};function Nt(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Ms(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function lt(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var C=class extends Error{code;retriable;cause;constructor(e,i,a){super(i),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};J();de();function ze(r,e){if(Nt(r)!=="cloud")throw new C("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function Lt(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}J();var fn="1008033",qs="1289";var Ks="pbbp2",Us="https://www.coze.cn",Fs="/api/coze_claw/resource/get_frontier_key",wa="https://www.coze.cn",ya="wss://frontier.coze.cn";function Hs(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??wa}function js(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??ya}function un(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),a&&(e["x-use-ppe"]=a),e}function dn(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Gs=B("handshake");async function Ws(r){let e=Hs(r.endpoint),i=r.timeoutMs??1e4,a=`${ba(e)}${Fs}?aid=${encodeURIComponent(fn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...un(r.ppeOverride)},f=new AbortController,l=setTimeout(()=>f.abort(),i);Gs.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:x,signal:f.signal}),m=h.headers.get("x-tt-logid")??"",y=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let R=await h.text().catch(()=>"");throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${R.slice(0,200)}`)}let S=await h.json();if(S.code!==void 0&&S.code!==0)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${S.code} msg=${S.msg??"-"} logid=${m}`);let b=S.data?.access_key,D=S.data?.device_id;if(!b||!D)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(S)}`);return Gs.info("handshake ok",{remoteDeviceId:D,logid:m,traceId:y}),{accessKey:b,deviceId:D}}catch(h){throw h instanceof C?h:h.name==="AbortError"?new C("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new C("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(l)}}function ba(r){return r.endsWith("/")?r.slice(0,-1):r}var br="https://llm-gateway.coze.cn",ht="auto";function Js(r){return{model:r.model??ht,...r.modelToken?{modelToken:r.modelToken}:{}}}function Bt(r){return!r||r===ht}function Vs(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=br,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),Bt(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Xs(r){let e=[];return Bt(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_providers.coze.name="coze"'),e.push("-c",`model_providers.coze.base_url="${br}/v1"`),e.push("-c",'model_providers.coze.env_key="OPENAI_API_KEY"'),e.push("-c",'model_providers.coze.wire_api="responses"'),e.push("-c","model_providers.coze.requires_openai_auth=false"),e.push("-c","model_providers.coze.supports_websockets=false"),e.push("-c",'model_provider="coze"')),e}function Ys(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}function vr(r){let{ttEnv:e,usePpe:i}=dn(r),a={};return e&&(a["x-tt-env"]=e),i&&(a["x-use-ppe"]=i),a}function $s(r,e){if(!r.modelToken)return{};let i=vr(e);return Object.keys(i).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(i).map(([x,f])=>`${x}:${f}`).join(`
89
- `)}}function Sr(r){return`coze-session-${r.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function Zs(r,e){if(!r.modelToken||Bt(r.model))return null;let i=vr(e),a={baseUrl:`${br}/v1`,api:"openai-completions",apiKey:r.modelToken,models:[{id:r.model,name:r.model,reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192,api:"openai-completions"}]};return Object.keys(i).length>0&&(a.headers=i),a}function Qs(r,e){if(!r.modelToken)return[];let i=vr(e),a=[];for(let[x,f]of Object.entries(i))a.push("-c",`model_providers.coze.http_headers.${x}="${f}"`);return a}var oe=B("agent-handlers"),ei=5*1024*1024,Pa=1,Ta=6,Ia=new Set(["node_modules",".git",".coze","dist","build",".next"]),hn=class{constructor(e){this.opts=e}opts;async listSkills(e){ze(e._meta,"_agent/listSkills");let i=lt(e._meta),a=await this.loadAgentCfg(i),x=a?.workspace??Oe(i).workspace,f=a?.skills??[],l=[];for(let h of f){let m=Me(x,h.relPath,"SKILL.md");await Ca(m).then(S=>S.isFile()).catch(()=>!1)&&l.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:l}}async addSkills(e){ze(e._meta,"_agent/addSkills");let i=lt(e._meta),a=await this.requireAgentCfg(i),x=e.skills??[],f=[...a.skills??[]],l=new Map(f.map((m,y)=>[m.skillId,y])),h=[];for(let m of x){if(!m.skillName)throw new C("IPC_BAD_REQUEST","skill missing skillName");let y=Ra(m.skillName),S=Na(a.framework),b=Me(S,y),D=Me(a.workspace,b);await va(D,{recursive:!0});let R=await Oa(m.downloadUrl);Ma(R)?await qa(R,D):await Aa(Me(D,"SKILL.md"),R.toString("utf8"),"utf8");let N={skillId:m.skillId,skillName:m.skillName,relPath:b,installedAt:Date.now(),...m.description?{description:m.description}:{},...m.version?{version:m.version}:{},...m.downloadUrl?{downloadUrl:m.downloadUrl}:{}},L=l.get(m.skillId);L!==void 0?f[L]=N:(l.set(m.skillId,f.length),f.push(N)),h.push(m),oe.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:b})}return await an(i,f),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){ze(e._meta,"_agent/removeSkills");let i=lt(e._meta),a=await this.requireAgentCfg(i),x=new Set(e.skillIds??[]),f=a.skills??[],l=[];for(let h of f){if(!x.has(h.skillId)){l.push(h);continue}let m=Me(a.workspace,h.relPath);await Ea(m,{recursive:!0,force:!0}),oe.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await an(i,l),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex"){for(let[x,f]of a.sessions)if(!(!f.downstream||!f.acpSessionId)){f.loadingSession=!0;try{await f.downstream.sessionLoad({sessionId:f.acpSessionId,cwd:a.workspace}),oe.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId})}catch(l){oe.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId,err:String(l)})}finally{f.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return oe.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await le(i);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(oe.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await be(a),await dt(a.workspace,a.framework,i,e.cozeIdentity),oe.info("_agent/update: cozeIdentity rewritten",{agentId:i,framework:a.framework}),await this.reloadAgentSessions(i,"identity-changed"),{ok:!0})}async disconnectAgent(e){let i=e.agentId;if(!i)throw new C("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await le(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await be(a),oe.info("agent disconnected",{agentId:i,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(i,e.reason??"disconnect"),{ok:!0}):(oe.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(ze(e._meta,"_agent/switchModel"),!e.agentId)throw new C("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:ht,a=await le(e.agentId);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await be(a),oe.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let x=this.opts.agents.get(e.agentId);if(!x)return oe.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};x.model=i;let f=[];for(let[l,h]of x.allSessionQueues())f.push(h.enqueue(async()=>{let m=x.sessions.get(l);m?.downstream&&(await m.downstream.stop(`switchModel: ${i}`).catch(()=>{}),m.downstream=void 0)}));return await Promise.all(f),oe.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i,cloudSessions:f.length}),{ok:!0}}async resetAgent(e){if(ze(e._meta,De.RESET),!e.agentId)throw new C("IPC_BAD_REQUEST",`${De.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,De.RESET,e.reason),{ok:!0}}async repairAgent(e){if(ze(e._meta,De.REPAIR),!e.agentId)throw new C("IPC_BAD_REQUEST",`${De.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new C("IPC_BAD_REQUEST",`${De.REPAIR} only allowed for openclaw, got ${i.framework}`);if(i&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,i.workspace)}catch(a){oe.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(a)})}return await this.runDetailSync(e.agentId,De.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,a){if(!this.opts.detailSyncer){oe.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(x){oe.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:a,err:String(x)})}}async getFileTree(e){ze(e._meta,"_agent/getFileTree");let i=e._meta,a=lt(i),x=await this.resolveWorkspace(a),f=e.filePath??"",l=this.safeJoin(x,f),h=await Er(l).catch(()=>null);if(!h)throw new C("IPC_BAD_REQUEST",`path not found: ${f}`);if(h.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${f}`);let m=Ua(e.depth);return h.isDirectory()?{tree:await ii(x,l,f,m)}:{tree:[{name:Fa(f),path:oi(f||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){ze(e._meta,"_agent/getFileContent");let i=lt(e._meta),a=await this.resolveWorkspace(i);if(!e.filePath)throw new C("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await Er(x).catch(()=>null);if(!f||!f.isFile())throw new C("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(f.size>ei)throw new C("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${ei})`);let l=await ni(x);return l.includes(0)?{content:l.toString("base64"),encoding:"base64",size:f.size}:{content:l.toString("utf8"),encoding:"utf-8",size:f.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await le(e).catch(()=>null))?.workspace??Oe(e).workspace}safeJoin(e,i){let a=Da(e,i||"."),x=ri(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${si}`))throw new C("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return le(e)}async requireAgentCfg(e){let i=await this.loadAgentCfg(e);if(!i)throw new C("AGENT_NOT_FOUND",`no config for agent: ${e}`);return i}};function Ra(r){let e=Lt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new C("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function Na(r){return r==="claude-code"?Me(".claude","skills"):Me(".agents","skills")}var La=3e4,Ba=50*1024*1024,gn=3e4;async function Oa(r){if(!r)throw new C("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);ln(e);let i=za(r);return ln(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await ni(e);return ln(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),La);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new C("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();return ln(x.byteLength),Buffer.from(x)}finally{clearTimeout(i)}}throw new C("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function ln(r){if(r>Ba)throw new C("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function za(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new C("IPC_BAD_REQUEST","bad data URL");let i=!!e[2],a=e[3]??"";return i?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function Ma(r){return r.length>=2&&r[0]===31&&r[1]===139}async function qa(r,e){await Ka(r),await new Promise((i,a)=>{let x=ti("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",h=>{f+=String(h)});let l=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar extract timeout (${gn}ms)`))},gn);x.on("error",h=>{clearTimeout(l),a(new C("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(l),h===0?i():a(new C("IPC_BAD_REQUEST",`tar exit ${h}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Ka(r){let e=await new Promise((i,a)=>{let x=ti("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),f="",l="";x.stdout?.on("data",m=>{f+=String(m)}),x.stderr?.on("data",m=>{l+=String(m)});let h=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar list timeout (${gn}ms)`))},gn);x.on("error",m=>{clearTimeout(h),a(new C("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),x.on("exit",m=>{clearTimeout(h),m===0?i(f):a(new C("IPC_BAD_REQUEST",`tar list exit ${m}${l?`: ${l.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)});for(let i of e.split(`
90
- `)){let a=i.trim();if(!a)continue;let x=a.charCodeAt(0);if(x!==45&&x!==100)throw new C("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let l=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!l)continue;if(l.startsWith("/"))throw new C("IPC_BAD_REQUEST",`tar entry absolute path: ${l}`);if(l.split(/[/\\]/).some(m=>m===".."))throw new C("IPC_BAD_REQUEST",`tar entry contains '..': ${l}`)}}async function ii(r,e,i,a){if(a<=0)return[];let x;try{x=await Sa(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let l of x){if(Ia.has(l.name)||l.isSymbolicLink())continue;let h=Me(e,l.name),m=ka(Me(i,l.name)),y=null;try{y=await Er(h)}catch{continue}if(y.isSymbolicLink())continue;let S={name:l.name,path:oi(ri(r,h)),isDir:y.isDirectory(),size:y.size,modifiedAt:Math.floor(y.mtimeMs)};y.isDirectory()&&a>1&&(S.children=await ii(r,h,m,a-1)),f.push(S)}return f.sort((l,h)=>l.isDir!==h.isDir?l.isDir?-1:1:l.name.localeCompare(h.name)),f}function Ua(r){return!r||r<=0?Pa:Math.min(r,Ta)}function Fa(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function oi(r){return r.split(si).join("/")}J();var Ot=B("agent-health-reporter"),Ha=1e4,pn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??Ha}opts;timer=null;inFlight=!1;unsubscribeRegister=null;intervalMs;start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs),this.timer.unref?.(),this.unsubscribeRegister=this.opts.core.onAgentRegister(()=>{this.tick()}),Ot.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Ot.info("heartbeat stopped"))}async tick(){if(this.inFlight){Ot.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Ot.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let i=[];for(let x of this.opts.core.agents.values()){let f=ja(x);f&&i.push({agentId:x.agentId,status:f})}if(i.length===0)return;let a={agents:i,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(x){Ot.warn("heartbeat batch send failed",{count:i.length,err:String(x)})}}finally{this.inFlight=!1}}};function ja(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}We();import{mkdir as Cr,rm as xx}from"node:fs/promises";import{spawn as Xa}from"node:child_process";function zt(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function mn(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function gt(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Qe(r,e){return{jsonrpc:"2.0",id:r,error:e}}var _n=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},X={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_TOKEN_GEN_FAILED:-32009};function ai(r){return"method"in r&&"id"in r&&r.id!==void 0}function xi(r){return"method"in r&&!("id"in r)}function wn(r){return!("method"in r)&&"id"in r}var Ga={AGENT_NOT_FOUND:X.AGENT_NOT_FOUND,AGENT_BUSY:X.AGENT_BUSY,AGENT_DISCONNECTED:X.AGENT_DISCONNECTED,AGENT_TIMEOUT:X.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:X.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:X.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:X.INTERNAL_ERROR,BRIDGE_INTERNAL:X.INTERNAL_ERROR,IPC_AUTH_FAILED:X.INTERNAL_ERROR,IPC_BAD_REQUEST:X.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:X.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:X.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:X.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:X.INTERNAL_ERROR};function yn(r){return r instanceof C?{code:Ga[r.code]??X.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:X.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function ci(r){let e=r.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new C(i,r.message,{retriable:e?.retriable??!1,cause:r.data})}function fi(r){return`${JSON.stringify(r)}
91
- `}var bn=class{buffer="";onError;constructor(e={}){this.onError=e.onError}push(e){this.buffer+=typeof e=="string"?e:e.toString("utf8");let i=this.buffer.split(`
92
- `);this.buffer=i.pop()??"";let a=[];for(let x of i){let f=x.replace(/\r$/,"").trim();if(f)try{a.push(JSON.parse(f))}catch(l){this.onError?.({line:f,error:l})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(i){return this.onError?.({line:e,error:i}),[]}}};var di={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel","_agent/genModelToken":"agent.genModelToken","_agent/reset":"agent.reset","_agent/repair":"agent.repair","session/request_permission":"session.requestPermission",initialize:"initialize"},Cd=Object.fromEntries(Object.entries(di).map(([r,e])=>[e,r])),Wa={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":[],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.genModelToken":["agentId","sessionId"],"agent.reset":["agentId"],"agent.repair":["agentId"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},pt=class{seq=0;next(e,i){this.seq+=1;let a=di[e]??Ja(e),x=Wa[a]??[],f=[a,String(this.seq)];if(x.length>0){let l=x.map(m=>ui(i?.[m]??"")),h=Va(l).join(":");h&&f.push(h)}else i&&Object.values(i).some(l=>l)&&f.push(Object.values(i).filter(Boolean).map(l=>ui(String(l))).join(":"));return f.join("_")}reset(){this.seq=0}};function Ja(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function ui(r){return r.replace(/[:_\s]+/g,"-")}function Va(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}J();var Ya=3e4;function li(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Je=class{constructor(e){this.opts=e;this.log=B(`downstream.${this.constructor.name}`),this.decoder=new bn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new pt;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new C("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=Xa(this.opts.command,this.opts.args,{cwd:this.opts.cwd,env:{...this.sanitizeEnv(process.env),...this.opts.env},stdio:["pipe","pipe","pipe"],detached:e});this.child=i,i.stdout?.setEncoding("utf8"),i.stdout?.on("data",a=>{for(let x of this.decoder.push(a))this.dispatch(x)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),i.on("exit",(a,x)=>{this.stopped=!0,this.failAllPending(new C("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let f of this.exitHandlers)f(a,x)}),i.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new C("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:i.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let i=this.child,a=new Promise(f=>i.once("exit",()=>f()));li(i.pid,"SIGTERM");let x=setTimeout(()=>{i.killed||li(i.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(x)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){!this.child||this.stopped||this.writeFrame(mn("session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(gt(e,i))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(Qe(e,i))}catch(a){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(a)})}}onExit(e){this.exitHandlers.push(e)}call(e,i,a=Ya){if(!this.child||this.stopped)return Promise.reject(new C("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=zt(x,e,i),l=a>0&&Number.isFinite(a);return new Promise((h,m)=>{let y=l?setTimeout(()=>{this.pending.delete(x),m(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:h,reject:m,timer:y,method:e});try{this.writeFrame(f)}catch(S){y&&clearTimeout(y),this.pending.delete(x),m(S)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new C("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(fi(e))}dispatch(e){if(wn(e)){let i=e.id!==null?this.pending.get(e.id):void 0;if(!i){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),i.timer&&clearTimeout(i.timer),e.error?i.reject(ci(e.error)):i.resolve(e.result);return}if(xi(e)){if(e.method==="session/update")for(let i of this.updateHandlers)Promise.resolve(i(e.params)).catch(a=>this.log.warn("update handler failed",{err:String(a)}));else this.log.debug("unknown notification",{method:e.method});return}if(ai(e)){let i=e;this.handleAgentRequest(i).catch(a=>this.log.error("agent request handler failed",{method:i.method,err:String(a)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(Qe(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let i of this.agentRequestHandlers)try{await i(e)}catch(a){this.log.error("agentRequestHandler threw",{method:e.method,err:String(a)});try{this.writeFrame(Qe(e.id,yn(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var $a="@agentclientprotocol/claude-agent-acp@latest";function Za(r){let e={};for(let[i,a]of Object.entries(r))a!==void 0&&(i.startsWith("CLAUDE")||i==="AI_AGENT"||i==="BAGGAGE"||(e[i]=a));return e}var vn=class extends Je{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",$a],x={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return Za(e)}};import{mkdtempSync as Qa,rmSync as ex}from"node:fs";import{tmpdir as tx}from"node:os";import{join as nx}from"node:path";var rx="@zed-industries/codex-acp@latest",Sn=class extends Je{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=e.command??"npx",a=e.args??["-y",rx],x=e.extraArgs?[...a,...e.extraArgs]:a,f=e.isolateCodexHome?Qa(nx(tx(),"coze-bridge-codex-home-")):void 0,l=f?{...e.env??{},CODEX_HOME:f}:e.env,h={command:i,args:x,cwd:e.cwd,...l?{env:l}:{}};super(h),this.authMethodId=e.authMethodId,this.codexHomeDir=f}async initialize(e){let i=await super.initialize(e);return this.authMethodId&&await this.call("authenticate",{methodId:this.authMethodId}),i}async stop(e){if(await super.stop(e),this.codexHomeDir)try{ex(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Mt=class extends Je{framework="openclaw";agentId;sessionName;slashModelOnStart;constructor(e){let i=e.sessionName??"default",a=["acp","--session",`agent:${e.agentId}:${i}`];e.gatewayToken&&a.push("--token",e.gatewayToken);let x={command:e.command,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x),this.agentId=e.agentId,this.sessionName=i,this.slashModelOnStart=e.slashModelOnStart}async afterSessionEstablished(e){this.slashModelOnStart&&(this.log.info("switching session to per-session provider via /model",{agentId:this.agentId,sessionName:this.sessionName,slash:this.slashModelOnStart}),await this.sessionPrompt({sessionId:e,prompt:[{type:"text",text:`/model ${this.slashModelOnStart}`}]}))}get acpSessionName(){return this.sessionName}};J();de();var mt=class{slots=[];running=!1;closed=!1;disposed=!1;enqueue(e){return this.disposed?Promise.reject(new Error("AsyncQueue disposed")):this.closed?Promise.reject(new Error("AsyncQueue closed")):new Promise((i,a)=>{this.slots.push({task:e,resolve:i,reject:a}),this.drain()})}close(){this.closed=!0}dispose(e=new Error("AsyncQueue disposed")){for(this.disposed=!0,this.closed=!0;this.slots.length>0;)this.slots.shift()?.reject(e)}get size(){return this.slots.length}get isRunning(){return this.running}async drain(){if(!this.running){this.running=!0;try{for(;this.slots.length>0&&!this.disposed;){let e=this.slots.shift();if(!e)break;try{let i=await e.task();e.resolve(i)}catch(i){e.reject(i)}}}finally{this.running=!1}}}};var En=class{agentId;framework;workspace;deployType;sessions=new Map;sessionQueues=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local"}getSessionQueue(e){let i=this.sessionQueues.get(e);return i||(i=new mt,this.sessionQueues.set(e,i)),i}allSessionQueues(){return this.sessionQueues.entries()}async dispose(e){this.status="stopped";let i=new Error(`AgentSession disposed${e?`: ${e}`:""}`);for(let a of this.sessionQueues.values())a.dispose(i);this.sessionQueues.clear(),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,a]of this.sessions)qt(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function qt(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}import{spawn as sx}from"node:child_process";import{homedir as ix}from"node:os";import{join as ox}from"node:path";nn();J();async function pi(){let r=ox(ix(),".openclaw/openclaw.json");return(await ut(r))?.gateway?.auth?.token??""}var hi=B("openclaw.config"),ax=[0,5e3,5e3],gi="models.providers.",Cn="agents.defaults.models",An=class{command;env;retryDelaysMs;queue=new mt;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??ax}async withRetry(e,i){let a;for(let x=0;x<this.retryDelaysMs.length;x++){let f=this.retryDelaysMs[x]??0;f>0&&await new Promise(l=>setTimeout(l,f));try{return await i()}catch(l){a=l,hi.warn("openclaw cli failed, will retry",{label:e,attempt:x+1,err:String(l)})}}throw new C("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${a?.message??"unknown"}`)}runCli(e){return new Promise((i,a)=>{let x=sx(this.command,e,{stdio:["ignore","pipe","pipe"],env:this.env}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`exit ${l}: ${f.trim().slice(0,500)}`))})})}async runCliTolerant(e,i){try{await this.runCli(e)}catch(a){let x=String(a);if(i.some(f=>x.includes(f)))return;throw a}}async bestEffortUnset(e,i){try{await this.queue.enqueue(()=>this.withRetry(e,()=>this.runCli(["config","unset",i])))}catch(a){hi.warn(`${e} failed (best-effort)`,{configPath:i,err:String(a)})}}ensureProvider(e,i){return this.queue.enqueue(()=>this.withRetry(`config set models.providers.${e}`,()=>this.runCli(["config","set",`${gi}${e}`,JSON.stringify(i),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${gi}${e}`)}addModelToAllowlist(e,i){let a={[e]:i?{alias:i}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${Cn}[${e}]`,()=>this.runCli(["config","set",Cn,JSON.stringify(a),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${Cn}[${e}]`,`${Cn}.${e}`)}ensureAgent(e,i,a){let x=["agents","add",e,"--workspace",i,"--non-interactive"];return a&&x.push("--model",a),this.queue.enqueue(()=>this.withRetry(`agents add ${e}`,()=>this.runCliTolerant(x,["already exists","already registered"])))}deleteAgent(e){return this.queue.enqueue(()=>this.withRetry(`agents delete ${e}`,()=>this.runCliTolerant(["agents","delete",e,"--force"],["not found","does not exist"])))}};var et=B("agent-manager"),cx=(r,e,i,a,x,f,l)=>{switch(r){case"claude-code":{let h=x?{...Vs(x),...$s(x,l)}:void 0;return new vn({cwd:i,...h&&Object.keys(h).length>0?{env:h}:{}})}case"codex":{let h=x?[...Xs(x),...Qs(x,l)]:[],m=x?Ys(x):void 0,y=!!x;return new Sn({cwd:i,...h.length>0?{extraArgs:h}:{},...m&&Object.keys(m).length>0?{env:m}:{},...y?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new Mt({command:e,cwd:i,agentId:a,...f?{sessionName:Lt(f)}:{}})}};function mi(r){return r==="claude-code"||r==="codex"}var fx={path:"",version:"cloud-deployed"},ux={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},dx=2e4,kn=class{paths;config;registry;factory;createTimeoutMs;openclawConfigCache;ensuredProviders=new Set;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??cx,this.createTimeoutMs=e.createTimeoutMs??dx}getOpenclawConfig(){if(!this.openclawConfigCache){let e=this.config.frameworksCache?.openclaw;if(!e?.path)throw new C("AGENT_SPAWN_FAILED","openclaw binary not detected on this machine");this.openclawConfigCache=new An({command:e.path})}return this.openclawConfigCache}async createAgent(e){if(!e.agentId)throw new C("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new C("IPC_BAD_REQUEST","framework required");let i=Nt(e._meta)==="cloud";this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new C("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")et.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(D=>et.warn("dispose stale agent failed (ignored)",{err:String(D)})),this.registry.unregister(e.agentId);else return et.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!(i&&mi(e.framework))&&!this.config.frameworksCache?.[e.framework])throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let f=Oe(e.agentId,this.paths),l=e.workspace??f.workspace,h=Nt(e._meta),m=new AbortController,y=setTimeout(()=>m.abort(new C("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),S,b=!1;try{let D=()=>{if(m.signal.aborted)throw m.signal.reason instanceof Error?m.signal.reason:new C("AGENT_TIMEOUT","_agent/create aborted")};await Cr(f.root,{recursive:!0}),await Cr(l,{recursive:!0}),await Cr(f.logs,{recursive:!0}),D(),await dt(l,e.framework,e.agentId,e.cozeIdentity),D();let R=await le(e.agentId,this.paths).catch(()=>null),N=Js({model:e.model??R?.model});if(S=new En({agentId:e.agentId,framework:e.framework,workspace:l,model:N.model??ht,deployType:h}),S.status="ok",R?.sessions){for(let[xe,re]of Object.entries(R.sessions))S.sessions.set(xe,{acpSessionId:re.acpSessionId,modelToken:re.modelToken,tokenGeneratedAt:re.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let F=Object.keys(R.sessions).length;F>0&&et.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:F})}this.registry.register(S),b=!0;let L={agentId:e.agentId,framework:e.framework,workspace:l,cozeIdentity:e.cozeIdentity,createdAt:R?.createdAt??Date.now(),sessions:R?.sessions??{},model:N.model};return h==="cloud"&&(L.deployType="cloud"),R?.skills&&(L.skills=R.skills),R?.agentName&&(L.agentName=R.agentName),R?.description&&(L.description=R.description),await be(L,this.paths),e.framework==="openclaw"&&await this.getOpenclawConfig().ensureAgent(e.agentId,l),et.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:h}),{ok:!0,agentId:e.agentId,workspace:l,framework:e.framework}}catch(D){throw et.error("agent create failed, rolling back",{agentId:e.agentId,err:String(D)}),b&&S&&(await S.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await xx(f.root,{recursive:!0,force:!0}).catch(R=>et.warn("rm agent dir failed (ignored)",{err:String(R)})),D instanceof C?D:new C("AGENT_SPAWN_FAILED",String(D),{cause:D})}finally{clearTimeout(y)}}async spawnSessionDownstream(e,i,a,x){let l=this.config.frameworksCache?.[e.framework];if(!l)if(e.deployType==="cloud"&&mi(e.framework))l=fx;else throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let h=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,m;e.framework==="openclaw"?m=await this.buildOpenclawDownstream({session:e,modelConfig:h,cloudSessionId:a,cozeEnv:x,command:l.path}):m=this.factory(e.framework,l.path,e.workspace,e.agentId,h,a,x);try{return await m.start(),await m.initialize(ux),m}catch(y){throw await m.stop("spawnSessionDownstream failed").catch(()=>{}),y instanceof C?y:new C("AGENT_SPAWN_FAILED",y instanceof Error?y.message:String(y),{cause:y})}}async buildOpenclawDownstream(e){let{session:i,modelConfig:a,cloudSessionId:x,cozeEnv:f,command:l}=e,h=Lt(x),m=await pi(),y=a?.modelToken&&!Bt(a.model)?Zs(a,f):null,S;if(y){let b=Sr(x),D=`${b}/${a.model}`;if(!this.ensuredProviders.has(D)){let R=this.getOpenclawConfig();await R.ensureProvider(b,y),await R.addModelToAllowlist(D),this.ensuredProviders.add(D)}S=D}return new Mt({command:l,cwd:i.workspace,agentId:i.agentId,sessionName:h,...m?{gatewayToken:m}:{},...S?{slashModelOnStart:S}:{}})}async openclawRepair(e,i){let a=this.getOpenclawConfig();await a.deleteAgent(e),await a.ensureAgent(e,i)}async cleanupOpenclawSessionProviders(e){if(e.framework!=="openclaw"||!this.openclawConfigCache)return;let i=this.openclawConfigCache;for(let a of e.sessions.keys()){let x=Sr(a),f=`${x}/${e.model}`;this.ensuredProviders.delete(f),await i.removeProvider(x),await i.removeModelFromAllowlist(f)}}};J();import{spawn as lx}from"node:child_process";import{constants as _i,access as hx}from"node:fs/promises";import{delimiter as gx,join as px}from"node:path";var mx=B("framework-detector"),wi={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},_x=[".exe",".cmd",".bat",".ps1"],Kt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??lx,access:e.access??hx}}async detect(e){let i=wi[e],a=await this.which(i);if(!a)return mx.debug("framework binary not found",{framework:e,bin:i}),null;let x=await this.probeVersion(a);return{path:a,version:x}}async detectAll(){let e=await Promise.all(Object.keys(wi).map(async a=>[a,await this.detect(a)])),i={};for(let[a,x]of e)x&&(i[a]=x);return i}async which(e){let i=this.env.pathEnv.split(gx).filter(Boolean),a=this.env.platform==="win32"?["",..._x]:[""];for(let x of i)for(let f of a){let l=px(x,e+f);if(await this.isExecutable(l))return l}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?_i.F_OK:_i.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",x=!1,f,l=h=>{x||(x=!0,f&&clearTimeout(f),i(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});f=setTimeout(()=>{h.kill("SIGKILL"),l("unknown")},5e3),h.stdout?.on("data",m=>{a+=m.toString("utf8")}),h.on("error",()=>l("unknown")),h.on("close",()=>{let m=bx(a).split(/\r?\n/)[0]??"";l(m)})}catch{l("unknown")}})}},yx=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function bx(r){return r.replace(yx,"")}nn();de();var vx=10*6e4;function yi(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?vx:e}function Dn(r){return ut(r??V().configFile)}function Ut(r,e){return tn(e??V().configFile,r)}import{randomBytes as Sx}from"node:crypto";We();J();var j=B("core"),Ex=3e4,Cx=3e4,Pn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new pt;pendingUpstream=new Map;pendingBridge=new Map;currentCozeEnv;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=yi(e.bridgeConfig)}registerExtension(e,i){this.extensions[e]=i}getCozeEnv(){return this.currentCozeEnv}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),j.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){j.info("Core stopping",{reason:e}),await Promise.all([...this.agents.values()].map(i=>i.dispose(e))),this.agents.clear(),await this.upstream.stop(e)}get(e){return this.agents.get(e)}register(e){this.agents.set(e.agentId,e),j.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){j.warn("onAgentRegister handler threw (ignored)",{agentId:e.agentId,err:String(a)})}}onAgentRegister(e){return this.registerHandlers.add(e),()=>this.registerHandlers.delete(e)}registerHandlers=new Set;unregister(e){this.agents.delete(e)}reviveIfDisconnected(e){this.disconnectedAgents.delete(e)&&j.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,a){let x=a.downstream;x&&(x.onUpdate(f=>{a.loadingSession||this.forwardUpdate(e,f)}),x.onAgentRequest(f=>{this.handleAgentRequest(e,x,f)}),x.onExit((f,l)=>{j.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:f,signal:l}),qt(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(wn(e)){this.handleUpstreamResponse(e);return}if(!("method"in e)||typeof e.method!="string")return;let i="id"in e&&e.id!==void 0?e.id:null,a=e.params?._meta?.cozeEnv;a&&(this.currentCozeEnv=a);try{if(e.method.startsWith("_agent/")){let x=this.extensions[e.method];if(!x){i!==null?await this.sendError(i,X.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):j.warn("drop notification: extension not registered",{method:e.method});return}let f=await x(e,this);i!==null&&await this.upstream.send(gt(i,f));return}if(e.method.startsWith("session/")){let x=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(gt(i,x));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(gt(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,X.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):j.warn("drop unknown notification",{method:e.method})}catch(x){j.error("handleFrame failed",{method:e.method,err:String(x)}),i!==null&&await this.upstream.send(Qe(i,yn(x)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new C("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new C("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new C("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new C("AGENT_NOT_FOUND",`agent not found: ${a}`);let f=typeof i.sessionId=="string"?i.sessionId:void 0;if(e.method==="session/cancel"||e.method==="session/new"||!f)return this.dispatchSessionCall(x,e.method,i);let l=Date.now(),h=!1;try{let m=await x.getSessionQueue(f).enqueue(()=>this.dispatchSessionCall(x,e.method,i));return h=!0,m}finally{j.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-l,ok:h})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:x}=Ms(a);switch(i){case"session/new":{let f=Ax();return j.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:f}),{sessionId:f}}case"session/load":{let f=x;return j.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:f.sessionId}),{}}case"session/prompt":{let f=x,l=f.sessionId;if(!l)throw new C("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,l);if(h.replySeq=0,await this.ensureDownstream(e,l,h),!h.downstream||!h.acpSessionId)throw new C("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let m=a._meta?.cozeTriggerMsgId;m?e.activeTriggers.set(h.acpSessionId,m):e.activeTriggers.delete(h.acpSessionId);try{let y=await h.downstream.sessionPrompt({...f,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),y}finally{e.activeTriggers.delete(h.acpSessionId),h.downstream?.isAlive()&&this.armIdleTimer(e,l,h)}}case"session/cancel":{let l=x.sessionId;if(!l)throw new C("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(l);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.acpSessionId}),{ok:!0}}default:throw new C("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}async ensureRuntime(e,i){let a=e.sessions.get(i);if(a)return a;let f={modelToken:e.deployType==="cloud"?await this.requestSessionToken(e.agentId,i):"",tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1,replySeq:0};return e.sessions.set(i,f),await this.persistSessionMapping(e),f}async requestSessionToken(e,i){let a={sessionId:i,_meta:{cozeAgentId:e}};try{let x=await this.sendRequest(De.GEN_MODEL_TOKEN,a,Cx);if(!x?.modelToken)throw new C("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return x.modelToken}catch(x){throw x instanceof C&&x.code==="MODEL_TOKEN_GEN_FAILED"?x:new C("MODEL_TOKEN_GEN_FAILED",x instanceof Error?x.message:String(x),{cause:x})}}async ensureDownstream(e,i,a){if(qt(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new C("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let x=await this.sessionSpawner(e,a.modelToken,i,this.currentCozeEnv);if(a.downstream=x,this.attachRuntimeHooks(e,i,a),a.acpSessionId){a.loadingSession=!0;try{await x.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),j.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId})}catch(f){j.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId,err:String(f)}),a.acpSessionId=void 0;let l=await x.sessionNew({cwd:e.workspace});a.acpSessionId=l.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let f=await x.sessionNew({cwd:e.workspace});a.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}x.afterSessionEstablished&&a.acpSessionId&&await x.afterSessionEstablished(a.acpSessionId)}armIdleTimer(e,i,a){if(qt(a),this.isRuntimeBusy(e,a)){j.debug("skip idle timer: runtime busy (in-flight turn / pending permission)",{agentId:e.agentId,cloudId:i});return}a.idleTimer=setTimeout(()=>{if(a.idleTimer=void 0,this.isRuntimeBusy(e,a)){j.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:i}),this.armIdleTimer(e,i,a);return}j.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let x=a.downstream;a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),x&&x.stop("idle timeout").catch(f=>j.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(f)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}isRuntimeBusy(e,i){if(i.acpSessionId&&e.activeTriggers.has(i.acpSessionId))return!0;let a=i.downstream;if(!a)return!1;for(let x of this.pendingUpstream.values())if(x.downstream===a)return!0;return!1}forwardUpdate(e,i){let a=i.sessionId,x=this.reverseSessionId(e,a);if(!x){j.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let f=e.sessions.get(x);if(!f){j.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:x});return}let l={cozeAgentId:e.agentId,cozeReplySeqID:++f.replySeq},h=e.activeTriggers.get(a);h&&(l.cozeTriggerMsgId=h),this.upstream.send(mn("session/update",{...i,sessionId:x,_meta:l})).catch(m=>j.warn("forward update failed",{agentId:e.agentId,err:String(m)}))}handleAgentRequest(e,i,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,i,a);return}j.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),i.respondAgentRequestError(a.id,{code:X.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}forwardPermissionRequest(e,i,a){let x=this.upstreamIds.next("session/request_permission"),f=a.params??{},h=f.sessionId,m=h?e.activeTriggers.get(h):void 0,y={cozeAgentId:e.agentId};m&&(y.cozeTriggerMsgId=m);let S=h?this.reverseSessionId(e,h):void 0,b={...f,...S?{sessionId:S}:{},_meta:y};this.pendingUpstream.set(x,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),this.upstream.send(zt(x,"session/request_permission",b)).catch(D=>{this.pendingUpstream.delete(x),j.error("forward permission request failed",{agentId:e.agentId,err:String(D)}),i.respondAgentRequestError(a.id,{code:X.INTERNAL_ERROR,message:`upstream send failed: ${String(D)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),e.error?i.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.downstream.respondAgentRequest(i.agentRequestId,e.result);return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new _n(e.error)):a.resolve(e.result);return}j.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=Ex){let x=this.upstreamIds.next(e);return new Promise((f,l)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),l(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:l,timer:h}),this.upstream.send(zt(x,e,i)).catch(m=>{let y=this.pendingBridge.get(x);y&&(clearTimeout(y.timer),this.pendingBridge.delete(x)),l(m)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[a,x]of e.sessions){let f={modelToken:x.modelToken,tokenGeneratedAt:x.tokenGeneratedAt};x.acpSessionId&&(f.acpSessionId=x.acpSessionId),i.set(a,f)}await yr(e.agentId,i,this.paths)}catch(i){j.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[a,x]of e.sessions.entries())if(x.acpSessionId===i)return a}sendError(e,i,a){return this.upstream.send(Qe(e,{code:i,message:a}))}};function Ax(){return Sx(16).toString("hex")}J();de();import{randomBytes as kx}from"node:crypto";import{chmod as Dx,mkdir as Px,writeFile as bi}from"node:fs/promises";import{createServer as Tx}from"node:http";import{dirname as Ix}from"node:path";var Rx=1e6,Ar=B("ipc"),Tn=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(i=>[`${i.method} ${i.path}`,i])),this.paths=e.paths??V()}async start(){this.token=kx(32).toString("hex");let e=Tx((a,x)=>{this.dispatch(a,x)});this.server=e,await new Promise((a,x)=>{e.once("error",x),e.listen(0,"127.0.0.1",()=>a())});let i=e.address();if(!i||typeof i!="object")throw new Error("failed to obtain IPC port");return this.port=i.port,await this.persistAuthFiles(),Ar.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((i,a)=>{e.close(x=>x?a(x):i())}),this.server=null)}async persistAuthFiles(){await Px(Ix(this.paths.portFile),{recursive:!0}),await bi(this.paths.portFile,String(this.port),"utf8"),await bi(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await Dx(this.paths.tokenFile,384)}catch(e){Ar.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Ft(i,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){Ft(i,404,{error:"not found"});return}let l=null;if(e.method==="POST")try{l=await Nx(e)}catch(h){Ft(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await f.handler(l,e);Ft(i,200,h??{ok:!0})}catch(h){Ar.error("IPC handler failed",{key:x,err:String(h)}),Ft(i,500,{error:h instanceof Error?h.message:String(h)})}}};function Ft(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function Nx(r){let e=[],i=0;for await(let x of r){let f=x;if(i+=f.length,i>Rx)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Fo=Be(Ri(),1);var hf=Be(Do(),1),gf=Be(Wn(),1),pf=Be(yt(),1),mf=Be(qr(),1),_f=Be(Fr(),1),wf=Be(Vr(),1),zo=Be(Yn(),1),yf=Be(Oo(),1);var Mo=zo.default;J();var ae=B("upstream.frontier"),Ko="application/json",Uo="none",Zn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ae.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:Us,...un(this.opts.ppeOverride)};class i extends Mo{constructor(h){super(h,Ks,{headers:e})}send(h,...m){if(Os("debug"))try{let y;typeof h=="string"?y=Buffer.from(h,"utf8"):h instanceof Buffer?y=h:h instanceof ArrayBuffer?y=new Uint8Array(h):ArrayBuffer.isView(h)?y=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):y=new Uint8Array(0);let S=Buffer.from(y.slice(0,128)).toString("hex");ae.debug("WS raw frame out",{bytes:y.byteLength,headHex:S})}catch(y){ae.warn("WS raw frame dump failed",{err:String(y)})}super.send(h,...m)}}let a=js(this.opts.urlOverride),x={url:a,ws:i,fpID:qs,aID:fn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:Ko,force:!0},payloadEncoding:{encoding:Uo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new Fo.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let l=this.openCount===1;ae.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:l,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:l})).catch(h=>ae.warn("onConnect handler threw (ignored)",{err:String(h)}))},f.onclose=l=>{this.opened=!1,ae.info("frontier closed",{code:l.code,reason:l.reason,willReconnect:l.willReconnect})},f.onerror=l=>{ae.warn("frontier error",{code:l.code,msg:l.message})},f.onmessage=l=>this.handleMessage(l),this.fws=f,await f.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(a){ae.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new C("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;ae.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:Ko,payloadEncoding:Uo})}catch(f){throw new C("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(f)}`,{cause:f})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let i=e.message?.service;if(i!==33555712){ae.debug("drop non-adapter frontier frame",{service:i});return}let a=Sf(e);if(!a){ae.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ae.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){ae.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}ae.info("frontier frame in",{logid:vf(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>ae.warn("frontier frame handler threw",{err:String(f)}))}};function vf(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function Sf(r){let e=r.message;if(e?.textPayload)return e.textPayload;let i=e?.payload;if(!i)return null;try{return Buffer.from(i).toString("utf8")}catch{return null}}J();var Yr=B("upstream.switchable"),Qn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;Yr.info("swap upstream",{reason:i});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw Yr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(i??"swapped").catch(x=>Yr.warn("previous upstream stop threw (ignored)",{err:String(x)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};J();var $r=B("upstream"),$t=class{handler=null;async start(){$r.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){$r.info("NoopUpstream stopped",{reason:e})}async send(e){$r.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};J();de();J();de();import{execSync as Ef}from"node:child_process";import{readFileSync as Ho,unlinkSync as Cf}from"node:fs";import{mkdir as Af,readFile as jo,unlink as Go,writeFile as kf}from"node:fs/promises";import{dirname as Df}from"node:path";var Pf=B("single-instance"),er=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??V().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(Pf.warn("removing stale pid file",{stalePid:e}),await Go(this.pidFile).catch(()=>{})),await Af(Df(this.pidFile),{recursive:!0}),await kf(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await jo(this.pidFile,"utf8")).trim()===String(process.pid)&&await Go(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await jo(this.pidFile,"utf8"),i=Number.parseInt(e.trim(),10);return Number.isFinite(i)&&i>0?i:null}catch(e){if(e.code==="ENOENT")return null;throw e}}isAlive(e){try{process.kill(e,0)}catch(i){return i.code==="EPERM"}return this.matchesDaemonTitle(e)}matchesDaemonTitle(e){try{let i=Ho(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=Ef(`ps -o command= -p ${e}`,{stdio:["ignore","pipe","ignore"],timeout:1e3}).toString();return i.trim()?i.includes("coze-bridge-daemon")||i.includes("lib/index.js"):!1}catch{return!0}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Ho(this.pidFile,"utf8").trim()===String(process.pid)&&Cf(this.pidFile)}catch{}})}};var q=B("daemon"),Tf="coze-bridge-daemon";async function Vo(){let r=new er({processTitle:Tf}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await Dn(),a=i??{};wr({pid:process.pid}),q.info(i?"loaded bridge config":"initialized bridge config");try{let I=new Kt;a.frameworksCache=await I.detectAll(),q.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(I){q.warn("framework detection failed",{err:String(I)})}await Ut(a);let x=new Qn(new $t),f=V(),l=null,h=new Pn({upstream:x,paths:f,bridgeConfig:a,sessionSpawner:async(I,H,Y,se)=>{if(!l)throw new Error("agentManager not ready");return l.spawnSessionDownstream(I,H,Y,se)}});await Rf(f,h);let m=new kn({paths:f,config:a,registry:h});l=m;let y,S,b=null,D=null;h.registerExtension("_agent/create",async I=>m.createAgent(I.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let R={},N=new hn({agents:h.agents,disposeAndMarkDisconnected:async(I,H)=>{let Y=h.agents.get(I);Y&&(await m.cleanupOpenclawSessionProviders(Y).catch(se=>q.warn("cleanup openclaw providers failed (ignored)",{agentId:I,err:String(se)})),await Y.dispose(`disconnect: ${H}`).catch(se=>q.warn("dispose during disconnect failed (ignored)",{agentId:I,err:String(se)})),Y.status="disconnected",h.unregister(I)),h.disconnectedAgents.add(I)},detailSyncer:async I=>{if(!R.ref)throw new Error("agent-detail-sync not initialized yet");await R.ref.syncOne(I)},openclawRepair:async(I,H)=>{await m.openclawRepair(I,H)}});h.registerExtension("_agent/listSkills",I=>N.listSkills(I.params)),h.registerExtension("_agent/addSkills",I=>N.addSkills(I.params)),h.registerExtension("_agent/removeSkills",I=>N.removeSkills(I.params)),h.registerExtension("_agent/getFileTree",I=>N.getFileTree(I.params)),h.registerExtension("_agent/getFileContent",I=>N.getFileContent(I.params)),h.registerExtension("_agent/update",I=>N.updateAgent(I.params)),h.registerExtension("_agent/disconnect",I=>N.disconnectAgent(I.params)),h.registerExtension("_agent/switchModel",I=>N.switchModel(I.params)),h.registerExtension("_agent/reset",I=>N.resetAgent(I.params)),h.registerExtension("_agent/repair",I=>N.repairAgent(I.params));let L=new cn({paths:f,handlers:N,sendDetail:I=>h.sendRequest("_agent/detail",I)});R.ref=L,x.onConnect(({initial:I})=>{q.info("frontier upstream connected, triggering detail sync",{initial:I}),L.syncAll(I?"initial-connect":"reconnect").catch(H=>q.warn("detail sync top-level error (ignored)",{err:String(H)}))});let F=new Tn({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:b??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async I=>{let H=I,Y=H?.privatecode,se=H?.pairing_code;if(!Y||!se)throw new C("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let Re=dn(H.env),_e=H.handshake_url,$e=H.frontier_url,kt=If(H.env,_e,$e),Zt=!!y&&y!==Y,Ee=S!==void 0&&S!==kt,Ce=Zt||Ee;if(Ce){q.warn("pair config switched, resetting agents",{pcChanged:Zt,envChanged:Ee,previousPc:y?Wo(y):"",nextPc:Wo(Y),previousEnvKey:S??"",nextEnvKey:kt});for(let W of[...h.agents.values()])await W.dispose("pair config switch").catch(()=>{}),h.agents.delete(W.agentId);await x.swap(new $t,"pair switch").catch(()=>{})}let Qt=await Ws({privatecode:Y,..._e?{endpoint:_e}:{},ppeOverride:Re});b=Qt.deviceId,wr({deviceId:b,pid:process.pid});let ce=new Zn({handshake:Qt,privatecode:Y,...$e?{urlOverride:$e}:{},ppeOverride:Re});await x.swap(ce,"pair");let en=Object.keys(a.frameworksCache??{});try{let W=await h.sendRequest("_agent/pair",{pairCode:se,patToken:Y,frameworks:en,_meta:{cozeDeviceId:b}});q.info("_agent/pair ok",{pairResult:W}),y=Y,S=kt,D||(D=new pn({core:h,getDeviceId:()=>b??""})),D.start(),Ce&&Jo(f,m).catch(Ne=>q.warn("post-pair-switch auto-revive error (ignored)",{err:String(Ne)}));let $;return H.agent_id&&($=await Nf(H.agent_id,f,m,Ne=>h.sendRequest("_agent/detail",Ne)).catch(Ne=>(q.error("--agent-id ensureAgent failed",{agentId:H.agent_id,err:String(Ne)}),{ok:!1,agentId:H.agent_id??"",note:String(Ne)}))),{ok:!0,note:"paired with cloud",...$?{agent:$}:{}}}catch(W){return q.error("_agent/pair failed",{err:String(W)}),{ok:!1,note:`pair failed: ${String(W)}`}}}},{method:"POST",path:"/_agent/create",handler:async I=>{let H=I;return{ok:!0,result:await m.createAgent(H)}}},{method:"POST",path:"/refresh",handler:async()=>{q.info("IPC /refresh: re-detecting frameworks");let I=new Kt;return a.frameworksCache=await I.detectAll(),await Ut(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(q.info("IPC /shutdown received"),setImmediate(()=>{ue.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:xe,token:re}=await F.start();await h.start(),Jo(f,m).catch(I=>q.warn("auto-revive top-level error (ignored)",{err:String(I)}));let Se=null,ue={port:xe,token:re,core:h,ipc:F,shutdown(I){return Se||(q.info("daemon shutdown",{reason:I}),Se=(async()=>{D?.stop(),await h.stop(I),await F.stop(),await r.release()})(),Se)}};for(let I of["SIGTERM","SIGINT"])process.on(I,()=>{ue.shutdown(I).then(()=>process.exit(0))});return q.info("daemon ready",{port:xe,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),ue}function Wo(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function If(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function Rf(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:f}=await Promise.resolve().then(()=>(We(),xn));for(let l of a){await f(l,r).catch(h=>q.warn("enforceAgentConfigMode failed (ignored)",{agentId:l,err:String(h)}));try{let h=await x(l,r);h?.disconnectedAt&&(e.disconnectedAgents.add(l),q.info("agent marked disconnected on startup",{agentId:l,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){q.warn("failed to load agent config on startup, skipping",{agentId:l,err:String(h)})}}}async function Nf(r,e,i,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(We(),xn)),f=await x(r,e);if(f){q.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let y={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{}};return await i.createAgent(y),{ok:!0,agentId:r,note:f.disconnectedAt?"revived from local config":"connected from local config"}}q.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let l=await a({_meta:{cozeAgentId:r}});if(!l.framework)throw new C("AGENT_NOT_FOUND",`agent ${r} \u4E0D\u5728\u672C\u5730; \u4E91\u7AEF _agent/detail \u54CD\u5E94\u7F3A framework \u5B57\u6BB5 (D36 \u534F\u8BAE\u6269\u5C55\u672A\u751F\u6548), \u65E0\u6CD5\u5728\u672C\u673A\u65B0\u5EFA`);let h={agentId:l.agentId,framework:l.framework,...l.cozeIdentity?{cozeIdentity:l.cozeIdentity}:{},...l.model?{model:l.model}:{},...l.deployType?{_meta:{cozeDeployType:l.deployType}}:{}};await i.createAgent(h);let m=l.deployType==="cloud"&&l.framework==="openclaw";return{ok:!0,agentId:r,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function Jo(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:x}=await Promise.resolve().then(()=>(We(),xn));q.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,l=0;for(let h of a){let m;try{m=await x(h,r)}catch(y){q.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(y)}),l+=1;continue}if(!m){l+=1;continue}if(m.disconnectedAt){q.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),l+=1;continue}try{q.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:h,framework:m.framework}),await e.createAgent({agentId:m.agentId,framework:m.framework,...m.cozeIdentity?{cozeIdentity:m.cozeIdentity}:{},...m.model?{model:m.model}:{},...m.deployType?{_meta:{cozeDeployType:m.deployType}}:{}}),f+=1}catch(y){q.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(y)}),l+=1}}return q.info("auto-revive: done",{revived:f,skipped:l,total:a.length}),{revived:f,skipped:l,total:a.length}}Qr();de();import{readFile as Yo}from"node:fs/promises";var Ye=class{paths;constructor(e){this.paths=e??V()}async probe(e=1e3){let i=await this.readAuth();if(!i)return{kind:"not-running"};try{let a=await this.fetch(i,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...i}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:Ff(a)}}}async request(e){let i=await this.readAuth();if(!i)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(i,e)}async readAuth(){try{let[e,i]=await Promise.all([Yo(this.paths.portFile,"utf8"),Yo(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=i.trim();return!Number.isFinite(a)||a<=0||!x?null:{port:a,token:x}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let a=i.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let f=new AbortController,l=setTimeout(()=>f.abort(),i.timeoutMs??5e3);try{let h=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:x,body:a?JSON.stringify(i.body):void 0,signal:f.signal}),m=await h.text();return{status:h.status,body:Uf(m)}}finally{clearTimeout(l)}}};function Uf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function Ff(r){return r instanceof Error?r.message:String(r)}J();de();import{copyFile as $o,mkdir as Hf,readFile as es,writeFile as jf}from"node:fs/promises";import{dirname as Gf,resolve as ts,sep as tr}from"node:path";import{fileURLToPath as Wf}from"node:url";J();de();var Zo=B("dist-install");function Jf(r){let e=Wf(r),i=Gf(e),a=`${tr}src${tr}`;if(i.includes(a)||i.endsWith(`${tr}src${tr}cli`))return null;let x=ts(i,"index.js"),f=ts(i,"..","package.json");return{dist:x,pkgJson:f}}async function Qo(r={}){let e=r.paths??V(),i=Jf(import.meta.url),a=r.sourceDist??i?.dist,x=r.sourcePackageJson??i?.pkgJson;if(!a||!x)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let f;try{f=JSON.parse(await es(x,"utf8")).version??"unknown"}catch(b){return Zo.warn("cannot read source package.json,skip dist install",{err:String(b)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(b)}`}}let l=await Dn(e.configFile)??{},h=l.libVersion;if(h===f)try{return await es(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await Hf(e.libDir,{recursive:!0}),await $o(a,e.libEntry),await $o(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=ts(e.libDir,"package.json"),y=`${JSON.stringify({type:"module"},null,2)}
93
- `;return await es(m,"utf8").catch(()=>null)!==y&&await jf(m,y),l.libVersion=f,await Ut(l,e.configFile),Zo.info("dist installed",{libEntry:e.libEntry,fromVersion:h,toVersion:f}),h?{kind:"version-changed",fromVersion:h,toVersion:f,libEntry:e.libEntry}:{kind:"first-install",libVersion:f,libEntry:e.libEntry}}var du=B("cli");function At(r,e){let i=[],a;for(let x=0;x<r.length;x++){let f=r[x];if(f===e){a=r[x+1],x+=1;continue}if(f.startsWith(`${e}=`)){a=f.slice(e.length+1);continue}i.push(f)}return{value:a,rest:i}}function lu(r){let e=r.slice(2);if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let i=e,{value:a,rest:x}=At(i,"--pat-token");i=x;let{value:f,rest:l}=At(i,"--pair-code");i=l;let{value:h,rest:m}=At(i,"--env");i=m;let{value:y,rest:S}=At(i,"--handshake-url");i=S;let{value:b,rest:D}=At(i,"--frontier-url");i=D;let{value:R}=At(i,"--agent-id");if(!a||!f)return{mode:"help"};let N={mode:"pair",privatecode:a,pairingCode:f};return h&&(N.env=h),y&&(N.handshakeUrl=y),b&&(N.frontierUrl=b),R&&(N.agentId=R),N}var hu=`
88
+ ${c}`}var ve=L("agent-detail-sync"),nn=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,o;try{o=await k0(i)}catch(c){ve.info("agents dir not found, skip detail sync",{root:i,err:String(c)});return}ve.info("starting detail sync",{reason:e,count:o.length});for(let c of o)try{await this.syncOne(c)}catch(x){ve.warn("detail sync failed for agent, skipping",{agentId:c,err:String(x)})}ve.info("detail sync done",{reason:e})}async syncOne(e){let i=await ue(e,this.opts.paths);if(!i){ve.info("detail sync: agent config missing, skip",{agentId:e});return}let o;try{o=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(f){ve.warn("detail RPC failed, using local data",{agentId:e,err:String(f)});return}if(o.agentId&&o.agentId!==e){ve.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:o.agentId});return}let c=!1,x=!1;if(o.agentName&&o.agentName!==i.agentName&&(i.agentName=o.agentName,c=!0),o.description!==void 0&&o.description!==i.description&&(i.description=o.description,c=!0),o.cozeIdentity&&o.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=o.cozeIdentity,c=!0,x=!0),o.deployType&&ve.info("detail.deployType",{agentId:e,deployType:o.deployType}),!c){ve.debug("detail sync: no diff",{agentId:e});return}await me(i,this.opts.paths),ve.info("detail sync: config updated",{agentId:e,identityChanged:x,agentName:i.agentName}),x&&(await ct(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ue();import{spawn as si}from"node:child_process";import{lstat as Cr,mkdir as T0,readFile as ii,readdir as L0,rm as R0,stat as N0,writeFile as O0}from"node:fs/promises";import{join as Re,normalize as B0,relative as oi,resolve as M0,sep as ai}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 At(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Us(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function xt(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var E=class extends Error{code;retriable;cause;constructor(e,i,o){super(i),this.name="BridgeError",this.code=e,this.retriable=o?.retriable??!1,o?.cause!==void 0&&(this.cause=o.cause)}};U();xe();function Le(r,e){if(At(r)!=="cloud")throw new E("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function kt(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}U();var rn="1008033",Hs="1289";var Ks="pbbp2",Gs="https://www.coze.cn",Ws="/api/coze_claw/resource/get_frontier_key",P0="https://www.coze.cn",D0="wss://frontier.coze.cn";function js(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??P0}function Js(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??D0}function sn(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,o=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),o&&(e["x-use-ppe"]=o),e}function on(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Vs=L("handshake");async function Ys(r){let e=js(r.endpoint),i=r.timeoutMs??1e4,o=`${I0(e)}${Ws}?aid=${encodeURIComponent(rn)}`,c={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...sn(r.ppeOverride)},x=new AbortController,f=setTimeout(()=>x.abort(),i);Vs.info("frontier key handshake",{base:e});try{let d=await fetch(o,{method:"GET",headers:c,signal:x.signal}),g=d.headers.get("x-tt-logid")??"",w=d.headers.get("x-tt-trace-id")??"";if(!d.ok){let P=await d.text().catch(()=>"");throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${d.status} logid=${g}: ${P.slice(0,200)}`)}let b=await d.json();if(b.code!==void 0&&b.code!==0)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${b.code} msg=${b.msg??"-"} logid=${g}`);let y=b.data?.access_key,C=b.data?.device_id;if(!y||!C)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${g}: ${JSON.stringify(b)}`);return Vs.info("handshake ok",{remoteDeviceId:C,logid:g,traceId:w}),{accessKey:y,deviceId:C}}catch(d){throw d instanceof E?d:d.name==="AbortError"?new E("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new E("UPSTREAM_HANDSHAKE_FAILED",String(d),{cause:d})}finally{clearTimeout(f)}}function I0(r){return r.endsWith("/")?r.slice(0,-1):r}var br="https://llm-gateway.coze.cn",He="auto";function Xs(r){return{model:r.model??He,...r.modelToken?{modelToken:r.modelToken}:{}}}function Pt(r){return!r||r===He}function $s(r){let e={};return r.modelToken?(e.ANTHROPIC_BASE_URL=br,e.ANTHROPIC_AUTH_TOKEN=r.modelToken,e.ANTHROPIC_MODEL=r.model||He):Pt(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Qs(r){let e=[];return r.modelToken?e.push("-c",`model="${r.model||He}"`):Pt(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_providers.coze.name="coze"'),e.push("-c",`model_providers.coze.base_url="${br}/v1"`),e.push("-c",'model_providers.coze.env_key="OPENAI_API_KEY"'),e.push("-c",'model_providers.coze.wire_api="responses"'),e.push("-c","model_providers.coze.requires_openai_auth=false"),e.push("-c","model_providers.coze.supports_websockets=false"),e.push("-c",'model_provider="coze"')),e}function Zs(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}function vr(r){let{ttEnv:e,usePpe:i}=on(r),o={};return e&&(o["x-tt-env"]=e),i&&(o["x-use-ppe"]=i),o}function ei(r,e){if(!r.modelToken)return{};let i=vr(e);return Object.keys(i).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(i).map(([c,x])=>`${c}:${x}`).join(`
89
+ `)}}function Sr(r){return`coze-session-${r.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function ti(r,e){if(!r.modelToken||Pt(r.model))return null;let i=vr(e),o={baseUrl:`${br}/v1`,api:"openai-completions",apiKey:r.modelToken,models:[{id:r.model,name:r.model,reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192,api:"openai-completions"}]};return Object.keys(i).length>0&&(o.headers=i),o}function ni(r,e){if(!r.modelToken)return[];let i=vr(e),o=[];for(let[c,x]of Object.entries(i))o.push("-c",`model_providers.coze.http_headers.${c}="${x}"`);return o}var te=L("agent-handlers"),ri=5*1024*1024,z0=1,q0=6,F0=new Set(["node_modules",".git",".coze","dist","build",".next"]),cn=class{constructor(e){this.opts=e}opts;async listSkills(e){Le(e._meta,"_agent/listSkills");let i=xt(e._meta),o=await this.loadAgentCfg(i),c=o?.workspace??Te(i).workspace,x=o?.skills??[],f=[];for(let d of x){let g=Re(c,d.relPath,"SKILL.md");await N0(g).then(b=>b.isFile()).catch(()=>!1)&&f.push({skillId:d.skillId,skillName:d.skillName,downloadUrl:d.downloadUrl??"",...d.description?{description:d.description}:{},...d.version?{version:d.version}:{}})}return{skills:f}}async addSkills(e){Le(e._meta,"_agent/addSkills");let i=xt(e._meta),o=await this.requireAgentCfg(i),c=e.skills??[],x=[...o.skills??[]],f=new Map(x.map((g,w)=>[g.skillId,w])),d=[];for(let g of c){if(!g.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let w=U0(g.skillName),b=H0(o.framework),y=Re(b,w),C=Re(o.workspace,y);await T0(C,{recursive:!0});let P=await W0(g.downloadUrl);J0(P)?await V0(P,C):await O0(Re(C,"SKILL.md"),P.toString("utf8"),"utf8");let I={skillId:g.skillId,skillName:g.skillName,relPath:y,installedAt:Date.now(),...g.description?{description:g.description}:{},...g.version?{version:g.version}:{},...g.downloadUrl?{downloadUrl:g.downloadUrl}:{}},T=f.get(g.skillId);T!==void 0?x[T]=I:(f.set(g.skillId,x.length),x.push(I)),d.push(g),te.info("skill installed",{agentId:i,skillId:g.skillId,skillName:g.skillName,relPath:y})}return await en(i,x),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:d}}async removeSkills(e){Le(e._meta,"_agent/removeSkills");let i=xt(e._meta),o=await this.requireAgentCfg(i),c=new Set(e.skillIds??[]),x=o.skills??[],f=[];for(let d of x){if(!c.has(d.skillId)){f.push(d);continue}let g=Re(o.workspace,d.relPath);await R0(g,{recursive:!0,force:!0}),te.info("skill removed",{agentId:i,skillId:d.skillId,relPath:d.relPath})}return await en(i,f),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let o=this.opts.agents.get(e);if(o&&o.framework!=="codex"){for(let[c,x]of o.sessions)if(!(!x.downstream||!x.acpSessionId)){x.loadingSession=!0;try{await x.downstream.sessionLoad({sessionId:x.acpSessionId,cwd:o.workspace}),te.info("session reloaded",{reason:i,agentId:e,framework:o.framework,cloudId:c,acpId:x.acpSessionId})}catch(f){te.warn("session reload failed",{reason:i,agentId:e,framework:o.framework,cloudId:c,acpId:x.acpSessionId,err:String(f)})}finally{x.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return te.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,o=await ue(i);if(!o)throw new E("AGENT_NOT_FOUND",`agent not found: ${i}`);return o.cozeIdentity===e.cozeIdentity?(te.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(o.cozeIdentity=e.cozeIdentity,await me(o),await ct(o.workspace,o.framework,i,e.cozeIdentity),te.info("_agent/update: cozeIdentity rewritten",{agentId:i,framework:o.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 o=await ue(i);return o?(o.disconnectedAt=Date.now(),o.disconnectReason=e.reason??"",await me(o),te.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}):(te.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,o=await ue(e.agentId);if(!o)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);o.model=i,await me(o),te.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let c=this.opts.agents.get(e.agentId);if(!c)return te.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};c.model=i;let x=[];for(let[f,d]of c.allSessionQueues())x.push(d.enqueue(async()=>{let g=c.sessions.get(f);g?.downstream&&(await g.downstream.stop(`switchModel: ${i}`).catch(()=>{}),g.downstream=void 0)}));return await Promise.all(x),te.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i,cloudSessions:x.length}),{ok:!0}}async resetAgent(e){if(Le(e._meta,Se.RESET),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Se.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,Se.RESET,e.reason),{ok:!0}}async repairAgent(e){if(Le(e._meta,Se.REPAIR),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Se.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new E("IPC_BAD_REQUEST",`${Se.REPAIR} only allowed for openclaw, got ${i.framework}`);if(i&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,i.workspace)}catch(o){te.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(o)})}return await this.runDetailSync(e.agentId,Se.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,o){if(!this.opts.detailSyncer){te.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(c){te.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:o,err:String(c)})}}async getFileTree(e){Le(e._meta,"_agent/getFileTree");let i=e._meta,o=xt(i),c=await this.resolveWorkspace(o),x=e.filePath??"",f=this.safeJoin(c,x),d=await Cr(f).catch(()=>null);if(!d)throw new E("IPC_BAD_REQUEST",`path not found: ${x}`);if(d.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${x}`);let g=X0(e.depth);return d.isDirectory()?{tree:await ci(c,f,x,g)}:{tree:[{name:$0(x),path:xi(x||"."),isDir:!1,size:d.size,modifiedAt:Math.floor(d.mtimeMs)}]}}async getFileContent(e){Le(e._meta,"_agent/getFileContent");let i=xt(e._meta),o=await this.resolveWorkspace(i);if(!e.filePath)throw new E("IPC_BAD_REQUEST","filePath required");let c=this.safeJoin(o,e.filePath),x=await Cr(c).catch(()=>null);if(!x||!x.isFile())throw new E("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(x.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(x.size>ri)throw new E("IPC_BAD_REQUEST",`file too large: ${x.size} bytes (max ${ri})`);let f=await ii(c);return f.includes(0)?{content:f.toString("base64"),encoding:"base64",size:x.size}:{content:f.toString("utf8"),encoding:"utf-8",size:x.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await ue(e).catch(()=>null))?.workspace??Te(e).workspace}safeJoin(e,i){let o=M0(e,i||"."),c=oi(e,o);if(c.startsWith("..")||c===".."||c.startsWith(`..${ai}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return o}loadAgentCfg(e){return ue(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 U0(r){let e=kt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new E("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function H0(r){return r==="claude-code"?Re(".claude","skills"):Re(".agents","skills")}var K0=3e4,G0=50*1024*1024,xn=3e4;async function W0(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);an(e);let i=j0(r);return an(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await ii(e);return an(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),K0);try{let o=await fetch(r,{signal:e.signal});if(!o.ok)throw new E("IPC_BAD_REQUEST",`fetch skill failed HTTP ${o.status} ${r}`);let c=await o.arrayBuffer();return an(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 an(r){if(r>G0)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],o=e[3]??"";return i?Buffer.from(o,"base64"):Buffer.from(decodeURIComponent(o),"utf8")}function J0(r){return r.length>=2&&r[0]===31&&r[1]===139}async function V0(r,e){await Y0(r),await new Promise((i,o)=>{let c=si("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),x="";c.stderr?.on("data",d=>{x+=String(d)});let f=setTimeout(()=>{c.kill("SIGKILL"),o(new E("IPC_BAD_REQUEST",`tar extract timeout (${xn}ms)`))},xn);c.on("error",d=>{clearTimeout(f),o(new E("IPC_BAD_REQUEST",`tar spawn failed: ${d.message}`,{cause:d}))}),c.on("exit",d=>{clearTimeout(f),d===0?i():o(new E("IPC_BAD_REQUEST",`tar exit ${d}${x?`: ${x.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)})}async function Y0(r){let e=await new Promise((i,o)=>{let c=si("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),x="",f="";c.stdout?.on("data",g=>{x+=String(g)}),c.stderr?.on("data",g=>{f+=String(g)});let d=setTimeout(()=>{c.kill("SIGKILL"),o(new E("IPC_BAD_REQUEST",`tar list timeout (${xn}ms)`))},xn);c.on("error",g=>{clearTimeout(d),o(new E("IPC_BAD_REQUEST",`tar list spawn failed: ${g.message}`))}),c.on("exit",g=>{clearTimeout(d),g===0?i(x):o(new E("IPC_BAD_REQUEST",`tar list exit ${g}${f?`: ${f.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)});for(let i of e.split(`
90
+ `)){let o=i.trim();if(!o)continue;let c=o.charCodeAt(0);if(c!==45&&c!==100)throw new E("IPC_BAD_REQUEST",`tar entry kind '${o[0]}' not allowed (symlink/hardlink/special): ${o.slice(0,100)}`);let f=(o.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!f)continue;if(f.startsWith("/"))throw new E("IPC_BAD_REQUEST",`tar entry absolute path: ${f}`);if(f.split(/[/\\]/).some(g=>g===".."))throw new E("IPC_BAD_REQUEST",`tar entry contains '..': ${f}`)}}async function ci(r,e,i,o){if(o<=0)return[];let c;try{c=await L0(e,{withFileTypes:!0})}catch{return[]}let x=[];for(let f of c){if(F0.has(f.name)||f.isSymbolicLink())continue;let d=Re(e,f.name),g=B0(Re(i,f.name)),w=null;try{w=await Cr(d)}catch{continue}if(w.isSymbolicLink())continue;let b={name:f.name,path:xi(oi(r,d)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&o>1&&(b.children=await ci(r,d,g,o-1)),x.push(b)}return x.sort((f,d)=>f.isDir!==d.isDir?f.isDir?-1:1:f.name.localeCompare(d.name)),x}function X0(r){return!r||r<=0?z0:Math.min(r,q0)}function $0(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function xi(r){return r.split(ai).join("/")}U();var Dt=L("agent-health-reporter"),Q0=1e4,un=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??Q0}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()}),Dt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Dt.info("heartbeat stopped"))}async tick(){if(this.inFlight){Dt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Dt.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 x=Z0(c);x&&i.push({agentId:c.agentId,status:x})}if(i.length===0)return;let o={agents:i,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",o)}catch(c){Dt.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}Ue();import{mkdir as Ar,rm as Cc}from"node:fs/promises";U();import{execFile as ec}from"node:child_process";import{promisify as tc}from"node:util";var fi=tc(ec),It=L("agents.acp-installer"),nc={"claude-code":{npmPackage:"@agentclientprotocol/claude-agent-acp",binary:"claude-agent-acp"},codex:{npmPackage:"@zed-industries/codex-acp",binary:"codex-acp"}},rc=5e4,sc=5e3,ic=5*6e4,dn=new Map,fn=new Map,Er=new Map;async function ui(r){let e=process.platform==="win32"?"where":"which";try{let{stdout:i}=await fi(e,[r],{timeout:sc});return i.split(`
91
+ `)[0]?.trim()||void 0}catch{return}}async function oc(r){It.info("npm install -g start",{npmPackage:r}),await fi("npm",["install","-g",`${r}@latest`],{timeout:rc,maxBuffer:10*1024*1024}),It.info("npm install -g done",{npmPackage:r})}async function di(r){let e=nc[r];if(!e)return;let i=dn.get(r);if(i)return i;let o=fn.get(r);if(o&&Date.now()-o<ic)return;let c=Er.get(r);if(c)return c;let x=(async()=>{let f=await ui(e.binary);if(f)return dn.set(r,f),It.info("acp wrapper found on PATH",{binary:e.binary,path:f}),f;try{await oc(e.npmPackage)}catch(g){It.warn("acp wrapper install failed (will fallback to npx)",{npmPackage:e.npmPackage,err:String(g)}),fn.set(r,Date.now());return}let d=await ui(e.binary);if(!d){It.warn("acp wrapper installed but binary not found on PATH",{binary:e.binary}),fn.set(r,Date.now());return}return dn.set(r,d),fn.delete(r),d})().finally(()=>{Er.delete(r)});return Er.set(r,x),x}function ln(r){return dn.get(r)}import{spawn as fc}from"node:child_process";function Tt(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function hn(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function ut(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Xe(r,e){return{jsonrpc:"2.0",id:r,error:e}}var gn=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 li(r){return"method"in r&&"id"in r&&r.id!==void 0}function hi(r){return"method"in r&&!("id"in r)}function pn(r){return!("method"in r)&&"id"in r}var ac={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 mn(r){return r instanceof E?{code:ac[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 gi(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 pi(r){return`${JSON.stringify(r)}
92
+ `}var wn=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 o=[];for(let c of i){let x=c.replace(/\r$/,"").trim();if(x)try{o.push(JSON.parse(x))}catch(f){this.onError?.({line:x,error:f})}}return o}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 wi={"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"},Wd=Object.fromEntries(Object.entries(wi).map(([r,e])=>[e,r])),cc={"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:[]},ft=class{seq=0;next(e,i){this.seq+=1;let o=wi[e]??xc(e),c=cc[o]??[],x=[o,String(this.seq)];if(c.length>0){let f=c.map(g=>mi(i?.[g]??"")),d=uc(f).join(":");d&&x.push(d)}else i&&Object.values(i).some(f=>f)&&x.push(Object.values(i).filter(Boolean).map(f=>mi(String(f))).join(":"));return x.join("_")}reset(){this.seq=0}};function xc(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function mi(r){return r.replace(/[:_\s]+/g,"-")}function uc(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}U();var dc=3e4;function _i(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Ke=class{constructor(e){this.opts=e;this.log=L(`downstream.${this.constructor.name}`),this.decoder=new wn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new ft;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new E("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=fc(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",o=>{for(let c of this.decoder.push(o))this.dispatch(c)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",o=>{this.log.debug("stderr",{text:o.trimEnd()})}),i.on("exit",(o,c)=>{this.stopped=!0,this.failAllPending(new E("AGENT_PROTOCOL_ERROR",`agent exited (${o}/${c})`));for(let x of this.exitHandlers)x(o,c)}),i.on("error",o=>{this.log.error("child error",{err:String(o)}),this.failAllPending(new E("AGENT_SPAWN_FAILED",String(o),{cause:o}))}),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,o=new Promise(x=>i.once("exit",()=>x()));_i(i.pid,"SIGTERM");let c=setTimeout(()=>{i.killed||_i(i.pid,"SIGKILL")},5e3);try{await o}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(hn("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(ut(e,i))}catch(o){this.log.warn("respondAgentRequest write failed",{id:e,err:String(o)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(Xe(e,i))}catch(o){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(o)})}}onExit(e){this.exitHandlers.push(e)}call(e,i,o=dc){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let c=this.idAllocator.next(e),x=Tt(c,e,i),f=o>0&&Number.isFinite(o);return new Promise((d,g)=>{let w=f?setTimeout(()=>{this.pending.delete(c),g(new E("AGENT_TIMEOUT",`${e} timed out after ${o}ms`))},o):null;this.pending.set(c,{resolve:d,reject:g,timer:w,method:e});try{this.writeFrame(x)}catch(b){w&&clearTimeout(w),this.pending.delete(c),g(b)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new E("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(pi(e))}dispatch(e){if(pn(e)){let i=e.id!==null?this.pending.get(e.id):void 0;if(!i){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),i.timer&&clearTimeout(i.timer),e.error?i.reject(gi(e.error)):i.resolve(e.result);return}if(hi(e)){if(e.method==="session/update")for(let i of this.updateHandlers)Promise.resolve(i(e.params)).catch(o=>this.log.warn("update handler failed",{err:String(o)}));else this.log.debug("unknown notification",{method:e.method});return}if(li(e)){let i=e;this.handleAgentRequest(i).catch(o=>this.log.error("agent request handler failed",{method:i.method,err:String(o)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(Xe(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let i of this.agentRequestHandlers)try{await i(e)}catch(o){this.log.error("agentRequestHandler threw",{method:e.method,err:String(o)});try{this.writeFrame(Xe(e.id,mn(o)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var lc="@agentclientprotocol/claude-agent-acp@latest";function hc(r){let e={};for(let[i,o]of Object.entries(r))o!==void 0&&(i.startsWith("CLAUDE")||i==="AI_AGENT"||i==="BAGGAGE"||(e[i]=o));return e}var _n=class extends Ke{framework="claude-code";constructor(e){let i=ln("claude-code"),[o,c]=i?[i,[]]:["npx",["-y",lc]],x=e.command??o,f=e.args??c,d={command:x,args:f,cwd:e.cwd,...e.env?{env:e.env}:{}};super(d)}sanitizeEnv(e){return hc(e)}};import{mkdtempSync as gc,rmSync as pc}from"node:fs";import{tmpdir as mc}from"node:os";import{join as wc}from"node:path";var _c="@zed-industries/codex-acp@latest",yn=class extends Ke{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=ln("codex"),[o,c]=i?[i,[]]:["npx",["-y",_c]],x=e.command??o,f=e.args??c,d=e.extraArgs?[...f,...e.extraArgs]:f,g=e.isolateCodexHome?gc(wc(mc(),"coze-bridge-codex-home-")):void 0,w=g?{...e.env??{},CODEX_HOME:g}:e.env,b={command:x,args:d,cwd:e.cwd,...w?{env:w}:{}};super(b),this.authMethodId=e.authMethodId,this.codexHomeDir=g}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{pc(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Lt=class extends Ke{framework="openclaw";agentId;sessionName;slashModelOnStart;constructor(e){let i=e.sessionName??"default",o=["acp","--session",`agent:${e.agentId}:${i}`];e.gatewayToken&&o.push("--token",e.gatewayToken);let c={command:e.command,args:o,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}};U();xe();var dt=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,o)=>{this.slots.push({task:e,resolve:i,reject:o}),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 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 i=this.sessionQueues.get(e);return i||(i=new dt,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 o of this.sessionQueues.values())o.dispose(i);this.sessionQueues.clear(),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,o]of this.sessions)Rt(o),o.downstream&&(i.push(o.downstream.stop(e).catch(()=>{})),o.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function Rt(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}import{spawn as yc}from"node:child_process";import{homedir as bc}from"node:os";import{join as vc}from"node:path";Xt();U();async function vi(){let r=vc(bc(),".openclaw/openclaw.json");return(await at(r))?.gateway?.auth?.token??""}var yi=L("openclaw.config"),Sc=[0,5e3,5e3],bi="models.providers.",vn="agents.defaults.models",Sn=class{command;env;retryDelaysMs;queue=new dt;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??Sc}async withRetry(e,i){let o;for(let c=0;c<this.retryDelaysMs.length;c++){let x=this.retryDelaysMs[c]??0;x>0&&await new Promise(f=>setTimeout(f,x));try{return await i()}catch(f){o=f,yi.warn("openclaw cli failed, will retry",{label:e,attempt:c+1,err:String(f)})}}throw new E("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${o?.message??"unknown"}`)}runCli(e){return new Promise((i,o)=>{let c=yc(this.command,e,{stdio:["ignore","pipe","pipe"],env:this.env}),x="";c.stderr?.on("data",f=>{x+=f.toString("utf8")}),c.on("error",o),c.on("close",f=>{f===0?i():o(new Error(`exit ${f}: ${x.trim().slice(0,500)}`))})})}async runCliTolerant(e,i){try{await this.runCli(e)}catch(o){let c=String(o);if(i.some(x=>c.includes(x)))return;throw o}}async bestEffortUnset(e,i){try{await this.queue.enqueue(()=>this.withRetry(e,()=>this.runCli(["config","unset",i])))}catch(o){yi.warn(`${e} failed (best-effort)`,{configPath:i,err:String(o)})}}ensureProvider(e,i){return this.queue.enqueue(()=>this.withRetry(`config set models.providers.${e}`,()=>this.runCli(["config","set",`${bi}${e}`,JSON.stringify(i),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${bi}${e}`)}addModelToAllowlist(e,i){let o={[e]:i?{alias:i}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${vn}[${e}]`,()=>this.runCli(["config","set",vn,JSON.stringify(o),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${vn}[${e}]`,`${vn}.${e}`)}ensureAgent(e,i,o){let c=["agents","add",e,"--workspace",i,"--non-interactive"];return o&&c.push("--model",o),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 Ge=L("agent-manager"),Ec=(r,e,i,o,c,x,f)=>{switch(r){case"claude-code":{let d=c?{...$s(c),...ei(c,f)}:void 0;return new _n({cwd:i,...d&&Object.keys(d).length>0?{env:d}:{}})}case"codex":{let d=c?[...Qs(c),...ni(c,f)]:[],g=c?Zs(c):void 0,w=!!c;return new yn({cwd:i,...d.length>0?{extraArgs:d}:{},...g&&Object.keys(g).length>0?{env:g}:{},...w?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new Lt({command:e,cwd:i,agentId:o,...x?{sessionName:kt(x)}:{}})}};function Si(r){return r==="claude-code"||r==="codex"}var Ac={path:"",version:"cloud-deployed"},kc={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},Pc=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??Ec,this.createTimeoutMs=e.createTimeoutMs??Pc}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 Sn({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=At(e._meta)==="cloud";this.registry.reviveIfDisconnected?.(e.agentId);let o=this.registry.get(e.agentId);if(o){if(o.framework!==e.framework)throw new E("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${o.framework})`);if(o.status==="error")Ge.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await o.dispose("rebuild after error").catch(C=>Ge.warn("dispose stale agent failed (ignored)",{err:String(C)})),this.registry.unregister(e.agentId);else return Ge.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:o.agentId,workspace:o.workspace,framework:o.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&&Si(e.framework)&&await di(e.framework);let x=Te(e.agentId,this.paths),f=e.workspace??x.workspace,d=At(e._meta),g=new AbortController,w=setTimeout(()=>g.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),b,y=!1;try{let C=()=>{if(g.signal.aborted)throw g.signal.reason instanceof Error?g.signal.reason:new E("AGENT_TIMEOUT","_agent/create aborted")};await Ar(x.root,{recursive:!0}),await Ar(f,{recursive:!0}),await Ar(x.logs,{recursive:!0}),C(),await ct(f,e.framework,e.agentId,e.cozeIdentity),C();let P=await ue(e.agentId,this.paths).catch(()=>null),I=Xs({model:e.model??P?.model});if(b=new bn({agentId:e.agentId,framework:e.framework,workspace:f,model:I.model??He,deployType:d}),b.status="ok",P?.sessions){for(let[re,Q]of Object.entries(P.sessions))b.sessions.set(re,{acpSessionId:Q.acpSessionId,modelToken:Q.modelToken,tokenGeneratedAt:Q.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let z=Object.keys(P.sessions).length;z>0&&Ge.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:z})}this.registry.register(b),y=!0;let T={agentId:e.agentId,framework:e.framework,workspace:f,cozeIdentity:e.cozeIdentity,createdAt:P?.createdAt??Date.now(),sessions:P?.sessions??{},model:I.model};return d==="cloud"&&(T.deployType="cloud"),P?.skills&&(T.skills=P.skills),P?.agentName&&(T.agentName=P.agentName),P?.description&&(T.description=P.description),await me(T,this.paths),e.framework==="openclaw"&&(this.config.frameworksCache?.openclaw?.path?await this.getOpenclawConfig().ensureAgent(e.agentId,f):Ge.warn("openclaw binary not on this machine, skip agents add (will fail at session/prompt)",{agentId:e.agentId})),Ge.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:d}),{ok:!0,agentId:e.agentId,workspace:f,framework:e.framework}}catch(C){throw Ge.error("agent create failed, rolling back",{agentId:e.agentId,err:String(C)}),y&&b&&(await b.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Cc(x.root,{recursive:!0,force:!0}).catch(P=>Ge.warn("rm agent dir failed (ignored)",{err:String(P)})),C instanceof E?C:new E("AGENT_SPAWN_FAILED",String(C),{cause:C})}finally{clearTimeout(w)}}async spawnSessionDownstream(e,i,o,c){let f=this.config.frameworksCache?.[e.framework];if(!f)if(e.deployType==="cloud"&&Si(e.framework))f=Ac;else throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let d=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,g;e.framework==="openclaw"?g=await this.buildOpenclawDownstream({session:e,modelConfig:d,cloudSessionId:o,cozeEnv:c,command:f.path}):g=this.factory(e.framework,f.path,e.workspace,e.agentId,d,o,c);try{return await g.start(),await g.initialize(kc),g}catch(w){throw await g.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:o,cloudSessionId:c,cozeEnv:x,command:f}=e,d=kt(c),g=await vi(),w=o?.modelToken&&!Pt(o.model)?ti(o,x):null,b;if(w){let y=Sr(c),C=`${y}/${o.model}`;if(!this.ensuredProviders.has(C)){let P=this.getOpenclawConfig();await P.ensureProvider(y,w),await P.addModelToAllowlist(C),this.ensuredProviders.add(C)}b=C}return new Lt({command:f,cwd:i.workspace,agentId:i.agentId,sessionName:d,...g?{gatewayToken:g}:{},...b?{slashModelOnStart:b}:{}})}async openclawRepair(e,i){let o=this.getOpenclawConfig();await o.deleteAgent(e),await o.ensureAgent(e,i)}async cleanupOpenclawSessionProviders(e){if(e.framework!=="openclaw"||!this.openclawConfigCache)return;let i=this.openclawConfigCache;for(let o of e.sessions.keys()){let c=Sr(o),x=`${c}/${e.model}`;this.ensuredProviders.delete(x),await i.removeProvider(c),await i.removeModelFromAllowlist(x)}}};U();import{spawn as Dc}from"node:child_process";import{constants as Ci,access as Ic}from"node:fs/promises";import{delimiter as Tc,join as Lc}from"node:path";var Rc=L("framework-detector"),Ei={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Nc=[".exe",".cmd",".bat",".ps1"],Nt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Dc,access:e.access??Ic}}async detect(e){let i=Ei[e],o=await this.which(i);if(!o)return Rc.debug("framework binary not found",{framework:e,bin:i}),null;let c=await this.probeVersion(o);return{path:o,version:c}}async detectAll(){let e=await Promise.all(Object.keys(Ei).map(async o=>[o,await this.detect(o)])),i={};for(let[o,c]of e)c&&(i[o]=c);return i}async which(e){let i=this.env.pathEnv.split(Tc).filter(Boolean),o=this.env.platform==="win32"?["",...Nc]:[""];for(let c of i)for(let x of o){let f=Lc(c,e+x);if(await this.isExecutable(f))return f}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Ci.F_OK:Ci.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let o="",c=!1,x,f=d=>{c||(c=!0,x&&clearTimeout(x),i(d.trim()||"unknown"))};try{let d=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});x=setTimeout(()=>{d.kill("SIGKILL"),f("unknown")},5e3),d.stdout?.on("data",g=>{o+=g.toString("utf8")}),d.on("error",()=>f("unknown")),d.on("close",()=>{let g=Bc(o).split(/\r?\n/)[0]??"";f(g)})}catch{f("unknown")}})}},Oc=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Bc(r){return r.replace(Oc,"")}Xt();xe();var Mc=10*6e4;function Ai(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?Mc:e}function En(r){return at(r??G().configFile)}function Ot(r,e){return Yt(e??G().configFile,r)}import{randomBytes as zc}from"node:crypto";Ue();U();var F=L("core"),qc=3e4,Fc=3e4,An=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new ft;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=Ai(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(),F.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){F.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),F.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(o){F.warn("onAgentRegister handler threw (ignored)",{agentId:e.agentId,err:String(o)})}}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)&&F.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,o){let c=o.downstream;c&&(c.onUpdate(x=>{o.loadingSession||this.forwardUpdate(e,x)}),c.onAgentRequest(x=>{this.handleAgentRequest(e,c,x)}),c.onExit((x,f)=>{F.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:x,signal:f}),Rt(o),o.downstream=void 0,o.acpSessionId&&e.activeTriggers.delete(o.acpSessionId)}))}async handleFrame(e){if(pn(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,o=e.params?._meta?.cozeEnv;o&&(this.currentCozeEnv=o);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}`):F.warn("drop notification: extension not registered",{method:e.method});return}let x=await c(e,this);i!==null&&await this.upstream.send(ut(i,x));return}if(e.method.startsWith("session/")){let c=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(ut(i,c));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(ut(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):F.warn("drop unknown notification",{method:e.method})}catch(c){F.error("handleFrame failed",{method:e.method,err:String(c)}),i!==null&&await this.upstream.send(Xe(i,mn(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,o=i._meta?.cozeAgentId;if(!o)throw new E("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let c=this.agents.get(o);if(!c)throw this.disconnectedAgents.has(o)?new E("AGENT_DISCONNECTED",`agent ${o} has been disconnected; cloud must _agent/create to revive`):new E("AGENT_NOT_FOUND",`agent not found: ${o}`);let x=typeof i.sessionId=="string"?i.sessionId:void 0;if(e.method==="session/cancel"||e.method==="session/new"||!x)return this.dispatchSessionCall(c,e.method,i);let f=Date.now(),d=!1;try{let g=await c.getSessionQueue(x).enqueue(()=>this.dispatchSessionCall(c,e.method,i));return d=!0,g}finally{F.info("session call done",{agentId:c.agentId,method:e.method,durationMs:Date.now()-f,ok:d})}}async dispatchSessionCall(e,i,o){e.lastActiveAt=Date.now();let{stripped:c}=Us(o);switch(i){case"session/new":{let x=Uc();return F.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:x}),{sessionId:x}}case"session/load":{let x=c;return F.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:x.sessionId}),{}}case"session/prompt":{let x=c,f=x.sessionId;if(!f)throw new E("IPC_BAD_REQUEST","session/prompt: missing sessionId");let d=await this.ensureRuntime(e,f);if(d.replySeq=0,await this.ensureDownstream(e,f,d),!d.downstream||!d.acpSessionId)throw new E("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let g=o._meta?.cozeTriggerMsgId;g?e.activeTriggers.set(d.acpSessionId,g):e.activeTriggers.delete(d.acpSessionId);try{let w=await d.downstream.sessionPrompt({...x,sessionId:d.acpSessionId});return d.lastActiveAt=Date.now(),w}finally{e.activeTriggers.delete(d.acpSessionId),d.downstream?.isAlive()&&this.armIdleTimer(e,f,d)}}case"session/cancel":{let f=c.sessionId;if(!f)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let d=e.sessions.get(f);return d?.downstream?.isAlive()&&d.acpSessionId&&await d.downstream.sessionCancel({sessionId:d.acpSessionId}),{ok:!0}}default:throw new E("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}async ensureRuntime(e,i){let o=e.sessions.get(i);if(o)return o;let x={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,x),await this.persistSessionMapping(e),x}async requestSessionToken(e,i){let o={sessionId:i,_meta:{cozeAgentId:e}};try{let c=await this.sendRequest(Se.GEN_MODEL_TOKEN,o,Fc);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,o){if(Rt(o),o.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,o.modelToken,i,this.currentCozeEnv);if(o.downstream=c,this.attachRuntimeHooks(e,i,o),o.acpSessionId){o.loadingSession=!0;try{await c.sessionLoad({sessionId:o.acpSessionId,cwd:e.workspace}),F.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:o.acpSessionId})}catch(x){F.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:o.acpSessionId,err:String(x)}),o.acpSessionId=void 0;let f=await c.sessionNew({cwd:e.workspace});o.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}finally{o.loadingSession=!1}}else{let x=await c.sessionNew({cwd:e.workspace});o.acpSessionId=x.sessionId,await this.persistSessionMapping(e)}c.afterSessionEstablished&&o.acpSessionId&&await c.afterSessionEstablished(o.acpSessionId)}armIdleTimer(e,i,o){if(Rt(o),this.isRuntimeBusy(e,o)){F.debug("skip idle timer: runtime busy (in-flight turn / pending permission)",{agentId:e.agentId,cloudId:i});return}o.idleTimer=setTimeout(()=>{if(o.idleTimer=void 0,this.isRuntimeBusy(e,o)){F.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:i}),this.armIdleTimer(e,i,o);return}F.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let c=o.downstream;o.downstream=void 0,o.acpSessionId&&e.activeTriggers.delete(o.acpSessionId),c&&c.stop("idle timeout").catch(x=>F.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(x)}))},this.sessionIdleTimeoutMs),o.idleTimer.unref?.()}isRuntimeBusy(e,i){if(i.acpSessionId&&e.activeTriggers.has(i.acpSessionId))return!0;let o=i.downstream;if(!o)return!1;for(let c of this.pendingUpstream.values())if(c.downstream===o)return!0;return!1}forwardUpdate(e,i){let o=i.sessionId,c=this.reverseSessionId(e,o);if(!c){F.debug("drop update for unknown session",{agentId:e.agentId,acpId:o});return}let x=e.sessions.get(c);if(!x){F.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:c});return}let f={cozeAgentId:e.agentId,cozeReplySeqID:++x.replySeq},d=e.activeTriggers.get(o);d&&(f.cozeTriggerMsgId=d),this.upstream.send(hn("session/update",{...i,sessionId:c,_meta:f})).catch(g=>F.warn("forward update failed",{agentId:e.agentId,err:String(g)}))}handleAgentRequest(e,i,o){if(o.method==="session/request_permission"){this.forwardPermissionRequest(e,i,o);return}F.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:o.method}),i.respondAgentRequestError(o.id,{code:W.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${o.method}`})}forwardPermissionRequest(e,i,o){let c=this.upstreamIds.next("session/request_permission"),x=o.params??{},d=x.sessionId,g=d?e.activeTriggers.get(d):void 0,w={cozeAgentId:e.agentId};g&&(w.cozeTriggerMsgId=g);let b=d?this.reverseSessionId(e,d):void 0,y={...x,...b?{sessionId:b}:{},_meta:w};this.pendingUpstream.set(c,{agentRequestId:o.id,agentId:e.agentId,downstream:i,method:o.method}),this.upstream.send(Tt(c,"session/request_permission",y)).catch(C=>{this.pendingUpstream.delete(c),F.error("forward permission request failed",{agentId:e.agentId,err:String(C)}),i.respondAgentRequestError(o.id,{code:W.INTERNAL_ERROR,message:`upstream send failed: ${String(C)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),e.error?i.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.downstream.respondAgentRequest(i.agentRequestId,e.result);return}let o=this.pendingBridge.get(e.id);if(o){this.pendingBridge.delete(e.id),clearTimeout(o.timer),e.error?o.reject(new gn(e.error)):o.resolve(e.result);return}F.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,o=qc){let c=this.upstreamIds.next(e);return new Promise((x,f)=>{let d=setTimeout(()=>{this.pendingBridge.delete(c),f(new E("AGENT_TIMEOUT",`${e} timed out after ${o}ms`))},o);this.pendingBridge.set(c,{method:e,resolve:x,reject:f,timer:d}),this.upstream.send(Tt(c,e,i)).catch(g=>{let w=this.pendingBridge.get(c);w&&(clearTimeout(w.timer),this.pendingBridge.delete(c)),f(g)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[o,c]of e.sessions){let x={modelToken:c.modelToken,tokenGeneratedAt:c.tokenGeneratedAt};c.acpSessionId&&(x.acpSessionId=c.acpSessionId),i.set(o,x)}await yr(e.agentId,i,this.paths)}catch(i){F.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[o,c]of e.sessions.entries())if(c.acpSessionId===i)return o}sendError(e,i,o){return this.upstream.send(Xe(e,{code:i,message:o}))}};function Uc(){return zc(16).toString("hex")}U();xe();import{randomBytes as Hc}from"node:crypto";import{chmod as Kc,mkdir as Gc,writeFile as ki}from"node:fs/promises";import{createServer as Wc}from"node:http";import{dirname as jc}from"node:path";var Jc=1e6,kr=L("ipc"),kn=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??G()}async start(){this.token=Hc(32).toString("hex");let e=Wc((o,c)=>{this.dispatch(o,c)});this.server=e,await new Promise((o,c)=>{e.once("error",c),e.listen(0,"127.0.0.1",()=>o())});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,o)=>{e.close(c=>c?o(c):i())}),this.server=null)}async persistAuthFiles(){await Gc(jc(this.paths.portFile),{recursive:!0}),await ki(this.paths.portFile,String(this.port),"utf8"),await ki(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await Kc(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}`){Bt(i,401,{error:"unauthorized"});return}let c=`${e.method} ${(e.url??"").split("?")[0]}`,x=this.routes.get(c);if(!x){Bt(i,404,{error:"not found"});return}let f=null;if(e.method==="POST")try{f=await Vc(e)}catch(d){Bt(i,400,{error:"invalid json",detail:String(d)});return}try{let d=await x.handler(f,e);Bt(i,200,d??{ok:!0})}catch(d){kr.error("IPC handler failed",{key:c,err:String(d)}),Bt(i,500,{error:d instanceof Error?d.message:String(d)})}}};function Bt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function Vc(r){let e=[],i=0;for await(let c of r){let x=c;if(i+=x.length,i>Jc)throw new Error("body too large");e.push(x)}let o=Buffer.concat(e).toString("utf8");return o?JSON.parse(o):null}var Vo=Ie(zi(),1);var Du=Ie(No(),1),Iu=Ie(Kn(),1),Tu=Ie(gt(),1),Lu=Ie(Fr(),1),Ru=Ie(Kr(),1),Nu=Ie(Yr(),1),Ko=Ie(Jn(),1),Ou=Ie(Ho(),1);var Go=Ko.default;U();var ne=L("upstream.frontier"),jo="application/json",Jo="none",Yn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ne.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:Gs,...sn(this.opts.ppeOverride)};class i extends Go{constructor(d){super(d,Ks,{headers:e})}send(d,...g){if(qs("debug"))try{let w;typeof d=="string"?w=Buffer.from(d,"utf8"):d instanceof Buffer?w=d:d instanceof ArrayBuffer?w=new Uint8Array(d):ArrayBuffer.isView(d)?w=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):w=new Uint8Array(0);let b=Buffer.from(w.slice(0,128)).toString("hex");ne.debug("WS raw frame out",{bytes:w.byteLength,headHex:b})}catch(w){ne.warn("WS raw frame dump failed",{err:String(w)})}super.send(d,...g)}}let o=Js(this.opts.urlOverride),c={url:o,ws:i,fpID:Hs,aID:rn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:jo,force:!0},payloadEncoding:{encoding:Jo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},x=new Vo.FWS(c);x.onopen=()=>{this.opened=!0,this.openCount+=1;let f=this.openCount===1;ne.info("frontier opened",{url:o,remoteDeviceId:this.opts.handshake.deviceId,initial:f,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:f})).catch(d=>ne.warn("onConnect handler threw (ignored)",{err:String(d)}))},x.onclose=f=>{this.opened=!1,ne.info("frontier closed",{code:f.code,reason:f.reason,willReconnect:f.willReconnect})},x.onerror=f=>{ne.warn("frontier error",{code:f.code,msg:f.message})},x.onmessage=f=>this.handleMessage(f),this.fws=x,await x.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(o){ne.warn("frontier close threw (ignored)",{err:String(o)})}}}async send(e){let i=this.fws;if(!i)throw new E("UPSTREAM_DISCONNECTED","frontier upstream not started");let o=JSON.stringify(e),c=e;ne.info("frontier frame out",{method:c.method,jsonrpcId:c.id,size:o.length});try{await i.send(o,{service:33555712,method:1,payloadType:jo,payloadEncoding:Jo})}catch(x){throw new E("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(x)}`,{cause:x})}}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){ne.debug("drop non-adapter frontier frame",{service:i});return}let o=zu(e);if(!o){ne.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ne.debug("frame received but no onFrame handler",{size:o.length});return}let c;try{c=JSON.parse(o)}catch(x){ne.warn("frontier message JSON parse failed",{err:String(x),head:o.slice(0,80)});return}ne.info("frontier frame in",{logid:Mu(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:c.id}),Promise.resolve(this.handler(c)).catch(x=>ne.warn("frontier frame handler threw",{err:String(x)}))}};function Mu(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function zu(r){let e=r.message;if(e?.textPayload)return e.textPayload;let i=e?.payload;if(!i)return null;try{return Buffer.from(i).toString("utf8")}catch{return null}}U();var $r=L("upstream.switchable"),Xn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;$r.info("swap upstream",{reason:i});let o=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 $r.error("swap target start failed, reverting",{err:String(c)}),this.inner=o,c}await o.stop(i??"swapped").catch(c=>$r.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()}};U();var Qr=L("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)}};U();xe();U();xe();import{execSync as qu}from"node:child_process";import{readFileSync as Yo,unlinkSync as Fu}from"node:fs";import{mkdir as Uu,readFile as Xo,unlink as $o,writeFile as Hu}from"node:fs/promises";import{dirname as Ku}from"node:path";var Gu=L("single-instance"),$n=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&&(Gu.warn("removing stale pid file",{stalePid:e}),await $o(this.pidFile).catch(()=>{})),await Uu(Ku(this.pidFile),{recursive:!0}),await Hu(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Xo(this.pidFile,"utf8")).trim()===String(process.pid)&&await $o(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Xo(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=Yo(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=qu(`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{Yo(this.pidFile,"utf8").trim()===String(process.pid)&&Fu(this.pidFile)}catch{}})}};var B=L("daemon"),Wu="coze-bridge-daemon";async function ea(){let r=new $n({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 En(),o=i??{};_r({pid:process.pid}),B.info(i?"loaded bridge config":"initialized bridge config");try{let D=new Nt;o.frameworksCache=await D.detectAll(),B.info("refreshed frameworks_cache",{detected:Object.keys(o.frameworksCache)})}catch(D){B.warn("framework detection failed",{err:String(D)})}await Ot(o);let c=new Xn(new Wt),x=G(),f=null,d=new An({upstream:c,paths:x,bridgeConfig:o,sessionSpawner:async(D,q,j,Z)=>{if(!f)throw new Error("agentManager not ready");return f.spawnSessionDownstream(D,q,j,Z)}});await Ju(x,d);let g=new Cn({paths:x,config:o,registry:d});f=g;let w,b,y=null,C=null;d.registerExtension("_agent/create",async D=>g.createAgent(D.params)),d.registerExtension("_agent/health",async()=>({ok:!0}));let P={},I=new cn({agents:d.agents,disposeAndMarkDisconnected:async(D,q)=>{let j=d.agents.get(D);j&&(await g.cleanupOpenclawSessionProviders(j).catch(Z=>B.warn("cleanup openclaw providers failed (ignored)",{agentId:D,err:String(Z)})),await j.dispose(`disconnect: ${q}`).catch(Z=>B.warn("dispose during disconnect failed (ignored)",{agentId:D,err:String(Z)})),j.status="disconnected",d.unregister(D)),d.disconnectedAgents.add(D)},detailSyncer:async D=>{if(!P.ref)throw new Error("agent-detail-sync not initialized yet");await P.ref.syncOne(D)},openclawRepair:async(D,q)=>{await g.openclawRepair(D,q)}});d.registerExtension("_agent/listSkills",D=>I.listSkills(D.params)),d.registerExtension("_agent/addSkills",D=>I.addSkills(D.params)),d.registerExtension("_agent/removeSkills",D=>I.removeSkills(D.params)),d.registerExtension("_agent/getFileTree",D=>I.getFileTree(D.params)),d.registerExtension("_agent/getFileContent",D=>I.getFileContent(D.params)),d.registerExtension("_agent/update",D=>I.updateAgent(D.params)),d.registerExtension("_agent/disconnect",D=>I.disconnectAgent(D.params)),d.registerExtension("_agent/switchModel",D=>I.switchModel(D.params)),d.registerExtension("_agent/reset",D=>I.resetAgent(D.params)),d.registerExtension("_agent/repair",D=>I.repairAgent(D.params));let T=new nn({paths:x,handlers:I,sendDetail:D=>d.sendRequest("_agent/detail",D)});P.ref=T,c.onConnect(({initial:D})=>{B.info("frontier upstream connected, triggering detail sync",{initial:D}),T.syncAll(D?"initial-connect":"reconnect").catch(q=>B.warn("detail sync top-level error (ignored)",{err:String(q)}))});let z=new kn({paths:x,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...d.agents.keys()],deviceId:y??"",frameworksCache:o.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async D=>{let q=D,j=q?.privatecode,Z=q?.pairing_code;if(!j||!Z)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let ke=on(q.env),ge=q.handshake_url,Ve=q.frontier_url,vt=ju(q.env,ge,Ve),jt=!!w&&w!==j,ye=b!==void 0&&b!==vt,be=jt||ye;if(be){B.warn("pair config switched, resetting agents",{pcChanged:jt,envChanged:ye,previousPc:w?Qo(w):"",nextPc:Qo(j),previousEnvKey:b??"",nextEnvKey:vt});for(let K of[...d.agents.values()])await K.dispose("pair config switch").catch(()=>{}),d.agents.delete(K.agentId);await c.swap(new Wt,"pair switch").catch(()=>{})}let Jt=await Ys({privatecode:j,...ge?{endpoint:ge}:{},ppeOverride:ke});y=Jt.deviceId,_r({deviceId:y,pid:process.pid});let se=new Yn({handshake:Jt,privatecode:j,...Ve?{urlOverride:Ve}:{},ppeOverride:ke});await c.swap(se,"pair");let Vt=Object.keys(o.frameworksCache??{});try{let K=await d.sendRequest("_agent/pair",{pairCode:Z,patToken:j,frameworks:Vt,_meta:{cozeDeviceId:y}});B.info("_agent/pair ok",{pairResult:K}),w=j,b=vt,C||(C=new un({core:d,getDeviceId:()=>y??""})),C.start(),be&&Zo(x,g).catch(Pe=>B.warn("post-pair-switch auto-revive error (ignored)",{err:String(Pe)}));let J;return q.agent_id&&(J=await Vu(q.agent_id,x,g,Pe=>d.sendRequest("_agent/detail",Pe)).catch(Pe=>(B.error("--agent-id ensureAgent failed",{agentId:q.agent_id,err:String(Pe)}),{ok:!1,agentId:q.agent_id??"",note:String(Pe)}))),{ok:!0,note:"paired with cloud",...J?{agent:J}:{}}}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 g.createAgent(q)}}},{method:"POST",path:"/refresh",handler:async()=>{B.info("IPC /refresh: re-detecting frameworks");let D=new Nt;return o.frameworksCache=await D.detectAll(),await Ot(o),{ok:!0,frameworks:o.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(B.info("IPC /shutdown received"),setImmediate(()=>{ae.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:re,token:Q}=await z.start();await d.start(),Zo(x,g).catch(D=>B.warn("auto-revive top-level error (ignored)",{err:String(D)}));let _e=null,ae={port:re,token:Q,core:d,ipc:z,shutdown(D){return _e||(B.info("daemon shutdown",{reason:D}),_e=(async()=>{C?.stop(),await d.stop(D),await z.stop(),await r.release()})(),_e)}};for(let D of["SIGTERM","SIGINT"])process.on(D,()=>{ae.shutdown(D).then(()=>process.exit(0))});return B.info("daemon ready",{port:re,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(o.frameworksCache??{}),libVersion:o.libVersion??"dev"}),ae}function Qo(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function ju(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function Ju(r,e){let{readdir:i}=await import("node:fs/promises"),o;try{o=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:c,enforceAgentConfigMode:x}=await Promise.resolve().then(()=>(Ue(),tn));for(let f of o){await x(f,r).catch(d=>B.warn("enforceAgentConfigMode failed (ignored)",{agentId:f,err:String(d)}));try{let d=await c(f,r);d?.disconnectedAt&&(e.disconnectedAgents.add(f),B.info("agent marked disconnected on startup",{agentId:f,disconnectedAt:d.disconnectedAt,reason:d.disconnectReason??""}))}catch(d){B.warn("failed to load agent config on startup, skipping",{agentId:f,err:String(d)})}}}async function Vu(r,e,i,o){let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Ue(),tn)),x=await c(r,e);if(x){B.info("--agent-id: local config found, reconnecting",{agentId:r,framework:x.framework,hadDisconnect:!!x.disconnectedAt});let w={agentId:x.agentId,framework:x.framework,...x.cozeIdentity?{cozeIdentity:x.cozeIdentity}:{},...x.model?{model:x.model}:{}};return await i.createAgent(w),{ok:!0,agentId:r,note:x.disconnectedAt?"revived from local config":"connected from local config"}}B.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let f=await o({_meta:{cozeAgentId:r}});if(!f.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 d={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{},...f.deployType?{_meta:{cozeDeployType:f.deployType}}:{}};await i.createAgent(d);let g=f.deployType==="cloud"&&f.framework==="openclaw";return{ok:!0,agentId:r,note:g?"cloud agent acknowledged":"created from cloud detail"}}async function Zo(r,e){let{readdir:i}=await import("node:fs/promises"),o;try{o=await i(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(o.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Ue(),tn));B.info("auto-revive: scanning local agents on startup",{count:o.length});let x=0,f=0;for(let d of o){let g;try{g=await c(d,r)}catch(w){B.warn("auto-revive: load config failed (skipping)",{agentId:d,err:String(w)}),f+=1;continue}if(!g){f+=1;continue}if(g.disconnectedAt){B.info("auto-revive: skip disconnected agent",{agentId:d,disconnectedAt:g.disconnectedAt}),f+=1;continue}try{B.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:d,framework:g.framework}),await e.createAgent({agentId:g.agentId,framework:g.framework,...g.cozeIdentity?{cozeIdentity:g.cozeIdentity}:{},...g.model?{model:g.model}:{},...g.deployType?{_meta:{cozeDeployType:g.deployType}}:{}}),x+=1}catch(w){B.warn("auto-revive: createAgent failed (skipping)",{agentId:d,framework:g.framework,err:String(w)}),f+=1}}return B.info("auto-revive: done",{revived:x,skipped:f,total:o.length}),{revived:x,skipped:f,total:o.length}}es();xe();import{readFile as na}from"node:fs/promises";var Je=class{paths;constructor(e){this.paths=e??G()}async probe(e=1e3){let i=await this.readAuth();if(!i)return{kind:"not-running"};try{let o=await this.fetch(i,{method:"GET",path:"/status",timeoutMs:e});return o.status===200?{kind:"connected",...i}:{kind:"stale",reason:`unexpected status ${o.status}`}}catch(o){return{kind:"stale",reason:rf(o)}}}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([na(this.paths.portFile,"utf8"),na(this.paths.tokenFile,"utf8")]),o=Number.parseInt(e.trim(),10),c=i.trim();return!Number.isFinite(o)||o<=0||!c?null:{port:o,token:c}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let o=i.body!==void 0,c={Authorization:`Bearer ${e.token}`};o&&(c["content-type"]="application/json");let x=new AbortController,f=setTimeout(()=>x.abort(),i.timeoutMs??5e3);try{let d=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:c,body:o?JSON.stringify(i.body):void 0,signal:x.signal}),g=await d.text();return{status:d.status,body:nf(g)}}finally{clearTimeout(f)}}};function nf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function rf(r){return r instanceof Error?r.message:String(r)}U();xe();import{copyFile as ra,mkdir as sf,readFile as ts,writeFile as of}from"node:fs/promises";import{dirname as af,resolve as ns,sep as Qn}from"node:path";import{fileURLToPath as cf}from"node:url";U();xe();var sa=L("dist-install");function xf(r){let e=cf(r),i=af(e),o=`${Qn}src${Qn}`;if(i.includes(o)||i.endsWith(`${Qn}src${Qn}cli`))return null;let c=ns(i,"index.js"),x=ns(i,"..","package.json");return{dist:c,pkgJson:x}}async function ia(r={}){let e=r.paths??G(),i=xf(import.meta.url),o=r.sourceDist??i?.dist,c=r.sourcePackageJson??i?.pkgJson;if(!o||!c)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let x;try{x=JSON.parse(await ts(c,"utf8")).version??"unknown"}catch(y){return sa.warn("cannot read source package.json,skip dist install",{err:String(y)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(y)}`}}let f=await En(e.configFile)??{},d=f.libVersion;if(d===x)try{return await ts(e.libEntry),{kind:"already-current",libVersion:x}}catch{}await sf(e.libDir,{recursive:!0}),await ra(o,e.libEntry),await ra(`${o}.map`,`${e.libEntry}.map`).catch(()=>{});let g=ns(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
94
+ `;return await ts(g,"utf8").catch(()=>null)!==w&&await of(g,w),f.libVersion=x,await Ot(f,e.configFile),sa.info("dist installed",{libEntry:e.libEntry,fromVersion:d,toVersion:x}),d?{kind:"version-changed",fromVersion:d,toVersion:x,libEntry:e.libEntry}:{kind:"first-install",libVersion:x,libEntry:e.libEntry}}var Pf=L("cli");function bt(r,e){let i=[],o;for(let c=0;c<r.length;c++){let x=r[c];if(x===e){o=r[c+1],c+=1;continue}if(x.startsWith(`${e}=`)){o=x.slice(e.length+1);continue}i.push(x)}return{value:o,rest:i}}function Df(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:o,rest:c}=bt(i,"--pat-token");i=c;let{value:x,rest:f}=bt(i,"--pair-code");i=f;let{value:d,rest:g}=bt(i,"--env");i=g;let{value:w,rest:b}=bt(i,"--handshake-url");i=b;let{value:y,rest:C}=bt(i,"--frontier-url");i=C;let{value:P}=bt(i,"--agent-id");if(!o||!x)return{mode:"help"};let I={mode:"pair",privatecode:o,pairingCode:x};return d&&(I.env=d),w&&(I.handshakeUrl=w),y&&(I.frontierUrl=y),P&&(I.agentId=P),I}var If=`
94
95
  coze-bridge - local bridge daemon for cloud Agent Service
95
96
 
96
97
  Usage:
@@ -117,35 +118,35 @@ Auto-connect agent (optional):
117
118
 
118
119
  Internal:
119
120
  <node> <entry> --daemon daemon mode (OS supervisor only)
120
- `.trimStart();async function i0(r=process.argv,e={}){let i=lu(r);switch(i.mode){case"help":return process.stdout.write(hu),0;case"daemon":{try{await Vo()}catch(a){return du.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return gu(e);case"stop":return pu(e);case"refresh":return mu(e);case"uninstall":return _u(e);case"install-service":return wu();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),yu(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function o0(r){let{unlink:e}=await import("node:fs/promises");await Promise.all([e(r.pidFile).catch(()=>{}),e(r.portFile).catch(()=>{}),e(r.tokenFile).catch(()=>{})])}async function gu(r){let e=r.paths??V(),i=new Ye(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
121
- `),1;if(a.kind==="stale")return await o0(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
122
- `),1;let x=await i.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
123
- ${JSON.stringify(x.body,null,2)}
124
- `),0}async function pu(r){let e=r.paths??V(),i=new Ye(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
125
- `),0;if(a.kind==="stale")return await o0(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
121
+ `.trimStart();async function fa(r=process.argv,e={}){let i=Df(r);switch(i.mode){case"help":return process.stdout.write(If),0;case"daemon":{try{await ea()}catch(o){return Pf.error("daemon start failed",{err:String(o)}),1}return new Promise(()=>{})}case"status":return Tf(e);case"stop":return Lf(e);case"refresh":return Rf(e);case"uninstall":return Nf(e);case"install-service":return Of();case"pair":{let o={};return i.env&&(o.env=i.env),i.handshakeUrl&&(o.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(o.frontierUrl=i.frontierUrl),Bf(i.privatecode,i.pairingCode,e,o,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 Tf(r){let e=r.paths??G(),i=new Je(e),o=await i.probe();if(o.kind==="not-running")return process.stdout.write(`coze-bridge: not running
122
+ `),1;if(o.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 Lf(r){let e=r.paths??G(),i=new Je(e),o=await i.probe();if(o.kind==="not-running")return process.stdout.write(`coze-bridge: not running
126
+ `),0;if(o.kind==="stale")return await da(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
126
127
  `),0;try{return await i.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
127
- `),0}catch(x){return process.stdout.write(`coze-bridge: stop failed: ${String(x)}
128
- `),1}}async function mu(r){let e=new Ye(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
129
- `),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
130
- ${JSON.stringify(a.body,null,2)}
131
- `),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
132
- `),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
133
- `),1}}async function _u(r){let e=new Ye(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
134
- `);try{await e.request({method:"POST",path:"/shutdown"})}catch(f){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(f)}
135
- `)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:l}=await Promise.resolve().then(()=>(xs(),as)),h=f();await h.uninstall(l()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
136
- `)}catch(f){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(f)}
137
- `)}let a=r.paths??V(),{rm:x}=await import("node:fs/promises");try{await x(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
138
- `)}catch(f){return process.stderr.write(`coze-bridge: remove failed: ${String(f)}
128
+ `),0}catch(c){return process.stdout.write(`coze-bridge: stop failed: ${String(c)}
129
+ `),1}}async function Rf(r){let e=new Je(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
130
+ `),1;try{let o=await e.request({method:"POST",path:"/refresh"});return o.status===200?(process.stdout.write(`coze-bridge: refreshed
131
+ ${JSON.stringify(o.body,null,2)}
132
+ `),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(o.body)}
133
+ `),1)}catch(o){return process.stderr.write(`coze-bridge: refresh failed: ${String(o)}
134
+ `),1}}async function Nf(r){let e=new Je(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(x){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(x)}
136
+ `)}await new Promise(x=>setTimeout(x,500))}if(!r.skipSupervisor)try{let{getSupervisor:x,buildContext:f}=await Promise.resolve().then(()=>(xs(),cs)),d=x();await d.uninstall(f()),process.stdout.write(`coze-bridge: ${d.platform} supervisor unregistered
137
+ `)}catch(x){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(x)}
138
+ `)}let o=r.paths??G(),{rm:c}=await import("node:fs/promises");try{await c(o.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${o.cozeRoot}
139
+ `)}catch(x){return process.stderr.write(`coze-bridge: remove failed: ${String(x)}
139
140
  `),1}return process.stdout.write(`coze-bridge: uninstalled
140
- `),0}async function wu(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(xs(),as)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
141
- `),await i.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
141
+ `),0}async function Of(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(xs(),cs)),i=r(),o=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
142
+ `),await i.install(o),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
142
143
  `),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
143
- `),1}}async function yu(r,e,i,a={},x){let f=new Ye(i.paths),l=i.spawnDaemon??Xo;if(!i.skipDistInstall){let y=await Qo({paths:i.paths});y.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${y.fromVersion} \u2192 ${y.toVersion}
144
- `),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(b=>setTimeout(b,500)))):y.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${y.libVersion}
145
- `)}let h=await f.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
146
- `),await l({paths:i.paths}),h=await bu(f,i.waitTimeoutMs??1e4,i.sleep??vu),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
147
- `),1;let m={privatecode:r,pairing_code:e};a.env&&(m.env=a.env),a.handshakeUrl&&(m.handshake_url=a.handshakeUrl),a.frontierUrl&&(m.frontier_url=a.frontierUrl),x&&(m.agent_id=x);try{let y=await f.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return y.status===200&&y.body?.ok?(process.stdout.write(`coze-bridge: paired (${y.body.note??"ok"})
148
- `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(y.body)}
149
- `),1)}catch(y){return process.stderr.write(`coze-bridge: pair failed: ${String(y)}
150
- `),1}}async function bu(r,e,i){let a=Date.now()+e;for(;Date.now()<a;){let x=await r.probe(500);if(x.kind==="connected")return x;await i(200)}return r.probe(500)}function vu(r){return new Promise(e=>setTimeout(e,r))}i0(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
144
+ `),1}}async function Bf(r,e,i,o={},c){let x=new Je(i.paths),f=i.spawnDaemon??ta;if(!i.skipDistInstall){let w=await ia({paths:i.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
145
+ `),(await x.probe()).kind==="connected"&&(await x.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 d=await x.probe();if(d.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
147
+ `),await f({paths:i.paths}),d=await Mf(x,i.waitTimeoutMs??1e4,i.sleep??zf),d.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${d.kind}
148
+ `),1;let g={privatecode:r,pairing_code:e};o.env&&(g.env=o.env),o.handshakeUrl&&(g.handshake_url=o.handshakeUrl),o.frontierUrl&&(g.frontier_url=o.frontierUrl),c&&(g.agent_id=c);try{let w=await x.request({method:"POST",path:"/pair",body:g,timeoutMs:35e3});return w.status===200&&w.body?.ok?(process.stdout.write(`coze-bridge: paired (${w.body.note??"ok"})
149
+ `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(w.body)}
150
+ `),1)}catch(w){return process.stderr.write(`coze-bridge: pair failed: ${String(w)}
151
+ `),1}}async function Mf(r,e,i){let o=Date.now()+e;for(;Date.now()<o;){let c=await r.probe(500);if(c.kind==="connected")return c;await i(200)}return r.probe(500)}function zf(r){return new Promise(e=>setTimeout(e,r))}fa(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
151
152
  `),process.exit(1)});