coze-bridge 0.1.11 → 0.1.13

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 +37 -37
  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 Fa=Object.create;var ir=Object.defineProperty;var Ua=Object.getOwnPropertyDescriptor;var Ha=Object.getOwnPropertyNames;var Ka=Object.getPrototypeOf,Ga=Object.prototype.hasOwnProperty;var J=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var ke=(r,e)=>()=>(r&&(e=r(r=0)),e);var ie=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),_s=(r,e)=>{for(var i in e)ir(r,i,{get:e[i],enumerable:!0})},Wa=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of Ha(e))!Ga.call(r,x)&&x!==i&&ir(r,x,{get:()=>e[x],enumerable:!(a=Ua(e,x))||a.enumerable});return r};var Ie=(r,e,i)=>(i=r!=null?Fa(Ka(r)):{},Wa(e||!r||!r.__esModule?ir(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as ja,mkdir as Ja,readFile as Va,rename as ws,writeFile as ys}from"node:fs/promises";import{dirname as Ya}from"node:path";async function Ft(r){try{let e=await Va(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Ut(r,e,i){await Ja(Ya(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 ys(x,a,{encoding:"utf8",mode:i.mode}):await ys(x,a,"utf8"),await ws(x,r),i?.mode!==void 0&&await ja(r,i.mode)}catch(f){await ws(x,x).catch(()=>{});let{rm:d}=await import("node:fs/promises");throw await d(x,{force:!0}).catch(()=>{}),f}}var or=ke(()=>{"use strict"});function Ss(r){return Kt[bs]<=Kt[r]}function ar(r){vs={...r}}function Ht(r,e,i,a){if(Kt[r]<Kt[bs])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...vs,...a});r==="error"||r==="warn"?$a.write(`${x}
10
- `):Xa.write(`${x}
11
- `)}function R(r){return{debug:(e,i)=>Ht("debug",r,e,i),info:(e,i)=>Ht("info",r,e,i),warn:(e,i)=>Ht("warn",r,e,i),error:(e,i)=>Ht("error",r,e,i),child:e=>R(`${r}.${e}`)}}var Kt,bs,Xa,$a,vs,K=ke(()=>{"use strict";Kt={debug:10,info:20,warn:30,error:40},bs=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),Xa=process.stdout,$a=process.stderr,vs={}});import{homedir as Za}from"node:os";import{join as te}from"node:path";function G(r){let e=r??Za(),i=te(e,".coze"),a=te(i,"bridge"),x=te(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:x,libEntry:te(x,"index.js"),pidFile:te(a,"bridge.pid"),portFile:te(a,"bridge.port"),tokenFile:te(a,"bridge.token"),logFile:te(a,"bridge.log"),installLock:te(a,"install.lock"),configFile:te(a,"config.json"),agentsRoot:te(i,"agents")}}function Pe(r,e=G()){let i=te(e.agentsRoot,r);return{root:i,config:te(i,"config.json"),workspace:te(i,"workspace"),logs:te(i,"logs")}}var oe=ke(()=>{"use strict"});var jt={};_s(jt,{AGENT_CONFIG_FILE_MODE:()=>Gt,enforceAgentConfigMode:()=>t0,loadAgentConfig:()=>ce,persistAgentSessions:()=>xr,persistAgentSkills:()=>Wt,saveAgentConfig:()=>ge});import{chmod as Qa,stat as e0}from"node:fs/promises";function ce(r,e){return Ft(Pe(r,e).config)}function ge(r,e){return Ut(Pe(r.agentId,e).config,r,{mode:Gt})}async function t0(r,e){if(process.platform==="win32")return;let i=Pe(r,e).config;try{let a=await e0(i);if(!a.isFile())return;let x=a.mode&511;x!==Gt&&(await Qa(i,Gt),Es.warn("agent config mode auto-corrected to 0600",{path:i,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;Es.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function xr(r,e,i){let a=await ce(r,i);a&&(a.sessions=Object.fromEntries(e),await ge(a,i))}async function Wt(r,e,i){let a=await ce(r,i);a&&(a.skills=e,await ge(a,i))}var Es,Gt,qe=ke(()=>{"use strict";or();K();oe();Es=R("agent-config"),Gt=384});var ci=ie(X=>{"use strict";var E=P;(function(r,e){let i=P,a=r();for(;;)try{if(parseInt(i(1425))/1*(-parseInt(i(843))/2)+-parseInt(i(1539))/3*(parseInt(i(870))/4)+parseInt(i(1585))/5+-parseInt(i(604))/6+parseInt(i(227))/7+-parseInt(i(1376))/8*(parseInt(i(700))/9)+-parseInt(i(1e3))/10*(-parseInt(i(858))/11)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(gn,971102);function P(r,e){r=r-182;let i=gn(),a=i[r];if(P.pibxMA===void 0){var x=function(m){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",v="",y="";for(let I=0,T,N,O=0;N=m.charAt(O++);~N&&(T=I%4?T*64+N:N,I++%4)?v+=String.fromCharCode(255&T>>(-2*I&6)):0)N=w.indexOf(N);for(let I=0,T=v.length;I<T;I++)y+="%"+("00"+v.charCodeAt(I).toString(16)).slice(-2);return decodeURIComponent(y)};P.qezRjX=x,P.ddOrNq={},P.pibxMA=!0}let f=i[0],d=r+f,h=P.ddOrNq[d];return h?a=h:(a=P.qezRjX(a),P.ddOrNq[d]=a),a}var gx=Object[E(1409)+E(757)],px=Object["getOwnPr"+E(663)+E(261)],si=(r,e)=>function(){return r&&(e=(0,r[{ZexgX:function(f,d){return f(d)}}[E(242)](px,r)[0]])(r=0)),e},mx=(r,e)=>{let i=E,a={rHhOA:function(f,d,h,m){return f(d,h,m)}};for(var x in e)a[i(1546)](gx,r,x,{get:e[x],enumerable:!0})};function _x(){return Qs||(Qs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function yx(){let r=E;return ei||(ei=[IDBCursor.prototype[r(1360)],IDBCursor[r(1031)+"e"].continue,IDBCursor[r(1031)+"e"][r(1618)+r(282)+"ey"]])}function bx(r){let e=E,i={jObvH:function(x){return x()},MIHWN:e(1595),yUcsu:e(1103),gyTfH:e(1145),wtIJG:function(x,f){return x(f)},vxBHE:function(x){return x()},CXLoi:function(x,f,d){return x(f,d)},TUNHl:e(303)+"ame",wZYsa:e(1047)},a=new Promise((x,f)=>{let d=e,h={IaBLM:i[d(1253)],PbHfT:function(y,I){return y!==I},mRmVI:i.yUcsu,SJNmP:i[d(273)],OZcFu:function(y,I){return i.wtIJG(y,I)},oDkKL:function(y){return i[d(1278)](y)}},m=()=>{let y=d;h[y(304)]("OPeox",y(1388))?(r[y(544)+"entListener"](h[y(1162)],w),r["removeEv"+y(1175)+y(1335)](h[y(1056)],v)):(this[y(1096)+"Queue"][y(361)](_0x2f271a),this._debug(h[y(1625)],_0x2e92be))},w=()=>{h[d(681)](x,h.OZcFu(Ee,r.result)),h.oDkKL(m)},v=()=>{let y=d;f(r[y(1145)]),i[y(1312)](m)};r["addEvent"+d(1679)](i[d(1342)],w),r["addEvent"+d(1679)](i[d(273)],v)});return a[e(1026)](x=>{let f=e;x instanceof IDBCursor&&(f(1047)!==i.wZYsa?(this[f(1676)+f(1517)]=_0x30af5c,this[f(465)+f(450)]=_0x2e6429,this["_message"+f(715)]=_0x2e06cb,this._qosDB=i.CXLoi(_0x498b6f,this[f(1676)+f(1517)],i[f(1055)])):lr.set(x,r))})[e(981)](()=>{}),mn.set(a,r),a}function vx(r){let e=E,i={eLqhi:function(x){return x()},qXqyx:function(x){return x()},twPzd:e(1215),QJhvz:e(1145),CYeuJ:function(x,f){return x(f)},yLZFK:e(1336)+"or",WetWU:e(932)};if(pn[e(257)](r))return;let a=new Promise((x,f)=>{let d=e,h={HHCFz:i[d(990)],ICZNu:i[d(1608)],XSLdR:function(y,I){return i[d(1284)](y,I)},piBZh:i[d(1306)],wFBZX:function(y){return y()}},m=()=>{let y=d;r[y(544)+y(1175)+y(1335)](h[y(650)],w),r[y(544)+y(1175)+"ner"](h[y(492)],v),r[y(544)+y(1175)+"ner"]("abort",v)},w=()=>{i[d(1541)](x),i.qXqyx(m)},v=()=>{let y=d;h[y(1448)](f,r[y(1145)]||new DOMException(h.piBZh,y(1336)+"or")),h.wFBZX(m)};r["addEvent"+d(1679)]("complete",w),r[d(252)+d(1679)](i[d(1608)],v),r[d(252)+d(1679)](i[d(1397)],v)});pn[e(454)](r,a)}function Sx(r){_n={kggcX:function(a,x){return a(x)}}[E(576)](r,_n)}function Ex(r){let e=E,i={zFPNA:function(a,x){return a(x)},DdFWd:function(a,x){return a(x)},DGRLv:function(a,x){return a(x)},baMgM:function(a,x){return a in x},MMSCq:function(a){return a()}};return r===IDBDatabase[e(1031)+"e"][e(655)+"ion"]&&!i[e(1045)](e(1484)+e(1302),IDBTransaction[e(1031)+"e"])?function(a,...x){let f=e,d=r[f(988)](i.zFPNA(It,this),a,...x);return dr[f(454)](d,a[f(248)]?a[f(248)]():[a]),i[f(1273)](Ee,d)}:i[e(901)](yx)[e(1354)](r)?function(...a){let x=e;return r.apply(i[x(1202)](It,this),a),i[x(1202)](Ee,lr[x(1525)](this))}:function(...a){return Ee(r.apply(It(this),a))}}function Cx(r){let e=E,i={tEteC:e(1303),bipdq:function(a,x){return a(x)},tboZR:function(a,x,f){return a(x,f)},UCMxY:function(a){return a()}};return typeof r===i[e(349)]?i[e(1326)](Ex,r):(r instanceof IDBTransaction&&i[e(1326)](vx,r),i.tboZR(ii,r,i[e(417)](_x))?new Proxy(r,_n):r)}function Ee(r){let e=E,i={wrtsA:function(x,f){return x(f)},LjnMX:function(x,f){return x(f)},nXvRO:function(x,f){return x!==f}};if(r instanceof IDBRequest)return i[e(651)](bx,r);if(ln[e(257)](r))return ln.get(r);let a=i.LjnMX(Cx,r);return i[e(440)](a,r)&&(ln[e(454)](r,a),mn.set(a,r)),a}function gn(){let r=["x3DHAxq","ueDHy20","zMzLCG","uNbTzge","ywXPzcb1CMW","x2rPC3bHDgm","ywrIvM8","A2HLEey","sKfgwue","svbhCvu","u09HvMm","y3vYDMfSDwu","z2v0qwXSs2u","pxv0zI04","Aw5PDcbrB1m","CgfNzxnOB3C","ywnRx2LK","x2LZtwLUAvC","vvHkwLu","Dhr3Awq","Dg9cExrLC0i","z2DrqNO","uvvfBLa","D3jkBwu","uK91u3C","q3vZDg9Tq2W","zePTEfa","wfzRDMW","zezIr3y","B2jQzwn0u3q","DhvVrhm","wwX0DuS","CMvZzxrdB3u","ANj0r0K","uK55AwO","BurQu2W","y29SBM8","rgvKAwnHDgu","q2jbDKq","u25wswi","C0jf","v3nQtuG","Agz0Ava","CMvTB3zLq2G","y29UBMvJDeu","A01tDhu","A1n0yxr1C0m","x2LZv29YA2u","yM9wqLK","CgLUz19VBMm","uMvJB25Uzwm","CMvZzxrfBMq","DfHtufq","BNzvqLC","AxnmB25N","rvvpCKS","yxv0BW","zMX1C2HfEha","Aw9UvgLTzw8","CwvHD1m","CMzysg0","EwPTsvC","yw1Lu3bHy2u","whrwvwq","A0TPr08","q3HdqMC","AgLNAa","vxzPs0C","wxfvAwO","yw94Avy","z2v0","zgvS","D3b1q1K","B1ngCMq","zxHmyLC","y2HLy2TdDxi","D24GCMvHC28","BNHVD00","B3jRig9MzMW","zgXPD0S","BwvY","yvjSDeq","DhbizwfKzxi","B25Uzwn0Aw4","nJzzrvjbBK8","ihrPBwvZ","zuXXAgK","D1v5EeW","DhjPzxmGCMu","AeXPDuK","DKDjD3O","CKHOt0e","uvn3uwq","ufb1rNO","DgvmB2Djre4","v3rHzfm","zu5gDwO","DuP0DK0","y0zorgS","yxrLq291BNq","sePUqu4","mNWWFdf8nxW","AM5bsey","B25mAw5L","C2zJy2u","wwnODNq","x2nSzwfYvgK","ywDL","teLQrvu","weL1EgK","B25VCgvU","wgLbuKm","B3bLBG","ufHUtwi","y2vZC0HHBMq","tgnpwg0","B2nRzxrtDwm","uwjcAve","CM92AwrLigi","x3nVy2TLDa","DMfSDwu","zgvSzxrL","y3jLyxrLrxi","v0D6swS","BvDTueG","wwrtqwi","AML5vK4","y2XLyxi","B3bvqNK","Aur0sNC","nZa0mJC3nwzdvLDKEa","t1Dzq2m","BwvZC2fNzv8","C29Tzq","tgjztuy","zxjlzgi","DhPhyM4","uLf6wwO","lcbOB3n0BMe","t0vVyw0","zw5XDwv1zq","BxnNsuq","vxjREgq","s1L3ywi","zNDZxZeUmc4","z2vY","x2vUzhbVAw4","BhvPseu","wKLdqxG","Ae9Wzw5fDMu","AhvJqvi","y29Uy2f0","rvjst1i","uuPODNO","uK5mzfi","vw1pDgK","v3rXyxC","C2XPy2u","wvHbvgK","Dgv4DfbHEwW","sND3u0q","yMXVy2TLza","u1fWuwm","y29UDgLUDwu","BfrPBwvVDxq","shvoCMC","yNvMzMvY","Dg9oDw1Izxi","uevXCuS","B25LCNjVCG","swfcte0","AvnswuC","yLbdELy","C1jHrLm","CMzHuwW","x2nSzwfYugK","CYbWyxjHBxm","BhPqCMO","zM5QqMG","Cwvos2u","EvP4EvG","B2fK","B213v3O","t2H6tNO","rg5gy0q","A2v5","Cgf5Bg9Hza","DMvUDa","u1r0rKq","zvDfCeO","C3rLBMvYCW","oxW1Fdz8ohW","DLLmtMm","wwH3zgK","zwrPyxrLBhK","tNzlwha","qM9jBgG","wu9VDuC","v0DmrgG","te96Deu","Dgv4Dc9WBge","AwDHDg9Yt24","ALjLy20","zhjqA1K","tuvtu0fhrv8","z29PBMCGyxC","D2LHAvO","rMv4v2y","zw1PDa","EM51te4","vw5Oyw5KBgu","Dg9cExrLC0W","DgXVyuu","B1jpDu8","v09XA04","zNjmsuC","u09juwO","wuPHAeq","C0nVDw50zxi","tLDHALa","DxfKtgu","x2n1CNnVCK4","AhPWEw0","nxW0Fdb8mxW","tgLZDgvUzxi","Dg9iyxnO","se1irhm","wevZs1y","BMCGB3iGyw4","Bwf4uMv0CMK","AxnrB1nby2S","v0PHBeq","sKfdAfK","ihzHBgLKigq","DfLHwMO","rejMELq","C3rVCMu","ywnOzwqSihC","DxjS","AxvrveS","zNjVBuHHC2G","t0nXyK0","Cg93","ihrVihjLDhi","rhjSwwe","B1L1DKq","C3jJ","qNHAEge","zKDmvM8","Dg9wuvu","ENj0wKe","v3HdCfC","AM9PBG","z2jQtMm","B3jRzxjhBg8","AKHtzg8","t2LJDuC","Evvjr0O","wKTcuuO","DeLUDgvYy2u","C2v0q3vYC28","zw5HyMXLvhi","t0zhAgq","x2DLBMvYyxq","CMLLC0nVDw4","EKn3y0O","vxbKyxrLq28","yKH4ufG","zxj2AwnL","x2LZqNjVD3m","v1zesxm","nteXmJuWnK5tu3DXsG","ufvzAeC","DgH1wgW","qvPRv1K","r0T2ve4","AgfZt3DUuhi","BKHLsNK","y2uGBM90igK","B3nLza","thDJDu0","igzHAwWSig0","mdaWmdaWmda","BMCGzMfPBgu","Eu1htfy","BM5Ly3q","wMv4z1G","ALL5B3G","Dwz0Afa","tMfiBu4","zNjVBujPDhm","x29UugfNzu4","C29YDa","EsbJBg9Zzwq","x3DZ","z25Ht2e","ywrKrxzLBNq","AefpyNm","lcbTyxGGCMu","qu94B28","ChziEwm","AgfZ","z2HVv1K","y29UBMvJDgK","y0rJzM4","BwvZ","D1fjywe","se50DwK","thPJyKC","r1v3yxG","vgLTzw91Da","rgztu3K","BNrLCG","x29UvgLTzw8","igzPzwXKoIa","zgvIDwC","wvPuELu","z3LuzKG","B3jL","sMDmvLa","s0nvr0S","qNnSuKW","zgHcuwi","yMfSrxzLBNq","r01drNC","rLvzDfe","uhjPBwfYEuS","D2fZq2XLyw4","qKHmA0e","DMTbEwy","BMXtrNO","CMfTzq","BMLtDLq","zxjFCw9Zx2e","AhrwqM0","t3bLBKv2zw4","z1rPBwvVDxq","tw9KDwXL","zgv5uLa","q291BNq","AxnAzxjV","u2vXsuq","z0rcwK8","uvHKqLi","q0fwB2y","DgvZDa","y2DeDuu","y3vYC29Yx24","ugjizLq","zM9YrwfJAa","x3fVC0rc","qxL1BMS","BezSDxnO","BMDLza","t1bftL9fuLi","quLxuxu","qxP6Chq","DLzOrue","su5tvefova","uvnzy3u","t0T3Cgy","tuLpCfC","vKjbq2q","seTpq2S","yxnJCMLWDa","y3jLyxrLq2W","vu1fzeq","zunjqKW","BMLbwhq","yxv0B21HDgK","DxnLCKLW","quHnB28","Ec1TC2CTy3u","C2vUza","s2r2y3a","rMXWwuS","yw5ZzM9YBvq","y1DWANa","u3f2quy","D3nZoI8V","Ae1LC3nHz2u","BKXPBMu","ugPeuxa","C3rYAw5N","A2v0ignVBNm","ywDLu2HVDW","rwvfqwO","vvbcsLe","zxjYtM8","CNnVCKzPBgu","t2jQzwn0","BxHkuMW","DxbNCMfKzw4","Dev0zum","ueX0vxO","sLDHrKC","rLDhDMm","CgjICdi","senAq0y","Ef9MCM9UDgK","y3jLyxrLtwu","BwvKAwf0zwW","BM9dy0u","CNzHBfzHBhu","t1zhwLq","ChvZAa","DuvjAMy","tfnezLO","CMvHzhLtDge","re1LAwq","CMvUDevUzha","ChniALO","reXqrKq","s2vAAuG","x21PBMLoyxy","CKLxD0e","t1jXr1y","CNjVCK1LC3m","yw1L","ywzL","t0TpD1K","B25dBg9Zzq","y3jLyxrLrwW","CMvXDwLYzwq","D3Dkuem","suXfsuC","Dg9tDhjPBMC","tg9srNy","zxrxB3jRq2G","oxWXmhW1Fdq","CuXKtLG","qvjmq0G","DeXztK0","BIWGAg9ZDg4","yxGGCMv0CMK","x2LZtwLUAvq","yMLUza","C3nHz2vfDMu","BLLYqKy","sLnptLa","D0jXwuW","B2vJBNC","EKrUEha","yLPhrfG","Ew9fwu0","yNL0zuXLBMC","CM9YrxzLBNq","Ee5Tzgy","EgX3yu0","AenkAwq","qu5JAxa","B05SAfe","C2v0u3rVCMe","zNjVBNrPzxi","B3bOBgy","tKDTugy","Au5XEuq","zxHWB3j0CW","l3DZl3yY","B3bLBKrc","DuncwgK","vunnEfK","AxnrB1nnzxm","t1zKt2S","zhbSDxu","CMvJB25Uzwm","x29UrxjYB3i","zhnLAgK","svjKsgC","u05os0K","CejOzLK","AenSB3nLrxy","BefKuw0","B3z1B24","zvP3vKi","r2vlyKC","yw9ZBK8","x2DLDeLUDgu","s0PKwfG","y2XVC2uSihC","s0jHtgy","AxH2sMC","t3jrsuK","B1nLtKG","BLH2uK8","BwLUzW","uxHLEum","tKDFrvjst1i","rhrhEw8","Cw9Zx18","reXMvNK","CeLIt0q","zxPvqNu","AgfUz2u","AwXLtMfTzq","B25tDgfYDfi","yMLKtvq","x2rLyNvN","C2v0","x3bPBMDqB24","Cgf5Bg9Hzfq","y3vYC29YlNm","DeL2C1m","yKzIwuO","y29UBMvJDa","A2rbzeG","B2XKvMvYC2K","x2HHBMrSzvi","o2nOyxjZzxq","x2n1CNnVCKy","CKnAB04","sLHVuhG","ENvwyNC","zxjFywnRx20","wMfMDgG","v3HIBva","BfPlvu8","BMfTzq","Bg9N","wgjmDwu","BMrWB2LUDfq","ywrK","BgvY","suXVv0S","ExHmve4","vg1YA3y","yNL0zxm","ywXSB2nvBNm","EvfKs3K","Dhj1y3rVCIa","tg9Nsuq","DNjXquG","ywnR","CgvYC2LZDgu","vLfHv2C","C3H2C0G","sunAtNu","mNWZ","vxPrDfO","x3jLy29UBMu","x3bYB3rVy28","BNnWDfe","y29UBMvJDfm","zNjHBwvuExa","y3vYC29Yx2y","y29Kzq","Egn2teK","BgzjEg4","mdaWma","rK5Nuge","mtb8oxW0Fdy","D0LTD3O","DxPwvum","AfflBu0","yNjSDKC","zxHbrxe","qKjQyxu","BgLZDgvUtMu","tg5zC0G","CMvZB2X2zq","quXPt04","Fdn8mNW1FdG","yNvMzMvYzwq","zMLN","v3fHANi","CLHSEwC","Bu9Hr2K","zuf5rhy","yxP2Dgi","CMfNzvn5BMm","yNngyNO","vgfN","Bw1pvu4","C2nYAxb0","D2zgAwi","u2vYDMLJzvC","tffnsgK","DLL1qLi","Ahr0Chm6","wvPbuKe","igXHCMDLCIa","wvDzyw8","uMvHzcbWyxm","CNnVCL92ywW","D2vRBMu","rM5iAK0","s3Hdrg8","AevYCM9Yrxy","CMvTB3zLrxy","q3D4s1m","CwrSq2W","r3LzDKS","y0zfz00","u3zJExa","D3jPDgu","uezeq08","CMjVshy","s3zjz2O","v2vIu29JA2u","vNHHDwe","BenOD1y","u1Dxs0W","tgfXvwi","v3DqBLK","zgT0sLG","BxLMvxi","tgHOww8","u2TPCcbWyxm","wKX3C0G","suf6rwS","yMfSu2nVCgu","C2v0y3vYC28","CvjluxO","q09otKvdveK","CKvjsfa","DLz3EKi","ywDLrxzLBNq","C3HcBeu","z0fWEMe","wNHfzhK","A2DNy1G","qMPRzxe","AxnbCNjHEq","B0PMqwu","C0fVtxi","Ag5nvfu","DfrxA1y","qNLUAuW","sKTPq0q","ywnRpwzYB24","A3PYsva","B2nRzxrgywK","zgLZCgf0y2G","BNfYtw8","CMvHzhDYAxq","qKrzs3K","BhPYAe8","Ec11C2uT","uwzywKm","CKDfB24","CgfNzwHPzgu","u2HHCMvKv28","BLbwtvi","DgHHBIbSB2m","CvPftvO","rxzLBNq","zfHYD2y","rxnJrw4","otC1mdiYogHezMnMCq","CgLUz0XVC3m","sLLcENq","v210z1q","BeHHBMrSzxi","Aw9Ul2PZB24","t1bftG","AwrI","BNvTyMvY","rLLktwq","quX2wxy","rNDQDvi","Bwv0Ag9K","rLreDge","Aw9U","C2vYDMLJzs0","y2rmAeS","sxrJALi","DwnTreu","uMDnvNO","r0LJqNi","B2zM","B25nzxnZywC","Cgf5Bg9Hzeu","reP1yvy","zcWG","De1HBMfNzxi","zv9ZDwnJzxm","reDhsLG","B0nnyMO","u09srxu","ignVzgu6ia","vM1TrfK","wgfjtge","yw5Hz2vY","B2zMBgLUzq","yNnlEfG","tvPotvG","r0Pttva","t0HMq1G","r2zmrKy","z2vtEw5J","BuDey1K","tg9sBve","igfYCMf5yNu","ChjVDg9JB2W","seHdrNO","D3j0C0e","q3D2Eg4","s1rruhe","q2zsqLO","DhjHBNnHy3q","twLZC2LUzYa","Bg93","ALnOzgm","y3jLyxrLt2i","yw1LoIa","C3HZyNK","zxq9DxrMltG","B3bLCNr5tMe","r1L4EKC","z29RB2m","t1firg4","wfDoBxG","ruvgruy","EvPxDgu","C1nvqu0","CNvgAve","zwXyBK8","ufDVAgG","zMzMzG","CYbHBhjLywq","q1vQsK0","zKPJz3e","CgLUz0LUDgu","wuHjBMi","u1vXz2m","t1PJrNu","zw5fDMvUDa","uNP2Buq","v2TSzw0","DMvYC2LVBG","C2DmwLu","zKX2sw4","r1LfBu0","DLDwA3y","uNnOsxu","zfPHve8","uLjMwhy","C0rctuC","vvD0Eui","Aw50zwDLCIa","ysbTDxn0igi","sgzzt1e","wvbTwvG","BNruCMLLC0m","mty2odzhr05zzuO","B2nRzxq","DwLwrfa","vefxquW","z3DQEfm","t3HZuu4","senYA2e","zxjFBxnNAwq","DgLLCKPtt04","Afzmse4","BMnVzgLUzW","whfWtxO","wvfyENm","zgvJB2rLzey","tvvuwwS","u3rYyxrLz3K","swTUzMS","ywrKq291BNq","vuftuvC","sgfPufG","yw5Nzq","AKHhtvC","DxrMofDYAxq","tNfctNi","yNnisuO","sNvIsLm","qxnfCNy","s3zoz3y","BwLUAvbYB2C","rNjVBNrPzxi","ufDLuw4","swv0ueq","nxWZFdf8mNW","wMPOseK","sezRqKi","rKXIB0u","uNP2ELu","rMrSrgG","C2vprwW","tMfTzq","C3vIyxjYyxK","BLHxvvG","EvjLy29UBMu","DerRAeO","zLjutKO","zMzmAw5L","ChrVCG","Cu9SDxK","x3bPBMC","v3bJzLO","tKfusvzfx0u","CMvHC29U","quLbqKC","CxLsAgC","BxnN","qKfwA2C","AKDrEeW","B3bLCNr5","vvjUAuG","Chv0","wwToCu8","DxrVuMvJB24","ihn1y2nLC3m","C2jmswu","icSG","z3LfzLu","ueXdCKC","BMrLEa","z1rMvu0","mxWYFdr8m3W","EMfkuMm","x3DZsw5ZDge","CM92AwrLige","rM5Lr1K","whD2rw0","C3rVCcbPBw0","B25szwnLAxy","ue1dDMK","CMvJzxzPzwq","q29UzMLN","wKn6Bey","ign1CNnVCIa","B25tDg9Wsw0","zuXZDw4","vw5vu2u","CKXntuy","CMfTugfYyw0","zMLUza","wLrWv2C","x29Ut3bLBG","B3nfug8","y2XLyxjtDg8","yw51Ce1LC3m","D0ziy0K","B2TTs0e","x3bPBMDmB3m","ywnRx2nVzgu","x2LUAxrhBg8","t0L0qvC","uKLcCLq","BgLUzq","BMvLzf9Hy2S","CeXdCfm","uuDcqw0","zNjVBunOyxi","BMjzAeO","vMf6Eva","EwzmsM4","wK1myMO","zfDVCMTLCKC","zMD2rNi","AeTpzuy","Eujhvhm","ywnRtxnNswq","qwHrufi","zNjVBuj5Dgu","zePLBfK","C0XPC3rLBMu","AefbwK0","ywrRvNO","wM1PzvG","wg9utLK","ufLuv1m","zhDhBxK","sMTNy1C","D2vI","zcWGDw5RBM8","x29Uq2XVC2u","x3jLywr5q2W","zgvSzxrLrge","Dg9hzw5LCMe","u3fNzfa","uwTztLG","BgvYtvG","wgTKqu8","A3nlqMG","BNrfBMrWB2K","Ahj2swG","y291BNq","rLL5tK4","zvjcu3K","Awr0DNC","tNrlDeS","odGYndbbBLPjrwq","sMTrB1y","z3Heuuy","Dxrjza","sM5ZChi","CKT2tuO","wfreCMq","ihrYEsbYzwm","DeLK","CLLqDKG","DeTdr1i","wuDOtuK","BMrWB2LUDca","uLLHzuq","u3PQyKW","otLSqwHitNO","C3b6whG","wKTAsvK","x2jPBMfYEvq","sMz3DeW","Aw47y2HHCNm","rhPnreO","r0Lkv1K","Dgv4Dc9Qyxy","vKD6uLm","De5sD1C","AefJA01LC3m","odyXmtj0BxLky0m","CuDJu2W","x19LC01Vzhu","y2XVC2veqG","s3HrwvO","CMvWBgfJzq","z09tAwW","zM5xDwu","v09pAMO","y1rZtu8","BKLRshi","v1vozMG","txb3CM8","y0nts3K","v2D5De4","q3fzCwq","x29WDgLVBNm","EhDuA2e","y2HnyxHdB3u","yLL4AvG","zw5JB2rPBMC","m3WWFdf8nhW","y2HLy2Tszwe","yNPpExm","sxvUBeO","B1fIwum","u3rnBxm","CgLUz09Uy2u","y2XVC2u","BeLYAeq","tunMELG","tu1tq3e","yKHdzKm","A3nUr2G","wfDVyMG","yKPrtgO","BML0AwfSAxO","zgrWB3e","EhnMBvq","rfzoDwC","zw50","AufUCwG","s0vUr2C","qw1VDw50","C3bSAxq","y2HHCKnVzgu","ENLWDfe","ChjVy2vZCW","Fdb8mNW4","rKfNsKC","twzeBNu","x2TLEvbHDgG","DuPWC28","x2zVCM1HDeu","ywnOzwq","nNWZFdD8mhW","qw5RyvO","x25HDMLNyxq","yKD1uwG","sLjMr0S","x3bYzwzPEa","y29UC3rYDwm","ywjVCNq","ywXty29Wzq","EfvZzuvUDG","Cvvuq3i","v2vuDwy","zw5KCg9PBNq","reiGzMfPBgu","D1Dqtha","sMDqDMm","A1jTChG","tevPCeS","BMnLq2XVC2u","zM9Yy2u","t21jv2q","tePWuhq","shLvEwe","BgLUzw5V","DMvY","zenMCNO","BeDwr2K","D2LSBfjLy28","BwLZzq","BMDJvMO","ENDeDLG","Ec1TC2CTCw8","AgvKtwf4uMu","CNr5vK4","A2v5CW","CMv0CNLdB3u","CLvrswW","uKPwrMS","Axnby2TdBgu","swfnBNi","AwXSihvZzsa","ChP1qNe","tMH0Cva","x3vYBa","sM5WEgC","suDTv1y","rML0y2i","DfDZqwS","zxmGCMvHy2G","t0PNDge","qMLYu0u","u2Llv2W","EKLMC2u","BeLWBwK","rxjYB3jdB2q","v1vOrNy","y2f0y2G","sMXAA0O","DMfS","rhPpvLy","x2rYB3bhBg8","BwvZC2fNztO","BMHJyxC","y2fSBa","AgvHzgvY","DhDqEMq","BgrLruu","x2nYzwf0zvm","D0XkEw4","A1rAtu4","CMvZDwX0","CvfsqK0","DgfIyxnL","t3newuG","seDHwNe","mZiWnJu5mgnfzwvPtW","rK9fugC","re1rte4","ExbL","B25SAw5L","zwLVA04","yvHtv3e","qKPezeO","AfrXqLO","yMLUyxj5vhK","Chr2qNq","CxLoAg0","uLfyyvm","D3m6lY8","zxjFCw9Z","B3bLBIa","ywDLsgLKzq","zvL5yxa","Bfbutuy","yKrHvw8","BeHpueK","x2XPC3rLBMu","ywjhA28","Bhm6ia","x2n1CNnVCK0","Dw5RBM93BIa","DgHLBG","D0zlBvC","Ahb5sLG","B25TzxnZywC","zM9nB0e","ChjVDg90Exa","x2LZsw5PDa","C0PJCeK","zwn0","Eu1Uvfi","Dg52q24","x3nLBMrby2S","EKHOAwu","zuvyreu","r1bzC0W","CNzHBa","q0Xpu0LorW","Dg9Y","qwXOCeO","yMfnz00","yxvTsMm","tg1UtKO","BwvZC2fNzq","r1fICfe","DxbKyxrLq3u","uwnWBuq","y3r4","BLfpC3q","AwXLx25HBwu","vfvosgW","u0PoBva","wvfwD2y","CeLJshO","ywnRDxbfBMq","BeDwufi","BvHbBxK","CMvQzwn0","DgLTzw91Da","Evb1Dfm","BMDuAw1LCG","EgDIzfG","tMP6s1m","zNvbwMO","zNjVBu51Bwi","Dw5ZAwDUzwq","AxjLza","zgXJtNC","zxf1ywXZ","v3vgCg4","yxbWBhK","Evv0Cue","DcbSAw1PDa","r2vfBNG","zNDrr0C","zeX4s1i","A05fB3u","CLzHBhvLCW","v2zABva","zMLSDgvY","z29TtMW","vMzuv2m","CMfUzg9T","AwHOD0m","q25iyNO","yNLL","B25ozxr3B3i","ruHKqvi","zv90Aw1LB3u","BvvfuuW","suTdwuq","x21LC3nHz2u","CYbPBNn0yw4","s255BKK","rxvSBNm","Exbdvfi","qNz6uMe","rMPbzLq","C3vJy2vZCW","zg9Uzq","uuvAz3m","tLLoqMy","uw9nBhG","C3vIC3rYAw4","rKLmrv9ot1q","n3WXmhWXmxW","uffYAKq","DhLWzq","x3jLBw92zvC","C1vKv3C","DxLhAuW","z2vjBMzVu3K","uu5RENK","z0HqwuO","C2v0zgi","twvZC2fNzuu","uxPzAeW","rLLwsuS","vNfSDLC","x1fVu01HBMe","CvHjD2i","CM92AwrLihC","y0LAD2S","C1vkDLG","t0DiAMK","CgLUz1rPBwu","CuzbueK","vw5PBxbSzw0","ugTkALy","vNfvs2O","B3bmuLO","x0vysvnu","zsbHihn0CMK","sg9uCue","Dev2zw50","A2L6A1q","rwHzBNC","BMjcCwm","DMfSDwvZ","BNnUzgm","zxjYB3i","wvbnq2u","zuHfsgu","y3ruAw1LB3u","zLr5t3a","Cg9PBNrdB24","qvD2C1C","wufjv2i","y3jLyxrLt3a","r01NBKK","Dg9cExrLCW","x2HHBMrSzu8","sLnHDey","Aw5KzxHpzG","tgnAq3m","B2zMC2v0","Ew14r2m","BvjTvKK","ihrPBwvVDxq","qufsEg8","CLnrufK","t3HJz3O","x2rLC3rYB3K","x2LUDgvYDMe","sgjcEem","CMvHzfvjBNq","AgvHzgvYCW","z1njvvC","tKrWuMK","yM9KEq","zw50tgLZDgu","t3PmtNa","BMv4DcGPigm","D1D0BMG","EvP0AMW","CMvKDwnL","y09Wzw4","txDKtM8","tuPbB1K","Cg9W","zMvbD0e","B3bIwgm","y3fnrg0","AMzXCfO","Cg9PBNrbBMq","qKHSvuG","zeXLtwK","rxfbrLC","teHxv2G","yMPOCwC","ANHzCeS","zwvKzwq","wK5huNK","BwLtCNi","C2vUzf9Hy2S","weX4sLm","Efrurw52","reDsthy","AuziBK8","Dg9mB3DLCKm","BM93","q3vZDg9Trxi","A3btD1q","B3vUDa","BwXhzvK","y3vYCMvUDeu","DeDIwwO","B3jpBMXPBMu","zLblweu","q09duwi","y29TCgXLDgu","z2v0sxrLBq","mNWXFdn8mhW","tLHrCNy","zw9Yu0S","DgLUzYbZzxi","zw5JB2rLrNi","sgX2A1a","D3jMwNK","zw1LBNq","x2HHBMrSzva","y3vRC0W","AxmGDw5Kzwy","AxrdvLO","q29Kzq","CLnbBei","uxvLDwu","yNL0zu9MzNm","x0rctMfTzq","A2Dev2G","uKfmzKW","C2vYDMvYvgK","tMDhue0","DM1Nyxu","aaaaaaaaaaa","BgvUz3rO","zvvYBa","Bwu6ia","D1jzEfu","A2fesu8","tufPzuG","zxndDhq","tfzWzue","AwXK","r2Hktfu","CgfYC2u","t1PbAgK","rwrzvNa","tuLiv04","qNvTuLG","DwXTrNK","zwDurMK","sfPIBwm","yxKSihrYEsa","tfn5tee","B2fJCha","zfbtwNm","vLLnreW","CwLUAMi","uxLZEeO","tg9JAW","yxbWBgLJyxq","CxjYsMC","uMzprxq","C2vYDMLJzq","y3vYC29Y","y09qrg0","AwzhBNm","rgrgv2q","wwLkBMi","AxnszwfKEq","C2v0sxrLBq","rejuyNO","DNHcseu","q3zYt0m","Dw5KzwzPBMu","rLjptLrjrvi","vgj0rMu","y3vYCMvUDeK","q1LLDuO","zuDxugy","x2rItMfTzq","EgnZyMi","BgLTAxq","mxWZFdj8mhW","AxnFywnR","u3LJq04","wuPJwxO","CMDZBui","y29UBMvJDca","z2v0qwXS","Agfku0i","ELn2z1O","zw5HyMXLuw8","veXZCLa","BfvHt08","AM1prKm","B3jLtMfTzxm","zNvUy3rPB24","D3jPDgvvAw4","zwnVBM5Ly3q","EuXArKS","Ee1jq2S","yMTxzKq","y3j2C2O","AwXytuC","x3nLCuLK","AK9IDKG","CMvJzwL2zwq","y3jLyxrLuMu","uLDXz0O","z2v0u3rVCMe","DfnnrLC","zMLSzw5HBwu","x3bHDgHlzxK","Aw5KzxG","x2nVBM5Ly3q","DuPwC20","DgLTzw91DcW","Bwf4twvZC2e","EhPiwuW","yMLWzhe","Aw1Xvwe","jMPZy2fSBgi","EuTUExi","y2HnyxHuCMK","y2jjzu0","A05HvvG","zxH0zw5ZAw8","svztzKi","BMvY","qwjVCNrfCNi","zKLxuhO","uwvQyNG","uMjZCuy","ywXS","x2LUAxrqCM8","EvvJC3u","B25pCgvU","Fdf8m3W3Fdy","qNjPzgDL","qNnXzKO","z1HrA0O","txHzuvy","ChbL","C2vUDa","C2fNzq","BMnnqLK","B3nLrxzLBNq","Aw5JBhvKzxm","zwrJvxi","CNnVCL9Uyw0","zufJAW","Dw50","rLvAAxG","ywr2yw5Jzq","uLjpuG","qLPMuNG","AvrqvgK","qM9Hvu8","x2rPC2nVBM4","y3vZDg9Tshq","yM9L","Aw5N","B0rszge","wMnWrKK","vxn6C1G","yxnZAwDU","EKLmCha","CMvZzxruCMK","ywXSq3vYC28","mZi5nMfxuurrwG","q0Xpu0ve","qxH6C0S","z2v0q3vYC28","quXm","x29UtwvZC2e","BxPxsuS","t1PbrK4","yxrHlcbKyxq","rwn6ANG","sMjQs3m","BMPXrfK","A1Hty0S","tuXHuvm","x2LUAxq","Cw9Z","DgzOyK8","s0LdtNO","suvtx0vsuK8","mhW0","CNnituy","v2v0v1u","yKLMvKq","Cwjwzgq","CgXLyxnLiha","CwTPv0C","Cu9Kz2O","wvDZuxa","sMDXruq","DhjPzxm","wMngweO","zxjYtxnN","CwjwCuS","zgvMAw5Luhi","ChbWvNa","zw5NDgG","C3rYAw5NAwy","DhjPBq","tg9NsurozxC","tMryrNK","wNnMyLu","zxjFAxnFywm","DgTSruq","DeDruKu","BNrbBMrvCgq","sMXssLe","zw5HyMXLqxu","mxW1Fdr8mG","yxnL","mJDQuvbly2q","z0Tkzg4","EfLLyLy","u1n1vwm","BMCGDxjSoIa","B25fCNjVCG","z2vrDwv1zuW","Agfbsg0","rLDt","zgrjrcWGzgu","x2fKzfDZtgK","zNnWuvi","qvPjCvy","z3bpwem","uwPIDxG","zgf0yq","t1bPq00","uezICfG","ChPcAfG","z2v0q3vYCMu","tufyx1jfvfi","yMrFzgLK","uKnls0S","wfnmzfi","sejvt0y","B25JBg9Zzq","Bg9NsurozxC","BhLoBvm","reD2sKS","uLDuseu"];return gn=function(){return r},gn()}var ii,Qs,ei,lr,pn,dr,ln,mn,_n,It,ti=si({"node_modules/idb/build/wrap-idb-value.js"(){let r=E,e={eYyap:function(i,a){return i instanceof a},lZKUO:r(1104),UMEdD:r(1484)+"oreNames",xNmdf:r(192),YltuK:function(i,a){return i!==a},xxLZP:"hqqdL",tzNBb:r(461),pLCpS:function(i,a){return i===a},OEoam:function(i,a){return i===a},NjzKS:function(i,a){return i in a}};ii=(i,a)=>a[r(1588)](x=>i instanceof x),lr=new WeakMap,pn=new WeakMap,dr=new WeakMap,ln=new WeakMap,mn=new WeakMap,_n={get(i,a,x){let f=r;if(e[f(1017)](i,IDBTransaction)){if(a===e[f(472)])return pn[f(1525)](i);if(a===e[f(322)])return i[f(1484)+f(1302)]||dr[f(1525)](i);if(a===e[f(403)])return e[f(1486)](e.xxLZP,e.tzNBb)?x[f(1484)+f(1302)][1]?void 0:x[f(1484)+f(274)](x[f(1484)+"oreNames"][0]):!!_0x3862d8?.[f(787)](d=>d[f(1640)]===_0x1bb55c&&d[f(1575)]===_0x333aec)}return Ee(i[a])},set(i,a,x){return i[a]=x,!0},has(i,a){let x=r;return e[x(1017)](i,IDBTransaction)&&(e[x(802)](a,e[x(472)])||e[x(1594)](a,e[x(403)]))?!0:e[x(1067)](a,i)}},It=i=>mn[r(1525)](i)}}),oi={};mx(oi,{deleteDB:()=>Dx,openDB:()=>Ax,unwrap:()=>It,wrap:()=>Ee});function Ax(r,e,{blocked:i,upgrade:a,blocking:x,terminated:f}={}){let d=E,h={tMDea:function(v,y){return v||y},IGmWV:function(v,y,I,T,N){return v(y,I,T,N)},nPhlw:function(v,y){return v(y)},oCMbj:function(v,y){return v(y)},auXDA:"close",gApza:"versionc"+d(449),GyYvK:function(v,y){return v(y)},oacpp:function(v,y){return v===y},XtVUd:"dBQHx",JgqED:d(348)+d(1196)},m=indexedDB.open(r,e),w=h[d(547)](Ee,m);if(a)if(h[d(1260)](h[d(1518)],d(690))){let v=this[d(306)][d(1316)+"geSync"](this._prefix);return _0x181cab.parse(h.tMDea(v,"{}"))[_0x11f3c6]}else m[d(252)+d(1679)](h[d(1404)],v=>{let y=d;h[y(970)](a,h.nPhlw(Ee,m[y(995)]),v[y(462)+"on"],v.newVersion,h[y(633)](Ee,m[y(655)+y(618)]))});return i&&m[d(252)+d(1679)](d(1616),()=>i()),w.then(v=>{let y=d;f&&v[y(252)+y(1679)](h.auXDA,()=>f()),x&&v[y(252)+y(1679)](h[y(574)],()=>x())})[d(981)](()=>{}),w}function Dx(r,{blocked:e}={}){let i=E,a={yjmIW:i(1616),ddpoq:function(f,d){return f(d)}},x=indexedDB[i(829)+i(997)](r);return e&&x[i(252)+i(1679)](a[i(1516)],()=>e()),a[i(907)](Ee,x)[i(1026)](()=>{})}function ni(r,e){let i=E,a={tLYNM:function(m,w,v){return m(w,v)},OGKSz:"readonly",WeTuf:function(m,w){return m instanceof w},fRTNJ:function(m,w){return m===w},wFHcI:i(339),HfYOQ:function(m,w){return m!==w},ERGFa:function(m,w){return m in w},NEoCO:function(m,w){return m!==w},PjDQp:i(780),JXoPx:i(516)};if(!(a[i(936)](r,IDBDatabase)&&!(e in r)&&a[i(744)](typeof e,a[i(793)])))return;if(hn[i(1525)](e))return hn[i(1525)](e);let x=e[i(875)](/FromIndex$/,""),f=a[i(697)](e,x),d=xi[i(1354)](x);if(!a.ERGFa(x,(f?IDBIndex:IDBObjectStore)[i(1031)+"e"])||!(d||ai.includes(x))){if(a.NEoCO(a[i(338)],a[i(467)]))return;try{_0x168d02(this,_0x5d52d6,[_0x1cff8f,_0x3c87a5,_0x225c00])}catch(m){let w=a[i(388)](_0x262585,"error",{message:m[i(1048)],code:_0xca8326[i(310)+"OR"],error:m});this["_dispatc"+i(543)+i(910)](w)}}let h=async function(m,...w){let v=i,y=this["transact"+v(618)](m,d?v(590)+"e":a.OGKSz),I=y[v(192)];return f&&(I=I[v(1320)](w.shift())),(await Promise[v(1340)]([I[x](...w),d&&y[v(1104)]]))[0]};return hn.set(e,h),h}var ai,xi,hn,kx=si({"node_modules/idb/build/index.js"(){let r=E,e={HPcUx:r(1556)+"3|4",rgsmB:"getKey",hBeuE:r(1295),wImwz:r(1467)+"ys",eWEpJ:"count",OHfCX:function(x){return x()},nfCFI:r(759),fLvIn:"delete",wBqYL:"clear"},i=e.HPcUx[r(914)]("|"),a=0;for(;;){switch(i[a++]){case"0":ti();continue;case"1":ai=[r(1525),e[r(1293)],e.hBeuE,e[r(507)],e[r(1644)]];continue;case"2":e[r(643)](ti);continue;case"3":hn=new Map;continue;case"4":Sx(x=>({...x,get:(f,d,h)=>ni(f,d)||x[r(1525)](f,d,h),has:(f,d)=>!!ni(f,d)||x[r(257)](f,d)}));continue;case"5":xi=[e.nfCFI,r(477),e[r(687)],e[r(396)]];continue}break}}}),Ix={idb:function(r){let e=E;r[e(413)]=Promise[e(515)]()[e(1026)](()=>(kx(),oi)).then(function(i){return i})}},ri={};function Se(r){let e=E,i=(e(1217)+"4")[e(914)]("|"),a=0;for(;;){switch(i[a++]){case"0":Ix[r](f,f[e(413)],Se);continue;case"1":if(x!==void 0)return x[e(413)];continue;case"2":var x=ri[r];continue;case"3":var f=ri[r]={exports:{}};continue;case"4":return f[e(413)]}break}}Se.d=(r,e)=>{let i=P;for(var a in e)Se.o(e,a)&&!Se.o(r,a)&&Object["definePr"+i(757)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=E;Se.o=(e,i)=>Object[r(1031)+"e"][r(232)+r(757)][r(988)](e,i)})(),(()=>{let r=E,e={ksnGh:function(i,a){return i!=a},yUtqA:r(1280)+"d",eCIBL:r(293)};Se.r=i=>{let a=r;e[a(903)](e[a(1076)],typeof Symbol)&&Symbol.toStringTag&&Object.defineProperty(i,Symbol[a(382)+a(527)],{value:e[a(323)]}),Object[a(1409)+a(757)](i,a(872)+"le",{value:!0})}})();var V={};(()=>{let r=E,e={Oxcgz:function(s,t){return s(t)},kNaUX:function(s,t){return s+t},EqAFW:function(s,t){return s*t},opbXc:function(s,t){return s*t},hucAR:function(s,t,n){return s(t,n)},KTQPq:function(s,t){return s(t)},UWtyB:function(s,t,n){return s(t,n)},LSyLA:function(s,t){return s+t},tNRwW:r(504),TDVPX:function(s,t){return s(t)},mmOUN:function(s,t){return s(t)},Azzpt:r(238)+r(238)+"00000000"+r(238),QGBAm:function(s,t){return s(t)},qGcSl:r(529),cFEgM:"http",NYNBf:r(1328)+r(585)+r(708)+"P",opLRZ:function(s,t){return s(t)},KnynI:function(s,t){return s>>t},tzGbn:function(s,t){return s|t},dFbGv:function(s,t){return s&t},OzLNp:function(s,t){return s>>t},RIBrT:r(253),hftiP:function(s,t){return s<t},rtyVN:function(s,t){return s>t},RgMVz:function(s,t){return s<t},ZxEdy:function(s,t){return s!==t},PUYhG:function(s,t){return s-t},JYBzt:function(s,t){return s-t},JAChY:function(s,t){return s<t},wwJPC:function(s,t){return s===t},ZLNRY:r(1002),OItAW:r(195),AARxo:function(s,t){return s<t},imqUa:function(s,t){return s!==t},dwGmy:function(s,t){return s-t},fnjBh:function(s,t){return s>t},UASQW:function(s,t){return s!==t},DBTbz:r(546),Iknfk:r(954),JkQoV:function(s,t,n){return s(t,n)},GfLFF:function(s,t,n){return s(t,n)},YiJnb:function(s,t){return s===t},omwWz:r(862),ilXMG:function(s,t){return s(t)},CfRBZ:function(s,t){return s>>>t},ufthP:function(s,t,n){return s(t,n)},gxDQF:function(s,t,n){return s(t,n)},SnVIb:function(s,t){return s(t)},YWYao:function(s,t,n){return s(t,n)},cIZwk:function(s,t){return s&t},AIWQu:"Missing "+r(379)+r(270)+r(1575),HJnAN:function(s,t){return s+t},WxCpW:function(s,t){return s+t},VYMDL:function(s,t){return s===t},oYuvD:r(399),kTZMN:"NgkPp",qLdNX:function(s){return s()},nQOst:function(s,t,n){return s(t,n)},IAzEk:function(s,t){return s!==t},HBUOF:function(s,t,n){return s(t,n)},LJytw:function(s,t,n){return s(t,n)},QSYcu:function(s,t){return s!==t},OxsQN:r(637),giFMJ:function(s,t){return s!==t},qZEMZ:function(s,t,n){return s(t,n)},VGzRS:function(s,t){return s(t)},zDnxp:function(s,t){return s!==t},wWtnh:function(s,t,n){return s(t,n)},OJgta:function(s){return s()},xcsbb:function(s,t){return s(t)},EscEn:function(s,t,n){return s(t,n)},xsfmT:function(s,t,n){return s(t,n)},eAyDv:function(s,t,n){return s(t,n)},WVDIs:function(s,t){return s!==t},HlvkP:function(s,t,n){return s(t,n)},MJAoY:function(s,t,n){return s(t,n)},ixvJg:function(s,t){return s!==t},OicuG:function(s,t){return s(t)},rEIHP:"aHIDk",eWWTK:function(s,t,n){return s(t,n)},GNILW:function(s,t){return s(t)},QEZgs:function(s,t){return s(t)},wUyxL:function(s,t){return s(t)},jxYpK:function(s,t){return s(t)},VqlvW:function(s,t,n){return s(t,n)},UPBJQ:function(s,t){return s(t)},ucmDE:function(s,t,n){return s(t,n)},FwjuR:function(s,t,n){return s(t,n)},Kdvcp:function(s,t){return s===t},YAIWb:r(656)+r(379)+" field: "+r(297),hTIBx:r(656)+r(379)+" field: "+r(1269),CwxKS:function(s,t){return s(t)},aumJc:function(s,t,n){return s(t,n)},PPuFz:r(1132)+"ented type: ",KBaLf:function(s,t){return s>>t},DMeid:function(s,t){return s>=t},UeZlj:function(s,t){return s>t},brlvG:function(s,t){return s+t},ptvBt:r(563)+r(1077),iSRYG:function(s,t){return s||t},PWohh:r(993),niSvT:r(1337),KRiZf:function(s,t){return s*t},nhcaw:r(407),ggQBz:r(444),azvtb:function(s,t,n){return s(t,n)},rKvMJ:function(s,t,n){return s(t,n)},DGvJK:function(s,t){return s+t},baohm:function(s,t){return s(t)},xwTka:function(s,t){return s>=t},NDpRi:function(s,t){return s+t},YQVwf:function(s,t){return s|t},ghoWY:function(s,t){return s<<t},DBfzT:function(s,t){return s&t},vVwzB:function(s,t){return s&t},erKdb:function(s,t){return s==t},WOOjj:function(s,t){return s&t},iDtJw:function(s,t){return s+t},FYVIK:function(s,t){return s!==t},FUYtQ:function(s,t){return s&t},StMms:function(s,t){return s&t},zyptQ:function(s,t){return s>=t},dliwK:function(s,t){return s<=t},cdLhK:function(s,t){return s>=t},YjADo:r(1095),FexWf:r(1001),TAWAL:function(s,t){return s+t},PXnMb:function(s,t){return s+t},BJDdJ:function(s,t){return s&t},ZmieX:function(s,t){return s<<t},DVNug:function(s,t){return s|t},XIuxi:function(s,t){return s<<t},nPVMR:function(s,t){return s&t},LoRmQ:function(s,t){return s<t},Eczjx:function(s,t){return s&t},kzrIP:function(s,t,n){return s(t,n)},SNNKI:r(1004),yUIGJ:"pagehide",hQKmM:function(s,t){return s===t},XLxJS:r(624),nXWUX:r(584),VfTWc:function(s,t){return s>=t},LnYsH:function(s,t){return s+t},YPmYX:function(s,t){return s-t},NGmPf:function(s,t,n){return s(t,n)},OPiCM:function(s,t){return s<t},kRmpx:function(s,t){return s-t},URniH:function(s,t){return s>>t},OWYCc:r(951),RALfL:function(s,t){return s&t},bsKxX:function(s,t){return s>>t},sSUAM:function(s,t){return s>>t},WgytN:function(s,t){return s|t},rLMMF:function(s,t){return s&t},sUdWw:function(s,t){return s|t},fuAZj:function(s,t,n){return s(t,n)},lzPrj:function(s,t){return s<t},ZsfbU:function(s,t){return s+t},sxvsH:function(s,t,n){return s(t,n)},UszsX:function(s,t){return s(t)},WpcfZ:function(s,t){return s&t},tloaE:function(s,t){return s&t},kSsBP:r(847),FjAfT:r(480),JSatF:function(s,t){return s>=t},EQNKC:function(s,t,n){return s(t,n)},IGUfF:r(385)+r(1344)+r(918),eGWPf:r(1269),ZcpFI:function(s,t,n,o){return s(t,n,o)},gwjxS:r(989),elXnO:r(457)+r(224),MfDnu:function(s,t){return s(t)},ZjhHI:function(s,t){return s(t)},nYrBF:function(s,t){return s(t)},wWPLp:function(s,t){return s&t},PGacm:function(s,t){return s<<t},LcOXm:function(s,t){return s&t},zuVbw:function(s,t){return s===t},gokoc:r(1089),yoEYM:function(s,t){return s(t)},OCqbM:function(s,t){return s&t},cnRgL:function(s,t){return s(t)},STtFD:function(s,t){return s(t)},gyEfU:function(s,t){return s===t},ZnYes:"bXzny",akqfy:r(773),HCrka:function(s,t){return s(t)},Zafth:function(s,t){return s&t},UzQtZ:function(s,t){return s===t},tuoDs:r(984),jShdc:function(s,t){return s&t},bGuQh:function(s,t){return s|t},GUwax:function(s,t){return s>>>t},XTDrd:function(s,t){return s>>>t},tXSPT:function(s,t){return s|t},qinjb:function(s,t){return s<<t},xMICk:function(s,t){return s>>>t},YVALa:function(s,t){return s===t},GYEmM:function(s,t){return s<t},iaoSw:function(s,t){return s<t},sgLZU:function(s,t){return s+t},AdsmG:function(s,t){return s&t},SQpQc:function(s,t){return s>>>t},sRaFS:function(s,t){return s+t},feAwA:function(s,t){return s|t},qeNKe:function(s,t){return s&t},wFKmW:function(s,t){return s>>>t},esCtt:function(s,t){return s&t},iNqyD:function(s,t){return s>>>t},cFsBV:function(s,t){return s!==t},MCfzX:function(s,t){return s&t},nIkHr:function(s,t){return s+t},bsHIJ:function(s,t){return s!==t},RzvmD:function(s,t){return s&t},rGEon:function(s,t){return s&t},deyRP:function(s,t){return s>>>t},GeKbG:function(s,t){return s>>>t},mxJRl:function(s,t){return s>>>t},nbYhJ:function(s,t){return s!==t},osEPo:function(s,t){return s|t},QSwQd:function(s,t){return s&t},qrrJg:function(s,t){return s|t},WGzIk:function(s,t){return s|t},QoMlx:r(1504)+r(1093)+"t",qOdgj:"timeout",psHjZ:function(s,t){return s!==t},MIOpW:r(912),ihhwC:function(s,t){return s|t},SOREu:function(s,t){return s|t},qUTCr:function(s,t){return s<<t},ZMLbj:function(s,t){return s<<t},JbjKs:function(s,t){return s|t},AOxoo:function(s,t){return s|t},lChwV:function(s,t){return s<<t},qeawS:function(s,t){return s|t},kKiGO:function(s,t){return s|t},Tejrm:function(s,t){return s|t},lUaOO:function(s,t){return s<<t},pppVp:function(s,t){return s|t},uiVDP:function(s,t){return s|t},JBkQm:function(s,t){return s|t},EicbH:function(s,t){return s===t},lerMX:function(s,t){return s<<t},FLboE:function(s,t){return s>>>t},FSeHq:function(s,t){return s|t},vmgau:function(s,t){return s<<t},RaKhO:function(s,t){return s&t},hKOeF:function(s,t){return s>>>t},SzjbL:function(s,t){return s&t},mlGeY:function(s,t){return s>>>t},XEsKV:function(s,t){return s>>>t},GKvTN:function(s,t){return s!==t},rSAlB:r(1674),AIABG:r(1364),Jnpxg:function(s,t){return s<=t},wfFib:function(s,t){return s>=t},SOaVc:function(s,t){return s+t},HoTqA:function(s,t){return s|t},Vxaua:function(s,t){return s%t},khexF:function(s,t){return s/t},SSuUc:function(s,t){return s*t},WUNfh:function(s,t){return s+t},DxKGe:function(s,t){return s>>>t},OGHji:function(s,t){return s===t},KxCDo:function(s,t){return s+t},RQzYj:function(s,t){return s>>>t},wrfZy:function(s,t){return s+t},FYJMd:function(s,t){return s|t},OrQII:function(s,t){return s===t},qQRBM:function(s,t){return s+t},dZaTO:function(s,t){return s+t},sbLIe:function(s,t){return s>>>t},BBjau:function(s,t){return s&t},aoxiV:function(s,t){return s>>>t},YGhMI:function(s,t){return s>>>t},CNCpW:function(s,t){return s&t},eiokN:function(s,t){return s&t},OVGZT:r(1323)+r(850)+r(1538)+"g",vrqAH:r(369),gpOXC:r(1179),wekne:r(1678)+r(493),HaiPX:r(1445)+r(1394)+"R",RRfXv:"MESSAGE_"+r(1607),ruFiQ:"OPEN_ERROR",gbjNc:r(569)+r(443),bEljP:r(750)+r(1361),jYyox:"2|5|0|6|1|4|3",kMStu:"3|2|0|1|4",CRmuj:r(980),lGVPR:function(s,t){return s instanceof t},SqvAF:r(339),Ychvt:"none_none",QzYhL:"binary",ByniL:function(s,t,n,o){return s(t,n,o)},iAnqh:r(1271),bsFbz:"HadpS",WsjMH:r(1280)+"d",QbBiQ:function(s,t){return s!==t},drPkY:"AAfXG",BoIlh:function(s,t){return s-t},LhhYo:function(s,t){return s===t},LQMHi:function(s,t){return s>t},eRBSy:r(500)+r(1054),NvKXp:r(1109)+r(1136),rSQPY:function(s,t){return s===t},dLeMi:r(1338),tBqNo:function(s,t){return s===t},bjhqg:function(s,t){return s instanceof t},gHPYJ:r(1665)+"d error.",eZwVB:function(s,t){return s===t},qyRhg:function(s,t){return s<t},lHOPI:"error",CAVof:r(898),oecnw:function(s,t,n){return s(t,n)},dhBQb:"message",nxowM:"open",GMCFw:function(s,t,n){return s(t,n)},zrtZA:r(1415),itCVZ:r(1203),OZAFN:function(s,t,n){return s(t,n)},uJVsm:r(679),pvHyc:function(s,t){return s||t},EhYnw:function(s,t){return s!=t},oJfAe:function(s,t){return s===t},bFbYJ:r(709),xzHYL:function(s,t){return s<t},cTsMO:function(s,t){return s<t},BHLkA:function(s,t){return s>=t},ALvYv:function(s,t){return s|t},UXJZU:function(s,t){return s&t},QqUft:function(s,t){return s|t},lzrhO:function(s,t){return s<<t},exLbW:function(s,t){return s<<t},YOouG:r(479),JkgcW:function(s,t){return s-t},CqYqd:function(s,t){return s|t},rxooN:function(s,t){return s|t},cDcfn:function(s,t){return s!==t},WGLDh:r(277),YWsQp:function(s,t){return s<t},nsndc:function(s,t){return s>>t},YPMCe:function(s,t){return s&t},xcvLI:function(s,t){return s&t},FWGvc:function(s,t){return s&t},OZAhi:function(s,t){return s+t},NqBNr:r(732)+r(1395),HFkBB:function(s,t){return s|t},RWTHE:function(s,t){return s&t},YqUij:function(s,t){return s>>t},aOrQY:function(s,t){return s&t},PYTWS:function(s,t){return s<<t},oROuO:function(s,t){return s&t},hrvIh:function(s,t){return s|t},LEipK:function(s,t){return s>>t},nGXZO:function(s,t){return s|t},rXlyg:function(s,t){return s-t},iTPTi:function(s,t){return s!=t},dLxKR:r(1655)+"in;chars"+r(662),Mpwro:r(1367),KYwab:r(1349),JwwSD:function(s,t){return s>=t},sxsby:function(s,t){return s(t)},FTDta:"unknown "+r(751),fgvFr:r(866)+r(320),PWeQn:r(589),seOEl:r(448),KRtHf:r(611),KxQYZ:function(s,t){return s===t},CvrOC:r(218),RzvzU:function(s){return s()},RJVFk:r(1478),MuXYy:function(s,t){return s!==t},Wtqaw:"aiDUW",jFumb:function(s,t){return s===t},pIWdI:r(1508),PFDCO:"bzLfo",tIvsS:r(553),uyGiL:r(1103),DJuaV:r(1504)+r(631)+"s",RbsqF:"kUdyd",zSvgZ:r(821),WCkmU:"QTHIC",YdSAb:function(s,t){return s===t},BxZxa:r(1551),mXAmy:function(s,t,n){return s(t,n)},hzpym:r(1249),NtKtK:r(1545),ZNGRy:function(s,t){return s||t},qFAPI:function(s,t){return s||t},JpoHl:function(s,t){return s!==t},XWNmx:"OuTaR",LaqUb:r(756),EotVS:r(1049),QUEnP:function(s,t){return s||t},boVBY:function(s,t){return s||t},SycCN:function(s,t){return s||t},Cwvxn:function(s,t){return s<t},ldeEE:function(s,t){return s>>>t},tYaZj:function(s,t){return s<<t},ksKBh:function(s,t){return s<t},rCZoN:function(s,t){return s>t},olzFG:function(s,t,n,o){return s(t,n,o)},IEjUh:"aPaqK",Svcyp:"bgjeM",GMgnI:function(s,t){return s&t},nLYUy:function(s,t){return s<<t},hpyJX:function(s,t){return s&t},BDYKy:function(s,t){return s<t},kyssH:r(229),yKnyr:r(1008),hVmfE:function(s,t){return s||t},DnFcD:r(1391),ikzzd:function(s,t){return s(t)},hnMTU:"lfxTc",Wklem:function(s,t){return s(t)},sxBlE:function(s,t){return s===t},fnWue:r(727),HMHDs:function(s,t){return s===t},CotgZ:"ToLyh",FYyNN:r(355)+r(1014),UnUSe:function(s,t,n,o){return s(t,n,o)},YZTzU:r(355)+r(289)+"ck",Fitcb:r(355)+r(469)+"sgid",AxzsK:r(801),BHlUH:"is_ack",GeEnx:r(1471),tVHVa:function(s,t){return s||t},IaMnr:r(796),ncMBY:r(1313),EeEAj:function(s,t){return s||t},vASBc:function(s,t,n){return s(t,n)},mDpOJ:function(s,t){return s(t)},ufbuN:function(s,t){return s===t},fspQR:"qtisq",xYebV:r(1266)+r(609),bwbxr:r(1266)+"ion/json"+r(464)+r(1468),FVNep:"aNAsl",okmKA:r(853),wpuCY:function(s,t){return s(t)},TyqgW:function(s,t){return s&t},kizkT:function(s,t){return s!==t},TLJGG:r(1510),opUBy:function(s,t){return s>t},CZeHC:function(s,t){return s(t)},hLiuI:function(s,t){return s|t},DLfVy:function(s,t){return s+t},xrrud:"index out of range: ",nRQyY:r(764),PiIRO:" > ",fnMbb:function(s,t){return s&t},CxCBg:function(s,t){return s+t},foMoA:function(s,t){return s+t},oSeNH:function(s,t,n){return s(t,n)},YJcYz:"0|2|3|4|1",tTWkV:function(s,t,n,o){return s(t,n,o)},ORqGV:function(s,t){return s+t},gtcrb:function(s,t,n,o){return s(t,n,o)},YjnEb:r(1373),adkVz:function(s,t){return s|t},AsErv:function(s,t){return s|t},ItcjR:function(s,t){return s<<t},ROuSw:function(s,t){return s+t},sbMfg:function(s,t){return s+t},aYdCX:function(s,t){return s+t},eLsun:function(s,t){return s+t},aEdUJ:function(s,t){return s&t},znuLN:function(s,t){return s+t},IRdHg:function(s,t){return s&t},ymxGc:function(s,t){return s>>>t},xgbdX:function(s,t){return s+t},BZfRx:function(s,t){return s>>>t},XVkvl:function(s,t){return s+t},tUYjA:function(s,t,n,o){return s(t,n,o)},WwPnY:r(737),qbVdd:function(s,t){return s&t},slIpm:function(s,t){return s+t},QysxJ:function(s,t){return s!==t},AVuKw:r(1237),bzOys:r(999),lyNmS:function(s,t){return s>>>t},bJQLj:function(s,t){return s<<t},SMKFx:function(s,t){return s&t},NBgwy:function(s,t){return s<t},HuNrg:function(s,t){return s|t},IVSfB:function(s,t){return s&t},ILEIG:function(s,t){return s<t},crvsj:"XxLRc",EdYVp:function(s,t){return s<t},LVpeA:function(s,t){return s(t)},tSMFW:function(s,t){return s===t},AZIqV:r(233),MLaQS:r(506)+r(517)+"|1|0|7",BiocV:r(619)+r(473),RWqgJ:function(s,t,n,o){return s(t,n,o)},ovuon:r(1466),dsehi:function(s,t){return s!==t},HNtui:r(318),wQIaa:function(s,t){return s(t)},tjoHJ:function(s,t){return s<t},BkHYP:function(s,t,n){return s(t,n)},tDkhJ:r(303)+"ame",kaDIO:function(s,t,n,o){return s(t,n,o)},ypCTR:"CONTINUE",NySLH:function(s,t,n,o){return s(t,n,o)},YvgiI:function(s){return s()},GUROo:function(s,t){return s===t},yPutS:r(922),NhtqP:function(s,t){return s(t)},LJpPt:r(567)+"r",OsDYH:function(s,t){return s!==t},aosnO:r(876),jrtGI:function(s,t){return s>>>t},FAgJG:function(s,t){return s&t},kgDWh:function(s,t){return s>>>t},idtvw:function(s,t){return s(t)},hToJm:function(s,t){return s&t},DGGJX:function(s,t){return s!==t},jRecm:r(712),XkdAO:function(s,t,n){return s(t,n)},BumRX:"x_fronti"+r(707),rfXHm:function(s,t,n){return s(t,n)},ZcFXJ:"x_frontier_ttl",cUZyL:r(956)+"s",mzWIK:r(328)+r(1356)+"e",vWVkv:function(s,t){return s(t)},KCUGK:"x-msg-cu"+r(539)+"ue",cWpjp:function(s){return s()},cFNDk:function(s,t){return s!==t},wiaiZ:r(1528),ifGns:r(211),uCBXi:function(s){return s()},kpSwT:function(s){return s()},JOcTK:function(s){return s()},pzuBq:function(s,t){return s===t},pInnU:function(s){return s()},cqMDm:function(s){return s()},yQdKy:function(s,t){return s!==t},dpluu:function(s,t){return s!==t},LbYMF:function(s,t,n){return s(t,n)},FnHjM:function(s){return s()},Ayunk:function(s,t,n,o){return s(t,n,o)},RCKKK:function(s,t,n){return s(t,n)},zCwcJ:function(s,t){return s instanceof t},mOaGi:function(s,t){return s+t},kNEou:function(s,t){return s===t},PMCvi:"always",MAieH:function(s,t){return s===t},UmOti:"XfrEp",dGWGN:function(s,t,n){return s(t,n)},qXIwb:r(1522),RNyij:function(s,t){return s<<t},xmlqp:r(1261),ynvLK:function(s,t){return s!==t},gSIUW:"arraybuffer",GJSMP:r(353),YdbvV:function(s,t){return s(t)},myfUr:r(1400)+r(1126)+r(1631)+", WebSoc"+r(340)+r(485)+r(1227)+"ined",Eulns:"IPGqU",AhQPR:function(s,t){return s>>>t},ogMLc:function(s,t){return s&t},FNgPa:function(s,t){return s&t},rfaQl:function(s,t){return s+t},OIZsV:r(1579),jHGMW:r(421)+"t",dcVXv:r(639),WxbmP:r(1470),QcpmD:function(s,t){return s!=t},oEHEG:r(872)+"le",QhOCP:function(s,t){return s===t},MDsiN:r(371),pQJlK:r(534),GlHWZ:"wss://",WmtgT:r(1013),SvBxN:r(1474),QkYNX:"device_id",hUBvH:function(s,t){return s||t},fwQGG:r(1303),jiyVN:function(s){return s()},eEXDE:r(825),WtadS:r(1599)+"0",HKOCk:function(s,t){return s instanceof t},njqDY:function(s,t,n){return s(t,n)},NaHmN:function(s,t){return s>t},QxeyC:function(s,t){return s-t},cuksL:function(s,t,n){return s(t,n)},lAdQm:"LHWWh",cmMbQ:function(s,t){return s(t)},dCfrz:function(s,t,n){return s(t,n)},nlSFz:r(1559),PkJjV:r(1281)+">",JRfGK:"Qgyzw",hCJid:function(s,t){return s===t},gDBZO:function(s,t){return s>>>t},Wqajr:function(s,t){return s|t},tklED:function(s,t){return s<<t},uhIEp:r(1151),BmNsg:function(s,t,n){return s(t,n)},AmyQj:r(1019),fGLVo:r(1609),rYPvH:function(s,t){return s(t)},QNkzy:"bbrkA",yBGTs:"HVuMy",UsXNW:function(s,t){return s===t},RfOEt:r(1199),vkAyf:r(1289)+"4",GPYsL:r(769)+"0",GYxzG:function(s,t){return s!==t},COCQb:r(354),uzVUC:"bye",PLCrG:r(1660)+"ay, netw"+r(1533)+"ine",AZkWY:r(1211),qOluy:r(904),TbtFe:r(488),oUYTM:r(925)+r(1423),pzBhX:r(435)+r(1097)+r(234)+r(906)+"ed",PFbpX:"please p"+r(772)+r(189)+r(1384)+r(696)+r(1137)+r(184)+r(648)+r(1457),haJSB:r(612),Tmrkv:function(s,t){return s instanceof t},nbBqc:function(s,t){return s(t)},egTFi:function(s,t){return s||t},DzMDJ:r(1400)+r(772)+" valid s"+r(224),WfZmP:function(s,t){return s instanceof t},eKTeI:function(s,t){return s(t)},KmTdl:r(1350),bCPfW:"enqueue",FlpYK:function(s,t){return s||t},hVwrW:function(s,t){return s!==t},ccspS:"manual r"+r(1305)+r(1368),lIrhD:function(s,t){return s+t},rsHMF:r(1159),adbVo:r(1239),qyNhm:function(s,t){return s/t},IunlJ:function(s,t){return s===t},JWaFG:"Window",CbAvD:function(s,t){return s!=t},GIJWY:function(s,t){return s===t},IetPD:r(346),mUEQL:function(s,t){return s!=t},HyUya:r(597)+"rkerGlob"+r(933),tzcvS:r(531)+r(210)+r(566),qbVqK:function(s,t){return s!=t},tWsAk:function(s,t){return s!=t},OdrDq:function(s,t){return s!=t},PEqqK:"__x_msg_"+r(445)};Se.r(V),Se.d(V,{FWS:()=>Ba,CustomErrorEvent:()=>ts,createCloseEvent:()=>he,ReconnectEvent:()=>es,createErrorEvent:()=>xe,decodedFrame:()=>Yr,createOpenEvent:()=>as,CustomCloseEvent:()=>ns,createReconnectEvent:()=>Jn,FrontierMessageEvent:()=>ss,encodeFrame:()=>jn,createMessageEvent:()=>os,OpenEvent:()=>is,ErrorCode:()=>Me,Event:()=>nt,MessageEvent:()=>rs});let i="";function a(s=""){let t=r,n="02",o=""+Date[t(1205)](),c=i||(i=e.Oxcgz(m,s)),l=Math.random()[t(382)](16)[t(1612)](-6);return e[t(1332)](n+o,c)+l}function x(){let s=r;return e[s(1192)](1e4,Date[s(1205)]())+Math.floor(e.opbXc(1e4,Math.random()))}function f(s){let t=r;return e[t(1332)](Array(8).join("0"),e[t(1605)](parseInt,s,10)[t(382)](2)).slice(-8)}function d(s){let t=r;return(e[t(653)](Array,4).join("0")+e[t(694)](parseInt,s,2)[t(382)](16))[t(1612)](-4)}function h(s){let t=r,n=s[t(914)](/\./).map(l=>f(l)),o=[];return o[0]=e[t(1166)](d,e[t(1259)](n[0],n[1])),o[1]=d(e[t(1259)](n[2],n[3])),[e[t(868)],e.tNRwW,e[t(868)],e[t(868)],e.tNRwW,t(674),o[0],o[1]][t(208)]("")}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}/.test(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(301)](s);return n?e.TDVPX(h,s):o?e[t(528)](w,s):e[t(312)]}function w(s){let t=r,n={MxYQV:function(_,b){return e[P(1098)](_,b)},miSrr:function(_,b){return e.tzGbn(_,b)},kLQDd:function(_,b){return e[P(1483)](_,b)},gKJdn:function(_,b){return e[P(1176)](_,b)},xlwaM:function(_,b){return _&b}},o="",c=[],l=0,p=0,g=!0,u=t(504);if(s[t(1158)]("::")>-1)if(e[t(799)]===e[t(799)]){let _=s.split("::");for(let A=0;e[t(1497)](A,_[t(1240)]);A++)if(t(725)===t(1038)){let S={KpcQB:function(k,M){return e[t(803)](k,M)}},C=_0xb419e2[t(378)+t(1224)](e[t(871)]);_0x25480d[t(409)+t(395)]=k=>{let M=t;_0x58f461[M(1174)][M(1498)+M(1248)](C),_0x2c758b[M(409)+M(395)]=void 0,S.KpcQB(_0x9598a3,k&&k[M(754)]||M(1025)+M(751))},C.type=t(866)+t(320),C.src=_0x159069.replace(/^ws/,e[t(548)])+e[t(1106)];try{_0x43abe5[t(1174)].appendChild(C)}catch{_0x53640e[t(1174)][t(1498)+t(1248)](C)}}else{let S=_[A];if(e[t(958)](S[t(1158)](":"),0)){let C=S[t(914)](":");g&&(l=C.length),p+=C[t(1240)];for(let k=0;e[t(623)](k,C[t(1240)]);k++)if(e.ZxEdy(4,C[k][t(1240)])){let M=u[t(1108)+"g"](0,e[t(228)](4,C[k][t(1240)])),ee=M[t(1606)](C[k]);c[t(361)](ee)}else c[t(361)](C[k]);g=!1}else{if(S[t(1240)]!==4){let C=u[t(1108)+"g"](0,e[t(606)](4,S[t(1240)])),k=C[t(1606)](S);c[t(361)](k)}else c.push(S);g&&(l+=1),p+=1,g=!1}}let b="";for(let A=0;e.JAChY(A,e[t(228)](8,p));A++)b=b[t(1606)](u);for(let A=0;A<c[t(1240)];A++)if(e[t(380)](A,l))if(e.ZLNRY!==e[t(798)])o=o[t(1606)](b),o=o[t(1606)](c[A]);else return e[t(1135)](_0x1862f8,_0x57aa4f);else o=o[t(1606)](c[A]);return o}else _0x484f3b[_0x32e326++]=n[t(1348)](_0x52a4e4,12)|224,_0x494d45[_0x1be7a3++]=n[t(1198)](n.kLQDd(n[t(1426)](_0x3171c6,6),63),128),_0x1d6b5f[_0x1f2c3f++]=n[t(404)](63,_0x770c6d)|128;{let _=s[t(914)](":");for(let b=0;e[t(1164)](b,_[t(1240)]);b++){let A=_[b];if(e[t(1327)](4,_[b][t(1240)])){let S=u[t(1108)+"g"](0,e.JYBzt(4,_[b].length)),C=S[t(1606)](A);o=o[t(1606)](C)}else o=o[t(1606)](A)}return o}}function v(s,t){let n=r,o=s[n(1640)];if(e[n(718)](void 0,o))if(e[n(575)](e[n(1277)],e[n(716)]))e[n(844)](F,t,10),e[n(644)](ye,t,o);else return this[n(306)][n(1275)];let c=s[n(1575)];if(e.ZxEdy(void 0,c))if(e.YiJnb(e[n(1637)],e[n(1637)]))F(t,18),e[n(844)](ye,t,c);else{let{initReconnectInterval:l,maxReconnectInterval:p,reconnectIntervalGrowFactor:g}=this._options,u=e[n(1192)](l,_0x1b594c.pow(g,e[n(823)](_0x554aa0,1)));return e[n(1633)](u,p)?p:u}}function y(s){let t=r,n={};e:for(;!e[t(803)](_e,s);){let o=e.ilXMG(Y,s);switch(e[t(654)](o,3)){case 0:break e;case 1:n[t(1640)]=e[t(244)](we,s,e.Oxcgz(Y,s));break;case 2:n[t(1575)]=e.gxDQF(we,s,e[t(1494)](Y,s));break;default:e.YWYao(Q,s,e[t(1127)](7,o))}}if(e[t(380)](void 0,n[t(1640)]))throw new Error(t(656)+t(379)+t(270)+t(1640));if(e[t(380)](void 0,n[t(1575)]))throw new Error(e[t(311)]);return n}function I(s){let t=r,n={htVBm:function(o,c){return e[P(1310)](o,c)},FJVVT:function(o,c){return e[P(1555)](o,c)},NXQrv:function(o,c){return e[P(1259)](o,c)},EEFEF:function(o,c){return e[P(207)](o,c)}};if(e[t(1262)](e[t(201)],e[t(994)])){let c=""+_0x4fffbe[t(1205)](),l=_0x3c849b||(_0x2a2174=nuZseE[t(290)](_0x58ef48,_0x49e36)),p=_0x362b12.random().toString(16).slice(-6);return nuZseE.FJVVT(nuZseE[t(1218)](nuZseE[t(668)]("02",c),l),p)}else{let o=e[t(386)](L);return e.nQOst(T,s,o),e.ilXMG(me,o)}}function T(s,t){let n=r,o=s.SeqID;e[n(565)](void 0,o)&&(e[n(537)](F,t,8),e.HBUOF(wt,t,o));let c=s[n(486)];e[n(565)](void 0,c)&&(e.LJytw(F,t,16),e[n(244)](wt,t,c));let l=s[n(1269)];if(e.QSYcu(void 0,l)){if(e[n(718)](e[n(705)],n(637)))return this._ws?this._ws.extensions:"";e.YWYao(F,t,24),e[n(644)](wt,t,re(l))}let p=s[n(616)];e.giFMJ(void 0,p)&&(e[n(600)](F,t,32),wt(t,e[n(867)](re,p)));let g=s[n(1171)];if(e[n(398)](void 0,g))for(let M of g){e.wWtnh(F,t,42);let ee=e[n(974)](L);v(M,ee),F(t,ee[n(1288)]),Wn(t,ee),e.xcsbb(q,ee)}let u=s[n(627)+"ncoding"];u!==void 0&&(e[n(603)](F,t,50),e[n(244)](ye,t,u));let _=s[n(456)+n(1003)];e[n(718)](void 0,_)&&(e.xsfmT(F,t,58),e.nQOst(ye,t,_));let b=s[n(1641)];b!==void 0&&(F(t,66),e[n(845)](F,t,b[n(1240)]),e[n(523)](qt,t,b));let A=s[n(1414)];A!==void 0&&(e[n(844)](F,t,74),ye(t,A));let S=s[n(1236)+n(441)];e[n(226)](void 0,S)&&(e[n(1222)](F,t,82),ye(t,S));let C=s.msgID;e.UASQW(void 0,C)&&(F(t,90),e[n(1183)](ye,t,C));let k=s.frameType;e[n(437)](void 0,k)&&(e[n(603)](F,t,96),e.GfLFF(wt,t,e[n(1287)](re,k)))}function N(s){let t=r;return e.OicuG(O,e[t(867)](Z,s))}function O(s){let t=r;if(e.rEIHP!==e[t(570)])_0x57aa86+=_0x23c132(_0x4fd316),_0x491dbe+=2;else{let n={};e:for(;!e.SnVIb(_e,s);){let o=e[t(867)](Y,s);switch(e[t(654)](o,3)){case 0:break e;case 1:n[t(297)]=e.eWWTK(Vr,s,!0);break;case 2:n[t(486)]=Vr(s,!0);break;case 3:n.service=e.GNILW(Y,s);break;case 4:n[t(616)]=e[t(1135)](Y,s);break;case 5:{let c=e[t(1105)](H,s);(n[t(1171)]||(n.headers=[]))[t(361)](e[t(1542)](y,s)),s[t(1288)]=c;break}case 6:n.payloadEncoding=we(s,e.jxYpK(Y,s));break;case 7:n["payloadT"+t(1003)]=e[t(1123)](we,s,e.UPBJQ(Y,s));break;case 8:n.payload=e[t(523)](zt,s,Y(s));break;case 9:n[t(1414)]=we(s,Y(s));break;case 10:n[t(1236)+t(441)]=e[t(622)](we,s,e[t(653)](Y,s));break;case 11:n[t(1596)]=we(s,e.QGBAm(Y,s));break;case 12:n[t(499)+"e"]=e[t(1195)](Y,s);break;default:e[t(615)](Q,s,e[t(1483)](7,o))}}if(e[t(330)](void 0,n[t(297)]))throw new Error(e[t(1152)]);if(e[t(1262)](void 0,n[t(486)]))throw new Error(t(656)+t(379)+" field: LogID");if(e[t(1262)](void 0,n[t(1269)]))throw new Error(e.hTIBx);if(n[t(616)]===void 0)throw new Error(t(656)+"required"+t(270)+"method");return n}}function H(s){let t=r,n=e[t(545)](Y,s),o=s[t(1288)];return s.limit=e[t(207)](s[t(1160)],n),o}function Q(s,t){let n=r;switch(t){case 0:for(;128&e[n(212)](se,s););break;case 2:e[n(1183)](De,s,Y(s));break;case 5:e[n(1178)](De,s,4);break;case 1:e[n(1046)](De,s,8);break;default:throw new Error(e[n(1548)]+t)}}function re(s){let t=r;return s|=0,{low:s,high:e[t(436)](s,31),unsigned:e[t(365)](s,0)}}let Ae=[];function L(){let s=r,t=Ae[s(1184)]();return t?(t[s(1160)]=t[s(1288)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function q(s){Ae[r(361)](s)}function Z(s){return{bytes:s,offset:0,limit:s[r(1240)]}}function me(s){let t=r,n=s[t(482)],o=s[t(1288)];return e[t(330)](n[t(1240)],o)?n:n[t(740)](0,o)}function De(s,t){let n=r;if(e.UeZlj(e.brlvG(s[n(1160)],t),s.limit))throw new Error(e[n(1010)]);s[n(1160)]+=t}function _e(s){let t=r;return s.offset>=s[t(1288)]}function le(s,t){let n=r;if(e[n(1262)](e[n(673)],e[n(288)])){let o=this._qosDB["getStora"+n(645)](this[n(930)]),c=_0x17df6a[n(1250)](e[n(1626)](o,"{}"));return c[_0x220dee]=void 0,this[n(306)][n(408)+n(645)](this[n(930)],_0x31d5f5.stringify(c))}else{let o=s.bytes,c=s[n(1160)],l=s.limit,p=c+t;if(e[n(1633)](p,o[n(1240)])){let g=new Uint8Array(e.KRiZf(2,p));g.set(o),s.bytes=g}return s[n(1160)]=p,p>l&&(s.limit=p),c}}function We(s,t){let n=r,o=s[n(1160)];if(e[n(1332)](o,t)>s[n(1288)])throw new Error(n(538)+n(1077));return s[n(1160)]+=t,o}function zt(s,t){let n=r,o=e[n(1605)](We,s,t);return s[n(482)][n(740)](o,o+t)}function qt(s,t){let n=r;if(e.UASQW(e[n(987)],e[n(1476)])){let o=e[n(524)](le,s,t[n(1240)]);s[n(482)][n(454)](t,o)}else{let o=this[n(306)][n(1216)](this[n(930)]),c=_0x5c131a[n(1250)](o||"{}");return c[_0x1a1c53]=void 0,this._qosDB[n(1276)](this[n(930)],_0x3c9d29[n(1412)+"y"](c))}}function we(s,t){let n=r,o={YkNqO:function(_,b,A){return _(b,A)}},c=e[n(848)](We,s,t),l=String[n(804)+"Code"],p=s[n(482)],g="\uFFFD",u="";for(let _=0;e[n(1497)](_,t);_++){let b=p[e[n(1453)](_,c)],A,S,C,k;e.wwJPC(128&b,0)?u+=e.baohm(l,b):e[n(380)](e[n(1127)](224,b),192)?e.xwTka(e[n(1173)](_,1),t)?u+=g:(A=p[e[n(510)](e[n(1332)](_,c),1)],e[n(1483)](192,A)!==128?u+=g:(k=e.YQVwf(e[n(258)](e[n(191)](31,b),6),e[n(571)](63,A)),k<128?u+=g:(u+=l(k),_++))):e[n(1590)](e[n(878)](240,b),224)?_+2>=t?u+=g:(A=p[_+c+1],S=p[e.brlvG(e[n(1584)](_,c),2)],e[n(1122)](e.cIZwk(e[n(1057)](A,e.ghoWY(S,8)),49344),32896)?u+=g:(k=e[n(258)](e[n(1483)](15,b),12)|e[n(281)](63,A)<<6|e[n(896)](63,S),k<2048||e[n(916)](k,55296)&&e.dliwK(k,57343)?u+=g:(u+=e[n(343)](l,k),_+=2))):e[n(1483)](248,b)==240?e[n(620)](_+3,t)?u+=g:e.YjADo===e[n(1662)]?o[n(760)](_0x1bef08,_0x2b94bd,this[n(433)+"rvalValue"](_0x1e8a04)):(A=p[_+c+1],S=p[e[n(703)](e[n(1568)](_,c),2)],C=p[e[n(1259)](_,c)+3],e[n(718)](e[n(1007)](e[n(1591)](A,e[n(820)](S,8))|e[n(820)](C,16),12632256),8421504)?u+=g:(k=e[n(1057)](e[n(909)](e[n(1564)](e[n(878)](7,b),18),e[n(258)](63&A,12)),e[n(598)](63,S)<<6)|63&C,e.LoRmQ(k,65536)||k>1114111?u+=g:(k-=65536,u+=e.aumJc(l,(k>>10)+55296,e[n(1385)](1023,k)+56320),_+=3))):u+=g}return u}function ye(s,t){let n=r,o={tfhbO:e.SNNKI,DfSSy:n(639),KdQWB:e[n(213)]},c=t[n(1240)],l=0;for(let u=0;e[n(647)](u,c);u++)if(e[n(509)](e[n(1200)],e[n(741)]))_0x195b44(_0x1afe48,24),e.kzrIP(_0x4bfe5a,_0x114a08,e[n(1310)](_0x1181b6,_0x151d6d));else{let _=t[n(915)+"At"](u);e[n(1086)](_,55296)&&e.dliwK(_,56319)&&e[n(188)](e[n(514)](u,1),c)&&(_=e[n(698)](e[n(514)](e[n(820)](_,10),t.charCodeAt(++u)),56613888)),l+=e.hftiP(_,128)?1:_<2048?2:e[n(188)](_,65536)?3:4}F(s,l);let p=e[n(411)](le,s,l),g=s[n(482)];for(let u=0;e[n(1497)](u,c);u++){let _=t.charCodeAt(u);e.cdLhK(_,55296)&&e[n(1534)](_,56319)&&e.OPiCM(u+1,c)&&(_=e[n(941)](e.LnYsH(e.XIuxi(_,10),t.charCodeAt(++u)),56613888)),e[n(647)](_,128)?g[p++]=_:(_<2048?g[p++]=e.YQVwf(e[n(878)](e[n(758)](_,6),31),192):e[n(1586)]!==e[n(1586)]?(this[n(225)+"er"]&&_0x421505.addEventListener(o[n(1392)],this["_handleO"+n(337)]),this._isBrowser&&_0xfdfe47[n(252)+n(1679)](o[n(267)],this[n(1156)+"ffLine"]),this[n(225)+"er"]&&_0x18f2a1["addEvent"+n(1679)](o.KdQWB,this[n(1225)+n(1016)]),this[n(225)+"er"]&&_0x19fb57["addEvent"+n(1679)](n(1470),this[n(1225)+n(341)])):(_<65536?g[p++]=e.Eczjx(e[n(1176)](_,12),15)|224:(g[p++]=e[n(1591)](e[n(1235)](e[n(640)](_,18),7),240),g[p++]=e.YQVwf(e[n(670)](_,12)&63,128)),g[p++]=e[n(884)](e[n(785)](_>>6,63),128)),g[p++]=e[n(1114)](e[n(878)](63,_),128))}}function Wn(s,t){let n=r,o=e[n(1068)](le,s,t[n(1288)]),c=s[n(482)],l=t[n(482)];for(let p=0,g=t.limit;e[n(1632)](p,g);p++)c[e[n(1416)](p,o)]=l[p]}function se(s){let t=r;return s[t(482)][e[t(491)](We,s,1)]}function be(s,t){let n=r,o=le(s,1);s[n(482)][o]=t}function Y(s){let t=r,n=0,o=0,c;do c=e.UszsX(se,s),e.AARxo(n,32)&&(o|=e[t(1564)](e[t(749)](127,c),n)),n+=7;while(e[t(1667)](128,c));return o}function F(s,t){let n=r;if(e.kSsBP===e[n(1102)])this[n(370)+"igatorOnline"]=_0x25aac3,_0x526afd?this[n(1156)+"nLine"]():this[n(1156)+n(745)]();else{for(t>>>=0;e[n(1157)](t,128);)e[n(644)](be,s,e[n(1483)](127,t)|128),t>>>=7;e.EQNKC(be,s,t)}}function Vr(s,t){let n=r,o={WuFpn:e.IGUfF,noCcE:e[n(1285)],lPTMF:function(u,_,b,A){return e[n(1370)](u,_,b,A)},mDjSl:e[n(704)],ulmFy:e[n(672)],ZKBQJ:function(u,_){return e[n(920)](u,_)},MwdNo:function(u,_){return e[n(733)](u,_)}},c=0,l=0,p=0,g;if(g=e[n(394)](se,s),c=e[n(939)](127,g),128&g&&(g=se(s),c|=e[n(258)](127&g,7),128&g&&(g=e.UPBJQ(se,s),c|=e.PGacm(e[n(1570)](127,g),14),128&g)))if(e[n(468)]("CnHbz",e[n(665)])){if(g=e.yoEYM(se,s),c|=e[n(1456)](e[n(197)](127,g),21),e[n(1127)](128,g)&&(g=e.cnRgL(se,s),l=e.OCqbM(127,g),128&g&&(g=e[n(1643)](se,s),l|=e.XIuxi(e[n(1483)](127,g),7),128&g))){if(e[n(765)](e.ZnYes,e.akqfy))_0x299577.log(_0x554625);else if(g=e[n(1135)](se,s),l|=e[n(1564)](127&g,14),128&g&&(g=e[n(706)](se,s),l|=e[n(820)](e[n(1667)](127,g),21),e[n(470)](128,g)))if(e[n(494)](n(816),e[n(1485)]))try{return!!this[n(306)]}catch(u){return _0xc38d68[n(474)](u),!1}else g=e[n(400)](se,s),p=e[n(749)](127,g),e[n(1667)](128,g)&&(g=se(s),p|=e[n(1456)](e[n(658)](127,g),7))}}else{let u={gXQkJ:o[n(1074)],TLsrP:n(473),pBIgR:o[n(358)],bHxPX:function(C,k,M,ee){return o[n(1018)](C,k,M,ee)},vhSMQ:o[n(1490)],mGDcY:"service-"+n(473),tnvCn:o[n(1255)]},[_,b]=o[n(214)](_0x14ab78,_0x41c402),A=o[n(1182)](_0x2a1891,_),S=0;return _0x42abc3.forEach(C=>{let k=n,M=u[k(1347)][k(914)]("|"),ee=0;for(;;){switch(M[ee++]){case"0":_0xd12de4[k(474)](u[k(1299)],S);continue;case"1":_0x36bba5.log(u.pBIgR,S);continue;case"2":S=u[k(223)](_0x568d27,_0x321d59[k(1069)+"er"](C[k(1270)]||_0x1f09ff),A,S);continue;case"3":S=u[k(223)](_0x648f9b,b[C.cursor_name],A,S);continue;case"4":S=_0x1c2662(A,S,C[k(1269)]||0);continue;case"5":_0x5d56c2[k(474)](u.vhSMQ,S);continue;case"6":S=_0xd09257(C.cursor_name,A,S);continue;case"7":_0x2d726e.log(u[k(646)],S);continue;case"8":_0x18c612[k(474)](k(1466),S);continue;case"9":_0x5184d4[k(474)](u[k(1036)],C,C.service);continue;case"10":S=_0x50ede7(0,A,S);continue}break}}),{frameType:_0x4598d8,headers:[{key:n(500)+n(1054),value:_0x2b38b1}],payload:A}}return{low:e[n(928)](c,l<<28),high:e[n(1114)](e.GUwax(l,4),e.XIuxi(p,24)),unsigned:t}}function wt(s,t){let n=r,o=e[n(849)](t[n(657)],0),c=e[n(1507)](t[n(657)]>>>28,e[n(1263)](t.high,4))>>>0,l=e[n(1307)](t[n(1521)],24),p=l===0?e.YVALa(0,c)?e[n(623)](o,16384)?e[n(688)](o,128)?1:2:e[n(1164)](o,2097152)?3:4:e[n(1164)](c,16384)?c<128?5:6:c<2097152?7:8:e.iaoSw(l,128)?9:10,g=e[n(615)](le,s,p),u=s[n(482)];switch(p){case 10:u[e[n(686)](g,9)]=e.AdsmG(e[n(1617)](l,7),1);case 9:u[e[n(1628)](g,8)]=e[n(437)](9,p)?e.tzGbn(128,l):e.DBfzT(127,l);case 8:u[g+7]=p!==8?e[n(1185)](c>>>21,128):e[n(1634)](e[n(1027)](c,21),127);case 7:u[e[n(1628)](g,6)]=e[n(315)](7,p)?e[n(1057)](e[n(265)](c,14),128):e[n(1246)](e[n(412)](c,14),127);case 6:u[e[n(1555)](g,5)]=e.cFsBV(6,p)?c>>>7|128:e[n(900)](c>>>7,127);case 5:u[e[n(880)](g,4)]=e[n(724)](5,p)?128|c:e[n(683)](127,c);case 4:u[e[n(1555)](g,3)]=e[n(398)](4,p)?e[n(909)](o>>>21,128):e[n(595)](e[n(294)](o,21),127);case 3:u[e[n(1453)](g,2)]=p!==3?e[n(928)](e[n(431)](o,14),128):e[n(191)](e[n(347)](o,14),127);case 2:u[g+1]=e[n(805)](2,p)?e.osEPo(o>>>7,128):e[n(1547)](o>>>7,127);case 1:u[g]=e[n(805)](1,p)?e.qrrJg(128,o):127&o}}function Yr(s){return N(s)}function jn(s){return I(s)}let Xr=65536,Jo=e[r(1461)],et=e[r(1428)](Xr,Xr),$r=et*et,Zr=e[r(1011)]($r,2),Be=String[r(1031)+"e"][r(915)+"At"];class B{constructor(t,n,o){let c=r;this[c(1509)]=!0,this.low=0|t,this.high=e[c(1578)](0,n),this[c(1070)]=!!o}static[r(1509)](t){let n=r;return t&&e[n(468)](!0,t[n(1509)])}static[r(246)](t,n,o){return new B(t,n,o)}static[r(815)+"s"](t,n,o){let c=r;if(e.psHjZ(e.MIOpW,e[c(317)]))this[c(795)+"sCounter"]?.[c(717)](),this[c(1663)](e[c(1107)],e[c(1402)]),this[c(795)+"sCounter"]?.[c(892)+c(888)+"nt"]()?this[c(463)+c(1305)]():this[c(748)]();else return o?B[c(815)+"sLE"](t,n):B[c(815)+c(1495)](t,n)}static[r(815)+"sLE"](t,n){let o=r;return new B(e[o(1088)](e[o(790)](e[o(634)](t[0],t[1]<<8),e.qUTCr(t[2],16)),e[o(808)](t[3],24)),e[o(790)](e.JbjKs(e[o(255)](t[4],e[o(556)](t[5],8)),t[6]<<16),e[o(935)](t[7],24)),n)}static[r(815)+r(1495)](t,n){let o=r;return new B(e[o(1514)](e[o(1519)](e.Tejrm(t[4]<<24,e[o(808)](t[5],16)),e[o(1300)](t[6],8)),t[7]),e[o(1410)](e[o(702)](e.JBkQm(e[o(1456)](t[0],24),t[1]<<16),t[2]<<8),t[3]),n)}static[r(196)](t){let n=r;return e.EicbH(t,Jo)?Qr:new B(e.SQpQc(e[n(928)](Be.call(t,0),e[n(1300)](Be[n(988)](t,1),8))|e[n(833)](Be[n(988)](t,2),16)|e[n(556)](Be[n(988)](t,3),24),0),e[n(735)](e[n(1088)](e.FSeHq(e.pppVp(Be[n(988)](t,4),e[n(1238)](Be[n(988)](t,5),8)),e[n(820)](Be[n(988)](t,6),16)),e[n(1300)](Be[n(988)](t,7),24)),0),!0)}[r(1680)](){let t=r;return String[t(804)+t(1229)](e[t(1634)](255,this[t(657)]),e[t(1127)](this[t(657)]>>>8,255),e.RaKhO(e.iNqyD(this[t(657)],16),255),e[t(811)](this[t(657)],24),255&this[t(1521)],e[t(857)](this.high>>>8,255),e[t(470)](e[t(1209)](this[t(1521)],16),255),e[t(183)](this[t(1521)],24))}static[r(1069)+"er"](t,n=!0){let o=r;if(isNaN(t))return n?Vo:Qr;if(n){if(e[o(916)](t,$r))return Xo}else if(e[o(231)](e[o(1230)],e[o(752)])){if(e[o(969)](t,-Zr))return $o;if(e[o(530)](e[o(1465)](t,1),Zr))return Yo}else this.on(_0x40fa04,_0x1a6199);return B[o(246)](e[o(1138)](e[o(555)](t,et),0),e.khexF(t,et)|0,n)}[r(1622)](){let t=r;return this.unsigned?e[t(1428)](e[t(1617)](this.high,0),et)+e[t(811)](this.low,0):e[t(881)](e[t(1186)](this[t(1521)],et),e.DxKGe(this.low,0))}[r(296)](){let t=r;return e.wwJPC(0,this[t(1521)])&&e[t(1129)](0,this[t(657)])}[r(477)](t){let n=r;B[n(1509)](t)||(t=B.fromNumber(t));let o=this.high>>>16,c=e.SzjbL(65535,this[n(1521)]),l=e[n(1617)](this[n(657)],16),p=65535&this[n(657)],g=e[n(811)](t[n(1521)],16),u=e[n(857)](65535,t[n(1521)]),_=e[n(849)](t.low,16),b=e.BJDdJ(65535,t[n(657)]),A=0,S=0,C=0,k=0;return k+=e[n(542)](p,b),C+=e[n(849)](k,16),k&=65535,C+=e[n(686)](l,_),S+=e[n(1592)](C,16),C&=65535,S+=e[n(1223)](c,u),A+=S>>>16,S&=65535,A+=e[n(514)](o,g),A&=65535,B[n(246)](e[n(634)](C<<16,k),e[n(613)](e.lUaOO(A,16),S),this.unsigned)}[r(1073)](t){let n=r;return B[n(1509)](t)||(t=B.fromNumber(t)),this[n(1070)]!==t[n(1070)]&&e[n(412)](this.high,31)===1&&e.XTDrd(t[n(1521)],31)===1?!1:e[n(330)](this[n(1521)],t[n(1521)])&&e[n(509)](this[n(657)],t[n(657)])}addOne(){let t=r;return e[t(765)](-1,this[t(657)])&&e[t(438)](-1,this[t(1521)])?B[t(246)](0,0,this[t(1070)]):e[t(1274)](-1,this.low)?B[t(246)](0,e[t(996)](this[t(1521)],1),this.unsigned):B[t(246)](e[t(691)](this[t(657)],1),this[t(1521)],this[t(1070)])}[r(1155)](t){return t?this.toBytesLE():this[r(1475)+"E"]()}[r(1666)+"E"](){let t=r,n=this[t(1521)],o=this[t(657)];return[255&o,e[t(939)](o>>>8,255),e[t(347)](o,16)&255,e[t(763)](o,24),255&n,e[t(1307)](n,8)&255,e[t(512)](e[t(1524)](n,16),255),e[t(854)](n,24)]}[r(1475)+"E"](){let t=r,n=this.high,o=this.low;return[n>>>24,e[t(878)](n>>>16,255),e[t(1007)](n>>>8,255),e.Eczjx(255,n),e.aoxiV(o,24),e.CNCpW(e.XTDrd(o,16),255),e.RaKhO(e.XTDrd(o,8),255),e[t(1005)](255,o)]}}let Qr=new B(0,0,!1),Vo=new B(0,0,!0),Yo=B[r(246)](-1,2147483647,!1),Xo=B.fromBits(-1,-1,!0),$o=B[r(246)](0,-2147483648,!1);var Me=(function(s){let t=r,n={frLIG:e.OVGZT};if(e[t(487)]!==e[t(1438)]){let o=e[t(540)].split("|"),c=0;for(;;){switch(o[c++]){case"0":s[s[e[t(719)]]=5003]=e[t(719)];continue;case"1":s[s[e[t(692)]]=5004]=e.RRfXv;continue;case"2":s[s.OPEN_ERROR=5005]=e[t(671)];continue;case"3":return s;case"4":s[s[e[t(209)]]=5002]=e[t(209)];continue;case"5":s[s["NATIVE_E"+t(1361)]=5001]=e.bEljP;continue}break}}else{let o=this["_endpoin"+t(630)]?.[t(1444)+t(836)+"nt"]();this[t(453)](t(1294)+o+t(1163)),this["_disconn"+t(1034)](1001,n[t(1670)],!0)}})({});class nt{constructor(t){let n=r;this[n(1112)]=t,this.target=null}}class es extends nt{constructor(t,n){let o=r;super(t),this[o(1048)]=n&&n[o(1048)]||null}}class ts extends nt{constructor(t,n){let o=r,c=e[o(243)][o(914)]("|"),l=0;for(;;){switch(c[l++]){case"0":this[o(1491)]=n&&n[o(1491)]||0;continue;case"1":this[o(948)]=n&&n.lineno||0;continue;case"2":super(t);continue;case"3":this[o(501)]=n&&n[o(501)]||5001;continue;case"4":this[o(1048)]=n&&n[o(1048)]||"";continue;case"5":this[o(1145)]=n&&n[o(1145)]||null;continue;case"6":this.filename=n&&n[o(1318)]||"";continue}break}}}class ns extends nt{constructor(t,n){let o=r,c=e[o(1500)].split("|"),l=0;for(;;){switch(c[l++]){case"0":this[o(751)]=n&&n.reason||"";continue;case"1":this[o(283)]=n&&n.wasClean||!1;continue;case"2":this[o(501)]=n&&n[o(501)]||0;continue;case"3":super(t);continue;case"4":this[o(952)+o(241)]=n&&n[o(952)+"nnect"]||!1;continue}break}}}class rs extends nt{constructor(t,n){let o=r;super(t),this[o(1440)]=n&&n[o(1440)]||null}}class ss extends rs{constructor(t,n){let o=r;super(t),this[o(1440)]=n&&n[o(1440)]||null,this[o(1048)]=n&&n.message||null}}class is extends nt{constructor(t,n){let o=r;super(t),this.data=n&&n[o(1440)]||null}}function xe(s,{message:t,code:n,error:o}){return new ts(s,{message:t,code:n,error:o})}function he(s,{code:t,reason:n,wasClean:o,willReconnect:c}){if(r(264)!==e.CRmuj)return new ns(s,{code:t,reason:n,wasClean:o,willReconnect:c});_0x136b5f+=_0x37e12a(_0x1b5014),_0x8695b0++}function os(s,{data:t,message:n}){return new ss(s,{data:t,message:n})}function as(s,{data:t}){return new is(s,{data:t})}function Jn(s,{message:t}){return new es(s,{message:t})}class xs{constructor(t,n){let o=r;this.endpoints=t,this[o(185)+"es"]=n,this[o(1283)+"ndex"]=0,this[o(1210)+o(476)+"riesCount"]=0}[r(1506)+"pointCon"+r(519)](){let t=r;this["currentI"+t(767)]=0,this["currentEndpointT"+t(220)+"t"]=0}[r(1374)+"es"](){let t=r;this["currentE"+t(476)+t(220)+"t"]=0}[r(1444)+r(836)+"nt"](){let t=r,n={JgLVP:function(o,c){return e[P(1060)](o,c)},fJcgq:t(1266)+t(609)+t(464)+t(1468),vYuBR:e[t(334)],cgDuE:e[t(1560)],amcFA:e[t(1121)],pNbRA:function(o,c,l,p){return e[t(583)](o,c,l,p)}};if(e[t(911)]===e[t(526)]){let o=n[t(275)](this._options[t(627)+t(710)],_0x13850a)?{force:!!this._options["payloadE"+t(710)].force,encoding:this[t(886)][t(627)+t(710)].encoding?this[t(886)][t(627)+t(710)][t(890)].replace(/\s/g,"")[t(1204)+t(1424)]():""}:{force:!1,encoding:this[t(886)][t(627)+t(710)]?this[t(886)]["payloadE"+t(710)].replace(/\s/g,"")[t(1204)+t(1424)]():""},c=_0x88bcc8[t(627)+t(710)]?_0x1c0e81[t(627)+t(710)][t(875)](/\s/g,"")["toLowerC"+t(1424)]():"",l=n[t(275)](this._options[t(456)+"ype"],_0x2f6ed2)?{force:!!this._options[t(456)+"ype"][t(944)],type:this[t(886)][t(456)+"ype"][t(1112)]?this[t(886)][t(456)+t(1003)][t(1112)][t(875)](/\s/g,"").toLowerCase():""}:{force:!1,type:this._options["payloadT"+t(1003)]?this._options[t(456)+t(1003)][t(875)](/\s/g,"")[t(1204)+"ase"]():""},p=_0x47a3e3["payloadT"+t(1003)]?_0x3cc71c[t(456)+"ype"][t(875)](/\s/g,"").toLowerCase():"",g=l[t(944)]?l[t(1112)]:p||l[t(1112)],u=o[t(944)]?o[t(890)]:c||o[t(890)],_=["text/pla"+t(863)+t(662),t(1266)+t(609),n[t(677)],n[t(533)]],b=[n[t(302)],n.amcFA];this[t(886)][t(217)+t(332)+"extPayload"]&&_[t(1354)](g)&&(!u||b[t(1354)](u))?_0x27992b[t(1614)+t(1636)]=n.pNbRA(_0x5245ca,_0x1dd132[t(1641)],0,_0x28c6f5[t(1641)][t(401)+"th"]):_0x3ff145[t(1614)+t(1636)]=""}else return this.endpoints[this[t(1283)+"ndex"]]}[r(1444)+r(836)+r(699)+r(1208)](){let t=r;return e.QbBiQ(e[t(1658)],e[t(1658)])?!!(_0x1c025e||_0xecf957&&_0xced0bb["connectS"+t(701)]||_0x122e1f&&_0x25a27a[t(498)+t(701)]||(_0x300437||_0x5cb3d9)&&e.WsjMH!=typeof _0x1c1b85&&_0x2b18e6):this["currentE"+t(476)+"riesCount"]}["checkRea"+r(1330)+"es"](){let t=r;return!!(e[t(887)](this[t(1283)+t(767)],this[t(937)+"s"][t(1240)])||this[t(1283)+t(767)]===e[t(1651)](this[t(937)+"s"][t(1240)],1)&&e.LhhYo(this[t(1210)+t(476)+t(220)+"t"],this.maxRetries))}["checkCur"+r(366)+"ointReac"+r(957)+r(1405)](){let t=r;return e[t(1590)](this[t(1283)+t(767)],this[t(937)+"s"][t(1240)])?!0:e[t(532)](this[t(1210)+t(476)+t(220)+"t"],this[t(185)+"es"])}["replaceB"+r(1059)+"pointAnd"+r(222)+r(1358)](){let t=r,n={Quffd:e[t(840)],NecEe:e[t(1650)]};return e[t(1165)](e[t(1191)],t(693))?{frameType:_0x3ef2be,headers:[{key:n.Quffd,value:n.NecEe}],payload:void 0}:(this[t(1210)+t(476)+"riesCount"]=1,this[t(1283)+t(767)]++,this[t(937)+"s"][this[t(1283)+t(767)]])}["getCurre"+r(836)+r(1420)+r(1554)](){let t=r;return this[t(1210)+t(476)+t(220)+"t"]++,this["getCurre"+t(836)+"nt"]()}}let rt=(r(1280)+"d"!=typeof globalThis&&e[r(894)](e[r(351)],globalThis[r(931)+r(1043)][r(473)])||e[r(1493)](r(1280)+"d",typeof window)&&e[r(865)](e[r(351)],window[r(931)+r(1043)][r(473)]))&&e[r(1363)](e[r(1496)],typeof document),je=e[r(1051)](e[r(1496)],typeof globalThis)&&(e.IetPD===globalThis[r(931)+r(1043)][r(473)]||e[r(1274)](r(1492)+"dWorkerGlobalScope",globalThis[r(931)+r(1043)][r(473)]))&&e[r(1141)](e[r(1496)],typeof tt),yt=(e[r(1094)]("undefined",typeof globalThis)&&e[r(731)]===globalThis[r(931)+"tor"].name||e.erKdb(r(1280)+"d",typeof globalThis)||r(1280)+"d"!=typeof globalThis&&!!globalThis["WeixinJS"+r(1345)])&&e[r(1363)](e[r(1496)],typeof wx),bt=e[r(1363)](e[r(1496)],typeof globalThis)&&(e[r(1165)]("Dedicate"+r(809)+"lobalScope",globalThis[r(931)+r(1043)].name)||e[r(1262)](e[r(947)],globalThis[r(931)+r(1043)][r(473)])||e.tzcvS===globalThis[r(931)+r(1043)].name)&&e[r(1408)](e[r(1496)],typeof self),Zo=e[r(972)](r(1280)+"d",typeof globalThis)&&e[r(731)]===globalThis[r(931)+"tor"][r(473)]&&e.CbAvD(r(1280)+"d",typeof global)&&e[r(731)]===global[r(931)+r(1043)][r(473)]&&e.EhYnw(e.WsjMH,typeof process)&&!!process[r(685)];class Vn{constructor(){this._listeners={}}[r(1663)](t,...n){let o=r,c=this[o(1021)+"rs"][t];if(c)c.slice()[o(305)](l=>l.fn[o(1075)](l.ctx,n));else if(e.tBqNo(o(1145),t)&&!this[o(1624)]){let l=n[o(1240)]&&n[0];if(e.bjhqg(l,Error))throw l;let p=new Error(e[o(691)](e[o(1118)],l?e[o(996)](" ("+l[o(1048)],")"):""));throw p.context=l,l}return this}[r(625)](t,n){let o=r;if(e[o(430)](void 0,t))this[o(1021)+"rs"]={};else if(e.OrQII(void 0,n))this[o(1021)+"rs"][t]=null;else{let c=this._listeners[t];if(c)for(let l=0;e[o(753)](l,c.length);)c[l].fn===n?c.splice(l,1):++l}return this}on(t,n,o){let c=r;return(this[c(1021)+"rs"][t]||(this[c(1021)+"rs"][t]=[]))[c(361)]({fn:n,ctx:o||this}),this}}class Qo extends Vn{[r(923)+"rrorMess"+r(1562)](t){let n=r;return t[n(1407)]||t[n(344)]?(n(986)+" "+(t[n(1407)]||"")+n(635)+(t[n(344)]||""))[n(1413)]():JSON[n(1412)+"y"](t)}constructor(t,n,o){let c=r;super(),this[c(1574)]=null,yt&&wx[c(498)+c(701)]&&(this._socket=wx[c(498)+"ocket"]({url:t,protocols:n,header:o,fail:this[c(992)+c(587)+c(608)][c(392)](this),success:this[c(992)+"ocketSuc"+c(1569)+c(478)].bind(this)})),je&&tt[c(498)+c(701)]&&(this[c(1574)]=tt["connectS"+c(701)]({url:t,protocols:n,header:o,fail:this["_createSocketFai"+c(608)][c(392)](this),success:this[c(992)+c(1571)+"cessHandler"].bind(this)}))}[r(992)+r(1571)+r(1569)+r(478)](){let t=r;Promise[t(515)]().then(()=>{this[t(1435)+"steners"]()})}[r(992)+"ocketFai"+r(608)](t){let n=r,o={SqgdP:function(c,l,p){return e[P(1222)](c,l,p)},cCSKy:e[n(1020)],HZbmc:e[n(300)]};Promise[n(515)]()[n(1026)](()=>{let c=n,l=o[c(831)](xe,o[c(883)],{message:this[c(923)+c(373)+c(1562)](t)});this[c(1663)](c(1145),l);let p=he(o[c(1257)],{reason:this[c(923)+c(373)+c(1562)](t)});this[c(1663)](c(898),p)})}[r(1435)+r(1645)](){let t=r,n={dXrwf:e[t(1532)],vVhEA:function(o,c,l){return o(c,l)},XiARC:e[t(300)],sJcpI:e.lHOPI};this[t(1574)][t(1343)](o=>{let c=t;this[c(1663)](n[c(602)],as(n[c(602)],{...o,data:o[c(1407)]||""}))}),this._socket[t(377)](o=>{let c=t;this[c(1663)](c(898),n[c(313)](he,n[c(1566)],{...o}))}),this[t(1574)][t(626)+"e"](o=>{let c=t;this.emit(c(1048),e.oecnw(os,e.dhBQb,{...o}))}),this[t(1574)][t(1430)](o=>{let c=t;this[c(1663)](n[c(1033)],n.vVhEA(xe,"error",{...o,message:o.errMsg||""}))})}[r(329)](t){let n=r,o={yMGLV:e[n(206)],lfIxn:e[n(1228)],OKwpf:"error",bPCzV:function(c,l,p){return e[n(1383)](c,l,p)}};if(e[n(1060)](t,Uint8Array))if(e[n(805)](e[n(1322)],n(975))){let c=t[n(1621)].slice(t[n(1232)+"et"],e[n(1223)](t[n(401)+"th"],t[n(1232)+"et"]));this[n(1574)]&&this[n(1574)][n(329)]({data:c,fail:l=>{let p=n;if(o[p(240)]===o[p(503)]){let{type:g}=_0x5cc059;this[p(1663)](g,_0xb26c6a)}else this[p(1663)](o[p(316)],o[p(1627)](xe,o[p(316)],{message:this[p(923)+p(373)+"age"](l)}))}})}else return(_0x20a7f8(4)[n(208)]("0")+e[n(280)](_0x25f9f6,_0x3cbcad,2).toString(16))[n(1612)](-4);else this._socket&&this._socket[n(329)]({data:t,fail:c=>{let l=n;this[l(1663)](e[l(1020)],e[l(537)](xe,e[l(1020)],{message:this[l(923)+"rrorMess"+l(1562)](c)}))}})}[r(898)](t,n){let o=r;this[o(1574)]&&this[o(1574)][o(898)]({code:t,reason:n})}[r(252)+"Listener"](t,n){this.on(t,n)}["removeEv"+r(1175)+r(1335)](t,n){this.off(t,n)}get[r(364)+"te"](){let t=r;return this[t(1574)][t(364)+"te"]}get binaryType(){let t=r;return this._socket[t(1009)+"pe"]}set[r(1009)+"pe"](t){}get[r(194)](){return this._socket.url}get[r(649)](){let t=r;return this._socket[t(649)]}get[r(1333)+"ns"](){let t=r;return this[t(1574)][t(1333)+"ns"]}get[r(518)+"Amount"](){return 0}}function ea(s,t){let n=r;if(t)return new t(s[n(194)],s[n(649)]);if(yt||je)return new Qo(s.url,s[n(649)],s[n(1171)]);if(e.pvHyc(rt,bt)&&e[n(1496)]!=typeof WebSocket&&WebSocket)return new WebSocket(s[n(194)],s[n(649)+"s"])}function ta(s){let t=r;return!!(s||yt&&wx[t(498)+t(701)]||je&&tt[t(498)+t(701)]||e[t(256)](rt,bt)&&e[t(1141)](e[t(1496)],typeof WebSocket)&&WebSocket)}function cs(s,t,n){let o=r,c={ZKZIY:function(l,p){return l===p}};if(e[o(579)](e.bFbYJ,e[o(459)])){let l=-1;async function p(g){let u=o;return g<=l?Promise[u(1062)](new Error(u(1177)+"alled multiple times in "+u(917))):(l=g,c[u(860)](g,n[u(1240)])?Promise[u(515)]():n[g][u(392)](s)(t,p.bind(null,g+1)))}e.SnVIb(p,0)}else _0x10d079.body["removeCh"+o(1248)](_0x4c20a9)}function fs(s){let t=r,n=0,o=0;for(let c=0;e[t(1325)](c,s[t(1240)]);++c)o=s[t(915)+"At"](c),e[t(1632)](o,128)?n+=1:e[t(879)](o,2048)?n+=2:e.OrQII(64512&o,55296)&&e[t(509)](e.StMms(64512,s[t(915)+"At"](c+1)),56320)?(++c,n+=4):n+=3;return n}function us(s,t,n){let o=r,c={pIbOD:function(p,g,u){return p(g,u)},sbbct:e[o(1020)]};if(e[o(1497)](e[o(941)](n,t),1))return"";let l="";for(let p=t;p<n;){let g=s[p++];if(e[o(969)](g,127))l+=String[o(804)+o(1229)](g);else if(e[o(284)](g,192)&&g<224)l+=String[o(804)+o(1229)](e[o(614)](e[o(683)](31,g)<<6,e[o(1473)](63,s[p++])));else if(g>=224&&g<240)l+=String[o(804)+"Code"](e.FSeHq(e.QqUft(e[o(592)](15&g,12),e[o(1529)](e[o(785)](63,s[p++]),6)),63&s[p++]));else if(e[o(620)](g,240))if(e[o(562)](e[o(1652)],o(479))){let u=e[o(824)](e[o(885)](e[o(1514)](e.rxooN(e[o(808)](e.RaKhO(7,g),18),e[o(808)](e.BJDdJ(63,s[p++]),12)),e[o(258)](e[o(1246)](63,s[p++]),6)),e[o(658)](63,s[p++])),65536);l+=String[o(804)+o(1229)](55296+(u>>10)),l+=String[o(804)+o(1229)](56320+e[o(683)](1023,u))}else{let u=c[o(447)](_0x37564f,c.sbbct,{message:_0x29325d[o(1048)],code:_0x3c2704[o(310)+"OR"],error:_0xa2fce});this[o(1460)+"hErrorEvent"](u)}}return l}function Yn(s,t,n){let o=r;if(e[o(260)](e.WGLDh,e[o(1653)]))e[o(586)](_0x25855c,_0xb23cee,16),e[o(1123)](_0x2713e4,_0x36799a,_0x4a595b);else{let c=n,l,p;for(let g=0;e[o(1164)](g,s[o(1240)]);++g)if(l=s[o(915)+"At"](g),e[o(1403)](l,128))t[n++]=l;else if(l<2048)t[n++]=e[o(1144)](l,6)|192,t[n++]=e[o(1514)](e[o(1146)](63,l),128);else if(e[o(765)](e[o(502)](64512,l),55296)&&e.wwJPC(e[o(352)](64512,p=s.charCodeAt(e[o(1251)](g,1))),56320)){let u=e[o(723)][o(914)]("|"),_=0;for(;;){switch(u[_++]){case"0":t[n++]=e[o(734)](e[o(1454)](e[o(1523)](l,6),63),128);continue;case"1":t[n++]=e[o(1410)](e[o(758)](l,18),240);continue;case"2":t[n++]=e[o(1098)](l,12)&63|128;continue;case"3":++g;continue;case"4":t[n++]=e.aOrQY(63,l)|128;continue;case"5":l=e[o(1465)](65536,e[o(822)](e.YPMCe(1023,l),10))+e[o(1668)](1023,p);continue}break}}else t[n++]=e[o(837)](e[o(640)](l,12),224),t[n++]=e[o(1267)](e[o(749)](e[o(942)](l,6),63),128),t[n++]=e.nGXZO(63&l,128);return e[o(521)](n,c)}}async function ds(s){let t=r;if(e[t(1590)](e[t(334)],typeof s)){let n=new Uint8Array(fs(s));return e[t(1370)](Yn,s,n,0),n}return e[t(1194)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(1621)],s.byteOffset,s[t(401)+"th"])}function na(s){let t=r;try{return e[t(1141)](e.SqvAF,typeof s)&&(s instanceof ArrayBuffer||s.buffer&&e.lGVPR(s[t(1621)],ArrayBuffer))||e[t(1363)](e.SqvAF,typeof s)?"":(JSON[t(1250)](s),t(1266)+"ion/json")}catch{return e[t(1590)](e[t(334)],typeof s)?e[t(1080)]:""}}let ra=(s,t)=>{let n=r;switch(s){case e[n(882)]:case e[n(1598)]:return{[n(593)+s]:1,"x-tt-env":t};default:return{}}};class sa{constructor(t){let n=r;this["maxLossC"+n(1208)]=t,this.count=0}[r(717)](){let t=r;this[t(838)]++}checkReachMaxCount(){let t=r;return e[t(1615)](this[t(838)],this["maxLossC"+t(1208)])}[r(1487)+r(268)](t=0){this.maxLossCount=t,this.count=0}}async function ia(s){let t=r,n={AlhpJ:function(o,c){return o===c},iPeLy:e[t(730)],DrlYa:e[t(738)],pBhfY:e[t(617)]};return new Promise(o=>{let c=t,l={OhzNz:function(p,g,u){return e[P(411)](p,g,u)},AHMoo:function(p,g,u){return e[P(844)](p,g,u)}};if(!rt)return e[c(661)](o,e[c(617)]);try{let p=document[c(378)+c(1224)](e.qGcSl);window["frontier"+c(395)]=g=>{let u=c;n[u(1044)](n.iPeLy,n[u(200)])?(RXZveY[u(1638)](_0x4f2fb4,_0x47e08b,32),RXZveY[u(327)](_0x5353f3,_0x4a31f5,_0x620175(_0x761031))):(document[u(1174)][u(1498)+u(1248)](p),window[u(409)+u(395)]=void 0,o(g&&g[u(754)]||n[u(426)]))},p[c(1112)]=e[c(810)],p[c(202)]=e[c(1259)](s[c(875)](/^ws/,e[c(548)]),e[c(1106)]);try{document[c(1174)]["appendCh"+c(1248)](p)}catch{document.body[c(1498)+c(1248)](p)}}catch{window[c(409)+c(395)]=void 0,e[c(653)](o,e[c(617)])}})}function ze(s,t,n){let o=r;return!!s?.find(c=>c[o(1640)]===t&&c.value===n)}function st(s,t){let n=r;return s?.[n(787)](o=>o[n(1640)]===t)?.[n(1575)]}let Xn=null;async function oa(){let s=r;return Xn||(Xn=Promise[s(515)]().then(Se[s(392)](Se,e.KRtHf))),Xn}class aa extends Vn{constructor(t,n){let o=r;super(),this[o(1286)]=t,this[o(921)]=n,this[o(306)]=void 0,this[o(1341)+o(953)]=null}async openDB(){await this._init()}async[r(1390)](){let t=r,n={hAAZM:function(o,c){return o===c},JlRJQ:e[t(962)]};if(!this._qosDB){if(this[t(1341)+t(953)])return this[t(1341)+t(953)];try{let o=this[t(1286)],c=this._keyPath;this[t(1341)+t(953)]=(async()=>{let l=t;if(e[l(874)](l(218),e[l(1279)])){let{openDB:p}=await e[l(736)](oa);this[l(306)]=await p(l(409)+"_"+o,1,{upgrade(g){let u=l;if(n[u(818)](n[u(1421)],u(205)))return this._qosDB.clearStorageSync();g[u(659)+"jectStore"](o,{keyPath:c})}})}else this[l(391)+"T"]?_0x9ab55a[l(1091)+"kStatusChange"](({isConnected:p})=>{let g=l;this[g(370)+"igatorOn"+g(800)]=p,p?this[g(1156)+"nLine"]():this[g(1156)+g(745)]()}):this._isMiniWX&&_0x46741b["onNetwor"+l(1501)+l(449)](({isConnected:p})=>{let g=l;this["_miniNav"+g(1656)+g(800)]=p,p?this[g(1156)+"nLine"]():this[g(1156)+g(745)]()})})(),await this[t(1341)+t(953)]}catch(o){console.log(o)}finally{this[t(1341)+"mise"]=null}}}async get(t){let n=r,o={Ffjjo:function(c,l,p){return e.VqlvW(c,l,p)},cbIeM:function(c,l){return e.RWTHE(c,l)}};try{if(e.MuXYy(e[n(1611)],e[n(1611)]))this[n(1096)+n(1231)].shift(),this[n(1096)+n(1231)][n(361)](_0x4d73b);else return await this[n(1390)](),this[n(306)]?.[n(1525)](this[n(1286)],t)}catch(c){e.jFumb(e.pIWdI,n(1508))?console[n(474)](c):(bVsgfl.Ffjjo(_0x1ceac0,_0xb98860,bVsgfl[n(1331)](127,_0x325939)|128),_0x272cc3>>>=7)}}async[r(454)](t,n){let o=r;return await this._init(),this[o(306)]?.[o(759)](this[o(1286)],t)}async del(t){let n=r;try{return await this[n(1390)](),this._qosDB?.[n(1576)](this[n(1286)],t)}catch(o){console[n(474)](o)}}async[r(1582)](){let t=r;if(e[t(551)]===e[t(458)])return null;try{return await this._init(),this._qosDB?.[t(1582)](this._dbName)}catch(n){if(e[t(438)]("gomNl",t(1085)))console.log(n);else return this._qosDB?.[t(1525)](_0x51764c)}}async[r(959)](){let t=r;if(e.imqUa(t(895),e[t(1339)]))return await this[t(1390)](),this[t(306)]?.[t(1467)+"ys"](this[t(1286)]);e[t(1166)](_0x2aeb7e,e[t(1115)]),this.off(e.DJuaV,_0x53e1a1),this[t(625)](e[t(1107)],_0x32d802)}async getAll(){let t=r;return await this._init(),this[t(306)]?.[t(1295)](this._dbName)}async[r(873)](){let t=r;if(e[t(1572)](e[t(1297)],e.WCkmU))try{this[t(306)]?.[t(898)](),this._qosDB=void 0}catch(n){console[t(474)](n)}else _0x20cefc.o=(n,o)=>_0x1d86c7[t(1031)+"e"][t(232)+t(757)][t(988)](n,o)}get[r(1275)](){let t=r;if(e[t(1580)](e[t(203)],e[t(203)]))try{if(t(1188)===t(1188))return!!this[t(306)];this[t(1663)](t(1145),_0x31b4ee),this[t(1624)]&&this.onerror(_0x578490)}catch(n){return console.log(n),!1}else return!!this._qosDB}}class xa{constructor(t,n){let o=r;this._DBName=t,this[o(1319)]=n,this._qosDB=localStorage}async[r(415)](){}get _prefix(){let t=r,n={Urkxd:function(o,c,l){return e[P(1061)](o,c,l)}};if(e[t(367)](e[t(1677)],e[t(842)]))return t(409)+"_"+this[t(1233)];_0x2836b4(_0x1bac5b,18),yWcKKh[t(1597)](_0x272ea8,_0x4b6aac,_0x9beb7f)}async[r(1525)](t){let n=r,o=this[n(306)][n(1216)](this._prefix);return JSON.parse(e.iSRYG(o,"{}"))[t]}async[r(454)](t,n){let o=r,c=this[o(306)][o(1216)](this[o(930)]),l=JSON.parse(e[o(1197)](c,"{}"));return l[n||t[this[o(1319)]]]=t,this._qosDB[o(1276)](this[o(930)],JSON.stringify(l)),n||t[this[o(1319)]]}async[r(1526)](t){let n=r,o=this[n(306)][n(1216)](this[n(930)]),c=JSON[n(1250)](o||"{}");return c[t]=void 0,this[n(306)][n(1276)](this[n(930)],JSON[n(1412)+"y"](c))}async[r(1582)](){let t=r;return this._qosDB[t(1582)]()}async[r(959)](){let t=r,n=this[t(306)].getItem(this[t(930)]),o=JSON[t(1250)](e[t(1197)](n,"{}"));return Object.keys(o)}async[r(1295)](){let t=r,n=this[t(306)][t(1216)](this._prefix),o=JSON.parse(e[t(1131)](n,"{}"));return Object[t(1143)](o)}[r(873)](){return Promise[r(515)]()}get[r(1275)](){return!!this[r(306)]}}class ca{constructor(t,n){let o=r;if(e.JpoHl(e[o(667)],o(1647)))this[o(1233)]=t,this[o(1319)]=n,this[o(306)]=je?tt:yt?wx:null;else return _0x4007c4?.[o(787)](c=>c[o(1640)]===_0x1d6c0f)?.[o(1575)]}async[r(415)](){}get[r(930)](){return r(409)+"_"+this._DBName}async[r(1525)](t){let n=r;if(e[n(430)](e[n(558)],e.EotVS))_0x48cf5b[n(1174)][n(1498)+"ild"](_0x597dc6),_0x168e13[n(409)+n(395)]=void 0,_0x4cc83a(_0x2a2f53&&_0x3d6bba.msg||n(1025)+n(751));else{let o=this[n(306)][n(1316)+n(645)](this[n(930)]);return JSON[n(1250)](e[n(1477)](o,"{}"))[t]}}async[r(454)](t,n){let o=r,c=this[o(306)][o(1316)+o(645)](this[o(930)]),l=JSON[o(1250)](e[o(1131)](c,"{}"));return l[n||t[this._pathKey]]=t,this[o(306)][o(408)+"geSync"](this._prefix,JSON.stringify(l)),n||t[this[o(1319)]]}async[r(1526)](t){let n=r,o=this[n(306)][n(1316)+n(645)](this._prefix),c=JSON[n(1250)](e[n(1503)](o,"{}"));return c[t]=void 0,this[n(306)][n(408)+n(645)](this._prefix,JSON[n(1412)+"y"](c))}async clear(){let t=r;return this._qosDB[t(791)+t(525)]()}async[r(959)](){let t=r,n=this._qosDB[t(1316)+"geInfoSync"](this[t(930)]),o=JSON[t(1250)](e[t(1291)](n,"{}"));return Object[t(959)](o)}async[r(1295)](){let t=r,n=this._qosDB["getStora"+t(1116)+"nc"](this[t(930)]),o=JSON.parse(n||"{}");return Object[t(1143)](o)}[r(873)](){let t=r,n={XbLue:function(o,c){return e[P(854)](o,c)},LSDfZ:function(o,c){return o&c},tGQRE:function(o,c){return e[P(652)](o,c)},ophlf:function(o,c){return e.CqYqd(o,c)},EHdAR:function(o,c){return e[P(991)](o,c)},sUJvX:function(o,c){return e[P(190)](o,c)},WJalD:function(o,c){return e[P(294)](o,c)},gnaOa:function(o,c){return o<<c},luiHE:function(o,c){return o&c},JlZkJ:function(o,c){return e.lerMX(o,c)},bidMT:function(o,c){return e[P(1146)](o,c)},KJdXX:function(o,c){return e[P(835)](o,c)},qkiWG:function(o,c){return e[P(466)](o,c)},niAXt:function(o,c,l,p){return e.olzFG(o,c,l,p)},FBmlk:function(o,c){return o|c}};if(e.IEjUh===e[t(549)]){if(_0x289c76=n[t(475)](n[t(363)](127,_0x36f950[_0x2c9a2a]),0),n[t(1419)](_0x5b6c51[_0x140ee7++],128))return{value:_0x5c1d91?_0x1ab1f5:n[t(410)](0,_0x278a02),offset:_0x4f9a5b};if(_0x3a8b5f=n[t(1092)](n[t(410)](_0x1d8b89,n[t(1128)](127&_0x3af47f[_0x1548ef],7)),0),_0x39bb80[_0x4eb486++]<128)return{value:_0x5a095d?_0x1cc3f2:0|_0xcb2a77,offset:_0x1ee4a0};if(_0x6b648e=n[t(187)](n.ophlf(_0x23c67c,n[t(251)](n[t(1602)](127,_0x13f9f6[_0x483ab1]),14)),0),n[t(1419)](_0xbee82[_0x4cda20++],128))return{value:_0x871f07?_0x5272e9:0|_0x4d6782,offset:_0x200564};if(_0x27164a=n.EHdAR(_0x2e35d8|n[t(982)](n.luiHE(127,_0x36ad96[_0x250b38]),21),0),_0x48209d[_0x30bffc++]<128)return{value:_0x16c5b3?_0x9368da:n[t(410)](0,_0x44094f),offset:_0x1b5334};if(_0x300687=n.XbLue(n[t(410)](_0xbc9ee7,n[t(251)](n[t(452)](15,_0x3ac339[_0x5e3c4c]),28)),0),n[t(434)](_0x471a72[_0x4d0eb3++],128))return{value:_0x5ca7e9?_0x2872b7:0|_0x13882e,offset:_0x1885ca};if(n[t(1401)](_0x1a45ca+=5,_0x21d820[t(1240)]))throw _0xc96d60=_0x18fecc[t(1240)],n[t(324)](_0x2f021d,_0x531958,10,_0x56cb15.length);return{value:_0x255e7d?_0x832c60:n.FBmlk(0,_0x53bd33),offset:_0xa0be11}}else return Promise[t(515)]()}get[r(1275)](){let t=r;if(e[t(1327)](e.kyssH,e[t(1329)]))return!!this._qosDB;_0x3276f3=e[t(1410)](e[t(1154)](15,_0x385b91)<<12|e.nLYUy(e[t(1028)](63,_0x5de047),6),e[t(1127)](63,_0x39ff70)),e[t(591)](_0x390ac,2048)||e[t(365)](_0x3149dc,55296)&&e[t(1534)](_0x4a5f87,57343)?_0x115bfa+=_0x14ea2a:(_0x4fedbe+=e.opLRZ(_0x16715f,_0x5bc41d),_0x27d574+=2)}}function ls(s,t){let n=r;if(e[n(1626)](je,je))return new ca(s,t);if(e[n(1477)](rt,bt)&&e.WsjMH!=typeof indexedDB)return new aa(s,t);if(e.hVmfE(rt,bt)&&e[n(1496)]!=typeof localStorage)return new xa(s,t);throw new Error(n(1469)+n(938)+"d")}class fa{constructor(){let t=r;this._intervalTimeoutId=null,this[t(1168)+"l"]=36e5,this._qosDB=ls(e[t(1639)],t(1587)+"id")}async[r(1168)+r(308)](){let t=r;e.ikzzd(clearInterval,this[t(1168)+t(1619)+"Id"]),this[t(1168)+t(1619)+"Id"]=setInterval(()=>{let n=t;this[n(1512)+n(1071)]()},this._interval)}async[r(415)](){let t=r;await this[t(306)][t(415)]()[t(1026)](()=>{let n=t;this[n(1168)+n(308)]()})}async["flushExp"+r(1071)](){let t=r;if(e[t(573)](e[t(877)],e.fnWue))(await this[t(306)]?.[t(1295)]()||[])[t(1084)](({timestamp:c})=>c<Date[t(1205)]())[t(305)](c=>{let l=t;if(e[l(1122)](e[l(581)],e[l(581)]))return new _0x2d1d25(_0x43002d,{code:_0x1849ef,reason:_0x42cbf4,wasClean:_0x25fa38,willReconnect:_0x45e553});this._qosDB?.del(c.message_id)});else{let n=0,o={};for(let c=0;e[t(188)](c,_0x1fb10b[t(1240)]);c++)o[_0x454b3d[c][t(303)+t(374)]]=e[t(684)](_0x2268dd,_0x37ae92[c][t(303)+t(374)]),n+=e[t(514)](14,o[_0x380cb9[c][t(303)+t(374)]]);return[n,o]}}async[r(1526)](t){let n=r;return this[n(306)]?.[n(1526)](t)}async[r(454)](t,n){let o=r;return this[o(306)]?.[o(454)]({message_id:t,timestamp:n})}async[r(1525)](t){let n=r;return e[n(182)](e.CotgZ,"agqau")?0:this[n(306)]?.[n(1525)](t)}async[r(873)](){let t=r;e[t(803)](clearInterval,this[t(1168)+t(1619)+"Id"]),await this._qosDB?.[t(873)]()}get[r(1275)](){let t=r;return this[t(306)]?.[t(1275)]}}function $n(s){let t=r,n=!!this[t(886)].enableQoS;if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e[t(1370)](ze,s.message[t(1171)],e[t(839)],"2"),c=o&&e[t(784)](ze,s.message.headers,e[t(272)],"1"),l=o&&e[t(1370)](ze,s.message[t(1171)],"x_fronti"+t(1417)+"k","1"),p=l?st(s.message[t(1171)],e[t(971)])?.[t(914)](",")[t(1084)](Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:c,isAckCleanupMessage:l,ackMsgIds:p}}async function hs(){let s=r;return this[s(1124)+s(1600)]||(this[s(1124)+"ger"]=new fa),this[s(1124)+s(1600)].isReady||await this[s(1124)+s(1600)][s(415)](),this[s(1124)+"ger"]}async function ua(s,t){let n=r,{enableAutoAck:o}=this[n(886)],c=e.olzFG(ze,s[n(1048)].headers,e[n(1378)],"1"),l=ze(s[n(1048)][n(1171)],n(1290),"1"),p=$n.call(this,s);if(o&&c){let{SeqID:g,LogID:u,service:_,LogIDNew:b,method:A}=s[n(1048)];this[n(1037)]({SeqID:g,LogID:u,LogIDNew:b,service:_,method:A,headers:[{key:e[n(1190)],value:"1"},{key:e[n(1078)],value:e.tVHVa(b,"")},{key:e[n(964)],value:"0"}]})}l&&!p[n(186)]&&this["_dispatc"+n(869)+n(572)](s),e.qLdNX(t)}async function da(s,t){let n=r;this[n(453)](e[n(1352)],s[n(1048)]),t()}async function la(s,t){let n=r,o={anlkI:function(l,p,g){return e[P(615)](l,p,g)},OmIWd:function(l,p,g){return e.vASBc(l,p,g)}},c=e.mDpOJ(Yr,await ds(s[n(1440)]));try{if(e.ufbuN(e[n(1436)],e[n(1436)]))if(e[n(1194)](c[n(1641)],Uint8Array)){let l=e[n(1060)](this[n(886)]["payloadE"+n(710)],Object)?{force:!!this[n(886)][n(627)+"ncoding"][n(944)],encoding:this._options[n(627)+n(710)][n(890)]?this._options[n(627)+n(710)].encoding[n(875)](/\s/g,"")[n(1204)+n(1424)]():""}:{force:!1,encoding:this[n(886)][n(627)+n(710)]?this[n(886)][n(627)+n(710)].replace(/\s/g,"")[n(1204)+n(1424)]():""},p=c[n(627)+"ncoding"]?c[n(627)+"ncoding"][n(875)](/\s/g,"")[n(1204)+"ase"]():"",g=this[n(886)].payloadType instanceof Object?{force:!!this[n(886)][n(456)+n(1003)][n(944)],type:this[n(886)]["payloadT"+n(1003)].type?this._options.payloadType[n(1112)][n(875)](/\s/g,"")[n(1204)+n(1424)]():""}:{force:!1,type:this[n(886)][n(456)+n(1003)]?this[n(886)][n(456)+n(1003)][n(875)](/\s/g,"")["toLowerC"+n(1424)]():""},u=c["payloadT"+n(1003)]?c[n(456)+n(1003)][n(875)](/\s/g,"")[n(1204)+n(1424)]():"",_=g[n(944)]?g[n(1112)]:u||g[n(1112)],b=l[n(944)]?l[n(890)]:p||l.encoding,A=[e.dLxKR,e[n(1427)],e.bwbxr,e[n(334)]],S=[e[n(1560)],e[n(1121)]];this[n(886)][n(217)+"ansformTextPayload"]&&A[n(1354)](_)&&(!b||S[n(1354)](b))?c.textPayload=us(c[n(1641)],0,c[n(1641)].byteLength):c[n(1614)+n(1636)]=""}else c["textPayl"+n(1636)]="";else{if(_0x4e2ed4)return new _0x203216(_0x584d74[n(194)],_0x3ccb68[n(649)]);if(e[n(342)](_0x589f7b,_0x438925))return new _0x29a0a8(_0x4bd394[n(194)],_0x3216a8[n(649)],_0x5814b9.headers);if((_0x527bcb||_0x2628fd)&&e.WsjMH!=typeof _0x4003e3&&_0x1e4d88)return new _0xb85e14(_0x410d6c[n(194)],_0xcf327e[n(649)+"s"])}}catch(l){e.LhhYo(e.FVNep,e[n(794)])?(bWWGTK.anlkI(_0x5c5772,_0x3e4bd3,8),bWWGTK[n(945)](_0x30f762,_0x5c8a71,_0x1399f6)):(c["textPayl"+n(1636)]="",console[n(474)](l))}s[n(1048)]=c,e[n(386)](t)}function ha(s,t,n){let o=r,c={OKOwY:function(_,b){return e[P(1527)](_,b)},ilIVR:function(_,b){return e[P(1028)](_,b)},dktJX:function(_,b){return e[P(1195)](_,b)},VQaWg:function(_,b){return e.TyqgW(_,b)},eorSK:function(_,b){return e[P(1140)](_,b)},yzhbP:e.TLJGG,Cruon:function(_,b){return _<b},aRltD:function(_,b){return e[P(1583)](_,b)},VmmDY:function(_,b){return e.CZeHC(_,b)},NWbuN:function(_,b){return _+b},luAJR:function(_,b){return e[P(1544)](_,b)}},l=e[o(1197)](n,8192),p=l>>>1,g=null,u=l;return function(_){let b=o,A={YJahD:function(S,C){return c.OKOwY(S,C)},bIfVD:function(S,C){return c.ilIVR(S,C)},nvXHo:function(S,C){return c.ilIVR(S,C)},ASSYE:function(S,C){return c[P(560)](S,C)},oDRda:function(S,C){return c[P(490)](S,C)}};if(c[b(1219)](c.yzhbP,c.yzhbP))_0x2409bd=COqqrV[b(1672)](_0x21385b,_0x549493),_0x39caa2=COqqrV[b(1398)](127,_0x366592),COqqrV.nvXHo(128,_0x42ec4d)&&(_0x3aacf3=COqqrV.ASSYE(_0x41bff5,_0x1df0cf),_0x1e9974|=COqqrV[b(1369)](127,_0x4d3202)<<7);else{if(c.Cruon(_,1)||c[b(1536)](_,p))return c[b(376)](s,_);c[b(1536)](u+_,l)&&(g=c[b(636)](s,l),u=0);let S=t[b(988)](g,u,u+=_);return 7&u&&(u=c.NWbuN(c.luAJR(7,u),1)),S}}}let ga=4294967295;function pa(s,t,n){let o=r;return RangeError(e.LSyLA(e[o(880)](e.sRaFS(e[o(446)](e.xrrud,s),e.nRQyY),e[o(1131)](t,1)),e.PiIRO)+n)}function ma(s,t,n){let o=r;if(n>ga)throw new Error(o(695)+"too large");let c=3;for(;e.BHLkA(c,0);){let l=e.fnMbb(255,n);e.olzFG(Qn,l,s,e[o(1520)](t,c)),n>>>=8,c--}return e[o(1030)](t,4)}function _a(s,t){let n=r,o=0,c=t,l=e[n(1520)](t,4);for(;e.qyRhg(c,l);){let{value:p,offset:g}=e[n(439)](Zn,s,c);c=g,o=e[n(412)](o<<8,0),o+=p}return{value:o,offset:l}}function wa(s,t,n){let o=r,c=e[o(1292)][o(914)]("|"),l=0;for(;;){switch(c[l++]){case"0":if(!s)return n;continue;case"1":return e[o(207)](e[o(582)](Yn,s,t,n),n);case"2":if(e.BDYKy(s[o(1240)],40))return e[o(372)](e.gtcrb(Yn,s,t,n),n);continue;case"3":if(t[o(722)+"e"])return t[o(722)+"e"](s,n)+n;continue;case"4":if(t[o(550)])return t.write(s,n)+n;continue}break}}function ya(s,t){let n=r;if(e.QSYcu(e.YjnEb,e.YjnEb))this.emit(e.lHOPI,e[n(1053)](_0x2dbcc7,e[n(1020)],{..._0x527a7f,message:_0xa1617c.errMsg||""}));else{let o=new B(e[n(819)](e[n(726)](e[n(837)](e[n(621)](s[e[n(1453)](t,4)],24),s[e[n(372)](t,5)]<<16),e[n(1238)](s[e[n(1223)](t,6)],8)),s[e[n(1479)](t,7)]),e.CqYqd(e[n(190)](s[e[n(880)](t,0)],24)|e[n(556)](s[e[n(446)](t,1)],16),e[n(556)](s[e.sbMfg(t,2)],8))|s[t+3],!0);return t+=8,{value:o,offset:e.aYdCX(t,8)}}}function ba(s,t,n){let o=r,c=s[o(657)],l=s[o(1521)];return t[n]=e[o(1617)](l,24),t[e[o(783)](n,1)]=l>>>16&255,t[e[o(686)](n,2)]=e.aEdUJ(e[o(1209)](l,8),255),t[e[o(1664)](n,3)]=e[o(424)](255,l),t[e[o(446)](n,4)]=e[o(1161)](c,24),t[e[o(1066)](n,5)]=e[o(1362)](c,16)&255,t[n+6]=e.UXJZU(c>>>8,255),t[e[o(1482)](n,7)]=e[o(502)](255,c),n+=8,n}function Zn(s,t){let n=r;if(e[n(559)]!==e[n(559)])for(var o in _0x51f967)hqcnaa.tUYjA(_0x533518,_0x59e3b7,o,{get:_0x4f34b2[o],enumerable:!0});else return s[n(1170)+"8"]?{value:s[n(1170)+"8"](t),offset:t+1}:{value:e[n(1399)](255,s[t]),offset:e.slIpm(t,1)}}function Qn(s,t,n){let o=r;return t[o(1304)+"t8"]?t[o(1304)+"t8"](s,n):t[n]=e.MCfzX(255,s),e[o(880)](n,1)}let va=function(s){let t=r;if(e[t(1264)](e.AVuKw,e[t(893)]))return new Uint8Array(s);this[t(306)]?.[t(898)](),this[t(306)]=void 0},Sa=e.OdrDq(e[r(1496)],typeof Buffer)?Buffer[r(483)+r(375)]:e[r(1447)](ha,va,Uint8Array[r(1031)+"e"][r(740)]),Ea=16,er=32;function Ca(s){let t=r;if(e[t(1309)]!=="XxLRc")return this._socket.binaryType;{let n=0,o={};for(let c=0;e[t(1252)](c,s[t(1240)]);c++)o[s[c]["cursor_n"+t(374)]]=e[t(1247)](fs,s[c][t(303)+"ame"]),n+=14+o[s[c]["cursor_n"+t(374)]];return[n,o]}}function gs(s,t,n){let o=r,c={RYaeD:function(l,p){return e[P(1135)](l,p)}};if(e[o(423)](e.HNtui,e[o(263)]))_0x33abff=JbFeiQ[o(856)](_0x49ef5f,_0x2551c5);else{let[l,p]=e[o(262)](Ca,s),g=Sa(l),u=0;return s[o(305)](_=>{let b=o;if(e[b(1317)]("QcxLM",e[b(1437)]))this[b(1032)]=!0,this[b(1321)]();else{let A=e[b(1389)].split("|"),S=0;for(;;){switch(A[S++]){case"0":u=e[b(583)](ba,B[b(1069)+"er"](_[b(1270)]||t),g,u);continue;case"1":console[b(474)]("name",u);continue;case"2":u=e[b(583)](Qn,p[_[b(303)+"ame"]],g,u);continue;case"3":console[b(474)](e[b(1285)],u);continue;case"4":console[b(474)](e.gwjxS,u);continue;case"5":console[b(474)](e.BiocV,u);continue;case"6":u=e[b(1315)](ma,g,u,_[b(1269)]||0);continue;case"7":console[b(474)](e[b(429)],u);continue;case"8":u=e[b(582)](wa,_[b(303)+"ame"],g,u);continue;case"9":u=e.tTWkV(Qn,0,g,u);continue;case"10":console[b(474)](e[b(672)],_,_.service);continue}break}}}),{frameType:er,headers:[{key:e[o(840)],value:n}],payload:g}}}function Aa(s){let t=r,n=0,o=[];for(;e.tjoHJ(n,s[t(401)+"th"]);){let{offset:c}=e.BkHYP(Zn,s,n);n=c;let l={cursor_name:"",cursor:0,service:0},{value:p,offset:g}=e[t(644)](_a,s,n);l[t(1269)]=p,n=g;let{value:u,offset:_}=e[t(644)](Zn,s,n);n=_,l[t(303)+t(374)]=us(s,n,e[t(1482)](n,u)),n+=u;let{value:b,offset:A}=e[t(1449)](ya,s,n);l[t(1270)]=b[t(1622)](),n=A,o[t(361)](l)}return o}function Da(){let s=r;return{frameType:er,headers:[{key:e[s(840)],value:e[s(1650)]}],payload:void 0}}class ka{constructor(t,n,o){let c=r;this[c(1676)+c(1517)]=t,this["_cursorF"+c(450)]=n,this["_message"+c(715)]=o,this[c(306)]=e[c(908)](ls,this[c(1676)+c(1517)],e[c(743)])}async[r(415)](){let t=r;await this[t(306)][t(415)]()}async getCursors(){let t=r;if(!this._qosDB[t(1275)])return;let n=this[t(1096)+t(715)],o=await this[t(306)].getAll();switch(console[t(474)](t(1375)+t(1082),o),n){case t(1380):return o&&o[t(1240)]?e[t(1244)](gs,o,0,this[t(465)+t(450)]):void 0;case t(314):return;case e[t(1100)]:return o&&o.length?e.NySLH(gs,o,0,this[t(465)+t(450)]):e.RzvzU(Da)}}async set(t,n,o){let c=r;return console[c(474)](c(1119),t,n,o),this._qosDB[c(454)]({cursor_name:t,cursor:n,service:o})}async[r(216)+"rs"](t){let n=r,o={fPKXE:function(c,l,p){return c(l,p)},woGpI:function(c){return e.YvgiI(c)},CUjJM:function(c,l,p){return c(l,p)},Rpmda:function(c,l){return e[P(1371)](c,l)}};if(e.GUROo(e[n(1064)],n(922))){let c=e[n(967)](Aa,t);for(let l of c)console[n(474)](e[n(946)],c),await this[n(306)][n(454)](l)}else{LkIjPs[n(1213)](_0x1d3b48,_0x190960,42);let c=LkIjPs.woGpI(_0x5484c5);_0x3ef51e(_0x515cfa,c),LkIjPs[n(676)](_0x38e9fd,_0x4d54d0,c[n(1288)]),LkIjPs[n(676)](_0x2f0cc4,_0x5d6b5b,c),LkIjPs[n(1458)](_0x12f151,c)}}async[r(1525)](t){let n=r;if(e[n(998)](e[n(432)],n(876)))_0x1ef0e3[n(474)](_0x5937b9);else return(await this._qosDB[n(1525)](t))?.[n(1270)]}async[r(873)](){let t=r;await this[t(306)][t(873)]()}updateCursorFileName(t){let n=r;this[n(465)+n(450)]=t}get[r(1275)](){return this[r(306)].isReady}}let Ia=e[r(1623)];async function ps(s){let t=r;if(!this[t(886)][t(1298)+"S"])return null;let{aID:n,fpID:o,messageStrategy:c}=this[t(886)],l=e.EeEAj(s,Ia);try{return this[t(1024)+t(638)]?s&&this[t(1024)+t(638)][t(1050)+t(345)+t(739)](s):this[t(1024)+t(638)]=new ka(o+"_"+n+"_"+l,l,c),this["_cursorM"+t(638)][t(1275)]||await this[t(1024)+t(638)][t(415)](),this._cursorManager}catch{return null}}async function Pa(s,t){let n=r;if(e[n(632)](e.jRecm,e[n(1657)])){let o=this[n(1521)],c=this[n(657)];return[255&c,e[n(1154)](e[n(1488)](c,8),255),e[n(1399)](c>>>16,255),e[n(431)](c,24),e[n(919)](255,o),e.MCfzX(e[n(265)](o,8),255),e[n(1234)](o,16)&255,e[n(849)](o,24)]}else{let o=e[n(1244)](ze,s[n(1048)][n(1171)],n(501),"-1"),c=e[n(1370)](ze,s[n(1048)].headers,e[n(1190)],"1"),l=e[n(834)](st,s.message[n(1171)],e[n(1254)]),p=e.idtvw(Number,e.rfXHm(st,s.message[n(1171)],e[n(1406)]))||0,g=$n[n(988)](this,s),u=e[n(582)](ze,s[n(1048)].headers,e.cUZyL,"2"),_=st(s[n(1048)].headers,e[n(1382)]),b=e[n(689)](Number,st(s[n(1048)][n(1171)],e[n(276)]));if(g[n(186)])return e[n(386)](t);let A=g[n(418)+"sage"]?await hs.call(this):null;if(s[n(1048)][n(1269)]>0&&c&&!o||s.message[n(1269)]>0){if(l&&g[n(418)+n(1351)]&&A)return!!!await A[n(1525)](l)&&(this["_dispatc"+n(336)+n(601)](s),await A[n(454)](l,e.nIkHr(Date[n(1205)](),p))),e[n(333)](t);if(u){let S=await ps[n(988)](this);if(!S){if(e[n(1553)](e[n(1661)],e[n(1272)]))return this[n(1460)+n(336)+n(601)](s),e[n(974)](t);_0x2b5506=e[n(841)](_0x216f78,_0x4193e8),_0x272c8c|=e.hToJm(127,_0x4256fd)<<7}let C=await S[n(1525)](_)??-1;if(C<b)this[n(1460)+n(336)+n(601)](s),S.set(_,b,s[n(1048)][n(1269)]);else throw new Error(n(778)+" message"+n(781)+b+(n(536)+n(599)+"al cursor ")+C);return e[n(736)](t)}return this[n(1460)+n(336)+n(601)](s),e[n(416)](t)}}}async function La(s,t){let n=r,o=$n[n(988)](this,s);if(!o[n(418)+"sage"])return e[n(1207)](t);let c=await hs[n(988)](this);if(o[n(963)+n(792)+n(1562)]&&o[n(813)+"s"][n(1240)])for(let l of o[n(813)+"s"])await c[n(1526)](l);e.JOcTK(t)}async function Ta(s,t){let n=r,o=s[n(1048)][n(499)+"e"]===Ea,c=e[n(966)](s[n(1048)][n(499)+"e"],er);if(!o&&!c)return e.pInnU(t);let l=e[n(1515)](st,s[n(1048)][n(1171)],n(500)+n(1054));if(!l)return e[n(1187)](t);let p=await ps[n(988)](this,l);if(!p)return e[n(974)](t);if(o){if(e[n(438)](n(1134),n(641)))return this[n(1460)+n(336)+n(601)](_0x30b522),_0x4e03cd();{let g=await p[n(1379)+"rs"](),u={frameType:g?.[n(499)+"e"],SeqID:B[n(1069)+"er"](this[n(1311)]++),LogID:B[n(1069)+"er"](this._options.logIDGenerator()),service:9e3,method:5,headers:g?.headers,payload:g?.[n(1641)]},_=e[n(400)](I,u);this._ws&&this[n(250)][n(364)+"te"]&&this[n(250)][n(329)](_)}}if(c){let g=s[n(1048)].payload;g&&p[n(216)+"rs"](g)}}let Na=async function(s,t){let n=r;this[n(1032)]=!1,e[n(1195)](clearTimeout,this[n(1321)+n(1513)+n(846)]),e.cqMDm(t)},Oa=async function(s,t){let n=r;if(!this[n(250)]||e[n(484)](this[n(250)].readyState,this.OPEN))return e[n(736)](t);let{pingInterval:o}=this[n(886)];this._endpointManager?.[n(1506)+n(1150)+"fig"]();for(let l=0;l<this["_message"+n(1231)][n(1240)];l++){let p=this[n(1096)+n(1231)][l];if(this[n(250)].readyState===this[n(610)]&&e[n(420)](null,p))this[n(250)]&&this._ws.send(p),this[n(1096)+n(1231)][l]=null;else break}this[n(1096)+n(1231)]=this[n(1096)+n(1231)][n(1084)](l=>!!l),this["_pingPon"+n(292)+"Id"]=e[n(1589)](setTimeout,()=>this[n(748)](),o),this[n(1460)+n(1604)+"nt"](s),this._isBrowser&&this._ws&&(this[n(250)].binaryType=this[n(861)+n(1003)]);let c=this[n(1601)+n(630)]?.[n(1444)+n(836)+"nt"]();this[n(453)](n(1015)+c+n(762)),e[n(541)](t)},Ra=async function(s,t){let n=r,o=this[n(1601)+n(630)]?.[n(1444)+"ntEndpoint"]();this[n(453)](n(1015)+o),e[n(736)](t)};class Ba extends Vn{constructor(t){let n=r,o={aXSWq:function(g,u){return g===u},ZdpTD:function(g,u){return e[P(221)](g,u)},HbBxC:e.gHPYJ,SOIQj:function(g,u){return e[P(522)](g,u)},fsqCz:function(g,u){return e[P(1081)](g,u)},BvzRa:e[n(777)],LIjEU:function(g,u){return e[n(1245)](g,u)},yfLJn:function(g,u){return g!==u},Yhwdi:e[n(1610)],yjwAw:n(859),wOBaO:e[n(628)],Bjkeq:e.uyGiL,pIcHz:function(g,u,_){return e.dGWGN(g,u,_)},BsqfJ:function(g,u,_,b){return g(u,_,b)},YXATi:e[n(1125)],abGko:n(1145),ZTpWg:function(g,u){return e[n(1386)](g,u)},uqdLe:function(g,u){return e[n(1489)](g,u)},MUTYk:function(g,u){return e[n(592)](g,u)},bYxiX:function(g,u){return e[n(1568)](g,u)},lIpmi:function(g,u){return e[n(790)](g,u)},ARLCH:e.xmlqp,KICNz:function(g,u,_){return e.LbYMF(g,u,_)},zwDvX:e[n(300)],dlcNw:function(g,u){return e[n(226)](g,u)},edcUr:function(g,u){return g(u)},LOztE:function(g,u,_){return e[n(397)](g,u,_)},yZxyX:function(g,u){return e.ynvLK(g,u)},nsptQ:function(g,u,_){return e.wWtnh(g,u,_)}};super(),this[n(370)+n(1656)+n(800)]=!0,this[n(225)+"er"]=rt,this._isNode=Zo,this._isMiniTT=je,this[n(1472)+"X"]=yt,this[n(1502)+"r"]=bt,this["_message"+n(1231)]=[],this[n(1601)+n(630)]=null,this[n(828)+n(235)]=!1,this["_binaryT"+n(1003)]=e[n(1172)],this[n(1321)+"Lock"]=!1,this["_connectionTimeo"+n(846)]=null,this["_reconne"+n(1148)+n(851)]=null,this[n(455)+"gTimeoutId"]=null,this[n(1311)]=0,this[n(1032)]=!1,this[n(968)]="",this[n(1124)+n(1600)]=null,this._cursorManager=null,this[n(795)+n(1673)]=null,this[n(496)+"ls"]=e[n(642)],this[n(1377)]=3,this.CONNECTING=0,this.OPEN=1,this.CLOSING=2,this[n(789)]=g=>{let u=n;try{e[u(307)](cs,this,g,[Na,Oa,Ra])}catch(_){let b=e[u(1447)](xe,e[u(1020)],{message:_[u(1048)],code:Me[u(310)+"OR"],error:_});this[u(1460)+u(543)+u(910)](b)}},this[n(1381)+"ge"]=async g=>{let u=n,_={XqpMz:function(S,C){return o.aXSWq(S,C)},OQHDn:function(S,C){return o.ZdpTD(S,C)},VazyP:o[u(1169)],QXdBR:function(S,C){return o[u(1671)](S,C)},idjSt:function(S,C){return o.SOIQj(S,C)}},{pingInterval:b,pingFrequency:A}=this[u(886)];if(o[u(1006)]("hi",g[u(1440)])&&o.fsqCz(o[u(1101)],A)||o[u(1563)](u(1511),A))if(o[u(807)](o[u(1648)],o.yjwAw))this[u(1630)+u(1065)](),this[u(1663)](o.wOBaO,o[u(577)]),this[u(455)+u(292)+"Id"]=o[u(1058)](setTimeout,this[u(748)][u(392)](this),b);else return this[u(306)][u(1582)]();if(g[u(1440)]!=="hi")try{o[u(1346)](cs,this,g,[la,ua,La,Ta,Pa,da])}catch(S){if(o[u(1613)]===o[u(1613)]){let C=o[u(1058)](xe,o[u(1022)],{message:S[u(1048)],code:Me[u(1659)+"ERROR"],error:S});this[u(1460)+u(543)+u(910)](C)}else{let C=this[u(1021)+"rs"][_0x285184];if(C)C[u(1612)]().forEach(k=>k.fn[u(1075)](k[u(1052)],_0x37a770));else if(vfuyJx[u(711)](u(1145),_0x356e3b)&&!this[u(1624)]){let k=_0x403434[u(1240)]&&_0x585d7f[0];if(vfuyJx[u(666)](k,_0x3701a5))throw k;let M=new _0x51fc4e(vfuyJx[u(806)]+(k?vfuyJx[u(299)](vfuyJx.idjSt(" (",k[u(1048)]),")"):""));throw M.context=k,k}return this}}},this[n(422)]=g=>{let u=n,_={sTDOi:function(S,C){return o[P(788)](S,C)},OVdOk:function(S,C){return S|C},fTyOp:function(S,C){return o[P(1675)](S,C)},SiKWl:function(S,C){return o[P(714)](S,C)},sAoMr:function(S,C){return o.SOIQj(S,C)},SUqgc:function(S,C){return o[P(889)](S,C)},LwcuM:function(S,C){return o[P(978)](S,C)},qRKQz:function(S,C){return S<<C},yZWte:function(S,C){return S+C},jKMio:function(S,C){return S+C},nnEEt:function(S,C){return o.bYxiX(S,C)}},b=this[u(1601)+"tManager"]?.[u(892)+u(1330)+"es"](),A=this[u(1601)+u(630)]?.[u(1444)+"ntEndpoint"]();if(b&&!g.message)if(u(1463)!==o[u(387)]){let S="connect "+A+(u(237)+u(390)+"es reached");this._dispatchErrorEvent(o[u(1058)](xe,o[u(1022)],{message:S,code:Me[u(1445)+u(1394)+"R"],error:g}));return}else{let S=new _0x57f33c(eJvVzy.sTDOi(eJvVzy[u(419)](eJvVzy[u(419)](eJvVzy.fTyOp(_0x59d2d8[_0x430174+4],24),eJvVzy[u(976)](_0x82ca6e[eJvVzy[u(580)](_0x1ae72e,5)],16)),eJvVzy[u(1149)](_0x1bf93e[eJvVzy[u(580)](_0x454f9f,6)],8)),_0x37da8f[eJvVzy[u(680)](_0x4edeed,7)]),eJvVzy.OVdOk(eJvVzy[u(236)](eJvVzy[u(976)](_0x5f621a[eJvVzy.SUqgc(_0x5e639e,0)],24)|eJvVzy[u(568)](_0x164779[eJvVzy[u(669)](_0x946919,1)],16),_0x174a67[_0x29de1a+2]<<8),_0x86bf27[eJvVzy.jKMio(_0x2a087f,3)]),!0);return _0x2d148c+=8,{value:S,offset:eJvVzy.nnEEt(_0x285df1,8)}}this[u(250)]&&this[u(250)][u(364)+"te"]===this.OPEN&&this[u(1365)+"ect"](),this[u(1460)+u(543)+"ent"](xe(o[u(1022)],{message:g[u(1048)],code:Me.NATIVE_ERROR,error:g}))},this[n(827)]=async g=>{let u=n;this[u(1561)+u(1535)](),this[u(1630)+u(1065)](),this[u(1113)+u(817)+"rs"](),this[u(250)]=null,this["_connect"+u(1265)]=!1;let _=this["_endpoin"+u(630)]?.[u(892)+u(1330)+"es"]();if(!_&&this[u(927)+"orOnline"]()&&!this[u(828)+"osed"]){let b=this[u(1601)+"tManager"]?.["getCurre"+u(836)+"nt"](),A=this[u(886)]["reconnec"+u(215)+"ptor"](g[u(501)],g.reason);this["_dispatc"+u(427)+u(910)](o.KICNz(he,o[u(955)],{code:1006,reason:g[u(751)]||u(259)+u(239)+u(826)+u(1531)+"n, hostn"+u(660)+b,willReconnect:A})),A&&this[u(1321)]();return}if(o[u(1072)](1e3,g.code)&&this[u(828)+u(235)]){this[u(1460)+u(427)+u(910)](o[u(1393)](he,o[u(955)],{code:1e3,reason:u(1090)})),this[u(1601)+u(630)]?.[u(1506)+u(1150)+u(519)](),this[u(795)+u(1673)]?.["resetCou"+u(268)]();return}if(o[u(807)](1e3,g[u(501)])&&_){let b=this["_endpoin"+u(630)]?.[u(1444)+u(836)+"nt"](),A=g[u(751)];A||(A=await o[u(1355)](ia,this[u(968)])),A=u(259)+u(239)+u(629)+A+(u(1593)+u(1242))+b+(u(254)+"tries re"+u(924)),this["_dispatc"+u(427)+u(910)](o[u(1393)](he,o[u(955)],{code:g[u(501)],reason:A}));let S="connect "+b+(u(237)+u(390)+u(973)+"ed");this[u(1460)+u(543)+u(910)](o[u(1654)](xe,o[u(1022)],{message:S,code:Me["MAX_RETR"+u(1394)+"R"]})),this[u(1601)+u(630)]?.[u(1506)+u(1150)+u(519)](),this[u(795)+u(1673)]?.["resetCou"+u(268)]();return}if(o[u(1635)](1e3,g[u(501)])&&!g.reason){let b=this[u(1601)+u(630)]?.[u(1444)+u(836)+"nt"]();this[u(1460)+"hCloseEvent"](o[u(497)](he,o[u(955)],{code:g[u(501)],reason:u(259)+u(239)+"d, unkno"+u(1531)+u(389)+u(660)+b})),this[u(1601)+u(630)]?.["resetEnd"+u(1150)+u(519)](),this[u(795)+u(1673)]?.[u(1487)+u(268)]();return}this[u(1460)+u(427)+"ent"](g),this[u(1601)+u(630)]?.[u(1506)+u(1150)+u(519)](),this["_pingLos"+u(1673)]?.[u(1487)+u(268)]()},this.onclose=null,this[n(1624)]=null,this[n(1029)+"e"]=null,this[n(1565)]=null,this[n(451)+n(1305)]=null,this[n(776)+"eAck"]=null,this[n(782)+n(357)+"yReconnect"]=null,this["_handleO"+n(337)]=this["_handleO"+n(337)][n(392)](this),this[n(1156)+n(745)]=this[n(1156)+n(745)][n(392)](this),this[n(1225)+"ageHide"]=this[n(1225)+n(1016)][n(392)](this),this[n(1225)+n(341)]=this["_handleP"+n(341)].bind(this),this[n(886)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(1462)](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:n(1511),pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:"CONTINUE",env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:l}=t,p=Array[n(578)](c)?c:e[n(334)]==typeof c?[c]:[];if(!p||e[n(765)](0,p[n(1240)]))throw new Error("please provide v"+n(1459));if(!e.YdbvV(ta,l))throw new Error(e[n(561)]);if(Object[n(1372)](this._options,t),this[n(1601)+"tManager"]=new xs(p,this[n(886)][n(185)+"es"]),this._pingLossCounter=new sa(this._options[n(605)+n(295)]),this._options["automati"+n(1181)]&&(this[n(1032)]=!0,this._connect()),this._options[n(513)+"tworkCha"+n(309)])if(e.hQKmM(n(1464),e[n(1099)]))this._isMiniTT||this[n(1472)+"X"]?this[n(247)+"etWorkCh"+n(720)]():this[n(225)+"er"]&&this[n(797)+n(279)+"Listener"]();else{let g=_0x59a6e8(o[n(1022)],{message:_0x161fe9.message,code:_0x426fcf["MESSAGE_"+n(1607)],error:_0x2027ab});this[n(1460)+n(543)+"ent"](g)}}[r(1156)+"nLine"](){let t=r;this[t(886)]["disableA"+t(761)+"nect"]||this[t(828)+t(235)]||this["_handleR"+t(1305)]()}[r(1156)+r(745)](){let t=r,n={JgPvc:function(o,c){return e[P(814)](o,c)},wRYxU:function(o,c){return e[P(1482)](o,c)},zIfse:function(o,c){return e.ogMLc(o,c)},bHCfC:function(o,c){return e[P(1416)](o,c)},YZARA:function(o,c){return e[P(505)](o,c)},ANcip:function(o,c){return e.GUwax(o,c)},exAEq:function(o,c){return e[P(1629)](o,c)},eHEHe:function(o,c){return o>>>c}};if(e[t(1274)](e.OIZsV,"mWmPH")){this["_destroy"+t(554)+"t"]();let o=e.XkdAO(Jn,e[t(721)],{message:t(775)+t(1649)+" reconnect"});this[t(782)+t(357)+t(742)+"ct"]&&this[t(782)+"mediatel"+t(742)+"ct"](o)}else{let o=_0xbf676c[t(657)],c=_0x4da0c1[t(1521)];return _0x44b464[_0x191f2b]=TiiwBu.JgPvc(c,24),_0x1f2a5c[TiiwBu[t(1243)](_0x276228,1)]=TiiwBu.zIfse(TiiwBu[t(940)](c,16),255),_0x1d69df[TiiwBu[t(1243)](_0x42efc1,2)]=TiiwBu.JgPvc(c,8)&255,_0x434c3c[TiiwBu[t(902)](_0x505b2b,3)]=TiiwBu[t(535)](255,c),_0x3b7d77[TiiwBu[t(1243)](_0x4e5c16,4)]=TiiwBu[t(406)](o,24),_0x30f6d7[_0x330f25+5]=TiiwBu[t(535)](o>>>16,255),_0x56a60f[TiiwBu[t(511)](_0x42f0bb,6)]=TiiwBu[t(977)](TiiwBu[t(1147)](o,8),255),_0x25825a[_0x5060e8+7]=TiiwBu.zIfse(255,o),_0x2272ca+=8,_0x52abf3}}[r(797)+r(279)+r(1679)](){let t=r;this[t(225)+"er"]&&window[t(252)+t(1679)](e[t(425)],this._handleOnLine),this[t(225)+"er"]&&window[t(252)+"Listener"](e.dcVXv,this[t(1156)+t(745)]),this[t(225)+"er"]&&window["addEvent"+t(1679)](t(596),this._handlePageHide),this[t(225)+"er"]&&window[t(252)+t(1679)](e[t(471)],this[t(1225)+t(341)])}[r(985)+r(279)+r(1679)](){let t=r;this._isBrowser&&window[t(544)+t(1175)+t(1335)](t(1004),this[t(1156)+t(337)]),this[t(225)+"er"]&&window.removeEventListener(e.dcVXv,this[t(1156)+t(745)]),this[t(225)+"er"]&&window[t(544)+"entListe"+t(1335)](e[t(213)],this["_handleP"+t(1016)]),this[t(225)+"er"]&&window[t(544)+"entListener"](e[t(471)],this["_handleP"+t(341)])}["_handleP"+r(1016)](t){let n=r;e.QhOCP(e.MDsiN,n(1035))?(hqcnaa[n(1051)](hqcnaa[n(1496)],typeof _0x296fac)&&_0x2da565[n(382)+n(527)]&&_0x4c1e4e[n(1409)+n(757)](_0x25083e,_0x33dbd3[n(382)+n(527)],{value:n(293)}),_0x480910[n(1409)+n(757)](_0x11bf56,hqcnaa.oEHEG,{value:!0})):(!t[n(489)+"d"]&&(this[n(225)+"er"]&&window[n(544)+n(1175)+n(1335)](e.yUIGJ,this[n(1225)+"ageHide"]),this._isBrowser&&window[n(544)+"entListe"+n(1335)]("pageshow",this[n(1225)+n(341)]),this[n(898)]()),this[n(225)+"er"]&&window[n(544)+n(1175)+n(1335)](e[n(425)],this[n(1156)+"nLine"]),this[n(225)+"er"]&&window[n(544)+n(1175)+n(1335)](e.dcVXv,this["_handleO"+n(745)]))}[r(1225)+"ageShow"](t){let n=r;t[n(489)+"d"]&&(this[n(927)+n(1212)]()&&(!this[n(250)]||e[n(805)](this[n(250)][n(364)+"te"],this[n(610)])||this[n(250)][n(364)+"te"]!==this.CONNECTING)&&this[n(1156)+n(337)](),this[n(225)+"er"]&&window["addEvent"+n(1679)](e[n(425)],this[n(1156)+n(337)]),this[n(225)+"er"]&&window[n(252)+"Listener"](e.dcVXv,this[n(1156)+n(745)]))}async[r(219)+r(1241)](t){let n=r,{fpID:o,deviceID:c,bddID:l,ttwID:p,accessKey:g,aID:u,customParams:_={},enableAutoAck:b,enableQoS:A,QoSLevel:S,env:C}=this[n(886)],k,M,ee;this[n(225)+"er"]||this._isMiniWX||this[n(391)+"T"]?(k=location&&e[n(1590)](e.pQJlK,location.protocol)?e.GlHWZ:e[n(607)],M=t.replace(/((^ws)|(^http))((?:[s]*:\/\/))/,""),ee=/^wss(.*:\/\/)/[n(301)](t)?t:""+k+M):(k=n(335),M=t[n(875)](/(^http)((?:[s]*:\/\/))/,""),ee=/(^ws)((?:[s]*:\/\/))/[n(301)](M)?M:""+k+M);let tr=l?n(1446):p?e.SvBxN:e[n(832)],ms=l||p||c;if(e.hUBvH(!ms,!tr))throw new Error(n(1400)+n(1573)+n(1434)+"viceID or ttwID");let Ma=e.erKdb(e[n(1079)],typeof _)?await e[n(1581)](_):_,za=C?ra(C[n(934)],C[n(1201)]):{},nr=Object[n(1372)]({device_platform:e[n(1039)],version_code:e[n(1550)],access_key:g,fpid:o,aid:u,[tr]:ms,xsack:b?1:0,xaack:b?1:0,xsqos:A?1:0,qos_level:A?S:void 0,qos_sdk_version:2,...za},Ma),qa=Object[n(959)](nr).reduce((rr,sr)=>nr[sr]!==void 0?""+rr+(rr?"&":"?")+sr+"="+nr[sr]:rr,"");return ee+n(414)+qa}async[r(1321)](){let t=r,n={AnkaZ:function(o,c){return e[P(319)](o,c)}};if(!(this["_connect"+t(1265)]||this[t(828)+t(235)])){this._connectLock=!0;try{let o=this["_endpoin"+t(630)]?.[t(1530)+t(366)+"ointReac"+t(957)+t(1405)](),{timeoutInterval:c}=this[t(886)];if(o){let p=this[t(1601)+t(630)]?.[t(1444)+t(836)+"nt"](),g=this["_endpoin"+t(630)]?.["replaceB"+t(1059)+t(1189)+t(222)+t(1358)](),u=this[t(1601)+"tManager"]?.["getCurre"+t(836)+t(699)+t(1208)]();if(g){let _="connect "+p+(t(1163)+t(254)+t(1543)+t(193)+t(965)+"backup e"+t(855))+g+(t(199)+"y"),b=e[t(397)](xe,e[t(1020)],{message:_,code:Me.MAX_RETRIES_ERROR});this[t(453)](_),this["_dispatc"+t(543)+t(910)](b),this[t(968)]=await this[t(219)+t(1241)](g),this[t(453)](t(1294)+g+" "+u+t(1540)),this[t(1113)+t(817)+"rs"]()}else{let _="connect "+p+(t(1163)+", max retries reached");this._debug(_),this[t(1460)+"hErrorEv"+t(910)](xe("error",{message:_,code:Me[t(1445)+"IES_ERROR"]}));return}}else{let p=this["_endpoin"+t(630)]?.[t(1444)+t(836)+t(1420)+t(1554)](),g=this[t(1601)+t(630)]?.[t(1444)+"ntEndpoi"+t(699)+t(1208)]();this[t(968)]=await this[t(219)+t(1241)](e[t(1503)](p,"")),this._debug(t(1294)+p+" "+g+t(1540)),this[t(1113)+t(817)+"rs"]()}if(this._isInit)this[t(1032)]=!1;else{let p=e[t(1387)](Jn,t(421)+"t",{message:"start"});this[t(451)+"econnect"]&&this[t(451)+"econnect"](p)}let l=this[t(1601)+t(630)]?.["getCurrentEndpoi"+t(699)+t(1208)]()||0;e[t(245)](l,1)&&await this._wait(e[t(442)](l,1)),this[t(453)]("connecti"+t(1429)+this[t(968)]+(" protoco"+t(1023))+this._protocols),this[t(250)]=e[t(1226)](ea,{url:this._url,protocols:[this._protocols],headers:this._options[t(728)+t(786)+"s"][t(1366)+t(1537)]},this[t(886)].ws),(this[t(225)+"er"]||this[t(1502)+"r"])&&this[t(250)]&&(this[t(250)][t(1009)+"pe"]=this[t(861)+t(1003)]),this._addWsListeners(),this[t(1321)+t(1513)+t(846)]=setTimeout(this[t(269)+"ut"][t(392)](this),c)}catch(o){if(e[t(428)]!==t(1193))nmZSRu[t(926)](_0x3bc9e4,_0xf625b4)&&_0x5aa004.set(_0x165784,_0x6a82e2);else throw this[t(1321)+t(1265)]=!1,o}}}["_clearTi"+r(1535)](){let t=r;e[t(528)](clearTimeout,this[t(1321)+t(1513)+t(846)]),this[t(1321)+t(1513)+t(846)]=null}[r(1630)+r(1065)](){let t=r;clearTimeout(this[t(455)+t(292)+"Id"]),e.cmMbQ(clearTimeout,this[t(495)+t(1148)+"tId"]),this["_pingPon"+t(292)+"Id"]=null,this["_reconne"+t(1148)+t(851)]=null}[r(453)](...t){let n=r,o={PLtUz:function(c,l,p){return e[P(950)](c,l,p)}};if(e[n(286)]===e[n(286)])this[n(886)][n(271)]&&console[n(474)][n(1075)](console,[e[n(1133)],...t]);else{let c=xyUZvY[n(350)](_0x450d6c,_0x3355dc,_0x181d5d[n(1240)]);_0x5d4ba5[n(482)][n(454)](_0x192b5b,c)}}["_getInte"+r(359)+"e"](t){let n=r;if(e[n(330)](e[n(929)],n(383))){if(_0x28c940[n(1240)]!==4){let o=_0x3c8ca6[n(1108)+"g"](0,e[n(1651)](4,_0x2ebab0[n(1240)])),c=o[n(1606)](_0x156314);_0x3477f5[n(361)](c)}else _0x3dd5fc[n(361)](_0x4c4fe6);_0x58f60b&&(_0x4f29eb+=1),_0x271734+=1,_0x4dd88e=!1}else{let{initReconnectInterval:o,maxReconnectInterval:c,reconnectIntervalGrowFactor:l}=this[n(886)],p=o*Math[n(198)](l,e[n(521)](t,1));return e.rtyVN(p,c)?c:p}}[r(748)](){let t=r;if(this[t(250)]&&e[t(468)](this[t(250)][t(364)+"te"],this.CONNECTING))if(e[t(438)](e.uhIEp,e.uhIEp)){this[t(1630)+t(1065)](),this[t(455)+t(292)+"Id"]=e[t(1053)](setTimeout,this._ping.bind(this),this[t(886)]["pingInte"+t(1041)]);return}else return e[t(405)](_0x1fe377,_0x375916)?_0x12d4e1:new _0x30165c(e[t(298)](_0x23a8a0[t(988)](_0x210e0d,0)|e[t(1263)](_0x3e3429[t(988)](_0x542089,1),8)|_0x4bffed[t(988)](_0x586886,2)<<16|e[t(1263)](_0x217a87[t(988)](_0xb9e95a,3),24),0),e[t(1452)](e[t(884)](e[t(520)](_0x460824[t(988)](_0x11f4c7,4),_0x4baafe[t(988)](_0x20894d,5)<<8),e[t(1263)](_0x3a0900[t(988)](_0x1bc8fe,6),16))|e[t(1418)](_0x102c72[t(988)](_0x4e06ad,7),24),0),!0);if(!this[t(250)]||this[t(250)][t(364)+"te"]!==this[t(610)])return void this[t(463)+t(1305)]();this._ws&&this._ws[t(329)]("hi"),this[t(495)+t(1148)+"tId"]=setTimeout(this[t(463)+t(1305)+"Timeout"].bind(this),this[t(886)][t(1130)+"outInter"+t(983)])}[r(463)+r(1305)+r(266)](){let t=r;this[t(795)+"sCounter"]?.[t(717)](),this[t(1663)](e.QoMlx,t(1063)),this._pingLossCounter?.[t(892)+t(888)+"nt"]()?this._handleReconnect():this[t(748)]()}[r(927)+"orOnline"](){let t=r;return this[t(391)+"T"]||this[t(1472)+"X"]?this[t(370)+t(1656)+"line"]:(this._isBrowser||this[t(1502)+"r"])&&this._options.listenNetworkChanged?navigator[t(1558)]:!0}[r(463)+r(1305)](){let t=r;!this[t(927)+"orOnline"]()||this[t(828)+"osed"]||(this[t(1601)+t(630)]?.[t(1506)+"pointCon"+t(519)](),this[t(795)+t(1673)]?.["resetCou"+t(268)](),this[t(250)]?this[t(1365)+"ect"](1001,t(1660)+t(1258)+t(421)+t(1220)+t(949),!0):this._connect())}[r(247)+r(384)+r(720)](){let t=r;this._isMiniTT?tt["onNetwor"+t(1501)+"hange"](({isConnected:n})=>{let o=t;this["_miniNav"+o(1656)+o(800)]=n,n?this[o(1156)+o(337)]():this._handleOffLine()}):this._isMiniWX&&wx[t(1091)+"kStatusChange"](({isConnected:n})=>{let o=t;this["_miniNav"+o(1656)+o(800)]=n,n?this[o(1156)+"nLine"]():this[o(1156)+o(745)]()})}[r(1455)](t){let n={GQNaH:function(o,c,l){return e.BmNsg(o,c,l)}};return new Promise(o=>{let c=P;if(c(1557)===c(1557))n.GQNaH(setTimeout,o,this[c(433)+c(359)+"e"](t));else return this[c(1574)][c(194)]})}[r(1365)+r(1034)](t=1e3,n="",o=!1){let c=r;if(e.AmyQj===e[c(204)])return _0xa6fae8|=0,{low:_0x209f2d,high:e[c(1144)](_0x875a77,31),unsigned:e[c(284)](_0x308995,0)};if(!this[c(250)])return;this[c(1167)+c(554)+"t"](t,n,o)}[r(269)+"ut"](){let t=r,n={uJtvM:function(o,c){return o(c)},ZICAx:function(o,c){return e[P(852)](o,c)}};if(e[t(1117)]===e[t(812)])return function(o,...c){let l=t,p=_0x25fc85[l(988)](CWRYDt[l(1552)](_0x5b05d6,this),o,...c);return _0x2a83c4[l(454)](p,o[l(248)]?o[l(248)]():[o]),CWRYDt[l(1603)](_0x4e3147,p)};{let o=this["_endpoin"+t(630)]?.[t(1444)+t(836)+"nt"]();this._debug(t(1294)+o+t(1163)),this[t(1365)+t(1034)](1001,e[t(360)],!0)}}[r(1037)](t){let n=r,o=e[n(262)](jn,t);this[n(250)]&&e.UsXNW(this[n(250)][n(364)+"te"],this[n(610)])&&(this[n(250)]&&this[n(250)][n(329)](o),this[n(453)](e[n(1268)],t))}[r(1113)+"sListeners"](){let t=r,n=e[t(285)][t(914)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(250)]["removeEv"+t(1175)+t(1335)](e[t(278)],this._onMessage);continue;case"1":if(!this[t(250)])return;continue;case"2":this._ws[t(544)+t(1175)+t(1335)]("close",this[t(827)]);continue;case"3":this[t(250)][t(544)+t(1175)+t(1335)](e.nxowM,this[t(789)]);continue;case"4":this._ws["removeEventListe"+t(1335)](t(1145),this._onError);continue}break}}[r(1435)+"steners"](){let t=r,n=e[t(1040)].split("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(250)][t(252)+"Listener"](e.lHOPI,this[t(422)]);continue;case"1":if(!this[t(250)])return;continue;case"2":this._ws[t(252)+t(1679)](e[t(1532)],this[t(789)]);continue;case"3":this[t(250)][t(252)+"Listener"](t(1048),this[t(1381)+"ge"]);continue;case"4":this[t(250)][t(252)+t(1679)](t(898),this[t(827)]);continue}break}}[r(771)+r(943)](t=1e3,n=""){let o=r;try{this[o(250)]&&this._ws[o(898)](t,n)}catch{}}[r(1167)+"WebSocket"](t=1e3,n="",o=!1){let c=r;if(this[c(1630)+c(1065)](),this["_clearTi"+c(1535)](),this[c(1113)+"sListeners"](),this[c(771)+c(943)](1e3,n),this[c(1321)+"Lock"]=!1,o&&this["_navigat"+c(1212)]()&&!this["_readyCl"+c(235)]){if(e[c(664)](e[c(1214)],e[c(1214)]))return _0x421467.resolve();if(this[c(1601)+c(630)]?.[c(892)+c(1330)+"es"]()){let p=this._endpointManager?.[c(1444)+c(836)+"nt"]();this[c(1460)+"hCloseEvent"](e[c(397)](he,e[c(300)],{code:1006,reason:"connect "+p+(c(1163)+", max re"+c(1543)+"ached"),wasClean:!0}))}else{let p=this._options[c(421)+c(215)+c(746)](t,n);this[c(1460)+"hCloseEv"+c(910)](e[c(1383)](he,e[c(300)],{code:t,reason:n,wasClean:!0,willReconnect:p})),p&&this._connect()}return}this[c(927)+c(1212)]()||this[c(828)+c(235)]?this[c(1460)+c(427)+c(910)](he(e.CAVof,{code:t,reason:e[c(508)]})):this[c(1460)+c(427)+c(910)](e[c(845)](he,e[c(300)],{code:1006,reason:e[c(766)]})),this[c(250)]=null,this["_endpoin"+c(630)]?.[c(1506)+c(1150)+c(519)](),this[c(795)+"sCounter"]?.[c(1487)+c(268)]()}["_dispatc"+r(1604)+"nt"](t){let n=r;this[n(1663)](n(1567),t),this[n(1565)]&&this[n(1565)](t)}[r(1460)+r(336)+"Event"](t){let n=r;this[n(1663)](e.dhBQb,t),this[n(1029)+"e"]&&this[n(1029)+"e"](t)}[r(1460)+r(869)+r(572)](t){let n=r;if(e[n(1580)](e[n(230)],e[n(747)]))switch(_0x1e872b){case e[n(882)]:case e[n(1598)]:return{["x-use-"+_0x7f771f]:1,"x-tt-env":_0x34fae1};default:return{}}else this[n(1663)](e[n(1282)],t),this[n(776)+n(1357)]&&this[n(776)+"eAck"](t)}["_dispatc"+r(543)+r(910)](t){let n=r;this[n(1663)](e.lHOPI,t),this[n(1624)]&&this[n(1624)](t)}[r(1460)+"hCloseEv"+r(910)](t){let n=r;this.emit("close",t),this[n(1450)]&&this[n(1450)](t)}get binaryType(){let t=r;return this[t(250)]?this[t(250)][t(1009)+"pe"]:this[t(861)+t(1003)]}set[r(1009)+"pe"](t){let n=r;this[n(861)+"ype"]=t,this[n(250)]&&(this[n(250)][n(1009)+"pe"]=t)}get[r(960)+"nt"](){let t=r;return this[t(1601)+"tManager"]?.["getCurre"+t(836)+t(699)+"ount"]()||0}get[r(518)+r(913)](){let t=r,n=this._messageQueue[t(1180)]((o,c)=>(o+=c&&c.byteLength||0,o),0);return e[t(686)](n,this[t(250)]?this[t(250)][t(518)+t(913)]:0)}get[r(1333)+"ns"](){let t=r;return this._ws?this[t(250)][t(1333)+"ns"]:""}get[r(649)](){let t=r;return this[t(250)]?this[t(250)][t(649)]:""}get[r(364)+"te"](){let t=r;return this._ws?this[t(250)][t(364)+"te"]:this[t(886)][t(325)+"cOpen"]?this[t(569)+"NG"]:this[t(1377)]}get[r(194)](){let t=r;return this[t(250)]?this[t(250)][t(194)]:this[t(968)]}[r(898)](t=1e3,n){let o=r,c=e.oUYTM[o(914)]("|"),l=0;for(;;){switch(c[l++]){case"0":this[o(985)+o(279)+"Listener"]();continue;case"1":this[o(1124)+o(1600)]?.closeDB();continue;case"2":this["_destroy"+o(554)+"t"](t,n);continue;case"3":this[o(1561)+o(1535)]();continue;case"4":if(e[o(874)](this[o(250)].readyState,this.CLOSED)||this._ws[o(364)+"te"]===this[o(1042)])return void this[o(453)](o(435)+o(675)+o(249));continue;case"5":if(!this[o(250)])return void this[o(453)](e[o(1443)]);continue;case"6":this["_readyCl"+o(235)]=!0;continue;case"7":this._clearPingTimer();continue}break}}async[r(329)](t,n){let o=r;if(e[o(1590)](null,t))throw new Error(e[o(1442)]);e.erKdb(e[o(1296)],typeof t)&&(t=JSON[o(1412)+"y"](t)),e[o(334)]!=typeof t&&!(t instanceof ArrayBuffer)&&!(t.buffer&&e[o(481)](t[o(1621)],ArrayBuffer))&&(t=JSON[o(1412)+"y"](t));let c=await e[o(343)](ds,t),l=e[o(1494)](na,t),{method:p=0,service:g=this[o(886)][o(1269)],logID:u=this[o(886)].logIDGenerator(),headers:_=this._options[o(1171)],payloadEncoding:b=this._options["payloadE"+o(710)],payloadType:A=this[o(886)][o(456)+o(1003)],logIDNew:S=this[o(886)][o(1451)+o(779)][o(1422)+o(830)+o(1549)+"ew"]?e[o(1142)](a,this[o(886)][o(1451)+o(779)][o(326)]):""}=e[o(1256)](n,{});if(!g)throw new Error(e[o(864)]);let C={SeqID:B[o(1069)+"er"](this[o(1311)]++),LogID:B.fromNumber(u),service:g,method:p,headers:_,payloadEncoding:e[o(1083)](b,Object)?b[o(890)]?b[o(890)]:"":b,payloadType:e[o(1083)](A,Object)?A[o(1112)]?A[o(1112)]:l:A||l,payload:c,LogIDNew:S},k=e.eKTeI(jn,C);return this[o(250)]&&e[o(438)](this._ws.readyState,this[o(610)])?(this._ws&&this[o(250)][o(329)](k),this[o(453)](e.KmTdl,C)):e.xzHYL(this[o(1096)+o(1231)].length,this._options[o(1324)+o(1431)+o(1411)])?(this[o(1096)+o(1231)][o(361)](k),this[o(453)](e.bCPfW,C)):(this[o(1096)+o(1231)].shift(),this[o(1096)+o(1231)][o(361)](k)),{seqID:this[o(1311)],logID:u,logIDNew:S}}async[r(421)+"t"](t){let n=r,{url:o}=e[n(331)](t,{}),c=Array[n(578)](o)?o:e[n(1590)](e[n(334)],typeof o)?[o]:[];t&&Object[n(1372)](this[n(886)],t),c&&c[n(1240)]?this[n(1601)+n(630)]=new xs(c,this[n(886)][n(185)+"es"]):this[n(1601)+"tManager"]?.[n(1506)+n(1150)+n(519)](),this[n(795)+n(1673)]?.[n(1487)+n(268)](this[n(886)].pingLossCount),this[n(828)+n(235)]=!1,this[n(250)]&&e.hVwrW(this._ws[n(364)+"te"],this[n(1377)])?this[n(1365)+"ect"](1e3,e.ccspS,!0):(this[n(1032)]=!0,this[n(1321)]())}async[r(460)](){let t=r,n={zaJRc:function(o,c){return e[P(899)](o,c)},WOqkN:function(o,c){return o*c},DLPFD:function(o,c){return e[P(1186)](o,c)}};if(!this[t(1321)+t(1265)])if(e[t(1396)]===e[t(1396)])this._endpointManager?.[t(1506)+t(1150)+"fig"](),this[t(795)+t(1673)]?.resetCounter(),this["_readyCl"+t(235)]=!1,this._isInit=!0,this[t(1321)]();else return rOwdJa[t(770)](rOwdJa[t(1669)](1e4,_0x43a297[t(1205)]()),_0x35456f.floor(rOwdJa[t(368)](1e4,_0x4c4b70[t(1087)]())))}addEventListener(t,n){this.on(t,n)}[r(588)+r(601)](t){let n=r,{type:o}=t;this[n(1663)](o,t)}[r(544)+"entListe"+r(1335)](t,n){this[r(625)](t,n)}[r(897)](){let t=r,n={PQrjD:e[t(1402)],BAVkg:e.DJuaV,jmOFC:"ping_onc"+t(1093)+"t",bkWfD:e[t(1115)],QfXZC:function(o,c,l){return o(c,l)}};return new Promise((o,c)=>{let l=t,p={gTfUM:n[l(1308)],SWWKL:n[l(1301)]};this["_clearPi"+l(1065)](),this[l(455)+l(292)+"Id"]=n[l(594)](setTimeout,this[l(748)].bind(this),this[l(886)][l(678)+"rval"]);let g=()=>{let _=l;o(p[_(768)]),this.off(_(1504)+"e_success",g),this[_(625)](p[_(557)],u)},u=()=>{let _=l;c(n[_(1111)]),this[_(625)](n[_(755)],g),this.off(n[_(1301)],u)};this.on(n[l(755)],g),this.on(n[l(1301)],u),this[l(748)]()})}}})(),X[E(1480)+E(1353)]=V[E(1480)+E(1353)],X[E(1206)+E(402)]=V["CustomEr"+E(402)],X[E(979)+"e"]=V.ErrorCode,X.Event=V.Event,X.FWS=V[E(1433)],X[E(729)+E(1120)+E(1642)]=V[E(729)+E(1120)+E(1642)],X["MessageE"+E(1642)]=V["MessageE"+E(1642)],X.OpenEvent=V.OpenEvent,X[E(1505)+E(1139)]=V[E(1505)+E(1139)],X[E(321)+E(1353)]=V[E(321)+E(1353)],X[E(1577)+E(402)]=V["createEr"+E(402)],X[E(356)+"ssageEvent"]=V[E(356)+E(393)+"nt"],X[E(1153)+E(682)]=V[E(1153)+E(682)],X[E(1314)+E(1499)+E(1642)]=V[E(1314)+E(1499)+E(1642)],X[E(713)+E(287)]=V[E(713)+E(287)],X["encodeFr"+E(374)]=V[E(1221)+E(374)];for(dn in V)["CustomCl"+E(1353),E(1206)+E(402),E(979)+"e",E(601),"FWS",E(729)+E(1120)+E(1642),E(1120)+E(1642),E(291)+"t",E(1505)+E(1139),E(321)+E(1353),E(1577)+E(402),E(356)+"ssageEvent","createOpenEvent","createRe"+E(1499)+E(1642),E(713)+E(287),E(1221)+E(374)][E(1158)](dn)===-1&&(X[dn]=V[dn]);var dn;Object[E(1409)+"operty"](X,E(872)+"le",{value:!0})});var Te=ie((gl,di)=>{"use strict";var fi=["nodebuffer","arraybuffer","fragments"],ui=typeof Blob<"u";ui&&fi.push("blob");di.exports={BINARY_TYPES:fi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:ui,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Pt=ie((pl,wn)=>{"use strict";var{EMPTY_BUFFER:Px}=Te(),hr=Buffer[Symbol.species];function Lx(r,e){if(r.length===0)return Px;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 hr(i.buffer,i.byteOffset,a):i}function li(r,e,i,a,x){for(let f=0;f<x;f++)i[a+f]=r[f]^e[f&3]}function hi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function Tx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function gr(r){if(gr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new hr(r):ArrayBuffer.isView(r)?e=new hr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),gr.readOnly=!1),e}wn.exports={concat:Lx,mask:li,toArrayBuffer:Tx,toBuffer:gr,unmask:hi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=J("bufferutil");wn.exports.mask=function(e,i,a,x,f){f<48?li(e,i,a,x,f):r.mask(e,i,a,x,f)},wn.exports.unmask=function(e,i){e.length<32?hi(e,i):r.unmask(e,i)}}catch{}});var mi=ie((ml,pi)=>{"use strict";var gi=Symbol("kDone"),pr=Symbol("kRun"),mr=class{constructor(e){this[gi]=()=>{this.pending--,this[pr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[pr]()}[pr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[gi])}}};pi.exports=mr});var dt=ie((_l,bi)=>{"use strict";var Lt=J("zlib"),_i=Pt(),Nx=mi(),{kStatusCode:wi}=Te(),Ox=Buffer[Symbol.species],Rx=Buffer.from([0,0,255,255]),bn=Symbol("permessage-deflate"),Ne=Symbol("total-length"),ft=Symbol("callback"),He=Symbol("buffers"),ut=Symbol("error"),yn,_r=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!yn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yn=new Nx(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[ft];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){yn.add(x=>{this._decompress(e,i,(f,d)=>{x(),a(f,d)})})}compress(e,i,a){yn.add(x=>{this._compress(e,i,(f,d)=>{x(),a(f,d)})})}_decompress(e,i,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,d=typeof this.params[f]!="number"?Lt.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=Lt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:d}),this._inflate[bn]=this,this._inflate[Ne]=0,this._inflate[He]=[],this._inflate.on("error",Mx),this._inflate.on("data",yi)}this._inflate[ft]=a,this._inflate.write(e),i&&this._inflate.write(Rx),this._inflate.flush(()=>{let f=this._inflate[ut];if(f){this._inflate.close(),this._inflate=null,a(f);return}let d=_i.concat(this._inflate[He],this._inflate[Ne]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ne]=0,this._inflate[He]=[],i&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,d)})}_compress(e,i,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,d=typeof this.params[f]!="number"?Lt.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=Lt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:d}),this._deflate[Ne]=0,this._deflate[He]=[],this._deflate.on("data",Bx)}this._deflate[ft]=a,this._deflate.write(e),this._deflate.flush(Lt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=_i.concat(this._deflate[He],this._deflate[Ne]);i&&(f=new Ox(f.buffer,f.byteOffset,f.length-4)),this._deflate[ft]=null,this._deflate[Ne]=0,this._deflate[He]=[],i&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};bi.exports=_r;function Bx(r){this[He].push(r),this[Ne]+=r.length}function yi(r){if(this[Ne]+=r.length,this[bn]._maxPayload<1||this[Ne]<=this[bn]._maxPayload){this[He].push(r);return}this[ut]=new RangeError("Max payload size exceeded"),this[ut].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ut][wi]=1009,this.removeListener("data",yi),this.reset()}function Mx(r){if(this[bn]._inflate=null,this[ut]){this[ft](this[ut]);return}r[wi]=1007,this[ft](r)}});var lt=ie((wl,vn)=>{"use strict";var{isUtf8:vi}=J("buffer"),{hasBlob:zx}=Te(),qx=[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 Fx(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function wr(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 Ux(r){return zx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}vn.exports={isBlob:Ux,isValidStatusCode:Fx,isValidUTF8:wr,tokenChars:qx};if(vi)vn.exports.isValidUTF8=function(r){return r.length<24?wr(r):vi(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=J("utf-8-validate");vn.exports.isValidUTF8=function(e){return e.length<32?wr(e):r(e)}}catch{}});var Er=ie((yl,Ii)=>{"use strict";var{Writable:Hx}=J("stream"),Si=dt(),{BINARY_TYPES:Kx,EMPTY_BUFFER:Ei,kStatusCode:Gx,kWebSocket:Wx}=Te(),{concat:yr,toArrayBuffer:jx,unmask:Jx}=Pt(),{isValidStatusCode:Vx,isValidUTF8:Ci}=lt(),Sn=Buffer[Symbol.species],ue=0,Ai=1,Di=2,ki=3,br=4,vr=5,En=6,Sr=class extends Hx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Kx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Wx]=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=ue}_write(e,i,a){if(this._opcode===8&&this._state==ue)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 Sn(a.buffer,a.byteOffset+e,a.length-e),new Sn(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 Sn(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 ue:this.getInfo(e);break;case Ai:this.getPayloadLength16(e);break;case Di:this.getPayloadLength64(e);break;case ki:this.getMask();break;case br:this.getData(e);break;case vr:case En:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let i=this.consume(2);if((i[0]&48)!==0){let x=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(x);return}let a=(i[0]&64)===64;if(a&&!this._extensions[Si.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=Ai:this._payloadLength===127?this._state=Di: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=ki:this._state=br}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=br}getData(e){let i=Ei;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&&Jx(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=vr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Si.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 d=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(d);return}this._fragments.push(f)}this.dataMessage(i),this._state===ue&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=ue;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=yr(a,i):this._binaryType==="arraybuffer"?x=jx(yr(a,i)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=ue):(this._state=En,setImmediate(()=>{this.emit("message",x,!0),this._state=ue,this.startLoop(e)}))}else{let x=yr(a,i);if(!this._skipUTF8Validation&&!Ci(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===vr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=ue):(this._state=En,setImmediate(()=>{this.emit("message",x,!1),this._state=ue,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Ei),this.end();else{let a=e.readUInt16BE(0);if(!Vx(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(f);return}let x=new Sn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Ci(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=ue;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=ue):(this._state=En,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=ue,this.startLoop(i)}))}createError(e,i,a,x,f){this._loop=!1,this._errored=!0;let d=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(d,this.createError),d.code=f,d[Gx]=x,d}};Ii.exports=Sr});var Dr=ie((vl,Ti)=>{"use strict";var{Duplex:bl}=J("stream"),{randomFillSync:Yx}=J("crypto"),Pi=dt(),{EMPTY_BUFFER:Xx,kWebSocket:$x,NOOP:Zx}=Te(),{isBlob:ht,isValidStatusCode:Qx}=lt(),{mask:Li,toBuffer:Ye}=Pt(),de=Symbol("kByteLength"),ec=Buffer.alloc(4),Cn=8*1024,Xe,gt=Cn,pe=0,tc=1,nc=2,Cr=class r{constructor(e,i,a){this._extensions=i||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=pe,this.onerror=Zx,this[$x]=void 0}static frame(e,i){let a,x=!1,f=2,d=!1;i.mask&&(a=i.maskBuffer||ec,i.generateMask?i.generateMask(a):(gt===Cn&&(Xe===void 0&&(Xe=Buffer.alloc(Cn)),Yx(Xe,0,Cn),gt=0),a[0]=Xe[gt++],a[1]=Xe[gt++],a[2]=Xe[gt++],a[3]=Xe[gt++]),d=(a[0]|a[1]|a[2]|a[3])===0,f=6);let h;typeof e=="string"?(!i.mask||d)&&i[de]!==void 0?h=i[de]:(e=Buffer.from(e),h=e.length):(h=e.length,x=i.mask&&i.readOnly&&!d);let m=h;h>=65536?(f+=8,m=127):h>125&&(f+=2,m=126);let w=Buffer.allocUnsafe(x?h+f:f);return w[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(w[0]|=64),w[1]=m,m===126?w.writeUInt16BE(h,2):m===127&&(w[2]=w[3]=0,w.writeUIntBE(h,4,6)),i.mask?(w[1]|=128,w[f-4]=a[0],w[f-3]=a[1],w[f-2]=a[2],w[f-1]=a[3],d?[w,e]:x?(Li(e,a,w,f,h),[w]):(Li(e,a,e,0,h),[w,e])):[w,e]}close(e,i,a,x){let f;if(e===void 0)f=Xx;else{if(typeof e!="number"||!Qx(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 d={[de]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==pe?this.enqueue([this.dispatch,f,!1,d,x]):this.sendFrame(r.frame(f,d),x)}ping(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):ht(e)?(x=e.size,f=!1):(e=Ye(e),x=e.length,f=Ye.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[de]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};ht(e)?this._state!==pe?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==pe?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}pong(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):ht(e)?(x=e.size,f=!1):(e=Ye(e),x=e.length,f=Ye.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[de]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};ht(e)?this._state!==pe?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==pe?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}send(e,i,a){let x=this._extensions[Pi.extensionName],f=i.binary?2:1,d=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):ht(e)?(h=e.size,m=!1):(e=Ye(e),h=e.length,m=Ye.readOnly),this._firstFragment?(this._firstFragment=!1,d&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=h>=x._threshold),this._compress=d):(d=!1,f=0),i.fin&&(this._firstFragment=!0);let w={[de]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:m,rsv1:d};ht(e)?this._state!==pe?this.enqueue([this.getBlobData,e,this._compress,w,a]):this.getBlobData(e,this._compress,w,a):this._state!==pe?this.enqueue([this.dispatch,e,this._compress,w,a]):this.dispatch(e,this._compress,w,a)}getBlobData(e,i,a,x){this._bufferedBytes+=a[de],this._state=nc,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Ar,this,h,x);return}this._bufferedBytes-=a[de];let d=Ye(f);i?this.dispatch(d,i,a,x):(this._state=pe,this.sendFrame(r.frame(d,a),x),this.dequeue())}).catch(f=>{process.nextTick(rc,this,f,x)})}dispatch(e,i,a,x){if(!i){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Pi.extensionName];this._bufferedBytes+=a[de],this._state=tc,f.compress(e,a.fin,(d,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Ar(this,m,x);return}this._bufferedBytes-=a[de],this._state=pe,a.readOnly=!1,this.sendFrame(r.frame(h,a),x),this.dequeue()})}dequeue(){for(;this._state===pe&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][de],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][de],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)}};Ti.exports=Cr;function Ar(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 rc(r,e,i){Ar(r,e,i),r.onerror(e)}});var Ui=ie((Sl,Fi)=>{"use strict";var{kForOnEventAttribute:Tt,kListener:kr}=Te(),Ni=Symbol("kCode"),Oi=Symbol("kData"),Ri=Symbol("kError"),Bi=Symbol("kMessage"),Mi=Symbol("kReason"),pt=Symbol("kTarget"),zi=Symbol("kType"),qi=Symbol("kWasClean"),Oe=class{constructor(e){this[pt]=null,this[zi]=e}get target(){return this[pt]}get type(){return this[zi]}};Object.defineProperty(Oe.prototype,"target",{enumerable:!0});Object.defineProperty(Oe.prototype,"type",{enumerable:!0});var $e=class extends Oe{constructor(e,i={}){super(e),this[Ni]=i.code===void 0?0:i.code,this[Mi]=i.reason===void 0?"":i.reason,this[qi]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[Ni]}get reason(){return this[Mi]}get wasClean(){return this[qi]}};Object.defineProperty($e.prototype,"code",{enumerable:!0});Object.defineProperty($e.prototype,"reason",{enumerable:!0});Object.defineProperty($e.prototype,"wasClean",{enumerable:!0});var mt=class extends Oe{constructor(e,i={}){super(e),this[Ri]=i.error===void 0?null:i.error,this[Bi]=i.message===void 0?"":i.message}get error(){return this[Ri]}get message(){return this[Bi]}};Object.defineProperty(mt.prototype,"error",{enumerable:!0});Object.defineProperty(mt.prototype,"message",{enumerable:!0});var Nt=class extends Oe{constructor(e,i={}){super(e),this[Oi]=i.data===void 0?null:i.data}get data(){return this[Oi]}};Object.defineProperty(Nt.prototype,"data",{enumerable:!0});var sc={addEventListener(r,e,i={}){for(let x of this.listeners(r))if(!i[Tt]&&x[kr]===e&&!x[Tt])return;let a;if(r==="message")a=function(f,d){let h=new Nt("message",{data:d?f:f.toString()});h[pt]=this,An(e,this,h)};else if(r==="close")a=function(f,d){let h=new $e("close",{code:f,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[pt]=this,An(e,this,h)};else if(r==="error")a=function(f){let d=new mt("error",{error:f,message:f.message});d[pt]=this,An(e,this,d)};else if(r==="open")a=function(){let f=new Oe("open");f[pt]=this,An(e,this,f)};else return;a[Tt]=!!i[Tt],a[kr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[kr]===e&&!i[Tt]){this.removeListener(r,i);break}}};Fi.exports={CloseEvent:$e,ErrorEvent:mt,Event:Oe,EventTarget:sc,MessageEvent:Nt};function An(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Dn=ie((El,Hi)=>{"use strict";var{tokenChars:Ot}=lt();function Ce(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function ic(r){let e=Object.create(null),i=Object.create(null),a=!1,x=!1,f=!1,d,h,m=-1,w=-1,v=-1,y=0;for(;y<r.length;y++)if(w=r.charCodeAt(y),d===void 0)if(v===-1&&Ot[w]===1)m===-1&&(m=y);else if(y!==0&&(w===32||w===9))v===-1&&m!==-1&&(v=y);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);v===-1&&(v=y);let T=r.slice(m,v);w===44?(Ce(e,T,i),i=Object.create(null)):d=T,m=v=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(h===void 0)if(v===-1&&Ot[w]===1)m===-1&&(m=y);else if(w===32||w===9)v===-1&&m!==-1&&(v=y);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);v===-1&&(v=y),Ce(i,r.slice(m,v),!0),w===44&&(Ce(e,d,i),i=Object.create(null),d=void 0),m=v=-1}else if(w===61&&m!==-1&&v===-1)h=r.slice(m,y),m=v=-1;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(x){if(Ot[w]!==1)throw new SyntaxError(`Unexpected character at index ${y}`);m===-1?m=y:a||(a=!0),x=!1}else if(f)if(Ot[w]===1)m===-1&&(m=y);else if(w===34&&m!==-1)f=!1,v=y;else if(w===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(w===34&&r.charCodeAt(y-1)===61)f=!0;else if(v===-1&&Ot[w]===1)m===-1&&(m=y);else if(m!==-1&&(w===32||w===9))v===-1&&(v=y);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);v===-1&&(v=y);let T=r.slice(m,v);a&&(T=T.replace(/\\/g,""),a=!1),Ce(i,h,T),w===44&&(Ce(e,d,i),i=Object.create(null),d=void 0),h=void 0,m=v=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(m===-1||f||w===32||w===9)throw new SyntaxError("Unexpected end of input");v===-1&&(v=y);let I=r.slice(m,v);return d===void 0?Ce(e,I,i):(h===void 0?Ce(i,I,!0):a?Ce(i,h,I.replace(/\\/g,"")):Ce(i,h,I),Ce(e,d,i)),e}function oc(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(d=>d===!0?x:`${x}=${d}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Hi.exports={format:oc,parse:ic}});var Ln=ie((Dl,eo)=>{"use strict";var ac=J("events"),xc=J("https"),cc=J("http"),Wi=J("net"),fc=J("tls"),{randomBytes:uc,createHash:dc}=J("crypto"),{Duplex:Cl,Readable:Al}=J("stream"),{URL:Ir}=J("url"),Ke=dt(),lc=Er(),hc=Dr(),{isBlob:gc}=lt(),{BINARY_TYPES:Ki,CLOSE_TIMEOUT:pc,EMPTY_BUFFER:kn,GUID:mc,kForOnEventAttribute:Pr,kListener:_c,kStatusCode:wc,kWebSocket:$,NOOP:ji}=Te(),{EventTarget:{addEventListener:yc,removeEventListener:bc}}=Ui(),{format:vc,parse:Sc}=Dn(),{toBuffer:Ec}=Pt(),Ji=Symbol("kAborted"),Lr=[8,13],Re=["CONNECTING","OPEN","CLOSING","CLOSED"],Cc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,U=class r extends ac{constructor(e,i,a){super(),this._binaryType=Ki[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=kn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,i===void 0?i=[]:Array.isArray(i)||(typeof i=="object"&&i!==null?(a=i,i=[]):i=[i]),Vi(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Ki.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 lc({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new hc(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[$]=this,f[$]=this,e[$]=this,x.on("conclude",kc),x.on("drain",Ic),x.on("error",Pc),x.on("message",Lc),x.on("ping",Tc),x.on("pong",Nc),f.onerror=Oc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",$i),e.on("data",Pn),e.on("end",Zi),e.on("error",Qi),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[Ke.extensionName]&&this._extensions[Ke.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){ae(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())}),Xi(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){Tr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||kn,i,a)}pong(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||kn,i,a)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof i=="function"&&(a=i,i={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[Ke.extensionName]||(x.compress=!1),this._sender.send(e||kn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ae(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(U,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(U.prototype,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(U,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(U.prototype,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(U,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(U.prototype,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(U,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});Object.defineProperty(U.prototype,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(U.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(U.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Pr])return e[_c];return null},set(e){for(let i of this.listeners(r))if(i[Pr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Pr]:!0})}})});U.prototype.addEventListener=yc;U.prototype.removeEventListener=bc;eo.exports=U;function Vi(r,e,i,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:pc,protocolVersion:Lr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=x.autoPong,r._closeTimeout=x.closeTimeout,!Lr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Lr.join(", ")})`);let f;if(e instanceof Ir)f=e;else try{f=new Ir(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}f.protocol==="http:"?f.protocol="ws:":f.protocol==="https:"&&(f.protocol="wss:"),r._url=f.href;let d=f.protocol==="wss:",h=f.protocol==="ws+unix:",m;if(f.protocol!=="ws:"&&!d&&!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 O=new SyntaxError(m);if(r._redirects===0)throw O;In(r,O);return}let w=d?443:80,v=uc(16).toString("base64"),y=d?xc.request:cc.request,I=new Set,T;if(x.createConnection=x.createConnection||(d?Dc:Ac),x.defaultPort=x.defaultPort||w,x.port=f.port||w,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":v,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(T=new Ke({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=vc({[Ke.extensionName]:T.offer()})),i.length){for(let O of i){if(typeof O!="string"||!Cc.test(O)||I.has(O))throw new SyntaxError("An invalid or duplicated subprotocol was specified");I.add(O)}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 O=x.path.split(":");x.socketPath=O[0],x.path=O[1]}let N;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=d,r._originalHostOrSocketPath=h?x.socketPath:f.host;let O=a&&a.headers;if(a={...a,headers:{}},O)for(let[H,Q]of Object.entries(O))a.headers[H.toLowerCase()]=Q}else if(r.listenerCount("redirect")===0){let O=h?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!O||r._originalSecure&&!d)&&(delete x.headers.authorization,delete x.headers.cookie,O||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=y(x),r._redirects&&r.emit("redirect",r.url,N)}else N=r._req=y(x);x.timeout&&N.on("timeout",()=>{ae(r,N,"Opening handshake has timed out")}),N.on("error",O=>{N===null||N[Ji]||(N=r._req=null,In(r,O))}),N.on("response",O=>{let H=O.headers.location,Q=O.statusCode;if(H&&x.followRedirects&&Q>=300&&Q<400){if(++r._redirects>x.maxRedirects){ae(r,N,"Maximum redirects exceeded");return}N.abort();let re;try{re=new Ir(H,e)}catch{let L=new SyntaxError(`Invalid URL: ${H}`);In(r,L);return}Vi(r,re,i,a)}else r.emit("unexpected-response",N,O)||ae(r,N,`Unexpected server response: ${O.statusCode}`)}),N.on("upgrade",(O,H,Q)=>{if(r.emit("upgrade",O),r.readyState!==U.CONNECTING)return;N=r._req=null;let re=O.headers.upgrade;if(re===void 0||re.toLowerCase()!=="websocket"){ae(r,H,"Invalid Upgrade header");return}let Ae=dc("sha1").update(v+mc).digest("base64");if(O.headers["sec-websocket-accept"]!==Ae){ae(r,H,"Invalid Sec-WebSocket-Accept header");return}let L=O.headers["sec-websocket-protocol"],q;if(L!==void 0?I.size?I.has(L)||(q="Server sent an invalid subprotocol"):q="Server sent a subprotocol but none was requested":I.size&&(q="Server sent no subprotocol"),q){ae(r,H,q);return}L&&(r._protocol=L);let Z=O.headers["sec-websocket-extensions"];if(Z!==void 0){if(!T){ae(r,H,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let me;try{me=Sc(Z)}catch{ae(r,H,"Invalid Sec-WebSocket-Extensions header");return}let De=Object.keys(me);if(De.length!==1||De[0]!==Ke.extensionName){ae(r,H,"Server indicated an extension that was not requested");return}try{T.accept(me[Ke.extensionName])}catch{ae(r,H,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[Ke.extensionName]=T}r.setSocket(H,Q,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(N,r):N.end()}function In(r,e){r._readyState=U.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function Ac(r){return r.path=r.socketPath,Wi.connect(r)}function Dc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=Wi.isIP(r.host)?"":r.host),fc.connect(r)}function ae(r,e,i){r._readyState=U.CLOSING;let a=new Error(i);Error.captureStackTrace(a,ae),e.setHeader?(e[Ji]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(In,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Tr(r,e,i){if(e){let a=gc(e)?e.size:Ec(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Re[r.readyState]})`);process.nextTick(i,a)}}function kc(r,e){let i=this[$];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[$]!==void 0&&(i._socket.removeListener("data",Pn),process.nextTick(Yi,i._socket),r===1005?i.close():i.close(r,e))}function Ic(){let r=this[$];r.isPaused||r._socket.resume()}function Pc(r){let e=this[$];e._socket[$]!==void 0&&(e._socket.removeListener("data",Pn),process.nextTick(Yi,e._socket),e.close(r[wc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function Gi(){this[$].emitClose()}function Lc(r,e){this[$].emit("message",r,e)}function Tc(r){let e=this[$];e._autoPong&&e.pong(r,!this._isServer,ji),e.emit("ping",r)}function Nc(r){this[$].emit("pong",r)}function Yi(r){r.resume()}function Oc(r){let e=this[$];e.readyState!==U.CLOSED&&(e.readyState===U.OPEN&&(e._readyState=U.CLOSING,Xi(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Xi(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function $i(){let r=this[$];if(this.removeListener("close",$i),this.removeListener("data",Pn),this.removeListener("end",Zi),r._readyState=U.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",Gi),r._receiver.on("finish",Gi))}function Pn(r){this[$]._receiver.write(r)||this.pause()}function Zi(){let r=this[$];r._readyState=U.CLOSING,r._receiver.end(),this.end()}function Qi(){let r=this[$];this.removeListener("error",Qi),this.on("error",ji),r&&(r._readyState=U.CLOSING,this.destroy())}});var so=ie((Il,ro)=>{"use strict";var kl=Ln(),{Duplex:Rc}=J("stream");function to(r){r.emit("close")}function Bc(){!this.destroyed&&this._writableState.finished&&this.destroy()}function no(r){this.removeListener("error",no),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Mc(r,e){let i=!0,a=new Rc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,d){let h=!d&&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(to,a);return}let d=!1;r.once("error",function(m){d=!0,f(m)}),r.once("close",function(){d||f(x),process.nextTick(to,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,d){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,d)});return}r.send(x,d)},a.on("end",Bc),a.on("error",no),a}ro.exports=Mc});var Nr=ie((Pl,io)=>{"use strict";var{tokenChars:zc}=lt();function qc(r){let e=new Set,i=-1,a=-1,x=0;for(x;x<r.length;x++){let d=r.charCodeAt(x);if(a===-1&&zc[d]===1)i===-1&&(i=x);else if(x!==0&&(d===32||d===9))a===-1&&i!==-1&&(a=x);else if(d===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}io.exports={parse:qc}});var lo=ie((Tl,uo)=>{"use strict";var Fc=J("events"),Tn=J("http"),{Duplex:Ll}=J("stream"),{createHash:Uc}=J("crypto"),oo=Dn(),Ze=dt(),Hc=Nr(),Kc=Ln(),{CLOSE_TIMEOUT:Gc,GUID:Wc,kWebSocket:jc}=Te(),Jc=/^[+/0-9A-Za-z]{22}==$/,ao=0,xo=1,fo=2,Or=class extends Fc{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Gc,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Kc,...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=Tn.createServer((a,x)=>{let f=Tn.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=Vc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,d)=>{this.handleUpgrade(x,f,d,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=ao}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(Rt,this);return}if(e&&this.once("close",e),this._state!==xo)if(this._state=xo,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(Rt,this):process.nextTick(Rt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Rt(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",co);let f=e.headers["sec-websocket-key"],d=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Qe(this,e,i,405,"Invalid HTTP method");return}if(d===void 0||d.toLowerCase()!=="websocket"){Qe(this,e,i,400,"Invalid Upgrade header");return}if(f===void 0||!Jc.test(f)){Qe(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){Qe(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Bt(i,400);return}let m=e.headers["sec-websocket-protocol"],w=new Set;if(m!==void 0)try{w=Hc.parse(m)}catch{Qe(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let v=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&v!==void 0){let I=new Ze({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let T=oo.parse(v);T[Ze.extensionName]&&(I.accept(T[Ze.extensionName]),y[Ze.extensionName]=I)}catch{Qe(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let I={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(I,(T,N,O,H)=>{if(!T)return Bt(i,N||401,O,H);this.completeUpgrade(y,f,w,e,i,a,x)});return}if(!this.options.verifyClient(I))return Bt(i,401)}this.completeUpgrade(y,f,w,e,i,a,x)}completeUpgrade(e,i,a,x,f,d,h){if(!f.readable||!f.writable)return f.destroy();if(f[jc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>ao)return Bt(f,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Uc("sha1").update(i+Wc).digest("base64")}`],v=new this.options.WebSocket(null,void 0,this.options);if(a.size){let y=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;y&&(w.push(`Sec-WebSocket-Protocol: ${y}`),v._protocol=y)}if(e[Ze.extensionName]){let y=e[Ze.extensionName].params,I=oo.format({[Ze.extensionName]:[y]});w.push(`Sec-WebSocket-Extensions: ${I}`),v._extensions=e}this.emit("headers",w,x),f.write(w.concat(`\r
8
+ var Ua=Object.create;var cr=Object.defineProperty;var Ka=Object.getOwnPropertyDescriptor;var Ha=Object.getOwnPropertyNames;var Ga=Object.getPrototypeOf,ja=Object.prototype.hasOwnProperty;var Y=(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 Ie=(r,e)=>()=>(r&&(e=r(r=0)),e);var se=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),bs=(r,e)=>{for(var i in e)cr(r,i,{get:e[i],enumerable:!0})},Wa=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of Ha(e))!ja.call(r,x)&&x!==i&&cr(r,x,{get:()=>e[x],enumerable:!(a=Ka(e,x))||a.enumerable});return r};var De=(r,e,i)=>(i=r!=null?Ua(Ga(r)):{},Wa(e||!r||!r.__esModule?cr(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as Ja,mkdir as Va,readFile as Ya,rename as vs,writeFile as Ss}from"node:fs/promises";import{dirname as $a}from"node:path";async function Ht(r){try{let e=await Ya(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Gt(r,e,i){await Va($a(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 Ss(x,a,{encoding:"utf8",mode:i.mode}):await Ss(x,a,"utf8"),await vs(x,r),i?.mode!==void 0&&await Ja(r,i.mode)}catch(u){await vs(x,x).catch(()=>{});let{rm:d}=await import("node:fs/promises");throw await d(x,{force:!0}).catch(()=>{}),u}}var xr=Ie(()=>{"use strict"});function As(r){return Wt[Es]<=Wt[r]}function ur(r){Cs={...r}}function jt(r,e,i,a){if(Wt[r]<Wt[Es])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...Cs,...a});r==="error"||r==="warn"?Xa.write(`${x}
10
+ `):Qa.write(`${x}
11
+ `)}function N(r){return{debug:(e,i)=>jt("debug",r,e,i),info:(e,i)=>jt("info",r,e,i),warn:(e,i)=>jt("warn",r,e,i),error:(e,i)=>jt("error",r,e,i),child:e=>N(`${r}.${e}`)}}var Wt,Es,Qa,Xa,Cs,K=Ie(()=>{"use strict";Wt={debug:10,info:20,warn:30,error:40},Es=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),Qa=process.stdout,Xa=process.stderr,Cs={}});import{homedir as Za}from"node:os";import{join as te}from"node:path";function H(r){let e=r??Za(),i=te(e,".coze"),a=te(i,"bridge"),x=te(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:x,libEntry:te(x,"index.js"),pidFile:te(a,"bridge.pid"),portFile:te(a,"bridge.port"),tokenFile:te(a,"bridge.token"),logFile:te(a,"bridge.log"),installLock:te(a,"install.lock"),configFile:te(a,"config.json"),agentsRoot:te(i,"agents")}}function Te(r,e=H()){let i=te(e.agentsRoot,r);return{root:i,config:te(i,"config.json"),workspace:te(i,"workspace"),logs:te(i,"logs")}}var ae=Ie(()=>{"use strict"});var Yt={};bs(Yt,{AGENT_CONFIG_FILE_MODE:()=>Jt,enforceAgentConfigMode:()=>n0,loadAgentConfig:()=>ce,persistAgentSessions:()=>fr,persistAgentSkills:()=>Vt,saveAgentConfig:()=>me});import{chmod as e0,stat as t0}from"node:fs/promises";function ce(r,e){return Ht(Te(r,e).config)}function me(r,e){return Gt(Te(r.agentId,e).config,r,{mode:Jt})}async function n0(r,e){if(process.platform==="win32")return;let i=Te(r,e).config;try{let a=await t0(i);if(!a.isFile())return;let x=a.mode&511;x!==Jt&&(await e0(i,Jt),ks.warn("agent config mode auto-corrected to 0600",{path:i,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;ks.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function fr(r,e,i){let a=await ce(r,i);a&&(a.sessions=Object.fromEntries(e),await me(a,i))}async function Vt(r,e,i){let a=await ce(r,i);a&&(a.skills=e,await me(a,i))}var ks,Jt,Ue=Ie(()=>{"use strict";xr();K();ae();ks=N("agent-config"),Jt=384});var ui=se(Q=>{"use strict";var S=P;(function(r,e){let i=P,a=r();for(;;)try{if(parseInt(i(1052))/1+parseInt(i(839))/2+parseInt(i(1598))/3+-parseInt(i(538))/4+-parseInt(i(1755))/5*(parseInt(i(1781))/6)+-parseInt(i(734))/7+parseInt(i(1360))/8*(parseInt(i(1292))/9)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Sn,778249);var mc=Object[S(1588)+"operty"],wc=Object[S(1318)+"opertyNames"],ii=(r,e)=>function(){return r&&(e=(0,r[{OyzEe:function(u,d){return u(d)}}[S(1628)](wc,r)[0]])(r=0)),e},_c=(r,e)=>{let i={cdVaZ:function(x,u,d,h){return x(u,d,h)}};for(var a in e)i.cdVaZ(mc,r,a,{get:e[a],enumerable:!0})};function yc(){return ei||(ei=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function bc(){let r=S;return ti||(ti=[IDBCursor[r(1268)+"e"].advance,IDBCursor[r(1268)+"e"][r(1104)],IDBCursor[r(1268)+"e"][r(1104)+r(497)+"ey"]])}function vc(r){let e=S,i={bwUDx:"success",hofvv:"error",cbpxP:function(x,u){return x(u)},EPtSg:function(x){return x()},UiMKb:function(x,u){return x instanceof u}},a=new Promise((x,u)=>{let d=P,h={aFCWh:function(_){return i[P(1876)](_)}},m=()=>{let _=P;r[_(938)+_(1425)+_(733)](i[_(999)],w),r[_(938)+_(1425)+"ner"](i[_(940)],b)},w=()=>{let _=P;i[_(1769)](x,Ce(r[_(1456)])),m()},b=()=>{let _=P;u(r[_(533)]),h[_(783)](m)};r[d(1149)+"Listener"](i[d(999)],w),r["addEvent"+d(1538)](i[d(940)],b)});return a[e(568)](x=>{let u=e;i[u(1280)](x,IDBCursor)&&pr[u(510)](x,r)})[e(1163)](()=>{}),bn.set(a,r),a}function Sc(r){let e=S,i={szFWk:e(1016),tEmio:"error",mjvQQ:e(1379),rrkiu:function(x,u){return x>u},rQYag:function(x,u){return x===u},SAgiY:e(408),jpgxj:function(x){return x()},xHFEH:function(x,u){return x(u)},kTSQu:e(516)+"or"};if(yn[e(1270)](r))return;let a=new Promise((x,u)=>{let d=e,h={yIIXm:function(_,C){return i.rrkiu(_,C)},fjRVN:function(_,C){return i[P(1535)](_,C)},nFMRx:i[d(1184)],Kehvq:function(_){return i[d(1710)](_)},EeUNy:function(_,C){return i[d(1707)](_,C)},cqdsJ:i[d(1233)]},m=()=>{let _=d;r[_(938)+"entListe"+_(733)](i[_(1446)],w),r["removeEventListe"+_(733)](i.tEmio,b),r["removeEventListe"+_(733)](i[_(1075)],b)},w=()=>{let _=d,C={KpeWr:function(L,I){return h[P(707)](L,I)}};if(h[_(1024)](h[_(1009)],"wtynF"))h[_(1166)](x),m();else return this[_(1062)+"ndex"]==this[_(1217)+"s"].length?!0:C.KpeWr(this[_(1489)+"ndpointT"+_(1338)+"t"],this[_(1770)+"es"])},b=()=>{let _=d;h[_(1589)](u,r[_(533)]||new DOMException(h[_(625)],"AbortError")),m()};r[d(1149)+"Listener"](i[d(1446)],w),r[d(1149)+d(1538)](i[d(623)],b),r[d(1149)+d(1538)](i[d(1075)],b)});yn[e(510)](r,a)}function Ec(r){vn={EEzQH:function(i,a){return i(a)}}.EEzQH(r,vn)}function Cc(r){let e=S,i={JJSeL:function(a,x){return a(x)},gcmNU:function(a,x){return a(x)},KPhwu:function(a,x){return a>x},HRLhA:function(a,x){return a+x},yNmxV:e(778)+e(523),WMbCv:function(a,x){return a(x)},JGSEm:function(a,x){return a===x},CqRnn:function(a,x){return a in x},mbwpd:function(a){return a()},FXYgv:e(1746)};if(i[e(638)](r,IDBDatabase[e(1268)+"e"][e(660)+"ion"])&&!i.CqRnn("objectSt"+e(541),IDBTransaction[e(1268)+"e"]))return function(a,...x){let u=e,d=r[u(1236)](i.JJSeL(Tt,this),a,...x);return gr[u(510)](d,a.sort?a[u(1169)]():[a]),i[u(468)](Ce,d)};if(i[e(572)](bc).includes(r))if(i.JGSEm(i.FXYgv,e(1406))){let a=_0x4a22df[e(646)];if(i[e(418)](i[e(1802)](a,_0x2e770d),_0x2b3adb[e(1199)]))throw new _0x4fa9b5(i[e(1115)]);return _0x12f499.offset+=_0x51c418,a}else return function(...a){let x=e;return r[x(1203)](Tt(this),a),Ce(pr[x(1528)](this))};return function(...a){let x=e;return Ce(r[x(1203)](i[x(787)](Tt,this),a))}}function Ac(r){let e=S,i={OWoPe:e(1368),FlgFu:function(a,x){return a(x)},knZHw:function(a,x){return a instanceof x},QZexg:function(a,x){return a(x)},OKxUM:function(a,x,u){return a(x,u)},VuAbz:function(a){return a()}};return typeof r===i[e(1819)]?i.FlgFu(Cc,r):(i[e(675)](r,IDBTransaction)&&i[e(1245)](Sc,r),i[e(685)](oi,r,i.VuAbz(yc))?new Proxy(r,vn):r)}function Ce(r){let e=S,i={eJePC:function(x,u){return x(u)},cXvIi:function(x,u){return x!==u}};if(r instanceof IDBRequest)return i[e(1451)](vc,r);if(wn[e(1270)](r))return wn.get(r);let a=i[e(1451)](Ac,r);return i.cXvIi(a,r)&&(wn[e(510)](r,a),bn[e(510)](a,r)),a}function P(r,e){r=r-386;let i=Sn(),a=i[r];if(P.OpPqTh===void 0){var x=function(m){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",b="",_="";for(let C=0,L,I,R=0;I=m.charAt(R++);~I&&(L=C%4?L*64+I:I,C++%4)?b+=String.fromCharCode(255&L>>(-2*C&6)):0)I=w.indexOf(I);for(let C=0,L=b.length;C<L;C++)_+="%"+("00"+b.charCodeAt(C).toString(16)).slice(-2);return decodeURIComponent(_)};P.KaQcMq=x,P.FNDdER={},P.OpPqTh=!0}let u=i[0],d=r+u,h=P.FNDdER[d];return h?a=h:(a=P.KaQcMq(a),P.FNDdER[d]=a),a}var oi,ei,ti,pr,yn,gr,wn,bn,vn,Tt,ni=ii({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={MIZEd:function(i,a){return i instanceof a},IdRBs:function(i,a){return i!==a},bGama:r(1556),LEvSR:r(648),uaOxB:r(1145),HMWQs:function(i,a){return i===a},PuHyT:r(1603)+r(541),zbten:r(838),JCEmt:function(i,a){return i(a)},oMatY:function(i,a){return i===a},uaSCS:"YRfjM",JiYZq:function(i,a){return i instanceof a},WpwUH:function(i,a){return i===a}};oi=(i,a)=>a.some(x=>i instanceof x),pr=new WeakMap,yn=new WeakMap,gr=new WeakMap,wn=new WeakMap,bn=new WeakMap,vn={get(i,a,x){let u=r;if(e.MIZEd(i,IDBTransaction))if(e[u(1095)](e.bGama,e[u(1416)])){if(a===e.uaOxB)return yn[u(1528)](i);if(e.HMWQs(a,e[u(1112)]))return i[u(1603)+u(541)]||gr[u(1528)](i);if(a===e[u(780)])return x[u(1603)+u(541)][1]?void 0:x[u(1603)+u(528)](x[u(1603)+"oreNames"][0])}else _0x4146f8[u(1030)](_0x4acadd);return e[u(1023)](Ce,i[a])},set(i,a,x){return i[a]=x,!0},has(i,a){let x=r;return e[x(754)](e.uaSCS,e[x(469)])?e[x(532)](i,IDBTransaction)&&(e[x(754)](a,e[x(947)])||e[x(1806)](a,e[x(780)]))?!0:a in i:_0x2c7ebe}},Tt=i=>bn[r(1528)](i)}}),ai={};_c(ai,{deleteDB:()=>Pc,openDB:()=>kc,unwrap:()=>Tt,wrap:()=>Ce});function kc(r,e,{blocked:i,upgrade:a,blocking:x,terminated:u}={}){let d=S,h={FYzFt:function(b,_,C,L,I){return b(_,C,L,I)},AqYdB:function(b,_){return b(_)},ctnZf:function(b,_){return b(_)},sCeca:function(b,_){return b||_},vvezs:d(1547)+"hange",aLhgE:d(1822),RAWKX:d(1089)+d(1772),qWRts:"blocked"},m=indexedDB[d(1875)](r,e),w=h[d(1014)](Ce,m);if(a)if(d(1822)===h[d(1817)])m["addEvent"+d(1538)](h.RAWKX,b=>{let _=d;h[_(1594)](a,h[_(628)](Ce,m[_(1456)]),b[_(1180)+"on"],b[_(1823)+"on"],h[_(1014)](Ce,m["transact"+_(474)]))});else{let b=this._qosDB[d(1505)+d(848)+"nc"](this[d(1353)]),_=_0x51b547[d(1525)](h.sCeca(b,"{}"));return _0x561aab[d(1035)](_)}return i&&m[d(1149)+"Listener"](h[d(1469)],()=>i()),w[d(568)](b=>{let _=d;u&&b[_(1149)+_(1538)]("close",()=>u()),x&&b[_(1149)+"Listener"](h[_(1886)],()=>x())}).catch(()=>{}),w}function Pc(r,{blocked:e}={}){let i=S,a={swFbl:i(1078),SNKwm:function(u,d){return u(d)}},x=indexedDB[i(544)+i(1777)](r);return e&&x[i(1149)+"Listener"](a[i(865)],()=>e()),a[i(450)](Ce,x)[i(568)](()=>{})}function ri(r,e){let i=S,a={bORpm:i(1605),sbknl:i(551),rswbi:function(m,w){return m!==w},apMmI:function(m,w){return m in w}};if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e===a[i(937)]))return;if(_n[i(1528)](e))return _n[i(1528)](e);let x=e[i(1493)](/FromIndex$/,""),u=a[i(1609)](e,x),d=xi.includes(x);if(!a[i(781)](x,(u?IDBIndex:IDBObjectStore).prototype)||!(d||ci[i(1386)](x)))return;let h=async function(m,...w){let b=i,_=this[b(660)+"ion"](m,d?b(878)+"e":a[b(1357)]),C=_[b(838)];return u&&(C=C[b(455)](w[b(678)]())),(await Promise.all([C[x](...w),d&&_[b(1145)]]))[0]};return _n[i(510)](e,h),h}var ci,xi,_n,Ic=ii({"node_modules/idb/build/index.js"(){let r=S,e={hswFy:function(x){return x()},qgdzi:r(1581)+"ys",KWyBJ:r(1248),wUpwo:r(972),MmGSZ:r(1799),ZNCVx:function(x,u){return x(u)}},i=(r(1752)+"0|5")[r(862)]("|"),a=0;for(;;){switch(i[a++]){case"0":_n=new Map;continue;case"1":e[r(1610)](ni);continue;case"2":ci=[r(1528),"getKey","getAll",e[r(1563)],r(429)];continue;case"3":e[r(1610)](ni);continue;case"4":xi=[r(1006),e[r(1855)],e.wUpwo,e[r(994)]];continue;case"5":e[r(1512)](Ec,x=>({...x,get:(u,d,h)=>ri(u,d)||x[r(1528)](u,d,h),has:(u,d)=>!!ri(u,d)||x[r(1270)](u,d)}));continue}break}}}),Dc={idb:function(r){let e=S;r[e(1887)]=Promise[e(1061)]()[e(568)](()=>(Ic(),ai))[e(568)](function(i){return i})}},si={};function Ee(r){let e=S,i={XgrFo:e(681)+"0",WkxOJ:function(h,m){return h!==m}},a=i[e(1327)][e(862)]("|"),x=0;for(;;){switch(a[x++]){case"0":return d[e(1887)];case"1":var u=si[r];continue;case"2":var d=si[r]={exports:{}};continue;case"3":Dc[r](d,d[e(1887)],Ee);continue;case"4":if(i[e(801)](void 0,u))return u[e(1887)];continue}break}}function Sn(){let r=["y2XQvuO","u0LbCNK","uLHIAhm","r091q1O","rvjst1i","y2jWEfa","Bwf4uMv0CMK","AMDcvxq","zwvKzwq","AMTABNi","yMfSrxzLBNq","AM9PBG","ihzHBgLKigq","DgfIyxnL","BeviDee","zgf0yq","ruDcCM4","mJrfzxPetxG","rNjVBNrPzxi","qw5UD2W","BfHWu2C","x2nYzwf0zvm","q09otKvdveK","Bwf4tg9ZC0m","CMvWBgfJzui","suvRAuS","sLzvwLC","nNWXFdb8nW","tMjpvLi","yxjdqNa","z0nWzfG","x19LC01Vzhu","ze9NAe0","BNHgEgS","zw1VvuO","y2XLyxi","zLbkDNO","AKPVB20","sfjmAee","zw5JB2rPBMC","u1nIDhi","DxrMofDYAxq","v3b3vuG","C2vrAxu","Bu5rC2G","BezSDxnO","sKDlsvG","BfrqEM8","ywPjzeC","yLP6vMK","r3nOtM4","zvfKvxy","DxnLCKLW","yuXOz0u","zxq9DxrMltG","t1DVugu","A2vmq24","CLzHBhvLCW","CgPKCK0","BMv3vMvYC2K","q0D0uNa","Bwv0Ag9K","wLrtqNi","AwPmvuu","CMvZzxrfBMq","yxrHlcbKyxq","CvjUENK","q0Xpu0LorW","sfLIuvy","B3bLBKrc","Du5sD3e","EhfWvvu","sMD3zgK","yw5Hz2vY","x3jLBw92zvC","BML0AwfSAxO","v0DXz2e","AxmGDw5Kzwy","ruTMC0q","BgvUz3rO","CuvMAui","AgLNAa","BhnhD2m","v3vZu0S","uNLUCLC","yuH1uuG","u3LSBxq","yM9L","CMvKDwnL","ywnRtxnNswq","y25Hz3u","s1D5qKO","DKL3uvq","sLzkA0q","Cg9W","y29UC3rYDwm","yu9YreK","y3nWBMO","y2zHCuK","AxnFywnR","A0LuBei","r3Hszuq","B2nRzxq","x3bPBMDqB24","qNHkCKW","ALncDwq","x29UugfNzu4","x29WDgLVBNm","DeLUDgvYy2u","B3PnAg8","zMrKueS","B3bLBG","rvb0u2C","DvjAq2i","qNz0BLe","yxvks28","zK1PDgu","wfzrCLG","y3jLyxrLq2W","zxf1ywXZ","ExzuEhm","Dgntww8","DNzLENm","zxHWB3j0CW","x3bHDgHlzxK","zMLUza","C3rquLy","y3jLyxrLuMu","D1Hvv04","AxnszwfKEq","Dg9Y","CLzLD0m","CMfTzq","vvP1s3O","ywWGy3vYC28","DhDVu1m","BwvKAwf0zwW","zevgvMW","rNPfA1m","z1rPBwvVDxq","CYbPBNn0yw4","BMrLEa","vxjkAg0","rxnUswG","yvPYv08","vKHZyxm","ywDLu2HVDW","sKLxrvi","tufyx1jfvfi","x2HHBMrSzu8","Aw5KzxHpzG","x3jLywr5q2W","Dw5KzwzPBMu","yuPXBgW","v2X6BKm","zK5Kz3u","CNnVCL9Uyw0","y1fSz3m","DMfSDwu","yNLL","uuzVswy","D3r5BKy","zxjFBxnNAwq","rLDt","CgjICdi","ww9PCva","DefwALm","zMPuDuy","z0PNAgi","DgTzEwS","x3nLBMrby2S","s1bOD3u","q2fgvwS","EvzcqMO","Dgv4DfbHEwW","AxnAzxjV","yxnKve4","CMvUDevUzha","wxzOqLC","Ahr0Ca","Bg9Nsurhzw4","zcWGDw5RBM8","y291BNq","ANPWEMS","quzhqMm","yMrFzgLK","DuHvEem","AvvTuwm","suz6D2m","B25pCgvU","uxjvt3e","C3rYAw5NAwy","DcbVzIbYyw4","y1PHqu4","CxvYvKS","uuHsEee","DKnTug0","x3DZ","Aw5L","t29TzMG","B25ozxr3B3i","x2rPC2nVBM4","v3LYtwq","u05lD20","Eu9eDeO","zgTAALy","yw5Nzq","D1LNANC","Aw5KzxG","BxHnBM4","z2HrB1e","A0f3B2u","v0vIqum","zw5XDwv1zq","qw1VDw50","u0TjAu0","B25LCNjVCG","uu9Otfe","icSG","CNfivg0","AuzAuw0","z2nTtLu","Dwftq1m","wevzy1K","ywrKt25L","yMfuEwK","s1fWu2e","Aw9U","zwPJAKK","wKXwCwu","ug9jsgy","y3r4","t1HsweK","zw5HyMXLqxu","Bhj4AMG","zNjHBwvuExa","ChvZAa","BMDLza","DvjlChu","CYbWyxjHBxm","vgLsse8","yxbWBgLJyxq","z2v0qwXS","wuvcqwC","x2HHBMrSzva","tNnpuhm","CgLUz1rPBwu","tgz0BLu","ywrKq291BNq","rgDPANG","uhjPBwfYEuS","ugTrr3u","AvnuwwC","rfjIwem","B3rvtg0","uKrfBeO","zfbPBwq","z2v0sxrLBq","q3vZDg9Trxi","Aw9Ul2PZB24","ywDLsgLKzq","yMDuChO","wgHvzu8","C2v0","whPJCMK","z3LhteS","zKfrBvm","C2jkENK","wfDRwum","qwjVCNrfCNi","B3bLBIa","uNPcs2u","tKHAC1a","yMLUyxj5","DhjPBq","s2nsD3a","DcbSAw1PDa","BwnMzNq","CMvTB3zLq2G","DgrTC2S","uxfLDuW","B3jL","uKXTCe4","r3Lkq0e","ALLjvK4","sMLzwNe","zxjYB3i","qxzVEwu","BM9Uzv9UB24","Dev2zw50","q0LtzMK","mJy5odqYohLyDK5JrW","AefsqM0","C3rHCNq","B3jLtMfTzxm","EK1QyuC","qw1iuMq","zgvSzxrLrge","y2XVC2uSihC","CxziBgW","ruPire8","DuHuuwS","tMfTzq","yvLQBhK","C3rYAw5N","CNbmCKG","yw5tveC","Dg9cExrLC0W","nxW0Fdf8nNW","Ec11C2uT","vNPosw4","DvjjDfC","yw51Ce1LC3m","DuLhB0G","CxDrCxu","wvf0qwm","svbyqxG","CxLrC1y","sef1vwW","s1f3EKS","tKfrEKu","DgHLBG","zM9Yy2u","x3nVy2TLDa","ihn1y2nLC3m","Bwj3Cgq","CuTsAwe","ANLwvui","ChLlr0q","sw1XBgC","u2DIB2q","Cvbmq0O","qwTpuei","DMLJzuLeig8","rgX5qKm","zNrHAw8","s1LfAve","DunlrLe","Aw5KzxGGB3u","zgvS","CKXeDxK","CgLUz0XVC3m","AK1yEwC","AxnrB1nnzxm","Bxrkq2i","BMCGDxjSoIa","ELbsC2C","tunpCvO","Cxjpuhq","y3jLyxrLrwW","y2HHCKnVzgu","sNPsue0","y2vZC0HHBMq","zMXVB3i","C2TPExG","B25tDgfYDfi","Aw9UvgLTzw8","ENvTz2m","rMjxywC","x2DLDeLUDgu","uNf6C0W","tMHjAfK","rLLvwuq","y3jLyxrLtwu","Cg5Xyvq","q2zJzwG","zujZruO","BwfUDwfSihi","Aw5N","CgfNzxnOB3C","AMvmyxK","t3bLBKv2zw4","yvDwz1e","C3rLBMvYCW","z05yBeG","shPft20","DevTAw8","yw1Lu3bHy2u","y3fKC0O","C3bSAwnL","B3nLrxzLBNq","qxfzzei","Dg9hzw5LCMe","r1HWyKy","uejpAwS","zv90Aw1LB3u","Dezcs2e","z3jQv2S","D2P0BM8","rLzcs0u","zNjVBunOyxi","sKDtrw0","B25SAw5L","Bxfntvy","vKPsA3q","vvjhsNa","DgvmB2Djre4","Efn4rxO","q291BNq","B2zMC2v0","BgLUzq","DMnfCu0","DMTgAeO","wvHRugi","yNzxEM4","zNjVBu51Bwi","s21LtLO","BMrWB2LUDfq","CMLVCKu","wNzkDfm","Ee16seu","Dg9VigXHCMC","AxnbCNjHEq","DhjHBNnHy3q","sNHoqxu","BMvLzf9Hy2S","ENreCvm","y0rmze8","C2DNvLa","vxPwrK0","o2nOyxjZzxq","B0LZqLq","BgvY","EhDWwvq","B2fK","Dg9mB3DLCKm","x2LZtwLUAvC","zLnTrg0","A25AshC","CM92AwrLihC","zxmGCMvHy2G","C2HPzNq","x3fVC0rc","EwrVu28","mxW0Fdj8m3W","EgLhB2i","CgXOweK","BxzrEey","t0T4vu0","zgrjrcWGzgu","tw96BM0","tg9JAW","mdaWma","aaaaaaaaaaa","C2vYDMvYvgK","vMX0ELm","vuLZANi","Cgf5Bg9Hzeu","s01kv1a","zKvesgq","A0DPzwq","s29wrMe","r3jmr2S","CM1nsgi","rMvTqvK","tefhrMK","AgfTzLC","zKP2zvK","DM9XBw4","yxrLq291BNq","EuLjwg0","yxKSihrYEsa","ue9Sq1q","CNnVCKzPBgu","AefJA01LC3m","quXwB1K","BeXiCxa","DgHHBIbSB2m","Ef9MCM9UDgK","rLjptLrjrvi","yxfoD1e","wgrQEM4","Bwf4twvZC2e","v1DRywe","D2vI","DuDNA1G","s2rNDK0","sMPwCg8","BwfW","C21cAhC","De9KALK","yM5ZEwi","x0vysvnu","ALDHseO","ChjVDg9JB2W","y2rmChy","BMvY","ota4ntG3neThzgzUAW","y0fLy28","A2v5","CLjotKC","C2nYAxb0","BxDxwhq","EuTrA0u","DNfxsvO","t2LWDxq","swrQB2G","sg9ZDwm","uLbszLm","zw5fDMvUDa","BM5Ly3q","DxjS","y2HnyxHuCMK","BuLQt0y","tg9UC3G","yLfMDgO","sLnAv2u","B01HDfK","zw50zwqGDhK","BxnN","r2P4sNG","AeziExK","CKHhAgK","DMvY","q1vxq3i","wxP5Dhq","vgLTzw91Da","Dhr3Awq","B2PxwKO","DLDPvhG","y3nzAe8","x2LUAxrqCM8","ywnRDxbfBMq","tfzfBgG","BgLZDgvUtMu","q09oveLovuu","Dhjjvxy","mdaWmdaWmda","C3bLufG","nNWZFdr8mG","C2vYDMLJzs0","uMvHzcbWyxm","BMnLq2XVC2u","EMj0zw4","yxbnBuK","CKfOwKy","yuzdv2G","igzHAwWSig0","u3rYyxrLz3K","v2vIu29JA2u","v01Iq3y","tfbYv3K","C0jf","x2zVCM1HDeu","uNvbuvu","seDuELK","ALv6uMu","Bfb4zfO","CMv0CNLdB3u","zLDvBuK","uMvJB25Uzwm","uLnRqMu","x3DZsw5ZDge","v0T4zhy","v2T4t0O","x2LZtwLUAvq","x2XPC3rLBMu","tgHYuNi","t2TOthK","zw1PDa","rM1qDfO","shzsBMK","DxDwt3i","B1vOyuC","u2HHCMvKv28","vfDcvMG","CMXRC00","z2vrDwv1zuW","ugrtqLq","t1LNrvO","y2vXD0y","ihbYB3rVy28","sK1dCfa","sKHrEui","Bg93","rKrvrwe","B25TzxnZywC","x2DLBMvYyxq","C2vUzf9Hy2S","AwXLtMfTzq","wLD4swm","C1jHww8","x2fKzfDZtgK","ywzL","B2zM","DMTWwwq","AgfZt3DUuhi","tg9Nsuq","vMPbzKi","rfjNtKy","z1HQs3y","C3rVCMu","mJGXmty1ngnICgzwDW","Bfr1BeK","svf6DKy","C3jJ","sMPfsw4","CMrvqLm","CfncCMq","Dg9tDhjPBMC","A2fgyKK","z2vjBMzVu3K","shrxCuy","D2fZq2XLyw4","sNfJAue","s0HIqwK","yKfmwKW","D25Rqve","EwfmsLu","EsbJBg9Zzwq","zwnVBM5Ly3q","qKXAAMO","Aw47y2HHCNm","Ew9ZAMi","B3zpBeC","C3bSAxq","EfPryuy","Dxrjza","C3DgyMW","Efrurw52","Be1ozfy","t0vwwLe","t2jQzwn0","rLvpC08","zxH0zw5ZAw8","zw5HyMXLvhi","thfjzfy","x2jPBMfYEvq","AMftCLC","y29SBM8","x2rPC3bHDgm","CMvHzhDYAxq","sNDoCNC","q3vZDg9Tq2W","q29Kzq","CLDMAMG","rxzLBNq","AwXK","sw1gCK8","Axnby2TdBgu","mhWYFdn8mxW","AxnmB25N","B2LUDfjLywm","Chvitum","B25szwnLAxy","Bwu6ia","Dw5ZAwDUzwq","Cgu6ia","tuntCKq","mhWZFdi","zKT2sKG","rxvzt2K","t21urge","suPTzeC","y1rxv00","tfrMwum","CxLJv3q","A2PVAgi","CvPRBwm","sg1itKC","yvDevMC","x2LZsw5PDa","BNruCMLLC0m","uwvSEM0","BKj2sgW","BMCGB3iGyw4","vujZD3a","t3f5tuC","t1nKEey","AgPMvgW","BNrLCG","r05JB3i","uvbZswS","C3HVu1K","x2n1CNnVCK0","AKfzEe0","uMzwzgS","tLvfr2K","AevYCM9Yrxy","zMvY","t0P6DxG","Agzwru8","D01Hzha","uu5hDg4","Cwjczhi","yxnJCMLWDa","quvzBfG","AgvHzgvYCW","quD1y0e","BNzpB0u","C2jRBMW","CMvTB3zLrxy","x3bPBMDmB3m","Ag9MDNy","t2nXyNu","u3DxsKq","B2fIy0C","B25fCNjVCG","vu5NBxq","q0Xpu0ve","DwfpEei","s1bvDg8","CMvZzxrdB3u","tNjVwgm","wwPLywG","Cg93","yMLUza","x29Ut3bLBG","A1n0yxr1C0m","ALfpuhm","EwPrEw0","B3jpBMXPBMu","vgfN","zw1Pyw8","BKXvrLG","CKHIz2i","qMnfCfe","wMjZvKe","zu9sDgu","vgXfCM0","vLvAvNu","DufNqwi","AKzzBMC","vwLxqu4","Cg56AuG","zgvSzxrL","Bhm6ia","uMrzvKu","q2vvDM0","zMPrvhO","AMvJDfn0B3i","yxPdwwq","x2TLEvbHDgG","uunctgO","tKDFrvjst1i","AeH3DMu","B25tDg9Wsw0","y0nvrwu","ufvvwM8","yNL0zuXLBMC","EvjLy29UBMu","r2HQAhO","yw1L","zxrxB3jRq2G","zLrQAuC","mhW0Fdn8mNW","BePoshi","tw1hu1O","y29UBMvJDca","Aw5PDcbrB1m","thLtEhq","u3Hpy0C","yNDvrhG","DejIANC","tMfjBvu","z29PBMCGyxC","B3nZy2S","DxDir2y","id4G","Chv0","mNWWFdf8nxW","CNzHBfzHBhu","BKznuNG","AgvHzgvY","Ce5fsMS","CMfUzg9T","uLjpuG","y3rUwMy","y2uGBM90igK","y29TCgXLDgu","u3Ddr2y","uu5QqwO","v3bkzKC","zK1zAe8","x2nSzwfYvgK","CIb0DhDjra","sKnfBxq","zMPsvK4","ENHPuNC","thfJDKy","B3bbA1C","twvZC2fNzuu","rNDIBhO","Bg9N","pxv0zI04","vgvntxO","u2vXsuq","q3Pvrem","DMfSDwvZ","z2u6ia","zgLNDNy","s0r5B20","ihrVihjLDhi","x2nSzwfYugK","t09rB3q","yxnL","x2rYB3bhBg8","AMzNDfa","sufoBxa","BLb4BMG","u0PgBLC","t1bsywS","DhjPzxmGCMu","zLvVsxy","x21LC3nHz2u","mteYmZC1oxveq01UBW","zNDZxZeUmc4","CgfNzwHPzgu","zgzwyLC","yxGGCMv0CMK","ywnRpwzYB24","vMzoBu0","rxjYB3jdB2q","EvbvzM4","CMvZB2X2zq","y3vYCMvUDeK","DLzWDvK","DxLVB28","sxjqtfe","ywDL","BNvTyMvY","quXm","Eu1cyue","vhb6AKG","BeDnyK8","vMrYzvu","y0jbDhm","rwHLBe0","BwP2uve","CMvJzxzPzwq","uxvLDwu","yMXVy2TLza","BwLZzq","zcWG","CffvsgW","swHmshe","Dg9cExrLCW","DLLWtgm","wxLTrMG","BgLUzw5V","uKzHtu8","s3PitKm","DxbNCMfKzw4","AunUEuq","C0HmDuS","vxbKyxrLq28","rxbXseC","vuD1se0","swrsqNm","BNfJAfm","rgXXAw0","BKPODhO","zuzAq04","s2vJCKO","suDQCve","zKrSsve","x29UtwvZC2e","y29UDgLUDwu","D24GCMvHC28","DLPhwLq","y3vYDMfSDwu","y2rbEKi","y29UBMvJDeu","AgnryvO","shf6tha","uhviEvq","zen1shK","ExbL","Eu5TEfy","yMDdAgC","Efvsr0C","zcbLCNjVCI4","Cuzjq0e","zw5HyMXLuw8","qMXMrxe","jMPZy2fSBgi","tuvtu0fhrv8","CKThtfC","C3vIC3rYAw4","t1Pku08","C2fNzq","CgLUz09Uy2u","ignVzgu6ia","DgfYz2v0","rxLcs1u","AKzUrvC","B3nLza","A2LHCfe","AgvKtwf4uMu","D3m6lY8","t1bftL9fuLi","Dg5ssxa","Eez5D2e","swvsv1m","Aw50zwDLCIa","B3vUDa","s1PwrLC","zMzMzG","zg9Uzq","ywXSB2nvBNm","txfWs3G","zePTrMm","ywrKrxzLBNq","C0nYsgK","yNvMzMvYzwq","yMfdvfK","rxLytLy","x2n1CNnVCK4","yKT2zKG","DffovuG","s1f4rKS","BwvZC2fNzv8","txfnv28","B3feuK0","weT6ze0","tfbJs0m","y2f0y2G","suDjC2G","CNnzs3i","s2vODNe","wwH6y2q","x29UvgLTzw8","C29YDa","zM9YrwfJAa","D3jPDgvvAw4","s05bu0S","zuDmBe8","CMvZzxruCMK","whnHuvy","BuDetwW","ywXmv2S","CNzHBa","y3jLyxrLt3a","B2XKvMvYC2K","BMrWB2LUDca","rKLmrv9ot1q","BMnVzgLUzW","u0fNAvK","CgvYC2LZDgu","zgvJB2rLzey","tuDYCuW","wKT3y2q","v2PhB3i","BMDuAw1LCG","DMjWuwK","zfDVCMTLCKC","CNjVCK1LC3m","r0nwBNG","s0XHyve","uw1wCuW","s3v5yKK","yxzlt3u","BgLTAxq","BNrbBMrvCgq","sxzYse4","sfPdtxi","yxbWBhK","y3vYC29Yx2y","qNrquK8","r25NBgC","A1H3rxe","uNPku3O","CfPqt2y","BNrfBMrWB2K","D3vRueC","tefvuw4","suvtx0vsuK8","vLrizha","y2HnyxHdB3u","uffnsxi","zw5KCg9PBNq","rNbzwfK","x194x21Zz18","y29UBMvJDgK","y0nJAg0","zw50","uMHxq1O","yxv0B21HDgK","x25HDMLNyxq","nhWZ","y29UBMvJDfm","B25nzxnZywC","CwzTuwO","yNL0zu9MzNm","C2vYDMLJzq","zxjFCw9Z","A1rtuxu","tKTHD2e","ruHPA1a","y2fSBa","sLfUAvG","CgLUz19VBMm","A25stvq","rK9NrNa","ign1CNnVCIa","u2fqrLi","yw5ZzM9YBvq","D3jPDgu","uvPLEgC","x2LUDgvYDMe","tw9KDwXL","ywrK","zNrvzNy","t2L0wge","vKvdBNu","qMTovw0","uxPmwgS","x2nVBM5Ly3q","u1rcue0","DgLTzw91DcW","Ec1TC2CTy3u","C2v0q3vYC28","t2Tpy2i","twLZC2LUzYa","qNjPzgDL","rvvPEgi","zu9Ks3O","v1bYELq","ywnRx2LK","tMHZrvm","zgLZCgf0y2G","ChjVDg90Exa","zw5JB2rLrNi","AgfZ","Ae1LC3nHz2u","BfPKCLm","txnctNK","wLDrthi","DgzJvu4","ig1LC3nHz2u","q2HnAvu","sMPqBLq","sKHyrLm","vwLns2i","uevsCuS","y29Uy2f0","wuXnvhi","zuLJz3O","BNrSqM8","BKnKqMy","CM9YrxzLBNq","C2v0u3rVCMe","AwXLx25HBwu","tKTPzhq","B1j2BMe","oxvHCg1qsq","EwLOB3a","DhvZDem","BxngEfG","Aw1LCYbPBIa","zwn0","CvnMzfK","qMrQDM8","Cw1zCNG","t0PMtNa","CKPZzvK","Axz4EuS","zhzbB0C","m3W4Fdb8n3W","zgHiA0O","A3bAALa","x2LZqNjVD3m","zu9PCNC","twrmBgC","vurzuLa","Dg9oDw1Izxi","z2v0q3vYC28","y2XVC2u","AvD5uvK","EfngB04","zvDnCwG","z2v0t3DUuhi","reiGzMfPBgu","rLLeBui","wwH4zeS","sevhqLa","shH0twu","CuXbD3G","zxDTBvC","ChLwAMe","wgDYrM8","CeHiC1a","EgTPEeG","ug9At0e","vLb6EuK","y29UDgv4Da","vwTNCg0","BwLUAvbYB2C","vgvhy1C","qwTkt08","DfDAA1C","CMLLC0nVDw4","tun0t0e","whbhChC","DNr2Deq","BgvSyMO","C0Xf","BwvY","BwvZC2fNztO","x2rLC3rYB3K","BxjrtvO","x3vYBa","sfLVqKe","y2HLy2Tszwe","D3LeBKG","x29UrxjYB3i","x3bYzwzPEa","uKfmqva","x2LUAxq","B2zMBgLUzq","yK9sCg0","D2LSBfjLy28","q0LqBwe","mtaYodi0oe10zhvwua","zgnQBKy","CNnVCL92ywW","rLjSvue","yw1LoIa","lcbxzwjtB2m","DMTxDNq","BxnNsuq","zNvUy3rPB24","zufJAW","Dw50","tePvqNi","z2v0q3vYCMu","B3LPBNq","sLPKCgm","B3bLCNr5","Cg9PBNrbBMq","v0DWtwW","zMDSuhy","ywjVCNq","x2LZv29YA2u","uK5Hz2O","wLDMAeG","AwDHDg9Yt24","EKX1r1i","CM92AwrLige","Aw5JBhvKzxm","x3jLy29UBMu","ywr2yw5Jzq","EfvZzuvUDG","wuPutKK","r2XvDeK","zNjVBuj5Dgu","rgvKAwnHDgu","wujOAvO","Dwr0y2W","CMvHzhLtDge","yvnWz1u","DgLTzw91Da","BwvZC2fNzq","wMLdEee","q1v1yKe","BgrlEwy","l3DZl3yY","ywHbDgu","r2XpEKm","zNDftLC","vw5Oyw5KBgu","ENbss24","C0nVDw50zxi","yNzwyMi","uKHOwhm","vfjLB1O","x3bPBMC","D1nwuuG","wgrlBgK","tev2u1i","z2vtEw5J","x21PBMLoyxy","DMfS","zw1LBNq","vgnfzxq","x2LUAxrhBg8","zNjVBuHHC2G","x2rLyNvN","zw50tgLZDgu","AxPOsLq","ywXty29Wzq","rhD2B2W","tMDWAgG","uwjkrui","uM9syu8","t3jAs3O","DhLWzq","AeL0rhu","u0nAC0i","CMvXDwLYzwq","y3vYC29Yx24","zxjYtxnN","zLP3EhC","wvvXExC","uMfwBKi","wurRuhu","uMTktxe","rg9Lz3y","yMfXAgO","C3Pgv2S","BM93","Ahr0Chm6","s05Qy3G","DeLAv2W","zuPLuem","ywXSzwqGBxu","DeDhBuO","zMzLCG","t292BvG","CMvZDwX0","yM9KEq","Ae9Wzw5fDMu","y3jLyxrLt2i","zg5uq04","ALr0CKS","Auv5wNO","zuX4C1y","yNL0zxm","v2LUzg93","DLnpCeC","DKDRAfC","y3vYC29YlNm","CvDsDhm","C0XPC3rLBMu","vhHgreS","x2rItMfTzq","tg9NsurozxC","C2DPza","y3vZDg9Tshq","yufRqMW","Awr6CxK","zMzmAw5L","qMTgvgq","A2v5CW","ihjLy29UBMu","yMfJA3vWigu","shrzwhK","y2XLyxjtDg8","Cgf5Bg9Hza","zxj2AwnL","ywXPzcb1CMW","zfDTtMi","y3vYCMvUDeu","x3nLCuLK","AgL0zeS","yxKSig5LDhC","CMvWBgfJzq","q2Pms0u","wvLhwfq","ihrPBwvZ","C2v0zgi","yxHqqK8","yxbWzw5Kq2G","BMvJDa","B3jRig9MzMW","zMLSDgvY","C3nHz2vfDMu","y1fRyuW","z2v0u3rVCMe","ihrYEsbYzwm","y0PyC3a","C1nOr2u","zv9ZDwnJzxm","x2HHBMrSzvi","BIWGAg9ZDg4","wK5dvNG","s3vns2u","C0TgD3m","r0zerMO","rMHArfe","CMvHC29U","Dw5RBM93BIa","yMzbELy","yuPRu3m","uNbpuue","DMvUDa","AenSB3nLrxy","sxHbyMm","CgfYC2u","m3WYFdr8mxW","ANHvtui","z2v0","BwLUzW","CMvJB25Uzwm","rvvztvy","rg1kBhm","B2nRzxrgywK","BfjvEe4","CLfzywC","B2nRzxrtDwm","vgrzr0W","tgLZDgvUzxi","CMTLCKDSB2i","x3bYB3rVy28","qwLQA3q","Cw1Lv1C","BM5hAue","zgLZywjSzue","ywnOzwq","BMfTzq","DMvYC2LVBMm","yNvMzMvY","CgXLyxnLiha","B25mAw5L","zu5cD2G","C3HUDva","y1rNs08","t1bftG","AgfUz2u","yKTbqMW","x2n1CNnVCKy","q29UzMLN","rvjrww4","rKDkwxu","sfjcwKu","v25zC3i","CwDKEMK","zwTiAKy","Bg9IywXty28","DKjYBwm","v05QBxG","sK1nvKm","zxjFDhrS","u1HPveq","y1b5t3i","qMXxqxq","Dhj1y3rVCIa","uwfMvvm","CMT0vvK","DhDVCMTdAge","zxflELu","wwLIwfe","t3ftEwm","y2HLy2TdDxi","z2v0qwXSs2u","Cg9PBNrdB24","s0zdCfa","ExrKuuS","ChrVCG","D2r0s1a","yLLtzhy","zgvMAw5Luhi","rwvvtNK","yMLUyxj5vhK","yw1QrNq","wwzPwvG","z2vY","rLL6rNq","CxbHru4","vfvpAxq","sgfOzKe","mZm5otC0n3LmzhnRvW","ywDLrxzLBNq","AvDvvM8","shPSzvq","txDNtgC","B2jQzwn0u3q","DxrVuMvJB24","CMvHzg9UBhK","ru1qwwK","BLfYD00","tMHVExq","CNn3yMK","Ahn3rNK","C2vUza","x1fVu01HBMe","x29Uq2XVC2u","EwXjvfq","uu9LsNy","tMTSCuq","zNjVBNrPzxi","r1HIr0i","wu9Nug4","tKfusvzfx0u","y3ruAw1LB3u","x0rctMfTzq","rgHts2W","wMvRqNe","rM1HyMe","C3vIyxjYyxK","vKXez2y","t3L6rwu","zgv2AwnLx2K","mNW1Fdn8nhW","s2v6twS","mxWZ","tvHwA3K","sK1Pru4","DK9mEeq","wgPRyKm","zMX1C2HfEha","Avb6shO","sLnptLa","C2v0sxrLBq","ChD5wNm","BvntvfK","r2HsA2K","tLDVA1u","zNjVBujPDhm","mxWYFdr8nNW","EuzsreK","qwHAD3a","CLzbDgq","igfYCMf5yNu","uxDLsMq","DhrUvwO","qwXWAKO","tLPKwNC","zu9xENa","qNr6y0u","r3fKDKG","s1HxBMy","wKPXvum","AhH5rMG","yNDXy2u","v1vxwKW","BhrPCgXLihq","zMLSzw5HBwu","Dgv4Dc9Qyxy","v3nNCxq","rfbNvfO","uuDLu2S","qxnmv3K","uNLNseS","CgLUz0LUDgu","t0Xbs04","v1LNEwG","EwPxzfy","vMLSzha","De1HBMfNzxi","y2H6q0C","Dgj5C0K","ihrPBwvVDxq","sg9PAgW","A25rB04","quD2sKK","DeLK","txjztLG","Cgf5Bg9Hzfq","rujsswW","mxWWFdr8m3W","ze1ZrhO","rKXfuuK","ChbL","n3W1Fdb8mxW","uwP2u3e","CeTIzuG","vhrKsKC","v0LLAwG","vw1NAfu","C0v2sKe","tNzxAwS","y3r4rgG","CKPjCvC","u2LwEwC","DgvZDa","zwrPyxrLBhK","y2XVC2veqG","wenJvw8","CMfTugfYyw0","EeHgruG","B1z5Chm","u2zjv0u","ANbNEgO","vhLKENC","yxv0BW","BfrPBwvVDxq","BKXPBMu","zhP3uLO","DhnRrhG","y3vYC29Y","wMnTqwq","Cw9Zx18","EKjVCva","BMCGzMfPBgu","B25JBg9Zzq","yLDvAum","DNPvrhy","B25VCgvU","y29Kzq","C2XPy2u","sgLrEwq","sKXLyMS","Dg9iyxnO","zNfwq3O","y3jLyxrLrxi","A2v0ignVBNm","DvbNDxG","DwnACeG","rfDzCLu","lcbTyxGGCMu","yxnZAwDU","CwzcCMu","AxjLza","x2vUzhbVAw4","z0vMAwu","zvvYBa","CNHSrKu","wNbjz3y","uNDusvO","zxjYtM8","BeHHBMrSzxi","sgPUDhK","sNzTuhy","wMTWAMG","m3WXFdj8nhW","Dg9cExrLC0i","DxbKyxrLq3u","mtmWmdy2mffIChPtqq","igzPzwXKoIa","y09Wzw4","Aw5Lza","zMLN","zxjHDg9Y","zNrJuwG","AxnrB1nby2S","DNHPqKG"];return Sn=function(){return r},Sn()}Ee.d=(r,e)=>{let i=P;for(var a in e)Ee.o(e,a)&&!Ee.o(r,a)&&Object[i(1588)+i(1375)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;Ee.o=(e,i)=>Object.prototype[r(833)+r(1375)][r(1236)](e,i)})(),(()=>{let r=S,e={uyooo:function(i,a){return i!=a},iTeAu:r(399)+"d",gyGLK:"Module"};Ee.r=i=>{let a=r;e[a(1064)](e.iTeAu,typeof Symbol)&&Symbol[a(846)+a(959)]&&Object[a(1588)+a(1375)](i,Symbol["toString"+a(959)],{value:e[a(512)]}),Object[a(1588)+a(1375)](i,"__esModule",{value:!0})}})();var $={};(()=>{let r=S,e={LhrRr:function(s,t){return s+t},SJFnW:function(s,t){return s*t},VPzyI:function(s,t){return s+t},JzRPM:function(s,t){return s(t)},rAhZF:function(s,t,n){return s(t,n)},uRKpu:function(s,t){return s(t)},zPRsg:function(s,t,n){return s(t,n)},QzLXk:function(s,t){return s(t)},QOhLQ:function(s,t){return s+t},NKidt:r(689),uRItW:function(s,t){return s!==t},XVQrX:r(1583),YymFh:r(903),RzBKe:function(s,t){return s>t},ozMho:function(s,t){return s<t},ftaio:function(s,t){return s-t},zpgTv:r(564),OLAKN:function(s,t){return s-t},cCchm:function(s,t){return s===t},HGTzY:function(s,t){return s<t},oIsBT:function(s,t){return s|t},qpaEN:function(s,t){return s<<t},axPBO:function(s,t){return s<<t},fAQmS:function(s,t){return s&t},stPRV:function(s,t,n){return s(t,n)},aHuQH:function(s,t){return s>>t},avKOu:function(s,t){return s===t},nvOoE:r(1382),xiGob:"ysKVA",trIUv:function(s,t,n){return s(t,n)},nnGiA:function(s,t,n){return s(t,n)},QbJEB:function(s,t){return s===t},zBoqP:r(1667),vSOpG:r(1302),lXpSg:function(s,t){return s>>>t},mvQxF:function(s,t,n){return s(t,n)},ZWxIc:function(s,t,n){return s(t,n)},Oomfh:function(s,t){return s===t},GQoPJ:r(1260)+r(1436)+r(1756)+r(736),anSTG:function(s){return s()},YXkPb:function(s,t){return s(t)},vqWIZ:function(s,t){return s>>>t},cQkaL:function(s,t){return s&t},BvtnQ:function(s,t){return s>>>t},EuYOi:r(545)+"s alread"+r(856),cCUEe:function(s,t){return s===t},HEGBP:r(1160),RNagj:function(s,t){return s!==t},RpyOS:"mwltf",UDYRP:r(1559),PJPeZ:function(s,t,n){return s(t,n)},riorE:function(s,t){return s!==t},lelbj:function(s,t,n){return s(t,n)},eBsEJ:function(s,t,n){return s(t,n)},eqKzU:function(s,t){return s(t)},tustC:function(s,t,n){return s(t,n)},SXiTD:function(s,t,n){return s(t,n)},tbysI:r(542),TxFDK:function(s,t,n){return s(t,n)},KNjcx:function(s,t,n){return s(t,n)},IeRWS:function(s,t,n){return s(t,n)},cAeco:r(1444),MuKdv:r(757),skiyx:function(s,t,n){return s(t,n)},UGuHM:function(s,t){return s!==t},kjohb:function(s,t,n){return s(t,n)},WlznC:function(s,t,n){return s(t,n)},hitdK:function(s,t,n){return s(t,n)},JVJkD:function(s,t,n){return s(t,n)},CUubA:function(s,t,n){return s(t,n)},mIjOF:function(s,t,n){return s(t,n)},KoVFa:function(s,t){return s>>>t},OPRak:function(s,t,n){return s(t,n)},vZGZT:function(s,t){return s(t)},sbJzy:function(s,t,n){return s(t,n)},LySxt:function(s,t,n){return s(t,n)},HZCMr:function(s,t){return s(t)},GwXQm:function(s,t,n){return s(t,n)},JjPnT:function(s,t){return s(t)},CUWCr:function(s,t,n){return s(t,n)},OZJSO:function(s,t){return s===t},uGgkX:r(1260)+r(1436)+" field: "+r(1033),LPrWy:r(1260)+r(1436)+r(1756)+r(834),KcRwp:r(1260)+r(1436)+r(1756)+"service",UpIcY:r(1260)+r(1436)+r(1756)+r(1825),QweJd:"close",CeKOF:r(496),nxFxk:function(s,t){return s+t},RzJSz:function(s,t){return s&t},ChMiU:function(s,t){return s(t)},iFZQm:function(s,t,n){return s(t,n)},Sgbod:function(s,t,n){return s(t,n)},qSfdY:"Unimplem"+r(755)+r(894),bYSdv:function(s,t){return s>=t},tdmsk:function(s,t){return s>=t},IGjqQ:function(s,t,n,o){return s(t,n,o)},JGKIX:function(s,t){return s+t},udtcl:function(s,t){return s!==t},oUhaG:r(1815),xqpUU:r(702),rdUBS:function(s,t){return s===t},cljUJ:function(s,t){return s+t},bwqce:function(s,t){return s>=t},lTulI:function(s,t){return s<t},rKGLW:function(s,t){return s|t},oabcG:function(s,t){return s&t},UIsjr:function(s,t){return s>=t},Dwvol:function(s,t){return s>>t},dkZjV:function(s,t){return s===t},kAwoe:r(442),JMMVC:function(s,t){return s>t},JLebk:function(s,t){return s>t},mtJCb:"Read past limit",baCTY:function(s,t,n){return s(t,n)},mSSTY:function(s,t){return s+t},LTfYC:function(s,t,n){return s(t,n)},yKQkE:function(s,t){return s&t},Qelzm:function(s,t){return s+t},ceqwF:function(s,t){return s&t},EGBrn:function(s,t){return s==t},WEbAC:function(s,t){return s+t},eOirw:function(s,t){return s+t},TlErm:function(s,t){return s+t},AFGBc:function(s,t){return s!==t},DRgNF:function(s,t){return s|t},RHhXs:function(s,t){return s<<t},SiVyg:function(s,t){return s|t},JMCpP:function(s,t){return s&t},bKvfH:function(s,t){return s&t},NhsES:function(s,t){return s&t},OitXa:function(s,t){return s<=t},tnRIp:function(s,t){return s&t},MCtOA:function(s,t){return s+t},AGvJI:function(s,t){return s+t},QNjAj:function(s,t){return s+t},QrUOq:function(s,t){return s!==t},LqcvF:function(s,t){return s<<t},sCrHi:function(s,t){return s<<t},qurVK:function(s,t){return s&t},uIGoH:function(s,t){return s>=t},Ivgth:function(s,t){return s+t},bgChg:function(s,t){return s-t},dfVbW:function(s,t){return s+t},rLDuy:function(s,t){return s<t},TpzjH:function(s,t){return s>=t},xSewm:function(s,t){return s<=t},yosjb:function(s,t){return s<t},hGbFg:function(s,t){return s+t},NZdZw:function(s,t){return s<t},JwNrw:function(s,t){return s|t},tBbjw:function(s,t){return s&t},PoZOA:function(s,t){return s<t},JHXFS:function(s,t){return s&t},azCYd:function(s,t){return s|t},OvgOA:function(s,t){return s>>t},oyint:function(s,t){return s&t},zxiRw:function(s,t){return s&t},qmeWW:function(s,t){return s>>t},YJTNI:function(s,t){return s&t},JSZWe:function(s,t){return s>>>t},TUOit:function(s,t){return s&t},FemAY:function(s,t){return s>>>t},vOLxD:r(619),yMBaA:function(s,t){return s<t},VzNIn:function(s,t){return s+t},Ocqbu:r(825),xSFoN:r(1263),EUixb:r(631),iaJts:function(s,t,n){return s(t,n)},iWUVo:function(s,t){return s<<t},rktUY:function(s,t){return s&t},Hjnty:function(s,t){return s&t},MdLlg:function(s,t){return s&t},RhWCZ:r(1016),uRZCb:r(533),Hoihl:function(s){return s()},WWkaa:r(516)+"or",rRNNG:function(s,t){return s&t},dvAoG:function(s,t){return s&t},hfVEO:function(s,t){return s<<t},jaSrW:function(s,t){return s&t},IxUTz:function(s,t){return s&t},dJmFc:function(s,t){return s&t},JMiEN:function(s,t){return s<<t},OJfNp:function(s,t){return s&t},alLWk:function(s,t){return s&t},pQUHl:function(s,t){return s<<t},FmPtZ:function(s,t){return s&t},wnkAQ:function(s,t){return s&t},dzwRZ:function(s,t){return s|t},yPUfn:function(s,t){return s>>>t},RuAQU:function(s,t){return s>>>t},plhXI:function(s,t){return s|t},BlWAt:function(s,t){return s>>>t},iSTYg:function(s,t){return s<t},AVFzs:function(s,t){return s<t},cZaAN:function(s,t,n){return s(t,n)},Hosuc:function(s,t){return s&t},eORte:function(s,t){return s+t},HvRni:function(s,t){return s|t},hARBm:function(s,t){return s>>>t},LPcKC:function(s,t){return s+t},GqdvH:function(s,t){return s!==t},ZvJtS:function(s,t){return s|t},iCnyD:function(s,t){return s&t},bgTpz:function(s,t){return s>>>t},NsOPs:function(s,t){return s>>>t},uCKFQ:function(s,t){return s+t},cDLdO:function(s,t){return s!==t},aJqll:function(s,t){return s+t},lGMbO:function(s,t){return s>>>t},iWyQY:function(s,t){return s!==t},LqIdV:function(s,t){return s|t},TcEet:function(s,t){return s>>>t},uPgux:function(s,t){return s&t},KQwzK:function(s,t){return s>>>t},HEJUR:function(s,t){return s&t},YfJKs:function(s,t){return s|t},HzleT:function(s,t){return s&t},PERqK:"RNGjT",digvv:r(466),FhZDQ:function(s,t,n,o,c){return s(t,n,o,c)},RSkBe:function(s,t){return s(t)},bZzVi:function(s,t){return s!==t},xwpYT:r(1689),lJNHr:"QyQDm",AFxaG:function(s,t){return s|t},wukPG:function(s,t){return s<<t},YUqyw:function(s,t){return s<<t},Lonsx:function(s,t){return s|t},fqVCz:function(s,t){return s<<t},gNXlH:function(s,t){return s===t},RPRfS:function(s,t){return s|t},yaerY:function(s,t){return s<<t},WUWZL:function(s,t){return s<<t},lPxdZ:function(s,t){return s<<t},bWUiC:function(s,t){return s>>>t},HuHjX:function(s,t){return s|t},YDkPu:function(s,t){return s|t},qfBre:function(s,t){return s|t},otULm:function(s,t){return s>>>t},MsBNy:function(s,t){return s&t},vCmPm:function(s,t){return s&t},HjOEK:function(s,t){return s>>>t},fWUmI:function(s,t){return s<=t},sRaYo:function(s,t){return s>=t},tWZkW:function(s,t){return s|t},WKxdv:function(s,t){return s%t},OqyMG:function(s,t){return s|t},aWDVg:function(s,t){return s/t},eFZCN:function(s,t){return s!==t},YYGXT:function(s,t){return s>>>t},iUmQc:function(s,t){return s*t},gMdaj:function(s,t){return s(t)},oVyps:"ROGrF",kaFbI:r(1616),NUEGi:function(s,t){return s===t},WjGor:function(s,t){return s&t},Zkpjh:function(s,t){return s>>>t},ZVplU:function(s,t){return s&t},Idjoh:function(s,t){return s>>>t},pNEJk:function(s,t){return s+t},ksOQA:function(s,t){return s>>>t},Avoye:function(s,t){return s+t},hcQaZ:function(s,t){return s>>>t},idzqy:function(s,t){return s+t},lTPzo:function(s,t){return s|t},Sylmt:function(s,t){return s!==t},pZPOf:function(s,t){return s===t},bnsyb:function(s,t){return s>>>t},xJvZG:function(s,t){return s===t},ZNDUj:function(s,t){return s===t},kiapQ:function(s,t){return s+t},knRMT:function(s,t){return s>>>t},ZLVqe:function(s,t){return s&t},nBvHl:function(s,t){return s>>>t},JQniX:function(s,t){return s>>>t},VfNmM:function(s,t){return s&t},sEvJA:function(s,t){return s&t},XjkbC:function(s,t){return s&t},xGioe:function(s,t){return s&t},vkpYd:r(1007)+r(1226),WusSK:r(1786)+r(981),RXbhs:r(395)+r(1213)+"R",aSpgU:r(1620)+r(1013),HRBZE:r(1137)+"OR",XEYcY:r(1123)+"ERROR",cfaqI:r(555)+r(896),wYgjw:"4|2|3|1|0",Ngphh:function(s,t){return s>t},pwyZs:r(1901),HYbQV:function(s,t,n){return s(t,n)},tfcUN:function(s,t){return s!==t},KNASK:r(1460),keLCn:r(462),yjQym:function(s,t){return s===t},UZuKz:function(s,t){return s-t},aYjly:function(s,t){return s===t},QqeuL:function(s,t){return s instanceof t},mGDMl:r(1407)+r(1118),XKzdM:function(s,t){return s+t},FDUEa:r(1439),rsBWX:function(s,t){return s===t},dPimd:r(1206),jMXyg:r(1800),NAQzE:"DaPvT",mqMMV:"message",YBhiZ:function(s,t,n){return s(t,n)},KuybI:function(s,t,n){return s(t,n)},qLAwx:function(s,t,n){return s(t,n)},rsyIF:function(s,t,n){return s(t,n)},dOghM:"geVgS",hItDu:r(1627),SCZsB:function(s,t){return s||t},ttnUj:function(s,t){return s||t},HqzLp:r(1526)+"0",wXUWN:function(s,t){return s||t},lsGwc:function(s,t){return s!=t},CISfi:"undefined",yVBBj:function(s,t){return s<=t},Scxza:"next() c"+r(1452)+r(1663)+r(1296)+"process",IJmdG:function(s,t){return s===t},NKawa:function(s,t){return s+t},aOrDI:function(s,t){return s<t},Annwl:function(s,t){return s===t},OXRXI:function(s,t){return s<t},OkhLy:function(s,t){return s-t},glwqU:function(s,t){return s<=t},GXbGB:function(s,t){return s>=t},msFxX:function(s,t){return s<t},uNRwq:function(s,t){return s|t},uwHGf:function(s,t){return s<<t},lEHtA:function(s,t){return s|t},tQNUH:function(s,t){return s&t},asdTN:function(s,t){return s|t},iEyZz:function(s,t){return s<<t},cdAzB:function(s,t){return s<<t},adpaz:function(s,t){return s&t},lMNdV:function(s,t){return s+t},csYhO:function(s,t){return s+t},DhSKl:function(s,t){return s&t},wSVQH:r(551),lRUxN:function(s,t){return s(t)},Nneem:function(s,t){return s!==t},ekHjF:function(s,t){return s<t},ZmDaV:function(s,t){return s|t},vkWvt:function(s,t){return s===t},cTgKO:function(s,t){return s&t},GpaEk:"4|2|5|0|"+r(1632),RAzuB:function(s,t){return s|t},hxyFh:function(s,t){return s>>t},XydME:function(s,t){return s&t},FGJYu:function(s,t){return s+t},VdreU:function(s,t){return s|t},EsnIh:function(s,t){return s&t},Xzcri:function(s,t){return s instanceof t},jgBUt:function(s,t){return s instanceof t},OaLAW:function(s,t){return s!=t},fTjiG:function(s,t){return s==t},mcfft:"text/pla"+r(859)+r(1818),fjQTz:r(1851),gJghb:r(1247),nqchS:"__esModule",ydoSo:function(s,t){return s===t},NGYFc:r(905),OJzux:function(s,t){return s<t},ZbsVA:function(s,t){return s+t},jxUMB:function(s,t){return s(t)},opAkW:r(1518)+"reason",TiRHO:r(639),fMYhO:r(1054),GOuCZ:r(738),bOLnI:r(1665)+"ascript",QafUS:"&jscallback=frontierJSONP",YfiYX:"TWBVh",KXWnf:r(1029),IANmp:r(1735),nnhZr:r(1463),RkJMq:r(717),vbpQi:r(726),HYoBA:function(s){return s()},twoSS:function(s,t){return s===t},baTyi:r(1488),gXjKv:function(s,t){return s===t},JxNAu:r(449),OOQot:r(697),WnYsr:function(s,t){return s===t},AkOPB:function(s,t){return s in t},ctxDh:r(1865),PUUZo:function(s,t){return s===t},ajIdG:r(1567),DRbXC:function(s,t){return s||t},jJoom:function(s,t){return s||t},RaVnB:"4|2|1|0|3",OYgEZ:function(s,t){return s!==t},yaLJU:function(s,t){return s||t},sHLuK:function(s,t){return s||t},IxAbc:function(s,t){return s(t)},FpYXY:function(s,t){return s!==t},LftnU:r(612),MgTPf:function(s,t){return s||t},OkOcb:"ymSim",wMadp:"xwCcR",XdKli:function(s,t){return s||t},KuMKe:r(996)+r(1319)+"d",WPrzT:function(s,t){return s*t},ALVoY:function(s,t){return s!==t},PdSBT:r(1467),JHYGo:function(s,t,n){return s(t,n)},JjVpo:"qos",nPzWu:r(1158)+"id",Moznm:"OmTDa",EhelM:function(s,t){return s(t)},IPXAx:r(885),izhJT:r(1201),ZTSBr:function(s,t){return s(t)},FUOsO:r(715)+r(1232),grjWk:r(715)+"er_qos_ack",jRnqY:"x_frontier_is_ack",HbOOs:"x_frontier_ack_m"+r(1474),cQlgs:function(s,t,n,o){return s(t,n,o)},ewmmW:"is_ack",GhRki:function(s,t){return s&&t},CIPma:r(1265),emwGa:"ack_code",ftUfv:function(s){return s()},ZcmAd:function(s,t){return s(t)},jxwqa:r(1728),DlyBC:r(752),Oiput:"application/json",VTHdp:"application/json"+r(667)+r(1031),rlksM:r(535)+"e",cJXsp:r(520),YOgPn:function(s,t){return s(t)},jWaHJ:function(s,t){return s+t},EOPUq:function(s,t){return s|t},CGtRp:r(1724),SElGD:r(630),RynrW:function(s,t){return s>>>t},fKvJH:function(s,t){return s(t)},GyJCA:function(s,t){return s+t},AlpjJ:function(s,t){return s+t},tAVjS:function(s,t){return s+t},VHsas:r(465),JqciA:r(1005),yJVhE:function(s,t){return s+t},BkFTd:r(531),DZGxx:function(s,t){return s>>>t},ghQoQ:r(992)+"1",hHwve:function(s,t){return s+t},domhM:function(s,t){return s+t},qRnzy:function(s,t){return s+t},MoGHH:function(s,t){return s<t},jFYng:function(s,t){return s|t},EJHDO:function(s,t){return s+t},YoiqP:function(s,t){return s+t},wjtno:function(s,t){return s+t},xoUPL:function(s,t){return s<<t},ovOlG:function(s,t){return s+t},RoRaO:function(s,t){return s+t},rHGhi:function(s,t){return s+t},SyTdW:function(s,t){return s>>>t},qYYVI:function(s,t){return s&t},OSdxF:function(s,t){return s>>>t},seQiu:function(s,t){return s+t},ELuwT:function(s,t){return s&t},tkYyk:function(s,t){return s>>>t},lAVmG:function(s,t){return s+t},KQpSa:function(s,t){return s&t},YhxdK:function(s,t){return s>>>t},TeGcW:r(1363),pnziH:function(s,t){return s+t},dbNHp:function(s,t){return s+t},Aijkt:function(s,t){return s&t},LsWgr:function(s,t){return s>>>t},ZKwcd:function(s,t){return s&t},sKFws:function(s,t){return s&t},OYrls:function(s,t){return s|t},CZpya:function(s,t){return s>>>t},qEfiB:function(s,t){return s<t},MCSrD:function(s,t){return s|t},puHMC:function(s,t){return s!==t},pyVja:function(s,t,n,o){return s(t,n,o)},fDlIQ:function(s,t){return s===t},emoUJ:"xAfRD",QjvSq:"BRTTL",cyyND:function(s,t){return s(t)},MXVky:r(1305)+r(1646)+"10|5|9",PQMIr:r(1010),SxOcG:"service",aAkBl:r(1468)+r(1486),KMJWP:function(s,t,n,o){return s(t,n,o)},JHQyB:function(s,t,n,o){return s(t,n,o)},kvcDj:r(1107),rsYKr:r(1705),EyXNV:r(1204)+r(1289),JVUZW:"success",jFnEW:r(1238)+r(632)+"t",NvWik:function(s,t){return s<t},KZVFW:r(696),OrZKz:function(s,t){return s+t},QYRLx:r(1182)+r(729),WMasM:"cursor_name",rpLrH:function(s,t){return s(t)},qbBdr:"ping_onc"+r(1509)+"s",EKfsD:r(951),AmHRd:"vgmmj",FVBKE:"allCurso"+r(1821),RdYVE:r(1068),KzHNC:"INSTANT",vYpLc:r(772),IEkiK:r(1497),baqhj:function(s,t){return s(t)},DWYrU:"setcursor",xRyJa:function(s,t){return s>=t},WGpMl:function(s,t){return s===t},UrJhm:function(s,t){return s===t},fJveY:r(391),JIWER:r(565),UNgmt:r(573),qPLCJ:function(s,t){return s||t},Wsgqt:r(674),ojWZJ:r(845),cBAts:r(843),mwWXt:r(1687)+"2",cPyOr:"yoFVf",SaPFR:r(1019),nCdBf:function(s,t,n,o){return s(t,n,o)},ZpIgv:r(1726),mxMnn:function(s,t,n){return s(t,n)},ossck:r(715)+r(409),zLuGR:r(715)+r(1569),qfmQj:"x-msg-qos",OovmX:function(s,t,n){return s(t,n)},bALZL:r(1257)+r(1362)+"ue",Ghjhz:function(s){return s()},arCBp:function(s){return s()},mDsYa:function(s){return s()},HahfA:r(1356),vWiTx:r(616),hFHyy:function(s,t){return s===t},NhIhY:r(1272),rVewC:r(1750),EHikP:function(s,t){return s===t},EUYMV:function(s,t){return s===t},NHZsP:function(s){return s()},voqmn:function(s){return s()},RfVdk:function(s){return s()},hamfW:function(s,t){return s===t},pHHsP:function(s,t,n){return s(t,n)},ZiCxA:function(s,t,n,o){return s(t,n,o)},RLmpN:function(s,t,n){return s(t,n)},eWMqh:"always",tVaAR:function(s,t){return s===t},spePX:function(s,t,n){return s(t,n)},fMite:function(s,t){return s|t},KLaaQ:function(s,t){return s>>t},Hqhgm:function(s,t){return s>>t},tIZWl:function(s,t){return s&t},amjFt:r(1157),DmJls:function(s,t,n){return s(t,n)},eOWzp:"arraybuf"+r(926),QKoLZ:"auto",ShQCX:r(1549)+r(676)+r(486)+r(1365)+r(1733)+r(1573)+r(1841)+r(1758),yjWdV:r(1530)+"t",wVPRn:function(s,t){return s===t},bfAzV:"lZPSf",PUEmD:r(1520),Ukgpm:function(s,t){return s!==t},BtPRO:function(s,t){return s!==t},PoIHf:r(1804),dCuHy:function(s,t){return s==t},EyBKU:r(1448),LVElh:"wss://",PkQGu:r(1136),tnucL:r(764),yFRDI:r(1629)+"d",jUzRe:function(s,t){return s||t},NGFiD:"please provide b"+r(686)+r(580)+r(1022),Jgwdi:"function",PXQmB:r(721),tcVxy:r(1053)+"0",jTtrK:function(s,t,n){return s(t,n)},qwQqu:r(540),cnagu:function(s,t,n){return s(t,n)},yihop:function(s,t){return s(t)},oAhWv:r(716)+">",OqSyc:function(s,t){return s*t},LCvVA:function(s,t){return s-t},POlCT:function(s,t){return s>t},xMzHE:function(s,t,n){return s(t,n)},GrLGk:function(s,t){return s!==t},VJRkt:function(s,t,n){return s(t,n)},fddPK:r(1002)+r(708)+r(1530)+"ting ser"+r(760),YgyaE:function(s,t){return s===t},lLHqp:r(961),iPzHz:r(1256)+r(1506)+"onnecting",KezMk:"open",XJQQU:function(s,t){return s!==t},Fofiv:r(1082),YLMTr:r(607),VltzS:function(s,t,n){return s(t,n)},zpRKn:function(s,t){return s===t},QCBLj:r(1869),MCOqZ:function(s,t,n){return s(t,n)},eNBwh:r(1002)+r(1492)+r(1501)+r(445),SJnwz:"ack",DUfaG:function(s,t){return s===t},fUoIv:function(s,t){return s(t)},Dlqim:r(426),tskDx:r(1065),URGJp:r(644),PjPcd:function(s,t){return s==t},bvVbb:r(1549)+r(1385)+r(1776)+r(1829)+"a must be a stri"+r(912)+r(1650)+r(1454),uHTQk:r(1067),OEVZQ:function(s,t){return s instanceof t},MwgLg:function(s,t){return s instanceof t},xmVXT:r(1549)+"rovide a valid service",vIwQT:function(s,t){return s instanceof t},CaFUk:function(s,t){return s instanceof t},cTWWM:function(s,t){return s(t)},UBswp:"sent",Yhzcd:function(s,t){return s!==t},KdgvM:"rTnCp",ftcQh:r(460),nZAih:function(s,t){return s||t},AEYlX:function(s,t){return s==t},QPsIk:function(s,t){return s!==t},vVpuY:r(614)+r(857)+r(615),PyANF:r(887)+"4",ztDqS:r(1354),FYDmB:"timeout",EBRIl:function(s,t,n){return s(t,n)},KDyom:r(1378),HmHNG:r(690),szihn:function(s,t){return s*t},NWokU:function(s,t){return s!=t},ZoNCt:function(s,t){return s===t},kITlB:r(1465),rHbgb:function(s,t){return s!=t},BcEpQ:function(s,t){return s!=t},SwWJD:function(s,t){return s!=t},ZWQLr:r(869),RPRaO:r(1393)+r(1192)+r(1565)+"pe",kpZjP:function(s,t){return s!=t},XsaQV:function(s,t){return s==t},tOdjY:function(s,t){return s!=t},XhUeO:"ServiceWorkerGlobalScope",AhZwp:function(s,t){return s!=t},qjKKt:r(1219)+r(1719)};Ee.r($),Ee.d($,{FWS:()=>Ma,CustomErrorEvent:()=>rs,createCloseEvent:()=>pe,ReconnectEvent:()=>ns,createErrorEvent:()=>ue,decodedFrame:()=>Qr,createOpenEvent:()=>xs,CustomCloseEvent:()=>ss,createReconnectEvent:()=>Qn,FrontierMessageEvent:()=>os,encodeFrame:()=>$n,createMessageEvent:()=>cs,OpenEvent:()=>as,ErrorCode:()=>Fe,Event:()=>rt,MessageEvent:()=>is});let i="";function a(s=""){let t=r,n="02",o=""+Date.now(),c=i||(i=m(s)),f=Math[t(1012)]()[t(846)](16)[t(1727)](-6);return e[t(804)](n+o+c,f)}function x(){let s=r;return e[s(804)](1e4*Date[s(1447)](),Math[s(600)](e[s(1047)](1e4,Math[s(1012)]())))}function u(s){let t=r;return e[t(1331)](e[t(598)](Array,8)[t(1775)]("0"),e.rAhZF(parseInt,s,10)[t(846)](2))[t(1727)](-8)}function d(s){let t=r;return e[t(1331)](e[t(485)](Array,4)[t(1775)]("0"),e[t(593)](parseInt,s,2)[t(846)](16))[t(1727)](-4)}function h(s){let t=r,n=s[t(862)](/\./)[t(725)](f=>u(f)),o=[];return o[0]=e[t(1253)](d,e[t(464)](n[0],n[1])),o[1]=e[t(1253)](d,e[t(464)](n[2],n[3])),[e[t(1290)],e[t(1290)],e[t(1290)],e[t(1290)],"0000",t(1144),o[0],o[1]][t(1775)]("")}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}/.test(s),o=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/.test(s);return n?h(s):o?e.JzRPM(w,s):t(774)+t(774)+t(774)+t(774)}function w(s){let t=r;if(e.uRItW(e[t(1881)],e[t(1085)])){let n="",o=[],c=0,f=0,g=!0,p=e[t(1290)];if(e[t(518)](s.indexOf("::"),-1)){let l=s[t(862)]("::");for(let k=0;k<l.length;k++){let v=l[k];if(v[t(397)](":")>0){let A=v[t(862)](":");g&&(c=A[t(1843)]),f+=A[t(1843)];for(let T=0;e[t(1873)](T,A[t(1843)]);T++)if(A[T][t(1843)]!==4){let G=p[t(1125)+"g"](0,e.ftaio(4,A[T].length)),M=G[t(1282)](A[T]);o[t(483)](M)}else o.push(A[T]);g=!1}else{if(e.uRItW(4,v[t(1843)]))if(e[t(558)](e.zpgTv,"YHmso")){let A=p[t(1125)+"g"](0,e[t(1672)](4,v[t(1843)])),T=A[t(1282)](v);o.push(T)}else{let{type:A}=_0x4215b0;this[t(806)](A,_0xb3633e)}else o.push(v);g&&(c+=1),f+=1,g=!1}}let y="";for(let k=0;e[t(1873)](k,e[t(582)](8,f));k++)y=y[t(1282)](p);for(let k=0;e.ozMho(k,o[t(1843)]);k++)e[t(1221)](k,c)&&(n=n.concat(y)),n=n[t(1282)](o[k]);return n}{let l=s[t(862)](":");for(let y=0;e[t(792)](y,l[t(1843)]);y++){let k=l[y];if(e[t(558)](4,l[y].length)){let v=p[t(1125)+"g"](0,e[t(582)](4,l[y][t(1843)])),A=v[t(1282)](k);n=n[t(1282)](A)}else n=n[t(1282)](k)}return n}}else this[t(570)]&&this._socket[t(1314)]({code:_0x31da35,reason:_0x39a77f})}function b(s,t){let n=r;if(e[n(1198)](e[n(936)],e[n(682)]))_0x417983=e.oIsBT(e[n(668)](e[n(668)](e[n(1595)](7&_0xf7825c,18),e.axPBO(e[n(513)](63,_0x934929),12)),e[n(513)](63,_0xd67c70)<<6),e[n(513)](63,_0x39fe21)),e.ozMho(_0x14b0d0,65536)||e[n(518)](_0x4c76c0,1114111)?_0x1ad72b+=_0x49669b:(_0x10f74e-=65536,_0x192e16+=e[n(1890)](_0x21fa86,e[n(464)](e[n(1849)](_0x21b3ed,10),55296),e[n(804)](1023&_0xbbe878,56320)),_0x3ae52c+=3);else{let o=s[n(736)];e[n(558)](void 0,o)&&(e[n(773)](J,t,10),e.zPRsg(be,t,o));let c=s[n(405)];e[n(558)](void 0,c)&&(e[n(782)](J,t,18),e[n(1543)](be,t,c))}}function _(s){let t=r;if(e[t(1430)](e[t(1720)],e[t(1466)]))this[t(444)]&&this[t(444)][t(1611)](_0x509cca),this[t(1051)+t(1077)][_0x514e4f]=null;else{let n={};e:for(;!ke(s);){let o=U(s);switch(e[t(1784)](o,3)){case 0:break e;case 1:n[t(736)]=ye(s,e[t(598)](U,s));break;case 2:n[t(405)]=e.mvQxF(ye,s,e[t(485)](U,s));break;default:e.ZWxIc(ee,s,e.fAQmS(7,o))}}if(e[t(446)](void 0,n.key))throw new Error(e.GQoPJ);if(e[t(1430)](void 0,n[t(405)]))throw new Error(t(1260)+t(1436)+t(1756)+t(405));return n}}function C(s){let t=r,n=e[t(553)](oe);return L(s,n),e.YXkPb(V,n)}function L(s,t){let n=r;if(e[n(984)](e[n(1322)],e[n(1322)])){let o=s[n(1033)];e[n(1381)](void 0,o)&&(e[n(827)](J,t,8),bt(t,o));let c=s[n(834)];if(e[n(1381)](void 0,c))if(e[n(558)](e.RpyOS,e[n(1311)]))J(t,16),e[n(684)](bt,t,c);else{let M=this[n(1845)],X=this[n(821)];return[e[n(513)](255,X),e[n(513)](e[n(1784)](X,8),255),e.fAQmS(e[n(1784)](X,16),255),e[n(741)](X,24),255&M,e[n(1504)](e[n(1878)](M,8),255),e[n(513)](e[n(1878)](M,16),255),M>>>24]}let f=s[n(1231)];e[n(558)](void 0,f)&&(e[n(593)](J,t,24),e.PJPeZ(bt,t,le(f)));let g=s[n(1825)];g!==void 0&&(J(t,32),bt(t,le(g)));let p=s[n(934)];if(e.riorE(void 0,p))for(let M of p){e[n(1342)](J,t,42);let X=oe();b(M,X),e[n(593)](J,t,X.limit),e.eBsEJ(Ut,t,X),e[n(1577)](D,X)}let l=s[n(694)+n(1183)];e.RNagj(void 0,l)&&(e.tustC(J,t,50),be(t,l));let y=s["payloadT"+n(1114)];e[n(655)](void 0,y)&&(e.SXiTD(J,t,58),be(t,y));let k=s[n(1485)];if(k!==void 0)if(e[n(1221)](e[n(1678)],e[n(1678)]))e[n(1471)](J,t,66),e.KNjcx(J,t,k[n(1843)]),e[n(1140)](qt,t,k);else{let M=(n(1630)+n(1791))[n(862)]("|"),X=0;for(;;){switch(M[X++]){case"0":if(e[n(1198)](this._ws.readyState,this[n(946)])||this._ws[n(1396)+"te"]===this[n(1831)])return void this[n(1424)](e[n(898)]);continue;case"1":if(!this[n(444)])return void this[n(1424)](n(545)+n(387)+n(1015)+n(1839)+"ed");continue;case"2":this[n(398)+n(1133)]=!0;continue;case"3":this["_clearPi"+n(1190)]();continue;case"4":this["_dropGlo"+n(1774)+"Listener"]();continue;case"5":this[n(1021)+n(1344)]();continue;case"6":this[n(1612)+n(1593)]?.[n(1704)]();continue;case"7":this[n(1346)+n(786)+"t"](_0x13896d,_0x4ffc78);continue}break}}let v=s[n(1473)];if(e[n(558)](void 0,v))if(e[n(735)]!==e.MuKdv)e[n(1342)](J,t,74),e[n(601)](be,t,v);else return this._ws?this[n(444)][n(731)]:"";let A=s.serverTiming;e[n(1094)](void 0,A)&&(e[n(904)](J,t,82),e[n(401)](be,t,A));let T=s[n(1367)];e[n(1094)](void 0,T)&&(e[n(1491)](J,t,90),e[n(1857)](be,t,T));let G=s[n(482)+"e"];e.uRItW(void 0,G)&&(e[n(1401)](J,t,96),e[n(750)](bt,t,e[n(598)](le,G)))}else this[n(1787)+"ount"]=_0x3c3caa,this[n(429)]=0}function I(s){return R(q(s))}function R(s){let t=r,n={};e:for(;!ke(s);){let o=e[t(1253)](U,s);switch(e[t(698)](o,3)){case 0:break e;case 1:n[t(1033)]=e[t(1048)](Pe,s,!0);break;case 2:n[t(834)]=Pe(s,!0);break;case 3:n.service=e[t(1253)](U,s);break;case 4:n[t(1825)]=e[t(1253)](U,s);break;case 5:{let c=e[t(1106)](z,s);(n[t(934)]||(n[t(934)]=[]))[t(483)](e[t(598)](_,s)),s[t(1199)]=c;break}case 6:n.payloadEncoding=e[t(514)](ye,s,e[t(485)](U,s));break;case 7:n.payloadType=e[t(997)](ye,s,e[t(485)](U,s));break;case 8:n[t(1485)]=yt(s,e[t(1202)](U,s));break;case 9:n[t(1473)]=ye(s,e[t(650)](U,s));break;case 10:n[t(691)+t(1529)]=e.GwXQm(ye,s,e[t(485)](U,s));break;case 11:n[t(1367)]=e[t(514)](ye,s,U(s));break;case 12:n[t(482)+"e"]=e[t(1278)](U,s);break;default:e[t(761)](ee,s,e[t(1504)](7,o))}}if(e[t(1126)](void 0,n[t(1033)]))throw new Error(e[t(722)]);if(e[t(1430)](void 0,n[t(834)]))throw new Error(e[t(788)]);if(n[t(1231)]===void 0)throw new Error(e[t(522)]);if(e.avKOu(void 0,n[t(1825)]))throw new Error(e.UpIcY);return n}function z(s){let t=r,n={QOeJv:function(o,c,f){return o(c,f)},AsLWy:t(533),chzCG:e[t(1651)]};if(e.CeKOF===t(496)){let o=e[t(485)](U,s),c=s[t(1199)];return s[t(1199)]=e[t(1797)](s[t(646)],o),c}else _0x5f5c76[t(1061)]()[t(568)](()=>{let o=t,c=n[o(1615)](_0x2f0dca,n[o(1669)],{message:this[o(790)+"rrorMessage"](_0x220be7)});this[o(806)](n[o(1669)],c);let f=n.QOeJv(_0x1409be,n.chzCG,{reason:this[o(790)+"rrorMessage"](_0x758619)});this[o(806)](n[o(1677)],f)})}function ee(s,t){let n=r;switch(t){case 0:for(;e[n(1208)](128,re(s)););break;case 2:e[n(1449)](he,s,e[n(1277)](U,s));break;case 5:e[n(467)](he,s,4);break;case 1:e[n(577)](he,s,8);break;default:throw new Error(e[n(464)](e[n(1298)],t))}}function le(s){return s|=0,{low:s,high:s>>31,unsigned:e.bYSdv(s,0)}}let _e=[];function oe(){let s=r,t=_e[s(1858)]();return t?(t[s(646)]=t.limit=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(1843)]}}function V(s){let t=r,n={YvhBW:function(o,c){return e[P(526)](o,c)},SIAry:function(o,c,f,g){return e.IGjqQ(o,c,f,g)},ynmWj:function(o,c){return e[P(1331)](o,c)},nQBQU:function(o,c){return e[P(1810)](o,c)}};if(e[t(1395)](e[t(810)],e[t(1835)])){let o=s.bytes,c=s[t(1199)];return e[t(844)](o[t(1843)],c)?o:o[t(1626)](0,c)}else{if(_0x38b849>_0x369e57)throw new _0x20a960(t(1141)+t(658)+"e");let o=3;for(;n[t(425)](o,0);){let c=255&_0x308b55;n[t(1765)](_0x4f73bf,c,_0x1379ca,n.ynmWj(_0x1a48d8,o)),_0x3dcf03>>>=8,o--}return n.nQBQU(_0x3eceeb,4)}}function he(s,t){let n=r;if(e.cljUJ(s.offset,t)>s[n(1199)])throw new Error("Skip pas"+n(523));s[n(646)]+=t}function ke(s){let t=r;return e.bwqce(s[t(646)],s[t(1199)])}function ge(s,t){let n=r,o={BkNUm:function(c,f){return c<=f},KPUto:function(c,f){return e.bYSdv(c,f)},yXLvH:function(c,f){return e[P(840)](c,f)},ZJqUC:function(c,f){return e[P(1124)](c,f)},HtWqF:function(c,f){return c<<f},kOqAd:function(c,f){return c&f},bmATN:function(c,f){return c&f},ejcjI:function(c,f){return e[P(943)](c,f)},GCVnx:function(c,f){return e[P(1504)](c,f)},BtzcE:function(c,f){return e[P(693)](c,f)},ldKyf:function(c,f){return e[P(1672)](c,f)},KYEiQ:function(c,f){return c|f},emiao:function(c,f){return e[P(1208)](c,f)},yODtJ:function(c,f){return c&f},vBrmc:function(c,f){return c&f},HxtMe:function(c,f){return e[P(1810)](c,f)},jfgtP:function(c,f){return e.Dwvol(c,f)},TtdJG:function(c,f){return e[P(1810)](c,f)}};if(e[n(452)](e[n(458)],e[n(458)])){let c=s.bytes,f=s[n(646)],g=s[n(1199)],p=e.VPzyI(f,t);if(e.RzBKe(p,c[n(1843)])){let l=new Uint8Array(e.SJFnW(2,p));l[n(510)](c),s[n(1464)]=l}return s[n(646)]=p,e.JMMVC(p,g)&&(s.limit=p),f}else{let c=_0x2695e1[_0x2c8e6a++];if(o[n(1252)](c,127))_0x286180+=_0x16c64e["fromChar"+n(881)](c);else if(o[n(948)](c,192)&&o.yXLvH(c,224))_0x16f554+=_0x1a7661["fromChar"+n(881)](o[n(1659)](o[n(849)](o.kOqAd(31,c),6),o.bmATN(63,_0x4f9d5c[_0x599ee7++])));else if(c>=224&&c<240)_0x34211b+=_0x3bb547.fromCharCode(o.ZJqUC(o[n(1659)](o[n(849)](o[n(475)](15,c),12),o.HtWqF(o[n(1194)](63,_0x21df5d[_0x49de96++]),6)),63&_0x4da420[_0x4bf492++]));else if(o[n(1656)](c,240)){let f=o[n(1402)](o[n(583)](o[n(583)](o.HtWqF(o.emiao(7,c),18)|o[n(451)](63,_0x30050c[_0x279631++])<<12,o[n(849)](o[n(1566)](63,_0x260b04[_0x530ab1++]),6)),o[n(960)](63,_0x3aaa53[_0x47f70d++])),65536);_0x1e64f1+=_0xd9d745.fromCharCode(o[n(1323)](55296,o[n(1044)](f,10))),_0x4073ba+=_0x4f412b[n(637)+n(881)](o[n(1694)](56320,1023&f))}}}function Je(s,t){let n=r,o=s[n(646)];if(e[n(1729)](e[n(1764)](o,t),s.limit))throw new Error(e[n(591)]);return s[n(646)]+=t,o}function yt(s,t){let n=r,o=e[n(1152)](Je,s,t);return s.bytes[n(1626)](o,e[n(1642)](o,t))}function qt(s,t){let n=r,o=ge(s,t[n(1843)]);s[n(1464)][n(510)](t,o)}function ye(s,t){let n=r,o=e[n(902)](Je,s,t),c=String.fromCharCode,f=s[n(1464)],g="\uFFFD",p="";for(let l=0;l<t;l++){let y=f[l+o],k,v,A,T;e[n(740)](128,y)===0?p+=c(y):e[n(943)](224,y)===192?e[n(1661)](e[n(910)](l,1),t)?p+=g:(k=f[e[n(1764)](l+o,1)],e[n(655)](e.RzJSz(192,k),128)?p+=g:(T=e[n(1124)](e[n(1498)](31&y,6),e[n(817)](63,k)),e.lTulI(T,128)?p+=g:(p+=e[n(485)](c,T),l++))):e[n(1780)](e[n(1208)](240,y),224)?e[n(459)](l,2)>=t?p+=g:(k=f[e[n(1309)](e.cljUJ(l,o),1)],v=f[e[n(966)](l+o,2)],e[n(431)](e[n(817)](e[n(836)](k,e[n(1411)](v,8)),49344),32896)?p+=g:(T=e.SiVyg(e[n(819)](15,y)<<12|e.RHhXs(e[n(1155)](63,k),6),e[n(1266)](63,v)),e[n(840)](T,2048)||T>=55296&&e[n(1250)](T,57343)?p+=g:(p+=e[n(650)](c,T),l+=2))):e.EGBrn(e[n(1138)](248,y),240)?e[n(1339)](l,3)>=t?p+=g:(k=f[e[n(1682)](l,o)+1],v=f[e.QNjAj(e[n(804)](l,o),2)],A=f[l+o+3],e[n(437)](e.RzJSz(e[n(836)](k|e.qpaEN(v,8),A<<16),12632256),8421504)?p+=g:(T=e[n(1701)](e[n(1026)](7&y,18),e[n(1150)](e[n(1155)](63,k),12))|e[n(1498)](e[n(441)](63,v),6)|63&A,e[n(840)](T,65536)||e.JMMVC(T,1114111)?p+=g:(T-=65536,p+=c((T>>10)+55296,(1023&T)+56320),l+=3))):p+=g}return p}function be(s,t){let n=r,o=t[n(1843)],c=0;for(let p=0;p<o;p++){let l=t[n(597)+"At"](p);e[n(560)](l,55296)&&l<=56319&&e.Ivgth(p,1)<o&&(l=e[n(1116)](e[n(1055)](l<<10,t[n(597)+"At"](++p)),56613888)),c+=e.lTulI(l,128)?1:e[n(587)](l,2048)?2:l<65536?3:4}e.LTfYC(J,s,c);let f=e.OPRak(ge,s,c),g=s[n(1464)];for(let p=0;p<o;p++){let l=t[n(597)+"At"](p);e[n(1070)](l,55296)&&e.xSewm(l,56319)&&e[n(860)](e[n(1682)](p,1),o)&&(l=e[n(1672)](e.hGbFg(e[n(1595)](l,10),t.charCodeAt(++p)),56613888)),l<128?g[f++]=l:(e.NZdZw(l,2048)?g[f++]=e[n(879)](e[n(1e3)](e[n(1849)](l,6),31),192):(e[n(1330)](l,65536)?g[f++]=e[n(1279)](e[n(1428)](l,12),15)|224:(g[f++]=e[n(978)](e.OvgOA(l,18)&7,240),g[f++]=e[n(668)](e[n(1373)](l>>12,63),128)),g[f++]=e[n(1701)](e[n(1025)](e.qmeWW(l,6),63),128)),g[f++]=e[n(879)](e[n(1390)](63,l),128))}}function Ut(s,t){let n=r,o={sShGe:function(c,f){return e.JSZWe(c,f)},rVAtd:function(c,f){return e[P(943)](c,f)},rmMHb:function(c,f){return e[P(1504)](c,f)},lrxjh:function(c,f){return e[P(1596)](c,f)},cspnj:function(c,f){return e[P(701)](c,f)}};if(e[n(1635)]!==e[n(1635)]){let c=this[n(1845)],f=this[n(821)];return[o[n(1508)](c,24),o[n(1649)](o[n(1508)](c,16),255),o[n(1649)](o[n(1508)](c,8),255),o[n(700)](255,c),f>>>24,o[n(481)](o[n(1508)](f,16),255),o[n(481)](o[n(1861)](f,8),255),o[n(1649)](255,f)]}else{let c=e[n(1140)](ge,s,t[n(1199)]),f=s.bytes,g=t[n(1464)];for(let p=0,l=t.limit;e[n(1069)](p,l);p++)f[e[n(557)](p,c)]=g[p]}}function re(s){let t=r;if(e[t(1316)]!==e[t(1262)])return s[t(1464)][e.iaJts(Je,s,1)];this[t(444)]&&this._ws[t(1611)](_0x4556f8),this[t(1424)](e[t(941)],_0x6dbf25)}function Kt(s,t){let n=r,o=e[n(1294)](ge,s,1);s.bytes[o]=t}function U(s){let t=r,n=0,o=0,c;do c=re(s),e.yMBaA(n,32)&&(o|=e[t(1600)](e.rktUY(127,c),n)),n+=7;while(e[t(1749)](128,c));return o}function J(s,t){let n=r;for(t>>>=0;e.bYSdv(t,128);)e[n(514)](Kt,s,e.SiVyg(e[n(1310)](127,t),128)),t>>>=7;Kt(s,t)}function Pe(s,t){let n=r,o={RupMG:e[n(1223)],KHbAi:e[n(1877)],uVwPf:function(l){return e[n(1680)](l)},EpqHG:e[n(720)],WioSy:function(l){return l()},nPxnh:n(1379)},c=0,f=0,g=0,p;if(p=e[n(1253)](re,s),c=127&p,e.rRNNG(128,p)&&(p=re(s),c|=e[n(1498)](e[n(1304)](127,p),7),e[n(737)](128,p)&&(p=re(s),c|=e[n(928)](e[n(1266)](127,p),14),e[n(1749)](128,p)&&(p=re(s),c|=e[n(875)](127,p)<<21,e[n(819)](128,p)))))if(e.rdUBS("IGIsh",n(1164)))p=e[n(1253)](re,s),f=e.IxUTz(127,p),e[n(1148)](128,p)&&(p=re(s),f|=e[n(1634)](e[n(1301)](127,p),7),e[n(1279)](128,p)&&(p=e[n(650)](re,s),f|=e[n(1177)](127,p)<<14,e[n(1504)](128,p)&&(p=re(s),f|=e.pQUHl(e[n(1304)](127,p),21),128&p&&(p=e.JjPnT(re,s),g=e[n(807)](127,p),e[n(854)](128,p)&&(p=e[n(1277)](re,s),g|=e[n(1595)](127&p,7))))));else{let l=()=>{let v=n;_0x518a0f["removeEventListe"+v(733)](XFyLAB.RupMG,y),_0x1d2bdf[v(938)+v(1425)+v(733)](XFyLAB.KHbAi,k),_0x3e182c[v(938)+v(1425)+v(733)]("abort",k)},y=()=>{XFyLAB.uVwPf(_0x366d18),l()},k=()=>{let v=n;_0x511d44(_0x239afa[v(533)]||new _0x51ff55(XFyLAB.EpqHG,XFyLAB[v(1093)])),XFyLAB.WioSy(l)};_0x2a07e2[n(1149)+"Listener"](XFyLAB.RupMG,y),_0x1dc4cc[n(1149)+n(1538)](XFyLAB[n(852)],k),_0xef1562[n(1149)+n(1538)](XFyLAB[n(1046)],k)}return{low:e.rKGLW(c,f<<28),high:e[n(1715)](e[n(1060)](f,4),e[n(1634)](g,24)),unsigned:t}}function bt(s,t){let n=r,o=e[n(791)](t.low,0),c=e[n(683)](e[n(791)](t[n(821)],28),t[n(1845)]<<4)>>>0,f=e[n(1572)](t.high,24),g=e.cCchm(0,f)?c===0?e.yMBaA(o,16384)?e.NZdZw(o,128)?1:2:e[n(499)](o,2097152)?3:4:e.AVFzs(c,16384)?e.lTulI(c,128)?5:6:e[n(1654)](c,2097152)?7:8:f<128?9:10,p=e[n(440)](ge,s,g),l=s[n(1464)];switch(g){case 10:l[e.WEbAC(p,9)]=e[n(744)](f>>>7,1);case 9:l[e[n(965)](p,8)]=e[n(1381)](9,g)?128|f:e[n(740)](127,f);case 8:l[e[n(1339)](p,7)]=e[n(437)](8,g)?e[n(808)](e[n(539)](c,21),128):e[n(854)](e[n(1060)](c,21),127);case 7:l[e[n(1162)](p,6)]=e.GqdvH(7,g)?e[n(656)](e.RuAQU(c,14),128):e[n(1090)](e[n(508)](c,14),127);case 6:l[p+5]=e.riorE(6,g)?e[n(492)](c,7)|128:e.TUOit(c>>>7,127);case 5:l[e[n(584)](p,4)]=e[n(664)](5,g)?e[n(808)](128,c):e[n(1575)](127,c);case 4:l[e[n(1339)](p,3)]=e[n(431)](4,g)?e[n(1124)](o>>>21,128):e[n(807)](e[n(698)](o,21),127);case 3:l[e[n(400)](p,2)]=e.riorE(3,g)?e.lGMbO(o,14)|128:o>>>14&127;case 2:l[p+1]=e[n(1315)](2,g)?e[n(873)](e.TcEet(o,7),128):e[n(1734)](e[n(566)](o,7),127);case 1:l[p]=g!==1?e[n(836)](128,o):e.HEJUR(127,o)}}function Qr(s){return I(s)}function $n(s){return e.ChMiU(C,s)}let Xr=65536,Vo=e[r(906)],nt=e.szihn(Xr,Xr),Zr=nt*nt,es=e[r(907)](Zr,2),ze=String[r(1268)+"e"][r(597)+"At"];class O{constructor(t,n,o){let c=r;this[c(888)]=!0,this[c(821)]=0|t,this[c(1845)]=e[c(1701)](0,n),this[c(893)]=!!o}static isLong(t){return t&&t.isLong===!0}static[r(1645)](t,n,o){let c=r;if(e[c(1281)]!==e[c(1037)])return new O(t,n,o);_0x164df7[_0x131ef7++]=e.dzwRZ(e[c(1542)](_0x55bfe9,6),192),_0x193dcb[_0xf90bd7++]=e.YfJKs(e[c(1601)](63,_0x33b172),128)}static[r(1392)+"s"](t,n,o){let c=r;if(e[c(1813)](e[c(670)],e[c(993)]))return o?O[c(1392)+c(1343)](t,n):O[c(1392)+c(789)](t,n);VTKkRk[c(1516)](_0x394b6b,VTKkRk[c(798)](_0x1e73a0,_0x54a1f0[c(1456)]),_0xf11f7e[c(1180)+"on"],_0x2f882a[c(1823)+"on"],_0x55544a(_0x3da622[c(660)+c(474)]))}static[r(1392)+"sLE"](t,n){let o=r;return new O(e.AFxaG(t[0]|e.LqcvF(t[1],8),e[o(1600)](t[2],16))|e[o(1150)](t[3],24),e.DRgNF(t[4]|t[5]<<8,t[6]<<16)|e[o(1211)](t[7],24),n)}static[r(1392)+r(789)](t,n){let o=r;return new O(e[o(656)](e[o(668)](t[4]<<24,e[o(1634)](t[5],16))|e[o(1440)](t[6],8),t[7]),e.LqIdV(e[o(751)](e[o(873)](e[o(1150)](t[0],24),e[o(1731)](t[1],16)),t[2]<<8),t[3]),n)}static[r(1423)](t){let n=r;return e[n(621)](t,Vo)?ts:new O(e[n(668)](e[n(745)](ze[n(1236)](t,0)|e.yaerY(ze.call(t,1),8),e.WUWZL(ze.call(t,2),16)),e.lPxdZ(ze[n(1236)](t,3),24))>>>0,e.bWUiC(e.HuHjX(e.YDkPu(e[n(1739)](ze.call(t,4),ze[n(1236)](t,5)<<8),e[n(1662)](ze.call(t,6),16)),ze[n(1236)](t,7)<<24),0),!0)}[r(1730)](){let t=r;return String[t(637)+"Code"](e[t(1301)](255,this[t(821)]),e.HEJUR(e[t(791)](this[t(821)],8),255),e[t(1177)](e[t(501)](this.low,16),255),this[t(821)]>>>24,e[t(1273)](255,this[t(1845)]),e[t(443)](e[t(1071)](this[t(1845)],8),255),e.hARBm(this.high,16)&255,e.HjOEK(this[t(1845)],24))}static fromNumber(t,n=!0){let o=r;if(e[o(1202)](isNaN,t))return n?Yo:ts;if(n){if(e[o(560)](t,Zr))return Qo}else{if(e[o(796)](t,-es))return Xo;if(e[o(828)](t+1,es))return $o}return O[o(1645)](e[o(1337)](e[o(800)](t,nt),0),e[o(914)](e.aWDVg(t,nt),0),n)}[r(1312)](){let t=r;if(e[t(1099)]("FbWag",t(605)))this[t(806)](t(1314),_0x28ae7f),this[t(1722)]&&this[t(1722)](_0x453985);else return this[t(893)]?e.YYGXT(this[t(1845)],0)*nt+e[t(753)](this[t(821)],0):e[t(434)](this[t(1845)],nt)+e[t(1495)](this[t(821)],0)}[r(422)](){let t=r;if(e[t(1708)]!==e[t(847)])return e[t(924)](0,this[t(1845)])&&e.avKOu(0,this[t(821)]);VTKkRk[t(1106)](_0x51da65,VTKkRk.gMdaj(_0x152813,_0x1e094d[t(1456)])),VTKkRk[t(1680)](_0x1cc1a3)}add(t){let n=r;O[n(888)](t)||(t=O[n(652)+"er"](t));let o=this[n(1845)]>>>16,c=e[n(1189)](65535,this[n(1845)]),f=this[n(821)]>>>16,g=65535&this[n(821)],p=e[n(1751)](t.high,16),l=e.ZVplU(65535,t[n(1845)]),y=e[n(743)](t[n(821)],16),k=65535&t[n(821)],v=0,A=0,T=0,G=0;return G+=e[n(1011)](g,k),T+=e.ksOQA(G,16),G&=65535,T+=f+y,A+=e[n(1723)](T,16),T&=65535,A+=e[n(534)](c,l),v+=e[n(1110)](A,16),A&=65535,v+=e[n(1477)](o,p),v&=65535,O[n(1645)](e[n(1811)](T<<16,G),e[n(808)](v<<16,A),this[n(893)])}[r(1883)](t){let n=r;return O.isLong(t)||(t=O.fromNumber(t)),e[n(1850)](this[n(893)],t.unsigned)&&e[n(924)](this[n(1845)]>>>31,1)&&e[n(1209)](e[n(728)](t[n(1845)],31),1)?!1:this[n(1845)]===t[n(1845)]&&e.xJvZG(this[n(821)],t.low)}[r(471)](){let t=r;return this[t(821)]===-1&&this.high===-1?O[t(1645)](0,0,this[t(893)]):e.ZNDUj(-1,this[t(821)])?O[t(1645)](0,e[t(1134)](this[t(1845)],1),this.unsigned):O.fromBits(e[t(1810)](this.low,1),this.high,this[t(893)])}[r(1083)](t){let n=r;return t?this[n(554)+"E"]():this[n(1753)+"E"]()}[r(554)+"E"](){let t=r,n=this.high,o=this.low;return[e.RzJSz(255,o),e[t(875)](o>>>8,255),e[t(1208)](e[t(1421)](o,16),255),e[t(1239)](o,24),e[t(476)](255,n),e.MdLlg(n>>>8,255),e[t(1390)](e[t(911)](n,16),255),e[t(1784)](n,24)]}toBytesBE(){let t=r,n=this.high,o=this.low;return[n>>>24,e[t(1237)](n,16)&255,e[t(1058)](e[t(508)](n,8),255),255&n,o>>>24,e[t(1697)](e[t(911)](o,16),255),e[t(1636)](e[t(1878)](o,8),255),e.xGioe(255,o)]}}let ts=new O(0,0,!1),Yo=new O(0,0,!0),$o=O.fromBits(-1,2147483647,!1),Qo=O[r(1645)](-1,-1,!0),Xo=O[r(1645)](0,-2147483648,!1);var Fe=(function(s){let t=r,n=e[t(832)][t(862)]("|"),o=0;for(;;){switch(n[o++]){case"0":s[s[e[t(1847)]]=5002]=t(1786)+t(981);continue;case"1":s[s[e[t(1766)]]=5003]=e[t(1766)];continue;case"2":s[s[e[t(1397)]]=5001]=e[t(1397)];continue;case"3":return s;case"4":s[s[e[t(1561)]]=5005]=e[t(1561)];continue;case"5":s[s[e.XEYcY]=5004]=e[t(470)];continue}break}})({});class rt{constructor(t){let n=r;this[n(1433)]=t,this[n(1130)]=null}}class ns extends rt{constructor(t,n){let o=r;super(t),this[o(1399)]=n&&n.message||null}}class rs extends rt{constructor(t,n){let o=r,c=e[o(1862)][o(862)]("|"),f=0;for(;;){switch(c[f++]){case"0":this[o(1086)]=n&&n[o(1086)]||0;continue;case"1":this[o(876)]=n&&n[o(876)]||0;continue;case"2":this[o(1726)]=n&&n.code||5001;continue;case"3":this[o(1399)]=n&&n[o(1399)]||"";continue;case"4":this[o(533)]=n&&n[o(533)]||null;continue;case"5":super(t);continue;case"6":this.filename=n&&n[o(1664)]||"";continue}break}}}class ss extends rt{constructor(t,n){let o=r,c=e[o(454)][o(862)]("|"),f=0;for(;;){switch(c[f++]){case"0":this[o(1358)+o(747)]=n&&n[o(1358)+o(747)]||!1;continue;case"1":this[o(850)]=n&&n[o(850)]||!1;continue;case"2":this.code=n&&n[o(1726)]||0;continue;case"3":this[o(1517)]=n&&n[o(1517)]||"";continue;case"4":super(t);continue}break}}}class is extends rt{constructor(t,n){let o=r;super(t),this[o(1779)]=n&&n[o(1779)]||null}}class os extends is{constructor(t,n){let o=r;super(t),this.data=n&&n[o(1779)]||null,this[o(1399)]=n&&n[o(1399)]||null}}class as extends rt{constructor(t,n){let o=r;if(e.eFZCN("aFpBJ",e[o(1641)]))super(t),this[o(1779)]=n&&n[o(1779)]||null;else{let{initReconnectInterval:c,maxReconnectInterval:f,reconnectIntervalGrowFactor:g}=this._options,p=e[o(434)](c,_0x2eec90.pow(g,e[o(1672)](_0xdeac8a,1)));return e.Ngphh(p,f)?f:p}}}function ue(s,{message:t,code:n,error:o}){return new rs(s,{message:t,code:n,error:o})}function pe(s,{code:t,reason:n,wasClean:o,willReconnect:c}){return new ss(s,{code:t,reason:n,wasClean:o,willReconnect:c})}function cs(s,{data:t,message:n}){return new os(s,{data:t,message:n})}function xs(s,{data:t}){return new as(s,{data:t})}function Qn(s,{message:t}){return new ns(s,{message:t})}class us{constructor(t,n){let o=r,c={QNGtn:"error",xFywa:function(f,g,p){return e[P(1832)](f,g,p)},rWfjh:function(f,g){return f+g}};if(e[o(1275)](e.KNASK,e[o(1172)])){let f=_0x44145f[o(1548)][o(1727)](_0x42283c[o(1230)+"et"],c[o(882)](_0x2c3a69[o(986)+"th"],_0x18091a[o(1230)+"et"]));this[o(570)]&&this[o(570)][o(1611)]({data:f,fail:g=>{let p=o;this[p(806)](c[p(930)],c[p(1139)](_0x1b48db,p(533),{message:this[p(790)+"rrorMess"+p(1066)](g)}))}})}else this[o(1217)+"s"]=t,this[o(1770)+"es"]=n,this[o(1062)+o(388)]=0,this[o(1489)+o(654)+o(1338)+"t"]=0}[r(1828)+"pointCon"+r(1759)](){let t=r;e[t(1820)]!==t(653)?(this[t(1062)+t(388)]=0,this[t(1489)+"ndpointT"+t(1338)+"t"]=0):(_0x56a081(_0xe96a13,90),e.CUWCr(_0x3018fb,_0x398e3d,_0x42a89f))}[r(1174)+"es"](){let t=r;this[t(1489)+"ndpointT"+t(1338)+"t"]=0}getCurrentEndpoint(){let t=r;return this[t(1217)+"s"][this["currentI"+t(388)]]}["getCurre"+r(1210)+"ntTriesCount"](){let t=r;return this[t(1489)+t(654)+t(1338)+"t"]}[r(1350)+r(749)+"es"](){let t=r;return!!(e[t(1661)](this[t(1062)+"ndex"],this.endpoints[t(1843)])||e[t(957)](this["currentI"+t(388)],e[t(1897)](this[t(1217)+"s"][t(1843)],1))&&this[t(1489)+t(654)+t(1338)+"t"]===this[t(1770)+"es"])}[r(1580)+r(424)+r(889)+r(1135)+"tries"](){let t=r;return this["currentI"+t(388)]==this[t(1217)+"s"][t(1843)]?!0:e[t(1729)](this[t(1489)+"ndpointT"+t(1338)+"t"],this[t(1770)+"es"])}[r(1788)+r(769)+r(1376)+r(1092)+r(1370)](){let t=r;return this[t(1489)+t(654)+"riesCount"]=1,this[t(1062)+t(388)]++,this[t(1217)+"s"][this[t(1062)+t(388)]]}["getCurre"+r(1210)+r(1200)+r(706)](){let t=r;return this[t(1489)+t(654)+t(1338)+"t"]++,this.getCurrentEndpoint()}}let st=(e[r(1644)]("undefined",typeof globalThis)&&e.ZoNCt(e.kITlB,globalThis[r(1859)+r(1894)].name)||e[r(962)](e[r(537)],typeof window)&&e.UrJhm(e[r(1864)],window["construc"+r(1894)].name))&&e[r(963)](e.CISfi,typeof document),Ve=e[r(942)](e.CISfi,typeof globalThis)&&(e[r(1408)](e[r(1274)],globalThis[r(1859)+r(1894)][r(1546)])||e[r(1899)](e.RPRaO,globalThis[r(1859)+"tor"][r(1546)]))&&e[r(537)]!=typeof tt,vt=(e[r(1307)](r(399)+"d",typeof globalThis)&&e[r(1274)]===globalThis[r(1859)+r(1894)][r(1546)]||e[r(1175)](e[r(537)],typeof globalThis)||e[r(1644)](e[r(537)],typeof globalThis)&&!!globalThis["WeixinJS"+r(1261)])&&e[r(727)](r(399)+"d",typeof wx),St=e.BcEpQ(r(399)+"d",typeof globalThis)&&(e.OZJSO(e.RPRaO,globalThis[r(1859)+r(1894)].name)||r(811)+r(1539)+r(1427)===globalThis[r(1859)+r(1894)][r(1546)]||e[r(509)]===globalThis[r(1859)+"tor"][r(1546)])&&e[r(537)]!=typeof self,Zo=e[r(1846)](e[r(537)],typeof globalThis)&&e.hFHyy(e[r(1274)],globalThis[r(1859)+r(1894)].name)&&r(399)+"d"!=typeof global&&e[r(1274)]===global[r(1859)+r(1894)][r(1546)]&&e.CISfi!=typeof process&&!!process.version;class Xn{constructor(){let t=r;this[t(803)+"rs"]={}}emit(t,...n){let o=r,c=this[o(803)+"rs"][t];if(c)c[o(1727)]()[o(1170)](f=>f.fn.apply(f[o(478)],n));else if(e[o(550)](e.uRZCb,t)&&!this[o(463)]){let f=n[o(1843)]&&n[0];if(e[o(527)](f,Error))throw f;let g=new Error(e[o(1176)]+(f?e[o(1161)](e[o(1764)](" (",f[o(1399)]),")"):""));throw g[o(1332)]=f,f}return this}[r(831)](t,n){let o=r,c={ntlBo:function(f,g,p){return e.stPRV(f,g,p)}};if(o(1306)!==e[o(822)]){if(e.rsBWX(void 0,t))this._listeners={};else if(e[o(1221)](void 0,n))this._listeners[t]=null;else if(e[o(550)](e[o(503)],o(1032))){let f="connect "+_0xc6b42a+(o(784)+o(1056)+o(677)+"ed");this[o(877)+o(925)+o(1222)](c[o(1285)](_0x31b941,o(533),{message:f,code:_0x2ef8e4[o(395)+"IES_ERROR"],error:_0xb89cea}));return}else{let f=this[o(803)+"rs"][t];if(f)for(let g=0;e[o(792)](g,f[o(1843)]);)e[o(621)](f[g].fn,n)?f[o(626)](g,1):++g}return this}else{let f=e[o(1570)](_0x191283,_0x3b4ca2,_0x44dde2.length);_0x218b0a[o(1464)][o(510)](_0x4f973d,f)}}on(t,n,o){let c=r;return(this[c(803)+"rs"][t]||(this._listeners[t]=[]))[c(483)]({fn:n,ctx:o||this}),this}}class ea extends Xn{[r(790)+r(1193)+r(1066)](t){let n=r;return t[n(1438)]||t.errNo?(n(1345)+" "+(t[n(1438)]||"")+n(1129)+(t[n(1747)]||""))[n(521)]():JSON[n(438)+"y"](t)}constructor(t,n,o){let c=r;super(),this[c(570)]=null,vt&&wx["connectS"+c(1866)]&&(this[c(570)]=wx[c(1227)+"ocket"]({url:t,protocols:n,header:o,fail:this["_createS"+c(1533)+c(1748)][c(953)](this),success:this[c(1785)+c(1536)+c(599)+"ler"][c(953)](this)})),Ve&&tt[c(1227)+c(1866)]&&(this._socket=tt["connectS"+c(1866)]({url:t,protocols:n,header:o,fail:this["_createS"+c(1533)+"lHandler"][c(953)](this),success:this[c(1785)+c(1536)+c(599)+c(669)].bind(this)}))}[r(1785)+"ocketSuccessHand"+r(669)](){let t=r;Promise[t(1061)]()[t(568)](()=>{this[t(829)+"steners"]()})}[r(1785)+"ocketFai"+r(1748)](t){let n=r;if(e[n(1850)](e[n(589)],e[n(567)]))Promise.resolve()[n(568)](()=>{let o=n,c=ue(e[o(1877)],{message:this["_formatE"+o(1193)+o(1066)](t)});this[o(806)](e[o(1877)],c);let f=e[o(1048)](pe,e.QweJd,{reason:this[o(790)+o(1193)+o(1066)](t)});this.emit(e[o(1651)],f)});else return e.uIGoH(_0x201b21[n(646)],_0x1ce6de[n(1199)])}["_addWsLi"+r(620)](){let t=r,n={dcjnF:t(1875),mNQsh:e[t(640)],GlOzC:function(o,c,f){return e[t(1394)](o,c,f)},vxiBH:e[t(1877)],lEmmA:function(o,c,f){return o(c,f)}};this[t(570)][t(436)](o=>{let c=t;this[c(806)](n.dcjnF,xs(n[c(1361)],{...o,data:o[c(1438)]||""}))}),this[t(570)].onClose(o=>{let c=t;this.emit("close",e.OPRak(pe,c(1314),{...o}))}),this[t(570)][t(1228)+"e"](o=>{let c=t;this[c(806)](n[c(1808)],n[c(1405)](cs,n[c(1808)],{...o}))}),this[t(570)][t(944)](o=>{let c=t;this.emit(n[c(1763)],n.lEmmA(ue,n[c(1763)],{...o,message:o[c(1438)]||""}))})}[r(1611)](t){let n=r,o={AGucA:e.uRZCb,aOGtp:function(c,f,g){return e[P(1324)](c,f,g)}};if(t instanceof Uint8Array){let c=t.buffer.slice(t[n(1230)+"et"],e[n(1309)](t.byteLength,t[n(1230)+"et"]));this[n(570)]&&this[n(570)][n(1611)]({data:c,fail:f=>{let g=n;this.emit(e[g(1877)],e.KuybI(ue,e[g(1877)],{message:this[g(790)+g(1193)+g(1066)](f)}))}})}else this[n(570)]&&this[n(570)][n(1611)]({data:t,fail:c=>{let f=n;this[f(806)](o[f(935)],o.aOGtp(ue,f(533),{message:this[f(790)+f(1193)+f(1066)](c)}))}})}close(t,n){let o=r;this._socket&&this[o(570)].close({code:t,reason:n})}[r(1149)+r(1538)](t,n){this.on(t,n)}[r(938)+r(1425)+"ner"](t,n){this.off(t,n)}get[r(1396)+"te"](){let t=r;return this[t(570)][t(1396)+"te"]}get[r(1590)+"pe"](){let t=r;return this._socket[t(1590)+"pe"]}set[r(1590)+"pe"](t){}get[r(748)](){let t=r;if(e[t(1657)](e[t(1796)],e[t(1796)]))_0x425871(_0x38129a,66),e.rsyIF(_0x5b3cec,_0x5c74db,_0x5c3f6a[t(1843)]),_0x2b479b(_0x5697ef,_0x1490b6);else return this[t(570)][t(748)]}get[r(731)](){return this[r(570)].protocol}get[r(871)+"ns"](){let t=r;return e.dkZjV(e[t(1434)],"VLDgf")?this[t(570)][t(871)+"ns"]:!!this[t(679)]}get[r(1151)+r(461)](){return 0}}function ta(s,t){let n=r;if(t)return new t(s[n(748)],s[n(731)]);if(e[n(1435)](vt,Ve))return new ea(s[n(748)],s.protocol,s.headers);if(e[n(1652)](st,St)&&n(399)+"d"!=typeof WebSocket&&WebSocket)return new WebSocket(s[n(748)],s.protocols)}function na(s){let t=r,n=e[t(1111)][t(862)]("|"),o=0;for(;;){switch(n[o++]){case"0":return!1;case"1":if(e[t(1892)](st,St)&&e.lsGwc(e[t(537)],typeof WebSocket)&&WebSocket)return!0;continue;case"2":if(vt&&wx[t(1227)+t(1866)])return!0;continue;case"3":if(s)return!0;continue;case"4":if(Ve&&tt[t(1227)+t(1866)])return!0;continue}break}}function fs(s,t,n){let o=-1;async function c(f){let g=P;return e[g(420)](f,o)?Promise.reject(new Error(e.Scxza)):(o=f,e.IJmdG(f,n.length)?Promise[g(1061)]():n[f].bind(s)(t,c.bind(null,e[g(1234)](f,1))))}c(0)}function ds(s){let t=r,n=0,o=0;for(let c=0;e[t(1860)](c,s[t(1843)]);++c)o=s[t(597)+"At"](c),e[t(1069)](o,128)?n+=1:e[t(499)](o,2048)?n+=2:e[t(476)](64512,o)===55296&&e[t(1783)](e[t(1155)](64512,s.charCodeAt(e[t(1309)](c,1))),56320)?(++c,n+=4):n+=3;return n}function ls(s,t,n){let o=r;if(e[o(479)](e[o(805)](n,t),1))return"";let c="";for(let f=t;e[o(479)](f,n);){let g=s[f++];if(e.glwqU(g,127))c+=String[o(637)+o(881)](g);else if(e[o(1618)](g,192)&&e[o(1295)](g,224))c+=String[o(637)+o(881)](e[o(1834)](e[o(1004)](31&g,6),63&s[f++]));else if(e[o(693)](g,224)&&g<240)c+=String[o(637)+"Code"](e[o(1442)](e[o(1778)](e.lPxdZ(e[o(1156)](15,g),12),e[o(1304)](63,s[f++])<<6),63&s[f++]));else if(e[o(1587)](g,240)){let p=e.asdTN(e[o(1811)](e[o(1081)](7&g,18)|e[o(1462)](e[o(1301)](63,s[f++]),12),e.cdAzB(63&s[f++],6)),e.adpaz(63,s[f++]))-65536;c+=String[o(637)+o(881)](e[o(867)](55296,e[o(1428)](p,10))),c+=String["fromChar"+o(881)](e[o(767)](56320,e[o(1623)](1023,p)))}}return c}function Zn(s,t,n){let o=r,c={LAUQn:function(f,g){return e[P(1780)](f,g)},IFzwc:e[o(1414)],wdtKP:function(f,g){return e[o(1534)](f,g)},kspSH:function(f,g,p,l){return e[o(1101)](f,g,p,l)}};if(e.Nneem(o(1255),"abery")){let f=n,g,p;for(let l=0;l<s[o(1843)];++l)if(g=s[o(597)+"At"](l),e[o(1564)](g,128))t[n++]=g;else if(e.AVFzs(g,2048))t[n++]=e.ZmDaV(g>>6,192),t[n++]=e[o(1636)](63,g)|128;else if(e[o(1138)](64512,g)===55296&&e[o(1366)](e[o(1553)](64512,p=s[o(597)+"At"](l+1)),56320)){let y=e.GpaEk[o(862)]("|"),k=0;for(;;){switch(y[k++]){case"0":t[n++]=e.RAzuB(e[o(1542)](g,12)&63,128);continue;case"1":t[n++]=e[o(1715)](e.adpaz(e[o(1660)](g,6),63),128);continue;case"2":++l;continue;case"3":t[n++]=e.XydME(63,g)|128;continue;case"4":g=e[o(1560)](e[o(1134)](65536,e[o(1634)](1023&g,10)),1023&p);continue;case"5":t[n++]=e[o(1660)](g,18)|240;continue}break}}else t[n++]=g>>12|224,t[n++]=e[o(683)](e[o(1156)](g>>6,63),128),t[n++]=e[o(1072)](e[o(390)](63,g),128);return n-f}else{if(c[o(1212)](c[o(435)],typeof _0x28b12c)){let f=new _0x5cba6e(c[o(1586)](_0xdb88d2,_0x209d1d));return c.kspSH(_0x10da37,_0x3f1386,f,0),f}return _0x4e0813 instanceof _0x44d21a?new _0x1598ec(_0x543636):new _0x3cf503(_0xbdcf20[o(1548)],_0x3b4d94[o(1230)+"et"],_0x3868db.byteLength)}}async function hs(s){let t=r;if(e[t(1414)]==typeof s){let n=new Uint8Array(e.RSkBe(ds,s));return Zn(s,n,0),n}return e[t(511)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(1548)],s[t(1230)+"et"],s[t(986)+"th"])}function ra(s){let t=r;try{return e[t(1414)]!=typeof s&&(e[t(511)](s,ArrayBuffer)||s.buffer&&e.jgBUt(s.buffer,ArrayBuffer))||e.OaLAW(e[t(1414)],typeof s)?"":(JSON[t(1525)](s),t(488)+t(506))}catch{return e[t(991)](e[t(1414)],typeof s)?e[t(524)]:""}}let sa=(s,t)=>{let n=r;switch(s){case e[n(976)]:case n(1690):return{[n(556)+s]:1,"x-tt-env":t};default:return{}}};class ia{constructor(t){let n=r;this[n(1787)+n(1142)]=t,this.count=0}[r(495)](){let t=r;e[t(680)](t(905),e.NGYFc)?this.count++:(VTKkRk[t(537)]!=typeof _0x466e&&_0x42759a[t(846)+"Tag"]&&_0x352fc0["definePr"+t(1375)](_0x19373c,_0x9d49d9[t(846)+t(959)],{value:VTKkRk[t(415)]}),_0xe4ca35.defineProperty(_0x4c13d8,VTKkRk[t(1096)],{value:!0}))}[r(1350)+"chMaxCount"](){let t=r;return this.count>=this["maxLossC"+t(1142)]}[r(949)+r(917)](t=0){let n=r;this[n(1787)+"ount"]=t,this[n(429)]=0}}async function oa(s){let t=r,n={JMmjO:function(o,c){return e[P(1250)](o,c)},YEBAg:function(o,c){return e[P(927)](o,c)},uHUxC:function(o,c){return e[P(964)](o,c)},JCfgh:function(o,c){return o-c},MbdVt:function(o,c){return o<<c},Fmaba:function(o,c){return e[P(927)](o,c)},HzEOm:function(o,c){return e.jxUMB(o,c)},qrOPt:e[t(1027)],Nhoyt:e[t(487)],cYxiT:e[t(1020)],MrYNX:function(o,c){return o&c},bvWzn:function(o,c){return e[t(1099)](o,c)},sxnuP:t(611),Vildp:t(1494),lWeJu:e[t(1767)],BxJrL:e.bOLnI,Tydzw:e[t(1574)],zumgc:function(o,c){return o===c},hjfTl:e[t(1592)],oRvna:e[t(1658)],yvTxs:e[t(1045)],rxlFE:e.nnhZr};return new Promise(o=>{let c=t,f={RFaMO:function(g,p){return n[P(622)](g,p)},MbFJp:n[c(595)],VECnu:n[c(1608)],WVJNN:n.cYxiT,fmhYS:"pageshow",Lught:function(g,p){return n[c(1684)](g,p)},VUZVu:function(g,p){return n[c(433)](g,p)}};if(n.bvWzn(n[c(1552)],n[c(1675)])){if(!st)return o(n[c(595)]);try{let g=document.createElement(n.lWeJu);window["frontier"+c(1639)]=p=>{let l=c;document[l(1457)][l(525)+"ild"](g),window[l(1617)+"JSONP"]=void 0,f[l(1087)](o,p&&p[l(756)]||f.MbFJp)},g.type=n[c(1868)],g[c(842)]=n[c(433)](s[c(1493)](/^ws/,"http"),n[c(1711)]);try{n[c(604)](n[c(916)],c(812))?document.body[c(1499)+c(884)](g):(this[c(1308)+"er"]&&_0x42bab4["removeEv"+c(1425)+"ner"](f[c(1251)],this[c(396)+c(1714)]),this[c(1308)+"er"]&&_0x26acf5[c(938)+"entListe"+c(733)](c(1356),this[c(396)+c(1478)]),this[c(1308)+"er"]&&_0x1583be[c(938)+c(1425)+c(733)](f.WVJNN,this[c(491)+c(507)]),this._isBrowser&&_0x260dbb["removeEventListe"+c(733)](f.fmhYS,this[c(491)+c(393)]))}catch{if(n[c(651)]("casDc",n[c(1291)]))document[c(1457)][c(525)+c(884)](g);else try{return!!this[c(679)]}catch(p){return _0xe85e82[c(1030)](p),!1}}}catch{if(n.bvWzn(n[c(1884)],n[c(1744)]))window[c(1617)+"JSONP"]=void 0,n[c(622)](o,c(1518)+c(1517));else{let g=_0x3eff87.charCodeAt(_0x4851f4);g>=55296&&bzaUbV.JMmjO(g,56319)&&bzaUbV[c(490)](bzaUbV.uHUxC(_0x37c9b5,1),_0x3ad501)&&(g=bzaUbV.JCfgh(bzaUbV[c(433)](bzaUbV.MbdVt(g,10),_0x574c87[c(597)+"At"](++_0x37c842)),56613888)),_0x4f014b+=bzaUbV[c(1625)](g,128)?1:bzaUbV[c(490)](g,2048)?2:g<65536?3:4}}}else return _0x1b62fb[c(1171)+"t8"]?_0x14930e[c(1171)+"t8"](_0x3b33c4,_0x2970fb):_0x20ce65[_0x2a2dfd]=f.Lught(255,_0x4d8d34),f[c(967)](_0x310947,1)})}function qe(s,t,n){let o=r,c={jAYxM:function(f,g,p){return e[P(1543)](f,g,p)},xbQpc:e.QweJd};if(e[o(900)](e[o(1443)],e[o(1191)])){let f=this[o(1741)+o(1676)]?.[o(1372)+o(1210)+"nt"]();this[o(877)+o(1523)+o(1222)](c[o(922)](_0x1fad0b,c.xbQpc,{code:_0x3076ec.code,reason:o(1220)+o(1721)+o(428)+o(1105)+"n, hostname: "+f})),this[o(1741)+"tManager"]?.[o(1828)+o(1582)+"fig"](),this[o(939)+o(1409)]?.[o(949)+o(917)]();return}else return!!s?.[o(1889)](f=>f[o(736)]===t&&f[o(405)]===n)}function it(s,t){let n=r;return s?.find(o=>o[n(736)]===t)?.[n(405)]}let er=null;async function aa(){let s=r;return er||(er=Promise[s(1061)]()[s(568)](Ee[s(953)](Ee,"idb"))),er}class ca extends Xn{constructor(t,n){let o=r;super(),this[o(1472)]=t,this[o(979)]=n,this[o(679)]=void 0,this._initPromise=null}async[r(1833)](){await this[r(1355)]()}async[r(1355)](){let t=r,n={FYUYD:function(o){return e[P(1349)](o)},xURGG:function(o,c,f,g){return o(c,f,g)}};if(!this[t(679)]){if(this[t(768)+t(1079)])return this["_initPro"+t(1079)];try{let o=this[t(1472)],c=this._keyPath;this[t(768)+t(1079)]=(async()=>{let f=t,{openDB:g}=await n[f(609)](aa);this[f(679)]=await n[f(1117)](g,f(1617)+"_"+o,1,{upgrade(p){let l=f;p[l(1459)+l(977)+"e"](o,{keyPath:c})}})})(),await this["_initPro"+t(1079)]}catch(o){console[t(1030)](o)}finally{this[t(768)+t(1079)]=null}}}async[r(1528)](t){let n=r;try{return await this[n(1355)](),this[n(679)]?.[n(1528)](this[n(1472)],t)}catch(o){console[n(1030)](o)}}async set(t,n){let o=r;return await this[o(1355)](),this[o(679)]?.[o(1006)](this[o(1472)],t)}async[r(586)](t){let n=r;if(e[n(1899)](e[n(472)],e[n(472)]))try{return await this[n(1355)](),this[n(679)]?.[n(972)](this[n(1472)],t)}catch(o){console[n(1030)](o)}else return null}async[r(1799)](){let t=r;try{return await this._init(),this[t(679)]?.[t(1799)](this[t(1472)])}catch(n){console[t(1030)](n)}}async[r(1480)](){let t=r;return e[t(837)](e[t(661)],e[t(1041)])?this[t(570)].protocol:(await this[t(1355)](),this[t(679)]?.[t(1581)+"ys"](this[t(1472)]))}async[r(489)](){let t=r;return await this[t(1355)](),this[t(679)]?.[t(489)](this[t(1472)])}async closeDB(){let t=r,n={BLZjj:function(o,c){return o instanceof c},tJLYg:function(o,c){return e.WnYsr(o,c)},GlUtI:function(o,c){return e[P(579)](o,c)}};try{this._qosDB?.[t(1314)](),this[t(679)]=void 0}catch(o){if(e[t(1699)]!==e.ctxDh)return yALsff[t(858)](_0x4f0739,_0x59bb7c)&&(yALsff.tJLYg(_0x81aeb5,"done")||_0x5d6265===t(838))?!0:yALsff[t(1391)](_0x35b38a,_0x2f74e8);console[t(1030)](o)}}get isReady(){let t=r;try{return e[t(985)](e[t(1812)],e[t(1812)])?!!this[t(679)]:this[t(444)]?this[t(444)][t(1590)+"pe"]:this[t(874)+t(1114)]}catch(n){return console.log(n),!1}}}class xa{constructor(t,n){let o=r;this._DBName=t,this[o(1888)]=n,this[o(679)]=localStorage}async[r(1833)](){}get[r(1353)](){let t=r;return t(1617)+"_"+this[t(1622)]}async[r(1528)](t){let n=r,o=this[n(679)][n(504)](this[n(1353)]);return JSON[n(1525)](o||"{}")[t]}async[r(510)](t,n){let o=r,c=this[o(679)][o(504)](this._prefix),f=JSON[o(1525)](e[o(1435)](c,"{}"));return f[n||t[this[o(1888)]]]=t,this[o(679)][o(1640)](this[o(1353)],JSON[o(438)+"y"](f)),n||t[this[o(1888)]]}async del(t){let n=r,o=this[n(679)][n(504)](this[n(1353)]),c=JSON[n(1525)](e[n(500)](o,"{}"));return c[t]=void 0,this[n(679)].setItem(this[n(1353)],JSON.stringify(c))}async[r(1799)](){return this[r(679)].clear()}async[r(1480)](){let t=r,n=this[t(679)].getItem(this[t(1353)]),o=JSON[t(1525)](e.jJoom(n,"{}"));return Object.keys(o)}async[r(489)](){let t=r,n=this._qosDB.getItem(this[t(1353)]),o=JSON[t(1525)](e[t(1801)](n,"{}"));return Object.values(o)}[r(1704)](){return Promise[r(1061)]()}get[r(1893)](){return!!this[r(679)]}}class ua{constructor(t,n){let o=r;this._DBName=t,this[o(1888)]=n,this[o(679)]=Ve?tt:vt?wx:null}async[r(1833)](){}get[r(1353)](){return"frontier_"+this[r(1622)]}async[r(1528)](t){let n=r,o={pyKGD:e[n(1441)],GshNn:e[n(640)],RygHK:e[n(1651)],rneQD:n(533)};if(e[n(816)]("qznDB",n(1688))){let c=this[n(679)][n(1505)+"geSync"](this._prefix);return JSON[n(1525)](e.yaLJU(c,"{}"))[t]}else{let c=o[n(575)].split("|"),f=0;for(;;){switch(c[f++]){case"0":this._ws[n(938)+n(1425)+n(733)](o[n(1814)],this._onMessage);continue;case"1":this[n(444)][n(938)+n(1425)+n(733)](o[n(1670)],this[n(1613)]);continue;case"2":this[n(444)]["removeEv"+n(1425)+n(733)](n(1875),this[n(954)]);continue;case"3":this[n(444)][n(938)+n(1425)+n(733)](o.rneQD,this[n(1352)]);continue;case"4":if(!this[n(444)])return;continue}break}}}async[r(510)](t,n){let o=r,c=this[o(679)]["getStora"+o(1417)](this[o(1353)]),f=JSON[o(1525)](e[o(500)](c,"{}"));return f[n||t[this._pathKey]]=t,this[o(679)][o(1288)+o(1417)](this[o(1353)],JSON[o(438)+"y"](f)),n||t[this._pathKey]}async del(t){let n=r,o=this[n(679)][n(1505)+n(1417)](this._prefix),c=JSON.parse(e[n(1091)](o,"{}"));return c[t]=void 0,this._qosDB[n(1288)+"geSync"](this[n(1353)],JSON[n(438)+"y"](c))}async[r(1799)](){let t=r;if(e.FpYXY(e[t(494)],e[t(494)]))_0x51df41[t(1617)+t(1639)]=void 0,e[t(1524)](_0x48b90a,t(1518)+t(1517));else return this[t(679)][t(1484)+"rageSync"]()}async[r(1480)](){let t=r,n=this[t(679)][t(1505)+t(848)+"nc"](this._prefix),o=JSON[t(1525)](e[t(855)](n,"{}"));return Object[t(1480)](o)}async getAll(){let t=r,n=this[t(679)][t(1505)+t(848)+"nc"](this[t(1353)]),o=JSON[t(1525)](e.MgTPf(n,"{}"));return Object[t(1035)](o)}[r(1704)](){let t=r,n={MGrqL:function(o){return o()}};if(e[t(1850)](e[t(1259)],e[t(929)]))return Promise.resolve();{let o=this[t(1741)+t(1676)]?.[t(1372)+t(1210)+"nt"]();this[t(1424)](t(517)+o),n[t(1187)](_0x58dc78)}}get[r(1893)](){return!!this[r(679)]}}function gs(s,t){let n=r;if(Ve||Ve)return new ua(s,t);if(e[n(1415)](st,St)&&e[n(1846)](e[n(537)],typeof indexedDB))return new ca(s,t);if((st||St)&&n(399)+"d"!=typeof localStorage)return new xa(s,t);throw new Error(e[n(1513)])}class fa{constructor(){let t=r;if(e[t(712)](e[t(815)],t(1467))){let n=new _0x5f47d5(e[t(1264)](2,_0x52e70a));n[t(510)](_0x585fad),_0xee6fb6[t(1464)]=n}else this["_interva"+t(1713)+"Id"]=null,this[t(1246)+"l"]=36e5,this[t(679)]=e.JHYGo(gs,e[t(724)],e.nPzWu)}async _intervalFlush(){let t=r,n={MqMWo:t(1399),fjTuF:function(o,c){return e[t(712)](o,c)},ivxyK:t(1147),MJahr:"jOWzd"};e[t(1275)](e[t(687)],t(899))?(this.emit(n[t(1159)],_0x5db4c8),this[t(823)+"e"]&&this.onmessage(_0x404c6b)):(e[t(1074)](clearInterval,this[t(1246)+"lTimeoutId"]),this[t(1246)+t(1713)+"Id"]=e.mIjOF(setInterval,()=>{let o=t;n[o(414)](n[o(1303)],n.MJahr)?this[o(1637)+o(1740)]():(this[o(877)+o(1271)+"Event"](_0x552c5a),_0xc5e642[o(510)](_0x54c2d1,_0x46fe79,_0x5e32ed[o(1399)].service))},this[t(1246)+"l"]))}async[r(1833)](){let t=r,n={wtBHS:function(o,c,f){return e.mvQxF(o,c,f)}};await this[t(679)].openDB()[t(568)](()=>{let o=t;if(e[o(563)]==="CZhUt")return _0x296622[o(1464)][DrTBrw.wtBHS(_0x1e9218,_0x1109c5,1)];this[o(1246)+o(1809)]()})}async[r(1637)+r(1740)](){let t=r,n={UmghU:e[t(1426)]};(await this[t(679)]?.getAll()||[])[t(1502)](({timestamp:f})=>f<Date[t(1447)]())[t(1170)](f=>{let g=t;if(n[g(1696)]!==n[g(1696)])return new _0x311155(_0x320b06,{message:_0x1f5b8e});this[g(679)]?.[g(586)](f.message_id)})}async[r(586)](t){return this[r(679)]?.del(t)}async set(t,n){return this[r(679)]?.set({message_id:t,timestamp:n})}async[r(1528)](t){let n=r;return this[n(679)]?.[n(1528)](t)}async[r(1704)](){let t=r;e.ZTSBr(clearInterval,this["_interva"+t(1713)+"Id"]),await this._qosDB?.[t(1704)]()}get isReady(){let t=r;return this[t(679)]?.[t(1893)]}}function tr(s){let t=r,n=!!this[t(1871)][t(1120)+"S"];if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=qe(s[t(1399)].headers,e[t(870)],"2"),c=o&&e[t(1101)](qe,s[t(1399)][t(934)],e[t(634)],"1"),f=o&&e[t(1101)](qe,s[t(1399)].headers,e.jRnqY,"1"),g=f?it(s[t(1399)].headers,e.HbOOs)?.[t(862)](",").filter(Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:c,isAckCleanupMessage:f,ackMsgIds:g}}async function ps(){let s=r;return this._QoSManager||(this[s(1612)+s(1593)]=new fa),this[s(1612)+s(1593)][s(1893)]||await this[s(1612)+"ger"][s(1833)](),this["_QoSMana"+s(1593)]}async function da(s,t){let n=r,{enableAutoAck:o}=this._options,c=e[n(1101)](qe,s[n(1399)][n(934)],n(662),"1"),f=e[n(404)](qe,s[n(1399)][n(934)],e[n(1325)],"1"),g=tr[n(1236)](this,s);if(e[n(1643)](o,c)){let{SeqID:p,LogID:l,service:y,LogIDNew:k,method:v}=s.message;this._sendAck({SeqID:p,LogID:l,LogIDNew:k,service:y,method:v,headers:[{key:e[n(1325)],value:"1"},{key:e[n(1359)],value:k||""},{key:e.emwGa,value:"0"}]})}f&&!g[n(1762)]&&this[n(877)+n(711)+n(1599)](s),e.HYoBA(t)}async function la(s,t){let n=r;this[n(1424)]("received",s[n(1399)]),e.ftUfv(t)}async function ha(s,t){let n=r,o={kXwEq:function(f,g,p){return e[P(601)](f,g,p)},jpvQJ:e[n(1651)]},c=e[n(1718)](Qr,await hs(s[n(1779)]));try{if(e[n(511)](c[n(1485)],Uint8Array))if(e[n(1218)](e.jxwqa,e[n(581)])){let f=e[n(1771)](this[n(1871)]["payloadE"+n(1183)],Object)?{force:!!this[n(1871)][n(694)+n(1183)].force,encoding:this._options.payloadEncoding[n(1803)]?this[n(1871)][n(694)+"ncoding"][n(1803)].replace(/\s/g,"")[n(672)+"ase"]():""}:{force:!1,encoding:this._options[n(694)+n(1183)]?this[n(1871)][n(694)+n(1183)][n(1493)](/\s/g,"")[n(672)+"ase"]():""},g=c["payloadE"+n(1183)]?c[n(694)+n(1183)].replace(/\s/g,"")[n(672)+n(1042)]():"",p=e.Xzcri(this[n(1871)][n(1685)+n(1114)],Object)?{force:!!this._options[n(1685)+n(1114)].force,type:this[n(1871)][n(1685)+n(1114)][n(1433)]?this[n(1871)][n(1685)+n(1114)][n(1433)][n(1493)](/\s/g,"")[n(672)+n(1042)]():""}:{force:!1,type:this[n(1871)][n(1685)+n(1114)]?this[n(1871)][n(1685)+n(1114)][n(1493)](/\s/g,"").toLowerCase():""},l=c[n(1685)+n(1114)]?c[n(1685)+n(1114)][n(1493)](/\s/g,"")[n(672)+n(1042)]():"",y=p[n(569)]?p[n(1433)]:l||p.type,k=f[n(569)]?f[n(1803)]:g||f.encoding,v=[e[n(524)],e[n(742)],e[n(1214)],e[n(1414)]],A=[e[n(813)],e[n(1507)]];this._options[n(872)+n(1243)+"extPayload"]&&v.includes(y)&&(!k||A[n(1386)](k))?c[n(421)+n(671)]=e.IGjqQ(ls,c[n(1485)],0,c[n(1485)][n(986)+"th"]):c[n(421)+"oad"]=""}else{this[n(877)+"hCloseEv"+n(1222)](o[n(1207)](_0x2054bf,o.jpvQJ,{code:1e3,reason:"bye"})),this[n(1741)+n(1676)]?.[n(1828)+n(1582)+"fig"](),this._pingLossCounter?.[n(949)+"nter"]();return}else c["textPayl"+n(671)]=""}catch(f){c[n(421)+"oad"]="",console[n(1030)](f)}s[n(1399)]=c,t()}function ga(s,t,n){let o=r,c={eGLlO:function(f,g){return e[P(1619)](f,g)},ZekBq:function(f,g){return e.ZTSBr(f,g)},SfIWE:function(f,g){return f&g},KqHST:function(f,g){return e[P(730)](f,g)},JYDQC:function(f,g){return e.EOPUq(f,g)}};if(e[o(1824)]===e.SElGD)try{this[o(444)]&&this[o(444)].close(_0x4d9d04,_0x369e42)}catch{}else{let f=n||8192,g=e[o(1848)](f,1),p=null,l=f;return function(y){let k=o;if(y<1||y>g)return c[k(1173)](s,y);l+y>f&&(p=c[k(1624)](s,f),l=0);let v=t[k(1236)](p,l,l+=y);return c[k(1709)](7,l)&&(l=c.KqHST(c.JYDQC(7,l),1)),v}}}let pa=4294967295;function ma(s,t,n){let o=r;return e[o(897)](RangeError,e.GyJCA(e[o(1653)](e[o(413)](e.AlpjJ(o(585)+o(439)+o(1036),s),e[o(392)])+e[o(1091)](t,1),e[o(851)]),n))}function wa(s,t,n){let o=r;if(e[o(1568)](n,pa))throw new Error(o(1141)+o(658)+"e");let c=3;for(;c>=0;){let f=e[o(1734)](255,n);rr(f,s,e.yJVhE(t,c)),n>>>=8,c--}return t+4}function _a(s,t){let n=r;if(e[n(1562)](e.BkFTd,e[n(1479)])){let o=0,c=t,f=e.AGvJI(t,4);for(;c<f;){let{value:g,offset:p}=e[n(1197)](nr,s,c);c=p,o=e.DZGxx(e[n(1411)](o,8),0),o+=g}return{value:o,offset:f}}else return _0x40fc60||(_0x2819be=[_0x120ade,_0x5d4a21,_0x3862b7,_0x10f388,_0x2ada81])}function ya(s,t,n){let o=r,c=e[o(457)][o(862)]("|"),f=0;for(;;){switch(c[f++]){case"0":if(!s)return n;continue;case"1":return e[o(982)](Zn(s,t,n),n);case"2":if(t[o(1244)])return e.domhM(t[o(1244)](s,n),n);continue;case"3":if(t.utf8Write)return e[o(1830)](t[o(1805)+"e"](s,n),n);continue;case"4":if(e.MoGHH(s[o(1843)],40))return e[o(1018)](e[o(404)](Zn,s,t,n),n);continue}break}}function ba(s,t){let n=r,o=new O(e[n(969)](e[n(1462)](s[e[n(547)](t,4)],24)|s[t+5]<<16,e[n(1108)](s[t+6],8))|s[e[n(412)](t,7)],e[n(873)](e.LqIdV(e[n(423)](e.fqVCz(s[e[n(635)](t,0)],24),e.xoUPL(s[t+1],16)),e[n(794)](s[e[n(1162)](t,2)],8)),s[e[n(861)](t,3)]),!0);return t+=8,{value:o,offset:e[n(1431)](t,8)}}function va(s,t,n){let o=r,c=s[o(821)],f=s[o(1845)];return t[n]=e.RynrW(f,24),t[n+1]=e[o(1878)](f,16)&255,t[e[o(759)](n,2)]=e.SyTdW(f,8)&255,t[e[o(530)](n,3)]=e.qYYVI(255,f),t[e[o(1810)](n,4)]=e[o(915)](c,24),t[e[o(1807)](n,5)]=e.ELuwT(e[o(416)](c,16),255),t[e.lAVmG(n,6)]=e[o(473)](e[o(1321)](c,8),255),t[n+7]=e[o(1553)](255,c),n+=8,n}function nr(s,t){let n=r;if(e[n(1335)]!==n(1521))return s.readUInt8?{value:s.readUInt8(t),offset:e[n(971)](t,1)}:{value:255&s[t],offset:e.dbNHp(t,1)};_0x92fbfe[n(1030)](_0x22e644)}function rr(s,t,n){let o=r;return t[o(1171)+"t8"]?t.writeUint8(s,n):t[n]=e[o(1541)](255,s),e[o(1309)](n,1)}let Sa=function(s){return new Uint8Array(s)},Ea=e[r(1648)](r(399)+"d",typeof Buffer)?Buffer[r(1146)+r(830)]:ga(Sa,Uint8Array[r(1268)+"e"][r(1626)]);(()=>{let s=r,t={JZdpc:function(o,c){return e.LsWgr(o,c)},YQtAc:function(o,c){return e[P(1188)](o,c)},fNdgu:function(o,c){return e[P(1124)](o,c)},ijLUE:function(o,c){return o<<c},UCsyS:function(o,c){return e[P(1514)](o,c)},XWkYC:function(o,c){return o&c},jQOPs:function(o,c){return e[P(792)](o,c)},uwVOr:function(o,c){return o|c},UGmTH:function(o,c){return o<c},nJhtz:function(o,c){return e.OYrls(o,c)},TReoZ:function(o,c){return e.CZpya(o,c)},SwCGf:function(o,c){return e[P(1844)](o,c)},knQoN:function(o,c){return e[P(895)](o,c)},AkJOO:function(o,c){return e.puHMC(o,c)},HtYXy:s(430),KecrJ:function(o,c,f,g){return e[s(1326)](o,c,f,g)},wzAmY:function(o,c){return o|c}},n=4294967295;return function(o,c,f=!0){let g=s;if(n=t[g(1374)](t[g(562)](127,o[c]),0),o[c++]<128)return{value:f?n:t[g(402)](0,n),offset:c};if(n=(n|t[g(1827)](t.UCsyS(127,o[c]),7))>>>0,o[c++]<128)return{value:f?n:0|n,offset:c};if(n=(n|t[g(1827)](t[g(515)](127,o[c]),14))>>>0,t[g(956)](o[c++],128))return{value:f?n:0|n,offset:c};if(n=t[g(809)](n,t[g(1827)](t[g(562)](127,o[c]),21))>>>0,t.UGmTH(o[c++],128))return{value:f?n:t[g(1098)](0,n),offset:c};if(n=t[g(1412)](n|(15&o[c])<<28,0),t[g(1017)](o[c++],128))return{value:f?n:t[g(1681)](0,n),offset:c};if((c+=5)>o[g(1843)])if(t[g(1336)](t[g(1483)],t[g(1483)]))this[g(679)]?.[g(586)](_0x40e77c[g(1158)+"id"]);else throw c=o[g(1843)],t[g(1100)](ma,c,10,o[g(1843)]);return{value:f?n:t.wzAmY(0,n),offset:c}}})();let Ca=16,sr=32;function Aa(s){let t=r,n=0,o={};for(let c=0;c<s[t(1843)];c++)if(e[t(1102)](e[t(1798)],e[t(1692)])){let f=this[t(679)][t(1505)+t(1417)](this[t(1353)]);return _0x47daef[t(1525)](e.wXUWN(f,"{}"))[_0x1255ca]}else o[s[c][t(1437)+t(989)]]=e.cyyND(ds,s[c][t(1437)+t(989)]),n+=e.tAVjS(14,o[s[c][t(1437)+t(989)]]);return[n,o]}function ms(s,t,n){let o=r;if(e[o(1275)](e[o(1165)],e[o(1165)]))e[o(1449)](_0x2bafda,_0x1ae890,32),e[o(1394)](_0x4f8704,_0x4751e3,e[o(1826)](_0x3098cd,_0x455ae5));else{let[c,f]=e[o(1277)](Aa,s),g=Ea(c),p=0;return s[o(1170)](l=>{let y=o,k=e[y(1633)][y(862)]("|"),v=0;for(;;){switch(k[v++]){case"0":console[y(1030)](e[y(1216)],p);continue;case"1":console[y(1030)](e[y(998)],p);continue;case"2":p=rr(f[l[y(1437)+"ame"]],g,p);continue;case"3":console[y(1030)](e[y(1476)],l,l[y(1231)]);continue;case"4":console[y(1030)](y(777)+y(1546),p);continue;case"5":p=e[y(695)](va,O.fromNumber(l[y(1717)]||t),g,p);continue;case"6":p=e[y(1326)](ya,l[y(1437)+y(989)],g,p);continue;case"7":p=e[y(820)](wa,g,p,l[y(1231)]||0);continue;case"8":p=e[y(1101)](rr,0,g,p);continue;case"9":console[y(1030)](e.kvcDj,p);continue;case"10":console.log(y(1546),p);continue}break}}),{frameType:sr,headers:[{key:e[o(1153)],value:n}],payload:g}}}function ka(s){let t=r,n=0,o=[];for(;e.NvWik(n,s[t(986)+"th"]);)if(e.udtcl(e[t(1143)],t(696)))e[t(1106)](_0x578a15,e[t(1790)]),this[t(831)](t(1238)+"e_success",_0x9080aa),this[t(831)](e[t(1132)],_0x18d1b1);else{let{offset:c}=e[t(904)](nr,s,n);n=c;let f={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e.KuybI(_a,s,n);f[t(1231)]=g,n=p;let{value:l,offset:y}=e.CUubA(nr,s,n);n=y,f[t(1437)+"ame"]=e[t(404)](ls,s,n,e[t(1432)](n,l)),n+=l;let{value:k,offset:v}=e.iaJts(ba,s,n);f[t(1717)]=k[t(1312)](),n=v,o[t(483)](f)}return o}function Pa(){return{frameType:sr,headers:[{key:e.EyXNV,value:e.QYRLx}],payload:void 0}}class Ia{constructor(t,n,o){let c=r;this["_cursorN"+c(624)]=t,this["_cursorF"+c(826)]=n,this[c(1051)+c(785)]=o,this._qosDB=e[c(1394)](gs,this[c(1154)+c(624)],e.WMasM)}async[r(1833)](){let t=r;await this[t(679)][t(1833)]()}async[r(1313)+"rs"](){let t=r,n={FOgFp:function(o,c){return e[P(552)](o,c)},cdLpv:e[t(1790)],QFoIf:e[t(1132)],SRkKw:function(o,c){return o(c)},UiWAN:function(o,c,f){return o(c,f)},QmVqL:e[t(931)]};if(e.FpYXY(e[t(1842)],e[t(543)])){if(!this[t(679)][t(1893)])return;let o=this._messageStrategy,c=await this._qosDB.getAll();switch(console[t(1030)](e[t(636)],c),o){case e[t(974)]:return c&&c[t(1843)]?e.JHQyB(ms,c,0,this[t(1557)+t(826)]):void 0;case e[t(1088)]:return;case e[t(1084)]:return c&&c[t(1843)]?ms(c,0,this[t(1557)+t(826)]):Pa()}}else return new _0x4310d8((o,c)=>{let f=t,g={nQrwM:function(y,k){return n[P(1240)](y,k)},CzUDC:n[f(732)],bljTH:n[f(407)],gCpdX:function(y,k){return n.SRkKw(y,k)},QGeSk:f(1238)+f(1509)+"s"};this[f(1040)+f(1190)](),this[f(1867)+"gTimeoutId"]=n[f(970)](_0x451e04,this[f(1413)].bind(this),this[f(1871)][f(1671)+f(1178)]);let p=()=>{let y=f;g[y(1607)](o,g[y(1034)]),this.off("ping_onc"+y(1509)+"s",p),this[y(831)](g.bljTH,l)},l=()=>{let y=f;g[y(1794)](c,y(1398)),this[y(831)](g[y(1668)],p),this[y(831)](y(1238)+y(632)+"t",l)};this.on(n[f(1196)],p),this.on(n.QFoIf,l),this._ping()})}async[r(510)](t,n,o){let c=r;return console[c(1030)](e[c(1789)],t,n,o),this[c(679)][c(510)]({cursor_name:t,cursor:n,service:o})}async[r(1258)+"rs"](t){let n=r,o=e[n(1445)](ka,t);for(let c of o)console[n(1030)](e[n(1736)],o),await this[n(679)][n(510)](c)}async[r(1528)](t){let n=r;return(await this[n(679)][n(1528)](t))?.[n(1717)]}async[r(1704)](){let t=r;if(e[t(655)](e[t(704)],e[t(394)]))await this[t(679)][t(1704)]();else return!!(e.xRyJa(this[t(1062)+t(388)],this[t(1217)+"s"][t(1843)])||e[t(1377)](this[t(1062)+t(388)],e.OkhLy(this.endpoints.length,1))&&e[t(389)](this["currentEndpointT"+t(1338)+"t"],this[t(1770)+"es"]))}[r(1754)+r(710)+"Name"](t){this._cursorFileName=t}get[r(1893)](){let t=r;return this[t(679)][t(1893)]}}let Da=e.qjKKt;async function ws(s){let t=r,n={ytdQK:e[t(1877)]};if(e[t(900)](e[t(945)],e.UNgmt)){if(!this._options[t(1120)+"S"])return null;let{aID:o,fpID:c,messageStrategy:f}=this[t(1871)],g=e[t(578)](s,Da);try{if(this[t(921)+t(1837)]){if(e.NUEGi(e[t(1666)],e[t(765)]))return this._socket[t(871)+"ns"];s&&this[t(921)+t(1837)][t(1754)+t(710)+t(549)](s)}else this[t(921)+t(1837)]=new Ia(c+"_"+o+"_"+g,g,f);return this[t(921)+t(1837)][t(1893)]||await this[t(921)+t(1837)][t(1833)](),this[t(921)+t(1837)]}catch{return e[t(1562)](e[t(1073)],t(843))?null:_0xf1399e[t(1061)]()}}else{let o=_0x1292bd(n[t(1584)],{message:_0x4331ca[t(1399)],code:_0x1065d1[t(1123)+t(1768)],error:_0x1d9a5a});this[t(877)+t(925)+t(1222)](o)}}async function Ta(s,t){let n=r,o={Yzytt:e[n(739)],crkmg:function(g,p){return g!==p}};if(e[n(924)](e[n(1571)],e[n(1242)])){let g=o[n(762)][n(862)]("|"),p=0;for(;;){switch(g[p++]){case"0":if(NDwjXa.crkmg(void 0,c))return c.exports;continue;case"1":var c=_0x1ec981[_0x1c5947];continue;case"2":return f[n(1887)];case"3":_0x558ccd[_0x547061](f,f[n(1887)],_0x721850);continue;case"4":var f=_0x515c0d[_0x1e4401]={exports:{}};continue}break}}else{let g=e.nCdBf(qe,s[n(1399)][n(934)],e[n(1745)],"-1"),p=e[n(1286)](qe,s[n(1399)][n(934)],n(1863),"1"),l=e[n(456)](it,s[n(1399)][n(934)],e[n(1003)]),y=Number(e[n(514)](it,s[n(1399)].headers,e[n(1384)]))||0,k=tr[n(1236)](this,s),v=qe(s[n(1399)][n(934)],e[n(1229)],"2"),A=it(s[n(1399)][n(934)],n(1257)+n(403)+"e"),T=Number(e[n(1455)](it,s.message[n(934)],e[n(853)]));if(k.isQoSAck)return t();let G=k[n(590)+n(1127)]?await ps.call(this):null;if(e[n(1729)](s[n(1399)][n(1231)],0)&&p&&!g||s.message[n(1231)]>0){if(l&&k["isQoSMes"+n(1127)]&&G)return!!!await G[n(1528)](l)&&(this[n(877)+n(1271)+"Event"](s),await G.set(l,Date[n(1447)]()+y)),e[n(1249)](t);if(v){let M=await ws[n(1236)](this);if(!M)return this[n(877)+"hMessage"+n(883)](s),e[n(1249)](t);let X=await M[n(1528)](A)??-1;if(e[n(1844)](X,T))this[n(877)+n(1271)+"Event"](s),M[n(510)](A,T,s.message[n(1231)]);else throw new Error(n(1076)+n(1276)+n(1241)+T+(" larger "+n(714)+n(1898)+"r ")+X);return e[n(988)](t)}return this[n(877)+n(1271)+n(883)](s),t()}}}async function La(s,t){let n=r,o=tr[n(1236)](this,s);if(!o[n(590)+n(1127)])return e[n(1793)](t);let c=await ps[n(1236)](this);if(o[n(886)+n(559)+n(1066)]&&o.ackMsgIds[n(1843)])for(let f of o[n(1853)+"s"])await c[n(586)](f);e.mDsYa(t)}async function Ra(s,t){let n=r;if(e[n(758)](e[n(608)],e[n(1895)]))this[n(1308)+"er"]&&_0x50ca96[n(1149)+n(1538)](n(639),this["_handleO"+n(1714)]),this[n(1308)+"er"]&&_0x26a9b0[n(1149)+"Listener"](e[n(1597)],this._handleOffLine),this[n(1308)+"er"]&&_0x2df1b9[n(1149)+n(1538)](n(1054),this[n(491)+"ageHide"]),this[n(1308)+"er"]&&_0x3ae05f[n(1149)+n(1538)](e[n(766)],this[n(491)+n(393)]);else{let o=e[n(1235)](s[n(1399)].frameType,Ca),c=e[n(1531)](s.message.frameType,sr);if(e[n(1643)](!o,!c))return t();let f=e.SXiTD(it,s[n(1399)].headers,e[n(1153)]);if(!f)return e[n(519)](t);let g=await ws.call(this,f);if(!g)return e[n(705)](t);if(o){let p=await g[n(1313)+"rs"](),l={frameType:p?.[n(482)+"e"],SeqID:O.fromNumber(this[n(1490)]++),LogID:O[n(652)+"er"](this[n(1871)][n(427)+"erator"]()),service:9e3,method:5,headers:p?.[n(934)],payload:p?.[n(1485)]},y=C(l);this[n(444)]&&this._ws[n(1396)+"te"]&&this[n(444)][n(1611)](y)}if(c){let p=s[n(1399)].payload;p&&g[n(1258)+"rs"](p)}}}let Na=async function(s,t){let n=r;this._isInit=!1,clearTimeout(this[n(1254)+"ionTimeo"+n(864)]),e[n(923)](t)},Oa=async function(s,t){let n=r;if(!this[n(444)]||e[n(816)](this[n(444)][n(1396)+"te"],this[n(1554)]))return e[n(988)](t);let{pingInterval:o}=this[n(1871)];this[n(1741)+"tManager"]?.[n(1828)+n(1582)+n(1759)]();for(let f=0;e.AVFzs(f,this[n(1051)+"Queue"].length);f++){let g=this[n(1051)+n(1077)][f];if(e[n(703)](this[n(444)][n(1396)+"te"],this[n(1554)])&&e[n(816)](null,g))this[n(444)]&&this[n(444)][n(1611)](g),this[n(1051)+n(1077)][f]=null;else break}this[n(1051)+n(1077)]=this[n(1051)+n(1077)][n(1502)](f=>!!f),this[n(1867)+n(386)+"Id"]=e[n(1328)](setTimeout,()=>this[n(1413)](),o),this["_dispatc"+n(1458)+"nt"](s),this._isBrowser&&this[n(444)]&&(this[n(444)][n(1590)+"pe"]=this._binaryType);let c=this[n(1741)+"tManager"]?.[n(1372)+n(1210)+"nt"]();this[n(1424)]("open "+c+n(571)),t()},Ba=async function(s,t){let n=r,o=this[n(1741)+n(1676)]?.[n(1372)+n(1210)+"nt"]();this[n(1424)](n(517)+o),e.RfVdk(t)};class Ma extends Xn{constructor(t){let n=r,o={DVVeI:function(p,l){return p<l},WGqga:function(p,l){return e[P(1880)](p,l)},Xdjzn:function(p,l){return e[P(1195)](p,l)},CeUvm:function(p,l){return e.Hqhgm(p,l)},NaImU:function(p,l){return e[P(1450)](p,l)},RDElJ:function(p,l){return e[P(890)](p,l)},uAgAb:n(1119),jeLay:e[n(1651)],VjAfB:n(406),jkZnr:function(p,l){return p===l},gEfie:n(1453),qmYrx:e[n(1591)],WIeih:function(p,l){return e[n(798)](p,l)},xkixH:function(p,l,y){return e.RLmpN(p,l,y)},IQzvF:function(p,l,y){return e[n(1532)](p,l,y)}};super(),this["_miniNav"+n(1383)+"line"]=!0,this._isBrowser=st,this._isNode=Zo,this[n(802)+"T"]=Ve,this[n(673)+"X"]=vt,this[n(1380)+"r"]=St,this[n(1051)+n(1077)]=[],this[n(1741)+n(1676)]=null,this["_readyCl"+n(1133)]=!1,this[n(874)+n(1114)]=e[n(1655)],this[n(1254)+"Lock"]=!1,this[n(1254)+n(603)+n(864)]=null,this._reconnectTimeoutId=null,this[n(1867)+n(386)+"Id"]=null,this[n(1490)]=0,this._isInit=!1,this[n(1348)]="",this[n(1612)+n(1593)]=null,this[n(921)+n(1837)]=null,this[n(939)+"sCounter"]=null,this[n(1540)+"ls"]=n(411),this[n(946)]=3,this.CONNECTING=0,this[n(1554)]=1,this[n(1831)]=2,this[n(954)]=p=>{let l=n;try{e[l(1400)](fs,this,p,[Na,Oa,Ba])}catch(y){let k=e[l(529)](ue,e[l(1877)],{message:y[l(1399)],code:Fe[l(1137)+"OR"],error:y});this[l(877)+l(925)+l(1222)](k)}},this[n(1103)+"ge"]=async p=>{let l=n,{pingInterval:y,pingFrequency:k}=this._options;if((e[l(984)]("hi",p[l(1779)])&&e[l(1317)]===k||e[l(758)](l(1712),k))&&(this[l(1040)+l(1190)](),this[l(806)](e.qbBdr,e.JVUZW),this["_pingPon"+l(386)+"Id"]=setTimeout(this[l(1413)][l(953)](this),y)),p[l(1779)]!=="hi")try{e[l(1101)](fs,this,p,[ha,da,La,Ra,Ta,la])}catch(v){let A=ue(e.uRZCb,{message:v[l(1399)],code:Fe[l(1123)+"ERROR"],error:v});this["_dispatc"+l(925)+"ent"](A)}},this[n(1352)]=p=>{let l=n,y=this[l(1741)+"tManager"]?.[l(1350)+l(749)+"es"](),k=this[l(1741)+l(1676)]?.["getCurre"+l(1210)+"nt"]();if(y&&!p.message){let v=l(995)+k+(l(784)+l(1056)+l(677)+"ed");this["_dispatc"+l(925)+l(1222)](ue(e.uRZCb,{message:v,code:Fe[l(395)+l(1213)+"R"],error:p}));return}this._ws&&e.tVaAR(this[l(444)][l(1396)+"te"],this[l(1554)])&&this[l(448)+l(1297)](),this[l(877)+l(925)+l(1222)](e[l(775)](ue,e[l(1877)],{message:p[l(1399)],code:Fe[l(1620)+l(1013)],error:p}))},this._onClose=async p=>{let l=n,y={qvHll:function(v,A){return o.DVVeI(v,A)},pKbeH:function(v,A){return o[P(1840)](v,A)},FzEkS:function(v,A){return v&A},oVaLH:function(v,A){return o[P(718)](v,A)},tcSYo:function(v,A){return o[P(1840)](v,A)},NroXc:function(v,A){return v&A},xZQaF:function(v,A){return v>>A},YibXQ:function(v,A){return o[P(1840)](v,A)},ahAte:function(v,A){return o[P(975)](v,A)},vtvtD:function(v,A){return o[P(1001)](v,A)},rJIqW:function(v,A,T){return v(A,T)},NbOVR:function(v,A){return v|A},eIcgz:function(v,A){return o[P(1001)](v,A)}};this["_clearTi"+l(1344)](),this[l(1040)+l(1190)](),this[l(1838)+l(1470)+"rs"](),this._ws=null,this[l(1254)+l(688)]=!1;let k=this[l(1741)+l(1676)]?.[l(1350)+"chMaxTries"]();if(!k&&this["_navigat"+l(958)]()&&!this["_readyCl"+l(1133)])if(o[l(502)](o[l(968)],o[l(968)]))FafJKr[l(546)](_0x5ba17f,2048)?_0x17cb9c[_0x13b0f2++]=FafJKr[l(1693)](FafJKr[l(1902)](FafJKr.oVaLH(_0x51e8c4,6),31),192):(FafJKr[l(546)](_0x570ac5,65536)?_0x109f4b[_0x1f4edd++]=FafJKr[l(1885)](FafJKr[l(950)](FafJKr[l(863)](_0x5e272c,12),15),224):(_0x39507f[_0x205bf6++]=FafJKr[l(1578)](FafJKr[l(950)](_0x22e877>>18,7),240),_0x561ab9[_0x110cd2++]=FafJKr[l(950)](_0x51b550>>12,63)|128),_0x3412de[_0x1b25fa++]=FafJKr[l(1578)](FafJKr[l(1404)](_0x4cc913,6)&63,128)),_0x571416[_0x1ca6dd++]=FafJKr[l(1693)](FafJKr[l(1341)](63,_0x2614a0),128);else{let v=this["_endpoin"+l(1676)]?.["getCurre"+l(1210)+"nt"](),A=this._options["reconnec"+l(1872)+l(1585)](p[l(1726)],p[l(1517)]);this["_dispatc"+l(1523)+l(1222)](pe(o[l(617)],{code:1006,reason:p.reason||l(1220)+l(1721)+l(428)+l(1105)+l(1511)+l(1364)+v,willReconnect:A})),A&&this[l(1254)]();return}if(o[l(502)](1e3,p[l(1726)])&&this[l(398)+l(1133)]){this[l(877)+l(1523)+l(1222)](pe(l(1314),{code:1e3,reason:o[l(835)]})),this["_endpoin"+l(1676)]?.[l(1828)+l(1582)+"fig"](),this[l(939)+"sCounter"]?.[l(949)+"nter"]();return}if(p[l(1726)]!==1e3&&k)if(o[l(1773)](o[l(1742)],o[l(1300)]))FafJKr[l(1700)](_0x34d565,_0x514d10,FafJKr[l(1792)](FafJKr[l(1284)](127,_0x3dfb71),128)),_0xa3bccc>>>=7;else{let v=this[l(1741)+l(1676)]?.[l(1372)+l(1210)+"nt"](),A=p.reason;A||(A=await o[l(1695)](oa,this._url)),A=l(1220)+"ng faile"+l(1080)+A+(", hostna"+l(892))+v+(l(1737)+l(1049)+l(1545)),this["_dispatchCloseEv"+l(1222)](pe(o[l(617)],{code:p[l(1726)],reason:A}));let T="connect "+v+(l(784)+"ax retri"+l(677)+"ed");this[l(877)+l(925)+"ent"](o[l(1329)](ue,"error",{message:T,code:Fe["MAX_RETR"+l(1213)+"R"]})),this[l(1741)+l(1676)]?.["resetEndpointCon"+l(1759)](),this[l(939)+l(1409)]?.[l(949)+"nter"]();return}if(p[l(1726)]!==1e3&&!p.reason){let v=this[l(1741)+l(1676)]?.[l(1372)+"ntEndpoint"]();this[l(877)+l(1523)+"ent"](o[l(841)](pe,o[l(617)],{code:p[l(1726)],reason:l(1220)+l(1721)+l(428)+l(1105)+l(1511)+"ame: "+v})),this[l(1741)+l(1676)]?.[l(1828)+l(1582)+l(1759)](),this[l(939)+"sCounter"]?.[l(949)+l(917)]();return}this["_dispatc"+l(1523)+l(1222)](p),this[l(1741)+l(1676)]?.[l(1828)+l(1582)+l(1759)](),this[l(939)+"sCounter"]?.["resetCou"+l(917)]()},this[n(1722)]=null,this[n(463)]=null,this.onmessage=null,this[n(1725)]=null,this["onStartR"+n(857)]=null,this["onReceiv"+n(1369)]=null,this["onStopIm"+n(1900)+n(987)+"ct"]=null,this[n(396)+n(1714)]=this._handleOnLine[n(953)](this),this["_handleO"+n(1478)]=this[n(396)+n(1478)][n(953)](this),this["_handleP"+n(507)]=this[n(491)+"ageHide"][n(953)](this),this[n(491)+"ageShow"]=this[n(491)+"ageShow"][n(953)](this),this[n(1871)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(907)](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.QKoLZ,pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e.vYpLc,env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:f}=t,g=Array[n(659)](c)?c:e[n(1780)](e[n(1414)],typeof c)?[c]:[];if(!g||g.length===0)throw new Error(n(1549)+"rovide v"+n(1487));if(!e[n(1277)](na,f))throw new Error(e.ShQCX);Object[n(1738)](this[n(1871)],t),this["_endpoin"+n(1676)]=new us(g,this._options[n(1770)+"es"]),this[n(939)+"sCounter"]=new ia(this[n(1871)][n(588)+n(645)]),this[n(1871)][n(1224)+"cOpen"]&&(this[n(908)]=!0,this[n(1254)]()),this[n(1871)][n(771)+n(1576)+"nged"]&&(this._isMiniTT||this[n(673)+"X"]?this[n(1870)+n(990)+n(453)]():this._isBrowser&&this[n(1422)+"balEventListener"]())}[r(396)+r(1714)](){let t=r;this._options[t(1544)+t(1604)+t(1500)]||this[t(398)+"osed"]||this["_handleR"+t(857)]()}[r(396)+r(1478)](){let t=r;this[t(1346)+t(786)+"t"]();let n=Qn(e.yjWdV,{message:"stop imm"+t(1703)+t(1481)+"ct"});this[t(983)+t(1900)+t(987)+"ct"]&&this[t(983)+t(1900)+t(987)+"ct"](n)}[r(1422)+r(1774)+r(1538)](){let t=r;this[t(1308)+"er"]&&window[t(1149)+t(1538)](e.TiRHO,this[t(396)+t(1714)]),this[t(1308)+"er"]&&window[t(1149)+t(1538)](e[t(1597)],this["_handleO"+t(1478)]),this._isBrowser&&window[t(1149)+"Listener"](e[t(1020)],this[t(491)+"ageHide"]),this[t(1308)+"er"]&&window[t(1149)+t(1538)](e[t(766)],this[t(491)+"ageShow"])}[r(1043)+r(1774)+r(1538)](){let t=r,n={FROny:t(1851)};if(e.wVPRn(e[t(1519)],e.PUEmD))switch(_0xaebddf){case sQoQwC.FROny:case t(1690):return{[t(556)+_0x2a770b]:1,"x-tt-env":_0x2f6d95};default:return{}}else this[t(1308)+"er"]&&window[t(938)+"entListener"](e[t(487)],this[t(396)+"nLine"]),this[t(1308)+"er"]&&window[t(938)+t(1425)+t(733)](t(1356),this[t(396)+t(1478)]),this[t(1308)+"er"]&&window[t(938)+t(1425)+t(733)](e[t(1020)],this[t(491)+"ageHide"]),this[t(1308)+"er"]&&window[t(938)+t(1425)+t(733)](e[t(766)],this[t(491)+t(393)])}[r(491)+r(507)](t){let n=r;!t[n(1185)+"d"]&&(this[n(1308)+"er"]&&window["removeEv"+n(1425)+n(733)](e.fMYhO,this[n(491)+n(507)]),this._isBrowser&&window[n(938)+n(1425)+n(733)](n(616),this[n(491)+n(393)]),this.close()),this[n(1308)+"er"]&&window[n(938)+"entListe"+n(733)](e[n(487)],this[n(396)+n(1714)]),this[n(1308)+"er"]&&window[n(938)+n(1425)+n(733)](e[n(1597)],this[n(396)+"ffLine"])}["_handleP"+r(393)](t){let n=r;t[n(1185)+"d"]&&(this[n(1225)+n(958)]()&&(!this[n(444)]||e[n(1333)](this._ws[n(1396)+"te"],this[n(1554)])||e[n(1205)](this[n(444)].readyState,this[n(1786)+"NG"]))&&this[n(396)+"nLine"](),this._isBrowser&&window[n(1149)+n(1538)](e[n(487)],this["_handleO"+n(1714)]),this[n(1308)+"er"]&&window[n(1149)+"Listener"]("offline",this[n(396)+n(1478)]))}async[r(824)+r(1743)](t){let n=r,{fpID:o,deviceID:c,bddID:f,ttwID:g,accessKey:p,aID:l,customParams:y={},enableAutoAck:k,enableQoS:v,QoSLevel:A,env:T}=this._options,G,M,X;if(this[n(1308)+"er"]||this[n(673)+"X"]||this._isMiniTT)if(e[n(477)]===e[n(477)])G=location&&e[n(1113)](e[n(1131)],location[n(731)])?e[n(770)]:e[n(498)],M=t[n(1493)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),X=/^wss(.*:\/\/)/[n(1702)](t)?t:""+G+M;else return this._socket[n(748)];else G=e[n(770)],M=t[n(1493)](/(^http)((?:[s]*:\/\/))/,""),X=/(^ws)((?:[s]*:\/\/))/[n(1702)](M)?M:""+G+M;let _s=f?n(432):g?e.tnucL:e[n(1647)],ys=f||g||c;if(e[n(793)](!ys,!_s))throw new Error(e.NGFiD);let za=e.EGBrn(e[n(1836)],typeof y)?await e[n(1793)](y):y,Fa=T?e[n(1471)](sa,T[n(1389)],T[n(866)]):{},ir=Object[n(1738)]({device_platform:e.PXQmB,version_code:e.tcVxy,access_key:p,fpid:o,aid:l,[_s]:ys,xsack:k?1:0,xaack:k?1:0,xsqos:v?1:0,qos_level:v?A:void 0,qos_sdk_version:2,...Fa},za),qa=Object[n(1480)](ir)[n(1852)]((or,ar)=>ir[ar]!==void 0?""+or+(or?"&":"?")+ar+"="+ir[ar]:or,"");return X+n(1403)+qa}async[r(1254)](){let t=r;if(!(this[t(1254)+t(688)]||this[t(398)+t(1133)])){this[t(1254)+t(688)]=!0;try{let n=this[t(1741)+t(1676)]?.[t(1580)+t(424)+"ointReac"+t(1135)+"tries"](),{timeoutInterval:o}=this[t(1871)];if(n){let f=this["_endpoin"+t(1676)]?.[t(1372)+"ntEndpoint"](),g=this[t(1741)+t(1676)]?.[t(1788)+t(769)+"pointAnd"+t(1092)+t(1370)](),p=this[t(1741)+t(1676)]?.[t(1372)+"ntEndpoi"+t(909)+t(1142)]();if(g){let l=t(995)+f+(t(1679)+t(1737)+t(1049)+"ached, will use "+t(1482)+t(1181))+g+(t(1039)+"y"),y=ue(t(533),{message:l,code:Fe["MAX_RETR"+t(1213)+"R"]});this[t(1424)](l),this[t(877)+t(925)+t(1222)](y),this[t(1348)]=await this[t(824)+t(1743)](g),this[t(1424)](t(995)+g+" "+p+t(1496)),this[t(1838)+"sListeners"]()}else{let l=t(995)+f+(t(1679)+t(1737)+"tries re"+t(1545));this._debug(l),this[t(877)+t(925)+t(1222)](e[t(1461)](ue,e[t(1877)],{message:l,code:Fe[t(395)+t(1213)+"R"]}));return}}else{let f=this[t(1741)+t(1676)]?.["getCurre"+t(1210)+t(1200)+t(706)](),g=this[t(1741)+t(1676)]?.[t(1372)+"ntEndpoi"+t(909)+t(1142)]();this[t(1348)]=await this[t(824)+t(1743)](e.qPLCJ(f,"")),this._debug(t(995)+f+" "+g+t(1496)),this["_removeW"+t(1470)+"rs"]()}if(this[t(908)])this._isInit=!1;else{let f=e.lelbj(Qn,e[t(1674)],{message:e[t(561)]});this[t(602)+t(857)]&&this[t(602)+t(857)](f)}let c=this._endpointManager?.[t(1372)+t(1210)+t(909)+t(1142)]()||0;e[t(1429)](c,1)&&await this._wait(e[t(1672)](c,1)),this[t(1424)](t(1220)+t(592)+this._url+(t(818)+t(973))+this[t(1540)+"ls"]),this._ws=e[t(613)](ta,{url:this[t(1348)],protocols:[this[t(1540)+"ls"]],headers:this[t(1871)][t(1334)+t(1706)+"s"][t(1475)+"tpHeader"]},this._options.ws),(this[t(1308)+"er"]||this._isWorker)&&this[t(444)]&&(this[t(444)][t(1590)+"pe"]=this[t(874)+"ype"]),this["_addWsLi"+t(620)](),this[t(1254)+t(603)+t(864)]=e[t(1854)](setTimeout,this[t(1168)+"ut"].bind(this),o)}catch(n){throw this[t(1254)+t(688)]=!1,n}}}[r(1021)+r(1344)](){let t=r;e[t(1293)](clearTimeout,this[t(1254)+t(603)+"utId"]),this["_connect"+t(603)+t(864)]=null}[r(1040)+r(1190)](){let t=r;e[t(552)](clearTimeout,this._pingPongTimeoutId),e[t(1527)](clearTimeout,this[t(1387)+t(1621)+"tId"]),this[t(1867)+t(386)+"Id"]=null,this[t(1387)+"ctTimeou"+t(1683)]=null}[r(1424)](...t){let n=r;this._options.debug&&console.log[n(1203)](console,[e.oAhWv,...t])}_getIntervalValue(t){let n=r,{initReconnectInterval:o,maxReconnectInterval:c,reconnectIntervalGrowFactor:f}=this[n(1871)],g=e[n(1579)](o,Math[n(952)](f,e.LCvVA(t,1)));return e[n(709)](g,c)?c:g}[r(1413)](){let t=r;if(this[t(444)]&&e.twoSS(this[t(444)][t(1396)+"te"],this[t(1786)+"NG"])){this[t(1040)+t(1190)](),this[t(1867)+t(386)+"Id"]=e[t(657)](setTimeout,this[t(1413)][t(953)](this),this[t(1871)][t(1671)+t(1178)]);return}if(!this[t(444)]||e[t(699)](this[t(444)][t(1396)+"te"],this[t(1554)]))return void this[t(1510)+t(857)]();this[t(444)]&&this[t(444)][t(1611)]("hi"),this[t(1387)+t(1621)+t(1683)]=e[t(641)](setTimeout,this[t(1510)+t(857)+t(763)].bind(this),this[t(1871)][t(493)+"outInter"+t(1419)])}["_handleR"+r(857)+"Timeout"](){let t=r;this[t(939)+t(1409)]?.[t(495)](),this[t(806)](e[t(1132)],t(1398)),this._pingLossCounter?.[t(1350)+t(1215)+"nt"]()?this[t(1510)+"econnect"]():this._ping()}[r(1225)+r(958)](){let t=r;return this[t(802)+"T"]||this[t(673)+"X"]?this[t(1418)+t(1383)+t(647)]:(this[t(1308)+"er"]||this[t(1380)+"r"])&&this[t(1871)][t(771)+"tworkCha"+t(484)]?navigator[t(1550)]:!0}[r(1510)+"econnect"](){let t=r;!this["_navigat"+t(958)]()||this[t(398)+t(1133)]||(this[t(1741)+"tManager"]?.resetEndpointConfig(),this[t(939)+t(1409)]?.[t(949)+t(917)](),this[t(444)]?this[t(448)+t(1297)](1001,e[t(1874)],!0):this[t(1254)]())}[r(1870)+"etWorkCh"+r(453)](){let t=r,n={TdYGL:function(o,c){return e[P(578)](o,c)}};this._isMiniTT?tt[t(447)+t(955)+t(1555)](({isConnected:o})=>{let c=t;if(e.YgyaE(e[c(713)],e[c(713)]))this["_miniNav"+c(1383)+c(647)]=o,o?this[c(396)+c(1714)]():this[c(396)+"ffLine"]();else{let f=this[c(679)][c(504)](this[c(1353)]),g=_0x4de035[c(1525)](WHXqeu[c(1537)](f,"{}"));return g[_0x3c1e04]=void 0,this[c(679)].setItem(this[c(1353)],_0x3b9fc8[c(438)+"y"](g))}}):this._isMiniWX&&wx[t(447)+"kStatusC"+t(1555)](({isConnected:o})=>{let c=t;this[c(1418)+c(1383)+c(647)]=o,o?this["_handleO"+c(1714)]():this["_handleO"+c(1478)]()})}_wait(t){return new Promise(n=>{let o=P;setTimeout(n,this[o(606)+o(1008)+"e"](t))})}[r(448)+r(1297)](t=1e3,n="",o=!1){let c=r;this._ws&&this[c(1346)+"WebSocket"](t,n,o)}_onTimeout(){let t=r,n=this[t(1741)+t(1676)]?.[t(1372)+t(1210)+"nt"]();this[t(1424)](t(995)+n+t(1679)),this[t(448)+t(1297)](1001,e[t(1638)],!0)}[r(417)](t){let n=r,o=e[n(1074)]($n,t);this._ws&&e[n(1102)](this[n(444)].readyState,this.OPEN)&&(this[n(444)]&&this[n(444)].send(o),this[n(1424)](e[n(941)],t))}["_removeW"+r(1470)+"rs"](){let t=r;this[t(444)]&&(this._ws["removeEv"+t(1425)+"ner"](e[t(1631)],this._onOpen),this[t(444)][t(938)+t(1425)+t(733)](t(1314),this._onClose),this[t(444)][t(938)+t(1425)+t(733)](e[t(640)],this[t(1103)+"ge"]),this[t(444)][t(938)+t(1425)+t(733)]("error",this[t(1352)]))}[r(829)+r(620)](){let t=r;this._ws&&(this[t(444)][t(1149)+t(1538)](t(1875),this._onOpen),this[t(444)]["addEvent"+t(1538)](e[t(1651)],this[t(1613)]),this[t(444)].addEventListener(e[t(640)],this[t(1103)+"ge"]),this._ws[t(1149)+t(1538)](e[t(1877)],this[t(1352)]))}["_wsInsta"+r(779)](t=1e3,n=""){let o=r;try{this._ws&&this[o(444)].close(t,n)}catch{}}["_destroy"+r(786)+"t"](t=1e3,n="",o=!1){let c=r;if(this[c(1040)+c(1190)](),this[c(1021)+"mer"](),this[c(1838)+c(1470)+"rs"](),this[c(799)+c(779)](1e3,n),this[c(1254)+c(688)]=!1,o&&this[c(1225)+"orOnline"]()&&!this[c(398)+c(1133)])if(e.XJQQU(e.Fofiv,e[c(1283)])){if(this[c(1741)+c(1676)]?.[c(1350)+"chMaxTries"]()){let g=this[c(1741)+c(1676)]?.[c(1372)+c(1210)+"nt"]();this[c(877)+c(1523)+c(1222)](e[c(692)](pe,c(1314),{code:1006,reason:c(995)+g+(c(1679)+", max re"+c(1049)+c(1545)),wasClean:!0}))}else if(e.zpRKn(e.QCBLj,e[c(980)])){let g=this._options[c(1530)+c(1872)+"ptor"](t,n);this["_dispatc"+c(1523)+c(1222)](pe(e[c(1651)],{code:t,reason:n,wasClean:!0,willReconnect:g})),g&&this[c(1254)]()}else this["currentI"+c(388)]=0,this[c(1489)+c(654)+c(1338)+"t"]=0;return}else return _0x1abb14||(_0x1bf37c=[_0x41a6a9.prototype[c(1388)],_0x3a6627[c(1268)+"e"][c(1104)],_0xbc0b6c[c(1268)+"e"].continuePrimaryKey]);this[c(1225)+c(958)]()||this[c(398)+"osed"]?this[c(877)+c(1523)+c(1222)](e.JVJkD(pe,"close",{code:t,reason:c(406)})):this[c(877)+c(1523)+c(1222)](e[c(594)](pe,e[c(1651)],{code:1006,reason:e[c(1551)]})),this[c(444)]=null,this[c(1741)+c(1676)]?.[c(1828)+"pointCon"+c(1759)](),this[c(939)+c(1409)]?.[c(949)+c(917)]()}[r(877)+r(1458)+"nt"](t){let n=r;this[n(806)](e[n(1631)],t),this[n(1725)]&&this[n(1725)](t)}[r(877)+r(1271)+r(883)](t){let n=r;this.emit(e[n(640)],t),this[n(823)+"e"]&&this[n(823)+"e"](t)}[r(877)+r(711)+r(1599)](t){let n=r;this[n(806)](e.SJnwz,t),this[n(891)+n(1369)]&&this[n(891)+n(1369)](t)}[r(877)+r(925)+r(1222)](t){let n=r;this[n(806)](n(533),t),this[n(463)]&&this[n(463)](t)}[r(877)+r(1523)+r(1222)](t){let n=r;this.emit(n(1314),t),this[n(1722)]&&this.onclose(t)}get binaryType(){let t=r;return this._ws?this[t(444)][t(1590)+"pe"]:this["_binaryT"+t(1114)]}set[r(1590)+"pe"](t){let n=r;this[n(874)+n(1114)]=t,this._ws&&(this[n(444)][n(1590)+"pe"]=t)}get[r(795)+"nt"](){let t=r;return this[t(1741)+t(1676)]?.[t(1372)+"ntEndpoi"+t(909)+"ount"]()||0}get["buffered"+r(461)](){let t=r;return this[t(1051)+t(1077)].reduce((o,c)=>(o+=c&&c.byteLength||0,o),0)+(this[t(444)]?this[t(444)]["buffered"+t(461)]:0)}get[r(871)+"ns"](){let t=r;return this[t(444)]?this[t(444)][t(871)+"ns"]:""}get[r(731)](){let t=r;return this[t(444)]?this._ws[t(731)]:""}get[r(1396)+"te"](){let t=r;return this[t(444)]?this[t(444)][t(1396)+"te"]:this[t(1871)][t(1224)+t(1757)]?this[t(1786)+"NG"]:this[t(946)]}get[r(748)](){let t=r;return this[t(444)]?this[t(444)][t(748)]:this[t(1348)]}[r(1314)](t=1e3,n){let o=r,c=(o(1691)+o(776))[o(862)]("|"),f=0;for(;;){switch(c[f++]){case"0":this["_clearPi"+o(1190)]();continue;case"1":this[o(1043)+"balEvent"+o(1538)]();continue;case"2":this[o(1346)+o(786)+"t"](t,n);continue;case"3":if(!this[o(444)])return void this[o(1424)](o(545)+o(387)+"ce not i"+o(1839)+"ed");continue;case"4":if(e.DUfaG(this[o(444)][o(1396)+"te"],this[o(946)])||this[o(444)].readyState===this[o(1831)])return void this._debug(e.EuYOi);continue;case"5":this[o(1021)+o(1344)]();continue;case"6":this._QoSManager?.[o(1704)]();continue;case"7":this[o(398)+"osed"]=!0;continue}break}}async[r(1611)](t,n){let o=r,c={UzVFM:function(f,g){return e[P(1050)](f,g)},Frjbp:e[o(1767)],yIIsr:o(1665)+o(932),tFBKa:function(f,g){return e[o(1161)](f,g)},sxoSY:e[o(1097)],EMPYi:function(f,g,p){return e.rsyIF(f,g,p)},auJKo:function(f,g,p){return e[o(684)](f,g,p)}};if(e[o(1716)]===e[o(642)]){let f=_0x1dff97[o(596)+o(1420)](sgxtvQ.Frjbp);_0x1c49ea["frontier"+o(1639)]=g=>{let p=o;_0x3ade73[p(1457)][p(525)+p(884)](f),_0x469e98["frontier"+p(1639)]=void 0,sgxtvQ[p(666)](_0x1514e9,g&&g.msg||p(1518)+p(1517))},f[o(1433)]=sgxtvQ.yIIsr,f[o(842)]=sgxtvQ[o(633)](_0x2df7be.replace(/^ws/,sgxtvQ[o(920)]),o(1122)+o(1057)+"tierJSONP");try{_0x4386c9[o(1457)][o(1499)+o(884)](f)}catch{_0x6c27ee.body["removeCh"+o(884)](f)}}else{if(e.PjPcd(null,t))throw new Error(e[o(1410)]);e[o(548)]==typeof t&&(t=JSON[o(438)+"y"](t)),e[o(1846)](o(551),typeof t)&&!e[o(868)](t,ArrayBuffer)&&!(t[o(1548)]&&e[o(1602)](t.buffer,ArrayBuffer))&&(t=JSON.stringify(t));let f=await e[o(1826)](hs,t),g=ra(t),{method:p=0,service:l=this[o(1871)].service,logID:y=this[o(1871)][o(427)+o(1760)](),headers:k=this[o(1871)][o(934)],payloadEncoding:v=this._options["payloadE"+o(1183)],payloadType:A=this._options[o(1685)+o(1114)],logIDNew:T=this[o(1871)]["logIDNew"+o(1558)][o(480)+o(629)+o(643)+"ew"]?e.YXkPb(a,this[o(1871)]["logIDNew"+o(1558)][o(1816)]):""}=e[o(1801)](n,{});if(!l)throw new Error(e.xmVXT);let G={SeqID:O[o(652)+"er"](this[o(1490)]++),LogID:O[o(652)+"er"](y),service:l,method:p,headers:k,payloadEncoding:e[o(1856)](v,Object)?v[o(1803)]?v[o(1803)]:"":v,payloadType:e[o(419)](A,Object)?A[o(1433)]?A[o(1433)]:g:A||g,payload:f,LogIDNew:T},M=e[o(901)]($n,G);return this[o(444)]&&e[o(1408)](this._ws[o(1396)+"te"],this.OPEN)?(this[o(444)]&&this[o(444)][o(1611)](M),this[o(1424)](e[o(913)],G)):e[o(1698)](this[o(1051)+o(1077)][o(1843)],this._options[o(719)+o(814)+"ength"])?e[o(1167)]("rTnCp",e[o(723)])?(sgxtvQ[o(1606)](_0x3590d9,_0x3888d9,50),sgxtvQ[o(1879)](_0x5f01fa,_0x441fc2,_0x16ddbb)):(this[o(1051)+"Queue"].push(M),this[o(1424)](e[o(1761)],G)):(this[o(1051)+o(1077)][o(678)](),this[o(1051)+"Queue"][o(483)](M)),{seqID:this[o(1490)],logID:y,logIDNew:T}}}async[r(1530)+"t"](t){let n=r,{url:o}=e.nZAih(t,{}),c=Array[n(659)](o)?o:e[n(933)](e[n(1414)],typeof o)?[o]:[];t&&Object.assign(this[n(1871)],t),c&&c[n(1843)]?this[n(1741)+"tManager"]=new us(c,this[n(1871)][n(1770)+"es"]):this._endpointManager?.[n(1828)+n(1582)+n(1759)](),this["_pingLos"+n(1409)]?.["resetCou"+n(917)](this[n(1871)][n(588)+n(645)]),this[n(398)+n(1133)]=!1,this[n(444)]&&e[n(919)](this[n(444)][n(1396)+"te"],this[n(946)])?this[n(448)+n(1297)](1e3,e[n(1063)],!0):(this._isInit=!0,this._connect())}async connect(){let t=r;if(!this[t(1254)+t(688)]){let n=e.PyANF.split("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(1741)+t(1676)]?.[t(1828)+t(1582)+t(1759)]();continue;case"1":this[t(908)]=!0;continue;case"2":this[t(939)+"sCounter"]?.[t(949)+t(917)]();continue;case"3":this["_readyCl"+t(1133)]=!1;continue;case"4":this[t(1254)]();continue}break}}}[r(1149)+"Listener"](t,n){this.on(t,n)}[r(1267)+r(883)](t){let n=r;if(e[n(1221)]("RALAP",e[n(663)])){let{type:o}=t;this.emit(o,t)}else{let o=_0x4e8423[n(1858)]();return o?(o[n(646)]=o.limit=0,o):{bytes:new _0x4f0c60(64),offset:0,limit:0}}}["removeEv"+r(1425)+r(733)](t,n){this[r(831)](t,n)}[r(1128)](){let t=r,n={GFDFj:e[t(537)],XpGpw:function(o,c){return o!=c},Imqlg:function(o,c){return e.QrUOq(o,c)},Bdjvo:e[t(1038)],mrQMZ:e[t(1790)],BlfEq:t(1238)+t(1509)+"s"};return new Promise((o,c)=>{let f=t,g={ylITT:function(y,k){return y(k)},WYgyh:e[f(1320)],jyVUB:f(1238)+f(1509)+"s",GNcor:f(1238)+"e_timeout"};this[f(1040)+f(1190)](),this[f(1867)+f(386)+"Id"]=e[f(1686)](setTimeout,this[f(1413)][f(953)](this),this[f(1871)].pingInterval);let p=()=>{let y=f,k={wyDnH:function(v,A){return v||A},vkFhJ:function(v,A){return v!=A},sggVP:n[y(1515)],LJUBr:function(v,A){return n[y(1340)](v,A)}};if(n[y(576)](y(1378),n[y(1299)])){if(tIkiUj[y(1351)](_0x2b84b1,_0x178b10))return new _0x404d2f(_0x5093a4,_0x444729);if(tIkiUj.wyDnH(_0x2dee9e,_0x3398f4)&&tIkiUj[y(649)](tIkiUj[y(665)],typeof _0x27eba3))return new _0x82f157(_0x1ff8ad,_0x253d97);if(tIkiUj[y(1351)](_0x8489fe,_0x456be6)&&tIkiUj[y(1371)](tIkiUj.sggVP,typeof _0x15c573))return new _0x195939(_0x3bf7d8,_0x3edac4);throw new _0x43a4e5(y(996)+y(1319)+"d")}else o(n[y(1347)]),this[y(831)](n[y(1121)],p),this.off(y(1238)+"e_timeout",l)},l=()=>{let y=f;g[y(1614)](c,g[y(1673)]),this[y(831)](g[y(574)],p),this[y(831)](g[y(918)],l)};this.on(e[f(931)],p),this.on(f(1238)+f(632)+"t",l),this._ping()})}}})(),Q[S(880)+S(627)]=$[S(880)+"oseEvent"],Q[S(505)+S(1287)]=$[S(505)+"rorEvent"],Q[S(1059)+"e"]=$[S(1059)+"e"],Q[S(883)]=$.Event,Q.FWS=$[S(410)],Q[S(1782)+S(1028)+"vent"]=$[S(1782)+S(1028)+"vent"],Q[S(1028)+S(1522)]=$["MessageE"+S(1522)],Q.OpenEvent=$.OpenEvent,Q[S(797)+"tEvent"]=$[S(797)+S(536)],Q[S(1882)+"oseEvent"]=$[S(1882)+S(627)],Q[S(1732)+S(1287)]=$["createEr"+S(1287)],Q[S(610)+"ssageEvent"]=$[S(610)+S(1503)+"nt"],Q[S(1179)+S(746)]=$[S(1179)+S(746)],Q[S(1891)+"connectE"+S(1522)]=$[S(1891)+S(1109)+S(1522)],Q[S(1186)+S(1896)]=$[S(1186)+"rame"],Q[S(1269)+S(989)]=$[S(1269)+S(989)];for(mn in $)[S(880)+S(627),S(505)+S(1287),"ErrorCode",S(883),S(410),"Frontier"+S(1028)+S(1522),"MessageE"+S(1522),S(618)+"t",S(797)+S(536),S(1882)+S(627),"createErrorEvent",S(610)+S(1503)+"nt",S(1179)+S(746),S(1891)+"connectE"+S(1522),S(1186)+S(1896),S(1269)+"ame"][S(397)](mn)===-1&&(Q[mn]=$[mn]);var mn;Object.defineProperty(Q,S(1795)+"le",{value:!0})});var Ne=se((bl,li)=>{"use strict";var fi=["nodebuffer","arraybuffer","fragments"],di=typeof Blob<"u";di&&fi.push("blob");li.exports={BINARY_TYPES:fi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:di,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Lt=se((vl,En)=>{"use strict";var{EMPTY_BUFFER:Tc}=Ne(),mr=Buffer[Symbol.species];function Lc(r,e){if(r.length===0)return Tc;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let x=0;x<r.length;x++){let u=r[x];i.set(u,a),a+=u.length}return a<e?new mr(i.buffer,i.byteOffset,a):i}function hi(r,e,i,a,x){for(let u=0;u<x;u++)i[a+u]=r[u]^e[u&3]}function gi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function Rc(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function wr(r){if(wr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new mr(r):ArrayBuffer.isView(r)?e=new mr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),wr.readOnly=!1),e}En.exports={concat:Lc,mask:hi,toArrayBuffer:Rc,toBuffer:wr,unmask:gi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=Y("bufferutil");En.exports.mask=function(e,i,a,x,u){u<48?hi(e,i,a,x,u):r.mask(e,i,a,x,u)},En.exports.unmask=function(e,i){e.length<32?gi(e,i):r.unmask(e,i)}}catch{}});var wi=se((Sl,mi)=>{"use strict";var pi=Symbol("kDone"),_r=Symbol("kRun"),yr=class{constructor(e){this[pi]=()=>{this.pending--,this[_r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[_r]()}[_r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[pi])}}};mi.exports=yr});var lt=se((El,vi)=>{"use strict";var Rt=Y("zlib"),_i=Lt(),Nc=wi(),{kStatusCode:yi}=Ne(),Oc=Buffer[Symbol.species],Bc=Buffer.from([0,0,255,255]),An=Symbol("permessage-deflate"),Oe=Symbol("total-length"),ft=Symbol("callback"),Ge=Symbol("buffers"),dt=Symbol("error"),Cn,br=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,!Cn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Cn=new Nc(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[ft];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 u=+x;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=u}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let u=+x;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=u}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){Cn.add(x=>{this._decompress(e,i,(u,d)=>{x(),a(u,d)})})}compress(e,i,a){Cn.add(x=>{this._compress(e,i,(u,d)=>{x(),a(u,d)})})}_decompress(e,i,a){let x=this._isServer?"client":"server";if(!this._inflate){let u=`${x}_max_window_bits`,d=typeof this.params[u]!="number"?Rt.Z_DEFAULT_WINDOWBITS:this.params[u];this._inflate=Rt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:d}),this._inflate[An]=this,this._inflate[Oe]=0,this._inflate[Ge]=[],this._inflate.on("error",zc),this._inflate.on("data",bi)}this._inflate[ft]=a,this._inflate.write(e),i&&this._inflate.write(Bc),this._inflate.flush(()=>{let u=this._inflate[dt];if(u){this._inflate.close(),this._inflate=null,a(u);return}let d=_i.concat(this._inflate[Ge],this._inflate[Oe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Oe]=0,this._inflate[Ge]=[],i&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,d)})}_compress(e,i,a){let x=this._isServer?"server":"client";if(!this._deflate){let u=`${x}_max_window_bits`,d=typeof this.params[u]!="number"?Rt.Z_DEFAULT_WINDOWBITS:this.params[u];this._deflate=Rt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:d}),this._deflate[Oe]=0,this._deflate[Ge]=[],this._deflate.on("data",Mc)}this._deflate[ft]=a,this._deflate.write(e),this._deflate.flush(Rt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let u=_i.concat(this._deflate[Ge],this._deflate[Oe]);i&&(u=new Oc(u.buffer,u.byteOffset,u.length-4)),this._deflate[ft]=null,this._deflate[Oe]=0,this._deflate[Ge]=[],i&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,u)})}};vi.exports=br;function Mc(r){this[Ge].push(r),this[Oe]+=r.length}function bi(r){if(this[Oe]+=r.length,this[An]._maxPayload<1||this[Oe]<=this[An]._maxPayload){this[Ge].push(r);return}this[dt]=new RangeError("Max payload size exceeded"),this[dt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[dt][yi]=1009,this.removeListener("data",bi),this.reset()}function zc(r){if(this[An]._inflate=null,this[dt]){this[ft](this[dt]);return}r[yi]=1007,this[ft](r)}});var ht=se((Cl,kn)=>{"use strict";var{isUtf8:Si}=Y("buffer"),{hasBlob:Fc}=Ne(),qc=[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 Uc(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function vr(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 Kc(r){return Fc&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}kn.exports={isBlob:Kc,isValidStatusCode:Uc,isValidUTF8:vr,tokenChars:qc};if(Si)kn.exports.isValidUTF8=function(r){return r.length<24?vr(r):Si(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=Y("utf-8-validate");kn.exports.isValidUTF8=function(e){return e.length<32?vr(e):r(e)}}catch{}});var kr=se((Al,Di)=>{"use strict";var{Writable:Hc}=Y("stream"),Ei=lt(),{BINARY_TYPES:Gc,EMPTY_BUFFER:Ci,kStatusCode:jc,kWebSocket:Wc}=Ne(),{concat:Sr,toArrayBuffer:Jc,unmask:Vc}=Lt(),{isValidStatusCode:Yc,isValidUTF8:Ai}=ht(),Pn=Buffer[Symbol.species],fe=0,ki=1,Pi=2,Ii=3,Er=4,Cr=5,In=6,Ar=class extends Hc{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Gc[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Wc]=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=fe}_write(e,i,a){if(this._opcode===8&&this._state==fe)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 Pn(a.buffer,a.byteOffset+e,a.length-e),new Pn(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 Pn(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 fe:this.getInfo(e);break;case ki:this.getPayloadLength16(e);break;case Pi:this.getPayloadLength64(e);break;case Ii:this.getMask();break;case Er:this.getData(e);break;case Cr:case In: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[Ei.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=ki:this._payloadLength===127?this._state=Pi: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=Ii:this._state=Er}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Er}getData(e){let i=Ci;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&&Vc(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=Cr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Ei.extensionName].decompress(e,this._fin,(x,u)=>{if(x)return i(x);if(u.length){if(this._messageLength+=u.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let d=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(d);return}this._fragments.push(u)}this.dataMessage(i),this._state===fe&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=fe;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=Sr(a,i):this._binaryType==="arraybuffer"?x=Jc(Sr(a,i)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=fe):(this._state=In,setImmediate(()=>{this.emit("message",x,!0),this._state=fe,this.startLoop(e)}))}else{let x=Sr(a,i);if(!this._skipUTF8Validation&&!Ai(x)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(u);return}this._state===Cr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=fe):(this._state=In,setImmediate(()=>{this.emit("message",x,!1),this._state=fe,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Ci),this.end();else{let a=e.readUInt16BE(0);if(!Yc(a)){let u=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(u);return}let x=new Pn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Ai(x)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(u);return}this._loop=!1,this.emit("conclude",a,x),this.end()}this._state=fe;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=fe):(this._state=In,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=fe,this.startLoop(i)}))}createError(e,i,a,x,u){this._loop=!1,this._errored=!0;let d=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(d,this.createError),d.code=u,d[jc]=x,d}};Di.exports=Ar});var Dr=se((Pl,Ri)=>{"use strict";var{Duplex:kl}=Y("stream"),{randomFillSync:$c}=Y("crypto"),Ti=lt(),{EMPTY_BUFFER:Qc,kWebSocket:Xc,NOOP:Zc}=Ne(),{isBlob:gt,isValidStatusCode:ex}=ht(),{mask:Li,toBuffer:$e}=Lt(),de=Symbol("kByteLength"),tx=Buffer.alloc(4),Dn=8*1024,Qe,pt=Dn,we=0,nx=1,rx=2,Pr=class r{constructor(e,i,a){this._extensions=i||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=we,this.onerror=Zc,this[Xc]=void 0}static frame(e,i){let a,x=!1,u=2,d=!1;i.mask&&(a=i.maskBuffer||tx,i.generateMask?i.generateMask(a):(pt===Dn&&(Qe===void 0&&(Qe=Buffer.alloc(Dn)),$c(Qe,0,Dn),pt=0),a[0]=Qe[pt++],a[1]=Qe[pt++],a[2]=Qe[pt++],a[3]=Qe[pt++]),d=(a[0]|a[1]|a[2]|a[3])===0,u=6);let h;typeof e=="string"?(!i.mask||d)&&i[de]!==void 0?h=i[de]:(e=Buffer.from(e),h=e.length):(h=e.length,x=i.mask&&i.readOnly&&!d);let m=h;h>=65536?(u+=8,m=127):h>125&&(u+=2,m=126);let w=Buffer.allocUnsafe(x?h+u:u);return w[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(w[0]|=64),w[1]=m,m===126?w.writeUInt16BE(h,2):m===127&&(w[2]=w[3]=0,w.writeUIntBE(h,4,6)),i.mask?(w[1]|=128,w[u-4]=a[0],w[u-3]=a[1],w[u-2]=a[2],w[u-1]=a[3],d?[w,e]:x?(Li(e,a,w,u,h),[w]):(Li(e,a,e,0,h),[w,e])):[w,e]}close(e,i,a,x){let u;if(e===void 0)u=Qc;else{if(typeof e!="number"||!ex(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)u=Buffer.allocUnsafe(2),u.writeUInt16BE(e,0);else{let h=Buffer.byteLength(i);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");u=Buffer.allocUnsafe(2+h),u.writeUInt16BE(e,0),typeof i=="string"?u.write(i,2):u.set(i,2)}}let d={[de]:u.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==we?this.enqueue([this.dispatch,u,!1,d,x]):this.sendFrame(r.frame(u,d),x)}ping(e,i,a){let x,u;if(typeof e=="string"?(x=Buffer.byteLength(e),u=!1):gt(e)?(x=e.size,u=!1):(e=$e(e),x=e.length,u=$e.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[de]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:u,rsv1:!1};gt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==we?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}pong(e,i,a){let x,u;if(typeof e=="string"?(x=Buffer.byteLength(e),u=!1):gt(e)?(x=e.size,u=!1):(e=$e(e),x=e.length,u=$e.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[de]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:u,rsv1:!1};gt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==we?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}send(e,i,a){let x=this._extensions[Ti.extensionName],u=i.binary?2:1,d=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):gt(e)?(h=e.size,m=!1):(e=$e(e),h=e.length,m=$e.readOnly),this._firstFragment?(this._firstFragment=!1,d&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=h>=x._threshold),this._compress=d):(d=!1,u=0),i.fin&&(this._firstFragment=!0);let w={[de]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:u,readOnly:m,rsv1:d};gt(e)?this._state!==we?this.enqueue([this.getBlobData,e,this._compress,w,a]):this.getBlobData(e,this._compress,w,a):this._state!==we?this.enqueue([this.dispatch,e,this._compress,w,a]):this.dispatch(e,this._compress,w,a)}getBlobData(e,i,a,x){this._bufferedBytes+=a[de],this._state=rx,e.arrayBuffer().then(u=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Ir,this,h,x);return}this._bufferedBytes-=a[de];let d=$e(u);i?this.dispatch(d,i,a,x):(this._state=we,this.sendFrame(r.frame(d,a),x),this.dequeue())}).catch(u=>{process.nextTick(sx,this,u,x)})}dispatch(e,i,a,x){if(!i){this.sendFrame(r.frame(e,a),x);return}let u=this._extensions[Ti.extensionName];this._bufferedBytes+=a[de],this._state=nx,u.compress(e,a.fin,(d,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Ir(this,m,x);return}this._bufferedBytes-=a[de],this._state=we,a.readOnly=!1,this.sendFrame(r.frame(h,a),x),this.dequeue()})}dequeue(){for(;this._state===we&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][de],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][de],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)}};Ri.exports=Pr;function Ir(r,e,i){typeof i=="function"&&i(e);for(let a=0;a<r._queue.length;a++){let x=r._queue[a],u=x[x.length-1];typeof u=="function"&&u(e)}}function sx(r,e,i){Ir(r,e,i),r.onerror(e)}});var Ki=se((Il,Ui)=>{"use strict";var{kForOnEventAttribute:Nt,kListener:Tr}=Ne(),Ni=Symbol("kCode"),Oi=Symbol("kData"),Bi=Symbol("kError"),Mi=Symbol("kMessage"),zi=Symbol("kReason"),mt=Symbol("kTarget"),Fi=Symbol("kType"),qi=Symbol("kWasClean"),Be=class{constructor(e){this[mt]=null,this[Fi]=e}get target(){return this[mt]}get type(){return this[Fi]}};Object.defineProperty(Be.prototype,"target",{enumerable:!0});Object.defineProperty(Be.prototype,"type",{enumerable:!0});var Xe=class extends Be{constructor(e,i={}){super(e),this[Ni]=i.code===void 0?0:i.code,this[zi]=i.reason===void 0?"":i.reason,this[qi]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[Ni]}get reason(){return this[zi]}get wasClean(){return this[qi]}};Object.defineProperty(Xe.prototype,"code",{enumerable:!0});Object.defineProperty(Xe.prototype,"reason",{enumerable:!0});Object.defineProperty(Xe.prototype,"wasClean",{enumerable:!0});var wt=class extends Be{constructor(e,i={}){super(e),this[Bi]=i.error===void 0?null:i.error,this[Mi]=i.message===void 0?"":i.message}get error(){return this[Bi]}get message(){return this[Mi]}};Object.defineProperty(wt.prototype,"error",{enumerable:!0});Object.defineProperty(wt.prototype,"message",{enumerable:!0});var Ot=class extends Be{constructor(e,i={}){super(e),this[Oi]=i.data===void 0?null:i.data}get data(){return this[Oi]}};Object.defineProperty(Ot.prototype,"data",{enumerable:!0});var ix={addEventListener(r,e,i={}){for(let x of this.listeners(r))if(!i[Nt]&&x[Tr]===e&&!x[Nt])return;let a;if(r==="message")a=function(u,d){let h=new Ot("message",{data:d?u:u.toString()});h[mt]=this,Tn(e,this,h)};else if(r==="close")a=function(u,d){let h=new Xe("close",{code:u,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[mt]=this,Tn(e,this,h)};else if(r==="error")a=function(u){let d=new wt("error",{error:u,message:u.message});d[mt]=this,Tn(e,this,d)};else if(r==="open")a=function(){let u=new Be("open");u[mt]=this,Tn(e,this,u)};else return;a[Nt]=!!i[Nt],a[Tr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Tr]===e&&!i[Nt]){this.removeListener(r,i);break}}};Ui.exports={CloseEvent:Xe,ErrorEvent:wt,Event:Be,EventTarget:ix,MessageEvent:Ot};function Tn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Ln=se((Dl,Hi)=>{"use strict";var{tokenChars:Bt}=ht();function Ae(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function ox(r){let e=Object.create(null),i=Object.create(null),a=!1,x=!1,u=!1,d,h,m=-1,w=-1,b=-1,_=0;for(;_<r.length;_++)if(w=r.charCodeAt(_),d===void 0)if(b===-1&&Bt[w]===1)m===-1&&(m=_);else if(_!==0&&(w===32||w===9))b===-1&&m!==-1&&(b=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);b===-1&&(b=_);let L=r.slice(m,b);w===44?(Ae(e,L,i),i=Object.create(null)):d=L,m=b=-1}else throw new SyntaxError(`Unexpected character at index ${_}`);else if(h===void 0)if(b===-1&&Bt[w]===1)m===-1&&(m=_);else if(w===32||w===9)b===-1&&m!==-1&&(b=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);b===-1&&(b=_),Ae(i,r.slice(m,b),!0),w===44&&(Ae(e,d,i),i=Object.create(null),d=void 0),m=b=-1}else if(w===61&&m!==-1&&b===-1)h=r.slice(m,_),m=b=-1;else throw new SyntaxError(`Unexpected character at index ${_}`);else if(x){if(Bt[w]!==1)throw new SyntaxError(`Unexpected character at index ${_}`);m===-1?m=_:a||(a=!0),x=!1}else if(u)if(Bt[w]===1)m===-1&&(m=_);else if(w===34&&m!==-1)u=!1,b=_;else if(w===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${_}`);else if(w===34&&r.charCodeAt(_-1)===61)u=!0;else if(b===-1&&Bt[w]===1)m===-1&&(m=_);else if(m!==-1&&(w===32||w===9))b===-1&&(b=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);b===-1&&(b=_);let L=r.slice(m,b);a&&(L=L.replace(/\\/g,""),a=!1),Ae(i,h,L),w===44&&(Ae(e,d,i),i=Object.create(null),d=void 0),h=void 0,m=b=-1}else throw new SyntaxError(`Unexpected character at index ${_}`);if(m===-1||u||w===32||w===9)throw new SyntaxError("Unexpected end of input");b===-1&&(b=_);let C=r.slice(m,b);return d===void 0?Ae(e,C,i):(h===void 0?Ae(i,C,!0):a?Ae(i,h,C.replace(/\\/g,"")):Ae(i,h,C),Ae(e,d,i)),e}function ax(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 u=a[x];return Array.isArray(u)||(u=[u]),u.map(d=>d===!0?x:`${x}=${d}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Hi.exports={format:ax,parse:ox}});var Bn=se((Rl,to)=>{"use strict";var cx=Y("events"),xx=Y("https"),ux=Y("http"),Wi=Y("net"),fx=Y("tls"),{randomBytes:dx,createHash:lx}=Y("crypto"),{Duplex:Tl,Readable:Ll}=Y("stream"),{URL:Lr}=Y("url"),je=lt(),hx=kr(),gx=Dr(),{isBlob:px}=ht(),{BINARY_TYPES:Gi,CLOSE_TIMEOUT:mx,EMPTY_BUFFER:Rn,GUID:_x,kForOnEventAttribute:Rr,kListener:yx,kStatusCode:bx,kWebSocket:Z,NOOP:Ji}=Ne(),{EventTarget:{addEventListener:vx,removeEventListener:Sx}}=Ki(),{format:Ex,parse:Cx}=Ln(),{toBuffer:Ax}=Lt(),Vi=Symbol("kAborted"),Nr=[8,13],Me=["CONNECTING","OPEN","CLOSING","CLOSED"],kx=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,F=class r extends cx{constructor(e,i,a){super(),this._binaryType=Gi[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Rn,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]),Yi(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Gi.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 hx({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),u=new gx(e,this._extensions,a.generateMask);this._receiver=x,this._sender=u,this._socket=e,x[Z]=this,u[Z]=this,e[Z]=this,x.on("conclude",Dx),x.on("drain",Tx),x.on("error",Lx),x.on("message",Rx),x.on("ping",Nx),x.on("pong",Ox),u.onerror=Bx,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",Xi),e.on("data",On),e.on("end",Zi),e.on("error",eo),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){xe(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())}),Qi(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){Or(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Rn,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){Or(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Rn,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){Or(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[je.extensionName]||(x.compress=!1),this._sender.send(e||Rn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){xe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(F,"CONNECTING",{enumerable:!0,value:Me.indexOf("CONNECTING")});Object.defineProperty(F.prototype,"CONNECTING",{enumerable:!0,value:Me.indexOf("CONNECTING")});Object.defineProperty(F,"OPEN",{enumerable:!0,value:Me.indexOf("OPEN")});Object.defineProperty(F.prototype,"OPEN",{enumerable:!0,value:Me.indexOf("OPEN")});Object.defineProperty(F,"CLOSING",{enumerable:!0,value:Me.indexOf("CLOSING")});Object.defineProperty(F.prototype,"CLOSING",{enumerable:!0,value:Me.indexOf("CLOSING")});Object.defineProperty(F,"CLOSED",{enumerable:!0,value:Me.indexOf("CLOSED")});Object.defineProperty(F.prototype,"CLOSED",{enumerable:!0,value:Me.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(F.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(F.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Rr])return e[yx];return null},set(e){for(let i of this.listeners(r))if(i[Rr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Rr]:!0})}})});F.prototype.addEventListener=vx;F.prototype.removeEventListener=Sx;to.exports=F;function Yi(r,e,i,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:mx,protocolVersion:Nr[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,!Nr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Nr.join(", ")})`);let u;if(e instanceof Lr)u=e;else try{u=new Lr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}u.protocol==="http:"?u.protocol="ws:":u.protocol==="https:"&&(u.protocol="wss:"),r._url=u.href;let d=u.protocol==="wss:",h=u.protocol==="ws+unix:",m;if(u.protocol!=="ws:"&&!d&&!h?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!u.pathname?m="The URL's pathname is empty":u.hash&&(m="The URL contains a fragment identifier"),m){let R=new SyntaxError(m);if(r._redirects===0)throw R;Nn(r,R);return}let w=d?443:80,b=dx(16).toString("base64"),_=d?xx.request:ux.request,C=new Set,L;if(x.createConnection=x.createConnection||(d?Ix:Px),x.defaultPort=x.defaultPort||w,x.port=u.port||w,x.host=u.hostname.startsWith("[")?u.hostname.slice(1,-1):u.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":b,Connection:"Upgrade",Upgrade:"websocket"},x.path=u.pathname+u.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(L=new je({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=Ex({[je.extensionName]:L.offer()})),i.length){for(let R of i){if(typeof R!="string"||!kx.test(R)||C.has(R))throw new SyntaxError("An invalid or duplicated subprotocol was specified");C.add(R)}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),(u.username||u.password)&&(x.auth=`${u.username}:${u.password}`),h){let R=x.path.split(":");x.socketPath=R[0],x.path=R[1]}let I;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=d,r._originalHostOrSocketPath=h?x.socketPath:u.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[z,ee]of Object.entries(R))a.headers[z.toLowerCase()]=ee}else if(r.listenerCount("redirect")===0){let R=h?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:u.host===r._originalHostOrSocketPath;(!R||r._originalSecure&&!d)&&(delete x.headers.authorization,delete x.headers.cookie,R||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),I=r._req=_(x),r._redirects&&r.emit("redirect",r.url,I)}else I=r._req=_(x);x.timeout&&I.on("timeout",()=>{xe(r,I,"Opening handshake has timed out")}),I.on("error",R=>{I===null||I[Vi]||(I=r._req=null,Nn(r,R))}),I.on("response",R=>{let z=R.headers.location,ee=R.statusCode;if(z&&x.followRedirects&&ee>=300&&ee<400){if(++r._redirects>x.maxRedirects){xe(r,I,"Maximum redirects exceeded");return}I.abort();let le;try{le=new Lr(z,e)}catch{let oe=new SyntaxError(`Invalid URL: ${z}`);Nn(r,oe);return}Yi(r,le,i,a)}else r.emit("unexpected-response",I,R)||xe(r,I,`Unexpected server response: ${R.statusCode}`)}),I.on("upgrade",(R,z,ee)=>{if(r.emit("upgrade",R),r.readyState!==F.CONNECTING)return;I=r._req=null;let le=R.headers.upgrade;if(le===void 0||le.toLowerCase()!=="websocket"){xe(r,z,"Invalid Upgrade header");return}let _e=lx("sha1").update(b+_x).digest("base64");if(R.headers["sec-websocket-accept"]!==_e){xe(r,z,"Invalid Sec-WebSocket-Accept header");return}let oe=R.headers["sec-websocket-protocol"],D;if(oe!==void 0?C.size?C.has(oe)||(D="Server sent an invalid subprotocol"):D="Server sent a subprotocol but none was requested":C.size&&(D="Server sent no subprotocol"),D){xe(r,z,D);return}oe&&(r._protocol=oe);let q=R.headers["sec-websocket-extensions"];if(q!==void 0){if(!L){xe(r,z,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let V;try{V=Cx(q)}catch{xe(r,z,"Invalid Sec-WebSocket-Extensions header");return}let he=Object.keys(V);if(he.length!==1||he[0]!==je.extensionName){xe(r,z,"Server indicated an extension that was not requested");return}try{L.accept(V[je.extensionName])}catch{xe(r,z,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[je.extensionName]=L}r.setSocket(z,ee,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(I,r):I.end()}function Nn(r,e){r._readyState=F.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function Px(r){return r.path=r.socketPath,Wi.connect(r)}function Ix(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=Wi.isIP(r.host)?"":r.host),fx.connect(r)}function xe(r,e,i){r._readyState=F.CLOSING;let a=new Error(i);Error.captureStackTrace(a,xe),e.setHeader?(e[Vi]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Nn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Or(r,e,i){if(e){let a=px(e)?e.size:Ax(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Me[r.readyState]})`);process.nextTick(i,a)}}function Dx(r,e){let i=this[Z];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[Z]!==void 0&&(i._socket.removeListener("data",On),process.nextTick($i,i._socket),r===1005?i.close():i.close(r,e))}function Tx(){let r=this[Z];r.isPaused||r._socket.resume()}function Lx(r){let e=this[Z];e._socket[Z]!==void 0&&(e._socket.removeListener("data",On),process.nextTick($i,e._socket),e.close(r[bx])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function ji(){this[Z].emitClose()}function Rx(r,e){this[Z].emit("message",r,e)}function Nx(r){let e=this[Z];e._autoPong&&e.pong(r,!this._isServer,Ji),e.emit("ping",r)}function Ox(r){this[Z].emit("pong",r)}function $i(r){r.resume()}function Bx(r){let e=this[Z];e.readyState!==F.CLOSED&&(e.readyState===F.OPEN&&(e._readyState=F.CLOSING,Qi(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Qi(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Xi(){let r=this[Z];if(this.removeListener("close",Xi),this.removeListener("data",On),this.removeListener("end",Zi),r._readyState=F.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[Z]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",ji),r._receiver.on("finish",ji))}function On(r){this[Z]._receiver.write(r)||this.pause()}function Zi(){let r=this[Z];r._readyState=F.CLOSING,r._receiver.end(),this.end()}function eo(){let r=this[Z];this.removeListener("error",eo),this.on("error",Ji),r&&(r._readyState=F.CLOSING,this.destroy())}});var io=se((Ol,so)=>{"use strict";var Nl=Bn(),{Duplex:Mx}=Y("stream");function no(r){r.emit("close")}function zx(){!this.destroyed&&this._writableState.finished&&this.destroy()}function ro(r){this.removeListener("error",ro),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Fx(r,e){let i=!0,a=new Mx({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(u,d){let h=!d&&a._readableState.objectMode?u.toString():u;a.push(h)||r.pause()}),r.once("error",function(u){a.destroyed||(i=!1,a.destroy(u))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,u){if(r.readyState===r.CLOSED){u(x),process.nextTick(no,a);return}let d=!1;r.once("error",function(m){d=!0,u(m)}),r.once("close",function(){d||u(x),process.nextTick(no,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,u,d){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,u,d)});return}r.send(x,d)},a.on("end",zx),a.on("error",ro),a}so.exports=Fx});var Br=se((Bl,oo)=>{"use strict";var{tokenChars:qx}=ht();function Ux(r){let e=new Set,i=-1,a=-1,x=0;for(x;x<r.length;x++){let d=r.charCodeAt(x);if(a===-1&&qx[d]===1)i===-1&&(i=x);else if(x!==0&&(d===32||d===9))a===-1&&i!==-1&&(a=x);else if(d===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 u=r.slice(i,x);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);return e.add(u),e}oo.exports={parse:Ux}});var ho=se((zl,lo)=>{"use strict";var Kx=Y("events"),Mn=Y("http"),{Duplex:Ml}=Y("stream"),{createHash:Hx}=Y("crypto"),ao=Ln(),Ze=lt(),Gx=Br(),jx=Bn(),{CLOSE_TIMEOUT:Wx,GUID:Jx,kWebSocket:Vx}=Ne(),Yx=/^[+/0-9A-Za-z]{22}==$/,co=0,xo=1,fo=2,Mr=class extends Kx{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Wx,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:jx,...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=Mn.createServer((a,x)=>{let u=Mn.STATUS_CODES[426];x.writeHead(426,{"Content-Length":u.length,"Content-Type":"text/plain"}),x.end(u)}),this._server.listen(e.port,e.host,e.backlog,i)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=$x(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,u,d)=>{this.handleUpgrade(x,u,d,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=co}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(Mt,this);return}if(e&&this.once("close",e),this._state!==xo)if(this._state=xo,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(Mt,this):process.nextTick(Mt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Mt(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",uo);let u=e.headers["sec-websocket-key"],d=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){et(this,e,i,405,"Invalid HTTP method");return}if(d===void 0||d.toLowerCase()!=="websocket"){et(this,e,i,400,"Invalid Upgrade header");return}if(u===void 0||!Yx.test(u)){et(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){et(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){zt(i,400);return}let m=e.headers["sec-websocket-protocol"],w=new Set;if(m!==void 0)try{w=Gx.parse(m)}catch{et(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let b=e.headers["sec-websocket-extensions"],_={};if(this.options.perMessageDeflate&&b!==void 0){let C=new Ze({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let L=ao.parse(b);L[Ze.extensionName]&&(C.accept(L[Ze.extensionName]),_[Ze.extensionName]=C)}catch{et(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let C={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(C,(L,I,R,z)=>{if(!L)return zt(i,I||401,R,z);this.completeUpgrade(_,u,w,e,i,a,x)});return}if(!this.options.verifyClient(C))return zt(i,401)}this.completeUpgrade(_,u,w,e,i,a,x)}completeUpgrade(e,i,a,x,u,d,h){if(!u.readable||!u.writable)return u.destroy();if(u[Vx])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>co)return zt(u,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Hx("sha1").update(i+Jx).digest("base64")}`],b=new this.options.WebSocket(null,void 0,this.options);if(a.size){let _=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;_&&(w.push(`Sec-WebSocket-Protocol: ${_}`),b._protocol=_)}if(e[Ze.extensionName]){let _=e[Ze.extensionName].params,C=ao.format({[Ze.extensionName]:[_]});w.push(`Sec-WebSocket-Extensions: ${C}`),b._extensions=e}this.emit("headers",w,x),u.write(w.concat(`\r
12
12
  `).join(`\r
13
- `)),f.removeListener("error",co),v.setSocket(f,d,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(v),v.on("close",()=>{this.clients.delete(v),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Rt,this)})),h(v,x)}};uo.exports=Or;function Vc(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 Rt(r){r._state=fo,r.emit("close")}function co(){this.destroy()}function Bt(r,e,i,a){i=i||Tn.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} ${Tn.STATUS_CODES[e]}\r
13
+ `)),u.removeListener("error",uo),b.setSocket(u,d,{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(Mt,this)})),h(b,x)}};lo.exports=Mr;function $x(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 Mt(r){r._state=fo,r.emit("close")}function uo(){this.destroy()}function zt(r,e,i,a){i=i||Mn.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} ${Mn.STATUS_CODES[e]}\r
14
14
  `+Object.keys(a).map(x=>`${x}: ${a[x]}`).join(`\r
15
15
  `)+`\r
16
16
  \r
17
- `+i)}function Qe(r,e,i,a,x,f){if(r.listenerCount("wsClientError")){let d=new Error(x);Error.captureStackTrace(d,Qe),r.emit("wsClientError",d,i,e)}else Bt(i,a,x,f)}});import{spawn as wf}from"node:child_process";import{existsSync as yf,openSync as bf}from"node:fs";import{mkdir as vf}from"node:fs/promises";import{dirname as Sf}from"node:path";import{fileURLToPath as Ef}from"node:url";function Mr(r=G()){return yf(r.libEntry)?r.libEntry:Ef(new URL("../index.ts",import.meta.url))}async function Ro(r={}){let e=r.paths??G(),i=r.entryOverride??Mr(e);await vf(Sf(e.logFile),{recursive:!0});let a=bf(e.logFile,"a"),f=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],d=wf(process.execPath,f,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(d.unref(),typeof d.pid!="number")throw new Error("failed to spawn daemon (no pid)");return Cf.info("daemon spawned",{pid:d.pid,entry:i}),{pid:d.pid,entry:i}}var Cf,zr=ke(()=>{"use strict";K();oe();Cf=R("spawn-daemon")});import{spawn as Nf}from"node:child_process";import{mkdir as Of,unlink as Rf,writeFile as Bf}from"node:fs/promises";import{dirname as Mf,join as zf}from"node:path";function Fn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Fo(r,e){return new Promise((i,a)=>{let x=Nf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var qn,Ur,Hr,Uo=ke(()=>{"use strict";K();qn=R("supervisor.launchd"),Ur="ai.coze.bridge",Hr={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
17
+ `+i)}function et(r,e,i,a,x,u){if(r.listenerCount("wsClientError")){let d=new Error(x);Error.captureStackTrace(d,et),r.emit("wsClientError",d,i,e)}else zt(i,a,x,u)}});import{spawn as yu}from"node:child_process";import{existsSync as bu,openSync as vu}from"node:fs";import{mkdir as Su}from"node:fs/promises";import{dirname as Eu}from"node:path";import{fileURLToPath as Cu}from"node:url";function qr(r=H()){return bu(r.libEntry)?r.libEntry:Cu(new URL("../index.ts",import.meta.url))}async function Bo(r={}){let e=r.paths??H(),i=r.entryOverride??qr(e);await Su(Eu(e.logFile),{recursive:!0});let a=vu(e.logFile,"a"),u=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],d=yu(process.execPath,u,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(d.unref(),typeof d.pid!="number")throw new Error("failed to spawn daemon (no pid)");return Au.info("daemon spawned",{pid:d.pid,entry:i}),{pid:d.pid,entry:i}}var Au,Ur=Ie(()=>{"use strict";K();ae();Au=N("spawn-daemon")});import{spawn as Nu}from"node:child_process";import{mkdir as Ou,unlink as Bu,writeFile as Mu}from"node:fs/promises";import{dirname as zu,join as Fu}from"node:path";function jn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Uo(r,e){return new Promise((i,a)=>{let x=Nu(r,e,{stdio:["ignore","pipe","pipe"]}),u="";x.stderr?.on("data",d=>{u+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var Gn,Gr,jr,Ko=Ie(()=>{"use strict";K();Gn=N("supervisor.launchd"),Gr="ai.coze.bridge",jr={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>${Ur}</string>
22
+ <string>${Gr}</string>
23
23
  <key>ProgramArguments</key>
24
24
  <array>
25
- <string>${Fn(r.nodeBin)}</string>
26
- <string>${Fn(r.entry)}</string>
25
+ <string>${jn(r.nodeBin)}</string>
26
+ <string>${jn(r.entry)}</string>
27
27
  <string>--daemon</string>
28
28
  </array>
29
29
  <key>RunAtLoad</key>
@@ -33,12 +33,12 @@ var Fa=Object.create;var ir=Object.defineProperty;var Ua=Object.getOwnPropertyDe
33
33
  <key>ThrottleInterval</key>
34
34
  <integer>10</integer>
35
35
  <key>StandardOutPath</key>
36
- <string>${Fn(r.logFile)}</string>
36
+ <string>${jn(r.logFile)}</string>
37
37
  <key>StandardErrorPath</key>
38
- <string>${Fn(r.logFile)}</string>
38
+ <string>${jn(r.logFile)}</string>
39
39
  </dict>
40
40
  </plist>
41
- `},configPath(r){return zf(r.homeDir,"Library","LaunchAgents",`${Ur}.plist`)},async install(r){let e=this.configPath(r);await Of(Mf(e),{recursive:!0}),await Bf(e,this.renderConfig(r),"utf8"),qn.info("plist written",{plistPath:e}),await Fo("launchctl",["load","-w",e]),qn.info("launchd job loaded",{label:Ur})},async uninstall(r){let e=this.configPath(r);await Fo("launchctl",["unload","-w",e]).catch(i=>qn.warn("launchctl unload failed (ignored)",{err:String(i)})),await Rf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),qn.info("launchd job removed",{plistPath:e})}}});import{spawn as qf}from"node:child_process";import{mkdir as Ff,unlink as Uf,writeFile as Hf}from"node:fs/promises";import{dirname as Kf,join as Gf}from"node:path";function Kn(r,e){return new Promise((i,a)=>{let x=qf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var Un,Hn,Kr,Ho=ke(()=>{"use strict";K();Un=R("supervisor.systemd"),Hn="coze-bridge.service",Kr={platform:"linux",renderConfig(r){return`[Unit]
41
+ `},configPath(r){return Fu(r.homeDir,"Library","LaunchAgents",`${Gr}.plist`)},async install(r){let e=this.configPath(r);await Ou(zu(e),{recursive:!0}),await Mu(e,this.renderConfig(r),"utf8"),Gn.info("plist written",{plistPath:e}),await Uo("launchctl",["load","-w",e]),Gn.info("launchd job loaded",{label:Gr})},async uninstall(r){let e=this.configPath(r);await Uo("launchctl",["unload","-w",e]).catch(i=>Gn.warn("launchctl unload failed (ignored)",{err:String(i)})),await Bu(e).catch(i=>{if(i.code!=="ENOENT")throw i}),Gn.info("launchd job removed",{plistPath:e})}}});import{spawn as qu}from"node:child_process";import{mkdir as Uu,unlink as Ku,writeFile as Hu}from"node:fs/promises";import{dirname as Gu,join as ju}from"node:path";function Vn(r,e){return new Promise((i,a)=>{let x=qu(r,e,{stdio:["ignore","pipe","pipe"]}),u="";x.stderr?.on("data",d=>{u+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var Wn,Jn,Wr,Ho=Ie(()=>{"use strict";K();Wn=N("supervisor.systemd"),Jn="coze-bridge.service",Wr={platform:"linux",renderConfig(r){return`[Unit]
42
42
  Description=Coze Bridge daemon
43
43
  After=network.target
44
44
 
@@ -52,7 +52,7 @@ StandardError=append:${r.logFile}
52
52
 
53
53
  [Install]
54
54
  WantedBy=default.target
55
- `},configPath(r){return Gf(r.homeDir,".config","systemd","user",Hn)},async install(r){let e=this.configPath(r);await Ff(Kf(e),{recursive:!0}),await Hf(e,this.renderConfig(r),"utf8"),Un.info("systemd unit written",{unitPath:e}),await Kn("systemctl",["--user","daemon-reload"]),await Kn("systemctl",["--user","enable","--now",Hn]),Un.info("systemd unit enabled",{unitName:Hn})},async uninstall(r){let e=this.configPath(r);await Kn("systemctl",["--user","disable","--now",Hn]).catch(i=>Un.warn("systemctl disable failed (ignored)",{err:String(i)})),await Uf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await Kn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Un.info("systemd unit removed",{unitPath:e})}}});import{spawn as Wf}from"node:child_process";import{join as jf}from"node:path";function Ko(r,e){return new Promise((i,a)=>{let x=Wf(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var Gr,Gn,Wr,Go=ke(()=>{"use strict";K();Gr=R("supervisor.taskscheduler"),Gn="CozeBridge",Wr={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
55
+ `},configPath(r){return ju(r.homeDir,".config","systemd","user",Jn)},async install(r){let e=this.configPath(r);await Uu(Gu(e),{recursive:!0}),await Hu(e,this.renderConfig(r),"utf8"),Wn.info("systemd unit written",{unitPath:e}),await Vn("systemctl",["--user","daemon-reload"]),await Vn("systemctl",["--user","enable","--now",Jn]),Wn.info("systemd unit enabled",{unitName:Jn})},async uninstall(r){let e=this.configPath(r);await Vn("systemctl",["--user","disable","--now",Jn]).catch(i=>Wn.warn("systemctl disable failed (ignored)",{err:String(i)})),await Ku(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await Vn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Wn.info("systemd unit removed",{unitPath:e})}}});import{spawn as Wu}from"node:child_process";import{join as Ju}from"node:path";function Go(r,e){return new Promise((i,a)=>{let x=Wu(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),u="";x.stderr?.on("data",d=>{u+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var Jr,Yn,Vr,jo=Ie(()=>{"use strict";K();Jr=N("supervisor.taskscheduler"),Yn="CozeBridge",Vr={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
56
56
  <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
57
57
  <RegistrationInfo>
58
58
  <Description>Coze Bridge daemon</Description>
@@ -76,7 +76,7 @@ WantedBy=default.target
76
76
  </Exec>
77
77
  </Actions>
78
78
  </Task>
79
- `},configPath(r){return jf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Ko("schtasks",["/Create","/SC","ONLOGON","/TN",Gn,"/TR",e,"/RU",r.userName,"/F"]),Gr.info("task scheduler entry created",{task:Gn})},async uninstall(r){await Ko("schtasks",["/Delete","/TN",Gn,"/F"]).catch(e=>Gr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),Gr.info("task scheduler entry removed",{task:Gn})}}});var jr={};_s(jr,{buildContext:()=>Xf,getSupervisor:()=>Yf,launchdSupervisor:()=>Hr,systemdSupervisor:()=>Kr,taskSchedulerSupervisor:()=>Wr});import{homedir as Jf,userInfo as Vf}from"node:os";function Yf(r=process.platform){switch(r){case"darwin":return Hr;case"linux":return Kr;case"win32":return Wr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function Xf(){let r=G();return{nodeBin:process.execPath,entry:Mr(r),logFile:r.logFile,homeDir:Jf(),userName:Vf().username}}var Jr=ke(()=>{"use strict";oe();zr();Uo();Ho();Go()});qe();K();import{readdir as a0}from"node:fs/promises";import{mkdir as n0,writeFile as r0}from"node:fs/promises";import{join as s0}from"node:path";var i0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function it(r,e,i,a){await n0(r,{recursive:!0});let x=i0[e],f=s0(r,x),d=o0(e,i,a);return await r0(f,d,"utf8"),f}function o0(r,e,i){let a=`# Coze Agent: ${e}
79
+ `},configPath(r){return Ju(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Go("schtasks",["/Create","/SC","ONLOGON","/TN",Yn,"/TR",e,"/RU",r.userName,"/F"]),Jr.info("task scheduler entry created",{task:Yn})},async uninstall(r){await Go("schtasks",["/Delete","/TN",Yn,"/F"]).catch(e=>Jr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),Jr.info("task scheduler entry removed",{task:Yn})}}});var Yr={};bs(Yr,{buildContext:()=>Qu,getSupervisor:()=>$u,launchdSupervisor:()=>jr,systemdSupervisor:()=>Wr,taskSchedulerSupervisor:()=>Vr});import{homedir as Vu,userInfo as Yu}from"node:os";function $u(r=process.platform){switch(r){case"darwin":return jr;case"linux":return Wr;case"win32":return Vr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function Qu(){let r=H();return{nodeBin:process.execPath,entry:qr(r),logFile:r.logFile,homeDir:Vu(),userName:Yu().username}}var $r=Ie(()=>{"use strict";ae();Ur();Ko();Ho();jo()});Ue();K();import{readdir as c0}from"node:fs/promises";import{mkdir as r0,writeFile as s0}from"node:fs/promises";import{join as i0}from"node:path";var o0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function ot(r,e,i,a){await r0(r,{recursive:!0});let x=o0[e],u=i0(r,x),d=a0(e,i,a);return await s0(u,d,"utf8"),u}function a0(r,e,i){let a=`# Coze Agent: ${e}
80
80
 
81
81
  > framework: \`${r}\`
82
82
 
@@ -85,11 +85,11 @@ WantedBy=default.target
85
85
  `:`_No instructions provided._
86
86
  `;return`${a}---
87
87
 
88
- ${x}`}var ve=R("agent-detail-sync"),Jt=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await a0(i)}catch(x){ve.info("agents dir not found, skip detail sync",{root:i,err:String(x)});return}ve.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){ve.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}ve.info("detail sync done",{reason:e})}async syncOne(e){let i=await ce(e,this.opts.paths);if(!i){ve.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(d){ve.warn("detail RPC failed, using local data",{agentId:e,err:String(d)});return}if(a.agentId&&a.agentId!==e){ve.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&&ve.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){ve.debug("detail sync: no diff",{agentId:e});return}await ge(i,this.opts.paths),ve.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:i.agentName}),f&&(await it(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};qe();import{spawn as Os}from"node:child_process";import{lstat as cr,mkdir as x0,readFile as Rs,readdir as c0,rm as f0,stat as u0,writeFile as d0}from"node:fs/promises";import{join as Le,normalize as l0,relative as Bs,resolve as h0,sep as Ms}from"node:path";function vt(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Cs(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function ot(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var D=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)}};K();oe();function Je(r,e){if(vt(r)!=="cloud")throw new D("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}var As="https://llm-gateway.coze.cn",at="auto";function Ds(r){return{model:r.model??at,...r.modelToken?{modelToken:r.modelToken}:{}}}function ks(r){return!r||r===at}function Is(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=As,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),ks(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Ps(r){let e=[];return ks(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="${As}/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 Ls(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var fe=R("agent-handlers"),Ts=5*1024*1024,g0=1,p0=6,m0=new Set(["node_modules",".git",".coze","dist","build",".next"]),Vt=class{constructor(e){this.opts=e}opts;async listSkills(e){Je(e._meta,"_agent/listSkills");let i=ot(e._meta),a=await this.loadAgentCfg(i),x=a?.workspace??Pe(i).workspace,f=a?.skills??[],d=[];for(let h of f){let m=Le(x,h.relPath,"SKILL.md");await u0(m).then(v=>v.isFile()).catch(()=>!1)&&d.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:d}}async addSkills(e){Je(e._meta,"_agent/addSkills");let i=ot(e._meta),a=await this.requireAgentCfg(i),x=e.skills??[],f=[...a.skills??[]],d=new Map(f.map((m,w)=>[m.skillId,w])),h=[];for(let m of x){if(!m.skillName)throw new D("IPC_BAD_REQUEST","skill missing skillName");let w=_0(m.skillName),v=w0(a.framework),y=Le(v,w),I=Le(a.workspace,y);await x0(I,{recursive:!0});let T=await b0(m.downloadUrl);S0(T)?await E0(T,I):await d0(Le(I,"SKILL.md"),T.toString("utf8"),"utf8");let N={skillId:m.skillId,skillName:m.skillName,relPath:y,installedAt:Date.now(),...m.description?{description:m.description}:{},...m.version?{version:m.version}:{},...m.downloadUrl?{downloadUrl:m.downloadUrl}:{}},O=d.get(m.skillId);O!==void 0?f[O]=N:(d.set(m.skillId,f.length),f.push(N)),h.push(m),fe.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:y})}return await Wt(i,f),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){Je(e._meta,"_agent/removeSkills");let i=ot(e._meta),a=await this.requireAgentCfg(i),x=new Set(e.skillIds??[]),f=a.skills??[],d=[];for(let h of f){if(!x.has(h.skillId)){d.push(h);continue}let m=Le(a.workspace,h.relPath);await f0(m,{recursive:!0,force:!0}),fe.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await Wt(i,d),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex"){for(let[x,f]of a.sessions)if(!(!f.downstream||!f.acpSessionId)){f.loadingSession=!0;try{await f.downstream.sessionLoad({sessionId:f.acpSessionId,cwd:a.workspace}),fe.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId})}catch(d){fe.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId,err:String(d)})}finally{f.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return fe.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await ce(i);if(!a)throw new D("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(fe.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await ge(a),await it(a.workspace,a.framework,i,e.cozeIdentity),fe.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 D("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await ce(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await ge(a),fe.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}):(fe.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Je(e._meta,"_agent/switchModel"),!e.agentId)throw new D("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:at,a=await ce(e.agentId);if(!a)throw new D("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await ge(a),fe.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let x=this.opts.agents.get(e.agentId);return x?(await x.msgQueue.enqueue(async()=>{x.model=i,await x.killAllRuntimes(`switchModel: ${i}`)}),fe.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i}),{ok:!0}):(fe.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0})}async getFileTree(e){Je(e._meta,"_agent/getFileTree");let i=e._meta,a=ot(i),x=this.resolveWorkspace(a),f=e.filePath??"",d=this.safeJoin(x,f),h=await cr(d).catch(()=>null);if(!h)throw new D("IPC_BAD_REQUEST",`path not found: ${f}`);if(h.isSymbolicLink())throw new D("IPC_BAD_REQUEST",`symlink not allowed: ${f}`);let m=A0(e.depth);return h.isDirectory()?{tree:await zs(x,d,f,m)}:{tree:[{name:D0(f),path:qs(f||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Je(e._meta,"_agent/getFileContent");let i=ot(e._meta),a=this.resolveWorkspace(i);if(!e.filePath)throw new D("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await cr(x).catch(()=>null);if(!f||!f.isFile())throw new D("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.isSymbolicLink())throw new D("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(f.size>Ts)throw new D("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${Ts})`);let d=await Rs(x);return d.includes(0)?{content:d.toString("base64"),encoding:"base64",size:f.size}:{content:d.toString("utf8"),encoding:"utf-8",size:f.size}}resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:Pe(e).workspace}safeJoin(e,i){let a=h0(e,i||"."),x=Bs(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Ms}`))throw new D("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return ce(e)}async requireAgentCfg(e){let i=await this.loadAgentCfg(e);if(!i)throw new D("AGENT_NOT_FOUND",`no config for agent: ${e}`);return i}};function _0(r){let e=r.trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new D("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function w0(r){return r==="claude-code"?Le(".claude","skills"):Le(".agents","skills")}var y0=3e4,Ns=50*1024*1024,Yt=3e4;async function b0(r){if(!r)throw new D("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:"))return v0(r);if(r.startsWith("file:")){let e=new URL(r).pathname,i=await Rs(e);if(i.length>Ns)throw new D("IPC_BAD_REQUEST",`skill too large: ${i.length} bytes`);return i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),y0);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new D("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();if(x.byteLength>Ns)throw new D("IPC_BAD_REQUEST",`skill too large: ${x.byteLength} bytes`);return Buffer.from(x)}finally{clearTimeout(i)}}throw new D("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function v0(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new D("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 S0(r){return r.length>=2&&r[0]===31&&r[1]===139}async function E0(r,e){await C0(r),await new Promise((i,a)=>{let x=Os("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",h=>{f+=String(h)});let d=setTimeout(()=>{x.kill("SIGKILL"),a(new D("IPC_BAD_REQUEST",`tar extract timeout (${Yt}ms)`))},Yt);x.on("error",h=>{clearTimeout(d),a(new D("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(d),h===0?i():a(new D("IPC_BAD_REQUEST",`tar exit ${h}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function C0(r){let e=await new Promise((i,a)=>{let x=Os("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),f="",d="";x.stdout?.on("data",m=>{f+=String(m)}),x.stderr?.on("data",m=>{d+=String(m)});let h=setTimeout(()=>{x.kill("SIGKILL"),a(new D("IPC_BAD_REQUEST",`tar list timeout (${Yt}ms)`))},Yt);x.on("error",m=>{clearTimeout(h),a(new D("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),x.on("exit",m=>{clearTimeout(h),m===0?i(f):a(new D("IPC_BAD_REQUEST",`tar list exit ${m}${d?`: ${d.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)});for(let i of e.split(`
89
- `)){let a=i.trim();if(!a)continue;let x=a.charCodeAt(0);if(x!==45&&x!==100)throw new D("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let d=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!d)continue;if(d.startsWith("/"))throw new D("IPC_BAD_REQUEST",`tar entry absolute path: ${d}`);if(d.split(/[/\\]/).some(m=>m===".."))throw new D("IPC_BAD_REQUEST",`tar entry contains '..': ${d}`)}}async function zs(r,e,i,a){if(a<=0)return[];let x;try{x=await c0(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let d of x){if(m0.has(d.name)||d.isSymbolicLink())continue;let h=Le(e,d.name),m=l0(Le(i,d.name)),w=null;try{w=await cr(h)}catch{continue}if(w.isSymbolicLink())continue;let v={name:d.name,path:qs(Bs(r,h)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&a>1&&(v.children=await zs(r,h,m,a-1)),f.push(v)}return f.sort((d,h)=>d.isDir!==h.isDir?d.isDir?-1:1:d.name.localeCompare(h.name)),f}function A0(r){return!r||r<=0?g0:Math.min(r,p0)}function D0(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function qs(r){return r.split(Ms).join("/")}K();var St=R("agent-health-reporter"),k0=1e4,Xt=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??k0}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()}),St.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),St.info("heartbeat stopped"))}async tick(){if(this.inFlight){St.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){St.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=I0(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){St.warn("heartbeat batch send failed",{count:i.length,err:String(x)})}}finally{this.inFlight=!1}}};function I0(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}qe();import{mkdir as fr,rm as K0}from"node:fs/promises";import{spawn as O0}from"node:child_process";function Et(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function $t(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function xt(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ve(r,e){return{jsonrpc:"2.0",id:r,error:e}}var Zt=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},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 Fs(r){return"method"in r&&"id"in r&&r.id!==void 0}function Us(r){return"method"in r&&!("id"in r)}function Qt(r){return!("method"in r)&&"id"in r}var P0={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 en(r){return r instanceof D?{code:P0[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 Hs(r){let e=r.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new D(i,r.message,{retriable:e?.retriable??!1,cause:r.data})}function Ks(r){return`${JSON.stringify(r)}
90
- `}var tn=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(`
91
- `);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(d){this.onError?.({line:f,error:d})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(i){return this.onError?.({line:e,error:i}),[]}}};var Ws={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel","_agent/genModelToken":"agent.genModelToken","session/request_permission":"session.requestPermission",initialize:"initialize"},ed=Object.fromEntries(Object.entries(Ws).map(([r,e])=>[e,r])),L0={"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"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},ct=class{seq=0;next(e,i){this.seq+=1;let a=Ws[e]??T0(e),x=L0[a]??[],f=[a,String(this.seq)];if(x.length>0){let d=x.map(m=>Gs(i?.[m]??"")),h=N0(d).join(":");h&&f.push(h)}else i&&Object.values(i).some(d=>d)&&f.push(Object.values(i).filter(Boolean).map(d=>Gs(String(d))).join(":"));return f.join("_")}reset(){this.seq=0}};function T0(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Gs(r){return r.replace(/[:_\s]+/g,"-")}function N0(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}K();var R0=3e4;function js(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Fe=class{constructor(e){this.opts=e;this.log=R(`downstream.${this.constructor.name}`),this.decoder=new tn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new ct;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new D("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=O0(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 D("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 D("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()));js(i.pid,"SIGTERM");let x=setTimeout(()=>{i.killed||js(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($t("session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(xt(e,i))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(Ve(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=R0){if(!this.child||this.stopped)return Promise.reject(new D("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=Et(x,e,i),d=a>0&&Number.isFinite(a);return new Promise((h,m)=>{let w=d?setTimeout(()=>{this.pending.delete(x),m(new D("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:h,reject:m,timer:w,method:e});try{this.writeFrame(f)}catch(v){w&&clearTimeout(w),this.pending.delete(x),m(v)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new D("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(Ks(e))}dispatch(e){if(Qt(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(Hs(e.error)):i.resolve(e.result);return}if(Us(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(Fs(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(Ve(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(Ve(e.id,en(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var B0="@agentclientprotocol/claude-agent-acp@latest";function M0(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 nn=class extends Fe{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",B0],x={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return M0(e)}};import{mkdtempSync as z0,rmSync as q0}from"node:fs";import{tmpdir as F0}from"node:os";import{join as U0}from"node:path";var H0="@zed-industries/codex-acp@latest",rn=class extends Fe{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=e.command??"npx",a=e.args??["-y",H0],x=e.extraArgs?[...a,...e.extraArgs]:a,f=e.isolateCodexHome?z0(U0(F0(),"coze-bridge-codex-home-")):void 0,d=f?{...e.env??{},CODEX_HOME:f}:e.env,h={command:i,args:x,cwd:e.cwd,...d?{env:d}:{}};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{q0(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};import{spawn as Js}from"node:child_process";K();var sn=class extends Fe{framework="openclaw";registerLog;profile;agentId;sessionName;registered=!1;constructor(e){let i=e.profile??"coze",a=e.sessionName??"default",x=["--profile",i,"acp","--session",`agent:${e.agentId}:${a}`],f={command:e.command,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f),this.profile=i,this.agentId=e.agentId,this.sessionName=a,this.registerLog=R("downstream.openclaw.register")}async start(){await this.registerAgent().catch(e=>{this.registerLog.warn("openclaw agents add failed (will continue to acp anyway)",{agentId:this.agentId,err:String(e)})}),await super.start()}registerAgent(){return new Promise((e,i)=>{let a=Js(this.opts.command,["--profile",this.profile,"agents","add",this.agentId,"--workspace",this.opts.cwd,"--non-interactive"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",i),a.on("close",f=>{f===0?(this.registered=!0,this.registerLog.info("agent registered",{agentId:this.agentId,profile:this.profile}),e()):i(new D("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${f}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(i=>{let a=Js(this.opts.command,["--profile",this.profile,"agents","delete",this.agentId,"--force"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",f=>{this.registerLog.warn("openclaw agents delete failed (best-effort)",{agentId:this.agentId,err:String(f)}),i()}),a.on("close",f=>{f===0?this.registerLog.info("agent unregistered",{agentId:this.agentId}):this.registerLog.warn("openclaw agents delete non-zero exit",{agentId:this.agentId,code:f,stderr:x.trim()}),this.registered=!1,i()})})}get acpSessionName(){return this.sessionName}};K();oe();var on=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 an=class{agentId;framework;workspace;deployType;msgQueue;sessions=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",this.msgQueue=new on}async dispose(e){this.status="stopped",this.msgQueue.dispose(new Error(`AgentSession disposed${e?`: ${e}`:""}`)),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,a]of this.sessions)Ct(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function Ct(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}var Ue=R("agent-manager"),G0=(r,e,i,a,x)=>{switch(r){case"claude-code":{let f=x?Is(x):void 0;return new nn({cwd:i,...f&&Object.keys(f).length>0?{env:f}:{}})}case"codex":{let f=x?Ps(x):[],d=x?Ls(x):void 0,h=!!x;return new rn({cwd:i,...f.length>0?{extraArgs:f}:{},...d&&Object.keys(d).length>0?{env:d}:{},...h?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new sn({command:e,cwd:i,agentId:a})}};function W0(r){return r==="claude-code"||r==="codex"}var j0={path:"",version:"cloud-deployed"},J0={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},V0=2e4,xn=class{paths;config;registry;factory;createTimeoutMs;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??G0,this.createTimeoutMs=e.createTimeoutMs??V0}async createAgent(e){if(!e.agentId)throw new D("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new D("IPC_BAD_REQUEST","framework required");let i=vt(e._meta)==="cloud";if(i&&e.framework==="openclaw")return Ue.info("cloud-deployed openclaw, ack without local spawn",{agentId:e.agentId,framework:e.framework}),{ok:!0,agentId:e.agentId,framework:e.framework};this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new D("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")Ue.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(y=>Ue.warn("dispose stale agent failed (ignored)",{err:String(y)})),this.registry.unregister(e.agentId);else return Ue.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!i&&!this.config.frameworksCache?.[e.framework])throw new D("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let x=Pe(e.agentId,this.paths),f=e.workspace??x.workspace,d=vt(e._meta),h=new AbortController,m=setTimeout(()=>h.abort(new D("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),w,v=!1;try{let y=()=>{if(h.signal.aborted)throw h.signal.reason instanceof Error?h.signal.reason:new D("AGENT_TIMEOUT","_agent/create aborted")};await fr(x.root,{recursive:!0}),await fr(f,{recursive:!0}),await fr(x.logs,{recursive:!0}),y(),await it(f,e.framework,e.agentId,e.cozeIdentity),y();let I=await ce(e.agentId,this.paths).catch(()=>null),T=Ds({model:e.model??I?.model});if(w=new an({agentId:e.agentId,framework:e.framework,workspace:f,model:T.model??at,deployType:d}),w.status="ok",I?.sessions){for(let[H,Q]of Object.entries(I.sessions))w.sessions.set(H,{acpSessionId:Q.acpSessionId,modelToken:Q.modelToken,tokenGeneratedAt:Q.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1});let O=Object.keys(I.sessions).length;O>0&&Ue.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:O})}this.registry.register(w),v=!0;let N={agentId:e.agentId,framework:e.framework,workspace:f,cozeIdentity:e.cozeIdentity,createdAt:I?.createdAt??Date.now(),sessions:I?.sessions??{},model:T.model};return d==="cloud"&&(N.deployType="cloud"),I?.skills&&(N.skills=I.skills),I?.agentName&&(N.agentName=I.agentName),I?.description&&(N.description=I.description),await ge(N,this.paths),Ue.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(y){throw Ue.error("agent create failed, rolling back",{agentId:e.agentId,err:String(y)}),v&&w&&(await w.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await K0(x.root,{recursive:!0,force:!0}).catch(I=>Ue.warn("rm agent dir failed (ignored)",{err:String(I)})),y instanceof D?y:new D("AGENT_SPAWN_FAILED",String(y),{cause:y})}finally{clearTimeout(m)}}async spawnSessionDownstream(e,i){let x=this.config.frameworksCache?.[e.framework];if(!x)if(e.deployType==="cloud"&&W0(e.framework))x=j0;else throw new D("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let f=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,d=this.factory(e.framework,x.path,e.workspace,e.agentId,f);try{return await d.start(),await d.initialize(J0),d}catch(h){throw await d.stop("spawnSessionDownstream failed").catch(()=>{}),h instanceof D?h:new D("AGENT_SPAWN_FAILED",h instanceof Error?h.message:String(h),{cause:h})}}};K();import{spawn as Y0}from"node:child_process";import{constants as Vs,access as X0}from"node:fs/promises";import{delimiter as $0,join as Z0}from"node:path";var Q0=R("framework-detector"),Ys={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},ex=[".exe",".cmd",".bat",".ps1"],At=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Y0,access:e.access??X0}}async detect(e){let i=Ys[e],a=await this.which(i);if(!a)return Q0.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(Ys).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($0).filter(Boolean),a=this.env.platform==="win32"?["",...ex]:[""];for(let x of i)for(let f of a){let d=Z0(x,e+f);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Vs.F_OK:Vs.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,d=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"),d("unknown")},5e3),h.stdout?.on("data",m=>{a+=m.toString("utf8")}),h.on("error",()=>d("unknown")),h.on("close",()=>{let m=nx(a).split(/\r?\n/)[0]??"";d(m)})}catch{d("unknown")}})}},tx=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function nx(r){return r.replace(tx,"")}or();oe();var rx=10*6e4;function Xs(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?rx:e}function cn(r){return Ft(r??G().configFile)}function Dt(r,e){return Ut(e??G().configFile,r)}import{randomBytes as sx}from"node:crypto";qe();var $s={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",DELETE:"_agent/delete"};K();var j=R("core"),ix=3e4,ox=3e4,fn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new ct;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=Xs(e.bridgeConfig)}registerExtension(e,i){this.extensions[e]=i}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,d)=>{j.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:f,signal:d}),Ct(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(Qt(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;try{if(e.method.startsWith("_agent/")){let a=this.extensions[e.method];if(!a){i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):j.warn("drop notification: extension not registered",{method:e.method});return}let x=await a(e,this);i!==null&&await this.upstream.send(xt(i,x));return}if(e.method.startsWith("session/")){let a=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(xt(i,a));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(xt(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):j.warn("drop unknown notification",{method:e.method})}catch(a){j.error("handleFrame failed",{method:e.method,err:String(a)}),i!==null&&await this.upstream.send(Ve(i,en(a)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new D("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new D("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new D("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new D("AGENT_NOT_FOUND",`agent not found: ${a}`);if(e.method==="session/cancel")return this.dispatchSessionCall(x,e.method,i);let f=Date.now(),d=!1;try{let h=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,i));return d=!0,h}finally{j.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-f,ok:d})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:x}=Cs(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,d=f.sessionId;if(!d)throw new D("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,d);if(await this.ensureDownstream(e,d,h),!h.downstream||!h.acpSessionId)throw new D("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let m=a._meta?.cozeTriggerMsgId;m?e.activeTriggers.set(h.acpSessionId,m):e.activeTriggers.delete(h.acpSessionId);try{let w=await h.downstream.sessionPrompt({...f,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),w}finally{h.downstream?.isAlive()&&this.armIdleTimer(e,d,h)}}case"session/cancel":{let d=x.sessionId;if(!d)throw new D("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(d);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.acpSessionId}),{ok:!0}}default:throw new D("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};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($s.GEN_MODEL_TOKEN,a,ox);if(!x?.modelToken)throw new D("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return x.modelToken}catch(x){throw x instanceof D&&x.code==="MODEL_TOKEN_GEN_FAILED"?x:new D("MODEL_TOKEN_GEN_FAILED",x instanceof Error?x.message:String(x),{cause:x})}}async ensureDownstream(e,i,a){if(Ct(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new D("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let x=await this.sessionSpawner(e,a.modelToken);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 d=await x.sessionNew({cwd:e.workspace});a.acpSessionId=d.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)}}armIdleTimer(e,i,a){Ct(a),a.idleTimer=setTimeout(()=>{j.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let x=a.downstream;a.downstream=void 0,a.idleTimer=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?.()}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={cozeAgentId:e.agentId},d=e.activeTriggers.get(a);d&&(f.cozeTriggerMsgId=d),this.upstream.send($t("session/update",{...i,sessionId:x,_meta:f})).catch(h=>j.warn("forward update failed",{agentId:e.agentId,err:String(h)}))}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:W.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,w={cozeAgentId:e.agentId};m&&(w.cozeTriggerMsgId=m);let v=h?this.reverseSessionId(e,h):void 0,y={...f,...v?{sessionId:v}:{},_meta:w};this.pendingUpstream.set(x,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),this.upstream.send(Et(x,"session/request_permission",y)).catch(I=>{this.pendingUpstream.delete(x),j.error("forward permission request failed",{agentId:e.agentId,err:String(I)}),i.respondAgentRequestError(a.id,{code:W.INTERNAL_ERROR,message:`upstream send failed: ${String(I)}`})})}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 Zt(e.error)):a.resolve(e.result);return}j.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=ix){let x=this.upstreamIds.next(e);return new Promise((f,d)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),d(new D("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:d,timer:h}),this.upstream.send(Et(x,e,i)).catch(m=>{let w=this.pendingBridge.get(x);w&&(clearTimeout(w.timer),this.pendingBridge.delete(x)),d(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 xr(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(Ve(e,{code:i,message:a}))}};function ax(){return sx(16).toString("hex")}K();oe();import{randomBytes as xx}from"node:crypto";import{chmod as cx,mkdir as fx,writeFile as Zs}from"node:fs/promises";import{createServer as ux}from"node:http";import{dirname as dx}from"node:path";var lx=1e6,ur=R("ipc"),un=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=xx(32).toString("hex");let e=ux((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(),ur.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 fx(dx(this.paths.portFile),{recursive:!0}),await Zs(this.paths.portFile,String(this.port),"utf8"),await Zs(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await cx(this.paths.tokenFile,384)}catch(e){ur.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){kt(i,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){kt(i,404,{error:"not found"});return}let d=null;if(e.method==="POST")try{d=await hx(e)}catch(h){kt(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await f.handler(d,e);kt(i,200,h??{ok:!0})}catch(h){ur.error("IPC handler failed",{key:x,err:String(h)}),kt(i,500,{error:h instanceof Error?h.message:String(h)})}}};function kt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function hx(r){let e=[],i=0;for await(let x of r){let f=x;if(i+=f.length,i>lx)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Co=Ie(ci(),1);var Yc=Ie(so(),1),Xc=Ie(Dn(),1),$c=Ie(dt(),1),Zc=Ie(Er(),1),Qc=Ie(Dr(),1),ef=Ie(Nr(),1),ho=Ie(Ln(),1),tf=Ie(lo(),1);var go=ho.default;K();var Nn="1008033",po="1289";var mo="pbbp2",_o="https://www.coze.cn",wo="/api/coze_claw/resource/get_frontier_key",nf="https://www.coze.cn",rf="wss://frontier.coze.cn";function yo(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??nf}function bo(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??rf}function On(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),a&&(e["x-use-ppe"]=a),e}var ne=R("upstream.frontier"),So="application/json",Eo="none",Rn=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:_o,...On(this.opts.ppeOverride)};class i extends go{constructor(h){super(h,mo,{headers:e})}send(h,...m){if(Ss("debug"))try{let w;typeof h=="string"?w=Buffer.from(h,"utf8"):h instanceof Buffer?w=h:h instanceof ArrayBuffer?w=new Uint8Array(h):ArrayBuffer.isView(h)?w=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):w=new Uint8Array(0);let v=Buffer.from(w.slice(0,128)).toString("hex");ne.debug("WS raw frame out",{bytes:w.byteLength,headHex:v})}catch(w){ne.warn("WS raw frame dump failed",{err:String(w)})}super.send(h,...m)}}let a=bo(this.opts.urlOverride),x={url:a,ws:i,fpID:po,aID:Nn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:So,force:!0},payloadEncoding:{encoding:Eo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new Co.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let d=this.openCount===1;ne.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:d,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:d})).catch(h=>ne.warn("onConnect handler threw (ignored)",{err:String(h)}))},f.onclose=d=>{this.opened=!1,ne.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},f.onerror=d=>{ne.warn("frontier error",{code:d.code,msg:d.message})},f.onmessage=d=>this.handleMessage(d),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){ne.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new D("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;ne.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:So,payloadEncoding:Eo})}catch(f){throw new D("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){ne.debug("drop non-adapter frontier frame",{service:i});return}let a=af(e);if(!a){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:a.length});return}let x;try{x=JSON.parse(a)}catch(f){ne.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}ne.info("frontier frame in",{logid:of(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>ne.warn("frontier frame handler threw",{err:String(f)}))}};function of(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function af(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}}K();function Do(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Ao=R("handshake");async function ko(r){let e=yo(r.endpoint),i=r.timeoutMs??1e4,a=`${xf(e)}${wo}?aid=${encodeURIComponent(Nn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...On(r.ppeOverride)},f=new AbortController,d=setTimeout(()=>f.abort(),i);Ao.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")??"",w=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let T=await h.text().catch(()=>"");throw new D("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${T.slice(0,200)}`)}let v=await h.json();if(v.code!==void 0&&v.code!==0)throw new D("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${v.code} msg=${v.msg??"-"} logid=${m}`);let y=v.data?.access_key,I=v.data?.device_id;if(!y||!I)throw new D("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(v)}`);return Ao.info("handshake ok",{remoteDeviceId:I,logid:m,traceId:w}),{accessKey:y,deviceId:I}}catch(h){throw h instanceof D?h:h.name==="AbortError"?new D("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new D("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(d)}}function xf(r){return r.endsWith("/")?r.slice(0,-1):r}K();var Rr=R("upstream.switchable"),Bn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;Rr.info("swap upstream",{reason:i});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw Rr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(i??"swapped").catch(x=>Rr.warn("previous upstream stop threw (ignored)",{err:String(x)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};K();var Br=R("upstream"),Mt=class{handler=null;async start(){Br.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Br.info("NoopUpstream stopped",{reason:e})}async send(e){Br.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)}};K();oe();K();oe();import{execSync as cf}from"node:child_process";import{readFileSync as Io,unlinkSync as ff}from"node:fs";import{mkdir as uf,readFile as Po,unlink as Lo,writeFile as df}from"node:fs/promises";import{dirname as lf}from"node:path";var hf=R("single-instance"),Mn=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&&(hf.warn("removing stale pid file",{stalePid:e}),await Lo(this.pidFile).catch(()=>{})),await uf(lf(this.pidFile),{recursive:!0}),await df(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Po(this.pidFile,"utf8")).trim()===String(process.pid)&&await Lo(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Po(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=Io(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=cf(`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{Io(this.pidFile,"utf8").trim()===String(process.pid)&&ff(this.pidFile)}catch{}})}};var z=R("daemon"),gf="coze-bridge-daemon";async function Oo(){let r=new Mn({processTitle:gf}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await cn(),a=i??{};ar({pid:process.pid}),z.info(i?"loaded bridge config":"initialized bridge config");try{let L=new At;a.frameworksCache=await L.detectAll(),z.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(L){z.warn("framework detection failed",{err:String(L)})}await Dt(a);let x=new Bn(new Mt),f=G(),d=null,h=new fn({upstream:x,paths:f,bridgeConfig:a,sessionSpawner:async(L,q)=>{if(!d)throw new Error("agentManager not ready");return d.spawnSessionDownstream(L,q)}});await mf(f,h);let m=new xn({paths:f,config:a,registry:h});d=m;let w,v,y=null,I=null;h.registerExtension("_agent/create",async L=>m.createAgent(L.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let T=new Vt({agents:h.agents,disposeAndMarkDisconnected:async(L,q)=>{let Z=h.agents.get(L);Z&&(await Z.dispose(`disconnect: ${q}`).catch(me=>z.warn("dispose during disconnect failed (ignored)",{agentId:L,err:String(me)})),Z.status="disconnected",h.unregister(L)),h.disconnectedAgents.add(L)}});h.registerExtension("_agent/listSkills",L=>T.listSkills(L.params)),h.registerExtension("_agent/addSkills",L=>T.addSkills(L.params)),h.registerExtension("_agent/removeSkills",L=>T.removeSkills(L.params)),h.registerExtension("_agent/getFileTree",L=>T.getFileTree(L.params)),h.registerExtension("_agent/getFileContent",L=>T.getFileContent(L.params)),h.registerExtension("_agent/update",L=>T.updateAgent(L.params)),h.registerExtension("_agent/disconnect",L=>T.disconnectAgent(L.params)),h.registerExtension("_agent/switchModel",L=>T.switchModel(L.params));let N=new Jt({paths:f,handlers:T,sendDetail:L=>h.sendRequest("_agent/detail",L)});x.onConnect(({initial:L})=>{z.info("frontier upstream connected, triggering detail sync",{initial:L}),N.syncAll(L?"initial-connect":"reconnect").catch(q=>z.warn("detail sync top-level error (ignored)",{err:String(q)}))});let O=new un({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:y??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async L=>{let q=L,Z=q?.privatecode,me=q?.pairing_code;if(!Z||!me)throw new D("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let De=Do(q.env),_e=q.handshake_url,le=q.frontier_url,We=pf(q.env,_e,le),zt=!!w&&w!==Z,qt=v!==void 0&&v!==We,we=zt||qt;if(we){z.warn("pair config switched, resetting agents",{pcChanged:zt,envChanged:qt,previousPc:w?To(w):"",nextPc:To(Z),previousEnvKey:v??"",nextEnvKey:We});for(let be of[...h.agents.values()])await be.dispose("pair config switch").catch(()=>{}),h.agents.delete(be.agentId);await x.swap(new Mt,"pair switch").catch(()=>{})}let ye=await ko({privatecode:Z,..._e?{endpoint:_e}:{},ppeOverride:De});y=ye.deviceId,ar({deviceId:y,pid:process.pid});let Wn=new Rn({handshake:ye,privatecode:Z,...le?{urlOverride:le}:{},ppeOverride:De});await x.swap(Wn,"pair");let se=Object.keys(a.frameworksCache??{});try{let be=await h.sendRequest("_agent/pair",{pairCode:me,patToken:Z,frameworks:se,_meta:{cozeDeviceId:y}});z.info("_agent/pair ok",{pairResult:be}),w=Z,v=We,I||(I=new Xt({core:h,getDeviceId:()=>y??""})),I.start(),we&&No(f,m).catch(F=>z.warn("post-pair-switch auto-revive error (ignored)",{err:String(F)}));let Y;return q.agent_id&&(Y=await _f(q.agent_id,f,m,F=>h.sendRequest("_agent/detail",F)).catch(F=>(z.error("--agent-id ensureAgent failed",{agentId:q.agent_id,err:String(F)}),{ok:!1,agentId:q.agent_id??"",note:String(F)}))),{ok:!0,note:"paired with cloud",...Y?{agent:Y}:{}}}catch(be){return z.error("_agent/pair failed",{err:String(be)}),{ok:!1,note:`pair failed: ${String(be)}`}}}},{method:"POST",path:"/_agent/create",handler:async L=>{let q=L;return{ok:!0,result:await m.createAgent(q)}}},{method:"POST",path:"/refresh",handler:async()=>{z.info("IPC /refresh: re-detecting frameworks");let L=new At;return a.frameworksCache=await L.detectAll(),await Dt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(z.info("IPC /shutdown received"),setImmediate(()=>{Ae.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:H,token:Q}=await O.start();await h.start(),No(f,m).catch(L=>z.warn("auto-revive top-level error (ignored)",{err:String(L)}));let re=null,Ae={port:H,token:Q,core:h,ipc:O,shutdown(L){return re||(z.info("daemon shutdown",{reason:L}),re=(async()=>{I?.stop(),await h.stop(L),await O.stop(),await r.release()})(),re)}};for(let L of["SIGTERM","SIGINT"])process.on(L,()=>{Ae.shutdown(L).then(()=>process.exit(0))});return z.info("daemon ready",{port:H,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),Ae}function To(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function pf(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function mf(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(()=>(qe(),jt));for(let d of a){await f(d,r).catch(h=>z.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(h)}));try{let h=await x(d,r);h?.disconnectedAt&&(e.disconnectedAgents.add(d),z.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){z.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(h)})}}}async function _f(r,e,i,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(qe(),jt)),f=await x(r,e);if(f){z.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let w={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{}};return await i.createAgent(w),{ok:!0,agentId:r,note:f.disconnectedAt?"revived from local config":"connected from local config"}}z.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let d=await a({_meta:{cozeAgentId:r}});if(!d.framework)throw new D("AGENT_NOT_FOUND",`agent ${r} \u4E0D\u5728\u672C\u5730; \u4E91\u7AEF _agent/detail \u54CD\u5E94\u7F3A framework \u5B57\u6BB5 (D36 \u534F\u8BAE\u6269\u5C55\u672A\u751F\u6548), \u65E0\u6CD5\u5728\u672C\u673A\u65B0\u5EFA`);let h={agentId:d.agentId,framework:d.framework,...d.cozeIdentity?{cozeIdentity:d.cozeIdentity}:{},...d.model?{model:d.model}:{},...d.deployType?{_meta:{cozeDeployType:d.deployType}}:{}};await i.createAgent(h);let m=d.deployType==="cloud"&&d.framework==="openclaw";return{ok:!0,agentId:r,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function No(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(()=>(qe(),jt));z.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,d=0;for(let h of a){let m;try{m=await x(h,r)}catch(w){z.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(w)}),d+=1;continue}if(!m){d+=1;continue}if(m.disconnectedAt){z.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),d+=1;continue}try{z.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(w){z.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(w)}),d+=1}}return z.info("auto-revive: done",{revived:f,skipped:d,total:a.length}),{revived:f,skipped:d,total:a.length}}zr();oe();import{readFile as Bo}from"node:fs/promises";var Ge=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 a=await this.fetch(i,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...i}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:Df(a)}}}async request(e){let i=await this.readAuth();if(!i)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(i,e)}async readAuth(){try{let[e,i]=await Promise.all([Bo(this.paths.portFile,"utf8"),Bo(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,d=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:Af(m)}}finally{clearTimeout(d)}}};function Af(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function Df(r){return r instanceof Error?r.message:String(r)}K();oe();import{copyFile as Mo,mkdir as kf,readFile as qr,writeFile as If}from"node:fs/promises";import{dirname as Pf,resolve as Fr,sep as zn}from"node:path";import{fileURLToPath as Lf}from"node:url";K();oe();var zo=R("dist-install");function Tf(r){let e=Lf(r),i=Pf(e),a=`${zn}src${zn}`;if(i.includes(a)||i.endsWith(`${zn}src${zn}cli`))return null;let x=Fr(i,"index.js"),f=Fr(i,"..","package.json");return{dist:x,pkgJson:f}}async function qo(r={}){let e=r.paths??G(),i=Tf(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 qr(x,"utf8")).version??"unknown"}catch(y){return zo.warn("cannot read source package.json,skip dist install",{err:String(y)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(y)}`}}let d=await cn(e.configFile)??{},h=d.libVersion;if(h===f)try{return await qr(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await kf(e.libDir,{recursive:!0}),await Mo(a,e.libEntry),await Mo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=Fr(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
92
- `;return await qr(m,"utf8").catch(()=>null)!==w&&await If(m,w),d.libVersion=f,await Dt(d,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 $f=R("cli");function _t(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 Zf(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}=_t(i,"--pat-token");i=x;let{value:f,rest:d}=_t(i,"--pair-code");i=d;let{value:h,rest:m}=_t(i,"--env");i=m;let{value:w,rest:v}=_t(i,"--handshake-url");i=v;let{value:y,rest:I}=_t(i,"--frontier-url");i=I;let{value:T}=_t(i,"--agent-id");if(!a||!f)return{mode:"help"};let N={mode:"pair",privatecode:a,pairingCode:f};return h&&(N.env=h),w&&(N.handshakeUrl=w),y&&(N.frontierUrl=y),T&&(N.agentId=T),N}var Qf=`
88
+ ${x}`}var ve=N("agent-detail-sync"),$t=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await c0(i)}catch(x){ve.info("agents dir not found, skip detail sync",{root:i,err:String(x)});return}ve.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(u){ve.warn("detail sync failed for agent, skipping",{agentId:x,err:String(u)})}ve.info("detail sync done",{reason:e})}async syncOne(e){let i=await ce(e,this.opts.paths);if(!i){ve.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(d){ve.warn("detail RPC failed, using local data",{agentId:e,err:String(d)});return}if(a.agentId&&a.agentId!==e){ve.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,u=!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,u=!0),a.deployType&&ve.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){ve.debug("detail sync: no diff",{agentId:e});return}await me(i,this.opts.paths),ve.info("detail sync: config updated",{agentId:e,identityChanged:u,agentName:i.agentName}),u&&(await ot(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ue();import{spawn as Bs}from"node:child_process";import{lstat as dr,mkdir as x0,readFile as Ms,readdir as u0,rm as f0,stat as d0,writeFile as l0}from"node:fs/promises";import{join as Re,normalize as h0,relative as zs,resolve as g0,sep as Fs}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 Et(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Ps(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function at(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var E=class extends Error{code;retriable;cause;constructor(e,i,a){super(i),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};K();ae();function Le(r,e){if(Et(r)!=="cloud")throw new E("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function Qt(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}var Is="https://llm-gateway.coze.cn",ct="auto";function Ds(r){return{model:r.model??ct,...r.modelToken?{modelToken:r.modelToken}:{}}}function Ts(r){return!r||r===ct}function Ls(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=Is,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),Ts(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Rs(r){let e=[];return Ts(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="${Is}/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 Ns(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var ie=N("agent-handlers"),Os=5*1024*1024,p0=1,m0=6,w0=new Set(["node_modules",".git",".coze","dist","build",".next"]),Zt=class{constructor(e){this.opts=e}opts;async listSkills(e){Le(e._meta,"_agent/listSkills");let i=at(e._meta),a=await this.loadAgentCfg(i),x=a?.workspace??Te(i).workspace,u=a?.skills??[],d=[];for(let h of u){let m=Re(x,h.relPath,"SKILL.md");await d0(m).then(b=>b.isFile()).catch(()=>!1)&&d.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:d}}async addSkills(e){Le(e._meta,"_agent/addSkills");let i=at(e._meta),a=await this.requireAgentCfg(i),x=e.skills??[],u=[...a.skills??[]],d=new Map(u.map((m,w)=>[m.skillId,w])),h=[];for(let m of x){if(!m.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let w=_0(m.skillName),b=y0(a.framework),_=Re(b,w),C=Re(a.workspace,_);await x0(C,{recursive:!0});let L=await S0(m.downloadUrl);C0(L)?await A0(L,C):await l0(Re(C,"SKILL.md"),L.toString("utf8"),"utf8");let I={skillId:m.skillId,skillName:m.skillName,relPath:_,installedAt:Date.now(),...m.description?{description:m.description}:{},...m.version?{version:m.version}:{},...m.downloadUrl?{downloadUrl:m.downloadUrl}:{}},R=d.get(m.skillId);R!==void 0?u[R]=I:(d.set(m.skillId,u.length),u.push(I)),h.push(m),ie.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:_})}return await Vt(i,u),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){Le(e._meta,"_agent/removeSkills");let i=at(e._meta),a=await this.requireAgentCfg(i),x=new Set(e.skillIds??[]),u=a.skills??[],d=[];for(let h of u){if(!x.has(h.skillId)){d.push(h);continue}let m=Re(a.workspace,h.relPath);await f0(m,{recursive:!0,force:!0}),ie.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await Vt(i,d),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex"){for(let[x,u]of a.sessions)if(!(!u.downstream||!u.acpSessionId)){u.loadingSession=!0;try{await u.downstream.sessionLoad({sessionId:u.acpSessionId,cwd:a.workspace}),ie.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:u.acpSessionId})}catch(d){ie.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:u.acpSessionId,err:String(d)})}finally{u.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return ie.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await ce(i);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(ie.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await me(a),await ot(a.workspace,a.framework,i,e.cozeIdentity),ie.info("_agent/update: cozeIdentity rewritten",{agentId:i,framework:a.framework}),await this.reloadAgentSessions(i,"identity-changed"),{ok:!0})}async disconnectAgent(e){let i=e.agentId;if(!i)throw new E("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await ce(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await me(a),ie.info("agent disconnected",{agentId:i,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(i,e.reason??"disconnect"),{ok:!0}):(ie.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Le(e._meta,"_agent/switchModel"),!e.agentId)throw new E("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:ct,a=await ce(e.agentId);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await me(a),ie.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let x=this.opts.agents.get(e.agentId);return x?(await x.msgQueue.enqueue(async()=>{x.model=i,await x.killAllRuntimes(`switchModel: ${i}`)}),ie.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i}),{ok:!0}):(ie.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{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}`);return await this.runDetailSync(e.agentId,Se.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,a){if(!this.opts.detailSyncer){ie.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(x){ie.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:a,err:String(x)})}}async getFileTree(e){Le(e._meta,"_agent/getFileTree");let i=e._meta,a=at(i),x=await this.resolveWorkspace(a),u=e.filePath??"",d=this.safeJoin(x,u),h=await dr(d).catch(()=>null);if(!h)throw new E("IPC_BAD_REQUEST",`path not found: ${u}`);if(h.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${u}`);let m=P0(e.depth);return h.isDirectory()?{tree:await qs(x,d,u,m)}:{tree:[{name:I0(u),path:Us(u||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Le(e._meta,"_agent/getFileContent");let i=at(e._meta),a=await this.resolveWorkspace(i);if(!e.filePath)throw new E("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),u=await dr(x).catch(()=>null);if(!u||!u.isFile())throw new E("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(u.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(u.size>Os)throw new E("IPC_BAD_REQUEST",`file too large: ${u.size} bytes (max ${Os})`);let d=await Ms(x);return d.includes(0)?{content:d.toString("base64"),encoding:"base64",size:u.size}:{content:d.toString("utf8"),encoding:"utf-8",size:u.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await ce(e).catch(()=>null))?.workspace??Te(e).workspace}safeJoin(e,i){let a=g0(e,i||"."),x=zs(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Fs}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return ce(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 _0(r){let e=Qt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new E("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function y0(r){return r==="claude-code"?Re(".claude","skills"):Re(".agents","skills")}var b0=3e4,v0=50*1024*1024,en=3e4;async function S0(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);Xt(e);let i=E0(r);return Xt(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await Ms(e);return Xt(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),b0);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new E("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();return Xt(x.byteLength),Buffer.from(x)}finally{clearTimeout(i)}}throw new E("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function Xt(r){if(r>v0)throw new E("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function E0(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new E("IPC_BAD_REQUEST","bad data URL");let i=!!e[2],a=e[3]??"";return i?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function C0(r){return r.length>=2&&r[0]===31&&r[1]===139}async function A0(r,e){await k0(r),await new Promise((i,a)=>{let x=Bs("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),u="";x.stderr?.on("data",h=>{u+=String(h)});let d=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar extract timeout (${en}ms)`))},en);x.on("error",h=>{clearTimeout(d),a(new E("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(d),h===0?i():a(new E("IPC_BAD_REQUEST",`tar exit ${h}${u?`: ${u.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function k0(r){let e=await new Promise((i,a)=>{let x=Bs("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),u="",d="";x.stdout?.on("data",m=>{u+=String(m)}),x.stderr?.on("data",m=>{d+=String(m)});let h=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar list timeout (${en}ms)`))},en);x.on("error",m=>{clearTimeout(h),a(new E("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),x.on("exit",m=>{clearTimeout(h),m===0?i(u):a(new E("IPC_BAD_REQUEST",`tar list exit ${m}${d?`: ${d.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)});for(let i of e.split(`
89
+ `)){let a=i.trim();if(!a)continue;let x=a.charCodeAt(0);if(x!==45&&x!==100)throw new E("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let d=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!d)continue;if(d.startsWith("/"))throw new E("IPC_BAD_REQUEST",`tar entry absolute path: ${d}`);if(d.split(/[/\\]/).some(m=>m===".."))throw new E("IPC_BAD_REQUEST",`tar entry contains '..': ${d}`)}}async function qs(r,e,i,a){if(a<=0)return[];let x;try{x=await u0(e,{withFileTypes:!0})}catch{return[]}let u=[];for(let d of x){if(w0.has(d.name)||d.isSymbolicLink())continue;let h=Re(e,d.name),m=h0(Re(i,d.name)),w=null;try{w=await dr(h)}catch{continue}if(w.isSymbolicLink())continue;let b={name:d.name,path:Us(zs(r,h)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&a>1&&(b.children=await qs(r,h,m,a-1)),u.push(b)}return u.sort((d,h)=>d.isDir!==h.isDir?d.isDir?-1:1:d.name.localeCompare(h.name)),u}function P0(r){return!r||r<=0?p0:Math.min(r,m0)}function I0(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function Us(r){return r.split(Fs).join("/")}K();var Ct=N("agent-health-reporter"),D0=1e4,tn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??D0}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()}),Ct.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Ct.info("heartbeat stopped"))}async tick(){if(this.inFlight){Ct.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Ct.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let i=[];for(let x of this.opts.core.agents.values()){let u=T0(x);u&&i.push({agentId:x.agentId,status:u})}if(i.length===0)return;let a={agents:i,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(x){Ct.warn("heartbeat batch send failed",{count:i.length,err:String(x)})}}finally{this.inFlight=!1}}};function T0(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}Ue();import{mkdir as lr,rm as j0}from"node:fs/promises";import{spawn as B0}from"node:child_process";function At(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function nn(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function xt(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ye(r,e){return{jsonrpc:"2.0",id:r,error:e}}var rn=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)}},j={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 Ks(r){return"method"in r&&"id"in r&&r.id!==void 0}function Hs(r){return"method"in r&&!("id"in r)}function sn(r){return!("method"in r)&&"id"in r}var L0={AGENT_NOT_FOUND:j.AGENT_NOT_FOUND,AGENT_BUSY:j.AGENT_BUSY,AGENT_DISCONNECTED:j.AGENT_DISCONNECTED,AGENT_TIMEOUT:j.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:j.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:j.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:j.INTERNAL_ERROR,BRIDGE_INTERNAL:j.INTERNAL_ERROR,IPC_AUTH_FAILED:j.INTERNAL_ERROR,IPC_BAD_REQUEST:j.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:j.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:j.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:j.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:j.INTERNAL_ERROR};function on(r){return r instanceof E?{code:L0[r.code]??j.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:j.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function Gs(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 js(r){return`${JSON.stringify(r)}
90
+ `}var an=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(`
91
+ `);this.buffer=i.pop()??"";let a=[];for(let x of i){let u=x.replace(/\r$/,"").trim();if(u)try{a.push(JSON.parse(u))}catch(d){this.onError?.({line:u,error:d})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(i){return this.onError?.({line:e,error:i}),[]}}};var Js={"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"},od=Object.fromEntries(Object.entries(Js).map(([r,e])=>[e,r])),R0={"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:[]},ut=class{seq=0;next(e,i){this.seq+=1;let a=Js[e]??N0(e),x=R0[a]??[],u=[a,String(this.seq)];if(x.length>0){let d=x.map(m=>Ws(i?.[m]??"")),h=O0(d).join(":");h&&u.push(h)}else i&&Object.values(i).some(d=>d)&&u.push(Object.values(i).filter(Boolean).map(d=>Ws(String(d))).join(":"));return u.join("_")}reset(){this.seq=0}};function N0(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Ws(r){return r.replace(/[:_\s]+/g,"-")}function O0(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}K();var M0=3e4;function Vs(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=N(`downstream.${this.constructor.name}`),this.decoder=new an({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new ut;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new E("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=B0(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 E("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let u of this.exitHandlers)u(a,x)}),i.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new E("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:i.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let i=this.child,a=new Promise(u=>i.once("exit",()=>u()));Vs(i.pid,"SIGTERM");let x=setTimeout(()=>{i.killed||Vs(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(nn("session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(xt(e,i))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(Ye(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=M0){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),u=At(x,e,i),d=a>0&&Number.isFinite(a);return new Promise((h,m)=>{let w=d?setTimeout(()=>{this.pending.delete(x),m(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:h,reject:m,timer:w,method:e});try{this.writeFrame(u)}catch(b){w&&clearTimeout(w),this.pending.delete(x),m(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(js(e))}dispatch(e){if(sn(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(Gs(e.error)):i.resolve(e.result);return}if(Hs(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(Ks(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(Ye(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(Ye(e.id,on(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var z0="@agentclientprotocol/claude-agent-acp@latest";function F0(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 cn=class extends Ke{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",z0],x={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return F0(e)}};import{mkdtempSync as q0,rmSync as U0}from"node:fs";import{tmpdir as K0}from"node:os";import{join as H0}from"node:path";var G0="@zed-industries/codex-acp@latest",xn=class extends Ke{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=e.command??"npx",a=e.args??["-y",G0],x=e.extraArgs?[...a,...e.extraArgs]:a,u=e.isolateCodexHome?q0(H0(K0(),"coze-bridge-codex-home-")):void 0,d=u?{...e.env??{},CODEX_HOME:u}:e.env,h={command:i,args:x,cwd:e.cwd,...d?{env:d}:{}};super(h),this.authMethodId=e.authMethodId,this.codexHomeDir=u}async initialize(e){let i=await super.initialize(e);return this.authMethodId&&await this.call("authenticate",{methodId:this.authMethodId}),i}async stop(e){if(await super.stop(e),this.codexHomeDir)try{U0(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};import{spawn as Ys}from"node:child_process";K();var un=class extends Ke{framework="openclaw";registerLog;profile;agentId;sessionName;registered=!1;constructor(e){let i=e.profile??"coze",a=e.sessionName??"default",x=["--profile",i,"acp","--session",`agent:${e.agentId}:${a}`],u={command:e.command,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(u),this.profile=i,this.agentId=e.agentId,this.sessionName=a,this.registerLog=N("downstream.openclaw.register")}async start(){await this.registerAgent().catch(e=>{this.registerLog.warn("openclaw agents add failed (will continue to acp anyway)",{agentId:this.agentId,err:String(e)})}),await super.start()}registerAgent(){return new Promise((e,i)=>{let a=Ys(this.opts.command,["--profile",this.profile,"agents","add",this.agentId,"--workspace",this.opts.cwd,"--non-interactive"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",u=>{x+=u.toString("utf8")}),a.on("error",i),a.on("close",u=>{u===0?(this.registered=!0,this.registerLog.info("agent registered",{agentId:this.agentId,profile:this.profile}),e()):i(new E("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${u}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(i=>{let a=Ys(this.opts.command,["--profile",this.profile,"agents","delete",this.agentId,"--force"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",u=>{x+=u.toString("utf8")}),a.on("error",u=>{this.registerLog.warn("openclaw agents delete failed (best-effort)",{agentId:this.agentId,err:String(u)}),i()}),a.on("close",u=>{u===0?this.registerLog.info("agent unregistered",{agentId:this.agentId}):this.registerLog.warn("openclaw agents delete non-zero exit",{agentId:this.agentId,code:u,stderr:x.trim()}),this.registered=!1,i()})})}get acpSessionName(){return this.sessionName}};K();ae();var fn=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 dn=class{agentId;framework;workspace;deployType;msgQueue;sessions=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",this.msgQueue=new fn}async dispose(e){this.status="stopped",this.msgQueue.dispose(new Error(`AgentSession disposed${e?`: ${e}`:""}`)),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,a]of this.sessions)kt(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function kt(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}var He=N("agent-manager"),W0=(r,e,i,a,x,u)=>{switch(r){case"claude-code":{let d=x?Ls(x):void 0;return new cn({cwd:i,...d&&Object.keys(d).length>0?{env:d}:{}})}case"codex":{let d=x?Rs(x):[],h=x?Ns(x):void 0,m=!!x;return new xn({cwd:i,...d.length>0?{extraArgs:d}:{},...h&&Object.keys(h).length>0?{env:h}:{},...m?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new un({command:e,cwd:i,agentId:a,...u?{sessionName:Qt(u)}:{}})}};function J0(r){return r==="claude-code"||r==="codex"}var V0={path:"",version:"cloud-deployed"},Y0={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},$0=2e4,ln=class{paths;config;registry;factory;createTimeoutMs;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??W0,this.createTimeoutMs=e.createTimeoutMs??$0}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=Et(e._meta)==="cloud";if(i&&e.framework==="openclaw")return He.info("cloud-deployed openclaw, ack without local spawn",{agentId:e.agentId,framework:e.framework}),{ok:!0,agentId:e.agentId,framework:e.framework};this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new E("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")He.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(_=>He.warn("dispose stale agent failed (ignored)",{err:String(_)})),this.registry.unregister(e.agentId);else return He.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!i&&!this.config.frameworksCache?.[e.framework])throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let x=Te(e.agentId,this.paths),u=e.workspace??x.workspace,d=Et(e._meta),h=new AbortController,m=setTimeout(()=>h.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),w,b=!1;try{let _=()=>{if(h.signal.aborted)throw h.signal.reason instanceof Error?h.signal.reason:new E("AGENT_TIMEOUT","_agent/create aborted")};await lr(x.root,{recursive:!0}),await lr(u,{recursive:!0}),await lr(x.logs,{recursive:!0}),_(),await ot(u,e.framework,e.agentId,e.cozeIdentity),_();let C=await ce(e.agentId,this.paths).catch(()=>null),L=Ds({model:e.model??C?.model});if(w=new dn({agentId:e.agentId,framework:e.framework,workspace:u,model:L.model??ct,deployType:d}),w.status="ok",C?.sessions){for(let[z,ee]of Object.entries(C.sessions))w.sessions.set(z,{acpSessionId:ee.acpSessionId,modelToken:ee.modelToken,tokenGeneratedAt:ee.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1});let R=Object.keys(C.sessions).length;R>0&&He.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:R})}this.registry.register(w),b=!0;let I={agentId:e.agentId,framework:e.framework,workspace:u,cozeIdentity:e.cozeIdentity,createdAt:C?.createdAt??Date.now(),sessions:C?.sessions??{},model:L.model};return d==="cloud"&&(I.deployType="cloud"),C?.skills&&(I.skills=C.skills),C?.agentName&&(I.agentName=C.agentName),C?.description&&(I.description=C.description),await me(I,this.paths),He.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:d}),{ok:!0,agentId:e.agentId,workspace:u,framework:e.framework}}catch(_){throw He.error("agent create failed, rolling back",{agentId:e.agentId,err:String(_)}),b&&w&&(await w.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await j0(x.root,{recursive:!0,force:!0}).catch(C=>He.warn("rm agent dir failed (ignored)",{err:String(C)})),_ instanceof E?_:new E("AGENT_SPAWN_FAILED",String(_),{cause:_})}finally{clearTimeout(m)}}async spawnSessionDownstream(e,i,a){let u=this.config.frameworksCache?.[e.framework];if(!u)if(e.deployType==="cloud"&&J0(e.framework))u=V0;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,h=this.factory(e.framework,u.path,e.workspace,e.agentId,d,a);try{return await h.start(),await h.initialize(Y0),h}catch(m){throw await h.stop("spawnSessionDownstream failed").catch(()=>{}),m instanceof E?m:new E("AGENT_SPAWN_FAILED",m instanceof Error?m.message:String(m),{cause:m})}}};K();import{spawn as Q0}from"node:child_process";import{constants as $s,access as X0}from"node:fs/promises";import{delimiter as Z0,join as ec}from"node:path";var tc=N("framework-detector"),Qs={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},nc=[".exe",".cmd",".bat",".ps1"],Pt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Q0,access:e.access??X0}}async detect(e){let i=Qs[e],a=await this.which(i);if(!a)return tc.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(Qs).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(Z0).filter(Boolean),a=this.env.platform==="win32"?["",...nc]:[""];for(let x of i)for(let u of a){let d=ec(x,e+u);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?$s.F_OK:$s.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",x=!1,u,d=h=>{x||(x=!0,u&&clearTimeout(u),i(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});u=setTimeout(()=>{h.kill("SIGKILL"),d("unknown")},5e3),h.stdout?.on("data",m=>{a+=m.toString("utf8")}),h.on("error",()=>d("unknown")),h.on("close",()=>{let m=sc(a).split(/\r?\n/)[0]??"";d(m)})}catch{d("unknown")}})}},rc=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function sc(r){return r.replace(rc,"")}xr();ae();var ic=10*6e4;function Xs(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?ic:e}function hn(r){return Ht(r??H().configFile)}function It(r,e){return Gt(e??H().configFile,r)}import{randomBytes as oc}from"node:crypto";Ue();K();var W=N("core"),ac=3e4,cc=3e4,gn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new ut;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=Xs(e.bridgeConfig)}registerExtension(e,i){this.extensions[e]=i}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),W.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){W.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),W.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){W.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)&&W.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,a){let x=a.downstream;x&&(x.onUpdate(u=>{a.loadingSession||this.forwardUpdate(e,u)}),x.onAgentRequest(u=>{this.handleAgentRequest(e,x,u)}),x.onExit((u,d)=>{W.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:u,signal:d}),kt(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(sn(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;try{if(e.method.startsWith("_agent/")){let a=this.extensions[e.method];if(!a){i!==null?await this.sendError(i,j.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):W.warn("drop notification: extension not registered",{method:e.method});return}let x=await a(e,this);i!==null&&await this.upstream.send(xt(i,x));return}if(e.method.startsWith("session/")){let a=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(xt(i,a));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(xt(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,j.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):W.warn("drop unknown notification",{method:e.method})}catch(a){W.error("handleFrame failed",{method:e.method,err:String(a)}),i!==null&&await this.upstream.send(Ye(i,on(a)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new E("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new E("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new E("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new E("AGENT_NOT_FOUND",`agent not found: ${a}`);if(e.method==="session/cancel")return this.dispatchSessionCall(x,e.method,i);let u=Date.now(),d=!1;try{let h=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,i));return d=!0,h}finally{W.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-u,ok:d})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:x}=Ps(a);switch(i){case"session/new":{let u=xc();return W.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:u}),{sessionId:u}}case"session/load":{let u=x;return W.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:u.sessionId}),{}}case"session/prompt":{let u=x,d=u.sessionId;if(!d)throw new E("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,d);if(await this.ensureDownstream(e,d,h),!h.downstream||!h.acpSessionId)throw new E("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let m=a._meta?.cozeTriggerMsgId;m?e.activeTriggers.set(h.acpSessionId,m):e.activeTriggers.delete(h.acpSessionId);try{let w=await h.downstream.sessionPrompt({...u,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),w}finally{e.activeTriggers.delete(h.acpSessionId),h.downstream?.isAlive()&&this.armIdleTimer(e,d,h)}}case"session/cancel":{let d=x.sessionId;if(!d)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(d);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.acpSessionId}),{ok:!0}}default:throw new E("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}async ensureRuntime(e,i){let a=e.sessions.get(i);if(a)return a;let u={modelToken:e.deployType==="cloud"?await this.requestSessionToken(e.agentId,i):"",tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1};return e.sessions.set(i,u),await this.persistSessionMapping(e),u}async requestSessionToken(e,i){let a={sessionId:i,_meta:{cozeAgentId:e}};try{let x=await this.sendRequest(Se.GEN_MODEL_TOKEN,a,cc);if(!x?.modelToken)throw new E("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return x.modelToken}catch(x){throw x instanceof E&&x.code==="MODEL_TOKEN_GEN_FAILED"?x:new E("MODEL_TOKEN_GEN_FAILED",x instanceof Error?x.message:String(x),{cause:x})}}async ensureDownstream(e,i,a){if(kt(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new E("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let x=await this.sessionSpawner(e,a.modelToken,i);if(a.downstream=x,this.attachRuntimeHooks(e,i,a),a.acpSessionId){a.loadingSession=!0;try{await x.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),W.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId})}catch(u){W.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId,err:String(u)}),a.acpSessionId=void 0;let d=await x.sessionNew({cwd:e.workspace});a.acpSessionId=d.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let u=await x.sessionNew({cwd:e.workspace});a.acpSessionId=u.sessionId,await this.persistSessionMapping(e)}}armIdleTimer(e,i,a){kt(a),a.idleTimer=setTimeout(()=>{W.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let x=a.downstream;a.downstream=void 0,a.idleTimer=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),x&&x.stop("idle timeout").catch(u=>W.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(u)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}forwardUpdate(e,i){let a=i.sessionId,x=this.reverseSessionId(e,a);if(!x){W.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let u={cozeAgentId:e.agentId},d=e.activeTriggers.get(a);d&&(u.cozeTriggerMsgId=d),this.upstream.send(nn("session/update",{...i,sessionId:x,_meta:u})).catch(h=>W.warn("forward update failed",{agentId:e.agentId,err:String(h)}))}handleAgentRequest(e,i,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,i,a);return}W.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),i.respondAgentRequestError(a.id,{code:j.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}forwardPermissionRequest(e,i,a){let x=this.upstreamIds.next("session/request_permission"),u=a.params??{},h=u.sessionId,m=h?e.activeTriggers.get(h):void 0,w={cozeAgentId:e.agentId};m&&(w.cozeTriggerMsgId=m);let b=h?this.reverseSessionId(e,h):void 0,_={...u,...b?{sessionId:b}:{},_meta:w};this.pendingUpstream.set(x,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),this.upstream.send(At(x,"session/request_permission",_)).catch(C=>{this.pendingUpstream.delete(x),W.error("forward permission request failed",{agentId:e.agentId,err:String(C)}),i.respondAgentRequestError(a.id,{code:j.INTERNAL_ERROR,message:`upstream send failed: ${String(C)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),e.error?i.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.downstream.respondAgentRequest(i.agentRequestId,e.result);return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new rn(e.error)):a.resolve(e.result);return}W.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=ac){let x=this.upstreamIds.next(e);return new Promise((u,d)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),d(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:u,reject:d,timer:h}),this.upstream.send(At(x,e,i)).catch(m=>{let w=this.pendingBridge.get(x);w&&(clearTimeout(w.timer),this.pendingBridge.delete(x)),d(m)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[a,x]of e.sessions){let u={modelToken:x.modelToken,tokenGeneratedAt:x.tokenGeneratedAt};x.acpSessionId&&(u.acpSessionId=x.acpSessionId),i.set(a,u)}await fr(e.agentId,i,this.paths)}catch(i){W.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(Ye(e,{code:i,message:a}))}};function xc(){return oc(16).toString("hex")}K();ae();import{randomBytes as uc}from"node:crypto";import{chmod as fc,mkdir as dc,writeFile as Zs}from"node:fs/promises";import{createServer as lc}from"node:http";import{dirname as hc}from"node:path";var gc=1e6,hr=N("ipc"),pn=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(i=>[`${i.method} ${i.path}`,i])),this.paths=e.paths??H()}async start(){this.token=uc(32).toString("hex");let e=lc((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(),hr.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 dc(hc(this.paths.portFile),{recursive:!0}),await Zs(this.paths.portFile,String(this.port),"utf8"),await Zs(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await fc(this.paths.tokenFile,384)}catch(e){hr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Dt(i,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,u=this.routes.get(x);if(!u){Dt(i,404,{error:"not found"});return}let d=null;if(e.method==="POST")try{d=await pc(e)}catch(h){Dt(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await u.handler(d,e);Dt(i,200,h??{ok:!0})}catch(h){hr.error("IPC handler failed",{key:x,err:String(h)}),Dt(i,500,{error:h instanceof Error?h.message:String(h)})}}};function Dt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function pc(r){let e=[],i=0;for await(let x of r){let u=x;if(i+=u.length,i>gc)throw new Error("body too large");e.push(u)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Ao=De(ui(),1);var Qx=De(io(),1),Xx=De(Ln(),1),Zx=De(lt(),1),eu=De(kr(),1),tu=De(Dr(),1),nu=De(Br(),1),go=De(Bn(),1),ru=De(ho(),1);var po=go.default;K();var zn="1008033",mo="1289";var wo="pbbp2",_o="https://www.coze.cn",yo="/api/coze_claw/resource/get_frontier_key",su="https://www.coze.cn",iu="wss://frontier.coze.cn";function bo(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??su}function vo(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??iu}function Fn(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),a&&(e["x-use-ppe"]=a),e}var ne=N("upstream.frontier"),Eo="application/json",Co="none",qn=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:_o,...Fn(this.opts.ppeOverride)};class i extends po{constructor(h){super(h,wo,{headers:e})}send(h,...m){if(As("debug"))try{let w;typeof h=="string"?w=Buffer.from(h,"utf8"):h instanceof Buffer?w=h:h instanceof ArrayBuffer?w=new Uint8Array(h):ArrayBuffer.isView(h)?w=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):w=new Uint8Array(0);let b=Buffer.from(w.slice(0,128)).toString("hex");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(h,...m)}}let a=vo(this.opts.urlOverride),x={url:a,ws:i,fpID:mo,aID:zn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:Eo,force:!0},payloadEncoding:{encoding:Co,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},u=new Ao.FWS(x);u.onopen=()=>{this.opened=!0,this.openCount+=1;let d=this.openCount===1;ne.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:d,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:d})).catch(h=>ne.warn("onConnect handler threw (ignored)",{err:String(h)}))},u.onclose=d=>{this.opened=!1,ne.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},u.onerror=d=>{ne.warn("frontier error",{code:d.code,msg:d.message})},u.onmessage=d=>this.handleMessage(d),this.fws=u,await u.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(a){ne.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new E("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;ne.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:Eo,payloadEncoding:Co})}catch(u){throw new E("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(u)}`,{cause:u})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let i=e.message?.service;if(i!==33555712){ne.debug("drop non-adapter frontier frame",{service:i});return}let a=cu(e);if(!a){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:a.length});return}let x;try{x=JSON.parse(a)}catch(u){ne.warn("frontier message JSON parse failed",{err:String(u),head:a.slice(0,80)});return}ne.info("frontier frame in",{logid:au(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(u=>ne.warn("frontier frame handler threw",{err:String(u)}))}};function au(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function cu(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}}K();function Po(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var ko=N("handshake");async function Io(r){let e=bo(r.endpoint),i=r.timeoutMs??1e4,a=`${xu(e)}${yo}?aid=${encodeURIComponent(zn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Fn(r.ppeOverride)},u=new AbortController,d=setTimeout(()=>u.abort(),i);ko.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:x,signal:u.signal}),m=h.headers.get("x-tt-logid")??"",w=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let L=await h.text().catch(()=>"");throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${L.slice(0,200)}`)}let b=await h.json();if(b.code!==void 0&&b.code!==0)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${b.code} msg=${b.msg??"-"} logid=${m}`);let _=b.data?.access_key,C=b.data?.device_id;if(!_||!C)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(b)}`);return ko.info("handshake ok",{remoteDeviceId:C,logid:m,traceId:w}),{accessKey:_,deviceId:C}}catch(h){throw h instanceof E?h:h.name==="AbortError"?new E("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new E("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(d)}}function xu(r){return r.endsWith("/")?r.slice(0,-1):r}K();var zr=N("upstream.switchable"),Un=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;zr.info("swap upstream",{reason:i});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw zr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(i??"swapped").catch(x=>zr.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()}};K();var Fr=N("upstream"),Ft=class{handler=null;async start(){Fr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Fr.info("NoopUpstream stopped",{reason:e})}async send(e){Fr.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)}};K();ae();K();ae();import{execSync as uu}from"node:child_process";import{readFileSync as Do,unlinkSync as fu}from"node:fs";import{mkdir as du,readFile as To,unlink as Lo,writeFile as lu}from"node:fs/promises";import{dirname as hu}from"node:path";var gu=N("single-instance"),Kn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??H().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(gu.warn("removing stale pid file",{stalePid:e}),await Lo(this.pidFile).catch(()=>{})),await du(hu(this.pidFile),{recursive:!0}),await lu(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await To(this.pidFile,"utf8")).trim()===String(process.pid)&&await Lo(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await To(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=Do(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=uu(`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{Do(this.pidFile,"utf8").trim()===String(process.pid)&&fu(this.pidFile)}catch{}})}};var B=N("daemon"),pu="coze-bridge-daemon";async function Oo(){let r=new Kn({processTitle:pu}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await hn(),a=i??{};ur({pid:process.pid}),B.info(i?"loaded bridge config":"initialized bridge config");try{let D=new Pt;a.frameworksCache=await D.detectAll(),B.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(D){B.warn("framework detection failed",{err:String(D)})}await It(a);let x=new Un(new Ft),u=H(),d=null,h=new gn({upstream:x,paths:u,bridgeConfig:a,sessionSpawner:async(D,q,V)=>{if(!d)throw new Error("agentManager not ready");return d.spawnSessionDownstream(D,q,V)}});await wu(u,h);let m=new ln({paths:u,config:a,registry:h});d=m;let w,b,_=null,C=null;h.registerExtension("_agent/create",async D=>m.createAgent(D.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let L={},I=new Zt({agents:h.agents,disposeAndMarkDisconnected:async(D,q)=>{let V=h.agents.get(D);V&&(await V.dispose(`disconnect: ${q}`).catch(he=>B.warn("dispose during disconnect failed (ignored)",{agentId:D,err:String(he)})),V.status="disconnected",h.unregister(D)),h.disconnectedAgents.add(D)},detailSyncer:async D=>{if(!L.ref)throw new Error("agent-detail-sync not initialized yet");await L.ref.syncOne(D)}});h.registerExtension("_agent/listSkills",D=>I.listSkills(D.params)),h.registerExtension("_agent/addSkills",D=>I.addSkills(D.params)),h.registerExtension("_agent/removeSkills",D=>I.removeSkills(D.params)),h.registerExtension("_agent/getFileTree",D=>I.getFileTree(D.params)),h.registerExtension("_agent/getFileContent",D=>I.getFileContent(D.params)),h.registerExtension("_agent/update",D=>I.updateAgent(D.params)),h.registerExtension("_agent/disconnect",D=>I.disconnectAgent(D.params)),h.registerExtension("_agent/switchModel",D=>I.switchModel(D.params)),h.registerExtension("_agent/reset",D=>I.resetAgent(D.params)),h.registerExtension("_agent/repair",D=>I.repairAgent(D.params));let R=new $t({paths:u,handlers:I,sendDetail:D=>h.sendRequest("_agent/detail",D)});L.ref=R,x.onConnect(({initial:D})=>{B.info("frontier upstream connected, triggering detail sync",{initial:D}),R.syncAll(D?"initial-connect":"reconnect").catch(q=>B.warn("detail sync top-level error (ignored)",{err:String(q)}))});let z=new pn({paths:u,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:_??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async D=>{let q=D,V=q?.privatecode,he=q?.pairing_code;if(!V||!he)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let ke=Po(q.env),ge=q.handshake_url,Je=q.frontier_url,yt=mu(q.env,ge,Je),qt=!!w&&w!==V,ye=b!==void 0&&b!==yt,be=qt||ye;if(be){B.warn("pair config switched, resetting agents",{pcChanged:qt,envChanged:ye,previousPc:w?Ro(w):"",nextPc:Ro(V),previousEnvKey:b??"",nextEnvKey:yt});for(let U of[...h.agents.values()])await U.dispose("pair config switch").catch(()=>{}),h.agents.delete(U.agentId);await x.swap(new Ft,"pair switch").catch(()=>{})}let Ut=await Io({privatecode:V,...ge?{endpoint:ge}:{},ppeOverride:ke});_=Ut.deviceId,ur({deviceId:_,pid:process.pid});let re=new qn({handshake:Ut,privatecode:V,...Je?{urlOverride:Je}:{},ppeOverride:ke});await x.swap(re,"pair");let Kt=Object.keys(a.frameworksCache??{});try{let U=await h.sendRequest("_agent/pair",{pairCode:he,patToken:V,frameworks:Kt,_meta:{cozeDeviceId:_}});B.info("_agent/pair ok",{pairResult:U}),w=V,b=yt,C||(C=new tn({core:h,getDeviceId:()=>_??""})),C.start(),be&&No(u,m).catch(Pe=>B.warn("post-pair-switch auto-revive error (ignored)",{err:String(Pe)}));let J;return q.agent_id&&(J=await _u(q.agent_id,u,m,Pe=>h.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(U){return B.error("_agent/pair failed",{err:String(U)}),{ok:!1,note:`pair failed: ${String(U)}`}}}},{method:"POST",path:"/_agent/create",handler:async D=>{let q=D;return{ok:!0,result:await m.createAgent(q)}}},{method:"POST",path:"/refresh",handler:async()=>{B.info("IPC /refresh: re-detecting frameworks");let D=new Pt;return a.frameworksCache=await D.detectAll(),await It(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(B.info("IPC /shutdown received"),setImmediate(()=>{oe.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:ee,token:le}=await z.start();await h.start(),No(u,m).catch(D=>B.warn("auto-revive top-level error (ignored)",{err:String(D)}));let _e=null,oe={port:ee,token:le,core:h,ipc:z,shutdown(D){return _e||(B.info("daemon shutdown",{reason:D}),_e=(async()=>{C?.stop(),await h.stop(D),await z.stop(),await r.release()})(),_e)}};for(let D of["SIGTERM","SIGINT"])process.on(D,()=>{oe.shutdown(D).then(()=>process.exit(0))});return B.info("daemon ready",{port:ee,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),oe}function Ro(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function mu(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function wu(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:u}=await Promise.resolve().then(()=>(Ue(),Yt));for(let d of a){await u(d,r).catch(h=>B.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(h)}));try{let h=await x(d,r);h?.disconnectedAt&&(e.disconnectedAgents.add(d),B.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){B.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(h)})}}}async function _u(r,e,i,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ue(),Yt)),u=await x(r,e);if(u){B.info("--agent-id: local config found, reconnecting",{agentId:r,framework:u.framework,hadDisconnect:!!u.disconnectedAt});let w={agentId:u.agentId,framework:u.framework,...u.cozeIdentity?{cozeIdentity:u.cozeIdentity}:{},...u.model?{model:u.model}:{}};return await i.createAgent(w),{ok:!0,agentId:r,note:u.disconnectedAt?"revived from local config":"connected from local config"}}B.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let d=await a({_meta:{cozeAgentId:r}});if(!d.framework)throw new E("AGENT_NOT_FOUND",`agent ${r} \u4E0D\u5728\u672C\u5730; \u4E91\u7AEF _agent/detail \u54CD\u5E94\u7F3A framework \u5B57\u6BB5 (D36 \u534F\u8BAE\u6269\u5C55\u672A\u751F\u6548), \u65E0\u6CD5\u5728\u672C\u673A\u65B0\u5EFA`);let h={agentId:d.agentId,framework:d.framework,...d.cozeIdentity?{cozeIdentity:d.cozeIdentity}:{},...d.model?{model:d.model}:{},...d.deployType?{_meta:{cozeDeployType:d.deployType}}:{}};await i.createAgent(h);let m=d.deployType==="cloud"&&d.framework==="openclaw";return{ok:!0,agentId:r,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function No(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ue(),Yt));B.info("auto-revive: scanning local agents on startup",{count:a.length});let u=0,d=0;for(let h of a){let m;try{m=await x(h,r)}catch(w){B.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(w)}),d+=1;continue}if(!m){d+=1;continue}if(m.disconnectedAt){B.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),d+=1;continue}try{B.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:h,framework:m.framework}),await e.createAgent({agentId:m.agentId,framework:m.framework,...m.cozeIdentity?{cozeIdentity:m.cozeIdentity}:{},...m.model?{model:m.model}:{},...m.deployType?{_meta:{cozeDeployType:m.deployType}}:{}}),u+=1}catch(w){B.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(w)}),d+=1}}return B.info("auto-revive: done",{revived:u,skipped:d,total:a.length}),{revived:u,skipped:d,total:a.length}}Ur();ae();import{readFile as Mo}from"node:fs/promises";var We=class{paths;constructor(e){this.paths=e??H()}async probe(e=1e3){let i=await this.readAuth();if(!i)return{kind:"not-running"};try{let a=await this.fetch(i,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...i}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:Pu(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([Mo(this.paths.portFile,"utf8"),Mo(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 u=new AbortController,d=setTimeout(()=>u.abort(),i.timeoutMs??5e3);try{let h=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:x,body:a?JSON.stringify(i.body):void 0,signal:u.signal}),m=await h.text();return{status:h.status,body:ku(m)}}finally{clearTimeout(d)}}};function ku(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function Pu(r){return r instanceof Error?r.message:String(r)}K();ae();import{copyFile as zo,mkdir as Iu,readFile as Kr,writeFile as Du}from"node:fs/promises";import{dirname as Tu,resolve as Hr,sep as Hn}from"node:path";import{fileURLToPath as Lu}from"node:url";K();ae();var Fo=N("dist-install");function Ru(r){let e=Lu(r),i=Tu(e),a=`${Hn}src${Hn}`;if(i.includes(a)||i.endsWith(`${Hn}src${Hn}cli`))return null;let x=Hr(i,"index.js"),u=Hr(i,"..","package.json");return{dist:x,pkgJson:u}}async function qo(r={}){let e=r.paths??H(),i=Ru(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 u;try{u=JSON.parse(await Kr(x,"utf8")).version??"unknown"}catch(_){return Fo.warn("cannot read source package.json,skip dist install",{err:String(_)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(_)}`}}let d=await hn(e.configFile)??{},h=d.libVersion;if(h===u)try{return await Kr(e.libEntry),{kind:"already-current",libVersion:u}}catch{}await Iu(e.libDir,{recursive:!0}),await zo(a,e.libEntry),await zo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=Hr(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
92
+ `;return await Kr(m,"utf8").catch(()=>null)!==w&&await Du(m,w),d.libVersion=u,await It(d,e.configFile),Fo.info("dist installed",{libEntry:e.libEntry,fromVersion:h,toVersion:u}),h?{kind:"version-changed",fromVersion:h,toVersion:u,libEntry:e.libEntry}:{kind:"first-install",libVersion:u,libEntry:e.libEntry}}var Xu=N("cli");function _t(r,e){let i=[],a;for(let x=0;x<r.length;x++){let u=r[x];if(u===e){a=r[x+1],x+=1;continue}if(u.startsWith(`${e}=`)){a=u.slice(e.length+1);continue}i.push(u)}return{value:a,rest:i}}function Zu(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}=_t(i,"--pat-token");i=x;let{value:u,rest:d}=_t(i,"--pair-code");i=d;let{value:h,rest:m}=_t(i,"--env");i=m;let{value:w,rest:b}=_t(i,"--handshake-url");i=b;let{value:_,rest:C}=_t(i,"--frontier-url");i=C;let{value:L}=_t(i,"--agent-id");if(!a||!u)return{mode:"help"};let I={mode:"pair",privatecode:a,pairingCode:u};return h&&(I.env=h),w&&(I.handshakeUrl=w),_&&(I.frontierUrl=_),L&&(I.agentId=L),I}var ef=`
93
93
  coze-bridge - local bridge daemon for cloud Agent Service
94
94
 
95
95
  Usage:
@@ -116,35 +116,35 @@ Auto-connect agent (optional):
116
116
 
117
117
  Internal:
118
118
  <node> <entry> --daemon daemon mode (OS supervisor only)
119
- `.trimStart();async function Wo(r=process.argv,e={}){let i=Zf(r);switch(i.mode){case"help":return process.stdout.write(Qf),0;case"daemon":{try{await Oo()}catch(a){return $f.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return eu(e);case"stop":return tu(e);case"refresh":return nu(e);case"uninstall":return ru(e);case"install-service":return su();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),iu(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function jo(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 eu(r){let e=r.paths??G(),i=new Ge(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
120
- `),1;if(a.kind==="stale")return await jo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
119
+ `.trimStart();async function Wo(r=process.argv,e={}){let i=Zu(r);switch(i.mode){case"help":return process.stdout.write(ef),0;case"daemon":{try{await Oo()}catch(a){return Xu.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return tf(e);case"stop":return nf(e);case"refresh":return rf(e);case"uninstall":return sf(e);case"install-service":return of();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),af(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function Jo(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??H(),i=new We(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
120
+ `),1;if(a.kind==="stale")return await Jo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
121
121
  `),1;let x=await i.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
122
122
  ${JSON.stringify(x.body,null,2)}
123
- `),0}async function tu(r){let e=r.paths??G(),i=new Ge(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
124
- `),0;if(a.kind==="stale")return await jo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
123
+ `),0}async function nf(r){let e=r.paths??H(),i=new We(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
124
+ `),0;if(a.kind==="stale")return await Jo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
125
125
  `),0;try{return await i.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
126
126
  `),0}catch(x){return process.stdout.write(`coze-bridge: stop failed: ${String(x)}
127
- `),1}}async function nu(r){let e=new Ge(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
127
+ `),1}}async function rf(r){let e=new We(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
128
128
  `),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
129
129
  ${JSON.stringify(a.body,null,2)}
130
130
  `),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
131
131
  `),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
132
- `),1}}async function ru(r){let e=new Ge(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
133
- `);try{await e.request({method:"POST",path:"/shutdown"})}catch(f){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(f)}
134
- `)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:d}=await Promise.resolve().then(()=>(Jr(),jr)),h=f();await h.uninstall(d()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
135
- `)}catch(f){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(f)}
136
- `)}let a=r.paths??G(),{rm:x}=await import("node:fs/promises");try{await x(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
137
- `)}catch(f){return process.stderr.write(`coze-bridge: remove failed: ${String(f)}
132
+ `),1}}async function sf(r){let e=new We(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
133
+ `);try{await e.request({method:"POST",path:"/shutdown"})}catch(u){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(u)}
134
+ `)}await new Promise(u=>setTimeout(u,500))}if(!r.skipSupervisor)try{let{getSupervisor:u,buildContext:d}=await Promise.resolve().then(()=>($r(),Yr)),h=u();await h.uninstall(d()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
135
+ `)}catch(u){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(u)}
136
+ `)}let a=r.paths??H(),{rm:x}=await import("node:fs/promises");try{await x(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
137
+ `)}catch(u){return process.stderr.write(`coze-bridge: remove failed: ${String(u)}
138
138
  `),1}return process.stdout.write(`coze-bridge: uninstalled
139
- `),0}async function su(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(Jr(),jr)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
139
+ `),0}async function of(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>($r(),Yr)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
140
140
  `),await i.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
141
141
  `),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
142
- `),1}}async function iu(r,e,i,a={},x){let f=new Ge(i.paths),d=i.spawnDaemon??Ro;if(!i.skipDistInstall){let w=await qo({paths:i.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
143
- `),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(y=>setTimeout(y,500)))):w.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${w.libVersion}
144
- `)}let h=await f.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
145
- `),await d({paths:i.paths}),h=await ou(f,i.waitTimeoutMs??1e4,i.sleep??au),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
146
- `),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 w=await f.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return w.status===200&&w.body?.ok?(process.stdout.write(`coze-bridge: paired (${w.body.note??"ok"})
142
+ `),1}}async function af(r,e,i,a={},x){let u=new We(i.paths),d=i.spawnDaemon??Bo;if(!i.skipDistInstall){let w=await qo({paths:i.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
143
+ `),(await u.probe()).kind==="connected"&&(await u.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(_=>setTimeout(_,500)))):w.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${w.libVersion}
144
+ `)}let h=await u.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
145
+ `),await d({paths:i.paths}),h=await cf(u,i.waitTimeoutMs??1e4,i.sleep??xf),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
146
+ `),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 w=await u.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return w.status===200&&w.body?.ok?(process.stdout.write(`coze-bridge: paired (${w.body.note??"ok"})
147
147
  `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(w.body)}
148
148
  `),1)}catch(w){return process.stderr.write(`coze-bridge: pair failed: ${String(w)}
149
- `),1}}async function ou(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 au(r){return new Promise(e=>setTimeout(e,r))}Wo(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
149
+ `),1}}async function cf(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 xf(r){return new Promise(e=>setTimeout(e,r))}Wo(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
150
150
  `),process.exit(1)});