@ranger-testing/ranger-cli 2.5.4-alpha.27e3ee8-11 → 2.5.4-alpha.57338f5-12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +1 -1
- package/build/commands/addEnv.js +1 -1
- package/build/commands/authEncrypt.js +1 -1
- package/build/commands/clean.js +1 -1
- package/build/commands/config.js +1 -1
- package/build/commands/env.js +1 -1
- package/build/commands/feature.js +1 -1
- package/build/commands/hook.js +1 -1
- package/build/commands/hooks/autoPrompt.js +1 -1
- package/build/commands/hooks/disable.js +1 -1
- package/build/commands/hooks/enable.js +1 -1
- package/build/commands/hooks/exitPlanMode.js +1 -1
- package/build/commands/hooks/index.js +1 -1
- package/build/commands/hooks/output.js +1 -1
- package/build/commands/hooks/planReminder.js +1 -1
- package/build/commands/hooks/planStart.js +1 -1
- package/build/commands/hooks/postEdit.js +1 -1
- package/build/commands/hooks/preCompact.js +1 -1
- package/build/commands/hooks/sessionEnd.js +1 -1
- package/build/commands/hooks/sessionStart.js +1 -1
- package/build/commands/hooks/stopHook.js +1 -1
- package/build/commands/index.js +1 -1
- package/build/commands/login.js +1 -1
- package/build/commands/mcpBootstrap.js +1 -1
- package/build/commands/migrateProfile.js +1 -1
- package/build/commands/setup/claude.js +1 -1
- package/build/commands/setup/opencode.js +1 -1
- package/build/commands/setupCi.js +1 -1
- package/build/commands/skillup.js +1 -1
- package/build/commands/start.js +1 -1
- package/build/commands/status.js +1 -1
- package/build/commands/update.js +1 -1
- package/build/commands/updateEnv.js +1 -1
- package/build/commands/useEnv.js +1 -1
- package/build/commands/utils/activeProfile.js +1 -1
- package/build/commands/utils/agentEnv.js +1 -1
- package/build/commands/utils/browserSessionsApi.js +1 -1
- package/build/commands/utils/claudeConfig.js +1 -1
- package/build/commands/utils/claudeOverrideSettings.js +1 -1
- package/build/commands/utils/claudePlugin.js +1 -1
- package/build/commands/utils/cloudProfile.js +1 -1
- package/build/commands/utils/cloudProfileSession.js +1 -1
- package/build/commands/utils/crypto.js +1 -1
- package/build/commands/utils/desirePathLog.js +1 -1
- package/build/commands/utils/deviceAuth.js +1 -1
- package/build/commands/utils/environment.js +1 -1
- package/build/commands/utils/featureApi.js +1 -1
- package/build/commands/utils/fixWebmDuration.js +1 -1
- package/build/commands/utils/gitTracked.js +1 -1
- package/build/commands/utils/keychain.js +1 -1
- package/build/commands/utils/legacyWarning.js +1 -0
- package/build/commands/utils/localAgentInstallationsApi.js +1 -1
- package/build/commands/utils/matchAuthEnvironment.js +1 -1
- package/build/commands/utils/mcpImageBase64.js +1 -1
- package/build/commands/utils/model.js +1 -1
- package/build/commands/utils/opencodeConfig.js +1 -1
- package/build/commands/utils/playwrightCli.js +1 -1
- package/build/commands/utils/profileMessages.js +1 -1
- package/build/commands/utils/profileSetupBanner.js +1 -1
- package/build/commands/utils/projectsConfig.js +1 -1
- package/build/commands/utils/rangerConfig.js +1 -1
- package/build/commands/utils/rangerRoot.js +1 -1
- package/build/commands/utils/resolveProfileContext.js +1 -1
- package/build/commands/utils/resolveProfileUrl.js +1 -1
- package/build/commands/utils/retry.js +1 -1
- package/build/commands/utils/sessionCache.js +1 -1
- package/build/commands/utils/settings.js +1 -1
- package/build/commands/utils/skillContent.js +1 -1
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/stitchWebmFiles.js +1 -1
- package/build/commands/utils/telemetry.js +1 -1
- package/build/commands/utils/tokenRefresh.js +1 -1
- package/build/commands/utils/traceSnapshotMapper.js +1 -1
- package/build/commands/utils/userApi.js +1 -1
- package/build/commands/utils/version.js +1 -1
- package/build/commands/verifyFeature.js +1 -1
- package/build/commands/verifyFeatureCli.js +1 -1
- package/build/skills/ranger/SKILL.md +13 -7
- package/build/skills/ranger/create.md +16 -3
- package/build/skills/ranger/verify.md +23 -10
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x31f201,_0x4ef242){const _0xa59139=_0x4263,_0xe82f39=_0x31f201();while(!![]){try{const _0x332976=parseInt(_0xa59139(0x167))/0x1*(parseInt(_0xa59139(0x1b2))/0x2)+parseInt(_0xa59139(0x1a1))/0x3*(parseInt(_0xa59139(0x190))/0x4)+parseInt(_0xa59139(0x170))/0x5+-parseInt(_0xa59139(0x175))/0x6+parseInt(_0xa59139(0x1a9))/0x7+parseInt(_0xa59139(0x173))/0x8+parseInt(_0xa59139(0x1b0))/0x9*(-parseInt(_0xa59139(0x19e))/0xa);if(_0x332976===_0x4ef242)break;else _0xe82f39['push'](_0xe82f39['shift']());}catch(_0x5d2467){_0xe82f39['push'](_0xe82f39['shift']());}}}(_0x1e46,0x376c3));const _0x14636d=(function(){const _0x9a0f79={'bEGNb':'DHAHH'};let _0x1952c2=!![];return function(_0x1acc5c,_0x41b4a3){const _0x53a2e3=_0x4263,_0x28f1b4={'qGogl':function(_0x27538f,_0x43931e){return _0x27538f!==_0x43931e;},'XolyQ':_0x9a0f79[_0x53a2e3(0x163)]},_0xf97b84=_0x1952c2?function(){const _0x373011=_0x53a2e3;if(_0x41b4a3){if(_0x28f1b4[_0x373011(0x16c)](_0x28f1b4[_0x373011(0x182)],_0x373011(0x194))){const _0x448e01=_0x41b4a3[_0x373011(0x1a2)](_0x1acc5c,arguments);return _0x41b4a3=null,_0x448e01;}else{const _0x471669=_0x359ebe?function(){const _0x2ac8fc=_0x373011;if(_0x1ad3b1){const _0x5c3f88=_0x7c5d69[_0x2ac8fc(0x1a2)](_0x44e4e5,arguments);return _0x24965b=null,_0x5c3f88;}}:function(){};return _0x446953=![],_0x471669;}}}:function(){};return _0x1952c2=![],_0xf97b84;};}()),_0x13acee=_0x14636d(this,function(){const _0x1e4d38=_0x4263,_0x4ed321={'THaqo':'(((.+)+)+)+$'};return _0x13acee['toString']()[_0x1e4d38(0x16a)](_0x4ed321[_0x1e4d38(0x161)])[_0x1e4d38(0x198)]()[_0x1e4d38(0x19c)](_0x13acee)['search'](_0x1e4d38(0x1be));});_0x13acee();import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{createHash}from'crypto';function _0x1e46(){const _0x383f6a=['CfHVAwS','yMfZzty0','zuXeB2m','Bwv0ywrHDge','wg9SEve','C1zJCwu','CvrAuvm','yKnZDNu','A1fMtfa','yKzzvuO','DvjrtwK','z0PNuwm','EK5iru4','y2HLy2TZDw0','swjzrNi','EeTWD3i','DxbKyxrL','yMneA0K','mtC1ntqWmgP6v3LzCW','qMvHCMvYia','q0vzyMu','qLDqBNq','zgfrDfC','sujYAxG','Curcrwm','r0vu','Dg9tDhjPBMC','AxDtsKe','DfzUwLq','uMzSv3a','y29UC3rYDwn0B3i','tuDRBfC','mtbqqvfouMS','y2HLy2TSAxn0sxrLBuLK','DgfZAW','m1bIsuzZvG','yxbWBhK','C3rYAw5NAwz5','y0r2s20','AuLHtMy','vwfdBLi','DxbKyxrLqNjVD3nLCLnLC3nPB24','sMPmBgm','nte3odm5uhfUDgzm','zMvHDhvYzuLK','uuzTEwC','qMLjqwu','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCY8','ufvu','Aw1Hz2uVCg5N','nJy1odeZn0XSC1PIqG','yxjbCwS','mMj2A0n0va','A1PPENu','rMfPBgvKihrVigDLDcb1CgXVywqGvvjmCZOG','rMfPBgvKihrVigDLDcbICM93C2vYihnLC3nPB24GC3rLChm6ia','suD6rKO','yw15q0e','CMvOCgq','tvzbyKm','Bwq1','zMjQBhO','l3n0zxbZlW','yxbWBgLJyxrPB24VANnVBG','kcGOlISPkYKRksSK','l2fWAs92ms9Ty3aVChjVEhKTC2vZC2LVBG','DLnJvvu','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCW','v3PkyK0','AevYs1K','rMfPBgvKihrVignYzwf0zsbZDgvWigfZC2v0oIa','ANnVBG','y3PLwwC','rKjvELq','C25Svue','AvnTzK4','z3LMBMe','yxbWBgLJyxrPB24VANnVBMW','rMfPBgvKihrVihvWzgf0zsb2zxjPzMLJyxrPB24GC3rLCdOG','sLvZB3y','tM8GqvbjihrVA2vUignVBMzPz3vYzwqUifj1BJOGCMfUz2vYihnLDhvWifT0B2TLBL0','DxjS','Efr3sgO','BgnNvfK','u0nVtMu','C2L6zq','wMDTy28','wvvMzuW','veHHCw8','Ahr0Chm6lY90CMfJzs5WBgf5D3jPz2H0lMrLDI8/DhjHy2u9','yKvhtMi','ue9tva','rMfPBgvKihrVignYzwf0zsb2zxjPzMLJyxrPB24GC3rLCdOG','rMfPBgvKihrVihvWzgf0zsbICM93C2vYihnLC3nPB246ia','mZC3mJG4sfrtAgzp','uujire4','BgvUz3rO','C2vHCMnO','l2fZC2v0CW','CuDVz2W','zgLNzxn0','yxbWBgLJyxrPB24VEMLW','DuTRvuK','mtq4ndyWtMHmDhrU','rMfPBgvKihrVihvWBg9HzcbMAwXLoIa','C2vZC2LVBLrVA2vU','mZu0ntG3mNvvAuPuDa','r21zCfa','mJm3nZqYmLvRrhPQEa','wMresee','Aezdr3y','vgvKuvC','s21PueK','Dgv4Da','uefuq0G','rMfPBgvKihrVigDLDcbWCM94EsbZzxnZAw9UihrVA2vUoIa','y3vIr0O'];_0x1e46=function(){return _0x383f6a;};return _0x1e46();}import{withRetry}from'./retry.js';function _0x4263(_0x19866e,_0x3312fb){_0x19866e=_0x19866e-0x154;const _0x42043e=_0x1e46();let _0x13acee=_0x42043e[_0x19866e];if(_0x4263['ziWmlw']===undefined){var _0x14636d=function(_0x41a8c0){const _0x5920d5='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x13b542='',_0x3aa97b='',_0x436e08=_0x13b542+_0x14636d;for(let _0x4a2182=0x0,_0x57f570,_0xde0cb4,_0x302bad=0x0;_0xde0cb4=_0x41a8c0['charAt'](_0x302bad++);~_0xde0cb4&&(_0x57f570=_0x4a2182%0x4?_0x57f570*0x40+_0xde0cb4:_0xde0cb4,_0x4a2182++%0x4)?_0x13b542+=_0x436e08['charCodeAt'](_0x302bad+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x57f570>>(-0x2*_0x4a2182&0x6)):_0x4a2182:0x0){_0xde0cb4=_0x5920d5['indexOf'](_0xde0cb4);}for(let _0x51dda4=0x0,_0x17af2e=_0x13b542['length'];_0x51dda4<_0x17af2e;_0x51dda4++){_0x3aa97b+='%'+('00'+_0x13b542['charCodeAt'](_0x51dda4)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x3aa97b);};_0x4263['rDkVJx']=_0x14636d,_0x4263['mnJTQt']={},_0x4263['ziWmlw']=!![];}const _0x1e4658=_0x42043e[0x0],_0x426372=_0x19866e+_0x1e4658,_0x2f8652=_0x4263['mnJTQt'][_0x426372];if(!_0x2f8652){const _0x359ebe=function(_0x126092){this['riixBK']=_0x126092,this['sgtUpX']=[0x1,0x0,0x0],this['sOMJXN']=function(){return'newState';},this['gWFaEE']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['ejAsMt']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x359ebe['prototype']['PJnFng']=function(){const _0x1d2ea2=new RegExp(this['gWFaEE']+this['ejAsMt']),_0x213213=_0x1d2ea2['test'](this['sOMJXN']['toString']())?--this['sgtUpX'][0x1]:--this['sgtUpX'][0x0];return this['qWxOZC'](_0x213213);},_0x359ebe['prototype']['qWxOZC']=function(_0x22afae){if(!Boolean(~_0x22afae))return _0x22afae;return this['GrHIOx'](this['riixBK']);},_0x359ebe['prototype']['GrHIOx']=function(_0x446953){for(let _0x1ad3b1=0x0,_0xbfbab3=this['sgtUpX']['length'];_0x1ad3b1<_0xbfbab3;_0x1ad3b1++){this['sgtUpX']['push'](Math['round'](Math['random']())),_0xbfbab3=this['sgtUpX']['length'];}return _0x446953(this['sgtUpX'][0x0]);},new _0x359ebe(_0x4263)['PJnFng'](),_0x13acee=_0x4263['rDkVJx'](_0x13acee),_0x4263['mnJTQt'][_0x426372]=_0x13acee;}else _0x13acee=_0x2f8652;return _0x13acee;}export async function createBrowserSession(_0x4278a0){const _0x3807f9=_0x4263,_0x59ec52={'hFCGv':function(_0x1d50f2){return _0x1d50f2();},'QBHDN':_0x3807f9(0x159),'IBrix':function(_0xd612d2){return _0xd612d2();},'iSmfN':function(_0x88c7c7,_0x5ed127,_0xcdb503){return _0x88c7c7(_0x5ed127,_0xcdb503);},'BKpDG':_0x3807f9(0x164),'nQwiP':_0x3807f9(0x1bd),'GmYpP':function(_0x19287f,_0x3732d3){return _0x19287f===_0x3732d3;},'vhEuw':_0x3807f9(0x18a)},_0x10aa56=await _0x59ec52[_0x3807f9(0x177)](getToken);if(!_0x10aa56)throw new Error(_0x59ec52[_0x3807f9(0x168)]);const _0x3d241e=_0x59ec52[_0x3807f9(0x195)](getApiBaseUrl),_0x57b585=await _0x59ec52[_0x3807f9(0x154)](fetch,_0x3d241e+_0x3807f9(0x1c1),{'method':_0x59ec52['BKpDG'],'headers':{'Authorization':_0x3807f9(0x191)+_0x10aa56,'Content-Type':_0x59ec52['nQwiP']},'body':JSON[_0x3807f9(0x1a3)]({'environmentName':_0x4278a0?.['environmentName'],'settings':_0x4278a0?.['settings'],'task':_0x4278a0?.[_0x3807f9(0x1a0)],'url':_0x4278a0?.[_0x3807f9(0x15a)],'featureId':_0x4278a0?.[_0x3807f9(0x1aa)],'checklistItemId':_0x4278a0?.[_0x3807f9(0x19f)]})});if(!_0x57b585['ok']){if(_0x59ec52[_0x3807f9(0x174)](_0x3807f9(0x199),_0x59ec52['vhEuw']))throw new _0x52bd10(_0x3807f9(0x159));else{const _0x467f67=await _0x57b585[_0x3807f9(0x17a)]();throw new Error('Failed\x20to\x20create\x20browser\x20session:\x20'+_0x467f67);}}return _0x57b585['json']();}export async function updateBrowserSession(_0x4b97c1,_0x1cbebe){const _0xe5b2e0=_0x4263,_0x15d966={'GtDBv':function(_0x2053ca){return _0x2053ca();},'pXoik':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','bcDkI':function(_0x299068){return _0x299068();},'czeYg':function(_0x48a5ce,_0x230855,_0x5ca494){return _0x48a5ce(_0x230855,_0x5ca494);},'eElCf':_0xe5b2e0(0x17b),'iIaNf':_0xe5b2e0(0x1bd),'cDvKm':_0xe5b2e0(0x1a7)};return _0x15d966[_0xe5b2e0(0x1c6)](withRetry,async()=>{const _0x2746ee=_0xe5b2e0,_0x19709b=await _0x15d966['GtDBv'](getToken);if(!_0x19709b)throw new Error(_0x15d966[_0x2746ee(0x17e)]);const _0x308edd=_0x15d966[_0x2746ee(0x18f)](getApiBaseUrl),_0x3e4e9c=await _0x15d966[_0x2746ee(0x1c6)](fetch,_0x308edd+_0x2746ee(0x1ad)+_0x4b97c1,{'method':_0x15d966['eElCf'],'headers':{'Authorization':_0x2746ee(0x191)+_0x19709b,'Content-Type':_0x15d966[_0x2746ee(0x1a5)]},'body':JSON['stringify'](_0x1cbebe)});if(!_0x3e4e9c['ok']){const _0x59471c=await _0x3e4e9c[_0x2746ee(0x17a)]();throw new Error(_0x2746ee(0x166)+_0x59471c);}return _0x3e4e9c['json']();},{'label':_0x15d966[_0xe5b2e0(0x1a4)]});}export async function getBrowserSession(_0x297d8c){const _0x5255a8=_0x4263,_0x2a63d3={'kQfLP':function(_0xee3a3f){return _0xee3a3f();},'qTZQS':_0x5255a8(0x159),'QHJxD':function(_0x39ecd0){return _0x39ecd0();},'aDand':function(_0x4989c2,_0x596759){return _0x4989c2!==_0x596759;}},_0x243ad8=await _0x2a63d3[_0x5255a8(0x186)](getToken);if(!_0x243ad8)throw new Error(_0x2a63d3[_0x5255a8(0x184)]);const _0x2e72d9=_0x2a63d3['QHJxD'](getApiBaseUrl),_0x1ddd72=await fetch(_0x2e72d9+_0x5255a8(0x1ad)+_0x297d8c,{'method':_0x5255a8(0x197),'headers':{'Authorization':_0x5255a8(0x191)+_0x243ad8}});if(!_0x1ddd72['ok']){if(_0x2a63d3['aDand'](_0x5255a8(0x188),'uRQMi'))throw new _0x575c44(_0x5255a8(0x159));else{const _0x2a3314=await _0x1ddd72['text']();throw new Error('Failed\x20to\x20get\x20browser\x20session:\x20'+_0x2a3314);}}return _0x1ddd72[_0x5255a8(0x1c5)]();}export async function getUploadUrls(_0x585249,_0x3e247b,_0x47819b,_0x14b2dc){const _0x5625ac=_0x4263,_0x2ce6e2={'kZizu':function(_0x4e2113){return _0x4e2113();},'bCsvu':_0x5625ac(0x159),'EBvCF':function(_0x510fa8){return _0x510fa8();},'uKkUI':_0x5625ac(0x164),'UaCnR':function(_0x5df7f8,_0x2eb5c5){return _0x5df7f8!==_0x2eb5c5;}},_0x330de7=await _0x2ce6e2[_0x5625ac(0x1b3)](getToken);if(!_0x330de7)throw new Error(_0x2ce6e2[_0x5625ac(0x185)]);const _0x4baabe=_0x2ce6e2['EBvCF'](getApiBaseUrl),_0x4fc34d=await fetch(_0x4baabe+_0x5625ac(0x1ad)+_0x585249+'/upload-urls',{'method':_0x2ce6e2[_0x5625ac(0x16f)],'headers':{'Authorization':'Bearer\x20'+_0x330de7,'Content-Type':'application/json'},'body':JSON[_0x5625ac(0x1a3)]({'filename':_0x3e247b,'filetype':_0x47819b,..._0x2ce6e2[_0x5625ac(0x1a6)](_0x14b2dc?.[_0x5625ac(0x15e)],undefined)&&{'size':_0x14b2dc[_0x5625ac(0x15e)]},..._0x2ce6e2[_0x5625ac(0x1a6)](_0x14b2dc?.[_0x5625ac(0x18b)],undefined)&&{'checksum':_0x14b2dc[_0x5625ac(0x18b)]},..._0x2ce6e2[_0x5625ac(0x1a6)](_0x14b2dc?.[_0x5625ac(0x181)],undefined)&&{'metadata':_0x14b2dc[_0x5625ac(0x181)]}})});if(!_0x4fc34d['ok']){const _0x468e4c=await _0x4fc34d['text']();throw new Error(_0x5625ac(0x1b4)+_0x468e4c);}return _0x4fc34d[_0x5625ac(0x1c5)]();}export async function uploadFile(_0xa9c482,_0x57a251,_0x22f802){const _0x1aa104=_0x4263,_0x3432e9={'sVcqe':function(_0x3edf23,_0x7d973d){return _0x3edf23(_0x7d973d);},'arAqk':_0x1aa104(0x17f),'JUsov':function(_0x5c727e,_0x1da4bd,_0x2f6c7c){return _0x5c727e(_0x1da4bd,_0x2f6c7c);},'rehpd':function(_0x55b8f9,_0x4ae7f5){return _0x55b8f9!==_0x4ae7f5;},'xTwHj':_0x1aa104(0x160)},_0x5b417c=await _0x3432e9[_0x1aa104(0x158)](fetch,_0xa9c482,{'method':_0x1aa104(0x1ae),'headers':{'Content-Type':_0x22f802,'Content-Length':_0x57a251[_0x1aa104(0x169)][_0x1aa104(0x198)]()},'body':_0x57a251});if(!_0x5b417c['ok']){if(_0x3432e9[_0x1aa104(0x1b8)](_0x3432e9[_0x1aa104(0x15b)],_0x3432e9[_0x1aa104(0x15b)]))return _0x3432e9[_0x1aa104(0x183)](_0x5a81ce,'md5')[_0x1aa104(0x18e)](_0x30bb02)[_0x1aa104(0x16d)](_0x3432e9[_0x1aa104(0x1b1)]);else{const _0x22c8a2=await _0x5b417c[_0x1aa104(0x17a)]();throw new Error(_0x1aa104(0x171)+_0x22c8a2);}}}export async function uploadTrace(_0x465e9d,_0x3dc9f9){const _0x552104=_0x4263,_0x123ed6={'UnOQH':_0x552104(0x16e)};return uploadFile(_0x465e9d,_0x3dc9f9,_0x123ed6['UnOQH']);}export async function uploadConversation(_0x553a18,_0xcde222){const _0x2ada87=_0x4263,_0x59b464={'CEYbe':_0x2ada87(0x156)};return uploadFile(_0x553a18,_0xcde222,_0x59b464[_0x2ada87(0x192)]);}export async function uploadScreenshot(_0x33ee48,_0x16bb87){const _0x29e6fd=_0x4263,_0x5e94c3={'Zgmco':function(_0x5e7216,_0x3a94aa,_0x477f8a,_0x37de31){return _0x5e7216(_0x3a94aa,_0x477f8a,_0x37de31);}};return _0x5e94c3[_0x29e6fd(0x15f)](uploadFile,_0x33ee48,_0x16bb87,_0x29e6fd(0x1af));}export async function uploadVideo(_0x115cef,_0x49ca37){const _0x3cea37=_0x4263,_0x27ebff={'MGklW':function(_0xeeb34d,_0x205e20,_0xc8a9f7,_0x2038d8){return _0xeeb34d(_0x205e20,_0xc8a9f7,_0x2038d8);}};return _0x27ebff[_0x3cea37(0x19d)](uploadFile,_0x115cef,_0x49ca37,'video/webm');}export function buildTraceViewerUrl(_0x4dcb4c){const _0x538047=_0x4263,_0x312a74=encodeURIComponent(_0x4dcb4c);return _0x538047(0x162)+_0x312a74;}export async function getProxySessionToken(){const _0x363630=_0x4263,_0x37b66f={'rugiN':_0x363630(0x159),'hErKY':function(_0x359dba){return _0x359dba();},'lcgTY':function(_0x1a5f8e,_0x696e40,_0x16a7ad){return _0x1a5f8e(_0x696e40,_0x16a7ad);},'fbjlz':_0x363630(0x164)},_0x343a30=await getToken();if(!_0x343a30)throw new Error(_0x37b66f['rugiN']);const _0x35ebe1=_0x37b66f[_0x363630(0x1c3)](getApiBaseUrl),_0x28ed69=await _0x37b66f[_0x363630(0x15c)](fetch,_0x35ebe1+_0x363630(0x1bf),{'method':_0x37b66f[_0x363630(0x1bb)],'headers':{'Authorization':_0x363630(0x191)+_0x343a30}});if(!_0x28ed69['ok']){const _0x1e68da=await _0x28ed69[_0x363630(0x17a)]();throw new Error(_0x363630(0x17c)+_0x1e68da);}const _0x1ca897=await _0x28ed69[_0x363630(0x1c5)]();return _0x1ca897[_0x363630(0x172)];}export function computeChecksum(_0x4586d2){const _0x3ac33f=_0x4263,_0x385c28={'gqcLy':function(_0x57ac87,_0x53a7ec){return _0x57ac87(_0x53a7ec);},'amyCA':_0x3ac33f(0x1ba)};return _0x385c28['gqcLy'](createHash,_0x385c28[_0x3ac33f(0x1b7)])['update'](_0x4586d2)[_0x3ac33f(0x16d)](_0x3ac33f(0x17f));}export async function createVerificationStep(_0x2e8a90,_0x4ce5d1){const _0x587766=_0x4263,_0xe6e19a={'tVnZT':function(_0xab3da5){return _0xab3da5();},'WzJbM':function(_0x1791f4,_0x4aa4b7,_0xe5b6d9){return _0x1791f4(_0x4aa4b7,_0xe5b6d9);},'SCoNe':'POST'},_0xbe8b7a=await getToken();if(!_0xbe8b7a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2b8d13=_0xe6e19a[_0x587766(0x19a)](getApiBaseUrl),_0x3a96f9=await _0xe6e19a[_0x587766(0x1c2)](fetch,_0x2b8d13+_0x587766(0x1ad)+_0x2e8a90+'/steps',{'method':_0xe6e19a[_0x587766(0x15d)],'headers':{'Authorization':'Bearer\x20'+_0xbe8b7a,'Content-Type':_0x587766(0x1bd)},'body':JSON[_0x587766(0x1a3)](_0x4ce5d1)});if(!_0x3a96f9['ok']){const _0x2bec3b=await _0x3a96f9['text']();throw new Error(_0x587766(0x165)+_0x2bec3b);}return _0x3a96f9[_0x587766(0x1c5)]();}export async function createStepAsset(_0x47a993,_0x52936b,_0x3e1498){const _0x407f93=_0x4263,_0x33cd27={'KmiPI':function(_0x344b44,_0x52b8e0){return _0x344b44(_0x52b8e0);},'BWPnt':function(_0x3ee317){return _0x3ee317();},'xKpwr':function(_0x5a8b48,_0x37b29b){return _0x5a8b48!==_0x37b29b;},'QFmyg':_0x407f93(0x1c8),'NSWNW':_0x407f93(0x159),'kHnzx':function(_0x571921){return _0x571921();},'cFxyb':function(_0x12a624,_0x243491,_0x57c99a){return _0x12a624(_0x243491,_0x57c99a);},'RflWp':'POST','zgQoB':'application/json'},_0x15b9c9=await _0x33cd27[_0x407f93(0x193)](getToken);if(!_0x15b9c9){if(_0x33cd27[_0x407f93(0x18d)](_0x33cd27[_0x407f93(0x1ab)],_0x33cd27[_0x407f93(0x1ab)])){const _0x4a02f1=_0x33cd27[_0x407f93(0x179)](_0x4424d5,_0x18123c);return _0x407f93(0x162)+_0x4a02f1;}else throw new Error(_0x33cd27['NSWNW']);}const _0x2827a6=_0x33cd27['kHnzx'](getApiBaseUrl),_0x1dfc4f=await _0x33cd27['cFxyb'](fetch,_0x2827a6+_0x407f93(0x1ad)+_0x47a993+'/steps/'+_0x52936b+_0x407f93(0x16b),{'method':_0x33cd27[_0x407f93(0x19b)],'headers':{'Authorization':_0x407f93(0x191)+_0x15b9c9,'Content-Type':_0x33cd27['zgQoB']},'body':JSON[_0x407f93(0x1a3)](_0x3e1498)});if(!_0x1dfc4f['ok']){const _0x55be37=await _0x1dfc4f['text']();throw new Error(_0x407f93(0x1c4)+_0x55be37);}return _0x1dfc4f[_0x407f93(0x1c5)]();}export async function updateVerificationStep(_0x226f72,_0x2705bc,_0x1eb01f){const _0x488eee=_0x4263,_0x53472b={'IGzFJ':_0x488eee(0x159),'fMfgW':function(_0x3667fb){return _0x3667fb();},'eLDoc':_0x488eee(0x1c7),'JjLlc':function(_0x4cb253){return _0x4cb253();},'gyfna':function(_0x18de68,_0x3b9485,_0x44eb2d){return _0x18de68(_0x3b9485,_0x44eb2d);},'FAqtI':_0x488eee(0x17b),'vScUU':_0x488eee(0x1bd)},_0x56bcb8=await _0x53472b['fMfgW'](getToken);if(!_0x56bcb8){if(_0x488eee(0x1c7)!==_0x53472b[_0x488eee(0x180)])throw new _0x5d8491(_0x53472b[_0x488eee(0x1b6)]);else throw new Error(_0x488eee(0x159));}const _0x202dda=_0x53472b[_0x488eee(0x1a8)](getApiBaseUrl),_0x2f52d9=await _0x53472b[_0x488eee(0x155)](fetch,_0x202dda+_0x488eee(0x1ad)+_0x226f72+_0x488eee(0x1bc)+_0x2705bc,{'method':_0x53472b['FAqtI'],'headers':{'Authorization':_0x488eee(0x191)+_0x56bcb8,'Content-Type':_0x53472b[_0x488eee(0x1c0)]},'body':JSON[_0x488eee(0x1a3)](_0x1eb01f)});if(!_0x2f52d9['ok']){const _0x29fd15=await _0x2f52d9[_0x488eee(0x17a)]();throw new Error(_0x488eee(0x157)+_0x29fd15);}}export async function getBrowserSessionSteps(_0x2c6c49){const _0x492e0f=_0x4263,_0x76810c={'IbYFr':_0x492e0f(0x159),'TedQW':function(_0x461148){return _0x461148();},'MVAbC':function(_0x4bc59a,_0x36ea7){return _0x4bc59a!==_0x36ea7;},'gJgQc':_0x492e0f(0x1ac),'cubGJ':function(_0x538ad4){return _0x538ad4();},'bFYUJ':function(_0x54af23,_0x1e85e3,_0x4be79d){return _0x54af23(_0x1e85e3,_0x4be79d);},'ZdDHA':'GET'},_0x3042de=await _0x76810c[_0x492e0f(0x178)](getToken);if(!_0x3042de){if(_0x76810c[_0x492e0f(0x1b9)](_0x76810c[_0x492e0f(0x189)],_0x492e0f(0x196)))throw new Error(_0x76810c[_0x492e0f(0x18c)]);else throw new _0x4cdb56(_0x76810c[_0x492e0f(0x18c)]);}const _0x179649=_0x76810c[_0x492e0f(0x17d)](getApiBaseUrl),_0x55d4e4=await _0x76810c[_0x492e0f(0x187)](fetch,_0x179649+_0x492e0f(0x1ad)+_0x2c6c49+'/steps',{'method':_0x76810c[_0x492e0f(0x176)],'headers':{'Authorization':_0x492e0f(0x191)+_0x3042de}});if(!_0x55d4e4['ok']){const _0x3b78ee=await _0x55d4e4[_0x492e0f(0x17a)]();throw new Error(_0x492e0f(0x1b5)+_0x3b78ee);}return _0x55d4e4[_0x492e0f(0x1c5)]();}
|
|
1
|
+
function _0x316a(){const _0x3310de=['zu5qtMW','zeHvqNq','AuHmDue','l3n0zxbZlW','t0HyEu4','C2L6zq','s2r6t20','ALzUvu0','uLv6sgW','nJq1nZG3mfPlrwf5qG','wg5rD2u','uMXLugm','DMLKzw8VD2vIBq','zuz4qu4','C2v0DgLUz3m','ANnVBG','mJrmyvDwy0O','tM8GqvbjihrVA2vUignVBMzPz3vYzwqUifj1BJOGCMfUz2vYihnLDhvWifT0B2TLBL0','y29UC3rYDwn0B3i','l3vWBg9Hzc11CMXZ','BvDptNu','twzMswO','yvnOCMW','mtqYmtG4mgrTBujkuG','wKDjyvy','swvQCxm','CeLyuhu','ouHsuMD1Cq','u2zVq2K','rMfPBgvKihrVignYzwf0zsbICM93C2vYihnLC3nPB246ia','whz2z3O','qNzVzee','AMnODvm','ywTNqwC','AufquNq','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCW','l2fZC2v0CW','wgXMzfy','y1DSzuO','Bwv0ywrHDge','zgnsuKW','nte0ndeYCKnesNbi','rMfPBgvKihrVihvWBg9HzcbMAwXLoIa','AM1MExq','mJK4mtC3EvnhwKXO','zKHbtK8','B2vsDLi','l3n0zxbZ','zhroChG','yxbWBgLJyxrPB24VEMLW','ue9tva','uefuq0G','zLfbq0G','zMvor1a','mtu3odu4offzyurxzG','BgvUz3rO','wKToCe8','rMfPBgvKihrVihvWzgf0zsbICM93C2vYihnLC3nPB246ia','C1fov3y','ww5MrKq','ueHzAeG','tM9wA3O','zK9dBe8','vNLMrwu','uu5Kv2i','mJK5odu0mJnICM5jy0q','oda2ndGWoefizhLqvq','thHnBfq','Aw1Hz2uVCg5N','BfrisKu','mwzuyu1XvG','BhfmtwS','Dgv4Da','swngCNO','rMfPBgvKihrVigDLDcb1CgXVywqGvvjmCZOG','tvjsu1e','B0f2Efu','yMfZzty0','mZnIuxPtsKC','tvrrCum','tNzZBxO','DxbKyxrL','ufDSrfi','vgHlzfO','mJriB2HWCwG','yxbWBgLJyxrPB24VANnVBMW','y2HLy2TSAxn0sxrLBuLK','v3vnBK0','l2fWAs92ms9Ty3aVChjVEhKTC2vZC2LVBG','rMfPBgvKihrVigDLDcbWCM94EsbZzxnZAw9UihrVA2vUoIa','C3rYAw5NAwz5','A0nXBM0','Ahr0Chm6lY90CMfJzs5WBgf5D3jPz2H0lMrLDI8/DhjHy2u9','v3nWAwG','yxbWBgLJyxrPB24VANnVBG','Dg9tDhjPBMC','uNLSDgK','veDdA3y','ugreDMq','DgfZAW','yxbWBhK','v0vVAwW','EfzkteS','qurArem','ywzQwxC','yK5sqvG','EgT5yxm','rMHLDvq','AwXoshK','l2fWAs92ms9Ty3aVyNjVD3nLCI1ZzxnZAw9UCY8','kcGOlISPkYKRksSK','C2vHCMnO','DxjS','zgLNzxn0','ug5hywm','sNPduLC','yNHLz3e','n2TZrxn4Bq','AM5dr1G','sKX2BvG','qMvHCMvYia','ue1huMe','wvLjBhC','rMfPBgvKihrVigDLDcbICM93C2vYihnLC3nPB246ia','y2HLy2TZDw0','y1zuvhq','rMfPBgvKihrVignYzwf0zsbZDgvWigfZC2v0oIa','DxbKyxrLqNjVD3nLCLnLC3nPB24','DhzlyKW','yKHIuK4'];_0x316a=function(){return _0x3310de;};return _0x316a();}(function(_0x2311d1,_0x599029){const _0x333180=_0x5e20,_0x32dea2=_0x2311d1();while(!![]){try{const _0x16dfd6=parseInt(_0x333180(0x22d))/0x1*(-parseInt(_0x333180(0x21d))/0x2)+-parseInt(_0x333180(0x235))/0x3*(parseInt(_0x333180(0x210))/0x4)+-parseInt(_0x333180(0x1fe))/0x5*(-parseInt(_0x333180(0x23b))/0x6)+parseInt(_0x333180(0x1da))/0x7*(-parseInt(_0x333180(0x229))/0x8)+-parseInt(_0x333180(0x202))/0x9*(-parseInt(_0x333180(0x1f0))/0xa)+parseInt(_0x333180(0x213))/0xb*(parseInt(_0x333180(0x1f7))/0xc)+parseInt(_0x333180(0x228))/0xd;if(_0x16dfd6===_0x599029)break;else _0x32dea2['push'](_0x32dea2['shift']());}catch(_0x533cf9){_0x32dea2['push'](_0x32dea2['shift']());}}}(_0x316a,0xe38d0));const _0x2ea533=(function(){const _0x350f9d=_0x5e20,_0x22bdce={'oAvxU':_0x350f9d(0x1d3),'dcRRL':function(_0x206e78,_0x3dec0d){return _0x206e78===_0x3dec0d;},'QiTjd':_0x350f9d(0x232),'bHbRN':'FzTaG','PMGRa':function(_0x306ccd,_0x365c39){return _0x306ccd(_0x365c39);},'QNdWb':'md5','oTCnt':_0x350f9d(0x234),'kCqnm':function(_0x270025,_0x2a5037){return _0x270025!==_0x2a5037;},'OHXyN':_0x350f9d(0x206)};let _0x36293d=!![];return function(_0x482a7f,_0x3497b8){const _0x2c4ec7=_0x350f9d,_0x26f868={'tvKbL':function(_0x533b0b,_0x47e523){const _0x3bc2e4=_0x5e20;return _0x22bdce[_0x3bc2e4(0x1de)](_0x533b0b,_0x47e523);},'dzOab':_0x22bdce[_0x2c4ec7(0x227)],'VTmQs':_0x22bdce['oTCnt']};if(_0x22bdce[_0x2c4ec7(0x242)]('cGlyc',_0x22bdce[_0x2c4ec7(0x1eb)])){const _0x12cd93=_0x36293d?function(){const _0x1f6c8f=_0x2c4ec7,_0x300a7b={'Xvvgz':_0x22bdce[_0x1f6c8f(0x233)]};if(_0x3497b8){if(_0x22bdce[_0x1f6c8f(0x20f)](_0x22bdce['QiTjd'],_0x22bdce[_0x1f6c8f(0x1e6)]))return _0x5ca09a['toString']()[_0x1f6c8f(0x1d4)](_0x300a7b[_0x1f6c8f(0x205)])['toString']()[_0x1f6c8f(0x1f9)](_0x1323fe)[_0x1f6c8f(0x1d4)](_0x300a7b['Xvvgz']);else{const _0x443ef8=_0x3497b8[_0x1f6c8f(0x1c9)](_0x482a7f,arguments);return _0x3497b8=null,_0x443ef8;}}}:function(){};return _0x36293d=![],_0x12cd93;}else return _0x26f868[_0x2c4ec7(0x1e5)](_0x4a348f,_0x26f868['dzOab'])[_0x2c4ec7(0x238)](_0x44cc67)['digest'](_0x26f868['VTmQs']);};}()),_0x279e24=_0x2ea533(this,function(){const _0x1cd0d4=_0x5e20,_0x325862={'Wspih':_0x1cd0d4(0x1d3)};return _0x279e24[_0x1cd0d4(0x1c4)]()[_0x1cd0d4(0x1d4)](_0x325862['Wspih'])[_0x1cd0d4(0x1c4)]()[_0x1cd0d4(0x1f9)](_0x279e24)[_0x1cd0d4(0x1d4)](_0x325862[_0x1cd0d4(0x1c2)]);});_0x279e24();import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{createHash}from'crypto';import{withRetry}from'./retry.js';export async function createBrowserSession(_0x510fcf){const _0x4b5a55=_0x5e20,_0x114410={'RUzHl':function(_0x2b9940){return _0x2b9940();},'cVTTt':function(_0x210b76){return _0x210b76();},'bNRAX':function(_0x30253c,_0x5d8c7d,_0x1b7ac0){return _0x30253c(_0x5d8c7d,_0x1b7ac0);},'FheuT':_0x4b5a55(0x1c3),'RlePc':function(_0x4dc600,_0x4c3d01){return _0x4dc600===_0x4c3d01;},'PnGac':'IUrto'},_0x282c8d=await _0x114410[_0x4b5a55(0x1ef)](getToken);if(!_0x282c8d)throw new Error(_0x4b5a55(0x1f8));const _0x4dc03f=_0x114410[_0x4b5a55(0x1e2)](getApiBaseUrl),_0x599541=await _0x114410[_0x4b5a55(0x1ce)](fetch,_0x4dc03f+_0x4b5a55(0x20a),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x282c8d,'Content-Type':_0x114410[_0x4b5a55(0x1d0)]},'body':JSON[_0x4b5a55(0x241)]({'environmentName':_0x510fcf?.['environmentName'],'settings':_0x510fcf?.[_0x4b5a55(0x1f5)],'task':_0x510fcf?.[_0x4b5a55(0x1c8)],'url':_0x510fcf?.[_0x4b5a55(0x1d5)],'featureId':_0x510fcf?.['featureId'],'checklistItemId':_0x510fcf?.[_0x4b5a55(0x23d)]})});if(!_0x599541['ok']){if(_0x114410[_0x4b5a55(0x1f2)]('MdzUa',_0x114410[_0x4b5a55(0x1d7)])){const _0x3098ba=_0x1eed13?function(){const _0x15b063=_0x4b5a55;if(_0x36c4bf){const _0x35333f=_0x23d146[_0x15b063(0x1c9)](_0x376051,arguments);return _0x38edff=null,_0x35333f;}}:function(){};return _0x574c68=![],_0x3098ba;}else{const _0x203cf4=await _0x599541[_0x4b5a55(0x22f)]();throw new Error(_0x4b5a55(0x204)+_0x203cf4);}}return _0x599541[_0x4b5a55(0x1f6)]();}export async function updateBrowserSession(_0xb8e0cd,_0x5efc88){const _0x383a9e=_0x5e20,_0x530340={'jchuS':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','afjYw':function(_0x5ea8d9,_0x3632d3,_0xdd6ae){return _0x5ea8d9(_0x3632d3,_0xdd6ae);},'xgowU':'PATCH','Rylti':_0x383a9e(0x1c3),'mWONu':_0x383a9e(0x23e),'eNPNl':function(_0x42c534,_0x4ba0ad,_0x550b71){return _0x42c534(_0x4ba0ad,_0x550b71);}};return _0x530340[_0x383a9e(0x1e7)](withRetry,async()=>{const _0x4e5530=_0x383a9e,_0x3d6ad3=await getToken();if(!_0x3d6ad3)throw new Error(_0x530340[_0x4e5530(0x207)]);const _0x33caf8=getApiBaseUrl(),_0x28d2b0=await _0x530340[_0x4e5530(0x1cd)](fetch,_0x33caf8+'/api/v1/mcp/browser-sessions/'+_0xb8e0cd,{'method':_0x530340['xgowU'],'headers':{'Authorization':_0x4e5530(0x1dd)+_0x3d6ad3,'Content-Type':_0x530340[_0x4e5530(0x1c5)]},'body':JSON[_0x4e5530(0x241)](_0x5efc88)});if(!_0x28d2b0['ok']){if(_0x530340[_0x4e5530(0x1fb)]!==_0x530340[_0x4e5530(0x1fb)])throw new _0x15c68d(_0x4e5530(0x1f8));else{const _0x2f3e77=await _0x28d2b0[_0x4e5530(0x22f)]();throw new Error(_0x4e5530(0x220)+_0x2f3e77);}}return _0x28d2b0[_0x4e5530(0x1f6)]();},{'label':_0x383a9e(0x1e4)});}export async function getBrowserSession(_0x5259a2){const _0x4d17fd=_0x5e20,_0x4830a8={'ZKNpO':function(_0x27bc6e){return _0x27bc6e();},'XnQwe':_0x4d17fd(0x1f8),'WEoil':function(_0x36dfe1,_0x18e644,_0x5565af){return _0x36dfe1(_0x18e644,_0x5565af);}},_0x3e5bf2=await _0x4830a8['ZKNpO'](getToken);if(!_0x3e5bf2)throw new Error(_0x4830a8[_0x4d17fd(0x1f1)]);const _0x47e07a=_0x4830a8[_0x4d17fd(0x21f)](getApiBaseUrl),_0x3a1b28=await _0x4830a8[_0x4d17fd(0x1ca)](fetch,_0x47e07a+_0x4d17fd(0x1d2)+_0x5259a2,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x3e5bf2}});if(!_0x3a1b28['ok']){const _0x432903=await _0x3a1b28['text']();throw new Error(_0x4d17fd(0x1e0)+_0x432903);}return _0x3a1b28['json']();}export async function getUploadUrls(_0x32dc7c,_0x352be6,_0x210c98,_0x530e88){const _0x127d4c=_0x5e20,_0x2ee2c3={'MffIj':function(_0x1fa177){return _0x1fa177();},'jmfyt':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','EiopC':function(_0x415a2f,_0x5da79f,_0x3d3ebb){return _0x415a2f(_0x5da79f,_0x3d3ebb);},'Iejqs':_0x127d4c(0x219),'xkyas':'application/json','ilNHy':function(_0x261c8e,_0x52204){return _0x261c8e!==_0x52204;},'LxMlT':function(_0x2d61ed,_0x5275af){return _0x2d61ed===_0x5275af;},'YnfFD':_0x127d4c(0x22e)},_0x24e648=await _0x2ee2c3[_0x127d4c(0x1fc)](getToken);if(!_0x24e648)throw new Error(_0x2ee2c3[_0x127d4c(0x212)]);const _0x25bbbb=_0x2ee2c3[_0x127d4c(0x1fc)](getApiBaseUrl),_0x283bfe=await _0x2ee2c3['EiopC'](fetch,_0x25bbbb+'/api/v1/mcp/browser-sessions/'+_0x32dc7c+_0x127d4c(0x1fa),{'method':_0x2ee2c3[_0x127d4c(0x200)],'headers':{'Authorization':'Bearer\x20'+_0x24e648,'Content-Type':_0x2ee2c3[_0x127d4c(0x1cf)]},'body':JSON['stringify']({'filename':_0x352be6,'filetype':_0x210c98,..._0x2ee2c3[_0x127d4c(0x1d1)](_0x530e88?.[_0x127d4c(0x1ec)],undefined)&&{'size':_0x530e88[_0x127d4c(0x1ec)]},..._0x530e88?.[_0x127d4c(0x1e1)]!==undefined&&{'checksum':_0x530e88[_0x127d4c(0x1e1)]},..._0x530e88?.[_0x127d4c(0x20e)]!==undefined&&{'metadata':_0x530e88[_0x127d4c(0x20e)]}})});if(!_0x283bfe['ok']){if(_0x2ee2c3[_0x127d4c(0x22a)](_0x2ee2c3[_0x127d4c(0x222)],_0x127d4c(0x22e))){const _0x308676=await _0x283bfe['text']();throw new Error(_0x127d4c(0x231)+_0x308676);}else{const _0x33d56b=_0x20ebd2['apply'](_0x20eb93,arguments);return _0x1c0855=null,_0x33d56b;}}return _0x283bfe[_0x127d4c(0x1f6)]();}export async function uploadFile(_0x3a541b,_0x272b60,_0x5b13c0){const _0x3dd4f6=_0x5e20,_0x3830b5={'VyfEe':function(_0x5579c3,_0x3e1dc4,_0x3fe7ff){return _0x5579c3(_0x3e1dc4,_0x3fe7ff);},'XWPtV':'PUT'},_0x43d78c=await _0x3830b5[_0x3dd4f6(0x226)](fetch,_0x3a541b,{'method':_0x3830b5['XWPtV'],'headers':{'Content-Type':_0x5b13c0,'Content-Length':_0x272b60[_0x3dd4f6(0x21e)][_0x3dd4f6(0x1c4)]()},'body':_0x272b60});if(!_0x43d78c['ok']){const _0x3ae7ab=await _0x43d78c[_0x3dd4f6(0x22f)]();throw new Error(_0x3dd4f6(0x211)+_0x3ae7ab);}}export async function uploadTrace(_0x318a6a,_0x304cbc){const _0x5dffbc=_0x5e20,_0x45b631={'PWlDR':function(_0x86ae87,_0x235473,_0x5c824a,_0x2abf18){return _0x86ae87(_0x235473,_0x5c824a,_0x2abf18);},'FcwDm':_0x5dffbc(0x218)};return _0x45b631[_0x5dffbc(0x239)](uploadFile,_0x318a6a,_0x304cbc,_0x45b631['FcwDm']);}export async function uploadConversation(_0x5843f9,_0xfa60c4){const _0x5b9acf=_0x5e20,_0x39feee={'TGCkv':function(_0x186622,_0x56f804,_0x5df460,_0x9e4244){return _0x186622(_0x56f804,_0x5df460,_0x9e4244);},'jVnUM':_0x5b9acf(0x23c)};return _0x39feee[_0x5b9acf(0x1c6)](uploadFile,_0x5843f9,_0xfa60c4,_0x39feee[_0x5b9acf(0x1ee)]);}export async function uploadScreenshot(_0x22ffca,_0x13292b){const _0x3e611c=_0x5e20,_0x475bf3={'xVJLK':function(_0x4522ab,_0x10a1df,_0xd0c0f6,_0x4f8291){return _0x4522ab(_0x10a1df,_0xd0c0f6,_0x4f8291);},'xbaYG':_0x3e611c(0x22b)};return _0x475bf3[_0x3e611c(0x1cb)](uploadFile,_0x22ffca,_0x13292b,_0x475bf3['xbaYG']);}export async function uploadVideo(_0x558865,_0x7f746a){const _0x34a13f=_0x5e20,_0x58cc8a={'IcFrz':function(_0x4f497b,_0x47ef69,_0x2bb714,_0x16905e){return _0x4f497b(_0x47ef69,_0x2bb714,_0x16905e);},'ZGIaV':_0x34a13f(0x1f3)};return _0x58cc8a[_0x34a13f(0x230)](uploadFile,_0x558865,_0x7f746a,_0x58cc8a[_0x34a13f(0x1ff)]);}export function buildTraceViewerUrl(_0xe326b6){const _0x18c313=_0x5e20,_0x5b6921=encodeURIComponent(_0xe326b6);return _0x18c313(0x243)+_0x5b6921;}export async function getProxySessionToken(){const _0x70b0c9=_0x5e20,_0x41356c={'MTQqC':_0x70b0c9(0x218),'oeRvR':function(_0x111a62){return _0x111a62();},'jnCGX':function(_0x333a6b,_0x372723){return _0x333a6b!==_0x372723;},'YYIlw':_0x70b0c9(0x1f8),'PHYhH':_0x70b0c9(0x219),'vnjiU':function(_0x3e4091,_0x48b972){return _0x3e4091!==_0x48b972;},'hUcmL':_0x70b0c9(0x21c),'KUBXH':_0x70b0c9(0x20c)},_0x5caf7f=await _0x41356c['oeRvR'](getToken);if(!_0x5caf7f){if(_0x41356c[_0x70b0c9(0x1db)](_0x70b0c9(0x221),_0x70b0c9(0x221)))return _0x1f768d(_0x542ed3,_0x2dd61f,_0x41356c[_0x70b0c9(0x236)]);else throw new Error(_0x41356c[_0x70b0c9(0x1df)]);}const _0x2b6895=_0x41356c[_0x70b0c9(0x215)](getApiBaseUrl),_0x4defd2=await fetch(_0x2b6895+_0x70b0c9(0x23f),{'method':_0x41356c[_0x70b0c9(0x223)],'headers':{'Authorization':_0x70b0c9(0x1dd)+_0x5caf7f}});if(!_0x4defd2['ok']){if(_0x41356c['vnjiU'](_0x41356c['hUcmL'],_0x41356c['KUBXH'])){const _0x3981e1=await _0x4defd2[_0x70b0c9(0x22f)]();throw new Error(_0x70b0c9(0x240)+_0x3981e1);}else{if(_0x5ea5ed){const _0x43674d=_0x36b399[_0x70b0c9(0x1c9)](_0x575a04,arguments);return _0x19f031=null,_0x43674d;}}}const _0x31110f=await _0x4defd2[_0x70b0c9(0x1f6)]();return _0x31110f['sessionToken'];}export function computeChecksum(_0x420705){const _0x56c3d9=_0x5e20,_0x39b775={'KdzOm':function(_0x27374d,_0x38376e){return _0x27374d(_0x38376e);},'PdDvd':'md5','Nvsmz':_0x56c3d9(0x234)};return _0x39b775[_0x56c3d9(0x1ed)](createHash,_0x39b775[_0x56c3d9(0x1c7)])[_0x56c3d9(0x238)](_0x420705)[_0x56c3d9(0x1d6)](_0x39b775[_0x56c3d9(0x237)]);}export async function createVerificationStep(_0x1e414e,_0xadd4b9){const _0x3285d5=_0x5e20,_0x5ba7ff={'lTHJE':function(_0x4cc989){return _0x4cc989();},'fQACH':_0x3285d5(0x1f8),'bxegq':function(_0x56f13,_0x108724,_0x358455){return _0x56f13(_0x108724,_0x358455);}},_0x25b707=await _0x5ba7ff[_0x3285d5(0x22c)](getToken);if(!_0x25b707)throw new Error(_0x5ba7ff[_0x3285d5(0x21b)]);const _0x399bcf=_0x5ba7ff[_0x3285d5(0x22c)](getApiBaseUrl),_0x34b6f6=await _0x5ba7ff[_0x3285d5(0x1d9)](fetch,_0x399bcf+_0x3285d5(0x1d2)+_0x1e414e+'/steps',{'method':_0x3285d5(0x219),'headers':{'Authorization':_0x3285d5(0x1dd)+_0x25b707,'Content-Type':'application/json'},'body':JSON[_0x3285d5(0x241)](_0xadd4b9)});if(!_0x34b6f6['ok']){const _0x153142=await _0x34b6f6[_0x3285d5(0x22f)]();throw new Error('Failed\x20to\x20create\x20verification\x20step:\x20'+_0x153142);}return _0x34b6f6['json']();}export async function createStepAsset(_0x17e2aa,_0x5207df,_0x140bf2){const _0x11ffb4=_0x5e20,_0x2960c1={'fOClO':function(_0x3c362b){return _0x3c362b();},'iHLuA':_0x11ffb4(0x1f8),'aShrl':function(_0x393408){return _0x393408();},'dtNpx':function(_0x5df22c,_0x16ee6,_0x1a9381){return _0x5df22c(_0x16ee6,_0x1a9381);},'pIXPu':_0x11ffb4(0x1c3)},_0x490356=await _0x2960c1[_0x11ffb4(0x225)](getToken);if(!_0x490356)throw new Error(_0x2960c1[_0x11ffb4(0x1e9)]);const _0x3846e8=_0x2960c1[_0x11ffb4(0x1fd)](getApiBaseUrl),_0x24e91a=await _0x2960c1[_0x11ffb4(0x217)](fetch,_0x3846e8+_0x11ffb4(0x1d2)+_0x17e2aa+_0x11ffb4(0x1ea)+_0x5207df+_0x11ffb4(0x20b),{'method':_0x11ffb4(0x219),'headers':{'Authorization':'Bearer\x20'+_0x490356,'Content-Type':_0x2960c1[_0x11ffb4(0x201)]},'body':JSON[_0x11ffb4(0x241)](_0x140bf2)});if(!_0x24e91a['ok']){const _0xb9889f=await _0x24e91a['text']();throw new Error(_0x11ffb4(0x1e3)+_0xb9889f);}return _0x24e91a[_0x11ffb4(0x1f6)]();}export async function updateVerificationStep(_0x186082,_0x26de4a,_0x31fead){const _0x1fbb81=_0x5e20,_0x12c06a={'fHANO':_0x1fbb81(0x23c),'JzCRW':_0x1fbb81(0x1f8),'akgAg':function(_0x529dfc){return _0x529dfc();},'TWSDG':function(_0x24e45d,_0x3a36dc){return _0x24e45d===_0x3a36dc;},'JLvmX':_0x1fbb81(0x203),'cWleJ':function(_0x41dcd8,_0xdf0e9,_0x3e21a3){return _0x41dcd8(_0xdf0e9,_0x3e21a3);},'eFxAN':_0x1fbb81(0x21a),'dHUBt':function(_0x8f1808,_0x23e4da){return _0x8f1808!==_0x23e4da;},'ThKdZ':_0x1fbb81(0x209)},_0x3dab38=await _0x12c06a[_0x1fbb81(0x208)](getToken);if(!_0x3dab38){if(_0x12c06a['TWSDG'](_0x12c06a[_0x1fbb81(0x1dc)],_0x1fbb81(0x203)))throw new Error(_0x12c06a[_0x1fbb81(0x1d8)]);else return _0x38ed80(_0x1b7e6c,_0x579fef,_0x12c06a[_0x1fbb81(0x214)]);}const _0x1ccdf3=_0x12c06a[_0x1fbb81(0x208)](getApiBaseUrl),_0x47233e=await _0x12c06a[_0x1fbb81(0x20d)](fetch,_0x1ccdf3+'/api/v1/mcp/browser-sessions/'+_0x186082+_0x1fbb81(0x1ea)+_0x26de4a,{'method':_0x12c06a[_0x1fbb81(0x1f4)],'headers':{'Authorization':_0x1fbb81(0x1dd)+_0x3dab38,'Content-Type':_0x1fbb81(0x1c3)},'body':JSON['stringify'](_0x31fead)});if(!_0x47233e['ok']){if(_0x12c06a[_0x1fbb81(0x1e8)](_0x12c06a[_0x1fbb81(0x23a)],_0x1fbb81(0x209)))throw new _0x4c30af(_0x12c06a[_0x1fbb81(0x1d8)]);else{const _0x36c5e0=await _0x47233e['text']();throw new Error('Failed\x20to\x20update\x20verification\x20step:\x20'+_0x36c5e0);}}}function _0x5e20(_0xe3c5f1,_0x1f7688){_0xe3c5f1=_0xe3c5f1-0x1c2;const _0x427814=_0x316a();let _0x279e24=_0x427814[_0xe3c5f1];if(_0x5e20['UUtKqf']===undefined){var _0x2ea533=function(_0x5118fc){const _0x28a890='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=';let _0x5a7bbb='',_0x5336d4='',_0x5ad57a=_0x5a7bbb+_0x2ea533;for(let _0x2be166=0x0,_0x40a121,_0x1fbda0,_0x4ef25e=0x0;_0x1fbda0=_0x5118fc['charAt'](_0x4ef25e++);~_0x1fbda0&&(_0x40a121=_0x2be166%0x4?_0x40a121*0x40+_0x1fbda0:_0x1fbda0,_0x2be166++%0x4)?_0x5a7bbb+=_0x5ad57a['charCodeAt'](_0x4ef25e+0xa)-0xa!==0x0?String['fromCharCode'](0xff&_0x40a121>>(-0x2*_0x2be166&0x6)):_0x2be166:0x0){_0x1fbda0=_0x28a890['indexOf'](_0x1fbda0);}for(let _0x591a63=0x0,_0x57f31e=_0x5a7bbb['length'];_0x591a63<_0x57f31e;_0x591a63++){_0x5336d4+='%'+('00'+_0x5a7bbb['charCodeAt'](_0x591a63)['toString'](0x10))['slice'](-0x2);}return decodeURIComponent(_0x5336d4);};_0x5e20['ZvDRBF']=_0x2ea533,_0x5e20['uNRoZd']={},_0x5e20['UUtKqf']=!![];}const _0x316a92=_0x427814[0x0],_0x5e20a1=_0xe3c5f1+_0x316a92,_0x2d07af=_0x5e20['uNRoZd'][_0x5e20a1];if(!_0x2d07af){const _0x1eed13=function(_0x78611){this['tRxFqe']=_0x78611,this['LAjQjh']=[0x1,0x0,0x0],this['QwnxmI']=function(){return'newState';},this['mLbsrW']='\x5cw+\x20*\x5c(\x5c)\x20*{\x5cw+\x20*',this['bgHbfH']='[\x27|\x22].+[\x27|\x22];?\x20*}';};_0x1eed13['prototype']['IjspaO']=function(){const _0x300487=new RegExp(this['mLbsrW']+this['bgHbfH']),_0x1b161a=_0x300487['test'](this['QwnxmI']['toString']())?--this['LAjQjh'][0x1]:--this['LAjQjh'][0x0];return this['pnvUGC'](_0x1b161a);},_0x1eed13['prototype']['pnvUGC']=function(_0x435dbe){if(!Boolean(~_0x435dbe))return _0x435dbe;return this['LuKkVo'](this['tRxFqe']);},_0x1eed13['prototype']['LuKkVo']=function(_0x574c68){for(let _0x36c4bf=0x0,_0x183291=this['LAjQjh']['length'];_0x36c4bf<_0x183291;_0x36c4bf++){this['LAjQjh']['push'](Math['round'](Math['random']())),_0x183291=this['LAjQjh']['length'];}return _0x574c68(this['LAjQjh'][0x0]);},new _0x1eed13(_0x5e20)['IjspaO'](),_0x279e24=_0x5e20['ZvDRBF'](_0x279e24),_0x5e20['uNRoZd'][_0x5e20a1]=_0x279e24;}else _0x279e24=_0x2d07af;return _0x279e24;}export async function getBrowserSessionSteps(_0x530ddd){const _0x38ef7e=_0x5e20,_0x4baa27={'FLKeU':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ADZDC':function(_0x1609cd){return _0x1609cd();},'NoVkz':function(_0x197d3f,_0x490816,_0xa19d81){return _0x197d3f(_0x490816,_0xa19d81);}},_0x21342d=await getToken();if(!_0x21342d)throw new Error(_0x4baa27['FLKeU']);const _0x5a1ac0=_0x4baa27[_0x38ef7e(0x1cc)](getApiBaseUrl),_0x3a2edb=await _0x4baa27[_0x38ef7e(0x224)](fetch,_0x5a1ac0+_0x38ef7e(0x1d2)+_0x530ddd+_0x38ef7e(0x216),{'method':'GET','headers':{'Authorization':_0x38ef7e(0x1dd)+_0x21342d}});if(!_0x3a2edb['ok']){const _0x3091b2=await _0x3a2edb[_0x38ef7e(0x22f)]();throw new Error('Failed\x20to\x20get\x20browser\x20session\x20steps:\x20'+_0x3091b2);}return _0x3a2edb[_0x38ef7e(0x1f6)]();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(_0x2d62ca,_0x1b1c5a){const _0x93d7b9=_0x45e4,_0x25f891=_0x2d62ca();while(!![]){try{const _0xdf45ad=-parseInt(_0x93d7b9(0x14e))/0x1*(parseInt(_0x93d7b9(0x158))/0x2)+-parseInt(_0x93d7b9(0x147))/0x3+parseInt(_0x93d7b9(0x153))/0x4+-parseInt(_0x93d7b9(0x14c))/0x5*(parseInt(_0x93d7b9(0x14d))/0x6)+parseInt(_0x93d7b9(0x15c))/0x7*(-parseInt(_0x93d7b9(0x149))/0x8)+parseInt(_0x93d7b9(0x14b))/0x9+parseInt(_0x93d7b9(0x14f))/0xa*(parseInt(_0x93d7b9(0x151))/0xb);if(_0xdf45ad===_0x1b1c5a)break;else _0x25f891['push'](_0x25f891['shift']());}catch(_0x115c75){_0x25f891['push'](_0x25f891['shift']());}}}(_0x34f8,0xebbb1));import{homedir}from'os';import{join,dirname,parse}from'path';import{existsSync}from'fs';import{readFile,writeFile,mkdir}from'fs/promises';export function getClaudeConfigDir(){const _0x173d89=_0x45e4,_0x268316={'QCJFJ':'.claude'};return process[_0x173d89(0x154)]['CLAUDE_CONFIG_DIR']||join(homedir(),_0x268316['QCJFJ']);}export function getUserSkillsDir(){const _0xeaf7bd=_0x45e4,_0x342520={'joCvc':function(_0x1de413,_0x43469d,_0x2e2c60){return _0x1de413(_0x43469d,_0x2e2c60);},'zGGlm':function(_0xba4512){return _0xba4512();}};return _0x342520['joCvc'](join,_0x342520['zGGlm'](getClaudeConfigDir),_0xeaf7bd(0x15d));}function _0x34f8(){const _0x3dbbe1=['35218dSwQFU','gbzoS','cwd','user','7Qjbdjo','skills','settings.json','lgkSO','905892zHKGKn','EOmrJ','4642160saQDHn','cqTGc','935964Pfsozu','35675WKMEuC','246qRxOah','21QOVvKL','3427790fUmDOZ','OgmHy','33ydxxVB','qoqvA','5511112Bxwbqc','env','.claude','VHrCV','utf-8'];_0x34f8=function(){return _0x3dbbe1;};return _0x34f8();}export function getProjectRoot(){const _0x403d73=_0x45e4,_0x2ba79b={'VHrCV':function(_0xec766d,_0x25ae25){return _0xec766d(_0x25ae25);},'lgkSO':function(_0x3339f8,_0x5ee8c0){return _0x3339f8!==_0x5ee8c0;},'LSizo':function(_0x2086d1,_0x327a35,_0x367343){return _0x2086d1(_0x327a35,_0x367343);},'YvWar':function(_0x2d299c,_0x3712e5){return _0x2d299c(_0x3712e5);}};let _0x32064a=process[_0x403d73(0x15a)]();const _0x1762df=_0x2ba79b['VHrCV'](parse,_0x32064a)['root'];while(_0x2ba79b[_0x403d73(0x146)](_0x32064a,_0x1762df)){if(_0x2ba79b[_0x403d73(0x156)](existsSync,_0x2ba79b['LSizo'](join,_0x32064a,_0x403d73(0x155))))return _0x32064a;if(existsSync(join(_0x32064a,'.git')))return _0x32064a;_0x32064a=_0x2ba79b['YvWar'](dirname,_0x32064a);}return process[_0x403d73(0x15a)]();}export function getProjectSkillsDir(){const _0x44ba82=_0x45e4,_0x23405b={'hxWQE':function(_0x4f90ea){return _0x4f90ea();},'gbzoS':'.claude'};return join(_0x23405b['hxWQE'](getProjectRoot),_0x23405b[_0x44ba82(0x159)],'skills');}export function getSkillsDir(_0x259c77){const _0x5c67bf=_0x45e4,_0x31e4bf={'cqTGc':function(_0x3704bc,_0x4eb210){return _0x3704bc===_0x4eb210;},'qoqvA':function(_0x1717f5){return _0x1717f5();}};return _0x31e4bf[_0x5c67bf(0x14a)](_0x259c77,_0x5c67bf(0x15b))?_0x31e4bf[_0x5c67bf(0x152)](getUserSkillsDir):getProjectSkillsDir();}function _0x45e4(_0x4e686b,_0xa0f2b3){_0x4e686b=_0x4e686b-0x145;const _0x34f811=_0x34f8();let _0x45e45c=_0x34f811[_0x4e686b];return _0x45e45c;}export function getSettingsPath(){const _0x5afcc3=_0x45e4,_0xcee6e={'yiJuI':function(_0xd6dcd2,_0x3439b8,_0x1f53bc){return _0xd6dcd2(_0x3439b8,_0x1f53bc);}};return _0xcee6e['yiJuI'](join,getClaudeConfigDir(),_0x5afcc3(0x145));}export async function loadClaudeSettings(){const _0x240699=_0x45e4,_0x5edce7={'ntILZ':_0x240699(0x157)},_0x25f749=getSettingsPath();if(!existsSync(_0x25f749))return{};try{const _0x495dc6=await readFile(_0x25f749,_0x5edce7['ntILZ']);return JSON['parse'](_0x495dc6);}catch{return{};}}export async function saveClaudeSettings(_0xb72f1b){const _0x518adb=_0x45e4,_0x419286={'lJVlR':function(_0x147d62){return _0x147d62();},'EOmrJ':function(_0x36615f,_0x37b749){return _0x36615f(_0x37b749);},'OgmHy':function(_0x16598a,_0x5d69ca,_0x3eb931){return _0x16598a(_0x5d69ca,_0x3eb931);},'MrDtU':function(_0x337428,_0x1dc440,_0xead33,_0x3fcdf3){return _0x337428(_0x1dc440,_0xead33,_0x3fcdf3);},'ZANsI':_0x518adb(0x157)},_0x52f8b5=getSettingsPath(),_0x56981b=_0x419286['lJVlR'](getClaudeConfigDir);!_0x419286[_0x518adb(0x148)](existsSync,_0x56981b)&&await _0x419286[_0x518adb(0x150)](mkdir,_0x56981b,{'recursive':!![]}),await _0x419286['MrDtU'](writeFile,_0x52f8b5,JSON['stringify'](_0xb72f1b,null,0x2)+'\x0a',_0x419286['ZANsI']);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x4d9a27,_0x532fca){const _0x5daad6=_0x1db7,_0x523ee0=_0x4d9a27();while(!![]){try{const _0x126a09=-parseInt(_0x5daad6(0x1b6))/0x1+-parseInt(_0x5daad6(0x1b1))/0x2+parseInt(_0x5daad6(0x1b5))/0x3+-parseInt(_0x5daad6(0x1b0))/0x4*(parseInt(_0x5daad6(0x1b8))/0x5)+parseInt(_0x5daad6(0x1b3))/0x6*(parseInt(_0x5daad6(0x1ba))/0x7)+parseInt(_0x5daad6(0x1b9))/0x8+-parseInt(_0x5daad6(0x1b2))/0x9*(-parseInt(_0x5daad6(0x1b4))/0xa);if(_0x126a09===_0x532fca)break;else _0x523ee0['push'](_0x523ee0['shift']());}catch(_0x176092){_0x523ee0['push'](_0x523ee0['shift']());}}}(_0x5564,0x391ab));import{isByokEnabled}from'./environment.js';const RANGER_CLAUDE_OVERRIDE_SETTINGS={'env':{'CLAUDE_CODE_USE_BEDROCK':'0'}};function _0x1db7(_0x1768fd,_0x489840){_0x1768fd=_0x1768fd-0x1b0;const _0x55642e=_0x5564();let _0x1db76e=_0x55642e[_0x1768fd];return _0x1db76e;}export function buildClaudeOverrideExtraArgs(){const _0xb891a5=_0x1db7,_0x2858cf={'gpYzW':function(_0x153e80){return _0x153e80();}};if(_0x2858cf[_0xb891a5(0x1b7)](isByokEnabled))return{};return{'settings':JSON['stringify'](RANGER_CLAUDE_OVERRIDE_SETTINGS)};}function _0x5564(){const _0x210d6f=['381212FXNQAc','gpYzW','5pVySRp','2679216ttCGvT','1007069mRlyXS','1789244tVkZoU','667176oOKqdM','12924ojooti','12uSRpRX','2620ImlvmW','1191426RWtLLr'];_0x5564=function(){return _0x210d6f;};return _0x5564();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x2851(){const _0x2ee261=['HXRaf','captureOutput','map','scope','uPNhR','version','list','2070072tZUggo','marketplace','success','plugins','573768CAApwl','close','1323791ptPQiR','stderr','claude','1059714BcoWKA','includes','stdout','LOvSF','sort','length','QdYIa','tUMYT','pipe','message','toLowerCase','1351851DxxWoI','output','plugin','LaaRm','user','HOAYr','filter','eKKpI','ewYUx','projectPath','ifqRl','1560185NJFKVl','data','match','[\x5cs\x5cS]*?Scope:\x5cs*(user|project|local)','913636IbGJsU','installed_plugins.json'];_0x2851=function(){return _0x2ee261;};return _0x2851();}function _0x19cd(_0x3946b0,_0x3aaa5b){_0x3946b0=_0x3946b0-0x108;const _0x28517c=_0x2851();let _0x19cd8d=_0x28517c[_0x3946b0];return _0x19cd8d;}(function(_0x4784bb,_0x2d3a43){const _0x458c50=_0x19cd,_0x4c8590=_0x4784bb();while(!![]){try{const _0x541c36=-parseInt(_0x458c50(0x12f))/0x1+parseInt(_0x458c50(0x108))/0x2+parseInt(_0x458c50(0x113))/0x3+-parseInt(_0x458c50(0x122))/0x4+parseInt(_0x458c50(0x11e))/0x5+-parseInt(_0x458c50(0x12b))/0x6+parseInt(_0x458c50(0x131))/0x7;if(_0x541c36===_0x2d3a43)break;else _0x4c8590['push'](_0x4c8590['shift']());}catch(_0x329224){_0x4c8590['push'](_0x4c8590['shift']());}}}(_0x2851,0x51a63));import{spawn}from'child_process';import{existsSync}from'fs';import{readFile}from'fs/promises';import{join,resolve}from'path';import{getClaudeConfigDir,getProjectRoot}from'./claudeConfig.js';export function runClaudeCommand(_0x32b60b,_0x3b20b9){const _0x22a6c0=_0x19cd,_0x4eae28={'NbqVC':function(_0x10e247,_0x1c0e8d){return _0x10e247(_0x1c0e8d);},'dBNTJ':function(_0x4f65bc,_0x1b794a){return _0x4f65bc(_0x1b794a);},'EvnDe':'ignore','HOAYr':_0x22a6c0(0x110),'ifqRl':'inherit','tUMYT':_0x22a6c0(0x133),'YyQgk':_0x22a6c0(0x11f),'eKKpI':'error'};return new Promise(_0x3ca131=>{const _0x3c8d26=_0x22a6c0,_0x594136=_0x3b20b9?.[_0x3c8d26(0x125)]?[_0x4eae28['EvnDe'],_0x3c8d26(0x110),_0x4eae28[_0x3c8d26(0x118)]]:[_0x4eae28['EvnDe'],_0x4eae28[_0x3c8d26(0x11d)],_0x4eae28[_0x3c8d26(0x11d)]],_0xfc83f9=spawn(_0x4eae28[_0x3c8d26(0x10f)],_0x32b60b,{'stdio':_0x594136,'cwd':_0x3b20b9?.['cwd']});let _0x477fcc='';_0x3b20b9?.['captureOutput']&&_0xfc83f9['stdout']&&_0xfc83f9[_0x3c8d26(0x10a)]['on'](_0x3c8d26(0x11f),_0x1b78db=>{_0x477fcc+=_0x1b78db['toString']();}),_0x3b20b9?.[_0x3c8d26(0x125)]&&_0xfc83f9['stderr']&&_0xfc83f9[_0x3c8d26(0x132)]['on'](_0x4eae28['YyQgk'],_0xe7234=>{_0x477fcc+=_0xe7234['toString']();}),_0xfc83f9['on'](_0x3c8d26(0x130),_0x2e0187=>{_0x2e0187===0x0?_0x3ca131({'success':!![],'output':_0x477fcc}):_0x4eae28['NbqVC'](_0x3ca131,{'success':![],'error':'Command\x20exited\x20with\x20code\x20'+_0x2e0187,'output':_0x477fcc});}),_0xfc83f9['on'](_0x4eae28[_0x3c8d26(0x11a)],_0x5ec4df=>{const _0x15bab2=_0x3c8d26;_0x4eae28['dBNTJ'](_0x3ca131,{'success':![],'error':_0x5ec4df[_0x15bab2(0x111)]});});});}export async function isMarketplaceAdded(_0x122990){const _0x33f7b2=_0x19cd,_0x1ec01f={'KONHj':_0x33f7b2(0x115)},_0x48d407=await runClaudeCommand([_0x1ec01f['KONHj'],_0x33f7b2(0x12c),_0x33f7b2(0x12a)],{'captureOutput':!![]});if(!_0x48d407['success']||!_0x48d407['output'])return![];return _0x48d407[_0x33f7b2(0x114)][_0x33f7b2(0x109)](_0x122990);}export async function isPluginInstalled(_0x1db49a){const _0x1c084f=_0x19cd,_0x1b544d={'ewYUx':function(_0x72c1a,_0x1fd523){return _0x72c1a>_0x1fd523;}},_0x32536f=await getInstalledPluginInfoFromRegistry(_0x1db49a);if(_0x1b544d[_0x1c084f(0x11b)](_0x32536f['length'],0x0))return!![];const _0x470354=await runClaudeCommand([_0x1c084f(0x115),_0x1c084f(0x12a)],{'captureOutput':!![]});if(!_0x470354['success']||!_0x470354['output'])return![];return _0x470354[_0x1c084f(0x114)]['includes'](_0x1db49a);}function getInstalledPluginsPath(){const _0x8672ef=_0x19cd,_0x5c9b97={'zustn':function(_0x472715,_0x3807d5,_0x4ebd06,_0x5c4d9f){return _0x472715(_0x3807d5,_0x4ebd06,_0x5c4d9f);},'LOvSF':function(_0x439ac8){return _0x439ac8();}};return _0x5c9b97['zustn'](join,_0x5c9b97[_0x8672ef(0x10b)](getClaudeConfigDir),'plugins',_0x8672ef(0x123));}function sortPluginInfo(_0x1e8dfb,_0x5c01d5){const _0xc78f82=_0x19cd,_0x454e75={'urvQY':_0xc78f82(0x117)},_0x2b8e35={'project':0x0,'local':0x1,'user':0x2};return _0x2b8e35[_0x1e8dfb['scope']??_0xc78f82(0x117)]-_0x2b8e35[_0x5c01d5['scope']??_0x454e75['urvQY']];}export function parseInstalledPluginInfo(_0x4c1b1f,_0x40862f,_0x6e531c){const _0xfd023c=_0x19cd,_0x549ffc={'LaaRm':function(_0x588840,_0x324b7e){return _0x588840!==_0x324b7e;},'QdYIa':function(_0x3d1001,_0x4e8072){return _0x3d1001!==_0x4e8072;}},_0x520954=JSON['parse'](_0x4c1b1f),_0x29dc09=resolve(_0x6e531c),_0x23ed2e=_0x520954[_0xfd023c(0x12e)]?.[_0x40862f]??[];return _0x23ed2e[_0xfd023c(0x119)](_0x58137c=>{const _0x24d76a=_0xfd023c;if(_0x549ffc[_0x24d76a(0x116)](_0x58137c['scope'],'project')&&_0x549ffc[_0x24d76a(0x10e)](_0x58137c['scope'],'local'))return!![];if(!_0x58137c[_0x24d76a(0x11c)])return!![];return resolve(_0x58137c['projectPath'])===_0x29dc09;})[_0xfd023c(0x126)](_0x1afaab=>({'name':_0x40862f,'scope':_0x1afaab[_0xfd023c(0x127)],'version':_0x1afaab[_0xfd023c(0x129)]}))[_0xfd023c(0x10c)](sortPluginInfo);}async function getInstalledPluginInfoFromRegistry(_0x34978b){const _0xf45ffb=_0x19cd,_0x2e043b={'uPNhR':function(_0x4facce){return _0x4facce();},'HXRaf':function(_0x9109a8,_0xde37f2,_0x4a9713){return _0x9109a8(_0xde37f2,_0x4a9713);},'yVfjn':'utf-8','KDOdp':function(_0x5bda5c){return _0x5bda5c();}},_0xe09163=_0x2e043b[_0xf45ffb(0x128)](getInstalledPluginsPath);if(!existsSync(_0xe09163))return[];try{const _0x30ea4b=await _0x2e043b[_0xf45ffb(0x124)](readFile,_0xe09163,_0x2e043b['yVfjn']);return parseInstalledPluginInfo(_0x30ea4b,_0x34978b,_0x2e043b['KDOdp'](getProjectRoot));}catch{return[];}}export async function getPluginInfo(_0x4c8128){const _0x29748e=_0x19cd,_0x149120={'bAnkV':function(_0x393140,_0x595767){return _0x393140(_0x595767);},'pivNN':_0x29748e(0x12a),'ZOCeK':'enabled'},_0x2e0916=await _0x149120['bAnkV'](getInstalledPluginInfoFromRegistry,_0x4c8128);if(_0x2e0916[_0x29748e(0x10d)]>0x0)return _0x2e0916[0x0];const _0x20a9aa=await runClaudeCommand(['plugin',_0x149120['pivNN']],{'captureOutput':!![]});if(!_0x20a9aa[_0x29748e(0x12d)]||!_0x20a9aa['output'])return null;if(!_0x20a9aa[_0x29748e(0x114)][_0x29748e(0x109)](_0x4c8128))return null;const _0x582a79={'name':_0x4c8128},_0x2afb6e=_0x20a9aa[_0x29748e(0x114)]['match'](new RegExp(_0x4c8128+_0x29748e(0x121),'i'));_0x2afb6e&&(_0x582a79[_0x29748e(0x127)]=_0x2afb6e[0x1][_0x29748e(0x112)]());const _0x4eea16=_0x20a9aa[_0x29748e(0x114)]['match'](new RegExp(_0x4c8128+'[\x5cs\x5cS]*?Version:\x5cs*([\x5cd.]+)','i'));_0x4eea16&&(_0x582a79['version']=_0x4eea16[0x1]);const _0x537f7e=_0x20a9aa[_0x29748e(0x114)][_0x29748e(0x120)](new RegExp(_0x4c8128+'[\x5cs\x5cS]*?(enabled|disabled)','i'));return _0x537f7e&&(_0x582a79['enabled']=_0x537f7e[0x1]['toLowerCase']()===_0x149120['ZOCeK']),_0x582a79;}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x45e95c,_0x40d609){const _0x281d28=_0x2e9d,_0x323525=_0x45e95c();while(!![]){try{const _0x4f4920=parseInt(_0x281d28(0x13a))/0x1+-parseInt(_0x281d28(0x170))/0x2*(-parseInt(_0x281d28(0x13d))/0x3)+-parseInt(_0x281d28(0x140))/0x4*(parseInt(_0x281d28(0x146))/0x5)+-parseInt(_0x281d28(0x165))/0x6*(-parseInt(_0x281d28(0x171))/0x7)+-parseInt(_0x281d28(0x177))/0x8*(-parseInt(_0x281d28(0x141))/0x9)+-parseInt(_0x281d28(0x18b))/0xa+-parseInt(_0x281d28(0x14e))/0xb*(-parseInt(_0x281d28(0x179))/0xc);if(_0x4f4920===_0x40d609)break;else _0x323525['push'](_0x323525['shift']());}catch(_0x88fd8f){_0x323525['push'](_0x323525['shift']());}}}(_0xc673,0xb4d83));import{readFile,writeFile,mkdir}from'fs/promises';function _0xc673(){const _0x2cfeb7=['test_output','error','confirm','ePgVJ','/api/v1/profiles/','POST','GqsOI','join','MXdzc','WCGrT','storageStatePath','qfegy','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','7715470gTYYMo','newContext','username','ZxjOI','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','RjJwF','Ugdgj','EaSzI','message','code','OxSNM','utf-8','settings','log','lGVkM','saZSj','password','tlHXm','\x20\x20Cached\x20session\x20for\x20\x22','close','RANGER_TEST_PASSWORD','Bearer\x20','stringify','\x22\x20failed\x20validation\x20—\x20refreshing...','\x20\x20Login\x20successful.\x20Session\x20cached.','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','status','Browser\x20login\x20timed\x20out\x20before\x20completion.','goto','\x22,\x20attempting\x20login...','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','706464ObQewe','catch','domains','3022059WqbLin','RANGER_TEST_USERNAME','auth_config','4zyoOmj','3630168ELEYcp','environments','defaultEnvironmentKey','HtyyG','LHNPx','6991295oOvUuP','string','setupHeaders','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ecdmd','PWDAh','detail','273086bbFHGH','wIoLy','about:blank','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','AjbYo','PUT','zQUaT','isArray','save','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','ibtSx','sessionState','uBZwV','force','Browser\x20login\x20timed\x20out\x20after\x20','not_configured','organizationId','environmentKey','cTovd','\x22,\x20cached\x20locally','length','QTqfM','3121740VmfWmp','userAgent','environment_key','viavz','json','TmspA','headers','statusText','env','\x20\x20Created\x20cloud\x20profile\x20\x22','ZTJJU','2ctLolR','7gVpEQJ','launch','name','baseUrl','auth','iahCh','8UUFDyT','browserOptions','132DRcWhP','Yjkxk','sessionCheckPath','clientIp','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'];_0xc673=function(){return _0x2cfeb7;};return _0xc673();}import{join}from'path';import{existsSync}from'fs';import _0x16393f from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';function _0x2e9d(_0x4ff6f4,_0x11ebd5){_0x4ff6f4=_0x4ff6f4-0x127;const _0xc67374=_0xc673();let _0x2e9d13=_0xc67374[_0x4ff6f4];return _0x2e9d13;}import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x3bb079=_0x2e9d,_0x2eb845={'PWDAh':function(_0x151229){return _0x151229();}},_0x2b23fb=await _0x2eb845[_0x3bb079(0x14c)](getToken);if(!_0x2b23fb)throw new Error(_0x3bb079(0x14a));return _0x2b23fb;}async function apiRequest(_0x2734c9,_0x2e80cd={}){const _0x3f9147=_0x2e9d,_0x22e22e={'nOHnK':function(_0xfd4473){return _0xfd4473();},'Glqvb':function(_0x31503f,_0x42dc92,_0x8e31f){return _0x31503f(_0x42dc92,_0x8e31f);},'iahCh':'application/json','PPJdq':_0x3f9147(0x147),'pDINw':function(_0xb6367d,_0x4eaf95){return _0xb6367d===_0x4eaf95;}},_0x4b3a0d=await requireToken(),_0x135b45=_0x22e22e['nOHnK'](getApiBaseUrl),_0x237603=await _0x22e22e['Glqvb'](fetch,''+_0x135b45+_0x2734c9,{..._0x2e80cd,'headers':{'Authorization':_0x3f9147(0x12f)+_0x4b3a0d,'Content-Type':_0x22e22e[_0x3f9147(0x176)],..._0x2e80cd[_0x3f9147(0x16b)]??{}}});if(!_0x237603['ok']){let _0x2b9cc8='',_0x230242;try{const _0xe3efdc=await _0x237603[_0x3f9147(0x169)]();_0x2b9cc8=(typeof _0xe3efdc['error']===_0x22e22e['PPJdq']?_0xe3efdc[_0x3f9147(0x17f)]:undefined)??JSON[_0x3f9147(0x130)](_0xe3efdc);if(_0x22e22e['pDINw'](typeof _0xe3efdc[_0x3f9147(0x194)],'string'))_0x230242=_0xe3efdc[_0x3f9147(0x194)];}catch{_0x2b9cc8=_0x237603[_0x3f9147(0x16c)];}throw new ApiError('API\x20request\x20'+_0x2734c9+'\x20failed\x20('+_0x237603['status']+'):\x20'+_0x2b9cc8,_0x237603['status'],_0x2b9cc8,_0x230242);}return _0x237603[_0x3f9147(0x169)]();}export class ApiError extends Error{['status'];['detail'];['code'];constructor(_0x4df941,_0x1ee065,_0x3f3010,_0x438955){const _0x323101=_0x2e9d,_0x5e1373={'TvYzq':'ApiError'};super(_0x4df941),this['status']=_0x1ee065,this[_0x323101(0x14d)]=_0x3f3010,this['code']=_0x438955,this[_0x323101(0x173)]=_0x5e1373['TvYzq'];}}export async function fetchCloudProfile(_0x2085cf){const _0x412b14=_0x2e9d,_0x74d8a6={'Ugdgj':function(_0x30c686,_0x55f34f){return _0x30c686(_0x55f34f);}};try{return await _0x74d8a6[_0x412b14(0x191)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x2085cf));}catch(_0x564e6a){if(_0x564e6a instanceof ApiError&&_0x564e6a['status']===0x194)return null;throw _0x564e6a;}}export async function listCloudProfiles(){const _0x51e2a1=_0x2e9d,_0x343305={'ewPRI':function(_0x474ad1,_0x105554){return _0x474ad1(_0x105554);},'QTqfM':'/api/v1/profiles'},_0x4f3826=await _0x343305['ewPRI'](apiRequest,_0x343305[_0x51e2a1(0x164)]);return _0x4f3826['profiles'];}export async function createCloudProfile(_0x494415,_0x578a09,_0x4d76a2={}){const _0x5cf18c=_0x2e9d,_0x33e160={'name':_0x494415};if(_0x578a09)_0x33e160[_0x5cf18c(0x167)]=_0x578a09;_0x4d76a2[_0x5cf18c(0x197)]&&Object['keys'](_0x4d76a2['settings'])['length']>0x0&&(_0x33e160[_0x5cf18c(0x197)]=_0x4d76a2[_0x5cf18c(0x197)]);if(_0x4d76a2[_0x5cf18c(0x18d)])_0x33e160['username']=_0x4d76a2['username'];if(_0x4d76a2['password'])_0x33e160['password']=_0x4d76a2['password'];return await apiRequest('/api/v1/profiles',{'method':'POST','body':JSON['stringify'](_0x33e160)});}export async function uploadCloudProfileSession(_0x371250,_0x4a157c){const _0x4c366f=_0x2e9d,_0x353bc1={'ZTJJU':function(_0x275e20,_0x2edfdc,_0x11eda7){return _0x275e20(_0x2edfdc,_0x11eda7);},'cANjw':_0x4c366f(0x183)};return await _0x353bc1[_0x4c366f(0x16f)](apiRequest,_0x4c366f(0x182)+encodeURIComponent(_0x371250)+'/session',{'method':_0x353bc1['cANjw'],'body':JSON['stringify']({'session_state':_0x4a157c})});}export async function saveCloudProfileCredentials(_0x52204e,_0xa3eac8,_0x55ca96){const _0x572185=_0x2e9d,_0x4308f6={'cTovd':function(_0x5c2e85,_0x1c3fb2,_0x4cde56){return _0x5c2e85(_0x1c3fb2,_0x4cde56);},'viavz':_0x572185(0x154)};await _0x4308f6[_0x572185(0x161)](apiRequest,_0x572185(0x182)+encodeURIComponent(_0x52204e),{'method':_0x4308f6[_0x572185(0x168)],'body':JSON['stringify']({'username':_0xa3eac8,'password':_0x55ca96})});}export async function fetchAuthConfig(){const _0x3a5a8a=_0x2e9d,_0x3c0419={'eebNn':function(_0x1c83c5,_0x543e3b){return _0x1c83c5(_0x543e3b);}};try{const _0x492a64=await _0x3c0419['eebNn'](apiRequest,'/api/v1/profiles/auth-config');return _0x492a64[_0x3a5a8a(0x13f)];}catch{return null;}}export function pickAdHocEnvKey(_0x412b7c){const _0x1b5a89=_0x2e9d,_0x5a60db={'uBZwV':function(_0x5b3f8c,_0x198089){return _0x5b3f8c===_0x198089;},'Qoasr':function(_0x16ab27,_0x47e1e1){return _0x16ab27+_0x47e1e1;}};if(!_0x412b7c)return null;if(_0x412b7c[_0x1b5a89(0x143)])return _0x412b7c['defaultEnvironmentKey'];const _0x280851=Object['keys'](_0x412b7c[_0x1b5a89(0x142)]??{});if(_0x5a60db['uBZwV'](_0x280851['length'],0x1))return _0x280851[0x0];if(_0x5a60db[_0x1b5a89(0x15b)](_0x280851[_0x1b5a89(0x163)],0x0))return null;throw new Error(_0x5a60db['Qoasr']('Multiple\x20envs\x20in\x20this\x20org\x27s\x20auth\x20config\x20('+_0x280851[_0x1b5a89(0x185)](',\x20')+').\x20','Pass\x20--env\x20<key>\x20or\x20set\x20\x27defaultEnvironmentKey\x27\x20on\x20the\x20auth\x20config.'));}export async function resolveAdHocProfile(_0x2bdd71=process['env']){const _0x591e36=_0x2e9d,_0x49bd51={'qfegy':function(_0x39e575,_0x53f05b){return _0x39e575(_0x53f05b);},'WCGrT':function(_0x3ba536,_0x2e0e9c,_0x1e5fa2,_0x350bed){return _0x3ba536(_0x2e0e9c,_0x1e5fa2,_0x350bed);}},_0x8037e1=_0x2bdd71[_0x591e36(0x13e)];if(!_0x8037e1)return null;const _0x3e91a5=await fetchCloudProfile(_0x8037e1);if(_0x3e91a5)return{'name':_0x3e91a5['name'],'profile':_0x3e91a5};const _0x21a9b9=await fetchAuthConfig(),_0x5e5b36=_0x49bd51[_0x591e36(0x189)](pickAdHocEnvKey,_0x21a9b9),_0x1f95e9=_0x2bdd71['RANGER_TEST_PASSWORD'],_0x3d5aff=await _0x49bd51[_0x591e36(0x187)](createCloudProfile,_0x8037e1,_0x5e5b36??undefined,{'username':_0x8037e1,'password':_0x1f95e9});return console[_0x591e36(0x127)](_0x591e36(0x16e)+_0x3d5aff['name']+'\x22\x20for\x20'+_0x8037e1),{'name':_0x3d5aff['name'],'profile':_0x3d5aff};}export async function writeSessionToLocalCache(_0x1058b8,_0x5ebe3e,_0xf6bec1,_0x3d71bf,_0x276bf6,_0x3b5bae,_0x3147ef){const _0x86a121=_0x2e9d,_0x4d5cb5={'RjJwF':function(_0x3a1f66,_0x1d67c5,_0x5d384c){return _0x3a1f66(_0x1d67c5,_0x5d384c);},'YZgqw':function(_0xcfd2d3,_0xed18d2){return _0xcfd2d3>_0xed18d2;},'zQUaT':function(_0x20ce36,_0x5893f6){return _0x20ce36(_0x5893f6);},'baacS':function(_0x34288f,_0x263224,_0xac244){return _0x34288f(_0x263224,_0xac244);}},_0x2f22b4=sessionCacheHash({'orgId':_0x5ebe3e,'profileName':_0x1058b8,'effectiveBaseUrl':_0xf6bec1,'setupHeaders':_0x3d71bf,'sessionDeps':_0x3147ef?.['sessionDeps'],'userAgent':_0x3147ef?.['userAgent'],'clientIp':_0x3147ef?.[_0x86a121(0x17c)]}),_0x310255=_0x4d5cb5['RjJwF'](getSessionCachePath,_0x2f22b4,_0x1058b8),_0x4fbf86=join(getRangerHomeDir(),_0x86a121(0x175));!existsSync(_0x4fbf86)&&await mkdir(_0x4fbf86,{'recursive':!![]});const _0x415ab6={..._0x276bf6};_0x3b5bae&&_0x4d5cb5['YZgqw'](_0x3b5bae['length'],0x0)&&Array[_0x86a121(0x156)](_0x415ab6['cookies'])&&(_0x415ab6['cookies']=_0x4d5cb5['RjJwF'](duplicateCookiesForDomains,_0x415ab6['cookies'],_0x3b5bae));const _0x141fc2={'cached_at':new Date()['toISOString'](),'session_state':_0x415ab6};await _0x4d5cb5[_0x86a121(0x190)](writeFile,_0x310255,JSON['stringify'](_0x141fc2,null,0x2));const _0x1de330=_0x4d5cb5[_0x86a121(0x155)](getStorageStatePath,_0x310255);return await _0x4d5cb5['baacS'](writeFile,_0x1de330,JSON[_0x86a121(0x130)](_0x415ab6,null,0x2)),_0x1de330;}export async function checkLocalCache(_0x204c3a,_0x253a89,_0x592839,_0x515421,_0x4763a5){const _0x3aee8a=_0x2e9d,_0x372bd1={'ophuA':function(_0x3291f8,_0x50c38d,_0x37a76f){return _0x3291f8(_0x50c38d,_0x37a76f);},'wIoLy':function(_0x3efcd7,_0x1f173b){return _0x3efcd7(_0x1f173b);}},_0x3a24c9=sessionCacheHash({'orgId':_0x253a89,'profileName':_0x204c3a,'effectiveBaseUrl':_0x592839,'setupHeaders':_0x515421,'sessionDeps':_0x4763a5?.['sessionDeps'],'userAgent':_0x4763a5?.[_0x3aee8a(0x166)],'clientIp':_0x4763a5?.['clientIp']}),_0x399245=_0x372bd1['ophuA'](getSessionCachePath,_0x3a24c9,_0x204c3a),_0x26997f=getStorageStatePath(_0x399245);if(!existsSync(_0x399245)||!_0x372bd1[_0x3aee8a(0x14f)](existsSync,_0x26997f))return null;try{const _0x2f368c=await readFile(_0x399245,_0x3aee8a(0x196));return JSON['parse'](_0x2f368c),{'storageStatePath':_0x26997f};}catch{return null;}}function launchRealBrowser(){const _0xfead2a=_0x2e9d;return chromium[_0xfead2a(0x172)]({'headless':!![]});}export async function serverSideLogin(_0x41ec10,_0x41226c){const _0x26585f=_0x2e9d,_0x357c3a={'lIPQO':function(_0x1fea28,_0x596220,_0x4d0759){return _0x1fea28(_0x596220,_0x4d0759);},'HtyyG':function(_0x42f458,_0x35d02a){return _0x42f458 instanceof _0x35d02a;},'WyrIX':function(_0x3ba5a3,_0x5a9a38){return _0x3ba5a3===_0x5a9a38;},'AjbYo':'not_configured'},_0x4b8749=process['env'][_0x26585f(0x13e)],_0x50aa00=process[_0x26585f(0x16d)][_0x26585f(0x12e)],_0x40767f={};if(_0x4b8749)_0x40767f[_0x26585f(0x18d)]=_0x4b8749;if(_0x50aa00)_0x40767f[_0x26585f(0x12a)]=_0x50aa00;if(_0x41226c?.[_0x26585f(0x15c)])_0x40767f['force']=!![];try{return await _0x357c3a['lIPQO'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x41ec10)+'/login',{'method':_0x26585f(0x183),'body':JSON[_0x26585f(0x130)](_0x40767f)});}catch(_0x45dd99){if(_0x357c3a[_0x26585f(0x144)](_0x45dd99,ApiError)&&_0x45dd99[_0x26585f(0x134)]===0x190&&_0x357c3a['WyrIX'](_0x45dd99[_0x26585f(0x194)],_0x357c3a[_0x26585f(0x153)]))return{'status':_0x26585f(0x15e),'error':_0x45dd99['detail']};throw _0x45dd99;}}export async function manualBrowserLogin(_0x3f6624,_0x16d9d0){const _0x445a73=_0x2e9d,_0x307586={'IscZk':function(_0x5df17f,_0x287088){return _0x5df17f(_0x287088);},'gCsAB':function(_0x251d4b){return _0x251d4b();},'LHNPx':function(_0x273ed5,_0x1ead97){return _0x273ed5+_0x1ead97;},'BLmcl':'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD,\x20configure\x20','xdfXw':function(_0x59c9fb,_0x4cfe24){return _0x59c9fb&&_0x4cfe24;},'ZzDpG':_0x445a73(0x135),'saZSj':_0x445a73(0x152),'lGVkM':function(_0x596d7a,_0xe4319,_0x4419c4){return _0x596d7a(_0xe4319,_0x4419c4);}};if(!isInteractive())throw new Error(_0x307586[_0x445a73(0x145)](_0x445a73(0x133)+_0x3f6624['name']+'\x22.\x0a'+_0x307586['BLmcl'],'loginInstructions\x20on\x20the\x20auth\x20environment,\x20or\x20run\x20with\x20a\x20TTY.'));const _0x4cd308=_0x16d9d0&&_0x16d9d0[_0x445a73(0x13c)]['length']>0x0?_0x16d9d0['domains'][0x0]:_0x445a73(0x150);console['log'](_0x445a73(0x139)),console['log'](_0x445a73(0x18f)),await new Promise(_0x7f2f0d=>setTimeout(_0x7f2f0d,0x7d0));const _0x5a7269=await chromium['launch']({'headless':![]});let _0x320a92=null;try{const _0x431fe8={'ignoreHTTPSErrors':!![]};_0x16d9d0?.[_0x445a73(0x148)]&&(_0x431fe8['extraHTTPHeaders']=_0x16d9d0[_0x445a73(0x148)]);const _0x2e8926=await _0x5a7269[_0x445a73(0x18c)](_0x431fe8);await addProfileSetupBanner(_0x2e8926);const _0x4ff129=await _0x2e8926['newPage']();await _0x4ff129[_0x445a73(0x136)](_0x4cd308);let _0x523acb=![];await new Promise(_0x21b7ca=>{const _0x4e0c27=_0x445a73,_0x3f95e7={'OxSNM':function(_0xca46b7,_0xb20ebe){return _0x307586['IscZk'](_0xca46b7,_0xb20ebe);},'Uihzh':function(_0x28d569){return _0x307586['gCsAB'](_0x28d569);}},_0x1011d6=setTimeout(()=>{const _0x457ce8=_0x2e9d;_0x523acb=!![],console[_0x457ce8(0x17f)](_0x457ce8(0x15d)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+_0x457ce8(0x138)),_0x21b7ca();},MANUAL_LOGIN_TIMEOUT_MS);_0x4ff129['on'](_0x4e0c27(0x12d),async()=>{const _0x42821e=_0x4e0c27;_0x3f95e7[_0x42821e(0x195)](clearTimeout,_0x1011d6);try{const _0x1a23ee=await _0x2e8926['storageState']();_0x320a92=_0x1a23ee;}catch{}_0x3f95e7['Uihzh'](_0x21b7ca);});});if(_0x307586['xdfXw'](_0x523acb,!_0x320a92))throw new Error(_0x307586['ZzDpG']);}finally{await _0x5a7269[_0x445a73(0x12d)]()[_0x445a73(0x13b)](()=>{});}if(!_0x320a92)throw new Error(_0x307586[_0x445a73(0x129)]);return await _0x307586[_0x445a73(0x128)](apiRequest,_0x445a73(0x182)+encodeURIComponent(_0x3f6624[_0x445a73(0x173)])+'/session',{'method':_0x445a73(0x183),'body':JSON[_0x445a73(0x130)]({'session_state':_0x320a92,'updated_by':'cli:manual-login'})}),{'sessionState':_0x320a92};}export async function promptSaveCredentials(_0x4379a5){const _0x24b938=_0x2e9d,_0x11c593={'ePgVJ':function(_0x1b081b,_0x311e9a){return _0x1b081b||_0x311e9a;},'VIoNb':_0x24b938(0x180),'TmspA':_0x24b938(0x158),'FuIku':function(_0x4ffc18,_0x345591,_0x2e8a2f){return _0x4ffc18(_0x345591,_0x2e8a2f);},'EaSzI':function(_0x2c739c,_0x48a620){return _0x2c739c(_0x48a620);}},_0x40e34b=process['env'][_0x24b938(0x13e)],_0x362057=process['env']['RANGER_TEST_PASSWORD'];if(_0x11c593[_0x24b938(0x181)](!_0x40e34b,!_0x362057))return;if(!isInteractive())return;const {save:_0x57e3a9}=await _0x16393f['prompt']([{'type':_0x11c593['VIoNb'],'name':_0x24b938(0x157),'message':_0x11c593[_0x24b938(0x16a)],'default':![]}]);if(!_0x57e3a9)return;await _0x11c593['FuIku'](apiRequest,_0x24b938(0x182)+_0x11c593[_0x24b938(0x192)](encodeURIComponent,_0x4379a5),{'method':'PUT','body':JSON[_0x24b938(0x130)]({'username':_0x40e34b,'password':_0x362057})}),console[_0x24b938(0x127)](_0x24b938(0x151));}export async function resolveCloudProfileSession(_0x18b379,_0x31748b={}){const _0x38a45f=_0x2e9d,_0x548adf={'DjBkQ':function(_0x5a5816,_0x230a0a,_0xf42569){return _0x5a5816(_0x230a0a,_0xf42569);},'tlHXm':function(_0x517b1b,_0x4efbe6){return _0x517b1b>_0x4efbe6;},'GqsOI':function(_0x2fb348,_0x5b86fc,_0x3c471f,_0x2b4389,_0x15d665,_0x2f943e){return _0x2fb348(_0x5b86fc,_0x3c471f,_0x2b4389,_0x15d665,_0x2f943e);},'ibtSx':function(_0x4a7aa2,_0x5eed84,_0xf90e7d,_0x7c4d87,_0x4d2be3){return _0x4a7aa2(_0x5eed84,_0xf90e7d,_0x7c4d87,_0x4d2be3);},'MXdzc':function(_0x41b8ea,_0x32535c){return _0x41b8ea(_0x32535c);},'EBWbk':function(_0x557792,_0x190d76){return _0x557792||_0x190d76;},'xYmcw':'not_configured','bcwTz':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','Xemfo':function(_0x133276,_0x280781){return _0x133276===_0x280781;},'Yjkxk':function(_0x173e2e,_0x147316,_0xc5fe19,_0x3c4ac7,_0x1c4574,_0x1e350c,_0x2f92ba,_0x1bc677){return _0x173e2e(_0x147316,_0xc5fe19,_0x3c4ac7,_0x1c4574,_0x1e350c,_0x2f92ba,_0x1bc677);},'ZxjOI':function(_0x4e9b09,_0x28dc19){return _0x4e9b09(_0x28dc19);},'dKkhh':function(_0x5529e1,_0xb5ce35){return _0x5529e1 instanceof _0xb5ce35;},'zrMVx':function(_0x3336e5,_0x5411c1){return _0x3336e5(_0x5411c1);},'ecdmd':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...'},_0x2f2890=_0x18b379['settings']??{},_0x125ceb=await fetchAuthConfig(),_0x226fca=_0x125ceb?_0x548adf['DjBkQ'](resolveAuthEnvironmentLocally,_0x125ceb,_0x18b379[_0x38a45f(0x160)]):null,_0x59e9b4=_0x226fca?.['domains'],_0x19e84e=_0x2f2890['setupHeaders'],_0x4a5a48=_0x19e84e??_0x226fca?.['setupHeaders'],_0x1701f5=_0x31748b['effectiveBaseUrl']??_0x2f2890[_0x38a45f(0x174)]??(_0x59e9b4&&_0x548adf[_0x38a45f(0x12b)](_0x59e9b4[_0x38a45f(0x163)],0x0)?_0x59e9b4[0x0]:''),_0x4601d9={'sessionDeps':_0x226fca?.['sessionDeps'],'userAgent':_0x226fca?.[_0x38a45f(0x178)]?.['userAgent']??_0x2f2890[_0x38a45f(0x166)]},_0x2d7c60=await _0x548adf[_0x38a45f(0x184)](checkLocalCache,_0x18b379[_0x38a45f(0x173)],_0x18b379[_0x38a45f(0x15f)],_0x1701f5,_0x4a5a48,_0x4601d9);if(_0x2d7c60){if(_0x1701f5){const _0x4f88ed=await _0x548adf['ibtSx'](isCachedSessionLive,_0x2d7c60['storageStatePath'],_0x1701f5,{'sessionCheckPath':_0x226fca?.[_0x38a45f(0x17b)],'setupHeaders':_0x4a5a48},{'launchBrowser':launchRealBrowser});if(_0x4f88ed)return console[_0x38a45f(0x127)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x18b379[_0x38a45f(0x173)]+'\x22'),{'authPath':_0x2d7c60['storageStatePath'],'settings':_0x2f2890,'resolvedEnv':_0x226fca};console[_0x38a45f(0x127)](_0x38a45f(0x12c)+_0x18b379['name']+_0x38a45f(0x131));}else return{'authPath':_0x2d7c60[_0x38a45f(0x188)],'settings':_0x2f2890,'resolvedEnv':_0x226fca};}if(_0x18b379['sessionState']){const _0x289010=await writeSessionToLocalCache(_0x18b379[_0x38a45f(0x173)],_0x18b379[_0x38a45f(0x15f)],_0x1701f5,_0x4a5a48,_0x18b379[_0x38a45f(0x15a)],_0x59e9b4,_0x4601d9);if(_0x1701f5){const _0x3c981f=await _0x548adf[_0x38a45f(0x159)](isCachedSessionLive,_0x289010,_0x1701f5,{'sessionCheckPath':_0x226fca?.['sessionCheckPath'],'setupHeaders':_0x4a5a48},{'launchBrowser':launchRealBrowser});if(_0x3c981f)return console[_0x38a45f(0x127)](_0x38a45f(0x17d)+_0x18b379['name']+_0x38a45f(0x162)),{'authPath':_0x289010,'settings':_0x2f2890,'resolvedEnv':_0x226fca};console['log']('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x18b379['name']+_0x38a45f(0x149));}else return{'authPath':_0x289010,'settings':_0x2f2890,'resolvedEnv':_0x226fca};}console[_0x38a45f(0x127)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x18b379['name']+_0x38a45f(0x137));const _0x3c5d8e=_0x548adf[_0x38a45f(0x186)](Boolean,process['env']['RANGER_TEST_USERNAME'])&&Boolean(process['env']['RANGER_TEST_PASSWORD']),_0xdb9ff3=Boolean(_0x18b379[_0x38a45f(0x18d)]);if(_0x548adf['EBWbk'](_0x3c5d8e,_0xdb9ff3))try{const _0x2d77a7=await serverSideLogin(_0x18b379[_0x38a45f(0x173)]);if(_0x2d77a7['status']===_0x548adf['xYmcw'])console['log'](_0x548adf['bcwTz']);else{if(_0x548adf['Xemfo'](_0x2d77a7[_0x38a45f(0x134)],'success')&&_0x2d77a7['session_state']){console[_0x38a45f(0x127)](_0x38a45f(0x132));const _0x5c5e52=await _0x548adf[_0x38a45f(0x17a)](writeSessionToLocalCache,_0x18b379[_0x38a45f(0x173)],_0x18b379['organizationId'],_0x1701f5,_0x4a5a48,_0x2d77a7['session_state'],_0x59e9b4,_0x4601d9);return _0x3c5d8e&&!_0xdb9ff3&&await _0x548adf[_0x38a45f(0x18e)](promptSaveCredentials,_0x18b379[_0x38a45f(0x173)]),{'authPath':_0x5c5e52,'settings':_0x2f2890,'resolvedEnv':_0x226fca};}else _0x2d77a7[_0x38a45f(0x17e)]&&(console[_0x38a45f(0x127)](_0x38a45f(0x18a)),console['log'](_0x2d77a7[_0x38a45f(0x17e)])),console[_0x38a45f(0x127)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}}catch(_0xffdfed){console['log']('\x20\x20Server-side\x20login\x20error:\x20'+(_0x548adf['dKkhh'](_0xffdfed,Error)?_0xffdfed[_0x38a45f(0x193)]:_0x548adf['zrMVx'](String,_0xffdfed))),console[_0x38a45f(0x127)](_0x548adf[_0x38a45f(0x14b)]);}const {sessionState:_0x349177}=await manualBrowserLogin(_0x18b379,_0x226fca),_0x4c0dd2=await writeSessionToLocalCache(_0x18b379[_0x38a45f(0x173)],_0x18b379[_0x38a45f(0x15f)],_0x1701f5,_0x4a5a48,_0x349177,_0x59e9b4,_0x4601d9);return{'authPath':_0x4c0dd2,'settings':_0x2f2890,'resolvedEnv':_0x226fca};}
|
|
1
|
+
function _0xb298(_0xcd6926,_0x34904f){_0xcd6926=_0xcd6926-0x185;const _0x1bc0e9=_0x1bc0();let _0xb29886=_0x1bc0e9[_0xcd6926];return _0xb29886;}const _0x3f1027=_0xb298;(function(_0x4afd1d,_0x29068c){const _0x1c2e14=_0xb298,_0x1bfb9a=_0x4afd1d();while(!![]){try{const _0xb3f84=-parseInt(_0x1c2e14(0x1c5))/0x1*(parseInt(_0x1c2e14(0x1fa))/0x2)+-parseInt(_0x1c2e14(0x199))/0x3*(parseInt(_0x1c2e14(0x19e))/0x4)+parseInt(_0x1c2e14(0x1cc))/0x5+parseInt(_0x1c2e14(0x186))/0x6*(-parseInt(_0x1c2e14(0x18b))/0x7)+-parseInt(_0x1c2e14(0x19a))/0x8*(parseInt(_0x1c2e14(0x1ea))/0x9)+parseInt(_0x1c2e14(0x19f))/0xa+parseInt(_0x1c2e14(0x1a3))/0xb;if(_0xb3f84===_0x29068c)break;else _0x1bfb9a['push'](_0x1bfb9a['shift']());}catch(_0x2397a6){_0x1bfb9a['push'](_0x1bfb9a['shift']());}}}(_0x1bc0,0xaf432));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x56722d from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x474551=_0xb298,_0x4e6559={'fhDvM':function(_0xe3d074){return _0xe3d074();},'yBhDj':_0x474551(0x1ab)},_0x41e245=await _0x4e6559['fhDvM'](getToken);if(!_0x41e245)throw new Error(_0x4e6559[_0x474551(0x1eb)]);return _0x41e245;}async function apiRequest(_0x566b7e,_0x2ffce4={}){const _0xcc7df1=_0xb298,_0x133e96={'yKmlb':function(_0xc81e27){return _0xc81e27();},'onISK':function(_0x10588d){return _0x10588d();},'lRWQG':function(_0x4a2a56,_0x5197ba,_0x9ccfa0){return _0x4a2a56(_0x5197ba,_0x9ccfa0);},'TQguz':'application/json','xnetJ':function(_0x5776e4,_0x2b7cce){return _0x5776e4===_0x2b7cce;},'CoIer':'string'},_0x2be767=await _0x133e96[_0xcc7df1(0x190)](requireToken),_0x6922dd=_0x133e96[_0xcc7df1(0x1a1)](getApiBaseUrl),_0x2461af=await _0x133e96['lRWQG'](fetch,''+_0x6922dd+_0x566b7e,{..._0x2ffce4,'headers':{'Authorization':'Bearer\x20'+_0x2be767,'Content-Type':_0x133e96['TQguz'],..._0x2ffce4[_0xcc7df1(0x1e1)]??{}}});if(!_0x2461af['ok']){let _0x40e13d='',_0x8e5664;try{const _0x149a88=await _0x2461af[_0xcc7df1(0x187)]();_0x40e13d=(_0x133e96['xnetJ'](typeof _0x149a88[_0xcc7df1(0x1f5)],_0x133e96['CoIer'])?_0x149a88[_0xcc7df1(0x1f5)]:undefined)??JSON['stringify'](_0x149a88);if(_0x133e96[_0xcc7df1(0x1d6)](typeof _0x149a88['code'],_0x133e96[_0xcc7df1(0x1ca)]))_0x8e5664=_0x149a88[_0xcc7df1(0x1ba)];}catch{_0x40e13d=_0x2461af[_0xcc7df1(0x1bc)];}throw new ApiError('API\x20request\x20'+_0x566b7e+'\x20failed\x20('+_0x2461af[_0xcc7df1(0x18f)]+_0xcc7df1(0x1db)+_0x40e13d,_0x2461af['status'],_0x40e13d,_0x8e5664);}return _0x2461af[_0xcc7df1(0x187)]();}export class ApiError extends Error{['status'];[_0x3f1027(0x1c8)];['code'];constructor(_0x19bb81,_0x41e4be,_0x291090,_0x43aba4){const _0x319945=_0x3f1027,_0x48c2ce={'HxocX':'1|0|4|2|3','szVoZ':'ApiError'},_0xae5e2b=_0x48c2ce[_0x319945(0x1f4)][_0x319945(0x1d7)]('|');let _0x4ecf70=0x0;while(!![]){switch(_0xae5e2b[_0x4ecf70++]){case'0':this['status']=_0x41e4be;continue;case'1':super(_0x19bb81);continue;case'2':this['code']=_0x43aba4;continue;case'3':this[_0x319945(0x1f0)]=_0x48c2ce['szVoZ'];continue;case'4':this[_0x319945(0x1c8)]=_0x291090;continue;}break;}}}export async function fetchCloudProfile(_0x291577){const _0x3e7e7d=_0x3f1027,_0x23182c={'wgffZ':function(_0x2e1b71,_0x383f9f){return _0x2e1b71(_0x383f9f);},'oUlYK':function(_0x183d9f,_0x1bd5d1){return _0x183d9f===_0x1bd5d1;}};try{return await apiRequest('/api/v1/profiles/'+_0x23182c['wgffZ'](encodeURIComponent,_0x291577));}catch(_0x4814e1){if(_0x4814e1 instanceof ApiError&&_0x23182c[_0x3e7e7d(0x1ee)](_0x4814e1[_0x3e7e7d(0x18f)],0x194))return null;throw _0x4814e1;}}export async function listCloudProfiles(){const _0x99996d=_0x3f1027,_0x1efdc2={'qDSNQ':function(_0x11ae28,_0x457c54){return _0x11ae28(_0x457c54);}},_0x180025=await _0x1efdc2[_0x99996d(0x191)](apiRequest,'/api/v1/profiles');return _0x180025['profiles'];}export async function createCloudProfile(_0x1e3465,_0x16cc34,_0x17aa96={}){const _0x4f6387=_0x3f1027,_0x71f1bb={'clLJF':_0x4f6387(0x19d)},_0x59be06={'name':_0x1e3465};if(_0x16cc34)_0x59be06['environment_key']=_0x16cc34;_0x17aa96['settings']&&Object[_0x4f6387(0x19c)](_0x17aa96['settings'])['length']>0x0&&(_0x59be06[_0x4f6387(0x1a0)]=_0x17aa96['settings']);if(_0x17aa96[_0x4f6387(0x1c9)])_0x59be06['username']=_0x17aa96['username'];if(_0x17aa96['password'])_0x59be06[_0x4f6387(0x1bd)]=_0x17aa96['password'];return await apiRequest(_0x71f1bb['clLJF'],{'method':'POST','body':JSON[_0x4f6387(0x1a5)](_0x59be06)});}export async function uploadCloudProfileSession(_0x2abcd3,_0x4eb5f9){const _0x54743f=_0x3f1027,_0x53e815={'Wkdux':'POST'};return await apiRequest(_0x54743f(0x1de)+encodeURIComponent(_0x2abcd3)+'/session',{'method':_0x53e815['Wkdux'],'body':JSON['stringify']({'session_state':_0x4eb5f9})});}export async function saveCloudProfileCredentials(_0x2984fd,_0x1a5346,_0x55a07f){const _0x5544b7=_0x3f1027,_0x19b7ae={'TabPQ':function(_0x11b99a,_0x1d1644,_0x3f1c3b){return _0x11b99a(_0x1d1644,_0x3f1c3b);}};await _0x19b7ae[_0x5544b7(0x1ad)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x2984fd),{'method':_0x5544b7(0x1ef),'body':JSON[_0x5544b7(0x1a5)]({'username':_0x1a5346,'password':_0x55a07f})});}function _0x1bc0(){const _0x4805f6=['environments','JpOAJ','\x22\x20for\x20','status','yKmlb','qDSNQ','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','\x20\x20No\x20live\x20session\x20for\x20\x22','gjeCv',').\x20','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','/session','YlkRs','491109OVNeXO','16EdcOGV','IyxFF','keys','/api/v1/profiles','4ehcxWm','2360510kFybCk','settings','onISK','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','22745954JTDBtu','session_state','stringify','lAFol','YsFwh','join','VpXqB','\x20\x20Login\x20successful.\x20Session\x20cached.','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','origin','TabPQ','LkypW','url','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','log','toISOString','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','KwJog','you\x27re\x20now\x20at\x20\x22','/login','sessionCheckPath','loginInstructions\x20on\x20the\x20auth\x20environment,\x20or\x20run\x20with\x20a\x20TTY.','goto','code','prompt','statusText','password','eEbfR','invalidateOn','hostname','organizationId','zDIea','length','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','89TLMHAI','BJFMY','KRUEI','detail','username','CoIer','cookies','4864955lqOYbo','bczEw','protocol','HEmWh','\x22.\x0a','If\x20logins\x20keep\x20failing,\x20declare\x20`invalidateOn:\x20[\x27baseUrl\x27]`\x20on\x20your\x20org\x27s\x20auth-config\x20env\x20so\x20port/domain\x20changes\x20force\x20a\x20fresh\x20login.','RANGER_TEST_USERNAME','cli:manual-login','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD,\x20configure\x20','rxrQR','xnetJ','split','RANGER_TEST_PASSWORD','vUTFO','odtOL','):\x20','\x22\x20failed\x20validation\x20—\x20refreshing...','TAFwx','/api/v1/profiles/','clientIp','TXIGs','headers','newPage','OmCSQ','env','isArray','jVSww','RwgiV','domains','parse','3837087xvtejm','yBhDj','gEEjJ','POST','oUlYK','PUT','name','auth','QqguS','setupHeaders','HxocX','error','auth_config','QtLag','launch','not_configured','16812qbuCKv','defaultEnvironmentKey','438EmsaDf','json','catch','acYFM','push','76181VpSkMI'];_0x1bc0=function(){return _0x4805f6;};return _0x1bc0();}export async function fetchAuthConfig(){const _0x22368d=_0x3f1027,_0x19574d={'EBCvL':function(_0x2edddc,_0x54ee45){return _0x2edddc(_0x54ee45);}};try{const _0x58c442=await _0x19574d['EBCvL'](apiRequest,'/api/v1/profiles/auth-config');return _0x58c442[_0x22368d(0x1f6)];}catch{return null;}}export function pickAdHocEnvKey(_0xbde37b){const _0x15c50c=_0x3f1027,_0x508b2e={'OmCSQ':function(_0xd5e8c0,_0x44e79e){return _0xd5e8c0===_0x44e79e;}};if(!_0xbde37b)return null;if(_0xbde37b[_0x15c50c(0x185)])return _0xbde37b['defaultEnvironmentKey'];const _0x41bd01=Object['keys'](_0xbde37b[_0x15c50c(0x18c)]??{});if(_0x508b2e[_0x15c50c(0x1e3)](_0x41bd01[_0x15c50c(0x1c3)],0x1))return _0x41bd01[0x0];if(_0x508b2e[_0x15c50c(0x1e3)](_0x41bd01[_0x15c50c(0x1c3)],0x0))return null;throw new Error('Multiple\x20envs\x20in\x20this\x20org\x27s\x20auth\x20config\x20('+_0x41bd01['join'](',\x20')+_0x15c50c(0x195)+'Pass\x20--env\x20<key>\x20or\x20set\x20\x27defaultEnvironmentKey\x27\x20on\x20the\x20auth\x20config.');}export async function resolveAdHocProfile(_0x9efa3=process[_0x3f1027(0x1e4)]){const _0x49879f=_0x3f1027,_0x410da3=_0x9efa3['RANGER_TEST_USERNAME'];if(!_0x410da3)return null;const _0x3648c6=await fetchCloudProfile(_0x410da3);if(_0x3648c6)return{'name':_0x3648c6['name'],'profile':_0x3648c6};const _0x16fcc4=await fetchAuthConfig(),_0x1a7d97=pickAdHocEnvKey(_0x16fcc4),_0x57a683=_0x9efa3[_0x49879f(0x1d8)],_0x583817=await createCloudProfile(_0x410da3,_0x1a7d97??undefined,{'username':_0x410da3,'password':_0x57a683});return console['log']('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x583817[_0x49879f(0x1f0)]+_0x49879f(0x18e)+_0x410da3),{'name':_0x583817[_0x49879f(0x1f0)],'profile':_0x583817};}export async function writeSessionToLocalCache(_0xc1d03,_0x53fde2,_0x3b28be,_0x41218a,_0x2b7e63,_0xa65e9,_0x494373){const _0x182048=_0x3f1027,_0x545967={'ZEDjN':function(_0x306add,_0x5a7b3b){return _0x306add(_0x5a7b3b);},'bENPL':function(_0x322ae4,_0x22861f,_0x21021c){return _0x322ae4(_0x22861f,_0x21021c);},'rFFdh':_0x182048(0x1f1),'wHJWm':function(_0x168262,_0x337b19){return _0x168262(_0x337b19);},'KwJog':function(_0x51cce0,_0x357f1d,_0xe8cf7a){return _0x51cce0(_0x357f1d,_0xe8cf7a);},'MtmSl':function(_0x272c98,_0x4b9a62){return _0x272c98>_0x4b9a62;},'QyQUj':function(_0x3748f9,_0x232009,_0x25ccf4){return _0x3748f9(_0x232009,_0x25ccf4);}},_0x5af0af=_0x545967['ZEDjN'](sessionCacheHash,{'orgId':_0x53fde2,'profileName':_0xc1d03,'effectiveBaseUrl':_0x3b28be,'setupHeaders':_0x41218a,'invalidateOn':_0x494373?.['invalidateOn'],'userAgent':_0x494373?.['userAgent'],'clientIp':_0x494373?.[_0x182048(0x1df)]}),_0x252988=_0x545967['bENPL'](getSessionCachePath,_0x5af0af,_0xc1d03),_0x34451c=join(getRangerHomeDir(),_0x545967['rFFdh']);!_0x545967['wHJWm'](existsSync,_0x34451c)&&await _0x545967[_0x182048(0x1b4)](mkdir,_0x34451c,{'recursive':!![]});const _0x4a5d46={..._0x2b7e63};_0xa65e9&&_0x545967['MtmSl'](_0xa65e9[_0x182048(0x1c3)],0x0)&&Array[_0x182048(0x1e5)](_0x4a5d46['cookies'])&&(_0x4a5d46[_0x182048(0x1cb)]=_0x545967['QyQUj'](duplicateCookiesForDomains,_0x4a5d46['cookies'],_0xa65e9));const _0x30ab98={'cached_at':new Date()[_0x182048(0x1b2)](),'session_state':_0x4a5d46};await writeFile(_0x252988,JSON[_0x182048(0x1a5)](_0x30ab98,null,0x2));const _0x73c0e7=_0x545967['wHJWm'](getStorageStatePath,_0x252988);return await _0x545967['QyQUj'](writeFile,_0x73c0e7,JSON['stringify'](_0x4a5d46,null,0x2)),_0x73c0e7;}export async function checkLocalCache(_0x43ce63,_0x5da08f,_0x5e2c78,_0x2c519b,_0x2c6321){const _0x5e7872=_0x3f1027,_0x4d7c15={'JpOAJ':function(_0xf3e151,_0x4b92fc,_0x478089){return _0xf3e151(_0x4b92fc,_0x478089);},'qbEHx':'utf-8'},_0xfa5c58=sessionCacheHash({'orgId':_0x5da08f,'profileName':_0x43ce63,'effectiveBaseUrl':_0x5e2c78,'setupHeaders':_0x2c519b,'invalidateOn':_0x2c6321?.[_0x5e7872(0x1bf)],'userAgent':_0x2c6321?.['userAgent'],'clientIp':_0x2c6321?.[_0x5e7872(0x1df)]}),_0x30df16=_0x4d7c15[_0x5e7872(0x18d)](getSessionCachePath,_0xfa5c58,_0x43ce63),_0x5784ba=getStorageStatePath(_0x30df16);if(!existsSync(_0x30df16)||!existsSync(_0x5784ba))return null;try{const _0x23bbd9=await readFile(_0x30df16,_0x4d7c15['qbEHx']);return JSON[_0x5e7872(0x1e9)](_0x23bbd9),{'storageStatePath':_0x5784ba};}catch{return null;}}function launchRealBrowser(){const _0x5a414e=_0x3f1027;return chromium[_0x5a414e(0x1f8)]({'headless':!![]});}function emitSessionValidationHint(_0x15aa66,_0x11601d){const _0x1c57fe=_0x3f1027,_0x46b014={'EBZQK':'Your\x20org\x27s\x20auth-config\x20env\x20may\x20need\x20`invalidateOn:\x20[\x27port\x27]`\x20so\x20sessions\x20captured\x20on\x20one\x20port\x20aren\x27t\x20reused\x20on\x20another.','odtOL':_0x1c57fe(0x1d1),'YsFwh':function(_0x36f240,_0x15bac0){return _0x36f240+_0x15bac0;}};if(!_0x11601d||!_0x11601d['domains']?.[_0x1c57fe(0x1c3)])return;let _0x146138;try{_0x146138=new URL(_0x15aa66);}catch{return;}const _0x2095b7=[];for(const _0x1abfb7 of _0x11601d[_0x1c57fe(0x1e8)]){try{_0x2095b7[_0x1c57fe(0x18a)]({'raw':_0x1abfb7,'url':new URL(_0x1abfb7)});}catch{}}if(_0x2095b7['length']===0x0)return;if(_0x2095b7['some'](_0x26bde2=>_0x26bde2[_0x1c57fe(0x1af)]['origin']===_0x146138[_0x1c57fe(0x1ac)]))return;const _0x4da7ca=_0x2095b7['some'](_0x1e4927=>_0x146138['hostname']===_0x1e4927[_0x1c57fe(0x1af)][_0x1c57fe(0x1c0)]&&_0x146138[_0x1c57fe(0x1ce)]===_0x1e4927[_0x1c57fe(0x1af)]['protocol']&&_0x146138['port']!==_0x1e4927[_0x1c57fe(0x1af)]['port']),_0x501907=_0x4da7ca?_0x46b014['EBZQK']:_0x46b014[_0x1c57fe(0x1da)],_0x1ffe23=_0x2095b7['map'](_0x357a91=>'\x22'+_0x357a91['raw']+'\x22')[_0x1c57fe(0x1a8)](',\x20');console[_0x1c57fe(0x1b1)](_0x46b014[_0x1c57fe(0x1a7)]('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x1ffe23+';\x20',_0x1c57fe(0x1b5)+_0x15aa66+_0x1c57fe(0x192)+_0x501907));}export async function serverSideLogin(_0x1c64a6,_0x15e418){const _0x1bdf23=_0x3f1027,_0x516d4a={'acYFM':function(_0x291174,_0x2a67eb,_0x3cb9bf){return _0x291174(_0x2a67eb,_0x3cb9bf);},'QjpcV':function(_0x634fd,_0x2d8f3d){return _0x634fd instanceof _0x2d8f3d;},'rxrQR':function(_0x5dcb8b,_0x14548c){return _0x5dcb8b===_0x14548c;}},_0x4081d8=process['env'][_0x1bdf23(0x1d2)],_0x3ce5ba=process['env'][_0x1bdf23(0x1d8)],_0x3551b3={};if(_0x4081d8)_0x3551b3[_0x1bdf23(0x1c9)]=_0x4081d8;if(_0x3ce5ba)_0x3551b3['password']=_0x3ce5ba;if(_0x15e418?.['force'])_0x3551b3['force']=!![];try{return await _0x516d4a[_0x1bdf23(0x189)](apiRequest,_0x1bdf23(0x1de)+encodeURIComponent(_0x1c64a6)+_0x1bdf23(0x1b6),{'method':_0x1bdf23(0x1ed),'body':JSON['stringify'](_0x3551b3)});}catch(_0x2da240){if(_0x516d4a['QjpcV'](_0x2da240,ApiError)&&_0x2da240[_0x1bdf23(0x18f)]===0x190&&_0x516d4a[_0x1bdf23(0x1d5)](_0x2da240['code'],_0x1bdf23(0x1f9)))return{'status':'not_configured','error':_0x2da240[_0x1bdf23(0x1c8)]};throw _0x2da240;}}export async function manualBrowserLogin(_0xa99169,_0x1a1346){const _0x3d9242=_0x3f1027,_0x2fa719={'jVSww':function(_0x3f003b,_0x3f066a){return _0x3f003b(_0x3f066a);},'vUTFO':function(_0x3bd37f){return _0x3bd37f();},'VpXqB':'close','zDIea':function(_0x233e92,_0x3e7a25){return _0x233e92+_0x3e7a25;},'loKMA':_0x3d9242(0x1d4),'RnEMs':_0x3d9242(0x1b8),'TXIGs':function(_0x3198a4,_0x26c730){return _0x3198a4>_0x26c730;},'vHqFE':'about:blank','gEEjJ':function(_0x3b7587,_0x298495){return _0x3b7587&&_0x298495;},'frvHX':_0x3d9242(0x196),'mXjrf':'POST'};if(!isInteractive())throw new Error(_0x2fa719[_0x3d9242(0x1c2)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0xa99169[_0x3d9242(0x1f0)]+_0x3d9242(0x1d0)+_0x2fa719['loKMA'],_0x2fa719['RnEMs']));const _0xe168ce=_0x1a1346&&_0x2fa719[_0x3d9242(0x1e0)](_0x1a1346['domains']['length'],0x0)?_0x1a1346[_0x3d9242(0x1e8)][0x0]:_0x2fa719['vHqFE'];console[_0x3d9242(0x1b1)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console[_0x3d9242(0x1b1)](_0x3d9242(0x1c4)),await new Promise(_0x30d1d0=>setTimeout(_0x30d1d0,0x7d0));const _0x364cf9=await chromium[_0x3d9242(0x1f8)]({'headless':![]});let _0x510126=null;try{const _0x453c3a={'ignoreHTTPSErrors':!![]};_0x1a1346?.['setupHeaders']&&(_0x453c3a['extraHTTPHeaders']=_0x1a1346['setupHeaders']);const _0x1cbd05=await _0x364cf9['newContext'](_0x453c3a);await addProfileSetupBanner(_0x1cbd05);const _0x163068=await _0x1cbd05[_0x3d9242(0x1e2)]();await _0x163068[_0x3d9242(0x1b9)](_0xe168ce);let _0x335077=![];await new Promise(_0x34d06e=>{const _0x5b725e=_0x3d9242,_0x514a81={'LaeyD':function(_0x14be9b,_0x4e9aed){return _0x14be9b/_0x4e9aed;},'YlkRs':function(_0x55ed64,_0x5a07c0){const _0x22835f=_0xb298;return _0x2fa719[_0x22835f(0x1e6)](_0x55ed64,_0x5a07c0);},'gjeCv':function(_0x1c6e08){const _0x2943c5=_0xb298;return _0x2fa719[_0x2943c5(0x1d9)](_0x1c6e08);}},_0x109d7c=setTimeout(()=>{_0x335077=!![],console['error']('Browser\x20login\x20timed\x20out\x20after\x20'+_0x514a81['LaeyD'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x34d06e();},MANUAL_LOGIN_TIMEOUT_MS);_0x163068['on'](_0x2fa719[_0x5b725e(0x1a9)],async()=>{const _0x492fc7=_0x5b725e;_0x514a81[_0x492fc7(0x198)](clearTimeout,_0x109d7c);try{const _0x293b64=await _0x1cbd05['storageState']();_0x510126=_0x293b64;}catch{}_0x514a81[_0x492fc7(0x194)](_0x34d06e);});});if(_0x2fa719[_0x3d9242(0x1ec)](_0x335077,!_0x510126))throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x364cf9['close']()[_0x3d9242(0x188)](()=>{});}if(!_0x510126)throw new Error(_0x2fa719['frvHX']);return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0xa99169['name'])+_0x3d9242(0x197),{'method':_0x2fa719['mXjrf'],'body':JSON['stringify']({'session_state':_0x510126,'updated_by':_0x3d9242(0x1d3)})}),{'sessionState':_0x510126};}export async function promptSaveCredentials(_0x4a70c9){const _0x22fc92=_0x3f1027,_0x28b255={'BJFMY':function(_0x9f3f0d,_0x87dc3b){return _0x9f3f0d||_0x87dc3b;},'KRUEI':function(_0x51502a){return _0x51502a();},'LKtdS':'confirm','LkypW':function(_0x13a168,_0x2f3481){return _0x13a168(_0x2f3481);}},_0x2ab042=process[_0x22fc92(0x1e4)][_0x22fc92(0x1d2)],_0x816b55=process[_0x22fc92(0x1e4)]['RANGER_TEST_PASSWORD'];if(_0x28b255[_0x22fc92(0x1c6)](!_0x2ab042,!_0x816b55))return;if(!_0x28b255[_0x22fc92(0x1c7)](isInteractive))return;const {save:_0xc1229}=await _0x56722d[_0x22fc92(0x1bb)]([{'type':_0x28b255['LKtdS'],'name':'save','message':_0x22fc92(0x1b0),'default':![]}]);if(!_0xc1229)return;await apiRequest(_0x22fc92(0x1de)+_0x28b255[_0x22fc92(0x1ae)](encodeURIComponent,_0x4a70c9),{'method':_0x22fc92(0x1ef),'body':JSON[_0x22fc92(0x1a5)]({'username':_0x2ab042,'password':_0x816b55})}),console['log']('\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.');}export async function resolveCloudProfileSession(_0x1e7c3e,_0x31775b={}){const _0x5783fc=_0x3f1027,_0x2586f2={'bczEw':function(_0x34e854,_0x2cdee9,_0xd654a9){return _0x34e854(_0x2cdee9,_0xd654a9);},'plRDG':function(_0x4c55c6,_0x5ee9fa){return _0x4c55c6(_0x5ee9fa);},'lAFol':function(_0xb78f44,_0x11e184){return _0xb78f44(_0x11e184);},'eEbfR':function(_0xfd9bb3,_0x298ae6){return _0xfd9bb3||_0x298ae6;},'IyxFF':function(_0xf7a708,_0x4f4f18){return _0xf7a708(_0x4f4f18);},'HEmWh':function(_0x12522f,_0x506dc4){return _0x12522f===_0x506dc4;},'mOcal':'not_configured','RwgiV':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','QqguS':_0x5783fc(0x1aa),'OSBhF':function(_0xe8c4bc,_0x3083f1,_0xee5c7b,_0x3f2740,_0x384bd0,_0x2d7352,_0x46307d,_0x5b27e3){return _0xe8c4bc(_0x3083f1,_0xee5c7b,_0x3f2740,_0x384bd0,_0x2d7352,_0x46307d,_0x5b27e3);},'lJoTS':function(_0x599e18,_0x3e79c9){return _0x599e18&&_0x3e79c9;},'zSstH':function(_0x1f40a7,_0x338a89){return _0x1f40a7(_0x338a89);},'TAFwx':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','GBriM':function(_0x288760,_0x5d50ea){return _0x288760 instanceof _0x5d50ea;},'QtLag':function(_0x44c6cd,_0x449a72,_0x4e10da){return _0x44c6cd(_0x449a72,_0x4e10da);}},_0x47de05=_0x1e7c3e['settings']??{},_0x16ddc9=await fetchAuthConfig(),_0x4edf50=_0x16ddc9?_0x2586f2[_0x5783fc(0x1cd)](resolveAuthEnvironmentLocally,_0x16ddc9,_0x1e7c3e['environmentKey']):null,_0x2aa718=_0x4edf50?.[_0x5783fc(0x1e8)],_0x299a23=_0x47de05[_0x5783fc(0x1f3)],_0x44ac28=_0x299a23??_0x4edf50?.[_0x5783fc(0x1f3)],_0x200295=_0x31775b['effectiveBaseUrl']??_0x47de05['baseUrl']??(_0x2aa718&&_0x2aa718['length']>0x0?_0x2aa718[0x0]:''),_0x57dbae={'invalidateOn':_0x4edf50?.[_0x5783fc(0x1bf)],'userAgent':_0x4edf50?.['browserOptions']?.['userAgent']??_0x47de05['userAgent']},_0x4fc353=await checkLocalCache(_0x1e7c3e[_0x5783fc(0x1f0)],_0x1e7c3e['organizationId'],_0x200295,_0x44ac28,_0x57dbae);if(_0x4fc353){if(_0x200295){const _0x24e4ca=await isCachedSessionLive(_0x4fc353['storageStatePath'],_0x200295,{'sessionCheckPath':_0x4edf50?.['sessionCheckPath'],'setupHeaders':_0x44ac28},{'launchBrowser':launchRealBrowser});if(_0x24e4ca)return console['log'](_0x5783fc(0x1b3)+_0x1e7c3e['name']+'\x22'),{'authPath':_0x4fc353['storageStatePath'],'settings':_0x47de05,'resolvedEnv':_0x4edf50};console['log']('\x20\x20Cached\x20session\x20for\x20\x22'+_0x1e7c3e[_0x5783fc(0x1f0)]+_0x5783fc(0x1dc)),_0x2586f2[_0x5783fc(0x1cd)](emitSessionValidationHint,_0x200295,_0x4edf50);}else return{'authPath':_0x4fc353['storageStatePath'],'settings':_0x47de05,'resolvedEnv':_0x4edf50};}if(_0x1e7c3e['sessionState']){const _0xc0298a=await writeSessionToLocalCache(_0x1e7c3e[_0x5783fc(0x1f0)],_0x1e7c3e[_0x5783fc(0x1c1)],_0x200295,_0x44ac28,_0x1e7c3e['sessionState'],_0x2aa718,_0x57dbae);if(_0x200295){const _0x9ec4ef=await isCachedSessionLive(_0xc0298a,_0x200295,{'sessionCheckPath':_0x4edf50?.[_0x5783fc(0x1b7)],'setupHeaders':_0x44ac28},{'launchBrowser':launchRealBrowser});if(_0x9ec4ef)return console['log'](_0x5783fc(0x1a2)+_0x1e7c3e['name']+'\x22,\x20cached\x20locally'),{'authPath':_0xc0298a,'settings':_0x47de05,'resolvedEnv':_0x4edf50};console[_0x5783fc(0x1b1)]('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x1e7c3e['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x2586f2['bczEw'](emitSessionValidationHint,_0x200295,_0x4edf50);}else return{'authPath':_0xc0298a,'settings':_0x47de05,'resolvedEnv':_0x4edf50};}console[_0x5783fc(0x1b1)](_0x5783fc(0x193)+_0x1e7c3e[_0x5783fc(0x1f0)]+'\x22,\x20attempting\x20login...');const _0xec4f34=_0x2586f2['plRDG'](Boolean,process[_0x5783fc(0x1e4)][_0x5783fc(0x1d2)])&&_0x2586f2[_0x5783fc(0x1a6)](Boolean,process[_0x5783fc(0x1e4)]['RANGER_TEST_PASSWORD']),_0x2db1de=Boolean(_0x1e7c3e['username']);if(_0x2586f2[_0x5783fc(0x1be)](_0xec4f34,_0x2db1de))try{const _0xcf4dfb=await _0x2586f2[_0x5783fc(0x19b)](serverSideLogin,_0x1e7c3e['name']);if(_0x2586f2[_0x5783fc(0x1cf)](_0xcf4dfb[_0x5783fc(0x18f)],_0x2586f2['mOcal']))console['log'](_0x2586f2[_0x5783fc(0x1e7)]);else{if(_0xcf4dfb[_0x5783fc(0x18f)]==='success'&&_0xcf4dfb['session_state']){console['log'](_0x2586f2[_0x5783fc(0x1f2)]);const _0xa24325=await _0x2586f2['OSBhF'](writeSessionToLocalCache,_0x1e7c3e[_0x5783fc(0x1f0)],_0x1e7c3e[_0x5783fc(0x1c1)],_0x200295,_0x44ac28,_0xcf4dfb[_0x5783fc(0x1a4)],_0x2aa718,_0x57dbae);return _0x2586f2['lJoTS'](_0xec4f34,!_0x2db1de)&&await _0x2586f2['zSstH'](promptSaveCredentials,_0x1e7c3e['name']),{'authPath':_0xa24325,'settings':_0x47de05,'resolvedEnv':_0x4edf50};}else _0xcf4dfb['test_output']&&(console[_0x5783fc(0x1b1)]('\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:'),console['log'](_0xcf4dfb['test_output'])),console['log'](_0x2586f2[_0x5783fc(0x1dd)]);}}catch(_0x3ec8e2){console['log']('\x20\x20Server-side\x20login\x20error:\x20'+(_0x2586f2['GBriM'](_0x3ec8e2,Error)?_0x3ec8e2['message']:String(_0x3ec8e2))),console[_0x5783fc(0x1b1)](_0x2586f2[_0x5783fc(0x1dd)]);}const {sessionState:_0x1dea65}=await _0x2586f2[_0x5783fc(0x1f7)](manualBrowserLogin,_0x1e7c3e,_0x4edf50),_0x7a21ff=await _0x2586f2['OSBhF'](writeSessionToLocalCache,_0x1e7c3e['name'],_0x1e7c3e['organizationId'],_0x200295,_0x44ac28,_0x1dea65,_0x2aa718,_0x57dbae);return{'authPath':_0x7a21ff,'settings':_0x47de05,'resolvedEnv':_0x4edf50};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x1defdc=_0x2f8f;(function(_0x26cbcf,_0x3fbfb1){const _0x4ad455=_0x2f8f,_0x135464=_0x26cbcf();while(!![]){try{const _0x1f48b9=parseInt(_0x4ad455(0x1ae))/0x1*(-parseInt(_0x4ad455(0x1a9))/0x2)+-parseInt(_0x4ad455(0x1b8))/0x3*(-parseInt(_0x4ad455(0x1a6))/0x4)+-parseInt(_0x4ad455(0x19a))/0x5+parseInt(_0x4ad455(0x1ad))/0x6*(-parseInt(_0x4ad455(0x1b1))/0x7)+-parseInt(_0x4ad455(0x1b3))/0x8+parseInt(_0x4ad455(0x195))/0x9*(-parseInt(_0x4ad455(0x197))/0xa)+parseInt(_0x4ad455(0x1bd))/0xb;if(_0x1f48b9===_0x3fbfb1)break;else _0x135464['push'](_0x135464['shift']());}catch(_0x39d9fd){_0x135464['push'](_0x135464['shift']());}}}(_0x21b5,0x3502c));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x15b71f=process['env'],_0x1ad120={'stdin':process['stdin'],'stdout':process[_0x1defdc(0x196)]}){const _0x58731e=_0x1defdc,_0x221c3a={'rUfWk':function(_0x2a4e0a,_0x855714){return _0x2a4e0a(_0x855714);}};if(_0x15b71f['CI'])return![];return _0x221c3a['rUfWk'](Boolean,_0x1ad120['stdin'][_0x58731e(0x1a5)])&&Boolean(_0x1ad120['stdout'][_0x58731e(0x1a5)]);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x48405b){const _0x8751f8=_0x1defdc,_0x30359d={'cIovC':'setupHeaders','WTydd':function(_0x226231,_0x530d7a){return _0x226231(_0x530d7a);},'rFeUB':_0x8751f8(0x1b9),'GTvDA':'clientIp','vWRiT':function(_0x4eb3e3,_0x41bde7){return _0x4eb3e3(_0x41bde7);},'snsuV':_0x8751f8(0x1a4),'gPTDJ':'hex'},_0x204692=new Set(_0x48405b[_0x8751f8(0x19f)]??DEFAULT_INVALIDATE_ON),_0x8a1dab={'orgId':_0x48405b[_0x8751f8(0x1c2)],'profileName':_0x48405b[_0x8751f8(0x19d)]};return _0x204692[_0x8751f8(0x1ba)]('baseUrl')&&(_0x8a1dab['effectiveBaseUrl']=_0x48405b[_0x8751f8(0x198)]),_0x204692[_0x8751f8(0x1ba)](_0x30359d['cIovC'])&&(_0x8a1dab['setupHeaders']=_0x48405b['setupHeaders']?_0x30359d['WTydd'](sortObjectKeys,_0x48405b[_0x8751f8(0x1b7)]):_0x48405b['setupHeaders']),_0x204692[_0x8751f8(0x1ba)](_0x30359d[_0x8751f8(0x1af)])&&(_0x8a1dab['port']=extractPort(_0x48405b[_0x8751f8(0x198)])),_0x204692['has']('userAgent')&&_0x48405b['userAgent']!==undefined&&(_0x8a1dab['userAgent']=_0x48405b['userAgent']),_0x204692[_0x8751f8(0x1ba)](_0x30359d['GTvDA'])&&_0x48405b[_0x8751f8(0x19b)]!==undefined&&(_0x8a1dab['clientIp']=_0x48405b[_0x8751f8(0x19b)]),_0x30359d[_0x8751f8(0x19e)](createHash,_0x30359d['snsuV'])['update'](JSON['stringify'](_0x8a1dab))['digest'](_0x30359d['gPTDJ'])[_0x8751f8(0x1be)](0x0,0xc);}function _0x2f8f(_0x3410d9,_0x3be87b){_0x3410d9=_0x3410d9-0x190;const _0x21b5d5=_0x21b5();let _0x2f8f73=_0x21b5d5[_0x3410d9];return _0x2f8f73;}function extractPort(_0x3afe36){try{return new URL(_0x3afe36)['port'];}catch{return'';}}function sortObjectKeys(_0x4567af){const _0x2c4c77=_0x1defdc,_0xdd361f={};for(const _0x3af315 of Object['keys'](_0x4567af)[_0x2c4c77(0x1a3)]()){_0xdd361f[_0x3af315]=_0x4567af[_0x3af315];}return _0xdd361f;}export function getSessionCachePath(_0x58ba4f,_0x150df0){const _0x4368be=_0x1defdc,_0x2cf684={'rgmAN':_0x4368be(0x199)};return join(getRangerHomeDir(),_0x2cf684['rgmAN'],_0x58ba4f+'-'+_0x150df0+_0x4368be(0x1a8));}export function getStorageStatePath(_0x1dc6a0){const _0x2c03dd=_0x1defdc,_0x87238d={'GXggC':_0x2c03dd(0x1b6)};return _0x1dc6a0[_0x2c03dd(0x1bc)](/\.json$/,_0x87238d['GXggC']);}function _0x21b5(){const _0x410b35=['invalidateOn','domain','status','sessionCheckPath','sort','sha256','isTTY','19464YJbTAg','close','.json','74JxwrSI','includes','environments','goto','604782lSeomS','137auuCkH','rFeUB','endsWith','21VUqEpl','.localhost','2538008lVEYvX','keys','JoXya','.storageState.json','setupHeaders','57dwHyDz','port','has','defaultEnvironmentKey','replace','11136631HHloJC','slice','toString','startsWith','length','orgId','hostname','iEaGv','newContext','pathname','push','add','174915fWzFrS','stdout','30mTkUdf','effectiveBaseUrl','auth','1023635ydMIZG','clientIp','test','profileName','vWRiT'];_0x21b5=function(){return _0x410b35;};return _0x21b5();}export function needsTunnel(_0x4b0e93){const _0x236acb=_0x1defdc,_0x32b797={'iEaGv':function(_0x5d9db6,_0x18e085){return _0x5d9db6===_0x18e085;}};let _0x7ebd67;try{_0x7ebd67=new URL(_0x4b0e93)['hostname'];}catch{return![];}if(_0x7ebd67==='localhost'||_0x32b797[_0x236acb(0x190)](_0x7ebd67,'127.0.0.1'))return!![];if(_0x7ebd67[_0x236acb(0x1b0)](_0x236acb(0x1b2)))return!![];if(_0x7ebd67[_0x236acb(0x1aa)]('localhost.'))return!![];return![];}export function hostnameOf(_0x47ffc9){const _0x5b0351=_0x1defdc;return new URL(_0x47ffc9)[_0x5b0351(0x1c3)];}export function duplicateCookiesForDomains(_0x44f282,_0x5c79d4){const _0x29079d=_0x1defdc,_0x94fd1b={'JoXya':function(_0xf6fac2,_0x19b2a3){return _0xf6fac2(_0x19b2a3);}},_0x5d5821=[..._0x44f282],_0x54e072=new Set(_0x44f282['map'](_0x50fccd=>_0x50fccd[_0x29079d(0x1a0)]));for(const _0x3051f2 of _0x5c79d4){let _0x10e9fc;try{_0x10e9fc=_0x94fd1b[_0x29079d(0x1b5)](hostnameOf,_0x3051f2);}catch{continue;}if(!_0x10e9fc)continue;const _0x2faf61=_0x10e9fc[_0x29079d(0x1c0)]('.')?_0x10e9fc:'.'+_0x10e9fc;if(_0x54e072['has'](_0x10e9fc)||_0x54e072[_0x29079d(0x1ba)](_0x2faf61))continue;for(const _0x486dfc of _0x44f282){_0x5d5821[_0x29079d(0x193)]({..._0x486dfc,'domain':_0x2faf61});}_0x54e072[_0x29079d(0x194)](_0x2faf61);}return _0x5d5821;}export function resolveAuthEnvironmentLocally(_0xbf7912,_0x4a4d4a){const _0x10c10c=_0x1defdc,_0x1fdb2a={'yhptq':function(_0x53040b,_0xbbcb76){return _0x53040b===_0xbbcb76;}},_0x1c69d8=_0xbf7912[_0x10c10c(0x1ab)];if(_0x4a4d4a){const _0x55afc7=_0x1c69d8[_0x4a4d4a];if(!_0x55afc7)return null;return{'key':_0x4a4d4a,..._0x55afc7};}if(_0xbf7912['defaultEnvironmentKey']){const _0x501828=_0x1c69d8[_0xbf7912['defaultEnvironmentKey']];if(!_0x501828)return null;return{'key':_0xbf7912[_0x10c10c(0x1bb)],..._0x501828};}const _0x5868a6=Object[_0x10c10c(0x1b4)](_0x1c69d8);if(_0x1fdb2a['yhptq'](_0x5868a6[_0x10c10c(0x1c1)],0x1)){const _0x15b3f3=_0x5868a6[0x0];return{'key':_0x15b3f3,..._0x1c69d8[_0x15b3f3]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x32c5a7,_0x219094){const _0x14e37d=_0x1defdc;try{if(_0x219094)return new URL(_0x219094,_0x32c5a7)[_0x14e37d(0x1bf)]();return new URL(_0x32c5a7)['toString']();}catch{return null;}}export function looksLikeLoginUrl(_0x480430){const _0x199672=_0x1defdc;try{const _0x1e5e5a=new URL(_0x480430);return LOGIN_URL_PATTERN[_0x199672(0x19c)](_0x1e5e5a[_0x199672(0x192)]);}catch{return LOGIN_URL_PATTERN[_0x199672(0x19c)](_0x480430);}}export async function isCachedSessionLive(_0x4261d3,_0x41925a,_0x1120e1={},_0x23f0ef={}){const _0x1d80fd=_0x1defdc,_0x24a499={'FOZgb':function(_0x341f75,_0xa5ddd3){return _0x341f75===_0xa5ddd3;},'ssyoV':function(_0x2c0f82,_0x129d0d){return _0x2c0f82===_0x129d0d;},'VZAal':function(_0xe8be3d,_0x36913c){return _0xe8be3d(_0x36913c);}},_0x12ef2d=buildSessionCheckUrl(_0x41925a,_0x1120e1[_0x1d80fd(0x1a2)]);if(!_0x12ef2d)return!![];if(!_0x23f0ef['launchBrowser'])return!![];let _0x3f0c44=null;try{_0x3f0c44=await _0x23f0ef['launchBrowser']();const _0x1751d5=await _0x3f0c44[_0x1d80fd(0x191)]({'storageState':_0x4261d3,'ignoreHTTPSErrors':!![],..._0x1120e1[_0x1d80fd(0x1b7)]?{'extraHTTPHeaders':_0x1120e1[_0x1d80fd(0x1b7)]}:{}}),_0x462170=await _0x1751d5['newPage'](),_0x27b271=await _0x462170[_0x1d80fd(0x1ac)](_0x12ef2d,{'waitUntil':'domcontentloaded','timeout':0x3a98}),_0x4cc32d=_0x27b271?.[_0x1d80fd(0x1a1)]();if(_0x24a499['FOZgb'](_0x4cc32d,0x191)||_0x24a499['ssyoV'](_0x4cc32d,0x193))return![];const _0x3e6d8b=_0x462170['url']();if(_0x24a499['VZAal'](looksLikeLoginUrl,_0x3e6d8b))return![];return!![];}catch{return![];}finally{if(_0x3f0c44)await _0x3f0c44[_0x1d80fd(0x1a7)]()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
const _0x1f60f6=_0x34ac;(function(_0x572dd4,_0x598bbb){const _0x3ce15f=_0x34ac,_0x385596=_0x572dd4();while(!![]){try{const _0x37ca5b=-parseInt(_0x3ce15f(0xe4))/0x1+-parseInt(_0x3ce15f(0xec))/0x2+parseInt(_0x3ce15f(0xed))/0x3+parseInt(_0x3ce15f(0xe6))/0x4*(-parseInt(_0x3ce15f(0xe7))/0x5)+parseInt(_0x3ce15f(0xea))/0x6*(-parseInt(_0x3ce15f(0xe3))/0x7)+parseInt(_0x3ce15f(0xf0))/0x8*(parseInt(_0x3ce15f(0xee))/0x9)+parseInt(_0x3ce15f(0xe9))/0xa;if(_0x37ca5b===_0x598bbb)break;else _0x385596['push'](_0x385596['shift']());}catch(_0x41c850){_0x385596['push'](_0x385596['shift']());}}}(_0x16a6,0xc56cd));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';function _0x16a6(){const _0x280209=['update','ZKrMe','final','KpIFQ','glwQm','utf8','21rjrBMY','119281Sgmotu','aes-256-gcm','16zHxbLB','1338605zbxaDf','getAuthTag','3301430VDdNHZ','221592AOCSgR','concat','795552wZSKEI','2456583bkhwNl','18ackSuG','subarray','5433544xtqfYr'];_0x16a6=function(){return _0x280209;};return _0x16a6();}const ALGORITHM=_0x1f60f6(0xe5),SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;function _0x34ac(_0x23f88a,_0x569cd0){_0x23f88a=_0x23f88a-0xe3;const _0x16a6cc=_0x16a6();let _0x34ac25=_0x16a6cc[_0x23f88a];return _0x34ac25;}export function deriveKey(_0x1d821e){const _0x1128ca=_0x1f60f6,_0x268991={'glwQm':function(_0x240b76,_0x4c5a95,_0x5341c5,_0x408d5b,_0x1e2f10,_0x58c982){return _0x240b76(_0x4c5a95,_0x5341c5,_0x408d5b,_0x1e2f10,_0x58c982);}};return _0x268991[_0x1128ca(0xf5)](pbkdf2Sync,_0x1d821e,SALT,0x186a0,KEY_LENGTH,'sha256');}export function encrypt(_0x5ded5b,_0x237300){const _0x26611d=_0x1f60f6,_0x5037b9={'WfyDt':function(_0xe7bf4e,_0x33b94c){return _0xe7bf4e(_0x33b94c);},'ZKrMe':function(_0x509b2e,_0x3d3a48){return _0x509b2e(_0x3d3a48);},'BBPip':'utf8'},_0xbc706a=_0x5037b9['WfyDt'](deriveKey,_0x237300),_0xc5bfaa=_0x5037b9[_0x26611d(0xf2)](randomBytes,IV_LENGTH),_0x3f92bd=createCipheriv(ALGORITHM,_0xbc706a,_0xc5bfaa),_0x8c505=Buffer[_0x26611d(0xeb)]([_0x3f92bd[_0x26611d(0xf1)](_0x5ded5b,_0x5037b9['BBPip']),_0x3f92bd[_0x26611d(0xf3)]()]),_0x4172d0=_0x3f92bd[_0x26611d(0xe8)]();return Buffer['concat']([_0xc5bfaa,_0x4172d0,_0x8c505]);}export function decrypt(_0x471504,_0x3a0c8f){const _0x474e40=_0x1f60f6,_0x307fe5={'KpIFQ':function(_0x114af3,_0x67afe9,_0x3a561d,_0x3e7a40){return _0x114af3(_0x67afe9,_0x3a561d,_0x3e7a40);}},_0x529342=deriveKey(_0x3a0c8f),_0x1c6b09=_0x471504[_0x474e40(0xef)](0x0,IV_LENGTH),_0x19b958=_0x471504['subarray'](IV_LENGTH,IV_LENGTH+TAG_LENGTH),_0x16c726=_0x471504[_0x474e40(0xef)](IV_LENGTH+TAG_LENGTH),_0x49b012=_0x307fe5[_0x474e40(0xf4)](createDecipheriv,ALGORITHM,_0x529342,_0x1c6b09);return _0x49b012['setAuthTag'](_0x19b958),_0x49b012[_0x474e40(0xf1)](_0x16c726)+_0x49b012['final'](_0x474e40(0xf6));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x64f26a=_0x37b6;(function(_0x5e3857,_0x242818){const _0x406bf3=_0x37b6,_0x50e1dc=_0x5e3857();while(!![]){try{const _0xe7ab48=parseInt(_0x406bf3(0x17c))/0x1*(-parseInt(_0x406bf3(0x16b))/0x2)+-parseInt(_0x406bf3(0x192))/0x3*(parseInt(_0x406bf3(0x171))/0x4)+parseInt(_0x406bf3(0x186))/0x5+-parseInt(_0x406bf3(0x178))/0x6*(-parseInt(_0x406bf3(0x16e))/0x7)+-parseInt(_0x406bf3(0x173))/0x8*(-parseInt(_0x406bf3(0x16f))/0x9)+parseInt(_0x406bf3(0x177))/0xa+parseInt(_0x406bf3(0x176))/0xb*(-parseInt(_0x406bf3(0x17e))/0xc);if(_0xe7ab48===_0x242818)break;else _0x50e1dc['push'](_0x50e1dc['shift']());}catch(_0x592a52){_0x50e1dc['push'](_0x50e1dc['shift']());}}}(_0x28a1,0xaefbf));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x37b6(_0x4949af,_0x43a43f){_0x4949af=_0x4949af-0x16b;const _0x28a11b=_0x28a1();let _0x37b631=_0x28a11b[_0x4949af];return _0x37b631;}import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0x64f26a(0x17b),'-t',_0x64f26a(0x172),_0x64f26a(0x18e),'--apikey',_0x64f26a(0x196),_0x64f26a(0x19a),_0x64f26a(0x16c),'--auth',_0x64f26a(0x181),_0x64f26a(0x18f),_0x64f26a(0x19c),_0x64f26a(0x179)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x1b49c1){const _0x5d1ff2=_0x64f26a;return TOKEN_PATTERNS[_0x5d1ff2(0x195)](_0x18b1e1=>_0x18b1e1['test'](_0x1b49c1));}function _0x28a1(){const _0x17af13=['--password','toLowerCase','--cookie','[REDACTED]','no_token','naLTm','368916oFApKH','--pass','has_token','49kufPFp','2390103fAdJDK','has','304336ThBjOB','--secret','24YuvrFA','startsWith','isTTY','22IcRzFd','4477470pGgXBm','1166010BfDrum','--credentials','DEBUG','--token','3AtKvVC','missing_required_argument','11175348Fvtjht','pdsps','application/json','--authorization','bTSzS','split','syntax_error','POST','3019790WyLRmc','featureId','includes','invalid_option_value','push','catch','0|3|5|2|7|6|4|1','[desire-path]\x20Sending\x20log\x20to\x20','--api-key','--header','HrJWU','env','3Wfytxg','gTrjW','EUjRY','some','--key','join','=[REDACTED]','errorMessage'];_0x28a1=function(){return _0x17af13;};return _0x28a1();}export function sanitizeArgs(_0x21343e){const _0x2657b0=_0x64f26a,_0x5e66de={'fPHQW':function(_0x53d524,_0x5ebfab){return _0x53d524<_0x5ebfab;},'jeXcU':_0x2657b0(0x19d),'xRrGG':function(_0x1bafef,_0x1f4614){return _0x1bafef!==_0x1f4614;},'EUjRY':function(_0x5d0ec4,_0x388d80){return _0x5d0ec4(_0x388d80);}},_0x30f672=[];let _0x3138e9=![];for(let _0x5c3cba=0x0;_0x5e66de['fPHQW'](_0x5c3cba,_0x21343e['length']);_0x5c3cba++){const _0x17944d=_0x21343e[_0x5c3cba];if(_0x3138e9){_0x30f672['push'](_0x5e66de['jeXcU']),_0x3138e9=![];continue;}if(_0x17944d[_0x2657b0(0x174)]('--')||_0x17944d[_0x2657b0(0x174)]('-')){const _0x153a74=_0x17944d['indexOf']('=');if(_0x5e66de['xRrGG'](_0x153a74,-0x1)){const _0x492876=_0x17944d['slice'](0x0,_0x153a74)['toLowerCase']();if(SENSITIVE_FLAGS['has'](_0x492876)){_0x30f672[_0x2657b0(0x18a)](_0x17944d['slice'](0x0,_0x153a74)+_0x2657b0(0x198));continue;}}else{const _0x1a93d0=_0x17944d[_0x2657b0(0x19b)]();SENSITIVE_FLAGS[_0x2657b0(0x170)](_0x1a93d0)&&(_0x3138e9=!![]);}_0x30f672[_0x2657b0(0x18a)](_0x17944d);}else _0x5e66de[_0x2657b0(0x194)](looksLikeToken,_0x17944d)?_0x30f672['push'](_0x5e66de['jeXcU']):_0x30f672[_0x2657b0(0x18a)](_0x17944d);}return _0x30f672[_0x2657b0(0x197)]('\x20');}export async function logDesirePath(_0x115781){const _0x1fa8e2=_0x64f26a,_0x42b9b0={'pdsps':function(_0x350a91){return _0x350a91();},'gTrjW':_0x1fa8e2(0x16d),'cUxcp':'Authorization'};try{const _0x17ef75=await _0x42b9b0['pdsps'](getToken)[_0x1fa8e2(0x18b)](()=>null),_0x168a2b=_0x42b9b0['pdsps'](getApiBaseUrl),_0x32c95d=_0x42b9b0[_0x1fa8e2(0x17f)](getCurrentVersion),_0x13adff=_0x17ef75?_0x42b9b0[_0x1fa8e2(0x193)]:_0x1fa8e2(0x19e),_0x5b33a7={..._0x115781['metadata'],'authStatus':_0x13adff,'isTty':process['stdout'][_0x1fa8e2(0x175)]??![]},_0xd11e01={'Content-Type':_0x1fa8e2(0x180)};_0x17ef75&&(_0xd11e01[_0x42b9b0['cUxcp']]='Bearer\x20'+_0x17ef75);const _0x511ba1={'rawCommand':_0x115781['rawCommand'],'errorMessage':_0x115781[_0x1fa8e2(0x199)],'errorType':_0x115781['errorType'],'featureId':_0x115781[_0x1fa8e2(0x187)],'sessionId':_0x115781['sessionId'],'metadata':_0x5b33a7,'cliVersion':_0x32c95d};process[_0x1fa8e2(0x191)][_0x1fa8e2(0x17a)]&&(console['error'](_0x1fa8e2(0x18d)+_0x168a2b+'/api/v1/mcp/desire-path-logs'),console['error']('[desire-path]\x20Payload:\x20'+JSON['stringify'](_0x511ba1,null,0x2))),await fetch(_0x168a2b+'/api/v1/mcp/desire-path-logs',{'method':_0x1fa8e2(0x185),'headers':_0xd11e01,'body':JSON['stringify'](_0x511ba1)});}catch(_0x32d380){process[_0x1fa8e2(0x191)][_0x1fa8e2(0x17a)]&&console['error']('[desire-path]\x20Failed\x20to\x20send:\x20'+_0x32d380);}}export function getErrorType(_0x1ec305,_0x9229c6){const _0x3b895e=_0x64f26a,_0x77996b={'naLTm':'Unknown\x20argument','HrJWU':'unknown_argument','bTSzS':'unknown','fsQfp':'Not\x20enough\x20non-option\x20arguments','XutQf':_0x3b895e(0x17d)},_0x7a5422=_0x3b895e(0x18c)[_0x3b895e(0x183)]('|');let _0x193fcc=0x0;while(!![]){switch(_0x7a5422[_0x193fcc++]){case'0':if(_0x9229c6)return'runtime_error';continue;case'1':return _0x3b895e(0x184);case'2':if(_0x1ec305[_0x3b895e(0x188)](_0x77996b[_0x3b895e(0x19f)]))return _0x77996b[_0x3b895e(0x190)];continue;case'3':if(!_0x1ec305)return _0x77996b[_0x3b895e(0x182)];continue;case'4':if(_0x1ec305['includes']('Missing\x20required\x20argument'))return'missing_option';continue;case'5':if(_0x1ec305['includes']('Unknown\x20command'))return'unknown_command';continue;case'6':if(_0x1ec305[_0x3b895e(0x188)]('Invalid\x20values'))return _0x3b895e(0x189);continue;case'7':if(_0x1ec305['includes'](_0x77996b['fsQfp']))return _0x77996b['XutQf'];continue;}break;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x524be5,_0x18e164){const _0x55b2dd=_0x5bea,_0x1abaec=_0x524be5();while(!![]){try{const _0x399b13=parseInt(_0x55b2dd(0x184))/0x1+-parseInt(_0x55b2dd(0x1a0))/0x2+-parseInt(_0x55b2dd(0x15d))/0x3+-parseInt(_0x55b2dd(0x15e))/0x4*(-parseInt(_0x55b2dd(0x16a))/0x5)+-parseInt(_0x55b2dd(0x198))/0x6*(-parseInt(_0x55b2dd(0x161))/0x7)+parseInt(_0x55b2dd(0x19d))/0x8+-parseInt(_0x55b2dd(0x194))/0x9;if(_0x399b13===_0x18e164)break;else _0x1abaec['push'](_0x1abaec['shift']());}catch(_0x5b0a4c){_0x1abaec['push'](_0x1abaec['shift']());}}}(_0x134e,0x9f63f));import{spawn}from'child_process';import _0x3ecf9a from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';function _0x5bea(_0x166c7f,_0x4e4a4d){_0x166c7f=_0x166c7f-0x15a;const _0x134e44=_0x134e();let _0x5bea2d=_0x134e44[_0x166c7f];return _0x5bea2d;}import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL='https://api.workos.com/user_management/authorize/device',WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0xb7aba){const _0x182034=_0x5bea,_0x13e353=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':'POST','headers':{'Content-Type':_0x182034(0x163)},'body':new URLSearchParams({'client_id':_0xb7aba})});if(!_0x13e353['ok']){const _0x5a22fb=await _0x13e353['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x13e353['status']+'\x20'+_0x5a22fb);}return _0x13e353[_0x182034(0x188)]();}export async function pollForTokens(_0x1a0917,_0x161ec5,_0x25fca5,_0x5e14f6){const _0xf427e5=_0x5bea,_0x7948f5={'zeyJk':function(_0x143bac,_0x3ce8ba){return _0x143bac*_0x3ce8ba;},'uBFWP':function(_0x9afacf,_0x5a4a3d,_0x42017a){return _0x9afacf(_0x5a4a3d,_0x42017a);},'ZDhPg':'urn:ietf:params:oauth:grant-type:device_code','dQCeb':'authorization_pending','erYsl':function(_0x51aadb,_0x37e3f8){return _0x51aadb===_0x37e3f8;},'wqnMj':'slow_down','ujaOW':_0xf427e5(0x18a),'HLQAw':'Device\x20authorization\x20timed\x20out'},_0x228ed7=Date['now']()+_0x5e14f6*0x3e8;let _0x176d7d=_0x7948f5[_0xf427e5(0x172)](_0x25fca5,0x3e8);while(Date[_0xf427e5(0x17e)]()<_0x228ed7){await sleep(_0x176d7d);const _0x2a49d9=await _0x7948f5[_0xf427e5(0x1a3)](fetch,WORKOS_TOKEN_URL,{'method':_0xf427e5(0x17c),'headers':{'Content-Type':_0xf427e5(0x163)},'body':new URLSearchParams({'client_id':_0x1a0917,'device_code':_0x161ec5,'grant_type':_0x7948f5[_0xf427e5(0x171)]})});if(_0x2a49d9['ok'])return _0x2a49d9[_0xf427e5(0x188)]();const _0x24a1da=await _0x2a49d9['json']();if(_0x24a1da[_0xf427e5(0x1a1)]===_0x7948f5['dQCeb'])continue;if(_0x7948f5[_0xf427e5(0x16e)](_0x24a1da['error'],_0x7948f5[_0xf427e5(0x174)])){_0x176d7d+=0x3e8;continue;}throw new Error(_0x24a1da[_0xf427e5(0x197)]||_0x24a1da['error']||_0x7948f5[_0xf427e5(0x166)]);}throw new Error(_0x7948f5['HLQAw']);}async function fetchUserProfile(_0x418205){const _0x257d16=_0x5bea,_0x155400={'Prkov':function(_0xb760a5,_0x5eb937,_0x236f3c){return _0xb760a5(_0x5eb937,_0x236f3c);},'ovfSJ':_0x257d16(0x18b)},_0x448bbf=getApiBaseUrl();try{const _0x54e1e2=await _0x155400[_0x257d16(0x186)](fetch,_0x448bbf+_0x257d16(0x173),{'method':_0x155400['ovfSJ'],'headers':{'workos-token':_0x418205}});if(_0x54e1e2['ok'])return _0x54e1e2['json']();}catch{}return null;}function buildKeyName(_0xf70f99,_0x1a0239){const _0x4afdc9=_0x5bea,_0x44e691={'eWSsw':function(_0x138358,_0x5820b6){return _0x138358===_0x5820b6;},'ARwAI':function(_0x4e52de,_0x207bb3){return _0x4e52de+_0x207bb3;}},_0x8ae2a6=_0x1a0239[_0x4afdc9(0x15c)](_0x17f641=>_0x17f641[_0x4afdc9(0x164)]===_0xf70f99||_0x17f641['name'][_0x4afdc9(0x181)](_0xf70f99+'\x20('));if(_0x44e691['eWSsw'](_0x8ae2a6[_0x4afdc9(0x17d)],0x0))return _0xf70f99;return _0xf70f99+'\x20('+_0x44e691['ARwAI'](_0x8ae2a6[_0x4afdc9(0x17d)],0x1)+')';}export async function provisionApiKey(_0x2971cf){const _0x4fa7aa=_0x5bea,_0x1c8845={'DwsOA':function(_0x1ba9c4){return _0x1ba9c4();},'tVybd':function(_0x1542b7,_0x1b1ce0,_0x204836){return _0x1542b7(_0x1b1ce0,_0x204836);},'FCozf':function(_0x26c524,_0x528021,_0x3fe34d){return _0x26c524(_0x528021,_0x3fe34d);},'seWYM':_0x4fa7aa(0x17c)},_0x1da4de=_0x1c8845['DwsOA'](getApiBaseUrl),_0x41137c={'Content-Type':'application/json','workos-token':_0x2971cf},_0xd2e7f6=await fetchUserProfile(_0x2971cf),_0x338e30=_0xd2e7f6?.['firstName']||_0xd2e7f6?.['email']?.['split']('@')[0x0],_0x560514=_0x338e30?_0x338e30+_0x4fa7aa(0x193):'CLI\x20Key';let _0x4d399d=[];try{const _0x15d107=await _0x1c8845['tVybd'](fetch,_0x1da4de+'/api-keys',{'method':'GET','headers':_0x41137c});if(_0x15d107['ok']){const _0xdea6d3=await _0x15d107['json']();_0x4d399d=_0xdea6d3['apiKeys'];}}catch{}const _0x52ede6=_0x1c8845[_0x4fa7aa(0x17f)](buildKeyName,_0x560514,_0x4d399d),_0x4a3be8=await _0x1c8845['FCozf'](fetch,_0x1da4de+_0x4fa7aa(0x17b),{'method':_0x1c8845['seWYM'],'headers':_0x41137c,'body':JSON['stringify']({'name':_0x52ede6,'scope':_0x4fa7aa(0x167)})});if(!_0x4a3be8['ok']){const _0x1a1e99=await _0x4a3be8['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x4a3be8['status']+'\x20'+_0x1a1e99);}const _0xaf84a3=await _0x4a3be8[_0x4fa7aa(0x188)]();return _0xaf84a3[_0x4fa7aa(0x1a5)][_0x4fa7aa(0x19e)];}function _0x134e(){const _0x103e17=['access_token','9837504qVGkOe','token','darwin','2607200knpDKs','error','workosClientId','uBFWP','win32','apiKey','isTTY','stdout','open','toString','ignore','parse','pivmN','filter','1568403NiRGgI','1128532STwYiy','utf-8','memberships','5012224tOxJQd','lIQJE','application/x-www-form-urlencoded','name','Using\x20organization:\x20','ujaOW','mcp:write','log','verification_uri_complete','5keDVXV','status','nXRPU','write','erYsl','eNJlp','KpScj','ZDhPg','zeyJk','/organization/me','wqnMj','list','/organization/my-memberships','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','prompt','Provisioning\x20CLI\x20token...','Failed\x20to\x20provision\x20CLI\x20token:\x20','/api-keys','POST','length','now','tVybd','cmd','startsWith','vvWrR','base64url','1252430TaRjLv','Invalid\x20JWT\x20format','Prkov','eqZNR','json','refresh_token','Authentication\x20failed','GET','text','device_code','/organization/self-serve-signup','tGlbH','organizationId','xdg-open','Waiting\x20for\x20authentication...','\x27s\x20CLI\x20Key','9009171yLWGhN','interval','dIEGA','error_description','6XxIMfy','expires_in','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','Shppd'];_0x134e=function(){return _0x103e17;};return _0x134e();}export function openBrowser(_0x4e243e){const _0x12bd7a=_0x5bea,_0x28e25b={'Kcsyj':function(_0x5be525,_0x13e4ae){return _0x5be525===_0x13e4ae;},'OUfrY':function(_0x120b9b,_0x531aef,_0x31e57f,_0x5be701){return _0x120b9b(_0x531aef,_0x31e57f,_0x5be701);},'kwsXd':_0x12bd7a(0x180),'JxXGw':function(_0xe5c490,_0x5acf69){return _0xe5c490===_0x5acf69;},'SPPJY':_0x12bd7a(0x19f),'vvWrR':'ignore'};try{if(_0x28e25b['Kcsyj'](process['platform'],_0x12bd7a(0x1a4))){const _0x2ea98d=_0x28e25b['OUfrY'](spawn,_0x28e25b['kwsXd'],['/c','start','',_0x4e243e],{'detached':!![],'stdio':_0x12bd7a(0x1aa),'windowsHide':!![]});_0x2ea98d['unref']();return;}const _0x586c9c=_0x28e25b['JxXGw'](process['platform'],_0x28e25b['SPPJY'])?_0x12bd7a(0x1a8):_0x12bd7a(0x191),_0x58e1ad=spawn(_0x586c9c,[_0x4e243e],{'detached':!![],'stdio':_0x28e25b[_0x12bd7a(0x182)]});_0x58e1ad['unref']();}catch{}}function decodeJwtPayload(_0x5e2b6a){const _0x381cb0=_0x5bea,_0x17bd2a={'rlhjg':function(_0x15a400,_0x625766){return _0x15a400!==_0x625766;},'eNJlp':_0x381cb0(0x185),'Shppd':_0x381cb0(0x183),'bbuSc':_0x381cb0(0x15f)},_0x4c2bc1=_0x5e2b6a['split']('.');if(_0x17bd2a['rlhjg'](_0x4c2bc1[_0x381cb0(0x17d)],0x3))throw new Error(_0x17bd2a[_0x381cb0(0x16f)]);const _0x2ee714=Buffer['from'](_0x4c2bc1[0x1],_0x17bd2a[_0x381cb0(0x19b)])[_0x381cb0(0x1a9)](_0x17bd2a['bbuSc']);return JSON[_0x381cb0(0x15a)](_0x2ee714);}async function selfServeSignup(_0x531b29){const _0x16f3c7=_0x5bea,_0x1ae806={'eqZNR':function(_0x2a57f2){return _0x2a57f2();},'KpScj':function(_0x4cf516,_0x1bdf6e,_0x54a79e){return _0x4cf516(_0x1bdf6e,_0x54a79e);},'AnIYm':'application/json'},_0x3e5892=_0x1ae806[_0x16f3c7(0x187)](getApiBaseUrl),_0xeef524=await _0x1ae806[_0x16f3c7(0x170)](fetch,_0x3e5892+_0x16f3c7(0x18e),{'method':'POST','headers':{'Content-Type':_0x1ae806['AnIYm'],'workos-token':_0x531b29}});if(!_0xeef524['ok']){const _0x2031b6=await _0xeef524[_0x16f3c7(0x18c)]();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0xeef524[_0x16f3c7(0x16b)]+'\x20'+_0x2031b6);}return _0xeef524[_0x16f3c7(0x188)]();}async function fetchMyMemberships(_0x19ee43){const _0x35ac2d=_0x5bea,_0x3fce7c={'Gcwse':function(_0x5a7257){return _0x5a7257();},'ESqxL':_0x35ac2d(0x18b)},_0x586e26=_0x3fce7c['Gcwse'](getApiBaseUrl),_0x2f2bff=await fetch(_0x586e26+_0x35ac2d(0x176),{'method':_0x3fce7c['ESqxL'],'headers':{'workos-token':_0x19ee43}});if(!_0x2f2bff['ok']){const _0x37ac78=await _0x2f2bff['text']();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x2f2bff[_0x35ac2d(0x16b)]+'\x20'+_0x37ac78);}const _0x554094=await _0x2f2bff['json']();return _0x554094[_0x35ac2d(0x160)];}async function refreshTokenWithOrg(_0x1e1495,_0x4497c6,_0x559929){const _0x120e2c=_0x5bea,_0x14daa9=await fetch(WORKOS_TOKEN_URL,{'method':_0x120e2c(0x17c),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x1e1495,'grant_type':'refresh_token','refresh_token':_0x4497c6,'organization_id':_0x559929})});if(!_0x14daa9['ok']){const _0x1f145d=await _0x14daa9['text']();throw new Error(_0x120e2c(0x177)+_0x14daa9[_0x120e2c(0x16b)]+'\x20'+_0x1f145d);}return _0x14daa9[_0x120e2c(0x188)]();}async function provisionCliToken(_0x32f8ef){const _0x1788ba=_0x5bea,_0x4c67d6={'pivmN':function(_0x2c4656){return _0x2c4656();}},_0x46796a=_0x4c67d6[_0x1788ba(0x15b)](getApiBaseUrl),_0x3cb181=await fetch(_0x46796a+'/cli-auth/token',{'method':'POST','headers':{'Content-Type':'application/json','workos-token':_0x32f8ef}});if(!_0x3cb181['ok']){const _0x42fc78=await _0x3cb181['text']();throw new Error(_0x1788ba(0x17a)+_0x3cb181[_0x1788ba(0x16b)]+'\x20'+_0x42fc78);}return _0x3cb181[_0x1788ba(0x188)]();}export async function runDeviceAuthFlow(){const _0x281299=_0x5bea,_0x1daa71={'tGlbH':function(_0x487563){return _0x487563();},'VKsWj':'\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','cRonq':function(_0xafe4c2,_0x56245d,_0x756428,_0x2eb7f2,_0x56911c){return _0xafe4c2(_0x56245d,_0x756428,_0x2eb7f2,_0x56911c);},'dIEGA':function(_0x40b0b5,_0x1d4a85){return _0x40b0b5===_0x1d4a85;},'nXRPU':function(_0x2ee52d,_0x36a096){return _0x2ee52d(_0x36a096);},'UJHDP':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','KXxAE':function(_0x41078c,_0xe10349,_0x433adf,_0x4a8b3b){return _0x41078c(_0xe10349,_0x433adf,_0x4a8b3b);},'lIQJE':_0x281299(0x179)},_0x12c4b5=_0x1daa71[_0x281299(0x18f)](getCurrentEnvironment),_0x265c35=ENVIRONMENT_CONFIGS[_0x12c4b5][_0x281299(0x1a2)],_0x53a095=await requestDeviceCode(_0x265c35);console['log'](_0x1daa71['VKsWj']),console['log']('\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a'),openBrowser(_0x53a095[_0x281299(0x169)]),console[_0x281299(0x168)]('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x53a095['verification_uri_complete']),console[_0x281299(0x168)]('Code:\x20'+_0x53a095['user_code']+'\x0a'),process[_0x281299(0x1a7)][_0x281299(0x16d)](_0x281299(0x192));let _0x1b4dd7=await _0x1daa71['cRonq'](pollForTokens,_0x265c35,_0x53a095[_0x281299(0x18d)],_0x53a095[_0x281299(0x195)],_0x53a095[_0x281299(0x199)]);console[_0x281299(0x168)]('\x20✓');const _0x554981=decodeJwtPayload(_0x1b4dd7['access_token']);if(!_0x554981['org_id']){const _0x140591=await fetchMyMemberships(_0x1b4dd7[_0x281299(0x19c)]);let _0x19de69;if(_0x1daa71[_0x281299(0x196)](_0x140591['length'],0x0)){process[_0x281299(0x1a7)][_0x281299(0x16d)]('Setting\x20up\x20your\x20organization...');const _0xd25d7b=await _0x1daa71[_0x281299(0x16c)](selfServeSignup,_0x1b4dd7[_0x281299(0x19c)]);_0x19de69=_0xd25d7b[_0x281299(0x190)],console['log']('\x20✓');}else{if(_0x1daa71['dIEGA'](_0x140591['length'],0x1))_0x19de69=_0x140591[0x0]['organizationId'],console[_0x281299(0x168)](_0x281299(0x165)+_0x140591[0x0]['name']);else{const _0x38dbc0=process['stdin']['isTTY']&&process['stdout'][_0x281299(0x1a6)];if(!_0x38dbc0)throw new Error(_0x281299(0x19a)+_0x1daa71['UJHDP']);const {selected:_0x41ee3a}=await _0x3ecf9a[_0x281299(0x178)]([{'type':_0x281299(0x175),'name':'selected','message':'Select\x20an\x20organization:','choices':_0x140591['map'](_0x45b215=>({'name':_0x45b215['name'],'value':_0x45b215['organizationId']}))}]);_0x19de69=_0x41ee3a;}}_0x1b4dd7=await _0x1daa71['KXxAE'](refreshTokenWithOrg,_0x265c35,_0x1b4dd7['refresh_token'],_0x19de69);}process['stdout'][_0x281299(0x16d)](_0x1daa71[_0x281299(0x162)]);const _0x102da4=await provisionCliToken(_0x1b4dd7[_0x281299(0x19c)]);return console[_0x281299(0x168)]('\x20✓'),await _0x1daa71['nXRPU'](storeToken,_0x102da4['token']),_0x1b4dd7['refresh_token']&&await storeRefreshToken(_0x1b4dd7[_0x281299(0x189)]),_0x102da4['token'];}function sleep(_0x3988fd){return new Promise(_0x236b6a=>setTimeout(_0x236b6a,_0x3988fd));}
|
|
1
|
+
const _0x3079c0=_0x6896;(function(_0x275fee,_0x1286a3){const _0xc6a615=_0x6896,_0x51fb3d=_0x275fee();while(!![]){try{const _0x23b49f=-parseInt(_0xc6a615(0x120))/0x1*(-parseInt(_0xc6a615(0x119))/0x2)+parseInt(_0xc6a615(0x121))/0x3+-parseInt(_0xc6a615(0x150))/0x4+parseInt(_0xc6a615(0x13d))/0x5*(-parseInt(_0xc6a615(0x110))/0x6)+parseInt(_0xc6a615(0x111))/0x7*(-parseInt(_0xc6a615(0x10a))/0x8)+-parseInt(_0xc6a615(0x134))/0x9+parseInt(_0xc6a615(0x132))/0xa;if(_0x23b49f===_0x1286a3)break;else _0x51fb3d['push'](_0x51fb3d['shift']());}catch(_0x2b9a76){_0x51fb3d['push'](_0x51fb3d['shift']());}}}(_0x6d35,0x48dc1));import{spawn}from'child_process';import _0x55ccba from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x3079c0(0x12b),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0xc98650){const _0x62f824=_0x3079c0,_0x495cc0={'VhuvB':function(_0x5772c2,_0x1d3657,_0x1b3c71){return _0x5772c2(_0x1d3657,_0x1b3c71);},'Jseaq':'POST'},_0x1b844c=await _0x495cc0['VhuvB'](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x495cc0['Jseaq'],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0xc98650})});if(!_0x1b844c['ok']){const _0x2dead3=await _0x1b844c['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x1b844c[_0x62f824(0x11d)]+'\x20'+_0x2dead3);}return _0x1b844c[_0x62f824(0x156)]();}export async function pollForTokens(_0x3f9c74,_0x181aec,_0x52400e,_0x6ad26b){const _0x3f654f=_0x3079c0,_0x5e0405={'WFQyo':function(_0x5a7119,_0x1f08a7){return _0x5a7119*_0x1f08a7;},'BhHje':function(_0x53d12b,_0xfda20b){return _0x53d12b*_0xfda20b;},'QrqBW':function(_0x506e2c,_0x1b6586){return _0x506e2c(_0x1b6586);},'sGAHM':'application/x-www-form-urlencoded','oaFBX':'urn:ietf:params:oauth:grant-type:device_code','PYNTW':function(_0x486654,_0x954046){return _0x486654===_0x954046;},'OtjWm':'authorization_pending','XYSUM':'slow_down','SwwPL':_0x3f654f(0x142)},_0x4c7462=Date['now']()+_0x5e0405['WFQyo'](_0x6ad26b,0x3e8);let _0x9c43bf=_0x5e0405[_0x3f654f(0x125)](_0x52400e,0x3e8);while(Date[_0x3f654f(0x15d)]()<_0x4c7462){await _0x5e0405[_0x3f654f(0x10c)](sleep,_0x9c43bf);const _0x42cfd5=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x5e0405[_0x3f654f(0x12a)]},'body':new URLSearchParams({'client_id':_0x3f9c74,'device_code':_0x181aec,'grant_type':_0x5e0405['oaFBX']})});if(_0x42cfd5['ok'])return _0x42cfd5[_0x3f654f(0x156)]();const _0x53915e=await _0x42cfd5[_0x3f654f(0x156)]();if(_0x5e0405[_0x3f654f(0x133)](_0x53915e['error'],_0x5e0405[_0x3f654f(0x114)]))continue;if(_0x53915e['error']===_0x5e0405['XYSUM']){_0x9c43bf+=0x3e8;continue;}throw new Error(_0x53915e['error_description']||_0x53915e['error']||_0x5e0405[_0x3f654f(0x14c)]);}throw new Error(_0x3f654f(0x157));}function _0x6d35(){const _0x1ccfde=['xdg-open','tHAJp','POST','SwwPL','email','text','/api-keys','374380OGlVgr','platform','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','utf-8','Using\x20organization:\x20','user_code','json','Device\x20authorization\x20timed\x20out','split','/organization/me','CKInY','NuIGL','ybCXh','now','stdout','8yAJSSI','workosClientId','QrqBW','mcp:write','Select\x20an\x20organization:','organizationId','296580LFngNt','1531327TLRALl','Failed\x20to\x20provision\x20API\x20key:\x20','toString','OtjWm','name','GET','hPZgp','XfRTQ','2ZukvZp','ignore','token','length','status','unref','OPYOV','129831vLCtEx','64938CsGKRo','device_code','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','/organization/self-serve-signup','BhHje','cxVEz','CLI\x20Key','uclcS','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','sGAHM','https://api.workos.com/user_management/authorize/device','log','guZYE','Failed\x20to\x20create\x20organization:\x20','refresh_token','application/json','prompt','10225380qqMVhd','PYNTW','620334XTKFIt','WUEnb','VbJKx','stringify','base64url','BUktN','org_id','access_token','Waiting\x20for\x20authentication...','50YYEocA','BPeOI','PvbPO','verification_uri_complete','/cli-auth/token','Authentication\x20failed','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','crqTY','win32','start','Code:\x20','mqeRZ'];_0x6d35=function(){return _0x1ccfde;};return _0x6d35();}async function fetchUserProfile(_0x110f45){const _0x4b7503=_0x3079c0,_0x3151c7={'dmHrR':function(_0x490e31,_0x25daca,_0x4be243){return _0x490e31(_0x25daca,_0x4be243);},'FySVb':_0x4b7503(0x116)},_0x266c4f=getApiBaseUrl();try{const _0x30cc5c=await _0x3151c7['dmHrR'](fetch,_0x266c4f+_0x4b7503(0x159),{'method':_0x3151c7['FySVb'],'headers':{'workos-token':_0x110f45}});if(_0x30cc5c['ok'])return _0x30cc5c[_0x4b7503(0x156)]();}catch{}return null;}function buildKeyName(_0xa0b362,_0x58198c){const _0x43bd6f=_0x3079c0,_0x366f60={'VbJKx':function(_0xe20bdf,_0x26a053){return _0xe20bdf===_0x26a053;}},_0x1e6ef2=_0x58198c['filter'](_0x1d88ce=>_0x1d88ce['name']===_0xa0b362||_0x1d88ce[_0x43bd6f(0x115)]['startsWith'](_0xa0b362+'\x20('));if(_0x366f60[_0x43bd6f(0x136)](_0x1e6ef2['length'],0x0))return _0xa0b362;return _0xa0b362+'\x20('+(_0x1e6ef2['length']+0x1)+')';}export async function provisionApiKey(_0x10aa0a){const _0x10ac2d=_0x3079c0,_0x209978={'hgNbL':function(_0x4ec6d7){return _0x4ec6d7();},'ybCXh':function(_0x35ed33,_0xcb9fd3){return _0x35ed33(_0xcb9fd3);},'JuARX':_0x10ac2d(0x127),'aYzis':_0x10ac2d(0x116),'vVHTz':function(_0x129c06,_0x58dc5a,_0x268cf6){return _0x129c06(_0x58dc5a,_0x268cf6);},'bYzXP':_0x10ac2d(0x10d)},_0x456a60=_0x209978['hgNbL'](getApiBaseUrl),_0x23abec={'Content-Type':'application/json','workos-token':_0x10aa0a},_0x4a1e96=await _0x209978[_0x10ac2d(0x15c)](fetchUserProfile,_0x10aa0a),_0x3a8d40=_0x4a1e96?.['firstName']||_0x4a1e96?.[_0x10ac2d(0x14d)]?.['split']('@')[0x0],_0x1e13ad=_0x3a8d40?_0x3a8d40+'\x27s\x20CLI\x20Key':_0x209978['JuARX'];let _0x1c4a4e=[];try{const _0x51a843=await fetch(_0x456a60+'/api-keys',{'method':_0x209978['aYzis'],'headers':_0x23abec});if(_0x51a843['ok']){const _0x55c0a3=await _0x51a843[_0x10ac2d(0x156)]();_0x1c4a4e=_0x55c0a3['apiKeys'];}}catch{}const _0x11b7d4=_0x209978['vVHTz'](buildKeyName,_0x1e13ad,_0x1c4a4e),_0xdac60e=await fetch(_0x456a60+_0x10ac2d(0x14f),{'method':_0x10ac2d(0x14b),'headers':_0x23abec,'body':JSON[_0x10ac2d(0x137)]({'name':_0x11b7d4,'scope':_0x209978['bYzXP']})});if(!_0xdac60e['ok']){const _0x2de3f0=await _0xdac60e[_0x10ac2d(0x14e)]();throw new Error(_0x10ac2d(0x112)+_0xdac60e[_0x10ac2d(0x11d)]+'\x20'+_0x2de3f0);}const _0x8b91ec=await _0xdac60e[_0x10ac2d(0x156)]();return _0x8b91ec['apiKey'][_0x10ac2d(0x11b)];}export function openBrowser(_0x54790e){const _0x14b68e=_0x3079c0,_0x58b20c={'guZYE':function(_0x36d5eb,_0x431634,_0x501014,_0x54ff4d){return _0x36d5eb(_0x431634,_0x501014,_0x54ff4d);},'uclcS':_0x14b68e(0x146),'OPYOV':function(_0x28c804,_0xe489a2){return _0x28c804===_0xe489a2;},'mqeRZ':'darwin','tHAJp':_0x14b68e(0x149),'BUktN':_0x14b68e(0x11a)};try{if(process['platform']===_0x14b68e(0x145)){const _0x490d86=_0x58b20c[_0x14b68e(0x12d)](spawn,'cmd',['/c',_0x58b20c[_0x14b68e(0x128)],'',_0x54790e],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0x490d86[_0x14b68e(0x11e)]();return;}const _0x1f3d8c=_0x58b20c[_0x14b68e(0x11f)](process[_0x14b68e(0x151)],_0x58b20c[_0x14b68e(0x148)])?'open':_0x58b20c[_0x14b68e(0x14a)],_0x5815d2=spawn(_0x1f3d8c,[_0x54790e],{'detached':!![],'stdio':_0x58b20c[_0x14b68e(0x139)]});_0x5815d2['unref']();}catch{}}function decodeJwtPayload(_0x545db2){const _0x33c84d=_0x3079c0,_0x33b4c8={'CKInY':_0x33c84d(0x138),'arjyd':_0x33c84d(0x153)},_0x326708=_0x545db2[_0x33c84d(0x158)]('.');if(_0x326708[_0x33c84d(0x11c)]!==0x3)throw new Error('Invalid\x20JWT\x20format');const _0x4ca901=Buffer['from'](_0x326708[0x1],_0x33b4c8[_0x33c84d(0x15a)])[_0x33c84d(0x113)](_0x33b4c8['arjyd']);return JSON['parse'](_0x4ca901);}async function selfServeSignup(_0x1544ad){const _0x5af05d=_0x3079c0,_0x18c5be={'RdxEH':function(_0x5cb775){return _0x5cb775();},'WUEnb':function(_0x36272e,_0x3eaaf7,_0x3a8baa){return _0x36272e(_0x3eaaf7,_0x3a8baa);},'QucnA':_0x5af05d(0x130)},_0x2335aa=_0x18c5be['RdxEH'](getApiBaseUrl),_0x36c4ae=await _0x18c5be[_0x5af05d(0x135)](fetch,_0x2335aa+_0x5af05d(0x124),{'method':'POST','headers':{'Content-Type':_0x18c5be['QucnA'],'workos-token':_0x1544ad}});if(!_0x36c4ae['ok']){const _0x4ee00a=await _0x36c4ae['text']();throw new Error(_0x5af05d(0x12e)+_0x36c4ae['status']+'\x20'+_0x4ee00a);}return _0x36c4ae[_0x5af05d(0x156)]();}async function fetchMyMemberships(_0x41d25f){const _0x3b2321=_0x3079c0,_0x1d8a72=getApiBaseUrl(),_0x5f14e0=await fetch(_0x1d8a72+'/organization/my-memberships',{'method':'GET','headers':{'workos-token':_0x41d25f}});if(!_0x5f14e0['ok']){const _0xb7cb61=await _0x5f14e0[_0x3b2321(0x14e)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x5f14e0[_0x3b2321(0x11d)]+'\x20'+_0xb7cb61);}const _0x5059e0=await _0x5f14e0[_0x3b2321(0x156)]();return _0x5059e0['memberships'];}async function refreshTokenWithOrg(_0x3eba38,_0x310e86,_0x5e01cb){const _0x277dea=_0x3079c0,_0x17120a={'WJpPz':function(_0x1d247d,_0x5d7cf2,_0x511d7a){return _0x1d247d(_0x5d7cf2,_0x511d7a);}},_0x12658a=await _0x17120a['WJpPz'](fetch,WORKOS_TOKEN_URL,{'method':_0x277dea(0x14b),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x3eba38,'grant_type':'refresh_token','refresh_token':_0x310e86,'organization_id':_0x5e01cb})});if(!_0x12658a['ok']){const _0x2695c9=await _0x12658a['text']();throw new Error(_0x277dea(0x123)+_0x12658a[_0x277dea(0x11d)]+'\x20'+_0x2695c9);}return _0x12658a['json']();}function _0x6896(_0x5b073e,_0x13c7e2){_0x5b073e=_0x5b073e-0x109;const _0x6d35fe=_0x6d35();let _0x6896c2=_0x6d35fe[_0x5b073e];return _0x6896c2;}async function provisionCliToken(_0x3cc64a){const _0xd71070=_0x3079c0,_0x5bf2c1={'wXwwt':function(_0x204075){return _0x204075();},'BPeOI':function(_0x45f177,_0x3edfe7,_0x37135e){return _0x45f177(_0x3edfe7,_0x37135e);},'PvbPO':_0xd71070(0x14b)},_0x4dc5eb=_0x5bf2c1['wXwwt'](getApiBaseUrl),_0x3bb023=await _0x5bf2c1[_0xd71070(0x13e)](fetch,_0x4dc5eb+_0xd71070(0x141),{'method':_0x5bf2c1[_0xd71070(0x13f)],'headers':{'Content-Type':_0xd71070(0x130),'workos-token':_0x3cc64a}});if(!_0x3bb023['ok']){const _0x49ec35=await _0x3bb023['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x3bb023[_0xd71070(0x11d)]+'\x20'+_0x49ec35);}return _0x3bb023[_0xd71070(0x156)]();}export async function runDeviceAuthFlow(){const _0x1f6a0d=_0x3079c0,_0x553ae7={'fQMZG':function(_0x21ecdf){return _0x21ecdf();},'crqTY':function(_0xca1d1f,_0x1dc121){return _0xca1d1f===_0x1dc121;},'lPYMr':'Setting\x20up\x20your\x20organization...','UPgUL':function(_0x5e3439,_0x2babb2){return _0x5e3439+_0x2babb2;},'hPZgp':_0x1f6a0d(0x129),'XfRTQ':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','cxVEz':'list','aiXDA':_0x1f6a0d(0x10e),'NuIGL':function(_0x3d83dd,_0x45b2d7,_0x45c2e3,_0x2b229b){return _0x3d83dd(_0x45b2d7,_0x45c2e3,_0x2b229b);},'PYRAc':function(_0x34a4d7,_0x269d09){return _0x34a4d7(_0x269d09);}},_0x1da778=_0x553ae7['fQMZG'](getCurrentEnvironment),_0x3ec6e1=ENVIRONMENT_CONFIGS[_0x1da778][_0x1f6a0d(0x10b)],_0x29aa83=await requestDeviceCode(_0x3ec6e1);console['log']('\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...'),console['log'](_0x1f6a0d(0x143)),openBrowser(_0x29aa83[_0x1f6a0d(0x140)]),console[_0x1f6a0d(0x12c)](_0x1f6a0d(0x152)+_0x29aa83['verification_uri_complete']),console['log'](_0x1f6a0d(0x147)+_0x29aa83[_0x1f6a0d(0x155)]+'\x0a'),process[_0x1f6a0d(0x109)]['write'](_0x1f6a0d(0x13c));let _0x42c634=await pollForTokens(_0x3ec6e1,_0x29aa83[_0x1f6a0d(0x122)],_0x29aa83['interval'],_0x29aa83['expires_in']);console[_0x1f6a0d(0x12c)]('\x20✓');const _0x3e3599=decodeJwtPayload(_0x42c634['access_token']);if(!_0x3e3599[_0x1f6a0d(0x13a)]){const _0x211411=await fetchMyMemberships(_0x42c634['access_token']);let _0x21e6de;if(_0x553ae7[_0x1f6a0d(0x144)](_0x211411[_0x1f6a0d(0x11c)],0x0)){process[_0x1f6a0d(0x109)]['write'](_0x553ae7['lPYMr']);const _0x1cc1ce=await selfServeSignup(_0x42c634[_0x1f6a0d(0x13b)]);_0x21e6de=_0x1cc1ce['organizationId'],console['log']('\x20✓');}else{if(_0x553ae7[_0x1f6a0d(0x144)](_0x211411[_0x1f6a0d(0x11c)],0x1))_0x21e6de=_0x211411[0x0][_0x1f6a0d(0x10f)],console['log'](_0x1f6a0d(0x154)+_0x211411[0x0][_0x1f6a0d(0x115)]);else{const _0x20dc7f=process['stdin']['isTTY']&&process['stdout']['isTTY'];if(!_0x20dc7f)throw new Error(_0x553ae7['UPgUL'](_0x553ae7[_0x1f6a0d(0x117)],_0x553ae7[_0x1f6a0d(0x118)]));const {selected:_0x172061}=await _0x55ccba[_0x1f6a0d(0x131)]([{'type':_0x553ae7[_0x1f6a0d(0x126)],'name':'selected','message':_0x553ae7['aiXDA'],'choices':_0x211411['map'](_0x588761=>({'name':_0x588761['name'],'value':_0x588761['organizationId']}))}]);_0x21e6de=_0x172061;}}_0x42c634=await _0x553ae7[_0x1f6a0d(0x15b)](refreshTokenWithOrg,_0x3ec6e1,_0x42c634['refresh_token'],_0x21e6de);}process[_0x1f6a0d(0x109)]['write']('Provisioning\x20CLI\x20token...');const _0x5824f7=await provisionCliToken(_0x42c634[_0x1f6a0d(0x13b)]);return console[_0x1f6a0d(0x12c)]('\x20✓'),await _0x553ae7['PYRAc'](storeToken,_0x5824f7['token']),_0x42c634['refresh_token']&&await _0x553ae7['PYRAc'](storeRefreshToken,_0x42c634[_0x1f6a0d(0x12f)]),_0x5824f7['token'];}function sleep(_0x1a310a){return new Promise(_0x456cc2=>setTimeout(_0x456cc2,_0x1a310a));}
|