@p697/clawket 0.4.0 → 0.4.2

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 +3439 -1
  2. package/package.json +2 -3
package/dist/index.js CHANGED
@@ -1,2 +1,3440 @@
1
1
  #!/usr/bin/env node
2
- (function(_0x301031,_0x4ea9de){const _0x10884b={_0x24394b:0xd9,_0x455dea:0x307,_0x5af205:0x522,_0x2e28b1:0x3e9,_0x28268a:0x187,_0x1c6754:0x1b4,_0x132b93:0x21c,_0x30d7f2:0xa4,_0x56cce7:0x135,_0x5f0f24:0x13c,_0x1a5afa:0x355,_0x4f19f7:0x45d,_0x52f23e:0x105},_0x40050f=_0x301031();function _0x257c32(_0x416bcd,_0x519185){return _0x47f8(_0x519185- -0x15d,_0x416bcd);}function _0x1aa132(_0x392319,_0x4e7dea){return _0x47f8(_0x392319- -0x2ee,_0x4e7dea);}while(!![]){try{const _0x2fbeab=parseInt(_0x1aa132(-_0x10884b._0x24394b,-0x24e))/0x1*(-parseInt(_0x257c32(0x17,0x21))/0x2)+-parseInt(_0x257c32(0x238,_0x10884b._0x455dea))/0x3+-parseInt(_0x257c32(_0x10884b._0x5af205,_0x10884b._0x2e28b1))/0x4*(parseInt(_0x257c32(-0x143,0x170))/0x5)+-parseInt(_0x1aa132(_0x10884b._0x28268a,_0x10884b._0x1c6754))/0x6*(parseInt(_0x1aa132(_0x10884b._0x132b93,-_0x10884b._0x30d7f2))/0x7)+-parseInt(_0x1aa132(-_0x10884b._0x56cce7,0x18b))/0x8*(parseInt(_0x257c32(0x5f,_0x10884b._0x5f0f24))/0x9)+parseInt(_0x257c32(0x385,_0x10884b._0x1a5afa))/0xa+-parseInt(_0x1aa132(0x229,_0x10884b._0x4f19f7))/0xb*(-parseInt(_0x257c32(0xee,_0x10884b._0x52f23e))/0xc);if(_0x2fbeab===_0x4ea9de)break;else _0x40050f['push'](_0x40050f['shift']());}catch(_0x4f88dc){_0x40050f['push'](_0x40050f['shift']());}}}(_0x1cc1,0x203b6));const _0x1e9614=(function(){let _0x46fcea=!![];return function(_0x169efb,_0x4de16f){const _0x3ebb45={_0x11c6c0:0x108},_0x21ca4f=_0x46fcea?function(){function _0x21456d(_0x10f8db,_0x13e7bf){return _0x47f8(_0x13e7bf- -_0x3ebb45._0x11c6c0,_0x10f8db);}if(_0x4de16f){const _0x43ec8a=_0x4de16f[_0x21456d(-0x1ba,0x84)](_0x169efb,arguments);return _0x4de16f=null,_0x43ec8a;}}:function(){};return _0x46fcea=![],_0x21ca4f;};}()),_0x23587f=_0x1e9614(this,function(){const _0x19a976={_0x3f1225:0x39d,_0x4393d7:0x508,_0x35ad3c:0x656,_0x3a41c1:0x4fe,_0xd5a18:0x427,_0x39d282:0x91a,_0x2e5ad0:0x9e4},_0x5992c7={_0x41d91a:0x2e};function _0x3632e3(_0x1423cc,_0x1561d3){return _0x47f8(_0x1561d3-_0x5992c7._0x41d91a,_0x1423cc);}function _0x313c24(_0x4e1d0e,_0x2fdbce){return _0x47f8(_0x4e1d0e-0x322,_0x2fdbce);}return _0x23587f[_0x3632e3(0x551,_0x19a976._0x3f1225)]()['search'](_0x3632e3(0x82d,0x665)+_0x313c24(0x7aa,_0x19a976._0x4393d7))[_0x313c24(0x691,_0x19a976._0x35ad3c)]()[_0x3632e3(0x4e3,0x224)+_0x313c24(_0x19a976._0x3a41c1,_0x19a976._0xd5a18)](_0x23587f)[_0x313c24(_0x19a976._0x39d282,0x754)](_0x313c24(0x959,_0x19a976._0x2e5ad0)+'+)+$');});_0x23587f();import _0x3e24a7 from'qrcode-terminal';import{readFileSync as _0x1a6cae}from'fs';import{Socket}from'net';import{homedir as _0x152237}from'os';import{existsSync,mkdirSync,readFileSync,rmSync,writeFileSync}from'fs';import{randomUUID}from'crypto';import{homedir,hostname,userInfo}from'os';import{join}from'path';var CONFIG_DIR=join(homedir(),_0x26b3dd(0x8b7,0x99b)),CONFIG_PATH=join(CONFIG_DIR,_0x26b3dd(0x8dc,0x641)+'li.json');function getPairingConfigPath(){return CONFIG_PATH;}function readPairingConfig(){const _0x5702dd={_0x4100e7:0x1ea,_0x371d70:0x696,_0x205121:0x311,_0x24b408:0xfd,_0x4d3e3d:0x281,_0x328797:0x128,_0x8bcb05:0x134,_0x2f176a:0x120,_0xcb0a48:0xee,_0x1bae89:0x1de,_0x4d989d:0x692,_0x4733ff:0x11,_0x496d26:0x993,_0x5c6828:0x99,_0x3e6e92:0x94,_0x483bd9:0x19b,_0x23a3d3:0xa9,_0x74cb71:0x972,_0x356ef4:0xc1,_0x5323af:0x6ef,_0x49045b:0x487,_0x339b82:0x13a,_0x2e7ae0:0x8b0,_0x2036a9:0x58f,_0x9647c7:0x8f7},_0x2cac2f={_0x28b808:0x6f5},_0x2c96ea={'VfoPL':function(_0x5b3242,_0x223400,_0xfc2d74){return _0x5b3242(_0x223400,_0xfc2d74);}};if(!existsSync(CONFIG_PATH))return null;function _0x59e8f6(_0x41d5b2,_0x14b0c0){return _0x26b3dd(_0x14b0c0- -_0x2cac2f._0x28b808,_0x41d5b2);}function _0x43c326(_0x168a85,_0x19c0de){return _0x26b3dd(_0x19c0de- -0xf7,_0x168a85);}try{const _0x25656b=JSON[_0x59e8f6(-0x10c,-_0x5702dd._0x4100e7)](_0x2c96ea[_0x43c326(0x400,_0x5702dd._0x371d70)](readFileSync,CONFIG_PATH,_0x59e8f6(-_0x5702dd._0x205121,-_0x5702dd._0x24b408)));if(!_0x25656b[_0x59e8f6(-_0x5702dd._0x4d3e3d,-_0x5702dd._0x328797)+'l']||!_0x25656b[_0x59e8f6(-_0x5702dd._0x8bcb05,_0x5702dd._0x2f176a)+'d']||!_0x25656b[_0x59e8f6(_0x5702dd._0xcb0a48,_0x5702dd._0x1bae89)+_0x43c326(0x7cf,_0x5702dd._0x4d989d)]||!_0x25656b[_0x59e8f6(_0x5702dd._0x4733ff,-0xa9)])return null;const _0x2a42b0={'serverUrl':_0x25656b['serverUr'+'l'],'gatewayId':_0x25656b[_0x43c326(_0x5702dd._0x496d26,0x71e)+'d'],'relaySecret':_0x25656b[_0x59e8f6(-_0x5702dd._0x5c6828,_0x5702dd._0x1bae89)+_0x59e8f6(-_0x5702dd._0x1bae89,_0x5702dd._0x3e6e92)],'relayUrl':_0x25656b[_0x59e8f6(-_0x5702dd._0x483bd9,-_0x5702dd._0x23a3d3)],'instanceId':_0x25656b[_0x43c326(_0x5702dd._0x74cb71,0x8f7)+'Id']?.[_0x59e8f6(0x201,_0x5702dd._0x356ef4)]()||createInstanceId(),'displayName':_0x25656b[_0x43c326(_0x5702dd._0x5323af,_0x5702dd._0x49045b)+_0x59e8f6(0x1aa,_0x5702dd._0x339b82)]??null,'createdAt':_0x25656b[_0x43c326(0x9d1,_0x5702dd._0x2e7ae0)+'t']??new Date()['toISOStr'+'ing'](),'updatedAt':_0x25656b['updatedA'+'t']??new Date()[_0x43c326(0x6ca,0x747)+_0x43c326(0x6e3,_0x5702dd._0x2036a9)]()};return _0x25656b[_0x59e8f6(0x2c9,0x2f9)+'Id']!==_0x2a42b0[_0x43c326(0xb28,_0x5702dd._0x9647c7)+'Id']&&writePairingConfig(_0x2a42b0),_0x2a42b0;}catch{return null;}}function writePairingConfig(_0x49bf32){const _0xf179a6={_0x45919c:0x29e,_0x1ce3c8:0x1d5,_0xc65b24:0x313,_0x5dda64:0x0},_0x620b53={_0x102f4e:0x168};function _0x1f0875(_0x5d36ca,_0x49e942){return _0x3266d5(_0x49e942,_0x5d36ca- -0x16e);}function _0x36447e(_0xf4c95f,_0x2970e9){return _0x3266d5(_0x2970e9,_0xf4c95f- -_0x620b53._0x102f4e);}const _0x42b217={'TzsIe':function(_0x49cd2f,_0x14da45,_0x175610,_0x1e77ce){return _0x49cd2f(_0x14da45,_0x175610,_0x1e77ce);}},_0x132cc7={};_0x132cc7[_0x1f0875(_0xf179a6._0x45919c,_0xf179a6._0x1ce3c8)+'e']=!![],mkdirSync(CONFIG_DIR,_0x132cc7),_0x42b217[_0x36447e(0xfd,-0xa0)](writeFileSync,CONFIG_PATH,JSON[_0x1f0875(-0x157,-_0xf179a6._0xc65b24)+'y'](_0x49bf32,null,0x2)+'\x0a',_0x36447e(_0xf179a6._0x5dda64,0x13b));}function deletePairingConfig(){const _0x1ac298={_0x246cd2:0x90},_0x3b2273={_0x3cbe8a:0xf9};function _0x1ed1ff(_0x4ff182,_0x53d0b3){return _0x3266d5(_0x53d0b3,_0x4ff182- -_0x3b2273._0x3cbe8a);}if(!existsSync(CONFIG_PATH))return;const _0x49f9a5={};_0x49f9a5[_0x1ed1ff(0x138,-_0x1ac298._0x246cd2)]=!![],rmSync(CONFIG_PATH,_0x49f9a5);}function getDefaultBridgeDisplayName(){const _0x3d6fbd={_0x4ada56:0x3ad,_0x267baa:0x575,_0x9f09cf:0x5d2,_0x382ed1:0x4a5,_0x3fafc9:0x22d},_0x5797d0={_0x3ee521:0x2ac},_0x20fde5={_0x1b9b38:0x221},_0x4c7cb0=readOpenClawDefaultAgentName();function _0x49341e(_0x33e263,_0xd95ed8){return _0x3266d5(_0xd95ed8,_0x33e263-_0x20fde5._0x1b9b38);}if(_0x4c7cb0)return _0x4c7cb0;function _0x33db39(_0x4c665d,_0x2e1a18){return _0x3266d5(_0x4c665d,_0x2e1a18-_0x5797d0._0x3ee521);}try{const _0x5c7a09=userInfo()[_0x49341e(_0x3d6fbd._0x4ada56,0x344)][_0x33db39(_0x3d6fbd._0x267baa,_0x3d6fbd._0x9f09cf)]();if(_0x5c7a09)return _0x5c7a09;}catch{}const _0x138abc=(process.env.LOGNAME??process.env.USER??process.env.USERNAME??'')[_0x49341e(0x547,_0x3d6fbd._0x382ed1)]();if(_0x138abc)return _0x138abc;return hostname()['trim']()||_0x49341e(_0x3d6fbd._0x3fafc9,0x366)+_0x49341e(0x6c5,0x7e1);}function pickOpenClawDefaultAgentName(_0x49dd54){const _0xe0c3fd={_0x37b65f:0x37b,_0x365647:0x766,_0x39aac9:0x38f,_0x67c855:0x5ef,_0x1a7fdf:0x92b,_0x2c0c4e:0x693},_0xb436b4={'JTFNM':function(_0x4e51dd,_0x53483c){return _0x4e51dd(_0x53483c);}};if(!_0x49dd54||typeof _0x49dd54!==_0x105674(0x52e,_0xe0c3fd._0x37b65f))return null;const _0x201034=_0x49dd54[_0x105674(0x916,0x7db)],_0x4b5df0=Array[_0x105674(_0xe0c3fd._0x365647,0xa0e)](_0x201034?.[_0x2f1f85(_0xe0c3fd._0x39aac9,0x572)])?_0x201034[_0x105674(_0xe0c3fd._0x67c855,0x471)]:[];function _0x105674(_0x535845,_0x1abdff){return _0x26b3dd(_0x535845-0x62,_0x1abdff);}const _0x421442=_0x4b5df0[_0x105674(_0xe0c3fd._0x1a7fdf,0x94f)](_0x48133a=>isDefaultAgent(_0x48133a))??_0x4b5df0[_0x2f1f85(_0xe0c3fd._0x2c0c4e,0x8ae)](_0x4584b5=>hasAgentId(_0x4584b5,_0x105674(0x63f,0x68f)))??_0x4b5df0[0x0];function _0x2f1f85(_0x99f940,_0x33b2ce){return _0x26b3dd(_0x33b2ce- -0x1b,_0x99f940);}return _0xb436b4[_0x2f1f85(0x7c1,0x81f)](readAgentName,_0x421442);}function createInstanceId(){const _0x10bc55={_0xa2d611:0x411,_0x10e9ac:0x49f,_0x2126b1:0x5be,_0x459fa8:0x30f,_0xc116c5:0x126},_0x7bd877={_0x899758:0x149};function _0x2de75a(_0x1dfe8d,_0x24e4c0){return _0x3266d5(_0x24e4c0,_0x1dfe8d-_0x7bd877._0x899758);}const _0x17ee69=sanitizeId(hostname()||_0x52fc51(_0x10bc55._0xa2d611,_0x10bc55._0x10e9ac));function _0x52fc51(_0x334cdf,_0x27caa5){return _0x3266d5(_0x27caa5,_0x334cdf-0x120);}return _0x2de75a(_0x10bc55._0x2126b1,_0x10bc55._0x459fa8)+_0x17ee69+'-'+randomUUID()[_0x52fc51(0x128,_0x10bc55._0xc116c5)](0x0,0xa);}function sanitizeId(_0x22e791){const _0xc8a339={_0x2759ee:0x39c,_0x170fce:0xa0,_0x37edf0:0x13a,_0x4eb08d:0x80},_0x5d38fe={_0x37906b:0x591},_0xe5244a={_0x3d6d49:0x647};function _0x757047(_0x6d614f,_0x204ea8){return _0x26b3dd(_0x6d614f- -_0xe5244a._0x3d6d49,_0x204ea8);}function _0x35c110(_0x12524f,_0x209383){return _0x26b3dd(_0x209383- -_0x5d38fe._0x37906b,_0x12524f);}return _0x22e791['trim']()[_0x757047(_0xc8a339._0x2759ee,0x4a7)+_0x757047(_0xc8a339._0x170fce,0x175)]()[_0x35c110(0x21d,0x12e)](/[^a-z0-9._-]+/g,'-')[_0x35c110(0x314,0x12e)](/^-+|-+$/g,'')||_0x757047(_0xc8a339._0x37edf0,-_0xc8a339._0x4eb08d);}function readOpenClawDefaultAgentName(){function _0x24356f(_0x5d7765,_0x34ac8e){return _0x3266d5(_0x5d7765,_0x34ac8e-0x4f5);}function _0x22ea50(_0x538b7d,_0x48101d){return _0x3266d5(_0x538b7d,_0x48101d- -0x24a);}const _0x2e5739=resolveOpenClawConfigPath();if(!_0x2e5739||!existsSync(_0x2e5739))return null;try{const _0x58739c=JSON[_0x24356f(0x432,0x570)](readFileSync(_0x2e5739,_0x22ea50(0xb4,-0xe2)));return pickOpenClawDefaultAgentName(_0x58739c);}catch{return null;}}function resolveOpenClawConfigPath(){const _0xa5dd3e={_0x122451:0x1af,_0x179322:0x139,_0x2a6484:0x4f,_0x595716:0x175,_0x517c26:0xe3,_0x3667d7:0xe8,_0x17bba3:0x7a,_0x4d4ec6:0x92,_0x18805d:0x4d},_0x12e994={_0x4a9394:0xc37,_0x3f3f97:0x893},_0x21fb69={_0x41f1af:0xae},_0x2d5c25={_0x13f259:0x13},_0x1c7015={};function _0x2a3b31(_0x1f371b,_0x3a4ac8){return _0x3266d5(_0x3a4ac8,_0x1f371b- -_0x2d5c25._0x13f259);}_0x1c7015[_0x2a3b31(0x11b,-0x133)]=_0x5b820f(_0xa5dd3e._0x122451,0x2d8);function _0x5b820f(_0x42ebcd,_0x1005f5){return _0x3266d5(_0x42ebcd,_0x1005f5- -_0x21fb69._0x41f1af);}_0x1c7015[_0x5b820f(_0xa5dd3e._0x179322,-_0xa5dd3e._0x2a6484)]=_0x2a3b31(_0xa5dd3e._0x595716,_0xa5dd3e._0x517c26)+'w',_0x1c7015[_0x2a3b31(_0xa5dd3e._0x3667d7,_0xa5dd3e._0x17bba3)]=_0x2a3b31(0x107,0x1bb)+_0x5b820f(0x244,_0xa5dd3e._0x4d4ec6);const _0x503ee0=_0x1c7015,_0x4a368c=new Set(),_0x55a1b1=[homedir(),_0x503ee0[_0x5b820f(0x8e,0x80)]]['map'](_0xfbbd33=>_0xfbbd33[_0x2a3b31(0x313,0x218)]())['filter'](Boolean)['filter'](_0x5cac07=>{const _0x4ff758={_0x3ed8fc:0x44},_0x388343={_0x5cdc27:0x544};if(_0x4a368c[_0x378e11(0x982,_0x12e994._0x4a9394)](_0x5cac07))return![];_0x4a368c[_0x378e11(_0x12e994._0x3f3f97,0x7c1)](_0x5cac07);function _0x378e11(_0x3d22d4,_0xe5c34c){return _0x5b820f(_0xe5c34c,_0x3d22d4-_0x388343._0x5cdc27);}function _0x590122(_0x27977b,_0x53175b){return _0x5b820f(_0x53175b,_0x27977b- -_0x4ff758._0x3ed8fc);}return!![];});for(const _0x23e20a of _0x55a1b1){const _0x5e322e=join(_0x23e20a,_0x503ee0[_0x5b820f(-0x9f,-0x4f)],_0x503ee0[_0x5b820f(-0xe,_0xa5dd3e._0x18805d)]);if(existsSync(_0x5e322e))return _0x5e322e;}return _0x55a1b1[0x0]?join(_0x55a1b1[0x0],_0x503ee0[_0x2a3b31(0x4c,0x23e)],_0x503ee0[_0x5b820f(-0x159,0x4d)]):null;}function isDefaultAgent(_0x3b0809){const _0x38e15f={_0x4e65a5:0x2c8,_0x192585:0xaf0},_0x1d347e={_0x13524c:0x204},_0x142151={'HPbsz':function(_0x3ff11d,_0x43b2c2){return _0x3ff11d(_0x43b2c2);},'gJSPd':function(_0x452b1e,_0x336955){return _0x452b1e===_0x336955;}};function _0x3aa47f(_0x2ecb6e,_0x153297){return _0x26b3dd(_0x153297- -0x104,_0x2ecb6e);}function _0x474275(_0x5b3718,_0xd681d6){return _0x26b3dd(_0xd681d6- -_0x1d347e._0x13524c,_0x5b3718);}return _0x142151['HPbsz'](Boolean,_0x3b0809&&typeof _0x3b0809===_0x474275(0x48e,_0x38e15f._0x4e65a5)&&_0x142151[_0x3aa47f(0x4fb,0x5f9)](_0x3b0809[_0x3aa47f(_0x38e15f._0x192585,0x8ad)],!![]));}function hasAgentId(_0x42be12,_0x3c2561){const _0x38b445={};_0x38b445['CaibL']='string';const _0x577a6b=_0x38b445;return Boolean(_0x42be12&&typeof _0x42be12==='object'&&typeof _0x42be12['id']===_0x577a6b['CaibL']&&_0x42be12['id']['trim']()===_0x3c2561);}function readAgentName(_0x2d5f60){const _0xb28013={_0x3a3110:0x47b,_0x2016fe:0x78f,_0x2ed32a:0x89b,_0x2de98d:0x2d6,_0x4d797e:0x41e,_0x2cbbbb:0x69,_0x378693:0x152,_0x233963:0x179,_0x4d7d4d:0x62,_0x50a9cb:0x66,_0x1039b9:0x13a,_0x385885:0xb1,_0x403aad:0x846},_0x1ed474={_0x5ad355:0xae},_0x59e7cd={};_0x59e7cd[_0x3378bb(0x4d0,_0xb28013._0x3a3110)]=function(_0x6836dc,_0x408282){return _0x6836dc!==_0x408282;},_0x59e7cd[_0x3378bb(_0xb28013._0x2016fe,_0xb28013._0x2ed32a)]=function(_0x46acdb,_0x5cb0c9){return _0x46acdb===_0x5cb0c9;},_0x59e7cd['RwzSz']='string';const _0x52cd47=_0x59e7cd;if(!_0x2d5f60||_0x52cd47[_0x1dcdc2(-_0xb28013._0x2de98d,-0x18c)](typeof _0x2d5f60,_0x3378bb(0x614,_0xb28013._0x4d797e)))return null;const _0x153803=_0x2d5f60;function _0x1dcdc2(_0x3d2460,_0x4f16ce){return _0x26b3dd(_0x4f16ce- -0x6b5,_0x3d2460);}const _0x47c330=_0x52cd47[_0x1dcdc2(0x40e,0x294)](typeof _0x153803['identity']?.[_0x1dcdc2(_0xb28013._0x2cbbbb,-0x60)],_0x1dcdc2(0x1,_0xb28013._0x378693))?_0x153803[_0x1dcdc2(_0xb28013._0x233963,_0xb28013._0x4d7d4d)][_0x1dcdc2(-_0xb28013._0x50a9cb,-0x60)][_0x1dcdc2(-0x193,0x101)]():'';if(_0x47c330)return _0x47c330;function _0x3378bb(_0x4f366c,_0x2254ee){return _0x26b3dd(_0x2254ee- -_0x1ed474._0x5ad355,_0x4f366c);}const _0x54dd7c=typeof _0x153803[_0x3378bb(0x42d,0x5a7)]===_0x52cd47[_0x1dcdc2(-_0xb28013._0x1039b9,-_0xb28013._0x385885)]?_0x153803[_0x3378bb(_0xb28013._0x403aad,0x5a7)][_0x3378bb(0x79e,0x708)]():'';return _0x54dd7c||null;}function buildPairingQrPayload(_0x509003){const _0x23839c={_0xb0f410:0x6,_0x1e8b6d:0x74d,_0x192c38:0x1b4,_0x403a0f:0x24f,_0x4b64f9:0x1ed,_0x36b5d8:0xb4,_0x10cffe:0x13b,_0xb9abc9:0x8ef,_0x335cc7:0x114,_0x407534:0x149,_0x595396:0x3df},_0x1731a4={_0x3d05c8:0x1eb},_0x25e867={};_0x25e867['v']=0x2,_0x25e867['k']='cp',_0x25e867['s']=_0x509003[_0xa10f88(-_0x23839c._0xb0f410,0x25)],_0x25e867['g']=_0x509003[_0x38e721(0x4bf,_0x23839c._0x1e8b6d)+'d'],_0x25e867['a']=_0x509003[_0xa10f88(0x211,0x24f)+'de'],_0x25e867['rb']=0x1,_0x25e867['pv']=0x2,_0x25e867['sb']=!![];function _0x38e721(_0x48151b,_0x579380){return _0x3266d5(_0x48151b,_0x579380-0x3c8);}const _0x256cb6=_0x25e867;_0x509003[_0x38e721(0x523,0x4b6)+_0xa10f88(_0x23839c._0x192c38,0x303)]?.[_0xa10f88(0x13b,-0x16e)]()&&(_0x256cb6['n']=_0x509003[_0xa10f88(-0xfd,0x154)+_0xa10f88(0x1b4,_0x23839c._0x403a0f)][_0xa10f88(0x13b,_0x23839c._0x4b64f9)]());_0x509003[_0xa10f88(_0x23839c._0x36b5d8,-0x112)]?.[_0xa10f88(_0x23839c._0x10cffe,0x2f8)]()&&(_0x256cb6['t']=_0x509003[_0xa10f88(0xb4,-0x86)]['trim']());_0x509003[_0x38e721(_0x23839c._0xb9abc9,0x84f)]?.[_0xa10f88(0x13b,-_0x23839c._0x335cc7)]()&&(_0x256cb6['p']=_0x509003['password'][_0xa10f88(0x13b,_0x23839c._0x407534)]());function _0xa10f88(_0x44fe5c,_0x3b4e24){return _0x3266d5(_0x3b4e24,_0x44fe5c- -_0x1731a4._0x3d05c8);}return JSON[_0x38e721(0x1ed,_0x23839c._0x595396)+'y'](_0x256cb6);}function buildGatewayQrPayload(_0xcdf75d){const _0x1b597e={_0x29922f:0xbaa,_0x545dcb:0x9c9,_0x2c0636:0x83f,_0x3f88d8:0x929,_0x14b8a1:0xa14,_0x11f306:0x8cf,_0x224647:0x544,_0x3f4e35:0x722,_0x212b45:0x748,_0x1c96bc:0x7ed,_0x180d6c:0x9d5,_0x2e0e71:0x874,_0x18693f:0x8ff,_0x443ad4:0x980};function _0x8b1ae5(_0x33d214,_0x236b24){return _0x26b3dd(_0x33d214-0xbe,_0x236b24);}const _0x278312={'mDQPR':function(_0x43c583,_0x41b052){return _0x43c583(_0x41b052);},'GyloQ':function(_0x5a94fc,_0x58f3b1){return _0x5a94fc*_0x58f3b1;}},_0x15afb2=_0x278312['mDQPR'](normalizeGatewayQrUrl,_0xcdf75d[_0x8b1ae5(0x941,_0x1b597e._0x29922f)+'rl']),_0x530032={'url':_0x15afb2[_0x8b1ae5(_0x1b597e._0x545dcb,0x8c7)],'host':_0x15afb2[_0x8b1ae5(_0x1b597e._0x2c0636,_0x1b597e._0x3f88d8)],'port':_0x15afb2[_0x8b1ae5(_0x1b597e._0x14b8a1,_0x1b597e._0x11f306)],'tls':_0x15afb2['tls'],'mode':'gateway','expiresAt':_0xcdf75d['expiresA'+'t']??Date[_0x8b1ae5(0x7b0,_0x1b597e._0x224647)]()+_0x278312['GyloQ'](0xa,0x3c)*0x3e8,'qrVersion':0x2};_0xcdf75d[_0x78cf1b(0x6c1,_0x1b597e._0x3f4e35)]?.[_0x78cf1b(_0x1b597e._0x212b45,0x69f)]()&&(_0x530032[_0x78cf1b(0x6c1,0x778)]=_0xcdf75d[_0x8b1ae5(_0x1b597e._0x1c96bc,0x644)][_0x78cf1b(0x748,0x874)]());function _0x78cf1b(_0x71960a,_0x573b75){return _0x26b3dd(_0x71960a- -0x6e,_0x573b75);}return _0xcdf75d[_0x8b1ae5(_0x1b597e._0x180d6c,0xa64)]?.[_0x8b1ae5(_0x1b597e._0x2e0e71,_0x1b597e._0x18693f)]()&&(_0x530032[_0x8b1ae5(_0x1b597e._0x180d6c,0x910)]=_0xcdf75d['password'][_0x8b1ae5(0x874,_0x1b597e._0x443ad4)]()),JSON['stringif'+'y'](_0x530032);}function _0x26b3dd(_0x260171,_0x113089){return _0x47f8(_0x260171-0x324,_0x113089);}function normalizeGatewayQrUrl(_0x445989){const _0x4e33c4={_0x5d25bd:0x2fc,_0x30b403:0x3ff,_0x491a02:0x482,_0x2e6eae:0x138,_0x463f9b:0x67a,_0x1b0b4b:0xd1,_0x174960:0x1f1,_0x530903:0x471,_0x53524c:0x97e,_0x1a82fd:0x80a,_0x48bdf2:0x54f},_0x49e5bd={_0x24721a:0x66},_0x5dbd18={};_0x5dbd18['BQFJb']=function(_0x2205f2,_0xfc7ec2){return _0x2205f2===_0xfc7ec2;},_0x5dbd18[_0x2d4bc8(0x1c4,_0x4e33c4._0x5d25bd)]=_0xe319bf(_0x4e33c4._0x30b403,_0x4e33c4._0x491a02);const _0x7bb564=_0x5dbd18,_0x116fda=new URL(_0x445989[_0xe319bf(_0x4e33c4._0x2e6eae,0x38c)]());function _0xe319bf(_0x544b66,_0x5121fb){return _0x3266d5(_0x544b66,_0x5121fb-_0x49e5bd._0x24721a);}const _0x45069a=_0x7bb564['BQFJb'](_0x116fda[_0x2d4bc8(0x95,0x2d5)],_0x2d4bc8(0x3ba,_0x4e33c4._0x463f9b))||_0x116fda[_0xe319bf(_0x4e33c4._0x1b0b4b,0xdd)]==='https:',_0x153fe5=_0x45069a?_0x7bb564[_0x2d4bc8(0x78,_0x4e33c4._0x5d25bd)]:_0xe319bf(0x318,_0x4e33c4._0x174960),_0x219ddc=_0x116fda[_0xe319bf(0x61e,_0x4e33c4._0x530903)],_0x10d9ac=_0x116fda[_0x2d4bc8(_0x4e33c4._0x53524c,0x724)]?Number(_0x116fda['port']):_0x45069a?0x1bb:0x50,_0x78c033=!_0x116fda['pathname']||_0x116fda[_0xe319bf(0x22a,0x98)]===''?'/':_0x116fda[_0xe319bf(-0x1af,0x98)],_0x1b84ef={};function _0x2d4bc8(_0x16e1d5,_0x32386b){return _0x3266d5(_0x16e1d5,_0x32386b-0x25e);}return _0x1b84ef[_0xe319bf(0x649,0x4e1)]=_0x153fe5+'//'+_0x219ddc+':'+_0x10d9ac+_0x78c033,_0x1b84ef[_0x2d4bc8(_0x4e33c4._0x1a82fd,_0x4e33c4._0x48bdf2)]=_0x219ddc,_0x1b84ef[_0xe319bf(0x410,0x52c)]=_0x10d9ac,_0x1b84ef[_0xe319bf(0x2b1,0x381)]=_0x78c033,_0x1b84ef['tls']=_0x45069a,_0x1b84ef;}var DEFAULT_REGISTRY_BASE=_0x26b3dd(0x4e9,0x32c)+_0x3266d5(0x2e6,0x398)+'.clawket'+_0x3266d5(0x382,0x580),DEFAULT_REGISTRY_FALLBACK_BASE=_0x26b3dd(0x4e9,0x6b3)+'clawket-'+_0x3266d5(0x4bc,0x398)+_0x3266d5(0x5dc,0x427)+'.workers'+'.dev';async function pairGateway(_0x216d01){const _0x3cdca5={_0x3f2ee7:0x4b8,_0x32ff92:0x5c8,_0x1ebda6:0x56e,_0x45aa30:0x308,_0x146858:0x50b,_0x41f07e:0x2e3,_0x387d25:0x52d,_0xaf5e9d:0x3c0,_0x4b3f22:0x1b6,_0x191388:0x318,_0x2647f0:0x489,_0x5f4941:0x1ef,_0x3b22d7:0x1d8,_0x476f32:0x489,_0x245115:0x487,_0x1d8282:0x3f5,_0x1d7479:0x18e,_0x3ac9f7:0x63c,_0x113574:0x63f,_0x39b4d0:0x540,_0x39f949:0x2af,_0x16cebb:0x227,_0xa9ed5d:0x567,_0x228858:0x332,_0x568bb8:0x18d,_0xa5357b:0x704,_0x42753b:0x662,_0x3160e5:0x3a1,_0xb329d:0xdc,_0x49bb50:0x330,_0x18e997:0x52a,_0x1f65d3:0x327,_0x36bce5:0xa,_0x7e0854:0x101,_0x414f68:0x1b6,_0x5293f0:0x489,_0x51761e:0x2ea,_0x41e341:0x193,_0x533c71:0x3b8,_0x218265:0x1ac,_0x320df9:0x29f,_0xacda67:0x409,_0x56158c:0x284,_0x1c55b2:0x4d8,_0x523bae:0x648,_0x25a9f5:0x7f5,_0x2dc32f:0x53d,_0x1eb320:0x41f,_0x57abcc:0x46f,_0xcd79c9:0xd0,_0x19b883:0x2a1,_0x3da440:0x28c,_0x47ce24:0x286,_0x1ddf36:0x4c4,_0x1f03a9:0x1d8,_0x201149:0x27e,_0x59ee33:0x397,_0x468fee:0x8a0,_0x2c57ab:0x63c,_0xf6235c:0x522},_0x1f65f7={_0x3cb37d:0xc8},_0x1db9bb={'ckWGZ':function(_0x44f9fa,_0xce4ef7,_0x4e9577){return _0x44f9fa(_0xce4ef7,_0x4e9577);},'vunef':'POST','Gtemc':_0x3acb9f(0x467,0x330)+_0x25409d(_0x3cdca5._0x3f2ee7,0x327)},_0x242e6c=normalizeHttpBase(_0x216d01['serverUr'+'l']),_0x506e9f=readPairingConfig(),_0x29d69d=_0x1db9bb['ckWGZ'](assessPairingCompatibility,_0x506e9f,_0x242e6c);function _0x25409d(_0x2078d1,_0x5a8eae){return _0x3266d5(_0x2078d1,_0x5a8eae-_0x1f65f7._0x3cb37d);}if(_0x29d69d===_0x3acb9f(0x56a,0x4f7)+'existing'&&_0x506e9f){const _0x580934={};return _0x580934[_0x3acb9f(0x393,0x227)+'l']=_0x506e9f['serverUr'+'l'],_0x580934[_0x3acb9f(_0x3cdca5._0x32ff92,0x46f)+'d']=_0x506e9f[_0x25409d(_0x3cdca5._0x1ebda6,0x44d)+'d'],_0x580934[_0x25409d(_0x3cdca5._0x45aa30,_0x3cdca5._0x146858)+_0x3acb9f(_0x3cdca5._0x41f07e,0x3e3)]=_0x506e9f[_0x3acb9f(0x363,_0x3cdca5._0x387d25)+'ret'],_0x580934[_0x25409d(_0x3cdca5._0xaf5e9d,_0x3cdca5._0x4b3f22)+_0x3acb9f(_0x3cdca5._0x191388,_0x3cdca5._0x2647f0)]=_0x216d01[_0x3acb9f(_0x3cdca5._0x5f4941,_0x3cdca5._0x3b22d7)+_0x3acb9f(0x3c9,_0x3cdca5._0x476f32)],_0x580934[_0x3acb9f(_0x3cdca5._0x245115,_0x3cdca5._0x1d8282)+'oken']=_0x216d01[_0x3acb9f(_0x3cdca5._0x1d7479,0x3f5)+_0x3acb9f(0x266,0x22f)],_0x580934[_0x3acb9f(0x48f,_0x3cdca5._0x3ac9f7)+_0x25409d(_0x3cdca5._0x113574,0x38a)]=_0x216d01[_0x3acb9f(0x579,0x63c)+_0x3acb9f(_0x3cdca5._0x39b4d0,0x3ac)],refreshAccessCode(_0x580934);}if(_0x29d69d==='server-m'+_0x25409d(0x1c9,_0x3cdca5._0x39f949))throw new Error('This\x20bri'+'dge\x20is\x20a'+'lready\x20p'+_0x3acb9f(0x16e,0x1cb)+_0x3acb9f(0xc5,0x24c)+_0x506e9f?.[_0x3acb9f(0x16a,_0x3cdca5._0x16cebb)+'l']+('.\x20Run\x20\x22c'+_0x25409d(0x432,_0x3cdca5._0xa9ed5d)+_0x25409d(0x11c,_0x3cdca5._0x228858)+_0x25409d(0x56f,0x3e6)+_0x25409d(0x2e5,0x529)+_0x3acb9f(_0x3cdca5._0x568bb8,0x281)+_0x25409d(_0x3cdca5._0xa5357b,0x5f5)+_0x25409d(0x4f3,0x406)));function _0x3acb9f(_0x74f36d,_0x5a2729){return _0x3266d5(_0x74f36d,_0x5a2729-0xea);}const _0x7c14eb=await postJsonWithCloudflareFallback(_0x242e6c+(_0x3acb9f(0x93,0x202)+'/registe'+'r'),{'method':_0x1db9bb[_0x3acb9f(_0x3cdca5._0x42753b,0x3b4)],'headers':{'content-type':_0x1db9bb[_0x3acb9f(_0x3cdca5._0x3160e5,0x606)],'accept':_0x3acb9f(_0x3cdca5._0xb329d,_0x3cdca5._0x49bb50)+_0x25409d(_0x3cdca5._0x18e997,_0x3cdca5._0x1f65d3)},'body':JSON[_0x3acb9f(_0x3cdca5._0x36bce5,_0x3cdca5._0x7e0854)+'y']({'displayName':_0x216d01[_0x25409d(0x32c,_0x3cdca5._0x414f68)+_0x3acb9f(0x6ea,_0x3cdca5._0x5293f0)]?.[_0x3acb9f(0x534,0x410)]()||null})});if(!_0x7c14eb[_0x25409d(_0x3cdca5._0x51761e,0x218)]['ok'])throw await buildPairingRequestError(_0x25409d(0x364,0x418)+_0x25409d(_0x3cdca5._0x41e341,_0x3cdca5._0x533c71),_0x7c14eb);const _0x109e35=await _0x7c14eb[_0x25409d(-0x7c,0x218)][_0x3acb9f(_0x3cdca5._0x218265,0x3df)](),_0x5747d5=new Date()['toISOStr'+_0x3acb9f(_0x3cdca5._0x320df9,0x2e0)](),_0x39a331={'serverUrl':_0x242e6c,'gatewayId':_0x109e35['gatewayI'+'d'],'relaySecret':_0x109e35[_0x25409d(_0x3cdca5._0xacda67,0x50b)+'ret'],'relayUrl':_0x109e35[_0x25409d(0x3a3,_0x3cdca5._0x56158c)],'instanceId':_0x506e9f?.[_0x3acb9f(_0x3cdca5._0x1c55b2,_0x3cdca5._0x523bae)+'Id']??_0x25409d(_0x3cdca5._0x25a9f5,_0x3cdca5._0x2dc32f)+_0x109e35[_0x3acb9f(_0x3cdca5._0x1eb320,_0x3cdca5._0x57abcc)+'d'][_0x25409d(-0x8d,_0x3cdca5._0xcd79c9)](-0xa),'displayName':_0x109e35[_0x3acb9f(_0x3cdca5._0x19b883,0x1d8)+_0x25409d(0x208,0x467)],'createdAt':_0x5747d5,'updatedAt':_0x5747d5};return writePairingConfig(_0x39a331),{'config':_0x39a331,'accessCode':_0x109e35['accessCo'+'de'],'accessCodeExpiresAt':_0x109e35[_0x3acb9f(0x5b3,0x4e6)+'deExpire'+_0x3acb9f(0x1c9,_0x3cdca5._0x3da440)],'action':_0x25409d(0x453,_0x3cdca5._0x47ce24)+'ed','qrPayload':buildPairingQrPayload({'server':_0x242e6c,'gatewayId':_0x109e35[_0x3acb9f(0x3f0,_0x3cdca5._0x57abcc)+'d'],'accessCode':_0x109e35[_0x25409d(0x2b4,_0x3cdca5._0x1ddf36)+'de'],'displayName':_0x109e35[_0x3acb9f(-0xb3,_0x3cdca5._0x1f03a9)+_0x3acb9f(_0x3cdca5._0x201149,0x489)],'token':_0x216d01['gatewayT'+'oken']?.[_0x3acb9f(_0x3cdca5._0x59ee33,0x410)]()||null,'password':_0x216d01[_0x3acb9f(_0x3cdca5._0x468fee,_0x3cdca5._0x2c57ab)+'assword']?.[_0x25409d(_0x3cdca5._0xf6235c,0x3ee)]()||null})};}async function refreshAccessCode(_0x15ba7f){const _0xec5030={_0x3d2464:0x408,_0x1ece4c:0xda,_0x46c644:0xb9,_0x310f9f:0x57d,_0x5f05a9:0x343,_0x3364d5:0x2d5,_0x251c06:0x26b,_0x259181:0x171,_0x4d6309:0x320,_0x2c9baf:0x1f9,_0xdb98bc:0x360,_0x4b3b84:0xc,_0x46960f:0x8ac,_0x30d500:0x1b8,_0x4677b9:0x506,_0x195910:0x2d7,_0x51fbd6:0x1b8,_0x25739d:0x799,_0x57e747:0x342,_0x1722c4:0x483,_0xc5cd17:0x61b,_0x7cc463:0x416,_0x58ad8c:0x2be,_0x3c81a4:0x369,_0x996361:0x311,_0x1a7e00:0x5cd,_0xd0e6fc:0x2b6,_0x2bb5e7:0x4a5,_0x584935:0x297,_0x2cabd6:0xc2,_0x4dc8c2:0x42a,_0x146633:0x12e,_0x42bfe2:0x3e7,_0x8ba7c4:0x2f7,_0x2b84db:0x71,_0x58a3b4:0x20c,_0x39144f:0xa6e,_0x269428:0x7be,_0x3f8998:0x6d1,_0x5a87b7:0x114,_0x290339:0x36e,_0x507617:0x646,_0x247116:0x6d3,_0x29367e:0x5b2,_0x586712:0x432,_0x15ca92:0x298,_0x40ca2b:0x4c4,_0x37ea54:0x644},_0x193300={_0x5c92a2:0x2a7},_0x469f54={'AnybB':function(_0x21100){return _0x21100();},'IHTEq':function(_0x2cf11c,_0x5b16f4,_0x463012){return _0x2cf11c(_0x5b16f4,_0x463012);},'RVMIe':_0x454390(_0xec5030._0x3d2464,0x1d3)},_0x38b29c=_0x469f54['AnybB'](readPairingConfig),_0x4dc99e=normalizeHttpBase(_0x15ba7f?.[_0x454390(_0xec5030._0x1ece4c,0xaf)+'l']??_0x38b29c?.[_0x454390(_0xec5030._0x46c644,0xaf)+'l']??''),_0x2ab8e1=_0x15ba7f?.[_0x454390(_0xec5030._0x310f9f,0x2f7)+'d']??_0x38b29c?.[_0x454390(0x383,0x2f7)+'d']??'',_0x2749f1=_0x15ba7f?.['relaySec'+_0x454390(_0xec5030._0x5f05a9,0x26b)]??_0x38b29c?.['relaySec'+_0x454390(_0xec5030._0x3364d5,_0xec5030._0x251c06)]??'';if(!_0x4dc99e||!_0x2ab8e1||!_0x2749f1)throw new Error(_0x454390(_0xec5030._0x259181,0x39)+_0xf8db93(0x406,_0xec5030._0x4d6309)+_0x454390(_0xec5030._0x2c9baf,_0xec5030._0xdb98bc)+_0x454390(_0xec5030._0x4b3b84,0x72)+'ir\x20first'+'.');const _0x4e06ae={};_0x4e06ae['content-'+_0xf8db93(_0xec5030._0x46960f,0x7e9)]=_0x454390(0x79,_0xec5030._0x30d500)+_0xf8db93(0x739,_0xec5030._0x4677b9);function _0x454390(_0x1095ae,_0x43e4b9){return _0x3266d5(_0x1095ae,_0x43e4b9- -0x8e);}_0x4e06ae[_0xf8db93(0x513,0x582)]=_0x454390(_0xec5030._0x195910,_0xec5030._0x51fbd6)+_0xf8db93(_0xec5030._0x25739d,_0xec5030._0x4677b9);const _0x49c6a1=await _0x469f54[_0x454390(0x1d0,_0xec5030._0x57e747)](postJsonWithCloudflareFallback,_0x4dc99e+('/v1/pair'+_0x454390(0x582,_0xec5030._0x1722c4)+_0xf8db93(_0xec5030._0xc5cd17,0x442)),{'method':_0x469f54[_0x454390(-0xc3,0x8e)],'headers':_0x4e06ae,'body':JSON[_0xf8db93(_0xec5030._0x7cc463,_0xec5030._0x58ad8c)+'y']({'gatewayId':_0x2ab8e1,'relaySecret':_0x2749f1,'displayName':_0x15ba7f?.[_0x454390(0x249,0x60)+_0x454390(_0xec5030._0x3c81a4,_0xec5030._0x996361)]?.[_0xf8db93(0x4ff,_0xec5030._0x1a7e00)]()||void 0x0})});function _0xf8db93(_0x10ac0f,_0x1052d7){return _0x3266d5(_0x10ac0f,_0x1052d7-_0x193300._0x5c92a2);}if(!_0x49c6a1['response']['ok'])throw await buildPairingRequestError('Access\x20c'+'ode\x20refr'+_0x454390(_0xec5030._0xd0e6fc,_0xec5030._0x2bb5e7),_0x49c6a1);const _0x3f98b2=await _0x49c6a1[_0x454390(_0xec5030._0x584935,_0xec5030._0x2cabd6)][_0xf8db93(_0xec5030._0x4dc8c2,0x59c)](),_0x478397={'serverUrl':_0x4dc99e,'gatewayId':_0x3f98b2['gatewayI'+'d'],'relaySecret':_0x2749f1,'relayUrl':_0x3f98b2[_0x454390(0x1af,_0xec5030._0x146633)],'instanceId':_0x38b29c?.[_0xf8db93(0x8eb,0x805)+'Id']??_0x454390(0x2c0,_0xec5030._0x42bfe2)+_0x3f98b2[_0x454390(0x351,_0xec5030._0x8ba7c4)+'d'][_0xf8db93(_0xec5030._0x2b84db,0x2af)](-0xa),'displayName':_0x3f98b2['displayN'+_0x454390(_0xec5030._0x58a3b4,_0xec5030._0x996361)],'createdAt':_0x38b29c?.[_0xf8db93(_0xec5030._0x39144f,_0xec5030._0x269428)+'t']??new Date()[_0xf8db93(_0xec5030._0x3f8998,0x655)+_0xf8db93(0x54a,0x49d)](),'updatedAt':new Date()[_0xf8db93(0x6bb,0x655)+_0xf8db93(0x5ef,0x49d)]()};return writePairingConfig(_0x478397),{'config':_0x478397,'accessCode':_0x3f98b2[_0x454390(0x3af,0x36e)+'de'],'accessCodeExpiresAt':_0x3f98b2[_0xf8db93(0x4b4,0x6a3)+'deExpire'+_0x454390(0x9c,_0xec5030._0x5a87b7)],'action':_0x454390(0x2f0,0x462)+'d','qrPayload':buildPairingQrPayload({'server':_0x4dc99e,'gatewayId':_0x3f98b2['gatewayI'+'d'],'accessCode':_0x3f98b2[_0x454390(0x422,_0xec5030._0x290339)+'de'],'displayName':_0x3f98b2[_0xf8db93(0x21a,0x395)+_0xf8db93(0x391,_0xec5030._0x507617)],'token':_0x15ba7f?.[_0xf8db93(_0xec5030._0x247116,_0xec5030._0x29367e)+'oken']?.[_0x454390(_0xec5030._0x586712,_0xec5030._0x15ca92)]()||null,'password':_0x15ba7f?.[_0x454390(0x6a6,_0xec5030._0x40ca2b)+_0x454390(0x37,0x234)]?.[_0xf8db93(_0xec5030._0x37ea54,_0xec5030._0x1a7e00)]()||null})};}function normalizeHttpBase(_0x4ec5a3){const _0x1ff66c={_0x2c9369:0xb6,_0x4e767e:0x228,_0x3d6ccf:0x5c5,_0x524f0e:0x52a,_0x21ba41:0x619,_0x258c02:0x1f2,_0x3fa5db:0x402,_0x2fc250:0x6a5,_0x31f15a:0x61d,_0x1c133d:0x1de,_0x9cab7c:0xf3,_0x386147:0x390,_0x302f81:0x618,_0x893232:0x72d,_0x1d495a:0x349,_0x4cf407:0xd5,_0x118952:0x250,_0x58be18:0x22f,_0x18ed3a:0x460,_0x331db3:0x474,_0x236cd5:0x75,_0x23f8b5:0x20a,_0x38c443:0x4aa,_0x451563:0x522},_0x1a16b6={_0x7004cd:0x237},_0x13b5c7={_0x54f223:0x2f3};function _0x38f1e7(_0x12bc96,_0x96dff7){return _0x3266d5(_0x12bc96,_0x96dff7-_0x13b5c7._0x54f223);}const _0x34bbe1={};_0x34bbe1['IKFtI']='http://',_0x34bbe1[_0x375926(-_0x1ff66c._0x2c9369,-_0x1ff66c._0x4e767e)]=_0x38f1e7(_0x1ff66c._0x3d6ccf,0x5ff);const _0x481805=_0x34bbe1,_0x1950b8=_0x4ec5a3[_0x38f1e7(_0x1ff66c._0x524f0e,_0x1ff66c._0x21ba41)]();if(!_0x1950b8)return'';function _0x375926(_0x190e6d,_0x20a351){return _0x3266d5(_0x20a351,_0x190e6d- -_0x1a16b6._0x7004cd);}if(_0x1950b8['startsWi'+'th'](_0x481805[_0x375926(-_0x1ff66c._0x258c02,-_0x1ff66c._0x3fa5db)])||_0x1950b8[_0x38f1e7(_0x1ff66c._0x2fc250,_0x1ff66c._0x31f15a)+'th'](_0x375926(-_0x1ff66c._0x1c133d,-0x9e)))return _0x1950b8[_0x38f1e7(0x2f8,0x522)](/\/+$/,'');if(_0x1950b8[_0x375926(_0x1ff66c._0x9cab7c,0xc6)+'th'](_0x375926(-0x155,-0x21e)))return(_0x38f1e7(0x366,_0x1ff66c._0x386147)+_0x1950b8[_0x375926(-0x22f,-0xf8)](_0x38f1e7(0x290,0x3d5)[_0x38f1e7(_0x1ff66c._0x302f81,_0x1ff66c._0x893232)]))[_0x38f1e7(_0x1ff66c._0x1d495a,0x522)](/\/+$/,'');if(_0x1950b8[_0x375926(_0x1ff66c._0x9cab7c,0x30e)+'th'](_0x375926(_0x1ff66c._0x4cf407,_0x1ff66c._0x118952)))return(_0x38f1e7(0x533,0x34c)+_0x1950b8[_0x375926(-_0x1ff66c._0x58be18,-_0x1ff66c._0x18ed3a)](_0x481805[_0x38f1e7(0x334,_0x1ff66c._0x331db3)][_0x375926(0x203,_0x1ff66c._0x236cd5)]))[_0x375926(-0x8,-_0x1ff66c._0x23f8b5)](/\/+$/,'');return('https://'+_0x1950b8)[_0x38f1e7(_0x1ff66c._0x38c443,_0x1ff66c._0x451563)](/\/+$/,'');}function assessPairingCompatibility(_0x3ca2bf,_0x4c0db2){const _0x18bcf9={_0x3d2178:0x350,_0x11f61e:0x49c,_0x7a0256:0x6d5,_0x1ed6c8:0x61b,_0x325a15:0x3e1},_0x3f0ce3={_0x3e47b5:0x277},_0x15dede={};_0x15dede['pjTvK']='refresh-'+'existing',_0x15dede[_0x3a821c(0x7e1,0x61c)]='server-m'+'ismatch';const _0x5e07bd=_0x15dede;function _0x3a821c(_0x598bd8,_0x5d85ab){return _0x26b3dd(_0x5d85ab- -0x276,_0x598bd8);}if(!_0x3ca2bf)return'register'+_0x3a821c(0x3ba,_0x18bcf9._0x3d2178);function _0x21a7ed(_0x14d97e,_0x2e387e){return _0x26b3dd(_0x14d97e- -_0x3f0ce3._0x3e47b5,_0x2e387e);}if(_0x3ca2bf[_0x3a821c(0x20b,0x357)+'l']===_0x4c0db2)return _0x5e07bd[_0x21a7ed(_0x18bcf9._0x11f61e,_0x18bcf9._0x7a0256)];return _0x5e07bd[_0x21a7ed(_0x18bcf9._0x1ed6c8,_0x18bcf9._0x325a15)];}async function postJsonWithCloudflareFallback(_0x268ffd,_0x568ab4){const _0x355c75={_0xa5db81:0x4cb},_0x4f45d3={_0x2c9e47:0x6fc},_0x5b91df={_0x1e7c78:0x23};function _0x37865c(_0x51a283,_0x1898a0){return _0x26b3dd(_0x1898a0-_0x5b91df._0x1e7c78,_0x51a283);}const _0x36a7c2=await fetch(_0x268ffd,_0x568ab4),_0x33e61f=resolveCloudflareChallengeFallbackUrl(_0x268ffd,_0x36a7c2);if(!_0x33e61f){const _0xf044b1={};return _0xf044b1[_0x14b66e(-0x357,-0x11c)]=_0x36a7c2,_0xf044b1[_0x37865c(_0x355c75._0xa5db81,0x72e)+_0x37865c(0x24b,0x4db)]=_0x268ffd,_0xf044b1['fallback'+'Url']=null,_0xf044b1;}function _0x14b66e(_0x3f6514,_0x134d9b){return _0x26b3dd(_0x134d9b- -_0x4f45d3._0x2c9e47,_0x3f6514);}return{'response':await fetch(_0x33e61f,_0x568ab4),'attemptedUrl':_0x268ffd,'fallbackUrl':_0x33e61f};}async function buildPairingRequestError(_0x5d944b,_0xba1ee1){const _0x113566={_0x4cfc91:0x36,_0x5964f7:0x118,_0x1cae79:0x895,_0x345184:0x31a,_0x2b5bc2:0x895,_0x3a3143:0x828,_0x30dd98:0xa1f,_0xbb8b71:0x1e,_0x2ac6d6:0x1cc,_0x3ba1a5:0x860,_0x4b6e7d:0x188,_0x4bdccb:0xae,_0x144983:0x953,_0x47c342:0xb8e,_0x537a32:0x128,_0x326c65:0x9eb,_0x16b832:0x369,_0x5b096f:0x731,_0x432305:0x67d,_0x326efe:0x375,_0x1e9541:0x17a,_0x42afb2:0x7a8,_0x17ed02:0x56f,_0x52b4f9:0x72f,_0x98ce99:0x35,_0x2df4b6:0x133,_0x449edd:0x547,_0x14172f:0x37,_0x10375e:0x3c,_0xf5265:0xa9c,_0x116077:0x284,_0x701178:0x102,_0x2fbde3:0x220,_0x36725e:0x1c5,_0x1874e5:0xa01,_0x2c4341:0x104,_0x154adb:0x1ad,_0x498d07:0x128,_0x62b593:0x41f,_0x5ad248:0x1a1,_0x12c08f:0x70e,_0x20cdb7:0x79d,_0x3c5f2f:0x7c6,_0x4ec356:0x917},_0x28089d={'KDPJf':function(_0x1ddfe3,_0x2680a3){return _0x1ddfe3(_0x2680a3);},'VrXzG':function(_0x23a299,_0x207eb4){return _0x23a299(_0x207eb4);}};function _0x4505fe(_0x5636f4,_0x361552){return _0x26b3dd(_0x361552- -0x6e4,_0x5636f4);}function _0x35c39f(_0x400b90,_0x1485b0){return _0x26b3dd(_0x400b90-0xb3,_0x1485b0);}if(_0x28089d[_0x4505fe(-_0x113566._0x4cfc91,-_0x113566._0x5964f7)](isCloudflareChallengeResponse,_0xba1ee1[_0x35c39f(0x693,0x7b6)])){const _0x2c5453=new URL(_0xba1ee1['fallback'+_0x35c39f(_0x113566._0x1cae79,0x8c3)]??_0xba1ee1['attempte'+'dUrl'])['origin'],_0x504d60=_0xba1ee1[_0x4505fe(-_0x113566._0x345184,-0x193)+_0x35c39f(_0x113566._0x2b5bc2,_0x113566._0x3a3143)]?_0x35c39f(0xa8e,_0x113566._0x30dd98)+'ic\x20fallb'+_0x4505fe(-0x24a,-_0x113566._0xbb8b71)+_0xba1ee1[_0x4505fe(-_0x113566._0x2ac6d6,-0x193)+_0x35c39f(0x895,_0x113566._0x3ba1a5)]+(_0x4505fe(-_0x113566._0x4b6e7d,_0x113566._0x4bdccb)+'t\x20a\x20Clou'+_0x35c39f(_0x113566._0x144983,_0x113566._0x47c342)+'hallenge'+'.'):'';return new Error(_0x5d944b+(_0x4505fe(0x470,0x26a)+'(')+_0xba1ee1['response'][_0x4505fe(0x13f,_0x113566._0x537a32)]+(_0x35c39f(_0x113566._0x326c65,0x7ee)+_0x4505fe(-_0x113566._0x16b832,-0xc3)+'allenge\x20'+_0x35c39f(_0x113566._0x5b096f,_0x113566._0x432305)+_0x4505fe(0x398,0x12a)+_0x4505fe(-_0x113566._0x326efe,-_0x113566._0x1e9541)+'\x20at\x20')+_0x2c5453+'.'+_0x504d60+('\x20Retry\x20f'+_0x35c39f(0x9ed,_0x113566._0x42afb2)+_0x35c39f(_0x113566._0x17ed02,_0x113566._0x52b4f9)+_0x4505fe(-_0x113566._0x98ce99,-_0x113566._0x2df4b6)+_0x35c39f(0x58b,_0x113566._0x449edd)+_0x4505fe(-_0x113566._0x14172f,-_0x113566._0x10375e)+'y\x20endpoi'+_0x35c39f(_0x113566._0xf5265,0x7e6)+_0x4505fe(0x522,_0x113566._0x116077)+'\x20require'+_0x4505fe(_0x113566._0x701178,_0x113566._0x2fbde3)+_0x4505fe(-_0x113566._0x36725e,-0x27)+'ation.'));}return new Error(_0x5d944b+(_0x35c39f(_0x113566._0x1874e5,0xa76)+'(')+_0xba1ee1[_0x4505fe(-0x16d,-_0x113566._0x2c4341)][_0x4505fe(_0x113566._0x154adb,_0x113566._0x498d07)]+_0x4505fe(-_0x113566._0x62b593,-_0x113566._0x5ad248)+_0x28089d[_0x35c39f(_0x113566._0x12c08f,_0x113566._0x20cdb7)](summarizeFailedResponse,await _0xba1ee1[_0x35c39f(0x693,_0x113566._0x3c5f2f)][_0x35c39f(0x7da,_0x113566._0x4ec356)]()));}function isCloudflareChallengeResponse(_0x67f2d5){const _0x423bab={_0x106a8c:0x255,_0x3ed211:0xaa0,_0x24c82c:0x867,_0x4b4016:0x99a,_0x4e2435:0x4b3,_0x5f224b:0x39f,_0x10ecdc:0x906};function _0x433c68(_0x1c0c9d,_0x9f94f3){return _0x3266d5(_0x1c0c9d,_0x9f94f3-0x148);}const _0x191693={};function _0x45c622(_0x547981,_0x106535){return _0x3266d5(_0x547981,_0x106535-0x447);}_0x191693['hvPdD']=_0x433c68(0x7de,0x574)+'e';const _0x41ce32=_0x191693;return _0x67f2d5['status']===0x193&&_0x67f2d5[_0x45c622(0x850,0x8c7)][_0x433c68(_0x423bab._0x106a8c,0x49b)](_0x45c622(0x6e8,0x6a0)+_0x45c622(_0x423bab._0x3ed211,_0x423bab._0x24c82c))?.[_0x45c622(0x60b,0x76d)]()[_0x45c622(0x8d4,_0x423bab._0x4b4016)+_0x433c68(_0x423bab._0x4e2435,_0x423bab._0x5f224b)]()===_0x41ce32[_0x45c622(0x6de,_0x423bab._0x10ecdc)];}function resolveCloudflareChallengeFallbackUrl(_0x51ee0c,_0x3a5dca){const _0x4187ee={_0x5970f9:0x601,_0x41a369:0x394,_0x59ca38:0x492,_0x4d5748:0x39c,_0x2a4de0:0x81e},_0x322f91={};_0x322f91['JtwbK']=function(_0x5128c6,_0x178b39){return _0x5128c6!==_0x178b39;};function _0x303ea2(_0x20f603,_0x48e808){return _0x26b3dd(_0x20f603- -0x30,_0x48e808);}const _0xa79678=_0x322f91;if(!isCloudflareChallengeResponse(_0x3a5dca))return null;const _0x13f17d=new URL(_0x51ee0c);if(_0xa79678[_0x32c612(_0x4187ee._0x5970f9,_0x4187ee._0x41a369)](_0x13f17d['origin'],DEFAULT_REGISTRY_BASE))return null;function _0x32c612(_0x231fb8,_0x4952d8){return _0x26b3dd(_0x4952d8- -0x164,_0x231fb8);}return''+DEFAULT_REGISTRY_FALLBACK_BASE+_0x13f17d[_0x303ea2(_0x4187ee._0x59ca38,_0x4187ee._0x4d5748)]+_0x13f17d[_0x32c612(_0x4187ee._0x2a4de0,0x7b8)];}function summarizeFailedResponse(_0x1caacd){const _0x18e058={_0x2c5c36:0x8b0,_0x55bc4f:0xcf,_0x393511:0x589,_0x1ddb4a:0x2b4,_0x5b846f:0x597,_0x320a0d:0x7f1,_0x169564:0x367,_0x1c4fe8:0x3cd,_0x21bb51:0x370,_0x5179fe:0x90,_0x5725ce:0x1c3},_0x10ae24={_0x6b583b:0x128},_0x54a7c0={};_0x54a7c0[_0x31c2de(_0x18e058._0x2c5c36,0xabb)]=_0x52ef76(0xb8,_0x18e058._0x55bc4f)+_0x31c2de(_0x18e058._0x393511,0x34a)+_0x31c2de(0x574,0x36d);function _0x52ef76(_0x1ba65c,_0x4153c4){return _0x26b3dd(_0x1ba65c- -0x671,_0x4153c4);}_0x54a7c0[_0x31c2de(0x3cd,_0x18e058._0x1ddb4a)]=function(_0x4dbfe7,_0x1d87e0){return _0x4dbfe7<=_0x1d87e0;};const _0x4da31a=_0x54a7c0;function _0x31c2de(_0x96c2d5,_0x482ea3){return _0x26b3dd(_0x96c2d5- -_0x10ae24._0x6b583b,_0x482ea3);}const _0x39aad9=_0x1caacd[_0x31c2de(_0x18e058._0x5b846f,_0x18e058._0x320a0d)](/\s+/g,'\x20')[_0x52ef76(0x145,-0x8e)]();if(!_0x39aad9)return _0x4da31a[_0x52ef76(_0x18e058._0x169564,0x1b4)];if(_0x4da31a[_0x31c2de(_0x18e058._0x1c4fe8,0x40b)](_0x39aad9[_0x52ef76(0x259,0x36f)],0xf0))return _0x39aad9;return _0x39aad9[_0x31c2de(_0x18e058._0x21bb51,0x378)](0x0,0xed)+_0x52ef76(-_0x18e058._0x5179fe,-_0x18e058._0x5725ce);}import{execFileSync,spawn}from'child_process';import{chmodSync,closeSync,existsSync as _0x3e4d20,mkdirSync as _0x28c50d,openSync,readFileSync as _0x156eb6,realpathSync,rmSync as _0x4763ae,writeFileSync as _0x242f96}from'fs';import{homedir as _0x13f146}from'os';import{dirname,join as _0xec9618}from'path';import{setTimeout as _0x3f83ac}from'timers/promises';var SERVICE_LABEL=_0x3266d5(0x2c1,0x2b8)+_0x3266d5(0xcf,0x1f0)+'e.cli',SYSTEMD_UNIT_NAME=SERVICE_LABEL+_0x3266d5(0x123,0x3e3),WINDOWS_RUN_KEY=_0x26b3dd(0x722,0x613)+_0x26b3dd(0x977,0x84c),SERVICE_DIR=_0xec9618(_0x13f146(),_0x3266d5(0x5c6,0x427)),LOG_DIR=_0xec9618(SERVICE_DIR,_0x26b3dd(0x52b,0x4b3)),SERVICE_STATE_PATH=_0xec9618(SERVICE_DIR,_0x26b3dd(0x514,0x71d)+_0x26b3dd(0x8b5,0x7b8)+_0x3266d5(0x316,0x6d)),RUNTIME_REGISTRY_PATH=_0xec9618(SERVICE_DIR,'bridge-r'+'untime-p'+_0x26b3dd(0x925,0x74b)+_0x26b3dd(0x5d0,0x4de)),SERVICE_LAUNCHER_PATH=_0xec9618(SERVICE_DIR,'clawket-'+_0x26b3dd(0x705,0x72e)+'.sh'),LINUX_CRON_RECORD_PATH=_0xec9618(SERVICE_DIR,'bridge-s'+'ervice.c'+_0x3266d5(0x68,0x248)),SERVICE_LOG_PATH=_0xec9618(LOG_DIR,'bridge-c'+'li.log'),SERVICE_ERROR_LOG_PATH=_0xec9618(LOG_DIR,_0x3266d5(0x41a,0x44c)+_0x3266d5(0x15a,0x230)+'.log'),MACOS_PLIST_PATH=_0xec9618(_0x13f146(),_0x26b3dd(0x4e6,0x610),_0x3266d5(-0x4,0x2af)+_0x3266d5(0x5ee,0x34a),SERVICE_LABEL+_0x26b3dd(0x5b7,0x830)),LINUX_SERVICE_PATH=_0xec9618(_0x13f146(),'.config',_0x3266d5(0xbd,0x1a),'user',SYSTEMD_UNIT_NAME),LINUX_CRON_MARKER=_0x3266d5(0x6dc,0x506)+_0x3266d5(0x1f4,0x185)+_0x3266d5(-0x5d,0x14f);function getServiceProgramArgs(_0x286cc2={},_0x5529e2=process[_0x26b3dd(0x965,0x7c2)]){const _0x38ecbc={_0x134dfa:0x2c3,_0x3b0c2f:0x4a1,_0x1a7240:0x5ec,_0x30d63b:0x6b1,_0x4dde31:0x893,_0xe087a7:0x7cd,_0x386895:0x58b,_0x373530:0x575,_0x20a573:0x828,_0x47d7e2:0xa82,_0x1d5125:0x50f,_0x21b9ec:0x2cc,_0x4c017b:0x757,_0x38919d:0x513,_0x538601:0x8ac,_0x506de7:0x68d},_0x32da37={'FACYz':'Unable\x20t'+'o\x20resolv'+_0xdbdbc8(0x4a8,0x64d)+'ript\x20pat'+_0xdbdbc8(0x587,0x36f)+_0x3c201a(0x46d,0x4f3)+_0x3c201a(_0x38ecbc._0x134dfa,_0x38ecbc._0x3b0c2f)+_0x3c201a(0x7a0,_0x38ecbc._0x1a7240),'sFojM':function(_0x490d55,_0x297b6a){return _0x490d55!==_0x297b6a;},'sMTJG':_0x3c201a(_0x38ecbc._0x30d63b,0x874),'odgfQ':function(_0x1426af,_0x3864e7){return _0x1426af(_0x3864e7);},'vXhUe':function(_0x106f0a,_0x5efbf7,_0x9e9b51){return _0x106f0a(_0x5efbf7,_0x9e9b51);},'YszkQ':'--servic'+'e'};function _0xdbdbc8(_0x5001a4,_0x328495){return _0x26b3dd(_0x5001a4- -0x79,_0x328495);}function _0x3c201a(_0x328610,_0xf871c7){return _0x26b3dd(_0xf871c7- -0x4b,_0x328610);}const _0x3d2e05=_0x286cc2['nodePath']?.[_0x3c201a(0x730,0x76b)]()||process[_0xdbdbc8(_0x38ecbc._0x4dde31,_0x38ecbc._0xe087a7)],_0x157e78=resolveScriptPath(_0x286cc2['scriptPa'+'th']);if(!_0x157e78)throw new Error(_0x32da37[_0x3c201a(0x4f9,_0x38ecbc._0x386895)]);if(_0x32da37[_0x3c201a(0xa1e,0x907)](_0x5529e2,_0x32da37['sMTJG'])){const _0x2b697d={};_0x2b697d[_0xdbdbc8(0x59d,_0x38ecbc._0x373530)]=_0x3d2e05,_0x2b697d[_0xdbdbc8(_0x38ecbc._0x20a573,_0x38ecbc._0x47d7e2)+'th']=_0x157e78,_0x2b697d[_0xdbdbc8(_0x38ecbc._0x1d5125,_0x38ecbc._0x21b9ec)]=process.env.PATH??'';const _0x590928=_0x32da37['odgfQ'](writeServiceLauncher,_0x2b697d);return _0x32da37[_0xdbdbc8(_0x38ecbc._0x4c017b,_0x38ecbc._0x38919d)](ensureLaunchScriptExecutable,_0x590928,_0x5529e2),[_0x590928];}return[_0x3d2e05,_0x157e78,_0x3c201a(0x737,_0x38ecbc._0x538601),_0x32da37[_0xdbdbc8(_0x38ecbc._0x506de7,0x87c)]];}function getServiceStatus(){const _0x1f8d97={_0x41b1e5:0x2ad,_0x220055:0x34b,_0x443d1e:0x207,_0x2b587a:0x55f,_0x29095a:0x341,_0x460f1a:0xf7,_0x285c72:0x55f,_0x2d332d:0x422,_0x30efe2:0xc7,_0x3eeda8:0x27f,_0x12e94e:0xf5,_0x5a1691:0x344,_0x41d278:0x2af,_0x265440:0x68f,_0x303331:0x1d9,_0x455288:0x426,_0x3d001e:0x572,_0x5ce040:0x1fb,_0x2ac454:0x381,_0x1b58e9:0x24f,_0x2a3ec2:0xf3},_0xde53b0={_0x2b47b9:0x166},_0x3f55a2={_0x4ec419:0xb5};function _0x4526f6(_0xccdded,_0x165739){return _0x3266d5(_0x165739,_0xccdded- -_0x3f55a2._0x4ec419);}const _0x4a4921={'WNnoo':function(_0x4786a7){return _0x4786a7();},'rcMJy':function(_0x5b923b){return _0x5b923b();},'rJRBC':function(_0x560a98,_0x3ca4f9){return _0x560a98(_0x3ca4f9);},'KUCIM':_0x4526f6(0x1d4,0x4d)+'l','KMEXA':_0x11016e(0x63f,0x3bb)+'e'};_0x4a4921[_0x11016e(0x39f,0x421)](ensureServiceDirs);const _0x405f4a=_0x4a4921[_0x11016e(0x388,_0x1f8d97._0x41b1e5)](readServiceState)?.[_0x11016e(0x566,0x471)]??null,_0x285047=detectServiceMethod();function _0x11016e(_0x5c21d9,_0x1b28c5){return _0x3266d5(_0x1b28c5,_0x5c21d9-_0xde53b0._0x2b47b9);}const _0x246e82={'installed':![],'running':_0x405f4a!=null&&_0x4a4921[_0x11016e(0x5c9,0x60b)](isPidRunning,_0x405f4a),'method':_0x285047,'servicePath':getServicePath(_0x285047),'logPath':SERVICE_LOG_PATH,'errorLogPath':SERVICE_ERROR_LOG_PATH,'pid':_0x405f4a};_0x246e82[_0x4526f6(_0x1f8d97._0x220055,_0x1f8d97._0x443d1e)]!=null&&!_0x246e82[_0x11016e(_0x1f8d97._0x2b587a,0x4d6)]&&(clearServiceState(_0x246e82[_0x11016e(0x566,_0x1f8d97._0x29095a)]),_0x246e82[_0x11016e(0x566,0x6bf)]=null);switch(_0x246e82[_0x11016e(0x431,0x421)]){case'launchag'+_0x4526f6(0x13a,-_0x1f8d97._0x460f1a):_0x246e82['installe'+'d']=_0x3e4d20(MACOS_PLIST_PATH);_0x246e82['installe'+'d']&&(_0x246e82[_0x11016e(_0x1f8d97._0x285c72,0x752)]=commandSucceeds(_0x11016e(0x5f1,0x514)+'l',['list',SERVICE_LABEL])||_0x246e82['running']);return _0x246e82;case'systemd-'+_0x11016e(_0x1f8d97._0x2d332d,0x2af):_0x246e82[_0x11016e(0x1f3,_0x1f8d97._0x30efe2)+'d']=_0x3e4d20(LINUX_SERVICE_PATH);_0x246e82[_0x4526f6(-0x28,0x243)+'d']&&(_0x246e82[_0x11016e(_0x1f8d97._0x285c72,0x802)]=commandSucceeds(_0x4a4921[_0x11016e(0x529,0x6f1)],[_0x11016e(_0x1f8d97._0x3eeda8,_0x1f8d97._0x12e94e),_0x4a4921['KMEXA'],'--quiet',SYSTEMD_UNIT_NAME])||_0x246e82[_0x4526f6(_0x1f8d97._0x5a1691,_0x1f8d97._0x41d278)]);return _0x246e82;case _0x11016e(0x547,_0x1f8d97._0x265440)+_0x11016e(_0x1f8d97._0x303331,_0x1f8d97._0x455288):_0x246e82[_0x4526f6(-0x28,-0x18)+'d']=hasLinuxCronRegistration();return _0x246e82;case _0x11016e(0x6ec,_0x1f8d97._0x3d001e)+'run-regi'+'stry':_0x246e82['installe'+'d']=commandSucceeds(_0x11016e(0x678,0x937),[_0x11016e(_0x1f8d97._0x5ce040,_0x1f8d97._0x2ac454),_0x4526f6(0x41d,_0x1f8d97._0x1b58e9)+_0x4526f6(_0x1f8d97._0x2a3ec2,-0xf2)+'crosoft\x5c'+'Windows\x5c'+'CurrentV'+'ersion\x5cR'+'un','/v',WINDOWS_RUN_KEY]);return _0x246e82;default:return _0x246e82;}}function installService(_0x2bd251={}){const _0x53c727={_0x3fce4e:0x9b8,_0xf2d987:0x7cf,_0x2e3bd3:0x2ca,_0x113d34:0x762,_0x4e72d5:0x9ae,_0x53423e:0x688,_0x129866:0x5e0,_0x490919:0x7c7,_0x25a6f8:0x658,_0x3cdfd5:0x1a7,_0x12826f:0x8,_0x582afb:0x488,_0x55edca:0x33a,_0x4ec315:0x980,_0x304faa:0x8a9,_0x528f3d:0x8a7,_0x5d5786:0x85b,_0x2f7bb3:0x6a6,_0x4d5421:0x354,_0x44cbb7:0x98a,_0x41878b:0xaa0,_0x319657:0x3d3,_0x51412e:0x5f,_0x3d9f36:0x68,_0x483088:0x7,_0x461921:0x178,_0x36d391:0x593,_0x152eb6:0x68a,_0x25d7bd:0xb34,_0x596ce1:0x50,_0x356580:0xcd,_0x268340:0x241,_0x51c88a:0xca,_0x12b4d5:0x303,_0x3cc052:0x2ce},_0x3a2a78={_0xb81b2b:0x18},_0x39dad4={'dNgwe':function(_0x9fec88){return _0x9fec88();},'nwDjf':function(_0x3dd083,_0xafa24e){return _0x3dd083(_0xafa24e);},'HiYhy':_0x34b1ce(_0x53c727._0x3fce4e,_0x53c727._0xf2d987),'qbrGm':function(_0x1058d5,_0x4b3c26,_0x147146){return _0x1058d5(_0x4b3c26,_0x147146);},'gwTco':'launchct'+'l','KOrUA':_0x20ea20(-_0x53c727._0x2e3bd3,-0x13c),'uqeuN':function(_0x39c020,_0x594eb3){return _0x39c020(_0x594eb3);},'iEvLy':function(_0x459390,_0x111b69,_0xcf237f,_0x98677e){return _0x459390(_0x111b69,_0xcf237f,_0x98677e);},'nevTE':function(_0x50d774,_0x2daddb){return _0x50d774(_0x2daddb);}};function _0x20ea20(_0x393109,_0x56049e){return _0x26b3dd(_0x56049e- -0x697,_0x393109);}function _0x34b1ce(_0x59c7da,_0x5044ca){return _0x26b3dd(_0x59c7da- -_0x3a2a78._0xb81b2b,_0x5044ca);}_0x39dad4[_0x34b1ce(_0x53c727._0x113d34,_0x53c727._0x4e72d5)](ensureServiceDirs);const _0x413644=_0x39dad4['nwDjf'](getServiceProgramArgs,_0x2bd251);switch(process['platform']){case _0x39dad4[_0x34b1ce(0x8ca,_0x53c727._0x53423e)]:_0x242f96(MACOS_PLIST_PATH,buildMacosPlist(_0x413644,SERVICE_LOG_PATH,SERVICE_ERROR_LOG_PATH),_0x34b1ce(_0x53c727._0x129866,0x833)),_0x39dad4['qbrGm'](execIgnoreFailure,_0x39dad4[_0x34b1ce(_0x53c727._0x490919,_0x53c727._0x25a6f8)],[_0x20ea20(-_0x53c727._0x3cdfd5,-_0x53c727._0x12826f),'-w',MACOS_PLIST_PATH]),execFileSync(_0x39dad4['gwTco'],[_0x34b1ce(_0x53c727._0x582afb,_0x53c727._0x55edca),'-w',MACOS_PLIST_PATH],{'stdio':_0x39dad4[_0x34b1ce(_0x53c727._0x4ec315,_0x53c727._0x304faa)]});break;case'linux':_0x39dad4['uqeuN'](installLinuxService,_0x413644);break;case _0x34b1ce(_0x53c727._0x528f3d,_0x53c727._0x5d5786):stopRunningProcess();const _0x35d701={};_0x35d701[_0x34b1ce(0x767,_0x53c727._0x2f7bb3)]=_0x20ea20(-_0x53c727._0x4d5421,-0x13c),_0x39dad4['iEvLy'](execFileSync,_0x34b1ce(_0x53c727._0x44cbb7,_0x53c727._0x41878b),[_0x20ea20(_0x53c727._0x319657,0x1f6),'HKCU\x5cSof'+_0x20ea20(0x125,-_0x53c727._0x51412e)+_0x20ea20(-_0x53c727._0x3d9f36,_0x53c727._0x483088)+'Windows\x5c'+_0x20ea20(-0x1c8,-_0x53c727._0x461921)+'ersion\x5cR'+'un','/v',WINDOWS_RUN_KEY,'/t',_0x34b1ce(_0x53c727._0x36d391,_0x53c727._0x152eb6),'/d',_0x39dad4[_0x34b1ce(0x90a,_0x53c727._0x25d7bd)](buildWindowsRunCommand,_0x413644),'/f'],_0x35d701),startDetachedWindowsService(_0x413644);break;default:throw new Error(_0x20ea20(-_0x53c727._0x596ce1,-_0x53c727._0x356580)+_0x20ea20(-0x277,-0x189)+_0x20ea20(-0x71,0x183)+'\x20CLI\x20ser'+_0x20ea20(_0x53c727._0x268340,_0x53c727._0x51c88a)+_0x34b1ce(0x632,0x5fe)+'n:\x20'+process[_0x20ea20(_0x53c727._0x12b4d5,_0x53c727._0x3cc052)]);}return _0x39dad4[_0x34b1ce(_0x53c727._0x113d34,0x9c7)](getServiceStatus);}function restartService(_0x42d73f={}){const _0xda8679={_0x29daf2:0x83a,_0x462c28:0x6e5,_0x56596e:0x1d4,_0x2b7fa4:0x4b0,_0x28f396:0x473,_0x247de0:0x669,_0x270d0d:0x719,_0x5d65b2:0x438,_0x5b2ba7:0x6e5,_0x5e8966:0x26a,_0x561547:0x818,_0x2be0fc:0x466,_0x439fbf:0x28d,_0x42993d:0x7be,_0x36ab60:0x567,_0x7c7cb1:0x402,_0x52507a:0x777,_0x2ffc5b:0x151,_0x1d8bd7:0x2e9,_0x141ec4:0x745,_0x4a7bef:0x76d,_0x515570:0x635,_0x225d36:0x2b,_0x1dc8f5:0x394,_0x4cdea7:0x499,_0x27f12f:0x5ed,_0x3a589f:0x339,_0x2d6e40:0x3fb},_0x3dcc4b={_0x4e6b2e:0x62},_0x33ee19={_0x3c4bc0:0x25a};function _0x5b06ea(_0x18f1bc,_0x1c6717){return _0x3266d5(_0x18f1bc,_0x1c6717-_0x33ee19._0x3c4bc0);}const _0x2416ce={'gBqRj':function(_0x47e651){return _0x47e651();},'HbVTY':function(_0x4fe9b3,_0x371fab,_0x448803,_0x39acbd){return _0x4fe9b3(_0x371fab,_0x448803,_0x39acbd);},'mPDNG':_0x5b06ea(_0xda8679._0x29daf2,_0xda8679._0x462c28)+'l','PtEFO':_0xf702d7(-_0xda8679._0x56596e,0x69),'ilmeq':function(_0x1c8a75){return _0x1c8a75();},'gtMGU':_0xf702d7(0x419,_0xda8679._0x2b7fa4),'LhTBz':function(_0x14e549,_0x456f69){return _0x14e549(_0x456f69);}};_0x2416ce['gBqRj'](ensureServiceDirs);function _0xf702d7(_0x181ec9,_0xe25ff){return _0x3266d5(_0x181ec9,_0xe25ff- -_0x3dcc4b._0x4e6b2e);}const _0x36ce61=getServiceProgramArgs(_0x42d73f);switch(process[_0xf702d7(0x6c2,_0xda8679._0x28f396)]){case _0xf702d7(0x439,0x4de):if(!_0x3e4d20(MACOS_PLIST_PATH))return installService(_0x42d73f);_0x242f96(MACOS_PLIST_PATH,_0x2416ce['HbVTY'](buildMacosPlist,_0x36ce61,SERVICE_LOG_PATH,SERVICE_ERROR_LOG_PATH),'utf8'),execIgnoreFailure(_0x2416ce[_0x5b06ea(_0xda8679._0x247de0,0x48c)],[_0xf702d7(0x307,0x19d),'-w',MACOS_PLIST_PATH]);const _0x4e4f33={};_0x4e4f33[_0x5b06ea(0x43b,0x549)]=_0x2416ce[_0x5b06ea(_0xda8679._0x270d0d,0x754)],execFileSync(_0x5b06ea(_0xda8679._0x5d65b2,_0xda8679._0x5b2ba7)+'l',[_0x5b06ea(0x31a,_0xda8679._0x5e8966),'-w',MACOS_PLIST_PATH],_0x4e4f33);break;case'linux':restartLinuxService(_0x36ce61);break;case _0x5b06ea(_0xda8679._0x561547,0x689):_0x2416ce[_0x5b06ea(0x6bc,0x5c1)](stopRunningProcess);const _0x22be77={};_0x22be77[_0xf702d7(_0xda8679._0x2be0fc,_0xda8679._0x439fbf)]='ignore',execFileSync(_0x2416ce[_0x5b06ea(_0xda8679._0x42993d,_0xda8679._0x36ab60)],[_0x5b06ea(0x63c,0x657),_0xf702d7(0x572,0x470)+_0x5b06ea(0x5f5,_0xda8679._0x7c7cb1)+_0xf702d7(0x333,0x1ac)+_0x5b06ea(_0xda8679._0x52507a,0x72d)+_0x5b06ea(_0xda8679._0x2ffc5b,_0xda8679._0x1d8bd7)+_0x5b06ea(_0xda8679._0x141ec4,_0xda8679._0x4a7bef)+'un','/v',WINDOWS_RUN_KEY,'/t',_0x5b06ea(_0xda8679._0x515570,0x375),'/d',buildWindowsRunCommand(_0x36ce61),'/f'],_0x22be77),_0x2416ce[_0xf702d7(-0x26d,-_0xda8679._0x225d36)](startDetachedWindowsService,_0x36ce61);break;default:throw new Error(_0x5b06ea(0x1d4,_0xda8679._0x1dc8f5)+'ted\x20plat'+_0xf702d7(_0xda8679._0x4cdea7,0x328)+_0xf702d7(0x163,0x8f)+_0x5b06ea(_0xda8679._0x27f12f,_0xda8679._0x3a589f)+_0xf702d7(0x3f,0x5c)+process[_0xf702d7(_0xda8679._0x2d6e40,0x473)]);}return getServiceStatus();}async function startTransientRuntime(_0x570b11={}){const _0x24d36e={_0x37d880:0x386,_0x2b0db1:0x3bc,_0x235dfd:0x4a2,_0x2e969c:0x593,_0x44b1eb:0x39a,_0x418eb2:0x147,_0x2e3880:0x813,_0x364e10:0x6ef},_0x4d10aa={_0x1aef70:0x152};function _0x341920(_0x5c8865,_0x55224f){return _0x26b3dd(_0x5c8865- -_0x4d10aa._0x1aef70,_0x55224f);}ensureServiceDirs();function _0x251047(_0x4eccf4,_0x366b93){return _0x26b3dd(_0x366b93- -0x437,_0x4eccf4);}const _0x331f3b=getServiceProgramArgs(_0x570b11);switch(process['platform']){case _0x251047(0x837,0x599):case'linux':startDetachedPosixService(_0x331f3b);break;case _0x251047(_0x24d36e._0x37d880,0x488):startDetachedWindowsService(_0x331f3b);break;default:throw new Error('Unsuppor'+_0x341920(_0x24d36e._0x2b0db1,_0x24d36e._0x235dfd)+_0x251047(_0x24d36e._0x2e969c,0x3e3)+_0x341920(0x6b7,0x82b)+_0x251047(0x54e,_0x24d36e._0x44b1eb)+_0x251047(_0x24d36e._0x418eb2,0x1ef)+_0x341920(0x3fc,0x62a)+process[_0x341920(_0x24d36e._0x2e3880,_0x24d36e._0x364e10)]);}return waitForRuntimeState();}function uninstallService(){const _0x4ce5df={_0x51d359:0x887,_0x495f7b:0x6c0,_0x13541e:0x96b,_0x396e75:0x78d,_0x8a1d0b:0x7fb,_0x58de11:0x60c,_0x550d9f:0x73d,_0x52cfc3:0x572,_0x1d9620:0x5dd,_0x2bd5e6:0x4fa,_0x9d1df0:0xee,_0x31c095:0x113,_0x2a9d46:0x656,_0xcd9ec7:0x58f,_0x42c6e9:0x81b,_0x32f3aa:0xee,_0x444a68:0x9f3,_0x1a30de:0x8d3,_0x482be0:0x735,_0x2ee582:0x245,_0x165b2e:0x70a,_0xdd31a6:0x12c,_0x455973:0x2c5,_0x2430d8:0x534},_0x530518={'kyBYC':_0x444892(_0x4ce5df._0x51d359,_0x4ce5df._0x495f7b),'gPpAa':function(_0x29ad6f,_0x48b7ea){return _0x29ad6f(_0x48b7ea);},'OBZwt':function(_0x6f92dd,_0x419876,_0x308eaa){return _0x6f92dd(_0x419876,_0x308eaa);},'xggNj':_0x4c0047(0x1b6,0x15e),'JOWnl':_0x444892(_0x4ce5df._0x13541e,_0x4ce5df._0x396e75),'RYXJL':'systemct'+'l','vTBSz':_0x444892(_0x4ce5df._0x8a1d0b,_0x4ce5df._0x58de11)+_0x444892(0x682,_0x4ce5df._0x550d9f),'xOspI':function(_0x1f75cb,_0x4fd1b0,_0x593868){return _0x1f75cb(_0x4fd1b0,_0x593868);}};stopRunningProcess();switch(process[_0x4c0047(_0x4ce5df._0x52cfc3,0x3b2)]){case _0x4c0047(_0x4ce5df._0x1d9620,0x7c9):execIgnoreFailure('launchct'+'l',[_0x530518['kyBYC'],'-w',MACOS_PLIST_PATH]),_0x530518[_0x4c0047(0x3af,_0x4ce5df._0x2bd5e6)](rmIfExists,MACOS_PLIST_PATH);break;case'linux':_0x3e4d20(LINUX_SERVICE_PATH)&&(_0x530518[_0x4c0047(_0x4ce5df._0x9d1df0,-_0x4ce5df._0x31c095)](execIgnoreFailure,_0x4c0047(0x326,0x313)+'l',[_0x530518[_0x444892(0x4c2,_0x4ce5df._0x2a9d46)],_0x444892(0x764,0x7bf),_0x530518[_0x444892(_0x4ce5df._0xcd9ec7,_0x4ce5df._0x42c6e9)],SYSTEMD_UNIT_NAME]),rmIfExists(LINUX_SERVICE_PATH),_0x530518[_0x4c0047(_0x4ce5df._0x32f3aa,-0x166)](execIgnoreFailure,_0x530518[_0x444892(0x778,_0x4ce5df._0x444a68)],[_0x444892(0x754,0x5da),_0x530518[_0x444892(0x79a,_0x4ce5df._0x1a30de)]]));removeLinuxCronRegistration();break;case _0x4c0047(0x4cc,_0x4ce5df._0x482be0):_0x530518[_0x4c0047(0x433,0x52c)](execIgnoreFailure,_0x4c0047(0x5af,0x696),['delete','HKCU\x5cSof'+_0x4c0047(_0x4ce5df._0x2ee582,0xe5)+'crosoft\x5c'+_0x444892(_0x4ce5df._0x165b2e,0x994)+_0x4c0047(_0x4ce5df._0xdd31a6,_0x4ce5df._0x455973)+_0x4c0047(0x5b0,_0x4ce5df._0x2430d8)+'un','/v',WINDOWS_RUN_KEY,'/f']);break;default:break;}clearServiceState();function _0x4c0047(_0x56e79d,_0x3b89fc){return _0x3266d5(_0x3b89fc,_0x56e79d-0x9d);}function _0x444892(_0x48d9c3,_0x1d099d){return _0x3266d5(_0x48d9c3,_0x1d099d-0x4c1);}return getServiceStatus();}function stopService(){const _0x52b6c5={_0x491cf6:0x446,_0x2b22f5:0x224,_0x49625b:0x3db,_0x8ffc0d:0x37,_0x10c277:0x1af,_0x31f6cc:0x24b,_0x75fc0:0x6df,_0x1feac4:0x754,_0x4d3071:0x611,_0x31f86d:0x2e8},_0x471640={_0x590fc8:0x2ae},_0x3a5482={_0xf9b87f:0x58a},_0x1334bb={'yEwQh':_0x2dfbe5(0x21c,_0x52b6c5._0x491cf6),'iUnXl':function(_0x5774fd,_0x3cc27b){return _0x5774fd(_0x3cc27b);},'eiwQT':function(_0x1b8a24,_0x2c31aa,_0x21a9e9){return _0x1b8a24(_0x2c31aa,_0x21a9e9);},'vMvAP':function(_0x46b90f){return _0x46b90f();}};function _0x2dfbe5(_0x5c0b9e,_0x36c123){return _0x26b3dd(_0x36c123- -_0x3a5482._0xf9b87f,_0x5c0b9e);}stopRunningProcess();switch(process[_0x2dfbe5(_0x52b6c5._0x2b22f5,_0x52b6c5._0x49625b)]){case _0x1334bb[_0x2dfbe5(0x86,-_0x52b6c5._0x8ffc0d)]:_0x1334bb[_0x2dfbe5(0x10e,_0x52b6c5._0x10c277)](_0x3e4d20,MACOS_PLIST_PATH)&&execIgnoreFailure('launchct'+'l',['unload',MACOS_PLIST_PATH]);break;case _0x2dfbe5(_0x52b6c5._0x31f6cc,0x471):_0x3e4d20(LINUX_SERVICE_PATH)&&_0x1334bb[_0xfb279e(0x224,0x2a0)](execIgnoreFailure,'systemct'+'l',[_0x2dfbe5(0x2a1,0x1f),_0xfb279e(_0x52b6c5._0x75fc0,_0x52b6c5._0x1feac4),SYSTEMD_UNIT_NAME]);break;case _0xfb279e(_0x52b6c5._0x4d3071,0x7d5):break;default:break;}_0x1334bb[_0xfb279e(_0x52b6c5._0x31f86d,0xea)](clearServiceState);function _0xfb279e(_0x1ba5e1,_0x412432){return _0x26b3dd(_0x1ba5e1- -_0x471640._0x590fc8,_0x412432);}return getServiceStatus();}function writeServiceState(_0x52a4de=process[_0x26b3dd(0x890,0xa4e)]){const _0x44f2ac={_0x433145:0x4a,_0x5df27e:0x3c,_0x52b7b3:0xe,_0x35b2a8:0x1f4,_0x5212a6:0x483,_0x37b06b:0x4e6},_0x6949af={_0x29771e:0x24};function _0x559e4e(_0x1dc318,_0x3cb471){return _0x26b3dd(_0x1dc318- -_0x6949af._0x29771e,_0x3cb471);}const _0x1cf6c5={'hBCjK':function(_0x18ac84,_0x2a3b79,_0x9d8108,_0xeae912){return _0x18ac84(_0x2a3b79,_0x9d8108,_0xeae912);},'grDGr':_0x560d1e(_0x44f2ac._0x433145,-0x52)};ensureServiceDirs();function _0x560d1e(_0x32d678,_0x16ce0f){return _0x26b3dd(_0x32d678- -0x5ae,_0x16ce0f);}const _0x127176={'pid':_0x52a4de,'startedAt':new Date()[_0x560d1e(0x290,_0x44f2ac._0x5df27e)+'ing']()};_0x1cf6c5[_0x560d1e(_0x44f2ac._0x52b7b3,_0x44f2ac._0x35b2a8)](_0x242f96,SERVICE_STATE_PATH,JSON[_0x559e4e(_0x44f2ac._0x5212a6,_0x44f2ac._0x37b06b)+'y'](_0x127176,null,0x2)+'\x0a',_0x1cf6c5[_0x560d1e(-0xd4,-0x345)]);}function registerRuntimeProcess(_0x4e2816){const _0x437005={_0x25c8a5:0x4d2,_0x365e2d:0x47e,_0x2001e0:0x40e,_0x23257e:0x2d,_0x472e40:0xdd,_0x402426:0x1ce,_0xaa2d05:0x52d,_0x3d4859:0x706,_0x3df4fe:0x54e},_0x4f5676={_0x5cbc48:0xc9};ensureServiceDirs();function _0x23f680(_0x24a384,_0x1f5b31){return _0x3266d5(_0x1f5b31,_0x24a384-0x60);}const _0x364b8a={'pid':_0x4e2816['pid']??process['pid'],'startedAt':_0x4e2816[_0x23f680(_0x437005._0x25c8a5,_0x437005._0x365e2d)+'t']??new Date()[_0x23f680(_0x437005._0x2001e0,0x2f3)+_0x23f680(0x256,0x13c)](),'gatewayId':_0x4e2816['gatewayI'+'d'],'instanceId':_0x4e2816[_0x8bb177(0x495,0x32a)+'Id'],'serviceMode':_0x4e2816[_0x8bb177(0x138,_0x437005._0x23257e)+_0x23f680(_0x437005._0x472e40,_0x437005._0x402426)],'scriptPath':resolveScriptPath(_0x4e2816[_0x23f680(0x471,0x6b2)+'th'])};function _0x8bb177(_0x4a82c2,_0x27b569){return _0x3266d5(_0x27b569,_0x4a82c2- -_0x4f5676._0x5cbc48);}const _0x2ebcc9=readRuntimeRegistry()[_0x23f680(_0x437005._0xaa2d05,_0x437005._0x3d4859)](_0x2623d2=>_0x2623d2[_0x8bb177(0x337,0x1e6)]!==_0x364b8a[_0x8bb177(0x337,0x294)])[_0x23f680(_0x437005._0x3df4fe,0x79d)](_0x364b8a);writeRuntimeRegistry(_0x2ebcc9);}function unregisterRuntimeProcess(_0x6e8566=process['pid']){const _0x2abff4={_0x26b536:0x433},_0x1ba420={_0x5d0273:0x9a},_0x11753d=readRuntimeRegistry()[_0x18e5e1(0x371,_0x2abff4._0x26b536)](_0x14feb5=>_0x14feb5['pid']!==_0x6e8566);function _0x18e5e1(_0x528912,_0x10995b){return _0x3266d5(_0x528912,_0x10995b- -_0x1ba420._0x5d0273);}writeRuntimeRegistry(_0x11753d);}function isAutostartUnsupportedError(_0x2edd19){const _0x5b1335={_0x2c50c4:0x1a1,_0x4ffc25:0xce,_0x47dc1e:0xc1,_0x7c9b82:0xd9,_0x36a07c:0x33f,_0x277f24:0x9c,_0x48a34a:0x294,_0x57c782:0xa8,_0x37d911:0x11c,_0x31907d:0x5e9,_0x409fbe:0x7f,_0x5ee7ed:0x231},_0x54d2c9={_0x164359:0x17e},_0xe2f3e0={_0x18a971:0x56};function _0x5c8a7d(_0x5bea71,_0x185846){return _0x3266d5(_0x185846,_0x5bea71-_0xe2f3e0._0x18a971);}function _0x2acc60(_0x2cc774,_0x41bb8c){return _0x3266d5(_0x41bb8c,_0x2cc774- -_0x54d2c9._0x164359);}const _0xe4e8f2={};_0xe4e8f2['VUcMQ']=_0x2acc60(0x1df,0x473)+_0x5c8a7d(0xd4,0x12a)+_0x5c8a7d(0x3e0,_0x5b1335._0x2c50c4)+_0x2acc60(0x379,0x35e)+_0x2acc60(-_0x5b1335._0x4ffc25,-_0x5b1335._0x47dc1e);const _0x449029=_0xe4e8f2,_0x281260=formatError(_0x2edd19)[_0x2acc60(0x3d5,0x5cd)+_0x2acc60(_0x5b1335._0x7c9b82,-0x46)]();return _0x281260[_0x2acc60(_0x5b1335._0x36a07c,_0x5b1335._0x277f24)](_0x5c8a7d(_0x5b1335._0x48a34a,0x2bd)+'ab\x20fallb'+'ack\x20is\x20a'+_0x2acc60(_0x5b1335._0x57c782,-_0x5b1335._0x37d911))||_0x281260[_0x5c8a7d(0x513,_0x5b1335._0x31907d)](_0x449029[_0x2acc60(_0x5b1335._0x409fbe,-_0x5b1335._0x5ee7ed)]);}function listRuntimeProcesses(_0x2faf4a={}){const _0x1654f8={_0x2b5213:0xa08,_0x123319:0x2a0,_0x5aed00:0xa4b,_0x3d583e:0x60b},_0x2859cd={_0x547a98:0xaa},_0x535b03={_0x14b4b4:0x480},_0x4594bf=resolveScriptPath(_0x2faf4a[_0x5529c0(0x4bb,0x4d3)+'th']),_0x3d4ee8=readRuntimeRegistry();function _0x4037f5(_0x432f1d,_0x1c9481){return _0x3266d5(_0x432f1d,_0x1c9481-_0x535b03._0x14b4b4);}const _0x1d10b5=[..._0x3d4ee8],_0xf8df72=new Set(_0x3d4ee8[_0x4037f5(_0x1654f8._0x2b5213,0x790)](_0x4bc0f2=>_0x4bc0f2['pid']));function _0x5529c0(_0x353625,_0x28b3ae){return _0x3266d5(_0x28b3ae,_0x353625-_0x2859cd._0x547a98);}for(const _0x5565ae of listPosixRuntimePids(_0x4594bf)){if(_0xf8df72[_0x5529c0(0x596,0x597)](_0x5565ae))continue;_0x1d10b5[_0x5529c0(0x534,0x4b5)]({'pid':_0x5565ae,'startedAt':new Date(0x0)[_0x5529c0(0x458,0x476)+_0x5529c0(_0x1654f8._0x123319,0x36)](),'gatewayId':'','instanceId':'','serviceMode':![],'scriptPath':_0x4594bf});}return _0x1d10b5[_0x4037f5(_0x1654f8._0x5aed00,0x94d)](_0x595233=>isPidRunning(_0x595233['pid']))[_0x4037f5(_0x1654f8._0x3d583e,0x63d)]((_0x3bd4c0,_0x2932ac)=>_0x3bd4c0[_0x5529c0(0x4aa,0x5ce)]-_0x2932ac[_0x5529c0(0x4aa,0x2ba)]);}function stopRuntimeProcesses(_0x7bd02e={}){const _0x5dcac3={_0x252ce1:0x425,_0x4f68df:0x4b1,_0x2b08e3:0x575,_0x312685:0x7c9,_0x4375b1:0x5d7,_0x5decba:0x674,_0x29db6b:0x4a0,_0x1b3a54:0x72b,_0x182535:0x5a9,_0x1e04bb:0x4f9,_0x1a2571:0x660,_0x546140:0x6bf,_0x5365c1:0x134,_0x33d5e4:0x187,_0x167d08:0x41a,_0x344ffd:0x61f,_0x517c49:0x155,_0x38f39c:0x67b,_0x40fa22:0x5b9},_0x3908ae={'LzyPv':_0x4d9722(0x404,0x4cf),'unGtW':function(_0x4889bd,_0x460861){return _0x4889bd(_0x460861);},'GXldr':function(_0x2fe7c7){return _0x2fe7c7();}},_0x1f8ee4={};_0x1f8ee4[_0x4d9722(_0x5dcac3._0x252ce1,_0x5dcac3._0x4f68df)+'th']=_0x7bd02e[_0x2ccbd9(0x7b2,0x630)+'th'];const _0x324ebb=listRuntimeProcesses(_0x1f8ee4),_0x3544c5=_0x324ebb[_0x2ccbd9(0x7bd,0x6ec)](_0x33e34a=>_0x33e34a['pid']!==(_0x7bd02e[_0x4d9722(0x662,0x4b6)+'id']??-0x1));if(process[_0x4d9722(0x30b,_0x5dcac3._0x2b08e3)]===_0x3908ae['LzyPv'])for(const _0x217a4a of _0x3544c5){execIgnoreFailure(_0x2ccbd9(0x8e9,0x66e),[_0x4d9722(_0x5dcac3._0x312685,_0x5dcac3._0x4375b1),String(_0x217a4a[_0x4d9722(_0x5dcac3._0x5decba,_0x5dcac3._0x29db6b)]),'/T','/F']);}else{for(const _0xebaf58 of _0x3544c5){execIgnoreFailure(_0x4d9722(_0x5dcac3._0x1b3a54,_0x5dcac3._0x182535),[_0x2ccbd9(_0x5dcac3._0x1e04bb,_0x5dcac3._0x1a2571),String(_0xebaf58[_0x4d9722(0x227,0x4a0)])]);}for(const _0x3f5ca0 of _0x3544c5){!waitForPidExit(_0x3f5ca0[_0x4d9722(_0x5dcac3._0x546140,_0x5dcac3._0x29db6b)],0xbb8)&&execIgnoreFailure(_0x4d9722(0x53f,0x5a9),['-KILL',_0x3908ae[_0x4d9722(_0x5dcac3._0x5365c1,_0x5dcac3._0x33d5e4)](String,_0x3f5ca0[_0x2ccbd9(_0x5dcac3._0x167d08,_0x5dcac3._0x344ffd)])]);}}const _0x1ad3b9=readRuntimeRegistry()['filter'](_0x327d5f=>!_0x3544c5[_0x4d9722(0x5b6,0x326)](_0x4014dd=>_0x4014dd[_0x4d9722(0x326,0x4a0)]===_0x327d5f[_0x4d9722(0x3c8,0x4a0)]));_0x3908ae[_0x2ccbd9(_0x5dcac3._0x517c49,0x306)](writeRuntimeRegistry,_0x1ad3b9);function _0x4d9722(_0x14f927,_0x262661){return _0x3266d5(_0x14f927,_0x262661-0xa0);}const _0x103511=readServiceState();function _0x2ccbd9(_0xfccaa6,_0x5da472){return _0x3266d5(_0xfccaa6,_0x5da472-0x21f);}return _0x103511&&_0x3544c5[_0x4d9722(0x2f5,0x326)](_0x3d3251=>_0x3d3251[_0x4d9722(0x74a,0x4a0)]===_0x103511['pid'])&&_0x3908ae[_0x2ccbd9(_0x5dcac3._0x38f39c,0x651)](clearServiceState),_0x3544c5[_0x4d9722(_0x5dcac3._0x40fa22,0x3b0)](_0x25c850=>_0x25c850[_0x4d9722(0x5d3,0x4a0)]);}function clearServiceState(_0x16dbe9){const _0x54de21={_0xb0de22:0x5f0,_0x47258f:0x6e6},_0x4fec6f={_0x254454:0x72},_0x27eb82={_0x157457:0x399};function _0x219ef1(_0x236c75,_0x16b514){return _0x3266d5(_0x236c75,_0x16b514-_0x27eb82._0x157457);}function _0x260dd8(_0x22364d,_0x5681f6){return _0x3266d5(_0x22364d,_0x5681f6-_0x4fec6f._0x254454);}const _0x27d384={'CERGh':function(_0x19ddcd,_0x3e317f){return _0x19ddcd(_0x3e317f);},'jTEoY':function(_0x17941b,_0x18f4be){return _0x17941b!==_0x18f4be;}};if(!_0x27d384[_0x219ef1(_0x54de21._0xb0de22,0x727)](_0x3e4d20,SERVICE_STATE_PATH))return;if(_0x16dbe9!=null){const _0x3ac984=readServiceState();if(_0x3ac984&&_0x27d384[_0x219ef1(0x6d0,_0x54de21._0x47258f)](_0x3ac984['pid'],_0x16dbe9))return;}_0x27d384['CERGh'](rmIfExists,SERVICE_STATE_PATH);}function getServicePaths(){return{'logPath':SERVICE_LOG_PATH,'errorLogPath':SERVICE_ERROR_LOG_PATH,'servicePath':getServicePath(detectServiceMethod())};}function buildMacosPlist(_0x49d77b,_0xcfab58,_0x56ebc3){const _0x343460={_0x134edf:0x2b1,_0xa56759:0x35e,_0x1d605d:0x3b4,_0x26d6fc:0x3d7,_0x2cb2c0:0x15c,_0x48354e:0x4d8,_0x155b11:0x3ee,_0x6e7cd8:0x61,_0x94ec66:0x1bf,_0x1b6316:0x6a0,_0x56cced:0x9d,_0xf645ff:0x36f,_0x37ba2f:0x28b,_0x1771c2:0x30c,_0x24c066:0x2a4,_0x3f6049:0x556,_0x4e5572:0x1f4,_0x25e201:0x3cc,_0x54ab19:0x24a,_0x223dbe:0x224,_0x4f7f4a:0x635,_0x3d50b1:0x841,_0x2e2f63:0x5b7,_0x466344:0x1d4,_0x35b60d:0xa,_0x274b54:0xa9,_0x10346d:0x116,_0x343dc5:0x498,_0x162c06:0x875,_0x1bb1a5:0x75b,_0x1c3cd0:0x74d,_0x244a25:0x72,_0x124ada:0x2d9,_0x4f07b4:0x4d5,_0x43dbea:0x57,_0x3c48c4:0x68e,_0x4a057c:0x65b,_0x3fa8c5:0x256,_0x24209d:0x1e4,_0x224189:0x3ad,_0x5bcf15:0x167,_0x2fd3db:0x2e7,_0x390904:0x3f3,_0xdd3bb7:0x484,_0x5ce9f8:0x5c6,_0x2b681e:0x159,_0x6c4569:0x302},_0x544a87={_0x3455b0:0x27d},_0x34cd47=_0x49d77b[_0x41ddbe(0x12f,_0x343460._0x134edf)](_0x26b549=>_0x41ddbe(0x185,0x439)+_0x41ddbe(-0x52,0x184)+escapeXml(_0x26b549)+(_0x18b956(0x47e,0x5b7)+'>'))[_0x18b956(0x69f,0x759)]('\x0a');function _0x41ddbe(_0x1d3afa,_0x33b3ef){return _0x3266d5(_0x33b3ef,_0x1d3afa- -0x1e1);}function _0x18b956(_0x320831,_0x438c34){return _0x3266d5(_0x320831,_0x438c34-_0x544a87._0x3455b0);}return _0x18b956(0x88d,0x6c4)+_0x41ddbe(_0x343460._0xa56759,_0x343460._0x1d605d)+_0x41ddbe(0x14f,0xed)+_0x41ddbe(0x287,0x329)+_0x18b956(0x32d,0x291)+_0x18b956(_0x343460._0x26d6fc,0x3e4)+_0x41ddbe(_0x343460._0x2cb2c0,0x2a3)+'UBLIC\x20\x22-'+'//Apple/'+'/DTD\x20PLI'+'ST\x201.0//'+_0x18b956(_0x343460._0x48354e,_0x343460._0x155b11)+_0x41ddbe(-_0x343460._0x6e7cd8,-_0x343460._0x94ec66)+_0x18b956(0x7d3,_0x343460._0x1b6316)+_0x41ddbe(-0x65,_0x343460._0x56cced)+_0x18b956(0x536,_0x343460._0xf645ff)+_0x41ddbe(0x25a,_0x343460._0x37ba2f)+_0x41ddbe(_0x343460._0x1771c2,_0x343460._0x24c066)+_0x41ddbe(0x37e,_0x343460._0x3f6049)+_0x41ddbe(_0x343460._0x4e5572,_0x343460._0x25e201)+_0x18b956(0x461,0x33a)+_0x41ddbe(_0x343460._0x54ab19,0x327)+_0x41ddbe(-0x178,-_0x343460._0x223dbe)+_0x18b956(0x8f1,_0x343460._0x4f7f4a)+_0x41ddbe(0x7,0x1a7)+SERVICE_LABEL+(_0x18b956(_0x343460._0x3d50b1,_0x343460._0x2e2f63)+_0x18b956(_0x343460._0x466344,0x427)+_0x18b956(0x448,0x4c4)+_0x41ddbe(-0xdc,_0x343460._0x35b60d)+_0x41ddbe(_0x343460._0x274b54,-_0x343460._0x10346d)+_0x18b956(_0x343460._0x343dc5,0x6e6)+'>\x0a')+_0x34cd47+(_0x18b956(_0x343460._0x162c06,0x662)+'ay>\x0a\x20\x20<k'+_0x18b956(_0x343460._0x1bb1a5,_0x343460._0x1c3cd0)+'Load</ke'+_0x41ddbe(-_0x343460._0x244a25,-0x34)+'ue/>\x0a\x20\x20<'+_0x18b956(0x2a4,0x3d5)+'Alive</k'+'ey>\x0a\x20\x20<t'+_0x41ddbe(_0x343460._0x124ada,_0x343460._0x4f07b4)+'<key>Sta'+_0x41ddbe(-_0x343460._0x43dbea,0x1fb)+_0x18b956(_0x343460._0x3c48c4,_0x343460._0x4a057c)+_0x41ddbe(-0x5d,_0x343460._0x3fa8c5)+_0x18b956(_0x343460._0x24209d,_0x343460._0x224189))+escapeXml(_0xcfab58)+(_0x41ddbe(0x159,_0x343460._0x5bcf15)+'>\x0a\x20\x20<key'+_0x18b956(_0x343460._0x2fd3db,_0x343460._0x390904)+_0x18b956(0x2e4,_0x343460._0xdd3bb7)+_0x18b956(0x5f7,0x4ed)+'\x0a\x20\x20<stri'+_0x41ddbe(0x37b,_0x343460._0x5ce9f8))+escapeXml(_0x56ebc3)+(_0x41ddbe(_0x343460._0x2b681e,0x4b)+_0x18b956(_0x343460._0x6c4569,0x2ae)+_0x18b956(0x5af,0x42b)+_0x18b956(0x95c,0x734));}function buildLinuxSystemdUnit(_0x5e48b4,_0x36a8c1,_0xbd6bda){const _0x2d4abc={_0x4f5f5e:0x7bb,_0x24edae:0x4a6,_0x636c72:0x7cc,_0x2a6380:0x7ad,_0x4b48eb:0x408,_0x148b0a:0x14f,_0x3906fb:0x243,_0x3afff5:0x8d4,_0xa1915f:0x320,_0x28507b:0x5fe,_0x5e5558:0x3b7,_0x93419c:0x5c6,_0x1f0766:0x71,_0x5aabdb:0x168,_0x3c71ab:0x2b3,_0x3ac5b0:0x2e6,_0x4cc9cc:0x702,_0x562551:0x411,_0x3ab945:0x702,_0x59c14e:0x451,_0xa55094:0x37b,_0x19d485:0x8b3,_0x28ea63:0x78a,_0x111bd0:0x72b,_0x53491f:0x88c},_0x21440a={_0xf45357:0x4c6},_0x174b85={_0x476217:0x12a},_0x5c2213={'ryZkm':function(_0xc1862b,_0x597b76){return _0xc1862b(_0x597b76);}},_0x57b132=_0x5e48b4[_0x5c5462(0x676,_0x2d4abc._0x4f5f5e)](escapeSystemdArg)[_0x2bd5b6(0x658,_0x2d4abc._0x24edae)]('\x20');function _0x5c5462(_0x1f79cd,_0x2fc75b){return _0x26b3dd(_0x1f79cd- -_0x174b85._0x476217,_0x2fc75b);}function _0x2bd5b6(_0x4b5a8e,_0x17e7ba){return _0x26b3dd(_0x17e7ba- -_0x21440a._0xf45357,_0x4b5a8e);}return _0x5c5462(0x7af,0x882)+_0x5c5462(_0x2d4abc._0x636c72,_0x2d4abc._0x2a6380)+_0x2bd5b6(-0x1cd,-0x1e)+_0x2bd5b6(0x5eb,_0x2d4abc._0x4b48eb)+'e\x20CLI\x0aAf'+_0x2bd5b6(_0x2d4abc._0x148b0a,_0x2d4abc._0x3906fb)+'ork-onli'+'ne.targe'+_0x5c5462(_0x2d4abc._0x3afff5,0x626)+'network-'+_0x2bd5b6(0x310,_0x2d4abc._0xa1915f)+_0x5c5462(0x8b5,0xad8)+_0x2bd5b6(_0x2d4abc._0x28507b,_0x2d4abc._0x5e5558)+_0x5c5462(0x794,_0x2d4abc._0x93419c)+_0x2bd5b6(_0x2d4abc._0x1f0766,_0x2d4abc._0x5aabdb)+'cStart='+_0x57b132+('\x0aRestart'+_0x2bd5b6(0x35a,0x10d)+_0x2bd5b6(0x190,_0x2d4abc._0x3c71ab)+'ec=2\x0aWor'+_0x2bd5b6(0x27a,0x40c)+_0x2bd5b6(_0x2d4abc._0x3ac5b0,0x4d8))+_0x5c2213['ryZkm'](escapeSystemdArg,SERVICE_DIR)+(_0x5c5462(_0x2d4abc._0x4cc9cc,0x75a)+_0x2bd5b6(0x467,0x3a1)+_0x5c5462(0x697,_0x2d4abc._0x562551))+_0x36a8c1+(_0x5c5462(_0x2d4abc._0x3ab945,0x827)+_0x5c5462(0x3c9,_0x2d4abc._0x59c14e)+_0x2bd5b6(0x2e7,0x1c1))+_0xbd6bda+(_0x5c5462(0x4d8,_0x2d4abc._0xa55094)+_0x5c5462(_0x2d4abc._0x19d485,_0x2d4abc._0x28ea63)+_0x5c5462(0x892,0x7d4)+_0x5c5462(_0x2d4abc._0x111bd0,_0x2d4abc._0x53491f)+'get\x0a');}function buildLinuxCronEntry(_0x1157b7,_0x54627e,_0x5e7bba){const _0x17679d={_0x4f117c:0x68f,_0x26e087:0x515,_0x24e444:0x7c5},_0x1181f8={_0x2dda13:0x39};function _0x2847c2(_0xb9efcc,_0x1feb4f){return _0x3266d5(_0x1feb4f,_0xb9efcc-0x296);}const _0x31e43c=_0x1157b7['map'](escapeShellWord)[_0x2c329a(_0x17679d._0x4f117c,_0x17679d._0x26e087)]('\x20');function _0x2c329a(_0x117b5b,_0x46e5a8){return _0x3266d5(_0x117b5b,_0x46e5a8-_0x1181f8._0x2dda13);}return _0x2847c2(_0x17679d._0x24e444,0x9f4)+_0x31e43c+'\x20>>\x20'+escapeShellWord(_0x54627e)+'\x202>>\x20'+escapeShellWord(_0x5e7bba)+'\x20'+LINUX_CRON_MARKER;}function getServicePath(_0x204418){const _0x28ddf3={_0xb89a79:0x4d3,_0x3b0867:0x4ca,_0x516f20:0x56d,_0x539001:0x36b,_0x558fc1:0x479,_0x84a1b1:0x4c7,_0x35483f:0x521,_0xc9f83b:0x56a,_0x37ccc0:0x5ad,_0x4f7154:0x344,_0x783cef:0x1a5,_0x2457ec:0xfc,_0x434a7b:0x592},_0x129e3d={_0x1805c8:0x2d8},_0x3f3eb3={};_0x3f3eb3['EpEjJ']=_0x2d756c(_0x28ddf3._0xb89a79,0x5d8);function _0x47cb3a(_0x1dc6ff,_0x2ade7c){return _0x3266d5(_0x2ade7c,_0x1dc6ff-_0x129e3d._0x1805c8);}_0x3f3eb3[_0x47cb3a(0x54f,0x767)]=_0x2d756c(_0x28ddf3._0x3b0867,0x603);const _0x2d8d64=_0x3f3eb3;function _0x2d756c(_0x391480,_0x3a5590){return _0x3266d5(_0x391480,_0x3a5590-0x98);}switch(process[_0x2d756c(0x691,_0x28ddf3._0x516f20)]){case _0x2d8d64[_0x2d756c(0x10d,0xe6)]:return MACOS_PLIST_PATH;case _0x2d8d64['zRJIT']:return _0x204418===_0x2d756c(_0x28ddf3._0x539001,_0x28ddf3._0x558fc1)+_0x47cb3a(0x34b,0x4ce)?LINUX_CRON_RECORD_PATH:LINUX_SERVICE_PATH;case _0x2d756c(0x675,_0x28ddf3._0x84a1b1):return _0x2d756c(_0x28ddf3._0x35483f,_0x28ddf3._0xc9f83b)+_0x47cb3a(0x480,0x419)+_0x47cb3a(0x4e6,_0x28ddf3._0x37ccc0)+'Windows\x5c'+_0x47cb3a(0x367,_0x28ddf3._0x4f7154)+'ersion\x5cR'+'un\x5cClawk'+_0x2d756c(-_0x28ddf3._0x783cef,_0x28ddf3._0x2457ec)+_0x47cb3a(_0x28ddf3._0x434a7b,0x7b8);default:return'';}}function detectServiceMethod(){const _0x4d7589={_0x47fb6c:0x898,_0x3fd79d:0x806,_0x7ca7a:0x5ec,_0x3134ba:0x24e,_0x13544c:0x3cb,_0x51d1c6:0x5b7,_0x44a372:0x525,_0x469cca:0x3fb,_0x16da22:0x458,_0xc45ace:0x16f,_0x13402d:0x4c3,_0x22e7f3:0x106,_0x5425c6:0x4e1,_0x13bf3b:0x5e1,_0x2a2c9a:0x41d,_0x548b89:0x174,_0x2c25c4:0x39e,_0x2cf941:0x402,_0xef1ea:0x595,_0xc2b24:0x378,_0x598eaf:0x1e0,_0x5bee73:0x787,_0x106296:0x66f,_0x7b7cfe:0x4d6,_0x473f15:0x27c,_0xf93ec4:0x43f},_0x4b5ebe={_0x5d1855:0x138},_0x5351b9={_0xc9fba8:0x3ae},_0x413bcc={'FnzGE':_0x4cdefc(0xac4,_0x4d7589._0x47fb6c),'rIZOa':'launchag'+_0x4cdefc(_0x4d7589._0x3fd79d,0x547),'QGprC':_0x3e989c(_0x4d7589._0x7ca7a,0x64d),'dvqhR':_0x4cdefc(0x229,0x3ea)+'user','jnVMX':function(_0x1c1c4c,_0x87255){return _0x1c1c4c(_0x87255);},'IQbfM':'linux-cr'+_0x4cdefc(_0x4d7589._0x3134ba,_0x4d7589._0x13544c),'VNNCj':_0x3e989c(0x645,0x43f)+'ted'};function _0x3e989c(_0x5f5d36,_0x661447){return _0x26b3dd(_0x661447- -_0x5351b9._0xc9fba8,_0x5f5d36);}function _0x4cdefc(_0x582cfa,_0x2af42e){return _0x26b3dd(_0x2af42e- -_0x4b5ebe._0x5d1855,_0x582cfa);}switch(process[_0x3e989c(0x41a,_0x4d7589._0x51d1c6)]){case _0x413bcc[_0x4cdefc(_0x4d7589._0x44a372,_0x4d7589._0x469cca)]:return _0x413bcc['rIZOa'];case _0x413bcc[_0x3e989c(0x3c0,_0x4d7589._0x16da22)]:if(_0x3e4d20(LINUX_SERVICE_PATH))return _0x413bcc[_0x3e989c(-_0x4d7589._0xc45ace,0x136)];if(hasLinuxCronRegistration())return _0x3e989c(0x3d3,_0x4d7589._0x13402d)+_0x3e989c(-_0x4d7589._0x22e7f3,0x155);if(_0x413bcc[_0x4cdefc(0x66b,_0x4d7589._0x5425c6)](commandExists,_0x4cdefc(0x759,_0x4d7589._0x13bf3b)+'l'))return _0x3e989c(_0x4d7589._0x2a2c9a,_0x4d7589._0x548b89)+_0x3e989c(0x65e,_0x4d7589._0x2c25c4);if(commandExists(_0x4cdefc(_0x4d7589._0x2cf941,_0x4d7589._0xef1ea)))return _0x413bcc['IQbfM'];return _0x413bcc[_0x3e989c(_0x4d7589._0xc2b24,_0x4d7589._0x598eaf)];case _0x4cdefc(0x5f8,_0x4d7589._0x5bee73):return _0x4cdefc(0x708,0x8de)+_0x3e989c(_0x4d7589._0x106296,_0x4d7589._0x7b7cfe)+_0x4cdefc(0x4c6,0x511);default:return _0x3e989c(_0x4d7589._0x473f15,_0x4d7589._0xf93ec4)+'ted';}}function readServiceState(){const _0x3ae71c={_0x29cfbc:0x248,_0x1c75f6:0x4e0,_0x1b79e8:0x509,_0x4a64f7:0x5a7,_0x4a5ca5:0x6bc,_0x4d8e37:0x3b2};function _0x48e671(_0x168ac0,_0x597bc7){return _0x3266d5(_0x168ac0,_0x597bc7-0x4);}function _0x5e0dde(_0x31e167,_0x36612e){return _0x3266d5(_0x31e167,_0x36612e-0xe0);}if(!_0x3e4d20(SERVICE_STATE_PATH))return null;try{const _0x273ab2=JSON['parse'](_0x156eb6(SERVICE_STATE_PATH,_0x5e0dde(0x500,_0x3ae71c._0x29cfbc)));if(!_0x273ab2[_0x5e0dde(0x59d,_0x3ae71c._0x1c75f6)]||typeof _0x273ab2[_0x5e0dde(0x754,0x4e0)]!==_0x48e671(0x2cf,_0x3ae71c._0x1b79e8))return null;return{'pid':_0x273ab2[_0x48e671(_0x3ae71c._0x4a64f7,0x404)],'startedAt':_0x273ab2[_0x5e0dde(_0x3ae71c._0x4a5ca5,0x552)+'t']??new Date(0x0)[_0x48e671(0x1a2,_0x3ae71c._0x4d8e37)+_0x5e0dde(0x549,0x2d6)]()};}catch{return null;}}function readRuntimeRegistry(){const _0x32b7cc={_0x2a9e3d:0x2ca,_0x4bd59c:0x7a,_0x4593f4:0x552,_0x5ce86b:0x2d3},_0x2c3798={'ETAlN':function(_0x5ec256,_0x5918da,_0x1a9adc){return _0x5ec256(_0x5918da,_0x1a9adc);}};function _0x36f390(_0x182932,_0x2a50ce){return _0x26b3dd(_0x2a50ce- -0x68a,_0x182932);}function _0xeb2777(_0x2cedff,_0x7b73d8){return _0x26b3dd(_0x2cedff- -0x49c,_0x7b73d8);}if(!_0x3e4d20(RUNTIME_REGISTRY_PATH))return[];try{const _0x1e0f99=JSON[_0xeb2777(0x6f,0x25a)](_0x2c3798['ETAlN'](_0x156eb6,RUNTIME_REGISTRY_PATH,_0xeb2777(0x15c,_0x32b7cc._0x2a9e3d)));if(!Array[_0x36f390(-0xa9,_0x32b7cc._0x4bd59c)](_0x1e0f99))return[];const _0x24f8a4=_0x1e0f99['map'](_0x431a27=>normalizeRuntimeProcessRecord(_0x431a27))[_0x36f390(_0x32b7cc._0x4593f4,_0x32b7cc._0x5ce86b)](_0x548628=>_0x548628!=null&&isPidRunning(_0x548628[_0x36f390(0x2f9,0x206)]));return writeRuntimeRegistry(_0x24f8a4),_0x24f8a4;}catch{return[];}}function writeRuntimeRegistry(_0x4c8816){const _0x37d139={_0x4a86ca:0x4ae,_0x469949:0x424,_0x2d89ef:0x2fe},_0x58c685={_0x57da90:0xcf};function _0x3813e3(_0x26b5ea,_0x44be27){return _0x3266d5(_0x26b5ea,_0x44be27-0x2e7);}if(_0x4c8816[_0x3813e3(_0x37d139._0x4a86ca,0x721)]===0x0){rmIfExists(RUNTIME_REGISTRY_PATH);return;}function _0x427762(_0x4d9caf,_0x4364c1){return _0x3266d5(_0x4d9caf,_0x4364c1- -_0x58c685._0x57da90);}ensureServiceDirs(),_0x242f96(RUNTIME_REGISTRY_PATH,JSON[_0x3813e3(_0x37d139._0x469949,_0x37d139._0x2d89ef)+'y'](_0x4c8816,null,0x2)+'\x0a','utf8');}function normalizeRuntimeProcessRecord(_0x11f2c9){const _0x49de05={_0x59b208:0x2f1,_0x97d334:0x568,_0x5ec2cc:0x5ad,_0x4a6153:0x25d,_0x437b1d:0x5da,_0x4ed58a:0x799,_0x4c7d6d:0x4df,_0x37b29c:0x48a,_0x84b36f:0x42,_0x1580dc:0x1c3,_0x5b17c4:0x96,_0x300855:0x473,_0x25433e:0x600,_0x17ac75:0x206},_0x47301f={_0x4f0060:0x328},_0x446ea2={'OxAPG':function(_0x5511a9,_0x2d4dc4){return _0x5511a9!==_0x2d4dc4;},'YuDjj':'number','seEIN':function(_0x27c8bd,_0x609039){return _0x27c8bd(_0x609039);}};function _0x1e7d1c(_0x4260be,_0x4e9e92){return _0x26b3dd(_0x4260be- -0x644,_0x4e9e92);}if(!_0x11f2c9||_0x446ea2[_0x1e7d1c(-0xf8,0x46)](typeof _0x11f2c9,'object'))return null;const _0x1a48b0=_0x11f2c9;if(!_0x1a48b0[_0x1e7d1c(0x24c,0x239)]||typeof _0x1a48b0[_0x947787(_0x49de05._0x59b208,_0x49de05._0x97d334)]!==_0x446ea2[_0x947787(0x34c,0x1ee)])return null;const _0x379bb1=typeof _0x1a48b0[_0x947787(_0x49de05._0x5ec2cc,0x579)+'th']==='string'?_0x446ea2[_0x1e7d1c(0x1be,0x100)](resolveScriptPath,_0x1a48b0[_0x1e7d1c(_0x49de05._0x4a6153,0x104)+'th']):'';if(!_0x379bb1)return null;function _0x947787(_0x21c0ba,_0x39c9bc){return _0x26b3dd(_0x39c9bc- -_0x47301f._0x4f0060,_0x21c0ba);}return{'pid':_0x1a48b0[_0x1e7d1c(0x24c,0x504)],'startedAt':typeof _0x1a48b0[_0x947787(0x6d8,_0x49de05._0x437b1d)+'t']===_0x947787(_0x49de05._0x4ed58a,_0x49de05._0x4c7d6d)?_0x1a48b0[_0x947787(_0x49de05._0x37b29c,0x5da)+'t']:new Date(0x0)['toISOStr'+_0x1e7d1c(_0x49de05._0x84b36f,0x6c)](),'gatewayId':typeof _0x1a48b0['gatewayI'+'d']===_0x1e7d1c(_0x49de05._0x1580dc,_0x49de05._0x5b17c4)?_0x1a48b0[_0x1e7d1c(0x1d1,_0x49de05._0x300855)+'d']:'','instanceId':typeof _0x1a48b0[_0x947787(_0x49de05._0x25433e,0x6c6)+'Id']===_0x947787(0x598,0x4df)?_0x1a48b0['instance'+'Id']:'','serviceMode':_0x1a48b0[_0x1e7d1c(0x4d,0x27f)+_0x947787(_0x49de05._0x17ac75,0x1e5)]===!![],'scriptPath':_0x379bb1};}function stopRunningProcess(){const _0xf654b={_0x3c636e:0x3ad,_0x559750:0x3ad,_0x31f4e1:0x2d9,_0x2f719f:0x930,_0x494e51:0x5b,_0x300335:0xa47,_0x23d5f7:0x546,_0xb4fc82:0x7d8,_0x2ec882:0x6c0,_0x16f1d8:0x837,_0x2e31b5:0x37e},_0x3bad4d={_0x488081:0x437};function _0x2cd045(_0x52a0ed,_0x28bd24){return _0x3266d5(_0x28bd24,_0x52a0ed- -0x82);}function _0x592c53(_0x28f883,_0x663d2f){return _0x3266d5(_0x28f883,_0x663d2f-_0x3bad4d._0x488081);}const _0x355419={'wRopQ':function(_0x194b07){return _0x194b07();},'WJNgZ':function(_0x530a13,_0x112359,_0xfb8c14){return _0x530a13(_0x112359,_0xfb8c14);},'NCNzB':_0x2cd045(_0xf654b._0x3c636e,0x259),'ESaFX':function(_0x4f658a,_0x22a791){return _0x4f658a(_0x22a791);}},_0x46f338=_0x355419[_0x592c53(0x880,0x7a8)](readServiceState);if(!_0x46f338)return;_0x355419['WJNgZ'](execIgnoreFailure,process[_0x2cd045(0x453,0x2d0)]===_0x2cd045(_0xf654b._0x559750,_0xf654b._0x31f4e1)?_0x2cd045(0x3cd,0x688):_0x2cd045(0x487,0x31d),process[_0x592c53(_0xf654b._0x2f719f,0x90c)]===_0x355419[_0x2cd045(_0xf654b._0x494e51,0x6a)]?[_0x2cd045(0x4b5,0x215),String(_0x46f338['pid']),'/T','/F']:[_0x592c53(_0xf654b._0x300335,0x878),_0x355419[_0x592c53(_0xf654b._0x23d5f7,_0xf654b._0xb4fc82)](String,_0x46f338[_0x592c53(_0xf654b._0x2ec882,_0xf654b._0x16f1d8)])]),clearServiceState(_0x46f338[_0x2cd045(_0xf654b._0x2e31b5,0x2e9)]);}function listPosixRuntimePids(_0x3fc302){const _0xfeb493={_0x219e98:0x4f8,_0x2c41a9:0x18e,_0x140912:0x439,_0x4644e8:0x453,_0x1096c5:0x8bd,_0x4aee7a:0x76e,_0x5206d9:0x38a,_0x4fd4e5:0x8d0,_0x10eb3c:0x907},_0x17b2cb={_0x3db25f:0x1bc,_0x5a6644:0x1dc,_0x2f0294:0x16d},_0x87a931={_0x5d093f:0x1b3},_0x4aac37={_0x48e3cb:0x62b};function _0x3159e3(_0x337328,_0x4a70d7){return _0x26b3dd(_0x4a70d7- -0x56,_0x337328);}const _0x3babbb={};_0x3babbb['VoXpN']='-ax';const _0x2ed20e=_0x3babbb;if(!_0x3fc302||process[_0x2a255c(_0xfeb493._0x219e98,0x4df)]===_0x2a255c(_0xfeb493._0x2c41a9,_0xfeb493._0x140912))return[];function _0x2a255c(_0x558cf7,_0x4e9bbd){return _0x26b3dd(_0x4e9bbd- -0x486,_0x558cf7);}try{const _0x481dec={};_0x481dec[_0x3159e3(0x362,_0xfeb493._0x4644e8)]=_0x2a255c(-0x14e,0x172);const _0x213dbf=execFileSync('ps',[_0x2ed20e[_0x3159e3(0x8c1,_0xfeb493._0x1096c5)],'-o',_0x3159e3(0x9c4,_0xfeb493._0x4aee7a)+'s='],_0x481dec);return _0x213dbf[_0x2a255c(0x1ea,_0xfeb493._0x5206d9)]('\x0a')[_0x3159e3(_0xfeb493._0x4fd4e5,0x74a)](_0x452f6a=>_0x452f6a[_0x3159e3(0x4fa,0x760)]())[_0x3159e3(0xa94,_0xfeb493._0x10eb3c)](Boolean)['flatMap'](_0x5b7601=>{const _0x19ec26=_0x5b7601[_0xe5a80f(_0x17b2cb._0x3db25f,-0x7)](/^(\d+)\s+(.*)$/);if(!_0x19ec26)return[];function _0xe5a80f(_0x4f9147,_0x2fbba4){return _0x3159e3(_0x2fbba4,_0x4f9147- -_0x4aac37._0x48e3cb);}const _0x2ca4f7=Number(_0x19ec26[0x1]),_0x4c03d4=_0x19ec26[0x2];if(!Number[_0x3b45f4(0x34b,0x3ad)+'r'](_0x2ca4f7)||_0x2ca4f7<=0x0||_0x2ca4f7===process[_0xe5a80f(0x20f,0x47e)])return[];if(!_0x4c03d4['includes'](_0x3fc302))return[];if(!/\brun\b/[_0xe5a80f(-_0x17b2cb._0x5a6644,-_0x17b2cb._0x2f0294)](_0x4c03d4))return[];function _0x3b45f4(_0x44bf87,_0x1fd0f4){return _0x3159e3(_0x1fd0f4,_0x44bf87- -_0x87a931._0x5d093f);}return[_0x2ca4f7];});}catch{return[];}}function isPidRunning(_0x3337cd){const _0x161a36={_0x4eecc7:0x3f5};function _0x61577d(_0x24fbae,_0x114d30){return _0x26b3dd(_0x24fbae- -0x5a4,_0x114d30);}try{return process[_0x61577d(_0x161a36._0x4eecc7,0x590)](_0x3337cd,0x0),!![];}catch{return![];}}function waitForPidExit(_0x36ee44,_0x3d6d1b){const _0xca90e4={_0x435394:0x82};function _0x201be3(_0x138336,_0x368496){return _0x26b3dd(_0x368496- -_0xca90e4._0x435394,_0x138336);}const _0x43b096=Date[_0x201be3(0x591,0x670)]()+_0x3d6d1b,_0x594d43=new Int32Array(new SharedArrayBuffer(0x4));while(isPidRunning(_0x36ee44)){if(Date['now']()>=_0x43b096)return![];Atomics['wait'](_0x594d43,0x0,0x0,0x32);}return!![];}function startDetachedWindowsService(_0x46a1fa){const _0x302d65={_0x40e491:0x14f,_0xb4ef77:0x99,_0x40e775:0x1da,_0x2cfc7f:0x77b,_0x48d602:0x3aa,_0x14fa70:0x4f7,_0x3ea20f:0x2c4,_0x10cf5a:0x2bb},_0x3bcb44={_0x20abf6:0x265},_0xf3d6da={'jPYtb':function(_0x466e75,_0x8b9d3e,_0x2e58d0){return _0x466e75(_0x8b9d3e,_0x2e58d0);},'lAlFd':function(_0x31492e,_0x172d48){return _0x31492e(_0x172d48);}};function _0x2395f1(_0xde81b6,_0x2fd67c){return _0x3266d5(_0x2fd67c,_0xde81b6-0x2df);}function _0x3d111d(_0x32d050,_0x5b16ec){return _0x3266d5(_0x32d050,_0x5b16ec- -_0x3bcb44._0x20abf6);}const _0x4fd3f5=openSync(SERVICE_LOG_PATH,'a'),_0xdeeff4=_0xf3d6da[_0x3d111d(0x328,_0x302d65._0x40e491)](openSync,SERVICE_ERROR_LOG_PATH,'a');try{const [_0xb52cc4,..._0x2c55eb]=_0x46a1fa,_0x43d626={};_0x43d626[_0x3d111d(-_0x302d65._0xb4ef77,_0x302d65._0x40e775)]=!![],_0x43d626[_0x2395f1(0x5ce,_0x302d65._0x2cfc7f)]=[_0x2395f1(_0x302d65._0x48d602,_0x302d65._0x14fa70),_0x4fd3f5,_0xdeeff4],_0x43d626[_0x3d111d(0x380,_0x302d65._0x3ea20f)+'ide']=!![];const _0x295ce7=spawn(_0xb52cc4,_0x2c55eb,_0x43d626);_0x295ce7[_0x3d111d(-_0x302d65._0x10cf5a,-0x1da)]();}finally{closeSync(_0x4fd3f5),_0xf3d6da['lAlFd'](closeSync,_0xdeeff4);}}function startDetachedPosixService(_0x1fbb21){const _0x513cd8={_0x2df36a:0x1e9,_0x2a08b3:0x3ee,_0x5ed805:0x22e,_0x4efc9e:0x1fc,_0xcdb99e:0x17,_0x53e265:0x1b5,_0x3dbb23:0x36,_0x16ca4d:0xb7};function _0x45c554(_0xb210a2,_0x4dea67){return _0x26b3dd(_0x4dea67- -0x551,_0xb210a2);}const _0x1483d9={'rVcoX':function(_0x4e19b3,_0x3a9c0b,_0xb5b57b){return _0x4e19b3(_0x3a9c0b,_0xb5b57b);},'wociA':function(_0xba6ab2,_0x24a33f,_0x1fcfc5,_0x20d604){return _0xba6ab2(_0x24a33f,_0x1fcfc5,_0x20d604);},'yYvbw':function(_0x1da165,_0x2928e8){return _0x1da165(_0x2928e8);}};function _0x3014f2(_0x21612e,_0x4e956f){return _0x26b3dd(_0x4e956f- -0x64c,_0x21612e);}const _0x219c04=openSync(SERVICE_LOG_PATH,'a'),_0x344e63=_0x1483d9[_0x3014f2(0x3c0,0x3ac)](openSync,SERVICE_ERROR_LOG_PATH,'a');try{const [_0x525c3d,..._0x545b37]=_0x1fbb21,_0x4a8f55={};_0x4a8f55[_0x45c554(_0x513cd8._0x2df36a,0x37e)]=!![],_0x4a8f55[_0x45c554(_0x513cd8._0x2a08b3,_0x513cd8._0x5ed805)]=['ignore',_0x219c04,_0x344e63];const _0x2c2361=_0x1483d9[_0x3014f2(_0x513cd8._0x4efc9e,_0x513cd8._0xcdb99e)](spawn,_0x525c3d,_0x545b37,_0x4a8f55);_0x2c2361[_0x45c554(_0x513cd8._0x53e265,-_0x513cd8._0x3dbb23)]();}finally{closeSync(_0x219c04),_0x1483d9[_0x45c554(0x172,-_0x513cd8._0x16ca4d)](closeSync,_0x344e63);}}async function waitForRuntimeState(_0x48969b=0x5dc,_0x4b3fa8=0x32){const _0x1e09e1={_0x30e45f:0x6aa,_0x1e91bc:0x43a,_0x4a8aa7:0x740,_0x175111:0x5ff},_0x300076={_0x322354:0x29b},_0x38c8f4={_0x872d72:0x182},_0x471e17={'ipezd':function(_0x41b9a1){return _0x41b9a1();}};function _0x57aac6(_0x517686,_0x553579){return _0x3266d5(_0x517686,_0x553579-_0x38c8f4._0x872d72);}const _0x3110e1=Date['now']()+_0x48969b;function _0x1ad64e(_0xcb1aa,_0x518da9){return _0x3266d5(_0x518da9,_0xcb1aa-_0x300076._0x322354);}let _0x4752c5=_0x471e17[_0x1ad64e(0x718,_0x1e09e1._0x30e45f)](getServiceStatus);while(Date[_0x1ad64e(0x4fd,_0x1e09e1._0x1e91bc)]()<_0x3110e1){if(_0x4752c5['running'])return _0x4752c5;await _0x3f83ac(_0x4b3fa8),_0x4752c5=_0x471e17[_0x57aac6(_0x1e09e1._0x4a8aa7,_0x1e09e1._0x175111)](getServiceStatus);}return _0x4752c5;}function installLinuxService(_0x1a6ae4){try{installLinuxSystemdService(_0x1a6ae4),removeLinuxCronRegistration();return;}catch(_0x5bd96b){installLinuxCronService(_0x1a6ae4,_0x5bd96b);}}function restartLinuxService(_0x225844){const _0x3e1316={'QNKMz':function(_0xb1ca09,_0x3cdf30,_0x16f9f5){return _0xb1ca09(_0x3cdf30,_0x16f9f5);}};try{restartLinuxSystemdService(_0x225844),removeLinuxCronRegistration();return;}catch(_0xd69874){_0x3e1316['QNKMz'](installLinuxCronService,_0x225844,_0xd69874);}}function installLinuxSystemdService(_0x2bd17a){const _0x14eeec={_0x204ccf:0x1c0,_0x22a76c:0x207,_0x404eca:0x747,_0x3b4955:0x6ff,_0xfc9f3d:0x162,_0x21d70d:0x559,_0x4580a0:0x4a9,_0x2b32bc:0xaa,_0xc90177:0x207,_0x2a0c20:0x574,_0x1545af:0x627,_0x4fa299:0xf7,_0xdc6d23:0x26d,_0x3ed586:0x841,_0x1c48f4:0x24d,_0xb2cd80:0x609,_0x1b28ec:0x5eb,_0x4a4466:0x8ca,_0x568628:0x853,_0x200223:0x947,_0x5a4ccc:0x8cc},_0x1b69af={'OcEDc':function(_0x3feca9,_0x27a7a2,_0x287666,_0x5e7a0e){return _0x3feca9(_0x27a7a2,_0x287666,_0x5e7a0e);},'OYJVo':'--now','mMEKO':function(_0x3cf952,_0xc59473,_0x32950c,_0x45fe3c){return _0x3cf952(_0xc59473,_0x32950c,_0x45fe3c);},'LkfmX':'utf8','LDgka':function(_0x92db63,_0x30699e,_0x43fdb3){return _0x92db63(_0x30699e,_0x43fdb3);}},_0x3ddf1b=(_0x42ad9e(_0x14eeec._0x204ccf,0x192)+'1')['split']('|');let _0x49fe66=0x0;function _0x42ad9e(_0xaba5e1,_0x48b61f){return _0x3266d5(_0xaba5e1,_0x48b61f- -0x82);}function _0x262d58(_0x56361d,_0x126f9e){return _0x3266d5(_0x126f9e,_0x56361d-0x4be);}while(!![]){switch(_0x3ddf1b[_0x49fe66++]){case'0':if(!commandExists(_0x42ad9e(0xfb,_0x14eeec._0x22a76c)+'l'))throw new Error(_0x262d58(_0x14eeec._0x404eca,_0x14eeec._0x3b4955)+_0x42ad9e(_0x14eeec._0xfc9f3d,0x327)+'\x20availab'+'le');continue;case'1':const _0x3ddc25={};_0x3ddc25[_0x42ad9e(0xeb,0x26d)]=_0x42ad9e(-0x17b,0x49),_0x1b69af[_0x42ad9e(_0x14eeec._0x21d70d,_0x14eeec._0x4580a0)](execFileSync,_0x42ad9e(_0x14eeec._0x2b32bc,_0x14eeec._0xc90177)+'l',[_0x42ad9e(0x68,0x97),'enable',_0x1b69af[_0x262d58(_0x14eeec._0x2a0c20,_0x14eeec._0x1545af)],SYSTEMD_UNIT_NAME],_0x3ddc25);continue;case'2':_0x242f96(LINUX_SERVICE_PATH,_0x1b69af[_0x262d58(0x722,0x6df)](buildLinuxSystemdUnit,_0x2bd17a,SERVICE_LOG_PATH,SERVICE_ERROR_LOG_PATH),_0x1b69af['LkfmX']);continue;case'3':const _0x5486de={};_0x5486de[_0x42ad9e(_0x14eeec._0x4fa299,_0x14eeec._0xdc6d23)]=_0x262d58(0x589,_0x14eeec._0x3ed586),execFileSync('systemct'+'l',[_0x42ad9e(_0x14eeec._0x1c48f4,0x97),_0x262d58(_0x14eeec._0xb2cd80,_0x14eeec._0x1b28ec)+_0x42ad9e(0x486,0x1fa)],_0x5486de);continue;case'4':const _0x4c337f={};_0x4c337f[_0x262d58(_0x14eeec._0x4a4466,_0x14eeec._0x568628)+'e']=!![],_0x1b69af[_0x262d58(_0x14eeec._0x200223,_0x14eeec._0x5a4ccc)](_0x28c50d,dirname(LINUX_SERVICE_PATH),_0x4c337f);continue;}break;}}function restartLinuxSystemdService(_0x3e41b7){const _0x4af5ae={_0x5a970e:0x25e,_0x2ab6cb:0x126,_0x46176a:0x18,_0x4811a4:0xa4,_0x243155:0x2d0,_0x223d6a:0x7e1,_0x514eff:0x5e8,_0x21b915:0x368,_0x50f830:0x4bc,_0x7e72d9:0x37e,_0x519c1b:0x4bc,_0x566a80:0x67},_0x801585={'ucRWU':function(_0x26035b,_0x1364ea){return _0x26035b(_0x1364ea);},'sabvk':_0x52d08c(_0x4af5ae._0x5a970e,0x39b),'WSnvM':_0x2b7054(0x122,-0x11a)};if(!commandExists(_0x2b7054(-_0x4af5ae._0x2ab6cb,0xa4)+'l'))throw new Error(_0x2b7054(_0x4af5ae._0x46176a,_0x4af5ae._0x4811a4)+_0x52d08c(0x4ad,0x5dc)+_0x2b7054(_0x4af5ae._0x243155,0x382)+'le');function _0x2b7054(_0x1aff19,_0x871080){return _0x26b3dd(_0x871080- -0x675,_0x1aff19);}if(!_0x801585[_0x2b7054(0xa,0x2d)](_0x3e4d20,LINUX_SERVICE_PATH)){installLinuxSystemdService(_0x3e41b7);return;}_0x242f96(LINUX_SERVICE_PATH,buildLinuxSystemdUnit(_0x3e41b7,SERVICE_LOG_PATH,SERVICE_ERROR_LOG_PATH),_0x801585[_0x52d08c(_0x4af5ae._0x223d6a,_0x4af5ae._0x514eff)]);const _0x411999={};_0x411999[_0x2b7054(0x373,0x10a)]='ignore',execFileSync(_0x52d08c(_0x4af5ae._0x21b915,_0x4af5ae._0x50f830)+'l',['--user',_0x52d08c(0xde,_0x4af5ae._0x7e72d9)+'eload'],_0x411999);function _0x52d08c(_0x223cb1,_0x174e73){return _0x26b3dd(_0x174e73- -0x25d,_0x223cb1);}const _0x137a14={};_0x137a14[_0x52d08c(0x6f9,0x522)]=_0x801585['WSnvM'],execFileSync(_0x52d08c(0x687,_0x4af5ae._0x519c1b)+'l',[_0x2b7054(-_0x4af5ae._0x566a80,-0xcc),'restart',SYSTEMD_UNIT_NAME],_0x137a14);}function installLinuxCronService(_0x2fd716,_0x2bbf99){const _0x3d9821={_0x4f6bb8:0x5f4,_0x3a6dc3:0x2a5,_0x54d0c3:0x61,_0x3504b2:0x34d,_0x26c0dc:0x2ac,_0x1678fc:0x13d,_0x4abbea:0x432,_0x5aebbc:0x407,_0x43ef18:0x7b9,_0x48f9ec:0x60c},_0x7848a0={_0x17819f:0x1f1},_0x1f0438={'yNXPq':function(_0xcc2e77,_0x1f683d){return _0xcc2e77(_0x1f683d);},'sZrhC':function(_0x580e72){return _0x580e72();}};if(!commandExists(_0x19b1ef(0x4dc,_0x3d9821._0x4f6bb8)))throw new Error(_0x19b1ef(_0x3d9821._0x3a6dc3,_0x3d9821._0x54d0c3)+_0x19b1ef(_0x3d9821._0x3504b2,0x5cc)+_0x19b1ef(0x2fb,0x12f)+'on\x20faile'+_0x19b1ef(_0x3d9821._0x26c0dc,_0x3d9821._0x1678fc)+'\x20crontab'+_0x19b1ef(0x70c,0x84b)+_0x4e0957(_0x3d9821._0x4abbea,0x58a)+'ilable:\x20'+_0x1f0438['yNXPq'](formatError,_0x2bbf99));function _0x19b1ef(_0x1a4c12,_0xc0c14c){return _0x26b3dd(_0x1a4c12- -_0x7848a0._0x17819f,_0xc0c14c);}rmIfExists(LINUX_SERVICE_PATH);const _0x144d59=buildLinuxCronEntry(_0x2fd716,SERVICE_LOG_PATH,SERVICE_ERROR_LOG_PATH);writeLinuxCrontabEntry(_0x144d59),_0x242f96(LINUX_CRON_RECORD_PATH,_0x144d59+'\x0a',_0x19b1ef(_0x3d9821._0x5aebbc,0x1d4));function _0x4e0957(_0x5b4110,_0x3806c1){return _0x26b3dd(_0x5b4110- -0x4f4,_0x3806c1);}_0x1f0438[_0x19b1ef(_0x3d9821._0x43ef18,_0x3d9821._0x48f9ec)](stopRunningProcess),startDetachedPosixService(_0x2fd716);}function hasLinuxCronRegistration(){const _0x466b05={_0x25306b:0x20f,_0x44b903:0x6e8,_0x724dd0:0x487,_0x35be25:0xfa},_0x1719cd={_0x20a341:0x313},_0x5a0096={_0x3ddf99:0x61c};function _0x2bcb25(_0x26c3f4,_0xb2d12d){return _0x26b3dd(_0xb2d12d- -_0x5a0096._0x3ddf99,_0x26c3f4);}function _0x55e38c(_0x52e958,_0x410461){return _0x26b3dd(_0x52e958- -_0x1719cd._0x20a341,_0x410461);}if(process[_0x2bcb25(_0x466b05._0x25306b,0x349)]!==_0x55e38c(_0x466b05._0x44b903,_0x466b05._0x724dd0))return![];return readLinuxCrontab()[_0x2bcb25(-0x6c,_0x466b05._0x35be25)](_0x240704=>_0x240704[_0x55e38c(0x63a,0x6ef)](LINUX_CRON_MARKER));}function _0x3266d5(_0x58cb42,_0x9e3226){const _0x491743={_0x57bbe9:0x16c};return _0x47f8(_0x9e3226- -_0x491743._0x57bbe9,_0x58cb42);}function removeLinuxCronRegistration(){const _0x403bc8={_0x3142a1:0x338,_0x159f47:0x5b4,_0x2778a8:0xcb,_0x42324a:0x356,_0x3f34ce:0x4a9,_0x367b71:0x4e6},_0x3c2239={_0x2c1f8a:0xc2},_0x3a9a98={};_0x3a9a98[_0x37c5f6(_0x403bc8._0x3142a1,_0x403bc8._0x159f47)]=_0x5bd9e2(_0x403bc8._0x2778a8,_0x403bc8._0x42324a);const _0x355783=_0x3a9a98;if(process['platform']!==_0x37c5f6(_0x403bc8._0x3f34ce,0x6b0))return;function _0x5bd9e2(_0x1cfea1,_0x312d31){return _0x3266d5(_0x1cfea1,_0x312d31-0x119);}if(commandExists(_0x355783[_0x37c5f6(0x338,_0x403bc8._0x367b71)])){const _0x2042a6=readLinuxCrontab()['filter'](_0x1b1c3f=>!_0x1b1c3f[_0x37c5f6(0x3fb,0x197)](LINUX_CRON_MARKER));writeLinuxCrontab(_0x2042a6);}function _0x37c5f6(_0x3792c3,_0x55843d){return _0x3266d5(_0x55843d,_0x3792c3- -_0x3c2239._0x2c1f8a);}rmIfExists(LINUX_CRON_RECORD_PATH);}function writeLinuxCrontabEntry(_0xa607c){const _0x464ade={_0x526204:0x22e};function _0xbe9845(_0x3f0094,_0x117e26){return _0x3266d5(_0x117e26,_0x3f0094- -0x274);}function _0x2b91cf(_0x1a87dc,_0x4d8270){return _0x3266d5(_0x4d8270,_0x1a87dc- -_0x464ade._0x526204);}const _0x12c2ff=readLinuxCrontab()['filter'](_0x5bde7c=>!_0x5bde7c[_0xbe9845(0x249,0x3a9)](LINUX_CRON_MARKER));_0x12c2ff[_0xbe9845(0x216,0x257)](_0xa607c),writeLinuxCrontab(_0x12c2ff);}function readLinuxCrontab(){const _0x5c93db={_0x17e2f7:0x4e3,_0x295d40:0x9,_0x138c60:0x13c,_0x5caab1:0x220,_0x48fe81:0x3a1,_0x452a39:0xe9,_0x2eaca4:0x221,_0x2d12f7:0x30,_0x46cca6:0x4b0};function _0x2d7f64(_0x48f882,_0x5320a5){return _0x26b3dd(_0x5320a5- -0x4ad,_0x48f882);}const _0x420906={};_0x420906[_0x2d7f64(0x4b0,_0x5c93db._0x17e2f7)]=_0x245af8(_0x5c93db._0x295d40,0x268);function _0x245af8(_0x41656d,_0x581fde){return _0x26b3dd(_0x41656d- -0x5ef,_0x581fde);}const _0x21f75d=_0x420906;if(!commandExists(_0x2d7f64(_0x5c93db._0x138c60,_0x5c93db._0x5caab1)))return[];try{const _0x3270a6={};_0x3270a6[_0x2d7f64(0x1f9,-0x4)]=_0x21f75d[_0x245af8(_0x5c93db._0x48fe81,0x118)];const _0x405210=execFileSync(_0x2d7f64(_0x5c93db._0x452a39,0x220),['-l'],_0x3270a6);return _0x405210[_0x245af8(_0x5c93db._0x2eaca4,_0x5c93db._0x2d12f7)]('\x0a')['map'](_0x1e88f2=>_0x1e88f2[_0x245af8(0x390,0x3c3)]())[_0x2d7f64(0x4f9,_0x5c93db._0x46cca6)](_0x1d516c=>_0x1d516c[_0x2d7f64(0x364,0x41d)]>0x0);}catch(_0x140969){if(isMissingCrontabError(_0x140969))return[];throw _0x140969;}}function writeLinuxCrontab(_0x314377){const _0x3be8e0={_0x40166f:0x2c5,_0x4c5c4c:0x160,_0xc3876:0x409,_0x2e486f:0x215,_0x455072:0x3ab,_0x2d2345:0x362,_0x389be0:0x17a,_0x1c16c0:0xa8},_0x301e56={_0x3718dd:0x3e1},_0x237c1a={};_0x237c1a['KqeXq']=_0x42969e(0x2ec,0x8c),_0x237c1a[_0x5cf916(0x223,_0x3be8e0._0x40166f)]=_0x42969e(0x17a,_0x3be8e0._0x4c5c4c);function _0x5cf916(_0x48dd29,_0x476e7e){return _0x26b3dd(_0x48dd29- -0x569,_0x476e7e);}function _0x42969e(_0x48a257,_0x34aeda){return _0x26b3dd(_0x48a257- -_0x301e56._0x3718dd,_0x34aeda);}const _0x291328=_0x237c1a;if(!commandExists('crontab'))return;if(_0x314377['length']===0x0){execIgnoreFailure(_0x291328[_0x42969e(0x4cd,_0x3be8e0._0xc3876)],['-r']);return;}execFileSync('crontab',['-'],{'input':_0x314377['join']('\x0a')+'\x0a','encoding':_0x42969e(0x217,0x32c),'stdio':[_0x42969e(0x254,_0x3be8e0._0x2e486f),_0x291328[_0x42969e(_0x3be8e0._0x455072,_0x3be8e0._0x2d2345)],_0x42969e(_0x3be8e0._0x389be0,_0x3be8e0._0x1c16c0)]});}function resolveScriptPath(_0x3ad68c){const _0x2ef609={_0x1d5843:0x163,_0x3b0baf:0x5d6},_0xb31a77={_0x449891:0x20c},_0x183b8a={'fQfLh':function(_0x3f9068,_0xaf6b84){return _0x3f9068(_0xaf6b84);}};function _0x4a603c(_0x58bb3f,_0x287517){return _0x3266d5(_0x58bb3f,_0x287517-0x80);}function _0xeb7d98(_0x1ee9db,_0x2a3cb1){return _0x3266d5(_0x1ee9db,_0x2a3cb1- -_0xb31a77._0x449891);}const _0x5c4ef9=_0x3ad68c?.[_0x4a603c(_0x2ef609._0x1d5843,0x3a6)]()||process['argv'][0x1]?.[_0x4a603c(0xfe,0x3a6)]()||'';if(!_0x5c4ef9)return'';try{return _0x183b8a[_0x4a603c(0x666,_0x2ef609._0x3b0baf)](realpathSync,_0x5c4ef9);}catch{return _0x5c4ef9;}}function ensureLaunchScriptExecutable(_0x2321e0,_0x235f72){const _0x4c126a={_0x277a4d:0x21c,_0x499884:0x1b3},_0x2aee81={_0x252d6a:0x496},_0x252121={_0x8973a4:0x213},_0x5bd68d={'kvuts':function(_0x89bd70,_0x350c21){return _0x89bd70(_0x350c21);}};function _0x41d9dd(_0xcd8d32,_0x211b0b){return _0x3266d5(_0x211b0b,_0xcd8d32- -_0x252121._0x8973a4);}if(_0x235f72===_0x41d9dd(_0x4c126a._0x277a4d,0x227)||!_0x5bd68d[_0x41d9dd(_0x4c126a._0x499884,0x2bd)](_0x3e4d20,_0x2321e0))return;function _0x2938c9(_0x2e2bee,_0x2e6e15){return _0x3266d5(_0x2e6e15,_0x2e2bee-_0x2aee81._0x252d6a);}try{chmodSync(_0x2321e0,0x1ed);}catch{}}function writeServiceLauncher(_0x4ff9f6){const _0x3cd472={_0x1c6f6c:0x475,_0x5a3056:0x106,_0x492a25:0x2c1,_0x61f89a:0x11,_0x3b4180:0x4f3,_0x56f62c:0x29f,_0x437b5b:0x8a8,_0x31434c:0x751,_0x1d9159:0x874,_0x31462c:0x7fc,_0x14a357:0x383,_0x18faa0:0x323,_0x3e738e:0x55f,_0x1007b1:0x54f,_0x1f4a97:0x370,_0x2a790b:0x282,_0x51e8ab:0x2b,_0x4adc00:0x10c,_0x40090d:0x35e,_0x444704:0xc,_0x3a288f:0xce,_0x4590f8:0x9c3,_0x51450e:0x831,_0x523b7b:0x27e,_0x44e94d:0x26e,_0xd0ab14:0x6c8,_0x28d0d8:0x642,_0x95f0ff:0x32f,_0x3fe77b:0x3bd,_0x28c53a:0x399,_0x1b6afd:0x52c,_0x7e7c9d:0x386,_0x27a0c3:0x7ff,_0x249929:0x29},_0x4e44af={_0x5105e9:0xfe},_0x3878e4={_0x569ddf:0x301},_0x57d54f={'dKyyL':function(_0x177126,_0x4ed613){return _0x177126(_0x4ed613);},'igTUL':function(_0x1c9c70,_0x4d5a93){return _0x1c9c70(_0x4d5a93);},'dsQbj':'\x20\x20exec\x20\x22'+_0x4b9b26(0x66a,_0x3cd472._0x1c6f6c)+_0x1993c8(-0x71,_0x3cd472._0x5a3056)+_0x1993c8(0x33c,_0x3cd472._0x492a25)+_0x1993c8(-0x35,-_0x3cd472._0x61f89a)+'-service','kkerY':_0x1993c8(0x219,0x2f2)+_0x1993c8(_0x3cd472._0x3b4180,0x405)+'RIPT_PAT'+_0x1993c8(-0x5b,-0x11)+_0x1993c8(0x26c,_0x3cd472._0x56f62c),'PYzin':'echo\x20\x22no'+_0x4b9b26(0x48e,0x668)+_0x4b9b26(0x71c,_0x3cd472._0x437b5b)+_0x4b9b26(_0x3cd472._0x31434c,0x557)+'\x20Clawket'+_0x4b9b26(_0x3cd472._0x1d9159,_0x3cd472._0x31462c)+'service\x22'+_0x1993c8(_0x3cd472._0x14a357,_0x3cd472._0x18faa0)};function _0x4b9b26(_0x46032f,_0x28d557){return _0x3266d5(_0x28d557,_0x46032f-_0x3878e4._0x569ddf);}function _0x1993c8(_0x54ad0f,_0x5b3a36){return _0x3266d5(_0x54ad0f,_0x5b3a36- -_0x4e44af._0x5105e9);}ensureServiceDirs();const _0x30caf5=[_0x4b9b26(_0x3cd472._0x3e738e,_0x3cd472._0x1007b1)+'h',_0x4b9b26(_0x3cd472._0x1f4a97,_0x3cd472._0x2a790b)+'ATH=\x22'+_0x57d54f[_0x1993c8(0x29e,_0x3cd472._0x51e8ab)](escapeShellDoubleQuoted,_0x4ff9f6['pathEnv'])+'\x22','NODE_PAT'+'H=\x22'+escapeShellDoubleQuoted(_0x4ff9f6[_0x1993c8(0x189,0x88)])+'\x22',_0x1993c8(_0x3cd472._0x4adc00,0x357)+_0x4b9b26(_0x3cd472._0x40090d,0x3d3)+_0x57d54f[_0x1993c8(-_0x3cd472._0x444704,_0x3cd472._0x3a288f)](escapeShellDoubleQuoted,_0x4ff9f6[_0x4b9b26(0x712,0x4a0)+'th'])+'\x22','if\x20[\x20-x\x20'+'\x22$NODE_P'+_0x4b9b26(0x861,_0x3cd472._0x4590f8)+_0x4b9b26(_0x3cd472._0x51450e,0x9e7),_0x57d54f[_0x1993c8(_0x3cd472._0x523b7b,_0x3cd472._0x44e94d)],'fi','if\x20comma'+_0x4b9b26(_0x3cd472._0xd0ab14,_0x3cd472._0x28d0d8)+'de\x20>/dev'+_0x4b9b26(_0x3cd472._0x95f0ff,_0x3cd472._0x3fe77b)+'&1;\x20then',_0x57d54f[_0x4b9b26(_0x3cd472._0x28c53a,0x198)],'fi',_0x57d54f[_0x4b9b26(_0x3cd472._0x1b6afd,0x33c)],_0x4b9b26(_0x3cd472._0x7e7c9d,0x3a0),''];return _0x242f96(SERVICE_LAUNCHER_PATH,_0x30caf5[_0x4b9b26(0x7dd,_0x3cd472._0x27a0c3)]('\x0a'),_0x1993c8(-_0x3cd472._0x249929,0x6a)),SERVICE_LAUNCHER_PATH;}function escapeShellDoubleQuoted(_0x5b6241){const _0x542bc6={_0x1762ef:0x264,_0x561a9a:0x20e,_0x368a9a:0x5a1,_0x59f77d:0x4e1,_0x526157:0x133};function _0x6b7f29(_0x39bd40,_0x3f83ad){return _0x26b3dd(_0x3f83ad- -0x6d9,_0x39bd40);}function _0x5ca6be(_0x504b28,_0x5310c9){return _0x26b3dd(_0x504b28- -0x346,_0x5310c9);}return _0x5b6241[_0x6b7f29(_0x542bc6._0x1762ef,_0x542bc6._0x561a9a)+'ll']('\x5c','\x5c\x5c')[_0x5ca6be(_0x542bc6._0x368a9a,_0x542bc6._0x59f77d)+'ll']('\x22','\x5c\x22')[_0x6b7f29(0x34c,_0x542bc6._0x561a9a)+'ll']('$','\x5c$')[_0x6b7f29(_0x542bc6._0x526157,0x20e)+'ll']('`','\x5c`');}function escapeShellWord(_0x2a24a4){const _0x286519={_0x58c133:0x900},_0x3af2bb={_0x16d911:0x36};if(_0x2a24a4[_0x173cf9(_0x286519._0x58c133,0xb79)]===0x0)return'\x27\x27';function _0x173cf9(_0x774ca6,_0xf31c84){return _0x26b3dd(_0x774ca6-_0x3af2bb._0x16d911,_0xf31c84);}return'\x27'+_0x2a24a4['replaceA'+'ll']('\x27','\x27\x22\x27\x22\x27')+'\x27';}function buildWindowsRunCommand(_0x38c889){function _0x2d9798(_0x3ad8bf,_0x28b52f){return _0x26b3dd(_0x28b52f- -0x2a2,_0x3ad8bf);}return _0x38c889['map'](escapeWindowsArg)[_0x2d9798(0x476,0x6ca)]('\x20');}function ensureServiceDirs(){const _0x4724e8={_0x3b3366:0x1cc},_0xb21bbe={_0x363eeb:0x12},_0x5d7a98={_0x519b00:0x3d9};function _0xf69617(_0x337c3d,_0x17ee45){return _0x3266d5(_0x17ee45,_0x337c3d-_0x5d7a98._0x519b00);}const _0x33e812={};_0x33e812[_0xa0347b(0x3fa,0x48f)+'e']=!![],_0x28c50d(SERVICE_DIR,_0x33e812);const _0x4c97b1={};function _0xa0347b(_0xc4463e,_0x47655c){return _0x3266d5(_0x47655c,_0xc4463e- -_0xb21bbe._0x363eeb);}_0x4c97b1[_0xa0347b(0x3fa,_0x4724e8._0x3b3366)+'e']=!![],_0x28c50d(LOG_DIR,_0x4c97b1);}function escapeXml(_0x476681){const _0x73d03b={_0x4d9f5f:0x4,_0x3ffc7c:0x284,_0x469287:0x1f3,_0x2b53cd:0xaf,_0x3adc76:0x55e,_0x588f55:0x2b9,_0x24c6eb:0x396,_0x498282:0x619,_0x11c966:0x530,_0x107588:0x46b,_0x57fad8:0x2d3,_0x5a866b:0x430},_0x133f28={_0x3c2f7b:0x614},_0x4e368e={_0x30640c:0x551};function _0x58c015(_0x443b85,_0x45a542){return _0x26b3dd(_0x443b85- -_0x4e368e._0x30640c,_0x45a542);}const _0x4128c8={};_0x4128c8[_0x58c015(_0x73d03b._0x4d9f5f,_0x73d03b._0x3ffc7c)]=_0x21869a(-_0x73d03b._0x469287,-_0x73d03b._0x2b53cd);function _0x21869a(_0x235f85,_0x32d0f6){return _0x26b3dd(_0x32d0f6- -_0x133f28._0x3c2f7b,_0x235f85);}_0x4128c8[_0x21869a(_0x73d03b._0x3adc76,_0x73d03b._0x588f55)]=_0x21869a(-0x13,-0x14f);const _0x4be79e=_0x4128c8;return _0x476681[_0x58c015(_0x73d03b._0x24c6eb,_0x73d03b._0x498282)+'ll']('&',_0x58c015(0x395,_0x73d03b._0x11c966))[_0x21869a(_0x73d03b._0x107588,_0x73d03b._0x57fad8)+'ll']('<',_0x4be79e['McatM'])[_0x21869a(0x528,_0x73d03b._0x57fad8)+'ll']('>',_0x4be79e[_0x21869a(0xb1,0x2b9)])['replaceA'+'ll']('\x22','&quot;')[_0x21869a(_0x73d03b._0x5a866b,0x2d3)+'ll']('\x27',_0x21869a(0x9f,0x18d));}function escapeSystemdArg(_0x37ecfc){const _0x50be9c={_0x379ee6:0xb5,_0x4bf76d:0x265,_0x2ce9f5:0x74c},_0x53a2ed={_0x1b93f5:0x682};function _0x5df48a(_0x58aded,_0x4e85a1){return _0x26b3dd(_0x4e85a1- -_0x53a2ed._0x1b93f5,_0x58aded);}function _0x58767b(_0x837342,_0x45bca3){return _0x26b3dd(_0x45bca3- -0x2b8,_0x837342);}return'\x22'+_0x37ecfc[_0x5df48a(_0x50be9c._0x379ee6,_0x50be9c._0x4bf76d)+'ll']('\x5c','\x5c\x5c')[_0x58767b(_0x50be9c._0x2ce9f5,0x62f)+'ll']('\x22','\x5c\x22')+'\x22';}function escapeWindowsArg(_0x1b0ffb){return'\x22'+_0x1b0ffb['replaceA'+'ll']('\x22','\x5c\x22')+'\x22';}function commandSucceeds(_0x4aa272,_0x180f46){const _0x20804={_0x665dc9:0xac},_0x3af584={_0x40a1ca:0x607},_0x247754={'ljMOx':function(_0x262fb1,_0x4f10c9,_0x2cac8d,_0x5e6dab){return _0x262fb1(_0x4f10c9,_0x2cac8d,_0x5e6dab);}};function _0x55fe6f(_0x2bc360,_0xaa5b8e){return _0x26b3dd(_0xaa5b8e- -_0x3af584._0x40a1ca,_0x2bc360);}try{const _0x571e50={};return _0x571e50['stdio']=_0x55fe6f(-0x2e5,-_0x20804._0x665dc9),_0x247754['ljMOx'](execFileSync,_0x4aa272,_0x180f46,_0x571e50),!![];}catch{return![];}}function commandExists(_0x450a64){const _0x2a7f34={_0x16253f:0x487,_0x1da12b:0x89f,_0x3b6c7f:0x7e1,_0xd684a9:0x550,_0x1cb227:0x45f,_0x49c4a8:0x627,_0x1df562:0x6d0},_0x2e3dea={_0x43dd91:0x367},_0x15cd2e={'eCcaZ':function(_0x3bf356,_0x4e2099){return _0x3bf356===_0x4e2099;},'JcMms':function(_0x173b9a,_0x41dd21){return _0x173b9a(_0x41dd21);}};function _0x271be5(_0x25c58a,_0x250042){return _0x26b3dd(_0x25c58a- -0x20,_0x250042);}function _0x552dbd(_0x2848e1,_0x21583f){return _0x26b3dd(_0x2848e1- -_0x2e3dea._0x43dd91,_0x21583f);}if(_0x15cd2e[_0x552dbd(0x40a,_0x2a7f34._0x16253f)](process[_0x552dbd(0x5fe,0x69c)],_0x271be5(_0x2a7f34._0x1da12b,_0x2a7f34._0x3b6c7f)))return commandSucceeds('where',[_0x450a64]);return commandSucceeds('sh',['-c',_0x271be5(_0x2a7f34._0xd684a9,_0x2a7f34._0x1cb227)+'-v\x20'+_0x15cd2e[_0x552dbd(_0x2a7f34._0x49c4a8,_0x2a7f34._0x1df562)](escapeShellWord,_0x450a64)]);}function execIgnoreFailure(_0x3a7618,_0x23f611){const _0x54cb50={_0x55dea9:0x1b0,_0x9d5f2e:0x20b},_0x38286a={_0x15bf05:0x27b};function _0x47cbe(_0x3b265d,_0x9be7eb){return _0x3266d5(_0x9be7eb,_0x3b265d- -_0x38286a._0x15bf05);}try{const _0x520c9d={};_0x520c9d['stdio']=_0x47cbe(-_0x54cb50._0x55dea9,-_0x54cb50._0x9d5f2e),execFileSync(_0x3a7618,_0x23f611,_0x520c9d);}catch{}}function rmIfExists(_0x63504f){if(!_0x3e4d20(_0x63504f))return;const _0x2907eb={};_0x2907eb['force']=!![],_0x4763ae(_0x63504f,_0x2907eb);}function isMissingCrontabError(_0x13b940){const _0x4dda8b={_0x48ac05:0x61d,_0x91dca6:0x32f,_0x206f0c:0x13d,_0x21f98d:0x3e4,_0x75c191:0x68a,_0x4b297f:0x72,_0x5cb984:0x6c6,_0x17ac5f:0x45f,_0x18e7ad:0x5e2,_0x16041f:0x6c,_0x55e514:0x91,_0x175827:0x35a,_0x54d603:0x601,_0x4fd296:0x636,_0xaea2b3:0x201,_0x3d387a:0x272,_0x5c9b41:0x27a},_0x41ee83={_0x272678:0x3df},_0x2904af={_0x4f55d4:0x1f9},_0x1986f1={};_0x1986f1['gakXJ']=_0x246628(0x8cb,_0x4dda8b._0x48ac05)+'ab\x20for';const _0x3b59e4=_0x1986f1;if(!(_0x13b940 instanceof Error))return![];const _0x4adc1e=_0x13b940[_0xce9e16(_0x4dda8b._0x91dca6,_0x4dda8b._0x206f0c)][_0xce9e16(_0x4dda8b._0x21f98d,0x35a)+'ase'](),_0x580afd=_0x13b940[_0x246628(_0x4dda8b._0x75c191,0x8a8)];function _0xce9e16(_0x1dc2e0,_0x2d34f9){return _0x3266d5(_0x1dc2e0,_0x2d34f9- -_0x2904af._0x4f55d4);}const _0x1967c4=typeof _0x580afd===_0xce9e16(_0x4dda8b._0x4b297f,0x17e)?_0x580afd[_0xce9e16(0x355,0x35a)+_0xce9e16(0xab,0x5e)]():Buffer[_0x246628(0x67f,_0x4dda8b._0x5cb984)](_0x580afd)?_0x580afd[_0x246628(_0x4dda8b._0x17ac5f,_0x4dda8b._0x18e7ad)](_0xce9e16(_0x4dda8b._0x16041f,-_0x4dda8b._0x55e514))[_0xce9e16(0x132,_0x4dda8b._0x175827)+_0x246628(_0x4dda8b._0x54d603,_0x4dda8b._0x4fd296)]():'';function _0x246628(_0x2a7fc0,_0x176b5b){return _0x3266d5(_0x2a7fc0,_0x176b5b-_0x41ee83._0x272678);}return _0x4adc1e['includes'](_0xce9e16(_0x4dda8b._0xaea2b3,0x45)+_0x246628(_0x4dda8b._0x3d387a,0x47e))||_0x1967c4['includes'](_0x3b59e4[_0xce9e16(0x102,_0x4dda8b._0x5c9b41)]);}function formatError(_0x328ce6){if(_0x328ce6 instanceof Error&&_0x328ce6['message'])return _0x328ce6['message'];return String(_0x328ce6);}import{randomBytes}from'crypto';import{existsSync as _0x1fa654,readFileSync as _0x593eae}from'fs';import{chmod,mkdir,readFile,rename,rm,writeFile}from'fs/promises';import{homedir as _0x3c82be}from'os';import{dirname as _0x5bba2e,join as _0x1d2c1b,resolve}from'path';var DEFAULT_GATEWAY_URL=_0x3266d5(0x12a,0x12b)+_0x3266d5(0x73f,0x4a2)+'8789',DEVICE_BOOTSTRAP_TOKEN_TTL_MS=0xa*0x3c*0x3e8,BOOTSTRAP_FILENAME=_0x3266d5(0x234,0x3a5)+'p.json',PAIRING_TOKEN_BYTES=0x20,withBootstrapLock=createAsyncLock();function resolveGatewayUrl(_0x201faf){const _0x53f55d={_0x59eeec:0x30d,_0x1a5acc:0x498,_0xa9c9b1:0x2f2,_0x4afe5f:0x112},_0x4b2839={_0x3f4cb0:0x122},_0x2d32f1={};_0x2d32f1[_0x925ec(0x49c,_0x53f55d._0x59eeec)]=function(_0x3476a2,_0x2d8e03){return _0x3476a2===_0x2d8e03;};const _0x5114ac=_0x2d32f1,_0x3f8a8e=_0x201faf?.['trim']();if(_0x3f8a8e)return _0x3f8a8e;function _0x925ec(_0x2e6eb7,_0x5901d8){return _0x3266d5(_0x5901d8,_0x2e6eb7-0x1c7);}const _0x7abd68=readOpenClawInfo();function _0x265061(_0x214943,_0x412add){return _0x3266d5(_0x412add,_0x214943- -_0x4b2839._0x3f4cb0);}if(_0x5114ac[_0x265061(0x1b3,0xef)](typeof _0x7abd68[_0x265061(0x430,_0x53f55d._0x1a5acc)+_0x925ec(0x30e,0x30d)],'number'))return _0x925ec(_0x53f55d._0xa9c9b1,0x3bf)+_0x265061(-0x20,_0x53f55d._0x4afe5f)+_0x7abd68[_0x925ec(0x719,0x950)+_0x265061(0x25,-0x1d1)];return DEFAULT_GATEWAY_URL;}function readOpenClawInfo(){const _0x556476={_0x8dbf7c:0x41,_0x3e46d2:0x2d4,_0x1e2e8e:0x2ce,_0xf0c615:0x2e9,_0x354890:0x2f2,_0x1c60d6:0x19a,_0x3c969a:0xac,_0x13186e:0x288,_0x3f109e:0x2cc,_0x59a200:0x12e,_0x38e73d:0x269,_0x54b3b3:0x156,_0x3251e5:0x252,_0x37f4ec:0x391,_0x4a59bd:0x1a1,_0x5d3206:0x108,_0xd5c9b:0x2b3,_0x1447d0:0x1c5,_0x299fbc:0xde},_0x497592={_0x2baaca:0x17};function _0x35096f(_0x567d65,_0x3fce7a){return _0x3266d5(_0x3fce7a,_0x567d65- -0x1d4);}function _0x292f70(_0x2f7d42,_0x5b11b8){return _0x3266d5(_0x5b11b8,_0x2f7d42- -_0x497592._0x2baaca);}const _0x15c745={'lIUHp':function(_0x452f97,_0x42d5ac){return _0x452f97(_0x42d5ac);},'MswUW':function(_0x19b793,_0x3b8358){return _0x19b793===_0x3b8358;},'qKoYs':_0x35096f(0x331,0xf9),'IPznc':function(_0x11750b){return _0x11750b();}},_0x4d9465=resolveOpenClawPaths();if(!_0x15c745[_0x35096f(0x215,-_0x556476._0x8dbf7c)](_0x1fa654,_0x4d9465[_0x292f70(_0x556476._0x3e46d2,_0x556476._0x1e2e8e)+'th']))return{'configFound':![],'gatewayPort':null,'authMode':null,'token':readGatewayTokenEnv(),'password':readGatewayPasswordEnv()};try{const _0x1d2be0=JSON['parse'](_0x593eae(_0x4d9465[_0x292f70(0x2d4,_0x556476._0xf0c615)+'th'],_0x35096f(-0x6c,0x94))),_0x203c2f=_0x1d2be0[_0x35096f(0xac,-0xc)]?.[_0x35096f(_0x556476._0x354890,0x2a0)],_0x451186=_0x15c745['MswUW'](typeof _0x203c2f,_0x15c745[_0x292f70(_0x556476._0x1c60d6,0x1f9)])&&Number[_0x292f70(0xad,0x289)+'r'](_0x203c2f)?_0x203c2f:null,_0x141dc9=_0x1d2be0[_0x35096f(_0x556476._0x3c969a,-0x94)]?.['auth']?.[_0x292f70(0x49a,0x70e)]===_0x292f70(_0x556476._0x13186e,0x452)||_0x1d2be0[_0x35096f(_0x556476._0x3c969a,_0x556476._0x3f109e)]?.[_0x292f70(0x75,-0x7c)]?.[_0x292f70(0x49a,0x226)]===_0x35096f(0x2b3,_0x556476._0x59a200)?_0x1d2be0[_0x292f70(_0x556476._0x38e73d,0xe0)][_0x292f70(0x75,0x37)]['mode']:null,_0x2fca13=readConfiguredSecret(_0x1d2be0[_0x292f70(0x269,_0x556476._0x54b3b3)]?.['auth']?.[_0x292f70(_0x556476._0x13186e,0xc4)])??readGatewayTokenEnv(),_0x1e54a4=_0x15c745['lIUHp'](readConfiguredSecret,_0x1d2be0[_0x35096f(_0x556476._0x3c969a,0x206)]?.['auth']?.[_0x292f70(0x470,0x3d0)])??readGatewayPasswordEnv(),_0x4f1f39={};return _0x4f1f39[_0x292f70(0x207,_0x556476._0x3251e5)+_0x292f70(0xde,-0xd1)]=!![],_0x4f1f39[_0x292f70(0x53b,_0x556476._0x37f4ec)+_0x292f70(0x130,_0x556476._0x4a59bd)]=_0x451186,_0x4f1f39[_0x35096f(_0x556476._0x5d3206,-0x17b)]=_0x141dc9,_0x4f1f39[_0x35096f(0xcb,0x240)]=_0x2fca13,_0x4f1f39[_0x35096f(_0x556476._0xd5c9b,0xd8)]=_0x1e54a4,_0x4f1f39;}catch{return{'configFound':!![],'gatewayPort':null,'authMode':null,'token':_0x15c745[_0x35096f(-_0x556476._0x1447d0,_0x556476._0x299fbc)](readGatewayTokenEnv),'password':readGatewayPasswordEnv()};}}function resolveGatewayAuth(){const _0x3e8b70={_0x4b7cb5:0x2d5,_0x4cac81:0x544,_0x14d1f9:0x326,_0x1886a0:0xbc,_0x2a1fa8:0xa2,_0x48d394:0x2f6,_0x22d393:0x227,_0x4a046a:0x47d,_0x1456ee:0x421,_0x1cb7a2:0x342,_0x2a1951:0x18d,_0x2ec027:0x22,_0x4f35c9:0x140,_0x231480:0x29e,_0x104acc:0xcb,_0x1bade8:0x62,_0x82a845:0x2e6,_0x1ccbb5:0x261,_0xd54739:0x33f,_0x558e61:0xad,_0x61fddd:0x21c,_0x560e22:0xe5,_0x220e0f:0x315,_0x2589b2:0x2d7,_0x15369e:0x57c,_0x420154:0x4bf,_0x7802de:0x59c,_0x4b84f4:0x2e,_0x130a7e:0x276},_0x22cc7c={_0x9b084c:0x211},_0x339dd6={'eAEET':function(_0x228c01){return _0x228c01();},'txjEy':function(_0x170f3d,_0x397efa){return _0x170f3d==_0x397efa;},'lvxPL':function(_0x272f23,_0x1badb8){return _0x272f23===_0x1badb8;},'IVQOC':_0x30f497(-0x72,0x8e)},_0x3a710e=_0x339dd6[_0x39006a(_0x3e8b70._0x4b7cb5,_0x3e8b70._0x4cac81)](readOpenClawInfo),_0x3bc830=_0x3a710e[_0x30f497(0x85,0x8e)],_0x1188fa=_0x3a710e[_0x39006a(_0x3e8b70._0x14d1f9,0x4bf)];if(_0x3bc830&&_0x1188fa&&_0x339dd6[_0x39006a(-_0x3e8b70._0x1886a0,0xe2)](_0x3a710e[_0x39006a(0x4ab,0x314)],null)){const _0x16d083={};return _0x16d083[_0x30f497(-_0x3e8b70._0x2a1fa8,0x8e)]=_0x3bc830,_0x16d083['password']=_0x1188fa,_0x16d083[_0x39006a(0x31e,_0x3e8b70._0x48d394)]=_0x39006a(_0x3e8b70._0x22d393,0x2d7),_0x16d083[_0x30f497(_0x3e8b70._0x4a046a,0x29a)]='OpenClaw'+'\x20has\x20bot'+_0x39006a(0x50b,0x502)+'y\x20token\x20'+_0x39006a(_0x3e8b70._0x1456ee,_0x3e8b70._0x1cb7a2)+'word\x20con'+_0x30f497(-0xd1,0xd4)+'\x20but\x20gat'+'eway.aut'+_0x39006a(0x11a,_0x3e8b70._0x2a1951)+_0x30f497(-0xd1,0x1cc)+_0x30f497(-_0x3e8b70._0x2ec027,_0x3e8b70._0x4f35c9)+_0x30f497(0x4ae,_0x3e8b70._0x231480)+'\x20token\x20o'+'r\x20passwo'+'rd\x20befor'+_0x39006a(0x526,0x47c)+'g.',_0x16d083;}if(_0x3a710e[_0x30f497(-0x14f,_0x3e8b70._0x104acc)]==='password'){const _0x61f26b={};return _0x61f26b[_0x39006a(_0x3e8b70._0x1bade8,0x2d7)]=null,_0x61f26b[_0x39006a(_0x3e8b70._0x82a845,0x4bf)]=null,_0x61f26b[_0x39006a(0x565,0x2f6)]=null,_0x1188fa?{'token':null,'password':_0x1188fa,'label':'password'}:_0x61f26b;}function _0x39006a(_0x5e0043,_0x50c750){return _0x3266d5(_0x5e0043,_0x50c750-0x38);}if(_0x339dd6['lvxPL'](_0x3a710e['authMode'],_0x339dd6[_0x30f497(_0x3e8b70._0x1ccbb5,-0x2f)])){const _0x164136={};return _0x164136[_0x39006a(_0x3e8b70._0xd54739,0x2d7)]=null,_0x164136['password']=null,_0x164136[_0x30f497(-0x1c7,_0x3e8b70._0x558e61)]=null,_0x3bc830?{'token':_0x3bc830,'password':null,'label':_0x39006a(_0x3e8b70._0x61fddd,0x2d7)}:_0x164136;}function _0x30f497(_0x215cef,_0x5fb19c){return _0x3266d5(_0x215cef,_0x5fb19c- -_0x22cc7c._0x9b084c);}if(_0x3bc830){const _0x29fff5={};return _0x29fff5['token']=_0x3bc830,_0x29fff5[_0x30f497(_0x3e8b70._0x560e22,0x276)]=null,_0x29fff5[_0x30f497(0x2a7,_0x3e8b70._0x558e61)]=_0x39006a(_0x3e8b70._0x220e0f,_0x3e8b70._0x2589b2),_0x29fff5;}if(_0x1188fa){const _0x32311d={};return _0x32311d[_0x39006a(0x5b,0x2d7)]=null,_0x32311d[_0x39006a(_0x3e8b70._0x15369e,_0x3e8b70._0x420154)]=_0x1188fa,_0x32311d[_0x30f497(0x205,0xad)]=_0x39006a(_0x3e8b70._0x7802de,_0x3e8b70._0x420154),_0x32311d;}const _0x38de3b={};return _0x38de3b['token']=null,_0x38de3b[_0x30f497(_0x3e8b70._0x4b84f4,_0x3e8b70._0x130a7e)]=null,_0x38de3b[_0x39006a(0xa9,_0x3e8b70._0x48d394)]=null,_0x38de3b;}function _0x1cc1(){const _0x8deb5e=['Bg8W','u21As1K','ohHrt0nfCq','zxDHEsa','B3vUDa','CYb1BNnLDc4','ugf0AdWVA2u','swq9','zuHvtKS','BgLUDxGTy3i','BM90igjLihm','lNnLCNzPy2u','zw1HBMqGzhi','cIaGpc9HCNi','igj1DcbZDg8','zwqGy29Kzt0','ugnTz0W','BeLvsha','zg9JDg9Y','BMCUieXLzNq','AwvUDeLK','u2vYDMLJzv0','B3qGzM91BMq','EsbruIbPBIa','icbLEgvJig4','CMvTB3rLsxa','zxrYEvrPBwu','z2f0zxDHEvu','CNvUlxjLz2K','vg9Rzw5gB3u','AwWGz2f0zxC','Ee5jsgW','BLrQs1K','CNvUBMLUzW','EwXOy2G','C3rVCciGzMK','ywnJzxnZq28','ywrK','ohWYFdv8nhW','DMjVEa','CgLK','z2f0zxDHEuG','r1nMtvG','BMCGy29UBMu','B2jZzxj2zum','C0fAy2S','B2S9zMfSC2u','ignVBMzPzYa','DwvZDcbYzxm','q3v2z0S','Bg9Nugf0Aa','Ag9ZDg5HBwu','CMvJDxjZAxy','CMvMCMvZAc0','ls1Syxn0ihy','AgfIBgu','zgzSyxjLigm','C2nYAxb0uge','DLrcu3O','Dw5HDMfPBge','ywrKCMvZCW','ls1NyxrLD2e','zxHJBhvKzva','y2XVC2u','CMvHy2HHyMW','FdL8mxWWFde','ifjLC3rHCNq','BwuGBM90igy','D3nZoG','C3vLzcbYzxe','s3fLwhe','y2XLyxjjBKy','yxrLza','id4MmG','uKW6ia','yxbWBguUy28','ywDLBNrZ','zxj2AwnLlMO','A2DWD3C','lMnSyxDRzxq','sLnKBha','yxrLD2f5t3a','ChzcvK8','Dd4kica8A2u','y2HHBgXLBMC','CMvXlq','cLr5Cgu9C2K','D2LUmZi','zw50CMLLCW','CxjjBwfNzva','r1HSzhi','rvvZzKS','CMfUzg9T','ihjLyxnVBJ0','EezHqwu','BMvJDgLUzW','y3jLyxrLv2u','zMLUza','BgvUz3rO','Axn0lteUmc4','nhWXnxW3Fdq','q1DfBhe','zxqGqNjPzgC','zgv0ywnOzwq','mJaW','lvrfuK0','A2LUz0rPCMu','CMvSyxLtzwm','zsbWywLYAw4','CYbTAxnZAw4','yuP6tvy','pd94BwWGDMu','yvvsy0S','w1vUAxrDcKq','z2uUANnVBG','qxrnCZ0','yNjPzgDLlwm','ugfZC3DVCMq','CgfPCMLUzYa','DgfZA2TPBgW','B3vUzcbMB3i','yxqG','sgLzAhK','DMLJzsbMB3i','BMzPzYbWyxq','u0nssvbux1a','jMfTCdS','CMvWBgfJzue','AxnZAw5Nx3i','tMfTztOG','y3qGAgfUzhm','zcbHigXVy2e','uMvXDwvZDfi','rMfPBgvKihq','Aw5Nr2f0zxC','tg9JywWGt3a','C2nVCgvZ','CMLUzYb3Axq','pL0GwY0TCMu','CKPsqKm','FdeWFdn8mtm','ignVBM5Ly3q','zxnJCMLWDgK','CNvU','zgLUzZ0Ivvq','ica8yxjYyxK','ywLUigf0igW','BgfZDe1Z','AguGyNjPzgC','igzHBgXIywm','Dg9Rzw4GAxm','C3rPBgWGCgu','lwPZB25D','rxjYB3iGtg8','C3rHCNrLzee','z2fRweO','igjYB3DZzxi','Aw5ZDc0','BcbNyxrLD2e','Dw5Kyxj5ihi','uMvZDgfYDgu','C2vUzfrVr2e','mNWZFdr8mxW','DxjS','zxHLy1bHDgG','AxbLEMq','tM8GBwf0y2G','BMD0Ad0','AgvHzgvYCW','uefjuKLor18','zxf1zxn0','vM9yCe4','u3rHCNrLzca','ChbLzc4GuMu','l3DZ','CgfZC3DVCMq','B3j0pL0GwY0','terNA2e','ChvZAa','Bgf1BMnOy3q','C2vHCMnO','AxngAw5PDgu','Axz3EgW','Bg9N','yxrLD2f5igK','zxnVBhzLza','BMv2veu','Eu9Wzw4','Esb0B2TLBIa','CM9JzxnZzxm','AYbPCYbHDMe','zgv2AwnLtMe','ChzNs20','y2XPzw50x2m','zwXHChnLzfm','ywLYic0TzM8','CgfPCIbYzxe','AxnhyxrLD2e','y29UzMLNoIa','Bgf3A2v0ihi','CfrVA2vU','whDjwKO','lJaUmc4XoJe','CNvUDgLTzs4','qNjPzgDL','zffMAwy','DxrVBwf0Awm','Aw52ywXPzf8','ktOGq2XVDwq','zxrYEurLBge','CM9TigeGzgK','zxjYB3i','Bg9ZAw5NigK','ywX1zxmGBgK','zMfTAwX5','ig1VzguGDg8','C2v0vgLTzw8','Bw9Kzq','y2XPzw50igq','DgfPBhmSig8','C2vYDMLJzva','yxv0AcbWyxq','twXvCxO','Dd4k','mti3lJaUmc4','v0jQwLy','CNvLlZ4kica','u3rHCNrPBMC','yxrLD2f5twu','Aw5JBhvKzxm','igzHAwXLzca','Ahzqzeq','ienSyxDRzxq','C2HPzNq','C0zVAK0','ExneAvi','B1zmEvG','ifSTlwzVCMm','Cg9YDa','rLzNrMG','BwvZC2fNzxm','C3rKzxjY','AcbNyxrLD2e','kcGOlISPkYK','EsbJAgvJAY4','zMLSDgvY','y29UBMvJDca','y29UDhjVBa','zxK+uNvUqxq','CMvXDwvZDa','seTdvvXtB2y','v2LUzg93C1W','DgfW','CgXHDgzVCM0','BgX3','iMnSyxDRzxq','zg9LCYbUB3q','AxmTywn0Axy','lY9OB3n0oNa','AxmGBg9JywW','AM9PBG','BMqU','ls1XCI1MAwW','CMLUzYbJB2q','s1PjyKm','CMvHzhLtDge','CMvJzw50','BfnUDe4','AgfUzgXLuMu','A3LQvwy','DxjSpL0GwY0','CMLKz2vdBgK','zxHPDa','z2vZ','zw5ZDxjLr2e','zguGAw4GDgG','AgfZ','zhrKiJ4kpha','y29Uy2f0','DhjPBuvUza','CMvMCMvZAgu','CNjVCKXVzW','AxnWBgf5tMe','nNW1FdH8mti','wevQAfy','D2XHBG','EMrgseW','ignSAsbZzxi','DwfQqxq','tg9NihbHDgG','uhrfrK8','tffxz0y','igHHBMrZAge','C3rVCa','sMnnBxm','zw1HBMq','y05gzgq','CMvSyxLtB2m','zxf1zxn0x2K','B2rLiciKu0m','CMfTCW','BNvTyMvY','iYbJBgf3A2u','vMHNEe4','s09Yvue','A2LSBa','zxjYB3jdB2q','uvf2u3q','zuffrvq','ls1QC29U','y3rVCNK9','uKvrvuLsruq','zxvLigjLzM8','l2fJy2vZCY0','CMvN','zxjZAw9Uxfi','su9PC1G','BYbKzxrLCM0','yMXLigr1CMK','y3jLyxrLzee','igf1DgHgAwu','CM9YoIa','C1PYAem','ihrVA2vUoIa','r3rLBwm','DgLTzwqGB3u','AxmGuviGy28','zg9JA2vY','CgvUzgLUz0C','zgvMyxvSDa','ihrVihnWzwm','C2GGzhjVCha','yxj0ienSyxC','mtb8mtn8mtC','phjLzgfJDgu','z2vYihrVihi','x0DbvevxqvK','D2LUzg93C0G','A2v0igfWCdO','t2nfrgm','zwrcEt1Kzwy','zxjLBNqGC2u','C2vHCMnOuge','qhjLyM9VDca','DgHLBG','zxDHEs5HDxq','uLLysKW','zxnO','zxjosxu','ig1LDgHVzd0','CuLKpq','l1bjra','Awz5igeGy3u','uNvUigbJBge','B25qzw5KAw4','DgvKoYbNyxq','wu9dyKS','ls1LCNjVCNm','D2f5uMvXDwu','CNnPB249iJe','zgfYD2LU','q29UzMLNrgK','DhLWzq','iI4GvxnLihy','B25iq00','yNjPzgDL','Axjjzva','CMvJB25Uzwm','BxvvBe0','B2zM','igLUDgvUDgK','ief1Dg9Tyxq','DvHdDgq','BgXDcLDHBNq','uxHvuvm','yxjNzxqkcLS','BNn0ywXSzwq','Agv4','z2f0zxDHEva','Dg9mB3DLCKm','yNiT','x1rps0vo','zLfMtgG','y2f0y2G','B0Dzs1y','BNqGDgHHDca','zMXHDe1HCa','zxDHEvf1zxu','BMC+','C25HChnOB3q','Aw5ZDgfUy2u','BgLZDcb2zxi','qvriiIbDoYa','AxjLza','zwqGyMfJA2C','qxv0BY1PBNm','Cc5Yzxf1zxm','Cc5LCNjVCG','Aw5LigeGtee','igf2ywLSywi','CLzJB1G','Bgf5twvZC2e','BguGzhjVCha','BgLUDxG','BgfZDfjLBge','B25Uzwn0zwq','DaPxyw50CZ0','Bgf5q29UDhi','zgLZy29UBMu','u2vYDMLJzsa','shHWDu8','iejYAwrNzsa','BM5pwey','BMvJDeHHBMq','C2LUzY4','mc4WlJaUma','y2XLyxjuAw0','BM9Uy2u','uviGAw1Hz2u','B25mB2C','igj1DcbNyxq','y0jWyxO','igDHDgv3yxK','x1bbu1nxt1i','lMfP','AxjPBMCU','CgfPCMvK','CMf3','ihn0B3aU','tK9ux1bbsvi','D2LUzg93CY0','C3rHCNqGDxi','tgLUDxGGC2u','Dgv3yxLnzxm','C2XPy2u','sw52ywXPzca','EvL2yNC','ls1Syxn0','q2XHD2TLDca','zcbHBMqGBM8','zgv2AwnLCW','svb6BMm','Bg9Hza','t0z5rhC','mtK5nePwB0fHta','tKP3s2e','rI04iJ8+cJW','DgvZDa','A2LUza','C3rYAw5NAwy','B249q2XHD2S','zw5JB2rPBMC','C3LZDgvTza','D3rQCvC','tg9NoIa','CgfYyw1Z','CMvZ','BIWGyw5Kihq','yxbWBhK','uNbbt2G','y2XPzw50q28','z2f0zxDHEvi','y29UzMLNrgK','v016rhy','C2rlvM4','BMvJDhm','zfvYBa','ls1SB2nHBa','CgfPCG','C2nOzwr1Bgu','zMzLCMvUDca','D2LMAq','l251BgWGmJ4','BwLZC2LUzW','CM91BMqGC2u','pGO8l2rPy3q','Cgf0Ag5HBwu','yxrO','B2X2zwqGCMu','jMD0oW','ignSAwvUDhm','tgHuqNO','Cgf5Bg9Hzc4','B3iGCgfZC3C','igLZihjLCxu','z2f0zxDHEvm','B2jQzwn0','zerLDMLJzxm','zhjVCfn0ywW','BgLLBNq','ihjLCxvLC3q','zgu9','zwL3uvq','B2nRzxq','zgvJAxnPB24','suTgDeK','y29UBMvJDa','y2HHBMDLzc4','B3iGDxnLige','zxHWAxjLC0e','z3jer3i','BK1JDwu','CI1MAwXLidW','mta0AhDQD2Ln','rxbfAKO','yxjNDG','y2XPzw50rgu','t0jAD3q','DM1Uzxq','CgvUzgLUz1a','zhzXAfi','ihrVDgfSpq','tgLICMfYEq','zxjYB3jmB2C','zwq9','Ahr0Chm6lY8','y29UzMLN','BIaIy2XHD2S','C3rHBgXHDgK','qvripsi','yxrLD2f5ihi','y1fmrgW','yxbWCM92zva','rgv0zwn0zwq','vuTxD1G','zevYCM9Ypwe','zxrcCMLKz2u','ChHcBNC','q2XLyxjLzca','C2nVCMu','sNr3yKS','Et5mywjLBdW','tw9IAwXLiem','y0Hbwvu','Dw5RBM93BG','C29U','A25ZtNi','zxHWB3j0ifa','Dg9Y','Dg9eyxrHvvi','Ag9ZDdPWB3i','B250ywi','BhjLywr5iha','C2L6zq','ugf0AdOG','ChjVDg9JB2W','u3rHCNrLza','y29UzMLNig4','cLnJyw4GDgG','CgfYC2u','qxrnCW','B2rL','DgvKihbSyxq','zt1WyxnZD28','B2S9Dhj1zq','z2vUzxjHDgu','ihrVihjLC3q','zxDHEvvYBa','yNjPzgDLlxm','zxHPDcaXmJC','wxveAMO','yxLnCW','CNrIzwf0','mM0SidfOlca','y29UC3rYDwm','Dw5Yzwy','yxv0Aa','Aw5ZDgfSBgu','D2fZig5VDca','q3vYCMvUDfy','BwLU','zsbdteKGC2m','C3LZDgvTzc0','DcbKB2vZig4','zcbZAw5JzuC','CxvLCNK','C3nHz2u9','zwzYzxnOzwq','A2TLCLK','AunAD0W','C2HHA2vZ','Bg9NCW','lY5VCgvUy2W','Ahr0CdOVlW','EKjfv2m','ywiGzM9Y','uMvTB3zLzca','DwvZDcbWzw4','u2vYDMvYifu','rM56r0u','y291BNq','qMfJA2DYB3u','zwnHDxnLigW','zM91BMq','B3nLzdOG','mti3AhLVD0Do','DhHQrxK','wKndCwy','y0XcAuC','yxDKBa','CNzPy2uGAw4','DxjSidX3CZO','DMLJzq','igrLDMLJzuK','BM90igLUC3q','ktOG','AK5iBuW','BM9VCa','t1LkvM8','vgHPCYbOB3m','C3rHCNq','m3WXFde0FdC','BI4GvxnLihK','q0Xbv0rct1q','t3HbueC','mci+cJXKAwm','DgfYDdOG','D2TLDcbKB2m','DxHrCvG','zMfSBgjHy2S','CLf1zxvLr2e','Euv3uwG','AxnjBNrLz2u','twnHDe0','B3vYignVBNq','ugfPCMLUzYa','BM90ihbHAxi','uen3ALi','yxj0','AwDUB3jL','C291CMnLq2W','zcbIywnRz3i','BMDqywLYuMu','C3rHBguGCxu','ig9YihbYB2m','ChvIBgLJs2u','zxDHEsbYzw0','yxKGCMvJB24','uMHWBuG','jMX0oW','B3bLBG','z2v0vgLTzq','q29UBMvJDeG','AgfUzhnOywS','C3rYEsbbueK','zxjYB3i6ia','AgvHCNrIzwe','tKnoEKi','Axn0CMf0Aw8','DMLJzsbYzxm','y29TBwfUzca','ywLYzwqGD2K','D3m6lY8','ruj3re4','ihrLEhq9','Aejwv3q','zgv0ywLSCW','Dw5hDfC','DcbHCha6cG','C2fNzq','lNbUzW','ywLUCYbUzwu','ig1HBMfNzxi','sciGCNvUic0','zgLZCgXHEu4','EwvZ','yMfJA2DYB3u','ienmssbZzxi','CM9Wzxj0EuW','C2fNzxmGyMu','DwvZDeLKpq','Dw5K','ndq3otzMrvbYtNq','EufJDgL2Axq','Cgf0AevUDG','ihnLCNzPy2u','BM9Uy2vqCMu','qwDeEge','CMvXDwLYzwq','BgLZDa','vK5oq2O','ChvZAfbLBMq','lIbsDw4GCge','shDIyuC','lJaUmc4XoG','C3rVCeHLyxi','vvjmoIa','qxjNDw1LBNq','DK12qva','rxPTvwO','D29YzcbJB24','C3rZ','uwnvBvK','ig5VBMnLuhi','zwqU','C2XVD1DHCM4','lZeYnY4WlJa','Dg90ywW','y2XVC2vhyxq','zwfZDcbVBMu','t3bLBKnSyxC','zNflCuG','zxqU','zsb5B3vYigm','ihjLCuLKpq','zgf0yq','l3yXl3bHAxi','ls11C2vY','B3bLBMnSyxC','uKvhx1nA','uLznswu','C2vUzeDHDgu','txvMtwO','y2XPzw50swq','ig1LzgLHoIa','BMv0D29YAYa','ugf0Aa','zM9Aue8','Aw5gBgLNAhq','BIbMywLSzwq','CgLUzW','lNbSAxn0','zsbYDw50Aw0','zeT5EuW','y29UBMvJDc4','D3m6lY8XmJC','AejdAKS','nZC4nuzyuMLvDq','tNzqrfq','C3rHCNrPBMC','CMLUzZ4','EsbYDw5UAw4','zhjVChbLzca','AdOG','B3rZDhjHCfi','r2f0zxDHEsa','lw5LDW','v2f2uwi','ihj1BNrPBwu','ChDsvgO','vw5ZDxbWB3i','yxv0AezPzwW','s0rqsMy','C2vYDMvYvxi','EgL5Cxi','CMvSyxKGzxi','lMPZB24','A2vtDgfYDgu','CgXHy2vD','pwfSD2f5CWO','DgLUzYbMB3i','B2TLBG','rKfdwxO','B3j0','suq6ia','B3bWzwqGDg8','B25tDgf0Dxm','zgfLBw9Ulxi','ig1VCMuGzgu','BwfPBG','Aw5Jzq','lwnSAq','CMvZCg9UC2u','lI4U','zg93BG','CgXHy2uIihq','ls1SAw5LCW','Ac5TB2rLigK','zxHPDenVzgu','B25Uzwn0sge','A2v5pKTLzxa','CMvSyxKGzgK','zwjVB3qU','BMvJDgvK','zw5nCZ0','ywn0Aw9U','uLHAz0y','ywrKugvUzgK','y29UDhjVBf8','ndi3nJu1z0zRvwTK','DgGG','CMvZAgvKlG','DhH1vhu','CxvLC3q','AxbZzwm','iurpq1rzueu','DxrMoa','uMvSyxLszwm','pg5VBMu+','zxzLBNq','Bwf4','ywXSzwq','zgvYia','Et4kica8Dhi','AcbMB3iGC2u','ru4IicjODhq','cGPBsw5ZDge','zg9yv1q','uND6u3O','BwfYA0rLDMK','pLn0yw5Kyxi','tfHJyM8','B2jZzxj2zuC','s0vKD2C','Bg9JywXhyxq','ywLYuMvXDwu','Bs9everZl1a','yLnVy2TLDa','icH0B2TLBIa','u3rYAw5N','CdOVl3D3DY4','t0LgyKy','igrLy2LZAw8','B3b0Aw9UCW','Et4kica8C3q','Dc1ICMLKz2u','BM9KzvbHDgG','ywnOywjSzsa','lM9Wzw5JBge','AM5wtvG','BMrHCMrpDxq','D3m6','DxnLCM5HBwu','zguGCNvUDgK','B250ywLUzxi','Aw5NpG','Fdj8mte','zMXHCMuGy2G','CIb1C2uGygm','C2nVCgvZig0','CMvYDw4GD2K','EgDNtMO','Dw50Aw1Lihm','AcbHigrPzMy','uxPOv1K','u0Lhvevstq','AevNuMy','y29Kzq','CYbHBhjLywq','m3WWFdv8mxW','BxbSzqPfEgu','BwfUzfn0yxi','EefAvK4','q29UzMLNoIa','C0f0','wwTYAMO','C3nHz2vZ','CgLWzq','lJe6mtG3odK','B24U','DhDHCMvCtwK','vNv1BuK','pGOGidXRzxK','z2f0zxDHEum','B3rZDhjHCca','vMvYC2LVBJO','pGO8l3bSAxm','w3n0yxr1C10','Aw5KzxHpzG','CuTVwxm','DgfPBhnJywW','Cgf0AdOG','BM5Ly3rLzca','Bg9NCYbMB3u','CNzPy2uGDg8','BsbNyxrLD2e','y29UBMvJDfi','C3rYEq','DgfSBgf0Aw8','A2v5CW','CMvSyxLvCMW','C29YDa','CMvNAxn0zxi','Es11CMW','CxjqyxLSB2e','sw5ZDgfUy2u','qxv0AcbTB2q','Axnoyu4','ugfPCMvKoIa','BMfTzq','DwvZDa','ANH1EvO','BgLUzxm','pL0GwY0Tzxi','DgfYDgvKige','vNjyEKC','AwDuvuW','y29UBMvJDeG','zuP4zvi','CMvZDgfYDa','zsbUzxCGCge','ihvYBd0','qLjSAwO','D29JAue','zxvLzcbNyxq','y29KzsbYzwy','CMvXDwvZDeK','wgvrDM8','ig1PC3nPBMC','yNjPzgDLihi','AxnZDwvKqxq','Dxn0ignVBNq','ihPLCM87igm','AMnWBfi','zxDHEq','y2uGD2fZigK','tuzcufK','zxqGyxbWoGO','svzrt0m','CNqGyxv0B20','yuTowwe','C2vYDMvY','zYbruI4','AxnTyxrJAa','phn0CMLUzZ4','zwqGka','C2nVBM5Ly3q','DMv0Aa','q29UzMLNrM8','Dw5PBNn0ywW','yMXVy2TLzca','zw50','zxqUyNjPzgC','DMvYlG','zgvK','uefusa','AxnszwXHEu8','zcbMB3iGzNi','Aw5N','ChbLBMq6','EuXtrhC','C2PTz2C','w2nSyxDRzxq','zxmUifjLC3q','AhvsA0W','vLvJtve','igvSyxbZzwq','Dw5SB2fK','uNLICfy','C2vYDMLJzu0','rvzNsfe','Dg9tDhjPBMC','veGIiciKu0m','igr1CgXPy2e','BMqGC2vYDMK','zevYCM9Yuge','AeHMqMO','t21dtwK','zxnZig1HBMe','zxf1zxn0CW','B2r5','AeH1sMS','y3jVC29MDfW','BM5Ly3qGyxq','zxrO','CNvUiIbTyw4','Dwnsv1u','m3WWFdr8mNW','mhW0Fdj8m3W','CMvZzxq','yw50ihrVigi','CxvLC3rDihi','ihjLz2LZDhi','CNvUDgLTzsa','EunVBNrYB2W','igvYCM9Ypq','zhKGCNvUBMK','zcbZzxj2Awm','y29UzMLNrM8','zwnVBM5Ly3q','y0nnCM8','C3bVBNnLigi','CMnnsNK','zxDHEsbTzxm','zgvfEhbPCMu','AhjoCLK','DMfPBgfIBgu','vNLKq3a','phvUA25VD24','Df9YzwXHEv8','zgLUz0DHDgu','ufL6Aw4','zgvZDhjVEq','ihzLCMLMAwm','ls1MB3jJzq','CMvWBgfJzq','BgKTzxjYB3i','zM9Yy2u','BvbetKC','phbHDgG+xsa','C3rHBguGAwq','tIbjucbHzgq','ywnRihrVia','Bg9JywW','qxjxu0G','v05UB28','CgvU','z2f0zxDHEsa','B3qGC3vWCg8','y3jVBNrHyG','BM8Gy3jVBNq','zcbKzwXHEu0','D2KTzMK','uxvPqLa','EhHpDxO','C3mGls11CMW','rLzgB2u','CxvLC3rjzd0','yxbWBgLJyxq','pLbYB2DYyw0','CM9U','BMrPBMCGCMu','yMfZzty0Dxi','sgPuu2S','Be1Z','yNjPzgDLlq','CMvSyxLbDhq','igzVCIbNyxq','DgHLienSyxC','yMLUyxj5','DwLYzwq','Dg9mB2nHBgu','AxmGC2fMzxq','ls1Zzxj2zxi','ANDQz0y','yxnL','C2v0','y2yTBwL0AwC','zgfYEvbLBMq','DgvZigfYzsa','t1bftKnmqvC','B3jKks4','iYeVyMLUl3m','Aw9Ul2PZB24','lw5HBwuGpgq','ue9tva','BM93','zw1WDa','Bu1fs08','vhPZswu','zgv2AwnLlNa','DxbKyxrLu24','yxnZAwDU','yxbZAg90','zxnLDciGyMu','r2vUzxjHDgu','Dgv3yxK','z0Ptugq','r2f0zxDHEvi','zxj2AwnLige','DgG8l2TLEt4','ywLYlMfWChi','ls1QC29Uxq','AgfRztSGCxu','AxnbCNjHEq','Bgf1BMnOzxi','wxn6A1e','ELjksvq','De1Z','DgvYpw5LDhC','z1HmBxC','yxr0zw1WDgu','zwXVywq','C3vJy2vLzgu','Aw5ZDgfSBa','ueHQz2S','z2f0zxDHEq','x0nptKzjr18','y0fctuq','CgPuDKS','ieLeoIa','zxnOignSAwu','C29Tzq','AwrLBNrPDhK','CuvrBuW','C3LZDgvTy3q','CZWVA2v5pGO','ls1YzxbSywm','Cgf0Ad5DifS','ywWGwY0TDxi','B3rOzxjuzxG','CMvSyxKGCMu','Aw5Qzwn0zwq','yw5Ktxm9','q2XHD2TLDei','zsbNyxrLD2e','y2vZuMvJzw4','ztOG','yLLqwhC','Dgv4Da','y2uGCMvNAxm','rw1WDhKGCMu','BNqGzgvTyw4','AguGq2XHD2S','DgfSBgvKigi','zxHWBgLJAxq','y2XLyxi','Dg9Rzw4','CMvXDwvZDgu','igf1DgGGAxm','Dd5DifSTlxe','ihrVA2vUigK','zwqGCMvXDwu','q0Xpu0ve','CMvJEwnSzsa','wY0TANnVBL0','ywX1zsaI','AvvUwgW','BxPQzKG','x1nuqvrfx0q','Aw5Ntg9Nz2u','ihjLBgf5pq','ywLYlNjLAMu','tgf1BMnOqwC','rML3uK4','igjPBMfYEt0','u2rMr2C','zxvLzcb1BNq','igTLChq9','DhjSk0mGDg8','CMvX','C2vYDMLJzuK','ywKUy2XHD2S','zxjYB3jdB3i','q2XP','z2uGCNvUDgK','DxnLCG','zxnLBNq9','BgfIzwW','yxrPyYbZDge','zMfPBgvK','zhjVChbLza','yxnZD29Yza','AxnJB25Uzwm','Cg9UzW','AxqU','z1zUr3y','B25Uzwn0Aw4','DgvKqxrnCW','A2v0','DNvUzwy','Bwv0Ag9K','ls1UB3C','CMvSyxKGy28','ihnPBMnLq2W','Bwf4ugf5Bg8','BgrZpq','DMLJzsbPBNm','Dw50Aw1LigK','B3zL','CMvZCY4Guge','vMzzuwW','s05VDeu','C2vYDMvYidW','B25Uzwn0','AgfUzgXLqM8','CMvJDgLVBKW','ywnJzxb0','yxv0Ae1Vzgu','igzYzxnOigq','C3rHCNrizwe','C0r6Exi','BM9Uy2vmzw4','zunJyvO','B25Jzq','Dgv3yxLdB24','C2vUza','zMLNDxjLzcW','y29KzsbBls0','AxncDwzMzxi','D2f5twvZC2e','uMvZDgfYDfm','ze5ND2u','y29UzMLNuge','ig9Yia','CMzmveC','CMvSyxLdB24','C3rKAw8','Axn0zxi','Ag9ZDa','ywLYlNjLC28','zgv2AwnLswq','rM91BMq','ANnVBG','Dg9YycbMB3i','r01kqLG','nta2mdu4wxfSEfHW','CMv0','C3rVBsbNyxq','CMvSyxKGyM8','yuzXsxe','vMzVueW','zgLZywjSzq','y2XHD2TLDca','Dw50','lxfYlwzPBgu','igfSC28GAgK','yxrLD2f5lxu','yxrLD2f5vxi','u2vYDMLJztO','Bg9Nu2XVD0m','zcbXDwv1zwq','ihrOzsbWywK','odi4ndq0r2LqzLjJ','yw5KihbHC3m','z2f0zxDHEvq','D3nZoI8V','z3rnr1u','r3zKv2W','Cgf5Bg9Hza','BwfW','jMfWB3m7','z1bWqwe','CM9Szq','BwfYz2LU','zNjVBq','lI4VCgfJA2e','D0DkAgy','Axjszxf1zxm','BgfZDevYCM8','lcbWDwjSAwm','Cgf0Aa','kYKRja','rxHWAxjLCZO','zM9YzsbWywK','BguGz2f0zxC','zsWGyw5Kihm','zxjYB3jnzxm','zgvMyxvSDeC','zxjZ','BgfZDfnLzw4','zM9YD2fYze8','DhjPBq','CgfPCIbBls0','rxjYB3iGBg8','BgfZDca8mM0','C3rHCNrZv2K','qxv0Ae1Vzgu','Bgf3A2v0iha','EsbWywLYAw4','C3rHDgveAxi','DhjHDgLVBI4','lJaIigvUy28','yxbWzw5KoG','mNWWFdf8m3W','C21HBgW','CgLKpsXHCMC','Bg9ZzujVDw4','BwvZC2fNzq','CM9YC10GwY0','C3rVChbLza','DMfSDwu','pc9ZDhjPBMC','sfv2qM4','rfH6zfC','ihbSAxn0ifa','CNzLCI4','zM9YzsbMBhu','DLHOvwu','BNqGq0Xjihi','BeHnC0y','BwLSEq','y2XHD2TLDc0','BwfYA1bHAxi','mJq3ndG2meHiBKrUzG','txm9','DcbWyxLSB2e','zMXVB3i','zw50CW','yMvAB3i','u0Lhsu5u','ALrfB1K','zsbJB3vSzca','z3Duy28','ugfPCIbYzwC','ifnLDcb0Agu','vxjS','z2v0','CNvUBMLUzZO','B2nHBcbBls0','B25SAw5LlNq','vLrzr1u','zgvSzxrL','C2vUDa','sK9xBMW','igvYCM9Yq28','zcbPCYbTAxm','Dw5ZDxbWB3i','BMrZAgfRzxm','ig5HBwu9','s0XougO','EuPTuhG','DgvKoYbJBg8','yMfZzty0','AxmGy3vZDg8','Eu1Z','icaGidXZDhi','AwXTzxe','zwXHEq','je5prevFuee','C2vYDMLJzq','ywnRz3jVDw4','zhnryMO','zw1HAw5Zig4','y2XVC2uGyM8','C3rHDgu','z2v0u25HChm','D1jVCfe','C2vfsu4','zxzLBa','y3rLzcbJB2q','D3DAswq','uuDWCKm','C3rYAw5N','A2uGmZbZlca','ihrYyw5ZAwu','zcbPCYbYzxe','AfLVsgO','C3rHDhvZ','zxqGAw5ZDge','DgHLihjLz2K','CxiTzMLSzsa','C3bSAxq','vgLPuhm','ChbW','zsbIywnRz3i','u2v5z0e','z2f0zxDHEuK','l3jVB3q','DNbU','yxbWCM92zwq','igHHCYbIB3q','zM9YBsbMB3i','DguGyNjPzgC','CMvQzwn0uge','t1bftG','q0vsr2G','DuroueS','y2HLzcbTB2q','Ag90','BgL1Bxu','C3bVBNnL','y2XVC2vKoIa','C3rHCNrLzca','Ee9ZCeK','y2XPzw50x2q','CMvNAxn0CNK','yxLnzxnZywC','EgXXtK4','DgjLyxq','cLn0yw5Kyxi','lxnLCNzPy2u','n3zezKfsuW','yw1L','uMrKufC','rvnHrLG','yxrLD2f5uMu','vvHVD3O','CNvUifSTlwC','yM9VDhn0CMe','igXVywqGDgG','C2vUzfjLBge','ver2yMu','BcbPCYbUB3q','sLrgtK0','mtq3nePJrfb5Bq','BM9stxC','Bwf0y2G','Dg9ju09tDhi','B3vUzcbZzxi','zYbWyxrOoIa','CM9SzsbPCYa','y29UBMvJDgu','uMvSyxKGvvi','ALbzDgi','C2fIDMS','rfb4A20','rKnJvvu','l2TLEt4kica','DgfYz2v0q2W','zwvKzwq','zcWGCNvUBMK','DM9lBvK','BhzLza','CMvXDwvZDca','uKLqvf9qqvq','ig5VBMnLtgu','txL3zhO','Bca8D3m6lY8','s1vdsu0','D2LKDgG','yxvSDc50yxi','A3z1Dhm','BMqGlxyGBM8','zgvUDgL0Esa','ihvUy2HHBMC','zuLKBgvhyxq','qKz5tKS','yw5KC2HHA2u','ihnJB3bL','s2v5lcbYB2W','iffsigLUihq','suHurxe','DfrPBwvY','CNn0lcbVCIa','nhWY','CMvQzwn0zwq','C2LVBJ0Ims4','C2LUzYbPzgW','ze91Dhb1Dd0'];_0x1cc1=function(){return _0x8deb5e;};return _0x1cc1();}function getOpenClawConfigDir(){const _0x226bdf={_0x199f59:0x449,_0x5d5c49:0x38c};function _0x5a1689(_0x3d4cd5,_0x364349){return _0x3266d5(_0x364349,_0x3d4cd5-0x425);}return resolveOpenClawPaths()[_0x5a1689(_0x226bdf._0x199f59,_0x226bdf._0x5d5c49)+'r'];}function getOpenClawStateDir(){const _0x4872be={_0xd0a93c:0x4b5},_0x543c91={_0xaa4e7c:0x279};function _0x41f1bb(_0x4f5669,_0xe4e1fe){return _0x26b3dd(_0xe4e1fe- -_0x543c91._0xaa4e7c,_0x4f5669);}return resolveOpenClawPaths()[_0x41f1bb(_0x4872be._0xd0a93c,0x545)];}function getOpenClawMediaDir(){return resolveOpenClawPaths()['mediaDir'];}function getOpenClawBootstrapPath(_0x88f091=getOpenClawStateDir()){const _0x18f88e={_0x2f467f:0x6fa,_0x1ddcca:0x4a0};function _0x2ca9ed(_0x51a69a,_0x2d7045){return _0x26b3dd(_0x51a69a-0xa8,_0x2d7045);}function _0x55d01b(_0x567ded,_0x260fd7){return _0x26b3dd(_0x567ded- -0xa2,_0x260fd7);}const _0x27f9db={};_0x27f9db[_0x55d01b(0x8e9,_0x18f88e._0x2f467f)]=_0x2ca9ed(0x546,_0x18f88e._0x1ddcca);const _0x20b5f4=_0x27f9db;return _0x1d2c1b(_0x88f091,_0x20b5f4['LQWgF'],BOOTSTRAP_FILENAME);}async function issueOpenClawBootstrapToken(_0x21dff9){const _0x1c09a2={_0x4cd1c6:0x1e3,_0x10fcc9:0x431,_0x2f2da1:0x71a,_0x3c094f:0x1ec,_0x492ca4:0x45e,_0x2c2c20:0x527,_0x37d9f0:0x3a9,_0x207618:0x464,_0x1a2200:0x5dc,_0x1fb412:0x7b0,_0x3a5e89:0x59e,_0x23e860:0x519},_0x504c1a={_0x25305c:0x6ef,_0x468778:0x741},_0x9bc417={_0x20a955:0x69},_0x1393f5={_0x3fc8fb:0x68f},_0x5809d2={_0x1da0fb:0x465},_0x1b38e0={'KZIbC':function(_0x530d9d){return _0x530d9d();},'akrkQ':function(_0x230f30,_0xab86be){return _0x230f30+_0xab86be;},'QzhWY':function(_0x2b01f2,_0x186a81){return _0x2b01f2(_0x186a81);},'jNHmL':_0xce24ec(_0x1c09a2._0x4cd1c6,_0x1c09a2._0x10fcc9)+_0x54936c(_0x1c09a2._0x2f2da1,0x77f)+_0x54936c(0x72d,0x833)+_0xce24ec(_0x1c09a2._0x3c094f,_0x1c09a2._0x492ca4)+'copes\x20ar'+'e\x20requir'+'ed'};function _0x54936c(_0x8f0f10,_0x555a84){return _0x3266d5(_0x8f0f10,_0x555a84-_0x5809d2._0x1da0fb);}const _0x2f7ed5=_0x21dff9[_0xce24ec(_0x1c09a2._0x2c2c20,0x431)][_0xce24ec(_0x1c09a2._0x37d9f0,_0x1c09a2._0x207618)]();function _0xce24ec(_0x4b78cc,_0x3411c4){return _0x3266d5(_0x4b78cc,_0x3411c4-0x13e);}const _0x4044b7=_0x21dff9[_0x54936c(_0x1c09a2._0x1a2200,0x536)+'y'][_0xce24ec(0x310,0x464)](),_0x4fd42e=_0x21dff9['role'][_0x54936c(0x6c9,0x78b)](),_0x29b452=_0x1b38e0[_0x54936c(_0x1c09a2._0x1fb412,0x5fd)](normalizeStringArray,_0x21dff9[_0xce24ec(0x6bb,_0x1c09a2._0x3a5e89)]);if(!_0x2f7ed5||!_0x4044b7||!_0x4fd42e||_0x29b452[_0xce24ec(0x35b,0x578)]===0x0)throw new Error(_0x1b38e0[_0x54936c(0x7ce,_0x1c09a2._0x23e860)]);return await withBootstrapLock(async()=>{const _0x5b2bed=_0x21dff9[_0x34925b(0x72a,_0x504c1a._0x25305c)]??getOpenClawStateDir();function _0x1db459(_0x4e8f95,_0x4c1b2d){return _0x54936c(_0x4e8f95,_0x4c1b2d- -_0x1393f5._0x3fc8fb);}const _0x5e4266=getOpenClawBootstrapPath(_0x5b2bed),_0x5b65ed=await loadBootstrapState(_0x5e4266);function _0x34925b(_0x1508b3,_0x132008){return _0x54936c(_0x132008,_0x1508b3- -_0x9bc417._0x20a955);}const _0x3701d0=_0x1b38e0[_0x34925b(0x8dc,_0x504c1a._0x468778)](generatePairingToken),_0x19398f=Date[_0x34925b(0x65e,0x564)]();return _0x5b65ed[_0x3701d0]={'token':_0x3701d0,'ts':_0x19398f,'deviceId':_0x2f7ed5,'publicKey':_0x4044b7,'roles':[_0x4fd42e],'scopes':_0x29b452,'issuedAtMs':_0x19398f},await writeJsonAtomic(_0x5e4266,_0x5b65ed),{'token':_0x3701d0,'expiresAtMs':_0x1b38e0['akrkQ'](_0x19398f,DEVICE_BOOTSTRAP_TOKEN_TTL_MS),'statePath':_0x5e4266};});}function readConfiguredSecret(_0x417fba){const _0x53fbe4={_0xa81c98:0x1be},_0x575d82={_0x1388e6:0x1b9};function _0x1792a2(_0x1c4a3e,_0x3c64e3){return _0x3266d5(_0x3c64e3,_0x1c4a3e- -_0x575d82._0x1388e6);}return typeof _0x417fba===_0x1792a2(_0x53fbe4._0xa81c98,0x2ad)&&_0x417fba['trim']()?_0x417fba['trim']():null;}function readGatewayTokenEnv(){const _0x5f2e38={_0x13e1c1:0x4c0,_0x1be5b4:0x5b7,_0x41d184:0x816},_0xb10c51={_0xceec5d:0x4f8};function _0x11b2f7(_0x21bcd9,_0x4636f6){return _0x26b3dd(_0x4636f6-0x19,_0x21bcd9);}function _0x15da33(_0x56f284,_0xdb8e1c){return _0x26b3dd(_0x56f284- -_0xb10c51._0xceec5d,_0xdb8e1c);}return readEnvValue('OPENCLAW'+_0x15da33(_0x5f2e38._0x13e1c1,0x59c)+_0x15da33(0x4ed,_0x5f2e38._0x1be5b4),'CLAWDBOT'+_0x15da33(_0x5f2e38._0x13e1c1,0x74c)+_0x11b2f7(_0x5f2e38._0x41d184,0x9fe));}function readGatewayPasswordEnv(){const _0x42b7cc={_0x406e10:0x698,_0x33faa2:0x1b4,_0x563942:0x2f9,_0x36db0d:0x621},_0x479940={_0x3d0b68:0x333};function _0x4cd1c0(_0x35fcef,_0x3df150){return _0x26b3dd(_0x35fcef- -_0x479940._0x3d0b68,_0x3df150);}function _0x537e59(_0x407165,_0x269ce5){return _0x26b3dd(_0x407165- -0x397,_0x269ce5);}return readEnvValue(_0x4cd1c0(0x3b9,0x499)+'_GATEWAY'+_0x537e59(0x678,_0x42b7cc._0x406e10)+'D',_0x537e59(_0x42b7cc._0x33faa2,_0x42b7cc._0x563942)+_0x537e59(_0x42b7cc._0x36db0d,0x682)+_0x4cd1c0(0x6dc,0x781)+'D');}function readEnvValue(_0x371ef4,_0x53086c){const _0xf7224a={_0x5a81cb:0x593},_0x3a3b09={_0x2e2d93:0x29f};function _0x40dc7e(_0x3424b9,_0x35d196){return _0x3266d5(_0x3424b9,_0x35d196-0x2ab);}const _0x11cdf5=process.env[_0x371ef4]?.[_0x148afe(0x62e,0x5c5)]();if(_0x11cdf5)return _0x11cdf5;function _0x148afe(_0x495971,_0xdd65ed){return _0x3266d5(_0x495971,_0xdd65ed-_0x3a3b09._0x2e2d93);}const _0x3a6ea5=process.env[_0x53086c]?.[_0x40dc7e(_0xf7224a._0x5a81cb,0x5d1)]();return _0x3a6ea5||null;}function resolveOpenClawPaths(){const _0x3ecdc1={_0x193783:0x1c2,_0x5c22ea:0x1a7},_0x4cded9={_0xbfcfd9:0x28};function _0x343301(_0x4ea83a,_0x48adbd){return _0x3266d5(_0x48adbd,_0x4ea83a-_0x4cded9._0xbfcfd9);}const _0x44910={'UKWwX':function(_0x4b1c2e){return _0x4b1c2e();},'hEgRf':function(_0x4237a0,_0x2ec083){return _0x4237a0(_0x2ec083);}},_0x187a38=_0x44910[_0x343301(0x8a,-0x14a)](resolveActiveOpenClawStateDir);function _0x3d9e75(_0x5e923a,_0x4d13bf){return _0x3266d5(_0x5e923a,_0x4d13bf- -0x36);}const _0x414674=_0x44910[_0x343301(_0x3ecdc1._0x193783,_0x3ecdc1._0x5c22ea)](resolveActiveOpenClawConfigPath,_0x187a38);return{'stateDir':_0x187a38,'configDir':_0x5bba2e(_0x414674),'configPath':_0x414674,'mediaDir':_0x1d2c1b(_0x187a38,'media')};}function resolveActiveOpenClawStateDir(){const _0x5cb94e={_0x246180:0x276,_0x184e86:0x8c,_0x1b92f3:0x29d,_0x411b6e:0x1cc,_0x1cb4ae:0x3d7},_0x219fbb={_0x1e05c6:0x6af};function _0x390405(_0x427e32,_0x1b0a0a){return _0x26b3dd(_0x1b0a0a- -_0x219fbb._0x1e05c6,_0x427e32);}const _0x541579={'VydCp':_0x516907(0x34c,_0x5cb94e._0x246180)+'_STATE_D'+'IR','qgjTt':function(_0x7a7627){return _0x7a7627();}};function _0x516907(_0x2bbc2d,_0x31cc7f){return _0x26b3dd(_0x2bbc2d- -0x1ff,_0x31cc7f);}const _0x4553f7=readEnvValue(_0x390405(0x77,0x3d)+_0x390405(-0x9d,_0x5cb94e._0x184e86)+'IR',_0x541579[_0x390405(-_0x5cb94e._0x1b92f3,0x8)]);if(_0x4553f7)return resolveUserPath(_0x4553f7);const _0x302984=_0x541579['qgjTt'](buildOpenClawStateDirCandidates),_0x96213a=_0x302984[_0x390405(_0x5cb94e._0x411b6e,0x21a)](_0x2d2557=>_0x1fa654(_0x1d2c1b(_0x2d2557,_0x516907(0x3ab,0x340)+'.json')));return _0x96213a??_0x302984[0x0]??_0x1d2c1b(_0x3c82be(),_0x516907(0x419,_0x5cb94e._0x1cb4ae)+'w');}function resolveActiveOpenClawConfigPath(_0x4a3429){const _0x47ee28={_0x2f6c88:0x64b,_0x500d71:0x70f,_0x3b4c4e:0x53f,_0x5c0561:0x70f},_0x4df707={_0x1df45d:0x48e},_0x3a4acb={_0x184450:0x132};function _0x578815(_0xcdc9c0,_0x5c5017){return _0x3266d5(_0xcdc9c0,_0x5c5017- -_0x3a4acb._0x184450);}function _0x57310b(_0x3e40d7,_0x59833d){return _0x3266d5(_0x3e40d7,_0x59833d-_0x4df707._0x1df45d);}const _0x181b4d=readEnvValue(_0x57310b(0x7dd,0x6ea)+_0x57310b(_0x47ee28._0x2f6c88,_0x47ee28._0x500d71)+_0x57310b(0x4ef,0x681),'CLAWDBOT'+_0x57310b(_0x47ee28._0x3b4c4e,_0x47ee28._0x5c0561)+'PATH');if(_0x181b4d)return resolveUserPath(_0x181b4d);return _0x1d2c1b(_0x4a3429,_0x578815(0x90,-0x18)+_0x57310b(0x455,0x5ce));}function buildOpenClawStateDirCandidates(){const _0x5e9352={_0x114f65:0x609,_0xdf9a3d:0x475,_0x1bb60f:0x4b5},_0x520133={_0x305082:0x3f6,_0x45cece:0x307,_0x2fb292:0x26f};function _0x1d44d6(_0x5650c7,_0x488903){return _0x26b3dd(_0x5650c7- -0x276,_0x488903);}function _0xf6bb79(_0x4e86c2,_0x232c65){return _0x26b3dd(_0x232c65- -0x4e8,_0x4e86c2);}const _0x1941de={'MWVhx':function(_0x19995a){return _0x19995a();}},_0x8fa8d=new Set();return[_0x1941de['MWVhx'](_0x3c82be),'/root'][_0x1d44d6(0x52a,_0x5e9352._0x114f65)](_0x30d636=>_0x30d636[_0xf6bb79(0x10a,0x2ce)]())[_0xf6bb79(0x720,_0x5e9352._0xdf9a3d)](Boolean)[_0xf6bb79(_0x5e9352._0x1bb60f,0x2b8)](_0x5a4874=>_0x1d2c1b(_0x5a4874,'.opencla'+'w'))['filter'](_0x1ecde8=>{const _0x262a5c={_0x4f857f:0x11d};function _0x5b5d76(_0x58e031,_0xfd4cc8){return _0xf6bb79(_0xfd4cc8,_0x58e031- -_0x262a5c._0x4f857f);}function _0x4eb51c(_0xa415d,_0x46ab69){return _0xf6bb79(_0x46ab69,_0xa415d- -0x9e);}if(_0x8fa8d[_0x4eb51c(_0x520133._0x305082,0x2b3)](_0x1ecde8))return![];return _0x8fa8d[_0x4eb51c(_0x520133._0x45cece,_0x520133._0x2fb292)](_0x1ecde8),!![];});}function resolveUserPath(_0x3f264c){const _0x498f7c={_0x586a33:0x34c,_0xce5a49:0x712,_0x1ecfca:0x76d},_0x2cb2d6={_0x2eb3a6:0x33e},_0x59559f={'xlqNN':function(_0x3982f3,_0x368cf1){return _0x3982f3===_0x368cf1;},'DPxkm':function(_0x55c218){return _0x55c218();},'dQfif':function(_0x6d8317,_0x72c7af){return _0x6d8317(_0x72c7af);}},_0x57af38=_0x3f264c[_0x570cc8(_0x498f7c._0x586a33,0xcd)]();if(!_0x57af38)return _0x57af38;function _0x570cc8(_0x3f426d,_0x21eb23){return _0x3266d5(_0x3f426d,_0x21eb23- -0x259);}if(_0x59559f[_0x288e34(0x6d8,0x6e2)](_0x57af38,'~'))return resolve(_0x59559f[_0x570cc8(0x62,0x15d)](_0x3c82be));function _0x288e34(_0x20abbb,_0x2ae768){return _0x3266d5(_0x2ae768,_0x20abbb-_0x2cb2d6._0x2eb3a6);}if(_0x57af38[_0x288e34(0x668,_0x498f7c._0xce5a49)+'th']('~/'))return _0x59559f[_0x288e34(0x7e3,_0x498f7c._0x1ecfca)](resolve,_0x1d2c1b(_0x3c82be(),_0x57af38['slice'](0x2)));return resolve(_0x57af38);}async function loadBootstrapState(_0x21ba8c){const _0xbfa9fe={_0x5d5ab6:0x2da,_0x3eb19d:0x347,_0x416584:0x688,_0x56e8fa:0x3fb,_0x47da06:0x5e6,_0x140870:0x509},_0x2f3064={'sjmgg':function(_0x1dedb9,_0x59ad35){return _0x1dedb9(_0x59ad35);},'pvBVO':function(_0x3d4a36,_0x5288ce){return _0x3d4a36!==_0x5288ce;}},_0x5bd5a3=await _0x2f3064[_0x5ac12e(_0xbfa9fe._0x5d5ab6,0x445)](readJsonFile,_0x21ba8c)??{},_0x4e8e52=Date[_0xd3db44(_0xbfa9fe._0x3eb19d,0x3b4)]();function _0xd3db44(_0x4e793d,_0x424f26){return _0x3266d5(_0x4e793d,_0x424f26-0x152);}function _0x5ac12e(_0x2e57e0,_0x3989a3){return _0x3266d5(_0x3989a3,_0x2e57e0-0xe1);}for(const [_0x5e7791,_0x277ebc]of Object['entries'](_0x5bd5a3)){if(!_0x277ebc||_0x2f3064[_0x5ac12e(0x50b,_0xbfa9fe._0x416584)](typeof _0x277ebc,'object')){delete _0x5bd5a3[_0x5e7791];continue;}typeof _0x277ebc['ts']!==_0xd3db44(_0xbfa9fe._0x56e8fa,0x657)&&typeof _0x277ebc['issuedAt'+'Ms']===_0x5ac12e(_0xbfa9fe._0x47da06,0x84c)&&(_0x277ebc['ts']=_0x277ebc[_0x5ac12e(0x2bb,_0xbfa9fe._0x140870)+'Ms']),_0x4e8e52-_0x277ebc['ts']>DEVICE_BOOTSTRAP_TOKEN_TTL_MS&&delete _0x5bd5a3[_0x5e7791];}return _0x5bd5a3;}async function readJsonFile(_0x276248){const _0x35419f={_0x198f9e:0x579,_0x30dd13:0x420,_0x44850c:0x2f7},_0x4a9518={'txuTu':function(_0x962899,_0x3c2f61,_0x37e3ae){return _0x962899(_0x3c2f61,_0x37e3ae);}};function _0x143da1(_0x33fa69,_0x4de26a){return _0x26b3dd(_0x33fa69- -0x1d8,_0x4de26a);}function _0x20e08a(_0x11aea3,_0x308b5b){return _0x26b3dd(_0x11aea3-0x81,_0x308b5b);}try{return JSON[_0x20e08a(0x58c,0x646)](await _0x4a9518[_0x143da1(0x41c,_0x35419f._0x198f9e)](readFile,_0x276248,_0x143da1(_0x35419f._0x30dd13,_0x35419f._0x44850c)));}catch{return null;}}async function writeJsonAtomic(_0x105c4b,_0x3f0577){const _0x401409={_0xe1a99a:0x3f7,_0x1e4a91:0x9fe,_0x20376d:0x3f9,_0x345879:0x4ef,_0x57d27c:0xa5d},_0x1f3723={'PEwJz':function(_0x7480e5){return _0x7480e5();}},_0x5566c5=JSON[_0x519041(0x189,_0x401409._0xe1a99a)+'y'](_0x3f0577,null,0x2),_0x294e92={};function _0x127fb5(_0x153a2a,_0x4f61d4){return _0x26b3dd(_0x153a2a-0x76,_0x4f61d4);}_0x294e92['recursiv'+'e']=!![],_0x294e92[_0x519041(_0x401409._0x1e4a91,0x891)]=0x1c0,await mkdir(_0x5bba2e(_0x105c4b),_0x294e92);const _0x37a266=_0x105c4b+'.'+_0x1f3723['PEwJz'](randomUUIDFragment)+'.tmp';function _0x519041(_0x45fea4,_0x5d7e63){return _0x26b3dd(_0x5d7e63- -0xb0,_0x45fea4);}try{const _0x5a29bb={};_0x5a29bb[_0x519041(0x5fa,_0x401409._0x20376d)]=_0x519041(0x2b6,0x548),_0x5a29bb['mode']=0x180,await writeFile(_0x37a266,_0x5566c5,_0x5a29bb),await safeChmod(_0x37a266,0x180),await rename(_0x37a266,_0x105c4b),await safeChmod(_0x105c4b,0x180);}finally{const _0x427024={};_0x427024[_0x127fb5(0x737,_0x401409._0x345879)]=!![],await rm(_0x37a266,_0x427024)[_0x127fb5(_0x401409._0x57d27c,0xa31)](()=>void 0x0);}}async function safeChmod(_0x3a7bb2,_0x20a4ce){try{await chmod(_0x3a7bb2,_0x20a4ce);}catch{}}function generatePairingToken(){const _0x56491c={_0x23d6e7:0x5ba,_0x5a9021:0x7c9,_0x32a9c5:0x790},_0x1433fc={_0x380d25:0x2b9},_0x5080c2={_0x2cb7b9:0x546};function _0x418443(_0x3ad9d9,_0x189642){return _0x3266d5(_0x3ad9d9,_0x189642-_0x5080c2._0x2cb7b9);}function _0x2c0219(_0x449d42,_0x42a850){return _0x3266d5(_0x42a850,_0x449d42-_0x1433fc._0x380d25);}return randomBytes(PAIRING_TOKEN_BYTES)[_0x2c0219(0x4bc,_0x56491c._0x23d6e7)](_0x418443(_0x56491c._0x5a9021,_0x56491c._0x32a9c5)+'l');}function normalizeStringArray(_0x32f479){const _0x8375e6={_0x3063ea:0x41d,_0x170ad5:0x6a7,_0x5d993d:0x229,_0x2f6c99:0x55e,_0x216233:0x11e,_0x10d7ad:0x38e,_0x1542f9:0xa2},_0x2553d2={_0x227153:0x3b5},_0x16449d={};_0x16449d[_0x20df5c(_0x8375e6._0x3063ea,_0x8375e6._0x170ad5)]=_0x20df5c(0x452,_0x8375e6._0x5d993d);function _0x43aae4(_0x3c9da7,_0x592164){return _0x26b3dd(_0x592164- -0x4ff,_0x3c9da7);}const _0x3d2ca1=_0x16449d,_0x4ca091=new Set();function _0x20df5c(_0x52ad86,_0x233b86){return _0x26b3dd(_0x52ad86- -_0x2553d2._0x227153,_0x233b86);}for(const _0x26fe4c of _0x32f479){const _0x75e802=typeof _0x26fe4c===_0x3d2ca1['lHMsF']?_0x26fe4c[_0x43aae4(_0x8375e6._0x2f6c99,0x2b7)]():'';_0x75e802&&_0x4ca091[_0x43aae4(_0x8375e6._0x216233,_0x8375e6._0x10d7ad)](_0x75e802);}return[..._0x4ca091][_0x43aae4(_0x8375e6._0x1542f9,0x14e)]();}function randomUUIDFragment(){const _0x3fc924={_0x28e469:0x3ea},_0x5a71f7={_0x1ed9e2:0x64d};function _0x3ea258(_0x2b1cd9,_0x4fedc6){return _0x26b3dd(_0x2b1cd9- -_0x5a71f7._0x1ed9e2,_0x4fedc6);}function _0x42e4b3(_0x53a8ea,_0x530131){return _0x26b3dd(_0x53a8ea- -0x686,_0x530131);}return randomBytes(0xc)[_0x3ea258(0x46,-0x1e7)](_0x3ea258(0x394,_0x3fc924._0x28e469));}function createAsyncLock(){let _0x4ecfb0=Promise['resolve']();return async function _0xe08285(_0x27c3b9){const _0x329633=_0x4ecfb0;let _0x3a4ba9;_0x4ecfb0=new Promise(_0x410323=>{_0x3a4ba9=_0x410323;}),await _0x329633;try{return await _0x27c3b9();}finally{_0x3a4ba9?.();}};}var CONTROL_PREFIX='__clawke'+_0x26b3dd(0x6b9,0x7c4)+_0x26b3dd(0x5f0,0x3a2)+'_:';function parseControl(_0x2b991d){const _0x57951a={_0x1e738e:0x62b,_0x473ddc:0x4b9,_0x2349d3:0x226,_0xdd3a9e:0x309,_0x434789:0x73b,_0x5a7169:0x13d,_0xa9eb8f:0xd9,_0x322fc1:0x678,_0x16907e:0x140,_0x224a46:0x87e,_0x69007b:0x9c3,_0x332aa0:0x5c1,_0x514368:0x98,_0x2534f9:0x34c,_0x8e14d9:0x3a5,_0xa33823:0x806,_0x32ddfa:0x81a,_0x1ace3d:0x1ca,_0x2aba1d:0x1c6,_0x230459:0x166,_0x26a7d3:0x13d,_0xdfedc8:0x1a8,_0x2f1ece:0x38f,_0x16d8d5:0x6ba,_0x14054c:0x59f,_0x46e313:0x6ed},_0xf78728={_0x5b6a7d:0x2e},_0x54535b={_0x436a0c:0x301},_0x3a6510={'cBpaz':function(_0x5f5964,_0x2996ed){return _0x5f5964(_0x2996ed);},'nMcue':function(_0x2edb55,_0x4eaf0f){return _0x2edb55===_0x4eaf0f;}};function _0x16bbfd(_0x1c504b,_0x1aeaad){return _0x3266d5(_0x1aeaad,_0x1c504b-_0x54535b._0x436a0c);}if(!_0x2b991d[_0x16bbfd(_0x57951a._0x1e738e,_0x57951a._0x473ddc)+'th'](CONTROL_PREFIX))return null;function _0x55fefd(_0x2ab538,_0x2913db){return _0x3266d5(_0x2913db,_0x2ab538- -_0xf78728._0x5b6a7d);}try{const _0x47d9b9=JSON[_0x16bbfd(0x37c,_0x57951a._0x2349d3)](_0x2b991d[_0x16bbfd(_0x57951a._0xdd3a9e,0x3db)](CONTROL_PREFIX[_0x16bbfd(_0x57951a._0x434789,0x863)]));if(typeof _0x47d9b9[_0x55fefd(_0x57951a._0x5a7169,-_0x57951a._0xa9eb8f)]!==_0x16bbfd(_0x57951a._0x322fc1,0x758)||!_0x47d9b9[_0x55fefd(0x13d,-_0x57951a._0x16907e)][_0x55fefd(0x2f8,0x230)]())return null;const _0x1b9703=_0x3a6510[_0x16bbfd(_0x57951a._0x224a46,_0x57951a._0x69007b)](isRecord,_0x47d9b9[_0x16bbfd(0x610,_0x57951a._0x332aa0)])?_0x47d9b9[_0x55fefd(0x2e1,_0x57951a._0x514368)]:void 0x0,_0x2bf64c=_0x3a6510[_0x16bbfd(_0x57951a._0x2534f9,0x217)](typeof _0x47d9b9[_0x16bbfd(_0x57951a._0x8e14d9,0x460)],_0x16bbfd(_0x57951a._0xa33823,_0x57951a._0x32ddfa))&&Number[_0x55fefd(0x45f,_0x57951a._0x1ace3d)](_0x47d9b9[_0x55fefd(0x76,0x18f)])?_0x47d9b9[_0x16bbfd(_0x57951a._0x8e14d9,_0x57951a._0x2aba1d)]:typeof _0x1b9703?.['count']===_0x16bbfd(_0x57951a._0xa33823,0x9e7)&&Number['isFinite'](_0x1b9703[_0x16bbfd(0x3a5,0x199)])?_0x1b9703[_0x55fefd(0x76,-_0x57951a._0x230459)]:void 0x0;return{'event':_0x47d9b9[_0x55fefd(_0x57951a._0x26a7d3,0x182)]['trim'](),'requestId':readOptionalString(_0x47d9b9[_0x55fefd(_0x57951a._0xdfedc8,_0x57951a._0x2f1ece)+'d']),'payload':_0x1b9703,'sourceClientId':readOptionalString(_0x47d9b9[_0x16bbfd(0x3cd,0x2e2)+'ientId']),'targetClientId':readOptionalString(_0x47d9b9[_0x16bbfd(_0x57951a._0x16d8d5,_0x57951a._0x14054c)+_0x16bbfd(_0x57951a._0x46e313,0x890)]),'count':_0x2bf64c};}catch{return null;}}function parseConnectStartIdentity(_0x444369){const _0x1be77e={_0x5e8a81:0x101,_0x5cb201:0x129,_0x2ccf02:0x210,_0x125e87:0xd,_0x5c3172:0xa5,_0x374f36:0x101,_0x10b35c:0x121,_0x21fb79:0x721,_0x3df9cf:0x9b4,_0x29ef59:0x721,_0x2e1673:0x828,_0x28cc84:0x371,_0x4a6056:0x1de,_0xcde360:0x892,_0x53d281:0x659,_0x4a4cef:0x9d,_0x31b8ff:0x217,_0x575b93:0xbc,_0x1bc8be:0x68},_0x584efa={_0x462e41:0x6e6},_0x498bff={};_0x498bff[_0x53f2a5(-0x163,_0x1be77e._0x5e8a81)]=function(_0x57f5d0,_0x159887){return _0x57f5d0===_0x159887;};function _0xaeb8bf(_0x3db305,_0x439527){return _0x26b3dd(_0x3db305- -0x95,_0x439527);}function _0x53f2a5(_0x569af6,_0x553c6e){return _0x26b3dd(_0x553c6e- -_0x584efa._0x462e41,_0x569af6);}const _0x326413=_0x498bff;try{const _0xab2df5=JSON[_0x53f2a5(-0x447,-0x1db)](_0x444369);if(_0xab2df5[_0x53f2a5(0x1d5,0x2ec)]!=='req')return null;if(_0xab2df5[_0x53f2a5(_0x1be77e._0x5cb201,0x75)]!==_0x53f2a5(-0x3c2,-_0x1be77e._0x2ccf02)&&_0xab2df5['method']!==_0x53f2a5(_0x1be77e._0x125e87,-0x12c)+_0x53f2a5(-0x16,-0x19e))return null;const _0x329b11=_0xab2df5['params']??{},_0x533ba3=_0x326413[_0x53f2a5(-_0x1be77e._0x5c3172,_0x1be77e._0x374f36)](typeof _0xab2df5['id'],_0x53f2a5(0x23c,_0x1be77e._0x10b35c))&&_0xab2df5['id'][_0xaeb8bf(_0x1be77e._0x21fb79,_0x1be77e._0x3df9cf)]()?_0xab2df5['id'][_0xaeb8bf(_0x1be77e._0x29ef59,0x50e)]():_0xaeb8bf(_0x1be77e._0x2e1673,0xa1e)+Math[_0x53f2a5(_0x1be77e._0x28cc84,_0x1be77e._0x4a6056)]()['toString'](0x24)[_0x53f2a5(-0x1b1,-0x24e)](0x2,0xc),_0x26b3ff=firstString(_0x329b11[_0xaeb8bf(_0x1be77e._0xcde360,_0x1be77e._0x53d281)+'me'],_0x329b11['clientNa'+'me'],_0x329b11[_0x53f2a5(0x106,_0x1be77e._0x4a4cef)],_0x53f2a5(-0x7f,-0x1ec)+_0x53f2a5(-0x2d3,-_0x1be77e._0x31b8ff)),_0x5bc317={};return _0x5bc317['id']=_0x533ba3,_0x5bc317[_0x53f2a5(_0x1be77e._0x575b93,_0x1be77e._0x1bc8be)]=_0x26b3ff,_0x5bc317;}catch{return null;}}function isConnectHandshakeRequest(_0x420556){const _0xc89424={_0x620338:0x20d,_0x512c8f:0x3b8,_0x3acd91:0x28c,_0x54fb59:0x410,_0x4e3727:0x19b,_0x1136d7:0x33a,_0x4d9d16:0x38e,_0x3a55d6:0x786,_0x3ce646:0x5bd},_0x2d9c04={_0x5778fe:0x38e},_0x2d88f6={};_0x2d88f6['BFyNK']=_0x220f42(_0xc89424._0x620338,_0xc89424._0x512c8f);function _0x220f42(_0x489e2b,_0x127dd2){return _0x26b3dd(_0x127dd2- -_0x2d9c04._0x5778fe,_0x489e2b);}_0x2d88f6[_0x220f42(_0xc89424._0x3acd91,_0xc89424._0x54fb59)]=function(_0x2f0435,_0x146d1a){return _0x2f0435===_0x146d1a;};function _0x2d7d21(_0x40d63e,_0x2d533b){return _0x26b3dd(_0x2d533b- -0x10b,_0x40d63e);}_0x2d88f6[_0x220f42(_0xc89424._0x4e3727,_0xc89424._0x1136d7)]=_0x220f42(0x126,0x22c)+_0x220f42(0x3b,0x1ba);const _0x4336a4=_0x2d88f6;try{const _0x513adf=JSON['parse'](_0x420556);return _0x513adf['type']===_0x4336a4[_0x220f42(_0xc89424._0x4d9d16,0x4cd)]&&(_0x513adf['method']===_0x2d7d21(0x1bd,0x3cb)||_0x4336a4[_0x220f42(0x570,0x410)](_0x513adf[_0x220f42(0x581,0x3cd)],_0x4336a4[_0x2d7d21(_0xc89424._0x3a55d6,_0xc89424._0x3ce646)]));}catch{return![];}}function parseConnectHandshakeMeta(_0x3cad4a){const _0x38ed85={_0x71bdd4:0x142,_0x1de880:0x44c,_0x44ec6a:0x1e7,_0x41db84:0xee,_0x65cf88:0x345,_0x19ec31:0x49,_0x123cb4:0x5d2,_0x581166:0x284,_0x2c308c:0x26f,_0x2bc662:0x142,_0xa9f6d1:0x2f6,_0x390b29:0x263,_0xdad8a6:0x4ae,_0x125e1e:0x345,_0x333b88:0x4fb,_0x500422:0x2f4,_0x56485d:0x299,_0x2e450b:0x24a,_0x308b74:0x4f5,_0x44b78c:0x280,_0x3d78e6:0x4e4,_0x2e5a43:0x4b8,_0x12cc9a:0x68,_0x52d43b:0x5b,_0x15bc86:0xf2},_0x28b9a1={_0x54e969:0x32},_0x3cfd40={};function _0x22bf4e(_0x17c0c2,_0xff5e58){return _0x3266d5(_0xff5e58,_0x17c0c2- -_0x28b9a1._0x54e969);}_0x3cfd40[_0x59879c(_0x38ed85._0x71bdd4,0x146)]=function(_0xa232c3,_0x14e89c){return _0xa232c3!==_0x14e89c;},_0x3cfd40[_0x59879c(0x2f6,_0x38ed85._0x1de880)]=function(_0x1bfecf,_0x50744d){return _0x1bfecf!==_0x50744d;},_0x3cfd40[_0x59879c(_0x38ed85._0x44ec6a,_0x38ed85._0x41db84)]=_0x22bf4e(_0x38ed85._0x65cf88,0x259);function _0x59879c(_0x1aa3b9,_0x1634a8){return _0x3266d5(_0x1634a8,_0x1aa3b9- -0xcb);}_0x3cfd40[_0x22bf4e(-0x1f,-0x52)]='object';const _0x4d6c07=_0x3cfd40;try{const _0x4829a6=JSON[_0x22bf4e(_0x38ed85._0x19ec31,0x141)](_0x3cad4a);if(_0x4829a6[_0x22bf4e(0x510,_0x38ed85._0x123cb4)]!==_0x22bf4e(_0x38ed85._0x581166,_0x38ed85._0x2c308c))return null;if(_0x4d6c07[_0x59879c(_0x38ed85._0x2bc662,0x2)](_0x4829a6['method'],'connect')&&_0x4d6c07[_0x59879c(_0x38ed85._0xa9f6d1,0x417)](_0x4829a6[_0x59879c(0x200,_0x38ed85._0x390b29)],'connect.'+'start'))return null;const _0xcf235a=_0x4829a6[_0x22bf4e(-0x15,0x13b)]?.['device']?.[_0x59879c(_0x38ed85._0xdad8a6,0x720)],_0x3f1cc5=_0x4829a6[_0x59879c(-0xae,-0x31f)]?.[_0x59879c(-0x3f,-0x1f1)];return{'id':typeof _0x4829a6['id']===_0x22bf4e(_0x38ed85._0x125e1e,_0x38ed85._0x333b88)&&_0x4829a6['id'][_0x22bf4e(_0x38ed85._0x500422,0x3fb)]()?_0x4829a6['id']['trim']():null,'method':_0x4829a6[_0x22bf4e(_0x38ed85._0x56485d,_0x38ed85._0x2e450b)],'noncePresent':typeof _0xcf235a===_0x59879c(0x2ac,_0x38ed85._0x308b74)&&_0xcf235a[_0x59879c(0x36f,0x3b1)]>0x0,'nonceLength':typeof _0xcf235a===_0x4d6c07[_0x22bf4e(_0x38ed85._0x44b78c,_0x38ed85._0x3d78e6)]?_0xcf235a[_0x59879c(0x36f,_0x38ed85._0x2e5a43)]:null,'authFields':_0x3f1cc5&&typeof _0x3f1cc5===_0x4d6c07[_0x22bf4e(-0x1f,-_0x38ed85._0x12cc9a)]?Object[_0x22bf4e(0x189,_0x38ed85._0x52d43b)](_0x3f1cc5)[_0x59879c(_0x38ed85._0x15bc86,0x13f)]():[]};}catch{return null;}}function parsePairingRequestFromError(_0x34a142,_0x4391a6=Date[_0x3266d5(0x1ea,0x262)]()){const _0x29972d={_0x204532:0x7ed,_0x4d4015:0x853,_0xbd6a49:0x6e9,_0x427a7f:0x9c4,_0x34b731:0x89d,_0x3961e8:0x7c5,_0x385b23:0xa78,_0x15af6b:0xd29,_0x108231:0x56e,_0xbfbd5a:0x92c,_0x29af34:0x7ed,_0x8999e3:0x5e6,_0x556303:0x581,_0x5d623f:0x853,_0x230d36:0xaf4,_0x14f228:0x864,_0x35f676:0x731,_0x43c230:0x548,_0x14d5a0:0x877,_0x3040d3:0x743,_0x5e2e0a:0x8c9,_0x342227:0xa2b,_0x4efbdb:0x877,_0x2bb347:0x697,_0x54b89f:0x808,_0x3b026b:0x61e,_0x57020d:0x5ef,_0x2ef02b:0x5d9,_0x35c053:0x4cc,_0xaf0e3e:0x865,_0x1ef9ee:0x683,_0x1a8ec8:0x4d1,_0x146790:0x590,_0xebe0a:0x7a2,_0x5f4664:0x91b,_0x70d4c6:0x836,_0x31ef72:0x806,_0x9469cd:0x8e4},_0x2e64bb={_0x176bfb:0x3ba},_0x2a48d0={_0x5944c2:0x4f3},_0x7edc40={};function _0x469856(_0x5191bd,_0x1649ab){return _0x3266d5(_0x1649ab,_0x5191bd-_0x2a48d0._0x5944c2);}function _0x35eb14(_0x4c244d,_0x3f6674){return _0x3266d5(_0x3f6674,_0x4c244d-_0x2e64bb._0x176bfb);}_0x7edc40[_0x35eb14(_0x29972d._0x204532,0x6a1)]=_0x35eb14(0x3d8,0x2e6),_0x7edc40[_0x469856(_0x29972d._0x4d4015,_0x29972d._0xbd6a49)]=function(_0x2872e3,_0x2f84f9){return _0x2872e3===_0x2f84f9;},_0x7edc40[_0x469856(0x6ba,0x7ba)]=_0x469856(0x86a,_0x29972d._0x427a7f),_0x7edc40[_0x35eb14(_0x29972d._0x34b731,_0x29972d._0x3961e8)]=_0x469856(_0x29972d._0x385b23,_0x29972d._0x15af6b)+'ED';const _0x23f9db=_0x7edc40;try{const _0x2059a6=JSON[_0x469856(_0x29972d._0x108231,0x3de)](_0x34a142);if(_0x2059a6[_0x469856(0xa35,_0x29972d._0xbfbd5a)]!==_0x23f9db[_0x35eb14(_0x29972d._0x29af34,0x5f4)]||_0x2059a6['ok']!==![]||!_0x2059a6['error'])return null;const _0x4632a4=_0x23f9db['KLNPj'](typeof _0x2059a6[_0x35eb14(0x865,_0x29972d._0x8999e3)]['code'],_0x23f9db[_0x35eb14(_0x29972d._0x556303,0x824)])?_0x2059a6[_0x35eb14(0x865,0x6ab)][_0x35eb14(0x555,0x721)]:'',_0x5d899d=_0x23f9db[_0x469856(_0x29972d._0x5d623f,_0x29972d._0x230d36)](typeof _0x2059a6[_0x35eb14(0x865,0x98e)][_0x469856(0x829,_0x29972d._0x14f228)],_0x35eb14(_0x29972d._0x35f676,_0x29972d._0x43c230))?_0x2059a6['error']['message']:'';if(!_0x4632a4[_0x35eb14(0x877,0xa12)](_0x23f9db[_0x469856(0x9d6,0x9a9)])&&!_0x4632a4[_0x35eb14(_0x29972d._0x14d5a0,_0x29972d._0x3040d3)](_0x35eb14(0x83b,0x8aa)+_0x35eb14(_0x29972d._0x5e2e0a,_0x29972d._0x342227))&&!_0x5d899d[_0x35eb14(_0x29972d._0x4efbdb,_0x29972d._0x2bb347)]('NOT_PAIR'+'ED')&&!_0x5d899d[_0x35eb14(0x877,0x773)](_0x35eb14(_0x29972d._0x54b89f,_0x29972d._0x3b026b)+_0x469856(_0x29972d._0x57020d,0x886)))return null;const _0x3a9992=_0x2059a6['error'][_0x469856(_0x29972d._0x2ef02b,_0x29972d._0x35c053)]??_0x2059a6[_0x35eb14(_0x29972d._0xaf0e3e,_0x29972d._0x1ef9ee)][_0x35eb14(_0x29972d._0x1a8ec8,0x2e7)]??{},_0x230a90=firstString(_0x3a9992[_0x35eb14(_0x29972d._0x146790,_0x29972d._0xebe0a)+'d'],extractRequestIdFromMessage(_0x5d899d),'unknown');return{'requestId':_0x230a90,'deviceId':firstString(_0x3a9992['deviceId'],''),'displayName':firstNullableString(_0x3a9992['displayN'+_0x35eb14(0x759,_0x29972d._0x5f4664)]),'platform':firstNullableString(_0x3a9992['platform']),'deviceFamily':firstNullableString(_0x3a9992['deviceFa'+_0x469856(_0x29972d._0x70d4c6,0x889)]),'role':firstNullableString(_0x3a9992[_0x469856(_0x29972d._0x31ef72,0x74f)]),'remoteIp':firstNullableString(_0x3a9992[_0x469856(_0x29972d._0x9469cd,0x7f9)]),'receivedAtMs':_0x4391a6,'status':'pending'};}catch{return null;}}function parsePairResolvedEvent(_0x4cdd90){const _0x400112={_0x437467:0x108,_0x23749c:0x3ad,_0x4149cd:0x5ea,_0xdd75b5:0x591,_0x32c152:0x4fa,_0x505fd4:0x3dc,_0x19b01d:0x589,_0x12fb54:0xcf,_0xec5367:0x18e,_0x5bc7d3:0x8ef,_0x446fe5:0x72e,_0x393252:0x83c,_0x19e515:0x16a,_0x2b3f0c:0x8c6,_0x4b3e86:0x184,_0x43d3c1:0xfe,_0x64662b:0x53,_0x85585c:0xa65,_0x10cadd:0x191,_0x27aa4e:0x346,_0x159893:0x94,_0x4430c6:0xd5,_0x104a80:0x6c,_0x2f1e1d:0x807,_0x425678:0x5f2,_0x4424e9:0x5ef,_0x12a87d:0xfe},_0x43a314={};_0x43a314[_0x180bdd(_0x400112._0x437467,0x329)]=_0xe42bda(_0x400112._0x23749c,_0x400112._0x4149cd);function _0xe42bda(_0x113a1e,_0x3dfc99){return _0x3266d5(_0x113a1e,_0x3dfc99-0x47f);}_0x43a314['QcUmY']=function(_0x57a1f9,_0x17c3ad){return _0x57a1f9!==_0x17c3ad;},_0x43a314['ivwxl']=function(_0x32e37c,_0x5a62cd){return _0x32e37c===_0x5a62cd;};const _0x55ec07=_0x43a314;function _0x180bdd(_0x124739,_0x521a43){return _0x3266d5(_0x521a43,_0x124739- -0xd8);}try{const _0x44159c=JSON[_0xe42bda(_0x400112._0xdd75b5,_0x400112._0x32c152)](_0x4cdd90);if(_0x44159c['type']!==_0x55ec07['MFBPY']||_0x55ec07[_0xe42bda(_0x400112._0x505fd4,_0x400112._0x19b01d)](_0x44159c[_0x180bdd(0x93,_0x400112._0x12fb54)],_0x180bdd(_0x400112._0xec5367,0xb1)+_0xe42bda(_0x400112._0x5bc7d3,0x771)+_0xe42bda(_0x400112._0x446fe5,_0x400112._0x393252))||!_0x44159c[_0x180bdd(0x237,_0x400112._0x19e515)])return null;const _0x33a892=_0x55ec07[_0xe42bda(0x702,0x90d)](typeof _0x44159c[_0xe42bda(_0x400112._0x2b3f0c,0x78e)]['requestI'+'d'],'string')?_0x44159c[_0x180bdd(0x237,_0x400112._0x4b3e86)][_0x180bdd(_0x400112._0x43d3c1,_0x400112._0x64662b)+'d'][_0xe42bda(_0x400112._0x85585c,0x7a5)]():'';if(!_0x33a892)return null;const _0x5c122b=typeof _0x44159c[_0xe42bda(0x9ce,0x78e)]['decision']===_0x180bdd(0x29f,_0x400112._0x10cadd)?_0x44159c[_0x180bdd(0x237,_0x400112._0x27aa4e)][_0x180bdd(-_0x400112._0x159893,_0x400112._0x4430c6)]:_0x180bdd(-_0x400112._0x104a80,-0x12f),_0x13bc70=_0x5c122b===_0xe42bda(0x67c,_0x400112._0x2f1e1d)||_0x5c122b===_0xe42bda(_0x400112._0x425678,0x853)?_0x5c122b:_0xe42bda(_0x400112._0x4424e9,0x4eb),_0x1855ac={};return _0x1855ac[_0x180bdd(_0x400112._0x12a87d,0x109)+'d']=_0x33a892,_0x1855ac[_0xe42bda(0x730,0x4c3)]=_0x13bc70,_0x1855ac;}catch{return null;}}function parseResponseEnvelopeMeta(_0x34d531){const _0xca0056={_0x234a51:0x2a7,_0x1b7546:0x2d3,_0x171ee2:0x74a,_0x2cf0ed:0x86,_0x567b4d:0x2c5,_0x4c4e3d:0x282,_0x2b8f2b:0x3e7,_0x40f443:0xf7,_0x30eba1:0x2d3,_0x2e855e:0xf0,_0x2421d0:0x2d8,_0x18cab5:0x407,_0x26ff4c:0x5f1,_0xbdc20c:0xaf,_0x4c0f9d:0x30d,_0x1bd39f:0x222,_0x5a1b85:0x2f,_0x5a31f4:0x314,_0x48db4d:0x574,_0x3cbe86:0x2d3,_0x27a3ca:0x4c9,_0x1c5a7f:0x292,_0x463049:0x41b,_0x58811c:0x39a},_0x580525={_0x729e35:0xa4},_0x129be4={};function _0x34cc46(_0x250920,_0x1cb1fc){return _0x3266d5(_0x1cb1fc,_0x250920-0x13d);}function _0x40980c(_0xc38439,_0x18b945){return _0x3266d5(_0x18b945,_0xc38439- -_0x580525._0x729e35);}_0x129be4[_0x40980c(_0xca0056._0x234a51,0x527)]=_0x40980c(_0xca0056._0x1b7546,0x442),_0x129be4[_0x40980c(0x222,0x33e)]=function(_0x3054af,_0x19fdaa){return _0x3054af===_0x19fdaa;};const _0x28f48d=_0x129be4;try{const _0x29dff5=JSON['parse'](_0x34d531);if(_0x29dff5[_0x40980c(0x49e,_0xca0056._0x171ee2)]!==_0x40980c(-_0xca0056._0x2cf0ed,0x5b))return null;if(typeof _0x29dff5['id']!==_0x28f48d[_0x34cc46(0x488,_0xca0056._0x567b4d)]||!_0x29dff5['id'][_0x40980c(_0xca0056._0x4c4e3d,_0xca0056._0x2b8f2b)]())return null;return{'id':_0x29dff5['id']['trim'](),'ok':_0x29dff5['ok']===!![],'errorCode':typeof _0x29dff5['error']?.[_0x40980c(_0xca0056._0x40f443,0x12a)]===_0x40980c(_0xca0056._0x30eba1,_0xca0056._0x2e855e)&&_0x29dff5[_0x40980c(0x407,0x1e6)][_0x34cc46(_0xca0056._0x2421d0,0x163)]['trim']()?_0x29dff5[_0x40980c(_0xca0056._0x18cab5,_0xca0056._0x26ff4c)][_0x34cc46(0x2d8,_0xca0056._0xbdc20c)][_0x40980c(0x282,_0xca0056._0x4c0f9d)]():null,'errorMessage':_0x28f48d[_0x40980c(_0xca0056._0x1bd39f,_0xca0056._0x5a1b85)](typeof _0x29dff5[_0x40980c(0x407,_0xca0056._0x5a31f4)]?.[_0x34cc46(0x473,_0xca0056._0x48db4d)],_0x40980c(_0xca0056._0x3cbe86,_0xca0056._0x27a3ca))&&_0x29dff5['error'][_0x40980c(_0xca0056._0x1c5a7f,0x229)][_0x40980c(0x282,_0xca0056._0x463049)]()?_0x29dff5[_0x40980c(_0xca0056._0x18cab5,0x47c)]['message'][_0x40980c(_0xca0056._0x4c4e3d,_0xca0056._0x58811c)]():null};}catch{return null;}}function firstString(..._0x37ab29){const _0x3fe5e9={_0x104b32:0x310,_0x27ecb3:0x410,_0x4b7512:0x2bf},_0x3d254d={_0x3d1250:0x67};for(const _0x54b38b of _0x37ab29){if(typeof _0x54b38b===_0x26ff41(0x174,_0x3fe5e9._0x104b32)&&_0x54b38b['trim']())return _0x54b38b[_0x26ff41(_0x3fe5e9._0x27ecb3,_0x3fe5e9._0x4b7512)]();}function _0x26ff41(_0x49740c,_0x259f3d){return _0x3266d5(_0x49740c,_0x259f3d- -_0x3d254d._0x3d1250);}function _0x15043d(_0x5ef7b5,_0x2558a2){return _0x3266d5(_0x2558a2,_0x5ef7b5-0x40e);}return'';}function firstNullableString(_0x46b3ae){return typeof _0x46b3ae==='string'&&_0x46b3ae['trim']()?_0x46b3ae['trim']():null;}function readOptionalString(_0x35f81e){const _0xdef814={_0x4c7324:0x4ef,_0xb19181:0x566,_0x699332:0x515},_0x154eb7={_0x2b6690:0x436};function _0x518558(_0x2f9d75,_0x5092a1){return _0x26b3dd(_0x5092a1- -0x2a1,_0x2f9d75);}function _0x4b2f49(_0x364bdc,_0x497b82){return _0x26b3dd(_0x364bdc- -_0x154eb7._0x2b6690,_0x497b82);}return typeof _0x35f81e===_0x518558(_0xdef814._0x4c7324,_0xdef814._0xb19181)&&_0x35f81e[_0x518558(0x36f,_0xdef814._0x699332)]()?_0x35f81e[_0x4b2f49(0x380,0x4ff)]():void 0x0;}function isRecord(_0x32eae4){const _0x5d53af={_0x4cedcb:0x23f,_0x325e31:0x72b,_0x3d87c6:0x477},_0x12af34={_0x3acf3d:0x28d};function _0x30661d(_0x460251,_0x2fff7e){return _0x26b3dd(_0x2fff7e- -_0x12af34._0x3acf3d,_0x460251);}function _0x3060c2(_0x34a33a,_0x2cd10a){return _0x26b3dd(_0x34a33a- -0x3c6,_0x2cd10a);}return typeof _0x32eae4===_0x30661d(0x38,_0x5d53af._0x4cedcb)&&_0x32eae4!=null&&!Array[_0x30661d(_0x5d53af._0x325e31,_0x5d53af._0x3d87c6)](_0x32eae4);}function extractRequestIdFromMessage(_0x34d3a4){const _0x42e633={_0x351f23:0x3ae,_0x115b4d:0x567};function _0x1231e5(_0x25d224,_0x494681){return _0x26b3dd(_0x25d224- -0x48f,_0x494681);}const _0x2c7ace=_0x34d3a4[_0x1231e5(_0x42e633._0x351f23,_0x42e633._0x115b4d)](/requestId[:\s]*([a-f0-9-]+)/i);return _0x2c7ace?.[0x1]??null;}import{randomUUID as _0xe7fcf0}from'crypto';import{setTimeout as _0x3fdfee}from'timers/promises';import _0x427ed3 from'ws';var HEARTBEAT_INTERVAL_MS=0x2710,HEARTBEAT_TIMEOUT_MS=0x88b8,GATEWAY_RETRY_DELAY_MS=0x4b0,RECONNECT_BASE_DELAY_MS=0x3e8,RECONNECT_MAX_DELAY_MS=0x3a98,CONNECT_HANDSHAKE_WARN_DELAY_MS=0x1f40,MAX_PENDING_GATEWAY_MESSAGES=0x100,MAX_DEVICE_DETAILS=0x20,MAX_PENDING_PAIR_REQUESTS=0x10,BridgeRuntime=class{[_0x3266d5(0x2c8,0x183)];[_0x3266d5(0x59c,0x501)+_0x3266d5(0x2e6,0x2c9)]=null;[_0x3266d5(-0x14c,0x3b)+_0x3266d5(0x9a,0x43)]=null;[_0x3266d5(0x2d8,0x2ee)+'necting']=![];[_0x3266d5(-0xc2,0x1ab)+_0x3266d5(0x30f,0x2c7)+'g']=![];[_0x3266d5(0xcc,0x338)]=!![];[_0x26b3dd(0x6de,0x4b1)+_0x3266d5(0x37f,0x263)]=0x0;['lastRela'+_0x3266d5(0x152,0xf7)+_0x26b3dd(0x7f5,0x621)]=0x0;[_0x26b3dd(0x9d7,0x752)+_0x26b3dd(0x861,0x6f6)]=null;['gatewayR'+_0x26b3dd(0x882,0x769)+'r']=null;['heartbea'+_0x26b3dd(0x861,0x786)]=null;[_0x3266d5(0x680,0x520)+'atewayMe'+'ssages']=[];[_0x3266d5(0x357,0x401)+_0x26b3dd(0x85c,0xab8)+'Started']=![];['gatewayC'+'loseBoun'+_0x26b3dd(0x6ea,0x43e)+_0x26b3dd(0x686,0x4a6)]=![];['clientDe'+_0x26b3dd(0x62f,0x76a)+'tedAtMs']=null;[_0x26b3dd(0x63b,0x76d)+_0x26b3dd(0x9fd,0x764)+_0x26b3dd(0x50c,0x7cd)]=null;[_0x3266d5(0x1de,0x124)+_0x26b3dd(0x568,0x3af)+_0x26b3dd(0x85c,0x785)+'s']=new Map();[_0x26b3dd(0x9ed,0xa8c)];constructor(_0x32864f){const _0x30f368={_0x4e2fe7:0x398,_0x30e58d:0x467,_0x28a9ce:0x5d6,_0x2a00a8:0x71,_0x566912:0xd2,_0x5a1656:0xa22,_0x3fc6a8:0x800},_0x224cac={_0x459284:0x40d};function _0x16db4b(_0x20a16d,_0x5bbe1a){return _0x3266d5(_0x20a16d,_0x5bbe1a-0x78);}function _0x432d72(_0x3fe78a,_0x4a128c){return _0x3266d5(_0x3fe78a,_0x4a128c-_0x224cac._0x459284);}this[_0x432d72(0x53b,0x590)]=_0x32864f,this[_0x16db4b(_0x30f368._0x4e2fe7,0x5d5)]={'running':![],'relayConnected':![],'gatewayConnected':![],'gatewayId':_0x32864f['config'][_0x16db4b(0x620,0x3fd)+'d'],'instanceId':_0x32864f[_0x432d72(0x53e,_0x30f368._0x30e58d)][_0x16db4b(0x6ad,_0x30f368._0x28a9ce)+'Id'],'relayUrl':_0x32864f[_0x16db4b(_0x30f368._0x2a00a8,_0x30f368._0x566912)]['relayUrl'],'gatewayUrl':_0x32864f[_0x432d72(_0x30f368._0x5a1656,_0x30f368._0x3fc6a8)+'rl'],'clientCount':0x0,'connectedDevices':[],'pendingPairRequests':[],'lastError':null,'lastUpdatedMs':Date['now']()};}['start'](){const _0x4bc7cf={_0x31b005:0x6b2,_0x3529f4:0x3ea,_0x2c8353:0x4cc,_0x16e92b:0x351,_0x24f78c:0x67c,_0xb6af78:0x37e,_0xea0c3a:0x15b,_0x4dc02e:0x15,_0x10dfa2:0x29f,_0x24867f:0x154,_0x5247df:0x892,_0x3cd20a:0x663,_0x529c70:0x2c,_0x29db42:0x4d6},_0x31ec22={_0x5713d1:0x54e},_0x58ab5f={};function _0x417c60(_0x1c4ed7,_0x3fa798){return _0x26b3dd(_0x1c4ed7- -_0x31ec22._0x5713d1,_0x3fa798);}_0x58ab5f[_0x417c60(-0xa3,-0x1a)]=_0x4eb0d0(0x528,_0x4bc7cf._0x31b005)+'1';const _0x19cf73=_0x58ab5f,_0x10c0d2=_0x19cf73[_0x417c60(-0xa3,0xd0)][_0x417c60(0x2c2,_0x4bc7cf._0x3529f4)]('|');function _0x4eb0d0(_0x43c3ff,_0x5147d0){return _0x26b3dd(_0x43c3ff- -0x17c,_0x5147d0);}let _0x1643f7=0x0;while(!![]){switch(_0x10c0d2[_0x1643f7++]){case'0':if(!this['stopped'])return;continue;case'1':void this[_0x4eb0d0(_0x4bc7cf._0x2c8353,_0x4bc7cf._0x16e92b)+_0x4eb0d0(_0x4bc7cf._0x24f78c,0x55f)]();continue;case'2':this[_0x4eb0d0(0x57b,_0x4bc7cf._0xb6af78)+'apshot']({'running':!![],'gatewayUrl':this[_0x4eb0d0(0x497,0x613)]['gatewayU'+'rl']});continue;case'3':this['log'](_0x417c60(_0x4bc7cf._0xea0c3a,_0x4bc7cf._0x4dc02e)+_0x417c60(0x71,_0x4bc7cf._0x10dfa2)+'\x20gateway'+_0x417c60(0x321,_0x4bc7cf._0x24867f)+this[_0x4eb0d0(0x497,0x628)][_0x417c60(-0x64,-0x10a)][_0x417c60(0x2c7,0x1e2)+'d']+(_0x4eb0d0(_0x4bc7cf._0x5247df,_0x4bc7cf._0x3cd20a)+'Url=')+this[_0x417c60(0xc5,_0x4bc7cf._0x529c70)]['gatewayU'+'rl']);continue;case'4':this[_0x4eb0d0(0x64c,_0x4bc7cf._0x29db42)]=![];continue;}break;}}async[_0x3266d5(0x538,0x4fd)](){const _0x1cf842={_0x2d1a39:0x239,_0x228a50:0x367,_0x18ffb8:0xa4,_0x5197ea:0x114,_0x2d2552:0x3e6,_0x5a2a3f:0x4d6,_0x2a239d:0x3aa,_0x3eb9f6:0x5d0,_0x12761b:0x641,_0x71372b:0x141,_0x187496:0x840,_0x5ac676:0x3a1,_0x2e3b33:0x46a,_0x5c35b3:0x232,_0x54b13c:0x479,_0x5eef0f:0x23f,_0x15dda5:0xc6,_0xadc87a:0x730,_0x92b2d5:0x2fd,_0x1036ce:0x641,_0xcd3b18:0x3a0,_0x5c2a69:0x6d5,_0x3cac68:0x381,_0x1cc4d7:0x361,_0x778744:0x344,_0x4b7d01:0x168,_0x42ad86:0x54,_0x38ad41:0x380,_0x1af51f:0x460,_0x58345f:0x624,_0xece24d:0x8d,_0x40f393:0x8fa,_0x542818:0x681,_0x4b16c2:0x324,_0x5d6a18:0x4b4,_0x4c0678:0x15f,_0x4466dc:0x269,_0x228a5b:0x622,_0x5bb16c:0x52d,_0x3f5753:0x1d0,_0x35c1be:0x63e,_0x1caf51:0x67b,_0xdb2ec6:0x602,_0xdd67b7:0x51f},_0x45c180={_0x4a57be:0x187};function _0x4d8495(_0x1137d1,_0x2379f1){return _0x26b3dd(_0x1137d1- -_0x45c180._0x4a57be,_0x2379f1);}const _0x3b30d5=(_0x20a062(_0x1cf842._0x2d1a39,_0x1cf842._0x228a50)+_0x4d8495(0x82e,0x8b2)+'|6|9|15|'+'11|0|12|'+_0x4d8495(0x3c2,0x276)+'|16')['split']('|');let _0x54dc6c=0x0;function _0x20a062(_0x5f350d,_0x50810d){return _0x26b3dd(_0x50810d- -0x527,_0x5f350d);}while(!![]){switch(_0x3b30d5[_0x54dc6c++]){case'0':this[_0x20a062(_0x1cf842._0x18ffb8,_0x1cf842._0x5197ea)+_0x20a062(_0x1cf842._0x2d2552,_0x1cf842._0x5a2a3f)+_0x4d8495(0x385,_0x1cf842._0x2a239d)]=null;continue;case'1':this['gatewayC'+_0x4d8495(_0x1cf842._0x3eb9f6,0x68c)+'g']=![];continue;case'2':this[_0x4d8495(_0x1cf842._0x12761b,0x77c)]=!![];continue;case'3':this[_0x20a062(_0x1cf842._0x71372b,0x257)+_0x4d8495(0x740,_0x1cf842._0x187496)]=![];continue;case'4':this[_0x20a062(_0x1cf842._0x5ac676,_0x1cf842._0x2e3b33)+_0x20a062(0x449,_0x1cf842._0x5c35b3)]?.[_0x4d8495(0x720,_0x1cf842._0x54b13c)]();continue;case'5':this[_0x20a062(_0x1cf842._0x5eef0f,0x4e1)+'ers']();continue;case'6':this['pendingG'+'atewayMe'+_0x20a062(_0x1cf842._0x15dda5,0x10d)]=[];continue;case'7':this[_0x4d8495(0x798,_0x1cf842._0xadc87a)](_0x4d8495(0x522,0x634)+_0x20a062(_0x1cf842._0x92b2d5,0x2a1));continue;case'8':if(this[_0x4d8495(_0x1cf842._0x1036ce,0x634)])return;continue;case'9':this[_0x20a062(_0x1cf842._0xcd3b18,0x36a)+_0x4d8495(_0x1cf842._0x5c2a69,0x7e6)+_0x4d8495(_0x1cf842._0x3cac68,_0x1cf842._0x1cc4d7)]=![];continue;case'10':this[_0x4d8495(_0x1cf842._0x778744,0x5d3)+_0x20a062(-_0x1cf842._0x4b7d01,-_0x1cf842._0x42ad86)]?.[_0x20a062(0x32e,_0x1cf842._0x38ad41)]();continue;case'11':this[_0x4d8495(0x359,_0x1cf842._0x1af51f)+_0x4d8495(0x4a8,_0x1cf842._0x58345f)+'tedAtMs']=null;continue;case'12':this[_0x20a062(0x2e1,_0x1cf842._0xece24d)+'ConnectH'+'andshake'+'s']['clear']();continue;case'13':this[_0x4d8495(0x80a,_0x1cf842._0x40f393)+_0x20a062(0x2ce,_0x1cf842._0x5c35b3)]=null;continue;case'14':const _0x55857b={};_0x55857b[_0x4d8495(0x702,_0x1cf842._0x542818)]=![],_0x55857b['relayCon'+_0x4d8495(0x464,_0x1cf842._0x4b16c2)]=![],_0x55857b[_0x4d8495(_0x1cf842._0x5d6a18,0x2bd)+'onnected']=![],_0x55857b['clientCo'+_0x20a062(_0x1cf842._0x4c0678,_0x1cf842._0x4466dc)]=0x0,_0x55857b[_0x4d8495(_0x1cf842._0x228a5b,_0x1cf842._0x5bb16c)+'r']=null,this[_0x20a062(0x187,_0x1cf842._0x3f5753)+'apshot'](_0x55857b);continue;case'15':this[_0x20a062(-0x16,0x114)+_0x4d8495(_0x1cf842._0x35c1be,0x761)+_0x4d8495(0x563,_0x1cf842._0x1caf51)+_0x4d8495(0x4ff,_0x1cf842._0xdb2ec6)]=![];continue;case'16':await _0x3fdfee(0x19);continue;case'17':this[_0x4d8495(0x344,_0x1cf842._0xdd67b7)+_0x20a062(-0x227,-0x54)]=null;continue;}break;}}async[_0x3266d5(0x122,0x60)+'airReque'+'st'](_0x19ff49){const _0x192d98={_0x291eef:0x16a,_0x410d34:0x577,_0x3a1d06:0x361,_0x15c812:0x5d9,_0x2a3821:0x23e,_0x3e6218:0x844,_0x17753d:0x64b,_0x50d442:0x6b6,_0x12019d:0x5ea,_0x20c4b4:0x622},_0x1e3ec1={_0x33c3a5:0x306},_0x2061ae={_0x4cce3d:0x159},_0x1d290d={};function _0x19dd5c(_0x2b2310,_0x41048a){return _0x3266d5(_0x41048a,_0x2b2310-_0x2061ae._0x4cce3d);}_0x1d290d[_0x19dd5c(_0x192d98._0x291eef,-0x124)]=_0x3af1a4(0x56c,_0x192d98._0x410d34)+_0x19dd5c(0x3ca,_0x192d98._0x3a1d06)+_0x3af1a4(_0x192d98._0x15c812,0x532);const _0x44c7dc=_0x1d290d;function _0x3af1a4(_0x399d61,_0x264077){return _0x3266d5(_0x264077,_0x399d61-_0x1e3ec1._0x33c3a5);}const _0x17b6fe={};_0x17b6fe[_0x3af1a4(0x4dc,_0x192d98._0x2a3821)+'d']=_0x19ff49,this[_0x3af1a4(0x423,0x4ab)+_0x3af1a4(_0x192d98._0x3e6218,0xab5)+'st'](_0x44c7dc[_0x19dd5c(_0x192d98._0x291eef,0x2a0)],_0x17b6fe),this[_0x3af1a4(_0x192d98._0x17753d,0x395)+_0x3af1a4(0x762,_0x192d98._0x50d442)+_0x19dd5c(_0x192d98._0x12019d,_0x192d98._0x20c4b4)](_0x19ff49,_0x19dd5c(0x4e1,0x4be));}async[_0x3266d5(0x4a4,0x38c)+_0x3266d5(0x492,0x318)+'t'](_0x8d3d79){const _0x12b1cd={_0x5a0518:0x1af,_0x1d0780:0x12b,_0x3a4eba:0x2c1,_0x50902f:0x33f,_0x2d9c33:0x594,_0x9fd23:0x3cb},_0x2f5cdc={_0x25ff45:0x6},_0x10ba6f={};_0x10ba6f[_0x312f4e(0x1d0,0x16b)+'d']=_0x8d3d79,this['sendGate'+'wayReque'+'st'](_0x312f4e(0x260,_0x12b1cd._0x5a0518)+_0x1ee9e4(_0x12b1cd._0x1d0780,_0x12b1cd._0x3a4eba)+'ct',_0x10ba6f);function _0x1ee9e4(_0x22a748,_0x121679){return _0x3266d5(_0x22a748,_0x121679-0x13);}function _0x312f4e(_0x4b56fa,_0xad50ae){return _0x3266d5(_0xad50ae,_0x4b56fa- -_0x2f5cdc._0x25ff45);}this[_0x312f4e(_0x12b1cd._0x50902f,0x200)+_0x312f4e(0x456,_0x12b1cd._0x2d9c33)+'esolved'](_0x8d3d79,_0x1ee9e4(_0x12b1cd._0x9fd23,0x3e7));}['getSnaps'+_0x3266d5(0x501,0x391)](){const _0x2c750b={_0x7b4cdd:0x355,_0x334c16:0x14a,_0x214dd7:0x20,_0xbc8e18:0xa0e,_0x41e98b:0x84b,_0x145943:0xb1,_0x22f9ce:0x4ee,_0x36cb59:0x607,_0x494aa5:0x504,_0x1c88e2:0x62c,_0x58886a:0x65c,_0x52183d:0xbbe,_0x5131ad:0x6c2},_0x2458bb={_0x12d3ed:0x5d};function _0x39e16f(_0x44128a,_0xbdb01b){return _0x3266d5(_0xbdb01b,_0x44128a-0x4b1);}const _0xae7d1c={...this['snapshot']};_0xae7d1c[_0x1f7680(0x21b,_0x2c750b._0x7b4cdd)+_0x1f7680(_0x2c750b._0x334c16,-_0x2c750b._0x214dd7)]=[...this[_0x39e16f(_0x2c750b._0xbc8e18,_0x2c750b._0x41e98b)][_0x1f7680(_0x2c750b._0x145943,0x355)+_0x39e16f(_0x2c750b._0x22f9ce,_0x2c750b._0x36cb59)]];function _0x1f7680(_0x15b952,_0x2abff7){return _0x3266d5(_0x15b952,_0x2abff7- -_0x2458bb._0x12d3ed);}return _0xae7d1c[_0x39e16f(_0x2c750b._0x494aa5,_0x2c750b._0x7b4cdd)+_0x39e16f(_0x2c750b._0x1c88e2,0x491)+_0x39e16f(0x5ba,_0x2c750b._0x58886a)]=[...this[_0x39e16f(_0x2c750b._0xbc8e18,_0x2c750b._0x52183d)]['pendingP'+'airReque'+_0x39e16f(0x5ba,_0x2c750b._0x5131ad)]],_0xae7d1c;}async[_0x3266d5(0x441,0x1b8)+'elay'](){const _0x493cc6={_0x576616:0x692,_0x444447:0x6d4,_0x38b4d1:0x7ef,_0x2c1e8b:0x68a,_0x1810fb:0x7d3,_0x289935:0x4f4,_0x8edb5a:0x6b7,_0x1c17d3:0x5ba,_0x55326c:0x5d6,_0x15df88:0x737,_0x547e20:0x742,_0x355d67:0x3f4,_0x296672:0x5ea,_0x3f9ece:0x5f7,_0x9d0ff3:0x68f,_0x10d6c5:0x5ff,_0x5a5c3f:0x3df,_0x279859:0x51f,_0xb40f91:0x2ff,_0x58eeaa:0x3f6,_0x47b6b8:0x82b,_0x728b55:0x4a8,_0x2f820e:0x669,_0x5914dc:0x77c,_0x3f9668:0x3ac,_0x1f8820:0x56d,_0x5cc116:0x7d4,_0x3afd55:0x47d,_0x3a6f2c:0x61c,_0x1e412a:0x665,_0x5265da:0x77e,_0x12d0a2:0x67e,_0x190021:0x897,_0x2bb741:0x513,_0x768a27:0x660,_0x175b48:0x847,_0x37fad8:0x570},_0x370bf3={_0x3646b5:0x32a,_0x4f24ba:0x528,_0xc47f0f:0x315,_0x5305f1:0x3be,_0x3c03c8:0x12a,_0x34ede3:0x20b,_0x22165f:0x401,_0x1514fc:0x1d2,_0x4d5460:0xc8,_0xedbbdb:0xcf,_0x4c3f84:0x24f,_0x448bfb:0x296,_0x5c2859:0x211,_0x8a5ec4:0x40e,_0x45e363:0x15c,_0x237392:0x64},_0x4327af={_0x39b0f5:0x987,_0x26d507:0xa2b,_0x4111ed:0x19d,_0x4a72e5:0x2c3,_0xddcac:0x62d,_0x251a52:0x69d},_0x5cc498={_0x291fbd:0x96b,_0x294edd:0x9dc,_0x3620b1:0x42b,_0x15b305:0x699,_0x2a8fdf:0x719},_0x4d73e8={_0x269fd6:0x68},_0x2a9606={_0x56b474:0xd4},_0x4c5ef7={_0x492dc1:0x518,_0x351d3d:0xc73},_0x5360ac={_0x4a6c86:0x485,_0x33910f:0x592,_0x2f75b7:0x66a,_0xd823c0:0x6e6,_0x2ec981:0x4de,_0x26b700:0x670,_0x224700:0x719,_0x4fb176:0x4ff,_0x47d76a:0xa2,_0xac20cb:0x2fa,_0x16353e:0x889,_0x59a820:0x89d,_0x4aadb2:0x51e,_0xadcb86:0x5c2,_0x1a1beb:0x6ec,_0x508e47:0x7e4,_0x682fae:0x1a2,_0x2bb18b:0xb3,_0x4ee8df:0x311,_0x91195:0x151,_0x8e966e:0x291,_0x40e4c8:0x1d1,_0x4ca1a1:0x249,_0x32ab56:0x374},_0x595310={_0x62c69a:0x10e},_0x694445={_0xc10930:0x26f},_0x32eea7={_0x333b1d:0x300},_0x57065f={'uxQqX':function(_0x5974bb,_0x3b9733){return _0x5974bb(_0x3b9733);}};if(this[_0x49ccae(_0x493cc6._0x576616,_0x493cc6._0x444447)]||this[_0x49ccae(_0x493cc6._0x38b4d1,_0x493cc6._0x2c1e8b)+_0x49ccae(0x91b,_0x493cc6._0x1810fb)]||this[_0x22f306(_0x493cc6._0x289935,_0x493cc6._0x8edb5a)+_0x49ccae(_0x493cc6._0x1c17d3,_0x493cc6._0x55326c)]())return;this[_0x49ccae(0x478,_0x493cc6._0x2c1e8b)+_0x22f306(_0x493cc6._0x15df88,_0x493cc6._0x547e20)]=!![],this[_0x49ccae(_0x493cc6._0x355d67,_0x493cc6._0x296672)+_0x49ccae(_0x493cc6._0x3f9ece,0x5ff)]+=0x1;const _0x5f4396=this[_0x49ccae(0x33e,0x5ea)+_0x49ccae(_0x493cc6._0x9d0ff3,_0x493cc6._0x10d6c5)],_0x25f0d1=buildRelayWsUrl(this[_0x49ccae(_0x493cc6._0x5a5c3f,_0x493cc6._0x279859)][_0x49ccae(_0x493cc6._0xb40f91,_0x493cc6._0x58eeaa)]);this[_0x49ccae(0x70e,_0x493cc6._0x47b6b8)](_0x49ccae(_0x493cc6._0x728b55,_0x493cc6._0x2f820e)+_0x49ccae(_0x493cc6._0x5914dc,0x5ab)+'tempt='+_0x5f4396+_0x49ccae(_0x493cc6._0x3f9668,_0x493cc6._0x1f8820)+redactRelayWsUrl(_0x25f0d1));function _0x22f306(_0x3eed26,_0x20b4db){return _0x3266d5(_0x20b4db,_0x3eed26-_0x32eea7._0x333b1d);}const _0x5990a6=this[_0x49ccae(0xa28,_0x493cc6._0x5cc116)+_0x22f306(_0x493cc6._0x3afd55,_0x493cc6._0x3a6f2c)](_0x25f0d1);this[_0x49ccae(0x859,0x89d)+_0x49ccae(0x45a,_0x493cc6._0x1e412a)]=_0x5990a6,_0x5990a6[_0x49ccae(_0x493cc6._0x5265da,_0x493cc6._0x12d0a2)](_0x49ccae(0x650,0x472),()=>{if(this[_0x8bc5e5(_0x5360ac._0x4a6c86,0x746)]||this[_0x5fd02c(0x54c,_0x5360ac._0x33910f)+_0x8bc5e5(0x79e,0x6d7)]!==_0x5990a6){_0x5990a6['close']();return;}this[_0x8bc5e5(_0x5360ac._0x2f75b7,0x6fc)+_0x5fd02c(_0x5360ac._0xd823c0,0x4c8)]=![],this[_0x8bc5e5(0x7cf,0x97a)+_0x8bc5e5(0x42c,0x505)+'yMs']=Date[_0x8bc5e5(_0x5360ac._0x2ec981,_0x5360ac._0x26b700)]();const _0x29424f={};function _0x5fd02c(_0x2c93df,_0x2bbfb7){return _0x22f306(_0x2bbfb7- -_0x694445._0xc10930,_0x2c93df);}_0x29424f[_0x8bc5e5(_0x5360ac._0x224700,0x6fc)+_0x8bc5e5(_0x5360ac._0x4fb176,0x569)]=!![],_0x29424f['lastErro'+'r']=null;function _0x8bc5e5(_0x5ce509,_0x4499a3){return _0x22f306(_0x4499a3-_0x595310._0x62c69a,_0x5ce509);}this[_0x8bc5e5(0x424,0x675)+_0x5fd02c(_0x5360ac._0x47d76a,_0x5360ac._0xac20cb)](_0x29424f),this[_0x8bc5e5(_0x5360ac._0x16353e,_0x5360ac._0x59a820)](_0x8bc5e5(_0x5360ac._0x4aadb2,0x6db)+_0x8bc5e5(0x6a6,_0x5360ac._0xadcb86)+'attempt='+_0x5f4396),this[_0x8bc5e5(0x878,_0x5360ac._0x1a1beb)+'rtbeat'](),shouldKeepGatewayConnected(this[_0x5fd02c(_0x5360ac._0x508e47,0x5ee)][_0x5fd02c(_0x5360ac._0x682fae,_0x5360ac._0x2bb18b)+'unt'],_0x57065f[_0x5fd02c(_0x5360ac._0x4ee8df,_0x5360ac._0x91195)](summarizePendingGatewayMessages,this[_0x8bc5e5(0x908,0x92e)+_0x8bc5e5(0xa61,0x8ca)+_0x5fd02c(_0x5360ac._0x8e966e,0x235)])[_0x5fd02c(_0x5360ac._0x40e4c8,_0x5360ac._0x4ca1a1)+_0x8bc5e5(0x888,0x619)])&&this[_0x8bc5e5(0x7da,0x8f8)+_0x5fd02c(0x1fb,_0x5360ac._0x32ab56)+'nected']();}),_0x5990a6['on'](_0x49ccae(_0x493cc6._0x190021,0x6d2),(_0x211469,_0x4d255b)=>{function _0x19945a(_0x5c2cc2,_0x11712a){return _0x49ccae(_0x5c2cc2,_0x11712a- -0x11a);}function _0x504175(_0x5b2383,_0x2b651d){return _0x49ccae(_0x5b2383,_0x2b651d-0x19a);}void this[_0x19945a(_0x4c5ef7._0x492dc1,0x766)+_0x504175(_0x4c5ef7._0x351d3d,0xa9f)+'ge'](_0x211469,_0x4d255b);}),_0x5990a6['on'](_0x49ccae(_0x493cc6._0x2bb741,_0x493cc6._0x768a27),()=>{function _0xb9dd1(_0xf9bae7,_0x4db9d9){return _0x49ccae(_0xf9bae7,_0x4db9d9-_0x2a9606._0x56b474);}function _0x3e2187(_0x422b3d,_0x54c1b8){return _0x49ccae(_0x54c1b8,_0x422b3d- -_0x4d73e8._0x269fd6);}this[_0xb9dd1(_0x5cc498._0x291fbd,_0x5cc498._0x294edd)+_0x3e2187(_0x5cc498._0x3620b1,0x51b)+_0x3e2187(_0x5cc498._0x15b305,_0x5cc498._0x2a8fdf)]=Date[_0xb9dd1(0x4a1,0x6d2)]();}),_0x5990a6[_0x22f306(0x5e2,0x383)](_0x49ccae(0x748,_0x493cc6._0x175b48),_0xfb8d53=>{function _0x150d85(_0x2a1c91,_0x44ce20){return _0x49ccae(_0x44ce20,_0x2a1c91-0x15c);}function _0x29f806(_0x2fa82c,_0x321326){return _0x49ccae(_0x2fa82c,_0x321326- -0x218);}this[_0x150d85(_0x4327af._0x39b0f5,_0x4327af._0x26d507)](_0x29f806(_0x4327af._0x4111ed,_0x4327af._0x4a72e5)+_0x29f806(_0x4327af._0xddcac,_0x4327af._0x251a52)+String(_0xfb8d53));});function _0x49ccae(_0x488472,_0x3d6950){return _0x3266d5(_0x488472,_0x3d6950-0x39c);}_0x5990a6[_0x22f306(0x5e2,_0x493cc6._0x37fad8)]('close',(_0x586355,_0x586625)=>{const _0x421154={_0x559e0c:0x350};this[_0x3a080f(_0x370bf3._0x3646b5,_0x370bf3._0x4f24ba)+_0x57c723(0x175,_0x370bf3._0xc47f0f)]===_0x5990a6&&(this['relaySoc'+_0x57c723(_0x370bf3._0x5305f1,0x315)]=null);this[_0x3a080f(0x93,0x315)+_0x57c723(0x2d3,0x483)]=![],this[_0x3a080f(0x2c5,_0x370bf3._0x3c03c8)+_0x3a080f(_0x370bf3._0x34ede3,0x3c2)](),this[_0x3a080f(0x153,0x77)+_0x3a080f(0x3fa,0x1c6)+_0x57c723(0x175,0x314)]=null,this[_0x3a080f(_0x370bf3._0x22165f,_0x370bf3._0x1514fc)+'onnected'+_0x57c723(0x280,_0x370bf3._0x4d5460)]=null;function _0x57c723(_0x588a23,_0x3e7008){return _0x49ccae(_0x588a23,_0x3e7008- -_0x421154._0x559e0c);}this['updateSn'+'apshot']({'relayConnected':![],'gatewayConnected':![],'clientCount':0x0,'lastError':_0x586355===0x3e8?null:'relay\x20cl'+_0x3a080f(0x12b,_0x370bf3._0xedbbdb)+(_0x586625[_0x57c723(0x265,_0x370bf3._0x4c3f84)]()||_0x586355)});function _0x3a080f(_0x52c971,_0x36772b){return _0x49ccae(_0x52c971,_0x36772b- -0x375);}this[_0x3a080f(0x30a,0x4b6)](_0x57c723(0x461,0x1a5)+_0x3a080f(_0x370bf3._0x448bfb,_0x370bf3._0x5c2859)+_0x3a080f(0x3a7,_0x370bf3._0x8a5ec4)+_0x586355+'\x20reason='+(_0x586625[_0x3a080f(0x1a9,0x22a)]()||'<none>')),this[_0x57c723(0x2e6,_0x370bf3._0x45e363)+_0x57c723(0x30e,0x22a)](),this[_0x57c723(_0x370bf3._0x237392,0x77)+_0x3a080f(0x21a,0x190)+_0x57c723(0x68,0x324)]();});}async[_0x3266d5(0x25e,0x4e4)+_0x26b3dd(0x9f9,0xa6a)+'ge'](_0x75e792,_0x3b6357){const _0x43a74a={_0x5b2c3e:0x1bf,_0x389458:0x4fb,_0x3078f9:0x268,_0x347086:0x414,_0x192210:0x1d5,_0x494623:0x1b1,_0x161f04:0xf1,_0x519fcd:0x319,_0x40e124:0x66,_0x3b0b51:0x5d3,_0x12187f:0x637,_0xa9936d:0x37e,_0x39ae18:0x1b9,_0x4aea39:0x77,_0xe08538:0x163};this['lastRela'+_0x2d0120(_0x43a74a._0x5b2c3e,0xc5)+_0x544b39(0x454,_0x43a74a._0x389458)]=Date[_0x544b39(0x351,_0x43a74a._0x3078f9)]();if(_0x3b6357){this[_0x544b39(_0x43a74a._0x347086,_0x43a74a._0x192210)+_0x544b39(_0x43a74a._0x494623,-_0x43a74a._0x161f04)+'tewayMes'+'sage']({'kind':_0x2d0120(_0x43a74a._0x519fcd,_0x43a74a._0x40e124),'data':normalizeBinary(_0x75e792)});return;}const _0x3602a6=normalizeText(_0x75e792);function _0x544b39(_0x2ed20a,_0x2ea421){return _0x26b3dd(_0x2ed20a- -0x3a1,_0x2ea421);}if(_0x3602a6==null)return;const _0x28566e=parseControl(_0x3602a6);if(_0x28566e){await this[_0x544b39(_0x43a74a._0x3b0b51,0x61b)+_0x2d0120(_0x43a74a._0x12187f,_0x43a74a._0xa9936d)+'ol'](_0x28566e);return;}const _0xfb342f=parseConnectStartIdentity(_0x3602a6);_0xfb342f&&this[_0x2d0120(0x4cc,0x72b)+'onnectSt'+_0x544b39(_0x43a74a._0x39ae18,_0x43a74a._0x4aea39)](_0xfb342f['id'],_0xfb342f[_0x2d0120(0x386,0x1fa)]);const _0x229303={};function _0x2d0120(_0x2d0b71,_0x108eb9){return _0x26b3dd(_0x2d0b71- -0x3c8,_0x108eb9);}_0x229303[_0x2d0120(0xde,-0x3b)]=_0x2d0120(0x35f,0x322),_0x229303[_0x2d0120(0x35f,0x432)]=_0x3602a6,this['forwardO'+_0x544b39(_0x43a74a._0x494623,-0xab)+_0x2d0120(0xcf,0x274)+_0x2d0120(0x1b1,_0x43a74a._0xe08538)](_0x229303);}async[_0x3266d5(0x6db,0x4e4)+'layContr'+'ol'](_0x586427){const _0x441453={_0x3671a8:0x748,_0x100a1f:0x973,_0x511c4d:0x6c5,_0x4870e9:0x564,_0x21308f:0x35c,_0x35b887:0x4d7,_0x45a5df:0x6bf,_0x2161c0:0x347,_0x9d9235:0x695,_0x26c2bc:0x43d,_0x53b04b:0x94a,_0x4ec9d3:0x8a8,_0x1175dd:0x5ef,_0x1b82bf:0x7b2,_0x1ba334:0x45a,_0x37a568:0x93c,_0x439e41:0x94c,_0x174a93:0x96c,_0x2bbb97:0x328,_0x3466a1:0x5ae,_0x21e288:0x6ee,_0x12fffb:0x45f,_0x93fbfe:0x4db,_0x1779df:0x4ce,_0x2a2b12:0x671,_0x3d68de:0x5a4,_0x36e36a:0x80c,_0x29070b:0x70f,_0x1abc8d:0x47c,_0x12e6b2:0x4ea,_0x4d90df:0x7db,_0x18d653:0x484,_0x4841b1:0x6a7,_0x509876:0x584,_0x512f56:0x44d,_0x2c7746:0x88e,_0x52d2e3:0x92f,_0x595d8b:0x6cf,_0x5e7ef8:0x4f8,_0x259de1:0x5c7,_0x4b59a2:0x700,_0x5bb49b:0x6b0,_0x162ec3:0x54e,_0x2be37e:0x2c3,_0x53113a:0x51f,_0x5073fd:0x3f1,_0x1eb626:0x59d,_0x45a3c7:0x6cb,_0x23c497:0x5f7,_0x21efe8:0x315,_0x4c3e7f:0x46d,_0x5d5c20:0x5e6,_0x5307d5:0x77c,_0x43c5bd:0x451,_0x1c63b4:0x92f,_0x8fc08:0x63b,_0x51e1d8:0x5b3,_0x4e6f31:0x6a2,_0x32f0d1:0x7c5,_0x243f26:0x50a,_0x471cef:0x4b9,_0x4d7007:0x245,_0x1780c8:0x4b3,_0x40d37c:0x498,_0x1d2c64:0x210,_0x58f647:0x394,_0x1d534a:0x322,_0x40314c:0xa24,_0x5ac808:0x616,_0x45ae00:0x4f3,_0x414b78:0x464,_0x3089c7:0x59e,_0x5852b0:0x810,_0x45012e:0x5df,_0x5e8e7f:0x377,_0x4935de:0x733,_0x4f3e26:0x637,_0xeaed40:0x3b7,_0x288337:0x516,_0x12dcaf:0x366,_0x283461:0x92f,_0x50bb4e:0x3b7,_0x1a61ea:0x5e8,_0x234ccd:0x96f,_0x439ab7:0x494,_0xadfbe7:0x541,_0x131605:0x723,_0x89c5c6:0x873,_0x5cef17:0x5ed,_0x17f888:0x926,_0x16fda6:0x8a2,_0xbec5f7:0x6df,_0x262c4e:0x5ba,_0x11dc73:0x714,_0x18310b:0x669,_0x2ce2ba:0x3be,_0x254aca:0xbab,_0x57ad9b:0x4ef,_0x1b78e7:0x3ee,_0x3ac862:0x678,_0x1f41cc:0xa45,_0x561653:0x7c1,_0x2a44d0:0x2a7,_0xfba82:0x56b,_0x53f8c2:0x8a9,_0x359d2b:0x361,_0x46c31f:0x780,_0x303a4a:0x288,_0x2333d1:0x354,_0x1adc2f:0x810,_0x1fe3d3:0x619,_0x882b09:0x487,_0x11c807:0x4f6,_0x1f54a1:0x782,_0x5fc9af:0x9e1,_0x5dd641:0x662,_0x410cbd:0x614,_0x28f3f7:0x5da,_0x57efa9:0x487,_0x165c5d:0x6db,_0x414737:0x757,_0x31027e:0x678,_0x26d611:0x2cc,_0xf69340:0x76e,_0x422260:0x7dc,_0x5d38b6:0x761,_0x55c12d:0x9b0,_0x31d6b8:0x896,_0x11aa1d:0x3b7,_0x5f3984:0x44b,_0x588165:0x457,_0x4ec893:0x6a6,_0x590e7e:0x635,_0x2f4173:0xa7c,_0x3aa2e6:0x8c1,_0x505b05:0x575,_0x103c20:0x7fd,_0x55a1db:0x5f9,_0x27cdc5:0x89e,_0x320889:0x47e,_0x308e02:0x6d2,_0x455d20:0x2a0,_0x36ea5e:0x445,_0x57d27d:0x4fa,_0x3c15c4:0x601,_0x1cf7df:0x6fd,_0x3d20bd:0x63a,_0x45970e:0x56a},_0x149ebd={'TiiPs':_0x57e108(0x5b8,_0x441453._0x3671a8)+_0x4cbc0b(0x6cc,_0x441453._0x100a1f)+'t','sAZck':function(_0x20f0f0,_0x29e2de){return _0x20f0f0===_0x29e2de;},'irIeP':function(_0x29afeb,_0x1234d9){return _0x29afeb===_0x1234d9;},'HUvBn':_0x57e108(_0x441453._0x511c4d,_0x441453._0x4870e9)+_0x57e108(0x5f7,0x7d5)+_0x57e108(_0x441453._0x21308f,0x575)+_0x57e108(0x3ef,_0x441453._0x35b887)+_0x57e108(_0x441453._0x45a5df,0x871)+'dle\x20gate'+'way','EzmUj':function(_0x5cdf60,_0xea43e9){return _0x5cdf60>_0xea43e9;},'QxUQS':function(_0x305c65,_0x2e524b){return _0x305c65(_0x2e524b);}};function _0x57e108(_0x5e5b9a,_0x1f02ec){return _0x26b3dd(_0x5e5b9a- -0x27d,_0x1f02ec);}if(_0x586427[_0x4cbc0b(0x3ad,0x57a)]===_0x149ebd[_0x4cbc0b(0x9fc,0x790)]){await this[_0x4cbc0b(0x94b,0x6e8)+_0x57e108(_0x441453._0x2161c0,0x4d1)+_0x57e108(_0x441453._0x9d9235,0x5a2)](_0x586427);return;}const {event:_0x4490f5,count:_0x5cd55c}=_0x586427;if(_0x149ebd[_0x57e108(0x618,_0x441453._0x26c2bc)](_0x4490f5,'client_c'+_0x57e108(0x780,0x94a))||_0x149ebd[_0x4cbc0b(0x72a,0x955)](_0x4490f5,_0x4cbc0b(_0x441453._0x53b04b,_0x441453._0x4ec9d3)+_0x57e108(_0x441453._0x1175dd,_0x441453._0x1b82bf))){const _0x41b603=this[_0x4cbc0b(0x8c6,0x96c)][_0x4cbc0b(_0x441453._0x1ba334,0x431)+_0x4cbc0b(_0x441453._0x37a568,0x70f)],_0x2d0cdb=_0x5cd55c??Math['max'](0x1,this[_0x4cbc0b(_0x441453._0x439e41,_0x441453._0x174a93)][_0x4cbc0b(0x297,0x431)+_0x57e108(0x513,0x5b9)]);_0x2d0cdb>0x0&&this[_0x57e108(0x263,_0x441453._0x2bbb97)+_0x4cbc0b(0x489,_0x441453._0x3466a1)+_0x57e108(0x4db,_0x441453._0x21e288)]==null&&(this[_0x4cbc0b(0x5c8,_0x441453._0x12fffb)+'mandStar'+_0x57e108(_0x441453._0x93fbfe,_0x441453._0x1779df)]=Date[_0x4cbc0b(0x659,_0x441453._0x2a2b12)]());const _0x33c4a5={};_0x33c4a5[_0x4cbc0b(_0x441453._0x3d68de,0x431)+_0x4cbc0b(_0x441453._0x36e36a,_0x441453._0x29070b)]=_0x2d0cdb,this['updateSn'+_0x57e108(_0x441453._0x1abc8d,_0x441453._0x12e6b2)](_0x33c4a5);if(_0x2d0cdb===0x0){this[_0x4cbc0b(0x646,0x810)+_0x4cbc0b(0x9d3,_0x441453._0x4d90df)+_0x57e108(0x28b,_0x441453._0x18d653)]=![],this[_0x4cbc0b(_0x441453._0x4841b1,_0x441453._0x509876)+_0x57e108(0x4a7,0x729)+'t'](),this[_0x4cbc0b(0x276,_0x441453._0x512f56)+_0x4cbc0b(0xa3b,0x7d9)+_0x57e108(0x76e,_0x441453._0x2c7746)+'e']();const _0x5556d0=summarizePendingGatewayMessages(this[_0x4cbc0b(0x8d9,_0x441453._0x52d2e3)+_0x57e108(_0x441453._0x595d8b,_0x441453._0x5e7ef8)+'ssages'])[_0x4cbc0b(0x43a,_0x441453._0x259de1)+_0x4cbc0b(_0x441453._0x4b59a2,0x61a)];shouldScheduleGatewayIdleClose(_0x2d0cdb,_0x5556d0,this[_0x57e108(_0x441453._0x5bb49b,0x70d)+_0x4cbc0b(0x84c,0x8a2)]())?(this['log'](_0x149ebd[_0x57e108(_0x441453._0x162ec3,_0x441453._0x2be37e)]),this[_0x4cbc0b(0x55a,_0x441453._0x53113a)+_0x57e108(_0x441453._0x5073fd,_0x441453._0x1eb626)]()):this[_0x4cbc0b(_0x441453._0x45a3c7,0x89e)]('client\x20d'+_0x57e108(_0x441453._0x23c497,0x571)+'opped\x20to'+'\x20zero;\x20g'+_0x4cbc0b(_0x441453._0x21efe8,_0x441453._0x4c3e7f)+_0x4cbc0b(_0x441453._0x5d5c20,_0x441453._0x5307d5)+_0x4cbc0b(0xa33,0x7c9));}else{if(shouldRecycleGatewayForFreshClient(_0x41b603,_0x2d0cdb,this['isGatewa'+_0x57e108(0x6a6,_0x441453._0x43c5bd)](),![])){const _0x5b818b=summarizePendingGatewayMessages(this[_0x4cbc0b(0x7d3,_0x441453._0x1c63b4)+_0x57e108(0x6cf,0x7a9)+_0x4cbc0b(_0x441453._0x8fc08,_0x441453._0x51e1d8)]);this[_0x57e108(_0x441453._0x4e6f31,_0x441453._0x32f0d1)](_0x4cbc0b(_0x441453._0x243f26,0x64a)+_0x57e108(_0x441453._0x471cef,_0x441453._0x4d7007)+_0x57e108(_0x441453._0x1780c8,0x5dc)+_0x57e108(0x408,0x1c5)+_0x57e108(_0x441453._0x40d37c,_0x441453._0x1d2c64)+_0x57e108(0x4ad,_0x441453._0x58f647)+_0x4cbc0b(0x5ff,0x716)+'='+_0x5b818b[_0x57e108(_0x441453._0x1d534a,0x123)]+(_0x4cbc0b(_0x441453._0x40314c,0x874)+'=')+_0x5b818b[_0x57e108(0x3cb,0x4a2)+'equests']+_0x4cbc0b(_0x441453._0x5ac808,_0x441453._0x45ae00)+_0x5b818b[_0x57e108(0x4a1,0x4ef)+'t']+'\x20binary='+_0x5b818b[_0x57e108(_0x441453._0x414b78,0x671)]+('\x20handsha'+'keStarte'+'d=')+this[_0x4cbc0b(_0x441453._0x3089c7,_0x441453._0x5852b0)+_0x57e108(_0x441453._0x45012e,0x87f)+_0x4cbc0b(_0x441453._0x5e8e7f,0x487)]);const _0x54b013=prunePendingGatewayMessagesForFreshDemand(this[_0x57e108(_0x441453._0x4935de,_0x441453._0x4f3e26)+_0x4cbc0b(0xb70,0x8cb)+_0x57e108(_0x441453._0xeaed40,0x293)]);_0x149ebd[_0x4cbc0b(0x2cb,_0x441453._0x288337)](_0x54b013[_0x57e108(0x4d4,_0x441453._0x12dcaf)],0x0)&&(this[_0x4cbc0b(0x948,_0x441453._0x283461)+'atewayMe'+_0x57e108(_0x441453._0x50bb4e,_0x441453._0x1a61ea)]=_0x54b013[_0x57e108(0x6db,_0x441453._0x234ccd)],this[_0x57e108(0x6a2,_0x441453._0x439ab7)](_0x4cbc0b(0x654,_0x441453._0xadfbe7)+'stale\x20ga'+'teway\x20qu'+_0x57e108(_0x441453._0x131605,_0x441453._0x5852b0)+'re\x20recyc'+_0x57e108(0x77d,_0x441453._0x89c5c6)+_0x4cbc0b(_0x441453._0x5cef17,0x467)+_0x54b013[_0x57e108(0x4d4,0x5fc)]+_0x57e108(0x4c7,0x2d9)+_0x54b013[_0x4cbc0b(0xab8,0x8d7)][_0x57e108(0x64d,0x5c9)])),this[_0x57e108(0x323,0x2f5)+_0x57e108(0x3f1,0x453)](!![]);}if(this['isGatewa'+_0x4cbc0b(_0x441453._0x17f888,_0x441453._0x16fda6)]()&&!this[_0x4cbc0b(_0x441453._0xbec5f7,_0x441453._0x262c4e)+'loseBoun'+_0x4cbc0b(_0x441453._0x11dc73,_0x441453._0x18310b)+_0x57e108(0x409,0x4cb)]){const _0x4b63fd={};_0x4b63fd[_0x57e108(_0x441453._0x2ce2ba,0x59e)+_0x4cbc0b(_0x441453._0x254aca,0x97c)]=!![],_0x4b63fd[_0x4cbc0b(_0x441453._0x57ad9b,0x728)+'r']=null,this[_0x4cbc0b(0x535,0x676)+_0x4cbc0b(_0x441453._0x1b78e7,_0x441453._0x3ac862)](_0x4b63fd),this['log'](_0x4cbc0b(0x60d,0x64a)+'already\x20'+_0x4cbc0b(_0x441453._0x1f41cc,_0x441453._0x561653)+_0x57e108(_0x441453._0x2a44d0,0x67)+_0x4cbc0b(0x960,0x838)+_0x4cbc0b(0x551,_0x441453._0xfba82)+this[_0x4cbc0b(0x725,_0x441453._0x53f8c2)+_0x57e108(_0x441453._0x359d2b,0x5d3)](this[_0x57e108(0x3be,0x1e0)+_0x57e108(_0x441453._0x46c31f,0x6cf)+_0x57e108(0x28f,_0x441453._0x303a4a)])+(_0x57e108(0x70f,0x496)+_0x57e108(_0x441453._0x2333d1,0x256)+'d=')+this[_0x4cbc0b(0x61e,_0x441453._0x1adc2f)+_0x57e108(_0x441453._0x45012e,0x646)+_0x4cbc0b(_0x441453._0x1fe3d3,_0x441453._0x882b09)]);}}this['ensureGa'+_0x57e108(_0x441453._0x11c807,0x408)+_0x4cbc0b(_0x441453._0x1f54a1,0x56a)]();return;}function _0x4cbc0b(_0x2206fa,_0x1660ea){return _0x26b3dd(_0x1660ea- -0x81,_0x2206fa);}if(_0x4490f5===_0x4cbc0b(_0x441453._0x5fc9af,0x7a6)+_0x4cbc0b(_0x441453._0x5dd641,0x6d2)+'ted'){this[_0x57e108(_0x441453._0x410cbd,_0x441453._0x28f3f7)+_0x4cbc0b(0x869,0x7db)+_0x4cbc0b(0x261,_0x441453._0x57efa9)]=![];const _0x49e02a={};_0x49e02a['clientCo'+_0x57e108(0x513,0x478)]=0x0,this[_0x57e108(0x47a,_0x441453._0x165c5d)+_0x4cbc0b(_0x441453._0x414737,_0x441453._0x31027e)](_0x49e02a),this['markDevi'+_0x4cbc0b(0x681,0x6a3)+'t'](),this[_0x4cbc0b(_0x441453._0x26d611,0x44d)+_0x57e108(0x5dd,0x4ef)+_0x57e108(_0x441453._0xf69340,_0x441453._0x422260)+'e']();const _0x3447fd=_0x149ebd[_0x57e108(_0x441453._0x5d38b6,0x53d)](summarizePendingGatewayMessages,this[_0x57e108(_0x441453._0x4935de,_0x441453._0x55c12d)+_0x57e108(0x6cf,_0x441453._0x31d6b8)+_0x57e108(_0x441453._0x11aa1d,_0x441453._0x5f3984)])[_0x4cbc0b(_0x441453._0x588165,0x5c7)+_0x57e108(0x41e,0x5d8)];shouldScheduleGatewayIdleClose(0x0,_0x3447fd,this['isGatewa'+_0x57e108(_0x441453._0x4ec893,0x6ae)]())?(this[_0x57e108(0x6a2,_0x441453._0x590e7e)](_0x4cbc0b(_0x441453._0x2f4173,_0x441453._0x3aa2e6)+'isconnec'+_0x57e108(_0x441453._0x505b05,_0x441453._0x103c20)+_0x57e108(0x5e9,0x504)+_0x4cbc0b(0x47c,0x6a2)+'y'),this[_0x57e108(0x323,0x91)+'eway']()):(this[_0x4cbc0b(_0x441453._0x55a1db,_0x441453._0x27cdc5)](_0x57e108(_0x441453._0x511c4d,_0x441453._0x320889)+_0x4cbc0b(0x651,_0x441453._0x308e02)+_0x4cbc0b(0x6f4,_0x441453._0x53b04b)+_0x57e108(0x2e5,_0x441453._0x455d20)+_0x4cbc0b(_0x441453._0x36ea5e,_0x441453._0x57d27d)+_0x4cbc0b(0x466,_0x441453._0x3c15c4)),this[_0x57e108(_0x441453._0x1cf7df,_0x441453._0x3d20bd)+_0x57e108(0x4f6,0x3d7)+_0x4cbc0b(0x38d,_0x441453._0x45970e)]());return;}}async[_0x26b3dd(0x769,0x4de)+_0x3266d5(-0x70,0x134)+_0x26b3dd(0x912,0xb45)](_0xfc396e){const _0x8ce52={_0x4aea84:0x530,_0x1c15fb:0x15a,_0x421c4a:0x9f9,_0x5a6ded:0x290,_0x3fa981:0x31a,_0xc2a2d7:0x668,_0x58be2f:0x16c,_0x553356:0xdb,_0x3a51fb:0x5ac,_0x4c4ddc:0x1a1,_0x2a1397:0x877,_0x3b216d:0x786,_0x149a9e:0x849,_0x2526de:0x5bd,_0x2b6f16:0x8e3,_0xe52d60:0x98d,_0xd18eca:0x51,_0x4722ac:0x9cd,_0x2997e7:0x323,_0x53f539:0x4cb,_0x12873f:0x348,_0x591b26:0xb0,_0x4887cc:0xb0,_0x3304de:0x17f,_0x2ed94d:0xeb,_0x3e23f4:0x7c1,_0x11d887:0x92a,_0x4ff7b3:0x832,_0x1dafaa:0x3f,_0x1ac056:0x2ef,_0x2b38d8:0x634,_0x49efc5:0x27f,_0x2971ee:0xc,_0x511a67:0x5b3,_0x54f8e4:0x535,_0x2203d8:0x57f,_0x44ee8c:0x750,_0x82dd17:0x269,_0x5aa609:0x46b,_0x5b627e:0x255,_0x55b053:0x1a9,_0x1febc2:0x202,_0x48811e:0x1a,_0x36838a:0x31,_0x1250a7:0x94e,_0x100147:0x8fd,_0x35d3af:0x957,_0x49242f:0x83c,_0x261d6e:0xfa,_0x78d22f:0x75,_0x41f4a6:0xeb,_0x156b45:0x5a1,_0x1a0dab:0x844},_0x21bd1e={};_0x21bd1e[_0x203934(_0x8ce52._0x4aea84,0x634)]=function(_0x325b0e,_0x25aa99){return _0x325b0e||_0x25aa99;},_0x21bd1e['ysDiR']=_0x436bcf(0x20c,_0x8ce52._0x1c15fb)+'p.issued',_0x21bd1e[_0x203934(_0x8ce52._0x421c4a,0x983)]=function(_0x59c2fe,_0x454255){return _0x59c2fe||_0x454255;},_0x21bd1e['pwRTj']=_0x203934(0x758,0x830)+_0x436bcf(_0x8ce52._0x5a6ded,_0x8ce52._0x3fa981);const _0x4d8944=_0x21bd1e,_0x588c83=_0xfc396e[_0x203934(_0x8ce52._0xc2a2d7,0x661)+'d']?.[_0x436bcf(_0x8ce52._0x58be2f,_0x8ce52._0x553356)]()??'',_0x14b405=_0xfc396e[_0x203934(_0x8ce52._0x3a51fb,0x557)+_0x436bcf(0x250,_0x8ce52._0x4c4ddc)]?.['trim']()||_0xfc396e[_0x436bcf(0xd9,0x16e)+_0x203934(0x856,_0x8ce52._0x2a1397)]?.['trim']()||'';if(!_0x588c83){this[_0x203934(0xb73,0x91a)](_0x203934(0x68c,_0x8ce52._0x3b216d)+_0x203934(0x390,0x637)+_0x203934(0x9c8,_0x8ce52._0x149a9e)+_0x203934(0x56b,_0x8ce52._0x2526de)+'reason=m'+_0x203934(0x8d2,_0x8ce52._0x2b6f16)+_0x203934(0x978,_0x8ce52._0xe52d60)+'d');return;}const _0xa79a00=parseBootstrapRequestPayload(_0xfc396e[_0x203934(0x78e,0x79a)]);function _0x436bcf(_0x1f9595,_0x39ee9){return _0x3266d5(_0x1f9595,_0x39ee9- -0x24b);}function _0x203934(_0x242f6c,_0x1962a7){return _0x3266d5(_0x242f6c,_0x1962a7-0x48b);}if(!_0xa79a00['ok']){this[_0x436bcf(_0x8ce52._0xd18eca,0x244)](_0x203934(_0x8ce52._0x4722ac,0x786)+'otstrap\x20'+_0x203934(0x6a4,0x849)+'rejected'+_0x203934(_0x8ce52._0x2997e7,_0x8ce52._0x53f539)+'Id='+_0x588c83+'\x20code='+_0xa79a00[_0x436bcf(-_0x8ce52._0x12873f,-_0x8ce52._0x591b26)]+_0x436bcf(0xc6,0x1ea)+_0xa79a00['message']);const _0xe51334={};_0xe51334[_0x436bcf(0xff,-_0x8ce52._0x4887cc)]=_0xa79a00[_0x436bcf(-_0x8ce52._0x3304de,-0xb0)],_0xe51334[_0x436bcf(-0xde,_0x8ce52._0x2ed94d)]=_0xa79a00[_0x203934(0x85f,_0x8ce52._0x3e23f4)],this[_0x203934(_0x8ce52._0x11d887,_0x8ce52._0x4ff7b3)+_0x203934(0x3f6,0x6a5)]({'event':_0x436bcf(-_0x8ce52._0x1dafaa,0x15a)+_0x436bcf(_0x8ce52._0x1ac056,0x31a),'requestId':_0x588c83,'targetClientId':_0x4d8944[_0x203934(0x48e,_0x8ce52._0x2b38d8)](_0x14b405,void 0x0),'payload':_0xe51334});return;}try{const _0x2cf673=await issueOpenClawBootstrapToken(_0xa79a00[_0x436bcf(_0x8ce52._0x49efc5,0xee)]);this[_0x436bcf(_0x8ce52._0x2971ee,0x244)](_0x203934(0x66a,0x786)+_0x203934(_0x8ce52._0x511a67,0x637)+_0x436bcf(-0x17,0x223)+_0x436bcf(0x1a6,0x1d2)+_0x203934(_0x8ce52._0x54f8e4,_0x8ce52._0x2203d8)+_0x588c83+(_0x436bcf(-0x30b,-0x19a)+'d=')+_0xa79a00[_0x203934(_0x8ce52._0x44ee8c,0x7c4)]['deviceId']+('\x20targetC'+'lientId=')+(_0x14b405||'<none>')+('\x20expires'+_0x436bcf(_0x8ce52._0x82dd17,0x200))+_0x2cf673[_0x203934(_0x8ce52._0x5aa609,0x4d4)+'tMs']);const _0xfbefb6={};_0xfbefb6['bootstra'+_0x436bcf(0x1cc,_0x8ce52._0x5b627e)]=_0x2cf673[_0x436bcf(-0x1d3,0x54)],_0xfbefb6[_0x436bcf(-_0x8ce52._0x55b053,-_0x8ce52._0x1febc2)+'tMs']=_0x2cf673[_0x436bcf(-0x305,-0x202)+'tMs'],this[_0x203934(0x6a4,0x832)+_0x436bcf(_0x8ce52._0x48811e,-_0x8ce52._0x36838a)]({'event':_0x4d8944[_0x203934(0x9b5,_0x8ce52._0x1250a7)],'requestId':_0x588c83,'targetClientId':_0x4d8944[_0x436bcf(0x156,0x2ad)](_0x14b405,void 0x0),'payload':_0xfbefb6});}catch(_0x536a36){const _0x101812=_0x536a36 instanceof Error?_0x536a36[_0x203934(_0x8ce52._0x100147,0x7c1)]:String(_0x536a36);this[_0x436bcf(0x228,0x244)](_0x436bcf(0x250,_0x8ce52._0x4887cc)+'otstrap\x20'+_0x203934(_0x8ce52._0x35d3af,0x8f9)+'sue\x20fail'+_0x203934(0x9e0,0x72f)+'stId='+_0x588c83+_0x203934(_0x8ce52._0x49242f,0x6a6)+_0x101812);const _0x3a7c84={};_0x3a7c84['code']='bootstra'+'p_issue_'+_0x436bcf(-_0x8ce52._0x261d6e,_0x8ce52._0x78d22f),_0x3a7c84[_0x436bcf(0x391,_0x8ce52._0x41f4a6)]=_0x101812;const _0x5b3e3b={};_0x5b3e3b['event']=_0x4d8944[_0x203934(_0x8ce52._0x156b45,0x5c4)],_0x5b3e3b['requestI'+'d']=_0x588c83,_0x5b3e3b[_0x203934(0xa9d,_0x8ce52._0x1a0dab)+'ientId']=_0x14b405||void 0x0,_0x5b3e3b[_0x203934(0x5a4,0x79a)]=_0x3a7c84,this['sendRela'+_0x203934(0x443,0x6a5)](_0x5b3e3b);}}[_0x3266d5(0x96,0x325)+'rQueueGa'+_0x26b3dd(0x497,0x39a)+'sage'](_0xcec5c7){const _0x4696f5={_0x3facc8:0x33,_0x34d7b4:0x476,_0x2c2ba4:0x2e3,_0x2fcf5e:0x579,_0x28ee7b:0x2d6,_0x47eaad:0x19b,_0x33f364:0x135,_0x43b67c:0x8a,_0x3b847e:0x2e,_0x201286:0x79,_0x374b0f:0x16e,_0xc2e37:0x5d,_0xdfa820:0x240,_0xcba1e:0x2bd,_0x46e1e1:0x1c9,_0x4cbc28:0x162,_0x338ec3:0x3a9,_0x231d42:0x4f2,_0x4ecefc:0x20b,_0x1351b:0x64a,_0x157561:0x252,_0x291d70:0x377,_0x1ddeea:0xcf,_0x4c908b:0x316,_0x1aca11:0x8a,_0x16184e:0x210,_0x3b2d1d:0xe7,_0x30aaa5:0x2e2,_0x57a67a:0x2c1,_0x9dca6a:0x41f,_0x54f0a8:0x4d,_0xc50269:0x42f,_0x29a72d:0xf3,_0x1db46e:0x256,_0x1a47de:0x5,_0x48f77a:0x1c4,_0xb4dd5:0x1dc,_0x5d033b:0x29e,_0x560aa9:0x18,_0x59a6c0:0x249},_0x30b949={_0x35d6a2:0x208},_0x2900ac={_0x2cf4db:0x63},_0x556c9c={'voKmY':_0x21145c(_0x4696f5._0x3facc8,-0x15e)+_0x5670e0(0x2e9,_0x4696f5._0x34d7b4)+_0x5670e0(_0x4696f5._0x2c2ba4,_0x4696f5._0x2fcf5e)+'ng\x20conne'+'ct\x20hands'+_0x5670e0(0x3f9,_0x4696f5._0x28ee7b)+_0x5670e0(_0x4696f5._0x47eaad,0x316)+_0x21145c(0x1ee,0xaf)+_0x21145c(-_0x4696f5._0x33f364,-0x11)+_0x5670e0(0x1ba,_0x4696f5._0x43b67c),'cCMro':function(_0x16f07d,_0x1fba0e){return _0x16f07d(_0x1fba0e);}},_0x16cdb4=_0xcec5c7[_0x5670e0(_0x4696f5._0x3b847e,_0x4696f5._0x201286)]===_0x21145c(0x8f,-_0x4696f5._0x374b0f)&&isConnectHandshakeRequest(_0xcec5c7['text']);function _0x5670e0(_0x342769,_0x9bb34b){return _0x3266d5(_0x342769,_0x9bb34b-_0x2900ac._0x2cf4db);}if(this[_0x21145c(-_0x4696f5._0xc2e37,-0x73)+_0x21145c(0x12d,_0x4696f5._0xdfa820)+_0x5670e0(0x39a,_0x4696f5._0xcba1e)+'ing']){this[_0x5670e0(_0x4696f5._0x46e1e1,_0x4696f5._0x4cbc28)+_0x21145c(0x256,0x19a)+_0x5670e0(0x1e5,0x3fc)+'e'](_0xcec5c7);_0x16cdb4&&this[_0x5670e0(_0x4696f5._0x338ec3,_0x4696f5._0x231d42)](_0x21145c(0x33,0x259)+_0x21145c(_0x4696f5._0x4ecefc,0x18d)+_0x5670e0(0x6ca,0x579)+_0x5670e0(_0x4696f5._0x1351b,0x466)+_0x21145c(_0x4696f5._0x157561,_0x4696f5._0x291d70)+_0x5670e0(0xa0,0x2d6)+_0x5670e0(_0x4696f5._0x1ddeea,_0x4696f5._0x4c908b)+'il\x20gatew'+'ay\x20recon'+_0x5670e0(0x32c,_0x4696f5._0x1aca11));return;}const _0x3f1989=this[_0x5670e0(-_0x4696f5._0x16184e,0x9e)+'ocket'];function _0x21145c(_0x59e122,_0x379fed){return _0x3266d5(_0x379fed,_0x59e122- -_0x30b949._0x35d6a2);}if(!_0x3f1989||_0x3f1989[_0x5670e0(0x78e,0x544)+'te']!==_0x427ed3[_0x21145c(0x185,_0x4696f5._0x3b2d1d)]){this[_0x21145c(_0x4696f5._0x30aaa5,_0x4696f5._0x57a67a)+'tewayCon'+'nected'](),this['pushPend'+'ingGatew'+'ayMessag'+'e'](_0xcec5c7);_0x16cdb4&&this['log'](_0x556c9c[_0x5670e0(0x218,_0x4696f5._0x9dca6a)]);return;}if(!this[_0x21145c(0x1f9,_0x4696f5._0x54f0a8)+_0x5670e0(0x1a2,_0x4696f5._0xc50269)+_0x21145c(-0x190,-_0x4696f5._0x29a72d)]){if(!_0x16cdb4){this['pushPend'+_0x21145c(_0x4696f5._0x1db46e,_0x4696f5._0x1a47de)+_0x5670e0(0x1b6,0x3fc)+'e'](_0xcec5c7);return;}this[_0x21145c(0x1f9,0xbe)+_0x21145c(_0x4696f5._0x48f77a,-0xd)+_0x21145c(-0x190,-0x2d8)]=!![];const _0x2b59ca=_0x556c9c[_0x5670e0(0x24b,0x283)](parseConnectHandshakeMeta,_0xcec5c7[_0x21145c(0x8f,-_0x4696f5._0xb4dd5)]);this[_0x21145c(0x287,0x4cf)](_0x5670e0(0xfe,_0x4696f5._0x5d033b)+_0x5670e0(0x3a1,0x13c)+'e\x20starte'+_0x21145c(0xff,0x288)+'='+this['pendingG'+'atewayMe'+_0x21145c(-0x64,-0xed)][_0x5670e0(0x4b5,0x49d)]+_0x556c9c[_0x21145c(_0x4696f5._0x560aa9,0x112)](formatConnectHandshakeMetaForLog,_0x2b59ca));}this['sendToGa'+_0x5670e0(_0x4696f5._0x59a6c0,0x2cf)](_0xcec5c7);}['ensureGa'+_0x3266d5(0x1b5,0x2e3)+_0x3266d5(0x10,0x15b)](){const _0x1abc0c={_0x2df8e5:0x577,_0x3d432b:0x2b3,_0x226dc6:0x2f6,_0x3ac235:0x157,_0x4ced23:0x23c,_0xa95548:0x3bd,_0x3c08e9:0x2eb,_0x41c328:0x287,_0x56b1d8:0x2a7,_0xa50baa:0x20e,_0x2354be:0x1a,_0x2e239d:0x2cd,_0x2c1fbc:0x256,_0x1dacf2:0x1b4,_0x8e798f:0x162,_0xe19994:0x268,_0x2654a2:0x2c2},_0x45a166={_0x27dd80:0x552,_0x3ff31f:0x380,_0x5e4bab:0x23d,_0x284e7b:0x1dd,_0x1c0a4a:0x4e3,_0x37595f:0x28c,_0xb56d08:0x228,_0x117e49:0x6a1,_0x15d847:0x31,_0x3a9d71:0x14d,_0x116b31:0x34c,_0x52be67:0x287,_0x61f8d4:0x513,_0x262395:0x3fe,_0xce5289:0xaa,_0x3d1d31:0x44d,_0x180ddc:0x3f3,_0xcb597:0x52b,_0x317fcf:0x3fb,_0x30815b:0x3a6,_0x1a1aeb:0x4d6,_0xcc3963:0x3e3,_0x2c1c83:0x617,_0x134c22:0x3c6,_0x54a0b6:0x4b7,_0x3b27aa:0x4c1,_0x264f94:0xc1,_0x14c3b0:0x2cb,_0x46a4db:0x38e,_0x194573:0x8e,_0x308bdb:0x19c,_0x57f0da:0x1fd,_0x1fa5e4:0x4cc,_0x26d6ee:0x355,_0x345aff:0x2ac,_0x2097f4:0x14e,_0x36cb46:0x650,_0x481daf:0x3a0,_0x2e2d2a:0x55a,_0x277de9:0x579,_0x45e300:0x36,_0x4dc069:0x163,_0x1e2d03:0x50c,_0x1a1ac0:0x119},_0x38966a={_0x18190f:0x23},_0x2827d3={_0x3af910:0x8fe,_0x5c0f72:0x180,_0x2104cc:0x86},_0x166565={_0x20c027:0x3b1,_0x5295a6:0x12a},_0x406948={_0x58d757:0x59a,_0x2530a7:0x7c7,_0x3fde55:0x36a,_0x2ba92c:0x147,_0x1efa69:0x208,_0x2bab1f:0x40d,_0x5d33d3:0x37,_0x50acab:0x40d,_0x519746:0x6a9,_0x285f7d:0x20e,_0x3cd786:0x4c4,_0x1e4d00:0x6f1,_0x49ca91:0x5e2,_0x1c9e4b:0x63d,_0x207511:0x1f3,_0x46a575:0x55,_0x219955:0xd2,_0x4552c6:0x2b,_0x5a3110:0x2db,_0x2c6658:0x1c9,_0x36e40c:0x2b2,_0x41c956:0x52b,_0x130820:0x10c,_0x49cd8b:0x52a,_0x189589:0x129,_0x130a29:0x13d},_0x5c1a0b={_0x447e32:0x3ff},_0xb9a6c7={'eJxeR':function(_0x242d90,_0x5a480b){return _0x242d90!==_0x5a480b;},'xAZVN':function(_0x81b898,_0x7b1ed1){return _0x81b898(_0x7b1ed1);}};if(this[_0x322db0(0x3c9,_0x1abc0c._0x2df8e5)]||!this[_0x322db0(0x285,0x49d)+_0x15c5c3(0x9d,0x148)]()||this[_0x15c5c3(0xe,_0x1abc0c._0x3d432b)+'onnectin'+'g']||this['isGatewa'+_0x15c5c3(_0x1abc0c._0x226dc6,_0x1abc0c._0x3ac235)]()||this[_0x322db0(_0x1abc0c._0x4ced23,0x3a3)+_0x322db0(0x3c6,_0x1abc0c._0xa95548)+_0x322db0(_0x1abc0c._0x3c08e9,_0x1abc0c._0x4ced23)+_0x322db0(_0x1abc0c._0x41c328,0x50b)])return;this['gatewayC'+'onnectin'+'g']=!![],this['log']('gateway\x20'+_0x15c5c3(0x331,0x28a)+_0x322db0(0x96,_0x1abc0c._0x56b1d8)+'l='+this['options']['gatewayU'+'rl']);const _0x5e1e68=this[_0x15c5c3(0x29b,0x44b)+_0x322db0(_0x1abc0c._0xa50baa,0x358)](this[_0x15c5c3(-_0x1abc0c._0x2354be,-_0x1abc0c._0x2e239d)][_0x15c5c3(_0x1abc0c._0x2c1fbc,_0x1abc0c._0x1dacf2)+'rl']);function _0x322db0(_0x3086c9,_0x599f27){return _0x26b3dd(_0x3086c9- -_0x5c1a0b._0x447e32,_0x599f27);}this[_0x15c5c3(-_0x1abc0c._0x8e798f,-_0x1abc0c._0xe19994)+_0x322db0(0xd4,0x198)]=_0x5e1e68,_0x5e1e68[_0x15c5c3(0x145,0x3ce)](_0x15c5c3(-0xc7,-0xa9),()=>{if(this[_0x5b0fbe(_0x406948._0x58d757,_0x406948._0x2530a7)]||_0xb9a6c7[_0x5b0fbe(0x430,_0x406948._0x3fde55)](this['gatewayS'+'ocket'],_0x5e1e68)){_0x5e1e68[_0x5b0fbe(0x679,0x4af)]();return;}this[_0x5443cc(-0x14,0x1f5)+_0x5443cc(0x108,-0x12d)+'g']=![];function _0x5443cc(_0x5aef5f,_0x33b6e0){return _0x15c5c3(_0x5aef5f- -0x22,_0x33b6e0);}this[_0x5b0fbe(0x663,0x7c0)+_0x5443cc(0x20d,0x48a)+_0x5443cc(-_0x406948._0x2ba92c,-_0x406948._0x1efa69)]=![],this[_0x5b0fbe(_0x406948._0x2bab1f,0x64a)+'loseBoun'+_0x5b0fbe(0x4bc,0x34f)+_0x5443cc(_0x406948._0x5d33d3,0x1d2)]=![],this[_0x5b0fbe(_0x406948._0x50acab,_0x406948._0x519746)+_0x5443cc(0x3ae,0x303)+_0x5443cc(-0x143,-_0x406948._0x285f7d)]=Date[_0x5b0fbe(_0x406948._0x3cd786,0x526)]();function _0x5b0fbe(_0x4f826f,_0x2bc002){return _0x15c5c3(_0x4f826f-0x3ff,_0x2bc002);}const _0x4ea92a={};_0x4ea92a[_0x5b0fbe(0x40d,0x5f5)+_0x5443cc(0x3ae,0x225)]=!![],_0x4ea92a['lastErro'+'r']=null,this['updateSn'+'apshot'](_0x4ea92a),this[_0x5b0fbe(_0x406948._0x1e4d00,_0x406948._0x49ca91)](_0x5b0fbe(0x49d,_0x406948._0x1c9e4b)+_0x5443cc(_0x406948._0x207511,-_0x406948._0x46a575)+'d\x20sinceC'+'lientDem'+_0x5443cc(_0x406948._0x219955,_0x406948._0x4552c6)+this[_0x5443cc(_0x406948._0x5a3110,_0x406948._0x2c6658)+_0x5b0fbe(0x3b0,0x22e)](this[_0x5b0fbe(_0x406948._0x36e40c,_0x406948._0x41c956)+_0x5443cc(-0x20,_0x406948._0x130820)+_0x5b0fbe(_0x406948._0x49cd8b,0x53e)])),this['flushPen'+'dingGate'+_0x5443cc(_0x406948._0x189589,-_0x406948._0x130a29)+'ges']();}),_0x5e1e68['on'](_0x322db0(0x3c7,0x461),(_0xf51daf,_0x6d425c)=>{function _0x22c2f0(_0x3ae1b2,_0x13c36f){return _0x15c5c3(_0x13c36f-0x6c,_0x3ae1b2);}this['handleGa'+_0x22c2f0(-_0x166565._0x20c027,-_0x166565._0x5295a6)+'sage'](_0xf51daf,_0x6d425c);});function _0x15c5c3(_0xaaf1e5,_0x2f07f7){return _0x26b3dd(_0xaaf1e5- -0x62d,_0x2f07f7);}_0x5e1e68['once'](_0x322db0(0x53c,_0x1abc0c._0x2654a2),_0xd79a3a=>{const _0x1ddd03={_0x4c8845:0x14c};function _0x2e87d0(_0x552740,_0x416da9){return _0x322db0(_0x416da9- -_0x1ddd03._0x4c8845,_0x552740);}function _0x10464c(_0x464d7d,_0x5290c6){return _0x322db0(_0x5290c6-0x127,_0x464d7d);}this[_0x10464c(_0x2827d3._0x3af910,0x647)](_0x2e87d0(0x2db,_0x2827d3._0x5c0f72)+_0x2e87d0(0xcd,0x20)+_0xb9a6c7[_0x2e87d0(-_0x2827d3._0x2104cc,0xe5)](String,_0xd79a3a));}),_0x5e1e68['once'](_0x15c5c3(0x27a,0x48),(_0x3be002,_0x3871ae)=>{const _0x378c73={_0x58f02d:0x1cf};function _0x182366(_0x532680,_0x210919){return _0x15c5c3(_0x210919-_0x378c73._0x58f02d,_0x532680);}const _0x53bb07=summarizePendingGatewayMessages(this[_0x182366(0x3e4,_0x45a166._0x27dd80)+_0x40e168(0x342,_0x45a166._0x3ff31f)+'ssages'])['connectR'+_0x182366(0x3c0,_0x45a166._0x5e4bab)],_0x513311=this[_0x182366(0x169,_0x45a166._0x284e7b)+'loseBoun'+_0x182366(_0x45a166._0x1c0a4a,_0x45a166._0x37595f)+_0x182366(0x236,_0x45a166._0xb56d08)]&&shouldKeepGatewayConnected(this[_0x40e168(0x3e3,_0x45a166._0x117e49)]['clientCo'+_0x182366(0x4e7,0x332)],_0x53bb07);this[_0x40e168(-0x13f,-0xd8)+'ocket']===_0x5e1e68&&(this[_0x40e168(-0x13f,0xb9)+_0x182366(0x2af,0x75)]=null);this[_0x40e168(_0x45a166._0x15d847,-0x9)+_0x40e168(_0x45a166._0x3a9d71,_0x45a166._0x116b31)+'g']=![],this[_0x40e168(_0x45a166._0x52be67,0x525)+_0x182366(_0x45a166._0x61f8d4,_0x45a166._0x262395)+_0x182366(0x34c,_0x45a166._0xce5289)]=![],this[_0x40e168(0x31,-0x225)+'loseBoun'+_0x182366(_0x45a166._0x3d1d31,0x28c)+_0x182366(0x133,0x228)]=![],this[_0x40e168(_0x45a166._0x15d847,0x286)+_0x40e168(_0x45a166._0x180ddc,0x1ba)+_0x182366(0x205,0xae)]=null,this[_0x40e168(0x2a5,_0x45a166._0xcb597)+'lightCon'+_0x40e168(_0x45a166._0x317fcf,0x1a4)+'shakes']('gateway\x20'+_0x182366(0x5e4,0x5a2)+_0x182366(0x3fe,_0x45a166._0x30815b)+'e='+_0x3be002);function _0x40e168(_0x165241,_0x2dff3a){return _0x15c5c3(_0x165241-_0x38966a._0x18190f,_0x2dff3a);}this[_0x182366(0x1e8,0x299)+_0x182366(_0x45a166._0x1a1aeb,0x29b)]({'gatewayConnected':![],'lastError':_0x3be002===0x3e8||_0x513311?this[_0x40e168(_0x45a166._0xcc3963,0x23f)]['lastErro'+'r']:'gateway\x20'+_0x182366(_0x45a166._0x2c1c83,_0x45a166._0x134c22)+(_0x3871ae['toString']()||_0x3be002)}),this[_0x182366(_0x45a166._0x54a0b6,_0x45a166._0x3b27aa)](_0x40e168(_0x45a166._0x264f94,0x315)+'disconne'+_0x40e168(0x1fa,_0x45a166._0x14c3b0)+'e='+_0x3be002+_0x182366(_0x45a166._0x46a4db,0x467)+(_0x3871ae['toString']()||_0x182366(-_0x45a166._0x194573,_0x45a166._0x308bdb))+(_0x40e168(0x154,_0x45a166._0x57f0da)+'ientDema'+'ndMs=')+this[_0x182366(0x658,_0x45a166._0x1fa5e4)+_0x182366(_0x45a166._0x26d6ee,0x180)](this['clientDe'+_0x182366(_0x45a166._0x345aff,0x1d1)+_0x40e168(_0x45a166._0x2097f4,0x3ff)]));if(_0x513311){this[_0x182366(_0x45a166._0x36cb46,_0x45a166._0x3b27aa)]('gateway\x20'+_0x182366(0x36b,_0x45a166._0x481daf)+_0x182366(0x40f,0x4a9)+'eached;\x20'+_0x182366(_0x45a166._0x2e2d2a,_0x45a166._0x277de9)+_0x40e168(-_0x45a166._0x45e300,-0xed)+_0x40e168(_0x45a166._0x4dc069,-0x1f)+_0x182366(_0x45a166._0x1e2d03,0x531)),this[_0x182366(0x604,0x51c)+'tewayCon'+'nected']();return;}this[_0x40e168(-0x14f,-_0x45a166._0x1a1ac0)+_0x40e168(0xf4,0xaf)+'econnect']();});}['handleGa'+_0x3266d5(0x27e,0x7)+_0x26b3dd(0x579,0x2c1)](_0x1c6db0,_0x55644f){const _0x423d0f={_0x7a1787:0x51a,_0x27224f:0x7b,_0x3fa132:0x2e2,_0x3298cd:0x7da,_0x153b57:0x658,_0x51e044:0x4d2,_0x1a4cb2:0x158,_0x361458:0x3b9,_0x13207c:0x775,_0x31a2ee:0x5c8,_0x505fe0:0x5bb,_0x3236fc:0x723,_0x4ba146:0x52a,_0x710dd5:0x632,_0x2b7efe:0x6ed,_0x227f32:0x35e,_0x454b74:0x1ef,_0x1564d1:0x4b3,_0x2dc081:0x11d,_0x1c9cb0:0x191,_0xf2c5fb:0x3ac,_0x4a0883:0x46a},_0x210cf6={_0x7d935:0x34},_0x419e65={'huRkL':function(_0x4ffab3,_0x2092e9){return _0x4ffab3!==_0x2092e9;},'RddPW':function(_0x1b5bb1,_0x289460){return _0x1b5bb1(_0x289460);}},_0x240a53=this[_0x31347f(0x321,_0x423d0f._0x7a1787)+_0x31347f(_0x423d0f._0x27224f,_0x423d0f._0x3fa132)];if(!_0x240a53||_0x419e65[_0x4a0b63(_0x423d0f._0x3298cd,_0x423d0f._0x153b57)](_0x240a53['readySta'+'te'],_0x427ed3[_0x31347f(0x516,0x3a6)]))return;if(_0x55644f){_0x240a53[_0x4a0b63(_0x423d0f._0x51e044,0x740)](normalizeBinary(_0x1c6db0));return;}function _0x31347f(_0x50939d,_0x55e1c2){return _0x26b3dd(_0x55e1c2- -0x477,_0x50939d);}const _0x1b6b98=_0x419e65[_0x31347f(_0x423d0f._0x1a4cb2,_0x423d0f._0x361458)](normalizeText,_0x1c6db0);if(_0x1b6b98==null)return;function _0x4a0b63(_0x525494,_0x2e47fe){return _0x26b3dd(_0x2e47fe- -_0x210cf6._0x7d935,_0x525494);}const _0x25a06a=_0x419e65[_0x4a0b63(_0x423d0f._0x13207c,0x7fc)](parsePairingRequestFromError,_0x1b6b98);_0x25a06a&&this[_0x4a0b63(_0x423d0f._0x31a2ee,_0x423d0f._0x505fe0)+_0x4a0b63(_0x423d0f._0x3236fc,_0x423d0f._0x4ba146)+_0x4a0b63(_0x423d0f._0x710dd5,0x5c1)](_0x25a06a);const _0x3cd5f7=_0x419e65[_0x4a0b63(_0x423d0f._0x2b7efe,0x7fc)](parsePairResolvedEvent,_0x1b6b98);_0x3cd5f7&&this[_0x31347f(0x2db,_0x423d0f._0x227f32)+_0x31347f(0x6e3,0x475)+_0x31347f(0x529,0x4aa)](_0x3cd5f7[_0x31347f(0x42a,_0x423d0f._0x454b74)+'d'],_0x3cd5f7[_0x4a0b63(_0x423d0f._0x1564d1,0x4a0)]);const _0xcc72ac=parseResponseEnvelopeMeta(_0x1b6b98);_0xcc72ac&&this[_0x31347f(-_0x423d0f._0x2dc081,_0x423d0f._0x1c9cb0)+'atewayRe'+_0x31347f(0x501,_0x423d0f._0xf2c5fb)](_0xcc72ac),_0x240a53[_0x31347f(_0x423d0f._0x4a0883,0x2fd)](_0x1b6b98);}['flushPen'+_0x3266d5(0x385,0x22a)+'wayMessa'+_0x3266d5(0x64e,0x4e9)](){const _0x4e0d92={_0x2eef2c:0x62b,_0x12faac:0x5cb,_0x5877e7:0x732,_0x5555b5:0x7b3,_0x2866b9:0x8c5,_0x50bedd:0x831,_0x16db3d:0x860,_0x5380c9:0x545,_0x47febd:0x88f,_0x54b152:0x834,_0x45a021:0x4d7,_0x460e5e:0x6c6,_0x35fc16:0x6c0,_0x269af3:0x579,_0x52ba20:0x4f5,_0x39e981:0x741,_0x274e11:0x3fd,_0x2ecd24:0x861,_0x25369e:0x8ca,_0x20a3cc:0x784,_0x587c25:0xa5f,_0x24965a:0x7a6,_0x38d608:0x7ce,_0x33bd0a:0x7e1,_0x35fc2a:0x47a,_0x5e4a9b:0x418,_0x5357fa:0xaa0,_0x1249f4:0x771,_0xd70501:0x81e,_0x3c8281:0x98e,_0x3f3ec7:0x705};function _0x1cbcb0(_0x4c8b1a,_0xce6e36){return _0x3266d5(_0x4c8b1a,_0xce6e36-0x3a5);}const _0x383146=this[_0x1cbcb0(0x3ac,0x3e0)+_0xc5d66c(0x445,_0x4e0d92._0x2eef2c)];if(!_0x383146||_0x383146[_0xc5d66c(0x8e3,0x810)+'te']!==_0x427ed3[_0x1cbcb0(_0x4e0d92._0x12faac,_0x4e0d92._0x5877e7)])return;const _0x39e315=[];function _0xc5d66c(_0x1806a4,_0x18bbf1){return _0x3266d5(_0x18bbf1,_0x1806a4-0x402);}const _0x464858=dedupePendingGatewayMessages(this[_0x1cbcb0(_0x4e0d92._0x5555b5,_0x4e0d92._0x2866b9)+_0x1cbcb0(_0x4e0d92._0x50bedd,0x861)+_0xc5d66c(0x5a6,_0x4e0d92._0x16db3d)]);_0x464858[_0x1cbcb0(_0x4e0d92._0x5380c9,0x666)]>0x0&&this[_0x1cbcb0(_0x4e0d92._0x47febd,_0x4e0d92._0x54b152)](_0x1cbcb0(0x413,_0x4e0d92._0x45a021)+_0xc5d66c(0x4d1,_0x4e0d92._0x460e5e)+_0x1cbcb0(_0x4e0d92._0x35fc16,_0x4e0d92._0x269af3)+_0xc5d66c(0x625,0x731)+_0xc5d66c(_0x4e0d92._0x52ba20,0x78f)+_0xc5d66c(_0x4e0d92._0x39e981,0x604)+_0x1cbcb0(0x94a,0x8c8)+_0x1cbcb0(0x66e,_0x4e0d92._0x274e11)+_0x464858[_0x1cbcb0(0x7f2,0x666)]+_0xc5d66c(0x6b6,0x542)+_0x464858['messages'][_0xc5d66c(0x83c,0x670)]);this['pendingG'+_0x1cbcb0(0x676,_0x4e0d92._0x2ecd24)+'ssages']=[];for(const _0x2c0f01 of _0x464858[_0xc5d66c(_0x4e0d92._0x25369e,_0x4e0d92._0x20a3cc)]){if(!this[_0x1cbcb0(_0x4e0d92._0x587c25,_0x4e0d92._0x24965a)+_0xc5d66c(_0x4e0d92._0x38d608,_0x4e0d92._0x33bd0a)+_0xc5d66c(_0x4e0d92._0x35fc2a,0x470)]){if(_0x2c0f01[_0xc5d66c(_0x4e0d92._0x5e4a9b,0x5e5)]!==_0xc5d66c(0x699,0x540)||!isConnectHandshakeRequest(_0x2c0f01['text'])){_0x39e315[_0x1cbcb0(_0x4e0d92._0x5357fa,0x82f)](_0x2c0f01);continue;}this[_0x1cbcb0(0x6f2,_0x4e0d92._0x24965a)+_0x1cbcb0(0x53b,_0x4e0d92._0x1249f4)+_0xc5d66c(0x47a,0x1b9)]=!![];}this[_0x1cbcb0(0x6ea,_0x4e0d92._0xd70501)+_0x1cbcb0(0x386,0x611)](_0x2c0f01);}this[_0x1cbcb0(_0x4e0d92._0x3c8281,0x8c5)+'atewayMe'+_0xc5d66c(0x5a6,_0x4e0d92._0x3f3ec7)]=_0x39e315;}['sendToGa'+_0x3266d5(0x4a8,0x26c)](_0x526781){const _0x5782ea={_0x58d758:0x273,_0x3e9ce1:0x1c5,_0x28c998:0xa5,_0x445a19:0x1cd,_0x5b28fc:0x51,_0x4a7234:0x359,_0x4c71d0:0x523,_0xc361f:0x101,_0x3fb393:0x421,_0x348e5b:0x180,_0x4e05f4:0x2c9,_0x3b4470:0x262,_0x3570e2:0x28f,_0x1341ee:0x4d8,_0x42cf05:0x1b4,_0x3c4bda:0x14b,_0x5463b2:0x331,_0x20c297:0x41a,_0x13cdfd:0x124,_0x24b25d:0x39e,_0x716996:0x40e,_0x494cc0:0x56e,_0x16059c:0x1cd,_0x4982f4:0x0},_0x53a9b6={_0x59d7e5:0x306},_0x5d8eab={'yLSDw':function(_0x242222,_0x2cd465){return _0x242222(_0x2cd465);}};function _0x2b3f84(_0x57026e,_0x4bbff9){return _0x26b3dd(_0x4bbff9- -_0x53a9b6._0x59d7e5,_0x57026e);}const _0x1b99dd=this[_0x2b3f84(_0x5782ea._0x58d758,_0x5782ea._0x3e9ce1)+_0x2b3f84(_0x5782ea._0x28c998,_0x5782ea._0x445a19)];if(!_0x1b99dd||_0x1b99dd['readySta'+'te']!==_0x427ed3[_0x2b3f84(0x27b,0x517)]){this[_0x2b3f84(_0x5782ea._0x5b28fc,0x289)+'ingGatew'+_0x2b3f84(_0x5782ea._0x4a7234,_0x5782ea._0x4c71d0)+'e'](_0x526781);return;}function _0x5f3911(_0x3c2e6f,_0x46e4ac){return _0x26b3dd(_0x3c2e6f- -0x5a7,_0x46e4ac);}if(_0x526781[_0x5f3911(-_0x5782ea._0xc361f,-0xc)]===_0x2b3f84(0x402,_0x5782ea._0x3fb393)){const _0x2e6894=patchConnectRequestGatewayAuth(_0x526781[_0x5f3911(_0x5782ea._0x348e5b,0xb8)],readOpenClawInfo()),_0x440558=_0x5d8eab[_0x2b3f84(_0x5782ea._0x4e05f4,0x382)](parseConnectHandshakeMeta,_0x2e6894['text']);_0x440558&&(_0x440558['id']&&this[_0x5f3911(0xd,-0x1d1)+_0x2b3f84(0xe1,_0x5782ea._0x3b4470)+_0x5f3911(0x2b5,_0x5782ea._0x3570e2)+'s'][_0x2b3f84(_0x5782ea._0x1341ee,0x3e2)](_0x440558['id'],{'method':_0x440558[_0x5f3911(_0x5782ea._0x42cf05,-0xe3)],'startedAtMs':Date[_0x5f3911(_0x5782ea._0x3c4bda,_0x5782ea._0x5463b2)](),'slowWarningLogged':![]}),this[_0x2b3f84(0x7b7,0x619)]('gateway\x20'+_0x2b3f84(0x7d4,0x658)+_0x2b3f84(0x5bf,0x548)+'forwarde'+'d'+formatConnectHandshakeMetaForLog(_0x440558)));_0x2e6894[_0x2b3f84(0x65f,_0x5782ea._0x20c297)]&&this[_0x5f3911(0x378,0x488)](_0x5f3911(_0x5782ea._0x13cdfd,0x2d2)+_0x2b3f84(0x883,0x658)+_0x5f3911(_0x5782ea._0x24b25d,0x64d)+_0x5f3911(0x279,_0x5782ea._0x716996)+_0x2b3f84(-0x4a,0x209)+'rd');_0x1b99dd['send'](_0x2e6894[_0x2b3f84(_0x5782ea._0x494cc0,0x421)]);return;}_0x1b99dd[_0x5f3911(_0x5782ea._0x16059c,0x6f)](_0x526781[_0x5f3911(_0x5782ea._0x4982f4,0xfe)]);}[_0x26b3dd(0x5ad,0x6f0)+'wayReque'+'st'](_0x48db5f,_0x5df9c5){const _0x5cd672={_0x1b3f65:0x658,_0x522c48:0x749,_0x576acf:0x356,_0x16a27b:0x248,_0x57f488:0x198,_0x4c42cf:0x5f,_0x1f3d82:0x151,_0x3b6527:0x1d8,_0x1bbbfe:0x7dd,_0x7a876d:0x98e},_0x17610a={_0x3ef2bb:0x1ee},_0x44c366={'xFaAe':_0xe7bf25(_0x5cd672._0x1b3f65,_0x5cd672._0x522c48),'dLTyI':function(_0x1431af){return _0x1431af();},'xiyqr':_0xe7bf25(0x7f0,0x72a)},_0x3f409a=JSON[_0x4b288f(-0x185,-0x1d7)+'y']({'type':_0x44c366[_0x4b288f(_0x5cd672._0x576acf,_0x5cd672._0x16a27b)],'id':_0x4b288f(-_0x5cd672._0x57f488,_0x5cd672._0x4c42cf)+_0x44c366['dLTyI'](_0xe7fcf0),'method':_0x48db5f,'params':_0x5df9c5}),_0x1f9d6f={};function _0xe7bf25(_0x3a469b,_0x1acfb8){return _0x3266d5(_0x3a469b,_0x1acfb8-0x493);}function _0x4b288f(_0x259beb,_0x2f0a4f){return _0x3266d5(_0x259beb,_0x2f0a4f- -_0x17610a._0x3ef2bb);}_0x1f9d6f[_0x4b288f(-_0x5cd672._0x1f3d82,-_0x5cd672._0x3b6527)]=_0x44c366[_0xe7bf25(_0x5cd672._0x1bbbfe,0x5d1)],_0x1f9d6f[_0x4b288f(0x2ab,0xa9)]=_0x3f409a,this[_0xe7bf25(_0x5cd672._0x7a876d,0x7b8)+'rQueueGa'+_0x4b288f(-0x3ac,-0x1e7)+'sage'](_0x1f9d6f);}[_0x3266d5(0x43f,0x3a7)+_0x3266d5(0x347,0x21a)](_0x60b379){const _0x34f7e7={_0x18907c:0x8e6,_0x35f267:0x49f,_0x52f2eb:0x424,_0x26a609:0x531,_0x3d8c32:0x563,_0x4b7417:0x718,_0x13fc77:0x4ae,_0x3b4c9e:0x6a5,_0x1f6b3c:0x2b2,_0x40bb29:0x4cf,_0x451205:0x31d,_0x596d91:0x741,_0x55ac22:0x58f,_0x34c256:0x349,_0x6aba1e:0x4e5,_0x46cfc7:0x4ba,_0x483e11:0x339},_0x4f3206={_0x257528:0x349},_0x5b3105=this[_0x206cf2(0x648,_0x34f7e7._0x18907c)+_0x2e3d9f(0x272,_0x34f7e7._0x35f267)];if(!_0x5b3105||_0x5b3105[_0x206cf2(0x628,_0x34f7e7._0x52f2eb)+'te']!==_0x427ed3[_0x2e3d9f(_0x34f7e7._0x26a609,_0x34f7e7._0x3d8c32)])return;const _0x109276={};_0x109276[_0x2e3d9f(0x52f,_0x34f7e7._0x4b7417)]=_0x2e3d9f(_0x34f7e7._0x13fc77,_0x34f7e7._0x3b4c9e),_0x109276[_0x206cf2(_0x34f7e7._0x1f6b3c,_0x34f7e7._0x40bb29)]=_0x60b379['event'],_0x109276['requestI'+'d']=_0x60b379[_0x206cf2(_0x34f7e7._0x451205,0x11c)+'d'];function _0x2e3d9f(_0x21720e,_0x2b06cd){return _0x26b3dd(_0x2b06cd- -0x2ba,_0x21720e);}_0x109276[_0x2e3d9f(0x32d,0x58f)+'ientId']=_0x60b379[_0x2e3d9f(_0x34f7e7._0x596d91,_0x34f7e7._0x55ac22)+'ientId'];function _0x206cf2(_0x3f5ffb,_0x5af99d){return _0x26b3dd(_0x3f5ffb- -_0x4f3206._0x257528,_0x5af99d);}_0x109276[_0x206cf2(0x456,0x59a)]=_0x60b379[_0x2e3d9f(_0x34f7e7._0x34c256,_0x34f7e7._0x6aba1e)],_0x5b3105[_0x2e3d9f(0x77a,_0x34f7e7._0x46cfc7)]('__clawke'+'t_relay_'+'control_'+'_:'+JSON[_0x206cf2(0x15e,_0x34f7e7._0x483e11)+'y'](_0x109276));}[_0x26b3dd(0x5a0,0x2f6)+_0x26b3dd(0x66e,0x486)](_0x58edcd=![]){const _0x50d1fb={_0x1c4519:0x2b4,_0x52b42b:0x2a1,_0x550e1f:0x3d2,_0x34696b:0x2dd,_0x157689:0x4cb,_0x344829:0x6ac,_0x1c7f99:0x1f5,_0x17476b:0x3cf,_0x402c57:0x6da,_0x592476:0x3ac,_0x5e106b:0x4ae,_0x32ed79:0x2dc,_0x2b6cb1:0x111,_0x2ab10d:0x465,_0x3b5655:0x5b7,_0x57c056:0x412,_0x19aef3:0x4b2,_0x359096:0x4b0,_0xc503d0:0x759,_0x9c4a48:0x3d2,_0x3d57ba:0x154,_0x753a0:0x1bb,_0x4f2228:0x803,_0x202a29:0x6e4,_0x24fced:0x154,_0x5c1ba6:0xa2,_0x3a1e26:0x3fe,_0x1736d9:0x155,_0x6e5e0b:0x4c1,_0xc168c9:0x109,_0x25aa25:0x20c,_0x252e1c:0x76,_0x55e76d:0x43d,_0x3a9daf:0x92,_0x5016e5:0x18d},_0x578a6e={_0x58981b:0x2ba};this[_0x249f85(-0x12e,-_0x50d1fb._0x1c4519)+_0x249f85(_0x50d1fb._0x52b42b,_0x50d1fb._0x550e1f)+'r']&&(clearTimeout(this[_0x4ad59f(0x4b7,_0x50d1fb._0x34696b)+_0x4ad59f(_0x50d1fb._0x157689,_0x50d1fb._0x344829)+'r']),this['gatewayR'+_0x249f85(0x2a1,_0x50d1fb._0x1c7f99)+'r']=null);const _0x5d801a=summarizePendingGatewayMessages(this[_0x249f85(_0x50d1fb._0x17476b,0x118)+_0x249f85(0x36b,0x218)+'ssages'])[_0x249f85(0x67,-0x242)+_0x4ad59f(_0x50d1fb._0x402c57,0x4c5)],_0x457b0b=_0x58edcd&&this[_0x4ad59f(_0x50d1fb._0x592476,_0x50d1fb._0x5e106b)+'pen']()&&shouldKeepGatewayConnected(this[_0x4ad59f(0x957,0x817)][_0x4ad59f(0xd6,_0x50d1fb._0x32ed79)+_0x249f85(0x1af,-_0x50d1fb._0x2b6cb1)],_0x5d801a),_0x3c1c0d=this[_0x4ad59f(0x135,0x2f5)+'ocket'];this[_0x249f85(0x2b0,0x2c5)+'andshake'+'Started']=![],this[_0x4ad59f(0x49c,_0x50d1fb._0x2ab10d)+'onnected'+'AtMs']=null;if(!_0x3c1c0d){this[_0x4ad59f(_0x50d1fb._0x3b5655,0x465)+'loseBoun'+_0x4ad59f(_0x50d1fb._0x57c056,0x514)+_0x4ad59f(_0x50d1fb._0x19aef3,_0x50d1fb._0x359096)]=![],this[_0x4ad59f(0x3ce,0x465)+_0x4ad59f(_0x50d1fb._0xc503d0,0x581)+'g']=![];_0x457b0b&&this['ensureGa'+_0x4ad59f(_0x50d1fb._0x9c4a48,0x59d)+_0x4ad59f(_0x50d1fb._0x3d57ba,0x415)]();return;}if(_0x3c1c0d[_0x249f85(0x390,_0x50d1fb._0x753a0)+'te']===_0x427ed3['CLOSING']){this[_0x249f85(0x5a,0x27d)+_0x4ad59f(_0x50d1fb._0x4f2228,0x5ef)+_0x249f85(0x109,0x184)+_0x4ad59f(_0x50d1fb._0x202a29,0x4b0)]=_0x457b0b;return;}if(_0x3c1c0d['readySta'+'te']===_0x427ed3[_0x249f85(_0x50d1fb._0x24fced,-_0x50d1fb._0x5c1ba6)]){const _0x4cc7b3=(_0x4ad59f(_0x50d1fb._0x3a1e26,0x4cd)+'1')[_0x249f85(0x22f,0x4cb)]('|');let _0x57d79a=0x0;while(!![]){switch(_0x4cc7b3[_0x57d79a++]){case'0':this[_0x249f85(0x5a,_0x50d1fb._0x1736d9)+_0x4ad59f(_0x50d1fb._0x6e5e0b,0x5ef)+_0x249f85(_0x50d1fb._0xc168c9,_0x50d1fb._0x25aa25)+_0x249f85(0xa5,-_0x50d1fb._0x252e1c)]=![];continue;case'1':return;case'2':_0x457b0b&&this[_0x249f85(0x399,_0x50d1fb._0x55e76d)+'tewayCon'+_0x249f85(0xa,-_0x50d1fb._0x3a9daf)]();continue;case'3':this['gatewayS'+'ocket']===_0x3c1c0d&&(this['gatewayS'+'ocket']=null);continue;case'4':this[_0x249f85(0x5a,-0x22a)+_0x4ad59f(0x63e,0x581)+'g']=![];continue;}break;}}function _0x4ad59f(_0x4c8870,_0xda17e){return _0x3266d5(_0x4c8870,_0xda17e-_0x578a6e._0x58981b);}function _0x249f85(_0x11d0de,_0x1c8fab){return _0x3266d5(_0x1c8fab,_0x11d0de- -0x151);}this[_0x249f85(0x5a,-_0x50d1fb._0x5016e5)+_0x249f85(0x1e4,0x3a7)+'daryPend'+'ing']=_0x457b0b,_0x3c1c0d['close']();}[_0x3266d5(0x3d5,0x438)+'bSocket'](_0x2936bb){const _0xb80382={_0x2cb54e:0x1a8,_0x5414c5:0x32d,_0x46f2c2:0x3a8,_0xb32670:0x45,_0x36f85a:0xff};if(this[_0x490eb7(0x4b,-_0xb80382._0x2cb54e)]['createWe'+_0x2fec4b(_0xb80382._0x5414c5,0xe3)])return this[_0x490eb7(0x4b,0x223)][_0x490eb7(0x300,_0xb80382._0x46f2c2)+_0x490eb7(_0xb80382._0xb32670,0x1b0)](_0x2936bb);const _0x55fb87={};function _0x490eb7(_0x29272d,_0x5ae337){return _0x3266d5(_0x5ae337,_0x29272d- -0x138);}function _0x2fec4b(_0x33c4ca,_0xa3867b){return _0x3266d5(_0xa3867b,_0x33c4ca-0x1b0);}return _0x55fb87[_0x490eb7(0x197,-_0xb80382._0x36f85a)+'ad']=0x19*0x400*0x400,new _0x427ed3(_0x2936bb,_0x55fb87);}[_0x26b3dd(0x608,0x59d)+_0x3266d5(0x2b4,0x3a2)+'sponse'](_0x55269d){const _0x276c82={_0x51097c:0x24e,_0x402611:0x1b8,_0x4b2b5e:0x650,_0xa40835:0x5a7,_0x48a8c4:0xa1f,_0x403e01:0xec,_0x4126e9:0x538,_0x3511c3:0xce,_0x30b5a7:0x1a2,_0x2dc962:0x454,_0xa651a4:0x827,_0x56cf85:0x82a,_0x424d04:0x8f,_0x1c7996:0x264,_0x218327:0x9d6,_0x3f9bdc:0x7f0,_0x4765e4:0x6cf,_0x5b315e:0x5bc,_0x44c91b:0x794,_0x40c338:0x19e,_0x1b9059:0x429,_0x40ef1a:0x1ae,_0x4ea671:0x395,_0x3716ba:0x54c,_0x30a61c:0x2c6};function _0x435b2b(_0x468004,_0x4b8e14){return _0x26b3dd(_0x4b8e14-0x3f,_0x468004);}function _0x61b2c7(_0x30d6e8,_0x5468e2){return _0x26b3dd(_0x5468e2- -0x442,_0x30d6e8);}const _0x240431={};_0x240431[_0x61b2c7(-0x5,_0x276c82._0x51097c)]=_0x61b2c7(0x4b,_0x276c82._0x402611);const _0x39b1f4=_0x240431,_0x2814e0=this['inFlight'+_0x435b2b(_0x276c82._0x4b2b5e,_0x276c82._0xa40835)+'andshake'+'s'][_0x435b2b(_0x276c82._0x48a8c4,0x822)](_0x55269d['id']);if(!_0x2814e0)return;this['inFlight'+_0x61b2c7(-_0x276c82._0x403e01,0x126)+_0x61b2c7(_0x276c82._0x4126e9,0x41a)+'s'][_0x61b2c7(0x200,0x3a6)](_0x55269d['id']);const _0x214924=_0x55269d['ok']?_0x61b2c7(0x45,_0x276c82._0x3511c3):_0x61b2c7(_0x276c82._0x30b5a7,_0x276c82._0x2dc962)+_0x435b2b(_0x276c82._0xa651a4,_0x276c82._0x56cf85)+_0x61b2c7(0x2dc,_0x276c82._0x424d04)+(_0x55269d[_0x61b2c7(0x37f,0x558)+'e']??_0x61b2c7(0x8c,_0x276c82._0x402611))+('\x20errorMe'+_0x61b2c7(_0x276c82._0x1c7996,0xe4))+(_0x55269d[_0x435b2b(_0x276c82._0x218327,_0x276c82._0x3f9bdc)+'sage']??_0x39b1f4[_0x435b2b(0x4ea,_0x276c82._0x4765e4)]);this[_0x61b2c7(_0x276c82._0x5b315e,0x4dd)](_0x435b2b(_0x276c82._0x44c91b,0x70a)+'connect\x20'+_0x61b2c7(0x33b,_0x276c82._0x40c338)+'\x20reqId='+_0x55269d['id']+_0x61b2c7(_0x276c82._0x1b9059,0x583)+_0x2814e0['method']+('\x20elapsed'+_0x61b2c7(_0x276c82._0x40ef1a,_0x276c82._0x4ea671))+(Date['now']()-_0x2814e0[_0x435b2b(0xb5d,0x941)+_0x61b2c7(_0x276c82._0x3716ba,_0x276c82._0x30a61c)])+'\x20'+_0x214924);}[_0x3266d5(0x5f8,0x41f)+'lightCon'+_0x3266d5(0x3b2,0x575)+_0x26b3dd(0x52a,0x2b5)](_0x395690){const _0x29692e={_0x49cee0:0x7bb,_0x284dbb:0x1af,_0x2a7d3d:0x49c,_0x182a36:0x450,_0x4b5bbe:0x89c,_0x31d385:0x9b9,_0x5ad2e0:0x5b3,_0x5502e6:0x607,_0x430df4:0x67a,_0x5d387e:0x658,_0x1e8a7d:0x451,_0x38d76b:0xa5f,_0x1d7814:0xa22,_0x11f958:0x8ce,_0x5b5e2f:0x744,_0x278345:0x6ab,_0x403fa7:0x616},_0x593a02={_0x1f8c1e:0x118};function _0x3af0e4(_0x59f31c,_0x4f5443){return _0x26b3dd(_0x59f31c-0x9a,_0x4f5443);}function _0x82767a(_0x5f4652,_0x302a80){return _0x26b3dd(_0x5f4652- -_0x593a02._0x1f8c1e,_0x302a80);}if(this[_0x3af0e4(0x64e,_0x29692e._0x49cee0)+'ConnectH'+'andshake'+'s'][_0x82767a(0x3ed,_0x29692e._0x284dbb)]===0x0)return;for(const [_0xe6afbc,_0x1718ce]of this[_0x82767a(_0x29692e._0x2a7d3d,0x272)+_0x82767a(_0x29692e._0x182a36,0x461)+'andshake'+'s'][_0x82767a(0x7a8,_0x29692e._0x4b5bbe)]()){this[_0x3af0e4(_0x29692e._0x31d385,0x802)](_0x82767a(_0x29692e._0x5ad2e0,0x6d4)+_0x82767a(0x846,_0x29692e._0x5502e6)+_0x3af0e4(_0x29692e._0x430df4,_0x29692e._0x5d387e)+_0x3af0e4(0x702,_0x29692e._0x1e8a7d)+'\x20reqId='+_0xe6afbc+_0x3af0e4(_0x29692e._0x38d76b,_0x29692e._0x1d7814)+_0x1718ce[_0x3af0e4(0x7f5,0x8d4)]+('\x20elapsed'+'Ms=')+(Date[_0x3af0e4(0x78c,0x9d0)]()-_0x1718ce['startedA'+_0x3af0e4(0x7a2,0x77e)])+_0x82767a(0x7ad,_0x29692e._0x11f958)+_0x395690);}this['inFlight'+_0x3af0e4(0x602,0x3e1)+_0x82767a(_0x29692e._0x5b5e2f,_0x29692e._0x278345)+'s'][_0x82767a(_0x29692e._0x403fa7,0x773)]();}[_0x3266d5(0x4f,0x2b)+_0x3266d5(0x406,0x169)+_0x3266d5(0x3bc,0x2d8)](){const _0x3b762a={_0x305678:0x54c,_0x3e9a4f:0x64e,_0x5d9160:0xaa0,_0x492f6d:0x329,_0x27958e:0x39d,_0x2b7513:0x499,_0x26cb5f:0x85d,_0x4712b3:0x7c5,_0x4446f9:0x67b,_0x5ae6f5:0x39a,_0x247857:0x1a8,_0x2b9585:0x3db,_0x3f0091:0x489,_0x2736b7:0xc8,_0x3a34e7:0x454},_0x5ee31d={_0x10a1e3:0x19f,_0x237205:0x1cb,_0x491516:0x7a},_0x183baa={_0x1bd00f:0x13f},_0x291412={_0x3d601e:0x384},_0x4c38d8={_0x300419:0x316},_0x1e8f0c={_0x2012ee:0xf3},_0x17c815={'kyjUf':function(_0x348c27,_0x49ac17,_0x16aa32){return _0x348c27(_0x49ac17,_0x16aa32);}};if(this[_0x5ca4cf(_0x3b762a._0x305678,_0x3b762a._0x3e9a4f)]||this[_0x5ca4cf(_0x3b762a._0x5d9160,0x85d)+'tTimer'])return;function _0x28904c(_0x3a0f88,_0xf7470){return _0x3266d5(_0xf7470,_0x3a0f88- -_0x1e8f0c._0x2012ee);}const _0x1bce8b=this[_0x5ca4cf(0x54a,0x499)][_0x28904c(0x454,_0x3b762a._0x492f6d)+'tBaseDel'+_0x5ca4cf(0x37d,_0x3b762a._0x27958e)]??RECONNECT_BASE_DELAY_MS;function _0x5ca4cf(_0x46aebe,_0x246a07){return _0x3266d5(_0x46aebe,_0x246a07-_0x4c38d8._0x300419);}const _0x4d3bfb=this[_0x5ca4cf(0x250,_0x3b762a._0x2b7513)][_0x5ca4cf(0xa8c,_0x3b762a._0x26cb5f)+'tMaxDela'+_0x5ca4cf(_0x3b762a._0x4712b3,_0x3b762a._0x4446f9)]??RECONNECT_MAX_DELAY_MS,_0x496187=Math[_0x5ca4cf(_0x3b762a._0x5ae6f5,0x3a6)](_0x4d3bfb,_0x1bce8b*Math[_0x28904c(0x79,_0x3b762a._0x247857)](0x1,this[_0x5ca4cf(0x428,0x564)+_0x5ca4cf(0x50e,0x579)]));this[_0x28904c(0x39c,0x5dc)](_0x28904c(0x19c,-0x2c)+_0x28904c(_0x3b762a._0x2b9585,_0x3b762a._0x3f0091)+_0x28904c(-_0x3b762a._0x2736b7,0xd0)+_0x28904c(0x14c,0x1ec)+'s='+_0x496187),this[_0x28904c(_0x3b762a._0x3a34e7,0x589)+'tTimer']=_0x17c815[_0x28904c(0x3f2,0x234)](setTimeout,()=>{this['reconnec'+_0x14ec4f(_0x5ee31d._0x10a1e3,_0x5ee31d._0x237205)]=null;function _0x5f0684(_0x29ee0d,_0x437154){return _0x28904c(_0x29ee0d-_0x291412._0x3d601e,_0x437154);}function _0x14ec4f(_0x545226,_0x35c429){return _0x28904c(_0x545226- -_0x183baa._0x1bd00f,_0x35c429);}void this[_0x14ec4f(-_0x5ee31d._0x491516,-0x27d)+_0x5f0684(0x5f9,0x4b2)]();},_0x496187);}['schedule'+_0x3266d5(0x43b,0x26e)+_0x26b3dd(0x6af,0x890)](){const _0x30bad5={_0x452139:0x29d,_0x290f7f:0x40e,_0x2e45ec:0x5c8,_0x3fa2fc:0x35,_0x257847:0x2ca,_0x258f74:0x5a,_0x161aa2:0x1b,_0x25cad5:0xc4,_0x4cae83:0x633,_0x46b141:0x457,_0x37d62e:0x9f,_0x186e96:0x1fc,_0x594c2f:0xb2,_0x18afc4:0x4cd,_0x4c79bf:0x43b,_0x27438b:0x24a,_0x4ee3da:0x4c8,_0x15d025:0x6b4},_0xc46fe5={_0x420e37:0x169,_0x5cde80:0x17c},_0x33619d={_0x277c9c:0x112},_0x375001={_0x486d04:0xd6},_0x5f44ca=summarizePendingGatewayMessages(this[_0x12e9d8(0x5f6,0x830)+_0x26985c(_0x30bad5._0x452139,0x4d0)+'ssages'])['connectR'+'equests'];function _0x26985c(_0x505816,_0xb93581){return _0x3266d5(_0xb93581,_0x505816- -0x21f);}if(this[_0x12e9d8(_0x30bad5._0x290f7f,_0x30bad5._0x2e45ec)]||this[_0x12e9d8(0xf9,-_0x30bad5._0x3fa2fc)+_0x26985c(0x1d3,0x2c8)+'r']||!this[_0x12e9d8(_0x30bad5._0x257847,_0x30bad5._0x258f74)+_0x26985c(_0x30bad5._0x161aa2,-_0x30bad5._0x25cad5)]()||!shouldKeepGatewayConnected(this[_0x12e9d8(_0x30bad5._0x4cae83,_0x30bad5._0x46b141)][_0x12e9d8(0xf8,_0x30bad5._0x37d62e)+'unt'],_0x5f44ca))return;function _0x12e9d8(_0x3bce59,_0x2e1ef1){return _0x3266d5(_0x2e1ef1,_0x3bce59-_0x375001._0x486d04);}const _0x2b7067=this['options'][_0x26985c(-_0x30bad5._0x186e96,_0x30bad5._0x594c2f)+_0x12e9d8(0x57f,_0x30bad5._0x18afc4)+_0x12e9d8(_0x30bad5._0x4c79bf,_0x30bad5._0x27438b)]??GATEWAY_RETRY_DELAY_MS;this['gatewayR'+_0x12e9d8(_0x30bad5._0x4ee3da,_0x30bad5._0x15d025)+'r']=setTimeout(()=>{function _0x42be56(_0xb89396,_0x543eab){return _0x26985c(_0xb89396-_0x33619d._0x277c9c,_0x543eab);}function _0x5b0c12(_0x438a8b,_0xfa1241){return _0x26985c(_0xfa1241-0x436,_0x438a8b);}this[_0x42be56(-0xea,_0xc46fe5._0x420e37)+'etryTime'+'r']=null,this['ensureGa'+_0x5b0c12(0x2bf,0x4fa)+_0x42be56(0x4e,-_0xc46fe5._0x5cde80)]();},_0x2b7067);}['startHea'+_0x26b3dd(0x518,0x304)](){const _0x13d008={_0x1710c6:0x37b,_0x5c96a1:0x130,_0x157aa8:0x191,_0x3acf28:0xbc,_0x4c39c2:0x1c3},_0xdcb306={_0x220c85:0x970,_0x173696:0x706,_0xb43a7d:0x374,_0x4b7987:0x399,_0x293e49:0x775,_0x11cc49:0x5c6,_0x560f1d:0x64d,_0x5b7c06:0x7cd,_0x15c836:0x3d,_0x3a3032:0x6d1,_0x5dec16:0x424,_0x452cca:0x21d,_0x306c6e:0x208,_0x5c7674:0xb13,_0x58ad0c:0x3d5,_0x43d7df:0x22},_0x1df3ea={'UuitX':function(_0x2cffb5,_0x36781a,_0x3c5590){return _0x2cffb5(_0x36781a,_0x3c5590);}};function _0x200218(_0x701903,_0x15333b){return _0x3266d5(_0x15333b,_0x701903- -0x20c);}function _0x256440(_0x1a403d,_0x41fde0){return _0x3266d5(_0x1a403d,_0x41fde0- -0x20);}this[_0x256440(-0x131,0xe3)+_0x256440(0x603,_0x13d008._0x1710c6)](),this[_0x200218(-_0x13d008._0x5c96a1,_0x13d008._0x157aa8)+'tTimer']=_0x1df3ea['UuitX'](setInterval,()=>{const _0x5b2aba=this[_0x1b9171(_0xdcb306._0x220c85,_0xdcb306._0x173696)+_0x39589c(0x181,_0xdcb306._0xb43a7d)];if(!_0x5b2aba||_0x5b2aba[_0x39589c(_0xdcb306._0x4b7987,0x437)+'te']!==_0x427ed3['OPEN'])return;function _0x1b9171(_0x22e4a9,_0xf28709){return _0x256440(_0xf28709,_0x22e4a9-0x48f);}this[_0x1b9171(_0xdcb306._0x293e49,0x58b)+_0x1b9171(_0xdcb306._0x11cc49,_0xdcb306._0x560f1d)+_0x1b9171(_0xdcb306._0x5b7c06,0x9df)]();const _0x49b63c=this[_0x39589c(0x3b,_0xdcb306._0x15c836)]['heartbea'+'tTimeout'+'Ms']??HEARTBEAT_TIMEOUT_MS;function _0x39589c(_0x2cb839,_0x4c1efa){return _0x256440(_0x4c1efa,_0x2cb839- -0x128);}if(Date[_0x1b9171(_0xdcb306._0x3a3032,0x70f)]()-this[_0x39589c(_0xdcb306._0x5dec16,0x392)+'yActivit'+_0x39589c(_0xdcb306._0x452cca,_0xdcb306._0x306c6e)]>_0x49b63c){this[_0x1b9171(0x8fe,_0xdcb306._0x5c7674)]('relay\x20he'+'artbeat\x20'+_0x39589c(_0xdcb306._0x58ad0c,0x24c)+'t'),_0x5b2aba['terminat'+'e']();return;}_0x5b2aba[_0x39589c(-_0xdcb306._0x43d7df,0x6)]();},this[_0x256440(0x111,0x163)][_0x256440(-0x164,_0x13d008._0x3acf28)+'tInterva'+_0x200218(0x40,_0x13d008._0x4c39c2)]??HEARTBEAT_INTERVAL_MS);}[_0x26b3dd(0x593,0x535)+_0x3266d5(0x3b5,0x39b)](){const _0x18d2ad={_0x230fc5:0x940,_0x47fba9:0x199,_0x9970a6:0x7dd,_0x32233c:0xa82,_0x5db057:0x4e8,_0x1db3e6:0x22d,_0x3971f6:0x351,_0x184aed:0x15c},_0x38b4f0={_0x58c62f:0x84};function _0x3e2706(_0x2d00fb,_0x5ed2e6){return _0x26b3dd(_0x5ed2e6- -0x705,_0x2d00fb);}function _0x562ab2(_0x176c37,_0x110e0c){return _0x26b3dd(_0x176c37- -_0x38b4f0._0x58c62f,_0x110e0c);}this['heartbea'+_0x562ab2(0x7dd,_0x18d2ad._0x230fc5)]&&(clearInterval(this[_0x3e2706(-0x7d,-_0x18d2ad._0x47fba9)+_0x562ab2(_0x18d2ad._0x9970a6,_0x18d2ad._0x32233c)]),this[_0x562ab2(_0x18d2ad._0x5db057,_0x18d2ad._0x1db3e6)+_0x3e2706(_0x18d2ad._0x3971f6,_0x18d2ad._0x184aed)]=null);}['logSlowC'+_0x26b3dd(0x5e7,0x3d1)+'ndshakes'](){const _0x2ef682={_0xa88d3a:0x4cd,_0xb4bf28:0x40f,_0x31b912:0x8cc,_0x2ddfe1:0x7ca,_0x3b8a9a:0x6af,_0x31edac:0x387,_0xfccde5:0x3f3,_0x5ce2ea:0x31a,_0x2410e6:0x672,_0x50299a:0x458,_0x116b1e:0x34f,_0x5419a5:0x5f6,_0x61092a:0x7c5,_0x2ec256:0x585,_0x22a647:0x5a0,_0x4eb4a9:0x818,_0x14ccc2:0x7ba,_0x495ba:0x593,_0x300973:0x5ed,_0x3afd3d:0x778,_0xe37291:0x991},_0x3a73fa={_0x2a83cd:0x146};if(this['inFlight'+_0x190299(0x465,0x422)+_0x190299(0x80e,0x716)+'s']['size']===0x0)return;const _0x31d162=this[_0x190299(0x42e,_0x2ef682._0xa88d3a)][_0x464881(0x34a,_0x2ef682._0xb4bf28)+_0x464881(_0x2ef682._0x31b912,0x60e)+'WarnDela'+_0x190299(_0x2ef682._0x2ddfe1,_0x2ef682._0x3b8a9a)]??CONNECT_HANDSHAKE_WARN_DELAY_MS,_0x29d6ed=Date['now']();function _0x464881(_0xd1a265,_0x282dd2){return _0x26b3dd(_0x282dd2- -0x24e,_0xd1a265);}function _0x190299(_0x53e449,_0x19ac38){return _0x26b3dd(_0x19ac38- -_0x3a73fa._0x2a83cd,_0x53e449);}for(const [_0x59c9ea,_0x23debb]of this[_0x464881(_0x2ef682._0x31edac,0x366)+_0x464881(_0x2ef682._0xfccde5,_0x2ef682._0x5ce2ea)+_0x190299(0x765,0x716)+'s'][_0x464881(0x67c,_0x2ef682._0x2410e6)]()){const _0x128ddb=_0x29d6ed-_0x23debb['startedA'+_0x464881(_0x2ef682._0x50299a,0x4ba)];if(_0x23debb[_0x464881(0x46a,_0x2ef682._0x116b1e)+_0x190299(0x5ca,_0x2ef682._0x5419a5)+'d']||_0x128ddb<_0x31d162)continue;_0x23debb['slowWarn'+_0x190299(0x708,0x5f6)+'d']=!![],this[_0x190299(0x790,0x7d9)](_0x190299(_0x2ef682._0x61092a,_0x2ef682._0x2ec256)+_0x190299(_0x2ef682._0x22a647,_0x2ef682._0x4eb4a9)+_0x190299(0x78c,0x7b9)+_0x190299(_0x2ef682._0x14ccc2,_0x2ef682._0x495ba)+_0x464881(_0x2ef682._0x300973,_0x2ef682._0x3afd3d)+_0x59c9ea+_0x464881(_0x2ef682._0xe37291,0x777)+_0x23debb[_0x190299(0x730,0x615)]+(_0x190299(0x3a4,0x548)+_0x190299(0x521,0x691))+_0x128ddb);}}[_0x26b3dd(0x58f,0x5d0)+_0x3266d5(0x673,0x45e)+_0x26b3dd(0x829,0x6be)+'e'](_0x4e4d47){const _0x3c9045={_0x4987a3:0xbe9,_0x4ae161:0x9e8,_0x2e328a:0x1,_0x2b1ded:0x66c,_0x1eb103:0x1d1,_0x3b1c04:0x847,_0x4a8b11:0x9e8,_0x20e3d8:0xb5c,_0x45a000:0x989,_0x444636:0x792},_0x420fa4={_0x1e226d:0x6d3},_0xbdb043={_0x27ddb8:0x38};function _0x2a7a16(_0x3df786,_0x2c1a4a){return _0x26b3dd(_0x2c1a4a-_0xbdb043._0x27ddb8,_0x3df786);}function _0x4cf52e(_0x4285eb,_0x10d425){return _0x26b3dd(_0x10d425- -_0x420fa4._0x1e226d,_0x4285eb);}this[_0x2a7a16(_0x3c9045._0x4987a3,_0x3c9045._0x4ae161)+_0x4cf52e(-_0x3c9045._0x2e328a,0x279)+_0x2a7a16(0x6d5,_0x3c9045._0x2b1ded)][_0x4cf52e(_0x3c9045._0x1eb103,0x1f7)]>=MAX_PENDING_GATEWAY_MESSAGES&&this[_0x2a7a16(_0x3c9045._0x3b1c04,_0x3c9045._0x4a8b11)+_0x2a7a16(0x7b4,0x984)+'ssages'][_0x2a7a16(_0x3c9045._0x20e3d8,_0x3c9045._0x45a000)](),this[_0x2a7a16(0xc73,0x9e8)+_0x2a7a16(_0x3c9045._0x444636,0x984)+_0x4cf52e(-0x174,-0x9f)]['push'](_0x4e4d47);}[_0x3266d5(0x1ca,0x3e)+_0x3266d5(0x497,0x3ca)+_0x26b3dd(0x9eb,0xaaa)+'e'](){const _0x496fef={_0x5f1a19:0x9d5,_0x188939:0x804,_0x4beeec:0x9d5,_0x4e46f1:0x931,_0x39ca7b:0x7d4,_0x379405:0x91c,_0x3fa016:0x7f7,_0x12c60e:0x7ac,_0x233a48:0x599,_0x3d4b2b:0x433,_0x1dc060:0x743,_0x1b83a4:0x89c,_0x24b55a:0x7d7,_0x54b4a4:0x68b},_0x5527e1=summarizePendingGatewayMessages(this[_0x1f9d2e(_0x496fef._0x5f1a19,0x7f4)+_0x257987(0x949,_0x496fef._0x188939)+_0x257987(0x631,0x678)]);function _0x1f9d2e(_0x503d99,_0x4e9ba6){return _0x26b3dd(_0x503d99-0x25,_0x4e9ba6);}if(_0x5527e1['total']===0x0||_0x5527e1['connectR'+_0x257987(0x698,0x700)]>0x0)return;function _0x257987(_0x49190f,_0x436498){return _0x26b3dd(_0x49190f- -0x3,_0x436498);}this[_0x1f9d2e(_0x496fef._0x4beeec,_0x496fef._0x4e46f1)+_0x1f9d2e(0x971,_0x496fef._0x39ca7b)+'ssages']=[],this[_0x257987(_0x496fef._0x379405,0x8e3)](_0x1f9d2e(0x5e7,0x826)+_0x257987(0x6c1,_0x496fef._0x3fa016)+_0x257987(_0x496fef._0x12c60e,0xa65)+'ay\x20queue'+_0x1f9d2e(0x50a,0x324)+_0x5527e1[_0x257987(0x59c,0x3a6)]+_0x1f9d2e(_0x496fef._0x233a48,_0x496fef._0x3d4b2b)+_0x5527e1[_0x1f9d2e(_0x496fef._0x1dc060,_0x496fef._0x1b83a4)+'t']+_0x257987(0x73e,_0x496fef._0x24b55a)+_0x5527e1[_0x1f9d2e(0x706,_0x496fef._0x54b4a4)]);}[_0x3266d5(0x343,0x404)+'onnectSt'+_0x26b3dd(0x55a,0x530)](_0x3f35a9,_0x1e7779){const _0x2f1e5f={_0x126e8a:0xbf5,_0x58760f:0x9df,_0x231f93:0x4e7,_0x542132:0x7a0,_0x401670:0xd3e,_0x3811cb:0xa9b,_0x201251:0x30c,_0x45b467:0x172,_0x26038a:0x90a,_0x5f5862:0x8f0,_0x3a2502:0x862,_0x21bdb1:0x87a,_0x367e7c:0x2f2,_0x30bb87:0xa4b,_0x7dc1d3:0x93c},_0x166ff1={};_0x166ff1[_0xf4ba29(_0x2f1e5f._0x126e8a,_0x2f1e5f._0x58760f)]=_0x353b79(0x56f,_0x2f1e5f._0x231f93)+'d';const _0x1b0582=_0x166ff1,_0x3e8663=Date[_0xf4ba29(0x520,_0x2f1e5f._0x542132)](),_0x42b96c=new Map(this[_0xf4ba29(_0x2f1e5f._0x401670,_0x2f1e5f._0x3811cb)][_0x353b79(0x35c,0x4e7)+_0x353b79(_0x2f1e5f._0x201251,_0x2f1e5f._0x45b467)]['map'](_0x55ce3c=>[_0x55ce3c['id'],{..._0x55ce3c}])),_0x4c26bd=_0x42b96c['get'](_0x3f35a9)??{'id':_0x3f35a9,'label':_0x1e7779,'state':_0x1b0582['XwIZJ'],'lastSeenMs':_0x3e8663};_0x4c26bd[_0x353b79(0x45a,0x3f3)]=_0x1e7779,_0x4c26bd[_0xf4ba29(0x87b,0x8ad)]=_0xf4ba29(_0x2f1e5f._0x26038a,_0x2f1e5f._0x5f5862)+'d',_0x4c26bd[_0xf4ba29(0xb0d,_0x2f1e5f._0x3a2502)+'Ms']=_0x3e8663,_0x42b96c[_0xf4ba29(_0x2f1e5f._0x21bdb1,0x796)](_0x3f35a9,_0x4c26bd);const _0x3f75bd=[..._0x42b96c['values']()][_0x353b79(0x3ee,_0x2f1e5f._0x367e7c)]((_0x348f46,_0x9d889a)=>_0x9d889a[_0xf4ba29(0x625,0x862)+'Ms']-_0x348f46[_0xf4ba29(0xaa4,0x862)+'Ms'])['slice'](0x0,MAX_DEVICE_DETAILS);function _0xf4ba29(_0xb524e4,_0x5e8e3d){return _0x26b3dd(_0x5e8e3d-0xae,_0xb524e4);}const _0x42defc={};function _0x353b79(_0x5bc802,_0x5b0a54){return _0x26b3dd(_0x5b0a54- -0x35b,_0x5bc802);}_0x42defc['connecte'+'dDevices']=_0x3f75bd,this[_0xf4ba29(_0x2f1e5f._0x30bb87,0x7a5)+_0xf4ba29(_0x2f1e5f._0x7dc1d3,0x7a7)](_0x42defc);}[_0x26b3dd(0x605,0x7ca)+'cesRecen'+'t'](){const _0x3e957f={_0x47df2a:0x193,_0x192c18:0x46d,_0x41b511:0x666,_0x1200ab:0x565,_0x39c319:0x489},_0x59f9ae={_0x417313:0x564};function _0x4e5d56(_0x328fc8,_0x49973c){return _0x26b3dd(_0x49973c- -0x93,_0x328fc8);}function _0x2a7fce(_0xb9a70c,_0x4efe4c){return _0x26b3dd(_0x4efe4c- -_0x59f9ae._0x417313,_0xb9a70c);}this[_0x2a7fce(-0x60,_0x3e957f._0x47df2a)+_0x4e5d56(_0x3e957f._0x192c18,_0x3e957f._0x41b511)]({'connectedDevices':this[_0x2a7fce(_0x3e957f._0x1200ab,_0x3e957f._0x39c319)]['connecte'+'dDevices']['map'](_0x8f03b9=>({..._0x8f03b9,'state':_0x2a7fce(0x14e,0x40e)}))});}[_0x26b3dd(0x5ef,0x840)+_0x26b3dd(0x55e,0x63d)+_0x26b3dd(0x5f5,0x4a6)](_0x2e1f07){const _0x1611e9={_0x176472:0x27,_0x5da80a:0x1d3,_0x278a9b:0xea,_0x228886:0x2a3,_0x50eedf:0x4dc,_0x2f2ef9:0x36a,_0x3dd9dc:0x4b,_0x172ff0:0x19e,_0x3f8233:0x3e6,_0x89a722:0x15e,_0xe3f30e:0x116,_0x14effe:0x2d,_0x520413:0x33b,_0x2f518a:0x135,_0x3e929c:0x1ef,_0x1fbf22:0x142,_0x45dd3c:0xde},_0x41716b={_0x36fd2e:0x1f3};function _0xbe1862(_0x5da6cb,_0x1f2c5c){return _0x3266d5(_0x5da6cb,_0x1f2c5c- -_0x41716b._0x36fd2e);}if(this['snapshot']['pendingP'+_0x5291be(_0x1611e9._0x176472,-_0x1611e9._0x5da80a)+_0xbe1862(-0xd,-_0x1611e9._0x278a9b)][_0x5291be(0x132,_0x1611e9._0x228886)](_0x35d382=>_0x35d382[_0x5291be(0x82,0x16)+'d']===_0x2e1f07[_0xbe1862(-0x1f9,-0x1d)+'d']))return;function _0x5291be(_0x5d1982,_0x45601d){return _0x3266d5(_0x45601d,_0x5d1982- -0x154);}const _0x5c9f3e=[...this[_0xbe1862(_0x1611e9._0x50eedf,_0x1611e9._0x2f2ef9)][_0x5291be(-0x101,-0x318)+_0x5291be(0x27,-0x15a)+_0x5291be(-_0x1611e9._0x3dd9dc,-0xd5)],_0x2e1f07][_0x5291be(-0x14c,0x64)](-MAX_PENDING_PAIR_REQUESTS),_0x5b3c02={};_0x5b3c02[_0xbe1862(0xbd,-0x1a0)+_0xbe1862(0x20a,-0x78)+_0x5291be(-_0x1611e9._0x3dd9dc,0xa9)]=_0x5c9f3e,this['updateSn'+_0x5291be(0x115,-_0x1611e9._0x172ff0)](_0x5b3c02),this['options'][_0x5291be(_0x1611e9._0x3f8233,_0x1611e9._0x89a722)+'gPairReq'+_0xbe1862(-_0x1611e9._0xe3f30e,-_0x1611e9._0x14effe)]?.(_0x2e1f07),this[_0x5291be(_0x1611e9._0x520413,0x2df)](_0xbe1862(_0x1611e9._0x2f518a,0x2a9)+_0xbe1862(-_0x1611e9._0x3e929c,-0x152)+'ding\x20req'+'uestId='+_0x2e1f07['requestI'+'d']+(_0xbe1862(-0x3d5,-_0x1611e9._0x1fbf22)+'d=')+(_0x2e1f07['deviceId']||_0x5291be(0xd4,-_0x1611e9._0x45dd3c)+'>'));}[_0x3266d5(0x22a,0x345)+_0x3266d5(0x3b9,0x45c)+'esolved'](_0x273ad9,_0x3dcc1f){const _0x4fbfb1={_0x15a2a5:0x882,_0xd5f563:0x1e3,_0x59b466:0x562,_0x5c7713:0x378,_0x2574b4:0x142,_0x555fbc:0x69,_0x125e7e:0x2cf,_0x3e7e9c:0x37b,_0x4a089c:0x973,_0x3426c1:0x3d3,_0x239940:0x1e0,_0x4f0c3b:0x521},_0x38709a={_0x1ad1dc:0xf1},_0x3e7c27=this[_0x186aad(_0x4fbfb1._0x15a2a5,0x5c5)][_0x2e334e(0x178,0x3f2)+_0x186aad(0x48,_0x4fbfb1._0xd5f563)+'sts'][_0x186aad(_0x4fbfb1._0x59b466,_0x4fbfb1._0x5c7713)](_0x3b4a7b=>_0x3b4a7b['requestI'+'d']===_0x273ad9?{..._0x3b4a7b,'status':_0x3dcc1f==='approved'||_0x3dcc1f===_0x186aad(0x2ed,0x43c)?_0x3dcc1f:_0x3b4a7b[_0x186aad(0x684,0x3e4)]}:_0x3b4a7b),_0x30a1ab={};_0x30a1ab['pendingP'+_0x186aad(_0x4fbfb1._0x2574b4,0x1e3)+_0x2e334e(0x204,0x4a8)]=_0x3e7c27;function _0x2e334e(_0x2d477c,_0x4d7615){return _0x26b3dd(_0x4d7615- -_0x38709a._0x1ad1dc,_0x2d477c);}function _0x186aad(_0x518652,_0x57426b){return _0x26b3dd(_0x57426b- -0x428,_0x518652);}this[_0x186aad(_0x4fbfb1._0x555fbc,_0x4fbfb1._0x125e7e)+'apshot'](_0x30a1ab),this[_0x186aad(_0x4fbfb1._0x3e7e9c,0x4f7)](_0x2e334e(0x8f6,0x83b)+_0x2e334e(_0x4fbfb1._0x4a089c,0x7a7)+_0x2e334e(0x668,_0x4fbfb1._0x3426c1)+_0x186aad(_0x4fbfb1._0x239940,0x2ad)+_0x273ad9+(_0x2e334e(0x278,_0x4fbfb1._0x4f0c3b)+'n=')+_0x3dcc1f);}['updateSn'+_0x26b3dd(0x6f9,0x8e0)](_0x1913f7){const _0x541bdd={_0x3b266d:0x345,_0x3742cb:0x33f,_0x2f8d17:0x38,_0x121f7e:0x227,_0x5a736b:0x2f9},_0x18941f={_0x44f1bf:0x507};function _0x30b68a(_0x3c00ce,_0x1c5492){return _0x26b3dd(_0x3c00ce- -0x3b3,_0x1c5492);}Object[_0x30b68a(_0x541bdd._0x3b266d,_0x541bdd._0x3742cb)](this['snapshot'],_0x1913f7,{'lastUpdatedMs':Date[_0x2f9571(0x1eb,_0x541bdd._0x2f8d17)]()});function _0x2f9571(_0x13a325,_0x420f6e){return _0x26b3dd(_0x13a325- -_0x18941f._0x44f1bf,_0x420f6e);}this['options'][_0x30b68a(_0x541bdd._0x121f7e,0x1c)]?.(this[_0x2f9571(_0x541bdd._0x5a736b,0x310)+'hot']());}[_0x26b3dd(0x91f,0x8ec)](_0x45ad06){const _0xf2a772={_0x6767b8:0xdc,_0x2d49be:0x84},_0x57cde8={_0x42a3e6:0x6ef},_0x287e61={_0x47ec37:0x6a7};function _0x3ab737(_0x1fece4,_0x19f928){return _0x26b3dd(_0x19f928- -_0x287e61._0x47ec37,_0x1fece4);}function _0x467232(_0x313b19,_0x3c6135){return _0x26b3dd(_0x313b19- -_0x57cde8._0x42a3e6,_0x3c6135);}this[_0x467232(-_0xf2a772._0x6767b8,_0xf2a772._0x2d49be)][_0x3ab737(0x4d4,0x364)]?.(_0x45ad06);}['isRelayO'+_0x26b3dd(0x6ca,0x7b5)](){const _0x35746b={_0x1b9a29:0x3f2,_0x22afd8:0x1c,_0xe90efb:0x1ba,_0x2ac1f9:0x98,_0xa469c:0x27e};function _0xaaee86(_0x458d02,_0x510b06){return _0x26b3dd(_0x510b06- -0x59f,_0x458d02);}function _0x194191(_0x23ac69,_0x349a86){return _0x26b3dd(_0x23ac69- -0x1a9,_0x349a86);}return this[_0xaaee86(0x5e5,_0x35746b._0x1b9a29)+_0xaaee86(-_0x35746b._0x22afd8,_0x35746b._0xe90efb)]?.['readySta'+'te']===_0x427ed3[_0xaaee86(_0x35746b._0x2ac1f9,_0x35746b._0xa469c)];}[_0x26b3dd(0x92d,0xb93)+_0x26b3dd(0x923,0xb21)](){const _0xbf55a4={_0xfdb313:0x667,_0x54a504:0x796,_0x3b284a:0x725,_0x923ee7:0x19b,_0x5c7177:0x317,_0x2aef1d:0x24b,_0x2f39cb:0x4ed,_0x168ad7:0x4d0},_0x10728c={_0xc2a3b6:0x288};function _0x5c963b(_0x4318b7,_0x131c74){return _0x26b3dd(_0x4318b7- -0x330,_0x131c74);}const _0x23a15f={};function _0x13243b(_0x4c6870,_0x3876bd){return _0x26b3dd(_0x3876bd- -_0x10728c._0xc2a3b6,_0x4c6870);}_0x23a15f[_0x5c963b(_0xbf55a4._0xfdb313,_0xbf55a4._0x54a504)]=function(_0x110ffc,_0xfbf3bf){return _0x110ffc===_0xfbf3bf;};const _0x5c9362=_0x23a15f;return _0x5c9362[_0x5c963b(0x667,_0xbf55a4._0x3b284a)](this[_0x5c963b(_0xbf55a4._0x923ee7,0x99)+_0x13243b(_0xbf55a4._0x5c7177,_0xbf55a4._0x2aef1d)]?.[_0x5c963b(0x641,0x82d)+'te'],_0x427ed3[_0x5c963b(_0xbf55a4._0x2f39cb,_0xbf55a4._0x168ad7)]);}[_0x3266d5(0x71a,0x578)+_0x3266d5(0x343,0x323)](){const _0x4aa088={_0x5c6764:0x5ed,_0x1b92f7:0x4b2,_0x428b3a:0x79b,_0x5cbb31:0x616,_0x41b1d2:0x8bd,_0x12f7a7:0x434},_0x5c415a={_0x24c153:0x26c},_0x4ce9bc={_0x5105dd:0xe1};this[_0x41b6e4(_0x4aa088._0x5c6764,_0x4aa088._0x1b92f7)+_0x41b6e4(0x614,0x74a)]();function _0x41b6e4(_0x47c56a,_0x1fb30c){return _0x26b3dd(_0x1fb30c- -_0x4ce9bc._0x5105dd,_0x47c56a);}this[_0xe48d85(0x76b,0xa02)+_0x41b6e4(_0x4aa088._0x428b3a,0x780)]&&(clearTimeout(this['reconnec'+'tTimer']),this['reconnec'+'tTimer']=null);function _0xe48d85(_0x1f62c7,_0x1e952a){return _0x26b3dd(_0x1f62c7- -_0x5c415a._0x24c153,_0x1e952a);}this['gatewayR'+_0xe48d85(_0x4aa088._0x5cbb31,_0x4aa088._0x41b1d2)+'r']&&(clearTimeout(this[_0xe48d85(0x247,_0x4aa088._0x12f7a7)+_0x41b6e4(0x916,0x7a1)+'r']),this['gatewayR'+_0xe48d85(_0x4aa088._0x5cbb31,0x5a1)+'r']=null);}['elapsedS'+_0x3266d5(0x40e,0x14e)](_0x4444c4){const _0x46173a={_0x4a3081:0x3b5,_0x1835fc:0x1b9},_0x22a28d={};_0x22a28d[_0x23bf90(_0x46173a._0x4a3081,0x16b)]=function(_0x472605,_0x28024f){return _0x472605-_0x28024f;};function _0x23bf90(_0x4ebf6b,_0x409b3b){return _0x26b3dd(_0x409b3b- -0x443,_0x4ebf6b);}const _0x50e846=_0x22a28d;function _0x5cb845(_0x125c86,_0x356b09){return _0x26b3dd(_0x125c86- -0x4bf,_0x356b09);}return _0x4444c4==null?null:Math[_0x23bf90(0x3a0,_0x46173a._0x1835fc)](0x0,_0x50e846['MufMj'](Date['now'](),_0x4444c4));}};function _0x47f8(_0x31ca37,_0x1383f8){_0x31ca37=_0x31ca37-0x171;const _0x17a50c=_0x1cc1();let _0x23587f=_0x17a50c[_0x31ca37];if(_0x47f8['ThIvvi']===undefined){var _0x1e9614=function(_0x20d5b4){const _0x169c7a='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x397c1b='',_0xe3bad5='',_0x3ca24e=_0x397c1b+_0x1e9614;for(let _0x416de4=0x0,_0x3321ad,_0x102752,_0xc4711b=0x0;_0x102752=_0x20d5b4['charAt'](_0xc4711b++);~_0x102752&&(_0x3321ad=_0x416de4%0x4?_0x3321ad*0x40+_0x102752:_0x102752,_0x416de4++%0x4)?_0x397c1b+=_0x3ca24e['charCodeAt'](_0xc4711b+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x3321ad>>(-0x2*_0x416de4&0x6)):_0x416de4:0x0){_0x102752=_0x169c7a['indexOf'](_0x102752);}for(let _0x1e5e7b=0x0,_0x342630=_0x397c1b['length'];_0x1e5e7b<_0x342630;_0x1e5e7b++){_0xe3bad5+='%'+('00'+_0x397c1b['charCodeAt'](_0x1e5e7b)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0xe3bad5);};_0x47f8['DJlGoD']=_0x1e9614,_0x47f8['esTulf']={},_0x47f8['ThIvvi']=!![];}const _0x1cc1ea=_0x17a50c[0x0],_0x47f8a3=_0x31ca37+_0x1cc1ea,_0x3dc0a3=_0x47f8['esTulf'][_0x47f8a3];if(!_0x3dc0a3){const _0x1bf55b=function(_0x33c76f){this['NZOVqO']=_0x33c76f,this['RvkpWN']=[0x1,0x0,0x0],this['UeKPpf']=function(){return'newState';},this['nPItkc']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['IYiCyE']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x1bf55b['prototype']['LemkxX']=function(){const _0x1be139=new RegExp(this['nPItkc']+this['IYiCyE']),_0x7f6946=_0x1be139['test'](this['UeKPpf']['toString']())?--this['RvkpWN'][0x1]:--this['RvkpWN'][0x0];return this['yEgaCT'](_0x7f6946);},_0x1bf55b['prototype']['yEgaCT']=function(_0x7603a7){if(!Boolean(~_0x7603a7))return _0x7603a7;return this['PkJXgv'](this['NZOVqO']);},_0x1bf55b['prototype']['PkJXgv']=function(_0x773359){for(let _0x32cb50=0x0,_0x41123e=this['RvkpWN']['length'];_0x32cb50<_0x41123e;_0x32cb50++){this['RvkpWN']['push'](Math['round'](Math['random']())),_0x41123e=this['RvkpWN']['length'];}return _0x773359(this['RvkpWN'][0x0]);},new _0x1bf55b(_0x47f8)['LemkxX'](),_0x23587f=_0x47f8['DJlGoD'](_0x23587f),_0x47f8['esTulf'][_0x47f8a3]=_0x23587f;}else _0x23587f=_0x3dc0a3;return _0x23587f;}function shouldKeepGatewayConnected(_0x551df0,_0x12a1f6){return _0x551df0>0x0||_0x12a1f6>0x0;}function shouldScheduleGatewayIdleClose(_0xc851e9,_0x4fd831,_0x153a74){return _0x153a74&&!shouldKeepGatewayConnected(_0xc851e9,_0x4fd831);}function shouldRecycleGatewayForFreshClient(_0x277350,_0x933310,_0x1b88d2,_0x2f1a2a){return _0x1b88d2&&_0x933310>0x0&&(_0x277350===0x0||_0x2f1a2a);}function summarizePendingGatewayMessages(_0x3b01c1){const _0x2cfbfd={_0x3f968c:0xb3,_0xa1659f:0x90,_0x360e66:0x1bf,_0x2497b0:0x2a,_0x3c3c0c:0x25c,_0x218bb4:0x295,_0x28ea72:0x258,_0x18257c:0x2d5,_0x4836bf:0x120,_0x548d7b:0x212,_0x1eaca8:0x506},_0x458f8d={_0x211d61:0x7},_0x382a99={};_0x382a99[_0x47aaef(-0x118,_0x2cfbfd._0x3f968c)]=function(_0x3f25e8,_0x2ab62d){return _0x3f25e8===_0x2ab62d;};const _0x22a0d5=_0x382a99,_0x4dcff2={};_0x4dcff2[_0x156861(0x116,_0x2cfbfd._0xa1659f)]=_0x3b01c1['length'],_0x4dcff2[_0x156861(_0x2cfbfd._0x360e66,0x400)+_0x47aaef(_0x2cfbfd._0x2497b0,_0x2cfbfd._0x3c3c0c)]=0x0;function _0x156861(_0x407630,_0x233df7){return _0x3266d5(_0x233df7,_0x407630-_0x458f8d._0x211d61);}_0x4dcff2[_0x156861(_0x2cfbfd._0x218bb4,0x1a6)+'t']=0x0;function _0x47aaef(_0x5ef57d,_0x3e982b){return _0x3266d5(_0x3e982b,_0x5ef57d- -0x1e1);}_0x4dcff2[_0x156861(_0x2cfbfd._0x28ea72,_0x2cfbfd._0x18257c)]=0x0;const _0x398b0e=_0x4dcff2;for(const _0x354dc5 of _0x3b01c1){if(_0x22a0d5['PCwjR'](_0x354dc5[_0x47aaef(-0x1cb,-_0x2cfbfd._0x4836bf)],'binary')){_0x398b0e[_0x47aaef(0x70,-0x1b0)]+=0x1;continue;}if(isConnectHandshakeRequest(_0x354dc5[_0x47aaef(0xb6,0x34c)])){_0x398b0e[_0x156861(0x1bf,0x307)+_0x156861(_0x2cfbfd._0x548d7b,0x1a0)]+=0x1;continue;}_0x398b0e[_0x156861(_0x2cfbfd._0x218bb4,_0x2cfbfd._0x1eaca8)+'t']+=0x1;}return _0x398b0e;}function dedupePendingGatewayMessages(_0x55ace7){const _0xf214b4={_0x34c606:0x3c9,_0xf016af:0x2a9,_0x33e725:0x692},_0x48e734={_0x41a97d:0x341};function _0x2298f7(_0x95ec37,_0x3726de){return _0x26b3dd(_0x3726de- -_0x48e734._0x41a97d,_0x95ec37);}let _0x4738da=-0x1;for(let _0x3c9297=_0x55ace7[_0xf2ae07(0x2ec,0x490)]-0x1;_0x3c9297>=0x0;_0x3c9297-=0x1){const _0x4fd734=_0x55ace7[_0x3c9297];if(_0x4fd734?.[_0x2298f7(_0xf214b4._0x34c606,0x165)]==='text'&&isConnectHandshakeRequest(_0x4fd734[_0x2298f7(_0xf214b4._0xf016af,0x3e6)])){_0x4738da=_0x3c9297;break;}}if(_0x4738da<=0x0){const _0x16069d={};return _0x16069d['messages']=[..._0x55ace7],_0x16069d['dropped']=0x0,_0x16069d;}const _0x3e35c0=_0x55ace7['filter']((_0x577dc8,_0x4238f5)=>_0x4238f5>=_0x4738da||(_0x577dc8['kind']!==_0x2298f7(0x147,0x3e6)||!isConnectHandshakeRequest(_0x577dc8[_0x2298f7(0x24c,0x3e6)])));function _0xf2ae07(_0x2ecd68,_0x58114e){return _0x26b3dd(_0x2ecd68- -0x5de,_0x58114e);}const _0xf99f18={};return _0xf99f18[_0x2298f7(0x7e3,0x617)]=_0x3e35c0,_0xf99f18[_0x2298f7(_0xf214b4._0x33e725,0x410)]=_0x55ace7['length']-_0x3e35c0['length'],_0xf99f18;}function prunePendingGatewayMessagesForFreshDemand(_0x41d85b){const _0x106773={_0x4c1060:0x33a,_0x231a4c:0xe2,_0x5dbd79:0x32c,_0x11153d:0x30b,_0x508725:0x25,_0x2ae5d9:0x484,_0x10d3be:0x180,_0xfef032:0x512,_0x4042c2:0x6c2,_0x2a03af:0x286,_0x283e24:0x725,_0x5b3991:0x3ff},_0x22ddef={_0x532cc0:0x4a},_0x73fb0f={};_0x73fb0f[_0x39edc7(_0x106773._0x4c1060,_0x106773._0x231a4c)]=function(_0x214662,_0x5b5fef){return _0x214662===_0x5b5fef;};const _0x5b53db=_0x73fb0f;if(_0x5b53db[_0x39edc7(0x33a,0x2c2)](_0x41d85b['length'],0x0)){const _0x46443e={};return _0x46443e[_0x52ac1c(0x512,_0x106773._0x5dbd79)]=[],_0x46443e[_0x52ac1c(_0x106773._0x11153d,0x1de)]=0x0,_0x46443e;}let _0x29f98b=-0x1;for(let _0x4dd8a=_0x41d85b[_0x52ac1c(0x484,0x35e)]-0x1;_0x4dd8a>=0x0;_0x4dd8a-=0x1){const _0x192a27=_0x41d85b[_0x4dd8a];if(_0x192a27?.[_0x39edc7(-_0x106773._0x508725,-0x2dd)]==='text'&&isConnectHandshakeRequest(_0x192a27[_0x39edc7(0x25c,0x2af)])){_0x29f98b=_0x4dd8a;break;}}function _0x39edc7(_0x337815,_0x5836c5){return _0x3266d5(_0x5836c5,_0x337815- -0x3b);}function _0x52ac1c(_0x4e2751,_0x3e27e3){return _0x3266d5(_0x3e27e3,_0x4e2751-_0x22ddef._0x532cc0);}if(_0x29f98b===-0x1){const _0xd9382a={};return _0xd9382a[_0x39edc7(0x48d,0x5cd)]=[],_0xd9382a['dropped']=_0x41d85b[_0x52ac1c(_0x106773._0x2ae5d9,0x335)],_0xd9382a;}const _0x2d5af5=_0x41d85b[_0x52ac1c(0x52,-_0x106773._0x10d3be)](_0x29f98b),_0x39f6d3={};return _0x39f6d3[_0x52ac1c(_0x106773._0xfef032,_0x106773._0x4042c2)]=_0x2d5af5,_0x39f6d3[_0x39edc7(_0x106773._0x2a03af,0x4ae)]=_0x41d85b[_0x52ac1c(_0x106773._0x2ae5d9,_0x106773._0x283e24)]-_0x2d5af5[_0x39edc7(_0x106773._0x5b3991,0x4b2)],_0x39f6d3;}function patchConnectRequestGatewayAuth(_0x54549f,_0x37ebe9){const _0x4f539f={_0x42265b:0x37c,_0x32e50b:0x44a,_0x84dfa1:0x3de,_0x23d3e2:0xb1b,_0x205b83:0x226,_0x32748c:0x64f,_0x5450aa:0x3fe,_0x5bf752:0x309,_0x1a6e34:0x582,_0x8f9449:0x373,_0xcf7f62:0x48c,_0x4b1e18:0x392,_0x57d851:0x52e,_0x6d9eb0:0x392,_0x1ff56f:0x7f4,_0x18bf2f:0x6cd,_0x5418d7:0x418,_0x10cf4b:0x45c,_0x6d68c4:0x4c7,_0x19f75b:0x9e7,_0x5977ea:0x7dd,_0x35409a:0x1fa,_0xbbb529:0x306,_0x39d28c:0x32b},_0x39e067={_0x423527:0x13a},_0xf1e785={};_0xf1e785[_0x280b88(0x1d7,_0x4f539f._0x42265b)]=function(_0x1405d0,_0x505c2e){return _0x1405d0!==_0x505c2e;};function _0x21257f(_0xf557c5,_0x4089c1){return _0x26b3dd(_0xf557c5- -0x322,_0x4089c1);}function _0x280b88(_0x12d135,_0x5181c1){return _0x26b3dd(_0x5181c1- -_0x39e067._0x423527,_0x12d135);}const _0x14560c=_0xf1e785;if(_0x37ebe9[_0x21257f(_0x4f539f._0x32e50b,0x5d2)]!=='password'||!_0x37ebe9['password']){const _0x11b46e={};return _0x11b46e['text']=_0x54549f,_0x11b46e[_0x21257f(0x3fe,_0x4f539f._0x84dfa1)]=![],_0x11b46e;}try{const _0xaf260=JSON['parse'](_0x54549f);if(_0x14560c[_0x21257f(0x194,0x362)](_0xaf260[_0x280b88(_0x4f539f._0x23d3e2,0x898)],'req')||_0xaf260[_0x21257f(0x439,0x565)]!=='connect'&&_0xaf260['method']!=='connect.'+_0x21257f(_0x4f539f._0x205b83,0x391)){const _0x2a6936={};return _0x2a6936[_0x280b88(_0x4f539f._0x32748c,0x5ed)]=_0x54549f,_0x2a6936[_0x21257f(_0x4f539f._0x5450aa,_0x4f539f._0x5bf752)]=![],_0x2a6936;}const _0x531021=_0xaf260['params']&&typeof _0xaf260[_0x280b88(_0x4f539f._0x1a6e34,_0x4f539f._0x8f9449)]===_0x280b88(_0x4f539f._0xcf7f62,_0x4f539f._0x4b1e18)?{..._0xaf260['params']}:{},_0x430f2a=_0x531021['auth']&&typeof _0x531021[_0x21257f(0x1fa,-0x6e)]===_0x280b88(_0x4f539f._0x57d851,_0x4f539f._0x6d9eb0)?{..._0x531021[_0x280b88(0x60b,0x3e2)]}:{},_0x500eb1=typeof _0x430f2a[_0x280b88(0x930,0x7dd)]===_0x280b88(_0x4f539f._0x1ff56f,_0x4f539f._0x18bf2f)?_0x430f2a['password'][_0x280b88(_0x4f539f._0x5418d7,0x67c)]():'';if(_0x500eb1){const _0xe98395={};return _0xe98395[_0x21257f(0x405,_0x4f539f._0x10cf4b)]=_0x54549f,_0xe98395[_0x280b88(_0x4f539f._0x6d68c4,0x5e6)]=![],_0xe98395;}_0x430f2a[_0x21257f(0x5f5,0x4f7)]=_0x37ebe9[_0x280b88(_0x4f539f._0x19f75b,_0x4f539f._0x5977ea)],_0x531021[_0x21257f(_0x4f539f._0x35409a,_0x4f539f._0xbbb529)]=_0x430f2a;const _0x362894={..._0xaf260};return _0x362894[_0x280b88(0x40a,0x373)]=_0x531021,{'text':JSON['stringif'+'y'](_0x362894),'injected':!![]};}catch{const _0x2979cb={};return _0x2979cb['text']=_0x54549f,_0x2979cb[_0x21257f(0x3fe,_0x4f539f._0x39d28c)]=![],_0x2979cb;}}function formatConnectHandshakeMetaForLog(_0x1c4b75){const _0x165454={_0x5de945:0x10,_0x36f06f:0x338,_0x3a1e86:0x431,_0x488f2a:0x4ea,_0x3de07a:0x327,_0x58a6c4:0x3d8,_0x3d6c8f:0x29a,_0x4604e2:0x468,_0x547f7a:0x697,_0x3f3101:0x50d,_0x268163:0x745,_0x20afca:0x752,_0x1968a8:0x4fd,_0x5705b6:0x709},_0x167a75={};_0x167a75['WavQb']='<none>';function _0x7e0248(_0x48bd18,_0x1fe8b8){return _0x3266d5(_0x48bd18,_0x1fe8b8-0x22d);}function _0x5232e3(_0x3e8084,_0x243949){return _0x3266d5(_0x243949,_0x3e8084- -0x126);}const _0x40df5a=_0x167a75;if(!_0x1c4b75)return'';return'\x20method='+_0x1c4b75['method']+_0x5232e3(-_0x165454._0x5de945,0xdd)+(_0x1c4b75['id']??'<none>')+(_0x7e0248(0x5e5,_0x165454._0x36f06f)+_0x7e0248(_0x165454._0x3a1e86,_0x165454._0x488f2a))+_0x1c4b75[_0x7e0248(0x37e,_0x165454._0x3de07a)+_0x7e0248(_0x165454._0x58a6c4,0x586)]+(_0x5232e3(_0x165454._0x3d6c8f,_0x165454._0x4604e2)+_0x7e0248(0x667,0x6ac))+(_0x1c4b75[_0x7e0248(_0x165454._0x547f7a,_0x165454._0x3f3101)+'gth']??0x0)+(_0x7e0248(0x987,_0x165454._0x268163)+_0x7e0248(_0x165454._0x20afca,_0x165454._0x1968a8))+(_0x1c4b75[_0x5232e3(0x15,0x112)+'ds'][_0x5232e3(0x314,0x463)]>0x0?_0x1c4b75['authFiel'+'ds'][_0x7e0248(0x590,_0x165454._0x5705b6)](','):_0x40df5a[_0x5232e3(0x11,0x1e9)]);}function parseBootstrapRequestPayload(_0x144dbd){const _0xba370f={_0x20b01c:0x28e,_0x25fecc:0x1a7,_0x44f92c:0xda,_0x467d50:0x4c1,_0x2cfbcf:0x63e,_0x1a39e2:0x7a3,_0x1de94a:0x44d,_0x2dcdbd:0x3ce,_0x29e206:0x4b5,_0x2ccffa:0x52,_0x45364d:0x480,_0x4b69d9:0x59f,_0x59a05c:0x508,_0x262fe7:0x243,_0x46d097:0x2d,_0x1bdf0a:0x18e,_0x3f4e8e:0x310,_0x1a9c5d:0x308,_0x451b76:0x4db,_0x4ac408:0x131,_0x346654:0x2fa,_0x412b53:0x5c6,_0x4acb0a:0x7fc,_0xc0ba54:0x459,_0x426de1:0x178,_0x4ea5bd:0x300,_0x1b4fbf:0x283,_0x4d024f:0x47a,_0x4889b4:0x27e,_0x3e2f57:0x6ba,_0x3fe4c7:0x55a,_0x2b375f:0x65,_0x45f60f:0x6e8,_0x4b37fe:0x4a6},_0x30ebe9={_0x1b4a5b:0x323},_0x405afa={'FVgFh':function(_0x35f840,_0x2ac5b2){return _0x35f840(_0x2ac5b2);},'RpAOh':_0x263a4d(0x1a5,_0xba370f._0x20b01c)+_0x263a4d(0x460,0x22a)+_0x263a4d(_0xba370f._0x25fecc,_0xba370f._0x44f92c)+_0x263a4d(0x6ce,0x74e)};if(!_0x144dbd){const _0x3255f1={};return _0x3255f1['ok']=![],_0x3255f1[_0xff6f95(0x243,_0xba370f._0x467d50)]=_0xff6f95(0x54f,0x72e)+_0x263a4d(_0xba370f._0x2cfbcf,_0xba370f._0x1a39e2),_0x3255f1[_0x263a4d(0x4a3,0x288)]=_0xff6f95(_0xba370f._0x1de94a,_0xba370f._0x2dcdbd)+'p.reques'+_0x263a4d(_0xba370f._0x29e206,0x26a)+_0xff6f95(0x422,0x1b9)+_0x263a4d(0x3bf,0x4d8),_0x3255f1;}const _0xacc024=readRequiredString(_0x144dbd['deviceId']),_0x3dd40f=readRequiredString(_0x144dbd[_0x263a4d(0x23e,-_0xba370f._0x2ccffa)+'y']);function _0x263a4d(_0x40a260,_0x5550a4){return _0x26b3dd(_0x40a260- -_0x30ebe9._0x1b4a5b,_0x5550a4);}const _0xc358c5=readRequiredString(_0x144dbd[_0x263a4d(_0xba370f._0x45364d,0x60a)]),_0x3fef2b=_0x405afa[_0xff6f95(0x56f,_0xba370f._0x4b69d9)](normalizeScopeList,_0x144dbd[_0xff6f95(_0xba370f._0x59a05c,0x66b)]);if(!_0xacc024){const _0x432609={};return _0x432609['ok']=![],_0x432609[_0xff6f95(_0xba370f._0x262fe7,_0xba370f._0x46d097)]='invalid_'+_0xff6f95(0x579,0x4ed),_0x432609['message']=_0x405afa[_0x263a4d(_0xba370f._0x1bdf0a,_0xba370f._0x3f4e8e)],_0x432609;}function _0xff6f95(_0x41d63f,_0x540585){return _0x26b3dd(_0x41d63f- -0x3e8,_0x540585);}if(!_0x3dd40f){const _0x48281d={};return _0x48281d['ok']=![],_0x48281d[_0x263a4d(_0xba370f._0x1a9c5d,0x5b9)]=_0x263a4d(0x614,0x649)+_0x263a4d(_0xba370f._0x2cfbcf,_0xba370f._0x451b76),_0x48281d[_0x263a4d(0x4a3,0x57f)]=_0xff6f95(0xe0,_0xba370f._0x4ac408)+_0x263a4d(0x23e,-0x3e)+'y\x20is\x20req'+_0xff6f95(_0xba370f._0x346654,0x58a),_0x48281d;}if(!_0xc358c5){const _0x23f397={};return _0x23f397['ok']=![],_0x23f397[_0x263a4d(0x308,_0xba370f._0x412b53)]=_0xff6f95(0x54f,0x72b)+_0x263a4d(0x63e,_0xba370f._0x4acb0a),_0x23f397[_0x263a4d(0x4a3,0x207)]=_0x263a4d(0x1a5,0x2fe)+_0xff6f95(_0xba370f._0xc0ba54,0x219)+'required',_0x23f397;}if(_0x3fef2b['length']===0x0){const _0x574410={};return _0x574410['ok']=![],_0x574410[_0xff6f95(_0xba370f._0x262fe7,_0xba370f._0x426de1)]='invalid_'+'request',_0x574410['message']='payload.'+_0x263a4d(_0xba370f._0x4ea5bd,0x47c)+_0xff6f95(_0xba370f._0x1b4fbf,0x1ad)+_0xff6f95(0x512,_0xba370f._0x4d024f)+_0x263a4d(_0xba370f._0x4889b4,0x13)+_0x263a4d(0x53a,_0xba370f._0x3e2f57),_0x574410;}const _0x27073c={};_0x27073c[_0x263a4d(0x460,_0xba370f._0x3fe4c7)]=_0xacc024,_0x27073c[_0xff6f95(0x179,_0xba370f._0x2b375f)+'y']=_0x3dd40f,_0x27073c[_0x263a4d(0x480,_0xba370f._0x45f60f)]=_0xc358c5,_0x27073c[_0x263a4d(0x5cd,0x778)]=_0x3fef2b;const _0x164d51={};return _0x164d51['ok']=!![],_0x164d51[_0x263a4d(_0xba370f._0x4b37fe,0x2fb)]=_0x27073c,_0x164d51;}function readRequiredString(_0x5b792c){function _0x2e51af(_0x5f15bc,_0x1176b0){return _0x26b3dd(_0x1176b0- -0x616,_0x5f15bc);}return typeof _0x5b792c==='string'?_0x5b792c[_0x2e51af(-0xe7,0x1a0)]():'';}function normalizeScopeList(_0x342ef3){const _0x33f756={_0x9b26d8:0x5df,_0x3bef91:0x7db,_0x299325:0x33,_0x3cefe3:0x861,_0x349bcf:0x963},_0x52d047={_0x59f8ff:0x2c};if(!Array[_0x48e16c(0x6d8,_0x33f756._0x9b26d8)](_0x342ef3))return[];function _0x3441d8(_0x1ef9b0,_0x94a8a){return _0x26b3dd(_0x94a8a- -0x57f,_0x1ef9b0);}const _0x3c198b=new Set();function _0x48e16c(_0x482abb,_0x2e515f){return _0x26b3dd(_0x482abb- -_0x52d047._0x59f8ff,_0x2e515f);}for(const _0x2319ed of _0x342ef3){if(typeof _0x2319ed!==_0x48e16c(_0x33f756._0x3bef91,0x71d))continue;const _0x21a432=_0x2319ed[_0x3441d8(-_0x33f756._0x299325,0x237)]();_0x21a432&&_0x3c198b[_0x48e16c(_0x33f756._0x3cefe3,_0x33f756._0x349bcf)](_0x21a432);}return[..._0x3c198b][_0x3441d8(0x2b,0xce)]();}function buildRelayWsUrl(_0x5f1247){const _0x2976e9={_0x3abdf9:0x73e,_0x227b09:0x223,_0x1c93be:0x487,_0x2ce284:0x20e,_0x33d758:0x864,_0x5e9bef:0x70a,_0x11bb03:0x7bc,_0x517a6e:0x579,_0x2474ce:0x5f7,_0x30dec3:0x63d,_0xef5b4c:0x510,_0x3d0140:0x749,_0x25224c:0x85d,_0x246f1b:0xa4a,_0x3e33ff:0x3d7,_0x4b5bb0:0x568,_0x2c6e98:0x844,_0x5ebe88:0x84b,_0x167bd3:0x6e0,_0x3fa13a:0x47b,_0x57d8bb:0x4d5,_0x5514a2:0x3df},_0x1d8ac5={_0x529c2e:0x2b4},_0x1037e9={};_0x1037e9[_0xf820c(0x2a5,0x3b9)]=_0x1c7c3c(_0x2976e9._0x3abdf9,0x4dc);function _0xf820c(_0x26ad16,_0x3eee54){return _0x26b3dd(_0x3eee54- -_0x1d8ac5._0x529c2e,_0x26ad16);}const _0x377095=_0x1037e9,_0x58d010=new URL(_0x5f1247[_0xf820c(0x2d4,0x398)]);(!_0x58d010['pathname']||_0x58d010[_0xf820c(_0x2976e9._0x227b09,0x20e)]==='/')&&(_0x58d010[_0xf820c(_0x2976e9._0x1c93be,_0x2976e9._0x2ce284)]=_0x377095[_0x1c7c3c(0x495,0x224)]);_0x58d010[_0xf820c(_0x2976e9._0x33d758,_0x2976e9._0x5e9bef)+_0x1c7c3c(_0x2976e9._0x11bb03,_0x2976e9._0x517a6e)][_0x1c7c3c(0x510,0x49f)](_0xf820c(_0x2976e9._0x2474ce,0x561)+'d',_0x5f1247[_0x1c7c3c(_0x2976e9._0x30dec3,0x3b4)+'d']);function _0x1c7c3c(_0x575d68,_0x3e30f3){return _0x26b3dd(_0x575d68- -0x1d8,_0x3e30f3);}return _0x58d010[_0x1c7c3c(0x7e6,0x9b1)+_0xf820c(0x97e,0x6e0)][_0x1c7c3c(_0x2976e9._0xef5b4c,_0x2976e9._0x3d0140)](_0x1c7c3c(0x5cb,_0x2976e9._0x25224c),_0xf820c(0x6fe,0x45c)),_0x58d010[_0x1c7c3c(0x7e6,_0x2976e9._0x246f1b)+_0xf820c(0x508,0x6e0)][_0x1c7c3c(0x510,0x431)](_0x1c7c3c(_0x2976e9._0x3e33ff,0x2dc),_0x5f1247[_0x1c7c3c(0x816,_0x2976e9._0x4b5bb0)+'Id']),_0x58d010[_0xf820c(_0x2976e9._0x2c6e98,0x70a)+_0xf820c(_0x2976e9._0x5ebe88,_0x2976e9._0x167bd3)][_0x1c7c3c(_0x2976e9._0xef5b4c,0x371)](_0xf820c(0x2ec,_0x2976e9._0x3fa13a),_0x5f1247[_0xf820c(0x6f3,0x61f)+_0xf820c(0x36d,_0x2976e9._0x57d8bb)]),_0x58d010[_0xf820c(0x50f,_0x2976e9._0x5514a2)]();}function redactRelayWsUrl(_0x5a60cf){const _0x22c7a5={_0x4d00b1:0x15e,_0x37993d:0xe1,_0x3a1d66:0x38d,_0x4d1aab:0xe1,_0x42d97c:0x69,_0xaad7c0:0x555,_0x3e0a6e:0x2c8,_0x1cbb91:0xaa},_0x4c1a83={_0x3814e9:0x25e},_0x4561f6={_0xc2da2e:0x1be},_0x1eae7e=new URL(_0x5a60cf);function _0x34a334(_0xe4e25a,_0xaf8ada){return _0x3266d5(_0xaf8ada,_0xe4e25a- -_0x4561f6._0xc2da2e);}function _0x5f149b(_0x3c0387,_0x5cddbb){return _0x3266d5(_0x3c0387,_0x5cddbb- -_0x4c1a83._0x3814e9);}return _0x1eae7e['searchPa'+'rams'][_0x5f149b(_0x22c7a5._0x4d00b1,0x28e)](_0x34a334(_0x22c7a5._0x37993d,0x1f5))&&_0x1eae7e[_0x5f149b(_0x22c7a5._0x3a1d66,0x2d0)+_0x5f149b(0x53d,0x2a6)]['set'](_0x34a334(_0x22c7a5._0x4d1aab,_0x22c7a5._0x42d97c),_0x5f149b(_0x22c7a5._0xaad7c0,_0x22c7a5._0x3e0a6e)+'d>'),_0x1eae7e[_0x5f149b(-_0x22c7a5._0x1cbb91,-0x5b)]();}function normalizeText(_0x2f1726){const _0x468bbb={_0x3cb385:0x681,_0x21457d:0x553,_0x16d822:0x431,_0x4abe56:0x696,_0x15c91a:0x700,_0xa3afef:0x58,_0x5085ed:0x247,_0x3f1cf0:0x649,_0x13a3d5:0x506,_0x273cd8:0x3bb,_0x4df7a6:0x6d2,_0x3d6b57:0x545,_0xb4251:0x247,_0x320fae:0x553,_0x4f2c20:0x65f,_0x36df2e:0x532,_0x36c617:0x1d0},_0x5db26d={_0x491d44:0x44c},_0x1453d5={};_0x1453d5['yJmPx']=function(_0x436b25,_0x167dfe){return _0x436b25 instanceof _0x167dfe;};function _0x49b771(_0x2b2558,_0x4f56cc){return _0x26b3dd(_0x2b2558- -0xa5,_0x4f56cc);}_0x1453d5[_0x49b771(_0x468bbb._0x3cb385,0x3f4)]=_0x49b771(_0x468bbb._0x21457d,_0x468bbb._0x16d822);function _0x4774a6(_0x288cab,_0x675a5b){return _0x26b3dd(_0x675a5b- -_0x5db26d._0x491d44,_0x288cab);}const _0x6f2291=_0x1453d5,_0x61a510=(_0x4774a6(_0x468bbb._0x4abe56,0x4be)+'0')[_0x4774a6(0x22c,0x3c4)]('|');let _0x2869e3=0x0;while(!![]){switch(_0x61a510[_0x2869e3++]){case'0':return null;case'1':if(_0x6f2291[_0x49b771(0x74c,0x6b1)](_0x2f1726,ArrayBuffer))return Buffer[_0x49b771(_0x468bbb._0x15c91a,0x8a5)](_0x2f1726)[_0x4774a6(-_0x468bbb._0xa3afef,_0x468bbb._0x5085ed)](_0x6f2291[_0x49b771(_0x468bbb._0x3cb385,_0x468bbb._0x3f1cf0)]);continue;case'2':if(typeof _0x2f1726===_0x4774a6(_0x468bbb._0x13a3d5,_0x468bbb._0x273cd8))return _0x2f1726;continue;case'3':if(Buffer[_0x49b771(_0x468bbb._0x4df7a6,_0x468bbb._0x3d6b57)](_0x2f1726))return _0x2f1726[_0x4774a6(0xba,_0x468bbb._0xb4251)](_0x49b771(_0x468bbb._0x320fae,0x6b1));continue;case'4':if(Array[_0x49b771(_0x468bbb._0x4f2c20,0x7d0)](_0x2f1726))return Buffer[_0x4774a6(0x7a6,_0x468bbb._0x36df2e)](_0x2f1726)[_0x4774a6(0x226,0x247)](_0x4774a6(_0x468bbb._0x36c617,0x1ac));continue;}break;}}function normalizeBinary(_0x1899a4){const _0x3d0218={_0x82159a:0x511,_0x13e75d:0x401,_0x170bea:0x282,_0x434124:0x501},_0x18817c={};_0x18817c[_0x218aba(0x71e,_0x3d0218._0x82159a)]='string';const _0x20a851=_0x18817c;if(Buffer[_0x218aba(0x691,_0x3d0218._0x13e75d)](_0x1899a4))return _0x1899a4;function _0x1fe765(_0x58526b,_0xe9e2d7){return _0x3266d5(_0xe9e2d7,_0x58526b-0x134);}if(typeof _0x1899a4===_0x20a851['xNIHl'])return Buffer[_0x1fe765(0x449,0x3cb)](_0x1899a4,_0x218aba(0x1b5,_0x3d0218._0x170bea));if(Array[_0x218aba(_0x3d0218._0x434124,0x38e)](_0x1899a4))return Buffer['concat'](_0x1899a4);function _0x218aba(_0x1f96c8,_0x3c66de){return _0x3266d5(_0x1f96c8,_0x3c66de-0x11a);}return Buffer[_0x1fe765(0x449,0x512)](_0x1899a4);}function readRecentCliLogs(_0x48b34b){const _0x2d477a={_0x4190aa:0x220,_0xe09b21:0x2c3,_0xc58e11:0x548,_0x2dafd9:0x7ca,_0x289342:0x275,_0x1c4a5a:0x871,_0x41701b:0x80a,_0x1a99dd:0x788,_0x3f8a50:0x7e2,_0x1e2d35:0x323},_0x258718={_0x4789f9:0x47d},_0x471f7f={_0x4526cc:0x110},_0x4ae12e={'aKNYa':function(_0x504407){return _0x504407();},'FiwRN':function(_0x1d0c55,_0x1611b1){return _0x1d0c55(_0x1611b1);}},{logPath:_0x1f4e5b,errorLogPath:_0x11f9ff}=_0x4ae12e[_0x4a8a5b(0x564,0x2d3)](getServicePaths),_0x478171=_0x4ae12e[_0x128e68(_0x2d477a._0x4190aa,_0x2d477a._0xe09b21)](clampLines,_0x48b34b?.[_0x4a8a5b(_0x2d477a._0xc58e11,0x3d5)]??0xc8);function _0x4a8a5b(_0x249c5d,_0x39d283){return _0x26b3dd(_0x249c5d- -_0x471f7f._0x4526cc,_0x39d283);}const _0x23e1be=_0x48b34b?.[_0x4a8a5b(0x7eb,_0x2d477a._0x2dafd9)]??null,_0x38ca18=_0x23e1be!=null?Date[_0x128e68(0x35c,_0x2d477a._0x289342)]()-_0x23e1be:null;function _0x128e68(_0xb4905f,_0x91a541){return _0x26b3dd(_0x91a541- -_0x258718._0x4789f9,_0xb4905f);}const _0x15cf1b=[_0x1f4e5b];_0x48b34b?.['includeE'+_0x4a8a5b(_0x2d477a._0x1c4a5a,0x852)]&&_0x15cf1b[_0x4a8a5b(_0x2d477a._0x41701b,_0x2d477a._0x1a99dd)](_0x11f9ff);const _0x10d143=_0x15cf1b[_0x128e68(_0x2d477a._0x3f8a50,0x56d)](_0x3e232e=>readLogFile(_0x3e232e)),_0x38c5dc=_0x38ca18==null?_0x10d143:_0x10d143[_0x4a8a5b(0x84d,0x604)](_0x51f3ee=>_0x51f3ee['ts']!=null&&_0x51f3ee['ts']>=_0x38ca18);return _0x38c5dc[_0x128e68(-0x29c,0x1b)](-_0x478171)[_0x128e68(0x350,_0x2d477a._0x1e2d35)](_0x2e48a6=>_0x2e48a6[_0x128e68(0x49b,0x596)]);}async function buildDoctorReport(){const _0x40ba69={_0x4997da:0x82e,_0xe6ed74:0x63f,_0x3ebdd3:0x4b5,_0x430cc5:0x534,_0x27c7e2:0x761,_0x4d0833:0x8d6,_0x5d3fdc:0x62e,_0x4893fb:0x405,_0x4d3567:0x2f,_0x2f65ac:0xc2,_0x4cfd32:0x5e3,_0x564713:0x82c,_0x221ad2:0x3ab,_0x107564:0x89,_0x3a68cf:0x44a,_0xd282c8:0x3cf,_0x31257e:0x216,_0x2b4903:0x15,_0x4ecfb2:0x46d,_0x5b8c15:0xd3,_0x2c8bc2:0xbd,_0x3c9be0:0xfc,_0x5c05c5:0x19b,_0x1973e3:0x822},_0x16e0c7={_0x15214d:0x699},_0x5aa5b6={_0x132dfb:0x118},_0x2910b3={'rfLTG':function(_0x13cc9e){return _0x13cc9e();},'MlUqz':function(_0x19f629,_0x3aff5c){return _0x19f629(_0x3aff5c);},'KNotE':function(_0x26e59d){return _0x26e59d();},'knsNr':function(_0x105b05,_0x2b2b22){return _0x105b05(_0x2b2b22);}},_0x3dc303=readPairingConfig();function _0x2e56cb(_0x1029ff,_0x52591b){return _0x26b3dd(_0x52591b- -_0x5aa5b6._0x132dfb,_0x1029ff);}const _0x2aab73=_0x2910b3[_0x3154b9(-0x156,0xe4)](getServiceStatus),_0x1f2f88=readOpenClawInfo(),_0x3e32ff=resolveGatewayUrl(),_0x5894ad=await _0x2910b3[_0x2e56cb(0x7b8,_0x40ba69._0x4997da)](checkGatewayReachable,_0x3e32ff);function _0x3154b9(_0xf27578,_0x3325c6){return _0x26b3dd(_0x3325c6- -_0x16e0c7._0x15214d,_0xf27578);}return{'paired':Boolean(_0x3dc303),'gatewayId':_0x3dc303?.[_0x2e56cb(0x4e6,0x6fd)+'d']??null,'serverUrl':_0x3dc303?.[_0x2e56cb(_0x40ba69._0xe6ed74,_0x40ba69._0x3ebdd3)+'l']??null,'relayUrl':_0x3dc303?.[_0x2e56cb(0x641,_0x40ba69._0x430cc5)]??null,'instanceId':_0x3dc303?.[_0x2e56cb(_0x40ba69._0x27c7e2,_0x40ba69._0x4d0833)+'Id']??null,'serviceInstalled':_0x2aab73[_0x2e56cb(_0x40ba69._0x5d3fdc,_0x40ba69._0x4893fb)+'d'],'serviceRunning':_0x2aab73[_0x3154b9(0x369,0x1f0)],'serviceMethod':_0x2aab73[_0x3154b9(-_0x40ba69._0x4d3567,_0x40ba69._0x2f65ac)],'servicePath':_0x2aab73[_0x2e56cb(_0x40ba69._0x4cfd32,_0x40ba69._0x564713)+_0x2e56cb(0x5aa,_0x40ba69._0x221ad2)],'logPath':_0x2aab73[_0x3154b9(_0x40ba69._0x107564,0x201)],'errorLogPath':_0x2aab73[_0x2e56cb(_0x40ba69._0x3a68cf,_0x40ba69._0xd282c8)+'Path'],'openclawConfigDir':_0x2910b3[_0x2e56cb(0x5bc,0x64e)](getOpenClawConfigDir),'openclawMediaDir':getOpenClawMediaDir(),'openclawConfigFound':_0x1f2f88[_0x3154b9(_0x40ba69._0x31257e,_0x40ba69._0x2b4903)+_0x2e56cb(0x3d6,_0x40ba69._0x4ecfb2)],'openclawAuthMode':_0x1f2f88[_0x3154b9(0x108,_0x40ba69._0x5b8c15)],'openclawTokenFound':_0x2910b3[_0x3154b9(_0x40ba69._0x2c8bc2,0x2ad)](Boolean,_0x1f2f88[_0x3154b9(_0x40ba69._0x3c9be0,0x96)]),'openclawPasswordFound':_0x2910b3[_0x3154b9(-0x3c,-_0x40ba69._0x5c05c5)](Boolean,_0x1f2f88[_0x2e56cb(_0x40ba69._0x1973e3,0x7ff)]),'localGatewayUrl':_0x3e32ff,'localGatewayReachable':_0x5894ad};}async function ensurePairPrerequisites(){const _0x53025a={_0x457712:0x3d1,_0xb699f:0x6ea,_0xbb9a58:0x864,_0x3c1901:0x3ea,_0x3b63de:0x639,_0x553911:0x275,_0x54602d:0x854,_0x3f77d1:0x4af,_0x29fe97:0x657,_0x153d97:0x875,_0x550e2a:0x4c6,_0xc4aacd:0x397,_0x19e844:0x2d0,_0x4e70c5:0x7f7,_0x38cb06:0x78c},_0x51c6dd={_0x47b16c:0x1e0},_0x5ab7a7={};function _0x38ae5d(_0x2c0f14,_0x329c52){return _0x26b3dd(_0x2c0f14- -0x165,_0x329c52);}_0x5ab7a7['IOisX']='Cannot\x20c'+'omplete\x20'+'`clawket'+'\x20pair`\x20b'+_0x38ae5d(_0x53025a._0x457712,0x234)+'ocal\x20Ope'+'nClaw\x20pr'+'erequisi'+_0x4ffe5e(0x50b,0x6e7)+'not\x20read'+'y.';const _0x13a701=_0x5ab7a7,_0x3be608=await buildDoctorReport();function _0x4ffe5e(_0x5b15ff,_0x31a411){return _0x26b3dd(_0x5b15ff- -_0x51c6dd._0x47b16c,_0x31a411);}const _0x5ed2ec=listPairPrerequisiteFailures(_0x3be608);if(_0x5ed2ec[_0x4ffe5e(_0x53025a._0xb699f,0x4d2)]>0x0)throw new Error([_0x13a701[_0x38ae5d(0x83f,0x6ad)],..._0x5ed2ec[_0x4ffe5e(0x5c0,0x6a9)](_0x291e78=>'-\x20'+_0x291e78),_0x38ae5d(_0x53025a._0xbb9a58,0x734)+_0x38ae5d(_0x53025a._0x3c1901,_0x53025a._0x3b63de)+_0x4ffe5e(0x5a6,0x7b7)+_0x38ae5d(0x477,_0x53025a._0x553911)+_0x4ffe5e(0x763,_0x53025a._0x54602d)+_0x38ae5d(0x4bd,_0x53025a._0x3f77d1)+_0x38ae5d(_0x53025a._0x29fe97,0x3b1)+_0x4ffe5e(0x74b,0x73d)+'rce`\x20onl'+'y\x20if\x20you'+_0x38ae5d(_0x53025a._0x153d97,0xa4d)+'onally\x20w'+_0x4ffe5e(_0x53025a._0x550e2a,_0x53025a._0xc4aacd)+'ypass\x20th'+_0x38ae5d(0x57f,_0x53025a._0x19e844)+_0x38ae5d(_0x53025a._0x4e70c5,0x795)][_0x4ffe5e(_0x53025a._0x38cb06,0x6c3)]('\x0a'));return _0x3be608;}function listPairPrerequisiteFailures(_0x4a8f29){const _0x1db4c2={_0x15c5a4:0x221,_0x39571f:0x570,_0x1de26f:0x75a,_0x13c173:0x2af,_0x150b81:0x4e0,_0x39e85d:0x4f7,_0x5aad57:0x6c3,_0x153df5:0x709,_0x5377d3:0x568,_0x3cea98:0x43b,_0x2a61ab:0x5b0,_0x71bce0:0x676,_0x4cc2d4:0x6f0,_0xd1aa14:0x5d5,_0x557249:0x428,_0x4dcc7a:0xb8b,_0x14e5c5:0x365,_0x162eef:0x5b8,_0x50012a:0x60b,_0x4183e5:0x64d,_0x3625df:0x932,_0x399f16:0x94f,_0x3548a2:0x69a,_0x4c2077:0x827,_0x38a785:0x5c3,_0x235651:0x840,_0x2d4f0a:0x69f,_0x4d481a:0x7f5,_0x5f5362:0x898,_0x3093e8:0x7af,_0x5e4404:0x3d6,_0x5cde59:0x7d5,_0x4139a2:0x842,_0x24d542:0x8a9,_0x23c842:0x717,_0x43f0eb:0x693,_0x38fcd8:0x639,_0x26a029:0x39a,_0x316334:0x2fd,_0x3581ac:0x576,_0xa1f64c:0x13f,_0x2cbcd9:0x3de,_0x5ee420:0x6f2,_0x3d537c:0x914,_0x3ebcff:0x6b9,_0x31528d:0x59d,_0xcaa2d3:0x74b,_0x120e77:0x908,_0x57dbb0:0x945,_0x477f8b:0x457,_0xa55ecf:0x9b3,_0x4582e6:0xa39,_0x2eca7d:0x817,_0x3ebdd8:0x83a,_0x505767:0x6d3,_0x37ce81:0x890,_0x3b591d:0x90c,_0x36a739:0x43e},_0x1582db={_0x4a51fa:0x2c4},_0x3c2791={_0x350310:0x4bb},_0x6fa8b0={};_0x6fa8b0[_0x14ac85(_0x1db4c2._0x15c5a4,0x32f)]=_0x2fb2b5(_0x1db4c2._0x39571f,_0x1db4c2._0x1de26f),_0x6fa8b0[_0x2fb2b5(_0x1db4c2._0x13c173,_0x1db4c2._0x150b81)]='OpenClaw'+'\x20gateway'+_0x2fb2b5(_0x1db4c2._0x39e85d,0x75e)+_0x14ac85(_0x1db4c2._0x5aad57,_0x1db4c2._0x153df5)+'g.';const _0x4d7e10=_0x6fa8b0,_0x5c7579=[];!_0x4a8f29[_0x2fb2b5(_0x1db4c2._0x5377d3,0x5d5)+'ConfigFo'+_0x2fb2b5(_0x1db4c2._0x3cea98,_0x1db4c2._0x2a61ab)]&&_0x5c7579['push'](_0x14ac85(0x294,0x3d6)+_0x14ac85(_0x1db4c2._0x71bce0,0x6cb)+_0x2fb2b5(0x79f,0x549)+'found\x20un'+_0x14ac85(0x321,0x432)+formatOpenClawConfigLocations()+'.');function _0x2fb2b5(_0x1a6c4a,_0x31c5d4){return _0x3266d5(_0x1a6c4a,_0x31c5d4-_0x3c2791._0x350310);}function _0x14ac85(_0x3bab25,_0x2ad790){return _0x3266d5(_0x3bab25,_0x2ad790-_0x1582db._0x4a51fa);}return _0x4a8f29[_0x2fb2b5(_0x1db4c2._0x4cc2d4,_0x1db4c2._0xd1aa14)+'TokenFou'+'nd']&&_0x4a8f29[_0x2fb2b5(_0x1db4c2._0x557249,0x5d5)+_0x2fb2b5(_0x1db4c2._0x4dcc7a,0x908)+_0x14ac85(_0x1db4c2._0x14e5c5,_0x1db4c2._0x162eef)]&&_0x4a8f29[_0x14ac85(_0x1db4c2._0x50012a,0x3de)+'AuthMode']==null&&_0x5c7579['push'](_0x2fb2b5(0x79e,0x5cd)+_0x14ac85(0x3fc,_0x1db4c2._0x4183e5)+_0x2fb2b5(_0x1db4c2._0x3625df,0x985)+_0x2fb2b5(0x864,_0x1db4c2._0x399f16)+_0x14ac85(_0x1db4c2._0x3548a2,0x5ce)+_0x2fb2b5(_0x1db4c2._0x4c2077,_0x1db4c2._0x38a785)+'figured,'+_0x14ac85(0x975,_0x1db4c2._0x235651)+_0x14ac85(_0x1db4c2._0x2d4f0a,_0x1db4c2._0x4d481a)+_0x2fb2b5(0x43d,0x610)+_0x2fb2b5(0x6e4,_0x1db4c2._0x5f5362)),!_0x4a8f29[_0x2fb2b5(0x527,0x5d5)+_0x14ac85(0x440,0x6b9)+'nd']&&!_0x4a8f29[_0x14ac85(0x406,0x3de)+'Password'+_0x2fb2b5(0x9ad,_0x1db4c2._0x3093e8)]&&_0x5c7579['push'](_0x14ac85(0x313,_0x1db4c2._0x5e4404)+_0x14ac85(_0x1db4c2._0x5cde59,_0x1db4c2._0x4139a2)+_0x2fb2b5(_0x1db4c2._0x24d542,0x75c)+_0x2fb2b5(_0x1db4c2._0x23c842,_0x1db4c2._0x43f0eb)+_0x2fb2b5(0x7bf,_0x1db4c2._0x38fcd8)+_0x14ac85(_0x1db4c2._0x26a029,_0x1db4c2._0x316334)+_0x14ac85(_0x1db4c2._0x3581ac,0x521)),_0x4a8f29[_0x14ac85(_0x1db4c2._0xa1f64c,_0x1db4c2._0x2cbcd9)+_0x2fb2b5(_0x1db4c2._0x5ee420,0x7e6)]===_0x4d7e10[_0x2fb2b5(0x294,0x526)]&&!_0x4a8f29[_0x2fb2b5(0x514,0x5d5)+_0x14ac85(_0x1db4c2._0x3d537c,_0x1db4c2._0x3ebcff)+'nd']&&_0x5c7579[_0x14ac85(0x8d4,0x74e)](_0x4d7e10[_0x2fb2b5(0x47b,0x4e0)]),_0x4a8f29['openclaw'+'AuthMode']===_0x14ac85(_0x1db4c2._0x31528d,_0x1db4c2._0xcaa2d3)&&!_0x4a8f29['openclaw'+_0x2fb2b5(0x64e,_0x1db4c2._0x120e77)+'Found']&&_0x5c7579[_0x2fb2b5(0xa33,_0x1db4c2._0x57dbb0)](_0x2fb2b5(_0x1db4c2._0x477f8b,0x5cd)+_0x2fb2b5(_0x1db4c2._0xa55ecf,_0x1db4c2._0x4582e6)+'\x20passwor'+_0x2fb2b5(0x991,_0x1db4c2._0x2eca7d)+_0x14ac85(0x595,_0x1db4c2._0x3ebdd8)),!_0x4a8f29['localGat'+'ewayReac'+_0x14ac85(0x75b,_0x1db4c2._0x505767)]&&_0x5c7579[_0x2fb2b5(_0x1db4c2._0x37ce81,0x945)](_0x14ac85(0x7f3,0x723)+'enClaw\x20G'+_0x14ac85(0x769,0x754)+'s\x20not\x20re'+_0x2fb2b5(0x4e2,0x642)+_0x2fb2b5(0xbb8,_0x1db4c2._0x3b591d)+_0x4a8f29[_0x14ac85(0x1a1,_0x1db4c2._0x36a739)+_0x2fb2b5(0x7e2,0x53e)]+'.'),_0x5c7579;}function formatOpenClawConfigLocations(){const _0x4d3874={_0xca9f4c:0x5f7,_0x47de71:0x12c,_0x588422:0x2e9,_0x4ed2f0:0x837},_0x527d32={_0x4b5f14:0x364,_0xa2510d:0x5b9},_0x4e28c7={_0x4c8195:0xbb},_0x307bb6={_0x1201f5:0x674},_0x2e4379={'cLBiG':function(_0x194a62){return _0x194a62();},'nnOXF':'/root'};function _0x4bcf4c(_0x5a36ed,_0xbc0b7d){return _0x26b3dd(_0x5a36ed- -_0x307bb6._0x1201f5,_0xbc0b7d);}const _0x1dd4be=new Set();function _0x299ef0(_0x59f9dc,_0x117f6e){return _0x26b3dd(_0x117f6e-_0x4e28c7._0x4c8195,_0x59f9dc);}return[_0x2e4379[_0x299ef0(0x39c,_0x4d3874._0xca9f4c)](_0x152237),_0x2e4379[_0x299ef0(0x9d4,0xabf)]][_0x4bcf4c(_0x4d3874._0x47de71,-0x7a)](_0x27adc1=>_0x27adc1['trim']()+(_0x4bcf4c(-0x148,-0x3cd)+'aw'))[_0x299ef0(0xbbe,0xa18)](_0x183b6b=>_0x183b6b!=='/.opencl'+'aw')[_0x4bcf4c(_0x4d3874._0x588422,0x23d)](_0x7194cd=>{const _0x28cdfd={_0x4e4a75:0x38f};if(_0x1dd4be[_0x1367f2(_0x527d32._0x4b5f14,0x464)](_0x7194cd))return![];_0x1dd4be[_0x19a06c(_0x527d32._0xa2510d,0x848)](_0x7194cd);function _0x19a06c(_0xf5d71d,_0x481924){return _0x299ef0(_0x481924,_0xf5d71d- -_0x28cdfd._0x4e4a75);}function _0x1367f2(_0x5b203b,_0x360f5e){return _0x299ef0(_0x360f5e,_0x5b203b- -0x6d3);}return!![];})[_0x4bcf4c(0x2f8,0x3fe)](_0x299ef0(0x7ec,_0x4d3874._0x4ed2f0));}function readLogFile(_0x5f0534){const _0x37c258={_0x537d5c:0x514,_0x4f665c:0x770,_0x2d0ff4:0x879,_0x8c7edc:0x610},_0x1fd278={_0x4d716b:0x3ac};function _0x181314(_0xc193f6,_0x167c88){return _0x3266d5(_0x167c88,_0xc193f6-_0x1fd278._0x4d716b);}function _0x1bab80(_0x27e239,_0x44bea1){return _0x3266d5(_0x27e239,_0x44bea1-0x300);}try{const _0x1b8393=_0x1a6cae(_0x5f0534,_0x181314(_0x37c258._0x537d5c,_0x37c258._0x4f665c));return _0x1b8393['split'](/\r?\n/)[_0x181314(_0x37c258._0x2d0ff4,0xab3)](Boolean)[_0x1bab80(0x4c0,_0x37c258._0x8c7edc)](_0x4605e7=>({'raw':_0x4605e7,'ts':parseTimestamp(_0x4605e7)}));}catch{return[];}}function parseTimestamp(_0x54d1ba){const _0x440a22={_0x5f1779:0x8f8,_0x1cfce3:0xb67,_0x111f17:0x3a4,_0x35a1e1:0x426};function _0x25282b(_0x453dca,_0x4b9739){return _0x3266d5(_0x4b9739,_0x453dca-0x54b);}const _0x26d4a6=_0x54d1ba[_0x25282b(_0x440a22._0x5f1779,_0x440a22._0x1cfce3)](/^\[(\d{13})\]\s/);if(!_0x26d4a6)return null;const _0x199b17=Number(_0x26d4a6[0x1]);function _0x5e9107(_0x3e26de,_0x3722f2){return _0x3266d5(_0x3e26de,_0x3722f2- -0x67);}return Number[_0x5e9107(_0x440a22._0x111f17,_0x440a22._0x35a1e1)](_0x199b17)?_0x199b17:null;}function clampLines(_0x4108a1){const _0x5419a2={_0x18af1c:0x4fb,_0x50ad1a:0x4af},_0x3c78db={_0x339856:0x1a};function _0x5009c7(_0x450b66,_0x415f5d){return _0x26b3dd(_0x450b66- -0x422,_0x415f5d);}function _0x3ce58a(_0x5229ec,_0x121300){return _0x26b3dd(_0x121300-_0x3c78db._0x339856,_0x5229ec);}if(!Number[_0x5009c7(_0x5419a2._0x18af1c,0x29e)](_0x4108a1))return 0xc8;return Math[_0x3ce58a(_0x5419a2._0x50ad1a,0x616)](0x1,Math['min'](0x7d0,Math[_0x5009c7(0x3b7,0x2c7)](_0x4108a1)));}async function checkGatewayReachable(_0x5e03d7){const _0x492159={_0x5dd1dc:0x733,_0xeba41b:0x945,_0x18d9b3:0x4ad,_0x34a004:0x684},_0x360f5a={_0x2c6750:0x11f,_0x58eeb1:0x5a2,_0x51404d:0x315},_0x1c9955={'UXowz':function(_0x4c5f97,_0x5f2f1f){return _0x4c5f97(_0x5f2f1f);},'YOCbK':'timeout','IhnwG':_0xe6e1c0(_0x492159._0x5dd1dc,_0x492159._0xeba41b)+'1'};function _0x379dd6(_0x2b94ad,_0x56b7b2){return _0x26b3dd(_0x56b7b2- -0x4a9,_0x2b94ad);}function _0xe6e1c0(_0xfed7d7,_0x563fc8){return _0x26b3dd(_0x563fc8- -0x3,_0xfed7d7);}try{const _0xfbd3c=new URL(_0x5e03d7),_0x2d14c1=_0xfbd3c[_0x379dd6(0x267,0x3f2)]||_0x1c9955['IhnwG'],_0x16ba56=_0xfbd3c[_0x379dd6(0x1f8,_0x492159._0x18d9b3)]?Number(_0xfbd3c[_0x379dd6(_0x492159._0x34a004,0x4ad)]):_0xfbd3c['protocol']===_0x379dd6(0x4bc,0x403)?0x1bb:0x50;return await new Promise((_0x1e133e,_0x322757)=>{const _0x56f3dc={_0x2f4645:0x2d9},_0xebdcbe={_0xac6f81:0x2c9},_0x1a5e7b={_0x987ede:0x156},_0x3a1dfc={_0x2d8281:0x11c},_0x415b83=new Socket();_0x415b83[_0x3d62c6(0x4f3,0x37b)+'ut'](0x384),_0x415b83[_0x3d62c6(0x2a6,0x1ad)]('connect',()=>{_0x415b83[_0x52e0a6(0x5d7,0x498)]();function _0x52e0a6(_0x40a609,_0x10243d){return _0x3d62c6(_0x10243d,_0x40a609-0x4e0);}_0x1e133e();}),_0x415b83[_0x3d62c6(_0x360f5a._0x2c6750,0x1ad)](_0x1c9955[_0x3787ea(0x7fc,0x854)],()=>{_0x415b83['destroy'](),_0x322757(new Error('timeout'));}),_0x415b83[_0x3787ea(_0x360f5a._0x58eeb1,_0x360f5a._0x51404d)]('error',_0x44466e=>{function _0x4fb561(_0x12d15e,_0x13cb07){return _0x3d62c6(_0x13cb07,_0x12d15e- -_0x3a1dfc._0x2d8281);}_0x415b83[_0x239fa6(0x24d,0x7b)]();function _0x239fa6(_0x4ef545,_0x2a8338){return _0x3d62c6(_0x2a8338,_0x4ef545-_0x1a5e7b._0x987ede);}_0x1c9955[_0x4fb561(0x152,_0xebdcbe._0xac6f81)](_0x322757,_0x44466e);});function _0x3d62c6(_0x34984b,_0x528f7d){return _0x379dd6(_0x34984b,_0x528f7d- -0x11c);}function _0x3787ea(_0x43a3aa,_0x28e4d0){return _0x379dd6(_0x28e4d0,_0x43a3aa-_0x56f3dc._0x2f4645);}_0x415b83[_0x3d62c6(-0x370,-0xef)](_0x16ba56,_0x2d14c1);}),!![];}catch{return![];}}function parseLookbackToMs(_0x2b558e){const _0x5beb56={_0x1cccf1:0xab8,_0x52bd27:0x44e,_0x211b8b:0x4c1,_0x3565ff:0x9fb,_0x3bba1c:0x965,_0x4207fa:0xac1,_0x24dcef:0x830,_0x181f53:0x786,_0x1b7348:0x541,_0x531c86:0x7bc},_0x3c8639={_0x1b975a:0x4b8},_0x55b6e7=_0x2b558e?.[_0xf0ae3f(0x2ab,0x2c1)]();if(!_0x55b6e7)return null;function _0xf0ae3f(_0x493951,_0x197b24){return _0x3266d5(_0x493951,_0x197b24- -0x65);}const _0x4303a=_0x55b6e7[_0x3c1566(_0x5beb56._0x1cccf1,0x865)](/^(\d+)(ms|s|m|h|d)$/i);if(!_0x4303a)throw new Error(_0x3c1566(_0x5beb56._0x52bd27,_0x5beb56._0x211b8b)+_0x3c1566(0x6cd,0x8c6)+_0xf0ae3f(0x3d9,0x243)+_0x55b6e7+(_0x3c1566(0x7a5,_0x5beb56._0x3565ff)+_0x3c1566(0x97f,_0x5beb56._0x3bba1c)+_0x3c1566(_0x5beb56._0x4207fa,_0x5beb56._0x24dcef)+_0x3c1566(_0x5beb56._0x181f53,_0x5beb56._0x1b7348)+'or\x201d.'));const _0x3addd6=Number(_0x4303a[0x1]);function _0x3c1566(_0x46dc98,_0x510899){return _0x3266d5(_0x46dc98,_0x510899-_0x3c8639._0x1b975a);}const _0x41475a=_0x4303a[0x2]['toLowerC'+_0x3c1566(_0x5beb56._0x531c86,0x70f)](),_0x4a3c55=_0x41475a==='ms'?0x1:_0x41475a==='s'?0x3e8:_0x41475a==='m'?0xea60:_0x41475a==='h'?0x36ee80:0x5265c00;return _0x3addd6*_0x4a3c55;}import{networkInterfaces}from'os';var BLOCKED_INTERFACE_TOKENS=['utun','tun',_0x3266d5(0x733,0x4d4),_0x26b3dd(0x642,0x6ae)+'e','wireguar'+'d','wg',_0x3266d5(0x2e0,0x387),_0x26b3dd(0x5f6,0x5f0),_0x26b3dd(0x9af,0x9be),_0x26b3dd(0x67b,0x529),_0x3266d5(-0x54,0x52),_0x3266d5(0x428,0x3ff),'loopback','\x20lo',_0x3266d5(0x584,0x3d8),_0x3266d5(-0xf0,0xad),_0x26b3dd(0x966,0xb0e),_0x3266d5(0x650,0x545),_0x26b3dd(0x9e4,0x783),_0x26b3dd(0x812,0x5a9)];function buildLocalPairingInfo(_0x3bca3e){const _0x59f48d={_0x27ab52:0x879,_0x84fd:0x72e,_0x3830f7:0x7e3,_0x56a58c:0x96e,_0x20851e:0x74f,_0x425024:0x8ef,_0x556d6d:0x4f7,_0x3ce404:0x663,_0x287bda:0x233,_0x5b5a16:0x17a,_0x291fe5:0x17e,_0x511be4:0x362};function _0x6fea6b(_0x3261d0,_0x366fed){return _0x3266d5(_0x366fed,_0x3261d0-0x491);}const _0x5bc024={'PcmgL':function(_0x491e09,_0x22fda2){return _0x491e09(_0x22fda2);},'BRlij':function(_0x39495a,_0x503431){return _0x39495a*_0x503431;}},_0x18d3b8=_0x5bc024[_0x6fea6b(_0x59f48d._0x27ab52,0x68b)](resolveLocalPairAuth,_0x3bca3e),_0x11918a={};_0x11918a['explicit'+'Url']=_0x3bca3e[_0x6fea6b(_0x59f48d._0x84fd,0x6ba)+_0x6fea6b(_0x59f48d._0x3830f7,_0x59f48d._0x56a58c)],_0x11918a[_0x6fea6b(0x7b3,_0x59f48d._0x20851e)+_0x6fea6b(0x795,_0x59f48d._0x425024)+'l']=_0x3bca3e[_0x6fea6b(0x7b3,_0x59f48d._0x556d6d)+_0x1a85fb(-0x76,0x1df)+'l'];function _0x1a85fb(_0x3028f1,_0x3c430a){return _0x3266d5(_0x3028f1,_0x3c430a- -0x125);}const _0x54c7dc=resolveLocalPairGatewayUrl(_0x11918a),_0x4aa370=_0x3bca3e['expiresA'+'t']??Date[_0x1a85fb(-0xa3,0x13d)]()+_0x5bc024[_0x6fea6b(_0x59f48d._0x3ce404,0x826)](0xa*0x3c,0x3e8);return{'gatewayUrl':_0x54c7dc,'expiresAt':_0x4aa370,'authMode':_0x18d3b8['mode'],'qrPayload':buildGatewayQrPayload({'gatewayUrl':_0x54c7dc,'token':_0x18d3b8[_0x1a85fb(_0x59f48d._0x287bda,_0x59f48d._0x5b5a16)],'password':_0x18d3b8[_0x1a85fb(_0x59f48d._0x291fe5,_0x59f48d._0x511be4)],'expiresAt':_0x4aa370})};}function resolveLocalPairGatewayUrl(_0x52c1bf){const _0x13532e={_0x1cb038:0x763,_0x1bc4cc:0x918,_0x2c0425:0x67e,_0x33cb20:0x7d0,_0x43b4bc:0x8a6,_0xbf0fd6:0x88c,_0x34f70e:0x7b5,_0x185d5c:0x769,_0x3f0b2c:0xa32,_0x4a391d:0x7bd,_0x1a2e92:0x701,_0x4e9071:0x944,_0x3ab46b:0x823,_0x125c80:0x70f,_0x4f3ad5:0x7b9,_0x26b313:0x9ee,_0x38a8cf:0x52d,_0x59c0b3:0x652},_0x4e0b9d={_0x541b6a:0x4cc},_0x401be4={_0xdbc8d2:0x358},_0xe84210={'erNIu':function(_0x1658dd){return _0x1658dd();},'GsjmC':function(_0x503ef5,_0x4bc7ec,_0x228190){return _0x503ef5(_0x4bc7ec,_0x228190);}},_0x22047e=_0x52c1bf?.[_0x3776d8(_0x13532e._0x1cb038,0x5f5)+'Url']?.[_0x3776d8(_0x13532e._0x1bc4cc,_0x13532e._0x2c0425)]();if(_0x22047e)return normalizeExplicitGatewayUrl(_0x22047e);function _0x3776d8(_0x4ca731,_0xed2273){return _0x3266d5(_0x4ca731,_0xed2273-_0x401be4._0xdbc8d2);}function _0x5aa7a5(_0xa61fa6,_0x4da182){return _0x3266d5(_0x4da182,_0xa61fa6-_0x4e0b9d._0x541b6a);}const _0x514871=_0x52c1bf?.[_0x3776d8(0x712,0x67a)+_0x5aa7a5(_0x13532e._0x33cb20,_0x13532e._0x43b4bc)+'l']?.[_0x5aa7a5(0x7f2,0x895)]()||_0xe84210[_0x3776d8(0x85c,_0x13532e._0xbf0fd6)](resolveGatewayUrl),_0x30ad6c=_0xe84210['erNIu'](detectLanIp);if(!_0x30ad6c)throw new Error(_0x3776d8(0x8c4,_0x13532e._0x34f70e)+_0x5aa7a5(0x9e1,_0x13532e._0x185d5c)+_0x5aa7a5(_0x13532e._0x3f0b2c,_0x13532e._0x4a391d)+_0x5aa7a5(_0x13532e._0x1a2e92,_0x13532e._0x4e9071)+_0x5aa7a5(0x7a0,_0x13532e._0x3ab46b)+_0x5aa7a5(_0x13532e._0x125c80,_0x13532e._0x4f3ad5)+_0x5aa7a5(_0x13532e._0x26b313,0x821)+_0x3776d8(0x862,0x890)+_0x3776d8(_0x13532e._0x38a8cf,_0x13532e._0x59c0b3)+'eway\x20URL'+'.');return _0xe84210['GsjmC'](rewriteGatewayHost,_0x514871,_0x30ad6c);}function normalizeExplicitGatewayUrl(_0x103e15){const _0x1bb99d={_0x29b82a:0x540,_0x334e68:0xb68},_0x51ef60={_0x27317a:0x50f};function _0xe368b4(_0x3dcb7a,_0x568a66){return _0x3266d5(_0x568a66,_0x3dcb7a-_0x51ef60._0x27317a);}function _0x32df98(_0x5e99b4,_0x1eb8f9){return _0x3266d5(_0x5e99b4,_0x1eb8f9-0x52b);}const _0x538e9e=_0x103e15[_0xe368b4(0x835,0x6b0)](),_0x53a937=/^[a-z]+:\/\//i[_0x32df98(0x78a,_0x1bb99d._0x29b82a)](_0x538e9e)?_0x538e9e:_0x32df98(0x652,0x60d)+_0x538e9e;return normalizeGatewayQrUrl(_0x53a937)[_0x32df98(_0x1bb99d._0x334e68,0x9a6)];}function rewriteGatewayHost(_0x206240,_0x3eec4d){const _0x554838={_0x29c788:0x157,_0xe7b042:0x165,_0x2d060c:0x107,_0x15c720:0xed,_0x159ec5:0x676,_0xed4ed8:0x4fd},_0x21a05d={_0x3172e4:0x1cf},_0x4928da={_0x403b3b:0xf2};function _0x3a8a26(_0x3e383b,_0x3ba07c){return _0x3266d5(_0x3e383b,_0x3ba07c-_0x4928da._0x403b3b);}const _0x52eaab=_0x206240[_0xe6d3b9(_0x554838._0x29c788,-_0x554838._0xe7b042)](),_0x5d076f=/^[a-z]+:\/\//i[_0x3a8a26(-0x13a,_0x554838._0x2d060c)](_0x52eaab)?_0x52eaab:_0xe6d3b9(-_0x554838._0x15c720,0x1a7)+_0x52eaab,_0x275c63=new URL(_0x5d076f);function _0xe6d3b9(_0x597ca0,_0x2905ed){return _0x3266d5(_0x2905ed,_0x597ca0- -_0x21a05d._0x3172e4);}return _0x275c63[_0x3a8a26(_0x554838._0x159ec5,_0x554838._0xed4ed8)]=_0x3eec4d,normalizeGatewayQrUrl(_0x275c63['toString']())['url'];}function detectLanIp(){const _0x4bac88={_0x2a007e:0x46a,_0xb2cb86:0x1ac,_0x2ab98a:0x201},_0x4d635e={'EVgHQ':function(_0x5d6f09){return _0x5d6f09();}};function _0x111c7c(_0x293a11,_0x5dde92){return _0x3266d5(_0x293a11,_0x5dde92-0x38c);}const _0x222c65=_0x4d635e[_0x111c7c(_0x4bac88._0x2a007e,0x58e)](networkInterfaces);function _0xc01ed1(_0x420e76,_0x35f277){return _0x3266d5(_0x420e76,_0x35f277- -0x268);}let _0x37e5b4=null;for(const [_0x30bd6c,_0x433fb4]of Object['entries'](_0x222c65)){for(const _0x59be33 of _0x433fb4??[]){if(_0x59be33[_0xc01ed1(0x39e,0x246)]!=='IPv4')continue;const _0x5a408a=scoreLanCandidate(_0x30bd6c,_0x59be33[_0xc01ed1(-0xa9,_0x4bac88._0xb2cb86)]);if(_0x5a408a===0x0)continue;if(!_0x37e5b4||_0x5a408a>_0x37e5b4[_0xc01ed1(-0x20e,-_0x4bac88._0x2ab98a)]){const _0x38e9d7={};_0x38e9d7['score']=_0x5a408a,_0x38e9d7['ip']=_0x59be33['address'],_0x37e5b4=_0x38e9d7;}}}return _0x37e5b4?.['ip']??null;}function scoreLanCandidate(_0x2ace30,_0x29e52c){const _0x5c06a7={_0x19c31e:0x40b,_0x2603a9:0x46d,_0x3997ce:0x3bc,_0x1c4112:0x2a7,_0x1875b2:0x24c,_0x49f613:0x8c2,_0xd9b658:0x23b,_0x57ee7f:0x383},_0x159282={_0x1a5deb:0x20e};if(!isLanIpv4(_0x29e52c))return 0x0;const _0x36b921=_0x2ace30[_0x3f4706(0x860,0x761)+_0x1bb349(0x39a,_0x5c06a7._0x19c31e)]();if(BLOCKED_INTERFACE_TOKENS['some'](_0x3eaa87=>_0x36b921[_0x1bb349(0x600,0x6dd)](_0x3eaa87)))return 0x0;let _0x552135=isRfc1918(_0x29e52c)?0x78:isCgnat(_0x29e52c)?0x5a:0x28;function _0x3f4706(_0x5b0d1d,_0x107c80){return _0x3266d5(_0x5b0d1d,_0x107c80-_0x159282._0x1a5deb);}(_0x36b921[_0x1bb349(_0x5c06a7._0x2603a9,_0x5c06a7._0x3997ce)+'th']('en')||_0x36b921['startsWi'+'th'](_0x1bb349(0x353,_0x5c06a7._0x1c4112))||_0x36b921[_0x1bb349(0x46d,_0x5c06a7._0x1875b2)+'th'](_0x3f4706(_0x5c06a7._0x49f613,0x703))||_0x36b921[_0x3f4706(0x471,0x538)+'th']('wl')||_0x36b921['includes'](_0x3f4706(0x224,_0x5c06a7._0xd9b658))||_0x36b921[_0x1bb349(0x600,0x3d5)](_0x1bb349(_0x5c06a7._0x57ee7f,0x1d4)))&&(_0x552135+=0x14);function _0x1bb349(_0x2d5535,_0x2a247b){return _0x3266d5(_0x2a247b,_0x2d5535-0x143);}return _0x552135;}function resolveLocalPairAuth(_0x106eb9){const _0x1ca137={_0xb3b389:0x4f0,_0x3e7e6b:0x322,_0x5be7c2:0x83a,_0x5aaf3b:0x6a0,_0x398a88:0x323,_0x56c0ac:0x664,_0x486165:0x481,_0x338e67:0x503,_0x310a70:0x8b6,_0x593f57:0x75b,_0x3e387c:0x7b5,_0x568311:0xa3b},_0xcd1bbf={_0x4bbed9:0x1dd},_0x378fef={_0x10d798:0x514};function _0x2493a1(_0x188778,_0x1cf02a){return _0x3266d5(_0x1cf02a,_0x188778-_0x378fef._0x10d798);}if(_0x106eb9[_0x1390b2(0x4fb,0x4e8)+_0x1390b2(_0x1ca137._0xb3b389,_0x1ca137._0x3e7e6b)]?.[_0x2493a1(_0x1ca137._0x5be7c2,_0x1ca137._0x5aaf3b)]())return{'mode':_0x1390b2(_0x1ca137._0x398a88,0x47c),'token':_0x106eb9['gatewayT'+'oken']['trim'](),'password':null};if(_0x106eb9['gatewayP'+'assword']?.[_0x2493a1(_0x1ca137._0x5be7c2,0x969)]())return{'mode':_0x1390b2(0x6ee,_0x1ca137._0x56c0ac),'token':null,'password':_0x106eb9['gatewayP'+_0x2493a1(0x7d6,0x84b)][_0x1390b2(_0x1ca137._0x486165,_0x1ca137._0x338e67)]()};function _0x1390b2(_0xf5e6f9,_0x3676d){return _0x3266d5(_0xf5e6f9,_0x3676d-_0xcd1bbf._0x4bbed9);}throw new Error(_0x2493a1(0x626,0x5f0)+_0x1390b2(_0x1ca137._0x310a70,_0x1ca137._0x593f57)+_0x2493a1(_0x1ca137._0x3e387c,_0x1ca137._0x568311)+_0x1390b2(0x565,0x3b5)+_0x2493a1(0x692,0x509)+'or\x20passw'+'ord).');}function isLanIpv4(_0x41510a){const _0x232eef={_0x548b56:0x829,_0x5a1358:0x875,_0x395255:0x71c,_0x5ede6e:0x2df},_0x1cd01b={_0x113b74:0x328},_0xe4f859={'hvrIx':function(_0x28ac23,_0x55c598){return _0x28ac23>=_0x55c598;},'LXcbo':function(_0x50dd7a,_0x482c8e){return _0x50dd7a===_0x482c8e;},'noRMw':function(_0x16f38c,_0x1aeb14){return _0x16f38c(_0x1aeb14);}};if(!isValidIpv4(_0x41510a))return![];if(_0x41510a===_0x288c01(_0x232eef._0x548b56,_0x232eef._0x5a1358))return![];function _0x288c01(_0xe730c2,_0x5f48a7){return _0x26b3dd(_0xe730c2- -0x1de,_0x5f48a7);}const [_0x1c0f0f,_0x3ad886,_0x2fbe94,_0x17932f]=_0x41510a['split']('.')[_0x5bc6fa(_0x232eef._0x395255,0x478)](Number);if(_0x1c0f0f===0x7f)return![];if(_0x1c0f0f===0xa9&&_0x3ad886===0xfe)return![];if(_0xe4f859['hvrIx'](_0x1c0f0f,0xe0)&&_0x1c0f0f<=0xef)return![];if(_0x1c0f0f===0xff&&_0x3ad886===0xff&&_0x2fbe94===0xff&&_0x17932f===0xff)return![];function _0x5bc6fa(_0x2e07ca,_0x5697e3){return _0x26b3dd(_0x5697e3- -_0x1cd01b._0x113b74,_0x2e07ca);}if(_0x1c0f0f===0xc6&&(_0xe4f859[_0x5bc6fa(0x113,_0x232eef._0x5ede6e)](_0x3ad886,0x12)||_0x3ad886===0x13))return![];return isRfc1918(_0x41510a)||_0xe4f859[_0x5bc6fa(0x566,0x514)](isCgnat,_0x41510a);}function isRfc1918(_0x20b8e4){const _0xd076f2={_0x4d424d:0x281,_0x2734cb:0x62c,_0x2be8e8:0x152},_0x5d4a64={};function _0x73580a(_0x5bbd9a,_0x46e28e){return _0x3266d5(_0x46e28e,_0x5bbd9a-0x114);}_0x5d4a64['wdKQF']=function(_0x39a3a6,_0x3c49b5){return _0x39a3a6===_0x3c49b5;},_0x5d4a64['RhpmH']=function(_0x45e75c,_0x273b7b){return _0x45e75c<=_0x273b7b;},_0x5d4a64[_0x34b32c(0x55a,0x305)]=function(_0x34e045,_0x1d3f08){return _0x34e045===_0x1d3f08;};function _0x34b32c(_0x392138,_0x4db4db){return _0x3266d5(_0x392138,_0x4db4db-0x12e);}const _0x1ac221=_0x5d4a64,[_0x28d737,_0xfb3e2c]=_0x20b8e4[_0x73580a(0x494,_0xd076f2._0x4d424d)]('.')[_0x34b32c(_0xd076f2._0x2734cb,0x43e)](Number);return _0x1ac221['wdKQF'](_0x28d737,0xa)||_0x28d737===0xac&&_0xfb3e2c>=0x10&&_0x1ac221[_0x73580a(0x1e8,_0xd076f2._0x2be8e8)](_0xfb3e2c,0x1f)||_0x28d737===0xc0&&_0x1ac221['XeQvo'](_0xfb3e2c,0xa8);}function isCgnat(_0x9ea571){const _0x4e2096={_0x569a22:0x6da,_0x57d87c:0x3d5,_0x26a413:0x562},_0x2a8f64={};_0x2a8f64['hHfBj']=function(_0x44da4d,_0x2f1b4d){return _0x44da4d===_0x2f1b4d;};const _0x2b394c=_0x2a8f64;function _0x1afcec(_0x1466eb,_0x4d76e2){return _0x26b3dd(_0x4d76e2- -0x3cb,_0x1466eb);}const [_0xf77dea,_0x30a528]=_0x9ea571[_0x15b9b5(_0x4e2096._0x569a22,0x4ec)]('.')[_0x1afcec(0x448,_0x4e2096._0x57d87c)](Number);function _0x15b9b5(_0x5c6c3b,_0x363e4e){return _0x26b3dd(_0x5c6c3b- -0x136,_0x363e4e);}return _0x2b394c[_0x15b9b5(_0x4e2096._0x26a413,0x43a)](_0xf77dea,0x64)&&_0x30a528>=0x40&&_0x30a528<=0x7f;}function isValidIpv4(_0x488d0c){const _0x5bea66={_0x358b57:0x78b,_0x2dc0b2:0x977,_0xbb9ad2:0x6e5,_0x3cf7f4:0x5a4},_0x106e62={_0x4a8ce5:0x66,_0x940042:0x1ef},_0x31797a={_0x2670fc:0x16a},_0xb1980={_0x322305:0x365};function _0x392623(_0x14db48,_0x4df3fd){return _0x3266d5(_0x4df3fd,_0x14db48-_0xb1980._0x322305);}function _0x1a8b5f(_0x3119e5,_0x5c031d){return _0x3266d5(_0x5c031d,_0x3119e5-_0x31797a._0x2670fc);}const _0x59769e={};_0x59769e[_0x392623(_0x5bea66._0x358b57,_0x5bea66._0x2dc0b2)]=function(_0x39c5d8,_0x2a983d){return _0x39c5d8<=_0x2a983d;};const _0x24d518=_0x59769e,_0x433d1e=_0x488d0c[_0x392623(_0x5bea66._0xbb9ad2,0x62f)]('.');return _0x433d1e[_0x1a8b5f(_0x5bea66._0x3cf7f4,0x317)]===0x4&&_0x433d1e['every'](_0x2d2935=>{function _0x24f9f5(_0x23a389,_0x2b1b82){return _0x392623(_0x2b1b82- -0x18b,_0x23a389);}if(!/^\d+$/[_0x24f9f5(-_0x106e62._0x4a8ce5,_0x106e62._0x940042)](_0x2d2935))return![];const _0x447d1a=Number(_0x2d2935);function _0x3e8fb4(_0x487d4b,_0x30a1bf){return _0x392623(_0x30a1bf- -0x57,_0x487d4b);}return _0x447d1a>=0x0&&_0x24d518[_0x24f9f5(0x582,0x600)](_0x447d1a,0xff);});}import{readFileSync as _0xe59c3b}from'fs';import{dirname as _0x4e958e,resolve as _0x2b5792}from'path';import{fileURLToPath}from'url';function readCliVersion(){const _0x2989d6={_0x36ddb3:0x4c2,_0x19afc0:0x491,_0xd29596:0x22c,_0x4c214d:0x13f},_0x3474f1=_0x4e958e(fileURLToPath(import.meta.url)),_0x5bb518=_0x2b5792(_0x3474f1,_0x525611(0x3da,0x2d0)+_0x9777a5(_0x2989d6._0x36ddb3,_0x2989d6._0x19afc0)),_0x29ff07=_0xe59c3b(_0x5bb518,_0x525611(_0x2989d6._0xd29596,0x338)),_0x1d57fb=JSON[_0x525611(_0x2989d6._0x4c214d,-0xa1)](_0x29ff07);function _0x9777a5(_0x1fa32b,_0x365e76){return _0x3266d5(_0x365e76,_0x1fa32b-0x78);}function _0x525611(_0x5a7bd4,_0x4b3c41){return _0x3266d5(_0x4b3c41,_0x5a7bd4-0xc4);}return _0x1d57fb['version']??_0x525611(0x130,0x70);}function buildPairingJson(_0x3af47b,_0x47574e,_0x18f958,_0x42e481){const _0x2b4039={_0x41a402:0x527,_0xb86825:0x6fc,_0x56d413:0x94b,_0x56151c:0x322,_0xeefeef:0x4fe,_0x4d825a:0x765,_0x34ce42:0x57e,_0x45690c:0x978,_0x47e916:0x3dd,_0xf8638b:0xa4,_0x2f4604:0x4b9,_0xc4b292:0x90b,_0x204c9e:0x5bc,_0x3ba9f2:0x89a,_0x57c7a6:0x923,_0x213db1:0x5f7,_0x35d5ae:0x838,_0x1c00bb:0x45c,_0x178a13:0x10b,_0x4e59fd:0x81f,_0x2b1285:0x8c8,_0x21517c:0x59a,_0x52ca96:0x146,_0x21afa8:0x7d,_0x599096:0x22e,_0x57bdb5:0x9f8,_0x573ad6:0x8ac,_0x5be7bd:0xb37,_0x507bb2:0x325,_0x5e6977:0x106,_0x597361:0x334,_0x42e7a5:0x63c,_0x230c05:0x63c,_0x48577a:0x5bf,_0x318ab3:0x8cb,_0x47fbb4:0x69b,_0x457a52:0x4cd,_0x491b4:0x6ed,_0x34db88:0x804,_0x1b606b:0x5e2},_0x76c4c1={_0x274a2b:0xd7},_0x5632df={_0x3ecebb:0x49a},_0x423396={};_0x423396[_0x26623f(_0x2b4039._0x41a402,_0x2b4039._0xb86825)+'d']=_0x18f958[_0x26623f(_0x2b4039._0x41a402,0x556)+'d'],_0x423396[_0x26623f(0x893,_0x2b4039._0x56d413)]=_0x18f958[_0x422559(_0x2b4039._0x56151c,_0x2b4039._0xeefeef)],_0x423396[_0x26623f(_0x2b4039._0x4d825a,_0x2b4039._0x34ce42)]=_0x18f958[_0x26623f(0x765,0x93b)];function _0x26623f(_0xb2b860,_0x444e56){return _0x3266d5(_0x444e56,_0xb2b860-_0x5632df._0x3ecebb);}_0x423396[_0x26623f(0x94e,_0x2b4039._0x45690c)+_0x26623f(0x4cd,0x53c)]=_0x18f958[_0x422559(_0x2b4039._0x47e916,0x58a)+_0x422559(-_0x2b4039._0xf8638b,0xfa)],_0x423396[_0x422559(0x333,_0x2b4039._0x2f4604)]=_0x18f958[_0x26623f(0x8a4,_0x2b4039._0xc4b292)],_0x423396['errorLog'+_0x26623f(_0x2b4039._0x204c9e,0x405)]=_0x18f958['errorLog'+'Path'],_0x423396[_0x26623f(_0x2b4039._0x3ba9f2,_0x2b4039._0x57c7a6)]=_0x18f958[_0x26623f(_0x2b4039._0x3ba9f2,0x84e)];const _0x37c56e={};_0x37c56e['ok']=!![],_0x37c56e[_0x26623f(_0x2b4039._0x213db1,_0x2b4039._0x35d5ae)]=_0x3af47b['action'],_0x37c56e[_0x422559(0x25f,_0x2b4039._0x1c00bb)]=_0x42e481,_0x37c56e[_0x422559(0x2ae,_0x2b4039._0x178a13)+'d']=_0x3af47b['config'][_0x26623f(_0x2b4039._0x4e59fd,_0x2b4039._0x2b1285)+'d'],_0x37c56e[_0x26623f(0x656,_0x2b4039._0x21517c)]=_0x3af47b[_0x422559(-0x7d,-0x1e1)][_0x422559(0xe5,-_0x2b4039._0x52ca96)],_0x37c56e['serverUr'+'l']=_0x3af47b[_0x422559(-_0x2b4039._0x21afa8,-_0x2b4039._0x599096)][_0x422559(0x66,-0x24d)+'l'],_0x37c56e[_0x26623f(_0x2b4039._0x57bdb5,_0x2b4039._0x573ad6)+'Id']=_0x3af47b[_0x422559(-0x7d,0x18b)][_0x422559(0x487,0x6fb)+'Id'],_0x37c56e[_0x26623f(0x896,_0x2b4039._0x5be7bd)+'de']=_0x3af47b['accessCo'+'de'],_0x37c56e[_0x422559(_0x2b4039._0x507bb2,_0x2b4039._0x5e6977)+_0x422559(0x14d,_0x2b4039._0x597361)+_0x26623f(_0x2b4039._0x42e7a5,0x6f3)]=_0x3af47b[_0x422559(0x325,0x5e5)+'deExpire'+_0x26623f(_0x2b4039._0x230c05,_0x2b4039._0x48577a)],_0x37c56e[_0x26623f(_0x2b4039._0x318ab3,_0x2b4039._0x47fbb4)+_0x26623f(_0x2b4039._0x457a52,_0x2b4039._0x491b4)]=_0x47574e,_0x37c56e[_0x26623f(_0x2b4039._0x34db88,_0x2b4039._0x1b606b)]=_0x423396;function _0x422559(_0x1ddcf5,_0xbea375){return _0x3266d5(_0xbea375,_0x1ddcf5- -_0x76c4c1._0x274a2b);}return _0x37c56e;}function buildLocalPairingJson(_0x2e3d04){const _0x1254b8={_0x2d2915:0x61a,_0x2a1b0b:0x367,_0x2e5365:0x4f3,_0x2fd51a:0x247,_0x41a8f8:0x102,_0x6be0b4:0x188,_0x1c27f9:0x38c,_0x58738c:0x39c},_0x2d0a31={_0x40a748:0x95},_0x352548={_0x5855fb:0x130},_0x238faf={};_0x238faf[_0x61fd64(_0x1254b8._0x2d2915,0x5f4)]=_0x61fd64(0x132,_0x1254b8._0x2a1b0b);function _0x61fd64(_0x3d5480,_0x1e44b2){return _0x3266d5(_0x3d5480,_0x1e44b2-_0x352548._0x5855fb);}const _0x510ea6=_0x238faf,_0x19c160={};function _0x2da3a1(_0x4b5cc0,_0x3aa8ce){return _0x3266d5(_0x4b5cc0,_0x3aa8ce- -_0x2d0a31._0x40a748);}return _0x19c160['ok']=!![],_0x19c160['action']=_0x510ea6['oVLyX'],_0x19c160[_0x61fd64(0x462,0x466)]=_0x2e3d04[_0x2da3a1(_0x1254b8._0x2e5365,0x2a1)],_0x19c160[_0x61fd64(0x35a,0x523)+'rl']=_0x2e3d04[_0x61fd64(0x38d,0x523)+'rl'],_0x19c160[_0x2da3a1(0x4b6,_0x1254b8._0x2fd51a)]=_0x2e3d04[_0x2da3a1(_0x1254b8._0x41a8f8,_0x1254b8._0x2fd51a)],_0x19c160[_0x61fd64(_0x1254b8._0x6be0b4,0x179)+'t']=_0x2e3d04[_0x61fd64(_0x1254b8._0x1c27f9,0x179)+'t'],_0x19c160[_0x2da3a1(0x3a3,_0x1254b8._0x58738c)+'ath']=_0x2e3d04[_0x61fd64(0x2e5,0x561)+_0x2da3a1(-0x268,-0x62)],_0x19c160;}import{mkdirSync as _0x186abd,writeFileSync as _0x4a06a7}from'fs';import{dirname as _0x2c7a4b,isAbsolute,join as _0x293617,resolve as _0x44dfaa}from'path';import _0x4a5369 from'qrcode';var DEFAULT_QR_DIR=getOpenClawMediaDir();async function writePairingQrPng(_0x114867,_0x14d916){const _0x2fe15f={_0x240e0c:0x3f4},_0x42c23b={_0x9ad8ce:0x6f},_0x70af7e={'FurAH':function(_0x162749,_0xf188b8,_0x1a0fc0){return _0x162749(_0xf188b8,_0x1a0fc0);}},_0x5b837e=resolveQrOutputPath(_0x114867['config'][_0x41ad44(_0x2fe15f._0x240e0c,0x228)+'d'],_0x14d916);function _0x41ad44(_0x3a8888,_0x19864f){return _0x3266d5(_0x19864f,_0x3a8888-_0x42c23b._0x9ad8ce);}return _0x70af7e['FurAH'](writeQrPng,_0x114867['qrPayloa'+'d'],_0x5b837e);}async function writeRawQrPng(_0x1f302e,_0x16b8b2,_0x23bb48){const _0x1aa2a2={_0x59b105:0x6a},_0x6429b2={_0x5036e2:0x494},_0x110126={'OmCMi':function(_0x44039d,_0x497c68,_0x3e81e0){return _0x44039d(_0x497c68,_0x3e81e0);},'NocoE':function(_0x3b5231,_0x1f5b5a,_0x5e38d1){return _0x3b5231(_0x1f5b5a,_0x5e38d1);}};function _0x2816f2(_0x2a3a1c,_0x197043){return _0x26b3dd(_0x2a3a1c- -_0x6429b2._0x5036e2,_0x197043);}const _0x326edd=_0x110126[_0x2816f2(0x205,_0x1aa2a2._0x59b105)](resolveQrOutputPath,_0x16b8b2,_0x23bb48);return _0x110126['NocoE'](writeQrPng,_0x1f302e,_0x326edd);}async function writeQrPng(_0x4c05be,_0x1823f1){const _0xb6d69e={_0x8611fa:0x8a6,_0x5f52d6:0x24b,_0x249744:0x5d1,_0x39ce19:0x393,_0x27046f:0x50b,_0x218a4f:0x361,_0x144042:0x81d,_0x3fa763:0x7af,_0xf392a0:0x41c},_0x390027={_0x40c177:0xa},_0x11df19={};_0x11df19['uDNPK']='image/pn'+'g';const _0x3ec72a=_0x11df19,_0x15017c={};_0x15017c[_0xe9afd9(0xa75,_0xb6d69e._0x8611fa)+'e']=!![],_0x186abd(_0x2c7a4b(_0x1823f1),_0x15017c);const _0x5a23d3={};function _0x40458e(_0x1a2bbd,_0x305929){return _0x26b3dd(_0x1a2bbd- -0x3d7,_0x305929);}function _0xe9afd9(_0x128b8e,_0xfadfab){return _0x26b3dd(_0xfadfab-_0x390027._0x40c177,_0x128b8e);}_0x5a23d3['type']=_0x3ec72a[_0x40458e(0x448,_0xb6d69e._0x5f52d6)],_0x5a23d3[_0xe9afd9(_0xb6d69e._0x249744,0x753)+_0x40458e(_0xb6d69e._0x39ce19,0x461)+_0xe9afd9(0x7f3,0x80d)]='M',_0x5a23d3[_0x40458e(0x3cd,0x366)]=0x1,_0x5a23d3[_0x40458e(0x47d,0x429)]=0x2d0;const _0x1bb915=await _0x4a5369[_0xe9afd9(0x789,_0xb6d69e._0x27046f)+'L'](_0x4c05be,_0x5a23d3),_0x33ee7f=_0x1bb915[_0x40458e(0x2e8,_0xb6d69e._0x218a4f)](/^data:image\/png;base64,/,'');return _0x4a06a7(_0x1823f1,Buffer[_0xe9afd9(_0xb6d69e._0x144042,_0xb6d69e._0x3fa763)](_0x33ee7f,_0x40458e(_0xb6d69e._0xf392a0,0x188))),_0x1823f1;}function resolveQrOutputPath(_0x4a0b49,_0x59b3ab){const _0x18aded={_0x4bbb07:0x641,_0x35b632:0x6aa,_0x3eb13f:0x405},_0x3c4a71=_0x59b3ab?.[_0x31a304(_0x18aded._0x4bbb07,_0x18aded._0x35b632)]();function _0x89a91d(_0x4fca07,_0x301450){return _0x3266d5(_0x4fca07,_0x301450- -0x236);}function _0x31a304(_0x92dda,_0x23a182){return _0x3266d5(_0x23a182,_0x92dda-0x31b);}if(_0x3c4a71)return isAbsolute(_0x3c4a71)?_0x3c4a71:_0x44dfaa(_0x3c4a71);return _0x293617(DEFAULT_QR_DIR,_0x4a0b49+_0x31a304(_0x18aded._0x3eb13f,0x173));}function decidePairServiceAction(_0x16a259,_0x2f0293){const _0x16ee6a={_0x143e65:0x681,_0x4130ad:0x5ea,_0x548081:0x8ce,_0x5578fa:0x5c9,_0x1b27f9:0x6f7,_0x5c0085:0x9d1,_0x382703:0x762,_0x3f2dce:0x4e9,_0x305a47:0x613,_0x5cc564:0x2bc,_0x4946bb:0x4c6,_0x19db26:0x7b1,_0x1d873a:0x538,_0x37a10f:0x41e},_0x5b4956={};_0x5b4956[_0x374dc1(_0x16ee6a._0x143e65,0x5f1)]='install',_0x5b4956['mzjfH']=function(_0x353885,_0xd0715a){return _0x353885===_0xd0715a;},_0x5b4956[_0x374dc1(_0x16ee6a._0x4130ad,0x7b1)]=_0x31fdc0(_0x16ee6a._0x548081,0x62d)+'ed';const _0x48982a=_0x5b4956;function _0x31fdc0(_0x1b9d7c,_0x585cb6){return _0x3266d5(_0x1b9d7c,_0x585cb6-0x46f);}if(!_0x2f0293[_0x31fdc0(_0x16ee6a._0x5578fa,0x4fc)+'d'])return _0x48982a[_0x31fdc0(0x6b7,_0x16ee6a._0x1b27f9)];if(!_0x2f0293[_0x374dc1(_0x16ee6a._0x5c0085,_0x16ee6a._0x382703)])return _0x374dc1(0x6a6,0x538);if(_0x48982a[_0x374dc1(_0x16ee6a._0x3f2dce,_0x16ee6a._0x305a47)](_0x16a259[_0x374dc1(_0x16ee6a._0x5cc564,_0x16ee6a._0x4946bb)],_0x48982a[_0x374dc1(0x80e,_0x16ee6a._0x19db26)]))return _0x374dc1(0x47b,_0x16ee6a._0x1d873a);function _0x374dc1(_0x3e6dbb,_0x91bb75){return _0x3266d5(_0x3e6dbb,_0x91bb75-0x369);}return _0x374dc1(0x416,_0x16ee6a._0x37a10f);}async function main(){const _0x3f8891={_0x4c6850:0x276,_0x4e748e:0x4ab,_0x5937b6:0x5fd,_0x3c0132:0x2e2,_0x348fda:0x5e1,_0x4ca9bf:0x6c5,_0x365940:0xe9,_0x391d48:0x451,_0x2c30c7:0x1ae,_0x422ac9:0x35b,_0x2fdde6:0x4a4,_0x130ea0:0x30e,_0x1a0fec:0x1d6,_0x156af7:0x460,_0x13d6c9:0x5d2,_0x430a47:0x18d,_0x2e73dc:0x3f3,_0x10b910:0x7ae,_0x1ccb10:0x64a,_0xb18563:0x27c,_0x234d87:0x107,_0x1a0aa5:0x7c8,_0x4cb22a:0x989,_0x55ce77:0x588,_0x516ab9:0x70b,_0x205560:0x6f0,_0x5e633e:0x1de,_0x20d644:0x1eb,_0x8ae6e0:0x416,_0x5a3443:0x421,_0x59a3e9:0x3d0,_0x45923a:0x649,_0xf6e9a0:0x513,_0x4bdd4d:0x15f,_0xd2784b:0x3cc,_0x4176b3:0x50e,_0x100c80:0x4d4,_0x18b561:0x6fd,_0x1a8e53:0x2fc,_0x207cd9:0x553,_0x9c1a69:0x2b9,_0x1000f6:0x40a,_0x5cb17d:0x2c3,_0x164319:0x3dc,_0x33e66c:0xcb,_0x302af0:0x29d,_0x9169c1:0x1d8,_0x3cea08:0x621,_0x21aae8:0x54b,_0x5da352:0x265,_0x561ff6:0x5fc,_0x11ecb3:0x5b9,_0x219c19:0x7c0,_0x2870a1:0x636,_0x481235:0x65d,_0x414721:0x6c6,_0x213727:0x33b,_0x44c5b5:0x39d,_0x249806:0x344,_0x2043f3:0x561,_0x48e267:0x6,_0x4757ff:0x37c,_0x4b7326:0x9cd,_0x2fd371:0x592,_0x450d2b:0x35f,_0x427d35:0x281,_0x3c8622:0x30b,_0x40f408:0x49a,_0x2eb689:0x35c,_0x5e378c:0x20f,_0x7b3075:0x690,_0x39cd2c:0x902,_0x36c8b6:0x369,_0x35197e:0x250,_0x24f3cf:0x176,_0x1482ad:0x99f,_0x4cfea1:0x182,_0x329f9e:0xf9,_0x210431:0x45c,_0x1dc737:0x337,_0x47912f:0x6e5,_0x2d1f24:0x57b,_0x23839d:0x2fb,_0x4f6bf3:0x4ea,_0x321c8a:0x472,_0x5ba35b:0x42c,_0x1e074e:0x442,_0x57ecff:0x61f,_0x4ac3e0:0x5df,_0x66cd00:0x4a1,_0x323252:0x5fb,_0x3a9d84:0x35f,_0x2562e8:0x601,_0x3fb5e5:0x3e1,_0x2ac521:0x200,_0x1045ba:0x640,_0x1322e9:0x379,_0x51f7e7:0x1e7,_0x3872c4:0x473,_0x42fbae:0x5da,_0x5cd686:0x414,_0x4cb518:0x4a5,_0x3b6008:0x3e0,_0x1895f2:0x63f,_0xacc5b9:0x4d2,_0x2495c3:0x10d,_0x36b63f:0x167,_0x493995:0x2ad,_0x4e585e:0x2d4,_0x1256c8:0x419,_0x2e0d06:0x2e3,_0x203028:0x435,_0x322b2f:0x664,_0xed4bd:0x63c,_0x1f1a26:0x550,_0x1513cf:0x539,_0x20a2e2:0x606,_0x4cb6e4:0x592,_0x4b9fb2:0x761,_0x237941:0x1c2,_0x14c8e3:0x524,_0x44758c:0x5ed,_0x4d9f55:0x4c5,_0x5cff2e:0x474,_0xf7fecc:0x37b,_0x383f9b:0x1f7,_0x3779bf:0x7c8,_0x5c6563:0x64e,_0xf331f0:0x536,_0x3ded9d:0x138,_0x36eb0f:0x86,_0x5674b9:0x6d6,_0x207692:0x3f1,_0x39573a:0x701,_0x5b0e8a:0x222,_0x329f7c:0x44e,_0x28de34:0x4f5,_0x32741f:0x371,_0x53c8b1:0x62f,_0xfad468:0x709,_0x165d8c:0x6dd,_0x7915ad:0x723,_0x24f6a0:0x2b2,_0x6926c3:0x323,_0x5837a8:0x457,_0x1fe1bc:0x530,_0x5b8b14:0x5d5,_0x53e770:0x65b,_0x3f0722:0x5a7,_0x35b72f:0x76d,_0x188b89:0x1aa,_0x42fe31:0x19,_0x4e6ded:0x7d4,_0x3c42fd:0x5fe,_0x4fe028:0x49b,_0x19a0ae:0x753,_0x5dfc74:0x47b,_0x246cc1:0x347,_0x556fb0:0x17d,_0x560712:0x9c,_0x19e750:0x363,_0x5659c1:0x4ee,_0x3b6916:0x40c,_0x12c133:0x6a3,_0xd8e137:0x45d,_0x436480:0x445,_0x47016f:0x56c,_0x22196d:0x2bc,_0x48362a:0x6a4,_0xd91a87:0x5d1,_0x510961:0x6c1,_0x49703c:0x3aa,_0x518ebc:0x51d,_0x39520a:0x3b4,_0x59d389:0x530,_0x5b69af:0x793,_0x56019c:0x41e,_0xd4a35d:0x40b,_0x5be9ee:0x527,_0x273393:0x62b,_0xfa0321:0x5db,_0x1cf594:0x76a,_0x597b16:0x662,_0x2c5c7c:0x5a8,_0x2d14dd:0x495,_0x25e8e7:0x3a4,_0xf29538:0x20e,_0x5eadb7:0x47c,_0x104ff3:0x4ed,_0x15bd0e:0x651,_0x327bec:0x763,_0x17fb17:0x3f4,_0xdca539:0x230,_0x2b1ac3:0x447,_0x130c39:0x73e,_0x1c6ae8:0x62f,_0x17e4c8:0x554,_0x4d253d:0x545,_0x357e3f:0x415,_0x1856ee:0x24e,_0x203b45:0x29e,_0x137d84:0x3c0,_0x3d4660:0x7b4,_0x33326f:0x9d8,_0x553041:0x6bf,_0x2de1d7:0x1e1,_0x4edbe7:0x466,_0x166935:0x8d7,_0x2914dd:0x40d,_0x2daf4e:0x34f,_0x3596cb:0x215,_0x9c5a58:0x32c,_0x3eddd7:0x631,_0x3498b5:0x6b9,_0x454c26:0x4c4,_0x8e1aff:0x1db,_0x5744b8:0x39d,_0x4f4be2:0xa06,_0x38784b:0x63b,_0x5120ca:0x4bc,_0x3cd72b:0x2d3},_0xa84ed5={_0x10b3eb:0x716,_0x5337f5:0x31f,_0x51aa0a:0x387,_0x50d101:0x605},_0x25fbae={_0x55c340:0x307},_0x4dda37={_0xf775ff:0x6e9,_0x193517:0x761,_0x218691:0x6a8,_0x5d3a3f:0x73b,_0x4f499c:0x807,_0x2be527:0x79,_0x114804:0x4b0,_0x5c227e:0x709},_0x430185={_0x37051d:0x42c,_0x58c408:0x2a6,_0x26a444:0x1b2,_0x32015a:0x129,_0x854877:0x581,_0x5350c8:0x1ae,_0x3f487f:0x5d7,_0x27556a:0x155,_0x5bc908:0x31e,_0x5026d2:0x17e,_0x68c41e:0x120,_0x5a8d78:0x59,_0x56ac0c:0xd3,_0x4a62cc:0x9,_0x4c85e9:0x13b,_0x2110cd:0x192},_0x3044cc={_0xf7ca21:0x40a},_0x3feff2={_0xca2ce2:0x420},_0x5482bc={_0x31f7e2:0x606,_0x305f8b:0x779,_0x5b8f7f:0x3d9,_0x36bfee:0x415},_0x1421a5={_0x115e12:0x23a};function _0xa2ddc5(_0x3c5bb6,_0x24d6c8){return _0x26b3dd(_0x3c5bb6- -0x3b3,_0x24d6c8);}const _0x1c5a5d={'HxpuO':function(_0x62daa2,_0x3eaa50){return _0x62daa2(_0x3eaa50);},'GjXqv':'down','iJKKf':_0xa2ddc5(_0x3f8891._0x4c6850,0x41f),'oGYKV':'help','onHCM':function(_0x2b3a1c,_0x3dc6f3,_0x4e8b83){return _0x2b3a1c(_0x3dc6f3,_0x4e8b83);},'sDzyr':_0xa2ddc5(0x5ea,0x870),'PHjgk':function(_0x4e907f){return _0x4e907f();},'HwbaG':'--url','GMJBX':function(_0x5f75bc,_0xfedab0){return _0x5f75bc in _0xfedab0;},'wGIeQ':function(_0x2b3402,_0xee8a0a,_0x337487){return _0x2b3402(_0xee8a0a,_0x337487);},'eHUNK':_0x3d738d(_0x3f8891._0x4e748e,_0x3f8891._0x5937b6),'hBVWt':function(_0x26aee6,_0x50a1e4,_0x43198f){return _0x26aee6(_0x50a1e4,_0x43198f);},'HjTSk':function(_0x28000a,_0x208077,_0xefff52){return _0x28000a(_0x208077,_0xefff52);},'cABMD':function(_0x3fa6e6,_0x3c18ba){return _0x3fa6e6===_0x3c18ba;},'fqKqH':_0x3d738d(0x2b7,0x3d7)+_0xa2ddc5(_0x3f8891._0x3c0132,0x43)+_0x3d738d(_0x3f8891._0x348fda,_0x3f8891._0x4ca9bf)+_0xa2ddc5(0x205,_0x3f8891._0x365940)+_0x3d738d(_0x3f8891._0x391d48,0x237)+'arted\x20th'+_0xa2ddc5(0x460,_0x3f8891._0x2c30c7)+_0xa2ddc5(0x48c,0x46b)+'vice\x20cle'+'anly.','doXWT':function(_0x57c0f9,_0x57ee8a,_0x4cfabe){return _0x57c0f9(_0x57ee8a,_0x4cfabe);},'foZPO':_0xa2ddc5(_0x3f8891._0x422ac9,0xb8),'DXzdW':function(_0x37d856,_0x5db5c2,_0x48a17b,_0x4be512,_0x2e15a1){return _0x37d856(_0x5db5c2,_0x48a17b,_0x4be512,_0x2e15a1);},'QQvSt':function(_0x2df951,_0x55ddfb,_0x3af6f4){return _0x2df951(_0x55ddfb,_0x3af6f4);},'JSdlp':function(_0x493930,_0x447011,_0x228549){return _0x493930(_0x447011,_0x228549);},'KsMOo':_0x3d738d(0x734,_0x3f8891._0x2fdde6)+'e','jwjgF':function(_0x43a73e,_0x35d6c4){return _0x43a73e(_0x35d6c4);},'TDvbe':function(_0x411d0c,_0x3e0781,_0x18e06d){return _0x411d0c(_0x3e0781,_0x18e06d);},'pvgKm':_0x3d738d(_0x3f8891._0x130ea0,_0x3f8891._0x1a0fec),'mPaDn':'Stopped\x20'+_0xa2ddc5(0x1cd,_0x3f8891._0x156af7)+_0xa2ddc5(0x2e3,0x56c)+'ce.','FVFoe':function(_0x3a613c,_0x51224d,_0x12a7b0){return _0x3a613c(_0x51224d,_0x12a7b0);},'EBwDN':_0xa2ddc5(0x2f2,0x232),'FCcUU':function(_0x99a6e3){return _0x99a6e3();},'aJzMV':function(_0x461859,_0x165ef8){return _0x461859===_0x165ef8;},'hYoHj':_0x3d738d(_0x3f8891._0x13d6c9,0x74e),'RXZgF':function(_0x435fab,_0x325ffa){return _0x435fab(_0x325ffa);},'QuiBP':_0xa2ddc5(0xe8,_0x3f8891._0x430a47),'liumu':function(_0x4b4cdb,_0x28a97b,_0x2c8528){return _0x4b4cdb(_0x28a97b,_0x2c8528);},'EEcRY':function(_0x4a516f,_0x4c5ca4){return _0x4a516f===_0x4c5ca4;},'SmZKY':function(_0x12a0b1){return _0x12a0b1();},'VoDaR':function(_0x10c81c,_0x4595ac){return _0x10c81c(_0x4595ac);},'DQeVT':_0x3d738d(_0x3f8891._0x2e73dc,0x33d)+_0x3d738d(0x629,0x713),'cKSrD':_0x3d738d(0x5a2,0x4d2)},[,,_0x29052f=_0x1c5a5d[_0x3d738d(_0x3f8891._0x10b910,_0x3f8891._0x1ccb10)],..._0x616d80]=process[_0x3d738d(0x2a5,0x400)],_0x30de9e=hasFlag(_0x616d80,'--servic'+'e'),_0x7a0d7=_0x1c5a5d[_0x3d738d(0x79a,0x769)](hasFlag,_0x616d80,_0x1c5a5d[_0xa2ddc5(0x3bc,_0x3f8891._0xb18563)]);if(_0x29052f===_0xa2ddc5(_0x3f8891._0x234d87,0x154)){const _0x5d9476=_0x1c5a5d[_0x3d738d(_0x3f8891._0x1a0aa5,_0x3f8891._0x4cb22a)](readPairSubcommand,_0x616d80),_0x556610=_0x5d9476===_0xa2ddc5(0x314,0x280)||hasFlag(_0x616d80,_0xa2ddc5(0x106,0x1cd));if(_0x556610){const _0x275889=_0x1c5a5d[_0x3d738d(0x4d5,0x43c)](resolveGatewayAuth);if(_0xa2ddc5(_0x3f8891._0x55ce77,_0x3f8891._0x516ab9)in _0x275889)throw new Error(_0x275889[_0x3d738d(0x701,0x95b)]);const _0x1a6863=readFlag(_0x616d80,_0xa2ddc5(0x5bb,0x81d)+'e'),_0x26e170=_0x1c5a5d[_0x3d738d(0x7c8,_0x3f8891._0x205560)](buildLocalPairingInfo,{'explicitUrl':readFlag(_0x616d80,_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x5e633e,_0x3f8891._0x20d644)]),'gatewayToken':_0x275889[_0x3d738d(0x4f5,0x2e4)],'gatewayPassword':_0x275889['password']}),_0x8c23db=await writeRawQrPng(_0x26e170[_0x3d738d(_0x3f8891._0x8ae6e0,0x6ab)+'d'],_0xa2ddc5(_0x3f8891._0x5a3443,_0x3f8891._0x59a3e9)+'local-pa'+'ir',_0x1a6863);if(_0x7a0d7){const _0x3dd2b2={};_0x3dd2b2[_0x3d738d(_0x3f8891._0x45923a,0x687)+'rl']=_0x26e170['gatewayU'+'rl'],_0x3dd2b2[_0xa2ddc5(0x3b9,_0x3f8891._0xf6e9a0)]=_0x26e170[_0xa2ddc5(0x3b9,_0x3f8891._0x4bdd4d)],_0x3dd2b2[_0xa2ddc5(0x126,_0x3f8891._0xd2784b)+'t']=_0x26e170[_0x3d738d(0x29f,0x34d)+'t'],_0x3dd2b2[_0xa2ddc5(_0x3f8891._0x4176b3,_0x3f8891._0x100c80)+'ath']=_0x8c23db,_0x3dd2b2[_0x3d738d(0x58c,_0x3f8891._0x18b561)]=_0x3d738d(0x4c1,_0x3f8891._0x1a8e53)+_0x3d738d(0x6b1,0x68c)+_0xa2ddc5(_0x3f8891._0x207cd9,_0x3f8891._0x9c1a69)+_0xa2ddc5(_0x3f8891._0x1000f6,0x500)+_0xa2ddc5(_0x3f8891._0x5cb17d,0x584),printJson(buildLocalPairingJson(_0x3dd2b2));}else printLocalPairingInfo(_0x26e170[_0x3d738d(0x649,_0x3f8891._0x164319)+'rl'],_0x26e170['authMode'],_0x26e170[_0xa2ddc5(0x126,_0x3f8891._0x33e66c)+'t'],_0x26e170[_0xa2ddc5(_0x3f8891._0x302af0,_0x3f8891._0x9169c1)+'d'],_0x8c23db,_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x3cea08,_0x3f8891._0x21aae8)](readFlag,_0x616d80,_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x5e633e,_0x3f8891._0x5da352)]));return;}const _0x494a78=hasFlag(_0x616d80,_0x3d738d(0x484,_0x3f8891._0x561ff6));!_0x494a78&&await ensurePairPrerequisites();const _0x169fbe=resolveGatewayAuth();if(_0x1c5a5d[_0x3d738d(0x54d,_0x3f8891._0x11ecb3)](_0x3d738d(0x701,_0x3f8891._0x219c19),_0x169fbe))throw new Error(_0x169fbe['error']);const _0x909e9e=_0x1c5a5d['wGIeQ'](readFlag,_0x616d80,_0x1c5a5d[_0x3d738d(_0x3f8891._0x2870a1,0x57a)])??readFlag(_0x616d80,'-s')??_0x3d738d(0x2af,0xe1)+_0x3d738d(0x5ee,0x693)+'.clawket'+_0xa2ddc5(_0x3f8891._0x481235,_0x3f8891._0x414721),_0x3ee622=readFlag(_0x616d80,'--name')??_0x1c5a5d[_0x3d738d(_0x3f8891._0x213727,0x3a8)](readFlag,_0x616d80,'-n')??getDefaultBridgeDisplayName(),_0x2b2ccf=readFlag(_0x616d80,'--qr-fil'+'e'),_0x204d44={};_0x204d44[_0xa2ddc5(0x21a,_0x3f8891._0x44c5b5)+'l']=_0x909e9e,_0x204d44[_0x3d738d(_0x3f8891._0x249806,0x59a)+_0xa2ddc5(0x47c,0x577)]=_0x3ee622,_0x204d44[_0x3d738d(_0x3f8891._0x2043f3,0x4fc)+_0xa2ddc5(0x222,-_0x3f8891._0x48e267)]=_0x169fbe[_0xa2ddc5(_0x3f8891._0x4757ff,0x584)],_0x204d44[_0x3d738d(0x7a8,_0x3f8891._0x4b7326)+_0x3d738d(0x518,_0x3f8891._0x2fd371)]=_0x169fbe[_0x3d738d(0x6dd,0x4d8)];const _0x44756=await pairGateway(_0x204d44),_0x519f35=await _0x1c5a5d['HjTSk'](writePairingQrPng,_0x44756,_0x2b2ccf),_0x29d305=getServiceStatus(),_0x248efc=decidePairServiceAction(_0x44756,_0x29d305);if(_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x450d2b,_0x3f8891._0x427d35)](_0x248efc,_0x3d738d(_0x3f8891._0x3c8622,_0x3f8891._0x40f408))){const _0xcee990=_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x2eb689,_0x3f8891._0x5e378c)](listRuntimeProcesses);if(_0xcee990[_0x3d738d(_0x3f8891._0x7b3075,_0x3f8891._0x39cd2c)]>0x1){stopRuntimeProcesses();const _0x3c6d23=_0x1c5a5d[_0xa2ddc5(0x35c,0x14a)](restartService),_0x4fca61=_0x1c5a5d[_0x3d738d(_0x3f8891._0x36c8b6,0x23f)];_0x7a0d7?printJson(buildPairingJson(_0x44756,_0x519f35,_0x3c6d23,_0x4fca61)):(_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x35197e,_0x3f8891._0x24f3cf)](printPairingInfo,_0x44756,_0x519f35),printServiceResult(_0x4fca61,_0x3c6d23));return;}_0x7a0d7?_0x1c5a5d[_0x3d738d(0x7c8,_0x3f8891._0x1482ad)](printJson,buildPairingJson(_0x44756,_0x519f35,_0x29d305,_0xa2ddc5(_0x3f8891._0x4cfea1,_0x3f8891._0x329f9e)+_0x3d738d(_0x3f8891._0x210431,_0x3f8891._0x1dc737)+'ce\x20alrea'+'dy\x20runni'+_0x3d738d(0x641,0x507)+'\x20unchang'+_0x3d738d(0x362,0x20a))):(printPairingInfo(_0x44756,_0x519f35),console[_0x3d738d(_0x3f8891._0x47912f,_0x3f8891._0x2d1f24)](_0x3d738d(_0x3f8891._0x23839d,_0x3f8891._0x4f6bf3)+_0xa2ddc5(0x2e3,0x104)+'ce\x20alrea'+_0x3d738d(_0x3f8891._0x321c8a,_0x3f8891._0x5ba35b)+_0xa2ddc5(0x4c8,_0x3f8891._0x1e074e)+_0x3d738d(_0x3f8891._0x57ecff,_0x3f8891._0x4ac3e0)+_0x3d738d(0x362,0x3ff)),_0x1c5a5d[_0x3d738d(_0x3f8891._0x66cd00,0x416)](printServiceResult,null,_0x29d305));return;}try{_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x2eb689,_0x3f8891._0x323252)](stopRuntimeProcesses);const _0x245c38=_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x3a9d84,_0x3f8891._0x2562e8)](_0x248efc,_0xa2ddc5(0x35b,_0x3f8891._0x3fb5e5))?installService():restartService(),_0x53e381=_0x248efc===_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x2ac521,0x3d4)]?_0xa2ddc5(_0x3f8891._0x1045ba,0x63e)+_0xa2ddc5(_0x3f8891._0x1322e9,_0x3f8891._0x51f7e7)+_0x3d738d(0x5c1,0x4ee)+_0x3d738d(_0x3f8891._0x3872c4,_0x3f8891._0x42fbae)+'e.':_0x44756[_0x3d738d(0x3b3,0x1df)]===_0x3d738d(_0x3f8891._0x5cd686,0x53d)+'ed'?'Bridge\x20i'+_0xa2ddc5(_0x3f8891._0x4cb518,0x3d8)+_0x3d738d(0x29d,_0x3f8891._0x3b6008)+_0xa2ddc5(0x4f7,0x50e)+_0xa2ddc5(_0x3f8891._0x1895f2,_0x3f8891._0xacc5b9)+_0xa2ddc5(_0x3f8891._0x2495c3,-_0x3f8891._0x36b63f)+_0x3d738d(0x40c,0x26d)+_0xa2ddc5(0x483,0x3a0)+_0xa2ddc5(_0x3f8891._0x493995,_0x3f8891._0x4e585e)+_0x3d738d(0x7d7,0x5f5):_0x3d738d(_0x3f8891._0x23839d,_0x3f8891._0x1256c8)+_0xa2ddc5(_0x3f8891._0x2e0d06,0x2cd)+_0x3d738d(_0x3f8891._0x203028,_0x3f8891._0x322b2f)+_0x3d738d(0x7a6,0x8bf)+_0x3d738d(_0x3f8891._0xed4bd,_0x3f8891._0x1f1a26)+_0xa2ddc5(0x562,0x6bd)+_0xa2ddc5(_0x3f8891._0x321c8a,_0x3f8891._0x1513cf)+_0x3d738d(0x51b,_0x3f8891._0x20a2e2);_0x7a0d7?_0x1c5a5d[_0xa2ddc5(0x64f,0x62a)](printJson,_0x1c5a5d[_0x3d738d(_0x3f8891._0x4cb6e4,0x4f5)](buildPairingJson,_0x44756,_0x519f35,_0x245c38,_0x53e381)):(_0x1c5a5d[_0x3d738d(_0x3f8891._0x4b9fb2,0x623)](printPairingInfo,_0x44756,_0x519f35),_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x237941,0x1eb)](printServiceResult,_0x53e381,_0x245c38));}catch(_0x235ddc){if(isAutostartUnsupportedError(_0x235ddc)){const _0x4d9537=await startTransientRuntime(),_0x4ed3fb=buildUnsupportedAutostartMessage(_0x4d9537);_0x7a0d7?printJson(buildPairingJson(_0x44756,_0x519f35,_0x4d9537,_0x4ed3fb)):(_0x1c5a5d[_0x3d738d(0x67e,_0x3f8891._0x14c8e3)](printPairingInfo,_0x44756,_0x519f35),printServiceResult(_0x4ed3fb,_0x4d9537));return;}console['error'](_0x3d738d(0x31d,0x3e6)+_0x3d738d(0x4d3,_0x3f8891._0x44758c)+'d,\x20but\x20s'+_0x3d738d(_0x3f8891._0x4d9f55,_0x3f8891._0x5cff2e)+'ctivatio'+_0x3d738d(_0x3f8891._0xf7fecc,_0x3f8891._0x383f9b)+':\x20'+_0x1c5a5d[_0x3d738d(_0x3f8891._0x3779bf,_0x3f8891._0x5c6563)](formatError2,_0x235ddc)),console[_0xa2ddc5(0x588,_0x3f8891._0xf331f0)]('You\x20can\x20'+'still\x20ru'+_0xa2ddc5(_0x3f8891._0x3ded9d,-_0x3f8891._0x36eb0f)+_0xa2ddc5(0x45a,0x48e)+'ll\x22\x20or\x20\x22'+'clawket\x20'+_0x3d738d(0x467,0x675)+'ually.'),process['exitCode']=0x1;}return;}if(_0x1c5a5d[_0xa2ddc5(0x35f,0x2b9)](_0x29052f,_0xa2ddc5(_0x3f8891._0x4f6bf3,_0x3f8891._0x5674b9)+_0x3d738d(_0x3f8891._0x207692,0x525))){const _0x585f59=readFlag(_0x616d80,_0x1c5a5d['KsMOo']),_0x3c6e00=resolveGatewayAuth();if(_0x3d738d(0x701,_0x3f8891._0x205560)in _0x3c6e00)throw new Error(_0x3c6e00[_0x3d738d(_0x3f8891._0x39573a,0x870)]);const _0x21ff11={};_0x21ff11[_0x3d738d(0x561,0x5a5)+_0xa2ddc5(_0x3f8891._0x5b0e8a,_0x3f8891._0x329f7c)]=_0x3c6e00[_0x3d738d(_0x3f8891._0x28de34,_0x3f8891._0x32741f)],_0x21ff11[_0xa2ddc5(_0x3f8891._0x53c8b1,_0x3f8891._0xfad468)+'assword']=_0x3c6e00[_0x3d738d(_0x3f8891._0x165d8c,_0x3f8891._0x7915ad)];const _0x25099f=await _0x1c5a5d[_0xa2ddc5(0x333,0x14a)](refreshAccessCode,_0x21ff11),_0x1178a9=await _0x1c5a5d['TDvbe'](writePairingQrPng,_0x25099f,_0x585f59);_0x7a0d7?printJson(buildPairingJson(_0x25099f,_0x1178a9,getServiceStatus(),'Pairing\x20'+_0xa2ddc5(_0x3f8891._0x24f6a0,0x414)+_0xa2ddc5(0x240,0x494))):printPairingInfo(_0x25099f,_0x1178a9);return;}if(_0x29052f===_0x1c5a5d['foZPO']||_0x29052f===_0x1c5a5d[_0x3d738d(0x6ee,0x836)]){const _0x192f56=requirePairingConfig();stopRuntimeProcesses();const _0x56994b=installService();console['log']('Installe'+_0x3d738d(_0x3f8891._0x6926c3,_0x3f8891._0x5837a8)+'ound\x20ser'+_0xa2ddc5(_0x3f8891._0x1fe1bc,_0x3f8891._0x5b8b14)+_0xa2ddc5(_0x3f8891._0x53e770,0x68b)+'\x20'+_0x192f56[_0xa2ddc5(0x462,_0x3f8891._0x3f0722)+'d']+'.'),_0x1c5a5d['hBVWt'](printServiceResult,null,_0x56994b);return;}if(_0x29052f===_0xa2ddc5(0x2ac,0x1bf)){const _0x1a2394=requirePairingConfig();stopRuntimeProcesses();const _0x44c40b=restartService();console[_0x3d738d(0x6e5,_0x3f8891._0x35b72f)](_0x3d738d(0x6ce,0x795)+_0xa2ddc5(_0x3f8891._0x188b89,_0x3f8891._0x42fe31)+'ound\x20ser'+_0x3d738d(0x6a9,0x8f1)+_0x3d738d(_0x3f8891._0x4e6ded,_0x3f8891._0x55ce77)+'\x20'+_0x1a2394[_0xa2ddc5(0x462,0x657)+'d']+'.'),_0x1c5a5d[_0x3d738d(_0x3f8891._0x3c42fd,_0x3f8891._0x4fe028)](printServiceResult,null,_0x44c40b);return;}if(_0x29052f===_0x3d738d(_0x3f8891._0x19a0ae,0x95e)){const _0x88a34f=stopService();stopRuntimeProcesses(),console[_0x3d738d(0x6e5,_0x3f8891._0x5dfc74)](_0x1c5a5d['mPaDn']),_0x1c5a5d[_0x3d738d(_0x3f8891._0x40f408,0x505)](printServiceResult,null,_0x88a34f);return;}function _0x3d738d(_0x541a91,_0x3b845a){return _0x26b3dd(_0x541a91- -_0x1421a5._0x115e12,_0x3b845a);}if(_0x29052f==='uninstal'+'l'){const _0x15f55a=uninstallService();stopRuntimeProcesses(),console[_0xa2ddc5(0x56c,_0x3f8891._0x246cc1)](_0xa2ddc5(_0x3f8891._0x556fb0,-_0x3f8891._0x560712)+'backgrou'+_0x3d738d(_0x3f8891._0x210431,_0x3f8891._0x19e750)+_0x3d738d(_0x3f8891._0x5659c1,0x440)+_0xa2ddc5(_0x3f8891._0x3b6916,0x483)),printServiceResult(null,_0x15f55a);return;}if(_0x29052f===_0x1c5a5d[_0x3d738d(0x339,0x127)]){const _0x4b13a4=(_0x3d738d(0x588,_0x3f8891._0x12c133)+'4')[_0xa2ddc5(_0x3f8891._0xd8e137,_0x3f8891._0x436480)]('|');let _0x20dcb1=0x0;while(!![]){switch(_0x4b13a4[_0x20dcb1++]){case'0':stopService();continue;case'1':_0x1c5a5d['PHjgk'](deletePairingConfig);continue;case'2':stopRuntimeProcesses();continue;case'3':console[_0xa2ddc5(_0x3f8891._0x47016f,0x5bd)](_0x3d738d(_0x3f8891._0x22196d,0x11e)+_0x3d738d(_0x3f8891._0x48362a,0x3e6)+_0x3d738d(0x6f4,0x51e)+_0x1c5a5d[_0x3d738d(0x60d,0x5f6)](getPairingConfigPath));continue;case'4':return;}break;}}if(_0x1c5a5d[_0x3d738d(0x69c,0x686)](_0x29052f,_0x1c5a5d[_0x3d738d(_0x3f8891._0xd91a87,_0x3f8891._0x510961)])){printStatus();return;}if(_0x29052f==='logs'){const _0x534235=Number(_0x1c5a5d[_0x3d738d(0x3c9,_0x3f8891._0x9169c1)](readFlag,_0x616d80,_0x3d738d(_0x3f8891._0x49703c,0x65a))??_0xa2ddc5(_0x3f8891._0x518ebc,0x3e0)),_0x588d3a=_0x1c5a5d[_0x3d738d(_0x3f8891._0x39520a,_0x3f8891._0x156af7)](parseLookbackToMs,readFlag(_0x616d80,_0x1c5a5d[_0x3d738d(0x497,0x5b0)])??readFlag(_0x616d80,'-l')),_0x58152e=readRecentCliLogs({'lines':_0x534235,'lastMs':_0x588d3a,'includeErrorLog':_0x1c5a5d[_0x3d738d(0x5e8,_0x3f8891._0x59d389)](hasFlag,_0x616d80,_0x3d738d(_0x3f8891._0x5b69af,0xa22))});if(_0x7a0d7){const _0x55f489={};_0x55f489['ok']=!![],_0x55f489[_0x3d738d(_0x3f8891._0x56019c,0x3a5)]=_0x58152e,printJson(_0x55f489);}else _0x1c5a5d[_0x3d738d(0x4d8,0x2f6)](_0x58152e[_0xa2ddc5(0x517,0x5ce)],0x0)?console['log'](_0xa2ddc5(0x55b,0x6bf)+'ing\x20CLI\x20'+_0x3d738d(_0x3f8891._0xd4a35d,_0x3f8891._0x5be9ee)+_0xa2ddc5(0x5ba,_0x3f8891._0x273393)):console['log'](_0x58152e[_0x3d738d(0x732,_0x3f8891._0xfa0321)]('\x0a'));return;}if(_0x29052f===_0xa2ddc5(0x4c7,_0x3f8891._0x1cf594)){const _0x7e2d31=await buildDoctorReport();_0x7a0d7?printJson(_0x7e2d31):printDoctorReport(_0x7e2d31);return;}if(_0x1c5a5d['EEcRY'](_0x29052f,_0x3d738d(0x6bd,0x5e9))){const _0xc9d493=requirePairingConfig(),_0x2448cf=hasFlag(_0x616d80,_0x3d738d(0x4e1,0x5f3)+'e'),_0xbe92e5=listRuntimeProcesses()[_0x3d738d(0x566,0x6d1)](_0x3699a9=>_0x3699a9['pid']);_0xbe92e5[_0x3d738d(_0x3f8891._0x7b3075,_0x3f8891._0x597b16)]>0x0&&(!_0x2448cf&&(console[_0x3d738d(_0x3f8891._0x39573a,_0x3f8891._0x2c5c7c)]('Another\x20'+_0x3d738d(0x262,_0x3f8891._0x2d14dd)+_0xa2ddc5(0x2b6,0x21a)+_0x3d738d(0x528,0x6d7)+_0x3d738d(0x3f2,_0x3f8891._0x25e8e7)+_0xa2ddc5(_0x3f8891._0xf29538,0x491)+'g\x20(pid'+(_0xbe92e5[_0xa2ddc5(0x517,_0x3f8891._0x49703c)]>0x1?'s':'')+':\x20'+_0xbe92e5[_0xa2ddc5(0x5b9,_0x3f8891._0x5eadb7)](',\x20')+(').\x20Run\x20\x22'+_0x3d738d(0x555,_0x3f8891._0x104ff3)+_0x3d738d(_0x3f8891._0x15bd0e,0x64c)+_0xa2ddc5(0x4af,_0x3f8891._0x327bec)+_0x3d738d(0x3ea,_0x3f8891._0x17fb17)+'th\x20\x22--re'+_0xa2ddc5(_0x3f8891._0xdca539,0x276)+'o\x20take\x20o'+_0x3d738d(_0x3f8891._0x2b1ac3,0x6ad))),process[_0x3d738d(_0x3f8891._0x130c39,0x9e2)](0x1)),_0x1c5a5d[_0x3d738d(_0x3f8891._0x1c6ae8,_0x3f8891._0x17e4c8)](stopRuntimeProcesses));const _0x57adde=_0x1c5a5d['VoDaR'](resolveGatewayUrl,readFlag(_0x616d80,_0x3d738d(0x66b,_0x3f8891._0x4d253d)+_0x3d738d(_0x3f8891._0x357e3f,0x1d2))??_0x1c5a5d[_0x3d738d(_0x3f8891._0x213727,_0x3f8891._0x1856ee)](readFlag,_0x616d80,'-g')),_0x6aeb25=_0x44492d=>{function _0x16e353(_0x26aefa,_0x435818){return _0x3d738d(_0x26aefa- -0x45,_0x435818);}function _0x3c0eb0(_0x21fdb5,_0x2cd432){return _0x3d738d(_0x21fdb5- -0xdf,_0x2cd432);}console[_0x3c0eb0(_0x5482bc._0x31f7e2,_0x5482bc._0x305f8b)]('['+Date[_0x3c0eb0(_0x5482bc._0x5b8f7f,_0x5482bc._0x36bfee)]()+']\x20'+_0x44492d);};if(!_0x30de9e){const _0x47cf72=_0x1c5a5d['DQeVT'][_0xa2ddc5(_0x3f8891._0xd8e137,0x6a0)]('|');let _0x61036e=0x0;while(!![]){switch(_0x47cf72[_0x61036e++]){case'0':console['log'](_0xa2ddc5(_0x3f8891._0x203b45,_0x3f8891._0x137d84)+'\x20ID:\x20'+_0xc9d493[_0x3d738d(_0x3f8891._0x3d4660,_0x3f8891._0x33326f)+'Id']);continue;case'1':console[_0x3d738d(0x6e5,0x4b0)]('');continue;case'2':console[_0x3d738d(_0x3f8891._0x47912f,0x5cf)]('');continue;case'3':console[_0x3d738d(0x6e5,_0x3f8891._0x553041)]('Gateway\x20'+_0xa2ddc5(0x225,0xf3)+_0xc9d493[_0x3d738d(0x5db,0x4c6)+'d']);continue;case'4':console[_0x3d738d(0x6e5,0x702)]('Starting'+'\x20bridge\x20'+_0x3d738d(0x6f9,0x755)+'\x20Press\x20C'+_0xa2ddc5(0x392,0xd8)+_0xa2ddc5(0x661,0x5c1));continue;case'5':console['log'](_0x3d738d(0x38b,0x121)+_0xa2ddc5(_0x3f8891._0x2de1d7,_0x3f8891._0x4edbe7)+_0x57adde);continue;}break;}}else _0x6aeb25(_0x3d738d(0x711,_0x3f8891._0x166935)+_0xa2ddc5(0x59d,_0x3f8891._0x2914dd)+_0x3d738d(_0x3f8891._0x2daf4e,0x16a)+_0xa2ddc5(_0x3f8891._0x3596cb,0x223)+_0xa2ddc5(_0x3f8891._0x9c5a58,0x3da)+_0x3d738d(_0x3f8891._0x3eddd7,_0x3f8891._0x3498b5)+_0xc9d493[_0x3d738d(0x5db,_0x3f8891._0x454c26)+'d']);_0x30de9e&&_0x1c5a5d[_0xa2ddc5(_0x3f8891._0x2eb689,_0x3f8891._0x8e1aff)](writeServiceState);const _0x3050c8=new BridgeRuntime({'config':_0xc9d493,'gatewayUrl':_0x57adde,'onLog':_0xb9fa7c=>{const _0x511821={_0x355747:0x30};function _0x5ddfb7(_0x4d8dbd,_0x28e4c0){return _0x3d738d(_0x4d8dbd- -_0x511821._0x355747,_0x28e4c0);}_0x6aeb25(_0x5ddfb7(_0x3feff2._0xca2ce2,0x2b3)+']\x20'+_0xb9fa7c);},'onStatus':_0x567656=>{const _0x532547={_0x53ec23:0x253};if(_0x567656[_0x31de10(_0x430185._0x37051d,0x31c)+'r']){_0x6aeb25(_0x31de10(_0x430185._0x58c408,_0x430185._0x26a444)+'\x20relay='+(_0x567656[_0x197345(-_0x430185._0x32015a,0x13a)+'nected']?'up':'down')+(_0x31de10(0x705,_0x430185._0x854877)+'=')+(_0x567656[_0x31de10(0x19d,_0x430185._0x5350c8)+_0x197345(_0x430185._0x3f487f,0x3b9)]?'up':_0x31de10(0x3eb,_0x430185._0x27556a))+(_0x197345(-_0x430185._0x5bc908,-_0x430185._0x5026d2)+'=')+_0x567656['clientCo'+'unt']+_0x31de10(0x396,0x21e)+_0x567656['lastErro'+'r']);return;}function _0x31de10(_0x29bbfd,_0x655d21){return _0x3d738d(_0x655d21- -_0x532547._0x53ec23,_0x29bbfd);}function _0x197345(_0x51809b,_0x383c6c){return _0x3d738d(_0x383c6c- -_0x3044cc._0xf7ca21,_0x51809b);}_0x1c5a5d['HxpuO'](_0x6aeb25,_0x31de10(0x1ec,_0x430185._0x26a444)+_0x197345(-_0x430185._0x68c41e,0xf9)+(_0x567656['relayCon'+_0x197345(-0x24a,-_0x430185._0x5a8d78)]?'up':_0x1c5a5d['GjXqv'])+('\x20gateway'+'=')+(_0x567656[_0x197345(-_0x430185._0x56ac0c,-_0x430185._0x4a62cc)+'onnected']?'up':_0x197345(-0x320,-0x62))+('\x20clients'+'=')+_0x567656[_0x197345(-_0x430185._0x4c85e9,-_0x430185._0x2110cd)+'unt']);},'onPendingPairRequest':_0x586611=>{const _0x471b61={_0x1e9a4a:0x3f5};function _0x381036(_0x5944e8,_0x40f400){return _0xa2ddc5(_0x5944e8-_0x471b61._0x1e9a4a,_0x40f400);}function _0x1d4592(_0x91634c,_0x38b1a1){return _0xa2ddc5(_0x91634c-0x34,_0x38b1a1);}_0x6aeb25('[pair-re'+_0x381036(_0x4dda37._0xf775ff,_0x4dda37._0x193517)+'equestId'+'='+_0x586611[_0x381036(_0x4dda37._0x218691,_0x4dda37._0x5d3a3f)+'d']+(_0x381036(0x583,0x43a)+'d=')+(_0x586611['deviceId']||'<unknown'+'>')+_0x381036(0x831,_0x4dda37._0x4f499c)+(_0x586611[_0x1d4592(0x1ff,_0x4dda37._0x2be527)+_0x1d4592(_0x4dda37._0x114804,_0x4dda37._0x5c227e)]??'<unknown'+'>'));}});_0x3050c8[_0xa2ddc5(0x195,_0x3f8891._0x5744b8)]();const _0x5ec97b={};_0x5ec97b['gatewayI'+'d']=_0xc9d493[_0xa2ddc5(0x462,0x1e1)+'d'],_0x5ec97b[_0x3d738d(_0x3f8891._0x3d4660,_0x3f8891._0x4f4be2)+'Id']=_0xc9d493[_0xa2ddc5(_0x3f8891._0x38784b,_0x3f8891._0x5120ca)+'Id'],_0x5ec97b['serviceM'+_0x3d738d(_0x3f8891._0x3cd72b,_0x3f8891._0x156af7)]=_0x30de9e,registerRuntimeProcess(_0x5ec97b);const _0x47310c=async()=>{process[_0x38cde3(0x99e,0x74e)](_0x38cde3(_0xa84ed5._0x10b3eb,0x551),_0x47310c);function _0x338e86(_0x217e22,_0x11a2c0){return _0xa2ddc5(_0x217e22- -_0x25fbae._0x55c340,_0x11a2c0);}process[_0x338e86(_0xa84ed5._0x5337f5,0x5a3)](_0x1c5a5d['iJKKf'],_0x47310c),await _0x3050c8[_0x338e86(0x2d3,0x31)]();function _0x38cde3(_0x2723e8,_0x59e357){return _0xa2ddc5(_0x59e357-0x128,_0x2723e8);}unregisterRuntimeProcess(process[_0x38cde3(_0xa84ed5._0x51aa0a,_0xa84ed5._0x50d101)]),_0x30de9e&&clearServiceState(process['pid']),process['exit'](0x0);};process['on'](_0x1c5a5d['cKSrD'],_0x47310c),process['on']('SIGTERM',_0x47310c),await new Promise(()=>{});}printHelp();}function printPairingInfo(_0x1033be,_0x31ed01){const _0xdb0bf0={_0x3a6c62:0x4ed,_0x4bfad1:0x352,_0x36fdb8:0x384,_0x13ba99:0x253,_0x1691a4:0x22d,_0x228b34:0x53c,_0xe365d0:0x79f,_0x4e21c5:0x668,_0x3a9081:0x24d,_0x5788eb:0x275,_0x17df94:0x4e1,_0x2b396a:0x6b8,_0x261df2:0x321,_0x3f177a:0x42f,_0x30d269:0x5d4,_0x4ffd71:0x2c2,_0x5c59eb:0x399,_0x4a170e:0x5d4,_0x58c3a4:0x3ec,_0x15bc40:0x462,_0x1882c4:0x329,_0x4e3248:0x369,_0x4eb8d8:0x189,_0x32ca1b:0x37b},_0x3c2fb9={_0x363c1c:0x34b},_0x90e9c6={};_0x90e9c6[_0x4c7f48(_0xdb0bf0._0x3a6c62,_0xdb0bf0._0x4bfad1)]=function(_0x182e76,_0x17b17b){return _0x182e76===_0x17b17b;},_0x90e9c6[_0x4ff521(0x2e8,0x2f0)]=_0x4c7f48(_0xdb0bf0._0x36fdb8,_0xdb0bf0._0x13ba99)+_0x4ff521(0x663,0x859)+_0x4c7f48(0x7f6,0x6c4)+'e\x20Clawke'+_0x4ff521(_0xdb0bf0._0x1691a4,0x435);const _0x4fdafc=_0x90e9c6;_0x4fdafc[_0x4c7f48(0x4f1,0x352)](_0x1033be['action'],_0x4c7f48(_0xdb0bf0._0x228b34,0x6c9)+'d')&&console[_0x4c7f48(_0xdb0bf0._0xe365d0,_0xdb0bf0._0x4e21c5)]('Bridge\x20a'+_0x4c7f48(0x413,_0xdb0bf0._0x3a9081)+'aired.\x20R'+_0x4ff521(0x1dc,_0xdb0bf0._0x5788eb)+_0x4c7f48(0x44d,_0xdb0bf0._0x17df94)+_0x4c7f48(0x630,_0xdb0bf0._0x2b396a)+'e.');function _0x4ff521(_0x30697c,_0x478141){return _0x26b3dd(_0x30697c- -_0x3c2fb9._0x363c1c,_0x478141);}console['log'](_0x4c7f48(0x124,0x30e)+_0x4c7f48(0x193,_0xdb0bf0._0x261df2)+_0x1033be['config'][_0x4ff521(0x4ca,_0xdb0bf0._0x3f177a)+'d']),console[_0x4ff521(_0xdb0bf0._0x30d269,0x4a5)](_0x4fdafc['Ykrjj']);const _0x4a1785={};_0x4a1785[_0x4ff521(0x478,_0xdb0bf0._0x4ffd71)]=!![],_0x3e24a7[_0x4ff521(0x1c6,0x357)](_0x1033be[_0x4c7f48(0x4d2,_0xdb0bf0._0x5c59eb)+'d'],_0x4a1785),console[_0x4ff521(_0xdb0bf0._0x4a170e,_0xdb0bf0._0x58c3a4)](_0x4ff521(_0xdb0bf0._0x15bc40,0x67c)+'\x20'+formatLocalTime(_0x1033be[_0x4ff521(0x541,_0xdb0bf0._0x1882c4)+_0x4ff521(_0xdb0bf0._0x4e3248,0x272)+_0x4c7f48(_0xdb0bf0._0x4eb8d8,_0xdb0bf0._0x32ca1b)]));function _0x4c7f48(_0x33f894,_0x552648){return _0x26b3dd(_0x552648- -0x2b7,_0x33f894);}console['log'](_0x4c7f48(0x804,0x753)+':\x20'+_0x31ed01);}function printLocalPairingInfo(_0x3a3102,_0x1974d1,_0x162662,_0x3e33cc,_0x4ec7e8,_0x100965){const _0x419b10={_0x3515b3:0x49b,_0x1022af:0x541,_0x320df2:0x89b,_0x116c15:0x52c,_0x11e54d:0x5ce,_0x124858:0x370,_0x5338d8:0x850,_0x4b5aeb:0x5c3,_0x13b494:0x14d,_0x1a954e:0x1b7,_0x38b5e0:0x25c,_0x1a3d39:0x340,_0x3d7d3c:0x655,_0x132f3b:0x58a,_0x3ca1aa:0x60a,_0x51f045:0x52a,_0x45fae4:0x2a7,_0x45669d:0x1ed,_0x3dc472:0x444,_0x5994f4:0x33f,_0x3767ad:0x8d,_0x132d03:0x6f2,_0x4fe3a2:0x729,_0x226529:0xd2,_0x25a306:0x69c,_0x15cda6:0x89b,_0x4a2ca9:0x8c1};console[_0x21b858(0x651,_0x419b10._0x3515b3)](_0x386bea(0x5bf,_0x419b10._0x1022af)+'URL:\x20'+_0x3a3102),console[_0x386bea(0x743,_0x419b10._0x320df2)](_0x386bea(_0x419b10._0x116c15,_0x419b10._0x11e54d)+_0x386bea(0x65d,0x6a1)+_0x1974d1),console[_0x386bea(0x759,0x89b)](_0x100965?_0x21b858(0x2db,0x86)+_0x21b858(0x26f,_0x419b10._0x124858)+_0x386bea(_0x419b10._0x5338d8,_0x419b10._0x4b5aeb)+_0x21b858(_0x419b10._0x13b494,0x3fb)+_0x21b858(_0x419b10._0x1a954e,_0x419b10._0x38b5e0)+_0x386bea(0x93a,0x936)+'\x0a':'\x0aScan\x20th'+_0x21b858(_0x419b10._0x1a3d39,0x4e7)+_0x21b858(_0x419b10._0x3d7d3c,_0x419b10._0x132f3b)+_0x21b858(_0x419b10._0x3ca1aa,0x3db)+_0x21b858(_0x419b10._0x51f045,_0x419b10._0x45fae4)+_0x21b858(0xf,_0x419b10._0x45669d));const _0x382a26={};function _0x386bea(_0x25e80f,_0x540fe8){return _0x3266d5(_0x25e80f,_0x540fe8-0x40c);}function _0x21b858(_0x4d0927,_0x4a2ed4){return _0x3266d5(_0x4d0927,_0x4a2ed4-0xc);}_0x382a26[_0x21b858(_0x419b10._0x3dc472,_0x419b10._0x5994f4)]=!![],_0x3e24a7[_0x21b858(-0xa4,_0x419b10._0x3767ad)](_0x3e33cc,_0x382a26),console[_0x386bea(0xa18,0x89b)](_0x386bea(_0x419b10._0x132d03,_0x419b10._0x4fe3a2)+'\x20'+new Date(_0x162662)[_0x386bea(0x862,0x65f)+_0x21b858(-_0x419b10._0x226529,0x18b)]()),console[_0x386bea(_0x419b10._0x25a306,_0x419b10._0x15cda6)](_0x386bea(_0x419b10._0x4a2ca9,0x986)+':\x20'+_0x4ec7e8);}function printStatus(){const _0x19f24f={_0xb161ef:0xf4,_0x518ec3:0xe6,_0x38d853:0x2a9,_0x342a37:0x500,_0x17427e:0x594,_0x6bd22:0x12f,_0x750129:0xa5,_0x399a1d:0x250,_0x2efe2b:0x2d7,_0x1d0e2c:0x969,_0x192742:0x805,_0x935f6c:0x4f6,_0x4d676b:0x651,_0x581ecd:0x51c,_0x11159c:0x442,_0x1b8c02:0x536,_0x89490f:0x109,_0x246df9:0x8ec,_0x217c2a:0x332,_0x1e900a:0xdd,_0x486990:0x51b,_0x2af518:0x29f,_0x1d23de:0x9a,_0x31390a:0x876,_0x164bf3:0x53d,_0x2035ce:0x520},_0x3b3655={_0x599115:0xa9},_0x54cc91={_0x4b2c4c:0x429},_0x31ac3a={'CuvgK':function(_0x461a9c){return _0x461a9c();},'xxOuz':function(_0x282395){return _0x282395();},'LPSRo':_0x1349fe(_0x19f24f._0xb161ef,-_0x19f24f._0x518ec3)+'d'},_0x1c4375=_0x31ac3a['CuvgK'](readPairingConfig),_0xd0732c=getServiceStatus(),{logPath:_0x47fe38,errorLogPath:_0x4cfad}=_0x31ac3a[_0x1349fe(_0x19f24f._0x38d853,_0x19f24f._0x342a37)](getServicePaths),_0x42dd05=_0x31ac3a[_0x2d6f3e(0x7f0,0x6ae)](readCliVersion);function _0x1349fe(_0x56aaf2,_0x45349c){return _0x26b3dd(_0x56aaf2- -_0x54cc91._0x4b2c4c,_0x45349c);}console['log'](_0x2d6f3e(_0x19f24f._0x17427e,0x4ef)+'\x20'+_0x42dd05);!_0x1c4375?console['log'](_0x2d6f3e(0x588,0x6e5)+_0x1349fe(_0x19f24f._0x6bd22,-_0x19f24f._0x750129)+_0x1349fe(_0x19f24f._0x399a1d,_0x19f24f._0x2efe2b)+getPairingConfigPath()+')'):(console[_0x2d6f3e(0x876,0x653)]('Config:\x20'+_0x2d6f3e(_0x19f24f._0x1d0e2c,_0x19f24f._0x192742)),console[_0x1349fe(_0x19f24f._0x935f6c,_0x19f24f._0x4d676b)](_0x2d6f3e(_0x19f24f._0x581ecd,0x6f4)+_0x2d6f3e(0x52f,_0x19f24f._0x11159c)+_0x1c4375[_0x2d6f3e(0x76c,0x6cf)+'d']),console['log'](_0x2d6f3e(0x5a8,_0x19f24f._0x1b8c02)+':\x20'+_0x1c4375[_0x1349fe(0x5c5,0x5e4)+'Id']),console['log'](_0x1349fe(_0x19f24f._0x89490f,0x19a)+_0x2d6f3e(0x809,0x8de)+_0x1c4375['serverUr'+'l']),console['log'](_0x1349fe(0x4c0,0x5ab)+(_0x1c4375['displayN'+'ame']??'-')));console['log']('Gateway:'+'\x20'+resolveGatewayUrl());function _0x2d6f3e(_0x205686,_0x132b16){return _0x26b3dd(_0x205686- -_0x3b3655._0x599115,_0x132b16);}console[_0x1349fe(0x4f6,0x498)](_0x2d6f3e(0x6ec,_0x19f24f._0x246df9)+'\x20'+(_0xd0732c['installe'+'d']?_0x31ac3a['LPSRo']:_0x2d6f3e(0x499,0x1f1)+'alled')+'\x20('+_0xd0732c[_0x1349fe(_0x19f24f._0x217c2a,0x8f)]+')'),console['log']('Running:'+'\x20'+(_0xd0732c['running']?_0x2d6f3e(0x4d6,0x440):'no')),console[_0x1349fe(_0x19f24f._0x935f6c,0x363)](_0x1349fe(_0x19f24f._0x1e900a,0x2cc)+(_0xd0732c[_0x1349fe(_0x19f24f._0x486990,_0x19f24f._0x2af518)+_0x1349fe(_0x19f24f._0x1d23de,0x155)]||'-')),console[_0x2d6f3e(_0x19f24f._0x31390a,0x8bb)](_0x1349fe(0x83,0x1d4)+_0x47fe38),console[_0x2d6f3e(_0x19f24f._0x31390a,0xa5f)](_0x2d6f3e(0x858,0x748)+'g:\x20'+_0x4cfad),!_0x1c4375&&(process[_0x2d6f3e(_0x19f24f._0x164bf3,_0x19f24f._0x2035ce)]=0x1);}function printServiceResult(_0x2b2a3e,_0x4f9b93){const _0x4680e9={_0x2b66d0:0x446,_0x16eec2:0x57,_0x229251:0x11f,_0x4c14e2:0x4fc,_0x2c598a:0x6c2,_0x497aad:0x2f1,_0x13f622:0x49d,_0x5c8227:0x96a};function _0x398e56(_0x1facaa,_0x20c363){return _0x26b3dd(_0x1facaa- -0x574,_0x20c363);}_0x2b2a3e&&console[_0x6ab7ab(0x5d0,0x6ea)](_0x2b2a3e);console[_0x398e56(0x3ab,0x413)](_0x6ab7ab(_0x4680e9._0x2b66d0,0x617)+'\x20'+(_0x4f9b93['installe'+'d']?_0x4f9b93[_0x398e56(0x315,0x213)]?_0x398e56(-_0x4680e9._0x16eec2,-_0x4680e9._0x229251)+_0x6ab7ab(_0x4680e9._0x4c14e2,_0x4680e9._0x2c598a)+'ng':_0x398e56(-0x57,-_0x4680e9._0x497aad)+'d,\x20stopp'+'ed':'not\x20inst'+_0x6ab7ab(0x2ae,_0x4680e9._0x13f622)));function _0x6ab7ab(_0x4c6ea7,_0x1095e7){return _0x26b3dd(_0x4c6ea7- -0x34f,_0x1095e7);}console[_0x6ab7ab(0x5d0,0x7bc)](_0x6ab7ab(0x6b2,_0x4680e9._0x5c8227)+'path:\x20'+(_0x4f9b93[_0x6ab7ab(0x5f5,0x5b2)+'ath']||'-'));}function printDoctorReport(_0x485869){const _0x5d7584={_0x172571:0x5c,_0x573468:0x4d6,_0x3e62b7:0x12a,_0x50e920:0x5d,_0x125219:0x715,_0x2abe40:0x547,_0x16269d:0x6ca,_0x10ad51:0x4b8,_0x26d067:0x6ed,_0x49fd00:0x7a6,_0x42223c:0x740,_0xaf0c94:0x10f,_0x1d3fb5:0x661,_0x546827:0x116,_0x517ea8:0x740,_0x19b4d3:0x1f1,_0x342cba:0x740,_0x18ca95:0x67b,_0x4a837b:0x3e6,_0x4fd6a3:0x289,_0x19e343:0x3b5,_0x282563:0x7e,_0x4321fe:0x196,_0x1ca7c5:0x5ed,_0x5cc771:0x3f6,_0x5581d9:0x276,_0x53555b:0x2c8,_0xf680bb:0x302,_0x56835a:0x3cb,_0x5e3ca1:0x6e4,_0x52b8f2:0x6a6,_0x283793:0x3f9,_0x4f3ab0:0x3e6,_0x32f1cf:0x81,_0xeacda1:0xd1,_0x49f1a2:0x282,_0x360a82:0xb5,_0x2ff524:0x107,_0x52f33b:0x1b3,_0x1c0c9a:0xff,_0x1cc44c:0x3a6,_0xc34d66:0x55d,_0x1cb6d4:0x358,_0x1afb68:0x1f8,_0x238831:0x209,_0x1c7aa3:0x3ee,_0x225ac2:0x487,_0x5d4016:0x2d0,_0x5aed38:0x1e6,_0x5c4be5:0x6b,_0x4071f6:0x80,_0x117397:0x30,_0x15502e:0x276,_0x51d49a:0x189,_0x3089c0:0x19a,_0x40328c:0x358,_0x43b686:0xb3,_0x59c6a9:0x1a8,_0x3d2bd9:0xca,_0x350a44:0x328,_0x556939:0x31b,_0x94ec75:0x3bc,_0x3f96ba:0x2dd},_0x13a7cb={_0x1476c4:0x2b1},_0x2d61f1={_0x445672:0x219},_0x19bae9={};function _0x2ca216(_0x45498e,_0x185296){return _0x3266d5(_0x45498e,_0x185296- -_0x2d61f1._0x445672);}function _0x1d0adb(_0x5cddc7,_0x30876f){return _0x3266d5(_0x5cddc7,_0x30876f-_0x13a7cb._0x1476c4);}_0x19bae9[_0x2ca216(0x342,0x2dd)]=_0x1d0adb(_0x5d7584._0x172571,0x2e0),_0x19bae9[_0x1d0adb(0x73b,_0x5d7584._0x573468)]=_0x2ca216(0x120,-_0x5d7584._0x3e62b7);const _0x1ea278=_0x19bae9,_0x58014=(_0x2ca216(_0x5d7584._0x50e920,0x2da)+_0x1d0adb(0x7ca,_0x5d7584._0x125219)+_0x1d0adb(_0x5d7584._0x2abe40,_0x5d7584._0x16269d)+_0x1d0adb(_0x5d7584._0x10ad51,_0x5d7584._0x26d067)+_0x1d0adb(0x30c,0x441))['split']('|');let _0x190b56=0x0;while(!![]){switch(_0x58014[_0x190b56++]){case'0':console[_0x1d0adb(_0x5d7584._0x49fd00,_0x5d7584._0x42223c)](_0x2ca216(0x2b3,_0x5d7584._0xaf0c94)+_0x1d0adb(0x53b,_0x5d7584._0x1d3fb5)+_0x485869[_0x1d0adb(_0x5d7584._0x546827,0x308)+'Path']);continue;case'1':console[_0x1d0adb(0x806,_0x5d7584._0x517ea8)](_0x2ca216(0x11a,0x2e0)+':\x20'+_0x485869[_0x2ca216(0x59,_0x5d7584._0x19b4d3)]);continue;case'2':console[_0x1d0adb(0x9b7,_0x5d7584._0x342cba)](_0x1d0adb(_0x5d7584._0x18ca95,_0x5d7584._0x4a837b)+_0x1d0adb(_0x5d7584._0x4fd6a3,_0x5d7584._0x19e343)+_0x485869[_0x2ca216(_0x5d7584._0x282563,-0x9f)+_0x2ca216(0x2b,-_0x5d7584._0x4321fe)]);continue;case'3':console[_0x2ca216(-0x1c,0x276)]('Service:'+'\x20'+(_0x485869[_0x1d0adb(0x800,0x568)+_0x1d0adb(0x7a9,0x801)]?_0x1d0adb(_0x5d7584._0x1ca7c5,0x33e)+'d':'not\x20inst'+'alled')+'\x20('+_0x485869['serviceM'+'ethod']+')');continue;case'4':console[_0x2ca216(_0x5d7584._0x5cc771,_0x5d7584._0x5581d9)](_0x1d0adb(0x20c,0x3c3)+_0x2ca216(_0x5d7584._0x53555b,_0x5d7584._0xf680bb)+(_0x485869[_0x1d0adb(0x1fc,_0x5d7584._0x56835a)+_0x1d0adb(_0x5d7584._0x5e3ca1,_0x5d7584._0x52b8f2)+'nd']?'found':_0x1ea278['zdFHL']));continue;case'5':console['log'](_0x1d0adb(_0x5d7584._0x283793,_0x5d7584._0x4f3ab0)+_0x2ca216(_0x5d7584._0x32f1cf,-_0x5d7584._0xeacda1)+(_0x485869[_0x2ca216(-0x9b,0x16c)+'d']??'-'));continue;case'6':console[_0x2ca216(0x39d,_0x5d7584._0x5581d9)](_0x2ca216(0x1fa,-0x55)+(_0x485869['paired']?_0x1ea278['hrNrY']:'no'));continue;case'7':console[_0x2ca216(_0x5d7584._0x49f1a2,0x276)](_0x2ca216(_0x5d7584._0x360a82,-_0x5d7584._0x2ff524)+'\x20config:'+'\x20'+(_0x485869[_0x2ca216(-_0x5d7584._0x52f33b,-_0x5d7584._0x1c0c9a)+_0x1d0adb(0x55a,0x49d)+_0x1d0adb(0x372,_0x5d7584._0x1cc44c)]?_0x1d0adb(_0x5d7584._0xc34d66,_0x5d7584._0x1cb6d4):'missing'));continue;case'8':console[_0x2ca216(_0x5d7584._0x1afb68,_0x5d7584._0x5581d9)]('Server\x20U'+_0x2ca216(0x3f3,_0x5d7584._0x238831)+(_0x485869[_0x1d0adb(0x2e2,_0x5d7584._0x1c7aa3)+'l']??'-'));continue;case'9':console[_0x1d0adb(_0x5d7584._0x225ac2,0x740)]('Service\x20'+_0x1d0adb(_0x5d7584._0x5d4016,0x464)+(_0x485869[_0x2ca216(0x2f0,0x29b)+_0x2ca216(-0x2f,-_0x5d7584._0x5aed38)]||'-'));continue;case'10':console['log'](_0x1d0adb(0x31a,0x472)+_0x2ca216(0xa7,_0x5d7584._0x5c4be5)+(_0x485869['instance'+'Id']??'-'));continue;case'11':console[_0x2ca216(_0x5d7584._0x4071f6,0x276)]('Gateway\x20'+_0x2ca216(-0x38,0x1ff)+_0x1d0adb(0x6f9,0x546)+(_0x485869['localGat'+'ewayReac'+_0x2ca216(-_0x5d7584._0x117397,0x1f6)]?_0x1ea278[_0x2ca216(0x2b5,0xc)]:'no'));continue;case'12':console[_0x2ca216(0x3a5,_0x5d7584._0x15502e)](_0x2ca216(_0x5d7584._0x51d49a,_0x5d7584._0x3089c0)+'L:\x20'+(_0x485869['relayUrl']??'-'));continue;case'13':console[_0x2ca216(0x12,0x276)](_0x2ca216(0x48d,_0x5d7584._0x40328c)+_0x1d0adb(0x7d1,0x605)+'\x20'+(_0x485869['serviceR'+'unning']?_0x2ca216(_0x5d7584._0x43b686,-0x12a):'no'));continue;case'14':console['log'](_0x2ca216(0x9c,-0x107)+'\x20dir:\x20'+_0x485869[_0x1d0adb(_0x5d7584._0x59c6a9,_0x5d7584._0x56835a)+_0x2ca216(_0x5d7584._0x3d2bd9,_0x5d7584._0x350a44)+'r']);continue;case'15':console[_0x2ca216(_0x5d7584._0x556939,_0x5d7584._0x15502e)](_0x2ca216(-_0x5d7584._0x94ec75,-0x107)+_0x2ca216(-_0x5d7584._0x3f96ba,-0xf9)+_0x485869['openclaw'+'MediaDir']);continue;}break;}}function requirePairingConfig(){const _0x1de835={_0x2b3bcf:0x4b8,_0x4d2ea6:0x66e,_0x5864a1:0x4d8,_0x16bebe:0x56b,_0x1e3b83:0x30f,_0xf7241c:0x175},_0x3b1fba={'nTjKY':function(_0x2ae040){return _0x2ae040();}},_0x53a3a5=_0x3b1fba[_0x52bc85(0x4f1,0x2b3)](readPairingConfig);!_0x53a3a5&&(console[_0x52bc85(_0x1de835._0x2b3bcf,0x366)]('Not\x20pair'+'ed.\x20Run\x20'+_0x2a04c5(_0x1de835._0x4d2ea6,_0x1de835._0x5864a1)+'\x20pair\x22\x20f'+'irst.\x20Co'+_0x52bc85(_0x1de835._0x16bebe,_0x1de835._0x1e3b83)+_0x2a04c5(_0x1de835._0xf7241c,0x134)+getPairingConfigPath()),process['exit'](0x1));function _0x52bc85(_0x1099cd,_0x4f2890){return _0x3266d5(_0x1099cd,_0x4f2890- -0x145);}function _0x2a04c5(_0x359d55,_0x5da39b){return _0x3266d5(_0x359d55,_0x5da39b-0x1);}return _0x53a3a5;}function readFlag(_0x23c718,_0x55315f){const _0x3c1c05={_0x2a72b1:0x320,_0x1d846a:0x93,_0x49e692:0x1e8},_0x42732c={_0x4b16f5:0x44e},_0x310ed7={};_0x310ed7[_0x1533fe(_0x3c1c05._0x2a72b1,0xed)]=function(_0x4aee2f,_0x2a0f9c){return _0x4aee2f<_0x2a0f9c;};function _0x193f99(_0x15ec4a,_0x55f5dd){return _0x26b3dd(_0x55f5dd- -0x5ce,_0x15ec4a);}const _0x271a88=_0x310ed7;function _0x1533fe(_0x59ffc2,_0x53864c){return _0x26b3dd(_0x53864c- -_0x42732c._0x4b16f5,_0x59ffc2);}const _0x567026=_0x23c718[_0x193f99(0x11f,0x72)](_0x55315f);if(_0x271a88[_0x193f99(-0xe1,-_0x3c1c05._0x1d846a)](_0x567026,0x0))return null;const _0x3b43f4=_0x23c718[_0x567026+0x1];return _0x3b43f4?.[_0x193f99(0x43e,0x1e8)]()?_0x3b43f4[_0x193f99(0x46b,_0x3c1c05._0x49e692)]():null;}function hasFlag(_0x1b1642,_0x3c5495){const _0x40f1a6={_0x14723d:0x2f9};function _0x1425dd(_0x125f5f,_0x4c53a7){return _0x3266d5(_0x4c53a7,_0x125f5f- -0x1c4);}return _0x1b1642[_0x1425dd(_0x40f1a6._0x14723d,0x338)](_0x3c5495);}function readPairSubcommand(_0x4b76d3){const _0x3acfbd={_0x572f7a:0x16e,_0x266784:0x1d,_0x4e17e9:0x16a,_0x451227:0x412},_0x29100f={_0x2f631b:0x413};function _0x136066(_0x440001,_0x3636a1){return _0x3266d5(_0x3636a1,_0x440001- -0x1bc);}for(const _0x5143de of _0x4b76d3){if(!_0x5143de[_0x136066(_0x3acfbd._0x572f7a,_0x3acfbd._0x266784)+'th']('-'))return _0x5143de[_0x136066(_0x3acfbd._0x4e17e9,_0x3acfbd._0x451227)]()||null;}function _0x57fbe1(_0x42d8c8,_0x133129){return _0x3266d5(_0x42d8c8,_0x133129-_0x29100f._0x2f631b);}return null;}function printHelp(){const _0x404040={_0x37146e:0x266,_0x54b985:0x31f,_0x5dd87f:0x11e,_0x51bbb1:0xb0,_0x4523c8:0x5a,_0x3c30b6:0xd8,_0x53f47d:0x16,_0x67957f:0x276,_0x21c946:0x164,_0x4feb8b:0x3d7,_0x212de0:0x29e,_0x382247:0x226,_0xf8b793:0x435,_0x2c1c7a:0x1d7,_0x2b58e1:0x6b3,_0x27908c:0x23e,_0x4e66fd:0x1aa,_0xc505:0x39c,_0x5edd34:0x43c,_0x1b258e:0x5e,_0x3d58a8:0x204,_0x454abd:0x339,_0x38a2b8:0x3f,_0xb7cb2f:0xd3,_0x3ff743:0x1f1,_0x1312ac:0x25e,_0x4afaf6:0x65,_0x466919:0x499,_0x130e9a:0x1db,_0x462915:0x264,_0xec91fa:0x430,_0x1afec1:0x36e,_0x315f3d:0x26f,_0x4d5a84:0x26,_0x1fa211:0x461,_0x2aa8cc:0x6a,_0x316eee:0x250,_0x2dfeec:0x75,_0x2b69a6:0x35c,_0x200f6e:0x2b1,_0x28375d:0x25d,_0x14d9a5:0x2ce,_0x3d8126:0x180,_0x2dc62a:0x182,_0x1f4e82:0x121,_0x3e1221:0x21e,_0x3f9d72:0x258,_0x5be74d:0x2af,_0x21432b:0x474,_0x156955:0xbf,_0x1d3c83:0x400,_0x3544c1:0x24e,_0x2fecf5:0x187,_0x438fec:0x118,_0x42c299:0x16,_0xfd9923:0x286,_0x3abed4:0x3bf,_0x57faa6:0x2cd,_0x28ec5a:0x24e,_0x1025f7:0xe4,_0x3ac4db:0x2af,_0x41724a:0x85,_0x530077:0x21f,_0x5732b5:0xbb,_0xc1ace3:0xb9},_0x186fc4={_0x52d48c:0xb1},_0x23358d={};_0x23358d[_0x42f3cf(0xd7,_0x404040._0x37146e)]=_0x42f3cf(0x437,0x24e)+_0x42f3cf(_0x404040._0x54b985,_0x404040._0x5dd87f);function _0x164b3f(_0x4634c0,_0x5efda0){return _0x3266d5(_0x4634c0,_0x5efda0- -0x89);}function _0x42f3cf(_0x1da374,_0x23620f){return _0x3266d5(_0x1da374,_0x23620f- -_0x186fc4._0x52d48c);}_0x23358d[_0x164b3f(-_0x404040._0x51bbb1,0x1f1)]=_0x42f3cf(0x102,0x24e)+_0x164b3f(_0x404040._0x4523c8,0x164)+'l',_0x23358d[_0x164b3f(_0x404040._0x3c30b6,0x2fb)]=_0x164b3f(_0x404040._0x53f47d,_0x404040._0x67957f)+_0x42f3cf(0x38c,_0x404040._0x21c946);const _0x359abc=_0x23358d;console['log'](['clawket\x20'+_0x164b3f(_0x404040._0x4feb8b,_0x404040._0x212de0)+_0x42f3cf(0x322,_0x404040._0x382247)+_0x42f3cf(0x266,_0x404040._0xf8b793)+_0x164b3f(0x3ee,_0x404040._0x2c1c7a)+_0x42f3cf(_0x404040._0x2b58e1,0x441)+'me>]\x20[--'+_0x164b3f(0x91,0x2f6)+_0x164b3f(_0x404040._0x27908c,_0x404040._0x4e66fd)+_0x42f3cf(0x33,0x1f6)+_0x164b3f(_0x404040._0xc505,_0x404040._0x5edd34)+'e]','clawket\x20'+'pair\x20loc'+_0x164b3f(_0x404040._0x1b258e,_0x404040._0x3d58a8)+_0x164b3f(0x9a,_0x404040._0x454abd)+_0x42f3cf(-0x36,-_0x404040._0x38a2b8)+_0x42f3cf(_0x404040._0xb7cb2f,_0x404040._0x3ff743)+_0x42f3cf(-_0x404040._0x1312ac,-_0x404040._0x4afaf6)+_0x42f3cf(_0x404040._0x466919,_0x404040._0x130e9a)+_0x164b3f(_0x404040._0x462915,0x1e9),_0x164b3f(_0x404040._0xec91fa,0x276)+'pair\x20--l'+_0x164b3f(_0x404040._0x1afec1,0x2cc)+_0x164b3f(_0x404040._0x315f3d,_0x404040._0x4d5a84)+_0x42f3cf(_0x404040._0x1fa211,0x429)+_0x164b3f(0x2a3,0x3ff)+_0x42f3cf(-_0x404040._0x2aa8cc,_0x404040._0x316eee)+'\x20<path>]'+'\x20[--json'+']',_0x164b3f(_0x404040._0x2dfeec,0x276)+_0x42f3cf(0x3c9,_0x404040._0x2b69a6)+_0x164b3f(_0x404040._0x200f6e,_0x404040._0x28375d)+_0x42f3cf(0x291,_0x404040._0x14d9a5)+_0x42f3cf(_0x404040._0x3d8126,_0x404040._0x2dc62a)+_0x164b3f(_0x404040._0x1f4e82,_0x404040._0x3e1221),_0x42f3cf(0x59,0x24e)+_0x42f3cf(_0x404040._0x3f9d72,0x7),_0x164b3f(0xe5,0x276)+'install',_0x359abc[_0x164b3f(0x106,0x28e)],_0x164b3f(_0x404040._0x5be74d,0x276)+_0x164b3f(0x514,_0x404040._0x21432b),_0x359abc[_0x164b3f(-_0x404040._0x156955,0x1f1)],_0x359abc['SeygA'],_0x42f3cf(0x13d,0x24e)+'status',_0x42f3cf(_0x404040._0x1d3c83,_0x404040._0x3544c1)+'logs\x20[--'+_0x42f3cf(0x237,0x278)+'>]\x20[--li'+'nes\x20<200'+_0x42f3cf(-_0x404040._0x2fecf5,_0x404040._0x438fec)+_0x42f3cf(_0x404040._0x42c299,_0x404040._0xfd9923)+_0x42f3cf(0x5a1,_0x404040._0x3abed4),_0x42f3cf(_0x404040._0x57faa6,_0x404040._0x28ec5a)+'doctor\x20['+'--json]','clawket\x20'+_0x42f3cf(0x430,0x2f3)+_0x42f3cf(_0x404040._0x1025f7,0x252)+'rl\x20<ws:/'+_0x164b3f(_0x404040._0x3ac4db,_0x404040._0x41724a)+_0x42f3cf(-0x16,0xf5)+_0x164b3f(_0x404040._0x530077,0x3d9)+_0x164b3f(-_0x404040._0x5732b5,_0x404040._0xc1ace3)]['join']('\x0a'));}function buildUnsupportedAutostartMessage(_0x32bffb){const _0x427c82={_0x518010:0x7ac,_0xf9df9b:0x6fe,_0x3b3bbc:0x795,_0x3d1986:0x6d2,_0x4d429b:0x5ad,_0x326d21:0x7b9,_0x5310e5:0x550,_0x56ae93:0x2ae,_0xc44760:0x55c,_0x1beb6a:0x4a6,_0x311e96:0x43c,_0x5ddbb8:0x8de,_0x879dec:0x3cd,_0x1e545f:0x44d,_0xffe259:0x5f6,_0xb2646:0x755,_0x3ad7d8:0x4d5,_0x49209e:0x498,_0x3970f7:0x9a9,_0x489c5a:0x90f,_0x36b0ec:0x660,_0x497714:0xa00,_0x57ade2:0x93c,_0x8d937b:0x4cf,_0x1c12fd:0x48a,_0x15d4b3:0x5c4,_0x1ead4c:0x88d,_0x4bb8f9:0x9bd,_0x3a6762:0x29d,_0x1a678d:0x4ce},_0x19eff6={_0xcaf72c:0x496};function _0x5683fd(_0x55e487,_0x2a5b72){return _0x3266d5(_0x55e487,_0x2a5b72-0x3ba);}if(_0x32bffb[_0x5683fd(_0x427c82._0x518010,0x7b3)])return _0x80a916(0x6c9,0x91a)+'the\x20brid'+_0x5683fd(_0x427c82._0xf9df9b,0x675)+'me,\x20but\x20'+'this\x20hos'+_0x5683fd(0x6a9,0x44d)+_0x80a916(_0x427c82._0x3b3bbc,_0x427c82._0x3d1986)+_0x80a916(0x81a,0x679)+'atic\x20sta'+'rtup\x20reg'+_0x80a916(_0x427c82._0x4d429b,0x574)+_0x80a916(_0x427c82._0x326d21,_0x427c82._0x5310e5)+_0x80a916(_0x427c82._0x56ae93,_0x427c82._0xc44760)+'ainer\x20or'+'\x20process'+_0x5683fd(0x6e9,_0x427c82._0x1beb6a)+_0x5683fd(0x59e,_0x427c82._0x311e96)+_0x5683fd(0x8d9,_0x427c82._0x5ddbb8)+'ket\x20on\x20r'+_0x80a916(_0x427c82._0x879dec,0x5f0);function _0x80a916(_0x6fe930,_0xbe439f){return _0x3266d5(_0x6fe930,_0xbe439f-_0x19eff6._0xcaf72c);}return _0x5683fd(0x4ef,0x471)+_0x5683fd(0x614,_0x427c82._0x1e545f)+_0x5683fd(0x66c,_0x427c82._0xffe259)+_0x5683fd(0x57c,0x59d)+_0x80a916(0x8e4,_0x427c82._0xb2646)+'rtup\x20reg'+_0x5683fd(_0x427c82._0x3ad7d8,_0x427c82._0x49209e)+_0x80a916(0x282,0x4b5)+_0x5683fd(_0x427c82._0x3970f7,0x826)+'e\x20runtim'+_0x80a916(0x62b,0x7e4)+_0x5683fd(0x746,0x79c)+_0x80a916(_0x427c82._0x489c5a,_0x427c82._0x36b0ec)+_0x80a916(_0x427c82._0x497714,_0x427c82._0x57ade2)+'ally.\x20Us'+_0x5683fd(0x447,_0x427c82._0x8d937b)+_0x80a916(0x42e,0x624)+_0x5683fd(0x35b,_0x427c82._0x1c12fd)+_0x5683fd(0x870,_0x427c82._0x15d4b3)+_0x80a916(_0x427c82._0x1ead4c,_0x427c82._0x4bb8f9)+'un\x20Clawk'+_0x5683fd(_0x427c82._0x3a6762,_0x427c82._0x1a678d);}function formatLocalTime(_0x65b88f){const _0x4a6ee3={_0x1b3579:0x70b,_0x500c51:0x699,_0x28baa7:0x752},_0x294a20={_0x319358:0x4d6},_0x55f6f8=new Date(_0x65b88f);if(Number[_0x29d2d3(_0x4a6ee3._0x1b3579,_0x4a6ee3._0x500c51)](_0x55f6f8[_0x29d2d3(0x3db,0x5ad)]()))return _0x65b88f;function _0x4c6118(_0x3a83a2,_0x35a25e){return _0x3266d5(_0x35a25e,_0x3a83a2-0x4ff);}function _0x29d2d3(_0x821d93,_0x3a044f){return _0x3266d5(_0x821d93,_0x3a044f-_0x294a20._0x319358);}return _0x55f6f8[_0x4c6118(_0x4a6ee3._0x28baa7,0x5ba)+'String']();}function formatError2(_0x91cb24){const _0x193d1a={_0xb80035:0x82c},_0x37f3d3={};_0x37f3d3[_0x1321fa(0x5dc,_0x193d1a._0xb80035)]=function(_0x393789,_0x36ca57){return _0x393789 instanceof _0x36ca57;};function _0x1321fa(_0x5ef853,_0x127d80){return _0x3266d5(_0x5ef853,_0x127d80-0x338);}const _0x2e42d7=_0x37f3d3;return _0x2e42d7['XEjhV'](_0x91cb24,Error)?_0x91cb24['message']:String(_0x91cb24);}function printJson(_0x472b6f){const _0x5e7d24={_0x47531b:0x509};function _0x591f98(_0x113428,_0x236a49){return _0x3266d5(_0x236a49,_0x113428-_0x5e7d24._0x47531b);}console[_0x591f98(0x998,0x913)](JSON['stringif'+'y'](_0x472b6f,null,0x2));}main()[_0x3266d5(0x394,0x557)](_0x4fcac4=>{const _0x4066b9={_0x10787e:0x88d,_0x487f9a:0x8a8,_0x5bc423:0x741},_0x9f594e={_0x49204a:0x134},_0x442691={_0x54cbb6:0x237},_0x48d2ce={'uXCtd':function(_0x580276,_0x254f60){return _0x580276(_0x254f60);}};function _0x2d23be(_0x256c0c,_0x3ca6e3){return _0x26b3dd(_0x256c0c- -_0x442691._0x54cbb6,_0x3ca6e3);}console[_0x2d23be(0x704,_0x4066b9._0x10787e)](_0x48d2ce[_0x2b31eb(0x961,_0x4066b9._0x487f9a)](formatError2,_0x4fcac4));function _0x2b31eb(_0x4425d8,_0x1e975e){return _0x26b3dd(_0x1e975e- -_0x9f594e._0x49204a,_0x4425d8);}process[_0x2d23be(_0x4066b9._0x5bc423,0x8e0)](0x1);});
2
+
3
+ // src/index.ts
4
+ import qrcodeTerminal from "qrcode-terminal";
5
+
6
+ // src/diagnostics.ts
7
+ import { readFileSync as readFileSync4 } from "fs";
8
+ import { Socket } from "net";
9
+ import { homedir as homedir4 } from "os";
10
+
11
+ // ../../packages/bridge-core/dist/config.js
12
+ import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "fs";
13
+ import { randomUUID } from "crypto";
14
+ import { homedir, hostname, userInfo } from "os";
15
+ import { join } from "path";
16
+ var CONFIG_DIR = join(homedir(), ".clawket");
17
+ var CONFIG_PATH = join(CONFIG_DIR, "bridge-cli.json");
18
+ var CONFIG_DIR_MODE = 448;
19
+ var CONFIG_FILE_MODE = 384;
20
+ function getPairingConfigPath() {
21
+ return CONFIG_PATH;
22
+ }
23
+ function readPairingConfig() {
24
+ if (!existsSync(CONFIG_PATH))
25
+ return null;
26
+ hardenPairingConfigPermissions();
27
+ try {
28
+ const parsed = JSON.parse(readFileSync(CONFIG_PATH, "utf8"));
29
+ if (!parsed.serverUrl || !parsed.gatewayId || !parsed.relaySecret || !parsed.relayUrl) {
30
+ return null;
31
+ }
32
+ const normalized = {
33
+ serverUrl: parsed.serverUrl,
34
+ gatewayId: parsed.gatewayId,
35
+ relaySecret: parsed.relaySecret,
36
+ relayUrl: parsed.relayUrl,
37
+ instanceId: parsed.instanceId?.trim() || createInstanceId(),
38
+ displayName: parsed.displayName ?? null,
39
+ createdAt: parsed.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
40
+ updatedAt: parsed.updatedAt ?? (/* @__PURE__ */ new Date()).toISOString()
41
+ };
42
+ if (parsed.instanceId !== normalized.instanceId) {
43
+ writePairingConfig(normalized);
44
+ }
45
+ return normalized;
46
+ } catch {
47
+ return null;
48
+ }
49
+ }
50
+ function writePairingConfig(config) {
51
+ ensurePairingConfigDir();
52
+ writeFileSync(CONFIG_PATH, JSON.stringify(config, null, 2) + "\n", {
53
+ encoding: "utf8",
54
+ mode: CONFIG_FILE_MODE
55
+ });
56
+ safeChmodSync(CONFIG_PATH, CONFIG_FILE_MODE);
57
+ }
58
+ function deletePairingConfig() {
59
+ if (!existsSync(CONFIG_PATH))
60
+ return;
61
+ rmSync(CONFIG_PATH, { force: true });
62
+ }
63
+ function getDefaultBridgeDisplayName() {
64
+ const openClawName = readOpenClawDefaultAgentName();
65
+ if (openClawName)
66
+ return openClawName;
67
+ try {
68
+ const username = userInfo().username.trim();
69
+ if (username)
70
+ return username;
71
+ } catch {
72
+ }
73
+ const envName = (process.env.LOGNAME ?? process.env.USER ?? process.env.USERNAME ?? "").trim();
74
+ if (envName)
75
+ return envName;
76
+ return hostname().trim() || "Clawket Bridge";
77
+ }
78
+ function pickOpenClawDefaultAgentName(value) {
79
+ if (!value || typeof value !== "object")
80
+ return null;
81
+ const agents = value.agents;
82
+ const list = Array.isArray(agents?.list) ? agents.list : [];
83
+ const preferred = list.find((item) => isDefaultAgent(item)) ?? list.find((item) => hasAgentId(item, "main")) ?? list[0];
84
+ return readAgentName(preferred);
85
+ }
86
+ function createInstanceId() {
87
+ const host = sanitizeId(hostname() || "host");
88
+ return `inst-${host}-${randomUUID().slice(0, 10)}`;
89
+ }
90
+ function sanitizeId(input) {
91
+ return input.trim().toLowerCase().replace(/[^a-z0-9._-]+/g, "-").replace(/^-+|-+$/g, "") || "host";
92
+ }
93
+ function readOpenClawDefaultAgentName() {
94
+ const openclawConfigPath = resolveOpenClawConfigPath();
95
+ if (!openclawConfigPath || !existsSync(openclawConfigPath))
96
+ return null;
97
+ try {
98
+ const parsed = JSON.parse(readFileSync(openclawConfigPath, "utf8"));
99
+ return pickOpenClawDefaultAgentName(parsed);
100
+ } catch {
101
+ return null;
102
+ }
103
+ }
104
+ function ensurePairingConfigDir() {
105
+ mkdirSync(CONFIG_DIR, { recursive: true, mode: CONFIG_DIR_MODE });
106
+ safeChmodSync(CONFIG_DIR, CONFIG_DIR_MODE);
107
+ }
108
+ function hardenPairingConfigPermissions() {
109
+ if (existsSync(CONFIG_DIR)) {
110
+ safeChmodSync(CONFIG_DIR, CONFIG_DIR_MODE);
111
+ }
112
+ safeChmodSync(CONFIG_PATH, CONFIG_FILE_MODE);
113
+ }
114
+ function safeChmodSync(path, mode) {
115
+ try {
116
+ chmodSync(path, mode);
117
+ } catch {
118
+ }
119
+ }
120
+ function resolveOpenClawConfigPath() {
121
+ const seen = /* @__PURE__ */ new Set();
122
+ const homes = [homedir(), "/root"].map((value) => value.trim()).filter(Boolean).filter((value) => {
123
+ if (seen.has(value))
124
+ return false;
125
+ seen.add(value);
126
+ return true;
127
+ });
128
+ for (const home of homes) {
129
+ const configPath = join(home, ".openclaw", "openclaw.json");
130
+ if (existsSync(configPath))
131
+ return configPath;
132
+ }
133
+ return homes[0] ? join(homes[0], ".openclaw", "openclaw.json") : null;
134
+ }
135
+ function isDefaultAgent(value) {
136
+ return Boolean(value && typeof value === "object" && value.default === true);
137
+ }
138
+ function hasAgentId(value, id) {
139
+ return Boolean(value && typeof value === "object" && typeof value.id === "string" && value.id.trim() === id);
140
+ }
141
+ function readAgentName(value) {
142
+ if (!value || typeof value !== "object")
143
+ return null;
144
+ const record = value;
145
+ const identityName = typeof record.identity?.name === "string" ? record.identity.name.trim() : "";
146
+ if (identityName)
147
+ return identityName;
148
+ const name = typeof record.name === "string" ? record.name.trim() : "";
149
+ return name || null;
150
+ }
151
+
152
+ // ../../packages/bridge-core/dist/qr.js
153
+ function buildPairingQrPayload(input) {
154
+ const payload = {
155
+ v: 2,
156
+ k: "cp",
157
+ s: input.server,
158
+ g: input.gatewayId,
159
+ a: input.accessCode,
160
+ rb: 1,
161
+ pv: 2,
162
+ sb: true
163
+ };
164
+ if (input.displayName?.trim()) {
165
+ payload.n = input.displayName.trim();
166
+ }
167
+ if (input.token?.trim()) {
168
+ payload.t = input.token.trim();
169
+ }
170
+ if (input.password?.trim()) {
171
+ payload.p = input.password.trim();
172
+ }
173
+ return JSON.stringify(payload);
174
+ }
175
+ function buildGatewayQrPayload(input) {
176
+ const parsed = normalizeGatewayQrUrl(input.gatewayUrl);
177
+ const payload = {
178
+ url: parsed.url,
179
+ host: parsed.host,
180
+ port: parsed.port,
181
+ tls: parsed.tls,
182
+ mode: "gateway",
183
+ expiresAt: input.expiresAt ?? Date.now() + 10 * 60 * 1e3,
184
+ qrVersion: 2
185
+ };
186
+ if (input.token?.trim()) {
187
+ payload.token = input.token.trim();
188
+ }
189
+ if (input.password?.trim()) {
190
+ payload.password = input.password.trim();
191
+ }
192
+ return JSON.stringify(payload);
193
+ }
194
+ function normalizeGatewayQrUrl(url) {
195
+ const parsed = new URL(url.trim());
196
+ const tls = parsed.protocol === "wss:" || parsed.protocol === "https:";
197
+ const scheme = tls ? "wss:" : "ws:";
198
+ const host = parsed.hostname;
199
+ const port = parsed.port ? Number(parsed.port) : tls ? 443 : 80;
200
+ const path = !parsed.pathname || parsed.pathname === "" ? "/" : parsed.pathname;
201
+ return {
202
+ url: `${scheme}//${host}:${port}${path}`,
203
+ host,
204
+ port,
205
+ path,
206
+ tls
207
+ };
208
+ }
209
+
210
+ // ../../packages/bridge-core/dist/pairing.js
211
+ var DEFAULT_REGISTRY_BASE = "https://registry.clawket.ai";
212
+ var DEFAULT_REGISTRY_FALLBACK_BASE = "https://clawket-registry.clawket.workers.dev";
213
+ async function pairGateway(input) {
214
+ const baseUrl = normalizeHttpBase(input.serverUrl);
215
+ const existing = readPairingConfig();
216
+ const compatibility = assessPairingCompatibility(existing, baseUrl);
217
+ if (compatibility === "refresh-existing" && existing) {
218
+ return refreshAccessCode({
219
+ serverUrl: existing.serverUrl,
220
+ gatewayId: existing.gatewayId,
221
+ relaySecret: existing.relaySecret,
222
+ displayName: input.displayName,
223
+ gatewayToken: input.gatewayToken,
224
+ gatewayPassword: input.gatewayPassword
225
+ });
226
+ }
227
+ if (compatibility === "server-mismatch") {
228
+ throw new Error(`This bridge is already paired with ${existing?.serverUrl}. Run "clawket reset" before pairing with a different server.`);
229
+ }
230
+ const registerRequest = await postJsonWithCloudflareFallback(`${baseUrl}/v1/pair/register`, {
231
+ method: "POST",
232
+ headers: { "content-type": "application/json", accept: "application/json" },
233
+ body: JSON.stringify({
234
+ displayName: input.displayName?.trim() || null
235
+ })
236
+ });
237
+ if (!registerRequest.response.ok) {
238
+ throw await buildPairingRequestError("Pair register", registerRequest);
239
+ }
240
+ const payload = await registerRequest.response.json();
241
+ const now = (/* @__PURE__ */ new Date()).toISOString();
242
+ const config = {
243
+ serverUrl: baseUrl,
244
+ gatewayId: payload.gatewayId,
245
+ relaySecret: payload.relaySecret,
246
+ relayUrl: payload.relayUrl,
247
+ instanceId: existing?.instanceId ?? `inst-${payload.gatewayId.slice(-10)}`,
248
+ displayName: payload.displayName,
249
+ createdAt: now,
250
+ updatedAt: now
251
+ };
252
+ writePairingConfig(config);
253
+ return {
254
+ config,
255
+ accessCode: payload.accessCode,
256
+ accessCodeExpiresAt: payload.accessCodeExpiresAt,
257
+ action: "registered",
258
+ qrPayload: buildPairingQrPayload({
259
+ server: baseUrl,
260
+ gatewayId: payload.gatewayId,
261
+ accessCode: payload.accessCode,
262
+ displayName: payload.displayName,
263
+ token: input.gatewayToken?.trim() || null,
264
+ password: input.gatewayPassword?.trim() || null
265
+ })
266
+ };
267
+ }
268
+ async function refreshAccessCode(input) {
269
+ const existing = readPairingConfig();
270
+ const serverUrl = normalizeHttpBase(input?.serverUrl ?? existing?.serverUrl ?? "");
271
+ const gatewayId = input?.gatewayId ?? existing?.gatewayId ?? "";
272
+ const relaySecret = input?.relaySecret ?? existing?.relaySecret ?? "";
273
+ if (!serverUrl || !gatewayId || !relaySecret) {
274
+ throw new Error("Pairing config not found. Run pair first.");
275
+ }
276
+ const refreshRequest = await postJsonWithCloudflareFallback(`${serverUrl}/v1/pair/access-code`, {
277
+ method: "POST",
278
+ headers: { "content-type": "application/json", accept: "application/json" },
279
+ body: JSON.stringify({
280
+ gatewayId,
281
+ relaySecret,
282
+ displayName: input?.displayName?.trim() || void 0
283
+ })
284
+ });
285
+ if (!refreshRequest.response.ok) {
286
+ throw await buildPairingRequestError("Access code refresh", refreshRequest);
287
+ }
288
+ const payload = await refreshRequest.response.json();
289
+ const nextConfig = {
290
+ serverUrl,
291
+ gatewayId: payload.gatewayId,
292
+ relaySecret,
293
+ relayUrl: payload.relayUrl,
294
+ instanceId: existing?.instanceId ?? `inst-${payload.gatewayId.slice(-10)}`,
295
+ displayName: payload.displayName,
296
+ createdAt: existing?.createdAt ?? (/* @__PURE__ */ new Date()).toISOString(),
297
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
298
+ };
299
+ writePairingConfig(nextConfig);
300
+ return {
301
+ config: nextConfig,
302
+ accessCode: payload.accessCode,
303
+ accessCodeExpiresAt: payload.accessCodeExpiresAt,
304
+ action: "refreshed",
305
+ qrPayload: buildPairingQrPayload({
306
+ server: serverUrl,
307
+ gatewayId: payload.gatewayId,
308
+ accessCode: payload.accessCode,
309
+ displayName: payload.displayName,
310
+ token: input?.gatewayToken?.trim() || null,
311
+ password: input?.gatewayPassword?.trim() || null
312
+ })
313
+ };
314
+ }
315
+ function normalizeHttpBase(url) {
316
+ const trimmed = url.trim();
317
+ if (!trimmed)
318
+ return "";
319
+ if (trimmed.startsWith("http://") || trimmed.startsWith("https://")) {
320
+ return trimmed.replace(/\/+$/, "");
321
+ }
322
+ if (trimmed.startsWith("ws://"))
323
+ return `http://${trimmed.slice("ws://".length)}`.replace(/\/+$/, "");
324
+ if (trimmed.startsWith("wss://"))
325
+ return `https://${trimmed.slice("wss://".length)}`.replace(/\/+$/, "");
326
+ return `https://${trimmed}`.replace(/\/+$/, "");
327
+ }
328
+ function assessPairingCompatibility(existing, nextServerUrl) {
329
+ if (!existing)
330
+ return "register-new";
331
+ if (existing.serverUrl === nextServerUrl)
332
+ return "refresh-existing";
333
+ return "server-mismatch";
334
+ }
335
+ async function postJsonWithCloudflareFallback(url, init) {
336
+ const response = await fetch(url, init);
337
+ const fallbackUrl = resolveCloudflareChallengeFallbackUrl(url, response);
338
+ if (!fallbackUrl) {
339
+ return { response, attemptedUrl: url, fallbackUrl: null };
340
+ }
341
+ return {
342
+ response: await fetch(fallbackUrl, init),
343
+ attemptedUrl: url,
344
+ fallbackUrl
345
+ };
346
+ }
347
+ async function buildPairingRequestError(action, request) {
348
+ if (isCloudflareChallengeResponse(request.response)) {
349
+ const targetOrigin = new URL(request.fallbackUrl ?? request.attemptedUrl).origin;
350
+ const fallbackText = request.fallbackUrl ? ` Automatic fallback to ${request.fallbackUrl} also hit a Cloudflare challenge.` : "";
351
+ return new Error(`${action} failed (${request.response.status}): Cloudflare challenge blocked the registry API at ${targetOrigin}.${fallbackText} Retry from a different network or use a registry endpoint that does not require browser verification.`);
352
+ }
353
+ return new Error(`${action} failed (${request.response.status}): ${summarizeFailedResponse(await request.response.text())}`);
354
+ }
355
+ function isCloudflareChallengeResponse(response) {
356
+ return response.status === 403 && response.headers.get("cf-mitigated")?.trim().toLowerCase() === "challenge";
357
+ }
358
+ function resolveCloudflareChallengeFallbackUrl(url, response) {
359
+ if (!isCloudflareChallengeResponse(response))
360
+ return null;
361
+ const requestUrl = new URL(url);
362
+ if (requestUrl.origin !== DEFAULT_REGISTRY_BASE)
363
+ return null;
364
+ return `${DEFAULT_REGISTRY_FALLBACK_BASE}${requestUrl.pathname}${requestUrl.search}`;
365
+ }
366
+ function summarizeFailedResponse(text) {
367
+ const collapsed = text.replace(/\s+/g, " ").trim();
368
+ if (!collapsed)
369
+ return "Empty response body";
370
+ if (collapsed.length <= 240)
371
+ return collapsed;
372
+ return `${collapsed.slice(0, 237)}...`;
373
+ }
374
+
375
+ // ../../packages/bridge-core/dist/service.js
376
+ import { execFileSync, spawn } from "child_process";
377
+ import { chmodSync as chmodSync2, closeSync, existsSync as existsSync2, mkdirSync as mkdirSync2, openSync, readFileSync as readFileSync2, realpathSync, rmSync as rmSync2, writeFileSync as writeFileSync2 } from "fs";
378
+ import { homedir as homedir2 } from "os";
379
+ import { dirname, join as join2 } from "path";
380
+ import { setTimeout as delay } from "timers/promises";
381
+ var SERVICE_LABEL = "ai.clawket.bridge.cli";
382
+ var SYSTEMD_UNIT_NAME = `${SERVICE_LABEL}.service`;
383
+ var WINDOWS_RUN_KEY = "ClawketBridgeCli";
384
+ var SERVICE_DIR = join2(homedir2(), ".clawket");
385
+ var LOG_DIR = join2(SERVICE_DIR, "logs");
386
+ var SERVICE_STATE_PATH = join2(SERVICE_DIR, "bridge-service.json");
387
+ var RUNTIME_REGISTRY_PATH = join2(SERVICE_DIR, "bridge-runtime-processes.json");
388
+ var SERVICE_LAUNCHER_PATH = join2(SERVICE_DIR, "clawket-launcher.sh");
389
+ var LINUX_CRON_RECORD_PATH = join2(SERVICE_DIR, "bridge-service.cron");
390
+ var SERVICE_LOG_PATH = join2(LOG_DIR, "bridge-cli.log");
391
+ var SERVICE_ERROR_LOG_PATH = join2(LOG_DIR, "bridge-cli-error.log");
392
+ var MACOS_PLIST_PATH = join2(homedir2(), "Library", "LaunchAgents", `${SERVICE_LABEL}.plist`);
393
+ var LINUX_SERVICE_PATH = join2(homedir2(), ".config", "systemd", "user", SYSTEMD_UNIT_NAME);
394
+ var LINUX_CRON_MARKER = "# clawket-bridge-cli";
395
+ function getServiceProgramArgs(context = {}, platform = process.platform) {
396
+ const nodePath = context.nodePath?.trim() || process.execPath;
397
+ const scriptPath = resolveScriptPath(context.scriptPath);
398
+ if (!scriptPath) {
399
+ throw new Error("Unable to resolve CLI script path for service installation.");
400
+ }
401
+ if (platform !== "win32") {
402
+ const launcherPath = writeServiceLauncher({
403
+ nodePath,
404
+ scriptPath,
405
+ pathEnv: process.env.PATH ?? ""
406
+ });
407
+ ensureLaunchScriptExecutable(launcherPath, platform);
408
+ return [launcherPath];
409
+ }
410
+ return [nodePath, scriptPath, "run", "--service"];
411
+ }
412
+ function getServiceStatus() {
413
+ ensureServiceDirs();
414
+ const pid = readServiceState()?.pid ?? null;
415
+ const method = detectServiceMethod();
416
+ const base = {
417
+ installed: false,
418
+ running: pid != null && isPidRunning(pid),
419
+ method,
420
+ servicePath: getServicePath(method),
421
+ logPath: SERVICE_LOG_PATH,
422
+ errorLogPath: SERVICE_ERROR_LOG_PATH,
423
+ pid
424
+ };
425
+ if (base.pid != null && !base.running) {
426
+ clearServiceState(base.pid);
427
+ base.pid = null;
428
+ }
429
+ switch (base.method) {
430
+ case "launchagent":
431
+ base.installed = existsSync2(MACOS_PLIST_PATH);
432
+ if (base.installed) {
433
+ base.running = commandSucceeds("launchctl", ["list", SERVICE_LABEL]) || base.running;
434
+ }
435
+ return base;
436
+ case "systemd-user":
437
+ base.installed = existsSync2(LINUX_SERVICE_PATH);
438
+ if (base.installed) {
439
+ base.running = commandSucceeds("systemctl", ["--user", "is-active", "--quiet", SYSTEMD_UNIT_NAME]) || base.running;
440
+ }
441
+ return base;
442
+ case "linux-crontab":
443
+ base.installed = hasLinuxCronRegistration();
444
+ return base;
445
+ case "windows-run-registry":
446
+ base.installed = commandSucceeds("reg", [
447
+ "query",
448
+ "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",
449
+ "/v",
450
+ WINDOWS_RUN_KEY
451
+ ]);
452
+ return base;
453
+ default:
454
+ return base;
455
+ }
456
+ }
457
+ function installService(context = {}) {
458
+ ensureServiceDirs();
459
+ const args = getServiceProgramArgs(context);
460
+ switch (process.platform) {
461
+ case "darwin":
462
+ writeFileSync2(MACOS_PLIST_PATH, buildMacosPlist(args, SERVICE_LOG_PATH, SERVICE_ERROR_LOG_PATH), "utf8");
463
+ execIgnoreFailure("launchctl", ["unload", "-w", MACOS_PLIST_PATH]);
464
+ execFileSync("launchctl", ["load", "-w", MACOS_PLIST_PATH], { stdio: "ignore" });
465
+ break;
466
+ case "linux":
467
+ installLinuxService(args);
468
+ break;
469
+ case "win32":
470
+ stopRunningProcess();
471
+ execFileSync("reg", [
472
+ "add",
473
+ "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",
474
+ "/v",
475
+ WINDOWS_RUN_KEY,
476
+ "/t",
477
+ "REG_SZ",
478
+ "/d",
479
+ buildWindowsRunCommand(args),
480
+ "/f"
481
+ ], { stdio: "ignore" });
482
+ startDetachedWindowsService(args);
483
+ break;
484
+ default:
485
+ throw new Error(`Unsupported platform for CLI service installation: ${process.platform}`);
486
+ }
487
+ return getServiceStatus();
488
+ }
489
+ function restartService(context = {}) {
490
+ ensureServiceDirs();
491
+ const args = getServiceProgramArgs(context);
492
+ switch (process.platform) {
493
+ case "darwin":
494
+ if (!existsSync2(MACOS_PLIST_PATH)) {
495
+ return installService(context);
496
+ }
497
+ writeFileSync2(MACOS_PLIST_PATH, buildMacosPlist(args, SERVICE_LOG_PATH, SERVICE_ERROR_LOG_PATH), "utf8");
498
+ execIgnoreFailure("launchctl", ["unload", "-w", MACOS_PLIST_PATH]);
499
+ execFileSync("launchctl", ["load", "-w", MACOS_PLIST_PATH], { stdio: "ignore" });
500
+ break;
501
+ case "linux":
502
+ restartLinuxService(args);
503
+ break;
504
+ case "win32":
505
+ stopRunningProcess();
506
+ execFileSync("reg", [
507
+ "add",
508
+ "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",
509
+ "/v",
510
+ WINDOWS_RUN_KEY,
511
+ "/t",
512
+ "REG_SZ",
513
+ "/d",
514
+ buildWindowsRunCommand(args),
515
+ "/f"
516
+ ], { stdio: "ignore" });
517
+ startDetachedWindowsService(args);
518
+ break;
519
+ default:
520
+ throw new Error(`Unsupported platform for CLI service restart: ${process.platform}`);
521
+ }
522
+ return getServiceStatus();
523
+ }
524
+ async function startTransientRuntime(context = {}) {
525
+ ensureServiceDirs();
526
+ const args = getServiceProgramArgs(context);
527
+ switch (process.platform) {
528
+ case "darwin":
529
+ case "linux":
530
+ startDetachedPosixService(args);
531
+ break;
532
+ case "win32":
533
+ startDetachedWindowsService(args);
534
+ break;
535
+ default:
536
+ throw new Error(`Unsupported platform for transient CLI runtime start: ${process.platform}`);
537
+ }
538
+ return waitForRuntimeState();
539
+ }
540
+ function uninstallService() {
541
+ stopRunningProcess();
542
+ switch (process.platform) {
543
+ case "darwin":
544
+ execIgnoreFailure("launchctl", ["unload", "-w", MACOS_PLIST_PATH]);
545
+ rmIfExists(MACOS_PLIST_PATH);
546
+ break;
547
+ case "linux":
548
+ if (existsSync2(LINUX_SERVICE_PATH)) {
549
+ execIgnoreFailure("systemctl", ["--user", "disable", "--now", SYSTEMD_UNIT_NAME]);
550
+ rmIfExists(LINUX_SERVICE_PATH);
551
+ execIgnoreFailure("systemctl", ["--user", "daemon-reload"]);
552
+ }
553
+ removeLinuxCronRegistration();
554
+ break;
555
+ case "win32":
556
+ execIgnoreFailure("reg", [
557
+ "delete",
558
+ "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run",
559
+ "/v",
560
+ WINDOWS_RUN_KEY,
561
+ "/f"
562
+ ]);
563
+ break;
564
+ default:
565
+ break;
566
+ }
567
+ clearServiceState();
568
+ return getServiceStatus();
569
+ }
570
+ function stopService() {
571
+ stopRunningProcess();
572
+ switch (process.platform) {
573
+ case "darwin":
574
+ if (existsSync2(MACOS_PLIST_PATH)) {
575
+ execIgnoreFailure("launchctl", ["unload", MACOS_PLIST_PATH]);
576
+ }
577
+ break;
578
+ case "linux":
579
+ if (existsSync2(LINUX_SERVICE_PATH)) {
580
+ execIgnoreFailure("systemctl", ["--user", "stop", SYSTEMD_UNIT_NAME]);
581
+ }
582
+ break;
583
+ case "win32":
584
+ break;
585
+ default:
586
+ break;
587
+ }
588
+ clearServiceState();
589
+ return getServiceStatus();
590
+ }
591
+ function writeServiceState(pid = process.pid) {
592
+ ensureServiceDirs();
593
+ const state = {
594
+ pid,
595
+ startedAt: (/* @__PURE__ */ new Date()).toISOString()
596
+ };
597
+ writeFileSync2(SERVICE_STATE_PATH, JSON.stringify(state, null, 2) + "\n", "utf8");
598
+ }
599
+ function registerRuntimeProcess(record) {
600
+ ensureServiceDirs();
601
+ const next = {
602
+ pid: record.pid ?? process.pid,
603
+ startedAt: record.startedAt ?? (/* @__PURE__ */ new Date()).toISOString(),
604
+ gatewayId: record.gatewayId,
605
+ instanceId: record.instanceId,
606
+ serviceMode: record.serviceMode,
607
+ scriptPath: resolveScriptPath(record.scriptPath)
608
+ };
609
+ const records = readRuntimeRegistry().filter((entry) => entry.pid !== next.pid).concat(next);
610
+ writeRuntimeRegistry(records);
611
+ }
612
+ function unregisterRuntimeProcess(pid = process.pid) {
613
+ const records = readRuntimeRegistry().filter((entry) => entry.pid !== pid);
614
+ writeRuntimeRegistry(records);
615
+ }
616
+ function isAutostartUnsupportedError(error) {
617
+ const message = formatError(error).toLowerCase();
618
+ return message.includes("no crontab fallback is available") || message.includes("unsupported platform for cli service");
619
+ }
620
+ function listRuntimeProcesses(context = {}) {
621
+ const scriptPath = resolveScriptPath(context.scriptPath);
622
+ const records = readRuntimeRegistry();
623
+ const result = [...records];
624
+ const known = new Set(records.map((entry) => entry.pid));
625
+ for (const pid of listPosixRuntimePids(scriptPath)) {
626
+ if (known.has(pid))
627
+ continue;
628
+ result.push({
629
+ pid,
630
+ startedAt: (/* @__PURE__ */ new Date(0)).toISOString(),
631
+ gatewayId: "",
632
+ instanceId: "",
633
+ serviceMode: false,
634
+ scriptPath
635
+ });
636
+ }
637
+ return result.filter((entry) => isPidRunning(entry.pid)).sort((a, b) => a.pid - b.pid);
638
+ }
639
+ function stopRuntimeProcesses(options = {}) {
640
+ const records = listRuntimeProcesses({ scriptPath: options.scriptPath });
641
+ const victims = records.filter((entry) => entry.pid !== (options.excludePid ?? -1));
642
+ if (process.platform === "win32") {
643
+ for (const entry of victims) {
644
+ execIgnoreFailure("taskkill", ["/PID", String(entry.pid), "/T", "/F"]);
645
+ }
646
+ } else {
647
+ for (const entry of victims) {
648
+ execIgnoreFailure("kill", ["-TERM", String(entry.pid)]);
649
+ }
650
+ for (const entry of victims) {
651
+ if (!waitForPidExit(entry.pid, 3e3)) {
652
+ execIgnoreFailure("kill", ["-KILL", String(entry.pid)]);
653
+ }
654
+ }
655
+ }
656
+ const remaining = readRuntimeRegistry().filter((entry) => !victims.some((victim) => victim.pid === entry.pid));
657
+ writeRuntimeRegistry(remaining);
658
+ const serviceState = readServiceState();
659
+ if (serviceState && victims.some((entry) => entry.pid === serviceState.pid)) {
660
+ clearServiceState();
661
+ }
662
+ return victims.map((entry) => entry.pid);
663
+ }
664
+ function clearServiceState(expectedPid) {
665
+ if (!existsSync2(SERVICE_STATE_PATH))
666
+ return;
667
+ if (expectedPid != null) {
668
+ const current = readServiceState();
669
+ if (current && current.pid !== expectedPid) {
670
+ return;
671
+ }
672
+ }
673
+ rmIfExists(SERVICE_STATE_PATH);
674
+ }
675
+ function getServicePaths() {
676
+ return {
677
+ logPath: SERVICE_LOG_PATH,
678
+ errorLogPath: SERVICE_ERROR_LOG_PATH,
679
+ servicePath: getServicePath(detectServiceMethod())
680
+ };
681
+ }
682
+ function buildMacosPlist(programArgs, logPath, errorLogPath) {
683
+ const argsXml = programArgs.map((arg) => ` <string>${escapeXml(arg)}</string>`).join("\n");
684
+ return `<?xml version="1.0" encoding="UTF-8"?>
685
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
686
+ <plist version="1.0">
687
+ <dict>
688
+ <key>Label</key>
689
+ <string>${SERVICE_LABEL}</string>
690
+ <key>ProgramArguments</key>
691
+ <array>
692
+ ${argsXml}
693
+ </array>
694
+ <key>RunAtLoad</key>
695
+ <true/>
696
+ <key>KeepAlive</key>
697
+ <true/>
698
+ <key>StandardOutPath</key>
699
+ <string>${escapeXml(logPath)}</string>
700
+ <key>StandardErrorPath</key>
701
+ <string>${escapeXml(errorLogPath)}</string>
702
+ </dict>
703
+ </plist>
704
+ `;
705
+ }
706
+ function buildLinuxSystemdUnit(programArgs, logPath, errorLogPath) {
707
+ const execStart = programArgs.map(escapeSystemdArg).join(" ");
708
+ return `[Unit]
709
+ Description=Clawket Bridge CLI
710
+ After=network-online.target
711
+ Wants=network-online.target
712
+
713
+ [Service]
714
+ Type=simple
715
+ ExecStart=${execStart}
716
+ Restart=always
717
+ RestartSec=2
718
+ WorkingDirectory=${escapeSystemdArg(SERVICE_DIR)}
719
+ StandardOutput=append:${logPath}
720
+ StandardError=append:${errorLogPath}
721
+
722
+ [Install]
723
+ WantedBy=default.target
724
+ `;
725
+ }
726
+ function buildLinuxCronEntry(programArgs, logPath, errorLogPath) {
727
+ const command = programArgs.map(escapeShellWord).join(" ");
728
+ return `@reboot ${command} >> ${escapeShellWord(logPath)} 2>> ${escapeShellWord(errorLogPath)} ${LINUX_CRON_MARKER}`;
729
+ }
730
+ function getServicePath(method) {
731
+ switch (process.platform) {
732
+ case "darwin":
733
+ return MACOS_PLIST_PATH;
734
+ case "linux":
735
+ return method === "linux-crontab" ? LINUX_CRON_RECORD_PATH : LINUX_SERVICE_PATH;
736
+ case "win32":
737
+ return "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\\ClawketBridgeCli";
738
+ default:
739
+ return "";
740
+ }
741
+ }
742
+ function detectServiceMethod() {
743
+ switch (process.platform) {
744
+ case "darwin":
745
+ return "launchagent";
746
+ case "linux":
747
+ if (existsSync2(LINUX_SERVICE_PATH)) {
748
+ return "systemd-user";
749
+ }
750
+ if (hasLinuxCronRegistration()) {
751
+ return "linux-crontab";
752
+ }
753
+ if (commandExists("systemctl")) {
754
+ return "systemd-user";
755
+ }
756
+ if (commandExists("crontab")) {
757
+ return "linux-crontab";
758
+ }
759
+ return "unsupported";
760
+ case "win32":
761
+ return "windows-run-registry";
762
+ default:
763
+ return "unsupported";
764
+ }
765
+ }
766
+ function readServiceState() {
767
+ if (!existsSync2(SERVICE_STATE_PATH))
768
+ return null;
769
+ try {
770
+ const parsed = JSON.parse(readFileSync2(SERVICE_STATE_PATH, "utf8"));
771
+ if (!parsed.pid || typeof parsed.pid !== "number")
772
+ return null;
773
+ return {
774
+ pid: parsed.pid,
775
+ startedAt: parsed.startedAt ?? (/* @__PURE__ */ new Date(0)).toISOString()
776
+ };
777
+ } catch {
778
+ return null;
779
+ }
780
+ }
781
+ function readRuntimeRegistry() {
782
+ if (!existsSync2(RUNTIME_REGISTRY_PATH))
783
+ return [];
784
+ try {
785
+ const parsed = JSON.parse(readFileSync2(RUNTIME_REGISTRY_PATH, "utf8"));
786
+ if (!Array.isArray(parsed))
787
+ return [];
788
+ const normalized = parsed.map((entry) => normalizeRuntimeProcessRecord(entry)).filter((entry) => entry != null && isPidRunning(entry.pid));
789
+ writeRuntimeRegistry(normalized);
790
+ return normalized;
791
+ } catch {
792
+ return [];
793
+ }
794
+ }
795
+ function writeRuntimeRegistry(records) {
796
+ if (records.length === 0) {
797
+ rmIfExists(RUNTIME_REGISTRY_PATH);
798
+ return;
799
+ }
800
+ ensureServiceDirs();
801
+ writeFileSync2(RUNTIME_REGISTRY_PATH, JSON.stringify(records, null, 2) + "\n", "utf8");
802
+ }
803
+ function normalizeRuntimeProcessRecord(value) {
804
+ if (!value || typeof value !== "object")
805
+ return null;
806
+ const entry = value;
807
+ if (!entry.pid || typeof entry.pid !== "number")
808
+ return null;
809
+ const scriptPath = typeof entry.scriptPath === "string" ? resolveScriptPath(entry.scriptPath) : "";
810
+ if (!scriptPath)
811
+ return null;
812
+ return {
813
+ pid: entry.pid,
814
+ startedAt: typeof entry.startedAt === "string" ? entry.startedAt : (/* @__PURE__ */ new Date(0)).toISOString(),
815
+ gatewayId: typeof entry.gatewayId === "string" ? entry.gatewayId : "",
816
+ instanceId: typeof entry.instanceId === "string" ? entry.instanceId : "",
817
+ serviceMode: entry.serviceMode === true,
818
+ scriptPath
819
+ };
820
+ }
821
+ function stopRunningProcess() {
822
+ const state = readServiceState();
823
+ if (!state)
824
+ return;
825
+ execIgnoreFailure(process.platform === "win32" ? "taskkill" : "kill", process.platform === "win32" ? ["/PID", String(state.pid), "/T", "/F"] : ["-TERM", String(state.pid)]);
826
+ clearServiceState(state.pid);
827
+ }
828
+ function listPosixRuntimePids(scriptPath) {
829
+ if (!scriptPath || process.platform === "win32")
830
+ return [];
831
+ try {
832
+ const output = execFileSync("ps", ["-ax", "-o", "pid=,args="], { encoding: "utf8" });
833
+ return output.split("\n").map((line) => line.trim()).filter(Boolean).flatMap((line) => {
834
+ const match = line.match(/^(\d+)\s+(.*)$/);
835
+ if (!match)
836
+ return [];
837
+ const pid = Number(match[1]);
838
+ const command = match[2];
839
+ if (!Number.isInteger(pid) || pid <= 0 || pid === process.pid)
840
+ return [];
841
+ if (!command.includes(scriptPath))
842
+ return [];
843
+ if (!/\brun\b/.test(command))
844
+ return [];
845
+ return [pid];
846
+ });
847
+ } catch {
848
+ return [];
849
+ }
850
+ }
851
+ function isPidRunning(pid) {
852
+ try {
853
+ process.kill(pid, 0);
854
+ return true;
855
+ } catch {
856
+ return false;
857
+ }
858
+ }
859
+ function waitForPidExit(pid, timeoutMs) {
860
+ const deadline = Date.now() + timeoutMs;
861
+ const sleepBuf = new Int32Array(new SharedArrayBuffer(4));
862
+ while (isPidRunning(pid)) {
863
+ if (Date.now() >= deadline)
864
+ return false;
865
+ Atomics.wait(sleepBuf, 0, 0, 50);
866
+ }
867
+ return true;
868
+ }
869
+ function startDetachedWindowsService(programArgs) {
870
+ const outFd = openSync(SERVICE_LOG_PATH, "a");
871
+ const errFd = openSync(SERVICE_ERROR_LOG_PATH, "a");
872
+ try {
873
+ const [command, ...args] = programArgs;
874
+ const child = spawn(command, args, {
875
+ detached: true,
876
+ stdio: ["ignore", outFd, errFd],
877
+ windowsHide: true
878
+ });
879
+ child.unref();
880
+ } finally {
881
+ closeSync(outFd);
882
+ closeSync(errFd);
883
+ }
884
+ }
885
+ function startDetachedPosixService(programArgs) {
886
+ const outFd = openSync(SERVICE_LOG_PATH, "a");
887
+ const errFd = openSync(SERVICE_ERROR_LOG_PATH, "a");
888
+ try {
889
+ const [command, ...args] = programArgs;
890
+ const child = spawn(command, args, {
891
+ detached: true,
892
+ stdio: ["ignore", outFd, errFd]
893
+ });
894
+ child.unref();
895
+ } finally {
896
+ closeSync(outFd);
897
+ closeSync(errFd);
898
+ }
899
+ }
900
+ async function waitForRuntimeState(timeoutMs = 1500, pollMs = 50) {
901
+ const deadline = Date.now() + timeoutMs;
902
+ let lastStatus = getServiceStatus();
903
+ while (Date.now() < deadline) {
904
+ if (lastStatus.running)
905
+ return lastStatus;
906
+ await delay(pollMs);
907
+ lastStatus = getServiceStatus();
908
+ }
909
+ return lastStatus;
910
+ }
911
+ function installLinuxService(programArgs) {
912
+ try {
913
+ installLinuxSystemdService(programArgs);
914
+ removeLinuxCronRegistration();
915
+ return;
916
+ } catch (error) {
917
+ installLinuxCronService(programArgs, error);
918
+ }
919
+ }
920
+ function restartLinuxService(programArgs) {
921
+ try {
922
+ restartLinuxSystemdService(programArgs);
923
+ removeLinuxCronRegistration();
924
+ return;
925
+ } catch (error) {
926
+ installLinuxCronService(programArgs, error);
927
+ }
928
+ }
929
+ function installLinuxSystemdService(programArgs) {
930
+ if (!commandExists("systemctl")) {
931
+ throw new Error("systemctl is not available");
932
+ }
933
+ mkdirSync2(dirname(LINUX_SERVICE_PATH), { recursive: true });
934
+ writeFileSync2(LINUX_SERVICE_PATH, buildLinuxSystemdUnit(programArgs, SERVICE_LOG_PATH, SERVICE_ERROR_LOG_PATH), "utf8");
935
+ execFileSync("systemctl", ["--user", "daemon-reload"], { stdio: "ignore" });
936
+ execFileSync("systemctl", ["--user", "enable", "--now", SYSTEMD_UNIT_NAME], { stdio: "ignore" });
937
+ }
938
+ function restartLinuxSystemdService(programArgs) {
939
+ if (!commandExists("systemctl")) {
940
+ throw new Error("systemctl is not available");
941
+ }
942
+ if (!existsSync2(LINUX_SERVICE_PATH)) {
943
+ installLinuxSystemdService(programArgs);
944
+ return;
945
+ }
946
+ writeFileSync2(LINUX_SERVICE_PATH, buildLinuxSystemdUnit(programArgs, SERVICE_LOG_PATH, SERVICE_ERROR_LOG_PATH), "utf8");
947
+ execFileSync("systemctl", ["--user", "daemon-reload"], { stdio: "ignore" });
948
+ execFileSync("systemctl", ["--user", "restart", SYSTEMD_UNIT_NAME], { stdio: "ignore" });
949
+ }
950
+ function installLinuxCronService(programArgs, systemdError) {
951
+ if (!commandExists("crontab")) {
952
+ throw new Error(`Linux service installation failed and no crontab fallback is available: ${formatError(systemdError)}`);
953
+ }
954
+ rmIfExists(LINUX_SERVICE_PATH);
955
+ const entry = buildLinuxCronEntry(programArgs, SERVICE_LOG_PATH, SERVICE_ERROR_LOG_PATH);
956
+ writeLinuxCrontabEntry(entry);
957
+ writeFileSync2(LINUX_CRON_RECORD_PATH, entry + "\n", "utf8");
958
+ stopRunningProcess();
959
+ startDetachedPosixService(programArgs);
960
+ }
961
+ function hasLinuxCronRegistration() {
962
+ if (process.platform !== "linux")
963
+ return false;
964
+ return readLinuxCrontab().some((line) => line.includes(LINUX_CRON_MARKER));
965
+ }
966
+ function removeLinuxCronRegistration() {
967
+ if (process.platform !== "linux")
968
+ return;
969
+ if (commandExists("crontab")) {
970
+ const filtered = readLinuxCrontab().filter((line) => !line.includes(LINUX_CRON_MARKER));
971
+ writeLinuxCrontab(filtered);
972
+ }
973
+ rmIfExists(LINUX_CRON_RECORD_PATH);
974
+ }
975
+ function writeLinuxCrontabEntry(entry) {
976
+ const filtered = readLinuxCrontab().filter((line) => !line.includes(LINUX_CRON_MARKER));
977
+ filtered.push(entry);
978
+ writeLinuxCrontab(filtered);
979
+ }
980
+ function readLinuxCrontab() {
981
+ if (!commandExists("crontab"))
982
+ return [];
983
+ try {
984
+ const output = execFileSync("crontab", ["-l"], { encoding: "utf8" });
985
+ return output.split("\n").map((line) => line.trimEnd()).filter((line) => line.length > 0);
986
+ } catch (error) {
987
+ if (isMissingCrontabError(error)) {
988
+ return [];
989
+ }
990
+ throw error;
991
+ }
992
+ }
993
+ function writeLinuxCrontab(lines) {
994
+ if (!commandExists("crontab"))
995
+ return;
996
+ if (lines.length === 0) {
997
+ execIgnoreFailure("crontab", ["-r"]);
998
+ return;
999
+ }
1000
+ execFileSync("crontab", ["-"], {
1001
+ input: `${lines.join("\n")}
1002
+ `,
1003
+ encoding: "utf8",
1004
+ stdio: ["pipe", "ignore", "ignore"]
1005
+ });
1006
+ }
1007
+ function resolveScriptPath(scriptPath) {
1008
+ const value = scriptPath?.trim() || process.argv[1]?.trim() || "";
1009
+ if (!value)
1010
+ return "";
1011
+ try {
1012
+ return realpathSync(value);
1013
+ } catch {
1014
+ return value;
1015
+ }
1016
+ }
1017
+ function ensureLaunchScriptExecutable(scriptPath, platform) {
1018
+ if (platform === "win32" || !existsSync2(scriptPath))
1019
+ return;
1020
+ try {
1021
+ chmodSync2(scriptPath, 493);
1022
+ } catch {
1023
+ }
1024
+ }
1025
+ function writeServiceLauncher(input) {
1026
+ ensureServiceDirs();
1027
+ const lines = [
1028
+ "#!/bin/sh",
1029
+ `export PATH="${escapeShellDoubleQuoted(input.pathEnv)}"`,
1030
+ `NODE_PATH="${escapeShellDoubleQuoted(input.nodePath)}"`,
1031
+ `SCRIPT_PATH="${escapeShellDoubleQuoted(input.scriptPath)}"`,
1032
+ 'if [ -x "$NODE_PATH" ]; then',
1033
+ ' exec "$NODE_PATH" "$SCRIPT_PATH" run --service',
1034
+ "fi",
1035
+ "if command -v node >/dev/null 2>&1; then",
1036
+ ' exec node "$SCRIPT_PATH" run --service',
1037
+ "fi",
1038
+ 'echo "node runtime not found for Clawket Bridge service" >&2',
1039
+ "exit 127",
1040
+ ""
1041
+ ];
1042
+ writeFileSync2(SERVICE_LAUNCHER_PATH, lines.join("\n"), "utf8");
1043
+ return SERVICE_LAUNCHER_PATH;
1044
+ }
1045
+ function escapeShellDoubleQuoted(value) {
1046
+ return value.replaceAll("\\", "\\\\").replaceAll('"', '\\"').replaceAll("$", "\\$").replaceAll("`", "\\`");
1047
+ }
1048
+ function escapeShellWord(value) {
1049
+ if (value.length === 0)
1050
+ return "''";
1051
+ return `'${value.replaceAll("'", `'"'"'`)}'`;
1052
+ }
1053
+ function buildWindowsRunCommand(programArgs) {
1054
+ return programArgs.map(escapeWindowsArg).join(" ");
1055
+ }
1056
+ function ensureServiceDirs() {
1057
+ mkdirSync2(SERVICE_DIR, { recursive: true });
1058
+ mkdirSync2(LOG_DIR, { recursive: true });
1059
+ }
1060
+ function escapeXml(value) {
1061
+ return value.replaceAll("&", "&amp;").replaceAll("<", "&lt;").replaceAll(">", "&gt;").replaceAll('"', "&quot;").replaceAll("'", "&apos;");
1062
+ }
1063
+ function escapeSystemdArg(value) {
1064
+ return `"${value.replaceAll("\\", "\\\\").replaceAll('"', '\\"')}"`;
1065
+ }
1066
+ function escapeWindowsArg(value) {
1067
+ return `"${value.replaceAll('"', '\\"')}"`;
1068
+ }
1069
+ function commandSucceeds(command, args) {
1070
+ try {
1071
+ execFileSync(command, args, { stdio: "ignore" });
1072
+ return true;
1073
+ } catch {
1074
+ return false;
1075
+ }
1076
+ }
1077
+ function commandExists(command) {
1078
+ if (process.platform === "win32") {
1079
+ return commandSucceeds("where", [command]);
1080
+ }
1081
+ return commandSucceeds("sh", ["-c", `command -v ${escapeShellWord(command)}`]);
1082
+ }
1083
+ function execIgnoreFailure(command, args) {
1084
+ try {
1085
+ execFileSync(command, args, { stdio: "ignore" });
1086
+ } catch {
1087
+ }
1088
+ }
1089
+ function rmIfExists(path) {
1090
+ if (!existsSync2(path))
1091
+ return;
1092
+ rmSync2(path, { force: true });
1093
+ }
1094
+ function isMissingCrontabError(error) {
1095
+ if (!(error instanceof Error))
1096
+ return false;
1097
+ const message = error.message.toLowerCase();
1098
+ const stderrValue = error.stderr;
1099
+ const stderr = typeof stderrValue === "string" ? stderrValue.toLowerCase() : Buffer.isBuffer(stderrValue) ? stderrValue.toString("utf8").toLowerCase() : "";
1100
+ return message.includes("no crontab for") || stderr.includes("no crontab for");
1101
+ }
1102
+ function formatError(error) {
1103
+ if (error instanceof Error && error.message) {
1104
+ return error.message;
1105
+ }
1106
+ return String(error);
1107
+ }
1108
+
1109
+ // ../../packages/bridge-runtime/dist/openclaw.js
1110
+ import { execFile } from "child_process";
1111
+ import { randomBytes } from "crypto";
1112
+ import { existsSync as existsSync3, readFileSync as readFileSync3 } from "fs";
1113
+ import { chmod, mkdir, readFile, rename, rm, writeFile } from "fs/promises";
1114
+ import { homedir as homedir3 } from "os";
1115
+ import { dirname as dirname2, join as join3, resolve } from "path";
1116
+ var DEFAULT_GATEWAY_URL = "ws://127.0.0.1:18789";
1117
+ var DEVICE_BOOTSTRAP_TOKEN_TTL_MS = 10 * 60 * 1e3;
1118
+ var BOOTSTRAP_FILENAME = "bootstrap.json";
1119
+ var PAIRING_TOKEN_BYTES = 32;
1120
+ var OPENCLAW_CLI_COMMAND = "openclaw";
1121
+ var withBootstrapLock = createAsyncLock();
1122
+ function resolveGatewayUrl(explicitUrl) {
1123
+ const trimmed = explicitUrl?.trim();
1124
+ if (trimmed)
1125
+ return trimmed;
1126
+ const info = readOpenClawInfo();
1127
+ if (typeof info.gatewayPort === "number") {
1128
+ return `ws://127.0.0.1:${info.gatewayPort}`;
1129
+ }
1130
+ return DEFAULT_GATEWAY_URL;
1131
+ }
1132
+ function readOpenClawInfo() {
1133
+ const openclaw = resolveOpenClawPaths();
1134
+ if (!existsSync3(openclaw.configPath)) {
1135
+ return {
1136
+ configFound: false,
1137
+ gatewayPort: null,
1138
+ authMode: null,
1139
+ token: readGatewayTokenEnv(),
1140
+ password: readGatewayPasswordEnv()
1141
+ };
1142
+ }
1143
+ try {
1144
+ const parsed = JSON.parse(readFileSync3(openclaw.configPath, "utf8"));
1145
+ const rawPort = parsed.gateway?.port;
1146
+ const gatewayPort = typeof rawPort === "number" && Number.isInteger(rawPort) ? rawPort : null;
1147
+ const authMode = parsed.gateway?.auth?.mode === "token" || parsed.gateway?.auth?.mode === "password" ? parsed.gateway.auth.mode : null;
1148
+ const token = readConfiguredSecret(parsed.gateway?.auth?.token) ?? readGatewayTokenEnv();
1149
+ const password = readConfiguredSecret(parsed.gateway?.auth?.password) ?? readGatewayPasswordEnv();
1150
+ return {
1151
+ configFound: true,
1152
+ gatewayPort,
1153
+ authMode,
1154
+ token,
1155
+ password
1156
+ };
1157
+ } catch {
1158
+ return {
1159
+ configFound: true,
1160
+ gatewayPort: null,
1161
+ authMode: null,
1162
+ token: readGatewayTokenEnv(),
1163
+ password: readGatewayPasswordEnv()
1164
+ };
1165
+ }
1166
+ }
1167
+ function resolveGatewayAuth() {
1168
+ const info = readOpenClawInfo();
1169
+ const token = info.token;
1170
+ const password = info.password;
1171
+ if (token && password && info.authMode == null) {
1172
+ return {
1173
+ token,
1174
+ password,
1175
+ label: "token",
1176
+ error: "OpenClaw has both gateway token and password configured, but gateway.auth.mode is unset. Set the mode to token or password before pairing."
1177
+ };
1178
+ }
1179
+ if (info.authMode === "password") {
1180
+ return password ? { token: null, password, label: "password" } : { token: null, password: null, label: null };
1181
+ }
1182
+ if (info.authMode === "token") {
1183
+ return token ? { token, password: null, label: "token" } : { token: null, password: null, label: null };
1184
+ }
1185
+ if (token) {
1186
+ return { token, password: null, label: "token" };
1187
+ }
1188
+ if (password) {
1189
+ return { token: null, password, label: "password" };
1190
+ }
1191
+ return { token: null, password: null, label: null };
1192
+ }
1193
+ function getOpenClawConfigDir() {
1194
+ return resolveOpenClawPaths().configDir;
1195
+ }
1196
+ function getOpenClawStateDir() {
1197
+ return resolveOpenClawPaths().stateDir;
1198
+ }
1199
+ function getOpenClawMediaDir() {
1200
+ return resolveOpenClawPaths().mediaDir;
1201
+ }
1202
+ async function configureOpenClawLanAccess(params) {
1203
+ const openclaw = resolveOpenClawPaths();
1204
+ if (!existsSync3(openclaw.configPath)) {
1205
+ throw new Error(`OpenClaw config was not found at ${openclaw.configPath}. Run OpenClaw setup first, then retry local pairing.`);
1206
+ }
1207
+ const controlUiOrigin = normalizeControlUiOrigin(params.controlUiOrigin);
1208
+ const currentBind = await readOpenClawConfigString("gateway.bind", openclaw);
1209
+ const currentAllowedOrigins = await readOpenClawAllowedOrigins(openclaw);
1210
+ let bindChanged = false;
1211
+ if (currentBind !== "lan") {
1212
+ await runOpenClawCli(["config", "set", "gateway.bind", "lan"], openclaw);
1213
+ bindChanged = true;
1214
+ }
1215
+ const allowedOrigins = appendUniqueOrigin(currentAllowedOrigins, controlUiOrigin);
1216
+ const allowedOriginAdded = allowedOrigins.length !== currentAllowedOrigins.length;
1217
+ if (allowedOriginAdded) {
1218
+ await runOpenClawCli([
1219
+ "config",
1220
+ "set",
1221
+ "gateway.controlUi.allowedOrigins",
1222
+ JSON.stringify(allowedOrigins),
1223
+ "--strict-json"
1224
+ ], openclaw);
1225
+ }
1226
+ return {
1227
+ configPath: openclaw.configPath,
1228
+ bindChanged,
1229
+ allowedOriginAdded,
1230
+ allowedOrigins,
1231
+ controlUiOrigin
1232
+ };
1233
+ }
1234
+ async function restartOpenClawGateway() {
1235
+ const openclaw = resolveOpenClawPaths();
1236
+ const restart = await runOpenClawDaemonCommand(["gateway", "restart", "--json"], openclaw);
1237
+ if (restart.result === "not-loaded") {
1238
+ const start = await runOpenClawDaemonCommand(["gateway", "start", "--json"], openclaw);
1239
+ if (start.result === "not-loaded") {
1240
+ throw new Error(buildGatewayNotLoadedMessage(start));
1241
+ }
1242
+ return {
1243
+ action: "started",
1244
+ result: start.result ?? "started",
1245
+ message: start.message,
1246
+ warnings: start.warnings
1247
+ };
1248
+ }
1249
+ return {
1250
+ action: "restarted",
1251
+ result: restart.result ?? "restarted",
1252
+ message: restart.message,
1253
+ warnings: restart.warnings
1254
+ };
1255
+ }
1256
+ function getOpenClawBootstrapPath(stateDir = getOpenClawStateDir()) {
1257
+ return join3(stateDir, "devices", BOOTSTRAP_FILENAME);
1258
+ }
1259
+ async function issueOpenClawBootstrapToken(params) {
1260
+ const deviceId = params.deviceId.trim();
1261
+ const publicKey = params.publicKey.trim();
1262
+ const role = params.role.trim();
1263
+ const scopes = normalizeStringArray(params.scopes);
1264
+ if (!deviceId || !publicKey || !role || scopes.length === 0) {
1265
+ throw new Error("deviceId, publicKey, role, and scopes are required");
1266
+ }
1267
+ return await withBootstrapLock(async () => {
1268
+ const stateDir = params.stateDir ?? getOpenClawStateDir();
1269
+ const statePath = getOpenClawBootstrapPath(stateDir);
1270
+ const state = await loadBootstrapState(statePath);
1271
+ const token = generatePairingToken();
1272
+ const issuedAtMs = Date.now();
1273
+ state[token] = {
1274
+ token,
1275
+ ts: issuedAtMs,
1276
+ deviceId,
1277
+ publicKey,
1278
+ roles: [role],
1279
+ scopes,
1280
+ issuedAtMs
1281
+ };
1282
+ await writeJsonAtomic(statePath, state);
1283
+ return {
1284
+ token,
1285
+ expiresAtMs: issuedAtMs + DEVICE_BOOTSTRAP_TOKEN_TTL_MS,
1286
+ statePath
1287
+ };
1288
+ });
1289
+ }
1290
+ function readConfiguredSecret(value) {
1291
+ return typeof value === "string" && value.trim() ? value.trim() : null;
1292
+ }
1293
+ async function readOpenClawConfigString(configPath, openclaw = resolveOpenClawPaths()) {
1294
+ try {
1295
+ const { stdout } = await runOpenClawCli(["config", "get", configPath], openclaw);
1296
+ const trimmed = stdout.trim();
1297
+ return trimmed || null;
1298
+ } catch (error) {
1299
+ if (isMissingConfigPathError(error)) {
1300
+ return null;
1301
+ }
1302
+ throw error;
1303
+ }
1304
+ }
1305
+ async function readOpenClawAllowedOrigins(openclaw = resolveOpenClawPaths()) {
1306
+ try {
1307
+ const { stdout } = await runOpenClawCli(["config", "get", "gateway.controlUi.allowedOrigins", "--json"], openclaw);
1308
+ const parsed = parseEmbeddedJsonValue(stdout);
1309
+ return Array.isArray(parsed) ? parsed.filter((value) => typeof value === "string").map((value) => value.trim()).filter(Boolean) : [];
1310
+ } catch (error) {
1311
+ if (isMissingConfigPathError(error)) {
1312
+ return [];
1313
+ }
1314
+ throw error;
1315
+ }
1316
+ }
1317
+ async function runOpenClawDaemonCommand(args, openclaw = resolveOpenClawPaths()) {
1318
+ const { stdout } = await runOpenClawCli(args, openclaw);
1319
+ let parsed;
1320
+ try {
1321
+ parsed = parseEmbeddedJsonValue(stdout);
1322
+ } catch (error) {
1323
+ throw new Error(`OpenClaw ${args.slice(0, 2).join(" ")} returned invalid JSON output.`, { cause: error });
1324
+ }
1325
+ if (parsed.ok !== true) {
1326
+ throw new Error(parsed.error?.trim() || `OpenClaw ${args.slice(0, 2).join(" ")} failed.`);
1327
+ }
1328
+ return {
1329
+ result: typeof parsed.result === "string" ? parsed.result : void 0,
1330
+ message: typeof parsed.message === "string" ? parsed.message : null,
1331
+ warnings: Array.isArray(parsed.warnings) ? parsed.warnings.filter((value) => typeof value === "string") : [],
1332
+ hints: Array.isArray(parsed.hints) ? parsed.hints.filter((value) => typeof value === "string") : []
1333
+ };
1334
+ }
1335
+ async function runOpenClawCli(args, openclaw = resolveOpenClawPaths()) {
1336
+ try {
1337
+ return await new Promise((resolvePromise, rejectPromise) => {
1338
+ execFile(OPENCLAW_CLI_COMMAND, args, {
1339
+ encoding: "utf8",
1340
+ env: {
1341
+ ...process.env,
1342
+ OPENCLAW_STATE_DIR: openclaw.stateDir,
1343
+ OPENCLAW_CONFIG_PATH: openclaw.configPath
1344
+ },
1345
+ maxBuffer: 1024 * 1024
1346
+ }, (error, stdout, stderr) => {
1347
+ if (error) {
1348
+ Object.assign(error, {
1349
+ stdout,
1350
+ stderr
1351
+ });
1352
+ rejectPromise(error);
1353
+ return;
1354
+ }
1355
+ resolvePromise({ stdout, stderr });
1356
+ });
1357
+ });
1358
+ } catch (error) {
1359
+ throw formatOpenClawCliError(args, error);
1360
+ }
1361
+ }
1362
+ function formatOpenClawCliError(args, error) {
1363
+ const messagePrefix = `OpenClaw ${args.join(" ")}`;
1364
+ if (isExecFileError(error)) {
1365
+ if (error.code === "ENOENT") {
1366
+ return new Error(`OpenClaw CLI was not found on PATH. Install OpenClaw and ensure \`${OPENCLAW_CLI_COMMAND}\` is available before running local pairing.`);
1367
+ }
1368
+ const combined = [error.stderr, error.stdout].filter((value) => typeof value === "string" && value.trim().length > 0).join("\n").trim();
1369
+ return new Error(combined ? `${messagePrefix} failed: ${combined}` : `${messagePrefix} failed.`);
1370
+ }
1371
+ return error instanceof Error ? error : new Error(`${messagePrefix} failed: ${String(error)}`);
1372
+ }
1373
+ function isMissingConfigPathError(error) {
1374
+ return error instanceof Error && /Config path not found:/i.test(error.message);
1375
+ }
1376
+ function isExecFileError(error) {
1377
+ return error instanceof Error;
1378
+ }
1379
+ function normalizeControlUiOrigin(origin) {
1380
+ const parsed = new URL(origin.trim());
1381
+ return parsed.origin;
1382
+ }
1383
+ function appendUniqueOrigin(currentOrigins, nextOrigin) {
1384
+ const normalizedNext = normalizeControlUiOrigin(nextOrigin).toLowerCase();
1385
+ const seen = /* @__PURE__ */ new Set();
1386
+ const seenInvalid = /* @__PURE__ */ new Set();
1387
+ const result = [];
1388
+ for (const origin of currentOrigins) {
1389
+ const trimmed = origin.trim();
1390
+ if (!trimmed) {
1391
+ continue;
1392
+ }
1393
+ let normalized;
1394
+ try {
1395
+ normalized = normalizeControlUiOrigin(trimmed).toLowerCase();
1396
+ } catch {
1397
+ const invalidKey = trimmed.toLowerCase();
1398
+ if (seenInvalid.has(invalidKey)) {
1399
+ continue;
1400
+ }
1401
+ seenInvalid.add(invalidKey);
1402
+ result.push(trimmed);
1403
+ continue;
1404
+ }
1405
+ if (seen.has(normalized)) {
1406
+ continue;
1407
+ }
1408
+ seen.add(normalized);
1409
+ result.push(normalized === normalizedNext ? normalizeControlUiOrigin(nextOrigin) : normalizeControlUiOrigin(trimmed));
1410
+ }
1411
+ if (!seen.has(normalizedNext)) {
1412
+ result.push(normalizeControlUiOrigin(nextOrigin));
1413
+ }
1414
+ return result;
1415
+ }
1416
+ function buildGatewayNotLoadedMessage(result) {
1417
+ const parts = [
1418
+ "OpenClaw Gateway is not running under a managed service, and no unmanaged gateway process could be restarted automatically."
1419
+ ];
1420
+ if (result.message) {
1421
+ parts.push(result.message);
1422
+ }
1423
+ if (result.hints.length > 0) {
1424
+ parts.push(result.hints.join(" "));
1425
+ }
1426
+ parts.push("Start the Gateway first, then rerun `clawket pair --local`.");
1427
+ return parts.join(" ");
1428
+ }
1429
+ function parseEmbeddedJsonValue(text) {
1430
+ const trimmed = text.trim();
1431
+ if (!trimmed) {
1432
+ throw new Error("Empty JSON output");
1433
+ }
1434
+ try {
1435
+ return JSON.parse(trimmed);
1436
+ } catch {
1437
+ }
1438
+ for (let index = 0; index < trimmed.length; index += 1) {
1439
+ const char = trimmed[index];
1440
+ if (char !== "{" && char !== "[") {
1441
+ continue;
1442
+ }
1443
+ const candidate = extractBalancedJsonValue(trimmed, index);
1444
+ if (!candidate) {
1445
+ continue;
1446
+ }
1447
+ try {
1448
+ return JSON.parse(candidate);
1449
+ } catch {
1450
+ }
1451
+ }
1452
+ throw new Error("Unable to locate a JSON value in command output.");
1453
+ }
1454
+ function extractBalancedJsonValue(text, startIndex) {
1455
+ let depth = 0;
1456
+ let inString = false;
1457
+ let escaping = false;
1458
+ for (let index = startIndex; index < text.length; index += 1) {
1459
+ const char = text[index];
1460
+ if (inString) {
1461
+ if (escaping) {
1462
+ escaping = false;
1463
+ continue;
1464
+ }
1465
+ if (char === "\\") {
1466
+ escaping = true;
1467
+ continue;
1468
+ }
1469
+ if (char === '"') {
1470
+ inString = false;
1471
+ }
1472
+ continue;
1473
+ }
1474
+ if (char === '"') {
1475
+ inString = true;
1476
+ continue;
1477
+ }
1478
+ if (char === "{" || char === "[") {
1479
+ depth += 1;
1480
+ continue;
1481
+ }
1482
+ if (char === "}" || char === "]") {
1483
+ depth -= 1;
1484
+ if (depth === 0) {
1485
+ return text.slice(startIndex, index + 1);
1486
+ }
1487
+ if (depth < 0) {
1488
+ return null;
1489
+ }
1490
+ }
1491
+ }
1492
+ return null;
1493
+ }
1494
+ function readGatewayTokenEnv() {
1495
+ return readEnvValue("OPENCLAW_GATEWAY_TOKEN", "CLAWDBOT_GATEWAY_TOKEN");
1496
+ }
1497
+ function readGatewayPasswordEnv() {
1498
+ return readEnvValue("OPENCLAW_GATEWAY_PASSWORD", "CLAWDBOT_GATEWAY_PASSWORD");
1499
+ }
1500
+ function readEnvValue(primary, legacy) {
1501
+ const current = process.env[primary]?.trim();
1502
+ if (current)
1503
+ return current;
1504
+ const fallback = process.env[legacy]?.trim();
1505
+ return fallback || null;
1506
+ }
1507
+ function resolveOpenClawPaths() {
1508
+ const stateDir = resolveActiveOpenClawStateDir();
1509
+ const configPath = resolveActiveOpenClawConfigPath(stateDir);
1510
+ return {
1511
+ stateDir,
1512
+ configDir: dirname2(configPath),
1513
+ configPath,
1514
+ mediaDir: join3(stateDir, "media")
1515
+ };
1516
+ }
1517
+ function resolveActiveOpenClawStateDir() {
1518
+ const explicitStateDir = readEnvValue("OPENCLAW_STATE_DIR", "CLAWDBOT_STATE_DIR");
1519
+ if (explicitStateDir) {
1520
+ return resolveUserPath(explicitStateDir);
1521
+ }
1522
+ const candidates = buildOpenClawStateDirCandidates();
1523
+ const existing = candidates.find((stateDir) => existsSync3(join3(stateDir, "openclaw.json")));
1524
+ return existing ?? candidates[0] ?? join3(homedir3(), ".openclaw");
1525
+ }
1526
+ function resolveActiveOpenClawConfigPath(stateDir) {
1527
+ const explicitConfigPath = readEnvValue("OPENCLAW_CONFIG_PATH", "CLAWDBOT_CONFIG_PATH");
1528
+ if (explicitConfigPath) {
1529
+ return resolveUserPath(explicitConfigPath);
1530
+ }
1531
+ return join3(stateDir, "openclaw.json");
1532
+ }
1533
+ function buildOpenClawStateDirCandidates() {
1534
+ const seen = /* @__PURE__ */ new Set();
1535
+ return [homedir3(), "/root"].map((value) => value.trim()).filter(Boolean).map((home) => join3(home, ".openclaw")).filter((value) => {
1536
+ if (seen.has(value))
1537
+ return false;
1538
+ seen.add(value);
1539
+ return true;
1540
+ });
1541
+ }
1542
+ function resolveUserPath(input) {
1543
+ const trimmed = input.trim();
1544
+ if (!trimmed)
1545
+ return trimmed;
1546
+ if (trimmed === "~") {
1547
+ return resolve(homedir3());
1548
+ }
1549
+ if (trimmed.startsWith("~/")) {
1550
+ return resolve(join3(homedir3(), trimmed.slice(2)));
1551
+ }
1552
+ return resolve(trimmed);
1553
+ }
1554
+ async function loadBootstrapState(statePath) {
1555
+ const state = await readJsonFile(statePath) ?? {};
1556
+ const now = Date.now();
1557
+ for (const [token, entry] of Object.entries(state)) {
1558
+ if (!entry || typeof entry !== "object") {
1559
+ delete state[token];
1560
+ continue;
1561
+ }
1562
+ if (typeof entry.ts !== "number" && typeof entry.issuedAtMs === "number") {
1563
+ entry.ts = entry.issuedAtMs;
1564
+ }
1565
+ if (now - entry.ts > DEVICE_BOOTSTRAP_TOKEN_TTL_MS) {
1566
+ delete state[token];
1567
+ }
1568
+ }
1569
+ return state;
1570
+ }
1571
+ async function readJsonFile(filePath) {
1572
+ try {
1573
+ return JSON.parse(await readFile(filePath, "utf8"));
1574
+ } catch {
1575
+ return null;
1576
+ }
1577
+ }
1578
+ async function writeJsonAtomic(filePath, value) {
1579
+ const payload = JSON.stringify(value, null, 2);
1580
+ await mkdir(dirname2(filePath), { recursive: true, mode: 448 });
1581
+ const tmpPath = `${filePath}.${randomUUIDFragment()}.tmp`;
1582
+ try {
1583
+ await writeFile(tmpPath, payload, { encoding: "utf8", mode: 384 });
1584
+ await safeChmod(tmpPath, 384);
1585
+ await rename(tmpPath, filePath);
1586
+ await safeChmod(filePath, 384);
1587
+ } finally {
1588
+ await rm(tmpPath, { force: true }).catch(() => void 0);
1589
+ }
1590
+ }
1591
+ async function safeChmod(filePath, mode) {
1592
+ try {
1593
+ await chmod(filePath, mode);
1594
+ } catch {
1595
+ }
1596
+ }
1597
+ function generatePairingToken() {
1598
+ return randomBytes(PAIRING_TOKEN_BYTES).toString("base64url");
1599
+ }
1600
+ function normalizeStringArray(values) {
1601
+ const normalized = /* @__PURE__ */ new Set();
1602
+ for (const value of values) {
1603
+ const trimmed = typeof value === "string" ? value.trim() : "";
1604
+ if (trimmed) {
1605
+ normalized.add(trimmed);
1606
+ }
1607
+ }
1608
+ return [...normalized].sort();
1609
+ }
1610
+ function randomUUIDFragment() {
1611
+ return randomBytes(12).toString("hex");
1612
+ }
1613
+ function createAsyncLock() {
1614
+ let lock = Promise.resolve();
1615
+ return async function withLock(fn) {
1616
+ const prev = lock;
1617
+ let release;
1618
+ lock = new Promise((resolveLock) => {
1619
+ release = resolveLock;
1620
+ });
1621
+ await prev;
1622
+ try {
1623
+ return await fn();
1624
+ } finally {
1625
+ release?.();
1626
+ }
1627
+ };
1628
+ }
1629
+
1630
+ // ../../packages/bridge-runtime/dist/protocol.js
1631
+ var CONTROL_PREFIX = "__clawket_relay_control__:";
1632
+ function parseControl(text) {
1633
+ if (!text.startsWith(CONTROL_PREFIX))
1634
+ return null;
1635
+ try {
1636
+ const parsed = JSON.parse(text.slice(CONTROL_PREFIX.length));
1637
+ if (typeof parsed.event !== "string" || !parsed.event.trim())
1638
+ return null;
1639
+ const payload = isRecord(parsed.payload) ? parsed.payload : void 0;
1640
+ const countCandidate = typeof parsed.count === "number" && Number.isFinite(parsed.count) ? parsed.count : typeof payload?.count === "number" && Number.isFinite(payload.count) ? payload.count : void 0;
1641
+ return {
1642
+ event: parsed.event.trim(),
1643
+ requestId: readOptionalString(parsed.requestId),
1644
+ payload,
1645
+ sourceClientId: readOptionalString(parsed.sourceClientId),
1646
+ targetClientId: readOptionalString(parsed.targetClientId),
1647
+ count: countCandidate
1648
+ };
1649
+ } catch {
1650
+ return null;
1651
+ }
1652
+ }
1653
+ function parseConnectStartIdentity(text) {
1654
+ try {
1655
+ const parsed = JSON.parse(text);
1656
+ if (parsed.type !== "req")
1657
+ return null;
1658
+ if (parsed.method !== "connect" && parsed.method !== "connect.start")
1659
+ return null;
1660
+ const params = parsed.params ?? {};
1661
+ const id = typeof parsed.id === "string" && parsed.id.trim() ? parsed.id.trim() : `req-${Math.random().toString(36).slice(2, 12)}`;
1662
+ const label = firstString(params.deviceName, params.clientName, params.deviceId, "Mobile Client");
1663
+ return { id, label };
1664
+ } catch {
1665
+ return null;
1666
+ }
1667
+ }
1668
+ function isConnectHandshakeRequest(text) {
1669
+ try {
1670
+ const parsed = JSON.parse(text);
1671
+ return parsed.type === "req" && (parsed.method === "connect" || parsed.method === "connect.start");
1672
+ } catch {
1673
+ return false;
1674
+ }
1675
+ }
1676
+ function parseConnectHandshakeMeta(text) {
1677
+ try {
1678
+ const parsed = JSON.parse(text);
1679
+ if (parsed.type !== "req")
1680
+ return null;
1681
+ if (parsed.method !== "connect" && parsed.method !== "connect.start")
1682
+ return null;
1683
+ const nonce = parsed.params?.device?.nonce;
1684
+ const auth = parsed.params?.auth;
1685
+ return {
1686
+ id: typeof parsed.id === "string" && parsed.id.trim() ? parsed.id.trim() : null,
1687
+ method: parsed.method,
1688
+ noncePresent: typeof nonce === "string" && nonce.length > 0,
1689
+ nonceLength: typeof nonce === "string" ? nonce.length : null,
1690
+ authFields: auth && typeof auth === "object" ? Object.keys(auth).sort() : []
1691
+ };
1692
+ } catch {
1693
+ return null;
1694
+ }
1695
+ }
1696
+ function parsePairingRequestFromError(text, nowMs = Date.now()) {
1697
+ try {
1698
+ const parsed = JSON.parse(text);
1699
+ if (parsed.type !== "res" || parsed.ok !== false || !parsed.error)
1700
+ return null;
1701
+ const code = typeof parsed.error.code === "string" ? parsed.error.code : "";
1702
+ const message = typeof parsed.error.message === "string" ? parsed.error.message : "";
1703
+ if (!code.includes("NOT_PAIRED") && !code.includes("PAIRING_REQUIRED") && !message.includes("NOT_PAIRED") && !message.includes("pairing required")) {
1704
+ return null;
1705
+ }
1706
+ const details = parsed.error.details ?? parsed.error.data ?? {};
1707
+ const requestId = firstString(details.requestId, extractRequestIdFromMessage(message), "unknown");
1708
+ return {
1709
+ requestId,
1710
+ deviceId: firstString(details.deviceId, ""),
1711
+ displayName: firstNullableString(details.displayName),
1712
+ platform: firstNullableString(details.platform),
1713
+ deviceFamily: firstNullableString(details.deviceFamily),
1714
+ role: firstNullableString(details.role),
1715
+ remoteIp: firstNullableString(details.remoteIp),
1716
+ receivedAtMs: nowMs,
1717
+ status: "pending"
1718
+ };
1719
+ } catch {
1720
+ return null;
1721
+ }
1722
+ }
1723
+ function parsePairResolvedEvent(text) {
1724
+ try {
1725
+ const parsed = JSON.parse(text);
1726
+ if (parsed.type !== "event" || parsed.event !== "device.pair.resolved" || !parsed.payload)
1727
+ return null;
1728
+ const requestId = typeof parsed.payload.requestId === "string" ? parsed.payload.requestId.trim() : "";
1729
+ if (!requestId)
1730
+ return null;
1731
+ const decisionValue = typeof parsed.payload.decision === "string" ? parsed.payload.decision : "unknown";
1732
+ const decision = decisionValue === "approved" || decisionValue === "rejected" ? decisionValue : "unknown";
1733
+ return { requestId, decision };
1734
+ } catch {
1735
+ return null;
1736
+ }
1737
+ }
1738
+ function parseResponseEnvelopeMeta(text) {
1739
+ try {
1740
+ const parsed = JSON.parse(text);
1741
+ if (parsed.type !== "res")
1742
+ return null;
1743
+ if (typeof parsed.id !== "string" || !parsed.id.trim())
1744
+ return null;
1745
+ return {
1746
+ id: parsed.id.trim(),
1747
+ ok: parsed.ok === true,
1748
+ errorCode: typeof parsed.error?.code === "string" && parsed.error.code.trim() ? parsed.error.code.trim() : null,
1749
+ errorMessage: typeof parsed.error?.message === "string" && parsed.error.message.trim() ? parsed.error.message.trim() : null
1750
+ };
1751
+ } catch {
1752
+ return null;
1753
+ }
1754
+ }
1755
+ function firstString(...values) {
1756
+ for (const value of values) {
1757
+ if (typeof value === "string" && value.trim())
1758
+ return value.trim();
1759
+ }
1760
+ return "";
1761
+ }
1762
+ function firstNullableString(value) {
1763
+ return typeof value === "string" && value.trim() ? value.trim() : null;
1764
+ }
1765
+ function readOptionalString(value) {
1766
+ return typeof value === "string" && value.trim() ? value.trim() : void 0;
1767
+ }
1768
+ function isRecord(value) {
1769
+ return typeof value === "object" && value != null && !Array.isArray(value);
1770
+ }
1771
+ function extractRequestIdFromMessage(message) {
1772
+ const matched = message.match(/requestId[:\s]*([a-f0-9-]+)/i);
1773
+ return matched?.[1] ?? null;
1774
+ }
1775
+
1776
+ // ../../packages/bridge-runtime/dist/runtime.js
1777
+ import { randomUUID as randomUUID2 } from "crypto";
1778
+ import { setTimeout as delay2 } from "timers/promises";
1779
+ import WebSocket from "ws";
1780
+ var HEARTBEAT_INTERVAL_MS = 1e4;
1781
+ var HEARTBEAT_TIMEOUT_MS = 35e3;
1782
+ var GATEWAY_RETRY_DELAY_MS = 1200;
1783
+ var RECONNECT_BASE_DELAY_MS = 1e3;
1784
+ var RECONNECT_MAX_DELAY_MS = 15e3;
1785
+ var CONNECT_HANDSHAKE_WARN_DELAY_MS = 8e3;
1786
+ var MAX_PENDING_GATEWAY_MESSAGES = 256;
1787
+ var MAX_DEVICE_DETAILS = 32;
1788
+ var MAX_PENDING_PAIR_REQUESTS = 16;
1789
+ var BridgeRuntime = class {
1790
+ options;
1791
+ relaySocket = null;
1792
+ gatewaySocket = null;
1793
+ relayConnecting = false;
1794
+ gatewayConnecting = false;
1795
+ stopped = true;
1796
+ relayAttempt = 0;
1797
+ lastRelayActivityMs = 0;
1798
+ reconnectTimer = null;
1799
+ gatewayRetryTimer = null;
1800
+ heartbeatTimer = null;
1801
+ pendingGatewayMessages = [];
1802
+ gatewayHandshakeStarted = false;
1803
+ gatewayCloseBoundaryPending = false;
1804
+ clientDemandStartedAtMs = null;
1805
+ gatewayConnectedAtMs = null;
1806
+ inFlightConnectHandshakes = /* @__PURE__ */ new Map();
1807
+ snapshot;
1808
+ constructor(options) {
1809
+ this.options = options;
1810
+ this.snapshot = {
1811
+ running: false,
1812
+ relayConnected: false,
1813
+ gatewayConnected: false,
1814
+ gatewayId: options.config.gatewayId,
1815
+ instanceId: options.config.instanceId,
1816
+ relayUrl: options.config.relayUrl,
1817
+ gatewayUrl: options.gatewayUrl,
1818
+ clientCount: 0,
1819
+ connectedDevices: [],
1820
+ pendingPairRequests: [],
1821
+ lastError: null,
1822
+ lastUpdatedMs: Date.now()
1823
+ };
1824
+ }
1825
+ start() {
1826
+ if (!this.stopped)
1827
+ return;
1828
+ this.stopped = false;
1829
+ this.updateSnapshot({ running: true, gatewayUrl: this.options.gatewayUrl });
1830
+ this.log(`runtime starting gatewayId=${this.options.config.gatewayId} gatewayUrl=${this.options.gatewayUrl}`);
1831
+ void this.connectRelay();
1832
+ }
1833
+ async stop() {
1834
+ if (this.stopped)
1835
+ return;
1836
+ this.stopped = true;
1837
+ this.clearTimers();
1838
+ this.relaySocket?.close();
1839
+ this.gatewaySocket?.close();
1840
+ this.relaySocket = null;
1841
+ this.gatewaySocket = null;
1842
+ this.pendingGatewayMessages = [];
1843
+ this.gatewayHandshakeStarted = false;
1844
+ this.gatewayCloseBoundaryPending = false;
1845
+ this.clientDemandStartedAtMs = null;
1846
+ this.gatewayConnectedAtMs = null;
1847
+ this.inFlightConnectHandshakes.clear();
1848
+ this.relayConnecting = false;
1849
+ this.gatewayConnecting = false;
1850
+ this.updateSnapshot({
1851
+ running: false,
1852
+ relayConnected: false,
1853
+ gatewayConnected: false,
1854
+ clientCount: 0,
1855
+ lastError: null
1856
+ });
1857
+ this.log("runtime stopped");
1858
+ await delay2(25);
1859
+ }
1860
+ async approvePairRequest(requestId) {
1861
+ this.sendGatewayRequest("device.pair.approve", { requestId });
1862
+ this.markPairRequestResolved(requestId, "approved");
1863
+ }
1864
+ async rejectPairRequest(requestId) {
1865
+ this.sendGatewayRequest("device.pair.reject", { requestId });
1866
+ this.markPairRequestResolved(requestId, "rejected");
1867
+ }
1868
+ getSnapshot() {
1869
+ return {
1870
+ ...this.snapshot,
1871
+ connectedDevices: [...this.snapshot.connectedDevices],
1872
+ pendingPairRequests: [...this.snapshot.pendingPairRequests]
1873
+ };
1874
+ }
1875
+ async connectRelay() {
1876
+ if (this.stopped || this.relayConnecting || this.isRelayOpen())
1877
+ return;
1878
+ this.relayConnecting = true;
1879
+ this.relayAttempt += 1;
1880
+ const attempt = this.relayAttempt;
1881
+ const relayUrl = buildRelayWsUrl(this.options.config);
1882
+ const relayHeaders = buildRelayWsHeaders(this.options.config);
1883
+ this.log(`relay connect attempt=${attempt} url=${redactRelayWsUrl(relayUrl)} authorization=${redactAuthorizationHeader(relayHeaders.Authorization)}`);
1884
+ const relay = this.createWebSocket(relayUrl, {
1885
+ headers: relayHeaders,
1886
+ maxPayload: 25 * 1024 * 1024
1887
+ });
1888
+ this.relaySocket = relay;
1889
+ relay.once("open", () => {
1890
+ if (this.stopped || this.relaySocket !== relay) {
1891
+ relay.close();
1892
+ return;
1893
+ }
1894
+ this.relayConnecting = false;
1895
+ this.lastRelayActivityMs = Date.now();
1896
+ this.updateSnapshot({ relayConnected: true, lastError: null });
1897
+ this.log(`relay connected attempt=${attempt}`);
1898
+ this.startHeartbeat();
1899
+ if (shouldKeepGatewayConnected(this.snapshot.clientCount, summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests)) {
1900
+ this.ensureGatewayConnected();
1901
+ }
1902
+ });
1903
+ relay.on("message", (data, isBinary) => {
1904
+ void this.handleRelayMessage(data, isBinary);
1905
+ });
1906
+ relay.on("pong", () => {
1907
+ this.lastRelayActivityMs = Date.now();
1908
+ });
1909
+ relay.once("error", (error) => {
1910
+ this.log(`relay error: ${String(error)}`);
1911
+ });
1912
+ relay.once("close", (code, reason) => {
1913
+ if (this.relaySocket === relay) {
1914
+ this.relaySocket = null;
1915
+ }
1916
+ this.relayConnecting = false;
1917
+ this.stopHeartbeat();
1918
+ this.clientDemandStartedAtMs = null;
1919
+ this.gatewayConnectedAtMs = null;
1920
+ this.updateSnapshot({
1921
+ relayConnected: false,
1922
+ gatewayConnected: false,
1923
+ clientCount: 0,
1924
+ lastError: code === 1e3 ? null : `relay closed: ${reason.toString() || code}`
1925
+ });
1926
+ this.log(`relay disconnected code=${code} reason=${reason.toString() || "<none>"}`);
1927
+ this.closeGateway();
1928
+ this.scheduleRelayReconnect();
1929
+ });
1930
+ }
1931
+ async handleRelayMessage(data, isBinary) {
1932
+ this.lastRelayActivityMs = Date.now();
1933
+ if (isBinary) {
1934
+ this.forwardOrQueueGatewayMessage({ kind: "binary", data: normalizeBinary(data) });
1935
+ return;
1936
+ }
1937
+ const text = normalizeText(data);
1938
+ if (text == null)
1939
+ return;
1940
+ const control = parseControl(text);
1941
+ if (control) {
1942
+ await this.handleRelayControl(control);
1943
+ return;
1944
+ }
1945
+ const identity = parseConnectStartIdentity(text);
1946
+ if (identity) {
1947
+ this.observeConnectStart(identity.id, identity.label);
1948
+ }
1949
+ this.forwardOrQueueGatewayMessage({ kind: "text", text });
1950
+ }
1951
+ async handleRelayControl(control) {
1952
+ if (control.event === "bootstrap.request") {
1953
+ await this.handleBootstrapRequest(control);
1954
+ return;
1955
+ }
1956
+ const { event, count } = control;
1957
+ if (event === "client_connected" || event === "client_count") {
1958
+ const previousClientCount = this.snapshot.clientCount;
1959
+ const clientCount = count ?? Math.max(1, this.snapshot.clientCount);
1960
+ if (clientCount > 0 && this.clientDemandStartedAtMs == null) {
1961
+ this.clientDemandStartedAtMs = Date.now();
1962
+ }
1963
+ this.updateSnapshot({ clientCount });
1964
+ if (clientCount === 0) {
1965
+ this.gatewayHandshakeStarted = false;
1966
+ this.markDevicesRecent();
1967
+ this.dropStaleIdleGatewayQueue();
1968
+ const queuedConnectRequests = summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests;
1969
+ if (shouldScheduleGatewayIdleClose(clientCount, queuedConnectRequests, this.isGatewayOpen())) {
1970
+ this.log("client demand dropped to zero; closing idle gateway");
1971
+ this.closeGateway();
1972
+ } else {
1973
+ this.log("client demand dropped to zero; gateway remains needed");
1974
+ }
1975
+ } else {
1976
+ if (shouldRecycleGatewayForFreshClient(previousClientCount, clientCount, this.isGatewayOpen(), false)) {
1977
+ const queued = summarizePendingGatewayMessages(this.pendingGatewayMessages);
1978
+ this.log(`gateway recycle requested for fresh client demand queued=${queued.total} connect=${queued.connectRequests} text=${queued.otherText} binary=${queued.binary} handshakeStarted=${this.gatewayHandshakeStarted}`);
1979
+ const pruned = prunePendingGatewayMessagesForFreshDemand(this.pendingGatewayMessages);
1980
+ if (pruned.dropped > 0) {
1981
+ this.pendingGatewayMessages = pruned.messages;
1982
+ this.log(`dropped stale gateway queue before recycle dropped=${pruned.dropped} kept=${pruned.messages.length}`);
1983
+ }
1984
+ this.closeGateway(true);
1985
+ }
1986
+ if (this.isGatewayOpen() && !this.gatewayCloseBoundaryPending) {
1987
+ this.updateSnapshot({ gatewayConnected: true, lastError: null });
1988
+ this.log(`gateway already connected sinceGatewayOpenMs=${this.elapsedSince(this.gatewayConnectedAtMs)} handshakeStarted=${this.gatewayHandshakeStarted}`);
1989
+ }
1990
+ }
1991
+ this.ensureGatewayConnected();
1992
+ return;
1993
+ }
1994
+ if (event === "client_disconnected") {
1995
+ this.gatewayHandshakeStarted = false;
1996
+ this.updateSnapshot({ clientCount: 0 });
1997
+ this.markDevicesRecent();
1998
+ this.dropStaleIdleGatewayQueue();
1999
+ const queuedConnectRequests = summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests;
2000
+ if (shouldScheduleGatewayIdleClose(0, queuedConnectRequests, this.isGatewayOpen())) {
2001
+ this.log("client disconnected; closing idle gateway");
2002
+ this.closeGateway();
2003
+ } else {
2004
+ this.log("client disconnected; gateway remains needed");
2005
+ this.ensureGatewayConnected();
2006
+ }
2007
+ return;
2008
+ }
2009
+ }
2010
+ async handleBootstrapRequest(control) {
2011
+ const requestId = control.requestId?.trim() ?? "";
2012
+ const replyTargetClientId = control.sourceClientId?.trim() || control.targetClientId?.trim() || "";
2013
+ if (!requestId) {
2014
+ this.log("relay bootstrap request dropped reason=missing_request_id");
2015
+ return;
2016
+ }
2017
+ const parsed = parseBootstrapRequestPayload(control.payload);
2018
+ if (!parsed.ok) {
2019
+ this.log(`relay bootstrap request rejected requestId=${requestId} code=${parsed.code} reason=${parsed.message}`);
2020
+ this.sendRelayControl({
2021
+ event: "bootstrap.error",
2022
+ requestId,
2023
+ targetClientId: replyTargetClientId || void 0,
2024
+ payload: {
2025
+ code: parsed.code,
2026
+ message: parsed.message
2027
+ }
2028
+ });
2029
+ return;
2030
+ }
2031
+ try {
2032
+ const issued = await issueOpenClawBootstrapToken(parsed.value);
2033
+ this.log(`relay bootstrap token issued requestId=${requestId} deviceId=${parsed.value.deviceId} targetClientId=${replyTargetClientId || "<none>"} expiresAtMs=${issued.expiresAtMs}`);
2034
+ this.sendRelayControl({
2035
+ event: "bootstrap.issued",
2036
+ requestId,
2037
+ targetClientId: replyTargetClientId || void 0,
2038
+ payload: {
2039
+ bootstrapToken: issued.token,
2040
+ expiresAtMs: issued.expiresAtMs
2041
+ }
2042
+ });
2043
+ } catch (error) {
2044
+ const message = error instanceof Error ? error.message : String(error);
2045
+ this.log(`relay bootstrap token issue failed requestId=${requestId} error=${message}`);
2046
+ this.sendRelayControl({
2047
+ event: "bootstrap.error",
2048
+ requestId,
2049
+ targetClientId: replyTargetClientId || void 0,
2050
+ payload: {
2051
+ code: "bootstrap_issue_failed",
2052
+ message
2053
+ }
2054
+ });
2055
+ }
2056
+ }
2057
+ forwardOrQueueGatewayMessage(message) {
2058
+ const isConnectHandshake = message.kind === "text" && isConnectHandshakeRequest(message.text);
2059
+ if (this.gatewayCloseBoundaryPending) {
2060
+ this.pushPendingGatewayMessage(message);
2061
+ if (isConnectHandshake) {
2062
+ this.log("gateway unavailable during connect handshake; queued until gateway reconnects");
2063
+ }
2064
+ return;
2065
+ }
2066
+ const gateway = this.gatewaySocket;
2067
+ if (!gateway || gateway.readyState !== WebSocket.OPEN) {
2068
+ this.ensureGatewayConnected();
2069
+ this.pushPendingGatewayMessage(message);
2070
+ if (isConnectHandshake) {
2071
+ this.log("gateway unavailable during connect handshake; queued until gateway reconnects");
2072
+ }
2073
+ return;
2074
+ }
2075
+ if (!this.gatewayHandshakeStarted) {
2076
+ if (!isConnectHandshake) {
2077
+ this.pushPendingGatewayMessage(message);
2078
+ return;
2079
+ }
2080
+ this.gatewayHandshakeStarted = true;
2081
+ const meta = parseConnectHandshakeMeta(message.text);
2082
+ this.log(`gateway handshake started queued=${this.pendingGatewayMessages.length}` + formatConnectHandshakeMetaForLog(meta));
2083
+ }
2084
+ this.sendToGateway(message);
2085
+ }
2086
+ ensureGatewayConnected() {
2087
+ if (this.stopped || !this.isRelayOpen() || this.gatewayConnecting || this.isGatewayOpen() || this.gatewayCloseBoundaryPending)
2088
+ return;
2089
+ this.gatewayConnecting = true;
2090
+ this.log(`gateway connect start url=${this.options.gatewayUrl}`);
2091
+ const gateway = this.createWebSocket(this.options.gatewayUrl);
2092
+ this.gatewaySocket = gateway;
2093
+ gateway.once("open", () => {
2094
+ if (this.stopped || this.gatewaySocket !== gateway) {
2095
+ gateway.close();
2096
+ return;
2097
+ }
2098
+ this.gatewayConnecting = false;
2099
+ this.gatewayHandshakeStarted = false;
2100
+ this.gatewayCloseBoundaryPending = false;
2101
+ this.gatewayConnectedAtMs = Date.now();
2102
+ this.updateSnapshot({ gatewayConnected: true, lastError: null });
2103
+ this.log(`gateway connected sinceClientDemandMs=${this.elapsedSince(this.clientDemandStartedAtMs)}`);
2104
+ this.flushPendingGatewayMessages();
2105
+ });
2106
+ gateway.on("message", (data, isBinary) => {
2107
+ this.handleGatewayMessage(data, isBinary);
2108
+ });
2109
+ gateway.once("error", (error) => {
2110
+ this.log(`gateway error: ${String(error)}`);
2111
+ });
2112
+ gateway.once("close", (code, reason) => {
2113
+ const queuedConnectRequests = summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests;
2114
+ const reconnectAfterClose = this.gatewayCloseBoundaryPending && shouldKeepGatewayConnected(this.snapshot.clientCount, queuedConnectRequests);
2115
+ if (this.gatewaySocket === gateway) {
2116
+ this.gatewaySocket = null;
2117
+ }
2118
+ this.gatewayConnecting = false;
2119
+ this.gatewayHandshakeStarted = false;
2120
+ this.gatewayCloseBoundaryPending = false;
2121
+ this.gatewayConnectedAtMs = null;
2122
+ this.clearInFlightConnectHandshakes(`gateway disconnected code=${code}`);
2123
+ this.updateSnapshot({
2124
+ gatewayConnected: false,
2125
+ lastError: code === 1e3 || reconnectAfterClose ? this.snapshot.lastError : `gateway closed: ${reason.toString() || code}`
2126
+ });
2127
+ this.log(`gateway disconnected code=${code} reason=${reason.toString() || "<none>"} sinceClientDemandMs=${this.elapsedSince(this.clientDemandStartedAtMs)}`);
2128
+ if (reconnectAfterClose) {
2129
+ this.log("gateway close boundary reached; reconnecting for fresh demand");
2130
+ this.ensureGatewayConnected();
2131
+ return;
2132
+ }
2133
+ this.scheduleGatewayReconnect();
2134
+ });
2135
+ }
2136
+ handleGatewayMessage(data, isBinary) {
2137
+ const relay = this.relaySocket;
2138
+ if (!relay || relay.readyState !== WebSocket.OPEN)
2139
+ return;
2140
+ if (isBinary) {
2141
+ relay.send(normalizeBinary(data));
2142
+ return;
2143
+ }
2144
+ const text = normalizeText(data);
2145
+ if (text == null)
2146
+ return;
2147
+ const pairReq = parsePairingRequestFromError(text);
2148
+ if (pairReq) {
2149
+ this.addPendingPairRequest(pairReq);
2150
+ }
2151
+ const resolved = parsePairResolvedEvent(text);
2152
+ if (resolved) {
2153
+ this.markPairRequestResolved(resolved.requestId, resolved.decision);
2154
+ }
2155
+ const response = parseResponseEnvelopeMeta(text);
2156
+ if (response) {
2157
+ this.observeGatewayResponse(response);
2158
+ }
2159
+ relay.send(text);
2160
+ }
2161
+ flushPendingGatewayMessages() {
2162
+ const gateway = this.gatewaySocket;
2163
+ if (!gateway || gateway.readyState !== WebSocket.OPEN)
2164
+ return;
2165
+ const deferred = [];
2166
+ const queued = dedupePendingGatewayMessages(this.pendingGatewayMessages);
2167
+ if (queued.dropped > 0) {
2168
+ this.log(`dropped stale queued gateway messages before flush dropped=${queued.dropped} kept=${queued.messages.length}`);
2169
+ }
2170
+ this.pendingGatewayMessages = [];
2171
+ for (const message of queued.messages) {
2172
+ if (!this.gatewayHandshakeStarted) {
2173
+ if (message.kind !== "text" || !isConnectHandshakeRequest(message.text)) {
2174
+ deferred.push(message);
2175
+ continue;
2176
+ }
2177
+ this.gatewayHandshakeStarted = true;
2178
+ }
2179
+ this.sendToGateway(message);
2180
+ }
2181
+ this.pendingGatewayMessages = deferred;
2182
+ }
2183
+ sendToGateway(message) {
2184
+ const gateway = this.gatewaySocket;
2185
+ if (!gateway || gateway.readyState !== WebSocket.OPEN) {
2186
+ this.pushPendingGatewayMessage(message);
2187
+ return;
2188
+ }
2189
+ if (message.kind === "text") {
2190
+ const patched = patchConnectRequestGatewayAuth(message.text, readOpenClawInfo());
2191
+ const meta = parseConnectHandshakeMeta(patched.text);
2192
+ if (meta) {
2193
+ if (meta.id) {
2194
+ this.inFlightConnectHandshakes.set(meta.id, {
2195
+ method: meta.method,
2196
+ startedAtMs: Date.now(),
2197
+ slowWarningLogged: false
2198
+ });
2199
+ }
2200
+ this.log(`gateway connect request forwarded${formatConnectHandshakeMetaForLog(meta)}`);
2201
+ }
2202
+ if (patched.injected) {
2203
+ this.log("gateway connect auth patched mode=password");
2204
+ }
2205
+ gateway.send(patched.text);
2206
+ return;
2207
+ }
2208
+ gateway.send(message.data);
2209
+ }
2210
+ sendGatewayRequest(method, params) {
2211
+ const payload = JSON.stringify({
2212
+ type: "req",
2213
+ id: `bridge-${randomUUID2()}`,
2214
+ method,
2215
+ params
2216
+ });
2217
+ this.forwardOrQueueGatewayMessage({ kind: "text", text: payload });
2218
+ }
2219
+ sendRelayControl(control) {
2220
+ const relay = this.relaySocket;
2221
+ if (!relay || relay.readyState !== WebSocket.OPEN)
2222
+ return;
2223
+ relay.send(`__clawket_relay_control__:${JSON.stringify({
2224
+ type: "control",
2225
+ event: control.event,
2226
+ requestId: control.requestId,
2227
+ targetClientId: control.targetClientId,
2228
+ payload: control.payload
2229
+ })}`);
2230
+ }
2231
+ closeGateway(reconnectAfterClose = false) {
2232
+ if (this.gatewayRetryTimer) {
2233
+ clearTimeout(this.gatewayRetryTimer);
2234
+ this.gatewayRetryTimer = null;
2235
+ }
2236
+ const queuedConnectRequests = summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests;
2237
+ const shouldReconnectAfterClose = reconnectAfterClose && this.isRelayOpen() && shouldKeepGatewayConnected(this.snapshot.clientCount, queuedConnectRequests);
2238
+ const gateway = this.gatewaySocket;
2239
+ this.gatewayHandshakeStarted = false;
2240
+ this.gatewayConnectedAtMs = null;
2241
+ if (!gateway) {
2242
+ this.gatewayCloseBoundaryPending = false;
2243
+ this.gatewayConnecting = false;
2244
+ if (shouldReconnectAfterClose) {
2245
+ this.ensureGatewayConnected();
2246
+ }
2247
+ return;
2248
+ }
2249
+ if (gateway.readyState === WebSocket.CLOSING) {
2250
+ this.gatewayCloseBoundaryPending = shouldReconnectAfterClose;
2251
+ return;
2252
+ }
2253
+ if (gateway.readyState === WebSocket.CLOSED) {
2254
+ if (this.gatewaySocket === gateway) {
2255
+ this.gatewaySocket = null;
2256
+ }
2257
+ this.gatewayCloseBoundaryPending = false;
2258
+ this.gatewayConnecting = false;
2259
+ if (shouldReconnectAfterClose) {
2260
+ this.ensureGatewayConnected();
2261
+ }
2262
+ return;
2263
+ }
2264
+ this.gatewayCloseBoundaryPending = shouldReconnectAfterClose;
2265
+ gateway.close();
2266
+ }
2267
+ createWebSocket(url, options) {
2268
+ if (this.options.createWebSocket) {
2269
+ return this.options.createWebSocket(url, options);
2270
+ }
2271
+ return new WebSocket(url, {
2272
+ maxPayload: options?.maxPayload ?? 25 * 1024 * 1024,
2273
+ headers: options?.headers
2274
+ });
2275
+ }
2276
+ observeGatewayResponse(response) {
2277
+ const pending = this.inFlightConnectHandshakes.get(response.id);
2278
+ if (!pending)
2279
+ return;
2280
+ this.inFlightConnectHandshakes.delete(response.id);
2281
+ const detail = response.ok ? "ok=true" : `ok=false errorCode=${response.errorCode ?? "<none>"} errorMessage=${response.errorMessage ?? "<none>"}`;
2282
+ this.log(`gateway connect response reqId=${response.id} method=${pending.method} elapsedMs=${Date.now() - pending.startedAtMs} ${detail}`);
2283
+ }
2284
+ clearInFlightConnectHandshakes(reason) {
2285
+ if (this.inFlightConnectHandshakes.size === 0)
2286
+ return;
2287
+ for (const [requestId, pending] of this.inFlightConnectHandshakes.entries()) {
2288
+ this.log(`gateway connect response missing reqId=${requestId} method=${pending.method} elapsedMs=${Date.now() - pending.startedAtMs} reason=${reason}`);
2289
+ }
2290
+ this.inFlightConnectHandshakes.clear();
2291
+ }
2292
+ scheduleRelayReconnect() {
2293
+ if (this.stopped || this.reconnectTimer)
2294
+ return;
2295
+ const base = this.options.reconnectBaseDelayMs ?? RECONNECT_BASE_DELAY_MS;
2296
+ const max = this.options.reconnectMaxDelayMs ?? RECONNECT_MAX_DELAY_MS;
2297
+ const delayMs = Math.min(max, base * Math.max(1, this.relayAttempt));
2298
+ this.log(`relay reconnect scheduled delayMs=${delayMs}`);
2299
+ this.reconnectTimer = setTimeout(() => {
2300
+ this.reconnectTimer = null;
2301
+ void this.connectRelay();
2302
+ }, delayMs);
2303
+ }
2304
+ scheduleGatewayReconnect() {
2305
+ const queuedConnectRequests = summarizePendingGatewayMessages(this.pendingGatewayMessages).connectRequests;
2306
+ if (this.stopped || this.gatewayRetryTimer || !this.isRelayOpen() || !shouldKeepGatewayConnected(this.snapshot.clientCount, queuedConnectRequests))
2307
+ return;
2308
+ const delayMs = this.options.gatewayRetryDelayMs ?? GATEWAY_RETRY_DELAY_MS;
2309
+ this.gatewayRetryTimer = setTimeout(() => {
2310
+ this.gatewayRetryTimer = null;
2311
+ this.ensureGatewayConnected();
2312
+ }, delayMs);
2313
+ }
2314
+ startHeartbeat() {
2315
+ this.stopHeartbeat();
2316
+ this.heartbeatTimer = setInterval(() => {
2317
+ const relay = this.relaySocket;
2318
+ if (!relay || relay.readyState !== WebSocket.OPEN)
2319
+ return;
2320
+ this.logSlowConnectHandshakes();
2321
+ const timeoutMs = this.options.heartbeatTimeoutMs ?? HEARTBEAT_TIMEOUT_MS;
2322
+ if (Date.now() - this.lastRelayActivityMs > timeoutMs) {
2323
+ this.log("relay heartbeat timed out");
2324
+ relay.terminate();
2325
+ return;
2326
+ }
2327
+ relay.ping();
2328
+ }, this.options.heartbeatIntervalMs ?? HEARTBEAT_INTERVAL_MS);
2329
+ }
2330
+ stopHeartbeat() {
2331
+ if (this.heartbeatTimer) {
2332
+ clearInterval(this.heartbeatTimer);
2333
+ this.heartbeatTimer = null;
2334
+ }
2335
+ }
2336
+ logSlowConnectHandshakes() {
2337
+ if (this.inFlightConnectHandshakes.size === 0)
2338
+ return;
2339
+ const warnDelayMs = this.options.connectHandshakeWarnDelayMs ?? CONNECT_HANDSHAKE_WARN_DELAY_MS;
2340
+ const now = Date.now();
2341
+ for (const [requestId, pending] of this.inFlightConnectHandshakes.entries()) {
2342
+ const elapsedMs = now - pending.startedAtMs;
2343
+ if (pending.slowWarningLogged || elapsedMs < warnDelayMs)
2344
+ continue;
2345
+ pending.slowWarningLogged = true;
2346
+ this.log(`gateway connect still pending reqId=${requestId} method=${pending.method} elapsedMs=${elapsedMs}`);
2347
+ }
2348
+ }
2349
+ pushPendingGatewayMessage(message) {
2350
+ if (this.pendingGatewayMessages.length >= MAX_PENDING_GATEWAY_MESSAGES) {
2351
+ this.pendingGatewayMessages.shift();
2352
+ }
2353
+ this.pendingGatewayMessages.push(message);
2354
+ }
2355
+ dropStaleIdleGatewayQueue() {
2356
+ const queued = summarizePendingGatewayMessages(this.pendingGatewayMessages);
2357
+ if (queued.total === 0 || queued.connectRequests > 0)
2358
+ return;
2359
+ this.pendingGatewayMessages = [];
2360
+ this.log(`dropped stale idle gateway queue total=${queued.total} text=${queued.otherText} binary=${queued.binary}`);
2361
+ }
2362
+ observeConnectStart(id, label) {
2363
+ const now = Date.now();
2364
+ const map = new Map(this.snapshot.connectedDevices.map((item) => [item.id, { ...item }]));
2365
+ const existing = map.get(id) ?? {
2366
+ id,
2367
+ label,
2368
+ state: "connected",
2369
+ lastSeenMs: now
2370
+ };
2371
+ existing.label = label;
2372
+ existing.state = "connected";
2373
+ existing.lastSeenMs = now;
2374
+ map.set(id, existing);
2375
+ const connectedDevices = [...map.values()].sort((a, b) => b.lastSeenMs - a.lastSeenMs).slice(0, MAX_DEVICE_DETAILS);
2376
+ this.updateSnapshot({ connectedDevices });
2377
+ }
2378
+ markDevicesRecent() {
2379
+ this.updateSnapshot({
2380
+ connectedDevices: this.snapshot.connectedDevices.map((item) => ({
2381
+ ...item,
2382
+ state: "recent"
2383
+ }))
2384
+ });
2385
+ }
2386
+ addPendingPairRequest(request) {
2387
+ if (this.snapshot.pendingPairRequests.some((item) => item.requestId === request.requestId))
2388
+ return;
2389
+ const next = [...this.snapshot.pendingPairRequests, request].slice(-MAX_PENDING_PAIR_REQUESTS);
2390
+ this.updateSnapshot({ pendingPairRequests: next });
2391
+ this.options.onPendingPairRequest?.(request);
2392
+ this.log(`pair request pending requestId=${request.requestId} deviceId=${request.deviceId || "<unknown>"}`);
2393
+ }
2394
+ markPairRequestResolved(requestId, decision) {
2395
+ const next = this.snapshot.pendingPairRequests.map((item) => item.requestId === requestId ? { ...item, status: decision === "approved" || decision === "rejected" ? decision : item.status } : item);
2396
+ this.updateSnapshot({ pendingPairRequests: next });
2397
+ this.log(`pair request resolved requestId=${requestId} decision=${decision}`);
2398
+ }
2399
+ updateSnapshot(patch) {
2400
+ Object.assign(this.snapshot, patch, { lastUpdatedMs: Date.now() });
2401
+ this.options.onStatus?.(this.getSnapshot());
2402
+ }
2403
+ log(line) {
2404
+ this.options.onLog?.(line);
2405
+ }
2406
+ isRelayOpen() {
2407
+ return this.relaySocket?.readyState === WebSocket.OPEN;
2408
+ }
2409
+ isGatewayOpen() {
2410
+ return this.gatewaySocket?.readyState === WebSocket.OPEN;
2411
+ }
2412
+ clearTimers() {
2413
+ this.stopHeartbeat();
2414
+ if (this.reconnectTimer) {
2415
+ clearTimeout(this.reconnectTimer);
2416
+ this.reconnectTimer = null;
2417
+ }
2418
+ if (this.gatewayRetryTimer) {
2419
+ clearTimeout(this.gatewayRetryTimer);
2420
+ this.gatewayRetryTimer = null;
2421
+ }
2422
+ }
2423
+ elapsedSince(startedAtMs) {
2424
+ return startedAtMs == null ? null : Math.max(0, Date.now() - startedAtMs);
2425
+ }
2426
+ };
2427
+ function shouldKeepGatewayConnected(clientCount, pendingConnectRequests) {
2428
+ return clientCount > 0 || pendingConnectRequests > 0;
2429
+ }
2430
+ function shouldScheduleGatewayIdleClose(clientCount, pendingConnectRequests, gatewayConnected) {
2431
+ return gatewayConnected && !shouldKeepGatewayConnected(clientCount, pendingConnectRequests);
2432
+ }
2433
+ function shouldRecycleGatewayForFreshClient(previousClientCount, nextClientCount, gatewayConnected, hadPendingIdleClose) {
2434
+ return gatewayConnected && nextClientCount > 0 && (previousClientCount === 0 || hadPendingIdleClose);
2435
+ }
2436
+ function summarizePendingGatewayMessages(messages) {
2437
+ const summary = {
2438
+ total: messages.length,
2439
+ connectRequests: 0,
2440
+ otherText: 0,
2441
+ binary: 0
2442
+ };
2443
+ for (const message of messages) {
2444
+ if (message.kind === "binary") {
2445
+ summary.binary += 1;
2446
+ continue;
2447
+ }
2448
+ if (isConnectHandshakeRequest(message.text)) {
2449
+ summary.connectRequests += 1;
2450
+ continue;
2451
+ }
2452
+ summary.otherText += 1;
2453
+ }
2454
+ return summary;
2455
+ }
2456
+ function dedupePendingGatewayMessages(messages) {
2457
+ let latestConnectIndex = -1;
2458
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
2459
+ const message = messages[index];
2460
+ if (message?.kind === "text" && isConnectHandshakeRequest(message.text)) {
2461
+ latestConnectIndex = index;
2462
+ break;
2463
+ }
2464
+ }
2465
+ if (latestConnectIndex <= 0) {
2466
+ return { messages: [...messages], dropped: 0 };
2467
+ }
2468
+ const deduped = messages.filter((message, index) => index >= latestConnectIndex || (message.kind !== "text" || !isConnectHandshakeRequest(message.text)));
2469
+ return {
2470
+ messages: deduped,
2471
+ dropped: messages.length - deduped.length
2472
+ };
2473
+ }
2474
+ function prunePendingGatewayMessagesForFreshDemand(messages) {
2475
+ if (messages.length === 0) {
2476
+ return { messages: [], dropped: 0 };
2477
+ }
2478
+ let latestConnectIndex = -1;
2479
+ for (let index = messages.length - 1; index >= 0; index -= 1) {
2480
+ const message = messages[index];
2481
+ if (message?.kind === "text" && isConnectHandshakeRequest(message.text)) {
2482
+ latestConnectIndex = index;
2483
+ break;
2484
+ }
2485
+ }
2486
+ if (latestConnectIndex === -1) {
2487
+ return { messages: [], dropped: messages.length };
2488
+ }
2489
+ const kept = messages.slice(latestConnectIndex);
2490
+ return {
2491
+ messages: kept,
2492
+ dropped: messages.length - kept.length
2493
+ };
2494
+ }
2495
+ function patchConnectRequestGatewayAuth(text, openClawInfo) {
2496
+ if (openClawInfo.authMode !== "password" || !openClawInfo.password) {
2497
+ return { text, injected: false };
2498
+ }
2499
+ try {
2500
+ const parsed = JSON.parse(text);
2501
+ if (parsed.type !== "req" || parsed.method !== "connect" && parsed.method !== "connect.start") {
2502
+ return { text, injected: false };
2503
+ }
2504
+ const params = parsed.params && typeof parsed.params === "object" ? { ...parsed.params } : {};
2505
+ const auth = params.auth && typeof params.auth === "object" ? { ...params.auth } : {};
2506
+ const existingPassword = typeof auth.password === "string" ? auth.password.trim() : "";
2507
+ if (existingPassword) {
2508
+ return { text, injected: false };
2509
+ }
2510
+ auth.password = openClawInfo.password;
2511
+ params.auth = auth;
2512
+ return {
2513
+ text: JSON.stringify({
2514
+ ...parsed,
2515
+ params
2516
+ }),
2517
+ injected: true
2518
+ };
2519
+ } catch {
2520
+ return { text, injected: false };
2521
+ }
2522
+ }
2523
+ function formatConnectHandshakeMetaForLog(meta) {
2524
+ if (!meta)
2525
+ return "";
2526
+ return ` method=${meta.method} reqId=${meta.id ?? "<none>"} noncePresent=${meta.noncePresent} nonceLength=${meta.nonceLength ?? 0} authFields=${meta.authFields.length > 0 ? meta.authFields.join(",") : "<none>"}`;
2527
+ }
2528
+ function parseBootstrapRequestPayload(payload) {
2529
+ if (!payload) {
2530
+ return {
2531
+ ok: false,
2532
+ code: "invalid_request",
2533
+ message: "bootstrap.request payload is required"
2534
+ };
2535
+ }
2536
+ const deviceId = readRequiredString(payload.deviceId);
2537
+ const publicKey = readRequiredString(payload.publicKey);
2538
+ const role = readRequiredString(payload.role);
2539
+ const scopes = normalizeScopeList(payload.scopes);
2540
+ if (!deviceId) {
2541
+ return { ok: false, code: "invalid_request", message: "payload.deviceId is required" };
2542
+ }
2543
+ if (!publicKey) {
2544
+ return { ok: false, code: "invalid_request", message: "payload.publicKey is required" };
2545
+ }
2546
+ if (!role) {
2547
+ return { ok: false, code: "invalid_request", message: "payload.role is required" };
2548
+ }
2549
+ if (scopes.length === 0) {
2550
+ return { ok: false, code: "invalid_request", message: "payload.scopes must contain at least one scope" };
2551
+ }
2552
+ return {
2553
+ ok: true,
2554
+ value: {
2555
+ deviceId,
2556
+ publicKey,
2557
+ role,
2558
+ scopes
2559
+ }
2560
+ };
2561
+ }
2562
+ function readRequiredString(value) {
2563
+ return typeof value === "string" ? value.trim() : "";
2564
+ }
2565
+ function normalizeScopeList(value) {
2566
+ if (!Array.isArray(value))
2567
+ return [];
2568
+ const scopes = /* @__PURE__ */ new Set();
2569
+ for (const item of value) {
2570
+ if (typeof item !== "string")
2571
+ continue;
2572
+ const trimmed = item.trim();
2573
+ if (trimmed) {
2574
+ scopes.add(trimmed);
2575
+ }
2576
+ }
2577
+ return [...scopes].sort();
2578
+ }
2579
+ function buildRelayWsUrl(config) {
2580
+ const base = new URL(config.relayUrl);
2581
+ if (!base.pathname || base.pathname === "/") {
2582
+ base.pathname = "/ws";
2583
+ }
2584
+ base.searchParams.delete("token");
2585
+ base.searchParams.set("gatewayId", config.gatewayId);
2586
+ base.searchParams.set("role", "gateway");
2587
+ base.searchParams.set("clientId", config.instanceId);
2588
+ return base.toString();
2589
+ }
2590
+ function buildRelayWsHeaders(config) {
2591
+ return {
2592
+ Authorization: `Bearer ${config.relaySecret}`
2593
+ };
2594
+ }
2595
+ function redactRelayWsUrl(rawUrl) {
2596
+ const parsed = new URL(rawUrl);
2597
+ if (parsed.username) {
2598
+ parsed.username = "<redacted>";
2599
+ }
2600
+ if (parsed.password) {
2601
+ parsed.password = "<redacted>";
2602
+ }
2603
+ if (parsed.searchParams.has("token")) {
2604
+ parsed.searchParams.set("token", "<redacted>");
2605
+ }
2606
+ return parsed.toString();
2607
+ }
2608
+ function redactAuthorizationHeader(value) {
2609
+ const trimmed = value?.trim() ?? "";
2610
+ if (!trimmed)
2611
+ return "<none>";
2612
+ return /^Bearer\s+/i.test(trimmed) ? "Bearer <redacted>" : "<redacted>";
2613
+ }
2614
+ function normalizeText(data) {
2615
+ if (typeof data === "string")
2616
+ return data;
2617
+ if (Buffer.isBuffer(data))
2618
+ return data.toString("utf8");
2619
+ if (Array.isArray(data))
2620
+ return Buffer.concat(data).toString("utf8");
2621
+ if (data instanceof ArrayBuffer)
2622
+ return Buffer.from(data).toString("utf8");
2623
+ return null;
2624
+ }
2625
+ function normalizeBinary(data) {
2626
+ if (Buffer.isBuffer(data))
2627
+ return data;
2628
+ if (typeof data === "string")
2629
+ return Buffer.from(data, "utf8");
2630
+ if (Array.isArray(data))
2631
+ return Buffer.concat(data);
2632
+ return Buffer.from(data);
2633
+ }
2634
+
2635
+ // src/diagnostics.ts
2636
+ function readRecentCliLogs(input) {
2637
+ const { logPath, errorLogPath } = getServicePaths();
2638
+ const lines = clampLines(input?.lines ?? 200);
2639
+ const lookbackMs = input?.lastMs ?? null;
2640
+ const cutoff = lookbackMs != null ? Date.now() - lookbackMs : null;
2641
+ const sources = [logPath];
2642
+ if (input?.includeErrorLog) {
2643
+ sources.push(errorLogPath);
2644
+ }
2645
+ const entries = sources.flatMap((path) => readLogFile(path));
2646
+ const filtered = cutoff == null ? entries : entries.filter((entry) => entry.ts != null && entry.ts >= cutoff);
2647
+ return filtered.slice(-lines).map((entry) => entry.raw);
2648
+ }
2649
+ async function buildDoctorReport() {
2650
+ const config = readPairingConfig();
2651
+ const service = getServiceStatus();
2652
+ const openclaw = readOpenClawInfo();
2653
+ const localGatewayUrl = resolveGatewayUrl();
2654
+ const localGatewayReachable = await checkGatewayReachable(localGatewayUrl);
2655
+ return {
2656
+ paired: Boolean(config),
2657
+ gatewayId: config?.gatewayId ?? null,
2658
+ serverUrl: config?.serverUrl ?? null,
2659
+ relayUrl: config?.relayUrl ?? null,
2660
+ instanceId: config?.instanceId ?? null,
2661
+ serviceInstalled: service.installed,
2662
+ serviceRunning: service.running,
2663
+ serviceMethod: service.method,
2664
+ servicePath: service.servicePath,
2665
+ logPath: service.logPath,
2666
+ errorLogPath: service.errorLogPath,
2667
+ openclawConfigDir: getOpenClawConfigDir(),
2668
+ openclawMediaDir: getOpenClawMediaDir(),
2669
+ openclawConfigFound: openclaw.configFound,
2670
+ openclawAuthMode: openclaw.authMode,
2671
+ openclawTokenFound: Boolean(openclaw.token),
2672
+ openclawPasswordFound: Boolean(openclaw.password),
2673
+ localGatewayUrl,
2674
+ localGatewayReachable
2675
+ };
2676
+ }
2677
+ async function ensurePairPrerequisites() {
2678
+ const report = await buildDoctorReport();
2679
+ const failures = listPairPrerequisiteFailures(report);
2680
+ if (failures.length > 0) {
2681
+ throw new Error([
2682
+ "Cannot complete `clawket pair` because local OpenClaw prerequisites are not ready.",
2683
+ ...failures.map((item) => `- ${item}`),
2684
+ "Run `clawket doctor` for more details, or use `clawket pair --force` only if you intentionally want to bypass this safety check."
2685
+ ].join("\n"));
2686
+ }
2687
+ return report;
2688
+ }
2689
+ function listPairPrerequisiteFailures(report) {
2690
+ const failures = [];
2691
+ if (!report.openclawConfigFound) {
2692
+ failures.push(`OpenClaw config was not found under ${formatOpenClawConfigLocations()}.`);
2693
+ }
2694
+ if (report.openclawTokenFound && report.openclawPasswordFound && report.openclawAuthMode == null) {
2695
+ failures.push("OpenClaw has both gateway token and password configured, but gateway.auth.mode is unset.");
2696
+ }
2697
+ if (!report.openclawTokenFound && !report.openclawPasswordFound) {
2698
+ failures.push("OpenClaw gateway auth is missing (token or password).");
2699
+ }
2700
+ if (report.openclawAuthMode === "token" && !report.openclawTokenFound) {
2701
+ failures.push("OpenClaw gateway token is missing.");
2702
+ }
2703
+ if (report.openclawAuthMode === "password" && !report.openclawPasswordFound) {
2704
+ failures.push("OpenClaw gateway password is missing.");
2705
+ }
2706
+ if (!report.localGatewayReachable) {
2707
+ failures.push(`Local OpenClaw Gateway is not reachable at ${report.localGatewayUrl}.`);
2708
+ }
2709
+ return failures;
2710
+ }
2711
+ function formatOpenClawConfigLocations() {
2712
+ const seen = /* @__PURE__ */ new Set();
2713
+ return [homedir4(), "/root"].map((home) => `${home.trim()}/.openclaw`).filter((path) => path !== "/.openclaw").filter((path) => {
2714
+ if (seen.has(path)) return false;
2715
+ seen.add(path);
2716
+ return true;
2717
+ }).join(" or ");
2718
+ }
2719
+ function readLogFile(path) {
2720
+ try {
2721
+ const raw = readFileSync4(path, "utf8");
2722
+ return raw.split(/\r?\n/).filter(Boolean).map((line) => ({
2723
+ raw: line,
2724
+ ts: parseTimestamp(line)
2725
+ }));
2726
+ } catch {
2727
+ return [];
2728
+ }
2729
+ }
2730
+ function parseTimestamp(line) {
2731
+ const matched = line.match(/^\[(\d{13})\]\s/);
2732
+ if (!matched) return null;
2733
+ const value = Number(matched[1]);
2734
+ return Number.isFinite(value) ? value : null;
2735
+ }
2736
+ function clampLines(value) {
2737
+ if (!Number.isFinite(value)) return 200;
2738
+ return Math.max(1, Math.min(2e3, Math.floor(value)));
2739
+ }
2740
+ async function checkGatewayReachable(gatewayUrl) {
2741
+ try {
2742
+ const parsed = new URL(gatewayUrl);
2743
+ const host = parsed.hostname || "127.0.0.1";
2744
+ const port = parsed.port ? Number(parsed.port) : parsed.protocol === "wss:" ? 443 : 80;
2745
+ await new Promise((resolve4, reject) => {
2746
+ const socket = new Socket();
2747
+ socket.setTimeout(900);
2748
+ socket.once("connect", () => {
2749
+ socket.destroy();
2750
+ resolve4();
2751
+ });
2752
+ socket.once("timeout", () => {
2753
+ socket.destroy();
2754
+ reject(new Error("timeout"));
2755
+ });
2756
+ socket.once("error", (error) => {
2757
+ socket.destroy();
2758
+ reject(error);
2759
+ });
2760
+ socket.connect(port, host);
2761
+ });
2762
+ return true;
2763
+ } catch {
2764
+ return false;
2765
+ }
2766
+ }
2767
+
2768
+ // src/log-parse.ts
2769
+ function parseLookbackToMs(input) {
2770
+ const trimmed = input?.trim();
2771
+ if (!trimmed) return null;
2772
+ const matched = trimmed.match(/^(\d+)(ms|s|m|h|d)$/i);
2773
+ if (!matched) {
2774
+ throw new Error(`Invalid --last value "${trimmed}". Use values like 30s, 2m, 1h, or 1d.`);
2775
+ }
2776
+ const value = Number(matched[1]);
2777
+ const unit = matched[2].toLowerCase();
2778
+ const factor = unit === "ms" ? 1 : unit === "s" ? 1e3 : unit === "m" ? 6e4 : unit === "h" ? 36e5 : 864e5;
2779
+ return value * factor;
2780
+ }
2781
+
2782
+ // src/local-pair.ts
2783
+ import { networkInterfaces } from "os";
2784
+ var BLOCKED_INTERFACE_TOKENS = [
2785
+ "utun",
2786
+ "tun",
2787
+ "tap",
2788
+ "tailscale",
2789
+ "wireguard",
2790
+ "wg",
2791
+ "vpn",
2792
+ "ipsec",
2793
+ "docker",
2794
+ "veth",
2795
+ "vmnet",
2796
+ "vbox",
2797
+ "loopback",
2798
+ " lo",
2799
+ "lo0",
2800
+ "awdl",
2801
+ "llw",
2802
+ "bridge",
2803
+ "br-",
2804
+ "ppp"
2805
+ ];
2806
+ function buildGatewayControlUiOrigin(gatewayUrl) {
2807
+ const parsed = new URL(normalizeExplicitGatewayUrl(gatewayUrl));
2808
+ const scheme = parsed.protocol === "wss:" ? "https:" : "http:";
2809
+ const port = parsed.port || (scheme === "https:" ? "443" : "80");
2810
+ return `${scheme}//${parsed.hostname}:${port}`;
2811
+ }
2812
+ function buildLocalPairingInfo(input) {
2813
+ const auth = resolveLocalPairAuth(input);
2814
+ const gatewayUrl = resolveLocalPairGatewayUrl({
2815
+ explicitUrl: input.explicitUrl,
2816
+ defaultGatewayUrl: input.defaultGatewayUrl
2817
+ });
2818
+ const expiresAt = input.expiresAt ?? Date.now() + 10 * 60 * 1e3;
2819
+ return {
2820
+ gatewayUrl,
2821
+ expiresAt,
2822
+ authMode: auth.mode,
2823
+ qrPayload: buildGatewayQrPayload({
2824
+ gatewayUrl,
2825
+ token: auth.token,
2826
+ password: auth.password,
2827
+ expiresAt
2828
+ })
2829
+ };
2830
+ }
2831
+ function resolveLocalPairGatewayUrl(input) {
2832
+ const explicit = input?.explicitUrl?.trim();
2833
+ if (explicit) {
2834
+ return normalizeExplicitGatewayUrl(explicit);
2835
+ }
2836
+ const baseGatewayUrl = input?.defaultGatewayUrl?.trim() || resolveGatewayUrl();
2837
+ const lanIp = detectLanIp();
2838
+ if (!lanIp) {
2839
+ throw new Error("Failed to determine a LAN IP address. Pass --url to specify a custom gateway URL.");
2840
+ }
2841
+ return rewriteGatewayHost(baseGatewayUrl, lanIp);
2842
+ }
2843
+ function normalizeExplicitGatewayUrl(url) {
2844
+ const trimmed = url.trim();
2845
+ const withScheme = /^[a-z]+:\/\//i.test(trimmed) ? trimmed : `ws://${trimmed}`;
2846
+ return normalizeGatewayQrUrl(withScheme).url;
2847
+ }
2848
+ function rewriteGatewayHost(gatewayUrl, nextHost) {
2849
+ const trimmed = gatewayUrl.trim();
2850
+ const withScheme = /^[a-z]+:\/\//i.test(trimmed) ? trimmed : `ws://${trimmed}`;
2851
+ const parsed = new URL(withScheme);
2852
+ parsed.hostname = nextHost;
2853
+ return normalizeGatewayQrUrl(parsed.toString()).url;
2854
+ }
2855
+ function detectLanIp() {
2856
+ const interfaces = networkInterfaces();
2857
+ let best = null;
2858
+ for (const [name, addresses] of Object.entries(interfaces)) {
2859
+ for (const address of addresses ?? []) {
2860
+ if (address.family !== "IPv4") continue;
2861
+ const score = scoreLanCandidate(name, address.address);
2862
+ if (score === 0) continue;
2863
+ if (!best || score > best.score) {
2864
+ best = { score, ip: address.address };
2865
+ }
2866
+ }
2867
+ }
2868
+ return best?.ip ?? null;
2869
+ }
2870
+ function scoreLanCandidate(name, ip) {
2871
+ if (!isLanIpv4(ip)) {
2872
+ return 0;
2873
+ }
2874
+ const lower = name.toLowerCase();
2875
+ if (BLOCKED_INTERFACE_TOKENS.some((token) => lower.includes(token))) {
2876
+ return 0;
2877
+ }
2878
+ let score = isRfc1918(ip) ? 120 : isCgnat(ip) ? 90 : 40;
2879
+ if (lower.startsWith("en") || lower.startsWith("eth") || lower.startsWith("wlan") || lower.startsWith("wl") || lower.includes("wifi") || lower.includes("wi-fi")) {
2880
+ score += 20;
2881
+ }
2882
+ return score;
2883
+ }
2884
+ function resolveLocalPairAuth(input) {
2885
+ if (input.gatewayToken?.trim()) {
2886
+ return { mode: "token", token: input.gatewayToken.trim(), password: null };
2887
+ }
2888
+ if (input.gatewayPassword?.trim()) {
2889
+ return { mode: "password", token: null, password: input.gatewayPassword.trim() };
2890
+ }
2891
+ throw new Error("OpenClaw gateway auth is missing (token or password).");
2892
+ }
2893
+ function isLanIpv4(ip) {
2894
+ if (!isValidIpv4(ip)) return false;
2895
+ if (ip === "0.0.0.0") return false;
2896
+ const [a, b, c, d] = ip.split(".").map(Number);
2897
+ if (a === 127) return false;
2898
+ if (a === 169 && b === 254) return false;
2899
+ if (a >= 224 && a <= 239) return false;
2900
+ if (a === 255 && b === 255 && c === 255 && d === 255) return false;
2901
+ if (a === 198 && (b === 18 || b === 19)) return false;
2902
+ return isRfc1918(ip) || isCgnat(ip);
2903
+ }
2904
+ function isRfc1918(ip) {
2905
+ const [a, b] = ip.split(".").map(Number);
2906
+ return a === 10 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
2907
+ }
2908
+ function isCgnat(ip) {
2909
+ const [a, b] = ip.split(".").map(Number);
2910
+ return a === 100 && b >= 64 && b <= 127;
2911
+ }
2912
+ function isValidIpv4(ip) {
2913
+ const parts = ip.split(".");
2914
+ return parts.length === 4 && parts.every((part) => {
2915
+ if (!/^\d+$/.test(part)) return false;
2916
+ const value = Number(part);
2917
+ return value >= 0 && value <= 255;
2918
+ });
2919
+ }
2920
+
2921
+ // src/metadata.ts
2922
+ import { readFileSync as readFileSync5 } from "fs";
2923
+ import { dirname as dirname3, resolve as resolve2 } from "path";
2924
+ import { fileURLToPath } from "url";
2925
+ function readCliVersion() {
2926
+ const here = dirname3(fileURLToPath(import.meta.url));
2927
+ const packageJsonPath = resolve2(here, "../package.json");
2928
+ const raw = readFileSync5(packageJsonPath, "utf8");
2929
+ const parsed = JSON.parse(raw);
2930
+ return parsed.version ?? "unknown";
2931
+ }
2932
+
2933
+ // src/pairing-output.ts
2934
+ function buildPairingJson(paired, qrImagePath, service, message) {
2935
+ return {
2936
+ ok: true,
2937
+ action: paired.action,
2938
+ message,
2939
+ gatewayId: paired.config.gatewayId,
2940
+ relayUrl: paired.config.relayUrl,
2941
+ serverUrl: paired.config.serverUrl,
2942
+ instanceId: paired.config.instanceId,
2943
+ accessCode: paired.accessCode,
2944
+ accessCodeExpiresAt: paired.accessCodeExpiresAt,
2945
+ qrImagePath,
2946
+ service: {
2947
+ installed: service.installed,
2948
+ running: service.running,
2949
+ method: service.method,
2950
+ servicePath: service.servicePath,
2951
+ logPath: service.logPath,
2952
+ errorLogPath: service.errorLogPath,
2953
+ pid: service.pid
2954
+ }
2955
+ };
2956
+ }
2957
+ function buildLocalPairingJson(input) {
2958
+ return {
2959
+ ok: true,
2960
+ action: "local",
2961
+ message: input.message,
2962
+ gatewayUrl: input.gatewayUrl,
2963
+ authMode: input.authMode,
2964
+ expiresAt: input.expiresAt,
2965
+ qrImagePath: input.qrImagePath,
2966
+ configUpdated: input.configUpdated ?? false,
2967
+ controlUiOrigin: input.controlUiOrigin ?? null,
2968
+ gatewayRestartAction: input.gatewayRestartAction ?? "unchanged",
2969
+ customUrl: input.customUrl ?? false
2970
+ };
2971
+ }
2972
+
2973
+ // src/qr-file.ts
2974
+ import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync3 } from "fs";
2975
+ import { dirname as dirname4, isAbsolute, join as join4, resolve as resolve3 } from "path";
2976
+ import QRCode from "qrcode";
2977
+ var DEFAULT_QR_DIR = getOpenClawMediaDir();
2978
+ async function writePairingQrPng(paired, outputPath) {
2979
+ const targetPath = resolveQrOutputPath(paired.config.gatewayId, outputPath);
2980
+ return writeQrPng(paired.qrPayload, targetPath);
2981
+ }
2982
+ async function writeRawQrPng(payload, fileStem, outputPath) {
2983
+ const targetPath = resolveQrOutputPath(fileStem, outputPath);
2984
+ return writeQrPng(payload, targetPath);
2985
+ }
2986
+ async function writeQrPng(payload, targetPath) {
2987
+ mkdirSync3(dirname4(targetPath), { recursive: true });
2988
+ const dataUrl = await QRCode.toDataURL(payload, {
2989
+ type: "image/png",
2990
+ errorCorrectionLevel: "M",
2991
+ margin: 1,
2992
+ width: 720
2993
+ });
2994
+ const encoded = dataUrl.replace(/^data:image\/png;base64,/, "");
2995
+ writeFileSync3(targetPath, Buffer.from(encoded, "base64"));
2996
+ return targetPath;
2997
+ }
2998
+ function resolveQrOutputPath(fileStem, outputPath) {
2999
+ const trimmed = outputPath?.trim();
3000
+ if (trimmed) {
3001
+ return isAbsolute(trimmed) ? trimmed : resolve3(trimmed);
3002
+ }
3003
+ return join4(DEFAULT_QR_DIR, `${fileStem}.png`);
3004
+ }
3005
+
3006
+ // src/service-decision.ts
3007
+ function decidePairServiceAction(paired, service) {
3008
+ if (!service.installed) {
3009
+ return "install";
3010
+ }
3011
+ if (!service.running) {
3012
+ return "restart";
3013
+ }
3014
+ if (paired.action === "registered") {
3015
+ return "restart";
3016
+ }
3017
+ return "noop";
3018
+ }
3019
+
3020
+ // src/index.ts
3021
+ async function main() {
3022
+ const [, , command = "help", ...args] = process.argv;
3023
+ const isServiceMode = hasFlag(args, "--service");
3024
+ const jsonOutput = hasFlag(args, "--json");
3025
+ if (command === "pair") {
3026
+ const pairSubcommand = readPairSubcommand(args);
3027
+ const localPair = pairSubcommand === "local" || hasFlag(args, "--local");
3028
+ if (localPair) {
3029
+ const gatewayAuth2 = resolveGatewayAuth();
3030
+ if ("error" in gatewayAuth2) {
3031
+ throw new Error(gatewayAuth2.error);
3032
+ }
3033
+ const qrFile2 = readFlag(args, "--qr-file");
3034
+ const explicitLocalUrl = readFlag(args, "--url");
3035
+ const local = buildLocalPairingInfo({
3036
+ explicitUrl: explicitLocalUrl,
3037
+ gatewayToken: gatewayAuth2.token,
3038
+ gatewayPassword: gatewayAuth2.password
3039
+ });
3040
+ let message = "Generated a local gateway pairing QR.";
3041
+ let configUpdated = false;
3042
+ let controlUiOrigin = null;
3043
+ let gatewayRestartAction = "unchanged";
3044
+ if (!explicitLocalUrl) {
3045
+ controlUiOrigin = buildGatewayControlUiOrigin(local.gatewayUrl);
3046
+ if (!jsonOutput) {
3047
+ console.log("\u23F3 Updating OpenClaw config for LAN access...");
3048
+ }
3049
+ const lanConfig = await configureOpenClawLanAccess({ controlUiOrigin });
3050
+ configUpdated = lanConfig.bindChanged || lanConfig.allowedOriginAdded;
3051
+ if (configUpdated) {
3052
+ if (!jsonOutput) {
3053
+ console.log("\u23F3 Restarting OpenClaw Gateway...");
3054
+ }
3055
+ const restart = await restartOpenClawGateway();
3056
+ gatewayRestartAction = restart.action;
3057
+ if (!jsonOutput) {
3058
+ console.log("\u2705 Gateway is ready.");
3059
+ }
3060
+ } else if (!jsonOutput) {
3061
+ console.log("\u2705 Gateway already allows LAN pairing.");
3062
+ }
3063
+ message = configUpdated ? "Configured OpenClaw for LAN access, restarted the Gateway, and generated a local gateway pairing QR." : "OpenClaw already allowed LAN pairing. Generated a local gateway pairing QR.";
3064
+ }
3065
+ const qrImagePath2 = await writeRawQrPng(local.qrPayload, "clawket-local-pair", qrFile2);
3066
+ if (jsonOutput) {
3067
+ printJson(buildLocalPairingJson({
3068
+ gatewayUrl: local.gatewayUrl,
3069
+ authMode: local.authMode,
3070
+ expiresAt: local.expiresAt,
3071
+ qrImagePath: qrImagePath2,
3072
+ message,
3073
+ configUpdated,
3074
+ controlUiOrigin,
3075
+ gatewayRestartAction,
3076
+ customUrl: Boolean(explicitLocalUrl)
3077
+ }));
3078
+ } else {
3079
+ printLocalPairingInfo(local.gatewayUrl, local.authMode, local.expiresAt, local.qrPayload, qrImagePath2, explicitLocalUrl);
3080
+ }
3081
+ return;
3082
+ }
3083
+ const forcePair = hasFlag(args, "--force");
3084
+ if (!forcePair) {
3085
+ await ensurePairPrerequisites();
3086
+ }
3087
+ const gatewayAuth = resolveGatewayAuth();
3088
+ if ("error" in gatewayAuth) {
3089
+ throw new Error(gatewayAuth.error);
3090
+ }
3091
+ const server = readFlag(args, "--server") ?? readFlag(args, "-s") ?? "https://registry.clawket.ai";
3092
+ const name = readFlag(args, "--name") ?? readFlag(args, "-n") ?? getDefaultBridgeDisplayName();
3093
+ const qrFile = readFlag(args, "--qr-file");
3094
+ const paired = await pairGateway({
3095
+ serverUrl: server,
3096
+ displayName: name,
3097
+ gatewayToken: gatewayAuth.token,
3098
+ gatewayPassword: gatewayAuth.password
3099
+ });
3100
+ const qrImagePath = await writePairingQrPng(paired, qrFile);
3101
+ const currentService = getServiceStatus();
3102
+ const serviceAction = decidePairServiceAction(paired, currentService);
3103
+ if (serviceAction === "noop") {
3104
+ const runtimeProcesses = listRuntimeProcesses();
3105
+ if (runtimeProcesses.length > 1) {
3106
+ stopRuntimeProcesses();
3107
+ const status = restartService();
3108
+ const message = "Detected duplicate bridge runtimes. Restarted the background service cleanly.";
3109
+ if (jsonOutput) {
3110
+ printJson(buildPairingJson(paired, qrImagePath, status, message));
3111
+ } else {
3112
+ printPairingInfo(paired, qrImagePath);
3113
+ printServiceResult(message, status);
3114
+ }
3115
+ return;
3116
+ }
3117
+ if (jsonOutput) {
3118
+ printJson(buildPairingJson(paired, qrImagePath, currentService, "Background service already running. Left unchanged."));
3119
+ } else {
3120
+ printPairingInfo(paired, qrImagePath);
3121
+ console.log("Background service already running. Left unchanged.");
3122
+ printServiceResult(null, currentService);
3123
+ }
3124
+ return;
3125
+ }
3126
+ try {
3127
+ stopRuntimeProcesses();
3128
+ const status = serviceAction === "install" ? installService() : restartService();
3129
+ const message = serviceAction === "install" ? "Auto-installed background service." : paired.action === "registered" ? "Bridge identity changed. Restarted background service to load the new pairing." : "Background service was installed but stopped. Restarted it.";
3130
+ if (jsonOutput) {
3131
+ printJson(buildPairingJson(paired, qrImagePath, status, message));
3132
+ } else {
3133
+ printPairingInfo(paired, qrImagePath);
3134
+ printServiceResult(message, status);
3135
+ }
3136
+ } catch (error) {
3137
+ if (isAutostartUnsupportedError(error)) {
3138
+ const status = await startTransientRuntime();
3139
+ const message = buildUnsupportedAutostartMessage(status);
3140
+ if (jsonOutput) {
3141
+ printJson(buildPairingJson(paired, qrImagePath, status, message));
3142
+ } else {
3143
+ printPairingInfo(paired, qrImagePath);
3144
+ printServiceResult(message, status);
3145
+ }
3146
+ return;
3147
+ }
3148
+ console.error(`Pairing succeeded, but service activation failed: ${formatError2(error)}`);
3149
+ console.error('You can still run "clawket install" or "clawket run" manually.');
3150
+ process.exitCode = 1;
3151
+ }
3152
+ return;
3153
+ }
3154
+ if (command === "refresh-code") {
3155
+ const qrFile = readFlag(args, "--qr-file");
3156
+ const gatewayAuth = resolveGatewayAuth();
3157
+ if ("error" in gatewayAuth) {
3158
+ throw new Error(gatewayAuth.error);
3159
+ }
3160
+ const paired = await refreshAccessCode({
3161
+ gatewayToken: gatewayAuth.token,
3162
+ gatewayPassword: gatewayAuth.password
3163
+ });
3164
+ const qrImagePath = await writePairingQrPng(paired, qrFile);
3165
+ if (jsonOutput) {
3166
+ printJson(buildPairingJson(paired, qrImagePath, getServiceStatus(), "Pairing code refreshed."));
3167
+ } else {
3168
+ printPairingInfo(paired, qrImagePath);
3169
+ }
3170
+ return;
3171
+ }
3172
+ if (command === "install" || command === "start") {
3173
+ const config = requirePairingConfig();
3174
+ stopRuntimeProcesses();
3175
+ const status = installService();
3176
+ console.log(`Installed background service for gateway ${config.gatewayId}.`);
3177
+ printServiceResult(null, status);
3178
+ return;
3179
+ }
3180
+ if (command === "restart") {
3181
+ const config = requirePairingConfig();
3182
+ stopRuntimeProcesses();
3183
+ const status = restartService();
3184
+ console.log(`Restarted background service for gateway ${config.gatewayId}.`);
3185
+ printServiceResult(null, status);
3186
+ return;
3187
+ }
3188
+ if (command === "stop") {
3189
+ const status = stopService();
3190
+ stopRuntimeProcesses();
3191
+ console.log("Stopped background service.");
3192
+ printServiceResult(null, status);
3193
+ return;
3194
+ }
3195
+ if (command === "uninstall") {
3196
+ const status = uninstallService();
3197
+ stopRuntimeProcesses();
3198
+ console.log("Removed background service registration.");
3199
+ printServiceResult(null, status);
3200
+ return;
3201
+ }
3202
+ if (command === "reset") {
3203
+ stopRuntimeProcesses();
3204
+ stopService();
3205
+ deletePairingConfig();
3206
+ console.log(`Cleared pairing config: ${getPairingConfigPath()}`);
3207
+ return;
3208
+ }
3209
+ if (command === "status") {
3210
+ printStatus();
3211
+ return;
3212
+ }
3213
+ if (command === "logs") {
3214
+ const lines = Number(readFlag(args, "--lines") ?? "200");
3215
+ const lastMs = parseLookbackToMs(readFlag(args, "--last") ?? readFlag(args, "-l"));
3216
+ const recent = readRecentCliLogs({
3217
+ lines,
3218
+ lastMs,
3219
+ includeErrorLog: hasFlag(args, "--errors")
3220
+ });
3221
+ if (jsonOutput) {
3222
+ printJson({ ok: true, lines: recent });
3223
+ } else if (recent.length === 0) {
3224
+ console.log("No matching CLI logs found.");
3225
+ } else {
3226
+ console.log(recent.join("\n"));
3227
+ }
3228
+ return;
3229
+ }
3230
+ if (command === "doctor") {
3231
+ const report = await buildDoctorReport();
3232
+ if (jsonOutput) {
3233
+ printJson(report);
3234
+ } else {
3235
+ printDoctorReport(report);
3236
+ }
3237
+ return;
3238
+ }
3239
+ if (command === "run") {
3240
+ const config = requirePairingConfig();
3241
+ const replaceExisting = hasFlag(args, "--replace");
3242
+ const existingRuntimePids = listRuntimeProcesses().map((entry) => entry.pid);
3243
+ if (existingRuntimePids.length > 0) {
3244
+ if (!replaceExisting) {
3245
+ console.error(
3246
+ `Another Clawket bridge runtime is already running (pid${existingRuntimePids.length > 1 ? "s" : ""}: ${existingRuntimePids.join(", ")}). Run "clawket stop" first, or rerun with "--replace" to take over.`
3247
+ );
3248
+ process.exit(1);
3249
+ }
3250
+ stopRuntimeProcesses();
3251
+ }
3252
+ const gatewayUrl = resolveGatewayUrl(readFlag(args, "--gateway-url") ?? readFlag(args, "-g"));
3253
+ const emitRuntimeLine = (line) => {
3254
+ console.log(`[${Date.now()}] ${line}`);
3255
+ };
3256
+ if (!isServiceMode) {
3257
+ console.log(`Gateway ID: ${config.gatewayId}`);
3258
+ console.log(`Instance ID: ${config.instanceId}`);
3259
+ console.log(`Gateway URL: ${gatewayUrl}`);
3260
+ console.log("");
3261
+ console.log("Starting bridge runtime. Press Ctrl+C to stop.");
3262
+ console.log("");
3263
+ } else {
3264
+ emitRuntimeLine(`Starting Clawket service runtime for gateway ${config.gatewayId}`);
3265
+ }
3266
+ if (isServiceMode) {
3267
+ writeServiceState();
3268
+ }
3269
+ const runtime = new BridgeRuntime({
3270
+ config,
3271
+ gatewayUrl,
3272
+ onLog: (line) => {
3273
+ emitRuntimeLine(`[clawket] ${line}`);
3274
+ },
3275
+ onStatus: (snapshot) => {
3276
+ if (snapshot.lastError) {
3277
+ emitRuntimeLine(`[status] relay=${snapshot.relayConnected ? "up" : "down"} gateway=${snapshot.gatewayConnected ? "up" : "down"} clients=${snapshot.clientCount} error=${snapshot.lastError}`);
3278
+ return;
3279
+ }
3280
+ emitRuntimeLine(`[status] relay=${snapshot.relayConnected ? "up" : "down"} gateway=${snapshot.gatewayConnected ? "up" : "down"} clients=${snapshot.clientCount}`);
3281
+ },
3282
+ onPendingPairRequest: (request) => {
3283
+ emitRuntimeLine(`[pair-request] requestId=${request.requestId} deviceId=${request.deviceId || "<unknown>"} name=${request.displayName ?? "<unknown>"}`);
3284
+ }
3285
+ });
3286
+ runtime.start();
3287
+ registerRuntimeProcess({
3288
+ gatewayId: config.gatewayId,
3289
+ instanceId: config.instanceId,
3290
+ serviceMode: isServiceMode
3291
+ });
3292
+ const shutdown = async () => {
3293
+ process.off("SIGINT", shutdown);
3294
+ process.off("SIGTERM", shutdown);
3295
+ await runtime.stop();
3296
+ unregisterRuntimeProcess(process.pid);
3297
+ if (isServiceMode) {
3298
+ clearServiceState(process.pid);
3299
+ }
3300
+ process.exit(0);
3301
+ };
3302
+ process.on("SIGINT", shutdown);
3303
+ process.on("SIGTERM", shutdown);
3304
+ await new Promise(() => {
3305
+ });
3306
+ }
3307
+ printHelp();
3308
+ }
3309
+ function printPairingInfo(paired, qrImagePath) {
3310
+ if (paired.action === "refreshed") {
3311
+ console.log("Bridge already paired. Refreshed the pairing code.");
3312
+ }
3313
+ console.log(`Gateway ID: ${paired.config.gatewayId}`);
3314
+ console.log("\nScan this QR code in the Clawket app:\n");
3315
+ qrcodeTerminal.generate(paired.qrPayload, { small: true });
3316
+ console.log(`Expires: ${formatLocalTime(paired.accessCodeExpiresAt)}`);
3317
+ console.log(`QR image: ${qrImagePath}`);
3318
+ }
3319
+ function printLocalPairingInfo(gatewayUrl, authMode, expiresAt, qrPayload, qrImagePath, customUrl) {
3320
+ console.log(`Gateway URL: ${gatewayUrl}`);
3321
+ console.log(`Auth mode: ${authMode}`);
3322
+ console.log(customUrl ? "\nScan this custom gateway QR in the Clawket app:\n" : "\nScan this local gateway QR in the Clawket app:\n");
3323
+ qrcodeTerminal.generate(qrPayload, { small: true });
3324
+ console.log(`Expires: ${new Date(expiresAt).toLocaleString()}`);
3325
+ console.log(`QR image: ${qrImagePath}`);
3326
+ }
3327
+ function printStatus() {
3328
+ const config = readPairingConfig();
3329
+ const service = getServiceStatus();
3330
+ const { logPath, errorLogPath } = getServicePaths();
3331
+ const version = readCliVersion();
3332
+ console.log(`Version: ${version}`);
3333
+ if (!config) {
3334
+ console.log(`Config: not paired (${getPairingConfigPath()})`);
3335
+ } else {
3336
+ console.log(`Config: paired`);
3337
+ console.log(`Gateway ID: ${config.gatewayId}`);
3338
+ console.log(`Instance: ${config.instanceId}`);
3339
+ console.log(`Server URL: ${config.serverUrl}`);
3340
+ console.log(`Name: ${config.displayName ?? "-"}`);
3341
+ }
3342
+ console.log(`Gateway: ${resolveGatewayUrl()}`);
3343
+ console.log(`Service: ${service.installed ? "installed" : "not installed"} (${service.method})`);
3344
+ console.log(`Running: ${service.running ? "yes" : "no"}`);
3345
+ console.log(`Path: ${service.servicePath || "-"}`);
3346
+ console.log(`Log: ${logPath}`);
3347
+ console.log(`Error Log: ${errorLogPath}`);
3348
+ if (!config) {
3349
+ process.exitCode = 1;
3350
+ }
3351
+ }
3352
+ function printServiceResult(message, status) {
3353
+ if (message) {
3354
+ console.log(message);
3355
+ }
3356
+ console.log(`Service: ${status.installed ? status.running ? "installed, running" : "installed, stopped" : "not installed"}`);
3357
+ console.log(`Service path: ${status.servicePath || "-"}`);
3358
+ }
3359
+ function printDoctorReport(report) {
3360
+ console.log(`Paired: ${report.paired ? "yes" : "no"}`);
3361
+ console.log(`Gateway ID: ${report.gatewayId ?? "-"}`);
3362
+ console.log(`Server URL: ${report.serverUrl ?? "-"}`);
3363
+ console.log(`Relay URL: ${report.relayUrl ?? "-"}`);
3364
+ console.log(`Instance ID: ${report.instanceId ?? "-"}`);
3365
+ console.log(`Service: ${report.serviceInstalled ? "installed" : "not installed"} (${report.serviceMethod})`);
3366
+ console.log(`Service running: ${report.serviceRunning ? "yes" : "no"}`);
3367
+ console.log(`Service path: ${report.servicePath || "-"}`);
3368
+ console.log(`Log path: ${report.logPath}`);
3369
+ console.log(`Error log path: ${report.errorLogPath}`);
3370
+ console.log(`OpenClaw dir: ${report.openclawConfigDir}`);
3371
+ console.log(`OpenClaw media: ${report.openclawMediaDir}`);
3372
+ console.log(`OpenClaw config: ${report.openclawConfigFound ? "found" : "missing"}`);
3373
+ console.log(`OpenClaw token: ${report.openclawTokenFound ? "found" : "missing"}`);
3374
+ console.log(`Gateway URL: ${report.localGatewayUrl}`);
3375
+ console.log(`Gateway reachable: ${report.localGatewayReachable ? "yes" : "no"}`);
3376
+ }
3377
+ function requirePairingConfig() {
3378
+ const config = readPairingConfig();
3379
+ if (!config) {
3380
+ console.error(`Not paired. Run "clawket pair" first. Config path: ${getPairingConfigPath()}`);
3381
+ process.exit(1);
3382
+ }
3383
+ return config;
3384
+ }
3385
+ function readFlag(args, name) {
3386
+ const index = args.indexOf(name);
3387
+ if (index < 0) return null;
3388
+ const value = args[index + 1];
3389
+ return value?.trim() ? value.trim() : null;
3390
+ }
3391
+ function hasFlag(args, name) {
3392
+ return args.includes(name);
3393
+ }
3394
+ function readPairSubcommand(args) {
3395
+ for (const arg of args) {
3396
+ if (!arg.startsWith("-")) {
3397
+ return arg.trim() || null;
3398
+ }
3399
+ }
3400
+ return null;
3401
+ }
3402
+ function printHelp() {
3403
+ console.log([
3404
+ "clawket pair [--server <url>] [--name <displayName>] [--qr-file <path>] [--json] [--force]",
3405
+ "clawket pair local [--url <ws://host:port>] [--qr-file <path>] [--json]",
3406
+ "clawket pair --local [--url <ws://host:port>] [--qr-file <path>] [--json]",
3407
+ "clawket refresh-code [--qr-file <path>] [--json]",
3408
+ "clawket start",
3409
+ "clawket install",
3410
+ "clawket restart",
3411
+ "clawket stop",
3412
+ "clawket uninstall",
3413
+ "clawket reset",
3414
+ "clawket status",
3415
+ "clawket logs [--last <2m>] [--lines <200>] [--errors] [--json]",
3416
+ "clawket doctor [--json]",
3417
+ "clawket run [--gateway-url <ws://127.0.0.1:18789>] [--replace]"
3418
+ ].join("\n"));
3419
+ }
3420
+ function buildUnsupportedAutostartMessage(status) {
3421
+ if (status.running) {
3422
+ return "Started the bridge runtime, but this host does not support automatic startup registration. Use your container or process manager to restart Clawket on reboot.";
3423
+ }
3424
+ return "This host does not support automatic startup registration, and the bridge runtime could not be started automatically. Use your container or process manager to run Clawket.";
3425
+ }
3426
+ function formatLocalTime(iso) {
3427
+ const d = new Date(iso);
3428
+ if (Number.isNaN(d.getTime())) return iso;
3429
+ return d.toLocaleString();
3430
+ }
3431
+ function formatError2(error) {
3432
+ return error instanceof Error ? error.message : String(error);
3433
+ }
3434
+ function printJson(value) {
3435
+ console.log(JSON.stringify(value, null, 2));
3436
+ }
3437
+ main().catch((error) => {
3438
+ console.error(formatError2(error));
3439
+ process.exit(1);
3440
+ });