@ranger-testing/ranger-cli 3.1.1 → 3.1.2-alpha.059c7a3-40
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/deleteProfile.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 -1
- 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/novaActCli.js +1 -1
- package/build/commands/utils/opencodeConfig.js +1 -1
- package/build/commands/utils/organizationEnvApi.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/rangerwrightCli.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/tunnelClient.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/commands/verifyFeatureNovaCli.js +1 -1
- package/build/commands/verifyFeatureRangerwrightCli.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x23f75b=_0x57dc;(function(_0x3a9343,_0x59e466){const _0x57b112=_0x57dc,_0x51b97b=_0x3a9343();while(!![]){try{const _0x4ca432=-parseInt(_0x57b112(0xfc))/0x1*(-parseInt(_0x57b112(0xd1))/0x2)+parseInt(_0x57b112(0x137))/0x3+parseInt(_0x57b112(0x134))/0x4*(-parseInt(_0x57b112(0xdf))/0x5)+-parseInt(_0x57b112(0x101))/0x6*(parseInt(_0x57b112(0x135))/0x7)+-parseInt(_0x57b112(0xef))/0x8+-parseInt(_0x57b112(0xec))/0x9+-parseInt(_0x57b112(0xe8))/0xa*(-parseInt(_0x57b112(0xd4))/0xb);if(_0x4ca432===_0x59e466)break;else _0x51b97b['push'](_0x51b97b['shift']());}catch(_0x31269d){_0x51b97b['push'](_0x51b97b['shift']());}}}(_0x23da,0x378f0));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x51042b 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';function _0x23da(){const _0x419019=['JjlPi','name','pw_endpoint','url','RvMYo','Browser\x20login\x20timed\x20out\x20after\x20','loginInstructions','Browser\x20login\x20timed\x20out\x20before\x20completion.','agent','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','VdlTM','Cloud\x20profile\x20\x22','GCSfG','persistSessionState','BHXID','IfUNY','grBHy','password','Uzdto','/api/v1/profiles/','some','/api/v1/profiles','/api/v1/profiles/auth-config','prompt','LWBhh','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','RGbCg','\x20\x20Cloud\x20session\x20for\x20\x22','oNBSq','RANGER_TEST_PASSWORD','length','SWggP','sessionCheckPath','clientIp','log','cFOfj','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','zxLbB','djlhL','4eTOhpY','7HXAUlz','IaUMt','154146aMlOHz','TIvLj','stringify','SsnOv','not_configured','QgkGw','Aenrk','save','\x20\x20Created\x20cloud\x20profile\x20\x22','\x20\x20No\x20live\x20session\x20for\x20\x22','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','aLwYn','TuyRq','kDjBS','defaultEnvironmentKey','string','headers','FwDIv','zDNwK','BhrQo','POST','newPage','AJzpS','username','qENjb','isArray','env','pwEndpoint','message','statusText','3|0|4|1|2','close','GcBJN','lybXB','RANGER_TEST_USERNAME','wsEndpoint','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','domains','YrBCO','):\x20','code','iCgRh','cli:manual-login','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','tunnel','10118zwiPeq','tgQro','JVten','3278ZZDKoa','\x22\x20failed\x20validation\x20—\x20refreshing...','Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.','join','extraHTTPHeaders','lRaXg','ZmLNV','origin','keys','catch','detail','1695020nWzigi','TRreX','aGfyD','OplNq','\x22\x20on\x20profile\x20\x22','push','status','force','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','35050EENnGc','setupHeaders','environmentKey','ziCPq','516024DPFTnf','LDqDQ','EnfnF','2886512UTJSUQ','/login','sessionState','BicaO','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','about:blank','tunnelUrl','pcNee','kJiyS','baseUrl','AVUyF','PUT','settings','9bYPIaF','split','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','/session','DELETE','940086PfIfFd','\x22.\x0a','userAgent','ExJGE','storageStatePath','sessionId','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','newContext','ypEKa','\x20\x20forceLogin\x20enabled\x20for\x20\x22','/api/v1/tunnel/sessions','organizationId'];_0x23da=function(){return _0x419019;};return _0x23da();}import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x345847={'MivKS':function(_0x16fd09){return _0x16fd09();},'vsDDs':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x50cb41=await _0x345847['MivKS'](getToken);if(!_0x50cb41)throw new Error(_0x345847['vsDDs']);return _0x50cb41;}async function apiRequest(_0x3ad6ec,_0x6db130={}){const _0x4bb7ee=_0x57dc,_0x5dcbbf={'aTwIP':function(_0xc71af0,_0x3d7aef,_0x39cc26){return _0xc71af0(_0x3d7aef,_0x39cc26);},'BicaO':'application/json','aqORv':function(_0x59aa1f,_0x29d4ea){return _0x59aa1f===_0x29d4ea;},'afNpR':_0x4bb7ee(0xb3)},_0x410bef=await requireToken(),_0xfc715d=getApiBaseUrl(),_0x443eca=await _0x5dcbbf['aTwIP'](fetch,''+_0xfc715d+_0x3ad6ec,{..._0x6db130,'headers':{'Authorization':'Bearer\x20'+_0x410bef,'Content-Type':_0x5dcbbf[_0x4bb7ee(0xf2)],..._0x6db130[_0x4bb7ee(0xb4)]??{}}});if(!_0x443eca['ok']){let _0x463334='',_0x1ceeec;try{const _0x169ad2=await _0x443eca['json']();_0x463334=(_0x5dcbbf['aqORv'](typeof _0x169ad2['error'],'string')?_0x169ad2['error']:undefined)??JSON[_0x4bb7ee(0xa4)](_0x169ad2);if(typeof _0x169ad2['code']===_0x5dcbbf['afNpR'])_0x1ceeec=_0x169ad2['code'];}catch{_0x463334=_0x443eca[_0x4bb7ee(0xc1)];}throw new ApiError('API\x20request\x20'+_0x3ad6ec+'\x20failed\x20('+_0x443eca[_0x4bb7ee(0xe5)]+_0x4bb7ee(0xcb)+_0x463334,_0x443eca['status'],_0x463334,_0x1ceeec);}if(_0x443eca[_0x4bb7ee(0xe5)]===0xcc)return undefined;return _0x443eca['json']();}export class ApiError extends Error{['status'];['detail'];['code'];constructor(_0x4869f7,_0x29a9ff,_0x37a170,_0x4ae399){const _0x3e31b1=_0x57dc,_0x11d106={'ZCgbE':_0x3e31b1(0xc2),'TIvLj':'ApiError'},_0x4b3e2c=_0x11d106['ZCgbE'][_0x3e31b1(0xfd)]('|');let _0x5ba7c6=0x0;while(!![]){switch(_0x4b3e2c[_0x5ba7c6++]){case'0':this[_0x3e31b1(0xe5)]=_0x29a9ff;continue;case'1':this[_0x3e31b1(0xcc)]=_0x4ae399;continue;case'2':this[_0x3e31b1(0x10e)]=_0x11d106[_0x3e31b1(0xa3)];continue;case'3':super(_0x4869f7);continue;case'4':this[_0x3e31b1(0xde)]=_0x37a170;continue;}break;}}}export async function fetchCloudProfile(_0x2320d6){const _0xbbb7b3=_0x57dc,_0x1159c2={'SsnOv':function(_0x39eaeb,_0x596cb9){return _0x39eaeb(_0x596cb9);}};try{return await apiRequest(_0xbbb7b3(0x120)+_0x1159c2[_0xbbb7b3(0xa5)](encodeURIComponent,_0x2320d6));}catch(_0x5c792f){if(_0x5c792f instanceof ApiError&&_0x5c792f['status']===0x194)return null;throw _0x5c792f;}}export async function listCloudProfiles(){const _0x49daa0=await apiRequest('/api/v1/profiles');return _0x49daa0['profiles'];}export async function deleteCloudProfile(_0x3ffd56){const _0xe30e6=_0x57dc,_0x49b89e={'xWrla':function(_0x3b54b4,_0x276718,_0x365ecb){return _0x3b54b4(_0x276718,_0x365ecb);},'Uzdto':function(_0x40fb59,_0x4db215){return _0x40fb59(_0x4db215);},'zxLbB':'DELETE','ypEKa':function(_0x48efba,_0x1869ed){return _0x48efba===_0x1869ed;}};try{await _0x49b89e['xWrla'](apiRequest,'/api/v1/profiles/'+_0x49b89e[_0xe30e6(0x11f)](encodeURIComponent,_0x3ffd56),{'method':_0x49b89e[_0xe30e6(0x132)]});}catch(_0x5c3717){if(_0x5c3717 instanceof ApiError&&_0x49b89e[_0xe30e6(0x109)](_0x5c3717['status'],0x194))throw new Error(_0xe30e6(0x118)+_0x3ffd56+'\x22\x20not\x20found.');throw _0x5c3717;}}export async function createCloudProfile(_0x15148b,_0x586845,_0x2fc1e7={}){const _0x431ee9=_0x57dc,_0x5d80bf={'aLwYn':function(_0x6d9c43,_0x14a3b7){return _0x6d9c43>_0x14a3b7;},'kJiyS':function(_0x2b8435,_0x35196b,_0x835023){return _0x2b8435(_0x35196b,_0x835023);},'aGfyD':_0x431ee9(0xb8)},_0x4b7541={'name':_0x15148b};if(_0x586845)_0x4b7541['environment_key']=_0x586845;_0x2fc1e7[_0x431ee9(0xfb)]&&_0x5d80bf[_0x431ee9(0xaf)](Object[_0x431ee9(0xdc)](_0x2fc1e7['settings'])['length'],0x0)&&(_0x4b7541[_0x431ee9(0xfb)]=_0x2fc1e7[_0x431ee9(0xfb)]);if(_0x2fc1e7[_0x431ee9(0xbb)])_0x4b7541['username']=_0x2fc1e7[_0x431ee9(0xbb)];if(_0x2fc1e7['password'])_0x4b7541['password']=_0x2fc1e7[_0x431ee9(0x11e)];return await _0x5d80bf[_0x431ee9(0xf7)](apiRequest,_0x431ee9(0x122),{'method':_0x5d80bf[_0x431ee9(0xe1)],'body':JSON[_0x431ee9(0xa4)](_0x4b7541)});}export async function uploadCloudProfileSession(_0x484ead,_0x3518c8){const _0x21f0c5=_0x57dc,_0x57274e={'FwDIv':function(_0x1f4ebd,_0x530a5e,_0x1d7f19){return _0x1f4ebd(_0x530a5e,_0x1d7f19);}};return await _0x57274e[_0x21f0c5(0xb5)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x484ead)+'/session',{'method':_0x21f0c5(0xb8),'body':JSON[_0x21f0c5(0xa4)]({'session_state':_0x3518c8})});}export async function saveCloudProfileCredentials(_0x19dd69,_0x433ddb,_0x40771a){const _0x5e3b52=_0x57dc,_0x4a39b8={'mzqlu':function(_0x4bb6b3,_0x16debf,_0x21422d){return _0x4bb6b3(_0x16debf,_0x21422d);},'AVUyF':function(_0x3c8901,_0x59a261){return _0x3c8901(_0x59a261);},'AJzpS':_0x5e3b52(0xfa)};await _0x4a39b8['mzqlu'](apiRequest,_0x5e3b52(0x120)+_0x4a39b8[_0x5e3b52(0xf9)](encodeURIComponent,_0x19dd69),{'method':_0x4a39b8[_0x5e3b52(0xba)],'body':JSON[_0x5e3b52(0xa4)]({'username':_0x433ddb,'password':_0x40771a})});}export async function fetchAuthConfig(){const _0x2ccf84=_0x57dc,_0x2e2cce={'RvMYo':function(_0x3dbeed,_0x2a33da){return _0x3dbeed(_0x2a33da);},'LWBhh':_0x2ccf84(0x123)};try{const _0x19cbc0=await _0x2e2cce[_0x2ccf84(0x111)](apiRequest,_0x2e2cce[_0x2ccf84(0x125)]);return _0x19cbc0['auth_config'];}catch(_0x1a5a7d){return _0x1a5a7d instanceof ApiError&&_0x1a5a7d[_0x2ccf84(0xe5)]!==0x194&&console['error']('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x1a5a7d[_0x2ccf84(0xc0)]),null;}}async function createTunnelSession(_0x32b0d2){const _0x4eb96a=_0x57dc,_0x381ddd={'VVtfn':_0x4eb96a(0x10b),'ziCPq':'POST'};return await apiRequest(_0x381ddd['VVtfn'],{'method':_0x381ddd[_0x4eb96a(0xeb)],'body':JSON[_0x4eb96a(0xa4)]({'targetUrl':_0x32b0d2,'mode':_0x4eb96a(0x115)})});}async function deleteTunnelSession(_0xc8e87e){const _0x4fecff=_0x57dc;await apiRequest('/api/v1/tunnel/sessions/'+_0xc8e87e,{'method':_0x4fecff(0x100)});}export function pickAdHocEnvKey(_0x2233cb){const _0x3017df=_0x57dc,_0x3e5391={'YrBCO':function(_0x27fcc0,_0x25886e){return _0x27fcc0===_0x25886e;},'ExJGE':function(_0x5a67f3,_0x1a8a1d){return _0x5a67f3+_0x1a8a1d;}};if(!_0x2233cb)return null;if(_0x2233cb[_0x3017df(0xb2)])return _0x2233cb['defaultEnvironmentKey'];const _0x182adc=Object[_0x3017df(0xdc)](_0x2233cb['environments']??{});if(_0x182adc['length']===0x1)return _0x182adc[0x0];if(_0x3e5391[_0x3017df(0xca)](_0x182adc['length'],0x0))return null;throw new Error(_0x3e5391[_0x3017df(0x104)]('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x182adc[_0x3017df(0xd7)](',\x20')+').\x20',_0x3017df(0xd6)));}export async function resolveAdHocProfile(_0xd21982=process[_0x23f75b(0xbe)]){const _0x2e9811=_0x23f75b,_0x4b3849={'BPYgo':function(_0x50f09c,_0x1e025a){return _0x50f09c(_0x1e025a);}},_0x442892=_0xd21982[_0x2e9811(0xc6)];if(!_0x442892)return null;const _0x12156f=await fetchCloudProfile(_0x442892);if(_0x12156f)return{'name':_0x12156f['name'],'profile':_0x12156f};const _0x2987cb=await fetchAuthConfig(),_0x367c98=_0x4b3849['BPYgo'](pickAdHocEnvKey,_0x2987cb),_0xfa0739=_0xd21982['RANGER_TEST_PASSWORD'],_0x34b863=await createCloudProfile(_0x442892,_0x367c98??undefined,{'username':_0x442892,'password':_0xfa0739});return console['log'](_0x2e9811(0xaa)+_0x34b863[_0x2e9811(0x10e)]+'\x22\x20for\x20'+_0x442892),{'name':_0x34b863[_0x2e9811(0x10e)],'profile':_0x34b863};}export async function writeSessionToLocalCache(_0x9450b6,_0x363882,_0xfb00ad,_0x413c46,_0x53be15,_0x31c91c,_0x1edd9c){const _0x1cac7d=_0x23f75b,_0x14530e={'zDNwK':function(_0x5911ac,_0x5b287c){return _0x5911ac(_0x5b287c);},'OplNq':function(_0x1d600b,_0x9ddce9,_0xa544a1){return _0x1d600b(_0x9ddce9,_0xa544a1);},'EpGnr':function(_0x3c00a6){return _0x3c00a6();},'TRreX':function(_0x320158,_0x5f3666,_0x1fda6a){return _0x320158(_0x5f3666,_0x1fda6a);},'GCSfG':function(_0x35b89d,_0xbcba7,_0x5643df){return _0x35b89d(_0xbcba7,_0x5643df);}},_0x329178=_0x14530e[_0x1cac7d(0xb6)](sessionCacheHash,{'orgId':_0x363882,'profileName':_0x9450b6,'effectiveBaseUrl':_0xfb00ad,'setupHeaders':_0x413c46,'invalidateOn':_0x1edd9c?.['invalidateOn'],'userAgent':_0x1edd9c?.[_0x1cac7d(0x103)],'clientIp':_0x1edd9c?.[_0x1cac7d(0x12e)]}),_0x5b0f1b=getSessionCachePath(_0x329178,_0x9450b6),_0x15279e=_0x14530e[_0x1cac7d(0xe2)](join,_0x14530e['EpGnr'](getRangerHomeDir),'auth');!_0x14530e['zDNwK'](existsSync,_0x15279e)&&await mkdir(_0x15279e,{'recursive':!![]});const _0x1783c8={..._0x53be15};_0x31c91c&&_0x31c91c[_0x1cac7d(0x12b)]>0x0&&Array[_0x1cac7d(0xbd)](_0x1783c8['cookies'])&&(_0x1783c8['cookies']=_0x14530e[_0x1cac7d(0xe0)](duplicateCookiesForDomains,_0x1783c8['cookies'],_0x31c91c));const _0x1fe47d={'cached_at':new Date()['toISOString'](),'session_state':_0x1783c8};await writeFile(_0x5b0f1b,JSON['stringify'](_0x1fe47d,null,0x2));const _0x142cf0=getStorageStatePath(_0x5b0f1b);return await _0x14530e[_0x1cac7d(0x119)](writeFile,_0x142cf0,JSON['stringify'](_0x1783c8,null,0x2)),_0x142cf0;}function _0x57dc(_0xe5e70e,_0x4c9110){_0xe5e70e=_0xe5e70e-0xa3;const _0x23da57=_0x23da();let _0x57dcee=_0x23da57[_0xe5e70e];return _0x57dcee;}export async function checkLocalCache(_0xc79676,_0x31e7d7,_0x15ef32,_0x3ce630,_0x4ad435){const _0x302268=_0x23f75b,_0x42f971={'QgkGw':function(_0x42c9bd,_0x5204b6){return _0x42c9bd(_0x5204b6);},'BHXID':function(_0x1e5a2a,_0x1b243e,_0x2c6794){return _0x1e5a2a(_0x1b243e,_0x2c6794);},'lRaXg':function(_0x4f4559,_0x35baae){return _0x4f4559(_0x35baae);}},_0x3f87e1=_0x42f971[_0x302268(0xa7)](sessionCacheHash,{'orgId':_0x31e7d7,'profileName':_0xc79676,'effectiveBaseUrl':_0x15ef32,'setupHeaders':_0x3ce630,'invalidateOn':_0x4ad435?.['invalidateOn'],'userAgent':_0x4ad435?.[_0x302268(0x103)],'clientIp':_0x4ad435?.[_0x302268(0x12e)]}),_0x2c0b20=_0x42f971[_0x302268(0x11b)](getSessionCachePath,_0x3f87e1,_0xc79676),_0x2bb48f=getStorageStatePath(_0x2c0b20);if(!_0x42f971[_0x302268(0xd9)](existsSync,_0x2c0b20)||!existsSync(_0x2bb48f))return null;try{const _0x228fae=await readFile(_0x2c0b20,'utf-8');return JSON['parse'](_0x228fae),{'storageStatePath':_0x2bb48f};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x37b8bb,_0x5ee926){const _0x1a2e38=_0x23f75b,_0x1d2b8a={'GcBJN':function(_0x321085,_0x3801c1){return _0x321085+_0x3801c1;}};if(!_0x5ee926||!_0x5ee926[_0x1a2e38(0xc9)]?.[_0x1a2e38(0x12b)])return;let _0x53505c;try{_0x53505c=new URL(_0x37b8bb);}catch{return;}const _0x1a8907=[];for(const _0x38f735 of _0x5ee926[_0x1a2e38(0xc9)]){try{_0x1a8907[_0x1a2e38(0xe4)]({'raw':_0x38f735,'url':new URL(_0x38f735)});}catch{}}if(_0x1a8907[_0x1a2e38(0x12b)]===0x0)return;if(_0x1a8907[_0x1a2e38(0x121)](_0x13cdca=>_0x13cdca[_0x1a2e38(0x110)]['origin']===_0x53505c[_0x1a2e38(0xdb)]))return;const _0x1b0614=_0x1a8907['map'](_0x1cc741=>'\x22'+_0x1cc741['raw']+'\x22')[_0x1a2e38(0xd7)](',\x20');console[_0x1a2e38(0x12f)](_0x1d2b8a[_0x1a2e38(0xc4)]('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x1b0614+';\x20'+('you\x27re\x20now\x20at\x20\x22'+_0x37b8bb+_0x1a2e38(0xac)),_0x1a2e38(0xf3)));}export async function serverSideLogin(_0x3e3b7f,_0x4b77d6){const _0x68bc06=_0x23f75b,_0x34f9e8={'RGbCg':function(_0x43c2bd,_0x19a841,_0x1fa6e4){return _0x43c2bd(_0x19a841,_0x1fa6e4);},'CmWOg':_0x68bc06(0xb8),'MGnkA':'not_configured'},_0x55fd08=process[_0x68bc06(0xbe)]['RANGER_TEST_USERNAME'],_0x57e69e=process['env'][_0x68bc06(0x12a)],_0x2816e7={};if(_0x55fd08)_0x2816e7['username']=_0x55fd08;if(_0x57e69e)_0x2816e7[_0x68bc06(0x11e)]=_0x57e69e;if(_0x4b77d6?.['force'])_0x2816e7['force']=!![];if(_0x4b77d6?.['targetUrl'])_0x2816e7['target_url']=_0x4b77d6['targetUrl'];_0x4b77d6?.['tunnel']&&(_0x2816e7['tunnel_session_id']=_0x4b77d6[_0x68bc06(0xd0)][_0x68bc06(0x106)],_0x2816e7[_0x68bc06(0x10f)]=_0x4b77d6[_0x68bc06(0xd0)][_0x68bc06(0xbf)]);try{return await _0x34f9e8[_0x68bc06(0x127)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x3e3b7f)+_0x68bc06(0xf0),{'method':_0x34f9e8['CmWOg'],'body':JSON['stringify'](_0x2816e7)});}catch(_0x4c1c53){if(_0x4c1c53 instanceof ApiError&&_0x4c1c53['status']===0x190&&_0x4c1c53[_0x68bc06(0xcc)]===_0x68bc06(0xa6))return{'status':_0x34f9e8['MGnkA'],'error':_0x4c1c53['detail']};throw _0x4c1c53;}}async function serverSideLoginWithOptionalTunnel(_0x293f76,_0x59651f,_0x26f1cd={}){const _0x477d4d=_0x23f75b,_0x4ed684={'VdlTM':function(_0x4feaac,_0x159d87){return _0x4feaac(_0x159d87);},'fqqbi':function(_0x17da0a,_0x221ea1,_0x4c3b80){return _0x17da0a(_0x221ea1,_0x4c3b80);},'nSukh':function(_0x15f3a9,_0x752ffe){return _0x15f3a9(_0x752ffe);},'VtIQH':function(_0x335409){return _0x335409();},'qzNiW':function(_0x392f62,_0x4a33bd,_0x5e138f){return _0x392f62(_0x4a33bd,_0x5e138f);},'AuNzD':function(_0xf7c2ec,_0x158c79){return _0xf7c2ec(_0x158c79);}};if(!_0x4ed684[_0x477d4d(0x117)](needsTunnel,_0x59651f))return await _0x4ed684['fqqbi'](serverSideLogin,_0x293f76,{'force':_0x26f1cd[_0x477d4d(0xe6)]});let _0x3fa173=null,_0x358145=null,_0xb61433=null,_0x2ee709=null;try{_0x3fa173=await _0x4ed684['nSukh'](launchBrowserServer,{'headless':!![]}),_0x358145=await createTunnelSession(_0x59651f);const _0xfbcb12=await _0x4ed684['VtIQH'](requireToken);_0xb61433=await createTunnelBridge({'localWsUrl':_0x3fa173[_0x477d4d(0xc7)],'tunnelServerUrl':_0x358145[_0x477d4d(0xf5)],'sessionId':_0x358145[_0x477d4d(0x106)],'apiKey':_0xfbcb12,'onError':_0x5cd924=>{_0x2ee709=_0x5cd924;}});try{return await _0x4ed684['qzNiW'](serverSideLogin,_0x293f76,{'force':_0x26f1cd['force'],'targetUrl':_0x59651f,'tunnel':{'sessionId':_0x358145['sessionId'],'pwEndpoint':_0x358145['pwEndpoint']}});}catch(_0x5b4836){throw _0x2ee709??_0x5b4836;}}finally{_0xb61433?.['close'](),_0x3fa173&&await _0x3fa173[_0x477d4d(0xc3)]()['catch'](()=>{}),_0x358145&&await _0x4ed684['AuNzD'](deleteTunnelSession,_0x358145[_0x477d4d(0x106)])[_0x477d4d(0xdd)](()=>{});}}export async function manualBrowserLogin(_0x31b763,_0x48de83,_0x10b8d8={}){const _0x213986=_0x23f75b,_0x177f31={'qENjb':function(_0x20e43e){return _0x20e43e();},'yFKuP':function(_0x34becb,_0x514b09,_0x1d0302){return _0x34becb(_0x514b09,_0x1d0302);},'pcNee':function(_0x2a1c67,_0x34860a){return _0x2a1c67+_0x34860a;},'tgQro':_0x213986(0xcf),'MSSWI':_0x213986(0x131),'bObYi':'\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','ZmLNV':function(_0x260071,_0x5c8836){return _0x260071(_0x5c8836);},'KgYev':function(_0x4389d1,_0x38f877){return _0x4389d1&&_0x38f877;},'IfUNY':_0x213986(0x126),'kJUlg':function(_0x12664b,_0x2eb840){return _0x12664b!==_0x2eb840;},'lybXB':function(_0x291174,_0xb8ea2,_0x420adc){return _0x291174(_0xb8ea2,_0x420adc);}};if(!isInteractive())throw new Error(_0x177f31['pcNee'](_0x177f31[_0x213986(0xf6)](_0x213986(0xfe)+_0x31b763[_0x213986(0x10e)]+_0x213986(0x102),_0x177f31[_0x213986(0xd2)]),_0x213986(0xae)));const _0x439777=_0x48de83&&_0x48de83['domains'][_0x213986(0x12b)]>0x0?_0x48de83['domains'][0x0]:_0x213986(0xf4);console[_0x213986(0x12f)](_0x177f31['MSSWI']),console[_0x213986(0x12f)](_0x177f31['bObYi']),await new Promise(_0x20ea91=>setTimeout(_0x20ea91,0x7d0));const _0x2081bb=await chromium['launch']({'headless':![]});let _0x37fe0e=null;try{const _0xff3825={'ignoreHTTPSErrors':!![]};_0x48de83?.[_0x213986(0xe9)]&&(_0xff3825[_0x213986(0xd8)]=_0x48de83['setupHeaders']);const _0x4d3207=await _0x2081bb[_0x213986(0x108)](_0xff3825);await _0x177f31[_0x213986(0xda)](addProfileSetupBanner,_0x4d3207);const _0x39841f=await _0x4d3207[_0x213986(0xb9)]();await _0x39841f['goto'](_0x439777);let _0x64ec8d=![];await new Promise(_0x24967a=>{const _0x3d6ed8=_0x213986,_0x555a4f={'BhrQo':function(_0x553253){const _0x3a63f1=_0x57dc;return _0x177f31[_0x3a63f1(0xbc)](_0x553253);}},_0x15e693=_0x177f31['yFKuP'](setTimeout,()=>{const _0x105aec=_0x57dc;_0x64ec8d=!![],console['error'](_0x105aec(0x112)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x177f31[_0x105aec(0xbc)](_0x24967a);},MANUAL_LOGIN_TIMEOUT_MS);_0x39841f['on'](_0x3d6ed8(0xc3),async()=>{const _0x5b3df0=_0x3d6ed8;clearTimeout(_0x15e693);try{const _0x4d5c7c=await _0x4d3207['storageState']();_0x37fe0e=_0x4d5c7c;}catch{}_0x555a4f[_0x5b3df0(0xb7)](_0x24967a);});});if(_0x177f31['KgYev'](_0x64ec8d,!_0x37fe0e))throw new Error(_0x213986(0x114));}finally{await _0x2081bb['close']()['catch'](()=>{});}if(!_0x37fe0e)throw new Error(_0x177f31[_0x213986(0x11c)]);return _0x177f31['kJUlg'](_0x10b8d8[_0x213986(0x11a)],![])&&await _0x177f31[_0x213986(0xc5)](apiRequest,'/api/v1/profiles/'+_0x177f31[_0x213986(0xda)](encodeURIComponent,_0x31b763[_0x213986(0x10e)])+_0x213986(0xff),{'method':'POST','body':JSON[_0x213986(0xa4)]({'session_state':_0x37fe0e,'updated_by':_0x213986(0xce)})}),{'sessionState':_0x37fe0e};}export async function promptSaveCredentials(_0x2a32e3){const _0x17e4b7=_0x23f75b,_0x358ef1={'EnfnF':function(_0x3b846b,_0x391722){return _0x3b846b||_0x391722;},'oeCVd':_0x17e4b7(0xa9),'cFOfj':function(_0x5ac82c,_0x557c81){return _0x5ac82c(_0x557c81);},'iCgRh':'PUT','JjlPi':_0x17e4b7(0xad)},_0x48f2ae=process['env'][_0x17e4b7(0xc6)],_0x319f8a=process['env']['RANGER_TEST_PASSWORD'];if(_0x358ef1[_0x17e4b7(0xee)](!_0x48f2ae,!_0x319f8a))return;if(!isInteractive())return;const {save:_0x4fd0f3}=await _0x51042b[_0x17e4b7(0x124)]([{'type':'confirm','name':_0x358ef1['oeCVd'],'message':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','default':![]}]);if(!_0x4fd0f3)return;await apiRequest(_0x17e4b7(0x120)+_0x358ef1[_0x17e4b7(0x130)](encodeURIComponent,_0x2a32e3),{'method':_0x358ef1[_0x17e4b7(0xcd)],'body':JSON[_0x17e4b7(0xa4)]({'username':_0x48f2ae,'password':_0x319f8a})}),console[_0x17e4b7(0x12f)](_0x358ef1[_0x17e4b7(0x10d)]);}export async function resolveCloudProfileSession(_0x48b187,_0xf98ca9={}){const _0x18e357=_0x23f75b,_0x4d09f2={'TuyRq':function(_0x4b9176){return _0x4b9176();},'SWggP':_0x18e357(0xb3),'URmRv':function(_0x3c2713,_0x1e3530){return _0x3c2713||_0x1e3530;},'DZEwz':function(_0x35041a,_0xe3369e){return _0x35041a(_0xe3369e);},'Aenrk':function(_0x5512ad,_0x539e6d){return _0x5512ad(_0x539e6d);},'kDjBS':function(_0x57e0ae,_0x2d9f1f){return _0x57e0ae>_0x2d9f1f;},'VLtuG':function(_0x528dbf,_0x80bfd9,_0x40e301){return _0x528dbf(_0x80bfd9,_0x40e301);},'grBHy':function(_0x4e19c3,_0x31a9e6,_0x4497f3,_0x5b4d58,_0x138e89,_0x1c7eaa,_0x10c96d,_0x3b9958){return _0x4e19c3(_0x31a9e6,_0x4497f3,_0x5b4d58,_0x138e89,_0x1c7eaa,_0x10c96d,_0x3b9958);},'zbhsG':function(_0x4b8a19,_0xe15803){return _0x4b8a19||_0xe15803;},'IaUMt':function(_0x3562ce,_0x24a5a9,_0x4d2556,_0x45c057){return _0x3562ce(_0x24a5a9,_0x4d2556,_0x45c057);},'djlhL':function(_0x5c2f3c,_0x11b96d,_0x3a8d7f){return _0x5c2f3c(_0x11b96d,_0x3a8d7f);},'LDqDQ':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','soXtH':'success','dHjnJ':'\x20\x20Login\x20successful.\x20Session\x20cached.','oNBSq':function(_0x5d5779,_0x1eec0f){return _0x5d5779&&_0x1eec0f;},'WaNPI':_0x18e357(0x107),'ZqXps':function(_0x4ba64b,_0x15cb1b){return _0x4ba64b instanceof _0x15cb1b;},'JVten':function(_0x353bef,_0x1822e5,_0x484748,_0x45e4b9,_0x28fba6,_0x2cd090,_0x40e767,_0xcc19d6){return _0x353bef(_0x1822e5,_0x484748,_0x45e4b9,_0x28fba6,_0x2cd090,_0x40e767,_0xcc19d6);}},_0xb982bb=_0x48b187['settings']??{},_0x1e4538=await _0x4d09f2[_0x18e357(0xb0)](fetchAuthConfig),_0x4ed0df=_0x1e4538?resolveAuthEnvironmentLocally(_0x1e4538,_0x48b187[_0x18e357(0xea)]):null,_0x1428d7=typeof _0x4ed0df?.['loginInstructions']===_0x4d09f2[_0x18e357(0x12c)]&&_0x4ed0df['loginInstructions']['trim']()?_0x4ed0df['loginInstructions']:undefined,_0x279eb7=typeof _0xb982bb[_0x18e357(0x113)]===_0x4d09f2[_0x18e357(0x12c)]&&_0xb982bb[_0x18e357(0x113)]['trim']()?_0xb982bb[_0x18e357(0x113)]:undefined,_0x45f318=_0x4d09f2['URmRv'](_0x279eb7,!_0x1428d7)?_0xb982bb:{..._0xb982bb,'loginInstructions':_0x1428d7},_0x2102ec=_0x4d09f2['DZEwz'](Boolean,_0x45f318['loginInstructions']?.['trim']()),_0x3175fc=_0x4d09f2[_0x18e357(0xa8)](Boolean,_0xb982bb['forceLogin']||_0x4ed0df?.['forceLogin']),_0x3d9fd6=_0x4ed0df?.['domains'],_0x340e4c=_0xb982bb[_0x18e357(0xe9)],_0x1c73b1=_0x340e4c??_0x4ed0df?.['setupHeaders'],_0x4ba38a=_0xf98ca9['effectiveBaseUrl']??_0xb982bb[_0x18e357(0xf8)]??(_0x3d9fd6&&_0x4d09f2[_0x18e357(0xb1)](_0x3d9fd6['length'],0x0)?_0x3d9fd6[0x0]:''),_0x397368=_0x4ba38a?needsTunnel(_0x4ba38a):![],_0x2c8a8f={'invalidateOn':_0x4ed0df?.['invalidateOn'],'userAgent':_0x4ed0df?.['browserOptions']?.['userAgent']??_0xb982bb['userAgent']};_0x3175fc&&console[_0x18e357(0x12f)](_0x18e357(0x10a)+_0x48b187[_0x18e357(0x10e)]+'\x22,\x20refreshing\x20session...');if(!_0x3175fc){const _0x17e8bb=await checkLocalCache(_0x48b187[_0x18e357(0x10e)],_0x48b187['organizationId'],_0x4ba38a,_0x1c73b1,_0x2c8a8f);if(_0x17e8bb){if(_0x4ba38a&&!_0x397368){const _0x1aacfb=await isCachedSessionLive(_0x17e8bb['storageStatePath'],_0x4ba38a,{'sessionCheckPath':_0x4ed0df?.[_0x18e357(0x12d)],'setupHeaders':_0x1c73b1},{'launchBrowser':launchRealBrowser});if(_0x1aacfb)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x48b187[_0x18e357(0x10e)]+'\x22'),{'authPath':_0x17e8bb['storageStatePath'],'settings':_0x45f318,'resolvedEnv':_0x4ed0df};console[_0x18e357(0x12f)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x48b187[_0x18e357(0x10e)]+_0x18e357(0xd5)),_0x4d09f2['VLtuG'](emitSessionValidationHint,_0x4ba38a,_0x4ed0df);}else return _0x397368&&console['log']('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x48b187[_0x18e357(0x10e)]+'\x22'),{'authPath':_0x17e8bb[_0x18e357(0x105)],'settings':_0x45f318,'resolvedEnv':_0x4ed0df};}}if(!_0x3175fc&&_0x48b187[_0x18e357(0xf1)]){if(_0x397368)console[_0x18e357(0x12f)](_0x18e357(0xe7)+_0x4ba38a+_0x18e357(0xe3)+_0x48b187[_0x18e357(0x10e)]+'\x22');else{const _0x4db2b7=await _0x4d09f2['grBHy'](writeSessionToLocalCache,_0x48b187[_0x18e357(0x10e)],_0x48b187['organizationId'],_0x4ba38a,_0x1c73b1,_0x48b187[_0x18e357(0xf1)],_0x3d9fd6,_0x2c8a8f);if(_0x4ba38a){const _0x574e1f=await isCachedSessionLive(_0x4db2b7,_0x4ba38a,{'sessionCheckPath':_0x4ed0df?.[_0x18e357(0x12d)],'setupHeaders':_0x1c73b1},{'launchBrowser':launchRealBrowser});if(_0x574e1f)return console['log'](_0x18e357(0xc8)+_0x48b187[_0x18e357(0x10e)]+'\x22,\x20cached\x20locally'),{'authPath':_0x4db2b7,'settings':_0x45f318,'resolvedEnv':_0x4ed0df};console['log'](_0x18e357(0x128)+_0x48b187['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x4d09f2['VLtuG'](emitSessionValidationHint,_0x4ba38a,_0x4ed0df);}else return{'authPath':_0x4db2b7,'settings':_0x45f318,'resolvedEnv':_0x4ed0df};}}if(_0x2102ec)return console[_0x18e357(0x12f)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x48b187['name']+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x45f318,'resolvedEnv':_0x4ed0df};console['log'](_0x18e357(0xab)+_0x48b187['name']+'\x22,\x20attempting\x20login...');const _0x5e71e2=Boolean(process['env']['RANGER_TEST_USERNAME'])&&Boolean(process['env'][_0x18e357(0x12a)]),_0x39b88f=Boolean(_0x48b187['username']);if(_0x4d09f2['zbhsG'](_0x5e71e2,_0x39b88f))try{const _0x9e8b1e=_0x4ba38a?await _0x4d09f2[_0x18e357(0x136)](serverSideLoginWithOptionalTunnel,_0x48b187[_0x18e357(0x10e)],_0x4ba38a,{'force':_0x3175fc}):await _0x4d09f2[_0x18e357(0x133)](serverSideLogin,_0x48b187[_0x18e357(0x10e)],{'force':_0x3175fc});if(_0x9e8b1e[_0x18e357(0xe5)]===_0x18e357(0xa6))console['log'](_0x4d09f2[_0x18e357(0xed)]);else{if(_0x9e8b1e['status']===_0x4d09f2['soXtH']&&_0x9e8b1e['session_state']){console[_0x18e357(0x12f)](_0x4d09f2['dHjnJ']);const _0x43dffe=await _0x4d09f2[_0x18e357(0x11d)](writeSessionToLocalCache,_0x48b187[_0x18e357(0x10e)],_0x48b187['organizationId'],_0x4ba38a,_0x1c73b1,_0x9e8b1e['session_state'],_0x3d9fd6,_0x2c8a8f);return _0x4d09f2[_0x18e357(0x129)](_0x5e71e2,!_0x39b88f)&&await promptSaveCredentials(_0x48b187['name']),{'authPath':_0x43dffe,'settings':_0x45f318,'resolvedEnv':_0x4ed0df};}else _0x9e8b1e['test_output']&&(console[_0x18e357(0x12f)](_0x18e357(0x116)),console[_0x18e357(0x12f)](_0x9e8b1e['test_output'])),console[_0x18e357(0x12f)](_0x4d09f2['WaNPI']);}}catch(_0x3eaf66){console[_0x18e357(0x12f)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0x4d09f2['ZqXps'](_0x3eaf66,Error)?_0x3eaf66[_0x18e357(0xc0)]:String(_0x3eaf66))),console['log'](_0x4d09f2['WaNPI']);}const _0x379616=_0x4ed0df?{..._0x4ed0df,'setupHeaders':_0x1c73b1}:_0x4ba38a?{'key':_0x48b187['environmentKey']??'','domains':[_0x4ba38a],'setupHeaders':_0x1c73b1}:null,{sessionState:_0x57f1c3}=await manualBrowserLogin(_0x48b187,_0x379616,{'persistSessionState':!_0x397368}),_0x53d6af=await _0x4d09f2[_0x18e357(0xd3)](writeSessionToLocalCache,_0x48b187['name'],_0x48b187[_0x18e357(0x10c)],_0x4ba38a,_0x1c73b1,_0x57f1c3,_0x3d9fd6,_0x2c8a8f);return{'authPath':_0x53d6af,'settings':_0x45f318,'resolvedEnv':_0x4ed0df};}
|
|
1
|
+
const _0x293293=_0x4b39;function _0x4b39(_0x5f0002,_0x40d559){_0x5f0002=_0x5f0002-0x124;const _0x3ce330=_0x3ce3();let _0x4b39d8=_0x3ce330[_0x5f0002];return _0x4b39d8;}(function(_0x4e1d3c,_0x58c522){const _0x7b64df=_0x4b39,_0x1e46f8=_0x4e1d3c();while(!![]){try{const _0x235383=-parseInt(_0x7b64df(0x156))/0x1+parseInt(_0x7b64df(0x190))/0x2*(parseInt(_0x7b64df(0x130))/0x3)+parseInt(_0x7b64df(0x197))/0x4*(parseInt(_0x7b64df(0x126))/0x5)+parseInt(_0x7b64df(0x13d))/0x6+-parseInt(_0x7b64df(0x192))/0x7+parseInt(_0x7b64df(0x15f))/0x8*(parseInt(_0x7b64df(0x199))/0x9)+-parseInt(_0x7b64df(0x185))/0xa;if(_0x235383===_0x58c522)break;else _0x1e46f8['push'](_0x1e46f8['shift']());}catch(_0x4b0600){_0x1e46f8['push'](_0x1e46f8['shift']());}}}(_0x3ce3,0x8d13d));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x5b064c 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,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x592dcf=_0x4b39,_0x2329fe={'RVhJZ':function(_0x3cba4f){return _0x3cba4f();},'VdTYq':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x58934f=await _0x2329fe[_0x592dcf(0x169)](getToken);if(!_0x58934f)throw new Error(_0x2329fe['VdTYq']);return _0x58934f;}async function apiRequest(_0x5cbeea,_0x2b5de2={}){const _0x1af81e=_0x4b39,_0x168f7d={'sTjWI':function(_0x2665e1){return _0x2665e1();},'xIBkm':_0x1af81e(0x175),'OdxYI':function(_0x29866d,_0x1ce679){return _0x29866d===_0x1ce679;},'CvZyZ':_0x1af81e(0x12a)},_0x5e6708=await requireToken(),_0x119a67=_0x168f7d[_0x1af81e(0x16f)](getApiBaseUrl),_0x23d4f3=await fetch(''+_0x119a67+_0x5cbeea,{..._0x2b5de2,'headers':{'Authorization':'Bearer\x20'+_0x5e6708,'Content-Type':_0x168f7d['xIBkm'],..._0x2b5de2[_0x1af81e(0x136)]??{}}});if(!_0x23d4f3['ok']){let _0x2b2a99='',_0x124372;try{const _0x583a6f=await _0x23d4f3['json']();_0x2b2a99=(_0x168f7d[_0x1af81e(0x198)](typeof _0x583a6f['error'],_0x168f7d[_0x1af81e(0x19e)])?_0x583a6f[_0x1af81e(0x137)]:undefined)??JSON[_0x1af81e(0x12e)](_0x583a6f);if(typeof _0x583a6f[_0x1af81e(0x17d)]===_0x168f7d[_0x1af81e(0x19e)])_0x124372=_0x583a6f[_0x1af81e(0x17d)];}catch{_0x2b2a99=_0x23d4f3['statusText'];}throw new ApiError(_0x1af81e(0x148)+_0x5cbeea+'\x20failed\x20('+_0x23d4f3[_0x1af81e(0x149)]+'):\x20'+_0x2b2a99,_0x23d4f3['status'],_0x2b2a99,_0x124372);}if(_0x23d4f3['status']===0xcc)return undefined;return _0x23d4f3[_0x1af81e(0x195)]();}export class ApiError extends Error{['status'];[_0x293293(0x181)];[_0x293293(0x17d)];constructor(_0x1e74d4,_0x20ff26,_0x2bb371,_0x522fb4){const _0x152fba=_0x293293;super(_0x1e74d4),this[_0x152fba(0x149)]=_0x20ff26,this['detail']=_0x2bb371,this['code']=_0x522fb4,this[_0x152fba(0x16d)]=_0x152fba(0x184);}}export async function fetchCloudProfile(_0x23c497){const _0x4a69ab=_0x293293;try{return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x23c497));}catch(_0x40182e){if(_0x40182e instanceof ApiError&&_0x40182e[_0x4a69ab(0x149)]===0x194)return null;throw _0x40182e;}}export async function listCloudProfiles(){const _0x986154=_0x293293,_0x335142={'IFxQK':function(_0x1887bc,_0x56232e){return _0x1887bc(_0x56232e);}},_0x556d7f=await _0x335142['IFxQK'](apiRequest,_0x986154(0x131));return _0x556d7f[_0x986154(0x129)];}export async function deleteCloudProfile(_0x3f1a90){const _0x57c524=_0x293293,_0x84783f={'AzvQo':function(_0x235a0f,_0x288ed4,_0x4483be){return _0x235a0f(_0x288ed4,_0x4483be);},'GCuQV':function(_0x29a3c3,_0x1ad80a){return _0x29a3c3===_0x1ad80a;}};try{await _0x84783f['AzvQo'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x3f1a90),{'method':_0x57c524(0x16e)});}catch(_0x3397c5){if(_0x3397c5 instanceof ApiError&&_0x84783f['GCuQV'](_0x3397c5['status'],0x194))throw new Error(_0x57c524(0x151)+_0x3f1a90+_0x57c524(0x128));throw _0x3397c5;}}export async function createCloudProfile(_0x13dfbf,_0x19acb0,_0x37db5a={}){const _0x1c7419=_0x293293,_0x51bb67={'oowMj':function(_0x18b045,_0x416515,_0x3bba9f){return _0x18b045(_0x416515,_0x3bba9f);},'IRUvr':_0x1c7419(0x131)},_0xfcd73={'name':_0x13dfbf};if(_0x19acb0)_0xfcd73['environment_key']=_0x19acb0;_0x37db5a[_0x1c7419(0x196)]&&Object['keys'](_0x37db5a['settings'])[_0x1c7419(0x188)]>0x0&&(_0xfcd73[_0x1c7419(0x196)]=_0x37db5a[_0x1c7419(0x196)]);if(_0x37db5a[_0x1c7419(0x15e)])_0xfcd73[_0x1c7419(0x15e)]=_0x37db5a[_0x1c7419(0x15e)];if(_0x37db5a['password'])_0xfcd73['password']=_0x37db5a['password'];return await _0x51bb67['oowMj'](apiRequest,_0x51bb67['IRUvr'],{'method':_0x1c7419(0x163),'body':JSON['stringify'](_0xfcd73)});}export async function uploadCloudProfileSession(_0x848d41,_0x343251){const _0x4738c4=_0x293293,_0x30b97b={'uXmHy':_0x4738c4(0x163)};return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x848d41)+_0x4738c4(0x14d),{'method':_0x30b97b['uXmHy'],'body':JSON['stringify']({'session_state':_0x343251})});}export async function saveCloudProfileCredentials(_0x2436fa,_0x4becc0,_0x10b3f2){const _0xcfd388=_0x293293,_0x2797bc={'oMIyN':_0xcfd388(0x144)};await apiRequest(_0xcfd388(0x138)+encodeURIComponent(_0x2436fa),{'method':_0x2797bc['oMIyN'],'body':JSON[_0xcfd388(0x12e)]({'username':_0x4becc0,'password':_0x10b3f2})});}export async function fetchAuthConfig(){const _0x478584=_0x293293,_0x1e6a11={'dusTX':'/api/v1/profiles/auth-config'};try{const _0x4f3973=await apiRequest(_0x1e6a11['dusTX']);return _0x4f3973['auth_config'];}catch(_0x164e3e){return _0x164e3e instanceof ApiError&&_0x164e3e[_0x478584(0x149)]!==0x194&&console['error'](_0x478584(0x18e)+_0x164e3e[_0x478584(0x14f)]),null;}}async function createTunnelSession(_0x339a68){const _0x4b6d34=_0x293293,_0x3a5c7b={'PQWhx':'POST','cJdnT':'agent'};return await apiRequest('/api/v1/tunnel/sessions',{'method':_0x3a5c7b[_0x4b6d34(0x187)],'body':JSON[_0x4b6d34(0x12e)]({'targetUrl':_0x339a68,'mode':_0x3a5c7b[_0x4b6d34(0x124)]})});}async function deleteTunnelSession(_0x332dd5){const _0x170db1=_0x293293,_0x2938ea={'JpHyI':function(_0x30487a,_0xdb8d84,_0x31cf6a){return _0x30487a(_0xdb8d84,_0x31cf6a);},'cAlwE':_0x170db1(0x16e)};await _0x2938ea[_0x170db1(0x186)](apiRequest,_0x170db1(0x168)+_0x332dd5,{'method':_0x2938ea['cAlwE']});}export function pickAdHocEnvKey(_0x46377f){const _0x2b9fa8=_0x293293,_0x5cc1cb={'SAAYy':function(_0x28bba9,_0x3346f3){return _0x28bba9===_0x3346f3;},'OZheS':function(_0x2b029f,_0x442808){return _0x2b029f===_0x442808;}};if(!_0x46377f)return null;if(_0x46377f[_0x2b9fa8(0x17b)])return _0x46377f[_0x2b9fa8(0x17b)];const _0x4da336=Object[_0x2b9fa8(0x183)](_0x46377f['environments']??{});if(_0x5cc1cb['SAAYy'](_0x4da336[_0x2b9fa8(0x188)],0x1))return _0x4da336[0x0];if(_0x5cc1cb[_0x2b9fa8(0x13e)](_0x4da336['length'],0x0))return null;throw new Error('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x4da336['join'](',\x20')+').\x20'+_0x2b9fa8(0x145));}export async function resolveAdHocProfile(_0x79bfbe=process['env']){const _0x355286=_0x293293,_0x3134c8={'hgHRv':function(_0x52c53d){return _0x52c53d();},'mffoW':function(_0x25b680,_0x32e4e3,_0xb9cc23,_0x334a13){return _0x25b680(_0x32e4e3,_0xb9cc23,_0x334a13);}},_0x15c05d=_0x79bfbe[_0x355286(0x170)];if(!_0x15c05d)return null;const _0x3c3898=await fetchCloudProfile(_0x15c05d);if(_0x3c3898)return{'name':_0x3c3898[_0x355286(0x16d)],'profile':_0x3c3898};const _0x554980=await _0x3134c8['hgHRv'](fetchAuthConfig),_0x34b5c9=pickAdHocEnvKey(_0x554980),_0x1abe7b=_0x79bfbe[_0x355286(0x177)],_0x5d0472=await _0x3134c8['mffoW'](createCloudProfile,_0x15c05d,_0x34b5c9??undefined,{'username':_0x15c05d,'password':_0x1abe7b});return console[_0x355286(0x132)](_0x355286(0x13f)+_0x5d0472[_0x355286(0x16d)]+'\x22\x20for\x20'+_0x15c05d),{'name':_0x5d0472[_0x355286(0x16d)],'profile':_0x5d0472};}export async function writeSessionToLocalCache(_0x41359d,_0x57377d,_0x37c6e3,_0x134769,_0x47f720,_0xcae39e,_0xd81b62){const _0x2455be=_0x293293,_0x471478={'jVZGp':function(_0x541495,_0x624129,_0x10a0e4){return _0x541495(_0x624129,_0x10a0e4);},'PwSpN':function(_0x20f046,_0x3de6fb){return _0x20f046(_0x3de6fb);},'EGfzS':function(_0x1f6529,_0x38e2cd,_0x5dbd58){return _0x1f6529(_0x38e2cd,_0x5dbd58);},'fsMRg':function(_0x3ab3cf,_0x123297){return _0x3ab3cf(_0x123297);}},_0x16d813=sessionCacheHash({'orgId':_0x57377d,'profileName':_0x41359d,'effectiveBaseUrl':_0x37c6e3,'setupHeaders':_0x134769,'invalidateOn':_0xd81b62?.[_0x2455be(0x189)],'userAgent':_0xd81b62?.['userAgent'],'clientIp':_0xd81b62?.['clientIp']}),_0x2c3755=_0x471478['jVZGp'](getSessionCachePath,_0x16d813,_0x41359d),_0x526ba8=join(getRangerHomeDir(),'auth');!_0x471478['PwSpN'](existsSync,_0x526ba8)&&await _0x471478[_0x2455be(0x12b)](mkdir,_0x526ba8,{'recursive':!![]});const _0xd95e1d={..._0x47f720};_0xcae39e&&_0xcae39e[_0x2455be(0x188)]>0x0&&Array['isArray'](_0xd95e1d['cookies'])&&(_0xd95e1d[_0x2455be(0x166)]=_0x471478['EGfzS'](duplicateCookiesForDomains,_0xd95e1d[_0x2455be(0x166)],_0xcae39e));const _0x167b25={'cached_at':new Date()['toISOString'](),'session_state':_0xd95e1d};await writeFile(_0x2c3755,JSON[_0x2455be(0x12e)](_0x167b25,null,0x2));const _0x401a5b=_0x471478[_0x2455be(0x194)](getStorageStatePath,_0x2c3755);return await _0x471478[_0x2455be(0x154)](writeFile,_0x401a5b,JSON['stringify'](_0xd95e1d,null,0x2)),_0x401a5b;}export async function checkLocalCache(_0x224f95,_0x82ac3e,_0x5d6b1c,_0x4fa03a,_0x489db7){const _0x115883=_0x293293,_0x5b34af={'CfbZT':function(_0x14c997,_0x14790d){return _0x14c997(_0x14790d);}},_0x458929=_0x5b34af['CfbZT'](sessionCacheHash,{'orgId':_0x82ac3e,'profileName':_0x224f95,'effectiveBaseUrl':_0x5d6b1c,'setupHeaders':_0x4fa03a,'invalidateOn':_0x489db7?.['invalidateOn'],'userAgent':_0x489db7?.['userAgent'],'clientIp':_0x489db7?.[_0x115883(0x15d)]}),_0x583a2e=getSessionCachePath(_0x458929,_0x224f95),_0x4fb978=getStorageStatePath(_0x583a2e);if(!_0x5b34af[_0x115883(0x19c)](existsSync,_0x583a2e)||!_0x5b34af['CfbZT'](existsSync,_0x4fb978))return null;try{const _0x1c7d9b=await readFile(_0x583a2e,'utf-8');return JSON[_0x115883(0x13c)](_0x1c7d9b),{'storageStatePath':_0x4fb978};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x5b17ed,_0x22073d){const _0x1dcfb0=_0x293293,_0x19a8a8={'VCnaN':function(_0x46ee16,_0x533f24){return _0x46ee16+_0x533f24;}};if(!_0x22073d||!_0x22073d[_0x1dcfb0(0x18b)]?.['length'])return;let _0x428a06;try{_0x428a06=new URL(_0x5b17ed);}catch{return;}const _0x779851=[];for(const _0x34f015 of _0x22073d['domains']){try{_0x779851['push']({'raw':_0x34f015,'url':new URL(_0x34f015)});}catch{}}if(_0x779851['length']===0x0)return;if(_0x779851['some'](_0x32e036=>_0x32e036[_0x1dcfb0(0x174)]['origin']===_0x428a06['origin']))return;const _0x58e1b7=_0x779851['map'](_0x3bd2c7=>'\x22'+_0x3bd2c7['raw']+'\x22')['join'](',\x20');console['log'](_0x19a8a8['VCnaN'](_0x1dcfb0(0x193)+_0x58e1b7+';\x20',_0x1dcfb0(0x143)+_0x5b17ed+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.');}export async function serverSideLogin(_0x12d4f1,_0x4da6b7){const _0x573050=_0x293293,_0x4ab01e={'bXFWy':function(_0x2f7284,_0x5b6c7b,_0x3507fa){return _0x2f7284(_0x5b6c7b,_0x3507fa);},'nqpqS':'POST','aLecL':function(_0x43a2d5,_0x1203e2){return _0x43a2d5===_0x1203e2;}},_0x58b483=process[_0x573050(0x18a)][_0x573050(0x170)],_0x2f1d0c=process[_0x573050(0x18a)][_0x573050(0x177)],_0x9f50b9={};if(_0x58b483)_0x9f50b9[_0x573050(0x15e)]=_0x58b483;if(_0x2f1d0c)_0x9f50b9[_0x573050(0x178)]=_0x2f1d0c;if(_0x4da6b7?.[_0x573050(0x1a4)])_0x9f50b9[_0x573050(0x1a4)]=!![];if(_0x4da6b7?.[_0x573050(0x167)])_0x9f50b9['target_url']=_0x4da6b7['targetUrl'];_0x4da6b7?.[_0x573050(0x14e)]&&(_0x9f50b9['tunnel_session_id']=_0x4da6b7[_0x573050(0x14e)][_0x573050(0x171)],_0x9f50b9[_0x573050(0x19b)]=_0x4da6b7['tunnel']['pwEndpoint']);try{return await _0x4ab01e[_0x573050(0x15c)](apiRequest,_0x573050(0x138)+encodeURIComponent(_0x12d4f1)+_0x573050(0x160),{'method':_0x4ab01e[_0x573050(0x1a3)],'body':JSON[_0x573050(0x12e)](_0x9f50b9)});}catch(_0x2927d9){if(_0x2927d9 instanceof ApiError&&_0x2927d9['status']===0x190&&_0x4ab01e[_0x573050(0x19a)](_0x2927d9['code'],_0x573050(0x13b)))return{'status':_0x573050(0x13b),'error':_0x2927d9['detail']};throw _0x2927d9;}}function _0x3ce3(){const _0x5762a3=['RANGER_TEST_PASSWORD','password','lScwD','\x20\x20forceLogin\x20enabled\x20for\x20\x22','defaultEnvironmentKey','VGpZf','code','trim','browserOptions','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','detail','bqLUh','keys','ApiError','8686070qUzbRX','JpHyI','PQWhx','length','invalidateOn','env','domains','sessionState','newContext','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','jqrpF','104WpHFzP','sessionCheckPath','6806702vWuWGe','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','fsMRg','json','settings','16Ecfifw','OdxYI','528102FPIcNe','aLecL','pw_endpoint','CfbZT','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','CvZyZ','jgDTw','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','sErLw','AiNzD','nqpqS','force','KBmcm','cJdnT','session_state','976810LPWnaR','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','\x22\x20not\x20found.','profiles','string','jVZGp','storageStatePath','SXEgn','stringify','\x20\x20Cloud\x20session\x20for\x20\x22','37371KXOvZO','/api/v1/profiles','log','test_output','Browser\x20login\x20timed\x20out\x20before\x20completion.','newPage','headers','error','/api/v1/profiles/','QJGRN','\x22,\x20refreshing\x20session...','not_configured','parse','3023142JPAwtV','OZheS','\x20\x20Created\x20cloud\x20profile\x20\x22','UOuPQ','\x20\x20No\x20live\x20session\x20for\x20\x22','success','you\x27re\x20now\x20at\x20\x22','PUT','Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.','FXtlF','EDjIX','API\x20request\x20','status','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','setupHeaders','userAgent','/session','tunnel','message','wsEndpoint','Cloud\x20profile\x20\x22','cli:manual-login','\x22\x20failed\x20validation\x20—\x20refreshing...','EGfzS','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','511749baFYuU','Rssih','organizationId','catch','LOtEn','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','bXFWy','clientIp','username','136kYhMbq','/login','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','forceLogin','POST','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','\x22.\x0a','cookies','targetUrl','/api/v1/tunnel/sessions/','RVhJZ','storageState','loginInstructions','effectiveBaseUrl','name','DELETE','sTjWI','RANGER_TEST_USERNAME','sessionId','TZDvs','FGDri','url','application/json','\x20\x20Login\x20successful.\x20Session\x20cached.'];_0x3ce3=function(){return _0x5762a3;};return _0x3ce3();}async function serverSideLoginWithOptionalTunnel(_0xdcebda,_0x34ef12,_0x173ed5={}){const _0x34e16a=_0x293293,_0x54765e={'Rssih':function(_0x55f2fb){return _0x55f2fb();},'MDJvo':function(_0x353b6b,_0x1d2805){return _0x353b6b??_0x1d2805;}};if(!needsTunnel(_0x34ef12))return await serverSideLogin(_0xdcebda,{'force':_0x173ed5['force']});let _0x485729=null,_0xf873e1=null,_0x19ea6c=null,_0x3d10b6=null;try{_0x485729=await launchBrowserServer({'headless':!![]}),_0xf873e1=await createTunnelSession(_0x34ef12);const _0x136dd9=await _0x54765e[_0x34e16a(0x157)](requireToken);_0x19ea6c=await createTunnelBridge({'localWsUrl':_0x485729[_0x34e16a(0x150)],'tunnelServerUrl':_0xf873e1['tunnelUrl'],'sessionId':_0xf873e1['sessionId'],'apiKey':_0x136dd9,'onError':_0x22df81=>{_0x3d10b6=_0x22df81;}});try{return await serverSideLogin(_0xdcebda,{'force':_0x173ed5[_0x34e16a(0x1a4)],'targetUrl':_0x34ef12,'tunnel':{'sessionId':_0xf873e1['sessionId'],'pwEndpoint':_0xf873e1['pwEndpoint']}});}catch(_0x1e5895){throw _0x54765e['MDJvo'](_0x3d10b6,_0x1e5895);}}finally{_0x19ea6c?.['close'](),_0x485729&&await _0x485729['close']()[_0x34e16a(0x159)](()=>{}),_0xf873e1&&await deleteTunnelSession(_0xf873e1['sessionId'])[_0x34e16a(0x159)](()=>{});}}export async function manualBrowserLogin(_0x5e902b,_0x4394fc,_0xa40eee={}){const _0x5da4dd=_0x293293,_0x4f7b7f={'Aurmh':function(_0x3bfcaf){return _0x3bfcaf();},'UOuPQ':function(_0x2a3c15,_0x5645a4){return _0x2a3c15(_0x5645a4);},'QowpX':function(_0x5669cf){return _0x5669cf();},'SXEgn':'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','CLfJp':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','sErLw':function(_0x3d2c27,_0x12cbdd){return _0x3d2c27>_0x12cbdd;},'jqrpF':'about:blank','VDWgn':function(_0x575de0,_0x2ea345){return _0x575de0&&_0x2ea345;},'jmFAO':'Browser\x20closed\x20before\x20authentication\x20was\x20saved.','FGDri':function(_0x53632d,_0x49b187){return _0x53632d!==_0x49b187;}};if(!_0x4f7b7f['QowpX'](isInteractive))throw new Error(_0x5da4dd(0x155)+_0x5e902b['name']+_0x5da4dd(0x165)+_0x4f7b7f[_0x5da4dd(0x12d)]+_0x4f7b7f['CLfJp']);const _0x597c84=_0x4394fc&&_0x4f7b7f[_0x5da4dd(0x1a1)](_0x4394fc[_0x5da4dd(0x18b)][_0x5da4dd(0x188)],0x0)?_0x4394fc['domains'][0x0]:_0x4f7b7f[_0x5da4dd(0x18f)];console[_0x5da4dd(0x132)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console[_0x5da4dd(0x132)](_0x5da4dd(0x180)),await new Promise(_0x2a1da0=>setTimeout(_0x2a1da0,0x7d0));const _0x1d8e08=await chromium['launch']({'headless':![]});let _0x1b46f0=null;try{const _0x120762={'ignoreHTTPSErrors':!![]};_0x4394fc?.['setupHeaders']&&(_0x120762['extraHTTPHeaders']=_0x4394fc[_0x5da4dd(0x14b)]);const _0x154cc2=await _0x1d8e08[_0x5da4dd(0x18d)](_0x120762);await _0x4f7b7f['UOuPQ'](addProfileSetupBanner,_0x154cc2);const _0x1d251e=await _0x154cc2[_0x5da4dd(0x135)]();await _0x1d251e['goto'](_0x597c84);let _0x3b99b0=![];await new Promise(_0xaa0975=>{const _0x551c11={'TZDvs':function(_0x1c78b4,_0xad9672){const _0x3f90a7=_0x4b39;return _0x4f7b7f[_0x3f90a7(0x140)](_0x1c78b4,_0xad9672);}},_0x597272=setTimeout(()=>{const _0x59faae=_0x4b39;_0x3b99b0=!![],console[_0x59faae(0x137)]('Browser\x20login\x20timed\x20out\x20after\x20'+MANUAL_LOGIN_TIMEOUT_MS/0xea60+_0x59faae(0x127)),_0x4f7b7f['Aurmh'](_0xaa0975);},MANUAL_LOGIN_TIMEOUT_MS);_0x1d251e['on']('close',async()=>{const _0x30b854=_0x4b39;_0x551c11[_0x30b854(0x172)](clearTimeout,_0x597272);try{const _0x123659=await _0x154cc2[_0x30b854(0x16a)]();_0x1b46f0=_0x123659;}catch{}_0xaa0975();});});if(_0x4f7b7f['VDWgn'](_0x3b99b0,!_0x1b46f0))throw new Error(_0x5da4dd(0x134));}finally{await _0x1d8e08['close']()['catch'](()=>{});}if(!_0x1b46f0)throw new Error(_0x4f7b7f['jmFAO']);return _0x4f7b7f[_0x5da4dd(0x173)](_0xa40eee['persistSessionState'],![])&&await apiRequest(_0x5da4dd(0x138)+encodeURIComponent(_0x5e902b['name'])+_0x5da4dd(0x14d),{'method':'POST','body':JSON[_0x5da4dd(0x12e)]({'session_state':_0x1b46f0,'updated_by':_0x5da4dd(0x152)})}),{'sessionState':_0x1b46f0};}export async function promptSaveCredentials(_0x4393af){const _0xc7fd8c=_0x293293,_0x6f99ca={'QJGRN':function(_0xb6a684,_0x56d154){return _0xb6a684||_0x56d154;},'KBmcm':'confirm','EDjIX':'save','FXtlF':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','tVygF':'PUT'},_0x107578=process['env']['RANGER_TEST_USERNAME'],_0x46bb37=process['env']['RANGER_TEST_PASSWORD'];if(_0x6f99ca[_0xc7fd8c(0x139)](!_0x107578,!_0x46bb37))return;if(!isInteractive())return;const {save:_0x3e96c8}=await _0x5b064c['prompt']([{'type':_0x6f99ca[_0xc7fd8c(0x1a5)],'name':_0x6f99ca[_0xc7fd8c(0x147)],'message':_0x6f99ca[_0xc7fd8c(0x146)],'default':![]}]);if(!_0x3e96c8)return;await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x4393af),{'method':_0x6f99ca['tVygF'],'body':JSON['stringify']({'username':_0x107578,'password':_0x46bb37})}),console['log']('\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.');}export async function resolveCloudProfileSession(_0x5aa513,_0x30be88={}){const _0x4740ce=_0x293293,_0x38544b={'PhzAM':function(_0x3e132d){return _0x3e132d();},'LOtEn':function(_0x2ee15a,_0x203910,_0x37778c){return _0x2ee15a(_0x203910,_0x37778c);},'ADbDV':'string','VGpZf':function(_0x32bd41,_0x2080c3){return _0x32bd41(_0x2080c3);},'cnsZH':function(_0x3f74d3,_0x4115b8,_0x233096,_0x5101ef,_0xd52c18,_0x3d85c7,_0x21fbfa,_0x39587f){return _0x3f74d3(_0x4115b8,_0x233096,_0x5101ef,_0xd52c18,_0x3d85c7,_0x21fbfa,_0x39587f);},'lScwD':function(_0x4a597a,_0x544a87){return _0x4a597a(_0x544a87);},'jTBXu':function(_0x5cd229,_0x2030a6){return _0x5cd229||_0x2030a6;},'KUvfu':function(_0x251f88,_0x2f0d50,_0x5037d,_0x173a9d){return _0x251f88(_0x2f0d50,_0x5037d,_0x173a9d);},'AiNzD':function(_0x4d060f,_0x536dda){return _0x4d060f===_0x536dda;},'bqLUh':_0x4740ce(0x176),'jgDTw':function(_0x2c1e37,_0x9cad04){return _0x2c1e37&&_0x9cad04;},'cVRDE':function(_0x3ce2a2,_0x44f516){return _0x3ce2a2(_0x44f516);}},_0x435b0c=_0x5aa513['settings']??{},_0x2674f6=await _0x38544b['PhzAM'](fetchAuthConfig),_0x323a10=_0x2674f6?_0x38544b[_0x4740ce(0x15a)](resolveAuthEnvironmentLocally,_0x2674f6,_0x5aa513['environmentKey']):null,_0x3984ef=typeof _0x323a10?.[_0x4740ce(0x16b)]==='string'&&_0x323a10['loginInstructions'][_0x4740ce(0x17e)]()?_0x323a10[_0x4740ce(0x16b)]:undefined,_0x525ef8=typeof _0x435b0c['loginInstructions']===_0x38544b['ADbDV']&&_0x435b0c['loginInstructions']['trim']()?_0x435b0c[_0x4740ce(0x16b)]:undefined,_0x513e78=_0x525ef8||!_0x3984ef?_0x435b0c:{..._0x435b0c,'loginInstructions':_0x3984ef},_0x5c5ca8=Boolean(_0x513e78['loginInstructions']?.[_0x4740ce(0x17e)]()),_0x44e2cb=_0x38544b['VGpZf'](Boolean,_0x435b0c[_0x4740ce(0x162)]||_0x323a10?.[_0x4740ce(0x162)]),_0x414539=_0x323a10?.['domains'],_0x6a933e=_0x435b0c['setupHeaders'],_0x24ed2b=_0x6a933e??_0x323a10?.[_0x4740ce(0x14b)],_0x26c573=_0x30be88[_0x4740ce(0x16c)]??_0x435b0c['baseUrl']??(_0x414539&&_0x414539[_0x4740ce(0x188)]>0x0?_0x414539[0x0]:''),_0x506b31=_0x26c573?_0x38544b[_0x4740ce(0x17c)](needsTunnel,_0x26c573):![],_0x42984c={'invalidateOn':_0x323a10?.['invalidateOn'],'userAgent':_0x323a10?.[_0x4740ce(0x17f)]?.[_0x4740ce(0x14c)]??_0x435b0c['userAgent']};_0x44e2cb&&console['log'](_0x4740ce(0x17a)+_0x5aa513['name']+_0x4740ce(0x13a));if(!_0x44e2cb){const _0x5160da=await checkLocalCache(_0x5aa513[_0x4740ce(0x16d)],_0x5aa513[_0x4740ce(0x158)],_0x26c573,_0x24ed2b,_0x42984c);if(_0x5160da){if(_0x26c573&&!_0x506b31){const _0x5614db=await isCachedSessionLive(_0x5160da[_0x4740ce(0x12c)],_0x26c573,{'sessionCheckPath':_0x323a10?.[_0x4740ce(0x191)],'setupHeaders':_0x24ed2b},{'launchBrowser':launchRealBrowser});if(_0x5614db)return console[_0x4740ce(0x132)](_0x4740ce(0x164)+_0x5aa513[_0x4740ce(0x16d)]+'\x22'),{'authPath':_0x5160da[_0x4740ce(0x12c)],'settings':_0x513e78,'resolvedEnv':_0x323a10};console['log']('\x20\x20Cached\x20session\x20for\x20\x22'+_0x5aa513['name']+_0x4740ce(0x153)),emitSessionValidationHint(_0x26c573,_0x323a10);}else return _0x506b31&&console['log'](_0x4740ce(0x14a)+_0x5aa513['name']+'\x22'),{'authPath':_0x5160da[_0x4740ce(0x12c)],'settings':_0x513e78,'resolvedEnv':_0x323a10};}}if(!_0x44e2cb&&_0x5aa513[_0x4740ce(0x18c)]){if(_0x506b31)console['log']('\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22'+_0x26c573+'\x22\x20on\x20profile\x20\x22'+_0x5aa513[_0x4740ce(0x16d)]+'\x22');else{const _0x1b7bca=await _0x38544b['cnsZH'](writeSessionToLocalCache,_0x5aa513['name'],_0x5aa513[_0x4740ce(0x158)],_0x26c573,_0x24ed2b,_0x5aa513[_0x4740ce(0x18c)],_0x414539,_0x42984c);if(_0x26c573){const _0x24c72e=await isCachedSessionLive(_0x1b7bca,_0x26c573,{'sessionCheckPath':_0x323a10?.[_0x4740ce(0x191)],'setupHeaders':_0x24ed2b},{'launchBrowser':launchRealBrowser});if(_0x24c72e)return console['log'](_0x4740ce(0x161)+_0x5aa513[_0x4740ce(0x16d)]+'\x22,\x20cached\x20locally'),{'authPath':_0x1b7bca,'settings':_0x513e78,'resolvedEnv':_0x323a10};console['log'](_0x4740ce(0x12f)+_0x5aa513['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),emitSessionValidationHint(_0x26c573,_0x323a10);}else return{'authPath':_0x1b7bca,'settings':_0x513e78,'resolvedEnv':_0x323a10};}}if(_0x5c5ca8)return console[_0x4740ce(0x132)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x5aa513[_0x4740ce(0x16d)]+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x513e78,'resolvedEnv':_0x323a10};console['log'](_0x4740ce(0x141)+_0x5aa513['name']+'\x22,\x20attempting\x20login...');const _0x48373f=_0x38544b['VGpZf'](Boolean,process[_0x4740ce(0x18a)]['RANGER_TEST_USERNAME'])&&Boolean(process['env']['RANGER_TEST_PASSWORD']),_0x3cdd16=_0x38544b[_0x4740ce(0x179)](Boolean,_0x5aa513[_0x4740ce(0x15e)]);if(_0x38544b['jTBXu'](_0x48373f,_0x3cdd16))try{const _0x3ac60d=_0x26c573?await _0x38544b['KUvfu'](serverSideLoginWithOptionalTunnel,_0x5aa513['name'],_0x26c573,{'force':_0x44e2cb}):await serverSideLogin(_0x5aa513['name'],{'force':_0x44e2cb});if(_0x3ac60d[_0x4740ce(0x149)]==='not_configured')console['log'](_0x4740ce(0x19d));else{if(_0x38544b[_0x4740ce(0x1a2)](_0x3ac60d['status'],_0x4740ce(0x142))&&_0x3ac60d[_0x4740ce(0x125)]){console['log'](_0x38544b[_0x4740ce(0x182)]);const _0x700ca4=await _0x38544b['cnsZH'](writeSessionToLocalCache,_0x5aa513['name'],_0x5aa513[_0x4740ce(0x158)],_0x26c573,_0x24ed2b,_0x3ac60d['session_state'],_0x414539,_0x42984c);return _0x38544b[_0x4740ce(0x19f)](_0x48373f,!_0x3cdd16)&&await promptSaveCredentials(_0x5aa513[_0x4740ce(0x16d)]),{'authPath':_0x700ca4,'settings':_0x513e78,'resolvedEnv':_0x323a10};}else _0x3ac60d['test_output']&&(console[_0x4740ce(0x132)](_0x4740ce(0x15b)),console['log'](_0x3ac60d[_0x4740ce(0x133)])),console[_0x4740ce(0x132)](_0x4740ce(0x1a0));}}catch(_0x308c88){console['log']('\x20\x20Server-side\x20login\x20error:\x20'+(_0x308c88 instanceof Error?_0x308c88[_0x4740ce(0x14f)]:_0x38544b['cVRDE'](String,_0x308c88))),console[_0x4740ce(0x132)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}const _0x5b5b76=_0x323a10?{..._0x323a10,'setupHeaders':_0x24ed2b}:_0x26c573?{'key':_0x5aa513['environmentKey']??'','domains':[_0x26c573],'setupHeaders':_0x24ed2b}:null,{sessionState:_0x248f80}=await manualBrowserLogin(_0x5aa513,_0x5b5b76,{'persistSessionState':!_0x506b31}),_0x43ce44=await writeSessionToLocalCache(_0x5aa513['name'],_0x5aa513[_0x4740ce(0x158)],_0x26c573,_0x24ed2b,_0x248f80,_0x414539,_0x42984c);return{'authPath':_0x43ce44,'settings':_0x513e78,'resolvedEnv':_0x323a10};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x2b78e9=_0xdf6d;(function(_0x11d91f,_0xee39db){const _0x370523=_0xdf6d,_0x335449=_0x11d91f();while(!![]){try{const _0x5f331b=-parseInt(_0x370523(0x7e))/0x1*(parseInt(_0x370523(0x88))/0x2)+-parseInt(_0x370523(0x82))/0x3+-parseInt(_0x370523(0x7c))/0x4*(parseInt(_0x370523(0x8d))/0x5)+-parseInt(_0x370523(0x8a))/0x6*(-parseInt(_0x370523(0x89))/0x7)+-parseInt(_0x370523(0xa6))/0x8+parseInt(_0x370523(0x8f))/0x9*(parseInt(_0x370523(0x7d))/0xa)+parseInt(_0x370523(0xa0))/0xb;if(_0x5f331b===_0xee39db)break;else _0x335449['push'](_0x335449['shift']());}catch(_0x3c0c03){_0x335449['push'](_0x335449['shift']());}}}(_0x52f6,0x71734));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x38e5c4=process['env'],_0x1c5165={'stdin':process[_0x2b78e9(0x9a)],'stdout':process[_0x2b78e9(0x99)]}){const _0xf8a900={'zhVkQ':function(_0x3fb7c,_0x4e097c){return _0x3fb7c(_0x4e097c);}};if(_0x38e5c4['CI'])return![];return _0xf8a900['zhVkQ'](Boolean,_0x1c5165['stdin']['isTTY'])&&Boolean(_0x1c5165['stdout']['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x41b457){const _0x21a0f4=_0x2b78e9,_0x19648c={'PihwG':'baseUrl','UadkH':'port','aZzaX':function(_0x3a603b,_0x271742){return _0x3a603b(_0x271742);},'IeKDv':_0x21a0f4(0x7a),'tJFtj':function(_0x4410df,_0xfd2cdc){return _0x4410df(_0xfd2cdc);}},_0x432602=new Set(_0x41b457[_0x21a0f4(0x83)]??DEFAULT_INVALIDATE_ON),_0xa1f1ff={'orgId':_0x41b457['orgId'],'profileName':_0x41b457['profileName']};return _0x432602[_0x21a0f4(0x8e)](_0x19648c['PihwG'])&&(_0xa1f1ff['effectiveBaseUrl']=_0x41b457['effectiveBaseUrl']),_0x432602[_0x21a0f4(0x8e)](_0x21a0f4(0x80))&&(_0xa1f1ff['setupHeaders']=_0x41b457['setupHeaders']?sortObjectKeys(_0x41b457['setupHeaders']):_0x41b457[_0x21a0f4(0x80)]),_0x432602[_0x21a0f4(0x8e)](_0x19648c[_0x21a0f4(0xa7)])&&(_0xa1f1ff[_0x21a0f4(0x9f)]=_0x19648c[_0x21a0f4(0x93)](extractPort,_0x41b457['effectiveBaseUrl'])),_0x432602[_0x21a0f4(0x8e)](_0x19648c['IeKDv'])&&_0x41b457[_0x21a0f4(0x7a)]!==undefined&&(_0xa1f1ff['userAgent']=_0x41b457[_0x21a0f4(0x7a)]),_0x432602['has'](_0x21a0f4(0xa3))&&_0x41b457[_0x21a0f4(0xa3)]!==undefined&&(_0xa1f1ff[_0x21a0f4(0xa3)]=_0x41b457['clientIp']),_0x19648c[_0x21a0f4(0x9b)](createHash,_0x21a0f4(0x94))['update'](JSON[_0x21a0f4(0xa2)](_0xa1f1ff))[_0x21a0f4(0xa1)](_0x21a0f4(0x86))['slice'](0x0,0xc);}function extractPort(_0x358905){const _0x338802=_0x2b78e9;try{return new URL(_0x358905)[_0x338802(0x9f)];}catch{return'';}}function sortObjectKeys(_0x4e63db){const _0x377d40={};for(const _0x1f2d03 of Object['keys'](_0x4e63db)['sort']()){_0x377d40[_0x1f2d03]=_0x4e63db[_0x1f2d03];}return _0x377d40;}export function getSessionCachePath(_0xb69e16,_0x2c15e4){const _0x16a697={'DrMHE':'auth'};return join(getRangerHomeDir(),_0x16a697['DrMHE'],_0xb69e16+'-'+_0x2c15e4+'.json');}export function getStorageStatePath(_0x23006f){const _0x1f6342=_0x2b78e9,_0x218925={'ZCjbR':'.storageState.json'};return _0x23006f[_0x1f6342(0x96)](/\.json$/,_0x218925[_0x1f6342(0x8b)]);}function _0xdf6d(_0x234ad1,_0xf0b7e8){_0x234ad1=_0x234ad1-0x7a;const _0x52f6e5=_0x52f6();let _0xdf6d5b=_0x52f6e5[_0x234ad1];return _0xdf6d5b;}export function needsTunnel(_0x11c9af){const _0x28bf7a=_0x2b78e9,_0x220f90={'kvqGe':_0x28bf7a(0x95)};let _0x2783b2;try{_0x2783b2=new URL(_0x11c9af)['hostname'];}catch{return![];}if(_0x2783b2===_0x28bf7a(0x97)||_0x2783b2==='127.0.0.1')return!![];if(_0x2783b2[_0x28bf7a(0x9d)](_0x28bf7a(0x7f)))return!![];if(_0x2783b2['includes'](_0x220f90[_0x28bf7a(0x98)]))return!![];return![];}export function hostnameOf(_0x525176){const _0xcfb10a=_0x2b78e9;return new URL(_0x525176)[_0xcfb10a(0x90)];}export function duplicateCookiesForDomains(_0x251f24,_0x174191){const _0x3e8434=_0x2b78e9,_0x194c50={'GNKiE':function(_0x198c20,_0x38759b){return _0x198c20(_0x38759b);}},_0x1eeb4b=[..._0x251f24],_0x1abcf9=new Set(_0x251f24[_0x3e8434(0x87)](_0x573366=>_0x573366['domain']));for(const _0x572d2c of _0x174191){let _0x84f6be;try{_0x84f6be=_0x194c50['GNKiE'](hostnameOf,_0x572d2c);}catch{continue;}if(!_0x84f6be)continue;const _0xc20ae0=_0x84f6be[_0x3e8434(0x85)]('.')?_0x84f6be:'.'+_0x84f6be;if(_0x1abcf9[_0x3e8434(0x8e)](_0x84f6be)||_0x1abcf9[_0x3e8434(0x8e)](_0xc20ae0))continue;for(const _0x4b8e73 of _0x251f24){_0x1eeb4b['push']({..._0x4b8e73,'domain':_0xc20ae0});}_0x1abcf9['add'](_0xc20ae0);}return _0x1eeb4b;}export function resolveAuthEnvironmentLocally(_0x4c7982,_0x51bf1f){const _0x2ff63b=_0x2b78e9,_0x2281e5={'WuSJm':function(_0x4b6730,_0x5651b2){return _0x4b6730===_0x5651b2;}},_0x1d7eff=_0x4c7982['environments'];if(_0x51bf1f){const _0x5e5171=_0x1d7eff[_0x51bf1f];if(!_0x5e5171)return null;return{'key':_0x51bf1f,..._0x5e5171};}if(_0x4c7982[_0x2ff63b(0x7b)]){const _0x4ec57c=_0x1d7eff[_0x4c7982['defaultEnvironmentKey']];if(!_0x4ec57c)return null;return{'key':_0x4c7982['defaultEnvironmentKey'],..._0x4ec57c};}const _0x10788c=Object[_0x2ff63b(0x92)](_0x1d7eff);if(_0x2281e5['WuSJm'](_0x10788c['length'],0x1)){const _0x5522d7=_0x10788c[0x0];return{'key':_0x5522d7,..._0x1d7eff[_0x5522d7]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x164f25,_0x459e62){const _0x112bc7=_0x2b78e9;try{if(_0x459e62)return new URL(_0x459e62,_0x164f25)['toString']();return new URL(_0x164f25)[_0x112bc7(0x84)]();}catch{return null;}}export function looksLikeLoginUrl(_0x1a9c73){try{const _0x53fde5=new URL(_0x1a9c73);return LOGIN_URL_PATTERN['test'](_0x53fde5['pathname']);}catch{return LOGIN_URL_PATTERN['test'](_0x1a9c73);}}export async function isCachedSessionLive(_0x824ae5,_0x38b6ff,_0x2d41ba={},_0x37cc11={}){const _0x5587d4=_0x2b78e9,_0x199370={'QxLKx':function(_0x4f39d7,_0x21b932,_0xb4830b){return _0x4f39d7(_0x21b932,_0xb4830b);},'FokVN':function(_0x33ec40,_0x5b111e){return _0x33ec40===_0x5b111e;},'BizYC':function(_0x31fcba,_0x276499){return _0x31fcba(_0x276499);}},_0x1e9921=_0x199370[_0x5587d4(0xa5)](buildSessionCheckUrl,_0x38b6ff,_0x2d41ba[_0x5587d4(0x91)]);if(!_0x1e9921)return!![];if(!_0x37cc11[_0x5587d4(0x9e)])return!![];let _0x2c570d=null;try{_0x2c570d=await _0x37cc11[_0x5587d4(0x9e)]();const _0x2ed579=await _0x2c570d[_0x5587d4(0x81)]({'storageState':_0x824ae5,'ignoreHTTPSErrors':!![],..._0x2d41ba[_0x5587d4(0x80)]?{'extraHTTPHeaders':_0x2d41ba[_0x5587d4(0x80)]}:{}}),_0x402518=await _0x2ed579['newPage'](),_0x177955=await _0x402518[_0x5587d4(0x9c)](_0x1e9921,{'waitUntil':'domcontentloaded','timeout':0x3a98}),_0x385683=_0x177955?.['status']();if(_0x385683===0x191||_0x199370[_0x5587d4(0xa4)](_0x385683,0x193))return![];const _0x11f7b4=_0x402518['url']();if(_0x199370['BizYC'](looksLikeLoginUrl,_0x11f7b4))return![];return!![];}catch{return![];}finally{if(_0x2c570d)await _0x2c570d[_0x5587d4(0x8c)]()['catch'](()=>{});}}function _0x52f6(){const _0x5e4def=['keys','aZzaX','sha256','localhost.','replace','localhost','kvqGe','stdout','stdin','tJFtj','goto','endsWith','launchBrowser','port','18210511UgLuSj','digest','stringify','clientIp','FokVN','QxLKx','1328480mEdFEm','UadkH','userAgent','defaultEnvironmentKey','52VjUfkf','18590AAhRrL','4OAxMKW','.localhost','setupHeaders','newContext','2366379bxfOnM','invalidateOn','toString','startsWith','hex','map','209244PZUyyc','52304vYIbnl','522rStqHy','ZCjbR','close','307805MyPMHl','has','1611bLPJwo','hostname','sessionCheckPath'];_0x52f6=function(){return _0x5e4def;};return _0x52f6();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x4bcd8b=_0x3dd4;function _0x3dd4(_0x1e96db,_0x459d03){_0x1e96db=_0x1e96db-0x1d5;const _0x3dd6fe=_0x3dd6();let _0x3dd45d=_0x3dd6fe[_0x1e96db];return _0x3dd45d;}function _0x3dd6(){const _0x4562ce=['16315704XdvPCc','6291vcpXor','AIKaq','RjLqY','865AGyWgo','concat','final','getAuthTag','4069910YUrDbJ','12adxCJk','8530096hiCcPG','ranger-auth-encryption','3260606RjzaDZ','aes-256-gcm','14082AZxEVg','10586628xwcLAq','PCPWB','908cOzZCG','22nknSAA','1YSJzRI','hmwax','sha256','subarray','7OXEaZe'];_0x3dd6=function(){return _0x4562ce;};return _0x3dd6();}(function(_0x152f0a,_0x4cf403){const _0xbcb3b0=_0x3dd4,_0x38203e=_0x152f0a();while(!![]){try{const _0x4cde97=parseInt(_0xbcb3b0(0x1e4))/0x1*(parseInt(_0xbcb3b0(0x1dd))/0x2)+-parseInt(_0xbcb3b0(0x1ea))/0x3*(-parseInt(_0xbcb3b0(0x1e2))/0x4)+parseInt(_0xbcb3b0(0x1d5))/0x5*(-parseInt(_0xbcb3b0(0x1df))/0x6)+-parseInt(_0xbcb3b0(0x1e8))/0x7*(-parseInt(_0xbcb3b0(0x1db))/0x8)+-parseInt(_0xbcb3b0(0x1e9))/0x9+parseInt(_0xbcb3b0(0x1d9))/0xa*(-parseInt(_0xbcb3b0(0x1e3))/0xb)+parseInt(_0xbcb3b0(0x1da))/0xc*(parseInt(_0xbcb3b0(0x1e0))/0xd);if(_0x4cde97===_0x4cf403)break;else _0x38203e['push'](_0x38203e['shift']());}catch(_0x53632d){_0x38203e['push'](_0x38203e['shift']());}}}(_0x3dd6,0xe8ed7));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM=_0x4bcd8b(0x1de),SALT=_0x4bcd8b(0x1dc),KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x554324){const _0x5236c7=_0x4bcd8b,_0x328b3d={'PCPWB':_0x5236c7(0x1e6)};return pbkdf2Sync(_0x554324,SALT,0x186a0,KEY_LENGTH,_0x328b3d[_0x5236c7(0x1e1)]);}export function encrypt(_0xff8be4,_0x2cae73){const _0xcdf3f6=_0x4bcd8b,_0xe10aa7={'aHchp':function(_0x2dca90,_0x20fd06,_0x549232,_0x4ff2ab){return _0x2dca90(_0x20fd06,_0x549232,_0x4ff2ab);},'hmwax':'utf8'},_0x237ca0=deriveKey(_0x2cae73),_0x1502e4=randomBytes(IV_LENGTH),_0x523fa0=_0xe10aa7['aHchp'](createCipheriv,ALGORITHM,_0x237ca0,_0x1502e4),_0x4057b9=Buffer[_0xcdf3f6(0x1d6)]([_0x523fa0['update'](_0xff8be4,_0xe10aa7[_0xcdf3f6(0x1e5)]),_0x523fa0[_0xcdf3f6(0x1d7)]()]),_0x3eb9c1=_0x523fa0[_0xcdf3f6(0x1d8)]();return Buffer[_0xcdf3f6(0x1d6)]([_0x1502e4,_0x3eb9c1,_0x4057b9]);}export function decrypt(_0x3778e5,_0x28d7d2){const _0x11cbc2=_0x4bcd8b,_0x4e0673={'RjLqY':function(_0x14253f,_0x4e2bb7){return _0x14253f(_0x4e2bb7);},'AIKaq':function(_0x28bb78,_0x3b4957,_0x50eeb4,_0x2ee066){return _0x28bb78(_0x3b4957,_0x50eeb4,_0x2ee066);},'xJuNG':'utf8'},_0x1ce546=_0x4e0673[_0x11cbc2(0x1ec)](deriveKey,_0x28d7d2),_0x3afaba=_0x3778e5['subarray'](0x0,IV_LENGTH),_0xfea49a=_0x3778e5[_0x11cbc2(0x1e7)](IV_LENGTH,IV_LENGTH+TAG_LENGTH),_0x586b6f=_0x3778e5[_0x11cbc2(0x1e7)](IV_LENGTH+TAG_LENGTH),_0xf03e1a=_0x4e0673[_0x11cbc2(0x1eb)](createDecipheriv,ALGORITHM,_0x1ce546,_0x3afaba);return _0xf03e1a['setAuthTag'](_0xfea49a),_0xf03e1a['update'](_0x586b6f)+_0xf03e1a[_0x11cbc2(0x1d7)](_0x4e0673['xJuNG']);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x205683=_0x47d7;function _0x47d7(_0x4f91d2,_0x5538f7){_0x4f91d2=_0x4f91d2-0x1ca;const _0x226000=_0x2260();let _0x47d7ee=_0x226000[_0x4f91d2];return _0x47d7ee;}function _0x2260(){const _0x9ed2be=['=[REDACTED]','error','application/json','OGCsk','2802576tTXFjh','--cookie','334212KYXABg','10090764TjodRE','toLowerCase','syntax_error','featureId','--authorization','--api-key','1524HGatzb','startsWith','has','DEBUG','--credentials','rawCommand','join','13630qrLJqt','push','uGbjf','GiaEK','catch','3319674tCTUnL','1332597iKDsCM','12343976opgJEY','[desire-path]\x20Failed\x20to\x20send:\x20','unknown_argument','/api/v1/mcp/desire-path-logs','missing_required_argument','errorMessage','[REDACTED]','env','slice','includes','some','POST','test','stdout','--pass'];_0x2260=function(){return _0x9ed2be;};return _0x2260();}(function(_0x772507,_0x1991b7){const _0x12337c=_0x47d7,_0x48e660=_0x772507();while(!![]){try{const _0x2ff6d2=-parseInt(_0x12337c(0x1dd))/0x1+parseInt(_0x12337c(0x1f0))/0x2+parseInt(_0x12337c(0x1f1))/0x3+parseInt(_0x12337c(0x1e4))/0x4*(-parseInt(_0x12337c(0x1eb))/0x5)+-parseInt(_0x12337c(0x1de))/0x6+parseInt(_0x12337c(0x1db))/0x7+parseInt(_0x12337c(0x1f2))/0x8;if(_0x2ff6d2===_0x1991b7)break;else _0x48e660['push'](_0x48e660['shift']());}catch(_0x2aab8a){_0x48e660['push'](_0x48e660['shift']());}}}(_0x2260,0xf2615));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set(['--token','-t','--secret',_0x205683(0x1e3),'--apikey','--key','--password',_0x205683(0x1d6),'--auth',_0x205683(0x1e2),'--header',_0x205683(0x1dc),_0x205683(0x1e8)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x1e2404){const _0x8a4a45=_0x205683;return TOKEN_PATTERNS[_0x8a4a45(0x1d2)](_0x24f932=>_0x24f932[_0x8a4a45(0x1d4)](_0x1e2404));}export function sanitizeArgs(_0x588714){const _0x309a1d=_0x205683,_0x25df39={'BVueA':function(_0xde35d2,_0x1d268e){return _0xde35d2!==_0x1d268e;},'xzKxT':_0x309a1d(0x1ce)},_0x327cd2=[];let _0x5d2843=![];for(let _0x1aed7f=0x0;_0x1aed7f<_0x588714['length'];_0x1aed7f++){const _0x35dea8=_0x588714[_0x1aed7f];if(_0x5d2843){_0x327cd2['push']('[REDACTED]'),_0x5d2843=![];continue;}if(_0x35dea8[_0x309a1d(0x1e5)]('--')||_0x35dea8['startsWith']('-')){const _0x4e2349=_0x35dea8['indexOf']('=');if(_0x25df39['BVueA'](_0x4e2349,-0x1)){const _0x3b573e=_0x35dea8[_0x309a1d(0x1d0)](0x0,_0x4e2349)['toLowerCase']();if(SENSITIVE_FLAGS[_0x309a1d(0x1e6)](_0x3b573e)){_0x327cd2['push'](_0x35dea8[_0x309a1d(0x1d0)](0x0,_0x4e2349)+_0x309a1d(0x1d7));continue;}}else{const _0x1b8b84=_0x35dea8[_0x309a1d(0x1df)]();SENSITIVE_FLAGS[_0x309a1d(0x1e6)](_0x1b8b84)&&(_0x5d2843=!![]);}_0x327cd2['push'](_0x35dea8);}else looksLikeToken(_0x35dea8)?_0x327cd2[_0x309a1d(0x1ec)](_0x25df39['xzKxT']):_0x327cd2['push'](_0x35dea8);}return _0x327cd2[_0x309a1d(0x1ea)]('\x20');}export async function logDesirePath(_0x556183){const _0x4475e5=_0x205683,_0x2a574c={'mFGSk':function(_0x402932){return _0x402932();},'uGbjf':'no_token','gozht':'Authorization','cYmRd':function(_0x38671b,_0x57ef58,_0x1cfe0e){return _0x38671b(_0x57ef58,_0x1cfe0e);}};try{const _0x407b86=await _0x2a574c['mFGSk'](getToken)[_0x4475e5(0x1ef)](()=>null),_0x3a98c2=_0x2a574c['mFGSk'](getApiBaseUrl),_0x2c5f09=getCurrentVersion(),_0x179aa7=_0x407b86?'has_token':_0x2a574c[_0x4475e5(0x1ed)],_0x4a9892={..._0x556183['metadata'],'authStatus':_0x179aa7,'isTty':process[_0x4475e5(0x1d5)]['isTTY']??![]},_0x2a806f={'Content-Type':_0x4475e5(0x1d9)};_0x407b86&&(_0x2a806f[_0x2a574c['gozht']]='Bearer\x20'+_0x407b86);const _0x33d0c3={'rawCommand':_0x556183[_0x4475e5(0x1e9)],'errorMessage':_0x556183[_0x4475e5(0x1cd)],'errorType':_0x556183['errorType'],'featureId':_0x556183[_0x4475e5(0x1e1)],'sessionId':_0x556183['sessionId'],'metadata':_0x4a9892,'cliVersion':_0x2c5f09};process[_0x4475e5(0x1cf)][_0x4475e5(0x1e7)]&&(console[_0x4475e5(0x1d8)]('[desire-path]\x20Sending\x20log\x20to\x20'+_0x3a98c2+'/api/v1/mcp/desire-path-logs'),console[_0x4475e5(0x1d8)]('[desire-path]\x20Payload:\x20'+JSON['stringify'](_0x33d0c3,null,0x2))),await _0x2a574c['cYmRd'](fetch,_0x3a98c2+_0x4475e5(0x1cb),{'method':_0x4475e5(0x1d3),'headers':_0x2a806f,'body':JSON['stringify'](_0x33d0c3)});}catch(_0x5c0dc8){process['env'][_0x4475e5(0x1e7)]&&console['error'](_0x4475e5(0x1f3)+_0x5c0dc8);}}export function getErrorType(_0x2d7be9,_0x572bc8){const _0x487ed6=_0x205683,_0x1f0103={'ZvVoN':'6|1|7|4|2|3|0|5','OKpvl':'missing_option','ksxEB':'unknown','GiaEK':'Invalid\x20values','avsUT':_0x487ed6(0x1ca),'OGCsk':'runtime_error','Xndii':'unknown_command'},_0x32b8de=_0x1f0103['ZvVoN']['split']('|');let _0x41d870=0x0;while(!![]){switch(_0x32b8de[_0x41d870++]){case'0':if(_0x2d7be9['includes']('Missing\x20required\x20argument'))return _0x1f0103['OKpvl'];continue;case'1':if(!_0x2d7be9)return _0x1f0103['ksxEB'];continue;case'2':if(_0x2d7be9[_0x487ed6(0x1d1)]('Not\x20enough\x20non-option\x20arguments'))return _0x487ed6(0x1cc);continue;case'3':if(_0x2d7be9['includes'](_0x1f0103[_0x487ed6(0x1ee)]))return'invalid_option_value';continue;case'4':if(_0x2d7be9[_0x487ed6(0x1d1)]('Unknown\x20argument'))return _0x1f0103['avsUT'];continue;case'5':return _0x487ed6(0x1e0);case'6':if(_0x572bc8)return _0x1f0103[_0x487ed6(0x1da)];continue;case'7':if(_0x2d7be9['includes']('Unknown\x20command'))return _0x1f0103['Xndii'];continue;}break;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x4a5ade,_0x572995){const _0x32307b=_0x427d,_0x3f0081=_0x4a5ade();while(!![]){try{const _0xe3b24e=parseInt(_0x32307b(0x11c))/0x1+-parseInt(_0x32307b(0x127))/0x2*(parseInt(_0x32307b(0x124))/0x3)+parseInt(_0x32307b(0x15c))/0x4+parseInt(_0x32307b(0x12a))/0x5+-parseInt(_0x32307b(0x128))/0x6+parseInt(_0x32307b(0x13d))/0x7*(-parseInt(_0x32307b(0x12c))/0x8)+parseInt(_0x32307b(0x165))/0x9*(parseInt(_0x32307b(0x147))/0xa);if(_0xe3b24e===_0x572995)break;else _0x3f0081['push'](_0x3f0081['shift']());}catch(_0x592f17){_0x3f0081['push'](_0x3f0081['shift']());}}}(_0x30e9,0xd1958));import{spawn}from'child_process';import _0x53c4de from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';function _0x427d(_0x524db6,_0x582a76){_0x524db6=_0x524db6-0x11c;const _0x30e950=_0x30e9();let _0x427d77=_0x30e950[_0x524db6];return _0x427d77;}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(_0x45642d){const _0x339a5a=_0x427d,_0x592d2b={'ekaCr':function(_0x30f9e0,_0x16a8b4,_0x2c012b){return _0x30f9e0(_0x16a8b4,_0x2c012b);},'pJJrO':_0x339a5a(0x133),'CDJsE':'application/x-www-form-urlencoded'},_0x1a72a4=await _0x592d2b['ekaCr'](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x592d2b['pJJrO'],'headers':{'Content-Type':_0x592d2b[_0x339a5a(0x143)]},'body':new URLSearchParams({'client_id':_0x45642d})});if(!_0x1a72a4['ok']){const _0x5274ad=await _0x1a72a4[_0x339a5a(0x15f)]();throw new Error(_0x339a5a(0x145)+_0x1a72a4[_0x339a5a(0x11d)]+'\x20'+_0x5274ad);}return _0x1a72a4['json']();}export async function pollForTokens(_0x5ba692,_0x398724,_0x5d8903,_0x40a386){const _0x4abe90=_0x427d,_0x34089f={'DepHn':function(_0x3682ac,_0x3e8dcc){return _0x3682ac+_0x3e8dcc;},'xEFnR':function(_0x597af6,_0x119a1f){return _0x597af6*_0x119a1f;},'vbIrf':function(_0x393d4b,_0x5e46da){return _0x393d4b(_0x5e46da);},'fZzNz':function(_0xbc8e45,_0x21a2db){return _0xbc8e45===_0x21a2db;},'AFIiY':_0x4abe90(0x13c)},_0x2dc575=_0x34089f[_0x4abe90(0x140)](Date['now'](),_0x40a386*0x3e8);let _0x44320e=_0x34089f[_0x4abe90(0x11e)](_0x5d8903,0x3e8);while(Date[_0x4abe90(0x16f)]()<_0x2dc575){await _0x34089f['vbIrf'](sleep,_0x44320e);const _0x52f1bc=await fetch(WORKOS_TOKEN_URL,{'method':_0x4abe90(0x133),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x5ba692,'device_code':_0x398724,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x52f1bc['ok'])return _0x52f1bc[_0x4abe90(0x136)]();const _0x32bc02=await _0x52f1bc['json']();if(_0x34089f[_0x4abe90(0x157)](_0x32bc02[_0x4abe90(0x173)],'authorization_pending'))continue;if(_0x32bc02['error']===_0x4abe90(0x153)){_0x44320e+=0x3e8;continue;}throw new Error(_0x32bc02[_0x4abe90(0x13a)]||_0x32bc02[_0x4abe90(0x173)]||_0x34089f[_0x4abe90(0x122)]);}throw new Error(_0x4abe90(0x146));}async function fetchUserProfile(_0x1be66e){const _0x2d5aee=_0x427d,_0x3959be=getApiBaseUrl();try{const _0x204ca1=await fetch(_0x3959be+_0x2d5aee(0x14f),{'method':_0x2d5aee(0x125),'headers':{'workos-token':_0x1be66e}});if(_0x204ca1['ok'])return _0x204ca1['json']();}catch{}return null;}function buildKeyName(_0xf080b5,_0x257076){const _0x4a779d=_0x427d,_0x5b6ac4={'jNKsY':function(_0x220ecb,_0x3689f1){return _0x220ecb+_0x3689f1;}},_0x1f70f0=_0x257076[_0x4a779d(0x160)](_0x212471=>_0x212471[_0x4a779d(0x15a)]===_0xf080b5||_0x212471[_0x4a779d(0x15a)][_0x4a779d(0x162)](_0xf080b5+'\x20('));if(_0x1f70f0['length']===0x0)return _0xf080b5;return _0xf080b5+'\x20('+_0x5b6ac4['jNKsY'](_0x1f70f0[_0x4a779d(0x16d)],0x1)+')';}export async function provisionApiKey(_0x2c4767){const _0x5d180d=_0x427d,_0x28a948={'LIFXQ':_0x5d180d(0x154),'vxJWI':function(_0x938352,_0x2d517d){return _0x938352(_0x2d517d);},'clqIp':'CLI\x20Key','SNJIh':_0x5d180d(0x125),'TWcRf':'POST'},_0x25914a=getApiBaseUrl(),_0x2129c6={'Content-Type':_0x28a948[_0x5d180d(0x163)],'workos-token':_0x2c4767},_0x147200=await _0x28a948[_0x5d180d(0x15b)](fetchUserProfile,_0x2c4767),_0x5dbc0d=_0x147200?.['firstName']||_0x147200?.['email']?.['split']('@')[0x0],_0x1bee97=_0x5dbc0d?_0x5dbc0d+'\x27s\x20CLI\x20Key':_0x28a948[_0x5d180d(0x138)];let _0x18ece1=[];try{const _0x2fb5df=await fetch(_0x25914a+_0x5d180d(0x161),{'method':_0x28a948['SNJIh'],'headers':_0x2129c6});if(_0x2fb5df['ok']){const _0x4b719a=await _0x2fb5df['json']();_0x18ece1=_0x4b719a[_0x5d180d(0x168)];}}catch{}const _0x1e1e84=buildKeyName(_0x1bee97,_0x18ece1),_0x25fbce=await fetch(_0x25914a+'/api-keys',{'method':_0x28a948[_0x5d180d(0x12f)],'headers':_0x2129c6,'body':JSON['stringify']({'name':_0x1e1e84,'scope':_0x5d180d(0x139)})});if(!_0x25fbce['ok']){const _0x94d364=await _0x25fbce['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x25fbce['status']+'\x20'+_0x94d364);}const _0x18b871=await _0x25fbce['json']();return _0x18b871[_0x5d180d(0x151)]['token'];}export function openBrowser(_0x36c6e2){const _0x4d7053=_0x427d,_0x290bfc={'YSJAn':'win32','IvpdF':function(_0x499b8f,_0x2f688d,_0x4c93dd,_0x1a9135){return _0x499b8f(_0x2f688d,_0x4c93dd,_0x1a9135);},'yrcyv':'cmd','BnQBV':_0x4d7053(0x150),'IAhoR':function(_0x2f454d,_0x4d0f5f){return _0x2f454d===_0x4d0f5f;},'gJEWz':'xdg-open'};try{if(process[_0x4d7053(0x120)]===_0x290bfc[_0x4d7053(0x156)]){const _0x5ee82f=_0x290bfc[_0x4d7053(0x131)](spawn,_0x290bfc[_0x4d7053(0x132)],['/c','start','',_0x36c6e2],{'detached':!![],'stdio':_0x290bfc[_0x4d7053(0x175)],'windowsHide':!![]});_0x5ee82f[_0x4d7053(0x134)]();return;}const _0x144fe6=_0x290bfc['IAhoR'](process[_0x4d7053(0x120)],_0x4d7053(0x159))?_0x4d7053(0x15d):_0x290bfc['gJEWz'],_0x2b2dbd=spawn(_0x144fe6,[_0x36c6e2],{'detached':!![],'stdio':_0x290bfc['BnQBV']});_0x2b2dbd['unref']();}catch{}}function decodeJwtPayload(_0x34130e){const _0x2fcfb5=_0x427d,_0x540b79={'NCdCN':_0x2fcfb5(0x174),'OPMAx':_0x2fcfb5(0x135),'iryWT':_0x2fcfb5(0x169)},_0x561794=_0x34130e[_0x2fcfb5(0x129)]('.');if(_0x561794['length']!==0x3)throw new Error(_0x540b79['NCdCN']);const _0x2d70b5=Buffer['from'](_0x561794[0x1],_0x540b79[_0x2fcfb5(0x11f)])['toString'](_0x540b79[_0x2fcfb5(0x167)]);return JSON['parse'](_0x2d70b5);}async function selfServeSignup(_0x35af91){const _0xb74c95=_0x427d,_0x4e75ed={'vKOwR':_0xb74c95(0x133)},_0x363839=getApiBaseUrl(),_0x3810bb=await fetch(_0x363839+'/organization/self-serve-signup',{'method':_0x4e75ed[_0xb74c95(0x170)],'headers':{'Content-Type':'application/json','workos-token':_0x35af91}});if(!_0x3810bb['ok']){const _0x57c33f=await _0x3810bb['text']();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0x3810bb['status']+'\x20'+_0x57c33f);}return _0x3810bb[_0xb74c95(0x136)]();}async function fetchMyMemberships(_0x893b00){const _0xcd000c=_0x427d,_0x2ef42f={'Pcbgb':'GET'},_0x112ea1=getApiBaseUrl(),_0x57b07a=await fetch(_0x112ea1+'/organization/my-memberships',{'method':_0x2ef42f[_0xcd000c(0x142)],'headers':{'workos-token':_0x893b00}});if(!_0x57b07a['ok']){const _0x51ea54=await _0x57b07a['text']();throw new Error(_0xcd000c(0x141)+_0x57b07a[_0xcd000c(0x11d)]+'\x20'+_0x51ea54);}const _0x18027d=await _0x57b07a[_0xcd000c(0x136)]();return _0x18027d['memberships'];}function _0x30e9(){const _0x5e6d20=['/api-keys','startsWith','LIFXQ','Waiting\x20for\x20authentication...','9tWUBjG','token','iryWT','apiKeys','utf-8','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','GtqYz','access_token','length','expires_in','now','vKOwR','user_code','organizationId','error','Invalid\x20JWT\x20format','BnQBV','write','563161vYPVlo','status','xEFnR','OPMAx','platform','stdin','AFIiY','Setting\x20up\x20your\x20organization...','663207cOgUDc','GET','NOKex','2kZfmnX','10117056tJipPD','split','588335MFPwlC','XRlWO','7642760yTRohG','vvdOW','verification_uri_complete','TWcRf','interval','IvpdF','yrcyv','POST','unref','base64url','json','oVxOj','clqIp','mcp:write','error_description','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','Authentication\x20failed','7lBPXVb','selected','Using\x20organization:\x20','DepHn','Failed\x20to\x20fetch\x20memberships:\x20','Pcbgb','CDJsE','GuhUE','Failed\x20to\x20request\x20device\x20code:\x20','Device\x20authorization\x20timed\x20out','15739370JgnZya','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','oRPqw','RzgIS','KJtGJ','cQovx','Provisioning\x20CLI\x20token...','/organization/me','ignore','apiKey','isTTY','slow_down','application/json','stdout','YSJAn','fZzNz','device_code','darwin','name','vxJWI','5865124IQEiyD','open','log','text','filter'];_0x30e9=function(){return _0x5e6d20;};return _0x30e9();}async function refreshTokenWithOrg(_0x137f83,_0x114d8f,_0x52f1a5){const _0x2a2615=_0x427d,_0x15aaf9={'XGjBH':function(_0x7f1a93,_0x16e390,_0x2429fe){return _0x7f1a93(_0x16e390,_0x2429fe);},'JlHvq':'application/x-www-form-urlencoded','oRPqw':'refresh_token'},_0x1f4eaf=await _0x15aaf9['XGjBH'](fetch,WORKOS_TOKEN_URL,{'method':_0x2a2615(0x133),'headers':{'Content-Type':_0x15aaf9['JlHvq']},'body':new URLSearchParams({'client_id':_0x137f83,'grant_type':_0x15aaf9[_0x2a2615(0x14a)],'refresh_token':_0x114d8f,'organization_id':_0x52f1a5})});if(!_0x1f4eaf['ok']){const _0x4e3b71=await _0x1f4eaf[_0x2a2615(0x15f)]();throw new Error(_0x2a2615(0x149)+_0x1f4eaf['status']+'\x20'+_0x4e3b71);}return _0x1f4eaf['json']();}async function provisionCliToken(_0xc73b40){const _0x44774f=_0x427d,_0x2d4928={'KJtGJ':function(_0x41db1c){return _0x41db1c();},'GtqYz':function(_0xa3642c,_0x5a5f2e,_0x5e87b1){return _0xa3642c(_0x5a5f2e,_0x5e87b1);},'IlBrZ':_0x44774f(0x154)},_0x2c2dd4=_0x2d4928[_0x44774f(0x14c)](getApiBaseUrl),_0x336c14=await _0x2d4928[_0x44774f(0x16b)](fetch,_0x2c2dd4+'/cli-auth/token',{'method':'POST','headers':{'Content-Type':_0x2d4928['IlBrZ'],'workos-token':_0xc73b40}});if(!_0x336c14['ok']){const _0x1404c1=await _0x336c14['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x336c14[_0x44774f(0x11d)]+'\x20'+_0x1404c1);}return _0x336c14['json']();}export async function runDeviceAuthFlow(){const _0x434532=_0x427d,_0x4fc8c4={'XRlWO':function(_0x16055c,_0x4a06b3){return _0x16055c(_0x4a06b3);},'cQovx':_0x434532(0x164),'RzgIS':function(_0x1b659b,_0x842ecf,_0x1ffc2a,_0x4ed341,_0x1ca86c){return _0x1b659b(_0x842ecf,_0x1ffc2a,_0x4ed341,_0x1ca86c);},'fBIir':function(_0x4788c4,_0x35d891){return _0x4788c4===_0x35d891;},'vvdOW':_0x434532(0x123),'QcVTY':function(_0x4639bc,_0x90eb75){return _0x4639bc===_0x90eb75;},'oVxOj':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','HxJWL':_0x434532(0x148),'GuhUE':function(_0x181639,_0x52c728,_0x3f621e,_0x550965){return _0x181639(_0x52c728,_0x3f621e,_0x550965);},'NOKex':_0x434532(0x14e),'VWivS':function(_0x16354a,_0x264c37){return _0x16354a(_0x264c37);}},_0x1b781a=getCurrentEnvironment(),_0x2bf0b3=ENVIRONMENT_CONFIGS[_0x1b781a]['workosClientId'],_0x58b60f=await requestDeviceCode(_0x2bf0b3);console[_0x434532(0x15e)](_0x434532(0x16a)),console['log'](_0x434532(0x13b)),_0x4fc8c4[_0x434532(0x12b)](openBrowser,_0x58b60f[_0x434532(0x12e)]),console['log']('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x58b60f['verification_uri_complete']),console['log']('Code:\x20'+_0x58b60f[_0x434532(0x171)]+'\x0a'),process[_0x434532(0x155)]['write'](_0x4fc8c4[_0x434532(0x14d)]);let _0x244c2e=await _0x4fc8c4[_0x434532(0x14b)](pollForTokens,_0x2bf0b3,_0x58b60f[_0x434532(0x158)],_0x58b60f[_0x434532(0x130)],_0x58b60f[_0x434532(0x16e)]);console['log']('\x20✓');const _0x236860=_0x4fc8c4['XRlWO'](decodeJwtPayload,_0x244c2e[_0x434532(0x16c)]);if(!_0x236860['org_id']){const _0x14eb6d=await fetchMyMemberships(_0x244c2e['access_token']);let _0x456d06;if(_0x4fc8c4['fBIir'](_0x14eb6d[_0x434532(0x16d)],0x0)){process[_0x434532(0x155)]['write'](_0x4fc8c4[_0x434532(0x12d)]);const _0x4264ad=await selfServeSignup(_0x244c2e[_0x434532(0x16c)]);_0x456d06=_0x4264ad[_0x434532(0x172)],console['log']('\x20✓');}else{if(_0x4fc8c4['QcVTY'](_0x14eb6d[_0x434532(0x16d)],0x1))_0x456d06=_0x14eb6d[0x0]['organizationId'],console['log'](_0x434532(0x13f)+_0x14eb6d[0x0]['name']);else{const _0xc2b5ea=process[_0x434532(0x121)][_0x434532(0x152)]&&process['stdout'][_0x434532(0x152)];if(!_0xc2b5ea)throw new Error(_0x4fc8c4[_0x434532(0x137)]+_0x4fc8c4['HxJWL']);const {selected:_0x20cc36}=await _0x53c4de['prompt']([{'type':'list','name':_0x434532(0x13e),'message':'Select\x20an\x20organization:','choices':_0x14eb6d['map'](_0x480076=>({'name':_0x480076[_0x434532(0x15a)],'value':_0x480076['organizationId']}))}]);_0x456d06=_0x20cc36;}}_0x244c2e=await _0x4fc8c4[_0x434532(0x144)](refreshTokenWithOrg,_0x2bf0b3,_0x244c2e['refresh_token'],_0x456d06);}process['stdout'][_0x434532(0x176)](_0x4fc8c4[_0x434532(0x126)]);const _0x1d6a84=await _0x4fc8c4[_0x434532(0x12b)](provisionCliToken,_0x244c2e[_0x434532(0x16c)]);return console[_0x434532(0x15e)]('\x20✓'),await _0x4fc8c4['VWivS'](storeToken,_0x1d6a84[_0x434532(0x166)]),_0x244c2e['refresh_token']&&await storeRefreshToken(_0x244c2e['refresh_token']),_0x1d6a84[_0x434532(0x166)];}function sleep(_0x34bc4f){return new Promise(_0x1aa4f3=>setTimeout(_0x1aa4f3,_0x34bc4f));}
|
|
1
|
+
(function(_0x4beea3,_0x1fea80){const _0x2824ff=_0x5110,_0x2da538=_0x4beea3();while(!![]){try{const _0xacad17=-parseInt(_0x2824ff(0x1e8))/0x1*(parseInt(_0x2824ff(0x1c1))/0x2)+-parseInt(_0x2824ff(0x1a6))/0x3*(parseInt(_0x2824ff(0x1b4))/0x4)+parseInt(_0x2824ff(0x1ab))/0x5+parseInt(_0x2824ff(0x1a0))/0x6*(parseInt(_0x2824ff(0x1c8))/0x7)+parseInt(_0x2824ff(0x1c9))/0x8*(-parseInt(_0x2824ff(0x1b1))/0x9)+parseInt(_0x2824ff(0x1d6))/0xa+parseInt(_0x2824ff(0x1bf))/0xb;if(_0xacad17===_0x1fea80)break;else _0x2da538['push'](_0x2da538['shift']());}catch(_0x1351c0){_0x2da538['push'](_0x2da538['shift']());}}}(_0x73ba,0x7b371));import{spawn}from'child_process';import _0x4fb8e4 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';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(_0x1651aa){const _0x4cb7a6=_0x5110,_0x1bd730={'EkKOM':'POST','UwTwh':'application/x-www-form-urlencoded'},_0x50c89e=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x1bd730['EkKOM'],'headers':{'Content-Type':_0x1bd730['UwTwh']},'body':new URLSearchParams({'client_id':_0x1651aa})});if(!_0x50c89e['ok']){const _0x1b43a9=await _0x50c89e['text']();throw new Error(_0x4cb7a6(0x1a7)+_0x50c89e['status']+'\x20'+_0x1b43a9);}return _0x50c89e['json']();}export async function pollForTokens(_0x867f0e,_0x4a6fd2,_0xe47046,_0x221e25){const _0x574866=_0x5110,_0x34f1d7={'Xvglj':_0x574866(0x1bd),'wZTuh':_0x574866(0x1e3),'IOdEQ':function(_0x3a1684,_0x13815f){return _0x3a1684===_0x13815f;},'PMCzM':'Authentication\x20failed'},_0x3ab4f1=Date['now']()+_0x221e25*0x3e8;let _0x2b7474=_0xe47046*0x3e8;while(Date['now']()<_0x3ab4f1){await sleep(_0x2b7474);const _0x5861e5=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x34f1d7['Xvglj']},'body':new URLSearchParams({'client_id':_0x867f0e,'device_code':_0x4a6fd2,'grant_type':_0x34f1d7['wZTuh']})});if(_0x5861e5['ok'])return _0x5861e5['json']();const _0x417790=await _0x5861e5[_0x574866(0x1cd)]();if(_0x417790['error']==='authorization_pending')continue;if(_0x34f1d7['IOdEQ'](_0x417790['error'],'slow_down')){_0x2b7474+=0x3e8;continue;}throw new Error(_0x417790['error_description']||_0x417790[_0x574866(0x1e7)]||_0x34f1d7[_0x574866(0x1ce)]);}throw new Error(_0x574866(0x1e9));}async function fetchUserProfile(_0x5b275a){const _0x10188b=_0x5110,_0x3cf5f9={'wviQx':function(_0x505735){return _0x505735();},'COLXU':_0x10188b(0x1ad)},_0x16548a=_0x3cf5f9['wviQx'](getApiBaseUrl);try{const _0x2a6f03=await fetch(_0x16548a+'/organization/me',{'method':_0x3cf5f9['COLXU'],'headers':{'workos-token':_0x5b275a}});if(_0x2a6f03['ok'])return _0x2a6f03['json']();}catch{}return null;}function buildKeyName(_0x2087c5,_0x148ad0){const _0x25181f=_0x5110,_0x3b7585={'LNVBQ':function(_0x1a0781,_0x2c73aa){return _0x1a0781===_0x2c73aa;},'kctca':function(_0xd82fe7,_0x255910){return _0xd82fe7+_0x255910;}},_0x4ab77b=_0x148ad0['filter'](_0x17eb33=>_0x17eb33['name']===_0x2087c5||_0x17eb33[_0x25181f(0x1af)]['startsWith'](_0x2087c5+'\x20('));if(_0x3b7585['LNVBQ'](_0x4ab77b[_0x25181f(0x1a2)],0x0))return _0x2087c5;return _0x2087c5+'\x20('+_0x3b7585['kctca'](_0x4ab77b['length'],0x1)+')';}export async function provisionApiKey(_0x2e8562){const _0x5ab234=_0x5110,_0x5403b5={'WLOBZ':function(_0x1e9852){return _0x1e9852();},'guGLz':'application/json','TiHjv':function(_0x382586,_0x17ee1e){return _0x382586(_0x17ee1e);},'ruYUT':_0x5ab234(0x1ad),'uvykQ':function(_0x1c3017,_0x100284,_0x44813b){return _0x1c3017(_0x100284,_0x44813b);},'WddXx':'POST','McZCY':_0x5ab234(0x1dd)},_0x207714=_0x5403b5[_0x5ab234(0x1ea)](getApiBaseUrl),_0x55ba21={'Content-Type':_0x5403b5[_0x5ab234(0x1c4)],'workos-token':_0x2e8562},_0x2a5a45=await _0x5403b5[_0x5ab234(0x1cc)](fetchUserProfile,_0x2e8562),_0x29b0a1=_0x2a5a45?.['firstName']||_0x2a5a45?.[_0x5ab234(0x1a3)]?.[_0x5ab234(0x1a1)]('@')[0x0],_0x2d3194=_0x29b0a1?_0x29b0a1+'\x27s\x20CLI\x20Key':'CLI\x20Key';let _0x2e2d70=[];try{const _0x413972=await fetch(_0x207714+_0x5ab234(0x1da),{'method':_0x5403b5[_0x5ab234(0x1ec)],'headers':_0x55ba21});if(_0x413972['ok']){const _0x1933ed=await _0x413972[_0x5ab234(0x1cd)]();_0x2e2d70=_0x1933ed[_0x5ab234(0x1e5)];}}catch{}const _0x44d879=_0x5403b5[_0x5ab234(0x1bc)](buildKeyName,_0x2d3194,_0x2e2d70),_0x3aa6c5=await fetch(_0x207714+'/api-keys',{'method':_0x5403b5['WddXx'],'headers':_0x55ba21,'body':JSON['stringify']({'name':_0x44d879,'scope':_0x5403b5[_0x5ab234(0x1b3)]})});if(!_0x3aa6c5['ok']){const _0x2ffd7e=await _0x3aa6c5[_0x5ab234(0x1e4)]();throw new Error(_0x5ab234(0x1b9)+_0x3aa6c5[_0x5ab234(0x1d8)]+'\x20'+_0x2ffd7e);}const _0x594543=await _0x3aa6c5[_0x5ab234(0x1cd)]();return _0x594543['apiKey'][_0x5ab234(0x1b6)];}export function openBrowser(_0x411c07){const _0x36ffd0=_0x5110,_0x146c38={'sgNvH':'win32','ADkog':function(_0x42c027,_0x39e8db,_0x2c0efe,_0x3292ce){return _0x42c027(_0x39e8db,_0x2c0efe,_0x3292ce);},'NgJYp':'cmd','SgQVb':_0x36ffd0(0x1b8),'depgY':function(_0x16c9b0,_0x44192c){return _0x16c9b0===_0x44192c;},'XpECG':'darwin','TaIoW':'open','OJNpj':_0x36ffd0(0x1b7)};try{if(process['platform']===_0x146c38[_0x36ffd0(0x1cf)]){const _0x278f8c=_0x146c38[_0x36ffd0(0x1df)](spawn,_0x146c38[_0x36ffd0(0x1d0)],['/c','start','',_0x411c07],{'detached':!![],'stdio':_0x146c38['SgQVb'],'windowsHide':!![]});_0x278f8c['unref']();return;}const _0x21fcf0=_0x146c38[_0x36ffd0(0x1cb)](process[_0x36ffd0(0x1be)],_0x146c38[_0x36ffd0(0x1d1)])?_0x146c38['TaIoW']:_0x146c38['OJNpj'],_0x4b7964=spawn(_0x21fcf0,[_0x411c07],{'detached':!![],'stdio':_0x36ffd0(0x1b8)});_0x4b7964[_0x36ffd0(0x1ac)]();}catch{}}function decodeJwtPayload(_0x3a6f01){const _0x2b67fd=_0x5110,_0x2dadf3={'KKUhJ':'Invalid\x20JWT\x20format'},_0x51570c=_0x3a6f01['split']('.');if(_0x51570c['length']!==0x3)throw new Error(_0x2dadf3[_0x2b67fd(0x1c3)]);const _0x1b013e=Buffer['from'](_0x51570c[0x1],_0x2b67fd(0x1c7))['toString']('utf-8');return JSON[_0x2b67fd(0x1bb)](_0x1b013e);}async function selfServeSignup(_0x34c4cb){const _0x591d7f=_0x5110,_0x38b202={'hHywH':function(_0x1f6270,_0x34fd42,_0x29a0ed){return _0x1f6270(_0x34fd42,_0x29a0ed);}},_0x328379=getApiBaseUrl(),_0xff6320=await _0x38b202[_0x591d7f(0x1e1)](fetch,_0x328379+'/organization/self-serve-signup',{'method':_0x591d7f(0x1d9),'headers':{'Content-Type':'application/json','workos-token':_0x34c4cb}});if(!_0xff6320['ok']){const _0x190d9c=await _0xff6320[_0x591d7f(0x1e4)]();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0xff6320['status']+'\x20'+_0x190d9c);}return _0xff6320[_0x591d7f(0x1cd)]();}async function fetchMyMemberships(_0x491ebb){const _0x46fe0c=_0x5110,_0x2ddd03={'qJVmB':function(_0x363a65){return _0x363a65();},'XDBhP':function(_0x5e6908,_0x1d0941,_0x59469f){return _0x5e6908(_0x1d0941,_0x59469f);},'TDiOP':_0x46fe0c(0x1ad)},_0x1b9b0c=_0x2ddd03[_0x46fe0c(0x1a4)](getApiBaseUrl),_0x26c724=await _0x2ddd03[_0x46fe0c(0x1a8)](fetch,_0x1b9b0c+'/organization/my-memberships',{'method':_0x2ddd03[_0x46fe0c(0x1d5)],'headers':{'workos-token':_0x491ebb}});if(!_0x26c724['ok']){const _0x5a34d6=await _0x26c724['text']();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x26c724['status']+'\x20'+_0x5a34d6);}const _0x36f514=await _0x26c724[_0x46fe0c(0x1cd)]();return _0x36f514[_0x46fe0c(0x1ae)];}async function refreshTokenWithOrg(_0x137205,_0x315d94,_0x2d215b){const _0x2c857e=_0x5110,_0x4fdaa4={'UAELL':function(_0x47cce2,_0x2ea55f,_0xeea1fc){return _0x47cce2(_0x2ea55f,_0xeea1fc);},'KiOVq':_0x2c857e(0x1d9),'pQjni':'application/x-www-form-urlencoded','CLYhy':'refresh_token'},_0x20430b=await _0x4fdaa4['UAELL'](fetch,WORKOS_TOKEN_URL,{'method':_0x4fdaa4['KiOVq'],'headers':{'Content-Type':_0x4fdaa4['pQjni']},'body':new URLSearchParams({'client_id':_0x137205,'grant_type':_0x4fdaa4[_0x2c857e(0x1ca)],'refresh_token':_0x315d94,'organization_id':_0x2d215b})});if(!_0x20430b['ok']){const _0x70eb1e=await _0x20430b['text']();throw new Error(_0x2c857e(0x1ba)+_0x20430b['status']+'\x20'+_0x70eb1e);}return _0x20430b[_0x2c857e(0x1cd)]();}function _0x5110(_0x39f511,_0x40c52f){_0x39f511=_0x39f511-0x19f;const _0x73bace=_0x73ba();let _0x511007=_0x73bace[_0x39f511];return _0x511007;}async function provisionCliToken(_0x42b3a4){const _0x12f6f3=_0x5110,_0x1c8ce3={'pjKFu':function(_0x189433){return _0x189433();},'MpDlM':function(_0x31e601,_0x4f6f7b,_0x550b7b){return _0x31e601(_0x4f6f7b,_0x550b7b);},'mWBhA':'POST'},_0x2b5dcd=_0x1c8ce3[_0x12f6f3(0x1db)](getApiBaseUrl),_0x37b5db=await _0x1c8ce3['MpDlM'](fetch,_0x2b5dcd+_0x12f6f3(0x1e6),{'method':_0x1c8ce3['mWBhA'],'headers':{'Content-Type':'application/json','workos-token':_0x42b3a4}});if(!_0x37b5db['ok']){const _0x21cb5c=await _0x37b5db['text']();throw new Error(_0x12f6f3(0x1aa)+_0x37b5db['status']+'\x20'+_0x21cb5c);}return _0x37b5db[_0x12f6f3(0x1cd)]();}function _0x73ba(){const _0x59bf5a=['memberships','name','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','7007049OSwsQK','refresh_token','McZCY','4EAdYIL','wAYOk','token','xdg-open','ignore','Failed\x20to\x20provision\x20API\x20key:\x20','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','parse','uvykQ','application/x-www-form-urlencoded','platform','2183126LPKRcX','org_id','2nvUglh','prompt','KKUhJ','guGLz','access_token','Select\x20an\x20organization:','base64url','6357869eLprAB','8QqRtXL','CLYhy','depgY','TiHjv','json','PMCzM','sgNvH','NgJYp','XpECG','write','map','selected','TDiOP','4596980SfHHSZ','stdin','status','POST','/api-keys','pjKFu','workosClientId','mcp:write','XQUKz','ADkog','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','hHywH','stdout','urn:ietf:params:oauth:grant-type:device_code','text','apiKeys','/cli-auth/token','error','988974qbCGye','Device\x20authorization\x20timed\x20out','WLOBZ','Provisioning\x20CLI\x20token...','ruYUT','log','6oOURbY','split','length','email','qJVmB','zveGD','458808QgCotO','Failed\x20to\x20request\x20device\x20code:\x20','XDBhP','isTTY','Failed\x20to\x20provision\x20CLI\x20token:\x20','4293645JqoPWF','unref','GET'];_0x73ba=function(){return _0x59bf5a;};return _0x73ba();}export async function runDeviceAuthFlow(){const _0x465172=_0x5110,_0x4209a6={'XQUKz':'\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','wRQYF':'\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','GJNYN':'Waiting\x20for\x20authentication...','KkzyT':function(_0x1d2a14,_0xa34a3b){return _0x1d2a14(_0xa34a3b);},'zIjES':_0x465172(0x1b0),'HeKXa':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','zveGD':_0x465172(0x1d4),'ZVvZz':function(_0x148ef,_0x235bf7){return _0x148ef(_0x235bf7);},'wAYOk':function(_0x134292,_0x2b6f58){return _0x134292(_0x2b6f58);}},_0x597e8a=getCurrentEnvironment(),_0x1b74ee=ENVIRONMENT_CONFIGS[_0x597e8a][_0x465172(0x1dc)],_0xc87349=await requestDeviceCode(_0x1b74ee);console['log'](_0x4209a6[_0x465172(0x1de)]),console[_0x465172(0x19f)](_0x4209a6['wRQYF']),openBrowser(_0xc87349['verification_uri_complete']),console['log'](_0x465172(0x1e0)+_0xc87349['verification_uri_complete']),console[_0x465172(0x19f)]('Code:\x20'+_0xc87349['user_code']+'\x0a'),process[_0x465172(0x1e2)]['write'](_0x4209a6['GJNYN']);let _0x4b5f53=await pollForTokens(_0x1b74ee,_0xc87349['device_code'],_0xc87349['interval'],_0xc87349['expires_in']);console['log']('\x20✓');const _0xb9d37b=_0x4209a6['KkzyT'](decodeJwtPayload,_0x4b5f53['access_token']);if(!_0xb9d37b[_0x465172(0x1c0)]){const _0x499569=await _0x4209a6['KkzyT'](fetchMyMemberships,_0x4b5f53['access_token']);let _0x3c1935;if(_0x499569['length']===0x0){process['stdout'][_0x465172(0x1d2)]('Setting\x20up\x20your\x20organization...');const _0x46d99a=await selfServeSignup(_0x4b5f53['access_token']);_0x3c1935=_0x46d99a['organizationId'],console[_0x465172(0x19f)]('\x20✓');}else{if(_0x499569[_0x465172(0x1a2)]===0x1)_0x3c1935=_0x499569[0x0]['organizationId'],console['log']('Using\x20organization:\x20'+_0x499569[0x0][_0x465172(0x1af)]);else{const _0xa6f16b=process[_0x465172(0x1d7)]['isTTY']&&process[_0x465172(0x1e2)][_0x465172(0x1a9)];if(!_0xa6f16b)throw new Error(_0x4209a6['zIjES']+_0x4209a6['HeKXa']);const {selected:_0x543f06}=await _0x4fb8e4[_0x465172(0x1c2)]([{'type':'list','name':_0x4209a6[_0x465172(0x1a5)],'message':_0x465172(0x1c6),'choices':_0x499569[_0x465172(0x1d3)](_0x14ef09=>({'name':_0x14ef09[_0x465172(0x1af)],'value':_0x14ef09['organizationId']}))}]);_0x3c1935=_0x543f06;}}_0x4b5f53=await refreshTokenWithOrg(_0x1b74ee,_0x4b5f53[_0x465172(0x1b2)],_0x3c1935);}process['stdout'][_0x465172(0x1d2)](_0x465172(0x1eb));const _0x20ba9d=await _0x4209a6['ZVvZz'](provisionCliToken,_0x4b5f53[_0x465172(0x1c5)]);return console['log']('\x20✓'),await _0x4209a6[_0x465172(0x1b5)](storeToken,_0x20ba9d[_0x465172(0x1b6)]),_0x4b5f53['refresh_token']&&await storeRefreshToken(_0x4b5f53[_0x465172(0x1b2)]),_0x20ba9d['token'];}function sleep(_0x501928){return new Promise(_0x5fabe9=>setTimeout(_0x5fabe9,_0x501928));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x5ba6a0=_0xd575;(function(_0x4c1df0,_0x1f0a86){const _0x20d40d=_0xd575,_0x26ff90=_0x4c1df0();while(!![]){try{const _0xe1c5c3=-parseInt(_0x20d40d(0x184))/0x1*(-parseInt(_0x20d40d(0x15e))/0x2)+-parseInt(_0x20d40d(0x188))/0x3+parseInt(_0x20d40d(0x167))/0x4*(-parseInt(_0x20d40d(0x16e))/0x5)+-parseInt(_0x20d40d(0x160))/0x6*(parseInt(_0x20d40d(0x181))/0x7)+-parseInt(_0x20d40d(0x172))/0x8+parseInt(_0x20d40d(0x180))/0x9*(parseInt(_0x20d40d(0x165))/0xa)+parseInt(_0x20d40d(0x173))/0xb;if(_0xe1c5c3===_0x1f0a86)break;else _0x26ff90['push'](_0x26ff90['shift']());}catch(_0x640ef4){_0x26ff90['push'](_0x26ff90['shift']());}}}(_0x314e,0x1c671));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':'client_01J9CBYM7M5ZETCF7G6614DXR2','aiProxyUrl':_0x5ba6a0(0x174),'mcpAuthUrl':_0x5ba6a0(0x16b)},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':_0x5ba6a0(0x17f),'aiProxyUrl':_0x5ba6a0(0x15d),'mcpAuthUrl':_0x5ba6a0(0x162)},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':_0x5ba6a0(0x187),'mcpAuthUrl':_0x5ba6a0(0x17a)}};export const DEFAULT_ENVIRONMENT=_0x5ba6a0(0x17b);export function isValidEnvironment(_0x3eb4da){const _0x57f0a8=_0x5ba6a0,_0x4857aa={'VGPbD':function(_0x34d658,_0x71776e){return _0x34d658===_0x71776e;},'UJgzP':_0x57f0a8(0x17b),'zWIhA':_0x57f0a8(0x16d),'IoHfW':function(_0x854a55,_0x18e9c9){return _0x854a55===_0x18e9c9;},'BBOCq':_0x57f0a8(0x175)};return _0x4857aa[_0x57f0a8(0x178)](_0x3eb4da,_0x4857aa[_0x57f0a8(0x17d)])||_0x3eb4da===_0x4857aa['zWIhA']||_0x4857aa['IoHfW'](_0x3eb4da,_0x4857aa[_0x57f0a8(0x17e)]);}export function getCurrentEnvironment(){const _0x5bec43=process['env']['RANGER_CLI_ENV'];if(_0x5bec43&&isValidEnvironment(_0x5bec43))return _0x5bec43;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['apiBaseUrl'];}export function getAiProxyUrl(){const _0x31d334={'vAuIM':function(_0x28317f){return _0x28317f();}};return ENVIRONMENT_CONFIGS[_0x31d334['vAuIM'](getCurrentEnvironment)]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x120f21=_0x5ba6a0;return process['env'][_0x120f21(0x16f)]??ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['mcpAuthUrl'];}function _0xd575(_0x5f0d8f,_0x1248ed){_0x5f0d8f=_0x5f0d8f-0x15d;const _0x314e3c=_0x314e();let _0xd5755c=_0x314e3c[_0x5f0d8f];return _0xd5755c;}export function isByokEnabled(){const _0x48f32e=_0x5ba6a0,_0x4d89b9={'nVrTq':function(_0x1ef62c,_0x298691){return _0x1ef62c===_0x298691;},'aTasn':'true'};return _0x4d89b9[_0x48f32e(0x182)](process[_0x48f32e(0x161)]['RANGER_BYOK'],_0x4d89b9[_0x48f32e(0x177)]);}function isVerificationTransport(_0x1335e0){const _0x306eeb=_0x5ba6a0,_0x417e21={'LetNg':function(_0x335b63,_0x3e1cf1){return _0x335b63===_0x3e1cf1;},'mFFJd':_0x306eeb(0x16a),'bOijF':function(_0x343231,_0x2f833e){return _0x343231===_0x2f833e;},'MXpkE':'rangerwright-cli'};return _0x417e21['LetNg'](_0x1335e0,_0x417e21['mFFJd'])||_0x417e21[_0x306eeb(0x176)](_0x1335e0,_0x306eeb(0x183))||_0x417e21['bOijF'](_0x1335e0,_0x306eeb(0x169))||_0x417e21['bOijF'](_0x1335e0,_0x417e21['MXpkE']);}function _0x314e(){const _0x5937b0=['nFXtu','10lFBEkw','trim','602012OGxiuK','find','nova-act-cli','mcp','https://mcp-auth.ranger.net/mcp','auto','staging','5DpevEn','RANGER_MCP_AUTH_URL','RANGER_USE_NOVA_ACT','PStmF','601952UYACoX','4954466LmmpUP','https://ai-proxy-716115358910.us-central1.run.app','local','LetNg','aTasn','VGPbD','error','http://localhost:8080/mcp','prod','RANGER_HOOKS','UJgzP','BBOCq','client_01J9CBYM2DKWV9HM17D95Z540K','363861nFbFJJ','75257oEChUP','nVrTq','playwright-cli','1679WSNvxG','\x22.\x20','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','http://localhost:8090','473145cdTuiD','https://ai-proxy-301751771437.us-central1.run.app','254LFsPdj','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','114izupqC','env','https://mcp-auth.staging.ranger.net/mcp','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.'];_0x314e=function(){return _0x5937b0;};return _0x314e();}const LEGACY_TRANSPORT_ENV_VARS=[_0x5ba6a0(0x170),'RANGER_DISABLE_MCP'];export function getVerificationTransport(){const _0xe3b531=_0x5ba6a0,_0x255827={'nFXtu':_0xe3b531(0x16a)},_0x509438=process['env']['RANGER_TRANSPORT']?.['trim']();if(_0x509438){if(isVerificationTransport(_0x509438))return _0x509438;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x509438+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x35246e=LEGACY_TRANSPORT_ENV_VARS[_0xe3b531(0x168)](_0x58749c=>process['env'][_0x58749c]);if(_0x35246e)throw new Error(_0x35246e+_0xe3b531(0x186));return _0x255827[_0xe3b531(0x164)];}export function resolveHookMode(_0x3faac0=process[_0x5ba6a0(0x161)]){const _0x2747cf=_0x5ba6a0,_0x5ad8b3={'PStmF':function(_0x39a95c,_0x4fe366){return _0x39a95c===_0x4fe366;},'mQssA':function(_0x8af6bc,_0x1d83fb){return _0x8af6bc===_0x1d83fb;},'cBeaa':_0x2747cf(0x16c)},_0x7094f8=_0x3faac0[_0x2747cf(0x17c)]?.[_0x2747cf(0x166)]()['toLowerCase']();if(!_0x7094f8)return _0x2747cf(0x16c);if(_0x5ad8b3[_0x2747cf(0x171)](_0x7094f8,'off')||_0x5ad8b3['mQssA'](_0x7094f8,'on')||_0x7094f8===_0x2747cf(0x16c))return _0x7094f8;return console[_0x2747cf(0x179)](_0x2747cf(0x15f)+_0x3faac0['RANGER_HOOKS']+_0x2747cf(0x185)+_0x2747cf(0x163)),_0x5ad8b3['cBeaa'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x2a4966,_0x43aa17){const _0xdf8b44=_0x4fb0,_0x4c13b0=_0x2a4966();while(!![]){try{const _0xe542aa=-parseInt(_0xdf8b44(0x174))/0x1*(-parseInt(_0xdf8b44(0x16b))/0x2)+parseInt(_0xdf8b44(0x173))/0x3*(parseInt(_0xdf8b44(0x1a5))/0x4)+-parseInt(_0xdf8b44(0x17c))/0x5+-parseInt(_0xdf8b44(0x1a3))/0x6+-parseInt(_0xdf8b44(0x197))/0x7+parseInt(_0xdf8b44(0x185))/0x8+parseInt(_0xdf8b44(0x1a4))/0x9*(parseInt(_0xdf8b44(0x1ac))/0xa);if(_0xe542aa===_0x43aa17)break;else _0x4c13b0['push'](_0x4c13b0['shift']());}catch(_0x3ad945){_0x4c13b0['push'](_0x4c13b0['shift']());}}}(_0x5009,0xef43a));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x151dbf){const _0x29db86=_0x4fb0,_0x3a9c96={'fHhhb':function(_0x37b059){return _0x37b059();},'REpJG':_0x29db86(0x190),'saEvv':'application/json','wpPCX':_0x29db86(0x192)},_0x74ea6a=await _0x3a9c96['fHhhb'](getToken);if(!_0x74ea6a)throw new Error(_0x3a9c96[_0x29db86(0x198)]);const _0x4b7ac4=getApiBaseUrl(),_0x566deb=await fetch(_0x4b7ac4+'/api/v1/mcp/features',{'method':_0x29db86(0x19b),'headers':{'Authorization':_0x29db86(0x193)+_0x74ea6a,'Content-Type':_0x3a9c96[_0x29db86(0x18d)]},'body':JSON['stringify'](_0x151dbf)});if(!_0x566deb['ok']){if(_0x566deb[_0x29db86(0x16c)]===0x192){const _0x2ba6f8=await _0x566deb[_0x29db86(0x17f)](),_0x5e5da9=_0x2ba6f8['billingUrl']||_0x3a9c96['wpPCX'];throw new Error((_0x2ba6f8[_0x29db86(0x18a)]||_0x29db86(0x169))+_0x29db86(0x168)+_0x5e5da9);}const _0x274b77=await _0x566deb[_0x29db86(0x196)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x274b77);}return _0x566deb[_0x29db86(0x17f)]();}export async function listFeatures(_0x4d4493){const _0x3bb785=_0x4fb0,_0x181bb9={'mPuna':function(_0x34841c){return _0x34841c();},'nWeAg':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','fvbTQ':_0x3bb785(0x166),'DPXBV':_0x3bb785(0x19e),'CGItU':'true'},_0x29ec71=await _0x181bb9[_0x3bb785(0x1a2)](getToken);if(!_0x29ec71)throw new Error(_0x181bb9[_0x3bb785(0x1a9)]);const _0x3ec074=getApiBaseUrl(),_0x470ab1=new URLSearchParams();if(_0x4d4493?.['gitRepoUrl'])_0x470ab1[_0x3bb785(0x1b1)](_0x3bb785(0x1b2),_0x4d4493['gitRepoUrl']);if(_0x4d4493?.['gitBranch'])_0x470ab1[_0x3bb785(0x1b1)](_0x181bb9[_0x3bb785(0x184)],_0x4d4493['gitBranch']);if(_0x4d4493?.[_0x3bb785(0x170)])_0x470ab1[_0x3bb785(0x1b1)]('limit',_0x4d4493[_0x3bb785(0x170)][_0x3bb785(0x19f)]());if(_0x4d4493?.[_0x3bb785(0x19e)])_0x470ab1[_0x3bb785(0x1b1)](_0x181bb9[_0x3bb785(0x1a1)],_0x4d4493[_0x3bb785(0x19e)]['toString']());if(_0x4d4493?.['includeDeleted'])_0x470ab1[_0x3bb785(0x1b1)]('includeDeleted',_0x181bb9['CGItU']);const _0x3ca584=_0x3ec074+'/api/v1/mcp/features'+(_0x470ab1[_0x3bb785(0x19f)]()?'?'+_0x470ab1[_0x3bb785(0x19f)]():''),_0x3cd706=await fetch(_0x3ca584,{'method':'GET','headers':{'Authorization':_0x3bb785(0x193)+_0x29ec71}});if(!_0x3cd706['ok']){const _0xcde119=await _0x3cd706['text']();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0xcde119);}return _0x3cd706[_0x3bb785(0x17f)]();}export async function getFeature(_0x21f2e3){const _0x6519fb=_0x4fb0,_0x24db1f={'keZQJ':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Mthkm':function(_0x2200a9){return _0x2200a9();},'rRkjH':function(_0x598ea1,_0x3d2268,_0x454725){return _0x598ea1(_0x3d2268,_0x454725);},'OVOnt':_0x6519fb(0x182)},_0x3ce6b7=await getToken();if(!_0x3ce6b7)throw new Error(_0x24db1f[_0x6519fb(0x181)]);const _0x452e63=_0x24db1f[_0x6519fb(0x1ab)](getApiBaseUrl),_0x595abc=await _0x24db1f['rRkjH'](fetch,_0x452e63+'/api/v1/mcp/features/'+_0x21f2e3,{'method':_0x24db1f[_0x6519fb(0x16f)],'headers':{'Authorization':'Bearer\x20'+_0x3ce6b7}});if(!_0x595abc['ok']){const _0x529221=await _0x595abc['text']();throw new Error(_0x6519fb(0x19d)+_0x529221);}return _0x595abc['json']();}function _0x5009(){const _0x5e35b1=['HOvGJ','/sessions/','1173TDEtnb','3lDTdHZ','gCczl','stringify','join','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','TviLD','qIKXB','bFquw','6315135XkaKgR','SUNct','/report/markdown','json','qdPnY','keZQJ','GET','/conclude','fvbTQ','2427296QtaOPI','CozCM','jCbGM','mrksS','/sessions','message','/checklist','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','saEvv','lCpJF','application/json','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','itemIds','https://dashboard.ranger.net/billing','Bearer\x20','Failed\x20to\x20list\x20sessions:\x20','NbtEm','text','10058412lIHDPf','REpJG','ATrgh','Failed\x20to\x20delete\x20feature\x20review:\x20','POST','ooJBA','Failed\x20to\x20get\x20feature\x20review:\x20','offset','toString','RKlyf','DPXBV','mPuna','4942206fJPLnq','18akWdth','5156lJuJmf','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','JPHzO','Failed\x20to\x20get\x20action\x20items:\x20','nWeAg','Failed\x20to\x20conclude\x20session:\x20','Mthkm','14921780GQpQwx','amPrK','sessionId','/api/v1/mcp/features/','style','set','gitRepoUrl','pUfCE','gitBranch','nFaxV','\x0a\x0aUpgrade\x20your\x20plan:\x20','Feature\x20limit\x20exceeded','/feedback','474602jgxWDT','status','DDKap','pGqsP','OVOnt','limit'];_0x5009=function(){return _0x5e35b1;};return _0x5009();}export async function updateFeature(_0x52f86e,_0x24f8e6){const _0x9e12e8=_0x4fb0,_0x2eab9d={'ooJBA':function(_0x1a2260){return _0x1a2260();},'bFquw':function(_0x29cf49,_0x1206e2,_0x223253){return _0x29cf49(_0x1206e2,_0x223253);},'nFaxV':'application/json'},_0x5ae45e=await _0x2eab9d['ooJBA'](getToken);if(!_0x5ae45e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4db686=_0x2eab9d[_0x9e12e8(0x19c)](getApiBaseUrl),_0x3ba72e=await _0x2eab9d[_0x9e12e8(0x17b)](fetch,_0x4db686+'/api/v1/mcp/features/'+_0x52f86e,{'method':'PATCH','headers':{'Authorization':'Bearer\x20'+_0x5ae45e,'Content-Type':_0x2eab9d[_0x9e12e8(0x167)]},'body':JSON[_0x9e12e8(0x176)](_0x24f8e6)});if(!_0x3ba72e['ok']){const _0x2150b6=await _0x3ba72e['text']();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x2150b6);}return _0x3ba72e['json']();}export async function createChecklistItem(_0x259c1b,_0x490ae7,_0x40ce02){const _0x116179=_0x4fb0,_0x68b4f8={'JPHzO':function(_0x444eed){return _0x444eed();},'amPrK':_0x116179(0x19b),'cyLIJ':'application/json'},_0x4d1041=await _0x68b4f8[_0x116179(0x1a7)](getToken);if(!_0x4d1041)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x467784=getApiBaseUrl(),_0x479028=await fetch(_0x467784+'/api/v1/mcp/features/'+_0x259c1b+_0x116179(0x18b),{'method':_0x68b4f8[_0x116179(0x1ad)],'headers':{'Authorization':_0x116179(0x193)+_0x4d1041,'Content-Type':_0x68b4f8['cyLIJ']},'body':JSON['stringify']({'description':_0x490ae7,'position':_0x40ce02})});if(!_0x479028['ok']){const _0x57edad=await _0x479028[_0x116179(0x196)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x57edad);}return _0x479028['json']();}export async function updateChecklistItem(_0x21f8a9,_0x42d3a7,_0x33faf7){const _0x228755=_0x4fb0,_0x2e9919={'dwBgs':function(_0x5dbd77){return _0x5dbd77();},'veFvy':_0x228755(0x190),'ewXVS':function(_0xf61908){return _0xf61908();},'SUNct':function(_0x34e304,_0x1dee5b,_0x42745c){return _0x34e304(_0x1dee5b,_0x42745c);},'CozCM':function(_0x215539,_0x31cc7d,_0x347265){return _0x215539(_0x31cc7d,_0x347265);},'lCpJF':'updateChecklistItem'};return _0x2e9919[_0x228755(0x186)](withRetry,async()=>{const _0x5f2a18=_0x228755,_0x555a7b=await _0x2e9919['dwBgs'](getToken);if(!_0x555a7b)throw new Error(_0x2e9919['veFvy']);const _0x4f3bc6=_0x2e9919['ewXVS'](getApiBaseUrl),_0x188bd5=await _0x2e9919[_0x5f2a18(0x17d)](fetch,_0x4f3bc6+'/api/v1/mcp/features/'+_0x21f8a9+'/checklist/'+_0x42d3a7,{'method':'PATCH','headers':{'Authorization':'Bearer\x20'+_0x555a7b,'Content-Type':_0x5f2a18(0x18f)},'body':JSON[_0x5f2a18(0x176)](_0x33faf7)});if(!_0x188bd5['ok']){const _0xd47d3f=await _0x188bd5['text']();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0xd47d3f);}return _0x188bd5[_0x5f2a18(0x17f)]();},{'label':_0x2e9919[_0x228755(0x18e)]});}export async function getFeatureReport(_0x2248bc){const _0x356f15=_0x4fb0,_0x2d6b31={'vyzaN':function(_0x59d8a3){return _0x59d8a3();}},_0x1efca2=await getToken();if(!_0x1efca2)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x15accb=_0x2d6b31['vyzaN'](getApiBaseUrl),_0x28d129=await fetch(_0x15accb+'/api/v1/mcp/features/'+_0x2248bc+'/report',{'method':_0x356f15(0x182),'headers':{'Authorization':_0x356f15(0x193)+_0x1efca2}});if(!_0x28d129['ok']){const _0x1cf00c=await _0x28d129[_0x356f15(0x196)]();throw new Error(_0x356f15(0x178)+_0x1cf00c);}return _0x28d129[_0x356f15(0x17f)]();}export async function getFeatureReportMarkdown(_0x3217d7,_0x123b99){const _0x5b310e=_0x4fb0,_0x54ad82={'DtZZd':function(_0xbeec33,_0x1ba6c8){return _0xbeec33(_0x1ba6c8);},'pUfCE':'itemIds','ErKib':_0x5b310e(0x1ae),'PrVgT':_0x5b310e(0x1b0)},_0xf338b7=await getToken();if(!_0xf338b7)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x208cc4=getApiBaseUrl(),_0x17a6ad=new URLSearchParams(),_0x51f20c=(_0x123b99?.['itemIds']?.['length']??0x0)>0x0,_0xcb78d8=_0x54ad82['DtZZd'](Boolean,_0x123b99?.[_0x5b310e(0x1ae)]);_0x51f20c&&_0x123b99?.[_0x5b310e(0x191)]&&_0x17a6ad[_0x5b310e(0x1b1)](_0x54ad82[_0x5b310e(0x1b3)],_0x123b99['itemIds'][_0x5b310e(0x177)](','));_0xcb78d8&&_0x123b99?.['sessionId']&&_0x17a6ad['set'](_0x54ad82['ErKib'],_0x123b99[_0x5b310e(0x1ae)]);!_0x51f20c&&!_0xcb78d8&&_0x123b99?.['style']&&_0x17a6ad[_0x5b310e(0x1b1)](_0x54ad82['PrVgT'],_0x123b99[_0x5b310e(0x1b0)]);const _0x31b1f8=_0x208cc4+'/api/v1/mcp/features/'+_0x3217d7+_0x5b310e(0x17e),_0x31814b=''+_0x31b1f8+(_0x17a6ad[_0x5b310e(0x19f)]()?'?'+_0x17a6ad['toString']():''),_0x4d4514=await fetch(_0x31814b,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0xf338b7}});if(!_0x4d4514['ok']){const _0x1bd39f=await _0x4d4514['text']();throw new Error(_0x5b310e(0x1a6)+_0x1bd39f);}return _0x4d4514['text']();}export async function listFeatureSessions(_0x57aeff){const _0x19ed6c=_0x4fb0,_0x2a915d={'XhAwC':function(_0x289cdc){return _0x289cdc();},'YpgKz':function(_0x5274db,_0x2b8d39,_0x229392){return _0x5274db(_0x2b8d39,_0x229392);}},_0x4730cf=await _0x2a915d['XhAwC'](getToken);if(!_0x4730cf)throw new Error(_0x19ed6c(0x190));const _0x3f85df=getApiBaseUrl(),_0x328946=await _0x2a915d['YpgKz'](fetch,_0x3f85df+_0x19ed6c(0x1af)+_0x57aeff+_0x19ed6c(0x189),{'method':_0x19ed6c(0x182),'headers':{'Authorization':_0x19ed6c(0x193)+_0x4730cf}});if(!_0x328946['ok']){const _0x303003=await _0x328946['text']();throw new Error(_0x19ed6c(0x194)+_0x303003);}return _0x328946[_0x19ed6c(0x17f)]();}export async function startSession(_0x998b84,_0xc262c4){const _0x3d68f2=_0x4fb0,_0x332c54={'HiRig':function(_0x2aca97){return _0x2aca97();},'kDsre':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','qdPnY':function(_0x33e062){return _0x33e062();},'DDKap':'POST'},_0x41cffc=await _0x332c54['HiRig'](getToken);if(!_0x41cffc)throw new Error(_0x332c54['kDsre']);const _0x3f7360=_0x332c54[_0x3d68f2(0x180)](getApiBaseUrl),_0x2b70e5=await fetch(_0x3f7360+_0x3d68f2(0x1af)+_0x998b84+_0x3d68f2(0x172)+_0xc262c4+'/start',{'method':_0x332c54[_0x3d68f2(0x16d)],'headers':{'Authorization':_0x3d68f2(0x193)+_0x41cffc}});if(!_0x2b70e5['ok']){const _0x1ce5cc=await _0x2b70e5['text']();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x1ce5cc);}return _0x2b70e5['json']();}export async function concludeSession(_0x578c5a,_0x430a5c){const _0x900d45=_0x4fb0,_0x49e219={'pGqsP':function(_0x415d4c){return _0x415d4c();},'tfYBH':_0x900d45(0x190),'gCczl':function(_0x35ffa8,_0xb82a00,_0x947e60){return _0x35ffa8(_0xb82a00,_0x947e60);}},_0x12e9b4=await _0x49e219[_0x900d45(0x16e)](getToken);if(!_0x12e9b4)throw new Error(_0x49e219['tfYBH']);const _0x38af6c=_0x49e219['pGqsP'](getApiBaseUrl),_0xdd6742=await _0x49e219[_0x900d45(0x175)](fetch,_0x38af6c+_0x900d45(0x1af)+_0x578c5a+'/sessions/'+_0x430a5c+_0x900d45(0x183),{'method':'POST','headers':{'Authorization':_0x900d45(0x193)+_0x12e9b4}});if(!_0xdd6742['ok']){const _0xc5e5b=await _0xdd6742[_0x900d45(0x196)]();throw new Error(_0x900d45(0x1aa)+_0xc5e5b);}return _0xdd6742[_0x900d45(0x17f)]();}function _0x4fb0(_0x20e868,_0x4a0474){_0x20e868=_0x20e868-0x166;const _0x500954=_0x5009();let _0x4fb02f=_0x500954[_0x20e868];return _0x4fb02f;}export async function getActionItems(_0x28dad5){const _0x64992a=_0x4fb0,_0x35f652={'mrksS':function(_0x3c72d8){return _0x3c72d8();},'RKlyf':_0x64992a(0x190)},_0x1e2e0e=await _0x35f652[_0x64992a(0x188)](getToken);if(!_0x1e2e0e)throw new Error(_0x35f652[_0x64992a(0x1a0)]);const _0x4576bd=_0x35f652[_0x64992a(0x188)](getApiBaseUrl),_0x47c38a=await fetch(_0x4576bd+'/api/v1/mcp/features/'+_0x28dad5+'/action-items',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x1e2e0e}});if(!_0x47c38a['ok']){const _0x171320=await _0x47c38a['text']();throw new Error(_0x64992a(0x1a8)+_0x171320);}return _0x47c38a[_0x64992a(0x17f)]();}export async function getItemFeedback(_0xfc1268,_0x502196){const _0xd9dedf=_0x4fb0,_0xa7a69a={'NfJRW':function(_0x29b43d){return _0x29b43d();},'jCbGM':function(_0x34f8be,_0x5b3dd6,_0x1e3d90){return _0x34f8be(_0x5b3dd6,_0x1e3d90);}},_0x2b1cfc=await getToken();if(!_0x2b1cfc)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3b5305=_0xa7a69a['NfJRW'](getApiBaseUrl),_0x560f07=await _0xa7a69a[_0xd9dedf(0x187)](fetch,_0x3b5305+'/api/v1/mcp/features/'+_0xfc1268+'/checklist-items/'+_0x502196+_0xd9dedf(0x16a),{'method':'GET','headers':{'Authorization':_0xd9dedf(0x193)+_0x2b1cfc}});if(!_0x560f07['ok']){const _0x3aeb6b=await _0x560f07['text']();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x3aeb6b);}return _0x560f07['json']();}export async function markCommentsAddressed(_0x1a0bb7,_0x1168b7,_0x58e749){const _0x23cfad=_0x4fb0,_0x6bbe5a={'ATrgh':function(_0x54789b){return _0x54789b();},'hqSpy':_0x23cfad(0x190),'jxrtM':function(_0x24e74a,_0x3d71ed,_0x5e113f){return _0x24e74a(_0x3d71ed,_0x5e113f);},'TviLD':_0x23cfad(0x19b)},_0x4dfff9=await _0x6bbe5a[_0x23cfad(0x199)](getToken);if(!_0x4dfff9)throw new Error(_0x6bbe5a['hqSpy']);const _0x3c7a46=_0x6bbe5a[_0x23cfad(0x199)](getApiBaseUrl),_0x2cf5eb=await _0x6bbe5a['jxrtM'](fetch,_0x3c7a46+'/api/v1/mcp/features/'+_0x1a0bb7+'/comments/address',{'method':_0x6bbe5a[_0x23cfad(0x179)],'headers':{'Authorization':_0x23cfad(0x193)+_0x4dfff9,'Content-Type':'application/json'},'body':JSON['stringify']({'checklistItemId':_0x1168b7,'commentIds':_0x58e749})});if(!_0x2cf5eb['ok']){const _0x182998=await _0x2cf5eb[_0x23cfad(0x196)]();throw new Error(_0x23cfad(0x18c)+_0x182998);}}export async function softDeleteFeature(_0x575ca5){const _0x5b21d0=_0x4fb0,_0x15f9c7={'HOvGJ':function(_0x5252d1){return _0x5252d1();},'qIKXB':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x161598=await _0x15f9c7[_0x5b21d0(0x171)](getToken);if(!_0x161598)throw new Error(_0x15f9c7[_0x5b21d0(0x17a)]);const _0x8d0238=getApiBaseUrl(),_0x188ceb=await fetch(_0x8d0238+'/api/v1/mcp/features/'+_0x575ca5,{'method':'DELETE','headers':{'Authorization':_0x5b21d0(0x193)+_0x161598}});if(!_0x188ceb['ok']){const _0x4fae68=await _0x188ceb[_0x5b21d0(0x196)]();throw new Error(_0x5b21d0(0x19a)+_0x4fae68);}}export async function restoreFeature(_0xfee2b4){const _0xbbc0da=_0x4fb0,_0x1fa887={'YlEcr':function(_0x55f0d4){return _0x55f0d4();},'NbtEm':_0xbbc0da(0x190)},_0x4e6d04=await _0x1fa887['YlEcr'](getToken);if(!_0x4e6d04)throw new Error(_0x1fa887[_0xbbc0da(0x195)]);const _0x204f46=getApiBaseUrl(),_0x433b6c=await fetch(_0x204f46+'/api/v1/mcp/features/'+_0xfee2b4+'/restore',{'method':_0xbbc0da(0x19b),'headers':{'Authorization':_0xbbc0da(0x193)+_0x4e6d04}});if(!_0x433b6c['ok']){const _0x1d1f54=await _0x433b6c['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x1d1f54);}}
|
|
1
|
+
(function(_0x26eed1,_0x36273d){const _0x4f4667=_0x28c1,_0x1f5e2c=_0x26eed1();while(!![]){try{const _0x28e21c=-parseInt(_0x4f4667(0xb2))/0x1*(parseInt(_0x4f4667(0xcd))/0x2)+parseInt(_0x4f4667(0xf3))/0x3+-parseInt(_0x4f4667(0xae))/0x4*(parseInt(_0x4f4667(0xe9))/0x5)+-parseInt(_0x4f4667(0xb1))/0x6+-parseInt(_0x4f4667(0xda))/0x7*(parseInt(_0x4f4667(0xe6))/0x8)+-parseInt(_0x4f4667(0xd5))/0x9+parseInt(_0x4f4667(0xdc))/0xa*(parseInt(_0x4f4667(0xdb))/0xb);if(_0x28e21c===_0x36273d)break;else _0x1f5e2c['push'](_0x1f5e2c['shift']());}catch(_0x3e9842){_0x1f5e2c['push'](_0x1f5e2c['shift']());}}}(_0x19f5,0x3b967));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x34d8d1){const _0x310151=_0x28c1,_0x3ae79a={'EKGXp':function(_0xe4c05d){return _0xe4c05d();},'Cghqo':_0x310151(0xa7),'iKWHX':function(_0xfc8143,_0x13bdf3,_0x4436f4){return _0xfc8143(_0x13bdf3,_0x4436f4);},'zVcdR':'application/json','SfqkV':'Feature\x20limit\x20exceeded'},_0x26c643=await _0x3ae79a['EKGXp'](getToken);if(!_0x26c643)throw new Error(_0x3ae79a['Cghqo']);const _0x3991ad=getApiBaseUrl(),_0x1b480c=await _0x3ae79a['iKWHX'](fetch,_0x3991ad+'/api/v1/mcp/features',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x26c643,'Content-Type':_0x3ae79a['zVcdR']},'body':JSON[_0x310151(0xef)](_0x34d8d1)});if(!_0x1b480c['ok']){if(_0x1b480c['status']===0x192){const _0x2cdb4a=await _0x1b480c[_0x310151(0xc1)](),_0x211920=_0x2cdb4a['billingUrl']||_0x310151(0xbd);throw new Error((_0x2cdb4a['message']||_0x3ae79a[_0x310151(0xe8)])+_0x310151(0xe0)+_0x211920);}const _0x40b5f4=await _0x1b480c[_0x310151(0xd6)]();throw new Error(_0x310151(0xa8)+_0x40b5f4);}return _0x1b480c['json']();}export async function listFeatures(_0x4e4b05){const _0x56daab=_0x28c1,_0x192754={'iONLQ':function(_0x4231a2){return _0x4231a2();},'bsLhS':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','OPSpx':'gitRepoUrl','gcRdo':_0x56daab(0xd7),'WBJJj':'limit'},_0x58ad55=await _0x192754['iONLQ'](getToken);if(!_0x58ad55)throw new Error(_0x192754['bsLhS']);const _0x90a7e7=getApiBaseUrl(),_0x300e93=new URLSearchParams();if(_0x4e4b05?.[_0x56daab(0xaa)])_0x300e93[_0x56daab(0xd2)](_0x192754[_0x56daab(0xb6)],_0x4e4b05['gitRepoUrl']);if(_0x4e4b05?.[_0x56daab(0xd7)])_0x300e93['set'](_0x192754[_0x56daab(0xaf)],_0x4e4b05['gitBranch']);if(_0x4e4b05?.[_0x56daab(0xbc)])_0x300e93[_0x56daab(0xd2)](_0x192754['WBJJj'],_0x4e4b05[_0x56daab(0xbc)]['toString']());if(_0x4e4b05?.[_0x56daab(0xcf)])_0x300e93[_0x56daab(0xd2)](_0x56daab(0xcf),_0x4e4b05['offset'][_0x56daab(0xb4)]());if(_0x4e4b05?.[_0x56daab(0xee)])_0x300e93[_0x56daab(0xd2)]('includeDeleted',_0x56daab(0xf5));const _0x5f469c=_0x90a7e7+_0x56daab(0xe4)+(_0x300e93[_0x56daab(0xb4)]()?'?'+_0x300e93['toString']():''),_0x5c17a9=await fetch(_0x5f469c,{'method':_0x56daab(0xad),'headers':{'Authorization':'Bearer\x20'+_0x58ad55}});if(!_0x5c17a9['ok']){const _0x48c98f=await _0x5c17a9[_0x56daab(0xd6)]();throw new Error(_0x56daab(0xed)+_0x48c98f);}return _0x5c17a9[_0x56daab(0xc1)]();}export async function getFeature(_0x562cf){const _0x123468=_0x28c1,_0x37d58b={'UikOc':'GET'},_0x2d8a15=await getToken();if(!_0x2d8a15)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1c823c=getApiBaseUrl(),_0x5ae5fb=await fetch(_0x1c823c+'/api/v1/mcp/features/'+_0x562cf,{'method':_0x37d58b['UikOc'],'headers':{'Authorization':'Bearer\x20'+_0x2d8a15}});if(!_0x5ae5fb['ok']){const _0x382c7c=await _0x5ae5fb[_0x123468(0xd6)]();throw new Error(_0x123468(0xac)+_0x382c7c);}return _0x5ae5fb[_0x123468(0xc1)]();}export async function updateFeature(_0x3314e6,_0x308c89){const _0xfba8e2=_0x28c1,_0x588d76={'spjdq':function(_0x2c86f4){return _0x2c86f4();},'UVQNP':function(_0x579113,_0x1ebe7f,_0x23f701){return _0x579113(_0x1ebe7f,_0x23f701);},'oJmmy':'PATCH'},_0x545830=await getToken();if(!_0x545830)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5c5fcb=_0x588d76[_0xfba8e2(0xbe)](getApiBaseUrl),_0x5d2b83=await _0x588d76[_0xfba8e2(0xe3)](fetch,_0x5c5fcb+_0xfba8e2(0xc0)+_0x3314e6,{'method':_0x588d76['oJmmy'],'headers':{'Authorization':_0xfba8e2(0xf0)+_0x545830,'Content-Type':'application/json'},'body':JSON['stringify'](_0x308c89)});if(!_0x5d2b83['ok']){const _0x4ead7e=await _0x5d2b83[_0xfba8e2(0xd6)]();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x4ead7e);}return _0x5d2b83[_0xfba8e2(0xc1)]();}export async function createChecklistItem(_0x5ec7a0,_0x15cd8d,_0x4c13bf){const _0x4c7775=_0x28c1,_0x51db9b={'Kgjsf':function(_0x503972){return _0x503972();},'CZwmr':_0x4c7775(0xa7),'IGGih':function(_0xf4c9eb,_0x2f0f4f,_0x390867){return _0xf4c9eb(_0x2f0f4f,_0x390867);},'FKZjb':'POST'},_0x53371f=await _0x51db9b[_0x4c7775(0xec)](getToken);if(!_0x53371f)throw new Error(_0x51db9b['CZwmr']);const _0x395c17=getApiBaseUrl(),_0x3d1a47=await _0x51db9b['IGGih'](fetch,_0x395c17+_0x4c7775(0xc0)+_0x5ec7a0+_0x4c7775(0xc2),{'method':_0x51db9b[_0x4c7775(0xe5)],'headers':{'Authorization':'Bearer\x20'+_0x53371f,'Content-Type':'application/json'},'body':JSON['stringify']({'description':_0x15cd8d,'position':_0x4c13bf})});if(!_0x3d1a47['ok']){const _0x31b1a9=await _0x3d1a47[_0x4c7775(0xd6)]();throw new Error(_0x4c7775(0xc8)+_0x31b1a9);}return _0x3d1a47['json']();}export async function updateChecklistItem(_0x562100,_0x451085,_0xf7bb0b){const _0x1d63ca=_0x28c1,_0x447965={'QCZnW':_0x1d63ca(0xa7),'AnWef':function(_0x194fd6){return _0x194fd6();},'URxXW':function(_0x234ddb,_0x107652,_0x1dcd80){return _0x234ddb(_0x107652,_0x1dcd80);},'QhDFt':_0x1d63ca(0xb8)};return withRetry(async()=>{const _0x5e0b6f=_0x1d63ca,_0x52f75a=await getToken();if(!_0x52f75a)throw new Error(_0x447965['QCZnW']);const _0x59eb60=_0x447965['AnWef'](getApiBaseUrl),_0x5de9f4=await _0x447965['URxXW'](fetch,_0x59eb60+_0x5e0b6f(0xc0)+_0x562100+_0x5e0b6f(0xca)+_0x451085,{'method':_0x447965['QhDFt'],'headers':{'Authorization':_0x5e0b6f(0xf0)+_0x52f75a,'Content-Type':'application/json'},'body':JSON['stringify'](_0xf7bb0b)});if(!_0x5de9f4['ok']){const _0x476ef0=await _0x5de9f4[_0x5e0b6f(0xd6)]();throw new Error(_0x5e0b6f(0xe1)+_0x476ef0);}return _0x5de9f4['json']();},{'label':'updateChecklistItem'});}export async function getFeatureReport(_0x452b04){const _0x44e6d5=_0x28c1,_0x50db9b={'llCQg':function(_0x2b63cf){return _0x2b63cf();},'RggQz':function(_0x3d38cd,_0x5e16e4,_0x2a7abe){return _0x3d38cd(_0x5e16e4,_0x2a7abe);},'NKpLd':_0x44e6d5(0xad)},_0x4b85d=await _0x50db9b[_0x44e6d5(0xb7)](getToken);if(!_0x4b85d)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1c20f8=_0x50db9b['llCQg'](getApiBaseUrl),_0x30b1f7=await _0x50db9b[_0x44e6d5(0xc7)](fetch,_0x1c20f8+'/api/v1/mcp/features/'+_0x452b04+_0x44e6d5(0xdf),{'method':_0x50db9b['NKpLd'],'headers':{'Authorization':'Bearer\x20'+_0x4b85d}});if(!_0x30b1f7['ok']){const _0x52886b=await _0x30b1f7['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x52886b);}return _0x30b1f7[_0x44e6d5(0xc1)]();}export async function getFeatureReportMarkdown(_0x46a36a,_0x27b24c){const _0x369203=_0x28c1,_0x525e60={'VuTvY':function(_0x473200){return _0x473200();},'EnGUm':_0x369203(0xa7),'TPoct':function(_0x210a54,_0x55d1cb){return _0x210a54(_0x55d1cb);},'lKHDn':'itemIds','NTDyj':function(_0x2f6486,_0x69a38e){return _0x2f6486&&_0x69a38e;},'geaml':function(_0x1f8485,_0x5728f9,_0x5b0872){return _0x1f8485(_0x5728f9,_0x5b0872);},'eACmd':_0x369203(0xad)},_0x589234=await _0x525e60['VuTvY'](getToken);if(!_0x589234)throw new Error(_0x525e60[_0x369203(0xab)]);const _0x4d87de=getApiBaseUrl(),_0x20144b=new URLSearchParams(),_0x31cbdd=(_0x27b24c?.['itemIds']?.['length']??0x0)>0x0,_0x5a0272=_0x525e60['TPoct'](Boolean,_0x27b24c?.['sessionId']);_0x31cbdd&&_0x27b24c?.['itemIds']&&_0x20144b[_0x369203(0xd2)](_0x525e60[_0x369203(0xbb)],_0x27b24c[_0x369203(0xea)][_0x369203(0xba)](','));_0x5a0272&&_0x27b24c?.['sessionId']&&_0x20144b[_0x369203(0xd2)](_0x369203(0xb3),_0x27b24c['sessionId']);_0x525e60[_0x369203(0xd1)](!_0x31cbdd,!_0x5a0272)&&_0x27b24c?.['style']&&_0x20144b[_0x369203(0xd2)]('style',_0x27b24c['style']);const _0x12ea56=_0x4d87de+'/api/v1/mcp/features/'+_0x46a36a+_0x369203(0xf4),_0x3048bb=''+_0x12ea56+(_0x20144b['toString']()?'?'+_0x20144b['toString']():''),_0x3c03da=await _0x525e60[_0x369203(0xeb)](fetch,_0x3048bb,{'method':_0x525e60[_0x369203(0xd9)],'headers':{'Authorization':_0x369203(0xf0)+_0x589234}});if(!_0x3c03da['ok']){const _0x5c27f9=await _0x3c03da[_0x369203(0xd6)]();throw new Error(_0x369203(0xb0)+_0x5c27f9);}return _0x3c03da[_0x369203(0xd6)]();}export async function listFeatureSessions(_0x20e825){const _0x5741a9=_0x28c1,_0x5dc90b={'HIiGC':function(_0x1707bf){return _0x1707bf();}},_0x59501a=await getToken();if(!_0x59501a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x40cfa6=_0x5dc90b['HIiGC'](getApiBaseUrl),_0x356c21=await fetch(_0x40cfa6+_0x5741a9(0xc0)+_0x20e825+'/sessions',{'method':_0x5741a9(0xad),'headers':{'Authorization':_0x5741a9(0xf0)+_0x59501a}});if(!_0x356c21['ok']){const _0x215c4b=await _0x356c21['text']();throw new Error(_0x5741a9(0xdd)+_0x215c4b);}return _0x356c21[_0x5741a9(0xc1)]();}export async function startSession(_0x17ce2f,_0x17c7e8){const _0x251ae0=_0x28c1,_0x2dc27a={'IHUxl':function(_0x464d67){return _0x464d67();},'ffsSv':function(_0x12862c,_0x366a1e,_0xbbeccb){return _0x12862c(_0x366a1e,_0xbbeccb);},'iwOiw':_0x251ae0(0xc6)},_0x1f9c3d=await _0x2dc27a['IHUxl'](getToken);if(!_0x1f9c3d)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3dbf58=getApiBaseUrl(),_0x1d1525=await _0x2dc27a[_0x251ae0(0xb9)](fetch,_0x3dbf58+_0x251ae0(0xc0)+_0x17ce2f+_0x251ae0(0xd0)+_0x17c7e8+_0x251ae0(0xc5),{'method':_0x2dc27a[_0x251ae0(0xf2)],'headers':{'Authorization':'Bearer\x20'+_0x1f9c3d}});if(!_0x1d1525['ok']){const _0x444eab=await _0x1d1525[_0x251ae0(0xd6)]();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x444eab);}return _0x1d1525['json']();}export async function concludeSession(_0x272411,_0x4b2693){const _0x172c45=_0x28c1,_0x5a7e3a={'RgpZW':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x37351a=await getToken();if(!_0x37351a)throw new Error(_0x5a7e3a['RgpZW']);const _0x2f184a=getApiBaseUrl(),_0x3a30c8=await fetch(_0x2f184a+_0x172c45(0xc0)+_0x272411+'/sessions/'+_0x4b2693+'/conclude',{'method':_0x172c45(0xc6),'headers':{'Authorization':_0x172c45(0xf0)+_0x37351a}});if(!_0x3a30c8['ok']){const _0x4d9037=await _0x3a30c8[_0x172c45(0xd6)]();throw new Error(_0x172c45(0xbf)+_0x4d9037);}return _0x3a30c8[_0x172c45(0xc1)]();}export async function getActionItems(_0x5d4f8f){const _0xb74e11=_0x28c1,_0x14e28f={'NKsNU':function(_0x4d9773){return _0x4d9773();},'nSJub':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','KXbXf':function(_0x131411,_0x543205,_0x37279c){return _0x131411(_0x543205,_0x37279c);}},_0x573d04=await _0x14e28f[_0xb74e11(0xd3)](getToken);if(!_0x573d04)throw new Error(_0x14e28f[_0xb74e11(0xce)]);const _0x45f662=getApiBaseUrl(),_0x186be7=await _0x14e28f['KXbXf'](fetch,_0x45f662+'/api/v1/mcp/features/'+_0x5d4f8f+_0xb74e11(0xcc),{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x573d04}});if(!_0x186be7['ok']){const _0xe29205=await _0x186be7['text']();throw new Error(_0xb74e11(0xd4)+_0xe29205);}return _0x186be7[_0xb74e11(0xc1)]();}function _0x28c1(_0x1b3c0d,_0x501fac){_0x1b3c0d=_0x1b3c0d-0xa7;const _0x19f5fe=_0x19f5();let _0x28c131=_0x19f5fe[_0x1b3c0d];return _0x28c131;}export async function getItemFeedback(_0x101e78,_0x338d81){const _0x2ec846=_0x28c1,_0x40df13={'yrWTa':function(_0x561abe){return _0x561abe();},'EnMev':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','pxDZb':function(_0x41d299){return _0x41d299();}},_0x49efa=await _0x40df13[_0x2ec846(0xd8)](getToken);if(!_0x49efa)throw new Error(_0x40df13[_0x2ec846(0xde)]);const _0x17fc1b=_0x40df13[_0x2ec846(0xb5)](getApiBaseUrl),_0x222563=await fetch(_0x17fc1b+_0x2ec846(0xc0)+_0x101e78+'/checklist-items/'+_0x338d81+_0x2ec846(0xa9),{'method':_0x2ec846(0xad),'headers':{'Authorization':'Bearer\x20'+_0x49efa}});if(!_0x222563['ok']){const _0x4ddd19=await _0x222563[_0x2ec846(0xd6)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x4ddd19);}return _0x222563['json']();}export async function markCommentsAddressed(_0x567d26,_0xf80a1f,_0x2210a6){const _0x18750e=_0x28c1,_0x13b499={'QfHik':function(_0x4cdb3c,_0x4b7bc7,_0x2a3919){return _0x4cdb3c(_0x4b7bc7,_0x2a3919);},'sRDuM':'POST'},_0x540c6d=await getToken();if(!_0x540c6d)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1bd1f0=getApiBaseUrl(),_0x49aaf0=await _0x13b499[_0x18750e(0xe2)](fetch,_0x1bd1f0+'/api/v1/mcp/features/'+_0x567d26+_0x18750e(0xe7),{'method':_0x13b499['sRDuM'],'headers':{'Authorization':'Bearer\x20'+_0x540c6d,'Content-Type':_0x18750e(0xc9)},'body':JSON[_0x18750e(0xef)]({'checklistItemId':_0xf80a1f,'commentIds':_0x2210a6})});if(!_0x49aaf0['ok']){const _0x597edf=await _0x49aaf0['text']();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x597edf);}}export async function softDeleteFeature(_0x487d15){const _0x1952d2=_0x28c1,_0x35a31d={'TEYkG':function(_0x6729e9){return _0x6729e9();},'kzThu':function(_0x2671f6,_0x3fcde0,_0x4ca170){return _0x2671f6(_0x3fcde0,_0x4ca170);}},_0x1d4551=await _0x35a31d['TEYkG'](getToken);if(!_0x1d4551)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x317a26=_0x35a31d['TEYkG'](getApiBaseUrl),_0x379952=await _0x35a31d[_0x1952d2(0xcb)](fetch,_0x317a26+_0x1952d2(0xc0)+_0x487d15,{'method':'DELETE','headers':{'Authorization':_0x1952d2(0xf0)+_0x1d4551}});if(!_0x379952['ok']){const _0x39f982=await _0x379952['text']();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x39f982);}}function _0x19f5(){const _0x56ef07=['25782PiIgdp','sessionId','toString','pxDZb','OPSpx','llCQg','PATCH','ffsSv','join','lKHDn','limit','https://dashboard.ranger.net/billing','spjdq','Failed\x20to\x20conclude\x20session:\x20','/api/v1/mcp/features/','json','/checklist','Failed\x20to\x20restore\x20feature\x20review:\x20','hOlOT','/start','POST','RggQz','Failed\x20to\x20create\x20scenario:\x20','application/json','/checklist/','kzThu','/action-items','16ETcTof','nSJub','offset','/sessions/','NTDyj','set','NKsNU','Failed\x20to\x20get\x20action\x20items:\x20','129258HHNxwq','text','gitBranch','yrWTa','eACmd','168pLMjyU','132mUvKqf','603560igbSpF','Failed\x20to\x20list\x20sessions:\x20','EnMev','/report','\x0a\x0aUpgrade\x20your\x20plan:\x20','Failed\x20to\x20update\x20scenario:\x20','QfHik','UVQNP','/api/v1/mcp/features','FKZjb','13664GnXRJT','/comments/address','SfqkV','5eJUpkE','itemIds','geaml','Kgjsf','Failed\x20to\x20list\x20feature\x20reviews:\x20','includeDeleted','stringify','Bearer\x20','bjidB','iwOiw','316350QejSgB','/report/markdown','true','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Failed\x20to\x20create\x20feature\x20review:\x20','/feedback','gitRepoUrl','EnGUm','Failed\x20to\x20get\x20feature\x20review:\x20','GET','949604jcitwf','gcRdo','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','519840NWtbkv'];_0x19f5=function(){return _0x56ef07;};return _0x19f5();}export async function restoreFeature(_0x3ecf01){const _0x395235=_0x28c1,_0x5b50={'bjidB':function(_0x575fa0){return _0x575fa0();},'QSZUt':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','hOlOT':function(_0x5b07b9,_0x227e32,_0x470205){return _0x5b07b9(_0x227e32,_0x470205);},'YmcxY':_0x395235(0xc6)},_0x24b704=await _0x5b50[_0x395235(0xf1)](getToken);if(!_0x24b704)throw new Error(_0x5b50['QSZUt']);const _0x138c45=getApiBaseUrl(),_0x5587ce=await _0x5b50[_0x395235(0xc4)](fetch,_0x138c45+'/api/v1/mcp/features/'+_0x3ecf01+'/restore',{'method':_0x5b50['YmcxY'],'headers':{'Authorization':_0x395235(0xf0)+_0x24b704}});if(!_0x5587ce['ok']){const _0x358684=await _0x5587ce['text']();throw new Error(_0x395235(0xc3)+_0x358684);}}
|