coze-bridge 0.1.11 → 0.1.12

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 +35 -35
  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 H0=Object.create;var fr=Object.defineProperty;var j0=Object.getOwnPropertyDescriptor;var G0=Object.getOwnPropertyNames;var W0=Object.getPrototypeOf,J0=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 Ie=(r,e)=>()=>(r&&(e=r(r=0)),e);var ie=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),vs=(r,e)=>{for(var i in e)fr(r,i,{get:e[i],enumerable:!0})},V0=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of G0(e))!J0.call(r,x)&&x!==i&&fr(r,x,{get:()=>e[x],enumerable:!(a=j0(e,x))||a.enumerable});return r};var Pe=(r,e,i)=>(i=r!=null?H0(W0(r)):{},V0(e||!r||!r.__esModule?fr(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as Y0,mkdir as X0,readFile as Z0,rename as Ss,writeFile as Cs}from"node:fs/promises";import{dirname as $0}from"node:path";async function Gt(r){try{let e=await Z0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Wt(r,e,i){await X0($0(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 Cs(x,a,{encoding:"utf8",mode:i.mode}):await Cs(x,a,"utf8"),await Ss(x,r),i?.mode!==void 0&&await Y0(r,i.mode)}catch(f){await Ss(x,x).catch(()=>{});let{rm:l}=await import("node:fs/promises");throw await l(x,{force:!0}).catch(()=>{}),f}}var ur=Ie(()=>{"use strict"});function Ds(r){return Vt[Es]<=Vt[r]}function dr(r){As={...r}}function Jt(r,e,i,a){if(Vt[r]<Vt[Es])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...As,...a});r==="error"||r==="warn"?ea.write(`${x}
10
+ `):Q0.write(`${x}
11
+ `)}function R(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=>R(`${r}.${e}`)}}var Vt,Es,Q0,ea,As,K=Ie(()=>{"use strict";Vt={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"})(),Q0=process.stdout,ea=process.stderr,As={}});import{homedir as ta}from"node:os";import{join as ee}from"node:path";function H(r){let e=r??ta(),i=ee(e,".coze"),a=ee(i,"bridge"),x=ee(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:x,libEntry:ee(x,"index.js"),pidFile:ee(a,"bridge.pid"),portFile:ee(a,"bridge.port"),tokenFile:ee(a,"bridge.token"),logFile:ee(a,"bridge.log"),installLock:ee(a,"install.lock"),configFile:ee(a,"config.json"),agentsRoot:ee(i,"agents")}}function Te(r,e=H()){let i=ee(e.agentsRoot,r);return{root:i,config:ee(i,"config.json"),workspace:ee(i,"workspace"),logs:ee(i,"logs")}}var oe=Ie(()=>{"use strict"});var Zt={};vs(Zt,{AGENT_CONFIG_FILE_MODE:()=>Yt,enforceAgentConfigMode:()=>sa,loadAgentConfig:()=>ae,persistAgentSessions:()=>lr,persistAgentSkills:()=>Xt,saveAgentConfig:()=>ge});import{chmod as na,stat as ra}from"node:fs/promises";function ae(r,e){return Gt(Te(r,e).config)}function ge(r,e){return Wt(Te(r.agentId,e).config,r,{mode:Yt})}async function sa(r,e){if(process.platform==="win32")return;let i=Te(r,e).config;try{let a=await ra(i);if(!a.isFile())return;let x=a.mode&511;x!==Yt&&(await na(i,Yt),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 lr(r,e,i){let a=await ae(r,i);a&&(a.sessions=Object.fromEntries(e),await ge(a,i))}async function Xt(r,e,i){let a=await ae(r,i);a&&(a.skills=e,await ge(a,i))}var ks,Yt,Ue=Ie(()=>{"use strict";ur();K();oe();ks=R("agent-config"),Yt=384});var di=ie(j=>{"use strict";var S=P;(function(r,e){let i=P,a=r();for(;;)try{if(parseInt(i(1185))/1*(parseInt(i(1860))/2)+-parseInt(i(1009))/3+parseInt(i(1324))/4+parseInt(i(833))/5*(-parseInt(i(534))/6)+parseInt(i(1079))/7*(-parseInt(i(1533))/8)+-parseInt(i(931))/9*(-parseInt(i(1814))/10)+parseInt(i(526))/11*(parseInt(i(753))/12)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(vn,828896);function P(r,e){r=r-378;let i=vn(),a=i[r];if(P.WIebtq===void 0){var x=function(m){let _="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",b="",w="";for(let C=0,k,T,L=0;T=m.charAt(L++);~T&&(k=C%4?k*64+T:T,C++%4)?b+=String.fromCharCode(255&k>>(-2*C&6)):0)T=_.indexOf(T);for(let C=0,k=b.length;C<k;C++)w+="%"+("00"+b.charCodeAt(C).toString(16)).slice(-2);return decodeURIComponent(w)};P.eZGfgU=x,P.ZQPubA={},P.WIebtq=!0}let f=i[0],l=r+f,h=P.ZQPubA[l];return h?a=h:(a=P.eZGfgU(a),P.ZQPubA[l]=a),a}var yx=Object[S(1676)+"operty"],bx=Object[S(400)+S(1366)+S(1308)],ai=(r,e)=>function(){return r&&(e=(0,r[{wupeG:function(x,f){return x(f)}}.wupeG(bx,r)[0]])(r=0)),e},vx=(r,e)=>{let i={wVjQY:function(x,f,l,h){return x(f,l,h)}};for(var a in e)i.wVjQY(yx,r,a,{get:e[a],enumerable:!0})};function Sx(){return ni||(ni=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Cx(){let r=S;return ri||(ri=[IDBCursor[r(1276)+"e"].advance,IDBCursor[r(1276)+"e"][r(1787)],IDBCursor[r(1276)+"e"][r(1787)+r(733)+"ey"]])}function Ex(r){let e=S,i={fjTlc:function(x,f){return x(f)},EwidR:function(x){return x()},KLNwn:function(x){return x()},VLkwd:e(831),GSaRr:e(1227),UrXVl:function(x,f,l){return x(f,l)},eAoeU:e(1559)+"t",CosvY:e(715),NKWdF:function(x,f){return x===f},JRgiL:e(1260)},a=new Promise((x,f)=>{let l=e,h={iaXjE:l(1227),mkUxG:function(w,C){return i[l(1443)](w,C)},jDFBG:function(w){return i[l(1854)](w)}},m=()=>{let w=l;r[w(447)+w(502)+w(1163)](w(831),_),r[w(447)+w(502)+"ner"](h[w(976)],b)},_=()=>{let w=l;x(i[w(1443)](Ce,r[w(721)])),i[w(452)](m)},b=()=>{let w=l;h[w(1638)](f,r[w(1227)]),h[w(1278)](m)};r[l(635)+"Listener"](i.VLkwd,_),r.addEventListener(i[l(1118)],b)});return a[e(1407)](x=>{let f=e;if(x instanceof IDBCursor)if(i[f(1747)](i[f(1241)],f(1370))){let l=i[f(1007)](_0x4ca72c,i[f(1773)],{message:i[f(1650)]});this["onStartR"+f(918)]&&this["onStartR"+f(918)](l)}else wr[f(756)](x,r)}).catch(()=>{}),Cn[e(756)](a,r),a}function vn(){let r=["Dvb6wLO","q0vkDge","DfbZyLG","Ef9MCM9UDgK","y2HHCKnVzgu","Cg9PBNrdB24","wM9SD0m","DgfIyxnL","z2v0sxrLBq","zw5JB2rLrNi","Ew50swi","t0Hutha","quHTvgW","swngrwe","rwPnBMq","y3jLyxrLt3a","x2rLC3rYB3K","Bg9Nsurhzw4","uvzmvK0","zxmGCMvHy2G","B21tv0e","AgjRtK8","DcbSAw1PDa","yMfSu2nVCgu","zMX1C2HfEha","twLZC2LUzYa","quzjuNu","x3bHDgHlzxK","Duz6yLK","zNbgvgi","sLr4CwC","DMvYC2LVBMm","y3jLyxrLq2W","wLDbt3u","zufns2G","CMfTugfYyw0","Ber5qxC","Bu9vyNi","uNn4z0S","Dgv6reW","y2vZC0HHBMq","tKTxzey","sfDsD3O","rgnjCem","zffjsLO","A01fy1y","x3vYBa","zujWBvq","u2vXsuq","ChvZAa","ChjVDg9JB2W","AxnrB1nnzxm","u2jlCg0","tfPhvLi","q2fRALK","BKLnEeO","zNjHBwvuExa","DLPXyva","B1Desuy","Dg9iyxnO","tuDoswu","x2jPBMfYEvq","swH3wwO","y3vYDMfSDwu","BLPztLi","zcWG","sKzQCfy","zufVzvu","vLv0r00","BNrczgG","Bw5xuxO","A05wtKC","ug1Vu2C","rfHwALi","EwDwruu","yMLUyxj5vhK","BgPfuhe","Be1OAhm","r0rtuuG","r1vmugu","Ag5yBhG","y29UDgLUDwu","BxrzD1q","shvuv24","zgvSzxrLrge","BffKCfK","sgHxCxy","yxv0B21HDgK","BMv3vMvYC2K","CMvXDwLYzwq","tgfrEM8","Bhb5u1K","x3fVC0rc","ExbL","C0TRvvu","B1zZAxa","CunuzuG","yNPeD2y","zLvZCMW","rMTSr04","tg9NsurozxC","C0XPC3rLBMu","DMvUDa","zNjVBunOyxi","BMXVsKW","yM9L","AxbrDg4","rLP2ExK","mtbxAfLKuLK","zLbkEhe","Bw9TCeq","A0jQA3u","CuP5Aei","sKX3q0K","Auz4ANG","t1fJwxm","s0T0s2y","zM1br0y","B2fK","BgLZDgvUtMu","z29PBMCGyxC","BwrXvKu","tefcDhC","BNrbBMrvCgq","ihn1y2nLC3m","tg9Nsuq","zwrWv0W","x29Uq2XVC2u","qw5TCNC","Dener3i","sLnptLa","tKfPqNq","v2LjsMS","yvfxA2y","txPkq28","vhnJtKK","sxLVDxO","DMfSDwu","suXxAMW","rw1wDgi","D3njDK8","BNruCMLLC0m","z1PgA3a","DhjHBNnHy3q","x2rPC3bHDgm","ExHyExK","DKffAwS","q2DOrey","s0XoD24","Aw5JBhvKzxm","zKPdzeW","AwDHDg9Yt24","D0jWCKu","z2PTDvi","mLjtq0LoqW","EwPnsfK","C3nHz2vfDMu","DuPNAuu","u0LSBxm","sgv0DMO","vejuzMK","Dwj6uuO","BLbhyLC","Axf4tgq","zenNBLC","v3fwC0C","ANfRy1q","EKrkrxm","y29UDgv4Da","A0HPzMu","ywXPzcb1CMW","ywDL","AffSuee","CMvHC29U","DhjPzxmGCMu","Dhj3vMq","x2XPC3rLBMu","m3W0Fdj8mhW","zxH0zw5ZAw8","AwrI","zMjIqKS","EeXMB1O","q291BNq","r1jKweO","ihrYEsbYzwm","BfDSBxu","qLrWt3i","EMjLwhe","C3L2C24","Aw50zwDLCIa","BvPbvLO","AfbyBee","txfREgi","BwvZC2fNzv8","igzPzwXKoIa","B3vIueW","y2uGBM90igK","x21LC3nHz2u","yuL1tuK","qLrxDNO","ExzjA1G","x2rItMfTzq","C2vYDMLJzq","y25PCeq","zg9Uzq","zgLZCgf0y2G","ENrxs3O","tNvYzMm","Cg9PBNrbBMq","sKTdtg8","CMvZzxrfBMq","Ahr0Chm6","BNrfBMrWB2K","suHxrxO","D3nZoI8V","EsbJBg9Zzwq","z2v0t3DUuhi","vLDKEu4","y29Kzq","C0z5yKS","BwvZC2fNztO","q2TJzuO","vNzgC1a","x3bPBMDqB24","uxDPzeG","AgjSB2S","DxbKyxrLq3u","uMfIuxy","DMzRANu","DhvJvey","rwzhCgm","vfbUz3O","vMXksve","DMvLtMq","Dg9cExrLCW","EwTcwxe","uK5Qz2e","BwjrCK8","y1rSCKK","t3bdDwC","Aw5Lza","y3jLyxrLt2i","BMDLza","wxn4Eg0","vxDUEw4","y3r4","u0zkre4","BMnrtfm","qwLHBMC","yMLUyxj5","zwn0","sg56vKS","CMfNzvn5BMm","yw1LoIa","BgD5C3O","wuTksKS","svnnCMG","zw5fDMvUDa","wxviz3q","qMzpEwi","zw50","tejewey","BNnqD1q","CMvTB3zLrxy","EfL2r0y","B25szwnLAxy","BvPtEhq","s0D2v0O","rxDPzfi","Dg9hzw5LCMe","thr2ywS","DLvXCLG","EwjkBha","uM14Ag0","D3f4vfO","sgjdufy","Dgv4Dc9Qyxy","CKz4y3K","ywrKq291BNq","DeLK","tMfTzq","s0net0S","DKDVzge","rKLmrv9ot1q","x2fKzfDZtgK","BM5ssgC","q3zsrhe","vLHruhe","s0zHuMS","zwvVA2i","D0vkDLO","C2vUza","AxjLza","wMf0B1m","yLvWwfi","CMfTzq","Cvj6ufG","wg90q0O","r0HnBNG","vNLpBxG","ywrK","BgLUzw5V","t0XdEgK","su5Pyue","wKPSwMm","C0ruDeW","mdaWma","BNrLCG","Dw50","wLf5wuK","AgLNAa","t1PMuuy","zKDduMC","q3vZDg9Tq2W","AM9PBG","revcANe","DeLUDgvYy2u","ig1LC3nHz2u","zw50tgLZDgu","BwvY","z2v0q3vYCMu","ANvYD2i","CM92AwrLige","zKH3vKq","AeXiENi","Dxrjza","B25dBg9Zzq","AwDjtKm","sKP3z1u","ueT4Aha","yMrtt2e","zxjYtM8","q3DJsw8","B25TzxnZywC","CwvvBM4","svfVAgK","AM5ytKO","uKXfrvG","C29YDa","svflCeS","CenxB1i","BMnLq2XVC2u","otLvv0TQwNG","zujvChC","vgfN","yMfJA3vWigu","B25nzxnZywC","zeXKCKq","DgvmB2Djre4","vgXsCKC","mZC5mZHHAvrwwMe","tLfjuvK","uNH2qLO","BuztCMG","zgHkzgm","ignVzgu6ia","rvjst1i","CMvQzwn0","re5lv0e","x2LZsw5PDa","y3vYC29YlNm","qw1VDw50","y29SBM8","AxzzuMS","yw5Nzq","uwPqBgq","z2v0","AMzoz3K","C2v0q3vYC28","Agriu2u","sKvOsvO","B3LvyuW","CwPYD08","zMLN","yMnsDMW","ugjHsgu","y2PmzhC","Dgv4Dc9WBge","y3ruAw1LB3u","zNvUy3rPB24","C3jJ","x2rLyNvN","uvzAuvi","AuzhBKq","uMvHzcbWyxm","B3jL","Ec1TC2CTCw8","r0npyw4","AgvHzgvYCW","uezvue0","qLL0Ewi","wxLJDg4","x21PBMLoyxy","x2vUzhbVAw4","ExDvv1O","BgLUzq","y0DwBwu","AefpC1a","yNLL","BM1uEvq","yxr0CgC","Cg93","CYbWyxjHBxm","CM92AwrLihC","zw50zwqGDhK","B25JBg9Zzq","CMvHzfvjBNq","nxWZFdz8mxW","x2HHBMrSzva","x2nVBM5Ly3q","AxfVAMS","AxLWC2i","tw9KDwXL","Aw9UvgLTzw8","qNfpy0K","y2XVC2uSihC","u3DQtfO","y3vYC29Yx2y","qvzJtNK","vMTss1O","Aw5XuMe","B3D4A1O","tufjBfK","wfLdzee","BxnNsuq","x3nLBMrby2S","B3bLBKrc","s2TusuC","q0HTDum","wND5Bg4","q05kBMC","y2HLy2TdDxi","rhjeyMO","rLjptLrjrvi","wvPOrKS","lcbOB3n0BMe","rLfTqLK","qwjYy20","D2LSBfjLy28","zw5HyMXLuw8","s2jVDuy","y2XVC2u","B25Uzwn0Aw4","DMDgA2e","Bwf4tg9ZC0m","C29Tzq","BezxA3O","Aejoz04","wgTvs2u","uMvJB25Uzwm","zLvVsgS","ywrKrxzLBNq","DxbrqM0","ChrVCG","u2fMwLm","uNHKwxu","CMvTB3zLq2G","B3jLtMfTzxm","t1bftL9fuLi","CNzHBfzHBhu","seXTwNm","CgLUz0XVC3m","zLDqsxO","Dw5KzwzPBMu","wMjNA2e","q2H4rey","ww1KAxq","CMP6uvu","tKLszgi","whbdA3i","BfHzugK","t3bLBKv2zw4","CgLUz09Uy2u","uhLTuvi","B25LCNjVCG","BKXPBMu","wgjwqLu","yNvMzMvY","CKP1qvK","CM92AwrLigi","DgfYz2v0","EMrxuxy","B2zM","Ae1LC3nHz2u","x194x21Zz18","tffPreS","AePPs1K","BeHHBMrSzxi","ve9yEhC","CxnPEgK","y2XLyxi","y2HnyxHdB3u","su5tvefova","ywTbvxK","BwLUzW","EezbD2m","AMHNCuO","zKnru0K","D24GCMvHC28","DgPqB20","tfrKs0S","ALv2yNu","ywzL","CMHqANm","Bg9N","x3jLBw92zvC","Dg9oDw1Izxi","ve5qB3C","uMzOwxi","y1zbvha","zLfvqLO","qNLSs0m","x3bPBMDmB3m","q0Xpu0LorW","qMD0AeG","rxjYB3jdB2q","CNnVCL9Uyw0","C2fNzq","we1lz28","ihbYB3rVy28","yvzNC0S","AxnmB25N","CNjVCK1LC3m","mNWZFdf8nhW","uNzNy2y","CgfNzxnOB3C","B2zMC2v0","zMLmrvO","y2HLy2Tszwe","BhfOBNO","zLPPAgK","C3rHCNq","sg1otKy","Cgf5Bg9Hzeu","DMfSDwvZ","CMnlr2q","C3bSAxq","CMvZDwX0","zxjFDhrS","vhPPvg8","ywrKt25L","AMz4EwW","sfLbq2W","ENfYqwq","Bwf4uMv0CMK","tLv6tu0","DNnNDxe","AejNrMC","DNHXue0","uhjPBwfYEuS","zw5HyMXLqxu","EwTVBLG","x3jLywr5q2W","v2vIu29JA2u","zw5JB2rPBMC","shrZy08","zgvS","zxq9DxrMltG","rxzQBum","zKrVsLG","yxHVA3i","r1rYA1e","Euruv1K","AKv1qva","mhWZFdr8mNW","zvfbt1O","B3nLza","DvPtuwO","AuDjsuK","ntmWndeYr0fstLHp","t3D2vNu","svjnEvq","C2v0","t1LvDKK","vfPhEu8","ENjUs3K","r25twwO","D2fZq2XLyw4","y1nJBK0","uxvLDwu","A2v5","AhfvCxC","zxDHyxy","A3zgA0q","Dw5RBM93BIa","z2v0qwXS","yxrLq291BNq","yxGGCMv0CMK","zfDVCMTLCKC","zw5NDgG","AwTzrfK","uePxz2u","yKTrAuO","rNvuCvy","vgLTzw91Da","vfHfAKK","AxnVwgC","vMXpvMi","veHPA2q","Aw1LCYbPBIa","qNfRCgS","Dg9cExrLC0W","shbvyMO","C2vYDMLJzs0","rvPYqLG","EvDQEue","BvzsD1u","zxrxB3jRq2G","BMCGB3iGyw4","tgLZDgvUzxi","y29UBMvJDgK","C3vIyxjYyxK","uKfMy0K","u2HHCMvKv28","EMXxDeG","B2LTEvq","x3nLCuLK","CgLUz0LUDgu","Ag1ru0G","D29Hrfm","yNvMzMvYzwq","sgXUA0e","C2vYDMvYvgK","z0ToEeW","AwXLx25HBwu","Du9Ryuu","CMTSrKW","sg9XuuC","Bwu6ia","s1zYtvu","vhDWC1a","u2TPCcbWyxm","rNzqBMi","z0XQBMe","zcbLCNjVCI4","CMvHzg9UBhK","CND5EwO","Au13tw0","CMrpwwC","Bg93","BvPHCNq","CMvWBgfJzui","CMT1swO","tgjhzve","Aw5KzxHpzG","zNjVBNrPzxi","tw1OAu4","C3vJy2vZCW","yM5euhe","nZe1B2Hvwenl","se9qyxm","zhLfDuS","zw5KCg9PBNq","yxHbrhe","Dxrlz2i","qKvlEhO","C0DrwKu","wurtuM4","sxjht3y","wuTRtKK","CMLLC0nVDw4","t1bAAvC","y29UBMvJDeu","yMP2y0C","Aw5KzxGGB3u","BMHHDeC","D1Dyvey","Bhm6ia","B2nRzxrgywK","A2DWvfa","q3H4CuK","sgDXwLa","EK5Lywe","u0nJyuy","t2jtDei","yu5VweO","r3bvzNe","ywjVCNq","vunwq2i","BxnxyNm","qNjPzgDL","mdaWmdaWmda","DxbNCMfKzw4","DgLTzw91Da","BIWGAg9ZDg4","EhnOAvG","vLnmtKG","zK5KDxe","C3bSAwnL","ywnR","DhbizwfKzxi","ywnRDxbfBMq","ihrPBwvVDxq","tgThue0","BwLUAvbYB2C","yxrHlcbKyxq","u2PMCLa","uuTpuMm","zgDHt24","AgfUz2u","AhfTDuu","uMnOz3e","yNL0zxm","y09Wzw4","C1Dbwwu","C3rLBMvYCW","vxDvq2e","ugvnyMu","A2v0ignVBNm","ywXSB2nvBNm","y0vVB3q","Dev2zw50","igzHAwWSig0","q3PoqxK","qNHqDxC","EfHAEKW","B25fCNjVCG","Cw9Z","vfD0B1G","EMLTEuu","v0TNy0m","z29py0W","A1H0yK8","CNfkvNi","x2LZtwLUAvq","vwjIC3e","rNLAuLu","zuvwvhG","x2n1CNnVCK0","zvnrB0S","wxDWC3y","z0XAy2C","y2XLyxjtDg8","ww9yy3m","zwnVBM5Ly3q","quXst1C","BhHbte4","rKzmExi","zLn1yvO","vKX3Aue","qurnELK","Bg9NsurozxC","AwXK","DgvZDa","vNzuqNq","zMzLCG","Cg9W","ote3ntq3m3nYt3rRqW","EMPjB0y","vxrYCwy","x0vysvnu","q3D1te8","D1vmzha","ywDLsgLKzq","AK1eCva","CKrUv2O","Dw5ZAwDUzwq","tgjythG","y29UC3rYDwm","zv9ZDwnJzxm","v3nduvy","z2v0u3rVCMe","AgfZ","DevYC2i","zMz1rvC","CerQAw0","u0LrqMG","tufyx1jfvfi","Auzovvy","tuvtu0fhrv8","Dhj1y3rVCIa","zwzWqKS","y3jLyxrLrxi","Dhvique","rLbIEuK","B3LxAMy","CMvHzhLtDge","zgvIDwC","zxjFAxnFywm","BMnVzgLUzW","nxWX","C2vUzf9Hy2S","BMfTzq","BezSDxnO","yxnZAwDU","Ae11vLi","rgH6C08","ChbL","z1v0rvy","DxrMofDYAxq","uhH0BLy","C3rVCMu","AwfyAKu","CLzvEK4","CNfjDw0","q1f4yLC","Egjpt2C","CgvYC2LZDgu","q1f1D1O","BxnN","CfHgrMG","DhjPzxm","mNWWFdn8nhW","wvfcEwS","Dg9mB3DLCKm","DKXjCxy","Cgu6ia","zgvSzxrL","ALPeB2W","x2LZtwLUAvC","q29UzMLN","y291BNq","yMfyvey","mhWZFdr8mxW","A2r0wMq","CgLUz19VBMm","DuXNr2e","Ahr0Ca","AKHSrKq","x19LC01Vzhu","y2fTzMW","AfznC2W","Du5xuxi","vxjyvMW","zw1LBNq","mZq1nJCYmhDmAeXfCG","z2vtEw5J","CYbPBNn0yw4","wMfkz08","vxbKyxrLq28","BMCGzMfPBgu","D3jPDgvvAw4","ANfOExq","swLUD2O","y29UBMvJDfm","qxL4zKW","zxHWB3j0CW","whjzCMC","C2nYAxb0","B2fqwLi","A29yBNK","tKHMEuy","rhbKvLu","x2HHBMrSzvi","CwzVvhG","tg9RDNO","tMnhzKu","ANDis2q","v3LlzK4","wxDqsNK","B25mAw5L","BwvKAwf0zwW","r2nHvKm","Chr5AeG","ChveruW","zhnZAwm","t3D3Axa","t1PXvMy","B0LJqMW","wvrhwwm","AxnrB1nby2S","ufPHAw0","y09usLe","uNnOuwi","EuryrvG","x3bPBMC","rvv4qKG","CKjPzNC","C1fXEwC","tfrNA1y","rKHbCey","Eu1ZCfC","B2rpD2u","BML0AwfSAxO","EhjsBwi","wvDLwfG","Afr2Avi","vvjUC0W","AMvJDfn0B3i","D1zou1y","Exvhyw4","tKDFrvjst1i","z01mvwG","q3HtA2C","x2nSzwfYugK","wgnmBvq","B2zMBgLUzq","BezvC3O","oxW4Fdf8nNW","sxPpDLi","tLnVs0q","B25ozxr3B3i","CxfTAxu","quXm","y21oque","n1H0rfHHuq","s1Ltuw0","zxjHDg9Y","swv2reC","x1fVu01HBMe","s3vJt0O","y29TCgXLDgu","igXHCMDLCIa","CNzHBa","DKP1Eue","DgHHBIbSB2m","DxrVuMvJB24","A2vfAgC","z09AEe4","ihzHBgLKihm","EfDJwNa","s1Dir2K","Dg9tDhjPBMC","q0nergW","Dg9VigXHCMC","zMzmAw5L","x2n1CNnVCK4","BfHOtwG","m3WWFdj8mxW","DcbVzIbYyw4","ve1ws0C","v1bWyum","y3jLyxrLuMu","x3nVy2TLDa","yMfSrxzLBNq","q3rMueS","tNnSwKO","Eevly3y","AMnwv2K","rgnVy0e","D0jZruW","Ec11C2uT","wNfsthC","C0nVDw50zxi","r1nHuNi","BMDNsgi","yKzuBgy","Dgv4DfbHEwW","B2LltKq","zcWGDw5RBM8","Aejbsvu","whLqzfC","rxDMD1u","sMDQDfa","Ew9OseC","AMvTzxe","yNL0zuXLBMC","C3nQq0O","tMHRBvu","x29UugfNzu4","B25tDgfYDfi","yKHuA0u","Cefgs3m","yxbWBhK","y29UBMvJDca","AejMBw8","seDAzM0","z1HLvNe","wM9vvwW","DvDNzxK","Bwv0Ag9K","uMXyC0y","sKTVCNy","x2n1CNnVCKy","sNntrxa","uufWrwm","swzLzMy","x2LUDgvYDMe","zw5XDwv1zq","BufmDwy","CKLpCNK","x3bYB3rVy28","CLLrz3m","yvriB1C","zw5HyMXLvhi","vwz5C3i","qKjmEge","x2LZqNjVD3m","s0zWBwS","BMvY","vhnLzK8","Chv0","CM92AwrLihy","x2LUAxrqCM8","ALzJBuu","yxbWzw5Kq2G","DKvirK4","x29UvgLTzw8","Bg9IywXty28","C2HPzNq","Cgzvs2u","A2fKExm","BhDRzMm","C2v0u3rVCMe","tvv3Beq","yxbWBgLJyxq","u1LnsNG","y3vYCMvUDeu","y2Pet2q","BM5Ly3q","x2LZtM9Kzq","nJy5ndmXChnxswDk","zgLZywjSzue","shz1uvy","DhLWzq","z2vjBMzVu3K","BMHwzha","B3bLBG","yMXVy2TLza","u3rhufC","zxjYtxnN","y3jLyxrLtwu","DgLLCKPtt04","BMrWB2LUDfq","zwrPyxrLBhK","vKrTshG","vhrnr2y","we51B2m","s1npCMm","x2DLDeLUDgu","tvv0whm","tuXiCuW","ExrfwMu","q29Kzq","t2zmq20","De1RDxm","CMvUDevUzha","yuvjB1i","BhP0qNi","sNDPqKi","y29Uy2f0","DgLUzYbZzxi","zv90Aw1LB3u","DhjPBq","z0DorgK","qLLYDNy","EvDeBxq","q09oveLovuu","sgLZC3C","qxbxEe4","zxjFywnRx20","vg15CgS","lcbTyxGGCMu","zxjYB3i","ExvTuui","zNjVBujPDhm","AenSB3nLrxy","AuzoshO","weDxueO","Dej6z20","DgDvtMG","ENvpB1O","D0TID0G","CMvWBgfJzq","AunryKC","BwvZC2fNzq","yM5lz20","sLjNAuW","vLzOvgK","u3rYyxrLz3K","te5Uwwi","AwXLtMfTzq","ihrPBwvZ","x2zVCM1HDeu","z3Hyrgy","C3rYAw5NAwy","reHzz0G","mtf8mtb8mNW","yxnJCMLWDa","BKPuu3e","x2nSzwfYvgK","A0vvB2y","y3LuDui","seTPtgK","BwfJCfq","B2nRzxrtDwm","sLjsz1a","s1DItgu","ue5Uy0S","re5pr28","vxv4vLG","B25SAw5L","BM93","yMLUza","C0PyBM4","y29UBMvJDa","Aw9Ul2PZB24","y01qEMS","v2firei","B3bLBIa","DgDbtK0","q29mrMu","ChjVDg90Exa","q3vZDg9Trxi","AKrgqKC","zgH3q1y","wML6vNy","CNnVCKzPBgu","rxzLBNq","y2TOAeW","wxPKvNm","C2HmtKe","sMfqyNq","wfPvrwO","x2nYzwf0zvm","quTlAee","tLHwqxK","q2HwEee","DuXws2K","txrxtKC","rNPKC0u","Ehnyy0m","D3jPDgu","uLnfv2S","AKTuzNu","swXhsxa","C2rQsNa","CKL1vwG","vMPizuG","zw1PDa","DMvY","AgDrCKO","DurABhG","lcbxzwjtB2m","BwvZ","CgLMywm","uhfcvw0","rhrHz3O","zgv2AwnLx2K","rvjtteS","q3z0qu0","D1P1A2q","sgLrwuK","yxKSihrYEsa","twjABui","Bvfgtfq","sKrvEe8","AMvIC2C","uMr6t1C","z0TUEeG","ntCYodG4mg53u3jgEa","tKfusvzfx0u","CKzyA3O","EvjLy29UBMu","t2X2ExO","y2fSBa","DwzgCwO","reiGzMfPBgu","DxjS","ELPZsNa","y2HmuMu","thnhrKO","x3DHAxq","s2XZBui","yxv0BW","A2Hrs08","Auv5s0K","vuXZzwC","y2XVC2veqG","ufHwyuG","ywnRpwzYB24","v1PorNi","sunlv2i","DxnLCKLW","y3vYC29Y","txLju2O","sxHzEKm","CgfYC2u","vhnPCwO","vw9UEhy","D3jVBeG","ywX3yxLZ","q0r6uMC","qLnrwg8","uNPJBu8","A2XuuNC","yw51Ce1LC3m","EgLyvxy","zvnctLy","tMzQqxi","AxLsz3G","qKLeu3G","B3bLCNr5tMe","BwfUDwfSihi","B3bLCNr5","zxj2AwnL","D25hrNG","ywXS","B2nRzxq","Dfr4vwG","yw1Lu3bHy2u","zgf0yq","yMXcsfC","CMvKDwnL","B2jQzwn0u3q","CMnqv2G","zuP4rhy","C2XPy2u","zxf1ywXZ","BwHqz3y","sNLeEu8","rxD0EwG","uhP0sLu","zwHbCNG","DKz2tvm","DNb1zuK","x2HHBMrSzu8","C2TWwvK","x29Ut3bLBG","z1rPBwvVDxq","Cgf5Bg9Hzfq","x2LUAxrhBg8","surhA1a","wgv6uwq","yxnL","z2jwAfy","tLHtCw8","wNnmyNG","uM1ywK8","zwPRv2G","zxHrsuG","sLnUBNK","CIb0DhDjra","DgHLBG","ywnOzwq","C3rYAw5N","BgvUz3rO","BwLZzq","D1DjB20","Ae1dqvO","CLzHBhvLCW","ug92swq","vvzRD2y","CxrPyLu","EgDRq00","DvHiywi","x3bYzwzPEa","z2v0q3vYC28","A1n0yxr1C0m","Aw5L","vuPjA1O","ugjcC08","DuvAq1K","x2rYB3bhBg8","uK1LtMW","BgTlDey","wfrUDLy","B25tDg9Wsw0","ywnRx2nVzgu","x2LZv29YA2u","CgXLyxnLiha","D2vI","EuLZuKG","x29WDgLVBNm","BfrPBwvVDxq","tMvrCwK","uvb1z0y","CMvJzwL2zwq","y01sz0W","zMPuBgm","uuLAu04","zNjVBu51Bwi","yuvZsg0","Cw9Zx18","BgD1A1m","rgvKAwnHDgu","sfrzqvG","tLfWCKy","A25Qz3y","EgDqv3q","x25HDMLNyxq","vuDKruS","x0rctMfTzq","CfnUvfa","Ber4CLq","yM9KEq","vuPorKG","DeXovNq","y3fvs3y","AefJA01LC3m","zfzSDfG","D21fEhK","Aw47y2HHCNm","qvnXtK0","AKPurMi","s0DYteK","yuDdDeK","ywXty29Wzq","C3vIC3rYAw4","wKzQBM4","CLPkteK","zwvKzwq","tMrrDuS","CMvJzxzPzwq","BgLTAxq","uLjpuG","CgLUz1rPBwu","ywnRtxnNswq","Aejyywm","ENPyr1u","ywDLu2HVDW","swvVEMm","vxPWD0e","CwTRsvG","uM5TALe","sMn1quC","sfnKCLC","y3vZDg9Tshq","u2v4zKC","qLDsyKe","BMDuAw1LCG","CgfNzwHPzgu","CMLADwG","zMXVB3i","tNzsr0C","y3vYC29Yx24","x2rPC2nVBM4","vM9YDhu","B3vUDa","CMTLCKDSB2i","zgvJB2rLzey","BMvJDa","yw5Hz2vY","BLvprgW","BMrWB2LUDca","Aw5KzxG","AevYCM9Yrxy","z2vY","ENbcA0S","D3m6lY8","rgnvDem","C1fdq0W","s2PJs3G","DhzQD1a","zMLSDgvY","jMPZy2fSBgi","rfLsAfe","CgXPuNG","x3jLy29UBMu","t1bftG","yxfHu3G","y3vYCMvUDeK","zufJAW","Cg9Yt0u","q3jxuha","zM9Yy2u","rfbkqK8","q0f3wwq","rLDt","nta2ota1nKf4Ew51Aa","v2vPEgLUsLm","vgnetgK","B2XKvMvYC2K","suvtx0vsuK8","x3DZ","v1vpsMq","A2v5CW","ywnRx2LK","CNnVCL92ywW","Ae9Wzw5fDMu","r2TOAvO","EwvYBKO","De1HBMfNzxi","Axnby2TdBgu","q0Huvhe","AgvKtwf4uMu","z2v0s2v5","C1rwr3a","wffZC2C","sKvzuMi","rNjVBNrPzxi","ANDmthi","u0rzyuC","Cxz3rM0","z1beB1e","CMvJB25Uzwm","uxjysLy","CxzjtLC","qu11v2u","tfzwCu4","q3n4v1m","sMj6Egm","BLH4wuS","t2HeDge","zePNugG","DLLnCNO","qwjVCNrfCNi","seXODeK","ExfZDgS","twvZC2fNzuu","sgvyDg0","ywXSq3vYC28","BwfW","A0HfwuK","uhfryNC","u2Leuhy","qxLgv2i","y2HnyxHuCMK","CMfUzg9T","vfvhshq","DKrNBg4","zerczee","B3jpBMXPBMu","D1nVA0O","zMLSzw5HBwu","zMLUza","EeHfqKq","x2DLBMvYyxq","uKrpuhG","CMvZB2X2zq","AxfoEgW","Egfxzum","DwHJuM8","uK5nBMu","zvvYBa","Aw9U","txzvt3C","we1rDLO","B1f1rfO","AxnszwfKEq","B2LUDfjLywm","z2v0qwXSs2u","z2TNsNe","BgvY","Dfj4ufa","AenMqxy","C2zvsKq","C3rVCcbPBw0","zxH0ugf5Bg8","q25pB1K","yw1L","BMrLEa","AxnFywnR","EK9ws1a","whbjtxi","BKXWu1q","tffqB0e","wff0Ae0","wKL5zfu","Dg9Y","wen5C3u","AxnAzxjV","EfjNt3m","EwrLs08","quTtDeO","suHIrge","C2v0zgi","B3nLrxzLBNq","CMvMtgy","rNrJAuu","x29UtwvZC2e","yw5ZzM9YBvq","Aw5PDcbrB1m","t0Psu3u","BwTvEeC","t1n4vhi","AgfZt3DUuhi","yNL0zu9MzNm","nxWW","CgjICdi","Buzpq1u","zKTvuuy","t2jQzwn0","C2DPza","EgjQweK","yKvhuKS","q29ZDLK","x2LUAxq","zwTtC28","vgXZt1C","CM9YrxzLBNq","tg9JAW","wgzWzha","tKPzqwK","A21kyMO","t0LusMO","vw5Oyw5KBgu","teD2sva","suHgr0K","rhHLD1i","EMLmr0q","vuvkrfC","Cgf5Bg9Hza","Ec1TC2CTy3u","sKTVsuG","q0Xpu0ve","sMjkswi","DgPLrwi","x29UrxjYB3i","ru1uAMS","q09otKvdveK","yvD6z0C","zgvMAw5Luhi","DgLTzw91DcW","EwrWyMW","r0jkweS","B25VCgvU","t3fKsMm","CMvZzxrdB3u","zNDZxZeUmc4","x3DZsw5ZDge","BxDvDhe","we1JsuO","vxvvr3a","zNjVBuj5Dgu","CKfeuMC","BLLQvgK","Dhr3Awq","x2TLEvbHDgG","ywDLrxzLBNq","C0jf","v3zcANa","tKHiv0S","BgjXCw4","zM9YrwfJAa","A0HzCeC","ALHmD3O","quDdy0y","y3HJtKK","B2nbzvy","r1Hctvq","EMr6uhK"];return vn=function(){return r},vn()}function Ax(r){let e=S,i={JlrIU:e(1085),SFJDN:e(1227),EjGOd:function(x,f){return x(f)},nJTSq:e(1570)+"or",omSWA:function(x){return x()},RfhYr:function(x,f){return x===f},bzoEY:"abort"};if(Sn[e(946)](r))return;let a=new Promise((x,f)=>{let l=e,h={dJgPh:l(1227),WvBjp:function(w,C){return i[l(692)](w,C)},tucTF:l(996),nWTgg:function(w){return w()}},m=()=>{let w=l;r[w(447)+"entListener"](i.JlrIU,_),r[w(447)+w(502)+w(1163)](i[w(430)],b),r["removeEventListe"+w(1163)](w(861),b)},_=()=>{let w=l,C={xaWeC:function(k,T,L){return k(T,L)},CwcIo:h[w(1568)]};if(h[w(1695)](h[w(413)],"baXTF"))h.nWTgg(x),m();else{let k=this[w(577)+w(1546)]?.["checkRea"+w(1581)+"es"](),T=this[w(577)+w(1546)]?.[w(504)+"ntEndpoint"]();if(k&&!_0xf685ec[w(1239)]){let L="connect "+T+(w(896)+"ax retri"+w(1725)+"ed");this["_dispatc"+w(1510)+w(444)](C[w(1595)](_0x4e578b,C[w(516)],{message:L,code:_0xd8d9e2[w(951)+"IES_ERROR"],error:_0x240e06}));return}this[w(1538)]&&this[w(1538)].readyState===this[w(1523)]&&this[w(1500)+w(434)](),this[w(1850)+w(1510)+w(444)](C.xaWeC(_0x2763e8,C[w(516)],{message:_0x19eb2b[w(1239)],code:_0x48ab7c[w(1325)+w(1479)],error:_0x316873}))}},b=()=>{let w=l;i.EjGOd(f,r[w(1227)]||new DOMException(i.nJTSq,i[w(1253)])),i[w(1726)](m)};r[l(635)+"Listener"](l(1085),_),r[l(635)+l(793)](i[l(430)],b),r["addEvent"+l(793)](i.bzoEY,b)});Sn.set(r,a)}function Dx(r){En=r(En)}function kx(r){let e=S,i={XMcIJ:function(a,x){return a==x},EqbUm:e(395),yWDmt:e(398),YKkNI:e(1513),FQmBY:function(a,x){return a(x)},JgjtP:function(a,x){return a(x)},ALROW:function(a,x){return a===x},XpIMr:e(1501),attpg:function(a,x){return a(x)},HpUbj:function(a,x){return a in x},kMEcV:e(507),wFZPV:function(a){return a()}};if(i.ALROW(r,IDBDatabase[e(1276)+"e"]["transact"+e(1599)])&&!i[e(786)](e(1378)+e(641),IDBTransaction[e(1276)+"e"]))if(i.ALROW(e(802),i[e(1751)]))_0xa555a4=_0x29ecf9&&i[e(1686)](i.EqbUm,_0x1a4349[e(1756)])?i[e(1220)]:i[e(843)],_0x3e29c4=_0x3d2b64.replace(/((^ws)|(^http))((?:[s]*:\/\/))/,""),_0x540d2b=/^wss(.*:\/\/)/[e(927)](_0x22624c)?_0x1ff454:""+_0xe569a+_0x274219;else return function(a,...x){let f=e,l=r[f(1329)](i[f(620)](Rt,this),a,...x);return mr[f(756)](l,a.sort?a[f(522)]():[a]),i[f(620)](Ce,l)};return i.wFZPV(Cx)[e(1855)](r)?function(...a){let x=e;return r[x(1137)](i[x(1127)](Rt,this),a),Ce(wr[x(550)](this))}:function(...a){let x=e;return i.XpIMr===i[x(1618)]?Ce(r[x(1137)](i[x(584)](Rt,this),a)):i[x(919)](0,this[x(494)])&&this.low===0}}function Ix(r){let e=S,i={hAOsP:"function",qeUnn:function(a,x){return a instanceof x},TscNI:function(a,x){return a(x)},CHmuC:function(a){return a()}};return typeof r===i[e(581)]?kx(r):(i[e(518)](r,IDBTransaction)&&i[e(1841)](Ax,r),xi(r,i[e(612)](Sx))?new Proxy(r,En):r)}function Ce(r){let e=S,i={pSnTP:function(x,f){return x instanceof f},yvIkX:function(x,f){return x(f)},uPzZZ:function(x,f){return x!==f}};if(i[e(1457)](r,IDBRequest))return i[e(384)](Ex,r);if(yn.has(r))return yn[e(550)](r);let a=Ix(r);return i[e(1706)](a,r)&&(yn[e(756)](r,a),Cn[e(756)](a,r)),a}var xi,ni,ri,wr,Sn,mr,yn,Cn,En,Rt,si=ai({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={ASqNM:function(i,a,x){return i(a,x)},GcaVC:function(i,a){return i(a)},IrGOv:function(i,a){return i instanceof a},syvsn:function(i,a){return i===a},yumQB:r(1168),cEoot:"done",yIsRH:function(i,a){return i+a},AwGnK:r(1660)+r(818),UCVCb:function(i,a){return i+a},rjzQU:function(i,a){return i===a},mVRwU:r(1222),PbaHe:function(i,a){return i===a},Abrcm:r(975)};xi=(i,a)=>a[r(629)](x=>i instanceof x),wr=new WeakMap,Sn=new WeakMap,mr=new WeakMap,yn=new WeakMap,Cn=new WeakMap,En={get(i,a,x){let f=r;if(e[f(842)](i,IDBTransaction))if(e.syvsn(e[f(1228)],e[f(1228)])){if(a===e[f(894)])return Sn[f(550)](i);if(e[f(1894)](a,f(1378)+f(641)))return i["objectSt"+f(641)]||mr[f(550)](i);if(e[f(1894)](a,f(975)))return x[f(1378)+f(641)][1]?void 0:x[f(1378)+"ore"](x[f(1378)+f(641)][0])}else e[f(1467)](_0x1f4367,_0x53eb2d,32),e[f(1467)](_0x23715e,_0x69297e,e[f(1036)](_0x3b1b4b,_0xb8af83));return e[f(1036)](Ce,i[a])},set(i,a,x){let f=r;if(e.rjzQU(e[f(790)],f(1222)))return i[a]=x,!0;{let l=_0x5dba50[f(1410)]&&_0x3b3f92[0];if(e[f(842)](l,_0x235ce9))throw l;let h=new _0x1c82ec(e[f(1436)](e.AwGnK,l?e[f(862)](e[f(1436)](" (",l[f(1239)]),")"):""));throw h.context=l,l}},has(i,a){let x=r;return i instanceof IDBTransaction&&(e[x(651)](a,e[x(894)])||e[x(559)](a,e[x(621)]))?!0:a in i}},Rt=i=>Cn[r(550)](i)}}),ci={};vx(ci,{deleteDB:()=>Tx,openDB:()=>Px,unwrap:()=>Rt,wrap:()=>Ce});function Px(r,e,{blocked:i,upgrade:a,blocking:x,terminated:f}={}){let l=S,h={rdOYg:function(b,w){return b===w},yDXEX:l(1272),TOXxw:"SDgGs",WsCQV:function(b,w,C,k,T){return b(w,C,k,T)},BEKxz:function(b,w){return b(w)},eSQoK:function(b,w){return b||w},EwfwU:function(b,w){return b!==w},ffuEW:"nUQih",KwUms:l(1005),DPCWx:l(1737)+l(883),kWOUA:function(b,w){return b(w)},mQFLT:"blocked"},m=indexedDB[l(1191)](r,e),_=h.kWOUA(Ce,m);return a&&m[l(635)+l(793)]("upgradeneeded",b=>{let w=l;h[w(822)](h[w(1048)],h[w(672)])||h[w(944)](a,h[w(839)](Ce,m[w(721)]),b[w(1536)+"on"],b[w(1794)+"on"],Ce(m[w(1849)+w(1599)]))}),i&&m["addEvent"+l(793)](h[l(1319)],()=>i()),_.then(b=>{let w=l;if(h[w(1126)](h[w(948)],h.KwUms))f&&b[w(635)+w(793)](w(625),()=>f()),x&&b[w(635)+w(793)](h.DPCWx,()=>x());else{let C=this[w(1798)].getItem(this[w(1420)]),k=_0x4acf05.parse(h[w(913)](C,"{}"));return _0x3acc94.values(k)}}).catch(()=>{}),_}function Tx(r,{blocked:e}={}){let i=S,a={iGIII:function(f,l){return f(l)}},x=indexedDB[i(1790)+i(1713)](r);return e&&x[i(635)+i(793)](i(1192),()=>e()),a[i(752)](Ce,x)[i(1407)](()=>{})}function ii(r,e){let i=S,a={ntBdh:function(m,_){return m(_)},Mqkxb:i(1570)+"or",LTnQP:function(m){return m()},Ufysr:i(1152),KCDOK:"nbVmt",YiGJJ:"readwrite",jUvbu:i(819),wKbwH:function(m,_){return m instanceof _},VgpUC:function(m,_){return m in _},lztBr:i(1409),TlsOW:function(m,_){return m!==_},qJyhB:function(m,_){return m===_},XcLmT:"lkshk"};if(!(a[i(1236)](r,IDBDatabase)&&!a.VgpUC(e,r)&&typeof e===a[i(1212)]))return;if(bn[i(550)](e))return bn.get(e);let x=e[i(1237)](/FromIndex$/,""),f=a[i(1653)](e,x),l=ui[i(1855)](x);if(!(x in(f?IDBIndex:IDBObjectStore)[i(1276)+"e"])||!(l||fi.includes(x))){if(a[i(1818)](a[i(1069)],a[i(1069)]))return;zJIeZX[i(1775)](_0x55fe6c,_0x3b9c6f[i(1227)]||new _0xd0e62f("AbortError",zJIeZX[i(1898)])),zJIeZX.LTnQP(_0x23d350)}let h=async function(m,..._){let b=i,w={Rmxhm:a[b(1159)]};if(a[b(465)]!=="nbVmt")this[b(381)+b(763)][b(1755)](_0x2461bf),this[b(565)](w[b(457)],_0x46ceca);else{let C=this.transaction(m,l?a.YiGJJ:a[b(685)]),k=C[b(975)];return f&&(k=k[b(1509)](_[b(1173)]())),(await Promise[b(1371)]([k[x](..._),l&&C.done]))[0]}};return bn[i(756)](e,h),h}var fi,ui,bn,Lx=ai({"node_modules/idb/build/index.js"(){let r=S,e={WUOJd:function(i){return i()},PymQR:r(550),skpYY:r(1550),LkGPM:r(1605)+"ys",PqBUm:r(995),ZaJgO:r(484),HWRwz:r(991),jHTiV:r(674)};e[r(1539)](si),e[r(1539)](si),fi=[e[r(657)],e[r(1391)],r(769),e[r(877)],e[r(1310)]],ui=[r(1165),e[r(1012)],e[r(1748)],e.jHTiV],bn=new Map,Dx(i=>({...i,get:(a,x,f)=>ii(a,x)||i[r(550)](a,x,f),has:(a,x)=>!!ii(a,x)||i[r(946)](a,x)}))}}),Nx={idb:function(r){let e=S;r[e(1020)]=Promise.resolve().then(()=>(Lx(),ci)).then(function(i){return i})}},oi={};function Se(r){let e=S,i={tTxUh:e(1883)+"1"},a=i[e(1373)].split("|"),x=0;for(;;){switch(a[x++]){case"0":Nx[r](f,f[e(1020)],Se);continue;case"1":return f.exports;case"2":var f=oi[r]={exports:{}};continue;case"3":var l=oi[r];continue;case"4":if(l!==void 0)return l.exports;continue}break}}Se.d=(r,e)=>{let i=P;for(var a in e)Se.o(e,a)&&!Se.o(r,a)&&Object[i(1676)+i(1368)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;Se.o=(e,i)=>Object.prototype[r(1640)+r(1368)][r(1329)](e,i)})(),(()=>{let r=S,e={camfl:"undefined",ksqrQ:r(596),OqdJc:r(1003)+"le"};Se.r=i=>{let a=r;e[a(1004)]!=typeof Symbol&&Symbol["toString"+a(528)]&&Object[a(1676)+a(1368)](i,Symbol[a(1096)+"Tag"],{value:e.ksqrQ}),Object["definePr"+a(1368)](i,e[a(1681)],{value:!0})}})();var V={};(()=>{let r=S,e={ULseg:function(s,t){return s+t},tezDL:function(s,t){return s+t},puDEL:function(s,t){return s!==t},ydpbl:r(1213),tjPom:function(s,t){return s*t},nsPwT:r(1085),JFjpV:r(1227),rJuAY:"abort",ZIydU:function(s,t){return s===t},TNPow:r(673),Ewtyh:function(s,t){return s(t)},DxewR:function(s,t,n){return s(t,n)},XMKgo:function(s,t){return s+t},jnXNJ:r(1418),edpWL:function(s,t){return s(t)},bFTlf:function(s,t){return s+t},XCysu:r(490),xRgOs:function(s,t){return s(t)},koXny:r(865)+"000000000000000000000000",xgPWt:function(s,t){return s!=t},yxXyy:function(s,t){return s instanceof t},ILWjl:r(561)+r(1466)+r(741),ZWAOu:r(1891),jfxyl:"qKXSN",pcGUf:"ESUwI",XbVBU:function(s,t){return s>t},oVsip:function(s,t){return s<t},LABtw:function(s,t){return s!==t},iqNxl:function(s,t){return s-t},utKgb:function(s,t){return s<t},Xsbel:function(s,t){return s-t},vEHFN:function(s,t,n){return s(t,n)},OHTLp:function(s,t,n){return s(t,n)},xXZzL:function(s,t,n){return s(t,n)},kvFkD:function(s,t){return s>>>t},PqQbw:function(s,t){return s(t)},tErsb:function(s,t,n){return s(t,n)},OZfQF:function(s,t){return s&t},pliRx:r(1731)+r(1795)+r(378)+r(764),hBAIU:function(s,t){return s===t},pyvGg:r(1731)+r(1795)+" field: value",hqUqw:function(s){return s()},nloJL:function(s,t,n,o){return s(t,n,o)},vxqPM:"x_frontier_qos",sQCCL:r(1709)+"er_qos_ack",lXYPi:function(s,t,n,o){return s(t,n,o)},jqhyt:"x_fronti"+r(962)+"k",Lokvz:function(s,t,n){return s(t,n)},Olvyz:r(1239),DXVjR:function(s,t,n){return s(t,n)},wBprE:r(1545),wULdp:function(s,t){return s!==t},rqIum:function(s,t){return s===t},eBUpw:r(471),LBDXF:function(s,t,n){return s(t,n)},EMTjk:function(s){return s()},hLHzr:function(s,t,n){return s(t,n)},NSoKD:function(s,t,n){return s(t,n)},fPJxq:function(s,t){return s(t)},RxdYu:function(s,t,n){return s(t,n)},shLNA:function(s,t,n){return s(t,n)},UVkwf:function(s,t,n){return s(t,n)},CNJng:function(s,t,n){return s(t,n)},gjmuR:function(s,t,n){return s(t,n)},qCMBG:function(s,t){return s!==t},HhWqv:function(s,t,n){return s(t,n)},IqSbU:function(s,t){return s!==t},porOE:function(s,t){return s!==t},ZqRLw:function(s,t){return s(t)},zzXGU:function(s,t){return s(t)},jXLwz:function(s,t){return s(t)},cywoN:function(s,t,n){return s(t,n)},PNncK:function(s,t,n){return s(t,n)},rIuUh:function(s,t){return s(t)},BYtyb:function(s,t){return s(t)},HLmZs:function(s,t,n){return s(t,n)},EZrBX:function(s,t){return s(t)},rcKGd:function(s,t,n){return s(t,n)},fmAGF:function(s,t,n){return s(t,n)},QVLVM:function(s,t){return s(t)},LNnYb:function(s,t,n){return s(t,n)},tLNVt:"Missing required"+r(378)+"SeqID",BTpOr:function(s,t){return s===t},UJIkZ:"Missing required"+r(378)+r(386),wsIvO:function(s,t){return s===t},tuHAA:"Missing "+r(1795)+r(378)+r(1144),oaPZR:function(s,t){return s|t},uhcRo:function(s,t){return s&t},fCQSI:r(419),RBEzj:function(s,t){return s(t)},aqaSx:function(s,t){return s(t)},CoLFe:function(s,t,n){return s(t,n)},vYKQw:function(s,t,n){return s(t,n)},VSLNH:function(s,t,n){return s(t,n)},jurwb:function(s,t){return s+t},sOAtx:"Unimplem"+r(588)+r(990),ziLGD:function(s,t){return s>>t},gSkxr:function(s,t){return s!==t},gOZxN:r(1718),ZoUUl:function(s,t){return s>t},DNOGo:function(s,t){return s+t},KKtKf:"WgaLk",FROBS:r(1555),Uonxv:function(s,t){return s>t},sJXnn:function(s,t){return s>t},OhDta:r(568)+r(1728),UYFtA:function(s,t,n){return s(t,n)},wEJvZ:function(s,t){return s+t},gXeVq:function(s,t){return s+t},kmJbj:function(s,t){return s&t},GwDtQ:function(s,t){return s(t)},LVVqN:function(s,t){return s===t},ICKWb:function(s,t){return s&t},HiQYI:function(s,t){return s>=t},mbQrO:function(s,t){return s+t},lMhhs:function(s,t){return s<<t},CKOxP:function(s,t){return s!==t},wVNSV:r(1512),odOwe:function(s,t){return s==t},DBwwn:function(s,t){return s+t},rcPWh:function(s,t){return s+t},HuTWn:function(s,t){return s+t},CnOoY:function(s,t){return s!==t},HtscO:function(s,t){return s|t},yuGan:function(s,t){return s<<t},LsGFJ:function(s,t){return s|t},jJTFb:function(s,t){return s<<t},qvwFm:function(s,t){return s&t},isoXg:function(s,t){return s&t},EmVtb:function(s,t){return s>=t},kgpTP:function(s,t){return s<=t},hTviR:function(s,t){return s==t},dVltX:function(s,t){return s>=t},OfLCm:function(s,t){return s+t},gkbFt:function(s,t){return s+t},hnXlx:function(s,t){return s!==t},RNjga:function(s,t){return s<<t},nhatG:function(s,t){return s|t},cOTJQ:function(s,t){return s<<t},Ymdit:function(s,t){return s&t},OaVlU:function(s,t){return s<t},cVATp:function(s,t){return s>>t},RxvBZ:function(s,t){return s|t},rqJVr:function(s,t){return s<t},DYRhQ:function(s,t){return s<t},NHfyF:function(s,t){return s<t},CQuwZ:function(s,t){return s<t},DhzsO:function(s,t){return s<t},lDxrT:function(s,t){return s>=t},XyPdW:function(s,t){return s<=t},YtAHv:function(s,t){return s-t},TUGHt:function(s,t){return s===t},MUwlD:r(1294),hdHSe:function(s,t){return s|t},SiDPv:function(s,t){return s&t},Rchgq:function(s,t){return s|t},ztWKz:function(s,t){return s&t},etwVe:function(s,t){return s===t},pXFFh:r(1742),sdOfp:r(1091),xrRmb:function(s,t){return s|t},PXVaH:function(s,t){return s&t},QjPld:function(s,t){return s>>t},SneRU:function(s,t){return s&t},QppcK:function(s,t){return s|t},TlRrG:function(s,t){return s&t},opNHF:function(s,t,n){return s(t,n)},oIcBl:function(s,t){return s<t},zuOoZ:function(s,t,n){return s(t,n)},iqojk:function(s,t,n){return s(t,n)},vLIqv:function(s,t){return s(t)},FuTqV:function(s,t){return s>=t},xHEBD:function(s,t,n){return s(t,n)},nHUmw:function(s,t){return s-t},cjDOd:function(s,t,n){return s(t,n)},DEBjq:function(s,t,n){return s(t,n)},WyKfN:r(625),jHlFD:function(s,t){return s!==t},HmNNF:r(814),gKNxL:function(s,t){return s&t},ykonX:function(s,t){return s(t)},tgANM:function(s,t){return s&t},VjHeH:function(s,t){return s&t},dssic:function(s,t){return s(t)},FPbyI:function(s,t){return s<<t},vfkju:function(s,t){return s(t)},ybJlp:function(s,t){return s&t},CtfPK:r(1019),macpT:function(s,t){return s<<t},lwkfc:function(s,t){return s&t},fQUBZ:function(s,t){return s===t},jxmZk:r(1473),bcRvl:function(s,t){return s(t)},LUVGL:function(s,t){return s<<t},BIDSx:r(1112),MgkRU:r(551),HTYAX:function(s,t){return s(t)},QKORc:function(s,t){return s<<t},tMkus:function(s,t){return s|t},HeXtm:function(s,t){return s<<t},GRdXJ:function(s,t){return s|t},SIQBh:"dkmLx",Ifeff:function(s,t){return s>>>t},mhPgv:function(s,t){return s>>>t},gbVhV:function(s,t){return s>>>t},OSxTr:function(s,t){return s===t},VlOVb:function(s,t){return s<t},PFUPM:function(s,t){return s<t},Dtagz:function(s,t,n){return s(t,n)},GULPe:function(s,t){return s>>>t},nggHb:function(s,t){return s!==t},AKKhA:function(s,t){return s&t},bKQiJ:function(s,t){return s>>>t},OpCug:function(s,t){return s+t},NdQuK:function(s,t){return s|t},qRzPX:function(s,t){return s&t},DcocA:function(s,t){return s>>>t},sDTtL:function(s,t){return s|t},xshiX:function(s,t){return s>>>t},fjOJn:function(s,t){return s>>>t},aEIoR:function(s,t){return s+t},XZUEj:function(s,t){return s&t},RlXsF:function(s,t){return s>>>t},YWeXX:function(s,t){return s+t},gkgJq:function(s,t){return s!==t},iypsb:function(s,t){return s|t},LGvIP:function(s,t){return s>>>t},IzOvR:function(s,t){return s&t},CQxbW:function(s,t){return s>>>t},qfoTx:function(s,t){return s+t},QPugF:function(s,t){return s>>>t},YQByk:function(s,t){return s&t},inqRa:function(s,t){return s|t},BBLxa:function(s,t){return s&t},LaQzo:r(684),VuvCV:function(s,t){return s(t)},WwUPl:function(s,t){return s!==t},blBHW:function(s,t){return s(t)},hBNgN:function(s,t){return s|t},TZGyO:function(s,t){return s<<t},hqmuE:function(s,t){return s&t},hoyid:function(s,t){return s<<t},nLpST:function(s,t){return s&t},cmNAA:r(1204),RdzOW:function(s,t){return s===t},YDSRn:function(s,t){return s|t},MtWNG:function(s,t){return s<<t},eBpmT:function(s,t){return s<<t},eSBNV:function(s,t){return s|t},DrDbj:function(s,t){return s|t},VDmHx:function(s,t){return s<<t},Rvgcf:function(s,t){return s===t},yohHG:function(s,t){return s<<t},iFxjx:function(s,t){return s&t},IcFEa:function(s,t){return s>>>t},iyRgx:function(s,t){return s>>>t},mFSrh:function(s,t){return s>>>t},hCfAv:function(s,t){return s>=t},vgFka:function(s,t){return s<=t},NPLCn:function(s,t){return s+t},qiwTS:function(s,t){return s|t},XnEcc:function(s,t){return s%t},hPXlA:function(s,t){return s/t},cScnM:function(s,t){return s+t},lvRsB:function(s,t){return s*t},UzpwA:function(s,t){return s>>>t},SafZS:function(s,t){return s>>>t},wrolH:function(s,t){return s===t},xiXUv:function(s,t){return s===t},mbsVs:function(s,t){return s>>>t},GpUfq:function(s,t){return s+t},Nurfc:function(s,t){return s+t},xFAwc:function(s,t){return s|t},DHYgH:function(s,t){return s<<t},QApEc:function(s,t){return s|t},KlsmB:function(s,t){return s<<t},BZkRH:function(s,t){return s===t},XotCJ:function(s,t){return s===t},rFXkz:function(s,t){return s===t},uWgey:function(s,t){return s===t},ejkWh:function(s,t){return s&t},wDKCR:function(s,t){return s>>>t},VvTBt:function(s,t){return s&t},FHApF:function(s,t){return s>>>t},XpCkr:function(s,t){return s&t},zLmqb:function(s,t){return s&t},sifMa:r(707)+r(1642),KkTIG:r(951)+r(1537)+"R",TcDLi:r(1325)+r(1479),Mouli:"MESSAGE_"+r(540),GkhiZ:r(642)+"OR",IlGIp:function(s,t){return s!==t},knjgv:r(974),wBsEL:r(591)+"0|2|4",YoXcs:r(748)+"1",GXBMT:r(1191),tRxPP:r(1791),uJgiE:function(s,t){return s-t},kHEYI:function(s,t){return s===t},VHhJr:function(s,t){return s==t},sQqyg:function(s,t){return s instanceof t},zdWQv:r(1660)+r(818),sFybK:function(s,t){return s+t},ZxqDd:function(s,t){return s+t},SbKpm:function(s,t){return s===t},bjvcG:function(s,t,n){return s(t,n)},TBTfi:r(1030),qCTeH:"uWlnL",EfGpc:function(s,t,n){return s(t,n)},HYACl:"IxpqF",WhzhO:function(s,t,n){return s(t,n)},VVhTi:function(s,t,n){return s(t,n)},MbZmB:function(s,t,n){return s(t,n)},JbJIb:function(s,t){return s instanceof t},VUtGM:function(s,t){return s||t},Hetvj:r(986)+"1",kHYpG:function(s,t){return s!=t},GCOan:r(647)+"d",wmExy:function(s,t){return s<=t},CCDDl:"next() called multiple t"+r(783)+"process",zOVKP:function(s,t){return s===t},ApWxN:function(s,t){return s+t},uXHab:function(s,t){return s<t},nFWsh:function(s,t){return s<t},AyFWb:function(s,t){return s&t},nYjTi:function(s,t){return s+t},nnRHg:function(s,t){return s===t},uSytC:r(560),LTgkV:function(s,t){return s-t},ptyhH:function(s,t){return s<t},TkAst:function(s,t){return s|t},Tsiqj:function(s,t){return s<<t},fbbBK:function(s,t){return s&t},IQohi:function(s,t){return s>=t},XezQd:function(s,t){return s|t},nZYNR:function(s,t){return s&t},bHTkE:function(s,t){return s<<t},TXEjI:function(s,t){return s>>t},xbOOg:function(s,t){return s+t},UJNFH:function(s,t){return s&t},zDJEs:function(s,t){return s===t},pfUKe:function(s,t){return s|t},gKnxH:function(s,t){return s|t},vUqrX:function(s,t){return s|t},VvFsP:function(s,t){return s<<t},ywUWZ:function(s,t){return s<<t},QVZQR:function(s,t){return s<<t},XUeKZ:r(388),MmhiN:function(s,t){return s<t},lgukS:"pqcaS",YZhFK:"qdaJq",VWdyN:function(s,t){return s&t},fUsrl:function(s,t){return s===t},hBXac:"3|2|4|0|"+r(964),PovId:function(s,t){return s&t},jjEel:function(s,t){return s+t},gxXDf:function(s,t){return s&t},fZihi:function(s,t){return s|t},ADMzY:function(s,t){return s&t},MGNIe:function(s,t){return s!==t},NJYAi:r(1632),Xfpdp:function(s,t){return s|t},Yyctn:function(s,t){return s>>t},oiKND:function(s,t){return s>>t},woaDS:function(s,t){return s|t},vDgln:function(s){return s()},UmInX:r(903),kEUof:r(1409),YTGYc:function(s,t){return s instanceof t},NQprF:r(1179)+r(1270),qukAD:r(1811),DpdVU:r(971),jMDqP:function(s,t){return s===t},IhwYj:r(600),LZGVR:function(s,t){return s>=t},AMuWe:function(s,t){return s>=t},ZatoS:r(1061),poRZR:"owCNs",rhPjs:function(s,t){return s|t},YKJJK:function(s,t){return s<<t},jhgqJ:function(s,t){return s|t},hGDiM:function(s,t){return s<<t},nIMxJ:r(768)+r(1879),PJWge:r(460)+r(1252),sxPpN:r(1001),FDdgj:r(1519)+r(1344)+r(1196)+"P",lCehN:r(1084),EUxBH:function(s,t){return s(t)},GTrkQ:r(1295),dQIJZ:function(s,t){return s(t)},ssjCJ:r(677),KWHGi:function(s){return s()},NXVAy:function(s,t){return s>=t},cGVme:function(s,t){return s<t},mZart:function(s,t){return s<<t},vGoda:function(s,t){return s>>t},yjMHY:function(s,t){return s&t},TziTo:function(s,t){return s>>t},AtajX:function(s,t){return s!==t},lkKtF:r(906),Ltvak:r(1072)+r(1251)+"3|5|4|0|7",CghDF:function(s,t){return s>>>t},sGQZE:function(s,t){return s|t},BAYwG:function(s,t){return s<t},IQKpK:function(s,t){return s<t},KFpmk:function(s,t){return s|t},KYSQm:function(s,t){return s<<t},fKUQF:r(1047),bnDPq:function(s,t){return s||t},eJxDv:function(s,t){return s||t},ocAeV:function(s,t,n){return s(t,n)},rwyyj:function(s,t){return s===t},sKkUU:r(1006),fiLEZ:r(1777),mdqVE:function(s,t){return s===t},PPLEu:r(897),OQcYs:r(1633),Ewxov:"RUcYw",YzdVs:function(s,t){return s|t},fJCdL:function(s,t){return s|t},CsxWS:function(s,t){return s<<t},NAiBt:function(s,t){return s|t},sfUJD:function(s,t){return s===t},fSuaZ:r(1805),JyDyO:function(s,t){return s||t},DDagx:function(s,t){return s||t},uEZCY:function(s,t){return s||t},XTnvV:function(s,t){return s!=t},fWPIz:r(901),hblok:"message_id",NfjAr:function(s,t){return s(t)},RabQv:function(s,t){return s===t},jwHKd:r(1556),Zbgka:function(s,t){return s===t},uDZlx:r(1238),dyEuK:function(s,t,n,o){return s(t,n,o)},lpySY:"need_ack",OJRSu:r(1616),LQiDK:function(s,t){return s&&t},rklFL:r(1740),uLVKi:r(1541),htwCU:r(1432),zdzPy:function(s){return s()},cyTuB:r(1441),ehArx:function(s){return s()},hMuVR:"hsOjW",CDzRg:function(s,t){return s(t)},NbVoO:function(s,t){return s(t)},mwUtq:function(s,t){return s instanceof t},KSOrc:function(s,t){return s instanceof t},trwVd:"applicat"+r(1270)+";charset=utf-8",hBfmo:"none_none",oyWjf:r(433),MzJCo:function(s,t,n,o){return s(t,n,o)},XrYrg:function(s,t){return s>t},HKiLi:function(s,t){return s+t},zlWtH:function(s,t){return s+t},HlnkA:"iQeho",SexfG:function(s,t){return s||t},qtibU:function(s,t){return s>>>t},MLHqL:function(s,t){return s(t)},fDoJX:function(s,t){return s+t},CAwYd:function(s,t){return s+t},PKxhp:r(848)+r(1103)+"ge: ",VLwiA:" + ",GDSQH:function(s,t){return s||t},NUzMM:" > ",dCgnW:function(s,t){return s&t},LInEG:function(s,t,n,o){return s(t,n,o)},IHbDa:function(s,t){return s+t},xbjXI:r(1488),Utrqf:r(1895)+r(1098)+"e",JDUxO:function(s,t){return s>=t},SjfrP:function(s,t){return s!==t},Ywpsv:"CARbt",dYnzR:function(s,t){return s&t},HpUYH:function(s,t){return s+t},bdSMU:function(s,t){return s+t},iFNHz:function(s,t){return s===t},qvINW:"ydcQW",qkkIX:function(s,t){return s<t},CEJta:r(1102)+"4",QwidH:function(s,t){return s+t},ikYDY:function(s,t){return s===t},JcuAG:r(1234),ZsLbx:function(s,t){return s+t},JEhIZ:function(s,t){return s+t},vYMrz:function(s,t){return s<<t},gGNDi:function(s,t){return s<<t},PZaim:function(s,t){return s<<t},jEuAP:function(s,t){return s<<t},BTWvz:function(s,t){return s>>>t},aWzgG:function(s,t){return s&t},yWjyA:function(s,t){return s&t},JTxqg:function(s,t){return s&t},mZSxt:function(s,t){return s&t},nmTyT:function(s,t){return s+t},ISMrh:function(s,t){return s&t},NXSqo:function(s,t){return s+t},oyUaL:function(s,t){return s(t)},HGZfm:r(1566),RLEEX:function(s,t){return s===t},qjrwO:function(s,t){return s>>>t},gUtEV:function(s,t){return s===t},MiSJt:function(s,t){return s>>>t},SUGdJ:function(s,t){return s|t},ufFqj:function(s,t){return s<<t},rZJLI:function(s,t){return s|t},wWXTF:function(s,t,n,o){return s(t,n,o)},HKOXc:r(1697),chLRe:r(511),CakjY:function(s,t){return s!==t},fSzub:r(898),ivYRk:r(397),lgysz:function(s,t){return s(t)},klTRw:"idb",bnKgm:r(1507),LWsme:r(544)+r(1369),RzcmO:"header",Ubbsq:function(s,t,n,o){return s(t,n,o)},rDnWj:r(787)+r(966),Zwyln:r(966),kdtZd:function(s,t){return s+t},PbBsO:"THdjM",yntIb:r(1493),ewaav:function(s,t,n){return s(t,n)},Bqkpk:r(1499)+r(1614),qqmiu:r(1575)+r(1414),ThTMd:r(1077),JVEhp:r(676),JKoIH:r(1221),DcIpC:function(s,t,n,o){return s(t,n,o)},AJZKb:r(1630),rkuIj:"setcursor",LbGeQ:r(431),zbeXq:function(s,t,n){return s(t,n)},oWDIF:function(s,t){return s(t)},KbouF:r(1585),XMQvZ:r(1232),bEGRK:r(1200),hJiKY:function(s,t){return s!==t},pifac:"oKYIT",QNaaH:"WYgef",VlJIQ:function(s,t,n,o){return s(t,n,o)},UsuPc:r(402),UuxVX:function(s,t,n,o){return s(t,n,o)},HoqQG:r(1709)+r(722),HSdrW:r(570)+"s",ZQyYI:r(1667)+r(700)+"e",rPOKN:function(s,t){return s(t)},dhJdc:function(s,t,n){return s(t,n)},lrnwy:function(s){return s()},owxkZ:"jIpIh",HnzVK:r(1132),RAfcI:function(s,t){return s+t},JJwgU:function(s){return s()},MyISj:function(s){return s()},JDOYn:function(s){return s()},hQlPA:r(1070),CvtAM:function(s,t,n){return s(t,n)},rYVhd:function(s){return s()},XVzjZ:r(415),XQssg:function(s,t){return s(t)},awlhK:function(s,t){return s!==t},jZDol:function(s,t){return s<t},FFLyr:function(s,t){return s===t},ERSLK:function(s){return s()},iqxLd:function(s,t,n){return s(t,n)},uLgGa:function(s,t,n){return s(t,n)},NvRGG:r(582),JaPbt:r(857),sWAYe:r(1553),WqVsG:function(s,t){return s(t)},rIOry:function(s,t){return s!==t},sdjJp:function(s,t){return s!=t},mNJIA:function(s,t){return s===t},zrnKy:r(1355),CwuLO:function(s,t){return s===t},AKStJ:r(1338),BgthH:r(999)+r(943)+"s",NeQqi:r(1129),eZWDN:"arraybuffer",OlSWN:r(1643),WZNFr:function(s,t){return s/t},ydeKO:function(s,t){return s==t},fNduq:function(s,t){return s===t},gLjna:r(1434)+r(1166)+r(1876),ecjwC:r(1434)+r(587)+r(586)+r(1307)+r(892)+r(954)+"is undef"+r(424),IevDG:function(s,t,n){return s(t,n)},iFNUV:r(1559)+"t",ygVEE:r(1265),WPpaC:r(1495),KVrMU:r(709),RmXZO:function(s,t){return s!==t},HvuQV:function(s,t){return s!==t},AJAOh:function(s,t){return s==t},rVUzN:r(395),vZqaP:r(398),CkceJ:r(1513),YiDYk:r(1462),eQAOZ:r(902),JKorv:r(1691),joKeX:r(1434)+r(663)+"ddID, deviceID o"+r(1406),CHTTq:function(s,t){return s==t},YwPJy:r(563),rABbc:function(s,t,n){return s(t,n)},nSzTm:r(1435),Iyouz:r(1683)+"0",zNeaa:r(1817),fUoHk:function(s,t,n){return s(t,n)},StGPW:r(617)+">",ckhhL:function(s,t){return s*t},Jbzxc:function(s,t){return s-t},tPsbX:function(s,t,n){return s(t,n)},mtYwT:function(s,t,n){return s(t,n)},IDGkP:"ping_onc"+r(1216)+"t",Aiang:"going aw"+r(1317)+"reconnec"+r(1215)+r(1304),riZuh:function(s,t){return s!==t},PmoSg:function(s,t){return s!==t},KGvWJ:r(782),zLIIT:r(1677)+r(1890)+r(626)+"g",OPZiW:r(965),DDCVa:function(s,t){return s+t},efpBK:function(s,t){return s||t},wqxTZ:function(s,t){return s!==t},IHFGI:r(1867),FvPnb:r(1834),elXDL:r(1839),AcBzz:function(s,t,n){return s(t,n)},DNKWA:function(s,t,n){return s(t,n)},JKCLo:function(s,t){return s!==t},vAEik:r(473),LBxsn:r(1826)+"ay, network offl"+r(1423),tBzgm:r(873),UGdEK:r(1602),wQxDi:r(1219),fOwFZ:function(s,t){return s>>t},VkRKZ:r(1136),ZolwC:r(599)+r(1011)+r(380)+r(1057)+"ed",nhVdp:function(s,t){return s===t},QIZSN:function(s,t){return s===t},Uwnyn:r(599)+"s alread"+r(399),ObStB:r(1434)+"rovide a valid d"+r(879)+"a must be a stri"+r(792)+" arraybu"+r(929),OLCxi:"number",SYMJx:function(s,t){return s!=t},knEGD:function(s,t){return s(t)},pCWoR:function(s,t){return s(t)},CrWPp:r(1434)+r(506)+r(1093)+r(1369),sVHEj:function(s,t){return s instanceof t},CvRDq:function(s,t){return s(t)},rYQgs:"sent",HLhtI:function(s,t){return s==t},dhwCV:r(1367)+r(918)+"ing",AFIRu:function(s,t){return s(t)},lqhnz:function(s,t){return s!==t},Owwip:"OdrIL",LQPoA:function(s,t){return s*t},FtnpV:"Window",OwvVu:function(s,t){return s!=t},ZpqIa:function(s,t){return s===t},dgaOn:r(1646),LbXLx:function(s,t){return s!=t},SIlms:r(1449)+r(772)+r(1172)+"pe",DPJBO:r(797)+r(1503)+r(1471),WKgcC:"ServiceWorkerGlo"+r(1729),yDTWY:function(s,t){return s!=t},QrXJV:function(s,t){return s===t},jqkcT:function(s,t){return s!=t},bzDwf:r(668)+r(1447)};Se.r(V),Se.d(V,{FWS:()=>q0,CustomErrorEvent:()=>os,createCloseEvent:()=>he,ReconnectEvent:()=>is,createErrorEvent:()=>ce,decodedFrame:()=>es,createOpenEvent:()=>ds,CustomCloseEvent:()=>as,createReconnectEvent:()=>er,FrontierMessageEvent:()=>cs,encodeFrame:()=>Qn,createMessageEvent:()=>us,OpenEvent:()=>fs,ErrorCode:()=>Me,Event:()=>rt,MessageEvent:()=>xs});let i="";function a(s=""){let t=r,n="02",o=""+Date.now(),c=i||(i=m(s)),d=Math.random()[t(1096)](16)[t(1381)](-6);return e[t(1341)](e[t(1745)](e.tezDL(n,o),c),d)}function x(){let s=r;if(e[s(1038)](e[s(1678)],e[s(1678)])){let t=_0x45e832[s(930)]();return t?(t[s(710)]=t[s(1478)]=0,t):{bytes:new _0x492624(64),offset:0,limit:0}}else return e.tezDL(e[s(683)](1e4,Date.now()),Math[s(1497)](e.tjPom(1e4,Math[s(1582)]())))}function f(s){let t=r,n={ljEPq:e[t(446)],vsguq:e[t(1772)],YqdvW:e[t(662)]};if(e[t(1622)](t(673),e[t(691)]))return e[t(1341)](e.Ewtyh(Array,8)[t(498)]("0"),e.DxewR(parseInt,s,10)[t(1096)](2)).slice(-8);_0x4fe0ef[t(447)+t(502)+t(1163)](STlEyl[t(1782)],_0x144e7e),_0x151aac[t(447)+t(502)+t(1163)](STlEyl[t(730)],_0x1102d1),_0x4c2d68[t(447)+t(502)+t(1163)](STlEyl.YqdvW,_0x12ef14)}function l(s){let t=r;return e[t(702)](Array(4).join("0"),parseInt(s,2)[t(1096)](16))[t(1381)](-4)}function h(s){let t=r;if(e[t(520)]==="uwrIq")this[t(1538)]&&this[t(1538)][t(625)](_0x3f3254,_0x11a265);else{let n=s[t(720)](/\./)[t(1576)](d=>f(d)),o=[];return o[0]=e[t(1832)](l,e[t(1120)](n[0],n[1])),o[1]=l(n[2]+n[3]),[e.XCysu,t(490),e[t(1624)],e.XCysu,e[t(1624)],"ffff",o[0],o[1]][t(498)]("")}}function m(s){let t=r,n=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[t(927)](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(927)](s);return n?e[t(1626)](h,s):o?_(s):e[t(1024)]}function _(s){let t=r,n={BylKC:function(y,v){return y(v)},HgqZP:function(y,v){return e[P(1453)](y,v)},ytEZe:t(1409),zKzqJ:function(y,v){return e[t(1851)](y,v)},aIuMI:function(y,v){return e[t(1851)](y,v)},dpRtL:e[t(1844)]},o="",c=[],d=0,g=0,p=!0,u=t(490);if(s[t(828)]("::")>-1)if(t(809)!==e[t(1739)]){let y=s.split("::");for(let A=0;A<y[t(1410)];A++)if(e.puDEL(e[t(725)],e.pcGUf)){let N=y[A];if(e[t(660)](N[t(828)](":"),0)){let D=N[t(720)](":");p&&(d=D[t(1410)]),g+=D[t(1410)];for(let O=0;e.oVsip(O,D[t(1410)]);O++)if(e[t(1828)](4,D[O][t(1410)])){let ke=u[t(1472)+"g"](0,4-D[O][t(1410)]),$=ke[t(1214)](D[O]);c.push($)}else c[t(1755)](D[O]);p=!1}else{if(e.puDEL(4,N[t(1410)])){let D=u[t(1472)+"g"](0,4-N.length),O=D.concat(N);c[t(1755)](O)}else c[t(1755)](N);p&&(d+=1),g+=1,p=!1}}else _0x4a056b=gHmsQi[t(695)](_0x44bac3,_0x23ec7f);let v="";for(let A=0;e[t(1801)](A,e[t(1594)](8,g));A++)v=v[t(1214)](u);for(let A=0;A<c[t(1410)];A++)e[t(1622)](A,d)?(o=o[t(1214)](v),o=o.concat(c[A])):o=o[t(1214)](c[A]);return o}else try{return n[t(855)](n[t(1206)],typeof _0x1e82f9)&&(n.zKzqJ(_0x8c4e9f,_0x2acffb)||_0x41d358[t(661)]&&n[t(382)](_0x1f3fb9[t(661)],_0xe7d436))||n[t(855)](n[t(1206)],typeof _0x52ef12)?"":(_0x3a8b9b[t(1351)](_0x39426c),t(1179)+t(1270))}catch{return n.ytEZe==typeof _0x3459bf?n.dpRtL:""}{let y=s[t(720)](":");for(let v=0;e[t(838)](v,y[t(1410)]);v++){let A=y[v];if(e[t(1038)](4,y[v].length)){let N=u.substring(0,e.Xsbel(4,y[v][t(1410)])),D=N[t(1214)](A);o=o[t(1214)](D)}else o=o[t(1214)](A)}return o}}function b(s,t){let n=r,o=s[n(764)];e[n(1828)](void 0,o)&&(e[n(1170)](q,t,10),e[n(1717)](ye,t,o));let c=s[n(1843)];e.puDEL(void 0,c)&&(e[n(1663)](q,t,18),e.xXZzL(ye,t,c))}function w(s){let t=r,n={};e:for(;!we(s);){let o=e[t(1626)](X,s);switch(e[t(767)](o,3)){case 0:break e;case 1:n[t(764)]=e[t(899)](_e,s,e[t(1578)](X,s));break;case 2:n[t(1843)]=e[t(947)](_e,s,e.xRgOs(X,s));break;default:e[t(1717)](Q,s,e[t(495)](7,o))}}if(n[t(764)]===void 0)throw new Error(e[t(1521)]);if(e[t(1124)](void 0,n[t(1843)]))throw new Error(e.pyvGg);return n}function C(s){let t=r,n=e[t(765)](I);return k(s,n),e[t(1578)](me,n)}function k(s,t){let n=r,o={sKAeF:function($,se,ot){return $(se,ot)},YfVgm:e[n(1328)]},c=s.SeqID;e[n(1038)](void 0,c)&&(e[n(1717)](q,t,8),e[n(1779)](bt,t,c));let d=s[n(1831)];e.puDEL(void 0,d)&&(q(t,16),e.DXVjR(bt,t,d));let g=s[n(386)];e.puDEL(void 0,g)&&(e[n(1622)](e[n(1858)],e[n(1858)])?(e[n(1779)](q,t,24),e.xXZzL(bt,t,e.Ewtyh(ne,g))):this[n(1303)](n(1239),o.sKAeF(_0x3a4045,o.YfVgm,{..._0x363c2d})));let p=s[n(1144)];if(e[n(936)](void 0,p))if(e[n(978)](e[n(527)],e[n(527)]))e.Lokvz(q,t,32),e[n(445)](bt,t,e[n(1578)](ne,p));else{let $=!!this[n(1437)].enableQoS;if(!$)return{enabled:$,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let se=e[n(1810)](_0x19ad06,_0x1dfd51[n(1239)][n(572)],e[n(732)],"2"),ot=se&&_0x2e8824(_0x3031fc.message[n(572)],e[n(1515)],"1"),Ct=se&&e[n(654)](_0x259ac5,_0x4fcfeb[n(1239)][n(572)],e[n(1016)],"1"),xr=Ct?e[n(1029)](_0x5c41fd,_0x2c53fc[n(1239)][n(572)],n(1709)+n(1224)+"sgid")?.[n(720)](",")[n(1518)](_0x3d8a89)||[]:[];return{enabled:$,isQoSMessage:se,isQoSAck:ot,isAckCleanupMessage:Ct,ackMsgIds:xr}}let u=s.headers;if(u!==void 0)for(let $ of u){q(t,42);let se=e[n(1673)](I);e.hLHzr(b,$,se),e[n(508)](q,t,se[n(1478)]),e[n(1074)]($n,t,se),e[n(1815)](M,se)}let y=s["payloadE"+n(963)];e.LABtw(void 0,y)&&(e.RxdYu(q,t,50),e[n(1285)](ye,t,y));let v=s["payloadT"+n(1799)];e[n(1038)](void 0,v)&&(e.UVkwf(q,t,58),e[n(1779)](ye,t,v));let A=s[n(1666)];A!==void 0&&(e[n(614)](q,t,66),q(t,A[n(1410)]),e[n(1663)](jt,t,A));let N=s[n(1806)];e[n(1828)](void 0,N)&&(e[n(1859)](q,t,74),ye(t,N));let D=s[n(806)+n(678)];e.qCMBG(void 0,D)&&(q(t,82),e[n(1792)](ye,t,D));let O=s[n(608)];e.IqSbU(void 0,O)&&(e[n(1029)](q,t,90),e.HhWqv(ye,t,O));let ke=s[n(1762)+"e"];e[n(1527)](void 0,ke)&&(q(t,96),e.CNJng(bt,t,e[n(1116)](ne,ke)))}function T(s){let t=r;return e[t(1385)](L,e[t(1116)](Y,s))}function L(s){let t=r,n={};e:for(;!e[t(1483)](we,s);){let o=e[t(1700)](X,s);switch(o>>>3){case 0:break e;case 1:n[t(1754)]=e.cywoN(Qr,s,!0);break;case 2:n.LogID=e[t(1262)](Qr,s,!0);break;case 3:n[t(386)]=e[t(1578)](X,s);break;case 4:n[t(1144)]=X(s);break;case 5:{let c=F(s);(n[t(572)]||(n.headers=[]))[t(1755)](e[t(1700)](w,s)),s[t(1478)]=c;break}case 6:n[t(717)+t(963)]=e.hLHzr(_e,s,e[t(1301)](X,s));break;case 7:n[t(1394)+t(1799)]=e[t(1029)](_e,s,e[t(1301)](X,s));break;case 8:n[t(1666)]=Ht(s,e[t(574)](X,s));break;case 9:n[t(1806)]=e[t(644)](_e,s,e[t(788)](X,s));break;case 10:n[t(806)+t(678)]=e[t(719)](_e,s,e.zzXGU(X,s));break;case 11:n[t(608)]=e[t(1823)](_e,s,e[t(1578)](X,s));break;case 12:n.frameType=e[t(1724)](X,s);break;default:e[t(1244)](Q,s,e.OZfQF(7,o))}}if(e[t(1124)](void 0,n[t(1754)]))throw new Error(e[t(1461)]);if(e[t(978)](void 0,n[t(1831)]))throw new Error(t(1731)+"required"+t(378)+t(1831));if(e[t(1892)](void 0,n[t(386)]))throw new Error(e[t(1424)]);if(e[t(1846)](void 0,n.method))throw new Error(e[t(957)]);return n}function F(s){let t=r,n={tjeEb:function(o,c,d){return e[P(1074)](o,c,d)},mALuf:function(o,c){return e[P(1023)](o,c)},hVFpO:function(o,c){return e[P(1596)](o,c)}};if(e[t(1622)](e[t(681)],e[t(681)])){let o=e.RBEzj(X,s),c=s[t(1478)];return s[t(1478)]=s[t(710)]+o,c}else n[t(1671)](_0x219293,_0x44a1e3,n[t(1153)](n.hVFpO(127,_0x4cd6b9),128)),_0x1394fb>>>=7}function Q(s,t){let n=r;switch(t){case 0:for(;e[n(495)](128,e[n(1524)](re,s)););break;case 2:e[n(1275)](De,s,e.RBEzj(X,s));break;case 5:e.vYKQw(De,s,4);break;case 1:e[n(870)](De,s,8);break;default:throw new Error(e.jurwb(e.sOAtx,t))}}function ne(s){let t=r;return s|=0,{low:s,high:e[t(1664)](s,31),unsigned:s>=0}}let Ae=[];function I(){let s=r,t=Ae[s(930)]();return t?(t.offset=t[s(1478)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function M(s){let t=r;if(e.gSkxr(t(1718),e[t(1092)]))return this[t(1107)][t(960)+"te"];Ae[t(1755)](s)}function Y(s){return{bytes:s,offset:0,limit:s[r(1410)]}}function me(s){let t=r,n=s.bytes,o=s[t(1478)];return n[t(1410)]===o?n:n[t(795)](0,o)}function De(s,t){let n=r;if(e[n(1142)](e[n(1263)](s[n(710)],t),s[n(1478)]))throw new Error(n(815)+"t limit");s[n(710)]+=t}function we(s){let t=r;return e[t(1822)]===e.FROBS?new _0x227d5b(_0x343ef3,_0x2e5ae0,_0x25e408):s[t(710)]>=s[t(1478)]}function le(s,t){let n=r,o=s[n(886)],c=s[n(710)],d=s[n(1478)],g=c+t;if(e.Uonxv(g,o[n(1410)])){let p=new Uint8Array(e[n(683)](2,g));p[n(756)](o),s[n(886)]=p}return s[n(710)]=g,e[n(1268)](g,d)&&(s.limit=g),c}function We(s,t){let n=r,o=s[n(710)];if(e[n(660)](e.tezDL(o,t),s[n(1478)]))throw new Error(e[n(1567)]);return s[n(710)]+=t,o}function Ht(s,t){let n=r,o=e.UYFtA(We,s,t);return s[n(886)][n(795)](o,e[n(474)](o,t))}function jt(s,t){let n=r,o=le(s,t.length);s[n(886)][n(756)](t,o)}function _e(s,t){let n=r,o=e[n(445)](We,s,t),c=String[n(1809)+n(1207)],d=s.bytes,g="\uFFFD",p="";for(let u=0;u<t;u++){let y=d[e[n(1141)](u,o)],v,A,N,D;if(e.kmJbj(128,y)===0)p+=e.GwDtQ(c,y);else if(e[n(1563)](e.ICKWb(224,y),192))if(e.HiQYI(u+1,t))p+=g;else if(v=d[e.mbQrO(e[n(505)](u,o),1)],e[n(1658)](192,v)!==128)p+=g;else if(D=e.oaPZR(e[n(1783)](31&y,6),e[n(1346)](63,v)),e[n(1801)](D,128))p+=g;else{if(e.CKOxP(e[n(1063)],e[n(1063)]))return this._qosDB[n(916)+n(436)]();p+=e[n(1815)](c,D),u++}else e[n(1056)](e.kmJbj(240,y),224)?e.DBwwn(u,2)>=t?p+=g:(v=d[e[n(474)](u,o)+1],A=d[e.rcPWh(e.HuTWn(u,o),2)],e[n(1613)](e.OZfQF(e[n(739)](v,e.yuGan(A,8)),49344),32896)?p+=g:(D=e.LsGFJ(e[n(1468)](e[n(1557)](15,y),12)|e[n(780)](63,v)<<6,63&A),D<2048||e[n(1845)](D,55296)&&e[n(853)](D,57343)?p+=g:(p+=e[n(788)](c,D),u+=2))):e[n(1060)](248&y,240)?e[n(1464)](e[n(1789)](u,3),t)?p+=g:(v=d[e[n(1208)](u+o,1)],A=d[e[n(505)](u+o,2)],N=d[e[n(1208)](e.gkbFt(u,o),3)],e[n(1786)](e.qvwFm(e[n(739)](e[n(1023)](v,e[n(420)](A,8)),e[n(420)](N,16)),12632256),8421504)?p+=g:(D=e[n(849)](e[n(1335)](e.HtscO((7&y)<<18,e[n(1046)](e[n(650)](63,v),12)),e[n(1557)](63,A)<<6),e[n(650)](63,N)),e.OaVlU(D,65536)||e[n(660)](D,1114111)?p+=g:(D-=65536,p+=e.HhWqv(c,e[n(1341)](e[n(693)](D,10),55296),e[n(1557)](1023,D)+56320),u+=3))):p+=g}return p}function ye(s,t){let n=r,o={JLwCI:function(u,y){return e[P(536)](u,y)},CqzDT:function(u,y){return e[P(1658)](u,y)},FyZRU:function(u,y){return e[P(1557)](u,y)},TXcHv:function(u,y){return e[P(907)](u,y)},zuLgt:function(u,y){return e.jXLwz(u,y)}},c=t[n(1410)],d=0;for(let u=0;e.DYRhQ(u,c);u++){let y=t[n(1710)+"At"](u);e[n(1316)](y,55296)&&y<=56319&&e.NHfyF(u+1,c)&&(y=e[n(1594)]((y<<10)+t[n(1710)+"At"](++u),56613888)),d+=e[n(838)](y,128)?1:e.OaVlU(y,2048)?2:e[n(982)](y,65536)?3:4}q(s,d);let g=le(s,d),p=s[n(886)];for(let u=0;e.DhzsO(u,c);u++){let y=t[n(1710)+"At"](u);if(e[n(1458)](y,55296)&&e[n(1125)](y,56319)&&e[n(702)](u,1)<c&&(y=e.YtAHv(e[n(702)](y<<10,t[n(1710)+"At"](++u)),56613888)),e.rqJVr(y,128))p[g++]=y;else if(e[n(1583)](e[n(1178)],e[n(1178)]))e[n(1801)](y,2048)?p[g++]=e[n(553)](e[n(1579)](e[n(1664)](y,6),31),192):(e[n(970)](y,65536)?p[g++]=e.Rchgq(e[n(390)](y>>12,15),224):e.etwVe(e[n(984)],e.sdOfp)?(_0x3085f4=jUAkdv[n(1819)](jUAkdv.CqzDT(31,_0x3ce80d)<<6,jUAkdv[n(910)](63,_0x141022)),jUAkdv.TXcHv(_0x265453,128)?_0x31ee9c+=_0x134ba7:(_0x2f71b2+=jUAkdv.zuLgt(_0x5c6803,_0x4dc727),_0x4b2af7++)):(p[g++]=e[n(1058)](e[n(1343)](e[n(549)](y,18),7),240),p[g++]=e.RxvBZ(e.SneRU(e[n(1664)](y,12),63),128)),p[g++]=e.QppcK(e[n(693)](y,6)&63,128)),p[g++]=e.QppcK(e.TlRrG(63,y),128);else throw _0x329cae=_0xe6a4f[n(1410)],e[n(1810)](_0x24e92f,_0x33e89d,10,_0x42a4f4[n(1410)])}}function $n(s,t){let n=r,o=e.opNHF(le,s,t[n(1478)]),c=s.bytes,d=t[n(886)];for(let g=0,p=t.limit;e[n(1042)](g,p);g++)c[e[n(1341)](g,o)]=d[g]}function re(s){let t=r;return s.bytes[e[t(1235)](We,s,1)]}function be(s,t){let n=r,o=e[n(594)](le,s,1);s[n(886)][o]=t}function X(s){let t=r,n=0,o=0,c;do c=e.vLIqv(re,s),e.rqJVr(n,32)&&(o|=(127&c)<<n),n+=7;while(e[t(533)](128,c));return o}function q(s,t){let n=r;for(t>>>=0;e[n(777)](t,128);)e[n(1590)](be,s,127&t|128),t>>>=7;e[n(639)](be,s,t)}function Qr(s,t){let n=r,o={axADq:function(c,d,g){return e.cjDOd(c,d,g)},WiIJk:function(c,d){return e[P(849)](c,d)},rkmGy:function(c,d){return e[P(1579)](c,d)},vJuyA:function(c,d){return c>=d},UwUCa:function(c,d,g){return e[P(499)](c,d,g)},fGCRg:e[n(1032)]};if(e[n(1002)](e[n(716)],e[n(716)])){let c=_0xf4b199[n(1472)+"g"](0,e.nHUmw(4,_0x4dca91[n(1410)])),d=c[n(1214)](_0x35bd4a);_0x18696e[n(1755)](d)}else{let c=0,d=0,g=0,p;if(p=re(s),c=127&p,e[n(807)](128,p)&&(p=e[n(735)](re,s),c|=e[n(1346)](127,p)<<7,128&p&&(p=e[n(1815)](re,s),c|=e[n(1783)](e[n(1274)](127,p),14),e[n(1302)](128,p)&&(p=e.dssic(re,s),c|=e[n(958)](e[n(1274)](127,p),21),e[n(807)](128,p)&&(p=e[n(412)](re,s),d=127&p,e[n(456)](128,p)))))){if(e[n(1622)](e[n(1109)],"UZSYJ")){for(_0x43fa0b>>>=0;_0x5d1afd>=128;)VjsALS[n(837)](_0x21b851,_0x1781d1,VjsALS[n(1838)](VjsALS.rkmGy(127,_0x16b1dd),128)),_0x1b36ee>>>=7;VjsALS[n(837)](_0x4b9e91,_0x2818ef,_0xe7f4fb)}else if(p=e[n(1700)](re,s),d|=e[n(1258)](e.lwkfc(127,p),7),e[n(1274)](128,p)){if(e[n(694)](n(757),e.jxmZk))return VjsALS[n(1088)](_0x18149b[n(710)],_0x331a8f[n(1478)]);if(p=e[n(558)](re,s),d|=e.jJTFb(127&p,14),e.OZfQF(128,p)&&(p=e[n(1832)](re,s),d|=e.LUVGL(e[n(533)](127,p),21),e.uhcRo(128,p)))if(e[n(694)](e[n(1365)],e.MgkRU)){let u=this[n(577)+n(1546)]?.["getCurre"+n(396)+"nt"]();this[n(1850)+n(1230)+n(444)](o[n(890)](_0x37e4a8,o[n(496)],{code:_0x4e587e[n(402)],reason:"connecti"+n(1014)+"d, unkno"+n(682)+n(868)+n(437)+u})),this[n(577)+n(1546)]?.[n(394)+"pointCon"+n(557)](),this[n(696)+n(1117)]?.[n(1682)+n(491)]();return}else p=re(s),g=127&p,e.qvwFm(128,p)&&(p=e[n(1450)](re,s),g|=e[n(881)](e[n(495)](127,p),7))}}return{low:e.tMkus(c,e[n(1574)](d,28)),high:e[n(1889)](d>>>4,g<<24),unsigned:t}}}function bt(s,t){let n=r,o={rBifw:function(c,d){return e[P(1700)](c,d)},EuLLs:n(999)+n(1216)+"t"};if(n(1386)!==e[n(950)]){let c=e[n(767)](t[n(823)],0),d=e[n(1150)](e[n(885)](e.mhPgv(t[n(823)],28),e[n(420)](t[n(494)],4)),0),g=e[n(1399)](t[n(494)],24),p=e.LVVqN(0,g)?e[n(1639)](0,d)?c<16384?e.CQuwZ(c,128)?1:2:e[n(781)](c,2097152)?3:4:e[n(1520)](d,16384)?e[n(970)](d,128)?5:6:e[n(573)](d,2097152)?7:8:e[n(1520)](g,128)?9:10,u=e.Dtagz(le,s,p),y=s[n(886)];switch(p){case 10:y[e.XMKgo(u,9)]=e[n(1785)](g,7)&1;case 9:y[e[n(1120)](u,8)]=e[n(1119)](9,p)?128|g:127&g;case 8:y[e[n(1379)](u,7)]=p!==8?e.Ifeff(d,21)|128:e[n(1289)](e[n(776)](d,21),127);case 7:y[e[n(423)](u,6)]=p!==7?e[n(1476)](d>>>14,128):e[n(480)](e[n(1113)](d,14),127);case 6:y[e[n(1789)](u,5)]=p!==6?e[n(489)](e[n(869)](d,7),128):e.VjHeH(e.fjOJn(d,7),127);case 5:y[e.aEIoR(u,4)]=p!==5?e[n(1476)](128,d):e[n(1287)](127,d);case 4:y[e[n(1789)](u,3)]=p!==4?e.xrRmb(e[n(1145)](c,21),128):e.Ifeff(c,21)&127;case 3:y[e[n(1059)](u,2)]=e[n(1606)](3,p)?e[n(595)](e[n(1661)](c,14),128):e.IzOvR(e[n(979)](c,14),127);case 2:y[e[n(1028)](u,1)]=e[n(1606)](2,p)?e.QPugF(c,7)|128:e[n(987)](e[n(1145)](c,7),127);case 1:y[u]=p!==1?e.inqRa(128,c):e[n(1160)](127,c)}}else o[n(1051)](_0x362350,"success"),this[n(666)]("ping_once_success",_0x319b01),this[n(666)](o.EuLLs,_0x295870)}function es(s){let t=r;if(e[t(1606)](e[t(1796)],e[t(1796)]))this[t(1303)](e.JFjpV,_0x3dd518),this.onerror&&this[t(658)](_0x4bc2fa);else return e.VuvCV(T,s)}function Qn(s){let t=r;if(e.WwUPl(t(1514),t(949)))return e[t(1376)](C,s);_0x5eb2d8.d=(n,o)=>{let c=t;for(var d in o)_0x4b6f4d.o(o,d)&&!_0x2a5993.o(n,d)&&_0x4602e9[c(1676)+c(1368)](n,d,{enumerable:!0,get:o[d]})}}let ts=65536,Xo="\0\0\0\0\0\0\0\0",nt=ts*ts,ns=e[r(1620)](nt,nt),rs=e[r(1897)](ns,2),ze=String[r(1276)+"e"][r(1710)+"At"];class B{constructor(t,n,o){let c=r;this[c(705)]=!0,this[c(823)]=e[c(739)](0,t),this[c(494)]=e[c(631)](0,n),this[c(940)]=!!o}static isLong(t){let n=r,o={bUpXR:function(c,d){return e[P(536)](c,d)},LRIWw:function(c,d){return e[P(758)](c,d)},TsefO:function(c,d){return e[P(884)](c,d)},lxALN:function(c,d){return e.hoyid(c,d)},BqOcI:function(c,d){return e[P(1619)](c,d)},exQIH:function(c,d){return c<d},bdSOa:function(c,d){return e[P(1845)](c,d)},iFGnD:function(c,d){return c<=d}};if(n(1204)!==e[n(1078)])_0x4ce089=AyBwyg[n(478)](AyBwyg.LRIWw(AyBwyg[n(1164)](15,_0x4f638b),12),AyBwyg[n(920)](AyBwyg[n(598)](63,_0x4aa7d6),6))|AyBwyg.TsefO(63,_0xb33b2d),AyBwyg[n(1404)](_0x3c7f85,2048)||AyBwyg[n(514)](_0x1c3ae9,55296)&&AyBwyg[n(567)](_0x5941a3,57343)?_0x5a8d93+=_0x4db57b:(_0x52b858+=_0x9df4fe(_0xba943b),_0x117722+=2);else return t&&e[n(1322)](!0,t[n(705)])}static fromBits(t,n,o){return new B(t,n,o)}static[r(1688)+"s"](t,n,o){let c=r;return o?B[c(1688)+"sLE"](t,n):B["fromByte"+c(1694)](t,n)}static[r(1688)+"sLE"](t,n){let o=r;return new B(e[o(631)](e.xrRmb(e[o(604)](t[0],e[o(1064)](t[1],8)),t[2]<<16),e.jJTFb(t[3],24)),e.inqRa(e[o(595)](t[4],t[5]<<8)|e.lMhhs(t[6],16),e[o(1258)](t[7],24)),n)}static[r(1688)+"sBE"](t,n){let o=r;return new B(e.oaPZR(e[o(841)](e[o(885)](t[4]<<24,e[o(1293)](t[5],16)),e[o(1753)](t[6],8)),t[7]),e[o(1023)](e[o(1362)](e.DrDbj(e[o(958)](t[0],24),e[o(1199)](t[1],16)),t[2]<<8),t[3]),n)}static fromHash(t){let n=r;return e[n(708)](t,Xo)?ss:new B(e[n(1440)](e.eSBNV(e.xrRmb(ze[n(1329)](t,0),e[n(1128)](ze[n(1329)](t,1),8))|e[n(1468)](ze.call(t,2),16),ze[n(1329)](t,3)<<24),0),(e[n(616)](ze[n(1329)](t,4),ze[n(1329)](t,5)<<8)|ze[n(1329)](t,6)<<16|e.TZGyO(ze[n(1329)](t,7),24))>>>0,!0)}[r(1765)](){let t=r;return String["fromChar"+t(1207)](e[t(533)](255,this[t(823)]),e[t(1820)](this[t(823)]>>>8,255),e[t(456)](this[t(823)]>>>16,255),e[t(1719)](this[t(823)],24),255&this[t(494)],e.PXVaH(e[t(869)](this.high,8),255),e.SiDPv(e.iyRgx(this[t(494)],16),255),e[t(537)](this.high,24))}static[r(1445)+"er"](t,n=!0){let o=r;if(e.PqQbw(isNaN,t))return n?Zo:ss;if(n){if(e[o(1609)](t,ns))return Qo}else{if(e[o(627)](t,-rs))return e0;if(e.EmVtb(e.NPLCn(t,1),rs))return $o}return B[o(1229)](e.qiwTS(e.XnEcc(t,nt),0),e[o(1362)](e.hPXlA(t,nt),0),n)}toNumber(){let t=r;return this[t(940)]?e[t(762)](e.lvRsB(e.UzpwA(this[t(494)],0),nt),this[t(823)]>>>0):e[t(1120)](this[t(494)]*nt,e[t(638)](this[t(823)],0))}[r(1625)](){let t=r;return e.wrolH(0,this[t(494)])&&e[t(1361)](0,this[t(823)])}add(t){let n=r;B[n(705)](t)||(t=B.fromNumber(t));let o=e[n(979)](this[n(494)],16),c=65535&this.high,d=this[n(823)]>>>16,g=65535&this[n(823)],p=e.fjOJn(t[n(494)],16),u=e[n(1343)](65535,t[n(494)]),y=e.QPugF(t[n(823)],16),v=65535&t[n(823)],A=0,N=0,D=0,O=0;return O+=g+v,D+=e.mbsVs(O,16),O&=65535,D+=e[n(1059)](d,y),N+=D>>>16,D&=65535,N+=e[n(860)](c,u),A+=N>>>16,N&=65535,A+=e[n(391)](o,p),A&=65535,B.fromBits(e[n(679)](e[n(1250)](D,16),O),e[n(1149)](e[n(1337)](A,16),N),this.unsigned)}[r(1382)](t){let n=r;return B[n(705)](t)||(t=B[n(1445)+"er"](t)),this[n(940)]!==t[n(940)]&&e.BZkRH(e.bKQiJ(this.high,31),1)&&t[n(494)]>>>31===1?!1:e.XotCJ(this.high,t[n(494)])&&this[n(823)]===t[n(823)]}[r(724)](){let t=r;return e[t(1326)](-1,this[t(823)])&&e.uWgey(-1,this[t(494)])?B.fromBits(0,0,this[t(940)]):e[t(1563)](-1,this[t(823)])?B[t(1229)](0,e[t(1211)](this[t(494)],1),this[t(940)]):B[t(1229)](e.aEIoR(this[t(823)],1),this[t(494)],this[t(940)])}[r(418)](t){return t?this.toBytesLE():this.toBytesBE()}[r(785)+"E"](){let t=r,n=this.high,o=this.low;return[e[t(987)](255,o),e[t(1619)](o>>>8,255),o>>>16&255,o>>>24,255&n,e[t(1403)](n>>>8,255),e[t(1364)](n,16)&255,e.wDKCR(n,24)]}toBytesBE(){let t=r,n=this[t(494)],o=this.low;return[e.GULPe(n,24),e.VvTBt(e[t(1486)](n,16),255),e.ICKWb(e[t(1054)](n,8),255),255&n,e.wDKCR(o,24),e.XpCkr(e[t(1383)](o,16),255),e.zLmqb(e[t(1486)](o,8),255),255&o]}}let ss=new B(0,0,!1),Zo=new B(0,0,!0),$o=B.fromBits(-1,2147483647,!1),Qo=B[r(1229)](-1,-1,!0),e0=B[r(1229)](0,-2147483648,!1);var Me=(function(s){let t=r,n=e.sifMa[t(720)]("|"),o=0;for(;;){switch(n[o++]){case"0":return s;case"1":s[s[t(951)+"IES_ERROR"]=5003]=e[t(611)];continue;case"2":s[s[e[t(1535)]]=5001]=e.TcDLi;continue;case"3":s[s[t(1674)+"NG_ERROR"]=5002]=t(1674)+t(1065);continue;case"4":s[s[e.Mouli]=5004]=t(953)+t(540);continue;case"5":s[s[t(642)+"OR"]=5005]=e[t(1544)];continue}break}})({});class rt{constructor(t){let n=r;this[n(1188)]=t,this[n(664)]=null}}class is extends rt{constructor(t,n){let o=r;super(t),this[o(1239)]=n&&n.message||null}}class os extends rt{constructor(t,n){let o=r;if(e.IlGIp(e[o(1452)],e[o(1452)]))try{e[o(654)](_0x354eda,this,_0xde1186,[_0x155670,_0x34a731,_0x512bbe])}catch(c){let d=_0xe032ec(e[o(1772)],{message:c[o(1239)],code:_0x10d147[o(642)+"OR"],error:c});this[o(1850)+o(1510)+o(444)](d)}else{let c=e[o(1114)][o(720)]("|"),d=0;for(;;){switch(c[d++]){case"0":this[o(485)]=n&&n[o(485)]||0;continue;case"1":this[o(1588)]=n&&n[o(1588)]||"";continue;case"2":this[o(1239)]=n&&n.message||"";continue;case"3":this[o(1227)]=n&&n.error||null;continue;case"4":this[o(402)]=n&&n[o(402)]||5001;continue;case"5":super(t);continue;case"6":this[o(546)]=n&&n.colno||0;continue}break}}}}class as extends rt{constructor(t,n){let o=r;super(t),this[o(402)]=n&&n.code||0,this[o(1879)]=n&&n[o(1879)]||"",this[o(761)]=n&&n[o(761)]||!1,this[o(622)+o(1183)]=n&&n[o(622)+o(1183)]||!1}}class xs extends rt{constructor(t,n){let o=r;super(t),this[o(1375)]=n&&n.data||null}}class cs extends xs{constructor(t,n){let o=r;super(t),this[o(1375)]=n&&n[o(1375)]||null,this[o(1239)]=n&&n[o(1239)]||null}}class fs extends rt{constructor(t,n){let o=r;super(t),this[o(1375)]=n&&n[o(1375)]||null}}function ce(s,{message:t,code:n,error:o}){return new os(s,{message:t,code:n,error:o})}function he(s,{code:t,reason:n,wasClean:o,willReconnect:c}){return new as(s,{code:t,reason:n,wasClean:o,willReconnect:c})}function us(s,{data:t,message:n}){return new cs(s,{data:t,message:n})}function ds(s,{data:t}){return new fs(s,{data:t})}function er(s,{message:t}){let n=r;if(e[n(1613)](e.tRxPP,e[n(1608)])){let o=e[n(917)][n(720)]("|"),c=0;for(;;){switch(o[c++]){case"0":if(!this[n(1538)])return;continue;case"1":this._ws["addEvent"+n(793)](e[n(1772)],this[n(1672)]);continue;case"2":this._ws.addEventListener(e[n(1328)],this[n(1634)+"ge"]);continue;case"3":this[n(1538)]["addEvent"+n(793)](e[n(1704)],this[n(1392)]);continue;case"4":this[n(1538)][n(635)+n(793)](n(625),this[n(1833)]);continue}break}}else return new is(s,{message:t})}class ls{constructor(t,n){let o=r;this[o(836)+"s"]=t,this.maxRetries=n,this.currentIndex=0,this[o(1181)+o(1197)+o(844)+"t"]=0}[r(394)+r(1711)+r(557)](){let t=r;this[t(1525)+t(1615)]=0,this[t(1181)+t(1197)+"riesCount"]=0}resetTries(){let t=r;this["currentE"+t(1197)+t(844)+"t"]=0}[r(504)+r(396)+"nt"](){let t=r;return this[t(836)+"s"][this[t(1525)+t(1615)]]}[r(504)+r(396)+r(1847)+r(1502)](){let t=r;return this[t(1181)+t(1197)+t(844)+"t"]}[r(712)+"chMaxTries"](){let t=r;return!!(e[t(777)](this.currentIndex,this.endpoints.length)||this["currentI"+t(1615)]===e[t(1863)](this[t(836)+"s"][t(1410)],1)&&e.kHEYI(this[t(1181)+t(1197)+t(844)+"t"],this[t(728)+"es"]))}[r(615)+r(1210)+r(1604)+r(1549)+r(985)](){let t=r;return e.VHhJr(this[t(1525)+"ndex"],this[t(836)+"s"][t(1410)])?!0:e[t(1353)](this[t(1181)+t(1197)+"riesCount"],this[t(728)+"es"])}[r(825)+r(875)+r(392)+r(1013)+r(492)](){let t=r;return this[t(1181)+"ndpointT"+t(844)+"t"]=1,this[t(1525)+t(1615)]++,this.endpoints[this[t(1525)+t(1615)]]}[r(504)+"ntEndpointAndUpd"+r(770)](){let t=r;return this[t(1181)+"ndpointT"+t(844)+"t"]++,this[t(504)+"ntEndpoint"]()}}let st=(e.SYMJx(e.GCOan,typeof globalThis)&&e.FtnpV===globalThis[r(942)+r(1623)][r(966)]||r(647)+"d"!=typeof window&&e[r(1231)](e.FtnpV,window[r(942)+r(1623)][r(966)]))&&e[r(754)](e[r(571)],typeof document),Je=e[r(1699)](e[r(571)],typeof globalThis)&&(e[r(935)]("Object",globalThis[r(942)+"tor"][r(966)])||e.ZpqIa(r(1449)+r(772)+r(1172)+"pe",globalThis[r(942)+r(1623)].name))&&e[r(571)]!=typeof tt,vt=(e[r(1300)](e.GCOan,typeof globalThis)&&e[r(1873)](e[r(882)],globalThis[r(942)+"tor"][r(966)])||e[r(571)]==typeof globalThis||e.OwvVu("undefined",typeof globalThis)&&!!globalThis[r(1534)+r(864)])&&e[r(941)](e.GCOan,typeof wx),St=e[r(1180)](r(647)+"d",typeof globalThis)&&(e[r(1639)](e[r(1864)],globalThis["construc"+r(1623)][r(966)])||e[r(1354)](e[r(1530)],globalThis[r(942)+"tor"][r(966)])||e[r(411)](e[r(904)],globalThis[r(942)+r(1623)][r(966)]))&&e[r(571)]!=typeof self,t0=e[r(746)](r(647)+"d",typeof globalThis)&&e[r(1560)](r(1646),globalThis[r(942)+r(1623)][r(966)])&&r(647)+"d"!=typeof global&&r(1646)===global["construc"+r(1623)][r(966)]&&e[r(571)]!=typeof process&&!!process.version;class tr{constructor(){let t=r;this[t(1882)+"rs"]={}}[r(1303)](t,...n){let o=r,c=this[o(1882)+"rs"][t];if(c)c[o(1381)]().forEach(d=>d.fn[o(1137)](d[o(429)],n));else if(e.LVVqN(e[o(1772)],t)&&!this[o(658)]){let d=n[o(1410)]&&n[0];if(e[o(1052)](d,Error))throw d;let g=new Error(e[o(860)](e[o(665)],d?e[o(403)](e.ZxqDd(" (",d[o(1239)]),")"):""));throw g[o(1874)]=d,d}return this}[r(666)](t,n){let o=r;if(e[o(978)](void 0,t))this[o(1882)+"rs"]={};else if(n===void 0)this._listeners[t]=null;else{let c=this[o(1882)+"rs"][t];if(c)for(let d=0;e.VlOVb(d,c[o(1410)]);)e[o(1758)](c[d].fn,n)?c[o(872)](d,1):++d}return this}on(t,n,o){let c=r;return(this[c(1882)+"rs"][t]||(this[c(1882)+"rs"][t]=[])).push({fn:n,ctx:o||this}),this}}class n0 extends tr{[r(1247)+r(706)+r(1877)](t){let n=r;return t[n(1194)]||t.errNo?(n(404)+" "+(t[n(1194)]||"")+n(539)+(t[n(515)]||""))[n(1217)]():JSON.stringify(t)}constructor(t,n,o){let c=r;super(),this._socket=null,vt&&wx[c(1018)+"ocket"]&&(this[c(1107)]=wx[c(1018)+"ocket"]({url:t,protocols:n,header:o,fail:this[c(1288)+c(852)+c(671)][c(1267)](this),success:this[c(1288)+c(1259)+"cessHand"+c(1607)][c(1267)](this)})),Je&&tt[c(1018)+"ocket"]&&(this[c(1107)]=tt[c(1018)+"ocket"]({url:t,protocols:n,header:o,fail:this["_createSocketFai"+c(671)][c(1267)](this),success:this[c(1288)+c(1259)+c(1746)+"ler"][c(1267)](this)}))}[r(1288)+r(1259)+r(1746)+"ler"](){let t=r,n={EpFvN:function(o,c,d){return e[P(847)](o,c,d)}};e[t(1038)](e[t(1866)],e[t(1802)])?Promise[t(1593)]()[t(1407)](()=>{this[t(468)+"steners"]()}):n.EpFvN(_0x26428e,_0x344737,this["_getInte"+t(643)+"e"](_0x17df60))}[r(1288)+r(852)+"lHandler"](t){let n=r;if(e.LVVqN(e[n(726)],e.HYACl))Promise[n(1593)]().then(()=>{let o=n,c=ce(o(1227),{message:this[o(1247)+"rrorMess"+o(1877)](t)});this.emit(o(1227),c);let d=e[o(414)](he,o(625),{reason:this["_formatE"+o(706)+o(1877)](t)});this[o(1303)](e[o(1032)],d)});else{let o=new _0xa95e3(e[n(683)](2,_0xd75c0c));o.set(_0x5f178c),_0x4fa62e[n(886)]=o}}[r(468)+r(889)](){let t=r,n={lFUsz:t(1191),hgQrJ:function(o,c,d){return e[t(1242)](o,c,d)},pzsAM:e[t(1328)]};this._socket.onOpen(o=>{let c=t;this[c(1303)](n[c(1071)],n[c(1305)](ds,n[c(1071)],{...o,data:o[c(1194)]||""}))}),this[t(1107)][t(510)](o=>{let c=t;this[c(1303)](e[c(1032)],e.tErsb(he,c(625),{...o}))}),this[t(1107)][t(530)+"e"](o=>{let c=t;this[c(1303)](c(1239),n[c(1305)](us,n.pzsAM,{...o}))}),this[t(1107)][t(900)](o=>{let c=t;this.emit(e[c(1772)],e.WhzhO(ce,e[c(1772)],{...o,message:o.errMsg||""}))})}[r(475)](t){let n=r;if(e[n(1670)](t,Uint8Array)){let o=t[n(661)].slice(t[n(1641)+"et"],e[n(1341)](t[n(1130)+"th"],t.byteOffset));this[n(1107)]&&this[n(1107)][n(475)]({data:o,fail:c=>{let d=n;this[d(1303)](e[d(1772)],e[d(1416)](ce,e.JFjpV,{message:this[d(1247)+d(706)+d(1877)](c)}))}})}else this._socket&&this._socket.send({data:t,fail:o=>{let c=n;this[c(1303)](e[c(1772)],e[c(1318)](ce,e.JFjpV,{message:this[c(1247)+"rrorMessage"](o)}))}})}[r(625)](t,n){let o=r;this._socket&&this[o(1107)][o(625)]({code:t,reason:n})}["addEvent"+r(793)](t,n){this.on(t,n)}["removeEv"+r(502)+"ner"](t,n){this[r(666)](t,n)}get[r(960)+"te"](){let t=r;return this._socket[t(960)+"te"]}get[r(1781)+"pe"](){let t=r;return this[t(1107)][t(1781)+"pe"]}set[r(1781)+"pe"](t){}get[r(1332)](){let t=r;return this[t(1107)][t(1332)]}get protocol(){return this[r(1107)].protocol}get[r(1884)+"ns"](){return this[r(1107)].extensions}get bufferedAmount(){return 0}}function r0(s,t){let n=r;if(t)return new t(s.url,s[n(1756)]);if(e[n(1774)](vt,Je))return new n0(s.url,s.protocol,s[n(572)]);if(e[n(1774)](st,St)&&n(647)+"d"!=typeof WebSocket&&WebSocket)return new WebSocket(s[n(1332)],s.protocols)}function s0(s){let t=r,n=e[t(1865)].split("|"),o=0;for(;;){switch(n[o++]){case"0":if(vt&&wx[t(1018)+t(1372)])return!0;continue;case"1":return!1;case"2":if(s)return!0;continue;case"3":if(Je&&tt[t(1018)+t(1372)])return!0;continue;case"4":if((st||St)&&e[t(1699)](e[t(571)],typeof WebSocket)&&WebSocket)return!0;continue}break}}function hs(s,t,n){let o=r,c=-1;async function d(g){let p=P;return e[p(1465)](g,c)?Promise[p(541)](new Error(e[p(1097)])):(c=g,e.zOVKP(g,n[p(1410)])?Promise[p(1593)]():n[g][p(1267)](s)(t,d.bind(null,e[p(1223)](g,1))))}e[o(989)](d,0)}function gs(s){let t=r,n=0,o=0;for(let c=0;e.uXHab(c,s.length);++c)o=s[t(1710)+"At"](c),e.nFWsh(o,128)?n+=1:e.oVsip(o,2048)?n+=2:e[t(1892)](e[t(533)](64512,o),55296)&&e[t(1639)](e[t(1580)](64512,s[t(1710)+"At"](e[t(1690)](c,1))),56320)?e[t(469)](t(560),e.uSytC)?(++c,n+=4):(e.blBHW(_0x5d9fed,this[t(1151)+"lTimeoutId"]),this["_interva"+t(1438)+"Id"]=_0xcb5046(()=>{let d=t;this[d(1730)+d(476)]()},this[t(1151)+"l"])):n+=3;return n}function ps(s,t,n){let o=r;if(e[o(1053)](n,t)<1)return"";let c="";for(let d=t;e[o(1037)](d,n);){let g=s[d++];if(g<=127)c+=String[o(1809)+o(1207)](g);else if(g>=192&&e[o(1520)](g,224))c+=String[o(1809)+o(1207)](e.TkAst(e[o(1352)](31&g,6),e[o(1886)](63,s[d++])));else if(e[o(519)](g,224)&&g<240)c+=String["fromChar"+o(1207)](e.XezQd(e[o(881)](e[o(1770)](15,g),12)|e[o(1135)](e[o(456)](63,s[d++]),6),63&s[d++]));else if(e[o(1845)](g,240)){let p=e[o(885)](e[o(679)](e[o(1209)]((7&g)<<18,e[o(1064)](e[o(1343)](63,s[d++]),12)),e[o(1135)](e[o(928)](63,s[d++]),6)),e[o(495)](63,s[d++]))-65536;c+=String[o(1809)+"Code"](e[o(1379)](55296,e[o(779)](p,10))),c+=String["fromChar"+o(1207)](e[o(980)](56320,e[o(1460)](1023,p)))}}return c}function nr(s,t,n){let o=r,c={mOUbr:function(u,y){return u===y},ZNqtE:e.XUeKZ,upQBm:function(u,y){return u in y}},d=n,g,p;for(let u=0;e[o(830)](u,s[o(1410)]);++u){if(e[o(1613)](e[o(1448)],e[o(1448)]))return _0x32ee6f instanceof _0x455d59&&(HJlqFv[o(1743)](_0x2baa9f,HJlqFv.ZNqtE)||HJlqFv[o(1743)](_0x4b3764,o(975)))?!0:HJlqFv[o(636)](_0x46716d,_0x9f29cd);if(g=s[o(1710)+"At"](u),e[o(1025)](g,128))t[n++]=g;else if(e[o(1037)](g,2048)){if(e[o(1038)](e[o(618)],e[o(618)]))return e[o(1873)](_0x26ed65,_0x50fd02)?_0x5a4812:new _0xe49048(e.mbsVs(e[o(1174)](e[o(1323)](e[o(455)](_0x14b823[o(1329)](_0x49c444,0),e[o(406)](_0x2fe112.call(_0xe5c757,1),8)),e[o(578)](_0x627ff4[o(1329)](_0x5b66f8,2),16)),_0x40212e[o(1329)](_0x421300,3)<<24),0),e[o(1661)](e.sDTtL(e.DrDbj(e[o(631)](_0x5d3b30[o(1329)](_0x4410c5,4),e[o(758)](_0x3b67f8[o(1329)](_0x5853f6,5),8)),e[o(566)](_0x54f23c.call(_0x45d83a,6),16)),_0x419c41[o(1329)](_0x3ae960,7)<<24),0),!0);t[n++]=e[o(679)](e[o(549)](g,6),192),t[n++]=e[o(1770)](63,g)|128}else if(e[o(401)](64512,g)===55296&&e[o(1804)](e.isoXg(64512,p=s.charCodeAt(u+1)),56320)){let y=e[o(1482)][o(720)]("|"),v=0;for(;;){switch(y[v++]){case"0":t[n++]=e[o(1596)](e[o(693)](g,12),63)|128;continue;case"1":t[n++]=e[o(536)](e[o(1415)](63,g),128);continue;case"2":++u;continue;case"3":g=e.jjEel(65536+e[o(1468)](e[o(1248)](1023,g),10),e[o(1596)](1023,p));continue;case"4":t[n++]=e[o(714)](g>>18,240);continue;case"5":t[n++]=e[o(924)](e.QjPld(g,6),63)|128;continue}break}}else if(e[o(1766)](e[o(1657)],e[o(1657)])){if(this[o(1437)][o(1186)+"utoRecon"+o(1505)]||this[o(736)+"osed"])return;this[o(1027)+o(918)]()}else t[n++]=e[o(1656)](e[o(575)](g,12),224),t[n++]=e[o(1289)](e[o(1122)](g,6),63)|128,t[n++]=e.woaDS(e[o(1557)](63,g),128)}return n-d}async function ms(s){let t=r;if(e[t(1124)](e.UmInX,e.UmInX)){if(e[t(1060)](e[t(1255)],typeof s)){let n=new Uint8Array(e[t(1450)](gs,s));return e[t(654)](nr,s,n,0),n}return e[t(1052)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(661)],s[t(1641)+"et"],s[t(1130)+"th"])}else return this[t(1850)+t(667)+t(1282)](_0x20ccc0),e[t(1584)](_0x27fcd9)}function i0(s){let t=r;try{return e.kHYpG(e[t(1255)],typeof s)&&(s instanceof ArrayBuffer||s[t(661)]&&e[t(1043)](s[t(661)],ArrayBuffer))||e[t(1699)](t(1409),typeof s)?"":(JSON.parse(s),e[t(1451)])}catch{return e[t(1255)]==typeof s?e[t(1844)]:""}}let o0=(s,t)=>{let n=r;switch(s){case e.qukAD:case e[n(1026)]:return{[n(1115)+s]:1,"x-tt-env":t};default:return{}}};class a0{constructor(t){let n=r;if(e[n(938)](e[n(1768)],n(600)))this[n(628)+n(1502)]=t,this[n(995)]=0;else return(this[n(1882)+"rs"][_0x2f060d]||(this._listeners[_0x201ef7]=[])).push({fn:_0x4f19a5,ctx:_0x252afd||this}),this}addCount(){let t=r;this[t(995)]++}[r(712)+"chMaxCount"](){let t=r;return e[t(1759)](this[t(995)],this[t(628)+"ount"])}[r(1682)+"nter"](t=0){let n=r;if(e[n(1577)](e[n(477)],e.poRZR))return!!(e[n(1562)](this[n(1525)+"ndex"],this[n(836)+"s"].length)||this[n(1525)+"ndex"]===this[n(836)+"s"][n(1410)]-1&&this[n(1181)+"ndpointT"+n(844)+"t"]===this[n(728)+"es"]);this[n(628)+n(1502)]=t,this[n(995)]=0}}async function x0(s){return new Promise(t=>{let n=P,o={xEKcv:n(768)+n(1879),aTHoW:function(c,d){return e[n(687)](c,d)},XkUKe:function(c,d){return e[n(1783)](c,d)},NIRdb:function(c,d){return e[n(439)](c,d)},RsxgK:function(c,d){return e[n(680)](c,d)},UJOIp:function(c,d){return e.hGDiM(c,d)}};if(!st)return t(e.nIMxJ);try{let c=document["createEl"+n(1008)](n(1022));window[n(829)+n(1836)]=d=>{let g=n;g(911)!==g(911)?(this[g(1525)+g(1615)]=0,this[g(1181)+g(1197)+g(844)+"t"]=0):(document[g(1459)][g(640)+g(926)](c),window[g(829)+g(1836)]=void 0,t(d&&d.msg||o[g(1111)]))},c[n(1188)]=e[n(775)],c[n(564)]=e[n(421)](s.replace(/^ws/,e.sxPpN),e.FDdgj);try{document.body[n(1169)+n(926)](c)}catch{document.body[n(640)+n(926)](c)}}catch{if(e.lCehN!==n(1875))window[n(829)+n(1836)]=void 0,e[n(1050)](t,e[n(1761)]);else return new _0x1c5e66(GCSkVQ[n(1157)](_0x4a7066[0]|GCSkVQ[n(632)](_0x62778c[1],8),_0x59266e[2]<<16)|GCSkVQ[n(652)](_0x490c03[3],24),GCSkVQ[n(1157)](GCSkVQ[n(1157)](GCSkVQ[n(1744)](_0x364edd[4],GCSkVQ[n(632)](_0x2358f4[5],8)),_0x2bd16e[6]<<16),GCSkVQ.UJOIp(_0x167810[7],24)),_0x137552)}})}function qe(s,t,n){let o=r;return!!s?.find(c=>c[o(764)]===t&&c[o(1843)]===n)}function it(s,t){let n=r;return s?.[n(1589)](o=>o[n(764)]===t)?.value}let rr=null;async function c0(){let s=r;if(e[s(1786)]("wLWGP",e[s(745)]))return rr||(rr=Promise[s(1593)]()[s(1407)](Se[s(1267)](Se,s(1885)))),rr;_0x16fcc8&&this._cursorManager["updateCu"+s(1281)+s(464)](_0x36edec)}class f0 extends tr{constructor(t,n){let o=r;super(),this._dbName=t,this[o(1692)]=n,this[o(1798)]=void 0,this[o(1167)+"mise"]=null}async[r(610)](){await this[r(1651)]()}async _init(){let t=r;if(!this[t(1798)]){if(this[t(1167)+"mise"])return this[t(1167)+"mise"];try{let n=this[t(385)],o=this._keyPath;this[t(1167)+t(1411)]=(async()=>{let c=t,d={ipQtn:function(p,u){return p(u)},NQIQY:function(p,u){return e[P(1750)](p,u)},OZqVf:e[c(1131)]},{openDB:g}=await e.KWHGi(c0);this[c(1798)]=await g(c(829)+"_"+n,1,{upgrade(p){let u=c;d.OZqVf!==d[u(1041)]?(d[u(1812)](_0x320fb3,this[u(407)+u(1393)+"Id"]),d[u(535)](_0x2ece98,this["_reconnectTimeou"+u(463)]),this[u(407)+"gTimeoutId"]=null,this[u(1522)+u(562)+u(463)]=null):p[u(425)+u(1062)+"e"](n,{keyPath:o})}})})(),await this[t(1167)+t(1411)]}catch(n){console[t(688)](n)}finally{this[t(1167)+"mise"]=null}}}async[r(550)](t){let n=r;try{return await this[n(1651)](),this[n(1798)]?.[n(550)](this[n(385)],t)}catch(o){console[n(688)](o)}}async[r(756)](t,n){let o=r;return await this[o(1651)](),this._qosDB?.put(this[o(385)],t)}async del(t){let n=r;try{return await this[n(1651)](),this._qosDB?.[n(991)](this._dbName,t)}catch(o){console[n(688)](o)}}async clear(){let t=r;try{return await this._init(),this[t(1798)]?.clear(this[t(385)])}catch(n){console[t(688)](n)}}async[r(1540)](){let t=r;return await this[t(1651)](),this[t(1798)]?.[t(1605)+"ys"](this[t(385)])}async[r(769)](){let t=r;return await this[t(1651)](),this._qosDB?.getAll(this[t(385)])}async[r(1342)](){let t=r;try{this[t(1798)]?.close(),this._qosDB=void 0}catch(n){console[t(688)](n)}}get isReady(){let t=r;try{if(e.zOVKP(t(1813),t(1067))){let n=_0xd9d1ed[t(1710)+"At"](_0x304e5e);e[t(1290)](n,55296)&&e.vgFka(n,56319)&&e[t(580)](e[t(1379)](_0x436961,1),_0x25b0b5)&&(n=e[t(1594)](e.Nurfc(e[t(824)](n,10),_0x2b95bc[t(1710)+"At"](++_0x525441)),56613888)),n<128?_0x56d360[_0x3c5849++]=n:(e[t(781)](n,2048)?_0x40c5ce[_0x957f38++]=e[t(466)](n,6)&31|192:(e[t(1419)](n,65536)?_0x247d7c[_0x322fdd++]=e[t(616)](e[t(1861)](e[t(723)](n,12),15),224):(_0x41bbda[_0x3e718c++]=e.RxvBZ(e[t(1073)](e[t(1122)](n,18),7),240),_0x5e0b51[_0x416d09++]=e[t(1397)](e[t(1287)](e[t(1664)](n,12),63),128)),_0x204efb[_0x3dfb27++]=e[t(1397)](e.Yyctn(n,6)&63,128)),_0x118d15[_0x360dda++]=e.iypsb(e[t(653)](63,n),128))}else return!!this._qosDB}catch(n){return console[t(688)](n),!1}}}class u0{constructor(t,n){let o=r;if(e[o(1766)](e[o(1429)],e.lkKtF)){var c=_0x455212[_0xe2e545];if(lEwhDQ.AtajX(void 0,c))return c[o(1020)];var d=_0x545d31[_0x51eb72]={exports:{}};return _0x57693c[_0x2528c4](d,d.exports,_0x4a699d),d[o(1020)]}else this[o(1456)]=t,this[o(1733)]=n,this[o(1798)]=localStorage}async[r(610)](){}get[r(1420)](){let t=r,n={wSokJ:e[t(454)],goOcL:function(o,c){return o>c},OWzJv:function(o,c,d,g){return o(c,d,g)},zhKtP:function(o,c){return e[t(869)](o,c)},IRMyT:function(o,c){return o&c},vFvMS:function(o,c){return e[t(1853)](o,c)},cTlrI:function(o,c){return e[t(840)](o,c)},gPDoQ:function(o,c){return e[t(1403)](o,c)},KFaRk:function(o,c){return e[t(580)](o,c)},cnipD:function(o,c){return e[t(1174)](o,c)},HbCPV:function(o,c){return o|c},RDOPx:function(o,c){return e[t(1403)](o,c)},IxYzC:function(o,c){return e.BAYwG(o,c)},PeMbe:function(o,c){return e[t(803)](o,c)},OITJj:function(o,c){return e[t(523)](o,c)},XQthM:function(o,c){return e[t(1042)](o,c)},kadys:function(o,c){return e[t(1162)](o,c)},yYGdG:function(o,c){return e[t(1080)](o,c)}};if(e[t(1606)]("RshQb",e[t(1645)])){let o=4294967295;return function(c,d,g=!0){let p=t,u=n[p(1587)].split("|"),y=0;for(;;){switch(u[y++]){case"0":if(n[p(905)](d+=5,c[p(1410)]))throw d=c.length,n.OWzJv(_0x5c45ea,d,10,c[p(1410)]);continue;case"1":o=n.zhKtP(o|n[p(755)](127,c[d])<<7,0);continue;case"2":o=n[p(1388)](n.cTlrI(o,n.gPDoQ(127,c[d])<<21),0);continue;case"3":if(n[p(472)](c[d++],128))return{value:g?o:n[p(422)](0,o),offset:d};continue;case"4":if(c[d++]<128)return{value:g?o:n[p(387)](0,o),offset:d};continue;case"5":o=n[p(1388)](n[p(459)](o,n[p(1592)](15,c[d])<<28),0);continue;case"6":if(n[p(1350)](c[d++],128))return{value:g?o:n[p(387)](0,o),offset:d};continue;case"7":return{value:g?o:n[p(891)](0,o),offset:d};case"8":if(n[p(1659)](c[d++],128))return{value:g?o:0|o,offset:d};continue;case"9":o=(127&c[d])>>>0;continue;case"10":if(n[p(1621)](c[d++],128))return{value:g?o:n[p(1175)](0,o),offset:d};continue;case"11":o=n[p(1388)](o|n.yYGdG(n[p(1558)](127,c[d]),14),0);continue}break}}}else return"frontier_"+this[t(1456)]}async get(t){let n=r,o=this._qosDB.getItem(this[n(1420)]);return JSON[n(1351)](e[n(832)](o,"{}"))[t]}async set(t,n){let o=r,c=this[o(1798)][o(1714)](this[o(1420)]),d=JSON[o(1351)](e[o(1380)](c,"{}"));return d[n||t[this._pathKey]]=t,this._qosDB.setItem(this[o(1420)],JSON[o(1249)+"y"](d)),n||t[this[o(1733)]]}async[r(740)](t){let n=r,o={xYvGF:function(c,d,g){return e[P(1703)](c,d,g)}};if(e[n(820)](e[n(1800)],e[n(1800)])){let c=this[n(1798)][n(1714)](this[n(1420)]),d=JSON.parse(e[n(1380)](c,"{}"));return d[t]=void 0,this._qosDB.setItem(this[n(1420)],JSON.stringify(d))}else{let c={EvjmC:function(d,g,p){return o[n(448)](d,g,p)}};return new _0x1888a4(d=>{let g=n;c[g(742)](_0x4bdcee,d,this[g(1203)+g(643)+"e"](_0x47f8bf))})}}async[r(674)](){let t=r;return this[t(1798)][t(674)]()}async[r(1540)](){let t=r,n=this[t(1798)][t(1714)](this[t(1420)]),o=JSON[t(1351)](n||"{}");return Object[t(1540)](o)}async[r(769)](){let t=r,n={yeGQX:function(o,c){return e.blBHW(o,c)},cMRgL:function(o,c){return e[P(1460)](o,c)}};if(e[t(711)]===e[t(711)]){let o=this[t(1798)][t(1714)](this[t(1420)]),c=JSON[t(1351)](o||"{}");return Object[t(718)](c)}else _0x653641=qmCwnX.yeGQX(_0x51eb19,_0x1a7b0a),_0x2dba56<32&&(_0x3e468c|=qmCwnX[t(1442)](127,_0x1a69a3)<<_0x4c6941),_0x3389df+=7}[r(1342)](){return Promise[r(1593)]()}get[r(1603)](){return!!this[r(1798)]}}class d0{constructor(t,n){let o=r;if(e[o(1827)]("UQAag",e.PPLEu))return _0x56bffa+=_0x23c52a&&_0x147665[o(1130)+"th"]||0,_0x6512f2;this._DBName=t,this[o(1733)]=n,this._qosDB=Je?tt:vt?wx:null}async openDB(){}get[r(1420)](){let t=r;return e[t(1143)](e[t(1821)],e.Ewxov)?_0x1a2319[t(1378)+t(641)][1]?void 0:_0x256bf5["objectSt"+t(569)](_0x458b42["objectSt"+t(641)][0]):t(829)+"_"+this._DBName}async[r(550)](t){let n=r,o=this._qosDB["getStora"+n(1010)](this[n(1420)]);return JSON.parse(e[n(832)](o,"{}"))[t]}async[r(756)](t,n){let o=r,c=this[o(1798)][o(945)+o(1010)](this._prefix),d=JSON[o(1351)](c||"{}");return d[n||t[this[o(1733)]]]=t,this[o(1798)]["setStora"+o(1010)](this[o(1420)],JSON[o(1249)+"y"](d)),n||t[this[o(1733)]]}async del(t){let n=r,o=this[n(1798)][n(945)+n(1010)](this[n(1420)]),c=JSON[n(1351)](e[n(832)](o,"{}"));return c[t]=void 0,this[n(1798)][n(1177)+n(1010)](this[n(1420)],JSON[n(1249)+"y"](c))}async[r(674)](){let t=r;return this._qosDB["clearSto"+t(436)]()}async[r(1540)](){let t=r;if(e[t(1610)](e[t(922)],"MKKUD"))return new _0x2c7208(e[t(841)](e[t(1284)](e[t(1856)](e.CsxWS(_0x43fa83[4],24),_0x225e63[5]<<16),_0x41091b[6]<<8),_0xff98bb[7]),e[t(803)](e[t(1837)](e[t(536)](e[t(1352)](_0x56b6e6[0],24),e[t(406)](_0x2d697[1],16)),e[t(1564)](_0x46b574[2],8)),_0x3eaa0e[3]),_0x653994);{let n=this[t(1798)][t(945)+t(1189)+"nc"](this._prefix),o=JSON[t(1351)](e[t(1384)](n,"{}"));return Object[t(1540)](o)}}async[r(769)](){let t=r,n=this._qosDB[t(945)+t(1189)+"nc"](this[t(1420)]),o=JSON.parse(e.DDagx(n,"{}"));return Object[t(718)](o)}[r(1342)](){return Promise[r(1593)]()}get[r(1603)](){return!!this._qosDB}}function ws(s,t){let n=r;if(e[n(1774)](Je,Je))return new d0(s,t);if(e.uEZCY(st,St)&&e.xgPWt("undefined",typeof indexedDB))return new f0(s,t);if(e.DDagx(st,St)&&e[n(1430)](e[n(571)],typeof localStorage))return new u0(s,t);throw new Error(n(1636)+n(1331)+"d")}class l0{constructor(){let t=r;this[t(1151)+t(1438)+"Id"]=null,this[t(1151)+"l"]=36e5,this[t(1798)]=e.bjvcG(ws,e[t(646)],e[t(409)])}async _intervalFlush(){let t=r;e[t(1363)](clearInterval,this["_interva"+t(1438)+"Id"]),this[t(1151)+t(1438)+"Id"]=setInterval(()=>{let n=t;this[n(1730)+n(476)]()},this[t(1151)+"l"])}async openDB(){let t=r;if(e.RabQv(e[t(1031)],"rzTDl"))return new _0x419a0b(_0x2327f3,{data:_0xdff350});await this[t(1798)].openDB()[t(1407)](()=>{let n=t;this[n(1151)+n(967)]()})}async[r(1730)+r(476)](){let t=r;(await this._qosDB?.[t(769)]()||[])[t(1518)](({timestamp:c})=>c<Date.now())[t(1698)](c=>{let d=t;this[d(1798)]?.[d(740)](c[d(1899)+"id"])})}async[r(740)](t){return this._qosDB?.del(t)}async[r(756)](t,n){return this._qosDB?.set({message_id:t,timestamp:n})}async get(t){return this[r(1798)]?.get(t)}async[r(1342)](){let t=r;e[t(1363)](clearInterval,this[t(1151)+t(1438)+"Id"]),await this[t(1798)]?.closeDB()}get[r(1603)](){let t=r;if(e[t(648)](t(1238),e[t(1306)]))return this._qosDB?.[t(1603)];if(!this[t(1538)])return;this[t(1722)+"WebSocket"](_0xfbdad8,_0x4c04a1,_0x7f3c29)}}function sr(s){let t=r,n=!!this[t(1437)].enableQoS;if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e[t(835)](qe,s[t(1239)][t(572)],e[t(732)],"2"),c=o&&qe(s[t(1239)][t(572)],e[t(1515)],"1"),d=o&&e[t(1810)](qe,s[t(1239)][t(572)],e[t(1016)],"1"),g=d?e[t(1275)](it,s[t(1239)][t(572)],t(1709)+t(1224)+t(1647))?.[t(720)](",")[t(1518)](Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:c,isAckCleanupMessage:d,ackMsgIds:g}}async function _s(){let s=r;return this[s(1083)+s(1511)]||(this[s(1083)+s(1511)]=new l0),this[s(1083)+s(1511)][s(1603)]||await this[s(1083)+s(1511)].openDB(),this["_QoSMana"+s(1511)]}async function h0(s,t){let n=r,o={yqstk:function(u,y,v){return e.vEHFN(u,y,v)},jlErm:function(u,y,v){return e[P(1717)](u,y,v)},iEyKI:n(625)},{enableAutoAck:c}=this[n(1437)],d=e.lXYPi(qe,s[n(1239)][n(572)],e[n(1797)],"1"),g=e[n(1810)](qe,s[n(1239)][n(572)],e[n(1637)],"1"),p=sr.call(this,s);if(e[n(669)](c,d))if(e[n(411)](n(1315),e[n(810)])){let u=fxQETY[n(1572)](_0x2f72d0,"error",{message:this[n(1247)+n(706)+"age"](_0x2ead42)});this.emit("error",u);let y=fxQETY.jlErm(_0x44d029,fxQETY[n(1340)],{reason:this[n(1247)+n(706)+n(1877)](_0x428431)});this.emit(n(625),y)}else{let{SeqID:u,LogID:y,service:v,LogIDNew:A,method:N}=s[n(1239)];this[n(609)]({SeqID:u,LogID:y,LogIDNew:A,service:v,method:N,headers:[{key:e[n(1637)],value:"1"},{key:e[n(1292)],value:e[n(1426)](A,"")},{key:e.htwCU,value:"0"}]})}g&&!p[n(1044)]&&this[n(1850)+n(1463)+n(1693)](s),e[n(1705)](t)}async function g0(s,t){let n=r;this[n(565)](e[n(1256)],s[n(1239)]),e[n(1387)](t)}async function p0(s,t){let n=r;if(e[n(820)](e[n(969)],e[n(969)])){let o=e[n(1356)](es,await e.NbVoO(ms,s.data));try{if(o[n(1666)]instanceof Uint8Array){let c=e[n(1685)](this[n(1437)][n(717)+n(963)],Object)?{force:!!this[n(1437)][n(717)+"ncoding"].force,encoding:this[n(1437)][n(717)+n(963)].encoding?this[n(1437)][n(717)+n(963)].encoding[n(1237)](/\s/g,"")["toLowerC"+n(1398)]():""}:{force:!1,encoding:this[n(1437)]["payloadE"+n(963)]?this._options[n(717)+"ncoding"].replace(/\s/g,"")["toLowerC"+n(1398)]():""},d=o[n(717)+n(963)]?o[n(717)+"ncoding"][n(1237)](/\s/g,"").toLowerCase():"",g=e[n(1202)](this[n(1437)][n(1394)+"ype"],Object)?{force:!!this[n(1437)][n(1394)+"ype"][n(1529)],type:this[n(1437)][n(1394)+n(1799)][n(1188)]?this._options[n(1394)+n(1799)][n(1188)][n(1237)](/\s/g,"")["toLowerC"+n(1398)]():""}:{force:!1,type:this[n(1437)][n(1394)+"ype"]?this[n(1437)][n(1394)+n(1799)].replace(/\s/g,"")[n(988)+"ase"]():""},p=o[n(1394)+"ype"]?o[n(1394)+n(1799)][n(1237)](/\s/g,"").toLowerCase():"",u=g.force?g[n(1188)]:p||g[n(1188)],y=c[n(1529)]?c[n(738)]:d||c[n(738)],v=[e[n(1844)],e.NQprF,e[n(1881)],e[n(1255)]],A=[e[n(1139)],e[n(959)]];this[n(1437)][n(1158)+n(1635)+n(1612)+"ad"]&&v[n(1855)](u)&&(!y||A[n(1855)](y))?o[n(1121)+"oad"]=e[n(1840)](ps,o[n(1666)],0,o[n(1666)][n(1130)+"th"]):o["textPayl"+n(1824)]=""}else o[n(1121)+n(1824)]=""}catch(c){o["textPayl"+n(1824)]="",console[n(688)](c)}s[n(1239)]=o,e[n(1705)](t)}else this[n(1538)]&&this._ws.send(_0x5be088),this._debug("sent",_0x3e2eef)}function m0(s,t,n){let o=r;if(e[o(805)]!=="kADpp"){let c=e[o(1492)](n,8192),d=e[o(1417)](c,1),g=null,p=c;return function(u){let y=o;if(u<1||e[y(1353)](u,d))return e[y(1039)](s,u);e[y(1021)](e[y(1257)](p,u),c)&&(g=e[y(1450)](s,c),p=0);let v=t[y(1329)](g,p,p+=u);return e[y(1176)](7,p)&&(p=e[y(798)](7|p,1)),v}}else _0x504d7c[o(1459)].appendChild(_0x246d2f)}let w0=4294967295;function _0(s,t,n){let o=r;return e[o(1205)](RangeError,e[o(702)](e[o(743)](e[o(1531)](e[o(513)]+s,e[o(923)]),e[o(1784)](t,1)),e.NUzMM)+n)}function y0(s,t,n){let o=r;if(e.gkgJq(o(854),e[o(1648)])){if(e[o(1142)](n,w0))throw new Error(e[o(933)]);let c=3;for(;e[o(1320)](c,0);)if(e[o(880)](e[o(914)],e[o(914)]))this[o(576)+o(1857)+"line"]=_0x5db04f,_0x54a748?this[o(1390)+"nLine"]():this[o(1390)+"ffLine"]();else{let d=e.dYnzR(255,n);e[o(1840)](or,d,s,e.HpUYH(t,c)),n>>>=8,c--}return e.bdSMU(t,4)}else{let c=e[o(1870)](255,_0x257d79);e.LInEG(_0x588e92,c,_0x36fd3f,e[o(1629)](_0xbd6c40,_0x523157)),_0x18d542>>>=8,_0x1d73e8--}}function b0(s,t){let n=r;if(e[n(1561)]===e[n(1561)]){let o=0,c=t,d=t+4;for(;e[n(1487)](c,d);){let{value:g,offset:p}=e[n(1262)](ir,s,c);c=p,o=e[n(979)](o<<8,0),o+=g}return{value:o,offset:d}}else{let o=this[n(1882)+"rs"][_0x15cf4];if(o)for(let c=0;c<o[n(1410)];)e[n(1231)](o[c].fn,_0x255eaa)?o[n(872)](c,1):++c}}function v0(s,t,n){let o=r,c=e[o(1707)][o(720)]("|"),d=0;for(;;){switch(c[d++]){case"0":if(s.length<40)return e[o(762)](e[o(1810)](nr,s,t,n),n);continue;case"1":if(t.write)return e[o(1690)](t[o(1296)](s,n),n);continue;case"2":if(t[o(973)+"e"])return t[o(973)+"e"](s,n)+n;continue;case"3":if(!s)return n;continue;case"4":return e[o(408)](nr(s,t,n),n)}break}}function S0(s,t){let n=r,o={yMspW:function(c,d,g){return e[P(508)](c,d,g)},gLZcg:function(c,d){return c(d)}};if(e[n(774)](n(799),e[n(1489)]))WbgijN[n(1055)](_0x78729f,_0x2f7bef,96),_0x382c83(_0x500f4b,WbgijN[n(915)](_0x4c19cd,_0x5a8c4a));else{let c=new B(e[n(687)](e[n(1058)](e[n(1023)](e[n(958)](s[e[n(1401)](t,4)],24),e[n(1064)](s[e[n(554)](t,5)],16)),e[n(1569)](s[e[n(762)](t,6)],8)),s[e[n(1379)](t,7)]),e[n(616)](e[n(714)](e[n(1218)](s[e.JEhIZ(t,0)],24),e[n(1045)](s[t+1],16))|e[n(747)](s[e[n(702)](t,2)],8),s[e[n(1789)](t,3)]),!0);return t+=8,{value:c,offset:e[n(408)](t,8)}}}function C0(s,t,n){let o=r,c=s[o(823)],d=s[o(494)];return t[n]=e[o(383)](d,24),t[n+1]=e[o(1675)](e[o(767)](d,16),255),t[e[o(474)](n,2)]=e[o(789)](e[o(776)](d,8),255),t[e[o(421)](n,3)]=e.dYnzR(255,d),t[n+4]=c>>>24,t[n+5]=e[o(1736)](e[o(638)](c,16),255),t[e[o(505)](n,6)]=e.yjMHY(c>>>8,255),t[e[o(423)](n,7)]=e[o(450)](255,c),n+=8,n}function ir(s,t){let n=r;return s[n(590)+"8"]?{value:s[n(590)+"8"](t),offset:t+1}:{value:e[n(924)](255,s[t]),offset:e[n(583)](t,1)}}function or(s,t,n){let o=r;return t[o(1015)+"t8"]?t.writeUint8(s,n):t[n]=e.ISMrh(255,s),e[o(1400)](n,1)}let E0=function(s){let t=r,n={zZsJp:function(o,c){return e[P(555)](o,c)}};if(e[t(1617)](e[t(1140)],"NyAss"))_0x185570[t(635)+t(793)](t(866)+t(1475),o=>{let c=t;_0xed4cdf(wVkZVI[c(1333)](_0x29a5b3,_0x249f7e.result),o[c(1536)+"on"],o[c(1794)+"on"],_0x20bc5f(_0x5439d2.transaction))});else return new Uint8Array(s)},A0=e[r(1872)](e[r(571)],typeof Buffer)?Buffer[r(893)+r(686)]:m0(E0,Uint8Array[r(1276)+"e"].subarray);(()=>{let s=r,t={Ieozc:function(n,o){return e[P(1299)](n,o)},wpBhq:function(n,o){return e[P(521)](n,o)},sTVGp:function(n,o){return e[P(556)](n,o)},JsSEp:function(n,o){return e[P(972)](n,o)},ChxDF:function(n,o){return e.MiSJt(n,o)},HOPas:function(n,o){return e.DhzsO(n,o)},HLYEb:function(n,o){return e.SUGdJ(n,o)},iMwMm:function(n,o){return e[P(1330)](n,o)},aEsHm:function(n,o){return e[P(440)](n,o)},ZJlZc:function(n,o){return e[P(1474)](n,o)},cxcNI:function(n,o){return n>>>o},tvjwP:function(n,o){return e[P(595)](n,o)},mFOCU:function(n,o){return n<o},Tmypk:function(n,o){return e.hdHSe(n,o)},RNMne:function(n,o,c,d){return e[P(850)](n,o,c,d)}};if(e.HKOXc===e[s(1334)])return _0x332a3e[s(705)](_0x1c837d)||(_0x292ae7=_0x826772[s(1445)+"er"](_0x3c1309)),ZPtZIv[s(1485)](j[s(940)],_0x404bf4.unsigned)&&ZPtZIv.wpBhq(ZPtZIv.sTVGp(j.high,31),1)&&ZPtZIv[s(1148)](ZPtZIv.ChxDF(_0x111717[s(494)],31),1)?!1:j[s(494)]===_0x5b9438[s(494)]&&j[s(823)]===_0x421e2f[s(823)];{let n=4294967295;return function(o,c,d=!0){let g=s;if(n=t[g(1551)](127&o[c],0),t[g(834)](o[c++],128))return{value:d?n:0|n,offset:c};if(n=t.ChxDF(t.HLYEb(n,t.iMwMm(127&o[c],7)),0),o[c++]<128)return{value:d?n:0|n,offset:c};if(n=t[g(1551)](t.HLYEb(n,t[g(1446)](127,o[c])<<14),0),t[g(834)](o[c++],128))return{value:d?n:0|n,offset:c};if(n=t[g(649)](t[g(488)](n,t[g(821)](127&o[c],21)),0),t[g(834)](o[c++],128))return{value:d?n:t[g(488)](0,n),offset:c};if(n=t[g(1702)](t[g(1517)](n,(15&o[c])<<28),0),t[g(1644)](o[c++],128))return{value:d?n:t[g(1225)](0,n),offset:c};if((c+=5)>o.length)throw c=o[g(1410)],t[g(1597)](_0,c,10,o[g(1410)]);return{value:d?n:0|n,offset:c}}}})();let D0=16,ar=32;function k0(s){let t=r,n={MAIlY:function(o,c){return e[P(1774)](o,c)}};if(e[t(1760)](e.fSzub,e[t(547)])){let o=0,c={};for(let d=0;d<s[t(1410)];d++)c[s[d].cursor_name]=e[t(438)](gs,s[d]["cursor_n"+t(1614)]),o+=14+c[s[d]["cursor_n"+t(1614)]];return[o,c]}else{let o=this._qosDB.getItem(this[t(1420)]);return _0x1eb6bd[t(1351)](ncFpUi[t(606)](o,"{}"))[_0x14240d]}}function ys(s,t,n){let o=r,c={zjIoF:e[o(1359)],khQKO:function(y,v){return e[o(1892)](y,v)},msWbs:o(1110),hIrCF:e[o(1240)],mnWQz:e.LWsme,CkyDr:function(y,v,A,N){return e[o(654)](y,v,A,N)},rFxcy:e[o(1358)],Iinwj:o(386),jebsg:function(y,v,A,N){return e[o(909)](y,v,A,N)},nPGbW:e[o(939)],vmHgu:e[o(613)]},[d,g]=e[o(1376)](k0,s),p=e[o(1724)](A0,d),u=0;return s[o(1698)](y=>{let v=o;if(c[v(1339)](c[v(863)],c.hIrCF))return _0x2bbc3f||(_0x2c14f9=_0x4b3e2a[v(1593)]()[v(1407)](_0x3b2719[v(1267)](_0x2efae2,WLJgia[v(932)]))),_0x5bb31d;console[v(688)](c[v(1776)],y,y[v(386)]),u=c.CkyDr(or,0,p,u),console.log(c[v(461)],u),u=y0(p,u,y.service||0),console[v(688)](c[v(1017)],u),u=c[v(1321)](or,g[y[v(1499)+v(1614)]],p,u),console[v(688)](c[v(1868)],u),u=c[v(1321)](v0,y["cursor_n"+v(1614)],p,u),console[v(688)](c.vmHgu,u),u=C0(B.fromNumber(y[v(1348)]||t),p,u),console[v(688)](v(1769),u)}),{frameType:ar,headers:[{key:o(601)+o(808),value:n}],payload:p}}function I0(s){let t=r,n=0,o=[];for(;n<s.byteLength;){let{offset:c}=e[t(1311)](ir,s,n);n=c;let d={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e[t(1590)](b0,s,n);d[t(386)]=g,n=p;let{value:u,offset:y}=ir(s,n);n=y,d[t(1499)+t(1614)]=ps(s,n,e[t(998)](n,u)),n+=u;let{value:v,offset:A}=S0(s,n);d.cursor=v[t(690)](),n=A,o[t(1755)](d)}return o}function P0(){let s=r;return{frameType:ar,headers:[{key:s(601)+s(808),value:s(467)+s(934)}],payload:void 0}}class T0{constructor(t,n,o){let c=r;if(e.CakjY(e[c(1425)],e[c(1716)]))this[c(1100)+"ameSpace"]=t,this["_cursorF"+c(1245)]=n,this[c(381)+"Strategy"]=o,this[c(1798)]=e[c(766)](ws,this[c(1100)+c(1374)],e[c(784)]);else{let d=this[c(1437)][c(1559)+"tInterce"+c(637)](_0x2a4f26,_0xbf58e9);this[c(1850)+c(1230)+"ent"](e[c(1182)](_0x44ac60,c(625),{code:_0xe171cd,reason:_0x707bd,wasClean:!0,willReconnect:d})),d&&this[c(593)]()}}async[r(610)](){let t=r;await this[t(1798)][t(610)]()}async getCursors(){let t=r;if(!this[t(1798)][t(1603)])return;let n=this[t(381)+t(1243)],o=await this[t(1798)][t(769)]();switch(console[t(688)](e[t(1076)],o),n){case e.ThTMd:return o&&o[t(1410)]?ys(o,0,this["_cursorF"+t(1245)]):void 0;case e.JVEhp:return;case e.JKoIH:return o&&o[t(1410)]?e[t(1749)](ys,o,0,this[t(1147)+t(1245)]):e[t(1584)](P0)}}async[r(756)](t,n,o){let c=r;return console[c(688)](e.AJZKb,t,n,o),this[c(1798)][c(756)]({cursor_name:t,cursor:n,service:o})}async[r(552)+"rs"](t){let n=r,o=I0(t);for(let c of o)console[n(688)](e[n(826)],o),await this._qosDB.set(c)}async get(t){let n=r;return(await this._qosDB[n(550)](t))?.[n(1348)]}async[r(1342)](){let t=r;await this[t(1798)][t(1342)]()}[r(410)+r(1281)+r(464)](t){let n=r;if(e[n(827)]==="ncQLS")this["_cursorF"+n(1245)]=t;else return this[n(1107)][n(1756)]}get[r(1603)](){let t=r;return this[t(1798)][t(1603)]}}let L0=e[r(1803)];async function bs(s){let t=r,n={RSEWk:function(o,c,d){return e[P(1893)](o,c,d)},eriSJ:function(o,c){return e.nmTyT(o,c)},axokr:function(o,c){return e.PovId(o,c)},hMCAZ:function(o,c){return o|c},MvUOw:function(o,c){return e[P(1128)](o,c)},ywdbw:function(o,c){return e[P(830)](o,c)},lXhMh:function(o,c){return e[P(1764)](o,c)}};if(e[t(624)]!==e[t(1601)]){if(!this._options[t(623)+"S"])return null;let{aID:o,fpID:c,messageStrategy:d}=this[t(1437)],g=s||L0;try{if(this[t(912)+t(1506)])if(e.jHlFD(e[t(1649)],t(1469)))s&&this["_cursorM"+t(1506)][t(410)+"rsorFile"+t(464)](s);else{this[t(1068)+"ngTimer"](),this["_pingPon"+t(1393)+"Id"]=n[t(1297)](_0x3c2f79,this[t(1049)][t(1267)](this),this[t(1437)][t(801)+t(1087)]);return}else this[t(912)+t(1506)]=new T0(c+"_"+o+"_"+g,g,d);return this[t(912)+t(1506)].isReady||await this[t(912)+t(1506)][t(610)](),this._cursorManager}catch{return e.hJiKY(e[t(1309)],e.QNaaH)?null:this[t(1107)].url}}else _0x2069da=_0x34481d[aWQaNs.eriSJ(_0x1d09ab+_0x2e15f3,1)],aWQaNs[t(744)](192,_0x32ce7c)!==128?_0x272883+=_0x4a2a03:(_0x39b2e5=aWQaNs[t(1413)](aWQaNs[t(1600)](aWQaNs.axokr(31,_0x55ba13),6),aWQaNs[t(744)](63,_0x50c894)),aWQaNs.ywdbw(_0x322582,128)?_0x30c056+=_0x1cc9da:(_0x18eef6+=aWQaNs[t(1101)](_0x118070,_0x23395e),_0x98e56b++))}async function N0(s,t){let n=r,o={dLdrD:function(D,O){return D===O},GHMnx:function(D,O){return D<O}},c=e[n(416)](qe,s[n(1239)][n(572)],e.UsuPc,"-1"),d=e[n(1264)](qe,s[n(1239)].headers,e[n(1637)],"1"),g=it(s.message[n(572)],n(1709)+"er_msgid"),p=e.QVLVM(Number,e[n(1244)](it,s.message[n(572)],e[n(811)]))||0,u=sr.call(this,s),y=qe(s.message[n(572)],e[n(1490)],"2"),v=e.ewaav(it,s[n(1239)][n(572)],e[n(493)]),A=e.rPOKN(Number,e[n(538)](it,s.message[n(572)],n(1667)+n(1542)+"ue"));if(u.isQoSAck)return e.lrnwy(t);let N=u[n(1757)+n(701)]?await _s[n(1329)](this):null;if(s[n(1239)].service>0&&d&&!c||e[n(1353)](s.message[n(386)],0))if(n(731)!==e[n(605)]){if(g&&u[n(1757)+n(701)]&&N)return!!!await N.get(g)&&(e.HnzVK!==e[n(435)]?(this[n(1188)]=_0x272fa4,this[n(664)]=null):(this[n(1850)+n(667)+n(1282)](s),await N[n(756)](g,e[n(796)](Date[n(1266)](),p)))),t();if(y){let D=await bs[n(1329)](this);if(!D)return this[n(1850)+n(667)+n(1282)](s),e[n(512)](t);let O=await D[n(550)](v)??-1;if(e[n(982)](O,A))this["_dispatchMessage"+n(1282)](s),D[n(756)](v,A,s[n(1239)][n(386)]);else throw new Error(n(1477)+n(501)+" cursor "+A+(n(1086)+n(1089)+"al cursor ")+O);return t()}return this[n(1850)+n(667)+n(1282)](s),e[n(1349)](t)}else{if(_0x942f0===void 0)this[n(1882)+"rs"]={};else if(LjCCrH[n(531)](void 0,_0x224acc))this[n(1882)+"rs"][_0x1c9d80]=null;else{let D=this[n(1882)+"rs"][_0x3c5da1];if(D)for(let O=0;LjCCrH[n(482)](O,D[n(1410)]);)LjCCrH.dLdrD(D[O].fn,_0x554ccc)?D[n(872)](O,1):++O}return this}}async function R0(s,t){let n=r,o=sr[n(1329)](this,s);if(!o.isQoSMessage)return e[n(1705)](t);let c=await _s.call(this);if(o[n(1547)+n(1360)+"age"]&&o[n(1481)+"s"][n(1410)])for(let d of o[n(1481)+"s"])await c[n(740)](d);e.JDOYn(t)}async function O0(s,t){let n=r,o={fpFTb:e[n(1878)]},c=s[n(1239)].frameType===D0,d=e[n(1354)](s[n(1239)][n(1762)+"e"],ar);if(e[n(669)](!c,!d))return t();let g=e[n(1314)](it,s[n(1239)][n(572)],"cursor_f"+n(808));if(!g)return e.rYVhd(t);let p=await bs[n(1329)](this,g);if(!p)return e[n(512)](t);if(c){let u=await p[n(1421)+"rs"](),y={frameType:u?.["frameType"],SeqID:B[n(1445)+"er"](this._seqId++),LogID:B[n(1445)+"er"](this[n(1437)][n(1723)+n(1081)]()),service:9e3,method:5,headers:u?.[n(572)],payload:u?.[n(1666)]},v=e.edpWL(C,y);this[n(1538)]&&this._ws[n(960)+"te"]&&this._ws[n(475)](v)}if(d)if(e[n(481)](n(859),e.XVzjZ))!_0x531279.persisted&&(this._isBrowser&&_0x1dc5aa[n(447)+n(502)+"ner"](n(1495),this[n(592)+"ageHide"]),this._isBrowser&&_0x354062["removeEv"+n(502)+"ner"]("pageshow",this[n(592)+"ageShow"]),this.close()),this._isBrowser&&_0x440a19[n(447)+n(502)+"ner"](n(1265),this[n(1390)+n(659)]),this[n(1161)+"er"]&&_0x22b2b4[n(447)+"entListe"+n(1163)](o[n(1735)],this[n(1390)+n(1099)]);else{let u=s.message.payload;u&&p[n(552)+"rs"](u)}}let B0=async function(s,t){let n=r;this[n(543)]=!1,e[n(1552)](clearTimeout,this[n(593)+n(597)+"utId"]),t()},z0=async function(s,t){let n=r;if(!this[n(1538)]||e.awlhK(this[n(1538)][n(960)+"te"],this[n(1523)]))return e[n(1349)](t);let{pingInterval:o}=this[n(1437)];this["_endpoin"+n(1546)]?.[n(394)+"pointCon"+n(557)]();for(let d=0;e[n(992)](d,this[n(381)+"Queue"][n(1410)]);d++){let g=this["_message"+n(763)][d];if(e[n(921)](this._ws[n(960)+"te"],this[n(1523)])&&e[n(1002)](null,g))this[n(1538)]&&this._ws[n(475)](g),this[n(381)+n(763)][d]=null;else break}this[n(381)+n(763)]=this["_message"+n(763)][n(1518)](d=>!!d),this["_pingPon"+n(1393)+"Id"]=setTimeout(()=>this._ping(),o),this[n(1850)+n(1543)+"nt"](s),this._isBrowser&&this[n(1538)]&&(this[n(1538)][n(1781)+"pe"]=this[n(1767)+n(1799)]);let c=this[n(577)+n(1546)]?.[n(504)+"ntEndpoint"]();this[n(565)](n(1273)+c+n(1830)),e[n(1095)](t)},M0=async function(s,t){let n=r,o=this[n(577)+"tManager"]?.["getCurre"+n(396)+"nt"]();this[n(565)](n(1273)+o),e[n(1313)](t)};class q0 extends tr{constructor(t){let n=r,o={ZizVv:function(p,u,y,v){return p(u,y,v)},ChVxA:"wXBEN",GBJXK:function(p,u,y){return e[P(508)](p,u,y)},UEJDW:e[n(1772)],xLfoZ:n(997)+"2",Ysxxm:function(p,u){return e[n(1300)](p,u)},KjcKx:e[n(571)],gZFkp:function(p,u){return e.mNJIA(p,u)},JSnny:e[n(759)],veeNd:function(p,u){return e[n(935)](p,u)},XYCdA:e.AKStJ,KWbLe:e[n(698)],AGCcF:function(p,u,y){return e[n(1590)](p,u,y)},fcQic:e[n(1439)]};super(),this["_miniNav"+n(1857)+n(579)]=!0,this[n(1161)+"er"]=st,this[n(1184)]=t0,this[n(908)+"T"]=Je,this[n(993)+"X"]=vt,this[n(1433)+"r"]=St,this[n(381)+n(763)]=[],this[n(577)+"tManager"]=null,this[n(736)+n(750)]=!1,this[n(1767)+n(1799)]=e.eZWDN,this[n(593)+"Lock"]=!1,this[n(593)+n(597)+n(509)]=null,this[n(1522)+n(562)+n(463)]=null,this["_pingPon"+n(1393)+"Id"]=null,this[n(800)]=0,this[n(543)]=!1,this[n(1752)]="",this[n(1083)+"ger"]=null,this[n(912)+"anager"]=null,this[n(696)+"sCounter"]=null,this[n(1155)+"ls"]=e.OlSWN,this.CLOSED=3,this[n(1674)+"NG"]=0,this[n(1523)]=1,this[n(697)]=2,this._onOpen=p=>{let u=n,y={TWKvH:u(873)};try{o[u(1280)](hs,this,p,[B0,z0,M0])}catch(v){if(o[u(1291)]!==o.ChVxA)this[u(1303)](y.TWKvH,_0x318dfa),this[u(449)+u(1526)]&&this[u(449)+u(1526)](_0x354bc8);else{let A=o[u(1679)](ce,o[u(1665)],{message:v[u(1239)],code:Me[u(642)+"OR"],error:v});this[u(1850)+u(1510)+u(444)](A)}}},this[n(1634)+"ge"]=async p=>{let u=n,y={mZAVZ:o[u(1887)],cMPzk:function(N,D){return N||D},XNuoc:function(N,D){return o[u(427)](N,D)},TMVKG:o[u(1516)]},{pingInterval:v,pingFrequency:A}=this[u(1437)];if((o[u(1848)]("hi",p[u(1375)])&&o[u(1405)]===A||o[u(417)](o[u(607)],A))&&(this["_clearPi"+u(1494)](),this[u(1303)](o[u(1261)],u(831)),this[u(407)+u(1393)+"Id"]=o[u(1701)](setTimeout,this._ping[u(1267)](this),v)),p[u(1375)]!=="hi")try{if(o.veeNd(u(1389),o.fcQic)){let N=y[u(1896)].split("|"),D=0;for(;;){switch(N[D++]){case"0":if(_0x351629)return!0;continue;case"1":if(dpzfCZ[u(1271)](_0x1f224d,_0x472d6f)&&dpzfCZ[u(1201)](dpzfCZ[u(1104)],typeof _0x5bb1df)&&_0x487f76)return!0;continue;case"2":return!1;case"3":if(_0x4e07cc&&_0x5af0b2[u(1018)+"ocket"])return!0;continue;case"4":if(_0x32aaa4&&_0x182ce0.connectSocket)return!0;continue}break}}else hs(this,p,[p0,h0,R0,O0,N0,g0])}catch(N){let D=o[u(1679)](ce,o[u(1665)],{message:N[u(1239)],code:Me[u(953)+"ERROR"],error:N});this[u(1850)+"hErrorEv"+u(444)](D)}},this[n(1672)]=p=>{let u=n,y=this[u(577)+u(1546)]?.[u(712)+"chMaxTries"](),v=this[u(577)+u(1546)]?.[u(504)+u(396)+"nt"]();if(y&&!p.message){let A="connect "+v+(u(896)+u(771)+u(1725)+"ed");this[u(1850)+u(1510)+u(444)](ce(o[u(1665)],{message:A,code:Me[u(951)+"IES_ERROR"],error:p}));return}this._ws&&o[u(1848)](this[u(1538)][u(960)+"te"],this.OPEN)&&this[u(1500)+u(434)](),this[u(1850)+u(1510)+u(444)](ce(o[u(1665)],{message:p[u(1239)],code:Me[u(1325)+u(1479)],error:p}))},this[n(1833)]=async p=>{let u=n;this[u(1254)+"mer"](),this[u(1068)+u(1494)](),this[u(689)+"sListeners"](),this[u(1538)]=null,this[u(593)+"Lock"]=!1;let y=this[u(577)+"tManager"]?.[u(712)+u(1581)+"es"]();if(!y&&this[u(1454)+"orOnline"]()&&!this[u(736)+u(750)]){let v=this[u(577)+u(1546)]?.[u(504)+u(396)+"nt"](),A=this[u(1437)][u(1559)+u(500)+u(637)](p[u(402)],p[u(1879)]);this[u(1850)+u(1230)+u(444)](e[u(1869)](he,e.WyKfN,{code:1006,reason:p.reason||u(794)+u(1014)+u(1123)+"wn reaso"+u(868)+u(437)+v,willReconnect:A})),A&&this[u(593)]();return}if(e[u(670)](1e3,p[u(402)])&&this[u(736)+"osed"]){this[u(1850)+"hCloseEvent"](e[u(1e3)](he,e[u(1032)],{code:1e3,reason:e.NvRGG})),this[u(577)+u(1546)]?.[u(394)+u(1711)+u(557)](),this[u(696)+u(1117)]?.[u(1682)+u(491)]();return}if(e[u(1038)](1e3,p[u(402)])&&y)if(e[u(1827)](e[u(1286)],e[u(888)]))_0x3c13cf(_0x5f35a8,82),OqPYKz[u(1701)](_0x94ef49,_0x1ff08d,_0x1ac51c);else{let v=this[u(577)+"tManager"]?.[u(504)+u(396)+"nt"](),A=p[u(1879)];A||(A=await e[u(1871)](x0,this._url)),A=u(794)+u(1014)+u(1771)+A+(u(619)+u(812))+v+(", max re"+u(1880)+u(1408)),this[u(1850)+u(1230)+u(444)](e[u(1859)](he,u(625),{code:p[u(402)],reason:A}));let N="connect "+v+(" fail, max retri"+u(1725)+"ed");this[u(1850)+u(1510)+u(444)](ce(u(1227),{message:N,code:Me[u(951)+"IES_ERROR"]})),this["_endpoin"+u(1546)]?.["resetEnd"+u(1711)+u(557)](),this[u(696)+u(1117)]?.[u(1682)+u(491)]();return}if(e[u(1154)](1e3,p[u(402)])&&!p[u(1879)]){let v=this[u(577)+u(1546)]?.["getCurre"+u(396)+"nt"]();this[u(1850)+u(1230)+"ent"](he("close",{code:p[u(402)],reason:"connecting faile"+u(1123)+"wn reaso"+u(868)+u(437)+v})),this._endpointManager?.["resetEnd"+u(1711)+u(557)](),this[u(696)+u(1117)]?.[u(1682)+u(491)]();return}this[u(1850)+u(1230)+u(444)](p),this[u(577)+u(1546)]?.[u(394)+"pointCon"+u(557)](),this["_pingLos"+u(1117)]?.resetCounter()},this[n(589)]=null,this[n(658)]=null,this[n(517)+"e"]=null,this[n(1680)]=null,this[n(1134)+n(918)]=null,this[n(449)+n(1526)]=null,this[n(1431)+"mediatel"+n(1327)+"ct"]=null,this["_handleO"+n(659)]=this[n(1390)+n(659)][n(1267)](this),this[n(1390)+n(1099)]=this[n(1390)+"ffLine"][n(1267)](this),this[n(592)+n(937)]=this[n(592)+"ageHide"].bind(this),this["_handleP"+n(1484)]=this[n(592)+n(1484)][n(1267)](this),this[n(1437)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(1345)](1,0),service:0,logIDGenerator:x,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1628)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e[n(1668)],env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:d}=t,g=Array.isArray(c)?c:e[n(1627)](e.kEUof,typeof c)?[c]:[];if(!g||e.fNduq(0,g[n(1410)]))throw new Error(e[n(817)]);if(!e[n(1626)](s0,d))throw new Error(e.ecjwC);Object[n(968)](this._options,t),this[n(577)+n(1546)]=new ls(g,this[n(1437)][n(728)+"es"]),this[n(696)+n(1117)]=new a0(this[n(1437)][n(645)+n(1888)]),this[n(1437)][n(1793)+n(887)]&&(this._isInit=!0,this[n(593)]()),this[n(1437)]["listenNetworkCha"+n(426)]&&(this[n(908)+"T"]||this[n(993)+"X"]?this["_onPageN"+n(791)+n(548)]():this[n(1161)+"er"]&&this._initGlobalEventListener())}[r(1390)+r(659)](){let t=r;this._options["disableA"+t(1090)+"nect"]||this[t(736)+t(750)]||this[t(1027)+t(918)]()}[r(1390)+r(1099)](){let t=r;this[t(1722)+t(737)+"t"]();let n=e[t(1082)](er,e.iFNUV,{message:t(1611)+t(1198)+" reconnect"});this[t(1431)+"mediatelyReconnect"]&&this[t(1431)+t(1035)+t(1327)+"ct"](n)}[r(1395)+r(1108)+r(793)](){let t=r;this[t(1161)+"er"]&&window["addEvent"+t(793)](e[t(1780)],this[t(1390)+t(659)]),this[t(1161)+"er"]&&window[t(635)+t(793)](e[t(1878)],this[t(1390)+t(1099)]),this[t(1161)+"er"]&&window["addEvent"+t(793)](e[t(1105)],this["_handleP"+t(937)]),this._isBrowser&&window[t(635)+t(793)](e[t(813)],this["_handleP"+t(1484)])}["_dropGlo"+r(1108)+"Listener"](){let t=r;this._isBrowser&&window[t(447)+"entListe"+t(1163)](e[t(1780)],this[t(1390)+"nLine"]),this._isBrowser&&window[t(447)+t(502)+t(1163)](t(1070),this[t(1390)+t(1099)]),this[t(1161)+"er"]&&window["removeEv"+t(502)+t(1163)](e[t(1105)],this[t(592)+t(937)]),this[t(1161)+"er"]&&window["removeEv"+t(502)+t(1163)](e.KVrMU,this[t(592)+t(1484)])}["_handleP"+r(937)](t){let n=r;!t[n(981)+"d"]&&(this[n(1161)+"er"]&&window[n(447)+n(502)+n(1163)](e[n(1105)],this[n(592)+n(937)]),this[n(1161)+"er"]&&window[n(447)+n(502)+"ner"](e.KVrMU,this[n(592)+n(1484)]),this.close()),this._isBrowser&&window["removeEv"+n(502)+"ner"](n(1265),this[n(1390)+n(659)]),this[n(1161)+"er"]&&window[n(447)+n(502)+n(1163)](e[n(1878)],this[n(1390)+n(1099)])}[r(592)+"ageShow"](t){let n=r;t.persisted&&(this[n(1454)+n(1586)]()&&(!this[n(1538)]||e[n(1402)](this[n(1538)][n(960)+"te"],this.OPEN)||e[n(1187)](this._ws[n(960)+"te"],this[n(1674)+"NG"]))&&this[n(1390)+n(659)](),this[n(1161)+"er"]&&window[n(635)+n(793)](e[n(1780)],this[n(1390)+"nLine"]),this[n(1161)+"er"]&&window[n(635)+n(793)](e[n(1878)],this[n(1390)+n(1099)]))}async[r(1591)+r(1598)](t){let n=r,o={BSQXo:function(Et,At,K0){return e.VVhTi(Et,At,K0)}},{fpID:c,deviceID:d,bddID:g,ttwID:p,accessKey:u,aID:y,customParams:v={},enableAutoAck:A,enableQoS:N,QoSLevel:D,env:O}=this[n(1437)],ke,$,se;this[n(1161)+"er"]||this[n(993)+"X"]||this[n(908)+"T"]?(ke=location&&e.AJAOh(e[n(977)],location.protocol)?e[n(1763)]:e[n(405)],$=t[n(1237)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),se=/^wss(.*:\/\/)/[n(927)](t)?t:""+ke+$):e.YiDYk!==e[n(749)]?(ke=e.vZqaP,$=t[n(1237)](/(^http)((?:[s]*:\/\/))/,""),se=/(^ws)((?:[s]*:\/\/))/[n(927)]($)?$:""+ke+$):(this[n(1100)+n(1374)]=_0x37ad92,this[n(1147)+n(1245)]=_0xa9d3f4,this[n(381)+"Strategy"]=_0x1a9d3e,this._qosDB=OakMRT[n(1357)](_0x2e6bc4,this[n(1100)+n(1374)],"cursor_name"));let ot=g?"bd_did":p?e[n(1146)]:n(1312)+"d",Ct=g||p||d;if(!Ct||!ot)throw new Error(e.joKeX);let xr=e[n(1548)](e[n(1033)],typeof v)?await e.lrnwy(v):v,U0=O?e.rABbc(o0,O.xUseEnv,O.xTTEnv):{},cr=Object.assign({device_platform:e.nSzTm,version_code:e[n(1842)],access_key:u,fpid:c,aid:y,[ot]:Ct,xsack:A?1:0,xaack:A?1:0,xsqos:N?1:0,qos_level:N?D:void 0,qos_sdk_version:2,...U0},xr),F0=Object.keys(cr)[n(1377)]((Et,At)=>cr[At]!==void 0?""+Et+(Et?"&":"?")+At+"="+cr[At]:Et,"");return se+"/ws/v2"+F0}async[r(593)](){let t=r;if(!(this[t(593)+"Lock"]||this._readyClosed)){this["_connect"+t(1655)]=!0;try{let n=this[t(577)+"tManager"]?.["checkCur"+t(1210)+t(1604)+t(1549)+t(985)](),{timeoutInterval:o}=this[t(1437)];if(n){let d=this[t(577)+t(1546)]?.[t(504)+t(396)+"nt"](),g=this["_endpoin"+t(1546)]?.[t(825)+t(875)+"pointAndUpdateCo"+t(492)](),p=this[t(577)+t(1546)]?.["getCurre"+t(396)+t(1847)+"ount"]();if(g){let u=t(1138)+d+(t(876)+", max retries reached, will use "+t(529)+t(1508))+g+" to retry",y=e[t(847)](ce,e[t(1772)],{message:u,code:Me[t(951)+t(1537)+"R"]});this[t(565)](u),this[t(1850)+t(1510)+"ent"](y),this._url=await this[t(1591)+t(1598)](g),this[t(565)](t(1138)+g+" "+p+t(1246)),this[t(689)+t(1807)+"rs"]()}else{let u="connect "+d+(" timeout"+t(1226)+t(1880)+t(1408));this[t(565)](u),this[t(1850)+t(1510)+t(444)](ce(e[t(1772)],{message:u,code:Me["MAX_RETR"+t(1537)+"R"]}));return}}else{let d=this[t(577)+t(1546)]?.[t(504)+t(396)+t(1829)+t(770)](),g=this[t(577)+t(1546)]?.["getCurre"+t(396)+t(1847)+t(1502)]();this._url=await this[t(1591)+"eUrl"](e[t(832)](d,"")),this[t(565)](t(1138)+d+" "+g+" times"),this[t(689)+t(1807)+"rs"]()}if(this[t(543)])this[t(543)]=!1;else if(e[t(856)]!==t(1817)){let d=_0x82d7bf[t(1239)][t(1666)];d&&_0x4348f0[t(552)+"rs"](d)}else{let d=e[t(634)](er,e[t(952)],{message:t(715)});this[t(1134)+"econnect"]&&this[t(1134)+t(918)](d)}let c=this[t(577)+"tManager"]?.[t(504)+t(396)+"ntTriesC"+t(1502)]()||0;e.sJXnn(c,1)&&await this[t(1336)](c-1),this[t(565)](t(794)+"ng url: "+this[t(1752)]+(t(703)+t(851))+this[t(1155)+"ls"]),this._ws=e[t(1262)](r0,{url:this[t(1752)],protocols:[this[t(1155)+"ls"]],headers:this._options[t(878)+t(1741)+"s"][t(1491)+t(874)]},this[t(1437)].ws),(this._isBrowser||this[t(1433)+"r"])&&this[t(1538)]&&(this[t(1538)][t(1781)+"pe"]=this[t(1767)+"ype"]),this[t(468)+"steners"](),this[t(593)+t(597)+"utId"]=setTimeout(this[t(1171)+"ut"][t(1267)](this),o)}catch(n){throw this[t(593)+"Lock"]=!1,n}}}[r(1254)+r(503)](){let t=r;e.vfkju(clearTimeout,this["_connect"+t(597)+t(509)]),this["_connect"+t(597)+t(509)]=null}[r(1068)+r(1494)](){let t=r;clearTimeout(this[t(407)+t(1393)+"Id"]),clearTimeout(this[t(1522)+t(562)+"tId"]),this[t(407)+"gTimeoutId"]=null,this[t(1522)+"ctTimeoutId"]=null}[r(565)](...t){let n=r;this[n(1437)][n(961)]&&console[n(688)][n(1137)](console,[e[n(1193)],...t])}[r(1203)+r(643)+"e"](t){let n=r,{initReconnectInterval:o,maxReconnectInterval:c,reconnectIntervalGrowFactor:d}=this[n(1437)],g=e[n(1283)](o,Math[n(585)](d,e[n(1565)](t,1)));return g>c?c:g}[r(1049)](){let t=r;if(e[t(1124)](t(1470),t(379)))return!!this._qosDB;if(this[t(1538)]&&e[t(871)](this[t(1538)].readyState,this[t(1674)+"NG"])){this._clearPingTimer(),this[t(407)+"gTimeoutId"]=e[t(1708)](setTimeout,this._ping[t(1267)](this),this[t(1437)][t(801)+t(1087)]);return}if(!this[t(1538)]||e.LABtw(this._ws[t(960)+"te"],this[t(1523)]))return void this[t(1027)+t(918)]();this[t(1538)]&&this[t(1538)][t(475)]("hi"),this[t(1522)+"ctTimeou"+t(463)]=e[t(1788)](setTimeout,this[t(1027)+t(918)+t(778)][t(1267)](this),this[t(1437)][t(1480)+"outInterval"])}[r(1027)+r(918)+"Timeout"](){let t=r;this[t(696)+t(1117)]?.[t(462)](),this.emit(e[t(1396)],t(867)),this[t(696)+t(1117)]?.["checkRea"+t(675)+"nt"]()?this[t(1027)+t(918)]():this[t(1049)]()}[r(1454)+r(1586)](){let t=r;return this[t(908)+"T"]||this._isMiniWX?this._miniNavigatorOnline:(this[t(1161)+"er"]||this[t(1433)+"r"])&&this[t(1437)][t(1825)+"tworkCha"+t(426)]?navigator[t(1034)]:!0}[r(1027)+"econnect"](){let t=r;!this[t(1454)+t(1586)]()||this[t(736)+"osed"]||(this[t(577)+t(1546)]?.["resetEnd"+t(1711)+"fig"](),this[t(696)+t(1117)]?.["resetCou"+t(491)](),this[t(1538)]?this[t(1500)+"ect"](1001,e[t(432)],!0):this[t(593)]())}[r(1133)+r(791)+r(548)](){let t=r;this._isMiniTT?tt[t(1075)+t(1422)+"hange"](({isConnected:n})=>{let o=t;this["_miniNavigatorOn"+o(579)]=n,n?this[o(1390)+o(659)]():this[o(1390)+"ffLine"]()}):this[t(993)+"X"]&&wx[t(1075)+t(1422)+t(883)](({isConnected:n})=>{let o=t;this[o(576)+o(1857)+o(579)]=n,n?this[o(1390)+o(659)]():this[o(1390)+"ffLine"]()})}[r(1336)](t){let n=r,o={tpcki:function(c,d){return e[P(1496)](c,d)},hbkNO:function(c,d,g){return e.xXZzL(c,d,g)},uFzbY:function(c,d){return e[P(1778)](c,d)},NHHWK:function(c,d,g){return e[P(1074)](c,d,g)},mompD:function(c,d,g){return e[P(1e3)](c,d,g)}};if(e[n(972)](e[n(451)],e[n(451)]))return new Promise(c=>{let d=n;setTimeout(c,this[d(1203)+d(643)+"e"](t))});{let c=_0x206247.key;KhJXio.tpcki(void 0,c)&&(_0x476e8a(_0x2688b5,10),KhJXio[n(1727)](_0x1e6db6,_0x6ac497,c));let d=_0x102738.value;KhJXio[n(1734)](void 0,d)&&(KhJXio[n(1696)](_0x51494d,_0x570f49,18),KhJXio[n(1816)](_0x20fd48,_0x2761ee,d))}}_disconnect(t=1e3,n="",o=!1){this[r(1538)]&&this._destroyWebSocket(t,n,o)}[r(1171)+"ut"](){let t=r,n=this[t(577)+t(1546)]?.[t(504)+t(396)+"nt"]();this[t(565)](t(1138)+n+t(876)),this[t(1500)+t(434)](1001,e.zLIIT,!0)}_sendAck(t){let n=r,o=e[n(1578)](Qn,t);this._ws&&e[n(1873)](this[n(1538)][n(960)+"te"],this[n(1523)])&&(this[n(1538)]&&this[n(1538)][n(475)](o),this._debug(e[n(845)],t))}[r(689)+r(1807)+"rs"](){let t=r;this[t(1538)]&&(this._ws[t(447)+t(502)+t(1163)](e[t(1704)],this[t(1392)]),this[t(1538)]["removeEv"+t(502)+t(1163)](e[t(1032)],this._onClose),this[t(1538)][t(447)+"entListe"+t(1163)](e.Olvyz,this[t(1634)+"ge"]),this[t(1538)][t(447)+t(502)+t(1163)](e[t(1772)],this[t(1672)]))}[r(468)+r(889)](){let t=r,n={aVgsK:function(o,c){return o(c)},EFlju:function(o,c){return e.CAwYd(o,c)},jKTfu:function(o,c){return e.jjEel(o,c)},NCuzY:function(o,c){return o+c},aKwKu:function(o,c){return e.DDCVa(o,c)},gMLUh:e[t(513)],YuHgt:e[t(923)],VyOmx:function(o,c){return e[t(955)](o,c)},BfOyb:e[t(729)]};if(e[t(458)](e[t(1662)],e[t(1662)]))return nHwgFT[t(704)](_0x1e7d80,nHwgFT.EFlju(nHwgFT[t(1298)](nHwgFT.NCuzY(nHwgFT.aKwKu(nHwgFT[t(1066)],_0x370139),nHwgFT[t(442)]),nHwgFT[t(483)](_0x47d0b7,1)),nHwgFT[t(443)])+_0x15e92d);if(!this._ws)return;this._ws[t(635)+t(793)](e[t(1704)],this[t(1392)]),this[t(1538)]["addEvent"+t(793)](e[t(1032)],this[t(1833)]),this._ws[t(635)+"Listener"](t(1239),this[t(1634)+"ge"]),this[t(1538)][t(635)+t(793)](e[t(1772)],this[t(1672)])}[r(1684)+r(525)](t=1e3,n=""){let o=r;if(e[o(648)](e[o(816)],e.elXDL))this[o(628)+"ount"]=_0x2b605e,this[o(995)]=0;else try{this[o(1538)]&&this[o(1538)][o(625)](t,n)}catch{}}[r(1722)+r(737)+"t"](t=1e3,n="",o=!1){let c=r,d={rADRg:function(g,p,u){return e.AcBzz(g,p,u)},uZSQj:function(g){return g()},AVcNy:function(g,p,u){return e.iqojk(g,p,u)},wWIom:function(g,p,u){return g(p,u)}};if(this._clearPingTimer(),this["_clearTi"+c(503)](),this[c(689)+"sListeners"](),this[c(1684)+c(525)](1e3,n),this[c(593)+"Lock"]=!1,o&&this[c(1454)+"orOnline"]()&&!this[c(736)+c(750)]){if(this[c(577)+"tManager"]?.[c(712)+c(1581)+"es"]()){let p=this[c(577)+c(1546)]?.[c(504)+"ntEndpoint"]();this["_dispatc"+c(1230)+c(444)](e[c(542)](he,e.WyKfN,{code:1006,reason:c(1138)+p+(c(876)+c(1226)+c(1880)+c(1408)),wasClean:!0}))}else if(e[c(393)](c(1835),e[c(1852)])){let p=this._options[c(1559)+c(500)+"ptor"](t,n);this[c(1850)+"hCloseEv"+c(444)](e[c(1311)](he,e.WyKfN,{code:t,reason:n,wasClean:!0,willReconnect:p})),p&&this._connect()}else{DCbbWi[c(1689)](_0x2ea0e2,_0xd8cbd7,42);let p=DCbbWi[c(751)](_0xc71a2a);DCbbWi[c(602)](_0x361429,_0x4f7d21,p),DCbbWi[c(1689)](_0x27a3cd,_0x14dc05,p[c(1478)]),DCbbWi[c(1412)](_0x58d1d2,_0x42d33f,p),_0x215b2e(p)}return}this._navigatorOnline()||this[c(736)+c(750)]?this[c(1850)+c(1230)+c(444)](he(e.WyKfN,{code:t,reason:e[c(1498)]})):this[c(1850)+c(1230)+c(444)](he(e[c(1032)],{code:1006,reason:e.LBxsn})),this[c(1538)]=null,this[c(577)+c(1546)]?.[c(394)+"pointConfig"](),this[c(696)+c(1117)]?.[c(1682)+c(491)]()}["_dispatc"+r(1543)+"nt"](t){let n=r;this[n(1303)](e[n(1704)],t),this.onopen&&this[n(1680)](t)}[r(1850)+r(667)+r(1282)](t){let n=r;this[n(1303)](e.Olvyz,t),this[n(517)+"e"]&&this[n(517)+"e"](t)}[r(1850)+r(1463)+r(1693)](t){let n=r;this[n(1303)](e[n(1233)],t),this[n(449)+n(1526)]&&this["onReceiv"+n(1526)](t)}[r(1850)+r(1510)+r(444)](t){let n=r;this[n(1303)](e[n(1772)],t),this[n(658)]&&this[n(658)](t)}["_dispatc"+r(1230)+r(444)](t){let n=r;this[n(1303)](e[n(1032)],t),this[n(589)]&&this[n(589)](t)}get[r(1781)+"pe"](){let t=r;return this[t(1538)]?this[t(1538)][t(1781)+"pe"]:this[t(1767)+t(1799)]}set[r(1781)+"pe"](t){let n=r;this._binaryType=t,this[n(1538)]&&(this[n(1538)][n(1781)+"pe"]=t)}get retryCount(){let t=r;return this["_endpoin"+t(1546)]?.[t(504)+t(396)+t(1847)+t(1502)]()||0}get[r(804)+r(545)](){let t=r;return e.riZuh(e[t(1455)],e.wQxDi)?this[t(381)+t(763)][t(1377)]((o,c)=>(o+=c&&c[t(1130)+"th"]||0,o),0)+(this._ws?this[t(1538)][t(804)+t(545)]:0):this[t(1798)][t(674)]()}get[r(1884)+"ns"](){let t=r;return this[t(1538)]?this[t(1538)].extensions:""}get[r(1756)](){let t=r;if(e[t(1617)](t(1136),e[t(603)]))return this[t(1538)]?this._ws[t(1756)]:"";_0x2710b7[_0x537c7d++]=e[t(1343)](e.fOwFZ(_0x253240,18),7)|240,_0x42d24c[_0x300347++]=e.vGoda(_0x137475,12)&63|128}get[r(960)+"te"](){let t=r;return this[t(1538)]?this._ws[t(960)+"te"]:this[t(1437)][t(1793)+t(887)]?this.CONNECTING:this[t(1669)]}get[r(1332)](){let t=r;return this._ws?this._ws[t(1332)]:this[t(1752)]}close(t=1e3,n){let o=r;if(this[o(736)+o(750)]=!0,this["_clearTi"+o(503)](),this._clearPingTimer(),this[o(1427)+o(1108)+o(793)](),this[o(1083)+"ger"]?.[o(1342)](),!this._ws)return void this[o(565)](e[o(1712)]);if(e[o(1190)](this[o(1538)][o(960)+"te"],this[o(1669)])||e[o(1444)](this._ws[o(960)+"te"],this[o(697)]))return void this[o(565)](e[o(428)]);this[o(1722)+o(737)+"t"](t,n)}async[r(475)](t,n){let o=r;if(e[o(1548)](null,t))throw new Error(e[o(858)]);e[o(486)]==typeof t&&(t=JSON[o(1249)+"y"](t)),e[o(1180)](e[o(1255)],typeof t)&&!(t instanceof ArrayBuffer)&&!(t[o(661)]&&e[o(1851)](t[o(661)],ArrayBuffer))&&(t=JSON[o(1249)+"y"](t));let c=await e.knEGD(ms,t),d=e[o(524)](i0,t),{method:g=0,service:p=this[o(1437)][o(386)],logID:u=this[o(1437)]["logIDGen"+o(1081)](),headers:y=this[o(1437)][o(572)],payloadEncoding:v=this[o(1437)][o(717)+o(963)],payloadType:A=this[o(1437)][o(1394)+o(1799)],logIDNew:N=this[o(1437)][o(925)+"Config"][o(734)+o(453)+o(532)+"ew"]?a(this[o(1437)][o(925)+o(994)][o(1347)]):""}=e[o(1380)](n,{});if(!p)throw new Error(e[o(1528)]);let D={SeqID:B[o(1445)+"er"](this._seqId++),LogID:B[o(1445)+"er"](u),service:p,method:g,headers:y,payloadEncoding:e.sVHEj(v,Object)?v[o(738)]?v.encoding:"":v,payloadType:e[o(1043)](A,Object)?A[o(1188)]?A[o(1188)]:d:A||d,payload:c,LogIDNew:N},O=e[o(470)](Qn,D);return this[o(1538)]&&this[o(1538)][o(960)+"te"]===this[o(1523)]?(this[o(1538)]&&this[o(1538)][o(475)](O),this._debug(e[o(1156)],D)):e.IQKpK(this[o(381)+o(763)].length,this[o(1437)]["maxMessageQueueL"+o(773)])?(this["_message"+o(763)].push(O),this._debug(o(1152),D)):(this[o(381)+"Queue"][o(1173)](),this[o(381)+"Queue"][o(1755)](O)),{seqID:this[o(800)],logID:u,logIDNew:N}}async[r(1559)+"t"](t){let n=r,{url:o}=t||{},c=Array.isArray(o)?o:e[n(1571)](e.kEUof,typeof o)?[o]:[];if(t&&Object[n(968)](this[n(1437)],t),c&&c[n(1410)]?this[n(577)+n(1546)]=new ls(c,this[n(1437)][n(728)+"es"]):this[n(577)+n(1546)]?.[n(394)+"pointCon"+n(557)](),this[n(696)+n(1117)]?.[n(1682)+n(491)](this[n(1437)][n(645)+"Count"]),this[n(736)+n(750)]=!1,this[n(1538)]&&this[n(1538)][n(960)+"te"]!==this[n(1669)])this[n(1500)+n(434)](1e3,e[n(1279)],!0);else if(e[n(871)](n(1720),n(1720)))this._isInit=!0,this[n(593)]();else return!0}async[r(1269)](){let t=r;!this[t(593)+t(1655)]&&(this[t(577)+t(1546)]?.[t(394)+"pointCon"+t(557)](),this[t(696)+t(1117)]?.[t(1682)+t(491)](),this[t(736)+"osed"]=!1,this[t(543)]=!0,this[t(593)]())}[r(635)+r(793)](t,n){this.on(t,n)}[r(389)+r(1282)](t){let n=r,{type:o}=t;this[n(1303)](o,t)}["removeEv"+r(502)+r(1163)](t,n){this[r(666)](t,n)}[r(656)](){let t=r,n={zqrAd:t(999)+t(943)+"s",lFWkz:function(o,c){return e[t(1732)](o,c)},LuWvB:function(o,c){return e[t(713)](o,c)},ekSso:e[t(1040)],GnSYj:e[t(1396)]};return new Promise((o,c)=>{let d=t,g={xWcZp:"success",RMeNl:n[d(727)],tasDw:function(p,u){return n[d(630)](p,u)},INiaA:d(867),UuUGp:d(999)+d(1216)+"t"};if(n.LuWvB("OdrIL",n[d(1652)]))_0x5b4384[d(1459)][d(640)+"ild"](_0x3fd234),_0x476e56["frontier"+d(1836)]=void 0,_0x448df2(_0x55ac34&&_0x56b061[d(983)]||d(768)+d(1879));else{this[d(1068)+d(1494)](),this[d(407)+d(1393)+"Id"]=setTimeout(this._ping.bind(this),this[d(1437)]["pingInte"+d(1087)]);let p=()=>{let y=d;o(g[y(1094)]),this[y(666)](g[y(1428)],p),this.off(y(999)+y(1216)+"t",u)},u=()=>{let y=d;g.tasDw(c,g[y(487)]),this[y(666)](g[y(1428)],p),this.off(g[y(1687)],u)};this.on("ping_once_success",p),this.on(n[d(760)],u),this[d(1049)]()}})}}})(),j["CustomCl"+S(1631)]=V[S(497)+S(1631)],j["CustomEr"+S(1654)]=V[S(1277)+S(1654)],j[S(699)+"e"]=V[S(699)+"e"],j[S(1282)]=V[S(1282)],j[S(1532)]=V[S(1532)],j[S(1554)+S(1573)+S(1808)]=V[S(1554)+S(1573)+S(1808)],j[S(1573)+"vent"]=V[S(1573)+S(1808)],j.OpenEvent=V[S(655)+"t"],j[S(633)+S(895)]=V[S(633)+S(895)],j[S(1738)+"oseEvent"]=V["createCl"+S(1631)],j[S(956)+S(1654)]=V[S(956)+S(1654)],j["createMe"+S(1862)+"nt"]=V[S(1195)+S(1862)+"nt"],j["createOp"+S(441)]=V[S(1721)+S(441)],j["createRe"+S(846)+"vent"]=V[S(1106)+"connectE"+S(1808)],j[S(1504)+S(479)]=V[S(1504)+S(479)],j[S(1715)+"ame"]=V.encodeFrame;for(_n in V)[S(497)+S(1631),S(1277)+"rorEvent",S(699)+"e",S(1282),S(1532),S(1554)+S(1573)+S(1808),S(1573)+"vent",S(655)+"t",S(633)+S(895),S(1738)+S(1631),S(956)+S(1654),S(1195)+S(1862)+"nt",S(1721)+"enEvent",S(1106)+S(846)+S(1808),"decodedF"+S(479),"encodeFrame"][S(828)](_n)===-1&&(j[_n]=V[_n]);var _n;Object.defineProperty(j,"__esModule",{value:!0})});var Ne=ie((vl,gi)=>{"use strict";var li=["nodebuffer","arraybuffer","fragments"],hi=typeof Blob<"u";hi&&li.push("blob");gi.exports={BINARY_TYPES:li,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:hi,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Ot=ie((Sl,An)=>{"use strict";var{EMPTY_BUFFER:Rx}=Ne(),_r=Buffer[Symbol.species];function Ox(r,e){if(r.length===0)return Rx;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 _r(i.buffer,i.byteOffset,a):i}function pi(r,e,i,a,x){for(let f=0;f<x;f++)i[a+f]=r[f]^e[f&3]}function mi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function Bx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function yr(r){if(yr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new _r(r):ArrayBuffer.isView(r)?e=new _r(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),yr.readOnly=!1),e}An.exports={concat:Ox,mask:pi,toArrayBuffer:Bx,toBuffer:yr,unmask:mi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=J("bufferutil");An.exports.mask=function(e,i,a,x,f){f<48?pi(e,i,a,x,f):r.mask(e,i,a,x,f)},An.exports.unmask=function(e,i){e.length<32?mi(e,i):r.unmask(e,i)}}catch{}});var yi=ie((Cl,_i)=>{"use strict";var wi=Symbol("kDone"),br=Symbol("kRun"),vr=class{constructor(e){this[wi]=()=>{this.pending--,this[br]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[br]()}[br](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[wi])}}};_i.exports=vr});var ht=ie((El,Ci)=>{"use strict";var Bt=J("zlib"),bi=Ot(),zx=yi(),{kStatusCode:vi}=Ne(),Mx=Buffer[Symbol.species],qx=Buffer.from([0,0,255,255]),kn=Symbol("permessage-deflate"),Re=Symbol("total-length"),dt=Symbol("callback"),He=Symbol("buffers"),lt=Symbol("error"),Dn,Sr=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,!Dn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Dn=new zx(i)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[dt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let i=this._options,a=e.find(x=>!(i.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>x.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return i.serverNoContextTakeover&&(a.server_no_context_takeover=!0),i.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof i.serverMaxWindowBits=="number"&&(a.server_max_window_bits=i.serverMaxWindowBits),typeof i.clientMaxWindowBits=="number"?a.client_max_window_bits=i.clientMaxWindowBits:(a.client_max_window_bits===!0||i.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let i=e[0];if(this._options.clientNoContextTakeover===!1&&i.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!i.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(i.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&i.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return i}normalizeParams(e){return e.forEach(i=>{Object.keys(i).forEach(a=>{let x=i[a];if(x.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(x=x[0],a==="client_max_window_bits"){if(x!==!0){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(x!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else throw new Error(`Unknown parameter "${a}"`);i[a]=x})}),e}decompress(e,i,a){Dn.add(x=>{this._decompress(e,i,(f,l)=>{x(),a(f,l)})})}compress(e,i,a){Dn.add(x=>{this._compress(e,i,(f,l)=>{x(),a(f,l)})})}_decompress(e,i,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,l=typeof this.params[f]!="number"?Bt.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=Bt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:l}),this._inflate[kn]=this,this._inflate[Re]=0,this._inflate[He]=[],this._inflate.on("error",Fx),this._inflate.on("data",Si)}this._inflate[dt]=a,this._inflate.write(e),i&&this._inflate.write(qx),this._inflate.flush(()=>{let f=this._inflate[lt];if(f){this._inflate.close(),this._inflate=null,a(f);return}let l=bi.concat(this._inflate[He],this._inflate[Re]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Re]=0,this._inflate[He]=[],i&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,l)})}_compress(e,i,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,l=typeof this.params[f]!="number"?Bt.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=Bt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:l}),this._deflate[Re]=0,this._deflate[He]=[],this._deflate.on("data",Ux)}this._deflate[dt]=a,this._deflate.write(e),this._deflate.flush(Bt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=bi.concat(this._deflate[He],this._deflate[Re]);i&&(f=new Mx(f.buffer,f.byteOffset,f.length-4)),this._deflate[dt]=null,this._deflate[Re]=0,this._deflate[He]=[],i&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};Ci.exports=Sr;function Ux(r){this[He].push(r),this[Re]+=r.length}function Si(r){if(this[Re]+=r.length,this[kn]._maxPayload<1||this[Re]<=this[kn]._maxPayload){this[He].push(r);return}this[lt]=new RangeError("Max payload size exceeded"),this[lt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[lt][vi]=1009,this.removeListener("data",Si),this.reset()}function Fx(r){if(this[kn]._inflate=null,this[lt]){this[dt](this[lt]);return}r[vi]=1007,this[dt](r)}});var gt=ie((Al,In)=>{"use strict";var{isUtf8:Ei}=J("buffer"),{hasBlob:Kx}=Ne(),Hx=[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 jx(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Cr(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 Gx(r){return Kx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}In.exports={isBlob:Gx,isValidStatusCode:jx,isValidUTF8:Cr,tokenChars:Hx};if(Ei)In.exports.isValidUTF8=function(r){return r.length<24?Cr(r):Ei(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=J("utf-8-validate");In.exports.isValidUTF8=function(e){return e.length<32?Cr(e):r(e)}}catch{}});var Ir=ie((Dl,Li)=>{"use strict";var{Writable:Wx}=J("stream"),Ai=ht(),{BINARY_TYPES:Jx,EMPTY_BUFFER:Di,kStatusCode:Vx,kWebSocket:Yx}=Ne(),{concat:Er,toArrayBuffer:Xx,unmask:Zx}=Ot(),{isValidStatusCode:$x,isValidUTF8:ki}=gt(),Pn=Buffer[Symbol.species],ue=0,Ii=1,Pi=2,Ti=3,Ar=4,Dr=5,Tn=6,kr=class extends Wx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Jx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Yx]=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 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 ue:this.getInfo(e);break;case Ii:this.getPayloadLength16(e);break;case Pi:this.getPayloadLength64(e);break;case Ti:this.getMask();break;case Ar:this.getData(e);break;case Dr:case Tn: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[Ai.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=Ii: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=Ti:this._state=Ar}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Ar}getData(e){let i=Di;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&&Zx(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=Dr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Ai.extensionName].decompress(e,this._fin,(x,f)=>{if(x)return i(x);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let l=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(l);return}this._fragments.push(f)}this.dataMessage(i),this._state===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=Er(a,i):this._binaryType==="arraybuffer"?x=Xx(Er(a,i)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=ue):(this._state=Tn,setImmediate(()=>{this.emit("message",x,!0),this._state=ue,this.startLoop(e)}))}else{let x=Er(a,i);if(!this._skipUTF8Validation&&!ki(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===Dr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=ue):(this._state=Tn,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,Di),this.end();else{let a=e.readUInt16BE(0);if(!$x(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(f);return}let x=new Pn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!ki(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=Tn,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 l=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(l,this.createError),l.code=f,l[Vx]=x,l}};Li.exports=kr});var Lr=ie((Il,Oi)=>{"use strict";var{Duplex:kl}=J("stream"),{randomFillSync:Qx}=J("crypto"),Ni=ht(),{EMPTY_BUFFER:ec,kWebSocket:tc,NOOP:nc}=Ne(),{isBlob:pt,isValidStatusCode:rc}=gt(),{mask:Ri,toBuffer:Xe}=Ot(),de=Symbol("kByteLength"),sc=Buffer.alloc(4),Ln=8*1024,Ze,mt=Ln,pe=0,ic=1,oc=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=pe,this.onerror=nc,this[tc]=void 0}static frame(e,i){let a,x=!1,f=2,l=!1;i.mask&&(a=i.maskBuffer||sc,i.generateMask?i.generateMask(a):(mt===Ln&&(Ze===void 0&&(Ze=Buffer.alloc(Ln)),Qx(Ze,0,Ln),mt=0),a[0]=Ze[mt++],a[1]=Ze[mt++],a[2]=Ze[mt++],a[3]=Ze[mt++]),l=(a[0]|a[1]|a[2]|a[3])===0,f=6);let h;typeof e=="string"?(!i.mask||l)&&i[de]!==void 0?h=i[de]:(e=Buffer.from(e),h=e.length):(h=e.length,x=i.mask&&i.readOnly&&!l);let m=h;h>=65536?(f+=8,m=127):h>125&&(f+=2,m=126);let _=Buffer.allocUnsafe(x?h+f:f);return _[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(_[0]|=64),_[1]=m,m===126?_.writeUInt16BE(h,2):m===127&&(_[2]=_[3]=0,_.writeUIntBE(h,4,6)),i.mask?(_[1]|=128,_[f-4]=a[0],_[f-3]=a[1],_[f-2]=a[2],_[f-1]=a[3],l?[_,e]:x?(Ri(e,a,_,f,h),[_]):(Ri(e,a,e,0,h),[_,e])):[_,e]}close(e,i,a,x){let f;if(e===void 0)f=ec;else{if(typeof e!="number"||!rc(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)f=Buffer.allocUnsafe(2),f.writeUInt16BE(e,0);else{let h=Buffer.byteLength(i);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");f=Buffer.allocUnsafe(2+h),f.writeUInt16BE(e,0),typeof i=="string"?f.write(i,2):f.set(i,2)}}let l={[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,l,x]):this.sendFrame(r.frame(f,l),x)}ping(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):pt(e)?(x=e.size,f=!1):(e=Xe(e),x=e.length,f=Xe.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let l={[de]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};pt(e)?this._state!==pe?this.enqueue([this.getBlobData,e,!1,l,a]):this.getBlobData(e,!1,l,a):this._state!==pe?this.enqueue([this.dispatch,e,!1,l,a]):this.sendFrame(r.frame(e,l),a)}pong(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):pt(e)?(x=e.size,f=!1):(e=Xe(e),x=e.length,f=Xe.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let l={[de]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};pt(e)?this._state!==pe?this.enqueue([this.getBlobData,e,!1,l,a]):this.getBlobData(e,!1,l,a):this._state!==pe?this.enqueue([this.dispatch,e,!1,l,a]):this.sendFrame(r.frame(e,l),a)}send(e,i,a){let x=this._extensions[Ni.extensionName],f=i.binary?2:1,l=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):pt(e)?(h=e.size,m=!1):(e=Xe(e),h=e.length,m=Xe.readOnly),this._firstFragment?(this._firstFragment=!1,l&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(l=h>=x._threshold),this._compress=l):(l=!1,f=0),i.fin&&(this._firstFragment=!0);let _={[de]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:m,rsv1:l};pt(e)?this._state!==pe?this.enqueue([this.getBlobData,e,this._compress,_,a]):this.getBlobData(e,this._compress,_,a):this._state!==pe?this.enqueue([this.dispatch,e,this._compress,_,a]):this.dispatch(e,this._compress,_,a)}getBlobData(e,i,a,x){this._bufferedBytes+=a[de],this._state=oc,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Tr,this,h,x);return}this._bufferedBytes-=a[de];let l=Xe(f);i?this.dispatch(l,i,a,x):(this._state=pe,this.sendFrame(r.frame(l,a),x),this.dequeue())}).catch(f=>{process.nextTick(ac,this,f,x)})}dispatch(e,i,a,x){if(!i){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Ni.extensionName];this._bufferedBytes+=a[de],this._state=ic,f.compress(e,a.fin,(l,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Tr(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)}};Oi.exports=Pr;function Tr(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 ac(r,e,i){Tr(r,e,i),r.onerror(e)}});var ji=ie((Pl,Hi)=>{"use strict";var{kForOnEventAttribute:zt,kListener:Nr}=Ne(),Bi=Symbol("kCode"),zi=Symbol("kData"),Mi=Symbol("kError"),qi=Symbol("kMessage"),Ui=Symbol("kReason"),wt=Symbol("kTarget"),Fi=Symbol("kType"),Ki=Symbol("kWasClean"),Oe=class{constructor(e){this[wt]=null,this[Fi]=e}get target(){return this[wt]}get type(){return this[Fi]}};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[Bi]=i.code===void 0?0:i.code,this[Ui]=i.reason===void 0?"":i.reason,this[Ki]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[Bi]}get reason(){return this[Ui]}get wasClean(){return this[Ki]}};Object.defineProperty($e.prototype,"code",{enumerable:!0});Object.defineProperty($e.prototype,"reason",{enumerable:!0});Object.defineProperty($e.prototype,"wasClean",{enumerable:!0});var _t=class extends Oe{constructor(e,i={}){super(e),this[Mi]=i.error===void 0?null:i.error,this[qi]=i.message===void 0?"":i.message}get error(){return this[Mi]}get message(){return this[qi]}};Object.defineProperty(_t.prototype,"error",{enumerable:!0});Object.defineProperty(_t.prototype,"message",{enumerable:!0});var Mt=class extends Oe{constructor(e,i={}){super(e),this[zi]=i.data===void 0?null:i.data}get data(){return this[zi]}};Object.defineProperty(Mt.prototype,"data",{enumerable:!0});var xc={addEventListener(r,e,i={}){for(let x of this.listeners(r))if(!i[zt]&&x[Nr]===e&&!x[zt])return;let a;if(r==="message")a=function(f,l){let h=new Mt("message",{data:l?f:f.toString()});h[wt]=this,Nn(e,this,h)};else if(r==="close")a=function(f,l){let h=new $e("close",{code:f,reason:l.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[wt]=this,Nn(e,this,h)};else if(r==="error")a=function(f){let l=new _t("error",{error:f,message:f.message});l[wt]=this,Nn(e,this,l)};else if(r==="open")a=function(){let f=new Oe("open");f[wt]=this,Nn(e,this,f)};else return;a[zt]=!!i[zt],a[Nr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Nr]===e&&!i[zt]){this.removeListener(r,i);break}}};Hi.exports={CloseEvent:$e,ErrorEvent:_t,Event:Oe,EventTarget:xc,MessageEvent:Mt};function Nn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Rn=ie((Tl,Gi)=>{"use strict";var{tokenChars:qt}=gt();function Ee(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function cc(r){let e=Object.create(null),i=Object.create(null),a=!1,x=!1,f=!1,l,h,m=-1,_=-1,b=-1,w=0;for(;w<r.length;w++)if(_=r.charCodeAt(w),l===void 0)if(b===-1&&qt[_]===1)m===-1&&(m=w);else if(w!==0&&(_===32||_===9))b===-1&&m!==-1&&(b=w);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${w}`);b===-1&&(b=w);let k=r.slice(m,b);_===44?(Ee(e,k,i),i=Object.create(null)):l=k,m=b=-1}else throw new SyntaxError(`Unexpected character at index ${w}`);else if(h===void 0)if(b===-1&&qt[_]===1)m===-1&&(m=w);else if(_===32||_===9)b===-1&&m!==-1&&(b=w);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${w}`);b===-1&&(b=w),Ee(i,r.slice(m,b),!0),_===44&&(Ee(e,l,i),i=Object.create(null),l=void 0),m=b=-1}else if(_===61&&m!==-1&&b===-1)h=r.slice(m,w),m=b=-1;else throw new SyntaxError(`Unexpected character at index ${w}`);else if(x){if(qt[_]!==1)throw new SyntaxError(`Unexpected character at index ${w}`);m===-1?m=w:a||(a=!0),x=!1}else if(f)if(qt[_]===1)m===-1&&(m=w);else if(_===34&&m!==-1)f=!1,b=w;else if(_===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${w}`);else if(_===34&&r.charCodeAt(w-1)===61)f=!0;else if(b===-1&&qt[_]===1)m===-1&&(m=w);else if(m!==-1&&(_===32||_===9))b===-1&&(b=w);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${w}`);b===-1&&(b=w);let k=r.slice(m,b);a&&(k=k.replace(/\\/g,""),a=!1),Ee(i,h,k),_===44&&(Ee(e,l,i),i=Object.create(null),l=void 0),h=void 0,m=b=-1}else throw new SyntaxError(`Unexpected character at index ${w}`);if(m===-1||f||_===32||_===9)throw new SyntaxError("Unexpected end of input");b===-1&&(b=w);let C=r.slice(m,b);return l===void 0?Ee(e,C,i):(h===void 0?Ee(i,C,!0):a?Ee(i,h,C.replace(/\\/g,"")):Ee(i,h,C),Ee(e,l,i)),e}function fc(r){return Object.keys(r).map(e=>{let i=r[e];return Array.isArray(i)||(i=[i]),i.map(a=>[e].concat(Object.keys(a).map(x=>{let f=a[x];return Array.isArray(f)||(f=[f]),f.map(l=>l===!0?x:`${x}=${l}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Gi.exports={format:fc,parse:cc}});var Mn=ie((Rl,ro)=>{"use strict";var uc=J("events"),dc=J("https"),lc=J("http"),Vi=J("net"),hc=J("tls"),{randomBytes:gc,createHash:pc}=J("crypto"),{Duplex:Ll,Readable:Nl}=J("stream"),{URL:Rr}=J("url"),je=ht(),mc=Ir(),wc=Lr(),{isBlob:_c}=gt(),{BINARY_TYPES:Wi,CLOSE_TIMEOUT:yc,EMPTY_BUFFER:On,GUID:bc,kForOnEventAttribute:Or,kListener:vc,kStatusCode:Sc,kWebSocket:Z,NOOP:Yi}=Ne(),{EventTarget:{addEventListener:Cc,removeEventListener:Ec}}=ji(),{format:Ac,parse:Dc}=Rn(),{toBuffer:kc}=Ot(),Xi=Symbol("kAborted"),Br=[8,13],Be=["CONNECTING","OPEN","CLOSING","CLOSED"],Ic=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,U=class r extends uc{constructor(e,i,a){super(),this._binaryType=Wi[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=On,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]),Zi(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Wi.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 mc({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new wc(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[Z]=this,f[Z]=this,e[Z]=this,x.on("conclude",Lc),x.on("drain",Nc),x.on("error",Rc),x.on("message",Oc),x.on("ping",Bc),x.on("pong",zc),f.onerror=Mc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",eo),e.on("data",zn),e.on("end",to),e.on("error",no),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){zr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||On,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){zr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||On,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){zr(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||On,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(U,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(U.prototype,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(U,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(U.prototype,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(U,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(U.prototype,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(U,"CLOSED",{enumerable:!0,value:Be.indexOf("CLOSED")});Object.defineProperty(U.prototype,"CLOSED",{enumerable:!0,value:Be.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[Or])return e[vc];return null},set(e){for(let i of this.listeners(r))if(i[Or]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Or]:!0})}})});U.prototype.addEventListener=Cc;U.prototype.removeEventListener=Ec;ro.exports=U;function Zi(r,e,i,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:yc,protocolVersion:Br[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,!Br.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Br.join(", ")})`);let f;if(e instanceof Rr)f=e;else try{f=new Rr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}f.protocol==="http:"?f.protocol="ws:":f.protocol==="https:"&&(f.protocol="wss:"),r._url=f.href;let l=f.protocol==="wss:",h=f.protocol==="ws+unix:",m;if(f.protocol!=="ws:"&&!l&&!h?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!f.pathname?m="The URL's pathname is empty":f.hash&&(m="The URL contains a fragment identifier"),m){let L=new SyntaxError(m);if(r._redirects===0)throw L;Bn(r,L);return}let _=l?443:80,b=gc(16).toString("base64"),w=l?dc.request:lc.request,C=new Set,k;if(x.createConnection=x.createConnection||(l?Tc:Pc),x.defaultPort=x.defaultPort||_,x.port=f.port||_,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":b,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(k=new je({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=Ac({[je.extensionName]:k.offer()})),i.length){for(let L of i){if(typeof L!="string"||!Ic.test(L)||C.has(L))throw new SyntaxError("An invalid or duplicated subprotocol was specified");C.add(L)}x.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(f.username||f.password)&&(x.auth=`${f.username}:${f.password}`),h){let L=x.path.split(":");x.socketPath=L[0],x.path=L[1]}let T;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=l,r._originalHostOrSocketPath=h?x.socketPath:f.host;let L=a&&a.headers;if(a={...a,headers:{}},L)for(let[F,Q]of Object.entries(L))a.headers[F.toLowerCase()]=Q}else if(r.listenerCount("redirect")===0){let L=h?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!L||r._originalSecure&&!l)&&(delete x.headers.authorization,delete x.headers.cookie,L||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),T=r._req=w(x),r._redirects&&r.emit("redirect",r.url,T)}else T=r._req=w(x);x.timeout&&T.on("timeout",()=>{xe(r,T,"Opening handshake has timed out")}),T.on("error",L=>{T===null||T[Xi]||(T=r._req=null,Bn(r,L))}),T.on("response",L=>{let F=L.headers.location,Q=L.statusCode;if(F&&x.followRedirects&&Q>=300&&Q<400){if(++r._redirects>x.maxRedirects){xe(r,T,"Maximum redirects exceeded");return}T.abort();let ne;try{ne=new Rr(F,e)}catch{let I=new SyntaxError(`Invalid URL: ${F}`);Bn(r,I);return}Zi(r,ne,i,a)}else r.emit("unexpected-response",T,L)||xe(r,T,`Unexpected server response: ${L.statusCode}`)}),T.on("upgrade",(L,F,Q)=>{if(r.emit("upgrade",L),r.readyState!==U.CONNECTING)return;T=r._req=null;let ne=L.headers.upgrade;if(ne===void 0||ne.toLowerCase()!=="websocket"){xe(r,F,"Invalid Upgrade header");return}let Ae=pc("sha1").update(b+bc).digest("base64");if(L.headers["sec-websocket-accept"]!==Ae){xe(r,F,"Invalid Sec-WebSocket-Accept header");return}let I=L.headers["sec-websocket-protocol"],M;if(I!==void 0?C.size?C.has(I)||(M="Server sent an invalid subprotocol"):M="Server sent a subprotocol but none was requested":C.size&&(M="Server sent no subprotocol"),M){xe(r,F,M);return}I&&(r._protocol=I);let Y=L.headers["sec-websocket-extensions"];if(Y!==void 0){if(!k){xe(r,F,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let me;try{me=Dc(Y)}catch{xe(r,F,"Invalid Sec-WebSocket-Extensions header");return}let De=Object.keys(me);if(De.length!==1||De[0]!==je.extensionName){xe(r,F,"Server indicated an extension that was not requested");return}try{k.accept(me[je.extensionName])}catch{xe(r,F,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[je.extensionName]=k}r.setSocket(F,Q,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(T,r):T.end()}function Bn(r,e){r._readyState=U.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function Pc(r){return r.path=r.socketPath,Vi.connect(r)}function Tc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=Vi.isIP(r.host)?"":r.host),hc.connect(r)}function xe(r,e,i){r._readyState=U.CLOSING;let a=new Error(i);Error.captureStackTrace(a,xe),e.setHeader?(e[Xi]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Bn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function zr(r,e,i){if(e){let a=_c(e)?e.size:kc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Be[r.readyState]})`);process.nextTick(i,a)}}function Lc(r,e){let i=this[Z];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[Z]!==void 0&&(i._socket.removeListener("data",zn),process.nextTick($i,i._socket),r===1005?i.close():i.close(r,e))}function Nc(){let r=this[Z];r.isPaused||r._socket.resume()}function Rc(r){let e=this[Z];e._socket[Z]!==void 0&&(e._socket.removeListener("data",zn),process.nextTick($i,e._socket),e.close(r[Sc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function Ji(){this[Z].emitClose()}function Oc(r,e){this[Z].emit("message",r,e)}function Bc(r){let e=this[Z];e._autoPong&&e.pong(r,!this._isServer,Yi),e.emit("ping",r)}function zc(r){this[Z].emit("pong",r)}function $i(r){r.resume()}function Mc(r){let e=this[Z];e.readyState!==U.CLOSED&&(e.readyState===U.OPEN&&(e._readyState=U.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 eo(){let r=this[Z];if(this.removeListener("close",eo),this.removeListener("data",zn),this.removeListener("end",to),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[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 zn(r){this[Z]._receiver.write(r)||this.pause()}function to(){let r=this[Z];r._readyState=U.CLOSING,r._receiver.end(),this.end()}function no(){let r=this[Z];this.removeListener("error",no),this.on("error",Yi),r&&(r._readyState=U.CLOSING,this.destroy())}});var ao=ie((Bl,oo)=>{"use strict";var Ol=Mn(),{Duplex:qc}=J("stream");function so(r){r.emit("close")}function Uc(){!this.destroyed&&this._writableState.finished&&this.destroy()}function io(r){this.removeListener("error",io),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Fc(r,e){let i=!0,a=new qc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,l){let h=!l&&a._readableState.objectMode?f.toString():f;a.push(h)||r.pause()}),r.once("error",function(f){a.destroyed||(i=!1,a.destroy(f))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,f){if(r.readyState===r.CLOSED){f(x),process.nextTick(so,a);return}let l=!1;r.once("error",function(m){l=!0,f(m)}),r.once("close",function(){l||f(x),process.nextTick(so,a)}),i&&r.terminate()},a._final=function(x){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(x)});return}r._socket!==null&&(r._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){x()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(x,f,l){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,l)});return}r.send(x,l)},a.on("end",Uc),a.on("error",io),a}oo.exports=Fc});var Mr=ie((zl,xo)=>{"use strict";var{tokenChars:Kc}=gt();function Hc(r){let e=new Set,i=-1,a=-1,x=0;for(x;x<r.length;x++){let l=r.charCodeAt(x);if(a===-1&&Kc[l]===1)i===-1&&(i=x);else if(x!==0&&(l===32||l===9))a===-1&&i!==-1&&(a=x);else if(l===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);let h=r.slice(i,a);if(e.has(h))throw new SyntaxError(`The "${h}" subprotocol is duplicated`);e.add(h),i=a=-1}else throw new SyntaxError(`Unexpected character at index ${x}`)}if(i===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let f=r.slice(i,x);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);return e.add(f),e}xo.exports={parse:Hc}});var po=ie((ql,go)=>{"use strict";var jc=J("events"),qn=J("http"),{Duplex:Ml}=J("stream"),{createHash:Gc}=J("crypto"),co=Rn(),Qe=ht(),Wc=Mr(),Jc=Mn(),{CLOSE_TIMEOUT:Vc,GUID:Yc,kWebSocket:Xc}=Ne(),Zc=/^[+/0-9A-Za-z]{22}==$/,fo=0,uo=1,ho=2,qr=class extends jc{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Vc,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Jc,...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=qn.createServer((a,x)=>{let f=qn.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=$c(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,l)=>{this.handleUpgrade(x,f,l,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=fo}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===ho){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Ut,this);return}if(e&&this.once("close",e),this._state!==uo)if(this._state=uo,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(Ut,this):process.nextTick(Ut,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Ut(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",lo);let f=e.headers["sec-websocket-key"],l=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){et(this,e,i,405,"Invalid HTTP method");return}if(l===void 0||l.toLowerCase()!=="websocket"){et(this,e,i,400,"Invalid Upgrade header");return}if(f===void 0||!Zc.test(f)){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)){Ft(i,400);return}let m=e.headers["sec-websocket-protocol"],_=new Set;if(m!==void 0)try{_=Wc.parse(m)}catch{et(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let b=e.headers["sec-websocket-extensions"],w={};if(this.options.perMessageDeflate&&b!==void 0){let C=new Qe({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let k=co.parse(b);k[Qe.extensionName]&&(C.accept(k[Qe.extensionName]),w[Qe.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,(k,T,L,F)=>{if(!k)return Ft(i,T||401,L,F);this.completeUpgrade(w,f,_,e,i,a,x)});return}if(!this.options.verifyClient(C))return Ft(i,401)}this.completeUpgrade(w,f,_,e,i,a,x)}completeUpgrade(e,i,a,x,f,l,h){if(!f.readable||!f.writable)return f.destroy();if(f[Xc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>fo)return Ft(f,503);let _=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Gc("sha1").update(i+Yc).digest("base64")}`],b=new this.options.WebSocket(null,void 0,this.options);if(a.size){let w=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;w&&(_.push(`Sec-WebSocket-Protocol: ${w}`),b._protocol=w)}if(e[Qe.extensionName]){let w=e[Qe.extensionName].params,C=co.format({[Qe.extensionName]:[w]});_.push(`Sec-WebSocket-Extensions: ${C}`),b._extensions=e}this.emit("headers",_,x),f.write(_.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
+ `)),f.removeListener("error",lo),b.setSocket(f,l,{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(Ut,this)})),h(b,x)}};go.exports=qr;function $c(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 Ut(r){r._state=ho,r.emit("close")}function lo(){this.destroy()}function Ft(r,e,i,a){i=i||qn.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} ${qn.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,f){if(r.listenerCount("wsClientError")){let l=new Error(x);Error.captureStackTrace(l,et),r.emit("wsClientError",l,i,e)}else Ft(i,a,x,f)}});import{spawn as Sf}from"node:child_process";import{existsSync as Cf,openSync as Ef}from"node:fs";import{mkdir as Af}from"node:fs/promises";import{dirname as Df}from"node:path";import{fileURLToPath as kf}from"node:url";function Kr(r=H()){return Cf(r.libEntry)?r.libEntry:kf(new URL("../index.ts",import.meta.url))}async function Mo(r={}){let e=r.paths??H(),i=r.entryOverride??Kr(e);await Af(Df(e.logFile),{recursive:!0});let a=Ef(e.logFile,"a"),f=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],l=Sf(process.execPath,f,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(l.unref(),typeof l.pid!="number")throw new Error("failed to spawn daemon (no pid)");return If.info("daemon spawned",{pid:l.pid,entry:i}),{pid:l.pid,entry:i}}var If,Hr=Ie(()=>{"use strict";K();oe();If=R("spawn-daemon")});import{spawn as zf}from"node:child_process";import{mkdir as Mf,unlink as qf,writeFile as Uf}from"node:fs/promises";import{dirname as Ff,join as Kf}from"node:path";function Jn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ho(r,e){return new Promise((i,a)=>{let x=zf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var Wn,Wr,Jr,jo=Ie(()=>{"use strict";K();Wn=R("supervisor.launchd"),Wr="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>${Wr}</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 Kf(r.homeDir,"Library","LaunchAgents",`${Wr}.plist`)},async install(r){let e=this.configPath(r);await Mf(Ff(e),{recursive:!0}),await Uf(e,this.renderConfig(r),"utf8"),Wn.info("plist written",{plistPath:e}),await Ho("launchctl",["load","-w",e]),Wn.info("launchd job loaded",{label:Wr})},async uninstall(r){let e=this.configPath(r);await Ho("launchctl",["unload","-w",e]).catch(i=>Wn.warn("launchctl unload failed (ignored)",{err:String(i)})),await qf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),Wn.info("launchd job removed",{plistPath:e})}}});import{spawn as Hf}from"node:child_process";import{mkdir as jf,unlink as Gf,writeFile as Wf}from"node:fs/promises";import{dirname as Jf,join as Vf}from"node:path";function Xn(r,e){return new Promise((i,a)=>{let x=Hf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var Vn,Yn,Vr,Go=Ie(()=>{"use strict";K();Vn=R("supervisor.systemd"),Yn="coze-bridge.service",Vr={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 Vf(r.homeDir,".config","systemd","user",Yn)},async install(r){let e=this.configPath(r);await jf(Jf(e),{recursive:!0}),await Wf(e,this.renderConfig(r),"utf8"),Vn.info("systemd unit written",{unitPath:e}),await Xn("systemctl",["--user","daemon-reload"]),await Xn("systemctl",["--user","enable","--now",Yn]),Vn.info("systemd unit enabled",{unitName:Yn})},async uninstall(r){let e=this.configPath(r);await Xn("systemctl",["--user","disable","--now",Yn]).catch(i=>Vn.warn("systemctl disable failed (ignored)",{err:String(i)})),await Gf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await Xn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Vn.info("systemd unit removed",{unitPath:e})}}});import{spawn as Yf}from"node:child_process";import{join as Xf}from"node:path";function Wo(r,e){return new Promise((i,a)=>{let x=Yf(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var Yr,Zn,Xr,Jo=Ie(()=>{"use strict";K();Yr=R("supervisor.taskscheduler"),Zn="CozeBridge",Xr={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 Xf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Wo("schtasks",["/Create","/SC","ONLOGON","/TN",Zn,"/TR",e,"/RU",r.userName,"/F"]),Yr.info("task scheduler entry created",{task:Zn})},async uninstall(r){await Wo("schtasks",["/Delete","/TN",Zn,"/F"]).catch(e=>Yr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),Yr.info("task scheduler entry removed",{task:Zn})}}});var Zr={};vs(Zr,{buildContext:()=>eu,getSupervisor:()=>Qf,launchdSupervisor:()=>Jr,systemdSupervisor:()=>Vr,taskSchedulerSupervisor:()=>Xr});import{homedir as Zf,userInfo as $f}from"node:os";function Qf(r=process.platform){switch(r){case"darwin":return Jr;case"linux":return Vr;case"win32":return Xr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function eu(){let r=H();return{nodeBin:process.execPath,entry:Kr(r),logFile:r.logFile,homeDir:Zf(),userName:$f().username}}var $r=Ie(()=>{"use strict";oe();Hr();jo();Go();Jo()});Ue();K();import{readdir as fa}from"node:fs/promises";import{mkdir as ia,writeFile as oa}from"node:fs/promises";import{join as aa}from"node:path";var xa={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function at(r,e,i,a){await ia(r,{recursive:!0});let x=xa[e],f=aa(r,x),l=ca(e,i,a);return await oa(f,l,"utf8"),f}function ca(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=R("agent-detail-sync"),$t=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await fa(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 ae(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(l){ve.warn("detail RPC failed, using local data",{agentId:e,err:String(l)});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 at(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ue();import{spawn as zs}from"node:child_process";import{lstat as hr,mkdir as ua,readFile as Ms,readdir as da,rm as la,stat as ha,writeFile as ga}from"node:fs/promises";import{join as Le,normalize as pa,relative as qs,resolve as ma,sep as Us}from"node:path";function Dt(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Is(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function xt(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var E=class extends Error{code;retriable;cause;constructor(e,i,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 Ve(r,e){if(Dt(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 Ps="https://llm-gateway.coze.cn",ct="auto";function Ts(r){return{model:r.model??ct,...r.modelToken?{modelToken:r.modelToken}:{}}}function Ls(r){return!r||r===ct}function Ns(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=Ps,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),Ls(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Rs(r){let e=[];return Ls(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="${Ps}/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 Os(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var fe=R("agent-handlers"),Bs=5*1024*1024,wa=1,_a=6,ya=new Set(["node_modules",".git",".coze","dist","build",".next"]),tn=class{constructor(e){this.opts=e}opts;async listSkills(e){Ve(e._meta,"_agent/listSkills");let i=xt(e._meta),a=await this.loadAgentCfg(i),x=a?.workspace??Te(i).workspace,f=a?.skills??[],l=[];for(let h of f){let m=Le(x,h.relPath,"SKILL.md");await ha(m).then(b=>b.isFile()).catch(()=>!1)&&l.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:l}}async addSkills(e){Ve(e._meta,"_agent/addSkills");let i=xt(e._meta),a=await this.requireAgentCfg(i),x=e.skills??[],f=[...a.skills??[]],l=new Map(f.map((m,_)=>[m.skillId,_])),h=[];for(let m of x){if(!m.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let _=ba(m.skillName),b=va(a.framework),w=Le(b,_),C=Le(a.workspace,w);await ua(C,{recursive:!0});let k=await Ea(m.downloadUrl);Da(k)?await ka(k,C):await ga(Le(C,"SKILL.md"),k.toString("utf8"),"utf8");let T={skillId:m.skillId,skillName:m.skillName,relPath:w,installedAt:Date.now(),...m.description?{description:m.description}:{},...m.version?{version:m.version}:{},...m.downloadUrl?{downloadUrl:m.downloadUrl}:{}},L=l.get(m.skillId);L!==void 0?f[L]=T:(l.set(m.skillId,f.length),f.push(T)),h.push(m),fe.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:w})}return await Xt(i,f),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){Ve(e._meta,"_agent/removeSkills");let i=xt(e._meta),a=await this.requireAgentCfg(i),x=new Set(e.skillIds??[]),f=a.skills??[],l=[];for(let h of f){if(!x.has(h.skillId)){l.push(h);continue}let m=Le(a.workspace,h.relPath);await la(m,{recursive:!0,force:!0}),fe.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await Xt(i,l),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex"){for(let[x,f]of a.sessions)if(!(!f.downstream||!f.acpSessionId)){f.loadingSession=!0;try{await f.downstream.sessionLoad({sessionId:f.acpSessionId,cwd:a.workspace}),fe.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId})}catch(l){fe.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId,err:String(l)})}finally{f.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return fe.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await ae(i);if(!a)throw new E("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 at(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 E("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await ae(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(Ve(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 ae(e.agentId);if(!a)throw new E("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){Ve(e._meta,"_agent/getFileTree");let i=e._meta,a=xt(i),x=await this.resolveWorkspace(a),f=e.filePath??"",l=this.safeJoin(x,f),h=await hr(l).catch(()=>null);if(!h)throw new E("IPC_BAD_REQUEST",`path not found: ${f}`);if(h.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${f}`);let m=Pa(e.depth);return h.isDirectory()?{tree:await Fs(x,l,f,m)}:{tree:[{name:Ta(f),path:Ks(f||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Ve(e._meta,"_agent/getFileContent");let i=xt(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),f=await hr(x).catch(()=>null);if(!f||!f.isFile())throw new E("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(f.size>Bs)throw new E("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${Bs})`);let l=await Ms(x);return l.includes(0)?{content:l.toString("base64"),encoding:"base64",size:f.size}:{content:l.toString("utf8"),encoding:"utf-8",size:f.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await ae(e).catch(()=>null))?.workspace??Te(e).workspace}safeJoin(e,i){let a=ma(e,i||"."),x=qs(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Us}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return ae(e)}async requireAgentCfg(e){let i=await this.loadAgentCfg(e);if(!i)throw new E("AGENT_NOT_FOUND",`no config for agent: ${e}`);return i}};function ba(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 va(r){return r==="claude-code"?Le(".claude","skills"):Le(".agents","skills")}var Sa=3e4,Ca=50*1024*1024,nn=3e4;async function Ea(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);en(e);let i=Aa(r);return en(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await Ms(e);return en(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),Sa);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 en(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 en(r){if(r>Ca)throw new E("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function Aa(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 Da(r){return r.length>=2&&r[0]===31&&r[1]===139}async function ka(r,e){await Ia(r),await new Promise((i,a)=>{let x=zs("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",h=>{f+=String(h)});let l=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar extract timeout (${nn}ms)`))},nn);x.on("error",h=>{clearTimeout(l),a(new E("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(l),h===0?i():a(new E("IPC_BAD_REQUEST",`tar exit ${h}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Ia(r){let e=await new Promise((i,a)=>{let x=zs("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),f="",l="";x.stdout?.on("data",m=>{f+=String(m)}),x.stderr?.on("data",m=>{l+=String(m)});let h=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar list timeout (${nn}ms)`))},nn);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(f):a(new E("IPC_BAD_REQUEST",`tar list exit ${m}${l?`: ${l.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 l=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!l)continue;if(l.startsWith("/"))throw new E("IPC_BAD_REQUEST",`tar entry absolute path: ${l}`);if(l.split(/[/\\]/).some(m=>m===".."))throw new E("IPC_BAD_REQUEST",`tar entry contains '..': ${l}`)}}async function Fs(r,e,i,a){if(a<=0)return[];let x;try{x=await da(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let l of x){if(ya.has(l.name)||l.isSymbolicLink())continue;let h=Le(e,l.name),m=pa(Le(i,l.name)),_=null;try{_=await hr(h)}catch{continue}if(_.isSymbolicLink())continue;let b={name:l.name,path:Ks(qs(r,h)),isDir:_.isDirectory(),size:_.size,modifiedAt:Math.floor(_.mtimeMs)};_.isDirectory()&&a>1&&(b.children=await Fs(r,h,m,a-1)),f.push(b)}return f.sort((l,h)=>l.isDir!==h.isDir?l.isDir?-1:1:l.name.localeCompare(h.name)),f}function Pa(r){return!r||r<=0?wa:Math.min(r,_a)}function Ta(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function Ks(r){return r.split(Us).join("/")}K();var kt=R("agent-health-reporter"),La=1e4,rn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??La}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()}),kt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),kt.info("heartbeat stopped"))}async tick(){if(this.inFlight){kt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){kt.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=Na(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){kt.warn("heartbeat batch send failed",{count:i.length,err:String(x)})}}finally{this.inFlight=!1}}};function Na(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}Ue();import{mkdir as gr,rm as Ja}from"node:fs/promises";import{spawn as Ma}from"node:child_process";function It(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function sn(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function ft(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ye(r,e){return{jsonrpc:"2.0",id:r,error:e}}var on=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)}},G={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 Hs(r){return"method"in r&&"id"in r&&r.id!==void 0}function js(r){return"method"in r&&!("id"in r)}function an(r){return!("method"in r)&&"id"in r}var Ra={AGENT_NOT_FOUND:G.AGENT_NOT_FOUND,AGENT_BUSY:G.AGENT_BUSY,AGENT_DISCONNECTED:G.AGENT_DISCONNECTED,AGENT_TIMEOUT:G.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:G.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:G.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:G.INTERNAL_ERROR,BRIDGE_INTERNAL:G.INTERNAL_ERROR,IPC_AUTH_FAILED:G.INTERNAL_ERROR,IPC_BAD_REQUEST:G.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:G.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:G.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:G.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:G.INTERNAL_ERROR};function xn(r){return r instanceof E?{code:Ra[r.code]??G.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:G.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 Ws(r){return`${JSON.stringify(r)}
90
+ `}var cn=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(l){this.onError?.({line:f,error:l})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(i){return this.onError?.({line:e,error:i}),[]}}};var Vs={"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"},od=Object.fromEntries(Object.entries(Vs).map(([r,e])=>[e,r])),Oa={"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:[]},ut=class{seq=0;next(e,i){this.seq+=1;let a=Vs[e]??Ba(e),x=Oa[a]??[],f=[a,String(this.seq)];if(x.length>0){let l=x.map(m=>Js(i?.[m]??"")),h=za(l).join(":");h&&f.push(h)}else i&&Object.values(i).some(l=>l)&&f.push(Object.values(i).filter(Boolean).map(l=>Js(String(l))).join(":"));return f.join("_")}reset(){this.seq=0}};function Ba(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Js(r){return r.replace(/[:_\s]+/g,"-")}function za(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}K();var qa=3e4;function Ys(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 cn({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=Ma(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 f of this.exitHandlers)f(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(f=>i.once("exit",()=>f()));Ys(i.pid,"SIGTERM");let x=setTimeout(()=>{i.killed||Ys(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(sn("session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(ft(e,i))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(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=qa){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=It(x,e,i),l=a>0&&Number.isFinite(a);return new Promise((h,m)=>{let _=l?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:_,method:e});try{this.writeFrame(f)}catch(b){_&&clearTimeout(_),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(Ws(e))}dispatch(e){if(an(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(js(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(Hs(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,xn(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var Ua="@agentclientprotocol/claude-agent-acp@latest";function Fa(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 fn=class extends Fe{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",Ua],x={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return Fa(e)}};import{mkdtempSync as Ka,rmSync as Ha}from"node:fs";import{tmpdir as ja}from"node:os";import{join as Ga}from"node:path";var Wa="@zed-industries/codex-acp@latest",un=class extends Fe{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=e.command??"npx",a=e.args??["-y",Wa],x=e.extraArgs?[...a,...e.extraArgs]:a,f=e.isolateCodexHome?Ka(Ga(ja(),"coze-bridge-codex-home-")):void 0,l=f?{...e.env??{},CODEX_HOME:f}:e.env,h={command:i,args:x,cwd:e.cwd,...l?{env:l}:{}};super(h),this.authMethodId=e.authMethodId,this.codexHomeDir=f}async initialize(e){let i=await super.initialize(e);return this.authMethodId&&await this.call("authenticate",{methodId:this.authMethodId}),i}async stop(e){if(await super.stop(e),this.codexHomeDir)try{Ha(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};import{spawn as Xs}from"node:child_process";K();var dn=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=Xs(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 E("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${f}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(i=>{let a=Xs(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 ln=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 hn=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 ln}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)Pt(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function Pt(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}var Ke=R("agent-manager"),Va=(r,e,i,a,x,f)=>{switch(r){case"claude-code":{let l=x?Ns(x):void 0;return new fn({cwd:i,...l&&Object.keys(l).length>0?{env:l}:{}})}case"codex":{let l=x?Rs(x):[],h=x?Os(x):void 0,m=!!x;return new un({cwd:i,...l.length>0?{extraArgs:l}:{},...h&&Object.keys(h).length>0?{env:h}:{},...m?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new dn({command:e,cwd:i,agentId:a,...f?{sessionName:Qt(f)}:{}})}};function Ya(r){return r==="claude-code"||r==="codex"}var Xa={path:"",version:"cloud-deployed"},Za={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},$a=2e4,gn=class{paths;config;registry;factory;createTimeoutMs;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??Va,this.createTimeoutMs=e.createTimeoutMs??$a}async createAgent(e){if(!e.agentId)throw new E("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new E("IPC_BAD_REQUEST","framework required");let i=Dt(e._meta)==="cloud";if(i&&e.framework==="openclaw")return Ke.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")Ke.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(w=>Ke.warn("dispose stale agent failed (ignored)",{err:String(w)})),this.registry.unregister(e.agentId);else return Ke.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),f=e.workspace??x.workspace,l=Dt(e._meta),h=new AbortController,m=setTimeout(()=>h.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),_,b=!1;try{let w=()=>{if(h.signal.aborted)throw h.signal.reason instanceof Error?h.signal.reason:new E("AGENT_TIMEOUT","_agent/create aborted")};await gr(x.root,{recursive:!0}),await gr(f,{recursive:!0}),await gr(x.logs,{recursive:!0}),w(),await at(f,e.framework,e.agentId,e.cozeIdentity),w();let C=await ae(e.agentId,this.paths).catch(()=>null),k=Ts({model:e.model??C?.model});if(_=new hn({agentId:e.agentId,framework:e.framework,workspace:f,model:k.model??ct,deployType:l}),_.status="ok",C?.sessions){for(let[F,Q]of Object.entries(C.sessions))_.sessions.set(F,{acpSessionId:Q.acpSessionId,modelToken:Q.modelToken,tokenGeneratedAt:Q.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1});let L=Object.keys(C.sessions).length;L>0&&Ke.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:L})}this.registry.register(_),b=!0;let T={agentId:e.agentId,framework:e.framework,workspace:f,cozeIdentity:e.cozeIdentity,createdAt:C?.createdAt??Date.now(),sessions:C?.sessions??{},model:k.model};return l==="cloud"&&(T.deployType="cloud"),C?.skills&&(T.skills=C.skills),C?.agentName&&(T.agentName=C.agentName),C?.description&&(T.description=C.description),await ge(T,this.paths),Ke.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:l}),{ok:!0,agentId:e.agentId,workspace:f,framework:e.framework}}catch(w){throw Ke.error("agent create failed, rolling back",{agentId:e.agentId,err:String(w)}),b&&_&&(await _.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Ja(x.root,{recursive:!0,force:!0}).catch(C=>Ke.warn("rm agent dir failed (ignored)",{err:String(C)})),w instanceof E?w:new E("AGENT_SPAWN_FAILED",String(w),{cause:w})}finally{clearTimeout(m)}}async spawnSessionDownstream(e,i,a){let f=this.config.frameworksCache?.[e.framework];if(!f)if(e.deployType==="cloud"&&Ya(e.framework))f=Xa;else throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let l=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,h=this.factory(e.framework,f.path,e.workspace,e.agentId,l,a);try{return await h.start(),await h.initialize(Za),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 Qa}from"node:child_process";import{constants as Zs,access as ex}from"node:fs/promises";import{delimiter as tx,join as nx}from"node:path";var rx=R("framework-detector"),$s={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},sx=[".exe",".cmd",".bat",".ps1"],Tt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Qa,access:e.access??ex}}async detect(e){let i=$s[e],a=await this.which(i);if(!a)return rx.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($s).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(tx).filter(Boolean),a=this.env.platform==="win32"?["",...sx]:[""];for(let x of i)for(let f of a){let l=nx(x,e+f);if(await this.isExecutable(l))return l}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Zs.F_OK:Zs.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",x=!1,f,l=h=>{x||(x=!0,f&&clearTimeout(f),i(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});f=setTimeout(()=>{h.kill("SIGKILL"),l("unknown")},5e3),h.stdout?.on("data",m=>{a+=m.toString("utf8")}),h.on("error",()=>l("unknown")),h.on("close",()=>{let m=ox(a).split(/\r?\n/)[0]??"";l(m)})}catch{l("unknown")}})}},ix=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function ox(r){return r.replace(ix,"")}ur();oe();var ax=10*6e4;function Qs(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?ax:e}function pn(r){return Gt(r??H().configFile)}function Lt(r,e){return Wt(e??H().configFile,r)}import{randomBytes as xx}from"node:crypto";Ue();var ei={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 W=R("core"),cx=3e4,fx=3e4,mn=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=Qs(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(f=>{a.loadingSession||this.forwardUpdate(e,f)}),x.onAgentRequest(f=>{this.handleAgentRequest(e,x,f)}),x.onExit((f,l)=>{W.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:f,signal:l}),Pt(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(an(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,G.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(ft(i,x));return}if(e.method.startsWith("session/")){let a=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(ft(i,a));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(ft(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,G.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,xn(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 f=Date.now(),l=!1;try{let h=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,i));return l=!0,h}finally{W.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-f,ok:l})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:x}=Is(a);switch(i){case"session/new":{let f=ux();return W.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:f}),{sessionId:f}}case"session/load":{let f=x;return W.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:f.sessionId}),{}}case"session/prompt":{let f=x,l=f.sessionId;if(!l)throw new E("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,l);if(await this.ensureDownstream(e,l,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 _=await h.downstream.sessionPrompt({...f,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),_}finally{e.activeTriggers.delete(h.acpSessionId),h.downstream?.isAlive()&&this.armIdleTimer(e,l,h)}}case"session/cancel":{let l=x.sessionId;if(!l)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(l);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.acpSessionId}),{ok:!0}}default:throw new E("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(ei.GEN_MODEL_TOKEN,a,fx);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(Pt(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(f){W.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId,err:String(f)}),a.acpSessionId=void 0;let l=await x.sessionNew({cwd:e.workspace});a.acpSessionId=l.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let f=await x.sessionNew({cwd:e.workspace});a.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}}armIdleTimer(e,i,a){Pt(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(f=>W.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){W.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let f={cozeAgentId:e.agentId},l=e.activeTriggers.get(a);l&&(f.cozeTriggerMsgId=l),this.upstream.send(sn("session/update",{...i,sessionId:x,_meta:f})).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:G.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,_={cozeAgentId:e.agentId};m&&(_.cozeTriggerMsgId=m);let b=h?this.reverseSessionId(e,h):void 0,w={...f,...b?{sessionId:b}:{},_meta:_};this.pendingUpstream.set(x,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),this.upstream.send(It(x,"session/request_permission",w)).catch(C=>{this.pendingUpstream.delete(x),W.error("forward permission request failed",{agentId:e.agentId,err:String(C)}),i.respondAgentRequestError(a.id,{code:G.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 on(e.error)):a.resolve(e.result);return}W.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=cx){let x=this.upstreamIds.next(e);return new Promise((f,l)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),l(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:l,timer:h}),this.upstream.send(It(x,e,i)).catch(m=>{let _=this.pendingBridge.get(x);_&&(clearTimeout(_.timer),this.pendingBridge.delete(x)),l(m)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[a,x]of e.sessions){let f={modelToken:x.modelToken,tokenGeneratedAt:x.tokenGeneratedAt};x.acpSessionId&&(f.acpSessionId=x.acpSessionId),i.set(a,f)}await lr(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 ux(){return xx(16).toString("hex")}K();oe();import{randomBytes as dx}from"node:crypto";import{chmod as lx,mkdir as hx,writeFile as ti}from"node:fs/promises";import{createServer as gx}from"node:http";import{dirname as px}from"node:path";var mx=1e6,pr=R("ipc"),wn=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=dx(32).toString("hex");let e=gx((a,x)=>{this.dispatch(a,x)});this.server=e,await new Promise((a,x)=>{e.once("error",x),e.listen(0,"127.0.0.1",()=>a())});let i=e.address();if(!i||typeof i!="object")throw new Error("failed to obtain IPC port");return this.port=i.port,await this.persistAuthFiles(),pr.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 hx(px(this.paths.portFile),{recursive:!0}),await ti(this.paths.portFile,String(this.port),"utf8"),await ti(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await lx(this.paths.tokenFile,384)}catch(e){pr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Nt(i,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){Nt(i,404,{error:"not found"});return}let l=null;if(e.method==="POST")try{l=await _x(e)}catch(h){Nt(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await f.handler(l,e);Nt(i,200,h??{ok:!0})}catch(h){pr.error("IPC handler failed",{key:x,err:String(h)}),Nt(i,500,{error:h instanceof Error?h.message:String(h)})}}};function Nt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function _x(r){let e=[],i=0;for await(let x of r){let f=x;if(i+=f.length,i>mx)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var ko=Pe(di(),1);var Qc=Pe(ao(),1),ef=Pe(Rn(),1),tf=Pe(ht(),1),nf=Pe(Ir(),1),rf=Pe(Lr(),1),sf=Pe(Mr(),1),mo=Pe(Mn(),1),of=Pe(po(),1);var wo=mo.default;K();var Un="1008033",_o="1289";var yo="pbbp2",bo="https://www.coze.cn",vo="/api/coze_claw/resource/get_frontier_key",af="https://www.coze.cn",xf="wss://frontier.coze.cn";function So(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??af}function Co(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??xf}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 te=R("upstream.frontier"),Ao="application/json",Do="none",Kn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){te.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:bo,...Fn(this.opts.ppeOverride)};class i extends wo{constructor(h){super(h,yo,{headers:e})}send(h,...m){if(Ds("debug"))try{let _;typeof h=="string"?_=Buffer.from(h,"utf8"):h instanceof Buffer?_=h:h instanceof ArrayBuffer?_=new Uint8Array(h):ArrayBuffer.isView(h)?_=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):_=new Uint8Array(0);let b=Buffer.from(_.slice(0,128)).toString("hex");te.debug("WS raw frame out",{bytes:_.byteLength,headHex:b})}catch(_){te.warn("WS raw frame dump failed",{err:String(_)})}super.send(h,...m)}}let a=Co(this.opts.urlOverride),x={url:a,ws:i,fpID:_o,aID:Un,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:Ao,force:!0},payloadEncoding:{encoding:Do,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new ko.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let l=this.openCount===1;te.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:l,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:l})).catch(h=>te.warn("onConnect handler threw (ignored)",{err:String(h)}))},f.onclose=l=>{this.opened=!1,te.info("frontier closed",{code:l.code,reason:l.reason,willReconnect:l.willReconnect})},f.onerror=l=>{te.warn("frontier error",{code:l.code,msg:l.message})},f.onmessage=l=>this.handleMessage(l),this.fws=f,await f.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(a){te.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;te.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:Ao,payloadEncoding:Do})}catch(f){throw new E("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){te.debug("drop non-adapter frontier frame",{service:i});return}let a=uf(e);if(!a){te.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){te.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){te.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}te.info("frontier frame in",{logid:ff(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>te.warn("frontier frame handler threw",{err:String(f)}))}};function ff(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function uf(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 Io=R("handshake");async function To(r){let e=So(r.endpoint),i=r.timeoutMs??1e4,a=`${df(e)}${vo}?aid=${encodeURIComponent(Un)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Fn(r.ppeOverride)},f=new AbortController,l=setTimeout(()=>f.abort(),i);Io.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")??"",_=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let k=await h.text().catch(()=>"");throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${k.slice(0,200)}`)}let 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 w=b.data?.access_key,C=b.data?.device_id;if(!w||!C)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(b)}`);return Io.info("handshake ok",{remoteDeviceId:C,logid:m,traceId:_}),{accessKey:w,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(l)}}function df(r){return r.endsWith("/")?r.slice(0,-1):r}K();var Ur=R("upstream.switchable"),Hn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;Ur.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 Ur.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(i??"swapped").catch(x=>Ur.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=R("upstream"),Kt=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();oe();K();oe();import{execSync as lf}from"node:child_process";import{readFileSync as Lo,unlinkSync as hf}from"node:fs";import{mkdir as gf,readFile as No,unlink as Ro,writeFile as pf}from"node:fs/promises";import{dirname as mf}from"node:path";var wf=R("single-instance"),jn=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&&(wf.warn("removing stale pid file",{stalePid:e}),await Ro(this.pidFile).catch(()=>{})),await gf(mf(this.pidFile),{recursive:!0}),await pf(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await No(this.pidFile,"utf8")).trim()===String(process.pid)&&await Ro(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await No(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=Lo(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=lf(`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{Lo(this.pidFile,"utf8").trim()===String(process.pid)&&hf(this.pidFile)}catch{}})}};var z=R("daemon"),_f="coze-bridge-daemon";async function zo(){let r=new jn({processTitle:_f}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await pn(),a=i??{};dr({pid:process.pid}),z.info(i?"loaded bridge config":"initialized bridge config");try{let I=new Tt;a.frameworksCache=await I.detectAll(),z.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(I){z.warn("framework detection failed",{err:String(I)})}await Lt(a);let x=new Hn(new Kt),f=H(),l=null,h=new mn({upstream:x,paths:f,bridgeConfig:a,sessionSpawner:async(I,M,Y)=>{if(!l)throw new Error("agentManager not ready");return l.spawnSessionDownstream(I,M,Y)}});await bf(f,h);let m=new gn({paths:f,config:a,registry:h});l=m;let _,b,w=null,C=null;h.registerExtension("_agent/create",async I=>m.createAgent(I.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let k=new tn({agents:h.agents,disposeAndMarkDisconnected:async(I,M)=>{let Y=h.agents.get(I);Y&&(await Y.dispose(`disconnect: ${M}`).catch(me=>z.warn("dispose during disconnect failed (ignored)",{agentId:I,err:String(me)})),Y.status="disconnected",h.unregister(I)),h.disconnectedAgents.add(I)}});h.registerExtension("_agent/listSkills",I=>k.listSkills(I.params)),h.registerExtension("_agent/addSkills",I=>k.addSkills(I.params)),h.registerExtension("_agent/removeSkills",I=>k.removeSkills(I.params)),h.registerExtension("_agent/getFileTree",I=>k.getFileTree(I.params)),h.registerExtension("_agent/getFileContent",I=>k.getFileContent(I.params)),h.registerExtension("_agent/update",I=>k.updateAgent(I.params)),h.registerExtension("_agent/disconnect",I=>k.disconnectAgent(I.params)),h.registerExtension("_agent/switchModel",I=>k.switchModel(I.params));let T=new $t({paths:f,handlers:k,sendDetail:I=>h.sendRequest("_agent/detail",I)});x.onConnect(({initial:I})=>{z.info("frontier upstream connected, triggering detail sync",{initial:I}),T.syncAll(I?"initial-connect":"reconnect").catch(M=>z.warn("detail sync top-level error (ignored)",{err:String(M)}))});let L=new wn({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:w??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async I=>{let M=I,Y=M?.privatecode,me=M?.pairing_code;if(!Y||!me)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let De=Po(M.env),we=M.handshake_url,le=M.frontier_url,We=yf(M.env,we,le),Ht=!!_&&_!==Y,jt=b!==void 0&&b!==We,_e=Ht||jt;if(_e){z.warn("pair config switched, resetting agents",{pcChanged:Ht,envChanged:jt,previousPc:_?Oo(_):"",nextPc:Oo(Y),previousEnvKey:b??"",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 Kt,"pair switch").catch(()=>{})}let ye=await To({privatecode:Y,...we?{endpoint:we}:{},ppeOverride:De});w=ye.deviceId,dr({deviceId:w,pid:process.pid});let $n=new Kn({handshake:ye,privatecode:Y,...le?{urlOverride:le}:{},ppeOverride:De});await x.swap($n,"pair");let re=Object.keys(a.frameworksCache??{});try{let be=await h.sendRequest("_agent/pair",{pairCode:me,patToken:Y,frameworks:re,_meta:{cozeDeviceId:w}});z.info("_agent/pair ok",{pairResult:be}),_=Y,b=We,C||(C=new rn({core:h,getDeviceId:()=>w??""})),C.start(),_e&&Bo(f,m).catch(q=>z.warn("post-pair-switch auto-revive error (ignored)",{err:String(q)}));let X;return M.agent_id&&(X=await vf(M.agent_id,f,m,q=>h.sendRequest("_agent/detail",q)).catch(q=>(z.error("--agent-id ensureAgent failed",{agentId:M.agent_id,err:String(q)}),{ok:!1,agentId:M.agent_id??"",note:String(q)}))),{ok:!0,note:"paired with cloud",...X?{agent:X}:{}}}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 I=>{let M=I;return{ok:!0,result:await m.createAgent(M)}}},{method:"POST",path:"/refresh",handler:async()=>{z.info("IPC /refresh: re-detecting frameworks");let I=new Tt;return a.frameworksCache=await I.detectAll(),await Lt(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:F,token:Q}=await L.start();await h.start(),Bo(f,m).catch(I=>z.warn("auto-revive top-level error (ignored)",{err:String(I)}));let ne=null,Ae={port:F,token:Q,core:h,ipc:L,shutdown(I){return ne||(z.info("daemon shutdown",{reason:I}),ne=(async()=>{C?.stop(),await h.stop(I),await L.stop(),await r.release()})(),ne)}};for(let I of["SIGTERM","SIGINT"])process.on(I,()=>{Ae.shutdown(I).then(()=>process.exit(0))});return z.info("daemon ready",{port:F,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),Ae}function Oo(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function yf(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function bf(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:f}=await Promise.resolve().then(()=>(Ue(),Zt));for(let l of a){await f(l,r).catch(h=>z.warn("enforceAgentConfigMode failed (ignored)",{agentId:l,err:String(h)}));try{let h=await x(l,r);h?.disconnectedAt&&(e.disconnectedAgents.add(l),z.info("agent marked disconnected on startup",{agentId:l,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){z.warn("failed to load agent config on startup, skipping",{agentId:l,err:String(h)})}}}async function vf(r,e,i,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ue(),Zt)),f=await x(r,e);if(f){z.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let _={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{}};return await i.createAgent(_),{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 l=await a({_meta:{cozeAgentId:r}});if(!l.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:l.agentId,framework:l.framework,...l.cozeIdentity?{cozeIdentity:l.cozeIdentity}:{},...l.model?{model:l.model}:{},...l.deployType?{_meta:{cozeDeployType:l.deployType}}:{}};await i.createAgent(h);let m=l.deployType==="cloud"&&l.framework==="openclaw";return{ok:!0,agentId:r,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function Bo(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(),Zt));z.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,l=0;for(let h of a){let m;try{m=await x(h,r)}catch(_){z.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(_)}),l+=1;continue}if(!m){l+=1;continue}if(m.disconnectedAt){z.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),l+=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(_){z.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(_)}),l+=1}}return z.info("auto-revive: done",{revived:f,skipped:l,total:a.length}),{revived:f,skipped:l,total:a.length}}Hr();oe();import{readFile as qo}from"node:fs/promises";var Ge=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:Tf(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([qo(this.paths.portFile,"utf8"),qo(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=i.trim();return!Number.isFinite(a)||a<=0||!x?null:{port:a,token:x}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let a=i.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let f=new AbortController,l=setTimeout(()=>f.abort(),i.timeoutMs??5e3);try{let h=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:x,body:a?JSON.stringify(i.body):void 0,signal:f.signal}),m=await h.text();return{status:h.status,body:Pf(m)}}finally{clearTimeout(l)}}};function Pf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function Tf(r){return r instanceof Error?r.message:String(r)}K();oe();import{copyFile as Uo,mkdir as Lf,readFile as jr,writeFile as Nf}from"node:fs/promises";import{dirname as Rf,resolve as Gr,sep as Gn}from"node:path";import{fileURLToPath as Of}from"node:url";K();oe();var Fo=R("dist-install");function Bf(r){let e=Of(r),i=Rf(e),a=`${Gn}src${Gn}`;if(i.includes(a)||i.endsWith(`${Gn}src${Gn}cli`))return null;let x=Gr(i,"index.js"),f=Gr(i,"..","package.json");return{dist:x,pkgJson:f}}async function Ko(r={}){let e=r.paths??H(),i=Bf(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 jr(x,"utf8")).version??"unknown"}catch(w){return Fo.warn("cannot read source package.json,skip dist install",{err:String(w)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(w)}`}}let l=await pn(e.configFile)??{},h=l.libVersion;if(h===f)try{return await jr(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await Lf(e.libDir,{recursive:!0}),await Uo(a,e.libEntry),await Uo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=Gr(e.libDir,"package.json"),_=`${JSON.stringify({type:"module"},null,2)}
92
+ `;return await jr(m,"utf8").catch(()=>null)!==_&&await Nf(m,_),l.libVersion=f,await Lt(l,e.configFile),Fo.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 tu=R("cli");function yt(r,e){let i=[],a;for(let x=0;x<r.length;x++){let f=r[x];if(f===e){a=r[x+1],x+=1;continue}if(f.startsWith(`${e}=`)){a=f.slice(e.length+1);continue}i.push(f)}return{value:a,rest:i}}function nu(r){let e=r.slice(2);if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let i=e,{value:a,rest:x}=yt(i,"--pat-token");i=x;let{value:f,rest:l}=yt(i,"--pair-code");i=l;let{value:h,rest:m}=yt(i,"--env");i=m;let{value:_,rest:b}=yt(i,"--handshake-url");i=b;let{value:w,rest:C}=yt(i,"--frontier-url");i=C;let{value:k}=yt(i,"--agent-id");if(!a||!f)return{mode:"help"};let T={mode:"pair",privatecode:a,pairingCode:f};return h&&(T.env=h),_&&(T.handshakeUrl=_),w&&(T.frontierUrl=w),k&&(T.agentId=k),T}var ru=`
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 Vo(r=process.argv,e={}){let i=nu(r);switch(i.mode){case"help":return process.stdout.write(ru),0;case"daemon":{try{await zo()}catch(a){return tu.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return su(e);case"stop":return iu(e);case"refresh":return ou(e);case"uninstall":return au(e);case"install-service":return xu();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),cu(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function Yo(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 su(r){let e=r.paths??H(),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 Yo(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 iu(r){let e=r.paths??H(),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 Yo(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 ou(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)
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...
132
+ `),1}}async function au(r){let e=new Ge(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
133
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
134
+ `)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:l}=await Promise.resolve().then(()=>($r(),Zr)),h=f();await h.uninstall(l()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
135
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}
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
137
  `)}catch(f){return process.stderr.write(`coze-bridge: remove failed: ${String(f)}
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 xu(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>($r(),Zr)),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}
142
+ `),1}}async function cu(r,e,i,a={},x){let f=new Ge(i.paths),l=i.spawnDaemon??Mo;if(!i.skipDistInstall){let _=await Ko({paths:i.paths});_.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${_.fromVersion} \u2192 ${_.toVersion}
143
+ `),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(w=>setTimeout(w,500)))):_.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${_.libVersion}
144
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"})
147
- `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(w.body)}
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)}
145
+ `),await l({paths:i.paths}),h=await fu(f,i.waitTimeoutMs??1e4,i.sleep??uu),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 _=await f.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return _.status===200&&_.body?.ok?(process.stdout.write(`coze-bridge: paired (${_.body.note??"ok"})
147
+ `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(_.body)}
148
+ `),1)}catch(_){return process.stderr.write(`coze-bridge: pair failed: ${String(_)}
149
+ `),1}}async function fu(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 uu(r){return new Promise(e=>setTimeout(e,r))}Vo(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)});