@ranger-testing/ranger-cli 3.1.3-alpha.e1ca941-42 → 3.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/build/cli.js +1 -1
  2. package/build/commands/addEnv.js +1 -1
  3. package/build/commands/authEncrypt.js +1 -1
  4. package/build/commands/clean.js +1 -1
  5. package/build/commands/config.js +1 -1
  6. package/build/commands/deleteProfile.js +1 -1
  7. package/build/commands/env.js +1 -1
  8. package/build/commands/feature.js +1 -1
  9. package/build/commands/hook.js +1 -1
  10. package/build/commands/hooks/autoPrompt.js +1 -1
  11. package/build/commands/hooks/disable.js +1 -1
  12. package/build/commands/hooks/enable.js +1 -1
  13. package/build/commands/hooks/exitPlanMode.js +1 -1
  14. package/build/commands/hooks/index.js +1 -1
  15. package/build/commands/hooks/output.js +1 -1
  16. package/build/commands/hooks/planReminder.js +1 -1
  17. package/build/commands/hooks/planStart.js +1 -1
  18. package/build/commands/hooks/postEdit.js +1 -1
  19. package/build/commands/hooks/preCompact.js +1 -1
  20. package/build/commands/hooks/sessionEnd.js +1 -1
  21. package/build/commands/hooks/sessionStart.js +1 -1
  22. package/build/commands/hooks/stopHook.js +1 -1
  23. package/build/commands/index.js +1 -1
  24. package/build/commands/login.js +1 -1
  25. package/build/commands/mcpBootstrap.js +1 -1
  26. package/build/commands/migrateProfile.js +1 -1
  27. package/build/commands/setup/claude.js +1 -1
  28. package/build/commands/setup/opencode.js +1 -1
  29. package/build/commands/setupCi.js +1 -1
  30. package/build/commands/skillup.js +1 -1
  31. package/build/commands/start.js +1 -1
  32. package/build/commands/status.js +1 -1
  33. package/build/commands/update.js +1 -1
  34. package/build/commands/updateEnv.js +1 -1
  35. package/build/commands/useEnv.js +1 -1
  36. package/build/commands/utils/activeProfile.js +1 -1
  37. package/build/commands/utils/agentEnv.js +1 -1
  38. package/build/commands/utils/browserSessionsApi.js +1 -1
  39. package/build/commands/utils/claudeConfig.js +1 -1
  40. package/build/commands/utils/claudeOverrideSettings.js +1 -1
  41. package/build/commands/utils/claudePlugin.js +1 -1
  42. package/build/commands/utils/cloudProfile.js +1 -1
  43. package/build/commands/utils/cloudProfileSession.js +1 -1
  44. package/build/commands/utils/crypto.js +1 -1
  45. package/build/commands/utils/desirePathLog.js +1 -1
  46. package/build/commands/utils/deviceAuth.js +1 -1
  47. package/build/commands/utils/environment.js +1 -1
  48. package/build/commands/utils/featureApi.js +1 -1
  49. package/build/commands/utils/fixWebmDuration.js +1 -1
  50. package/build/commands/utils/gitTracked.js +1 -1
  51. package/build/commands/utils/keychain.js +1 -1
  52. package/build/commands/utils/legacyWarning.js +1 -1
  53. package/build/commands/utils/localAgentInstallationsApi.js +1 -1
  54. package/build/commands/utils/matchAuthEnvironment.js +1 -1
  55. package/build/commands/utils/mcpImageBase64.js +1 -1
  56. package/build/commands/utils/model.js +1 -1
  57. package/build/commands/utils/novaActCli.js +1 -1
  58. package/build/commands/utils/opencodeConfig.js +1 -1
  59. package/build/commands/utils/organizationEnvApi.js +1 -1
  60. package/build/commands/utils/playwrightCli.js +1 -1
  61. package/build/commands/utils/profileMessages.js +1 -1
  62. package/build/commands/utils/profileSetupBanner.js +1 -1
  63. package/build/commands/utils/projectsConfig.js +1 -1
  64. package/build/commands/utils/rangerConfig.js +1 -1
  65. package/build/commands/utils/rangerRoot.js +1 -1
  66. package/build/commands/utils/rangerwrightCli.js +1 -1
  67. package/build/commands/utils/resolveProfileContext.js +1 -1
  68. package/build/commands/utils/resolveProfileUrl.js +1 -1
  69. package/build/commands/utils/retry.js +1 -1
  70. package/build/commands/utils/sessionCache.js +1 -1
  71. package/build/commands/utils/settings.js +1 -1
  72. package/build/commands/utils/skillContent.js +1 -1
  73. package/build/commands/utils/skills.js +1 -1
  74. package/build/commands/utils/stitchWebmFiles.js +1 -1
  75. package/build/commands/utils/telemetry.js +1 -1
  76. package/build/commands/utils/tokenRefresh.js +1 -1
  77. package/build/commands/utils/traceSnapshotMapper.js +1 -1
  78. package/build/commands/utils/tunnelClient.js +1 -1
  79. package/build/commands/utils/userApi.js +1 -1
  80. package/build/commands/utils/version.js +1 -1
  81. package/build/commands/verifyFeature.js +1 -1
  82. package/build/commands/verifyFeatureCli.js +1 -1
  83. package/build/commands/verifyFeatureNovaCli.js +1 -1
  84. package/build/commands/verifyFeatureRangerwrightCli.js +1 -1
  85. package/package.json +2 -2
@@ -1 +1 @@
1
- const _0x184572=_0x4cf0;(function(_0x4ab5d1,_0x5a7055){const _0x3c31b7=_0x4cf0,_0x49a013=_0x4ab5d1();while(!![]){try{const _0x17475f=-parseInt(_0x3c31b7(0x253))/0x1*(-parseInt(_0x3c31b7(0x24e))/0x2)+-parseInt(_0x3c31b7(0x203))/0x3+parseInt(_0x3c31b7(0x273))/0x4*(parseInt(_0x3c31b7(0x265))/0x5)+parseInt(_0x3c31b7(0x1e3))/0x6*(-parseInt(_0x3c31b7(0x21f))/0x7)+parseInt(_0x3c31b7(0x1f8))/0x8+-parseInt(_0x3c31b7(0x22f))/0x9+parseInt(_0x3c31b7(0x27b))/0xa;if(_0x17475f===_0x5a7055)break;else _0x49a013['push'](_0x49a013['shift']());}catch(_0x2f2af1){_0x49a013['push'](_0x49a013['shift']());}}}(_0x2911,0x41d30));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';function _0x2911(){const _0x444831=['aIYTW','EnDwU','tunnel_session_id','GsQxl','environmentKey','fPFbs','/api/v1/profiles','agent','XCfdM','VofsB','wsEndpoint','nooqj','not_configured','host','YmYUi','2282144mDfuLR','upmVj','\x20\x20forceLogin\x20enabled\x20for\x20\x22','\x22\x20failed\x20validation\x20—\x20refreshing...','setupHeaders','JALmf','cwhpo','json','status','WMJjh','xDmVZ','1090851nAokft','Cloud\x20profile\x20\x22','trackPhaseStart','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','browserOptions','password','close','PUT','tunnel_bridge_event','GumKD','some','launch','profiles','username','storageStatePath','\x20failed\x20(','DIxCv','RANGER_TEST_PASSWORD','tunnel_login_setup','map','trim','):\x20','POST','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','AxJrt','log','error','headers','21hArvFp','VHHSl','lvhoe','vqKGW','invalid-url','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','RANGER_TEST_USERNAME','eVRwr','\x20\x20Cloud\x20session\x20for\x20\x22','/api/v1/tunnel/sessions','invalidateOn','storageState','stringify','WEznm','\x20\x20No\x20live\x20session\x20for\x20\x22','test_output','4741164rbhzqD','QFJiu','confirm','Browser\x20login\x20timed\x20out\x20after\x20','dQSHX','pPxZh','split','Bearer\x20','zuVXS','message','save','\x22;\x20proceeding\x20with\x20loginInstructions.','Browser\x20login\x20timed\x20out\x20before\x20completion.','uQUNL','kqlhl',').\x20','NphHD','then','sessionId','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','MLnda','fmtWV','MMUlt','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','auth','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','ZECEP','targetUrl','extraHTTPHeaders','join','sessionState','34hhgQnZ','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','ziSAZ','you\x27re\x20now\x20at\x20\x22','IqEqE','12585bBNcol','code','vUSPj','env','pendingLocalConnections','loginInstructions','\x22\x20not\x20found.','\x22\x20on\x20profile\x20\x22','settings','tGNEd','origin','parse','type','newPage','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','cookies','TXAXx','\x22,\x20refreshing\x20session...','1280225qSTAEc','/api/v1/profiles/','userAgent','telemetry','string','pwEndpoint','activeLocalConnections','force','\x20\x20Cached\x20session\x20for\x20\x22','tunnel_login_request','uqYlq','GLsYf','keys','QheIp','4wYrVFv','forceLogin','baseUrl','name','XOhAe','pw_endpoint','length','trackPhaseEnd','6167930LXTuDq','domains','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','/session','organizationId','newContext','tunnel_login_cleanup','bypMb','utf-8','tunnel','catch','aeibO','kTWnS','jAsnj','OiJhf','424044WBYkPJ','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','\x22,\x20cached\x20locally','persistSessionState','OvVCC','trackPhaseError'];_0x2911=function(){return _0x444831;};return _0x2911();}import _0x4e7ffc 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';function targetHostForTelemetry(_0x10020f){const _0x4bf5a4=_0x4cf0;try{return new URL(_0x10020f)[_0x4bf5a4(0x1f6)];}catch{return _0x4bf5a4(0x223);}}function _0x4cf0(_0x35c324,_0x4706fb){_0x35c324=_0x35c324-0x1dc;const _0x29112b=_0x2911();let _0x4cf093=_0x29112b[_0x35c324];return _0x4cf093;}function errorMessageForTelemetry(_0x53d88a){const _0x568b82={'AugqC':function(_0x1d886e,_0x152abd){return _0x1d886e instanceof _0x152abd;}};return _0x568b82['AugqC'](_0x53d88a,Error)?_0x53d88a['message']:undefined;}function trackBridgeEvent(_0x558cdd,_0x44d57e){const _0x546450=_0x4cf0,_0x571793={'sJHSZ':_0x546450(0x20b),'HzXqk':'tunnel_error'};if(!_0x558cdd)return;const _0x41ec57={'tunnelSessionId':_0x44d57e['sessionId'],'tunnelEventType':_0x44d57e[_0x546450(0x25f)],'connectionId':_0x44d57e['connectionId'],'code':_0x44d57e[_0x546450(0x254)],'reason':_0x44d57e['reason'],'error':_0x44d57e['error'],'elapsedMs':_0x44d57e['elapsedMs'],'activeLocalConnections':_0x44d57e[_0x546450(0x26b)],'pendingLocalConnections':_0x44d57e[_0x546450(0x257)]};_0x558cdd[_0x546450(0x27a)](_0x571793['sJHSZ'],_0x41ec57),(_0x44d57e['type']===_0x571793['HzXqk']||_0x44d57e['type']==='local_ws_error')&&void _0x558cdd[_0x546450(0x1e8)]('tunnel_bridge',new Error(_0x44d57e['error']??_0x44d57e[_0x546450(0x25f)]),_0x41ec57);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x356d6f={'TyZMw':function(_0x2aa18c){return _0x2aa18c();}},_0xe4b917=await _0x356d6f['TyZMw'](getToken);if(!_0xe4b917)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');return _0xe4b917;}async function apiRequest(_0x328aeb,_0x4aea38={}){const _0x14622a=_0x4cf0,_0x5a4484={'fmtWV':function(_0xb6558d,_0x5a089a,_0x5a0b58){return _0xb6558d(_0x5a089a,_0x5a0b58);},'bypMb':'application/json','ovKwz':function(_0x5390b5,_0x4144fc){return _0x5390b5===_0x4144fc;},'EjJCR':_0x14622a(0x269)},_0x729535=await requireToken(),_0x16a6e6=getApiBaseUrl(),_0x6b2e3=await _0x5a4484[_0x14622a(0x244)](fetch,''+_0x16a6e6+_0x328aeb,{..._0x4aea38,'headers':{'Authorization':_0x14622a(0x236)+_0x729535,'Content-Type':_0x5a4484[_0x14622a(0x282)],..._0x4aea38[_0x14622a(0x21e)]??{}}});if(!_0x6b2e3['ok']){let _0x29f75f='',_0x35640f;try{const _0x308550=await _0x6b2e3[_0x14622a(0x1ff)]();_0x29f75f=(_0x5a4484['ovKwz'](typeof _0x308550['error'],_0x14622a(0x269))?_0x308550[_0x14622a(0x21d)]:undefined)??JSON['stringify'](_0x308550);if(_0x5a4484['ovKwz'](typeof _0x308550[_0x14622a(0x254)],_0x5a4484['EjJCR']))_0x35640f=_0x308550['code'];}catch{_0x29f75f=_0x6b2e3['statusText'];}throw new ApiError('API\x20request\x20'+_0x328aeb+_0x14622a(0x212)+_0x6b2e3[_0x14622a(0x200)]+_0x14622a(0x218)+_0x29f75f,_0x6b2e3[_0x14622a(0x200)],_0x29f75f,_0x35640f);}if(_0x6b2e3[_0x14622a(0x200)]===0xcc)return undefined;return _0x6b2e3[_0x14622a(0x1ff)]();}export class ApiError extends Error{[_0x184572(0x200)];['detail'];['code'];constructor(_0x23374b,_0x1839e6,_0x405e62,_0x199314){const _0x2f7ba6=_0x184572,_0x569763={'zvame':'0|1|3|2|4','QqOnK':'ApiError'},_0x372156=_0x569763['zvame'][_0x2f7ba6(0x235)]('|');let _0x268002=0x0;while(!![]){switch(_0x372156[_0x268002++]){case'0':super(_0x23374b);continue;case'1':this[_0x2f7ba6(0x200)]=_0x1839e6;continue;case'2':this[_0x2f7ba6(0x254)]=_0x199314;continue;case'3':this['detail']=_0x405e62;continue;case'4':this['name']=_0x569763['QqOnK'];continue;}break;}}}export async function fetchCloudProfile(_0x177840){const _0x2cb38d=_0x184572,_0x2355cb={'xDmVZ':function(_0x4db74b,_0x3b7b52){return _0x4db74b(_0x3b7b52);},'fZwGk':function(_0x322b98,_0x1930ea){return _0x322b98===_0x1930ea;}};try{return await apiRequest(_0x2cb38d(0x266)+_0x2355cb[_0x2cb38d(0x202)](encodeURIComponent,_0x177840));}catch(_0x1c5494){if(_0x1c5494 instanceof ApiError&&_0x2355cb['fZwGk'](_0x1c5494['status'],0x194))return null;throw _0x1c5494;}}export async function listCloudProfiles(){const _0x1fa798=_0x184572,_0x513bf8=await apiRequest('/api/v1/profiles');return _0x513bf8[_0x1fa798(0x20f)];}export async function deleteCloudProfile(_0x40f240){const _0x4c8c25=_0x184572,_0x41fbf7={'EnDwU':function(_0x251031,_0x3de119,_0x943ce6){return _0x251031(_0x3de119,_0x943ce6);},'TXAXx':function(_0x48b25d,_0x396cd8){return _0x48b25d(_0x396cd8);},'xhpvD':function(_0x211bc3,_0x27d8af){return _0x211bc3 instanceof _0x27d8af;},'fPFbs':function(_0x8a7451,_0x55f50e){return _0x8a7451===_0x55f50e;}};try{await _0x41fbf7[_0x4c8c25(0x1ea)](apiRequest,_0x4c8c25(0x266)+_0x41fbf7[_0x4c8c25(0x263)](encodeURIComponent,_0x40f240),{'method':'DELETE'});}catch(_0x2d037a){if(_0x41fbf7['xhpvD'](_0x2d037a,ApiError)&&_0x41fbf7[_0x4c8c25(0x1ee)](_0x2d037a['status'],0x194))throw new Error(_0x4c8c25(0x204)+_0x40f240+_0x4c8c25(0x259));throw _0x2d037a;}}export async function createCloudProfile(_0x3b25a6,_0x5cc87d,_0x51bf46={}){const _0x2fd2d6=_0x184572,_0xbe2650={'eVRwr':_0x2fd2d6(0x1ef),'QzYUd':'POST'},_0x25399b={'name':_0x3b25a6};if(_0x5cc87d)_0x25399b['environment_key']=_0x5cc87d;_0x51bf46[_0x2fd2d6(0x25b)]&&Object[_0x2fd2d6(0x271)](_0x51bf46[_0x2fd2d6(0x25b)])[_0x2fd2d6(0x279)]>0x0&&(_0x25399b['settings']=_0x51bf46[_0x2fd2d6(0x25b)]);if(_0x51bf46[_0x2fd2d6(0x210)])_0x25399b['username']=_0x51bf46[_0x2fd2d6(0x210)];if(_0x51bf46[_0x2fd2d6(0x208)])_0x25399b[_0x2fd2d6(0x208)]=_0x51bf46[_0x2fd2d6(0x208)];return await apiRequest(_0xbe2650[_0x2fd2d6(0x226)],{'method':_0xbe2650['QzYUd'],'body':JSON[_0x2fd2d6(0x22b)](_0x25399b)});}export async function uploadCloudProfileSession(_0x2ea8f1,_0x25c583){const _0x1e6a31=_0x184572,_0x1ad1d6={'DtwqD':function(_0x123e51,_0x3b9707,_0x3a9c6e){return _0x123e51(_0x3b9707,_0x3a9c6e);}};return await _0x1ad1d6['DtwqD'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x2ea8f1)+_0x1e6a31(0x27e),{'method':'POST','body':JSON[_0x1e6a31(0x22b)]({'session_state':_0x25c583})});}export async function saveCloudProfileCredentials(_0x28bb50,_0x550c25,_0x7acf38){const _0x5dac92=_0x184572,_0x5705a9={'wXysQ':function(_0x3d64bf,_0x1cdd18,_0x2eeb35){return _0x3d64bf(_0x1cdd18,_0x2eeb35);},'ziSAZ':function(_0x4153e6,_0x2d4711){return _0x4153e6(_0x2d4711);},'npsaQ':_0x5dac92(0x20a)};await _0x5705a9['wXysQ'](apiRequest,'/api/v1/profiles/'+_0x5705a9[_0x5dac92(0x250)](encodeURIComponent,_0x28bb50),{'method':_0x5705a9['npsaQ'],'body':JSON[_0x5dac92(0x22b)]({'username':_0x550c25,'password':_0x7acf38})});}export async function fetchAuthConfig(){const _0x5b2c68=_0x184572,_0x385b5c={'AWWtL':function(_0x57c2b5,_0x73c3f1){return _0x57c2b5(_0x73c3f1);}};try{const _0x2ecfd1=await _0x385b5c['AWWtL'](apiRequest,'/api/v1/profiles/auth-config');return _0x2ecfd1['auth_config'];}catch(_0x1bca34){return _0x1bca34 instanceof ApiError&&_0x1bca34['status']!==0x194&&console['error'](_0x5b2c68(0x21a)+_0x1bca34[_0x5b2c68(0x238)]),null;}}async function createTunnelSession(_0x19dc30){const _0x2510a3=_0x184572,_0x1f946f={'XsMIM':function(_0x59d51d,_0x1a6d82,_0xb8b51a){return _0x59d51d(_0x1a6d82,_0xb8b51a);},'YawRi':_0x2510a3(0x228)};return await _0x1f946f['XsMIM'](apiRequest,_0x1f946f['YawRi'],{'method':_0x2510a3(0x219),'body':JSON[_0x2510a3(0x22b)]({'targetUrl':_0x19dc30,'mode':_0x2510a3(0x1f0)})});}async function deleteTunnelSession(_0x789413){const _0x32c3c9=_0x184572,_0x598e17={'YmYUi':function(_0xb74327,_0x43c5ac,_0x3cbd36){return _0xb74327(_0x43c5ac,_0x3cbd36);},'QheIp':'DELETE'};await _0x598e17[_0x32c3c9(0x1f7)](apiRequest,'/api/v1/tunnel/sessions/'+_0x789413,{'method':_0x598e17[_0x32c3c9(0x272)]});}export function pickAdHocEnvKey(_0x5cd0f7){const _0x161c72=_0x184572,_0x24edcc={'blAiZ':function(_0x5c4d81,_0xfb6a02){return _0x5c4d81===_0xfb6a02;},'AxJrt':function(_0xacf9c,_0x3bc7a2){return _0xacf9c+_0x3bc7a2;}};if(!_0x5cd0f7)return null;if(_0x5cd0f7['defaultEnvironmentKey'])return _0x5cd0f7['defaultEnvironmentKey'];const _0x507057=Object[_0x161c72(0x271)](_0x5cd0f7['environments']??{});if(_0x24edcc['blAiZ'](_0x507057['length'],0x1))return _0x507057[0x0];if(_0x507057['length']===0x0)return null;throw new Error(_0x24edcc[_0x161c72(0x21b)]('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x507057[_0x161c72(0x24c)](',\x20')+_0x161c72(0x23e),'Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.'));}export async function resolveAdHocProfile(_0xea6e79=process['env']){const _0x4a3de3=_0x184572,_0x14c596={'uVocd':function(_0x4322d5,_0x363e07){return _0x4322d5(_0x363e07);},'tvuPJ':function(_0x1444d4){return _0x1444d4();},'OiJhf':function(_0x21c9d1,_0x36a53f,_0x55c7c2,_0x189565){return _0x21c9d1(_0x36a53f,_0x55c7c2,_0x189565);}},_0xca43c0=_0xea6e79[_0x4a3de3(0x225)];if(!_0xca43c0)return null;const _0x2cb927=await _0x14c596['uVocd'](fetchCloudProfile,_0xca43c0);if(_0x2cb927)return{'name':_0x2cb927[_0x4a3de3(0x276)],'profile':_0x2cb927};const _0x2deb0e=await _0x14c596['tvuPJ'](fetchAuthConfig),_0x2db4af=pickAdHocEnvKey(_0x2deb0e),_0x4a7089=_0xea6e79[_0x4a3de3(0x214)],_0x470c6e=await _0x14c596[_0x4a3de3(0x1e2)](createCloudProfile,_0xca43c0,_0x2db4af??undefined,{'username':_0xca43c0,'password':_0x4a7089});return console['log']('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x470c6e[_0x4a3de3(0x276)]+'\x22\x20for\x20'+_0xca43c0),{'name':_0x470c6e['name'],'profile':_0x470c6e};}export async function writeSessionToLocalCache(_0x58c2d5,_0x7a27e8,_0x203828,_0x6bfa8e,_0x549fae,_0x2975d9,_0x5a2689){const _0x2a301b=_0x184572,_0x1a25a0={'AxbIn':function(_0x3d96d9,_0x475fe6){return _0x3d96d9(_0x475fe6);},'OvVCC':function(_0x3612c5,_0x13ca0f,_0x4087ca){return _0x3612c5(_0x13ca0f,_0x4087ca);},'xtLDn':function(_0x5c3634,_0x9d0300,_0x389057){return _0x5c3634(_0x9d0300,_0x389057);},'GLsYf':function(_0xe2041d,_0x148baf,_0x4949db){return _0xe2041d(_0x148baf,_0x4949db);}},_0x3d281d=_0x1a25a0['AxbIn'](sessionCacheHash,{'orgId':_0x7a27e8,'profileName':_0x58c2d5,'effectiveBaseUrl':_0x203828,'setupHeaders':_0x6bfa8e,'invalidateOn':_0x5a2689?.['invalidateOn'],'userAgent':_0x5a2689?.['userAgent'],'clientIp':_0x5a2689?.['clientIp']}),_0x5e4c7d=_0x1a25a0[_0x2a301b(0x1e7)](getSessionCachePath,_0x3d281d,_0x58c2d5),_0x4fa36e=join(getRangerHomeDir(),_0x2a301b(0x247));!existsSync(_0x4fa36e)&&await _0x1a25a0[_0x2a301b(0x1e7)](mkdir,_0x4fa36e,{'recursive':!![]});const _0x2a8c7e={..._0x549fae};_0x2975d9&&_0x2975d9[_0x2a301b(0x279)]>0x0&&Array['isArray'](_0x2a8c7e[_0x2a301b(0x262)])&&(_0x2a8c7e['cookies']=_0x1a25a0['xtLDn'](duplicateCookiesForDomains,_0x2a8c7e[_0x2a301b(0x262)],_0x2975d9));const _0xe4cc54={'cached_at':new Date()['toISOString'](),'session_state':_0x2a8c7e};await _0x1a25a0[_0x2a301b(0x270)](writeFile,_0x5e4c7d,JSON[_0x2a301b(0x22b)](_0xe4cc54,null,0x2));const _0x50c85a=getStorageStatePath(_0x5e4c7d);return await writeFile(_0x50c85a,JSON[_0x2a301b(0x22b)](_0x2a8c7e,null,0x2)),_0x50c85a;}export async function checkLocalCache(_0x21eccb,_0x1c020c,_0x2d4854,_0x22a2b6,_0xface6a){const _0x35ef35=_0x184572,_0x3e4c17={'zuVXS':function(_0x11b0a9,_0x5d13e2){return _0x11b0a9(_0x5d13e2);},'aIYTW':function(_0x2539de,_0x434268,_0x496248){return _0x2539de(_0x434268,_0x496248);},'MMUlt':function(_0x35592e,_0x52057b,_0xa04d96){return _0x35592e(_0x52057b,_0xa04d96);},'WGrZB':_0x35ef35(0x1dc)},_0x1741f5=_0x3e4c17[_0x35ef35(0x237)](sessionCacheHash,{'orgId':_0x1c020c,'profileName':_0x21eccb,'effectiveBaseUrl':_0x2d4854,'setupHeaders':_0x22a2b6,'invalidateOn':_0xface6a?.['invalidateOn'],'userAgent':_0xface6a?.[_0x35ef35(0x267)],'clientIp':_0xface6a?.['clientIp']}),_0x5f5396=_0x3e4c17[_0x35ef35(0x1e9)](getSessionCachePath,_0x1741f5,_0x21eccb),_0x29e538=_0x3e4c17['zuVXS'](getStorageStatePath,_0x5f5396);if(!existsSync(_0x5f5396)||!_0x3e4c17['zuVXS'](existsSync,_0x29e538))return null;try{const _0x2e0d7c=await _0x3e4c17[_0x35ef35(0x245)](readFile,_0x5f5396,_0x3e4c17['WGrZB']);return JSON[_0x35ef35(0x25e)](_0x2e0d7c),{'storageStatePath':_0x29e538};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x1e1c3f,_0x258144){const _0x1287ae=_0x184572,_0x565ecf={'GumKD':function(_0x2f7635,_0x29a152){return _0x2f7635===_0x29a152;},'cdPWZ':function(_0x1d59d9,_0x46be8b){return _0x1d59d9+_0x46be8b;}};if(!_0x258144||!_0x258144['domains']?.['length'])return;let _0x485dc3;try{_0x485dc3=new URL(_0x1e1c3f);}catch{return;}const _0x46449d=[];for(const _0x3db1df of _0x258144['domains']){try{_0x46449d['push']({'raw':_0x3db1df,'url':new URL(_0x3db1df)});}catch{}}if(_0x565ecf[_0x1287ae(0x20c)](_0x46449d['length'],0x0))return;if(_0x46449d[_0x1287ae(0x20d)](_0x42ad7f=>_0x42ad7f['url']['origin']===_0x485dc3[_0x1287ae(0x25d)]))return;const _0xfaedd0=_0x46449d[_0x1287ae(0x216)](_0x992e29=>'\x22'+_0x992e29['raw']+'\x22')['join'](',\x20');console['log'](_0x565ecf['cdPWZ']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0xfaedd0+';\x20'+(_0x1287ae(0x251)+_0x1e1c3f+_0x1287ae(0x1e4)),'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.'));}export async function serverSideLogin(_0x373bde,_0x780bb1){const _0x16e93c=_0x184572,_0x5331ba={'kqlhl':function(_0x5c4b69,_0x2c8ab8){return _0x5c4b69(_0x2c8ab8);},'NphHD':function(_0x2a93df,_0x3f05e2){return _0x2a93df===_0x3f05e2;},'iFalo':'not_configured'},_0x2f578c=process['env']['RANGER_TEST_USERNAME'],_0x3e5bfc=process['env']['RANGER_TEST_PASSWORD'],_0x234b24={};if(_0x2f578c)_0x234b24['username']=_0x2f578c;if(_0x3e5bfc)_0x234b24[_0x16e93c(0x208)]=_0x3e5bfc;if(_0x780bb1?.[_0x16e93c(0x26c)])_0x234b24['force']=!![];if(_0x780bb1?.[_0x16e93c(0x24a)])_0x234b24['target_url']=_0x780bb1[_0x16e93c(0x24a)];_0x780bb1?.['tunnel']&&(_0x234b24[_0x16e93c(0x1eb)]=_0x780bb1[_0x16e93c(0x1dd)][_0x16e93c(0x241)],_0x234b24[_0x16e93c(0x278)]=_0x780bb1['tunnel'][_0x16e93c(0x26a)]);try{return await apiRequest(_0x16e93c(0x266)+_0x5331ba[_0x16e93c(0x23d)](encodeURIComponent,_0x373bde)+'/login',{'method':'POST','body':JSON[_0x16e93c(0x22b)](_0x234b24)});}catch(_0x305ee2){if(_0x305ee2 instanceof ApiError&&_0x5331ba[_0x16e93c(0x23f)](_0x305ee2[_0x16e93c(0x200)],0x190)&&_0x305ee2[_0x16e93c(0x254)]===_0x5331ba['iFalo'])return{'status':_0x16e93c(0x1f5),'error':_0x305ee2['detail']};throw _0x305ee2;}}async function serverSideLoginWithOptionalTunnel(_0x20dc38,_0x3e4e16,_0x25d862={}){const _0x2aa7d7=_0x184572,_0x3f3335={'QFJiu':_0x2aa7d7(0x26e),'ydIgn':function(_0x1faf0a,_0x8e3933){return _0x1faf0a(_0x8e3933);},'lvhoe':function(_0x34d396,_0x4fed3f){return _0x34d396(_0x4fed3f);},'JALmf':function(_0x88fa5,_0x2fed19){return _0x88fa5(_0x2fed19);},'uiwhx':function(_0x3dde8e,_0xe7b830,_0x58f23e){return _0x3dde8e(_0xe7b830,_0x58f23e);},'ZECEP':function(_0x2285e2,_0x1ee221){return _0x2285e2??_0x1ee221;},'IqEqE':_0x2aa7d7(0x215),'zJKwR':function(_0x5f5146,_0xc83c27){return _0x5f5146||_0xc83c27;},'ArAlq':'3|1|0|4|2'};if(!_0x3f3335['ydIgn'](needsTunnel,_0x3e4e16))return await serverSideLogin(_0x20dc38,{'force':_0x25d862[_0x2aa7d7(0x26c)]});let _0x503dc1=null,_0x1e31b5=null,_0x42947b=null,_0x51e926=null,_0x4f0a33=![];const _0x1c4a65={'profileName':_0x20dc38,'targetUrlHost':targetHostForTelemetry(_0x3e4e16),'tunnelRequired':!![],'forceLogin':Boolean(_0x25d862[_0x2aa7d7(0x26c)])};try{_0x25d862[_0x2aa7d7(0x268)]?.[_0x2aa7d7(0x205)]('tunnel_login_setup',_0x1c4a65),_0x503dc1=await _0x3f3335[_0x2aa7d7(0x221)](launchBrowserServer,{'headless':!![]}),_0x1e31b5=await _0x3f3335[_0x2aa7d7(0x1fd)](createTunnelSession,_0x3e4e16);const _0x50d6e1=await requireToken();_0x42947b=await _0x3f3335['lvhoe'](createTunnelBridge,{'localWsUrl':_0x503dc1[_0x2aa7d7(0x1f3)],'tunnelServerUrl':_0x1e31b5['tunnelUrl'],'sessionId':_0x1e31b5['sessionId'],'apiKey':_0x50d6e1,'onError':_0x23b084=>{_0x51e926=_0x23b084;},'onClose':()=>{const _0x151dfa=_0x2aa7d7;_0x51e926??=new Error(_0x151dfa(0x242)+_0x20dc38);},'onEvent':_0x2592e4=>trackBridgeEvent(_0x25d862['telemetry'],_0x2592e4)}),_0x25d862[_0x2aa7d7(0x268)]?.['trackPhaseEnd'](_0x2aa7d7(0x215),{..._0x1c4a65,'tunnelSessionId':_0x1e31b5['sessionId'],'localBrowserServer':!![]}),_0x4f0a33=!![];try{return _0x25d862[_0x2aa7d7(0x268)]?.['trackPhaseStart'](_0x3f3335[_0x2aa7d7(0x230)],{..._0x1c4a65,'tunnelSessionId':_0x1e31b5['sessionId']}),await _0x3f3335['uiwhx'](serverSideLogin,_0x20dc38,{'force':_0x25d862[_0x2aa7d7(0x26c)],'targetUrl':_0x3e4e16,'tunnel':{'sessionId':_0x1e31b5['sessionId'],'pwEndpoint':_0x1e31b5[_0x2aa7d7(0x26a)]}})[_0x2aa7d7(0x240)](_0x2800c1=>{const _0x1cb40d=_0x2aa7d7;return _0x25d862['telemetry']?.[_0x1cb40d(0x27a)](_0x3f3335[_0x1cb40d(0x230)],{..._0x1c4a65,'tunnelSessionId':_0x1e31b5?.[_0x1cb40d(0x241)],'loginStatus':_0x2800c1['status'],'hasSessionState':Boolean(_0x2800c1['session_state']),'hasTestOutput':Boolean(_0x2800c1['test_output']),'bridgeError':errorMessageForTelemetry(_0x51e926)}),_0x2800c1;});}catch(_0x4d10b4){await _0x25d862['telemetry']?.[_0x2aa7d7(0x1e8)]('tunnel_login_request',_0x51e926??_0x4d10b4,{..._0x1c4a65,'tunnelSessionId':_0x1e31b5[_0x2aa7d7(0x241)],'bridgeError':errorMessageForTelemetry(_0x51e926)});throw _0x3f3335[_0x2aa7d7(0x249)](_0x51e926,_0x4d10b4);}}catch(_0x1f18be){!_0x4f0a33&&await _0x25d862['telemetry']?.['trackPhaseError'](_0x3f3335[_0x2aa7d7(0x252)],_0x1f18be,{..._0x1c4a65,'tunnelSessionId':_0x1e31b5?.[_0x2aa7d7(0x241)]});throw _0x1f18be;}finally{if(_0x3f3335['zJKwR'](_0x1e31b5,_0x503dc1)||_0x42947b){const _0x593045=_0x3f3335['ArAlq']['split']('|');let _0x3efc96=0x0;while(!![]){switch(_0x593045[_0x3efc96++]){case'0':_0x503dc1&&await _0x503dc1[_0x2aa7d7(0x209)]()[_0x2aa7d7(0x1de)](()=>{});continue;case'1':_0x42947b?.[_0x2aa7d7(0x209)]();continue;case'2':_0x25d862['telemetry']?.[_0x2aa7d7(0x27a)](_0x2aa7d7(0x281),{..._0x1c4a65,'tunnelSessionId':_0x1e31b5?.[_0x2aa7d7(0x241)]});continue;case'3':_0x25d862['telemetry']?.[_0x2aa7d7(0x205)]('tunnel_login_cleanup',{..._0x1c4a65,'tunnelSessionId':_0x1e31b5?.['sessionId']});continue;case'4':_0x1e31b5&&await deleteTunnelSession(_0x1e31b5[_0x2aa7d7(0x241)])[_0x2aa7d7(0x1de)](()=>{});continue;}break;}}}}export async function manualBrowserLogin(_0x17a0f4,_0xe7f444,_0x13edd8={}){const _0x2310aa=_0x184572,_0x1fd2cc={'uqYlq':function(_0x3d46f9,_0x3d0a85){return _0x3d46f9/_0x3d0a85;},'tGNEd':function(_0x2d9e9c,_0x27c34b){return _0x2d9e9c(_0x27c34b);},'dHCuO':function(_0x3ab88a,_0x9af3c4,_0x511c2e){return _0x3ab88a(_0x9af3c4,_0x511c2e);},'nooqj':_0x2310aa(0x209),'jAsnj':function(_0x5e625a){return _0x5e625a();},'XCfdM':function(_0x51559c,_0x1ab37b){return _0x51559c+_0x1ab37b;},'Dqazz':'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','pPxZh':function(_0x25a471,_0x3a04ef){return _0x25a471>_0x3a04ef;},'koUSH':_0x2310aa(0x246),'uQUNL':function(_0x4d5443,_0x55c337){return _0x4d5443&&_0x55c337;},'dQSHX':_0x2310aa(0x23b),'vqKGW':function(_0x468c99,_0x478e1b){return _0x468c99!==_0x478e1b;},'MLnda':function(_0xfede26,_0x544303,_0x408562){return _0xfede26(_0x544303,_0x408562);},'cwhpo':'POST'};if(!_0x1fd2cc[_0x2310aa(0x1e1)](isInteractive))throw new Error(_0x1fd2cc[_0x2310aa(0x1f1)](_0x2310aa(0x224)+_0x17a0f4['name']+'\x22.\x0a',_0x1fd2cc['Dqazz'])+'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.');const _0x3fa24a=_0xe7f444&&_0x1fd2cc[_0x2310aa(0x234)](_0xe7f444['domains']['length'],0x0)?_0xe7f444[_0x2310aa(0x27c)][0x0]:'about:blank';console['log'](_0x1fd2cc['koUSH']),console[_0x2310aa(0x21c)](_0x2310aa(0x206)),await new Promise(_0x71aeb0=>setTimeout(_0x71aeb0,0x7d0));const _0x280009=await chromium[_0x2310aa(0x20e)]({'headless':![]});let _0x564497=null;try{const _0x499f56={'ignoreHTTPSErrors':!![]};_0xe7f444?.[_0x2310aa(0x1fc)]&&(_0x499f56[_0x2310aa(0x24b)]=_0xe7f444['setupHeaders']);const _0x4d48d4=await _0x280009[_0x2310aa(0x280)](_0x499f56);await addProfileSetupBanner(_0x4d48d4);const _0x195784=await _0x4d48d4[_0x2310aa(0x260)]();await _0x195784['goto'](_0x3fa24a);let _0x35f0b9=![];await new Promise(_0x378141=>{const _0x3e4788=_0x2310aa,_0x20b17e={'IHusB':function(_0x54c477,_0x4b666a){const _0x16f49f=_0x4cf0;return _0x1fd2cc[_0x16f49f(0x26f)](_0x54c477,_0x4b666a);},'WMJjh':function(_0xbf9069,_0x6b6ce4){const _0x2c5517=_0x4cf0;return _0x1fd2cc[_0x2c5517(0x25c)](_0xbf9069,_0x6b6ce4);},'pxwQo':function(_0x24ddc9){return _0x24ddc9();}},_0x225747=_0x1fd2cc['dHCuO'](setTimeout,()=>{const _0x59a223=_0x4cf0;_0x35f0b9=!![],console[_0x59a223(0x21d)](_0x59a223(0x232)+_0x20b17e['IHusB'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x378141();},MANUAL_LOGIN_TIMEOUT_MS);_0x195784['on'](_0x1fd2cc[_0x3e4788(0x1f4)],async()=>{const _0x525ae7=_0x3e4788;_0x20b17e[_0x525ae7(0x201)](clearTimeout,_0x225747);try{const _0x17dd45=await _0x4d48d4[_0x525ae7(0x22a)]();_0x564497=_0x17dd45;}catch{}_0x20b17e['pxwQo'](_0x378141);});});if(_0x1fd2cc[_0x2310aa(0x23c)](_0x35f0b9,!_0x564497))throw new Error(_0x1fd2cc[_0x2310aa(0x233)]);}finally{await _0x280009[_0x2310aa(0x209)]()[_0x2310aa(0x1de)](()=>{});}if(!_0x564497)throw new Error(_0x2310aa(0x248));return _0x1fd2cc[_0x2310aa(0x222)](_0x13edd8[_0x2310aa(0x1e6)],![])&&await _0x1fd2cc[_0x2310aa(0x243)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x17a0f4[_0x2310aa(0x276)])+'/session',{'method':_0x1fd2cc[_0x2310aa(0x1fe)],'body':JSON[_0x2310aa(0x22b)]({'session_state':_0x564497,'updated_by':'cli:manual-login'})}),{'sessionState':_0x564497};}export async function promptSaveCredentials(_0x5da02c){const _0x62fabd=_0x184572,_0x274404={'fRLvv':function(_0x380024,_0x13982e){return _0x380024||_0x13982e;},'ILXmL':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','csuVW':function(_0x2187ff,_0x467df7,_0x11d383){return _0x2187ff(_0x467df7,_0x11d383);},'upmVj':_0x62fabd(0x20a)},_0x5160b1=process[_0x62fabd(0x256)][_0x62fabd(0x225)],_0x437f81=process[_0x62fabd(0x256)]['RANGER_TEST_PASSWORD'];if(_0x274404['fRLvv'](!_0x5160b1,!_0x437f81))return;if(!isInteractive())return;const {save:_0x23c11d}=await _0x4e7ffc['prompt']([{'type':_0x62fabd(0x231),'name':_0x62fabd(0x239),'message':_0x274404['ILXmL'],'default':![]}]);if(!_0x23c11d)return;await _0x274404['csuVW'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x5da02c),{'method':_0x274404[_0x62fabd(0x1f9)],'body':JSON['stringify']({'username':_0x5160b1,'password':_0x437f81})}),console[_0x62fabd(0x21c)]('\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.');}export async function resolveCloudProfileSession(_0x2f0b2b,_0x270413={}){const _0x9a693=_0x184572,_0x5253d9={'XOhAe':function(_0x3d7f8a){return _0x3d7f8a();},'DIxCv':function(_0x326d81,_0x3fba33){return _0x326d81===_0x3fba33;},'VofsB':'string','NYGRV':function(_0x479c65,_0x4b28aa){return _0x479c65||_0x4b28aa;},'kTWnS':function(_0x55bda2,_0x1356b7){return _0x55bda2(_0x1356b7);},'qMBng':function(_0x277b28,_0x2fb315){return _0x277b28>_0x2fb315;},'zNOTc':function(_0x2b8a06,_0x312a1b){return _0x2b8a06(_0x312a1b);},'aeibO':function(_0x394967,_0xf4ef50,_0x4fdce0,_0x5420da,_0x5c8ee4,_0x4a0523){return _0x394967(_0xf4ef50,_0x4fdce0,_0x5420da,_0x5c8ee4,_0x4a0523);},'WxglA':function(_0x21cb25,_0x1cecca,_0x59dfa3){return _0x21cb25(_0x1cecca,_0x59dfa3);},'kPQnv':function(_0x1f1197,_0xd7afef,_0x13e82e){return _0x1f1197(_0xd7afef,_0x13e82e);},'VHHSl':function(_0x1e1c75,_0x57fda2){return _0x1e1c75(_0x57fda2);},'yWREa':function(_0x20299d,_0x228c97,_0x5dd9cc,_0x1e0eb1){return _0x20299d(_0x228c97,_0x5dd9cc,_0x1e0eb1);},'WEznm':function(_0x3ca172,_0x246cca,_0xd29d62){return _0x3ca172(_0x246cca,_0xd29d62);},'amRxQ':'not_configured','HSwQG':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','vUSPj':'\x20\x20Login\x20successful.\x20Session\x20cached.','OJKNW':'\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','PvcgX':_0x9a693(0x27d),'GsQxl':function(_0x3f7891,_0x3ea6a5,_0x5cd6f0,_0x2eb5b4){return _0x3f7891(_0x3ea6a5,_0x5cd6f0,_0x2eb5b4);}},_0x5acdc3=_0x2f0b2b[_0x9a693(0x25b)]??{},_0x17bfad=await _0x5253d9[_0x9a693(0x277)](fetchAuthConfig),_0x4650bf=_0x17bfad?resolveAuthEnvironmentLocally(_0x17bfad,_0x2f0b2b[_0x9a693(0x1ed)]):null,_0x32c49d=typeof _0x4650bf?.['loginInstructions']==='string'&&_0x4650bf['loginInstructions']['trim']()?_0x4650bf['loginInstructions']:undefined,_0xf9c7df=_0x5253d9['DIxCv'](typeof _0x5acdc3[_0x9a693(0x258)],_0x5253d9[_0x9a693(0x1f2)])&&_0x5acdc3[_0x9a693(0x258)][_0x9a693(0x217)]()?_0x5acdc3[_0x9a693(0x258)]:undefined,_0x4268d2=_0x5253d9['NYGRV'](_0xf9c7df,!_0x32c49d)?_0x5acdc3:{..._0x5acdc3,'loginInstructions':_0x32c49d},_0x1673a9=Boolean(_0x4268d2['loginInstructions']?.['trim']()),_0x45c579=_0x5253d9['kTWnS'](Boolean,_0x5acdc3[_0x9a693(0x274)]||_0x4650bf?.[_0x9a693(0x274)]),_0x11adab=_0x4650bf?.[_0x9a693(0x27c)],_0x297a7e=_0x5acdc3[_0x9a693(0x1fc)],_0x47ee59=_0x297a7e??_0x4650bf?.[_0x9a693(0x1fc)],_0x188d35=_0x270413['effectiveBaseUrl']??_0x5acdc3[_0x9a693(0x275)]??(_0x11adab&&_0x5253d9['qMBng'](_0x11adab[_0x9a693(0x279)],0x0)?_0x11adab[0x0]:''),_0xa0d383=_0x188d35?_0x5253d9['zNOTc'](needsTunnel,_0x188d35):![],_0x387dad={'invalidateOn':_0x4650bf?.[_0x9a693(0x229)],'userAgent':_0x4650bf?.[_0x9a693(0x207)]?.['userAgent']??_0x5acdc3[_0x9a693(0x267)]};_0x45c579&&console[_0x9a693(0x21c)](_0x9a693(0x1fa)+_0x2f0b2b['name']+_0x9a693(0x264));if(!_0x45c579){const _0x16f619=await _0x5253d9[_0x9a693(0x1df)](checkLocalCache,_0x2f0b2b[_0x9a693(0x276)],_0x2f0b2b['organizationId'],_0x188d35,_0x47ee59,_0x387dad);if(_0x16f619){if(_0x188d35&&!_0xa0d383){const _0x163c64=await isCachedSessionLive(_0x16f619[_0x9a693(0x211)],_0x188d35,{'sessionCheckPath':_0x4650bf?.['sessionCheckPath'],'setupHeaders':_0x47ee59},{'launchBrowser':launchRealBrowser});if(_0x163c64)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x2f0b2b[_0x9a693(0x276)]+'\x22'),{'authPath':_0x16f619[_0x9a693(0x211)],'settings':_0x4268d2,'resolvedEnv':_0x4650bf};console['log'](_0x9a693(0x26d)+_0x2f0b2b['name']+_0x9a693(0x1fb)),_0x5253d9['WxglA'](emitSessionValidationHint,_0x188d35,_0x4650bf);}else return _0xa0d383&&console['log']('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x2f0b2b['name']+'\x22'),{'authPath':_0x16f619['storageStatePath'],'settings':_0x4268d2,'resolvedEnv':_0x4650bf};}}if(!_0x45c579&&_0x2f0b2b[_0x9a693(0x24d)]){if(_0xa0d383)console[_0x9a693(0x21c)]('\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22'+_0x188d35+_0x9a693(0x25a)+_0x2f0b2b['name']+'\x22');else{const _0x581f40=await writeSessionToLocalCache(_0x2f0b2b[_0x9a693(0x276)],_0x2f0b2b[_0x9a693(0x27f)],_0x188d35,_0x47ee59,_0x2f0b2b['sessionState'],_0x11adab,_0x387dad);if(_0x188d35){const _0x4df15f=await isCachedSessionLive(_0x581f40,_0x188d35,{'sessionCheckPath':_0x4650bf?.['sessionCheckPath'],'setupHeaders':_0x47ee59},{'launchBrowser':launchRealBrowser});if(_0x4df15f)return console['log'](_0x9a693(0x24f)+_0x2f0b2b[_0x9a693(0x276)]+_0x9a693(0x1e5)),{'authPath':_0x581f40,'settings':_0x4268d2,'resolvedEnv':_0x4650bf};console[_0x9a693(0x21c)](_0x9a693(0x227)+_0x2f0b2b[_0x9a693(0x276)]+_0x9a693(0x261)),_0x5253d9['kPQnv'](emitSessionValidationHint,_0x188d35,_0x4650bf);}else return{'authPath':_0x581f40,'settings':_0x4268d2,'resolvedEnv':_0x4650bf};}}if(_0x1673a9)return console[_0x9a693(0x21c)](_0x9a693(0x22d)+_0x2f0b2b[_0x9a693(0x276)]+_0x9a693(0x23a)),{'authPath':undefined,'settings':_0x4268d2,'resolvedEnv':_0x4650bf};console['log'](_0x9a693(0x22d)+_0x2f0b2b['name']+'\x22,\x20attempting\x20login...');const _0x304ad4=Boolean(process['env'][_0x9a693(0x225)])&&_0x5253d9[_0x9a693(0x220)](Boolean,process[_0x9a693(0x256)]['RANGER_TEST_PASSWORD']),_0x4069c8=_0x5253d9[_0x9a693(0x1e0)](Boolean,_0x2f0b2b['username']);if(_0x304ad4||_0x4069c8)try{const _0x38211d=_0x188d35?await _0x5253d9['yWREa'](serverSideLoginWithOptionalTunnel,_0x2f0b2b[_0x9a693(0x276)],_0x188d35,{'force':_0x45c579,'telemetry':_0x270413['telemetry']}):await _0x5253d9[_0x9a693(0x22c)](serverSideLogin,_0x2f0b2b[_0x9a693(0x276)],{'force':_0x45c579});if(_0x5253d9[_0x9a693(0x213)](_0x38211d['status'],_0x5253d9['amRxQ']))console[_0x9a693(0x21c)](_0x5253d9['HSwQG']);else{if(_0x5253d9[_0x9a693(0x213)](_0x38211d['status'],'success')&&_0x38211d['session_state']){console['log'](_0x5253d9[_0x9a693(0x255)]);const _0x159192=await writeSessionToLocalCache(_0x2f0b2b['name'],_0x2f0b2b[_0x9a693(0x27f)],_0x188d35,_0x47ee59,_0x38211d['session_state'],_0x11adab,_0x387dad);return _0x304ad4&&!_0x4069c8&&await promptSaveCredentials(_0x2f0b2b['name']),{'authPath':_0x159192,'settings':_0x4268d2,'resolvedEnv':_0x4650bf};}else _0x38211d[_0x9a693(0x22e)]&&(console[_0x9a693(0x21c)](_0x5253d9['OJKNW']),console['log'](_0x38211d['test_output'])),console[_0x9a693(0x21c)](_0x5253d9['PvcgX']);}}catch(_0x13cbde){console[_0x9a693(0x21c)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0x13cbde instanceof Error?_0x13cbde[_0x9a693(0x238)]:String(_0x13cbde))),console[_0x9a693(0x21c)](_0x5253d9['PvcgX']);}const _0x399358=_0x4650bf?{..._0x4650bf,'setupHeaders':_0x47ee59}:_0x188d35?{'key':_0x2f0b2b[_0x9a693(0x1ed)]??'','domains':[_0x188d35],'setupHeaders':_0x47ee59}:null,{sessionState:_0x44624a}=await _0x5253d9[_0x9a693(0x1ec)](manualBrowserLogin,_0x2f0b2b,_0x399358,{'persistSessionState':!_0xa0d383}),_0x4b1619=await writeSessionToLocalCache(_0x2f0b2b['name'],_0x2f0b2b['organizationId'],_0x188d35,_0x47ee59,_0x44624a,_0x11adab,_0x387dad);return{'authPath':_0x4b1619,'settings':_0x4268d2,'resolvedEnv':_0x4650bf};}
1
+ function _0x533e(){const _0x3383a3=['PUT','\x20failed\x20(','telemetry','JWWOA','environmentKey','lRRHQ','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','CyXGf','goto','cli:manual-login','type','\x20\x20Created\x20cloud\x20profile\x20\x22','orCEy','Ylquz','HeIRx','\x22,\x20refreshing\x20session...','BCLsf','143852BsrPpu','ulGng','then','10QoLuMF','not_configured','headers','dRIZe','fvjmd','length','organizationId','wYNSf','\x22\x20on\x20profile\x20\x22','RANGER_TEST_USERNAME','local_ws_error','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','\x22\x20not\x20found.','\x22.\x0a','RANGER_TEST_PASSWORD','3Vluxrs','zWUtO','loginInstructions','tunnelUrl','trim','browserOptions','802744sPoVvl','/session','environment_key','newContext','env','lMdXa','ewRxw','\x20\x20Login\x20successful.\x20Session\x20cached.','settings','stringify','ShMVX','trackPhaseEnd','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','effectiveBaseUrl','force','llHni','RLKVX','catch','TNHxO','tunnel_login_request','/api/v1/profiles','POST','1460916kabzTr','ucvmn','message','tunnel','tunnel_bridge_event','session_state','toISOString','FyDXW','vMDpa','YrEWe','100008xTeueq','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','statusText','901938ztKVqE','tunnel_error','ZleKs','\x20\x20No\x20live\x20session\x20for\x20\x22','ujYUz','tunnel_bridge','trackPhaseStart','tunnel_login_cleanup','WSjfJ','WhOrn','username','5wlCbVZ','zVheJ','rcxHD','YBzkf','confirm','detail','invalidateOn','invalid-url','pendingLocalConnections','host','BIIpK','sessionCheckPath','persistSessionState','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','fIFTp','PlARe','userAgent','clientIp','/api/v1/profiles/','KrIgX','url','sessionId','log','WZoDG','pFTiy','utf-8','jvNum','origin','name','RTdZD','defaultEnvironmentKey','parse','pIfnt','QhhFe','QjTIB','tunnel_session_id','some','DELETE','test_output','yGswk','pGhpI','btNoU','13737768VkwbuK','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','DComE','rwHqu','\x20\x20forceLogin\x20enabled\x20for\x20\x22','VXsZg','tDZRH','Cloud\x20profile\x20\x22','password','UpjWQ','Bearer\x20','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','350XNGZJM','FSshK','profiles','nHBNB','BSluV','launch','aeBHl','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','kuUtb','tunnel_login_setup','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','dAiUV','\x20\x20Server-side\x20login\x20error:\x20','auth','error','lIKRw','sessionState','\x22\x20failed\x20validation\x20—\x20refreshing...','cookies','GsEax','code','trackPhaseError','elapsedMs','string','mfPji','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','zPzua','nFYUD','405278FtHJmp','UxZHS','json','target_url','toLowerCase','storageStatePath','pwEndpoint','status','):\x20','storageState','2|0|3|1|4'];_0x533e=function(){return _0x3383a3;};return _0x533e();}const _0x29e5ed=_0x404c;(function(_0x508fcc,_0x42263d){const _0x5f7992=_0x404c,_0x4afa16=_0x508fcc();while(!![]){try{const _0x2be089=parseInt(_0x5f7992(0x23f))/0x1+-parseInt(_0x5f7992(0x273))/0x2*(parseInt(_0x5f7992(0x26d))/0x3)+-parseInt(_0x5f7992(0x25b))/0x4+parseInt(_0x5f7992(0x2a1))/0x5*(parseInt(_0x5f7992(0x296))/0x6)+parseInt(_0x5f7992(0x223))/0x7*(-parseInt(_0x5f7992(0x293))/0x8)+-parseInt(_0x5f7992(0x289))/0x9*(parseInt(_0x5f7992(0x25e))/0xa)+parseInt(_0x5f7992(0x217))/0xb;if(_0x2be089===_0x42263d)break;else _0x4afa16['push'](_0x4afa16['shift']());}catch(_0x506af7){_0x4afa16['push'](_0x4afa16['shift']());}}}(_0x533e,0x8d8c4));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x49363e 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';function targetHostForTelemetry(_0x4eac93){const _0x575a41=_0x404c,_0x118eb9={'CyXGf':_0x575a41(0x1f4)};try{return new URL(_0x4eac93)[_0x575a41(0x1f6)];}catch{return _0x118eb9[_0x575a41(0x251)];}}function errorMessageForTelemetry(_0x4c25ad){const _0x2bbfe4=_0x404c;return _0x4c25ad instanceof Error?_0x4c25ad[_0x2bbfe4(0x28b)]:undefined;}function trackBridgeEvent(_0x128892,_0xda541f){const _0x136453=_0x404c,_0x429322={'KmhQa':_0x136453(0x28d),'rcxHD':_0x136453(0x297),'SgguT':_0x136453(0x268),'QhhFe':_0x136453(0x29b)};if(!_0x128892)return;const _0x35a199={'tunnelSessionId':_0xda541f['sessionId'],'tunnelEventType':_0xda541f[_0x136453(0x254)],'connectionId':_0xda541f['connectionId'],'code':_0xda541f[_0x136453(0x237)],'reason':_0xda541f['reason'],'error':_0xda541f['error'],'elapsedMs':_0xda541f[_0x136453(0x239)],'activeLocalConnections':_0xda541f['activeLocalConnections'],'pendingLocalConnections':_0xda541f[_0x136453(0x1f5)]};_0x128892['trackPhaseEnd'](_0x429322['KmhQa'],_0x35a199),(_0xda541f['type']===_0x429322[_0x136453(0x2a3)]||_0xda541f['type']===_0x429322['SgguT'])&&void _0x128892[_0x136453(0x238)](_0x429322[_0x136453(0x20e)],new Error(_0xda541f['error']??_0xda541f['type']),_0x35a199);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0xd5b59c=_0x404c,_0x5c4067={'YBzkf':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x115376=await getToken();if(!_0x115376)throw new Error(_0x5c4067[_0xd5b59c(0x2a4)]);return _0x115376;}async function apiRequest(_0x511c30,_0x271ba9={}){const _0x166059=_0x404c,_0xed4b9a={'BSluV':function(_0x264344){return _0x264344();},'WhOrn':function(_0x77258f,_0x250246){return _0x77258f===_0x250246;},'PlARe':_0x166059(0x23a)},_0x1efe93=await _0xed4b9a[_0x166059(0x227)](requireToken),_0x410f62=getApiBaseUrl(),_0x1e2653=await fetch(''+_0x410f62+_0x511c30,{..._0x271ba9,'headers':{'Authorization':_0x166059(0x221)+_0x1efe93,'Content-Type':'application/json',..._0x271ba9[_0x166059(0x260)]??{}}});if(!_0x1e2653['ok']){let _0x467ae7='',_0x321d6d;try{const _0x546a99=await _0x1e2653['json'](),_0x67450c=(_0xed4b9a[_0x166059(0x29f)](typeof _0x546a99[_0x166059(0x231)],_0x166059(0x23a))?_0x546a99[_0x166059(0x231)]:undefined)??JSON[_0x166059(0x27c)](_0x546a99);_0x467ae7=_0x67450c;_0xed4b9a[_0x166059(0x29f)](typeof _0x546a99['test_output'],_0xed4b9a[_0x166059(0x1fc)])&&_0x546a99[_0x166059(0x213)]&&(_0x467ae7=_0x467ae7+'\x0a'+_0x546a99['test_output']);if(typeof _0x546a99[_0x166059(0x237)]===_0x166059(0x23a))_0x321d6d=_0x546a99['code'];}catch{_0x467ae7=_0x1e2653[_0x166059(0x295)];}throw new ApiError('API\x20request\x20'+_0x511c30+_0x166059(0x24b)+_0x1e2653[_0x166059(0x246)]+_0x166059(0x247)+_0x467ae7,_0x1e2653[_0x166059(0x246)],_0x467ae7,_0x321d6d);}if(_0xed4b9a['WhOrn'](_0x1e2653['status'],0xcc))return undefined;return _0x1e2653[_0x166059(0x241)]();}export class ApiError extends Error{[_0x29e5ed(0x246)];[_0x29e5ed(0x2a6)];['code'];constructor(_0x5d5994,_0x35642f,_0x2391b3,_0x411c86){const _0x1a78ee=_0x29e5ed,_0x1b265f={'ShMVX':_0x1a78ee(0x249),'lIKRw':'ApiError'},_0x4f6a6e=_0x1b265f[_0x1a78ee(0x27d)]['split']('|');let _0x14ee01=0x0;while(!![]){switch(_0x4f6a6e[_0x14ee01++]){case'0':this['status']=_0x35642f;continue;case'1':this[_0x1a78ee(0x237)]=_0x411c86;continue;case'2':super(_0x5d5994);continue;case'3':this['detail']=_0x2391b3;continue;case'4':this[_0x1a78ee(0x209)]=_0x1b265f[_0x1a78ee(0x232)];continue;}break;}}}export async function fetchCloudProfile(_0x3df847){const _0x487fbe=_0x29e5ed,_0x5391a9={'GFtyU':function(_0x13b528,_0x2920b5){return _0x13b528(_0x2920b5);},'WWRpn':function(_0x512a96,_0x41e3b3){return _0x512a96 instanceof _0x41e3b3;},'ulGng':function(_0x4007c1,_0x156fd7){return _0x4007c1===_0x156fd7;}};try{return await _0x5391a9['GFtyU'](apiRequest,'/api/v1/profiles/'+_0x5391a9['GFtyU'](encodeURIComponent,_0x3df847));}catch(_0x134e14){if(_0x5391a9['WWRpn'](_0x134e14,ApiError)&&_0x5391a9[_0x487fbe(0x25c)](_0x134e14[_0x487fbe(0x246)],0x194))return null;throw _0x134e14;}}function _0x404c(_0x367e68,_0x55200f){_0x367e68=_0x367e68-0x1f3;const _0x533ecb=_0x533e();let _0x404cf9=_0x533ecb[_0x367e68];return _0x404cf9;}export async function listCloudProfiles(){const _0x18eb5c=_0x29e5ed,_0x2958ad={'qLEUf':function(_0x157626,_0xf1add){return _0x157626(_0xf1add);},'wYNSf':_0x18eb5c(0x287)},_0x3eef27=await _0x2958ad['qLEUf'](apiRequest,_0x2958ad[_0x18eb5c(0x265)]);return _0x3eef27[_0x18eb5c(0x225)];}export async function deleteCloudProfile(_0x28a118){const _0x1e4d4b=_0x29e5ed,_0x96e11f={'FoHcC':function(_0x4e60cb,_0x489fd3){return _0x4e60cb(_0x489fd3);},'QjTIB':function(_0x4a7954,_0x220afa){return _0x4a7954===_0x220afa;}};try{await apiRequest(_0x1e4d4b(0x1ff)+_0x96e11f['FoHcC'](encodeURIComponent,_0x28a118),{'method':'DELETE'});}catch(_0x42515a){if(_0x42515a instanceof ApiError&&_0x96e11f[_0x1e4d4b(0x20f)](_0x42515a['status'],0x194))throw new Error(_0x1e4d4b(0x21e)+_0x28a118+_0x1e4d4b(0x26a));throw _0x42515a;}}export async function createCloudProfile(_0x2de768,_0x36d4f5,_0x1c492c={}){const _0x1d79ab=_0x29e5ed,_0x5e43ad={'CNVFm':function(_0xe2a905,_0x1fe29e){return _0xe2a905>_0x1fe29e;},'fIFTp':function(_0x4505a0,_0x21aca4,_0x4b36e0){return _0x4505a0(_0x21aca4,_0x4b36e0);},'aVBVk':_0x1d79ab(0x287),'WZoDG':_0x1d79ab(0x288)},_0x3d8a49={'name':_0x2de768};if(_0x36d4f5)_0x3d8a49[_0x1d79ab(0x275)]=_0x36d4f5;_0x1c492c[_0x1d79ab(0x27b)]&&_0x5e43ad['CNVFm'](Object['keys'](_0x1c492c[_0x1d79ab(0x27b)])['length'],0x0)&&(_0x3d8a49[_0x1d79ab(0x27b)]=_0x1c492c['settings']);if(_0x1c492c[_0x1d79ab(0x2a0)])_0x3d8a49[_0x1d79ab(0x2a0)]=_0x1c492c[_0x1d79ab(0x2a0)];if(_0x1c492c[_0x1d79ab(0x21f)])_0x3d8a49['password']=_0x1c492c['password'];return await _0x5e43ad[_0x1d79ab(0x1fb)](apiRequest,_0x5e43ad['aVBVk'],{'method':_0x5e43ad[_0x1d79ab(0x204)],'body':JSON['stringify'](_0x3d8a49)});}export async function uploadCloudProfileSession(_0x21a620,_0x2df4e4){const _0x7cc21b=_0x29e5ed,_0x110962={'ZleKs':function(_0x19b863,_0x50fc70,_0x566a5f){return _0x19b863(_0x50fc70,_0x566a5f);},'Grhtx':_0x7cc21b(0x288)};return await _0x110962[_0x7cc21b(0x298)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x21a620)+_0x7cc21b(0x274),{'method':_0x110962['Grhtx'],'body':JSON['stringify']({'session_state':_0x2df4e4})});}export async function saveCloudProfileCredentials(_0x5dd251,_0x518e08,_0x4d9683){const _0x3effdf=_0x29e5ed,_0x27fd95={'nHBNB':function(_0x4f10d7,_0x53ffbd){return _0x4f10d7(_0x53ffbd);}};await apiRequest('/api/v1/profiles/'+_0x27fd95[_0x3effdf(0x226)](encodeURIComponent,_0x5dd251),{'method':_0x3effdf(0x24a),'body':JSON[_0x3effdf(0x27c)]({'username':_0x518e08,'password':_0x4d9683})});}export async function fetchAuthConfig(){const _0xbae061=_0x29e5ed,_0x222c09={'nFYUD':function(_0x56fb5f,_0x45d3d5){return _0x56fb5f(_0x45d3d5);},'QuDdn':'/api/v1/profiles/auth-config','tDZRH':function(_0x3ec069,_0x4755e4){return _0x3ec069!==_0x4755e4;}};try{const _0x3c2dfe=await _0x222c09[_0xbae061(0x23e)](apiRequest,_0x222c09['QuDdn']);return _0x3c2dfe['auth_config'];}catch(_0x360bd9){return _0x360bd9 instanceof ApiError&&_0x222c09[_0xbae061(0x21d)](_0x360bd9['status'],0x194)&&console[_0xbae061(0x231)]('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x360bd9[_0xbae061(0x28b)]),null;}}async function createTunnelSession(_0x51649e){const _0x4650e3=_0x29e5ed,_0x3e36b7={'pGhpI':'/api/v1/tunnel/sessions','FSshK':_0x4650e3(0x288)};return await apiRequest(_0x3e36b7[_0x4650e3(0x215)],{'method':_0x3e36b7[_0x4650e3(0x224)],'body':JSON['stringify']({'targetUrl':_0x51649e,'mode':'agent'})});}async function deleteTunnelSession(_0x45b612){const _0x3ba25=_0x29e5ed,_0x24edd7={'VXsZg':_0x3ba25(0x212)};await apiRequest('/api/v1/tunnel/sessions/'+_0x45b612,{'method':_0x24edd7[_0x3ba25(0x21c)]});}export function pickAdHocEnvKey(_0x23cc79){const _0x4eadad=_0x29e5ed,_0x281bf0={'zPzua':function(_0x577caf,_0x2cb6cf){return _0x577caf===_0x2cb6cf;},'bMeij':function(_0x3bb6e9,_0x3bec41){return _0x3bb6e9+_0x3bec41;}};if(!_0x23cc79)return null;if(_0x23cc79[_0x4eadad(0x20b)])return _0x23cc79[_0x4eadad(0x20b)];const _0x15e7ce=Object['keys'](_0x23cc79['environments']??{});if(_0x281bf0['zPzua'](_0x15e7ce[_0x4eadad(0x263)],0x1))return _0x15e7ce[0x0];if(_0x281bf0[_0x4eadad(0x23d)](_0x15e7ce[_0x4eadad(0x263)],0x0))return null;throw new Error(_0x281bf0['bMeij']('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x15e7ce['join'](',\x20')+').\x20','Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.'));}export async function resolveAdHocProfile(_0x11e3d9=process['env']){const _0x104461=_0x29e5ed,_0x92f5cd={'YrEWe':function(_0x1c53ba,_0x3a15fc){return _0x1c53ba(_0x3a15fc);},'TNHxO':function(_0x3a9745){return _0x3a9745();}},_0x44c004=_0x11e3d9[_0x104461(0x267)];if(!_0x44c004)return null;const _0x48349b=await _0x92f5cd['YrEWe'](fetchCloudProfile,_0x44c004);if(_0x48349b)return{'name':_0x48349b[_0x104461(0x209)],'profile':_0x48349b};const _0x52079d=await _0x92f5cd[_0x104461(0x285)](fetchAuthConfig),_0x5d0e5b=_0x92f5cd[_0x104461(0x292)](pickAdHocEnvKey,_0x52079d),_0x18d562=_0x11e3d9['RANGER_TEST_PASSWORD'],_0x5cb779=await createCloudProfile(_0x44c004,_0x5d0e5b??undefined,{'username':_0x44c004,'password':_0x18d562});return console['log'](_0x104461(0x255)+_0x5cb779[_0x104461(0x209)]+'\x22\x20for\x20'+_0x44c004),{'name':_0x5cb779['name'],'profile':_0x5cb779};}export async function writeSessionToLocalCache(_0x2a3185,_0x3e0196,_0x46c5b2,_0x29cf86,_0x5404ce,_0x534647,_0x38f992){const _0xb30273=_0x29e5ed,_0x30b32e={'vMDpa':function(_0x351abf,_0x2b9e77,_0x5b4ca3){return _0x351abf(_0x2b9e77,_0x5b4ca3);},'pIfnt':function(_0x3c698e){return _0x3c698e();},'tKhDP':_0xb30273(0x230),'zWUtO':function(_0x50c318,_0x19830b){return _0x50c318(_0x19830b);},'WOdEW':function(_0x1c836c,_0x40cbd4){return _0x1c836c>_0x40cbd4;},'dAiUV':function(_0x13e361,_0xbbd132,_0x167570){return _0x13e361(_0xbbd132,_0x167570);},'xKJci':function(_0x5c8198,_0x74fbb7,_0x4dffb4){return _0x5c8198(_0x74fbb7,_0x4dffb4);}},_0x1679d8=sessionCacheHash({'orgId':_0x3e0196,'profileName':_0x2a3185,'effectiveBaseUrl':_0x46c5b2,'setupHeaders':_0x29cf86,'invalidateOn':_0x38f992?.['invalidateOn'],'userAgent':_0x38f992?.[_0xb30273(0x1fd)],'clientIp':_0x38f992?.['clientIp']}),_0x3b4ef1=_0x30b32e[_0xb30273(0x291)](getSessionCachePath,_0x1679d8,_0x2a3185),_0x4e327f=_0x30b32e['vMDpa'](join,_0x30b32e[_0xb30273(0x20d)](getRangerHomeDir),_0x30b32e['tKhDP']);!_0x30b32e[_0xb30273(0x26e)](existsSync,_0x4e327f)&&await _0x30b32e[_0xb30273(0x291)](mkdir,_0x4e327f,{'recursive':!![]});const _0x328660={..._0x5404ce};_0x534647&&_0x30b32e['WOdEW'](_0x534647['length'],0x0)&&Array['isArray'](_0x328660['cookies'])&&(_0x328660[_0xb30273(0x235)]=_0x30b32e[_0xb30273(0x22e)](duplicateCookiesForDomains,_0x328660[_0xb30273(0x235)],_0x534647));const _0xe47bd2={'cached_at':new Date()[_0xb30273(0x28f)](),'session_state':_0x328660};await _0x30b32e['xKJci'](writeFile,_0x3b4ef1,JSON['stringify'](_0xe47bd2,null,0x2));const _0x3ab5c0=getStorageStatePath(_0x3b4ef1);return await writeFile(_0x3ab5c0,JSON[_0xb30273(0x27c)](_0x328660,null,0x2)),_0x3ab5c0;}export async function checkLocalCache(_0x3626b4,_0xe4f32e,_0x10e400,_0x50705f,_0x5123d1){const _0x225166=_0x29e5ed,_0x490060={'WSjfJ':function(_0x3eeaa9,_0x18ad9,_0x33d1d0){return _0x3eeaa9(_0x18ad9,_0x33d1d0);}},_0x12fc08=sessionCacheHash({'orgId':_0xe4f32e,'profileName':_0x3626b4,'effectiveBaseUrl':_0x10e400,'setupHeaders':_0x50705f,'invalidateOn':_0x5123d1?.[_0x225166(0x1f3)],'userAgent':_0x5123d1?.['userAgent'],'clientIp':_0x5123d1?.[_0x225166(0x1fe)]}),_0x192b39=_0x490060[_0x225166(0x29e)](getSessionCachePath,_0x12fc08,_0x3626b4),_0x1bc78e=getStorageStatePath(_0x192b39);if(!existsSync(_0x192b39)||!existsSync(_0x1bc78e))return null;try{const _0x277b72=await _0x490060['WSjfJ'](readFile,_0x192b39,_0x225166(0x206));return JSON[_0x225166(0x20c)](_0x277b72),{'storageStatePath':_0x1bc78e};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x4f8370,_0x246f8a){const _0x39830a=_0x29e5ed,_0x1f1ae8={'ucvmn':function(_0x5f06f2,_0x3964ba){return _0x5f06f2+_0x3964ba;}};if(!_0x246f8a||!_0x246f8a['domains']?.[_0x39830a(0x263)])return;let _0x34416e;try{_0x34416e=new URL(_0x4f8370);}catch{return;}const _0x3459ad=[];for(const _0x5e94df of _0x246f8a['domains']){try{_0x3459ad['push']({'raw':_0x5e94df,'url':new URL(_0x5e94df)});}catch{}}if(_0x3459ad[_0x39830a(0x263)]===0x0)return;if(_0x3459ad[_0x39830a(0x211)](_0x1c57bb=>_0x1c57bb[_0x39830a(0x201)][_0x39830a(0x208)]===_0x34416e[_0x39830a(0x208)]))return;const _0x528fea=_0x3459ad['map'](_0x447a1b=>'\x22'+_0x447a1b['raw']+'\x22')['join'](',\x20');console[_0x39830a(0x203)](_0x1f1ae8[_0x39830a(0x28a)](_0x39830a(0x1fa)+_0x528fea+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x4f8370+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+_0x39830a(0x250));}export async function serverSideLogin(_0x4427ac,_0x13b4ca){const _0x4013fe=_0x29e5ed,_0x2218ff={'mfPji':function(_0x24ad14,_0xe11d0e){return _0x24ad14===_0xe11d0e;},'SutpZ':function(_0x59055c,_0x35f7c5){return _0x59055c===_0x35f7c5;}},_0x19b1d9=process[_0x4013fe(0x277)][_0x4013fe(0x267)],_0x410b36=process[_0x4013fe(0x277)][_0x4013fe(0x26c)],_0x40b475={};if(_0x19b1d9)_0x40b475['username']=_0x19b1d9;if(_0x410b36)_0x40b475[_0x4013fe(0x21f)]=_0x410b36;if(_0x13b4ca?.['force'])_0x40b475['force']=!![];if(_0x13b4ca?.['targetUrl'])_0x40b475[_0x4013fe(0x242)]=_0x13b4ca['targetUrl'];_0x13b4ca?.[_0x4013fe(0x28c)]&&(_0x40b475[_0x4013fe(0x210)]=_0x13b4ca['tunnel']['sessionId'],_0x40b475['pw_endpoint']=_0x13b4ca['tunnel'][_0x4013fe(0x245)]);try{return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x4427ac)+'/login',{'method':'POST','body':JSON['stringify'](_0x40b475)});}catch(_0x73f0cb){if(_0x73f0cb instanceof ApiError&&_0x2218ff[_0x4013fe(0x23b)](_0x73f0cb['status'],0x190)&&_0x2218ff['SutpZ'](_0x73f0cb['code'],'not_configured'))return{'status':'not_configured','error':_0x73f0cb[_0x4013fe(0x2a6)]};throw _0x73f0cb;}}async function serverSideLoginWithOptionalTunnel(_0x500c10,_0x281a85,_0x1f6d48={}){const _0x11d187=_0x29e5ed,_0x48c20a={'IaGQu':function(_0x4623a4,_0x490666){return _0x4623a4(_0x490666);},'Xeyuj':function(_0x351a21,_0x2a09d9){return _0x351a21===_0x2a09d9;},'Nkjjl':'true','BIIpK':function(_0x4ec566,_0x77a81d){return _0x4ec566(_0x77a81d);},'aeBHl':'\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','pWiet':function(_0x505743,_0x23c9d7){return _0x505743(_0x23c9d7);},'UpjWQ':function(_0x808103){return _0x808103();},'wPMUM':_0x11d187(0x22c),'taBTO':_0x11d187(0x286),'Ylquz':function(_0x1862f4,_0x580f1c,_0x57051e){return _0x1862f4(_0x580f1c,_0x57051e);},'zVheJ':function(_0x4b68c8,_0x376018){return _0x4b68c8??_0x376018;},'RshVJ':function(_0x17dde2,_0x465239){return _0x17dde2(_0x465239);},'RLKVX':function(_0x163340,_0x274554){return _0x163340||_0x274554;},'pFTiy':function(_0x545883,_0xc421ef){return _0x545883(_0xc421ef);},'DKACR':_0x11d187(0x29d)};if(!needsTunnel(_0x281a85))return await serverSideLogin(_0x500c10,{'force':_0x1f6d48[_0x11d187(0x281)]});let _0x53d58e=null,_0x2d3df9=null,_0x1ddd83=null,_0x2b8f0f=null,_0x305154=![];const _0x43f443=process['env']['RANGER_TUNNEL_LOGIN_HEADED']?.[_0x11d187(0x243)](),_0x29e454=_0x43f443==='1'||_0x48c20a['Xeyuj'](_0x43f443,_0x48c20a['Nkjjl']),_0x278462={'profileName':_0x500c10,'targetUrlHost':targetHostForTelemetry(_0x281a85),'tunnelRequired':!![],'forceLogin':_0x48c20a[_0x11d187(0x1f7)](Boolean,_0x1f6d48[_0x11d187(0x281)]),'localBrowserServerHeaded':_0x29e454};try{_0x1f6d48[_0x11d187(0x24c)]?.[_0x11d187(0x29c)](_0x11d187(0x22c),_0x278462);_0x29e454&&console[_0x11d187(0x203)](_0x48c20a[_0x11d187(0x229)]);_0x53d58e=await _0x48c20a['pWiet'](launchBrowserServer,{'headless':!_0x29e454}),_0x2d3df9=await createTunnelSession(_0x281a85);const _0x19fba3=await _0x48c20a[_0x11d187(0x220)](requireToken);_0x1ddd83=await _0x48c20a['pWiet'](createTunnelBridge,{'localWsUrl':_0x53d58e['wsEndpoint'],'tunnelServerUrl':_0x2d3df9[_0x11d187(0x270)],'sessionId':_0x2d3df9[_0x11d187(0x202)],'apiKey':_0x19fba3,'onError':_0x12abce=>{_0x2b8f0f=_0x12abce;},'onClose':()=>{_0x2b8f0f??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x500c10);},'onEvent':_0x1cf71c=>trackBridgeEvent(_0x1f6d48[_0x11d187(0x24c)],_0x1cf71c)}),_0x1f6d48[_0x11d187(0x24c)]?.['trackPhaseEnd'](_0x48c20a['wPMUM'],{..._0x278462,'tunnelSessionId':_0x2d3df9['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x29e454}),_0x305154=!![];try{return _0x1f6d48[_0x11d187(0x24c)]?.['trackPhaseStart'](_0x48c20a['taBTO'],{..._0x278462,'tunnelSessionId':_0x2d3df9[_0x11d187(0x202)]}),await _0x48c20a[_0x11d187(0x257)](serverSideLogin,_0x500c10,{'force':_0x1f6d48['force'],'targetUrl':_0x281a85,'tunnel':{'sessionId':_0x2d3df9[_0x11d187(0x202)],'pwEndpoint':_0x2d3df9[_0x11d187(0x245)]}})[_0x11d187(0x25d)](_0x54825d=>{const _0x120caf=_0x11d187;return _0x1f6d48[_0x120caf(0x24c)]?.[_0x120caf(0x27e)]('tunnel_login_request',{..._0x278462,'tunnelSessionId':_0x2d3df9?.[_0x120caf(0x202)],'loginStatus':_0x54825d['status'],'hasSessionState':_0x48c20a['IaGQu'](Boolean,_0x54825d['session_state']),'hasTestOutput':Boolean(_0x54825d[_0x120caf(0x213)]),'bridgeError':errorMessageForTelemetry(_0x2b8f0f)}),_0x54825d;});}catch(_0x3a4595){await _0x1f6d48[_0x11d187(0x24c)]?.['trackPhaseError'](_0x48c20a['taBTO'],_0x48c20a[_0x11d187(0x2a2)](_0x2b8f0f,_0x3a4595),{..._0x278462,'tunnelSessionId':_0x2d3df9[_0x11d187(0x202)],'bridgeError':_0x48c20a['RshVJ'](errorMessageForTelemetry,_0x2b8f0f)});throw _0x2b8f0f??_0x3a4595;}}catch(_0x1aedea){!_0x305154&&await _0x1f6d48['telemetry']?.['trackPhaseError'](_0x48c20a['wPMUM'],_0x1aedea,{..._0x278462,'tunnelSessionId':_0x2d3df9?.['sessionId']});throw _0x1aedea;}finally{if(_0x48c20a[_0x11d187(0x283)](_0x2d3df9,_0x53d58e)||_0x1ddd83){const _0x2aeb24='2|3|1|0|4'['split']('|');let _0x2eb5f5=0x0;while(!![]){switch(_0x2aeb24[_0x2eb5f5++]){case'0':_0x2d3df9&&await _0x48c20a[_0x11d187(0x205)](deleteTunnelSession,_0x2d3df9[_0x11d187(0x202)])[_0x11d187(0x284)](()=>{});continue;case'1':_0x53d58e&&await _0x53d58e['close']()['catch'](()=>{});continue;case'2':_0x1f6d48[_0x11d187(0x24c)]?.['trackPhaseStart'](_0x48c20a['DKACR'],{..._0x278462,'tunnelSessionId':_0x2d3df9?.['sessionId']});continue;case'3':_0x1ddd83?.['close']();continue;case'4':_0x1f6d48['telemetry']?.['trackPhaseEnd'](_0x48c20a['DKACR'],{..._0x278462,'tunnelSessionId':_0x2d3df9?.['sessionId']});continue;}break;}}}}export async function manualBrowserLogin(_0x2a3781,_0x43c95c,_0x257f05={}){const _0x4b0c0d=_0x29e5ed,_0x19afeb={'btNoU':function(_0x34f397){return _0x34f397();},'oAyAw':'close','lMdXa':'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','FyDXW':function(_0x21af27,_0x373e9c){return _0x21af27>_0x373e9c;},'yGswk':'\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','KRxiq':function(_0x577213,_0x1e0a5f){return _0x577213(_0x1e0a5f);},'HeIRx':function(_0x38566d,_0x17b943){return _0x38566d&&_0x17b943;},'kuUtb':'Browser\x20login\x20timed\x20out\x20before\x20completion.','KrIgX':_0x4b0c0d(0x22a),'lRRHQ':function(_0x17bb26,_0x8257bb,_0x1e1931){return _0x17bb26(_0x8257bb,_0x1e1931);},'HPUTa':_0x4b0c0d(0x288),'DComE':_0x4b0c0d(0x253)};if(!isInteractive())throw new Error('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x2a3781[_0x4b0c0d(0x209)]+_0x4b0c0d(0x26b)+_0x19afeb[_0x4b0c0d(0x278)]+_0x4b0c0d(0x23c));const _0xfd0b0c=_0x43c95c&&_0x19afeb[_0x4b0c0d(0x290)](_0x43c95c['domains']['length'],0x0)?_0x43c95c['domains'][0x0]:'about:blank';console[_0x4b0c0d(0x203)](_0x4b0c0d(0x218)),console[_0x4b0c0d(0x203)](_0x19afeb[_0x4b0c0d(0x214)]),await new Promise(_0xfcbd8=>setTimeout(_0xfcbd8,0x7d0));const _0x5cdb81=await chromium[_0x4b0c0d(0x228)]({'headless':![]});let _0x424156=null;try{const _0x19a5b9={'ignoreHTTPSErrors':!![]};_0x43c95c?.['setupHeaders']&&(_0x19a5b9['extraHTTPHeaders']=_0x43c95c['setupHeaders']);const _0x46f6d4=await _0x5cdb81[_0x4b0c0d(0x276)](_0x19a5b9);await _0x19afeb['KRxiq'](addProfileSetupBanner,_0x46f6d4);const _0x338402=await _0x46f6d4['newPage']();await _0x338402[_0x4b0c0d(0x252)](_0xfd0b0c);let _0x28d6ba=![];await new Promise(_0x1d0944=>{const _0x5f186a={'XyyLo':function(_0x11fddb,_0x58b937){return _0x11fddb/_0x58b937;}},_0x4e2f54=setTimeout(()=>{const _0x415bf1=_0x404c;_0x28d6ba=!![],console[_0x415bf1(0x231)]('Browser\x20login\x20timed\x20out\x20after\x20'+_0x5f186a['XyyLo'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+_0x415bf1(0x27f)),_0x1d0944();},MANUAL_LOGIN_TIMEOUT_MS);_0x338402['on'](_0x19afeb['oAyAw'],async()=>{const _0x3fd911=_0x404c;clearTimeout(_0x4e2f54);try{const _0x4a21a8=await _0x46f6d4[_0x3fd911(0x248)]();_0x424156=_0x4a21a8;}catch{}_0x19afeb[_0x3fd911(0x216)](_0x1d0944);});});if(_0x19afeb[_0x4b0c0d(0x258)](_0x28d6ba,!_0x424156))throw new Error(_0x19afeb[_0x4b0c0d(0x22b)]);}finally{await _0x5cdb81['close']()['catch'](()=>{});}if(!_0x424156)throw new Error(_0x19afeb[_0x4b0c0d(0x200)]);return _0x257f05[_0x4b0c0d(0x1f9)]!==![]&&await _0x19afeb[_0x4b0c0d(0x24f)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x2a3781['name'])+'/session',{'method':_0x19afeb['HPUTa'],'body':JSON[_0x4b0c0d(0x27c)]({'session_state':_0x424156,'updated_by':_0x19afeb[_0x4b0c0d(0x219)]})}),{'sessionState':_0x424156};}export async function promptSaveCredentials(_0xa9f036){const _0x2128ec=_0x29e5ed,_0x2ea9db={'JWWOA':function(_0x449acf,_0x250c38){return _0x449acf||_0x250c38;},'ujYUz':_0x2128ec(0x2a5),'llHni':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','ZZuEj':function(_0xdffb2e,_0xebbfc){return _0xdffb2e(_0xebbfc);}},_0x43e960=process[_0x2128ec(0x277)][_0x2128ec(0x267)],_0x2ace00=process['env']['RANGER_TEST_PASSWORD'];if(_0x2ea9db[_0x2128ec(0x24d)](!_0x43e960,!_0x2ace00))return;if(!isInteractive())return;const {save:_0x57d3e9}=await _0x49363e['prompt']([{'type':_0x2ea9db[_0x2128ec(0x29a)],'name':'save','message':_0x2ea9db[_0x2128ec(0x282)],'default':![]}]);if(!_0x57d3e9)return;await apiRequest(_0x2128ec(0x1ff)+_0x2ea9db['ZZuEj'](encodeURIComponent,_0xa9f036),{'method':_0x2128ec(0x24a),'body':JSON[_0x2128ec(0x27c)]({'username':_0x43e960,'password':_0x2ace00})}),console[_0x2128ec(0x203)](_0x2128ec(0x22d));}export async function resolveCloudProfileSession(_0x3b2e50,_0x3d0c7b={}){const _0x32f8df=_0x29e5ed,_0x573009={'fvjmd':function(_0xac0301){return _0xac0301();},'orCEy':function(_0x271150,_0x7e7ce7,_0x2e19ff){return _0x271150(_0x7e7ce7,_0x2e19ff);},'RTdZD':function(_0x47c0b6,_0x229ce6){return _0x47c0b6===_0x229ce6;},'BCLsf':_0x32f8df(0x23a),'rwHqu':function(_0x56926d,_0x2bedab){return _0x56926d||_0x2bedab;},'dRIZe':function(_0x55cb7f,_0x408d04){return _0x55cb7f(_0x408d04);},'XPemD':function(_0x127f6e,_0x4ebbf6){return _0x127f6e>_0x4ebbf6;},'IHgXn':function(_0x297244,_0x5399f6,_0xfda0c2,_0xa3e78e,_0xf8573c,_0x4df7ae){return _0x297244(_0x5399f6,_0xfda0c2,_0xa3e78e,_0xf8573c,_0x4df7ae);},'UEoXJ':function(_0x483dc9,_0xf96768,_0x2040c9,_0x2ce778,_0x448793,_0x3f9244,_0x546836,_0x275da9){return _0x483dc9(_0xf96768,_0x2040c9,_0x2ce778,_0x448793,_0x3f9244,_0x546836,_0x275da9);},'GsEax':function(_0x3a5642,_0x33e10a,_0x396b38,_0x3481a6,_0x4934a2){return _0x3a5642(_0x33e10a,_0x396b38,_0x3481a6,_0x4934a2);},'jvNum':function(_0x2f613a,_0x41a006){return _0x2f613a(_0x41a006);},'qxIZp':function(_0x32e17e,_0x931aa9){return _0x32e17e||_0x931aa9;},'ewRxw':function(_0x3bface,_0xd1143c,_0x5ed756,_0x1584b7){return _0x3bface(_0xd1143c,_0x5ed756,_0x1584b7);},'HEbuZ':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','XxOQS':'success','sjATl':_0x32f8df(0x27a),'UxZHS':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...'},_0x3c5cac=_0x3b2e50[_0x32f8df(0x27b)]??{},_0x4c97fb=await _0x573009[_0x32f8df(0x262)](fetchAuthConfig),_0x4d0f9a=_0x4c97fb?_0x573009[_0x32f8df(0x256)](resolveAuthEnvironmentLocally,_0x4c97fb,_0x3b2e50['environmentKey']):null,_0x10e3b4=_0x573009[_0x32f8df(0x20a)](typeof _0x4d0f9a?.['loginInstructions'],_0x32f8df(0x23a))&&_0x4d0f9a['loginInstructions']['trim']()?_0x4d0f9a[_0x32f8df(0x26f)]:undefined,_0x4035b2=typeof _0x3c5cac['loginInstructions']===_0x573009[_0x32f8df(0x25a)]&&_0x3c5cac[_0x32f8df(0x26f)][_0x32f8df(0x271)]()?_0x3c5cac[_0x32f8df(0x26f)]:undefined,_0x49b099=_0x573009[_0x32f8df(0x21a)](_0x4035b2,!_0x10e3b4)?_0x3c5cac:{..._0x3c5cac,'loginInstructions':_0x10e3b4},_0x26bd66=_0x573009[_0x32f8df(0x261)](Boolean,_0x49b099['loginInstructions']?.['trim']()),_0x58e48a=Boolean(_0x3c5cac['forceLogin']||_0x4d0f9a?.['forceLogin']),_0x40430a=_0x4d0f9a?.['domains'],_0x5064eb=_0x3c5cac['setupHeaders'],_0x5c2d19=_0x5064eb??_0x4d0f9a?.['setupHeaders'],_0x2d6d23=_0x3d0c7b[_0x32f8df(0x280)]??_0x3c5cac['baseUrl']??(_0x40430a&&_0x573009['XPemD'](_0x40430a['length'],0x0)?_0x40430a[0x0]:''),_0x496ebd=_0x2d6d23?needsTunnel(_0x2d6d23):![],_0x450dc2={'invalidateOn':_0x4d0f9a?.[_0x32f8df(0x1f3)],'userAgent':_0x4d0f9a?.[_0x32f8df(0x272)]?.[_0x32f8df(0x1fd)]??_0x3c5cac['userAgent']};_0x58e48a&&console['log'](_0x32f8df(0x21b)+_0x3b2e50[_0x32f8df(0x209)]+_0x32f8df(0x259));if(!_0x58e48a){const _0xaf3dcf=await _0x573009['IHgXn'](checkLocalCache,_0x3b2e50[_0x32f8df(0x209)],_0x3b2e50[_0x32f8df(0x264)],_0x2d6d23,_0x5c2d19,_0x450dc2);if(_0xaf3dcf){if(_0x2d6d23&&!_0x496ebd){const _0x563e98=await isCachedSessionLive(_0xaf3dcf[_0x32f8df(0x244)],_0x2d6d23,{'sessionCheckPath':_0x4d0f9a?.[_0x32f8df(0x1f8)],'setupHeaders':_0x5c2d19},{'launchBrowser':launchRealBrowser});if(_0x563e98)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x3b2e50['name']+'\x22'),{'authPath':_0xaf3dcf['storageStatePath'],'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};console[_0x32f8df(0x203)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x3b2e50[_0x32f8df(0x209)]+_0x32f8df(0x234)),emitSessionValidationHint(_0x2d6d23,_0x4d0f9a);}else return _0x496ebd&&console['log'](_0x32f8df(0x294)+_0x3b2e50['name']+'\x22'),{'authPath':_0xaf3dcf[_0x32f8df(0x244)],'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};}}if(!_0x58e48a&&_0x3b2e50[_0x32f8df(0x233)]){if(_0x496ebd)console['log']('\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22'+_0x2d6d23+_0x32f8df(0x266)+_0x3b2e50['name']+'\x22');else{const _0x48200e=await _0x573009['UEoXJ'](writeSessionToLocalCache,_0x3b2e50['name'],_0x3b2e50['organizationId'],_0x2d6d23,_0x5c2d19,_0x3b2e50[_0x32f8df(0x233)],_0x40430a,_0x450dc2);if(_0x2d6d23){const _0x270b79=await _0x573009[_0x32f8df(0x236)](isCachedSessionLive,_0x48200e,_0x2d6d23,{'sessionCheckPath':_0x4d0f9a?.['sessionCheckPath'],'setupHeaders':_0x5c2d19},{'launchBrowser':launchRealBrowser});if(_0x270b79)return console['log'](_0x32f8df(0x222)+_0x3b2e50[_0x32f8df(0x209)]+'\x22,\x20cached\x20locally'),{'authPath':_0x48200e,'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};console['log']('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x3b2e50['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x573009['orCEy'](emitSessionValidationHint,_0x2d6d23,_0x4d0f9a);}else return{'authPath':_0x48200e,'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};}}if(_0x26bd66)return console['log'](_0x32f8df(0x299)+_0x3b2e50['name']+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};console[_0x32f8df(0x203)](_0x32f8df(0x299)+_0x3b2e50[_0x32f8df(0x209)]+'\x22,\x20attempting\x20login...');const _0x1020d7=Boolean(process[_0x32f8df(0x277)]['RANGER_TEST_USERNAME'])&&_0x573009[_0x32f8df(0x207)](Boolean,process['env'][_0x32f8df(0x26c)]),_0x1fab49=Boolean(_0x3b2e50['username']);if(_0x573009['qxIZp'](_0x1020d7,_0x1fab49))try{const _0xa88410=_0x2d6d23?await _0x573009['ewRxw'](serverSideLoginWithOptionalTunnel,_0x3b2e50[_0x32f8df(0x209)],_0x2d6d23,{'force':_0x58e48a,'telemetry':_0x3d0c7b['telemetry']}):await _0x573009['orCEy'](serverSideLogin,_0x3b2e50[_0x32f8df(0x209)],{'force':_0x58e48a});if(_0xa88410['status']===_0x32f8df(0x25f))console['log'](_0x573009['HEbuZ']);else{if(_0x573009['RTdZD'](_0xa88410[_0x32f8df(0x246)],_0x573009['XxOQS'])&&_0xa88410[_0x32f8df(0x28e)]){console['log'](_0x573009['sjATl']);const _0x583ef0=await writeSessionToLocalCache(_0x3b2e50['name'],_0x3b2e50[_0x32f8df(0x264)],_0x2d6d23,_0x5c2d19,_0xa88410[_0x32f8df(0x28e)],_0x40430a,_0x450dc2);return _0x1020d7&&!_0x1fab49&&await _0x573009['dRIZe'](promptSaveCredentials,_0x3b2e50[_0x32f8df(0x209)]),{'authPath':_0x583ef0,'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};}else _0xa88410[_0x32f8df(0x213)]&&(console[_0x32f8df(0x203)](_0x32f8df(0x269)),console['log'](_0xa88410['test_output'])),console['log'](_0x573009[_0x32f8df(0x240)]);}}catch(_0x11ea54){console['log'](_0x32f8df(0x22f)+(_0x11ea54 instanceof Error?_0x11ea54['message']:String(_0x11ea54))),console[_0x32f8df(0x203)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}const _0x5df96b=_0x4d0f9a?{..._0x4d0f9a,'setupHeaders':_0x5c2d19}:_0x2d6d23?{'key':_0x3b2e50[_0x32f8df(0x24e)]??'','domains':[_0x2d6d23],'setupHeaders':_0x5c2d19}:null,{sessionState:_0x59f8fa}=await _0x573009[_0x32f8df(0x279)](manualBrowserLogin,_0x3b2e50,_0x5df96b,{'persistSessionState':!_0x496ebd}),_0x268277=await writeSessionToLocalCache(_0x3b2e50['name'],_0x3b2e50[_0x32f8df(0x264)],_0x2d6d23,_0x5c2d19,_0x59f8fa,_0x40430a,_0x450dc2);return{'authPath':_0x268277,'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};}
@@ -1 +1 @@
1
- const _0x4109c1=_0x2892;(function(_0x4aed84,_0x4cdf9e){const _0x5b8b53=_0x2892,_0x26c9dc=_0x4aed84();while(!![]){try{const _0x2c7620=-parseInt(_0x5b8b53(0x1b1))/0x1+-parseInt(_0x5b8b53(0x1a9))/0x2*(-parseInt(_0x5b8b53(0x19e))/0x3)+parseInt(_0x5b8b53(0x1a1))/0x4+parseInt(_0x5b8b53(0x195))/0x5+-parseInt(_0x5b8b53(0x193))/0x6*(-parseInt(_0x5b8b53(0x1ac))/0x7)+-parseInt(_0x5b8b53(0x1b2))/0x8*(parseInt(_0x5b8b53(0x1b9))/0x9)+-parseInt(_0x5b8b53(0x1af))/0xa;if(_0x2c7620===_0x4cdf9e)break;else _0x26c9dc['push'](_0x26c9dc['shift']());}catch(_0x346b45){_0x26c9dc['push'](_0x26c9dc['shift']());}}}(_0x1223,0x99620));import{createHash}from'crypto';import{join}from'path';function _0x2892(_0x22ade9,_0xe96186){_0x22ade9=_0x22ade9-0x18f;const _0x1223c6=_0x1223();let _0x289285=_0x1223c6[_0x22ade9];return _0x289285;}import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x4a4ee6=process[_0x4109c1(0x1b7)],_0x1212d3={'stdin':process[_0x4109c1(0x1a5)],'stdout':process[_0x4109c1(0x1ab)]}){const _0x17cf84=_0x4109c1;if(_0x4a4ee6['CI'])return![];return Boolean(_0x1212d3['stdin'][_0x17cf84(0x191)])&&Boolean(_0x1212d3[_0x17cf84(0x1ab)][_0x17cf84(0x191)]);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0xe5a053){const _0x1fca25=_0x4109c1,_0x1e00ea={'NvBJJ':'setupHeaders','CXIJT':function(_0x3bd862,_0x3261f2){return _0x3bd862(_0x3261f2);},'vyOKA':'userAgent','QZaUt':function(_0x3968e3,_0x85a7c5){return _0x3968e3!==_0x85a7c5;},'NNaNN':'clientIp','SwWNi':function(_0x171780,_0x27586b){return _0x171780(_0x27586b);}},_0x12e61a=new Set(_0xe5a053[_0x1fca25(0x1a3)]??DEFAULT_INVALIDATE_ON),_0x311c4c={'orgId':_0xe5a053[_0x1fca25(0x199)],'profileName':_0xe5a053['profileName']};return _0x12e61a[_0x1fca25(0x19f)]('baseUrl')&&(_0x311c4c[_0x1fca25(0x1b0)]=_0xe5a053['effectiveBaseUrl']),_0x12e61a[_0x1fca25(0x19f)](_0x1e00ea['NvBJJ'])&&(_0x311c4c[_0x1fca25(0x19b)]=_0xe5a053[_0x1fca25(0x19b)]?_0x1e00ea['CXIJT'](sortObjectKeys,_0xe5a053[_0x1fca25(0x19b)]):_0xe5a053[_0x1fca25(0x19b)]),_0x12e61a['has']('port')&&(_0x311c4c['port']=extractPort(_0xe5a053['effectiveBaseUrl'])),_0x12e61a[_0x1fca25(0x19f)](_0x1e00ea[_0x1fca25(0x1a8)])&&_0x1e00ea[_0x1fca25(0x196)](_0xe5a053[_0x1fca25(0x1a7)],undefined)&&(_0x311c4c[_0x1fca25(0x1a7)]=_0xe5a053[_0x1fca25(0x1a7)]),_0x12e61a[_0x1fca25(0x19f)](_0x1e00ea['NNaNN'])&&_0x1e00ea[_0x1fca25(0x196)](_0xe5a053[_0x1fca25(0x1b4)],undefined)&&(_0x311c4c['clientIp']=_0xe5a053[_0x1fca25(0x1b4)]),_0x1e00ea[_0x1fca25(0x197)](createHash,_0x1fca25(0x18f))[_0x1fca25(0x1ad)](JSON['stringify'](_0x311c4c))[_0x1fca25(0x19c)]('hex')['slice'](0x0,0xc);}function extractPort(_0x2288cd){const _0x29f31e=_0x4109c1;try{return new URL(_0x2288cd)[_0x29f31e(0x1bb)];}catch{return'';}}function sortObjectKeys(_0x4cecc8){const _0x4d316b={};for(const _0x18a846 of Object['keys'](_0x4cecc8)['sort']()){_0x4d316b[_0x18a846]=_0x4cecc8[_0x18a846];}return _0x4d316b;}export function getSessionCachePath(_0x3124a3,_0x426e86){const _0x42fb38=_0x4109c1,_0x2fb941={'NYArE':function(_0x37b849,_0x11aa14,_0x5c3a6f,_0x277141){return _0x37b849(_0x11aa14,_0x5c3a6f,_0x277141);},'XLmDr':_0x42fb38(0x1a4)};return _0x2fb941['NYArE'](join,getRangerHomeDir(),_0x2fb941[_0x42fb38(0x1ae)],_0x3124a3+'-'+_0x426e86+'.json');}export function getStorageStatePath(_0x3f09ad){const _0x17732c=_0x4109c1,_0x4ce058={'TvJKA':_0x17732c(0x192)};return _0x3f09ad['replace'](/\.json$/,_0x4ce058['TvJKA']);}export function needsTunnel(_0x151ff4){const _0x11ae04=_0x4109c1,_0x305c87={'CHBlz':'localhost.'};let _0x121ca1;try{_0x121ca1=new URL(_0x151ff4)[_0x11ae04(0x1a6)];}catch{return![];}if(_0x121ca1===_0x11ae04(0x1a2)||_0x121ca1==='127.0.0.1')return!![];if(_0x121ca1['endsWith']('.localhost'))return!![];if(_0x121ca1['includes'](_0x305c87['CHBlz']))return!![];return![];}export function hostnameOf(_0x190263){const _0x1a0213=_0x4109c1;return new URL(_0x190263)[_0x1a0213(0x1a6)];}export function duplicateCookiesForDomains(_0x490ee4,_0x5c774c){const _0x5aab44=_0x4109c1,_0xbbe443={'KlTij':function(_0x5a9d21,_0x304186){return _0x5a9d21(_0x304186);}},_0x563c27=[..._0x490ee4],_0x3c5aea=new Set(_0x490ee4['map'](_0x35715b=>_0x35715b[_0x5aab44(0x1b6)]));for(const _0x347551 of _0x5c774c){let _0x12281b;try{_0x12281b=_0xbbe443['KlTij'](hostnameOf,_0x347551);}catch{continue;}if(!_0x12281b)continue;const _0x3f408c=_0x12281b['startsWith']('.')?_0x12281b:'.'+_0x12281b;if(_0x3c5aea['has'](_0x12281b)||_0x3c5aea['has'](_0x3f408c))continue;for(const _0x131e33 of _0x490ee4){_0x563c27['push']({..._0x131e33,'domain':_0x3f408c});}_0x3c5aea[_0x5aab44(0x19d)](_0x3f408c);}return _0x563c27;}export function resolveAuthEnvironmentLocally(_0x5255c8,_0x40cfc3){const _0x59fcdf=_0x4109c1,_0x977d6d=_0x5255c8[_0x59fcdf(0x1b3)];if(_0x40cfc3){const _0x2f3139=_0x977d6d[_0x40cfc3];if(!_0x2f3139)return null;return{'key':_0x40cfc3,..._0x2f3139};}if(_0x5255c8['defaultEnvironmentKey']){const _0x7ae0c9=_0x977d6d[_0x5255c8[_0x59fcdf(0x1a0)]];if(!_0x7ae0c9)return null;return{'key':_0x5255c8[_0x59fcdf(0x1a0)],..._0x7ae0c9};}const _0x91548c=Object['keys'](_0x977d6d);if(_0x91548c['length']===0x1){const _0x491327=_0x91548c[0x0];return{'key':_0x491327,..._0x977d6d[_0x491327]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;function _0x1223(){const _0x9286a1=['localhost','invalidateOn','auth','stdin','hostname','userAgent','vyOKA','2cBVtFX','IBjjB','stdout','14hmdlJo','update','XLmDr','19613350hybdjw','effectiveBaseUrl','477428fWMFzS','8jTUKIn','environments','clientIp','newPage','domain','env','domcontentloaded','5357331IwRFop','launchBrowser','port','sha256','catch','isTTY','.storageState.json','3370818tkWZhe','NCPrU','5941320teNJoc','QZaUt','SwWNi','sessionCheckPath','orgId','test','setupHeaders','digest','add','2815767keiZbL','has','defaultEnvironmentKey','1647276zxXZoq'];_0x1223=function(){return _0x9286a1;};return _0x1223();}export function buildSessionCheckUrl(_0x4a21d1,_0x5086b8){try{if(_0x5086b8)return new URL(_0x5086b8,_0x4a21d1)['toString']();return new URL(_0x4a21d1)['toString']();}catch{return null;}}export function looksLikeLoginUrl(_0x10844f){const _0x59255b=_0x4109c1;try{const _0x3faf9d=new URL(_0x10844f);return LOGIN_URL_PATTERN[_0x59255b(0x19a)](_0x3faf9d['pathname']);}catch{return LOGIN_URL_PATTERN['test'](_0x10844f);}}export async function isCachedSessionLive(_0x209ec9,_0x1724ab,_0x3710b6={},_0x4b29af={}){const _0x3fe78a=_0x4109c1,_0x4c2dce={'RiMHS':function(_0x1a2966,_0x481d47,_0x175fae){return _0x1a2966(_0x481d47,_0x175fae);},'IxVVB':function(_0x5a10c8,_0xf2aeb8){return _0x5a10c8===_0xf2aeb8;},'NCPrU':function(_0x5895c1,_0x5e777a){return _0x5895c1===_0x5e777a;},'IBjjB':function(_0x3c77aa,_0x18fad1){return _0x3c77aa(_0x18fad1);}},_0x5cbbf8=_0x4c2dce['RiMHS'](buildSessionCheckUrl,_0x1724ab,_0x3710b6[_0x3fe78a(0x198)]);if(!_0x5cbbf8)return!![];if(!_0x4b29af[_0x3fe78a(0x1ba)])return!![];let _0x57ae4f=null;try{_0x57ae4f=await _0x4b29af['launchBrowser']();const _0x3ba5f5=await _0x57ae4f['newContext']({'storageState':_0x209ec9,'ignoreHTTPSErrors':!![],..._0x3710b6['setupHeaders']?{'extraHTTPHeaders':_0x3710b6[_0x3fe78a(0x19b)]}:{}}),_0x33f369=await _0x3ba5f5[_0x3fe78a(0x1b5)](),_0x564b5a=await _0x33f369['goto'](_0x5cbbf8,{'waitUntil':_0x3fe78a(0x1b8),'timeout':0x3a98}),_0x4202f2=_0x564b5a?.['status']();if(_0x4c2dce['IxVVB'](_0x4202f2,0x191)||_0x4c2dce[_0x3fe78a(0x194)](_0x4202f2,0x193))return![];const _0x4821b5=_0x33f369['url']();if(_0x4c2dce[_0x3fe78a(0x1aa)](looksLikeLoginUrl,_0x4821b5))return![];return!![];}catch{return![];}finally{if(_0x57ae4f)await _0x57ae4f['close']()[_0x3fe78a(0x190)](()=>{});}}
1
+ const _0x3f9a8a=_0x1e38;(function(_0x3a8592,_0x76b56b){const _0x2d5b8c=_0x1e38,_0x199994=_0x3a8592();while(!![]){try{const _0x4d8c1c=-parseInt(_0x2d5b8c(0x1d3))/0x1*(-parseInt(_0x2d5b8c(0x1e0))/0x2)+-parseInt(_0x2d5b8c(0x1d2))/0x3+parseInt(_0x2d5b8c(0x1ea))/0x4+-parseInt(_0x2d5b8c(0x1d6))/0x5*(-parseInt(_0x2d5b8c(0x1e3))/0x6)+-parseInt(_0x2d5b8c(0x1ce))/0x7+parseInt(_0x2d5b8c(0x1eb))/0x8+-parseInt(_0x2d5b8c(0x1ee))/0x9;if(_0x4d8c1c===_0x76b56b)break;else _0x199994['push'](_0x199994['shift']());}catch(_0x172250){_0x199994['push'](_0x199994['shift']());}}}(_0x30ad,0x26ccb));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x110bd7=process['env'],_0x13cf4e={'stdin':process[_0x3f9a8a(0x1e9)],'stdout':process['stdout']}){const _0x14875e=_0x3f9a8a,_0x384de2={'OiqFR':function(_0x3f4f51,_0x2f2748){return _0x3f4f51(_0x2f2748);}};if(_0x110bd7['CI'])return![];return _0x384de2['OiqFR'](Boolean,_0x13cf4e[_0x14875e(0x1e9)]['isTTY'])&&Boolean(_0x13cf4e['stdout']['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x2faad7){const _0x110ca1=_0x3f9a8a,_0x1fb528={'HuDqZ':_0x110ca1(0x1c4),'UhvKY':function(_0x7814b9,_0x15291a){return _0x7814b9(_0x15291a);},'XfEaA':_0x110ca1(0x1e1),'mnvrk':'sha256'},_0x4d43fe=new Set(_0x2faad7[_0x110ca1(0x1cf)]??DEFAULT_INVALIDATE_ON),_0x15c8ce={'orgId':_0x2faad7[_0x110ca1(0x1ed)],'profileName':_0x2faad7[_0x110ca1(0x1cb)]};return _0x4d43fe['has'](_0x110ca1(0x1c7))&&(_0x15c8ce[_0x110ca1(0x1d5)]=_0x2faad7[_0x110ca1(0x1d5)]),_0x4d43fe[_0x110ca1(0x1d8)](_0x1fb528[_0x110ca1(0x1d4)])&&(_0x15c8ce['setupHeaders']=_0x2faad7[_0x110ca1(0x1c4)]?_0x1fb528[_0x110ca1(0x1e8)](sortObjectKeys,_0x2faad7[_0x110ca1(0x1c4)]):_0x2faad7[_0x110ca1(0x1c4)]),_0x4d43fe['has'](_0x1fb528[_0x110ca1(0x1da)])&&(_0x15c8ce[_0x110ca1(0x1e1)]=extractPort(_0x2faad7[_0x110ca1(0x1d5)])),_0x4d43fe['has']('userAgent')&&_0x2faad7['userAgent']!==undefined&&(_0x15c8ce[_0x110ca1(0x1cc)]=_0x2faad7['userAgent']),_0x4d43fe['has'](_0x110ca1(0x1c3))&&_0x2faad7['clientIp']!==undefined&&(_0x15c8ce['clientIp']=_0x2faad7['clientIp']),createHash(_0x1fb528[_0x110ca1(0x1ec)])[_0x110ca1(0x1de)](JSON['stringify'](_0x15c8ce))[_0x110ca1(0x1c5)]('hex')[_0x110ca1(0x1cd)](0x0,0xc);}function _0x30ad(){const _0x5e9099=['orgId','2111544syKVXx','EFiMS','.localhost','clientIp','setupHeaders','digest','launchBrowser','baseUrl','auth','twTDA','sessionCheckPath','profileName','userAgent','slice','658266xWWqpA','invalidateOn','.storageState.json','close','652701VjYbBp','144139OieycI','HuDqZ','effectiveBaseUrl','709370HyQXvr','EhpMv','has','aZOTN','XfEaA','keys','sort','toString','update','test','4ABrLVL','port','domcontentloaded','6isNFwP','hostname','ycMuN','127.0.0.1','push','UhvKY','stdin','574920YhsHVy','1050096KONUph','mnvrk'];_0x30ad=function(){return _0x5e9099;};return _0x30ad();}function extractPort(_0x155bc1){try{return new URL(_0x155bc1)['port'];}catch{return'';}}function sortObjectKeys(_0x5a1e87){const _0xdbbcb5=_0x3f9a8a,_0x5eeb40={};for(const _0x14ee7e of Object[_0xdbbcb5(0x1db)](_0x5a1e87)[_0xdbbcb5(0x1dc)]()){_0x5eeb40[_0x14ee7e]=_0x5a1e87[_0x14ee7e];}return _0x5eeb40;}export function getSessionCachePath(_0x1afa11,_0x41ee27){const _0x1c50f3=_0x3f9a8a,_0x37852b={'IdtgX':_0x1c50f3(0x1c8)};return join(getRangerHomeDir(),_0x37852b['IdtgX'],_0x1afa11+'-'+_0x41ee27+'.json');}export function getStorageStatePath(_0x3c8ed9){const _0x5c1450=_0x3f9a8a;return _0x3c8ed9['replace'](/\.json$/,_0x5c1450(0x1d0));}export function needsTunnel(_0x32912c){const _0x4d8095=_0x3f9a8a,_0x350a41={'twTDA':function(_0x2da700,_0x3cbd7e){return _0x2da700===_0x3cbd7e;}};let _0x20cdcc;try{_0x20cdcc=new URL(_0x32912c)['hostname'];}catch{return![];}if(_0x20cdcc==='localhost'||_0x350a41[_0x4d8095(0x1c9)](_0x20cdcc,_0x4d8095(0x1e6)))return!![];if(_0x20cdcc['endsWith'](_0x4d8095(0x1c2)))return!![];if(_0x20cdcc['includes']('localhost.'))return!![];return![];}export function hostnameOf(_0x2e7b5a){const _0x4d5d0f=_0x3f9a8a;return new URL(_0x2e7b5a)[_0x4d5d0f(0x1e4)];}function _0x1e38(_0x37d49c,_0x4d2432){_0x37d49c=_0x37d49c-0x1c1;const _0x30ad83=_0x30ad();let _0x1e3869=_0x30ad83[_0x37d49c];return _0x1e3869;}export function duplicateCookiesForDomains(_0x420d0a,_0x55cee8){const _0x3adddd=_0x3f9a8a,_0x2ad899=[..._0x420d0a],_0x360379=new Set(_0x420d0a['map'](_0x1f8a45=>_0x1f8a45['domain']));for(const _0xadc54 of _0x55cee8){let _0x3c897a;try{_0x3c897a=hostnameOf(_0xadc54);}catch{continue;}if(!_0x3c897a)continue;const _0x3e42c3=_0x3c897a['startsWith']('.')?_0x3c897a:'.'+_0x3c897a;if(_0x360379['has'](_0x3c897a)||_0x360379['has'](_0x3e42c3))continue;for(const _0x7f1b4e of _0x420d0a){_0x2ad899[_0x3adddd(0x1e7)]({..._0x7f1b4e,'domain':_0x3e42c3});}_0x360379['add'](_0x3e42c3);}return _0x2ad899;}export function resolveAuthEnvironmentLocally(_0x4a3c54,_0x41d11f){const _0x5243b0={'UmdFG':function(_0x5d2a54,_0x4813c5){return _0x5d2a54===_0x4813c5;}},_0x2234fb=_0x4a3c54['environments'];if(_0x41d11f){const _0x252b97=_0x2234fb[_0x41d11f];if(!_0x252b97)return null;return{'key':_0x41d11f,..._0x252b97};}if(_0x4a3c54['defaultEnvironmentKey']){const _0x51b307=_0x2234fb[_0x4a3c54['defaultEnvironmentKey']];if(!_0x51b307)return null;return{'key':_0x4a3c54['defaultEnvironmentKey'],..._0x51b307};}const _0x57e91a=Object['keys'](_0x2234fb);if(_0x5243b0['UmdFG'](_0x57e91a['length'],0x1)){const _0x3e2a50=_0x57e91a[0x0];return{'key':_0x3e2a50,..._0x2234fb[_0x3e2a50]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x329dae,_0x5504e2){const _0x2c5570=_0x3f9a8a;try{if(_0x5504e2)return new URL(_0x5504e2,_0x329dae)[_0x2c5570(0x1dd)]();return new URL(_0x329dae)[_0x2c5570(0x1dd)]();}catch{return null;}}export function looksLikeLoginUrl(_0x58affa){const _0x5a8012=_0x3f9a8a;try{const _0x756c39=new URL(_0x58affa);return LOGIN_URL_PATTERN[_0x5a8012(0x1df)](_0x756c39['pathname']);}catch{return LOGIN_URL_PATTERN[_0x5a8012(0x1df)](_0x58affa);}}export async function isCachedSessionLive(_0x2d1725,_0x2cba16,_0x3a2f3d={},_0x3c6c3a={}){const _0x4061dc=_0x3f9a8a,_0x1c3d00={'EFiMS':function(_0x5e7372,_0x348ffc,_0x47e4ce){return _0x5e7372(_0x348ffc,_0x47e4ce);},'EhpMv':_0x4061dc(0x1e2),'aZOTN':function(_0x3c1c51,_0x26c228){return _0x3c1c51===_0x26c228;},'ycMuN':function(_0x3ab0d7,_0x422ba7){return _0x3ab0d7(_0x422ba7);}},_0x58a58f=_0x1c3d00[_0x4061dc(0x1c1)](buildSessionCheckUrl,_0x2cba16,_0x3a2f3d[_0x4061dc(0x1ca)]);if(!_0x58a58f)return!![];if(!_0x3c6c3a['launchBrowser'])return!![];let _0x4b31dc=null;try{_0x4b31dc=await _0x3c6c3a[_0x4061dc(0x1c6)]();const _0x57ca93=await _0x4b31dc['newContext']({'storageState':_0x2d1725,'ignoreHTTPSErrors':!![],..._0x3a2f3d['setupHeaders']?{'extraHTTPHeaders':_0x3a2f3d[_0x4061dc(0x1c4)]}:{}}),_0x58f33f=await _0x57ca93['newPage'](),_0x28bcf1=await _0x58f33f['goto'](_0x58a58f,{'waitUntil':_0x1c3d00[_0x4061dc(0x1d7)],'timeout':0x3a98}),_0x4bf99a=_0x28bcf1?.['status']();if(_0x1c3d00[_0x4061dc(0x1d9)](_0x4bf99a,0x191)||_0x1c3d00['aZOTN'](_0x4bf99a,0x193))return![];const _0x3936b2=_0x58f33f['url']();if(_0x1c3d00[_0x4061dc(0x1e5)](looksLikeLoginUrl,_0x3936b2))return![];return!![];}catch{return![];}finally{if(_0x4b31dc)await _0x4b31dc[_0x4061dc(0x1d1)]()['catch'](()=>{});}}
@@ -1 +1 @@
1
- const _0x54109=_0x6e7c;(function(_0x13c3c2,_0x3cf2cd){const _0x5f11b4=_0x6e7c,_0x303a47=_0x13c3c2();while(!![]){try{const _0x442529=parseInt(_0x5f11b4(0x18d))/0x1+parseInt(_0x5f11b4(0x18f))/0x2*(-parseInt(_0x5f11b4(0x17f))/0x3)+-parseInt(_0x5f11b4(0x18b))/0x4*(parseInt(_0x5f11b4(0x184))/0x5)+parseInt(_0x5f11b4(0x18e))/0x6*(-parseInt(_0x5f11b4(0x17d))/0x7)+-parseInt(_0x5f11b4(0x182))/0x8*(-parseInt(_0x5f11b4(0x18a))/0x9)+-parseInt(_0x5f11b4(0x181))/0xa+parseInt(_0x5f11b4(0x185))/0xb;if(_0x442529===_0x3cf2cd)break;else _0x303a47['push'](_0x303a47['shift']());}catch(_0x4d2e9a){_0x303a47['push'](_0x303a47['shift']());}}}(_0x12ad,0x2e6ff));function _0x6e7c(_0x23a9b6,_0x4da231){_0x23a9b6=_0x23a9b6-0x17c;const _0x12ad93=_0x12ad();let _0x6e7c34=_0x12ad93[_0x23a9b6];return _0x6e7c34;}import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';function _0x12ad(){const _0x68d1f9=['113598rvgfYJ','86VDpNor','yqQHU','ranger-auth-encryption','35QnDicw','getAuthTag','519mvYbVJ','aes-256-gcm','3472870SKIJie','770384tnJAyX','GzdoJ','10bjbavJ','4863881fkyYTr','subarray','sha256','ArBpr','concat','9FtyxUw','411188AzhUDE','adxKY','306723isyaqs'];_0x12ad=function(){return _0x68d1f9;};return _0x12ad();}const ALGORITHM=_0x54109(0x180),SALT=_0x54109(0x17c),KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x48fe1a){const _0x166781=_0x54109,_0x1c0d26={'lRkAy':function(_0x23451e,_0x5b7483,_0x16392f,_0x16661a,_0x46238f,_0x31f6e7){return _0x23451e(_0x5b7483,_0x16392f,_0x16661a,_0x46238f,_0x31f6e7);},'yqQHU':_0x166781(0x187)};return _0x1c0d26['lRkAy'](pbkdf2Sync,_0x48fe1a,SALT,0x186a0,KEY_LENGTH,_0x1c0d26[_0x166781(0x190)]);}export function encrypt(_0x5fdc93,_0x1f35fc){const _0x2d11c2=_0x54109,_0x3f808f={'ArBpr':function(_0x4c21fa,_0x3841a3){return _0x4c21fa(_0x3841a3);},'adxKY':'utf8'},_0x4b67b7=deriveKey(_0x1f35fc),_0x48f669=_0x3f808f[_0x2d11c2(0x188)](randomBytes,IV_LENGTH),_0x5a6227=createCipheriv(ALGORITHM,_0x4b67b7,_0x48f669),_0x31a834=Buffer['concat']([_0x5a6227['update'](_0x5fdc93,_0x3f808f[_0x2d11c2(0x18c)]),_0x5a6227['final']()]),_0x56a45f=_0x5a6227[_0x2d11c2(0x17e)]();return Buffer[_0x2d11c2(0x189)]([_0x48f669,_0x56a45f,_0x31a834]);}export function decrypt(_0x117a1a,_0x44f93d){const _0x48ff8f=_0x54109,_0x1acbbe={'Agikt':function(_0x4c96bd,_0x40d35c){return _0x4c96bd(_0x40d35c);},'GzdoJ':function(_0x460d65,_0x352a59){return _0x460d65+_0x352a59;},'QrtYg':function(_0x3dedbb,_0x44eb4e){return _0x3dedbb+_0x44eb4e;},'uzCNZ':'utf8'},_0x17151d=_0x1acbbe['Agikt'](deriveKey,_0x44f93d),_0x4e68c0=_0x117a1a['subarray'](0x0,IV_LENGTH),_0x1d12b4=_0x117a1a[_0x48ff8f(0x186)](IV_LENGTH,_0x1acbbe[_0x48ff8f(0x183)](IV_LENGTH,TAG_LENGTH)),_0x49b5f5=_0x117a1a[_0x48ff8f(0x186)](IV_LENGTH+TAG_LENGTH),_0x405785=createDecipheriv(ALGORITHM,_0x17151d,_0x4e68c0);return _0x405785['setAuthTag'](_0x1d12b4),_0x1acbbe['QrtYg'](_0x405785['update'](_0x49b5f5),_0x405785['final'](_0x1acbbe['uzCNZ']));}
1
+ const _0x7184fe=_0x4c0e;(function(_0x237877,_0x5c8242){const _0x3244e1=_0x4c0e,_0x2542a0=_0x237877();while(!![]){try{const _0x5259da=-parseInt(_0x3244e1(0x1da))/0x1+parseInt(_0x3244e1(0x1dc))/0x2*(-parseInt(_0x3244e1(0x1d4))/0x3)+parseInt(_0x3244e1(0x1d7))/0x4+-parseInt(_0x3244e1(0x1df))/0x5+parseInt(_0x3244e1(0x1d5))/0x6+parseInt(_0x3244e1(0x1d6))/0x7+parseInt(_0x3244e1(0x1d9))/0x8;if(_0x5259da===_0x5c8242)break;else _0x2542a0['push'](_0x2542a0['shift']());}catch(_0x41737d){_0x2542a0['push'](_0x2542a0['shift']());}}}(_0x3f11,0x81fab));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM=_0x7184fe(0x1e0),SALT=_0x7184fe(0x1d0),KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;function _0x4c0e(_0x3bcb12,_0x45d61e){_0x3bcb12=_0x3bcb12-0x1ce;const _0x3f1189=_0x3f11();let _0x4c0e71=_0x3f1189[_0x3bcb12];return _0x4c0e71;}export function deriveKey(_0x42e0dd){return pbkdf2Sync(_0x42e0dd,SALT,0x186a0,KEY_LENGTH,'sha256');}export function encrypt(_0x1778de,_0x4af644){const _0x47c0ab=_0x7184fe,_0x8e0223={'jyGEG':function(_0x28b13b,_0x490a18){return _0x28b13b(_0x490a18);},'qAWtZ':function(_0x201b20,_0x1891ce,_0x40b05e,_0xb94551){return _0x201b20(_0x1891ce,_0x40b05e,_0xb94551);}},_0x46d9ae=_0x8e0223['jyGEG'](deriveKey,_0x4af644),_0x5b0f84=_0x8e0223['jyGEG'](randomBytes,IV_LENGTH),_0x4a6108=_0x8e0223[_0x47c0ab(0x1dd)](createCipheriv,ALGORITHM,_0x46d9ae,_0x5b0f84),_0x6bc2ca=Buffer['concat']([_0x4a6108[_0x47c0ab(0x1cf)](_0x1778de,_0x47c0ab(0x1d2)),_0x4a6108[_0x47c0ab(0x1e1)]()]),_0x5cdf29=_0x4a6108[_0x47c0ab(0x1d1)]();return Buffer['concat']([_0x5b0f84,_0x5cdf29,_0x6bc2ca]);}export function decrypt(_0x1cef88,_0x5c481a){const _0x35d5d4=_0x7184fe,_0x2cfc4d={'RVxpT':function(_0x6f89af,_0x2d2919){return _0x6f89af(_0x2d2919);},'NQKoH':function(_0x298501,_0x2681d4){return _0x298501+_0x2681d4;},'aAtLH':function(_0x376382,_0x797734,_0x282dec,_0x3c0f5a){return _0x376382(_0x797734,_0x282dec,_0x3c0f5a);},'AfNNP':function(_0x12ad74,_0x5af3c2){return _0x12ad74+_0x5af3c2;}},_0x4f6ff6=_0x2cfc4d['RVxpT'](deriveKey,_0x5c481a),_0x55a1a4=_0x1cef88[_0x35d5d4(0x1d8)](0x0,IV_LENGTH),_0x59875e=_0x1cef88['subarray'](IV_LENGTH,IV_LENGTH+TAG_LENGTH),_0x3dacc5=_0x1cef88[_0x35d5d4(0x1d8)](_0x2cfc4d[_0x35d5d4(0x1d3)](IV_LENGTH,TAG_LENGTH)),_0x497046=_0x2cfc4d[_0x35d5d4(0x1de)](createDecipheriv,ALGORITHM,_0x4f6ff6,_0x55a1a4);return _0x497046[_0x35d5d4(0x1db)](_0x59875e),_0x2cfc4d[_0x35d5d4(0x1ce)](_0x497046['update'](_0x3dacc5),_0x497046['final']('utf8'));}function _0x3f11(){const _0x232fb8=['update','ranger-auth-encryption','getAuthTag','utf8','NQKoH','38481ibCwNd','362658BwkUQN','1517922CpFqbW','2667844ckVjyc','subarray','14054152PBlSJE','994601ZrKdvo','setAuthTag','38cUfgNu','qAWtZ','aAtLH','4651550McLYVU','aes-256-gcm','final','AfNNP'];_0x3f11=function(){return _0x232fb8;};return _0x3f11();}
@@ -1 +1 @@
1
- const _0x28618f=_0x4d1e;(function(_0x5b59b7,_0x4858fd){const _0x3bb77e=_0x4d1e,_0x5a2d89=_0x5b59b7();while(!![]){try{const _0x1d5ffa=parseInt(_0x3bb77e(0x1dd))/0x1*(parseInt(_0x3bb77e(0x1e3))/0x2)+-parseInt(_0x3bb77e(0x202))/0x3+-parseInt(_0x3bb77e(0x1f3))/0x4+parseInt(_0x3bb77e(0x1fa))/0x5+parseInt(_0x3bb77e(0x1f0))/0x6+parseInt(_0x3bb77e(0x1e2))/0x7*(-parseInt(_0x3bb77e(0x1e1))/0x8)+-parseInt(_0x3bb77e(0x206))/0x9;if(_0x1d5ffa===_0x4858fd)break;else _0x5a2d89['push'](_0x5a2d89['shift']());}catch(_0xd0dd97){_0x5a2d89['push'](_0x5a2d89['shift']());}}}(_0x1836,0x40fe9));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x1836(){const _0x7cff5e=['ULlVA','errorMessage','--secret','--pass','--credentials','sessionId','errorType','POST','995jdBmiD','7|6|1|4|5|0|2|3','DEBUG','[REDACTED]','64NCOkAt','264019ZlfRFz','758zHLpsf','has_token','has','rawCommand','invalid_option_value','Not\x20enough\x20non-option\x20arguments','includes','XpHaL','some','Unknown\x20command','--key','missing_required_argument','Invalid\x20values','2994090WnlVFo','push','unknown_command','222936GMukvE','indexOf','DbzTx','syntax_error','unknown_argument','unknown','Bearer\x20','2616460klAPKM','application/json','test','/api/v1/mcp/desire-path-logs','split','gqCjO','catch','slice','600399xVaOBm','startsWith','Ojoxh','Unknown\x20argument','5180328vybHrb','error','length','--password','env','hryOt','toLowerCase','Missing\x20required\x20argument','no_token','PTPrQ'];_0x1836=function(){return _0x7cff5e;};return _0x1836();}import{getCurrentVersion}from'./version.js';function _0x4d1e(_0x396b8b,_0x325152){_0x396b8b=_0x396b8b-0x1dd;const _0x18361d=_0x1836();let _0x4d1eb9=_0x18361d[_0x396b8b];return _0x4d1eb9;}const SENSITIVE_FLAGS=new Set(['--token','-t',_0x28618f(0x212),'--api-key','--apikey',_0x28618f(0x1ed),_0x28618f(0x209),_0x28618f(0x213),'--auth','--authorization','--header','--cookie',_0x28618f(0x214)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x5e14d9){const _0x1fd019=_0x28618f;return TOKEN_PATTERNS[_0x1fd019(0x1eb)](_0x1969ed=>_0x1969ed[_0x1fd019(0x1fc)](_0x5e14d9));}export function sanitizeArgs(_0x2da56a){const _0x1107fd=_0x28618f,_0xbcc1f0={'NhshL':function(_0x3f583d,_0x3e9d75){return _0x3f583d<_0x3e9d75;},'BIfHS':_0x1107fd(0x1e0)},_0x2252ff=[];let _0x2f1b89=![];for(let _0x898475=0x0;_0xbcc1f0['NhshL'](_0x898475,_0x2da56a[_0x1107fd(0x208)]);_0x898475++){const _0x392738=_0x2da56a[_0x898475];if(_0x2f1b89){_0x2252ff['push'](_0xbcc1f0['BIfHS']),_0x2f1b89=![];continue;}if(_0x392738[_0x1107fd(0x203)]('--')||_0x392738[_0x1107fd(0x203)]('-')){const _0x42c0a5=_0x392738[_0x1107fd(0x1f4)]('=');if(_0x42c0a5!==-0x1){const _0x394b65=_0x392738[_0x1107fd(0x201)](0x0,_0x42c0a5)[_0x1107fd(0x20c)]();if(SENSITIVE_FLAGS['has'](_0x394b65)){_0x2252ff[_0x1107fd(0x1f1)](_0x392738['slice'](0x0,_0x42c0a5)+'=[REDACTED]');continue;}}else{const _0x18f76c=_0x392738['toLowerCase']();SENSITIVE_FLAGS[_0x1107fd(0x1e5)](_0x18f76c)&&(_0x2f1b89=!![]);}_0x2252ff['push'](_0x392738);}else looksLikeToken(_0x392738)?_0x2252ff['push']('[REDACTED]'):_0x2252ff[_0x1107fd(0x1f1)](_0x392738);}return _0x2252ff['join']('\x20');}export async function logDesirePath(_0x55dfa2){const _0x6e1902=_0x28618f,_0x1c25de={'ZvbCy':function(_0x61e803){return _0x61e803();},'mWQie':function(_0x1a69a2){return _0x1a69a2();},'ULlVA':function(_0x41efc9,_0x266a3a,_0x1d14bc){return _0x41efc9(_0x266a3a,_0x1d14bc);},'XpHaL':_0x6e1902(0x217)};try{const _0x459425=await _0x1c25de['ZvbCy'](getToken)[_0x6e1902(0x200)](()=>null),_0x351cc0=_0x1c25de['mWQie'](getApiBaseUrl),_0x5c3fda=getCurrentVersion(),_0x45512e=_0x459425?_0x6e1902(0x1e4):_0x6e1902(0x20e),_0x2715e1={..._0x55dfa2['metadata'],'authStatus':_0x45512e,'isTty':process['stdout']['isTTY']??![]},_0x206f32={'Content-Type':_0x6e1902(0x1fb)};_0x459425&&(_0x206f32['Authorization']=_0x6e1902(0x1f9)+_0x459425);const _0xfea090={'rawCommand':_0x55dfa2[_0x6e1902(0x1e6)],'errorMessage':_0x55dfa2[_0x6e1902(0x211)],'errorType':_0x55dfa2[_0x6e1902(0x216)],'featureId':_0x55dfa2['featureId'],'sessionId':_0x55dfa2[_0x6e1902(0x215)],'metadata':_0x2715e1,'cliVersion':_0x5c3fda};process[_0x6e1902(0x20a)]['DEBUG']&&(console[_0x6e1902(0x207)]('[desire-path]\x20Sending\x20log\x20to\x20'+_0x351cc0+_0x6e1902(0x1fd)),console['error']('[desire-path]\x20Payload:\x20'+JSON['stringify'](_0xfea090,null,0x2))),await _0x1c25de[_0x6e1902(0x210)](fetch,_0x351cc0+'/api/v1/mcp/desire-path-logs',{'method':_0x1c25de[_0x6e1902(0x1ea)],'headers':_0x206f32,'body':JSON['stringify'](_0xfea090)});}catch(_0x1b0518){process[_0x6e1902(0x20a)][_0x6e1902(0x1df)]&&console['error']('[desire-path]\x20Failed\x20to\x20send:\x20'+_0x1b0518);}}export function getErrorType(_0x56d022,_0x3668bf){const _0x2f1658=_0x28618f,_0x500ef3={'PTPrQ':_0x2f1658(0x1de),'haxUJ':_0x2f1658(0x1ef),'tlfku':_0x2f1658(0x1e7),'hryOt':_0x2f1658(0x1f6),'gqCjO':_0x2f1658(0x205),'Ojoxh':_0x2f1658(0x1e8),'XlKrv':_0x2f1658(0x1ee),'svzZT':_0x2f1658(0x1f8),'DbzTx':'runtime_error'},_0x462294=_0x500ef3[_0x2f1658(0x20f)][_0x2f1658(0x1fe)]('|');let _0x1f9409=0x0;while(!![]){switch(_0x462294[_0x1f9409++]){case'0':if(_0x56d022['includes'](_0x500ef3['haxUJ']))return _0x500ef3['tlfku'];continue;case'1':if(_0x56d022['includes'](_0x2f1658(0x1ec)))return _0x2f1658(0x1f2);continue;case'2':if(_0x56d022['includes'](_0x2f1658(0x20d)))return'missing_option';continue;case'3':return _0x500ef3[_0x2f1658(0x20b)];case'4':if(_0x56d022[_0x2f1658(0x1e9)](_0x500ef3[_0x2f1658(0x1ff)]))return _0x2f1658(0x1f7);continue;case'5':if(_0x56d022['includes'](_0x500ef3[_0x2f1658(0x204)]))return _0x500ef3['XlKrv'];continue;case'6':if(!_0x56d022)return _0x500ef3['svzZT'];continue;case'7':if(_0x3668bf)return _0x500ef3[_0x2f1658(0x1f5)];continue;}break;}}
1
+ const _0x723662=_0x1790;(function(_0x3a290e,_0x541f78){const _0x252e04=_0x1790,_0x2fb0b9=_0x3a290e();while(!![]){try{const _0x3abf3a=-parseInt(_0x252e04(0x1c9))/0x1+parseInt(_0x252e04(0x1cb))/0x2*(parseInt(_0x252e04(0x1a6))/0x3)+-parseInt(_0x252e04(0x1c5))/0x4+parseInt(_0x252e04(0x1d6))/0x5+-parseInt(_0x252e04(0x1bc))/0x6*(parseInt(_0x252e04(0x1b9))/0x7)+-parseInt(_0x252e04(0x1ae))/0x8*(-parseInt(_0x252e04(0x1ce))/0x9)+-parseInt(_0x252e04(0x1c6))/0xa;if(_0x3abf3a===_0x541f78)break;else _0x2fb0b9['push'](_0x2fb0b9['shift']());}catch(_0x4b0b7e){_0x2fb0b9['push'](_0x2fb0b9['shift']());}}}(_0x4d54,0xe054a));function _0x4d54(){const _0x31c9ce=['env','770036zEEzFE','errorMessage','4AZXPmT','=[REDACTED]','error','126081GfypQJ','has_token','Unknown\x20command','slice','startsWith','Authorization','--authorization','Ovcsv','6802810mxLmWw','Not\x20enough\x20non-option\x20arguments','[desire-path]\x20Failed\x20to\x20send:\x20','syntax_error','--password','--secret','SorRS','2513937AroFRd','has','--token','runtime_error','--key','POST','zhQid','join','176DtUPPH','errorType','application/json','--pass','AQRrp','missing_option','catch','--apikey','missing_required_argument','includes','test','7ECwIhp','--credentials','isTTY','4753374nuAWGa','toLowerCase','rawCommand','sessionId','length','--api-key','indexOf','push','mWJxh','1846784PnmDgz','4018990ftIfct','[REDACTED]'];_0x4d54=function(){return _0x31c9ce;};return _0x4d54();}function _0x1790(_0xd771d9,_0x54c129){_0xd771d9=_0xd771d9-0x1a4;const _0x4d54a0=_0x4d54();let _0x17900c=_0x4d54a0[_0xd771d9];return _0x17900c;}import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0x723662(0x1a8),'-t',_0x723662(0x1a4),_0x723662(0x1c1),_0x723662(0x1b5),_0x723662(0x1aa),_0x723662(0x1da),_0x723662(0x1b1),'--auth',_0x723662(0x1d4),'--header','--cookie',_0x723662(0x1ba)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x455334){const _0x47e260=_0x723662;return TOKEN_PATTERNS['some'](_0x11dc5e=>_0x11dc5e[_0x47e260(0x1b8)](_0x455334));}export function sanitizeArgs(_0x3374c6){const _0x2152f2=_0x723662,_0x4d81b0={'xXSxj':function(_0x4b5090,_0xae6e71){return _0x4b5090<_0xae6e71;},'SorRS':_0x2152f2(0x1c7),'ZGEfc':function(_0x206608,_0x153e37){return _0x206608!==_0x153e37;}},_0x53619f=[];let _0xa474eb=![];for(let _0x5b5d25=0x0;_0x4d81b0['xXSxj'](_0x5b5d25,_0x3374c6[_0x2152f2(0x1c0)]);_0x5b5d25++){const _0x2599f6=_0x3374c6[_0x5b5d25];if(_0xa474eb){_0x53619f[_0x2152f2(0x1c3)](_0x4d81b0[_0x2152f2(0x1a5)]),_0xa474eb=![];continue;}if(_0x2599f6['startsWith']('--')||_0x2599f6[_0x2152f2(0x1d2)]('-')){const _0x52dd80=_0x2599f6[_0x2152f2(0x1c2)]('=');if(_0x4d81b0['ZGEfc'](_0x52dd80,-0x1)){const _0x30ddcc=_0x2599f6[_0x2152f2(0x1d1)](0x0,_0x52dd80)['toLowerCase']();if(SENSITIVE_FLAGS['has'](_0x30ddcc)){_0x53619f['push'](_0x2599f6[_0x2152f2(0x1d1)](0x0,_0x52dd80)+_0x2152f2(0x1cc));continue;}}else{const _0x290c1b=_0x2599f6[_0x2152f2(0x1bd)]();SENSITIVE_FLAGS[_0x2152f2(0x1a7)](_0x290c1b)&&(_0xa474eb=!![]);}_0x53619f[_0x2152f2(0x1c3)](_0x2599f6);}else looksLikeToken(_0x2599f6)?_0x53619f['push']('[REDACTED]'):_0x53619f[_0x2152f2(0x1c3)](_0x2599f6);}return _0x53619f[_0x2152f2(0x1ad)]('\x20');}export async function logDesirePath(_0x307e9f){const _0x4e87b9=_0x723662,_0xfa07d6={'mWJxh':function(_0x225181){return _0x225181();},'JGkBC':'no_token','YSIEj':_0x4e87b9(0x1b0),'VRjdo':_0x4e87b9(0x1ab)};try{const _0x401133=await _0xfa07d6['mWJxh'](getToken)[_0x4e87b9(0x1b4)](()=>null),_0x445424=_0xfa07d6[_0x4e87b9(0x1c4)](getApiBaseUrl),_0x383cfa=getCurrentVersion(),_0x19dd26=_0x401133?_0x4e87b9(0x1cf):_0xfa07d6['JGkBC'],_0x2a97cb={..._0x307e9f['metadata'],'authStatus':_0x19dd26,'isTty':process['stdout'][_0x4e87b9(0x1bb)]??![]},_0x5a0f06={'Content-Type':_0xfa07d6['YSIEj']};_0x401133&&(_0x5a0f06[_0x4e87b9(0x1d3)]='Bearer\x20'+_0x401133);const _0x85b2e9={'rawCommand':_0x307e9f[_0x4e87b9(0x1be)],'errorMessage':_0x307e9f[_0x4e87b9(0x1ca)],'errorType':_0x307e9f[_0x4e87b9(0x1af)],'featureId':_0x307e9f['featureId'],'sessionId':_0x307e9f[_0x4e87b9(0x1bf)],'metadata':_0x2a97cb,'cliVersion':_0x383cfa};process['env']['DEBUG']&&(console[_0x4e87b9(0x1cd)]('[desire-path]\x20Sending\x20log\x20to\x20'+_0x445424+'/api/v1/mcp/desire-path-logs'),console[_0x4e87b9(0x1cd)]('[desire-path]\x20Payload:\x20'+JSON['stringify'](_0x85b2e9,null,0x2))),await fetch(_0x445424+'/api/v1/mcp/desire-path-logs',{'method':_0xfa07d6['VRjdo'],'headers':_0x5a0f06,'body':JSON['stringify'](_0x85b2e9)});}catch(_0x577b11){process[_0x4e87b9(0x1c8)]['DEBUG']&&console[_0x4e87b9(0x1cd)](_0x4e87b9(0x1d8)+_0x577b11);}}export function getErrorType(_0x51ebae,_0x47f23e){const _0x3ef533=_0x723662,_0xd2a65a={'Ovcsv':'unknown','nkVtZ':_0x3ef533(0x1d0),'vIWwk':'unknown_command','WTYoB':'Unknown\x20argument','zhQid':'unknown_argument','AQRrp':'invalid_option_value','MWCTn':'Missing\x20required\x20argument'};if(_0x47f23e)return _0x3ef533(0x1a9);if(!_0x51ebae)return _0xd2a65a[_0x3ef533(0x1d5)];if(_0x51ebae['includes'](_0xd2a65a['nkVtZ']))return _0xd2a65a['vIWwk'];if(_0x51ebae['includes'](_0xd2a65a['WTYoB']))return _0xd2a65a[_0x3ef533(0x1ac)];if(_0x51ebae[_0x3ef533(0x1b7)](_0x3ef533(0x1d7)))return _0x3ef533(0x1b6);if(_0x51ebae['includes']('Invalid\x20values'))return _0xd2a65a[_0x3ef533(0x1b2)];if(_0x51ebae[_0x3ef533(0x1b7)](_0xd2a65a['MWCTn']))return _0x3ef533(0x1b3);return _0x3ef533(0x1d9);}
@@ -1 +1 @@
1
- (function(_0x450d74,_0x4e8913){const _0x506cb1=_0x3073,_0x3744ae=_0x450d74();while(!![]){try{const _0x3a1e08=parseInt(_0x506cb1(0x1cc))/0x1+-parseInt(_0x506cb1(0x1d7))/0x2*(parseInt(_0x506cb1(0x1c2))/0x3)+-parseInt(_0x506cb1(0x1fd))/0x4+parseInt(_0x506cb1(0x1e3))/0x5*(-parseInt(_0x506cb1(0x211))/0x6)+parseInt(_0x506cb1(0x1fe))/0x7*(-parseInt(_0x506cb1(0x1dc))/0x8)+-parseInt(_0x506cb1(0x215))/0x9*(parseInt(_0x506cb1(0x1fb))/0xa)+parseInt(_0x506cb1(0x1cd))/0xb;if(_0x3a1e08===_0x4e8913)break;else _0x3744ae['push'](_0x3744ae['shift']());}catch(_0x3e919c){_0x3744ae['push'](_0x3744ae['shift']());}}}(_0x397a,0x9cbe6));import{spawn}from'child_process';import _0x44a19d from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';function _0x397a(){const _0x4e1256=['from','POST','413577yvUqCA','zJujk','MyFYF','KounT','application/x-www-form-urlencoded','unref','Authentication\x20failed','length','xdg-open','5553zMYGKd','split','org_id','/api-keys','OkKuh','map','name','list','RPHhB','ryntH','912107XxhBTM','38332954rpcKBm','fNjOu','Using\x20organization:\x20','uVxdA','DzWol','nUOdx','knoWS','selected','FaGqk','log','1142jflNUb','Failed\x20to\x20request\x20device\x20code:\x20','yKbYU','PDkhv','expires_in','5216856CnjcsJ','firstName','token','json','SkvBw','Setting\x20up\x20your\x20organization...','error_description','41920AvAyBd','NnRzs','device_code','verification_uri_complete','startsWith','Code:\x20','xTnFn','Invalid\x20JWT\x20format','status','application/json','memberships','jqdYv','start','ignore','now','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','isTTY','GET','write','Failed\x20to\x20fetch\x20memberships:\x20','workosClientId','base64url','stdout','130cxoTHa','/organization/self-serve-signup','4787848bnxJse','7vpxEbD','Failed\x20to\x20provision\x20CLI\x20token:\x20','error','filter','miZEz','Sonrb','jjqtu','Select\x20an\x20organization:','interval','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','open','access_token','organizationId','vSUwJ','email','EMRxb','text','vWksx','refresh_token','180wkZrbK','platform'];_0x397a=function(){return _0x4e1256;};return _0x397a();}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(_0x464ad3){const _0x19a8c2=_0x3073,_0x2e71d7={'ryntH':'POST','jjqtu':'application/x-www-form-urlencoded'},_0x4b7bac=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x2e71d7[_0x19a8c2(0x1cb)],'headers':{'Content-Type':_0x2e71d7[_0x19a8c2(0x204)]},'body':new URLSearchParams({'client_id':_0x464ad3})});if(!_0x4b7bac['ok']){const _0x46c87a=await _0x4b7bac['text']();throw new Error(_0x19a8c2(0x1d8)+_0x4b7bac['status']+'\x20'+_0x46c87a);}return _0x4b7bac[_0x19a8c2(0x1df)]();}export async function pollForTokens(_0x4e1904,_0xfcd7dd,_0x98c61e,_0x3962b6){const _0x509cff=_0x3073,_0x1b6968={'nlNtW':function(_0x16f583,_0x52d81b){return _0x16f583+_0x52d81b;},'PDkhv':function(_0x4793c7,_0x560ad0){return _0x4793c7<_0x560ad0;},'yjaNh':function(_0x5ed402,_0x179ee4){return _0x5ed402(_0x179ee4);},'LrKHW':_0x509cff(0x1bd),'ldWpv':'authorization_pending','uVxdA':function(_0x2a6fcc,_0x4e52bb){return _0x2a6fcc===_0x4e52bb;},'IOSvU':'slow_down','vWksx':_0x509cff(0x1bf),'KounT':'Device\x20authorization\x20timed\x20out'},_0x52b181=_0x1b6968['nlNtW'](Date[_0x509cff(0x1f1)](),_0x3962b6*0x3e8);let _0x4cbdf1=_0x98c61e*0x3e8;while(_0x1b6968[_0x509cff(0x1da)](Date['now'](),_0x52b181)){await _0x1b6968['yjaNh'](sleep,_0x4cbdf1);const _0x4cb9de=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x1b6968['LrKHW']},'body':new URLSearchParams({'client_id':_0x4e1904,'device_code':_0xfcd7dd,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x4cb9de['ok'])return _0x4cb9de[_0x509cff(0x1df)]();const _0x4c5834=await _0x4cb9de[_0x509cff(0x1df)]();if(_0x4c5834['error']===_0x1b6968['ldWpv'])continue;if(_0x1b6968[_0x509cff(0x1d0)](_0x4c5834[_0x509cff(0x200)],_0x1b6968['IOSvU'])){_0x4cbdf1+=0x3e8;continue;}throw new Error(_0x4c5834[_0x509cff(0x1e2)]||_0x4c5834[_0x509cff(0x200)]||_0x1b6968[_0x509cff(0x20f)]);}throw new Error(_0x1b6968[_0x509cff(0x1bc)]);}async function fetchUserProfile(_0x53d1e4){const _0x5bf3ef=_0x3073,_0x526f67={'BSLMX':function(_0x2a328d){return _0x2a328d();},'jqdYv':function(_0x67858e,_0x408c4b,_0x23c08a){return _0x67858e(_0x408c4b,_0x23c08a);},'bVQrb':'GET'},_0x25a7ee=_0x526f67['BSLMX'](getApiBaseUrl);try{const _0x583295=await _0x526f67[_0x5bf3ef(0x1ee)](fetch,_0x25a7ee+'/organization/me',{'method':_0x526f67['bVQrb'],'headers':{'workos-token':_0x53d1e4}});if(_0x583295['ok'])return _0x583295[_0x5bf3ef(0x1df)]();}catch{}return null;}function buildKeyName(_0x4babf0,_0x510c33){const _0x5a0e14=_0x3073,_0x451bd5={'FaGqk':function(_0x4d38a8,_0x594e52){return _0x4d38a8===_0x594e52;},'nUOdx':function(_0x1b4fa7,_0x253c90){return _0x1b4fa7+_0x253c90;}},_0x51ca26=_0x510c33[_0x5a0e14(0x201)](_0x1499d3=>_0x1499d3[_0x5a0e14(0x1c8)]===_0x4babf0||_0x1499d3['name'][_0x5a0e14(0x1e7)](_0x4babf0+'\x20('));if(_0x451bd5[_0x5a0e14(0x1d5)](_0x51ca26['length'],0x0))return _0x4babf0;return _0x4babf0+'\x20('+_0x451bd5[_0x5a0e14(0x1d2)](_0x51ca26[_0x5a0e14(0x1c0)],0x1)+')';}export async function provisionApiKey(_0x54b47d){const _0x2d23a2=_0x3073,_0x1577d6={'xTnFn':function(_0x59e125,_0x5ef56b,_0x38abf4){return _0x59e125(_0x5ef56b,_0x38abf4);},'Mgbzq':'GET','QCtfD':function(_0x309b5f,_0x5c49d8,_0x261563){return _0x309b5f(_0x5c49d8,_0x261563);},'vAoWU':'POST'},_0x4ff00c=getApiBaseUrl(),_0x13b5ba={'Content-Type':'application/json','workos-token':_0x54b47d},_0x2a552f=await fetchUserProfile(_0x54b47d),_0x10c241=_0x2a552f?.[_0x2d23a2(0x1dd)]||_0x2a552f?.[_0x2d23a2(0x20c)]?.[_0x2d23a2(0x1c3)]('@')[0x0],_0x3f7f41=_0x10c241?_0x10c241+'\x27s\x20CLI\x20Key':'CLI\x20Key';let _0x3875e2=[];try{const _0x5a6fcf=await _0x1577d6[_0x2d23a2(0x1e9)](fetch,_0x4ff00c+_0x2d23a2(0x1c5),{'method':_0x1577d6['Mgbzq'],'headers':_0x13b5ba});if(_0x5a6fcf['ok']){const _0x1de3ee=await _0x5a6fcf[_0x2d23a2(0x1df)]();_0x3875e2=_0x1de3ee['apiKeys'];}}catch{}const _0x47c0a4=buildKeyName(_0x3f7f41,_0x3875e2),_0x357d4f=await _0x1577d6['QCtfD'](fetch,_0x4ff00c+'/api-keys',{'method':_0x1577d6['vAoWU'],'headers':_0x13b5ba,'body':JSON['stringify']({'name':_0x47c0a4,'scope':'mcp:write'})});if(!_0x357d4f['ok']){const _0x24518c=await _0x357d4f['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x357d4f['status']+'\x20'+_0x24518c);}const _0x5bd19c=await _0x357d4f[_0x2d23a2(0x1df)]();return _0x5bd19c['apiKey'][_0x2d23a2(0x1de)];}export function openBrowser(_0x47763b){const _0x591ed2=_0x3073,_0x502499={'MyFYF':function(_0x8e2f1c,_0x4e0682){return _0x8e2f1c===_0x4e0682;},'vWSyR':'win32','DzWol':function(_0x27a8db,_0x225dae,_0x1c926e,_0x9eb08d){return _0x27a8db(_0x225dae,_0x1c926e,_0x9eb08d);},'knoWS':'cmd','XYelx':_0x591ed2(0x1ef),'zJujk':function(_0x1fcb9d,_0x3af1dc){return _0x1fcb9d===_0x3af1dc;},'OkKuh':'darwin','NnRzs':_0x591ed2(0x1c1),'Sonrb':function(_0x4432d0,_0xd3065f,_0x53bd81,_0x2ac095){return _0x4432d0(_0xd3065f,_0x53bd81,_0x2ac095);},'ZbHYk':_0x591ed2(0x1f0)};try{if(_0x502499[_0x591ed2(0x1bb)](process[_0x591ed2(0x212)],_0x502499['vWSyR'])){const _0x45e507=_0x502499[_0x591ed2(0x1d1)](spawn,_0x502499[_0x591ed2(0x1d3)],['/c',_0x502499['XYelx'],'',_0x47763b],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0x45e507[_0x591ed2(0x1be)]();return;}const _0xbf57d2=_0x502499[_0x591ed2(0x1ba)](process[_0x591ed2(0x212)],_0x502499[_0x591ed2(0x1c6)])?_0x591ed2(0x208):_0x502499[_0x591ed2(0x1e4)],_0x4975f7=_0x502499[_0x591ed2(0x203)](spawn,_0xbf57d2,[_0x47763b],{'detached':!![],'stdio':_0x502499['ZbHYk']});_0x4975f7[_0x591ed2(0x1be)]();}catch{}}function decodeJwtPayload(_0x337205){const _0x30b18a=_0x3073,_0x5c889e={'RPHhB':'utf-8'},_0x2c1131=_0x337205[_0x30b18a(0x1c3)]('.');if(_0x2c1131[_0x30b18a(0x1c0)]!==0x3)throw new Error(_0x30b18a(0x1ea));const _0x479f72=Buffer[_0x30b18a(0x213)](_0x2c1131[0x1],_0x30b18a(0x1f9))['toString'](_0x5c889e[_0x30b18a(0x1ca)]);return JSON['parse'](_0x479f72);}async function selfServeSignup(_0x50a024){const _0x31646e=_0x3073,_0x597d23={'esHcy':function(_0x44681a,_0x2bfcb3,_0x4266e9){return _0x44681a(_0x2bfcb3,_0x4266e9);}},_0x138df5=getApiBaseUrl(),_0x3413ff=await _0x597d23['esHcy'](fetch,_0x138df5+_0x31646e(0x1fc),{'method':'POST','headers':{'Content-Type':_0x31646e(0x1ec),'workos-token':_0x50a024}});if(!_0x3413ff['ok']){const _0x28c31e=await _0x3413ff['text']();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0x3413ff[_0x31646e(0x1eb)]+'\x20'+_0x28c31e);}return _0x3413ff[_0x31646e(0x1df)]();}async function fetchMyMemberships(_0x100841){const _0x2b2d8f=_0x3073,_0x2cf071={'miZEz':function(_0x1b54d2,_0x2fc8aa,_0x302ca5){return _0x1b54d2(_0x2fc8aa,_0x302ca5);},'SCzAl':_0x2b2d8f(0x1f5)},_0xa86d7=getApiBaseUrl(),_0x28e13c=await _0x2cf071[_0x2b2d8f(0x202)](fetch,_0xa86d7+'/organization/my-memberships',{'method':_0x2cf071['SCzAl'],'headers':{'workos-token':_0x100841}});if(!_0x28e13c['ok']){const _0x5e7f36=await _0x28e13c[_0x2b2d8f(0x20e)]();throw new Error(_0x2b2d8f(0x1f7)+_0x28e13c[_0x2b2d8f(0x1eb)]+'\x20'+_0x5e7f36);}const _0x47e58f=await _0x28e13c[_0x2b2d8f(0x1df)]();return _0x47e58f[_0x2b2d8f(0x1ed)];}async function refreshTokenWithOrg(_0x21e954,_0x2aff13,_0x1cc25c){const _0x362957=_0x3073,_0x4c9c09={'XffkZ':function(_0x32140e,_0x353418,_0x40e162){return _0x32140e(_0x353418,_0x40e162);},'opOVy':_0x362957(0x1bd),'iGwes':_0x362957(0x210)},_0x50bd93=await _0x4c9c09['XffkZ'](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x4c9c09['opOVy']},'body':new URLSearchParams({'client_id':_0x21e954,'grant_type':_0x4c9c09['iGwes'],'refresh_token':_0x2aff13,'organization_id':_0x1cc25c})});if(!_0x50bd93['ok']){const _0x3d8eee=await _0x50bd93[_0x362957(0x20e)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x50bd93['status']+'\x20'+_0x3d8eee);}return _0x50bd93[_0x362957(0x1df)]();}function _0x3073(_0x10b433,_0x68ff86){_0x10b433=_0x10b433-0x1ba;const _0x397aa8=_0x397a();let _0x3073a2=_0x397aa8[_0x10b433];return _0x3073a2;}async function provisionCliToken(_0x2a8bfa){const _0x1cfa99=_0x3073,_0x319d5c={'xHahA':function(_0x20f250){return _0x20f250();},'yKbYU':function(_0x4de1a8,_0x39b2bc,_0x2a8ae3){return _0x4de1a8(_0x39b2bc,_0x2a8ae3);},'QslWG':_0x1cfa99(0x214),'WAoTf':_0x1cfa99(0x1ec)},_0x6758=_0x319d5c['xHahA'](getApiBaseUrl),_0x3475c3=await _0x319d5c[_0x1cfa99(0x1d9)](fetch,_0x6758+'/cli-auth/token',{'method':_0x319d5c['QslWG'],'headers':{'Content-Type':_0x319d5c['WAoTf'],'workos-token':_0x2a8bfa}});if(!_0x3475c3['ok']){const _0x5cb047=await _0x3475c3[_0x1cfa99(0x20e)]();throw new Error(_0x1cfa99(0x1ff)+_0x3475c3['status']+'\x20'+_0x5cb047);}return _0x3475c3[_0x1cfa99(0x1df)]();}export async function runDeviceAuthFlow(){const _0x3130d6=_0x3073,_0x5211df={'wBXgh':function(_0x4c4b61){return _0x4c4b61();},'fNjOu':function(_0x524d77,_0x283e13){return _0x524d77(_0x283e13);},'ZdTMi':_0x3130d6(0x1f3),'SkvBw':function(_0x1b7c50,_0xc87001){return _0x1b7c50(_0xc87001);},'iyIBN':_0x3130d6(0x207),'vSUwJ':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','auUTZ':_0x3130d6(0x1d4),'nXpff':function(_0xeccfbe,_0xc122eb,_0x551fd8,_0x4b7af9){return _0xeccfbe(_0xc122eb,_0x551fd8,_0x4b7af9);},'EMRxb':'Provisioning\x20CLI\x20token...'},_0xaec1a3=_0x5211df['wBXgh'](getCurrentEnvironment),_0x33e6d7=ENVIRONMENT_CONFIGS[_0xaec1a3][_0x3130d6(0x1f8)],_0x2d48b5=await _0x5211df[_0x3130d6(0x1ce)](requestDeviceCode,_0x33e6d7);console['log'](_0x5211df['ZdTMi']),console[_0x3130d6(0x1d6)](_0x3130d6(0x1f2)),_0x5211df[_0x3130d6(0x1e0)](openBrowser,_0x2d48b5[_0x3130d6(0x1e6)]),console[_0x3130d6(0x1d6)]('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x2d48b5[_0x3130d6(0x1e6)]),console[_0x3130d6(0x1d6)](_0x3130d6(0x1e8)+_0x2d48b5['user_code']+'\x0a'),process['stdout'][_0x3130d6(0x1f6)]('Waiting\x20for\x20authentication...');let _0x79c713=await pollForTokens(_0x33e6d7,_0x2d48b5[_0x3130d6(0x1e5)],_0x2d48b5[_0x3130d6(0x206)],_0x2d48b5[_0x3130d6(0x1db)]);console[_0x3130d6(0x1d6)]('\x20✓');const _0x45fff1=decodeJwtPayload(_0x79c713[_0x3130d6(0x209)]);if(!_0x45fff1[_0x3130d6(0x1c4)]){const _0x50e3ad=await fetchMyMemberships(_0x79c713[_0x3130d6(0x209)]);let _0x2da1d6;if(_0x50e3ad[_0x3130d6(0x1c0)]===0x0){process['stdout'][_0x3130d6(0x1f6)](_0x3130d6(0x1e1));const _0x11d6f8=await _0x5211df[_0x3130d6(0x1e0)](selfServeSignup,_0x79c713[_0x3130d6(0x209)]);_0x2da1d6=_0x11d6f8[_0x3130d6(0x20a)],console[_0x3130d6(0x1d6)]('\x20✓');}else{if(_0x50e3ad['length']===0x1)_0x2da1d6=_0x50e3ad[0x0][_0x3130d6(0x20a)],console[_0x3130d6(0x1d6)](_0x3130d6(0x1cf)+_0x50e3ad[0x0]['name']);else{const _0x36397e=process['stdin'][_0x3130d6(0x1f4)]&&process[_0x3130d6(0x1fa)]['isTTY'];if(!_0x36397e)throw new Error(_0x5211df['iyIBN']+_0x5211df[_0x3130d6(0x20b)]);const {selected:_0x3872c4}=await _0x44a19d['prompt']([{'type':_0x3130d6(0x1c9),'name':_0x5211df['auUTZ'],'message':_0x3130d6(0x205),'choices':_0x50e3ad[_0x3130d6(0x1c7)](_0xcbbcc2=>({'name':_0xcbbcc2['name'],'value':_0xcbbcc2[_0x3130d6(0x20a)]}))}]);_0x2da1d6=_0x3872c4;}}_0x79c713=await _0x5211df['nXpff'](refreshTokenWithOrg,_0x33e6d7,_0x79c713['refresh_token'],_0x2da1d6);}process[_0x3130d6(0x1fa)][_0x3130d6(0x1f6)](_0x5211df[_0x3130d6(0x20d)]);const _0x3ebcb8=await provisionCliToken(_0x79c713['access_token']);return console['log']('\x20✓'),await _0x5211df['fNjOu'](storeToken,_0x3ebcb8['token']),_0x79c713['refresh_token']&&await storeRefreshToken(_0x79c713['refresh_token']),_0x3ebcb8['token'];}function sleep(_0x6b1c1){return new Promise(_0x5d1232=>setTimeout(_0x5d1232,_0x6b1c1));}
1
+ const _0x3e883b=_0x4d9b;(function(_0x2fcfcc,_0xef7f6f){const _0x343fdc=_0x4d9b,_0x31bc9a=_0x2fcfcc();while(!![]){try{const _0x35728b=parseInt(_0x343fdc(0x11e))/0x1*(-parseInt(_0x343fdc(0x117))/0x2)+parseInt(_0x343fdc(0x135))/0x3*(parseInt(_0x343fdc(0x14c))/0x4)+-parseInt(_0x343fdc(0x139))/0x5+parseInt(_0x343fdc(0x122))/0x6*(parseInt(_0x343fdc(0x128))/0x7)+-parseInt(_0x343fdc(0x161))/0x8*(-parseInt(_0x343fdc(0x147))/0x9)+-parseInt(_0x343fdc(0x158))/0xa*(-parseInt(_0x343fdc(0x151))/0xb)+parseInt(_0x343fdc(0x146))/0xc;if(_0x35728b===_0xef7f6f)break;else _0x31bc9a['push'](_0x31bc9a['shift']());}catch(_0x50e9de){_0x31bc9a['push'](_0x31bc9a['shift']());}}}(_0x54c7,0xa9718));function _0x54c7(){const _0x3c3303=['18uJsToJ','Failed\x20to\x20provision\x20API\x20key:\x20','Device\x20authorization\x20timed\x20out','status','4754650qpiGzI','write','FNjar','PdCYA','nEkoU','access_token','GxZyb','jPPAD','unref','stringify','Authentication\x20failed','stdout','split','8564592Xzdwpw','9VjMKTK','YryKR','text','https://api.workos.com/user_management/authenticate','POST','328056OEzele','apiKeys','token','length','xdg-open','8888374MKkeqg','/organization/me','Invalid\x20JWT\x20format','application/x-www-form-urlencoded','Using\x20organization:\x20','open','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','10YXNEwV','workosClientId','mcp:write','device_code','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','tEdbM','application/json','nfLJT','HbwqJ','1114032iGVSih','GET','org_id','Failed\x20to\x20fetch\x20memberships:\x20','log','Failed\x20to\x20provision\x20CLI\x20token:\x20','apiKey','aNCsO','WPrwg','json','Failed\x20to\x20create\x20organization:\x20','verification_uri_complete','utf-8','10TaEvfc','ieiES','from','now','authorization_pending','XKmYI','name','212945bSaFbT','zvHva','refresh_token','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','3339642jHlkuw','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','Failed\x20to\x20request\x20device\x20code:\x20','gAMUj','/cli-auth/token','tgtgW','7srbQhi','NmylB','organizationId','XeKnv','map','/organization/self-serve-signup','Setting\x20up\x20your\x20organization...','startsWith','gZbWT','/api-keys','error','NQHcV','isTTY'];_0x54c7=function(){return _0x3c3303;};return _0x54c7();}import{spawn}from'child_process';import _0x1c0726 from'inquirer';function _0x4d9b(_0x508377,_0x1da5bb){_0x508377=_0x508377-0x111;const _0x54c7ee=_0x54c7();let _0x4d9bb6=_0x54c7ee[_0x508377];return _0x4d9bb6;}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=_0x3e883b(0x14a);export async function requestDeviceCode(_0x3d2b19){const _0x57877c=_0x3e883b,_0x597748={'SiQrU':function(_0x42c20f,_0x27f42e,_0x57588b){return _0x42c20f(_0x27f42e,_0x57588b);}},_0x4ef4bd=await _0x597748['SiQrU'](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x57877c(0x14b),'headers':{'Content-Type':_0x57877c(0x154)},'body':new URLSearchParams({'client_id':_0x3d2b19})});if(!_0x4ef4bd['ok']){const _0x26d357=await _0x4ef4bd['text']();throw new Error(_0x57877c(0x124)+_0x4ef4bd['status']+'\x20'+_0x26d357);}return _0x4ef4bd[_0x57877c(0x113)]();}export async function pollForTokens(_0x5b3bdd,_0xeb639,_0x3e7eba,_0x2f55e3){const _0x34dc49=_0x3e883b,_0x1f52ff={'svUmA':function(_0x442efe,_0x442442){return _0x442efe+_0x442442;},'nEkoU':function(_0x4e3049,_0x365c35){return _0x4e3049*_0x365c35;},'NQHcV':function(_0x35daf9,_0x133ee9){return _0x35daf9<_0x133ee9;},'GxZyb':function(_0x32fd2d,_0x15dc98){return _0x32fd2d(_0x15dc98);},'mAuZZ':function(_0x5f2be4,_0x4a6639,_0x183101){return _0x5f2be4(_0x4a6639,_0x183101);},'tgtgW':_0x34dc49(0x154),'lKwGv':'slow_down','SMOYc':_0x34dc49(0x143)},_0x4fb564=_0x1f52ff['svUmA'](Date[_0x34dc49(0x11a)](),_0x1f52ff[_0x34dc49(0x13d)](_0x2f55e3,0x3e8));let _0x497d7b=_0x3e7eba*0x3e8;while(_0x1f52ff[_0x34dc49(0x133)](Date['now'](),_0x4fb564)){await _0x1f52ff[_0x34dc49(0x13f)](sleep,_0x497d7b);const _0x10b88d=await _0x1f52ff['mAuZZ'](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x1f52ff[_0x34dc49(0x127)]},'body':new URLSearchParams({'client_id':_0x5b3bdd,'device_code':_0xeb639,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x10b88d['ok'])return _0x10b88d[_0x34dc49(0x113)]();const _0x1907e9=await _0x10b88d[_0x34dc49(0x113)]();if(_0x1907e9[_0x34dc49(0x132)]===_0x34dc49(0x11b))continue;if(_0x1907e9[_0x34dc49(0x132)]===_0x1f52ff['lKwGv']){_0x497d7b+=0x3e8;continue;}throw new Error(_0x1907e9['error_description']||_0x1907e9['error']||_0x1f52ff['SMOYc']);}throw new Error(_0x34dc49(0x137));}async function fetchUserProfile(_0x44b4a5){const _0x29d198=_0x3e883b,_0x5e2459={'tEdbM':function(_0x51aec9,_0x2e0340,_0x59b91f){return _0x51aec9(_0x2e0340,_0x59b91f);}},_0x5776b6=getApiBaseUrl();try{const _0x12a660=await _0x5e2459[_0x29d198(0x15d)](fetch,_0x5776b6+_0x29d198(0x152),{'method':_0x29d198(0x162),'headers':{'workos-token':_0x44b4a5}});if(_0x12a660['ok'])return _0x12a660['json']();}catch{}return null;}function buildKeyName(_0x25140d,_0x43d39a){const _0x8e2481=_0x3e883b,_0x18f79d={'chdhi':function(_0x30252d,_0x48b092){return _0x30252d===_0x48b092;}},_0x4cfafb=_0x43d39a['filter'](_0x363a1d=>_0x363a1d['name']===_0x25140d||_0x363a1d['name'][_0x8e2481(0x12f)](_0x25140d+'\x20('));if(_0x18f79d['chdhi'](_0x4cfafb[_0x8e2481(0x14f)],0x0))return _0x25140d;return _0x25140d+'\x20('+(_0x4cfafb[_0x8e2481(0x14f)]+0x1)+')';}export async function provisionApiKey(_0x366b88){const _0x539f43=_0x3e883b,_0x4dea1e={'hhixi':function(_0x5bc940){return _0x5bc940();},'AWSbw':function(_0x151c0e,_0x1bb7aa,_0x4b2277){return _0x151c0e(_0x1bb7aa,_0x4b2277);},'aNCsO':_0x539f43(0x162),'wajYC':function(_0x5d3720,_0x59351e,_0x348936){return _0x5d3720(_0x59351e,_0x348936);},'QzLCc':_0x539f43(0x15a)},_0x2716ab=_0x4dea1e['hhixi'](getApiBaseUrl),_0x5bc099={'Content-Type':'application/json','workos-token':_0x366b88},_0x1fdf0a=await fetchUserProfile(_0x366b88),_0x4a8208=_0x1fdf0a?.['firstName']||_0x1fdf0a?.['email']?.['split']('@')[0x0],_0x4a6651=_0x4a8208?_0x4a8208+'\x27s\x20CLI\x20Key':'CLI\x20Key';let _0x3d8a70=[];try{const _0x4edc4f=await _0x4dea1e['AWSbw'](fetch,_0x2716ab+_0x539f43(0x131),{'method':_0x4dea1e[_0x539f43(0x111)],'headers':_0x5bc099});if(_0x4edc4f['ok']){const _0x455a54=await _0x4edc4f[_0x539f43(0x113)]();_0x3d8a70=_0x455a54[_0x539f43(0x14d)];}}catch{}const _0xd4d4b1=_0x4dea1e['wajYC'](buildKeyName,_0x4a6651,_0x3d8a70),_0x311a64=await fetch(_0x2716ab+'/api-keys',{'method':'POST','headers':_0x5bc099,'body':JSON[_0x539f43(0x142)]({'name':_0xd4d4b1,'scope':_0x4dea1e['QzLCc']})});if(!_0x311a64['ok']){const _0x22fd76=await _0x311a64[_0x539f43(0x149)]();throw new Error(_0x539f43(0x136)+_0x311a64[_0x539f43(0x138)]+'\x20'+_0x22fd76);}const _0x1e70b1=await _0x311a64['json']();return _0x1e70b1[_0x539f43(0x167)][_0x539f43(0x14e)];}export function openBrowser(_0x2f2b82){const _0x4582b7=_0x3e883b,_0x5caaba={'oAwDY':function(_0x2a1564,_0x11b7df){return _0x2a1564===_0x11b7df;},'nfLJT':function(_0x15ab8a,_0x503857,_0x588291,_0x46506b){return _0x15ab8a(_0x503857,_0x588291,_0x46506b);},'ZkKDt':_0x4582b7(0x156),'XhaVb':'ignore'};try{if(_0x5caaba['oAwDY'](process['platform'],'win32')){const _0x701100=_0x5caaba[_0x4582b7(0x15f)](spawn,'cmd',['/c','start','',_0x2f2b82],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0x701100[_0x4582b7(0x141)]();return;}const _0x46c5c2=process['platform']==='darwin'?_0x5caaba['ZkKDt']:_0x4582b7(0x150),_0x35ec31=spawn(_0x46c5c2,[_0x2f2b82],{'detached':!![],'stdio':_0x5caaba['XhaVb']});_0x35ec31['unref']();}catch{}}function decodeJwtPayload(_0x14a7e6){const _0x2a6261=_0x3e883b,_0x207d42={'FNjar':function(_0x2fd128,_0x1cc9c5){return _0x2fd128!==_0x1cc9c5;},'HnNku':_0x2a6261(0x153)},_0x5131f3=_0x14a7e6[_0x2a6261(0x145)]('.');if(_0x207d42[_0x2a6261(0x13b)](_0x5131f3[_0x2a6261(0x14f)],0x3))throw new Error(_0x207d42['HnNku']);const _0x4235ec=Buffer[_0x2a6261(0x119)](_0x5131f3[0x1],'base64url')['toString'](_0x2a6261(0x116));return JSON['parse'](_0x4235ec);}async function selfServeSignup(_0x4c6052){const _0x490c83=_0x3e883b,_0x48114b={'ieiES':_0x490c83(0x14b)},_0x5611b2=getApiBaseUrl(),_0x15de62=await fetch(_0x5611b2+_0x490c83(0x12d),{'method':_0x48114b[_0x490c83(0x118)],'headers':{'Content-Type':'application/json','workos-token':_0x4c6052}});if(!_0x15de62['ok']){const _0x28306b=await _0x15de62[_0x490c83(0x149)]();throw new Error(_0x490c83(0x114)+_0x15de62['status']+'\x20'+_0x28306b);}return _0x15de62[_0x490c83(0x113)]();}async function fetchMyMemberships(_0xaff331){const _0x142b0d=_0x3e883b,_0x3b927b={'YryKR':function(_0x4683bd){return _0x4683bd();}},_0x5156ed=_0x3b927b[_0x142b0d(0x148)](getApiBaseUrl),_0x4017fc=await fetch(_0x5156ed+'/organization/my-memberships',{'method':_0x142b0d(0x162),'headers':{'workos-token':_0xaff331}});if(!_0x4017fc['ok']){const _0x3b1f1f=await _0x4017fc['text']();throw new Error(_0x142b0d(0x164)+_0x4017fc[_0x142b0d(0x138)]+'\x20'+_0x3b1f1f);}const _0x43da63=await _0x4017fc[_0x142b0d(0x113)]();return _0x43da63['memberships'];}async function refreshTokenWithOrg(_0x55ee94,_0x3e8186,_0x2a9ae9){const _0x2d4d98=_0x3e883b,_0x3fa895={'MiPcD':function(_0x292fba,_0x3956d7,_0xff2c68){return _0x292fba(_0x3956d7,_0xff2c68);},'HbwqJ':_0x2d4d98(0x14b),'KeHvW':_0x2d4d98(0x120)},_0x154b63=await _0x3fa895['MiPcD'](fetch,WORKOS_TOKEN_URL,{'method':_0x3fa895[_0x2d4d98(0x160)],'headers':{'Content-Type':_0x2d4d98(0x154)},'body':new URLSearchParams({'client_id':_0x55ee94,'grant_type':_0x3fa895['KeHvW'],'refresh_token':_0x3e8186,'organization_id':_0x2a9ae9})});if(!_0x154b63['ok']){const _0x374eb7=await _0x154b63['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x154b63['status']+'\x20'+_0x374eb7);}return _0x154b63['json']();}async function provisionCliToken(_0x1e0e8f){const _0x4b20b4=_0x3e883b,_0x24e1a0={'DocEc':function(_0x3071d0){return _0x3071d0();},'XeKnv':function(_0x15698a,_0x3b0889,_0x503237){return _0x15698a(_0x3b0889,_0x503237);},'NmylB':_0x4b20b4(0x14b)},_0x4ff185=_0x24e1a0['DocEc'](getApiBaseUrl),_0x5c5ea9=await _0x24e1a0[_0x4b20b4(0x12b)](fetch,_0x4ff185+_0x4b20b4(0x126),{'method':_0x24e1a0[_0x4b20b4(0x129)],'headers':{'Content-Type':_0x4b20b4(0x15e),'workos-token':_0x1e0e8f}});if(!_0x5c5ea9['ok']){const _0x216ff4=await _0x5c5ea9['text']();throw new Error(_0x4b20b4(0x166)+_0x5c5ea9[_0x4b20b4(0x138)]+'\x20'+_0x216ff4);}return _0x5c5ea9[_0x4b20b4(0x113)]();}export async function runDeviceAuthFlow(){const _0x162383=_0x3e883b,_0x1145cb={'WPrwg':_0x162383(0x121),'PdCYA':'Waiting\x20for\x20authentication...','IXPeO':function(_0x5db029,_0x261730,_0x494fdb,_0x4d61d1,_0x9205a5){return _0x5db029(_0x261730,_0x494fdb,_0x4d61d1,_0x9205a5);},'jPPAD':function(_0x435db5,_0x5ad776){return _0x435db5===_0x5ad776;},'gAMUj':_0x162383(0x12e),'foSnG':function(_0xe032d,_0x353756){return _0xe032d(_0x353756);},'wLasH':'list','gZbWT':'selected','jYEms':'Select\x20an\x20organization:','zvHva':'Provisioning\x20CLI\x20token...','XKmYI':function(_0x540b31,_0x2a4bb4){return _0x540b31(_0x2a4bb4);}},_0x481b6d=getCurrentEnvironment(),_0x1f1920=ENVIRONMENT_CONFIGS[_0x481b6d][_0x162383(0x159)],_0x52a5ec=await requestDeviceCode(_0x1f1920);console['log'](_0x162383(0x157)),console[_0x162383(0x165)](_0x1145cb[_0x162383(0x112)]),openBrowser(_0x52a5ec[_0x162383(0x115)]),console['log'](_0x162383(0x123)+_0x52a5ec['verification_uri_complete']),console[_0x162383(0x165)]('Code:\x20'+_0x52a5ec['user_code']+'\x0a'),process['stdout']['write'](_0x1145cb[_0x162383(0x13c)]);let _0x42a76e=await _0x1145cb['IXPeO'](pollForTokens,_0x1f1920,_0x52a5ec[_0x162383(0x15b)],_0x52a5ec['interval'],_0x52a5ec['expires_in']);console[_0x162383(0x165)]('\x20✓');const _0x5880e5=decodeJwtPayload(_0x42a76e[_0x162383(0x13e)]);if(!_0x5880e5[_0x162383(0x163)]){const _0x292803=await fetchMyMemberships(_0x42a76e['access_token']);let _0x32aeea;if(_0x1145cb['jPPAD'](_0x292803[_0x162383(0x14f)],0x0)){process['stdout'][_0x162383(0x13a)](_0x1145cb[_0x162383(0x125)]);const _0x1c3159=await _0x1145cb['foSnG'](selfServeSignup,_0x42a76e['access_token']);_0x32aeea=_0x1c3159[_0x162383(0x12a)],console['log']('\x20✓');}else{if(_0x1145cb[_0x162383(0x140)](_0x292803['length'],0x1))_0x32aeea=_0x292803[0x0]['organizationId'],console[_0x162383(0x165)](_0x162383(0x155)+_0x292803[0x0][_0x162383(0x11d)]);else{const _0x3f2117=process['stdin'][_0x162383(0x134)]&&process[_0x162383(0x144)][_0x162383(0x134)];if(!_0x3f2117)throw new Error(_0x162383(0x15c)+'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.');const {selected:_0x4e5cb5}=await _0x1c0726['prompt']([{'type':_0x1145cb['wLasH'],'name':_0x1145cb[_0x162383(0x130)],'message':_0x1145cb['jYEms'],'choices':_0x292803[_0x162383(0x12c)](_0x4c0f52=>({'name':_0x4c0f52['name'],'value':_0x4c0f52[_0x162383(0x12a)]}))}]);_0x32aeea=_0x4e5cb5;}}_0x42a76e=await refreshTokenWithOrg(_0x1f1920,_0x42a76e[_0x162383(0x120)],_0x32aeea);}process['stdout'][_0x162383(0x13a)](_0x1145cb[_0x162383(0x11f)]);const _0x27d1ec=await provisionCliToken(_0x42a76e['access_token']);return console[_0x162383(0x165)]('\x20✓'),await _0x1145cb[_0x162383(0x11c)](storeToken,_0x27d1ec[_0x162383(0x14e)]),_0x42a76e['refresh_token']&&await storeRefreshToken(_0x42a76e[_0x162383(0x120)]),_0x27d1ec[_0x162383(0x14e)];}function sleep(_0x4b6fbd){return new Promise(_0x12c038=>setTimeout(_0x12c038,_0x4b6fbd));}
@@ -1 +1 @@
1
- const _0x4e4d91=_0x5224;(function(_0x2706f5,_0x110c07){const _0x3b6c67=_0x5224,_0x45ec3b=_0x2706f5();while(!![]){try{const _0x3c7bac=parseInt(_0x3b6c67(0xe2))/0x1+parseInt(_0x3b6c67(0xd9))/0x2+-parseInt(_0x3b6c67(0xd1))/0x3*(-parseInt(_0x3b6c67(0xd0))/0x4)+-parseInt(_0x3b6c67(0xdc))/0x5*(parseInt(_0x3b6c67(0xce))/0x6)+-parseInt(_0x3b6c67(0xd5))/0x7+parseInt(_0x3b6c67(0xd2))/0x8+-parseInt(_0x3b6c67(0xd6))/0x9;if(_0x3c7bac===_0x110c07)break;else _0x45ec3b['push'](_0x45ec3b['shift']());}catch(_0x23fab1){_0x45ec3b['push'](_0x45ec3b['shift']());}}}(_0x359d,0xcd181));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':'client_01J9CBYM7M5ZETCF7G6614DXR2','aiProxyUrl':'https://ai-proxy-716115358910.us-central1.run.app','mcpAuthUrl':_0x4e4d91(0xd3)},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':_0x4e4d91(0xeb),'mcpAuthUrl':'https://mcp-auth.staging.ranger.net/mcp'},'local':{'apiBaseUrl':_0x4e4d91(0xdd),'workosClientId':_0x4e4d91(0xe6),'aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT='prod';export function isValidEnvironment(_0x545e14){return _0x545e14==='prod'||_0x545e14==='staging'||_0x545e14==='local';}export function getCurrentEnvironment(){const _0x107d48=_0x4e4d91,_0x236431=process[_0x107d48(0xcd)][_0x107d48(0xd7)];if(_0x236431&&isValidEnvironment(_0x236431))return _0x236431;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x32b22d=_0x4e4d91;return ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x32b22d(0xee)];}export function getAiProxyUrl(){const _0x5510c7=_0x4e4d91,_0x550aeb={'kROyP':function(_0x36289f){return _0x36289f();}};return ENVIRONMENT_CONFIGS[_0x550aeb[_0x5510c7(0xe5)](getCurrentEnvironment)][_0x5510c7(0xe8)];}export function getMcpAuthUrl(){const _0xa01fc3=_0x4e4d91,_0x4a57af={'EjTsn':function(_0x48785a){return _0x48785a();}};return process[_0xa01fc3(0xcd)][_0xa01fc3(0xe9)]??ENVIRONMENT_CONFIGS[_0x4a57af[_0xa01fc3(0xcf)](getCurrentEnvironment)]['mcpAuthUrl'];}function _0x359d(){const _0x43a382=['SiDcr','apiBaseUrl','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','env','6YSQyat','EjTsn','44rJBVRR','6441GUTAls','12891896mrjeWo','https://mcp-auth.ranger.net/mcp','RANGER_DISABLE_MCP','2557520GXrUJB','16354233QbKayF','RANGER_CLI_ENV','trim','3155548mnlJjR','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','off','3917810YAdMsJ','http://localhost:8080','nova-act-cli','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.','rHybA','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','593246MYVZhF','ZgfMH','cYgtV','kROyP','client_01J9CBYM2DKWV9HM17D95Z540K','mtBDk','aiProxyUrl','RANGER_MCP_AUTH_URL','rangerwright-cli','https://ai-proxy-301751771437.us-central1.run.app','RANGER_USE_NOVA_ACT'];_0x359d=function(){return _0x43a382;};return _0x359d();}function _0x5224(_0x11a574,_0x532359){_0x11a574=_0x11a574-0xcc;const _0x359dc9=_0x359d();let _0x522418=_0x359dc9[_0x11a574];return _0x522418;}export function isByokEnabled(){const _0x450f33=_0x4e4d91;return process[_0x450f33(0xcd)]['RANGER_BYOK']==='true';}function isVerificationTransport(_0x32f3e0){const _0x4ad8f0=_0x4e4d91,_0x4c6fa5={'cYgtV':function(_0x46cc6b,_0xc41e3a){return _0x46cc6b===_0xc41e3a;},'xqyfP':'playwright-cli','EnGMM':_0x4ad8f0(0xde),'rHybA':_0x4ad8f0(0xea)};return _0x4c6fa5[_0x4ad8f0(0xe4)](_0x32f3e0,'mcp')||_0x32f3e0===_0x4c6fa5['xqyfP']||_0x32f3e0===_0x4c6fa5['EnGMM']||_0x32f3e0===_0x4c6fa5[_0x4ad8f0(0xe0)];}const LEGACY_TRANSPORT_ENV_VARS=[_0x4e4d91(0xec),_0x4e4d91(0xd4)];export function getVerificationTransport(){const _0x1689be=_0x4e4d91,_0x164e30={'ZgfMH':function(_0x13572e,_0x32ecea){return _0x13572e(_0x32ecea);},'rfLBk':'mcp'},_0x295f70=process[_0x1689be(0xcd)]['RANGER_TRANSPORT']?.[_0x1689be(0xd8)]();if(_0x295f70){if(_0x164e30[_0x1689be(0xe3)](isVerificationTransport,_0x295f70))return _0x295f70;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x295f70+_0x1689be(0xcc));}const _0x7f0c37=LEGACY_TRANSPORT_ENV_VARS['find'](_0x51be06=>process[_0x1689be(0xcd)][_0x51be06]);if(_0x7f0c37)throw new Error(_0x7f0c37+_0x1689be(0xe1));return _0x164e30['rfLBk'];}export function resolveHookMode(_0x3ecb11=process[_0x4e4d91(0xcd)]){const _0x3a9876=_0x4e4d91,_0x19dcf9={'SiDcr':function(_0x59f4cb,_0x2b13a5){return _0x59f4cb===_0x2b13a5;},'mtBDk':_0x3a9876(0xdb),'mWtjB':function(_0x4dff83,_0x48073b){return _0x4dff83+_0x48073b;}},_0x3b3f28=_0x3ecb11['RANGER_HOOKS']?.[_0x3a9876(0xd8)]()['toLowerCase']();if(!_0x3b3f28)return'auto';if(_0x19dcf9[_0x3a9876(0xed)](_0x3b3f28,_0x19dcf9[_0x3a9876(0xe7)])||_0x19dcf9['SiDcr'](_0x3b3f28,'on')||_0x3b3f28==='auto')return _0x3b3f28;return console['error'](_0x19dcf9['mWtjB'](_0x3a9876(0xda)+_0x3ecb11['RANGER_HOOKS']+'\x22.\x20',_0x3a9876(0xdf))),'auto';}
1
+ const _0x48f2e4=_0x4125;(function(_0x3ec85a,_0xb9e1c4){const _0xe66679=_0x4125,_0x550840=_0x3ec85a();while(!![]){try{const _0x545539=-parseInt(_0xe66679(0x1a7))/0x1+parseInt(_0xe66679(0x1bb))/0x2+-parseInt(_0xe66679(0x1c8))/0x3+parseInt(_0xe66679(0x1b3))/0x4*(-parseInt(_0xe66679(0x1a8))/0x5)+-parseInt(_0xe66679(0x1af))/0x6*(parseInt(_0xe66679(0x1a3))/0x7)+-parseInt(_0xe66679(0x1bd))/0x8+parseInt(_0xe66679(0x1a5))/0x9*(parseInt(_0xe66679(0x1a4))/0xa);if(_0x545539===_0xb9e1c4)break;else _0x550840['push'](_0x550840['shift']());}catch(_0x2dc0d3){_0x550840['push'](_0x550840['shift']());}}}(_0x4030,0xe7fd1));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':_0x48f2e4(0x1b2),'aiProxyUrl':'https://ai-proxy-716115358910.us-central1.run.app','mcpAuthUrl':_0x48f2e4(0x1bc)},'staging':{'apiBaseUrl':_0x48f2e4(0x1b7),'workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':_0x48f2e4(0x1c7)},'local':{'apiBaseUrl':_0x48f2e4(0x1c2),'workosClientId':_0x48f2e4(0x1ba),'aiProxyUrl':'http://localhost:8090','mcpAuthUrl':_0x48f2e4(0x1c5)}};export const DEFAULT_ENVIRONMENT='prod';export function isValidEnvironment(_0x22809f){const _0x589a47=_0x48f2e4,_0x8c46c={'OdYke':function(_0x5a8c78,_0x5eb3bf){return _0x5a8c78===_0x5eb3bf;},'jgLeT':function(_0x4e5f2b,_0x1f868a){return _0x4e5f2b===_0x1f868a;},'aIkzE':_0x589a47(0x1a2)};return _0x8c46c[_0x589a47(0x1c1)](_0x22809f,_0x589a47(0x1c4))||_0x8c46c[_0x589a47(0x1be)](_0x22809f,_0x589a47(0x1a6))||_0x8c46c[_0x589a47(0x1be)](_0x22809f,_0x8c46c['aIkzE']);}export function getCurrentEnvironment(){const _0x2c2428=_0x48f2e4,_0x226515={'DOdif':function(_0x317f99,_0x5c7c1e){return _0x317f99(_0x5c7c1e);}},_0x5ba0b3=process[_0x2c2428(0x1b9)]['RANGER_CLI_ENV'];if(_0x5ba0b3&&_0x226515['DOdif'](isValidEnvironment,_0x5ba0b3))return _0x5ba0b3;return DEFAULT_ENVIRONMENT;}function _0x4030(){const _0x547dfe=['4819684idCylL','off','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','RANGER_USE_NOVA_ACT','https://api.staging.ranger.net','RANGER_HOOKS','env','client_01J9CBYM2DKWV9HM17D95Z540K','378696YccbvA','https://mcp-auth.ranger.net/mcp','7759120Ilpkxd','jgLeT','nova-act-cli','mcpAuthUrl','OdYke','http://localhost:8080','trim','prod','http://localhost:8080/mcp','PxFLW','https://mcp-auth.staging.ranger.net/mcp','1770726qwJHpG','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','local','546dtzrzp','10OfdnwK','43168932cVAeMr','staging','804568ZILUtS','5ESDiZO','PCEll','mcp','RANGER_BYOK','GufVO','\x22.\x20','auto','35850YLGnOe','RANGER_DISABLE_MCP','toLowerCase','client_01J9CBYM7M5ZETCF7G6614DXR2'];_0x4030=function(){return _0x547dfe;};return _0x4030();}export function getApiBaseUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['apiBaseUrl'];}export function getAiProxyUrl(){const _0x1f312b={'ykxrM':function(_0x560d39){return _0x560d39();}};return ENVIRONMENT_CONFIGS[_0x1f312b['ykxrM'](getCurrentEnvironment)]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x1ea287=_0x48f2e4;return process[_0x1ea287(0x1b9)]['RANGER_MCP_AUTH_URL']??ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x1ea287(0x1c0)];}export function isByokEnabled(){const _0x6bee45=_0x48f2e4;return process['env'][_0x6bee45(0x1ab)]==='true';}function isVerificationTransport(_0x3c4a8d){const _0x291693=_0x48f2e4,_0x27b55c={'PCEll':_0x291693(0x1bf),'PxFLW':function(_0x3253de,_0x4fa373){return _0x3253de===_0x4fa373;},'GufVO':'rangerwright-cli'};return _0x3c4a8d==='mcp'||_0x3c4a8d==='playwright-cli'||_0x3c4a8d===_0x27b55c[_0x291693(0x1a9)]||_0x27b55c[_0x291693(0x1c6)](_0x3c4a8d,_0x27b55c[_0x291693(0x1ac)]);}function _0x4125(_0x1a830c,_0x26c0d7){_0x1a830c=_0x1a830c-0x1a2;const _0x403097=_0x4030();let _0x4125b2=_0x403097[_0x1a830c];return _0x4125b2;}const LEGACY_TRANSPORT_ENV_VARS=[_0x48f2e4(0x1b6),_0x48f2e4(0x1b0)];export function getVerificationTransport(){const _0x669f4e=_0x48f2e4,_0x403b02=process[_0x669f4e(0x1b9)]['RANGER_TRANSPORT']?.[_0x669f4e(0x1c3)]();if(_0x403b02){if(isVerificationTransport(_0x403b02))return _0x403b02;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x403b02+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x10faa2=LEGACY_TRANSPORT_ENV_VARS['find'](_0x133c91=>process[_0x669f4e(0x1b9)][_0x133c91]);if(_0x10faa2)throw new Error(_0x10faa2+_0x669f4e(0x1c9));return _0x669f4e(0x1aa);}export function resolveHookMode(_0x13601f=process[_0x48f2e4(0x1b9)]){const _0xf6e73b=_0x48f2e4,_0x28d67c={'MPZKd':_0xf6e73b(0x1ae),'ZbPhf':function(_0x411fcc,_0x1e7d7a){return _0x411fcc===_0x1e7d7a;},'sIJYj':function(_0x27e7d5,_0x162fde){return _0x27e7d5+_0x162fde;}},_0x4b37b8=_0x13601f['RANGER_HOOKS']?.[_0xf6e73b(0x1c3)]()[_0xf6e73b(0x1b1)]();if(!_0x4b37b8)return _0x28d67c['MPZKd'];if(_0x28d67c['ZbPhf'](_0x4b37b8,_0xf6e73b(0x1b4))||_0x28d67c['ZbPhf'](_0x4b37b8,'on')||_0x4b37b8===_0xf6e73b(0x1ae))return _0x4b37b8;return console['error'](_0x28d67c['sIJYj'](_0xf6e73b(0x1b5)+_0x13601f[_0xf6e73b(0x1b8)]+_0xf6e73b(0x1ad),'Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.')),_0x28d67c['MPZKd'];}
@@ -1 +1 @@
1
- (function(_0x571d66,_0x1bee4d){const _0x4569a0=_0x4b33,_0x200c6f=_0x571d66();while(!![]){try{const _0x51dba5=-parseInt(_0x4569a0(0x1ad))/0x1*(parseInt(_0x4569a0(0x1ca))/0x2)+-parseInt(_0x4569a0(0x1b7))/0x3+parseInt(_0x4569a0(0x1c4))/0x4*(-parseInt(_0x4569a0(0x1b8))/0x5)+parseInt(_0x4569a0(0x1ab))/0x6*(parseInt(_0x4569a0(0x1a3))/0x7)+-parseInt(_0x4569a0(0x1b0))/0x8+-parseInt(_0x4569a0(0x1b9))/0x9*(parseInt(_0x4569a0(0x1d2))/0xa)+parseInt(_0x4569a0(0x1e6))/0xb;if(_0x51dba5===_0x1bee4d)break;else _0x200c6f['push'](_0x200c6f['shift']());}catch(_0x4afe91){_0x200c6f['push'](_0x200c6f['shift']());}}}(_0x399d,0x44522));function _0x4b33(_0x6ba84e,_0x4a2007){_0x6ba84e=_0x6ba84e-0x19f;const _0x399d22=_0x399d();let _0x4b3349=_0x399d22[_0x6ba84e];return _0x4b3349;}import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0xcb2026){const _0x3f811c=_0x4b33,_0x59ad7e={'ZUkjf':function(_0x63a202){return _0x63a202();},'EcXvu':_0x3f811c(0x1a2),'NyHaK':function(_0x153505,_0x2d2295){return _0x153505===_0x2d2295;},'KlBax':'Feature\x20limit\x20exceeded'},_0x1de6ac=await _0x59ad7e['ZUkjf'](getToken);if(!_0x1de6ac)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4d38f7=_0x59ad7e['ZUkjf'](getApiBaseUrl),_0x14c80b=await fetch(_0x4d38f7+_0x3f811c(0x1da),{'method':'POST','headers':{'Authorization':_0x3f811c(0x1c0)+_0x1de6ac,'Content-Type':_0x59ad7e['EcXvu']},'body':JSON['stringify'](_0xcb2026)});if(!_0x14c80b['ok']){if(_0x59ad7e['NyHaK'](_0x14c80b[_0x3f811c(0x1cb)],0x192)){const _0x13a0b3=await _0x14c80b[_0x3f811c(0x1b5)](),_0x57e787=_0x13a0b3['billingUrl']||'https://dashboard.ranger.net/billing';throw new Error((_0x13a0b3['message']||_0x59ad7e[_0x3f811c(0x1d1)])+_0x3f811c(0x1e3)+_0x57e787);}const _0x2b2958=await _0x14c80b['text']();throw new Error(_0x3f811c(0x1c6)+_0x2b2958);}return _0x14c80b['json']();}export async function listFeatures(_0x565803){const _0x17dae0=_0x4b33,_0x123b22={'nOhYE':function(_0x3f08e4){return _0x3f08e4();},'XHnLX':_0x17dae0(0x1d5),'hpiRD':'gitRepoUrl','MftEP':'gitBranch','aEuuk':_0x17dae0(0x1a5)},_0x3002f2=await _0x123b22[_0x17dae0(0x1cc)](getToken);if(!_0x3002f2)throw new Error(_0x123b22['XHnLX']);const _0x45105c=_0x123b22['nOhYE'](getApiBaseUrl),_0x34a120=new URLSearchParams();if(_0x565803?.['gitRepoUrl'])_0x34a120['set'](_0x123b22['hpiRD'],_0x565803[_0x17dae0(0x1e8)]);if(_0x565803?.['gitBranch'])_0x34a120['set'](_0x123b22['MftEP'],_0x565803[_0x17dae0(0x1dd)]);if(_0x565803?.[_0x17dae0(0x1af)])_0x34a120['set']('limit',_0x565803[_0x17dae0(0x1af)][_0x17dae0(0x1a6)]());if(_0x565803?.[_0x17dae0(0x1a5)])_0x34a120['set'](_0x123b22['aEuuk'],_0x565803[_0x17dae0(0x1a5)]['toString']());if(_0x565803?.[_0x17dae0(0x1aa)])_0x34a120[_0x17dae0(0x1b6)]('includeDeleted','true');const _0x114c3a=_0x45105c+'/api/v1/mcp/features'+(_0x34a120[_0x17dae0(0x1a6)]()?'?'+_0x34a120[_0x17dae0(0x1a6)]():''),_0xa41d28=await fetch(_0x114c3a,{'method':'GET','headers':{'Authorization':_0x17dae0(0x1c0)+_0x3002f2}});if(!_0xa41d28['ok']){const _0x1f2615=await _0xa41d28[_0x17dae0(0x1a8)]();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x1f2615);}return _0xa41d28['json']();}export async function getFeature(_0x31b8f4){const _0x2a9170=_0x4b33,_0x30263d={'uurMZ':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','nwJZg':function(_0x22a33c){return _0x22a33c();},'jhNzO':function(_0x39e843,_0x12d16c,_0x4e326b){return _0x39e843(_0x12d16c,_0x4e326b);},'pJDMu':_0x2a9170(0x1b1)},_0x1c7e4c=await getToken();if(!_0x1c7e4c)throw new Error(_0x30263d['uurMZ']);const _0x100c73=_0x30263d['nwJZg'](getApiBaseUrl),_0x132d87=await _0x30263d['jhNzO'](fetch,_0x100c73+_0x2a9170(0x1e4)+_0x31b8f4,{'method':_0x30263d[_0x2a9170(0x1d4)],'headers':{'Authorization':_0x2a9170(0x1c0)+_0x1c7e4c}});if(!_0x132d87['ok']){const _0x31be78=await _0x132d87[_0x2a9170(0x1a8)]();throw new Error(_0x2a9170(0x1e7)+_0x31be78);}return _0x132d87[_0x2a9170(0x1b5)]();}export async function updateFeature(_0x93d28e,_0x22f3b9){const _0x4c98c9=_0x4b33,_0x1dc718={'RSqXs':function(_0x38324a){return _0x38324a();},'LETfR':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x4b329d=await _0x1dc718[_0x4c98c9(0x1b4)](getToken);if(!_0x4b329d)throw new Error(_0x1dc718[_0x4c98c9(0x1d7)]);const _0xc49946=getApiBaseUrl(),_0x33888b=await fetch(_0xc49946+_0x4c98c9(0x1e4)+_0x93d28e,{'method':'PATCH','headers':{'Authorization':_0x4c98c9(0x1c0)+_0x4b329d,'Content-Type':_0x4c98c9(0x1a2)},'body':JSON[_0x4c98c9(0x1e1)](_0x22f3b9)});if(!_0x33888b['ok']){const _0x184023=await _0x33888b[_0x4c98c9(0x1a8)]();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x184023);}return _0x33888b['json']();}export async function createChecklistItem(_0x13f52b,_0x4063a1,_0x5e169b){const _0x505846=_0x4b33,_0x44e3cf={'MxgNQ':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','fNBXf':function(_0x3d3cae){return _0x3d3cae();}},_0x2c6518=await getToken();if(!_0x2c6518)throw new Error(_0x44e3cf['MxgNQ']);const _0x30b3cf=_0x44e3cf[_0x505846(0x1a9)](getApiBaseUrl),_0x238766=await fetch(_0x30b3cf+'/api/v1/mcp/features/'+_0x13f52b+'/checklist',{'method':_0x505846(0x1e9),'headers':{'Authorization':_0x505846(0x1c0)+_0x2c6518,'Content-Type':_0x505846(0x1a2)},'body':JSON['stringify']({'description':_0x4063a1,'position':_0x5e169b})});if(!_0x238766['ok']){const _0x2230b8=await _0x238766['text']();throw new Error(_0x505846(0x1e2)+_0x2230b8);}return _0x238766[_0x505846(0x1b5)]();}export async function updateChecklistItem(_0x2c7983,_0x2b27e5,_0x287fc6){const _0x5a1f15=_0x4b33,_0x55e736={'xvKMy':_0x5a1f15(0x1d5),'nOmEE':function(_0x270f02,_0x4575b5,_0x4bc969){return _0x270f02(_0x4575b5,_0x4bc969);},'rtFGj':'PATCH'};return withRetry(async()=>{const _0x5a91a4=_0x5a1f15,_0x198efa=await getToken();if(!_0x198efa)throw new Error(_0x55e736[_0x5a91a4(0x1cf)]);const _0x1f8fd8=getApiBaseUrl(),_0x4f7bcd=await _0x55e736['nOmEE'](fetch,_0x1f8fd8+_0x5a91a4(0x1e4)+_0x2c7983+'/checklist/'+_0x2b27e5,{'method':_0x55e736['rtFGj'],'headers':{'Authorization':_0x5a91a4(0x1c0)+_0x198efa,'Content-Type':'application/json'},'body':JSON[_0x5a91a4(0x1e1)](_0x287fc6)});if(!_0x4f7bcd['ok']){const _0x3ea0de=await _0x4f7bcd[_0x5a91a4(0x1a8)]();throw new Error(_0x5a91a4(0x1df)+_0x3ea0de);}return _0x4f7bcd[_0x5a91a4(0x1b5)]();},{'label':_0x5a1f15(0x1c1)});}export async function getFeatureReport(_0x416ad8){const _0x482d83=_0x4b33,_0x196b05={'GfnpA':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','BozNe':function(_0x44dfbb){return _0x44dfbb();},'sZLRX':function(_0xc29932,_0x15d59d,_0x4b1f7d){return _0xc29932(_0x15d59d,_0x4b1f7d);}},_0x27aa7e=await getToken();if(!_0x27aa7e)throw new Error(_0x196b05['GfnpA']);const _0x349760=_0x196b05[_0x482d83(0x1bc)](getApiBaseUrl),_0x44f121=await _0x196b05['sZLRX'](fetch,_0x349760+_0x482d83(0x1e4)+_0x416ad8+_0x482d83(0x1db),{'method':_0x482d83(0x1b1),'headers':{'Authorization':'Bearer\x20'+_0x27aa7e}});if(!_0x44f121['ok']){const _0x16a036=await _0x44f121[_0x482d83(0x1a8)]();throw new Error(_0x482d83(0x1ba)+_0x16a036);}return _0x44f121['json']();}export async function getFeatureReportMarkdown(_0x564d80,_0x30920a){const _0x129cd3=_0x4b33,_0x3de0c7={'XVxYB':function(_0x339784){return _0x339784();},'lZpet':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','yNXag':function(_0x528bbe,_0x1f7686){return _0x528bbe>_0x1f7686;},'KmTsr':function(_0x83051f,_0x3b0a44){return _0x83051f(_0x3b0a44);},'oYZbL':function(_0x18d1a8,_0x4590c6){return _0x18d1a8&&_0x4590c6;}},_0x15e53c=await _0x3de0c7[_0x129cd3(0x1d3)](getToken);if(!_0x15e53c)throw new Error(_0x3de0c7[_0x129cd3(0x1cd)]);const _0xe6f395=getApiBaseUrl(),_0x500f1d=new URLSearchParams(),_0x500eed=_0x3de0c7[_0x129cd3(0x1a7)](_0x30920a?.['itemIds']?.[_0x129cd3(0x1b2)]??0x0,0x0),_0x4c1056=_0x3de0c7['KmTsr'](Boolean,_0x30920a?.['sessionId']);_0x500eed&&_0x30920a?.[_0x129cd3(0x1c5)]&&_0x500f1d[_0x129cd3(0x1b6)]('itemIds',_0x30920a[_0x129cd3(0x1c5)][_0x129cd3(0x1b3)](','));_0x4c1056&&_0x30920a?.[_0x129cd3(0x1bd)]&&_0x500f1d['set']('sessionId',_0x30920a[_0x129cd3(0x1bd)]);_0x3de0c7[_0x129cd3(0x1ce)](!_0x500eed,!_0x4c1056)&&_0x30920a?.['style']&&_0x500f1d['set'](_0x129cd3(0x1c8),_0x30920a[_0x129cd3(0x1c8)]);const _0x1637b0=_0xe6f395+'/api/v1/mcp/features/'+_0x564d80+'/report/markdown',_0x273308=''+_0x1637b0+(_0x500f1d[_0x129cd3(0x1a6)]()?'?'+_0x500f1d[_0x129cd3(0x1a6)]():''),_0x4b009f=await fetch(_0x273308,{'method':_0x129cd3(0x1b1),'headers':{'Authorization':_0x129cd3(0x1c0)+_0x15e53c}});if(!_0x4b009f['ok']){const _0x17d58e=await _0x4b009f[_0x129cd3(0x1a8)]();throw new Error(_0x129cd3(0x1dc)+_0x17d58e);}return _0x4b009f[_0x129cd3(0x1a8)]();}export async function listFeatureSessions(_0x5cc977){const _0xe2684a=_0x4b33,_0x2a5478={'bXeqY':function(_0x2fbb59){return _0x2fbb59();}},_0x274732=await getToken();if(!_0x274732)throw new Error(_0xe2684a(0x1d5));const _0x13aeef=_0x2a5478['bXeqY'](getApiBaseUrl),_0x15790d=await fetch(_0x13aeef+_0xe2684a(0x1e4)+_0x5cc977+_0xe2684a(0x1de),{'method':_0xe2684a(0x1b1),'headers':{'Authorization':'Bearer\x20'+_0x274732}});if(!_0x15790d['ok']){const _0x1e14cc=await _0x15790d[_0xe2684a(0x1a8)]();throw new Error(_0xe2684a(0x1e0)+_0x1e14cc);}return _0x15790d['json']();}export async function startSession(_0x433418,_0x55e4c9){const _0x3abb65=_0x4b33,_0x13e018={'BdsBk':function(_0x501eb1){return _0x501eb1();},'tMzfF':function(_0x2d8318,_0x438823,_0x234706){return _0x2d8318(_0x438823,_0x234706);}},_0xadb8ab=await _0x13e018[_0x3abb65(0x1c3)](getToken);if(!_0xadb8ab)throw new Error(_0x3abb65(0x1d5));const _0x28aa89=getApiBaseUrl(),_0x20ce7b=await _0x13e018['tMzfF'](fetch,_0x28aa89+_0x3abb65(0x1e4)+_0x433418+'/sessions/'+_0x55e4c9+_0x3abb65(0x1e5),{'method':_0x3abb65(0x1e9),'headers':{'Authorization':'Bearer\x20'+_0xadb8ab}});if(!_0x20ce7b['ok']){const _0x1f524f=await _0x20ce7b['text']();throw new Error(_0x3abb65(0x1d8)+_0x1f524f);}return _0x20ce7b['json']();}export async function concludeSession(_0x35bcdc,_0x10a791){const _0x3ce610=_0x4b33,_0x10669f={'lyhfO':function(_0x43dd44){return _0x43dd44();},'yQSbi':function(_0x57ab15,_0x312856,_0x26511f){return _0x57ab15(_0x312856,_0x26511f);},'dTGal':_0x3ce610(0x1e9)},_0x18b71a=await _0x10669f[_0x3ce610(0x1ea)](getToken);if(!_0x18b71a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1ab73b=_0x10669f['lyhfO'](getApiBaseUrl),_0x4962f7=await _0x10669f['yQSbi'](fetch,_0x1ab73b+'/api/v1/mcp/features/'+_0x35bcdc+_0x3ce610(0x1ac)+_0x10a791+_0x3ce610(0x1d6),{'method':_0x10669f[_0x3ce610(0x1ae)],'headers':{'Authorization':_0x3ce610(0x1c0)+_0x18b71a}});if(!_0x4962f7['ok']){const _0x37d415=await _0x4962f7[_0x3ce610(0x1a8)]();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x37d415);}return _0x4962f7['json']();}export async function getActionItems(_0x5edf6a){const _0x5d5764=_0x4b33,_0x32c44b={'RjSUY':_0x5d5764(0x1d5),'CbMaQ':'GET'},_0x1b93c1=await getToken();if(!_0x1b93c1)throw new Error(_0x32c44b['RjSUY']);const _0x1a1c91=getApiBaseUrl(),_0x5d5b7d=await fetch(_0x1a1c91+_0x5d5764(0x1e4)+_0x5edf6a+'/action-items',{'method':_0x32c44b[_0x5d5764(0x1a0)],'headers':{'Authorization':'Bearer\x20'+_0x1b93c1}});if(!_0x5d5b7d['ok']){const _0x4d090a=await _0x5d5b7d[_0x5d5764(0x1a8)]();throw new Error(_0x5d5764(0x1c7)+_0x4d090a);}return _0x5d5b7d[_0x5d5764(0x1b5)]();}export async function getItemFeedback(_0x54ed7d,_0xf4cd4a){const _0x6ee0ff=_0x4b33,_0x1dbf12={'PSfBr':function(_0x2770d9){return _0x2770d9();},'TskUU':function(_0x3c076b,_0x81baf9,_0x1c2dc3){return _0x3c076b(_0x81baf9,_0x1c2dc3);},'aVmFU':_0x6ee0ff(0x1b1)},_0x17a8d9=await _0x1dbf12['PSfBr'](getToken);if(!_0x17a8d9)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x23b20d=_0x1dbf12['PSfBr'](getApiBaseUrl),_0x4c205e=await _0x1dbf12['TskUU'](fetch,_0x23b20d+_0x6ee0ff(0x1e4)+_0x54ed7d+'/checklist-items/'+_0xf4cd4a+_0x6ee0ff(0x1a1),{'method':_0x1dbf12['aVmFU'],'headers':{'Authorization':_0x6ee0ff(0x1c0)+_0x17a8d9}});if(!_0x4c205e['ok']){const _0x4ad4bd=await _0x4c205e[_0x6ee0ff(0x1a8)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x4ad4bd);}return _0x4c205e[_0x6ee0ff(0x1b5)]();}export async function markCommentsAddressed(_0x1a96a1,_0x3039db,_0x104d9b){const _0x2ee252=_0x4b33,_0xd1d68={'aHjjl':function(_0x1f2ad5){return _0x1f2ad5();},'vkYJE':function(_0x202c01){return _0x202c01();}},_0x292f50=await _0xd1d68['aHjjl'](getToken);if(!_0x292f50)throw new Error(_0x2ee252(0x1d5));const _0x2a7188=_0xd1d68['vkYJE'](getApiBaseUrl),_0x109c6a=await fetch(_0x2a7188+'/api/v1/mcp/features/'+_0x1a96a1+'/comments/address',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x292f50,'Content-Type':'application/json'},'body':JSON['stringify']({'checklistItemId':_0x3039db,'commentIds':_0x104d9b})});if(!_0x109c6a['ok']){const _0x1933ec=await _0x109c6a[_0x2ee252(0x1a8)]();throw new Error(_0x2ee252(0x1d0)+_0x1933ec);}}export async function softDeleteFeature(_0x4ba749){const _0x12b1bf=_0x4b33,_0x56f974={'KaAfF':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','KoIcl':function(_0x269361){return _0x269361();},'usLwv':function(_0x689f3f,_0x2945d8,_0x47c3b3){return _0x689f3f(_0x2945d8,_0x47c3b3);},'okOJd':'DELETE'},_0x3c7c02=await getToken();if(!_0x3c7c02)throw new Error(_0x56f974[_0x12b1bf(0x1c2)]);const _0x16de5d=_0x56f974[_0x12b1bf(0x1bb)](getApiBaseUrl),_0xc2754c=await _0x56f974[_0x12b1bf(0x1d9)](fetch,_0x16de5d+'/api/v1/mcp/features/'+_0x4ba749,{'method':_0x56f974[_0x12b1bf(0x1bf)],'headers':{'Authorization':'Bearer\x20'+_0x3c7c02}});if(!_0xc2754c['ok']){const _0x5bda56=await _0xc2754c['text']();throw new Error(_0x12b1bf(0x19f)+_0x5bda56);}}function _0x399d(){const _0x4b654b=['14XrNxuz','jnJnB','offset','toString','yNXag','text','fNBXf','includeDeleted','981528ZBVByP','/sessions/','19212QRKmAq','dTGal','limit','724280opSbWW','GET','length','join','RSqXs','json','set','641727FIlioR','271985VgrIao','18GaWUYM','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','KoIcl','BozNe','sessionId','VCXad','okOJd','Bearer\x20','updateChecklistItem','KaAfF','BdsBk','16vVzpdz','itemIds','Failed\x20to\x20create\x20feature\x20review:\x20','Failed\x20to\x20get\x20action\x20items:\x20','style','/restore','22lHWhwJ','status','nOhYE','lZpet','oYZbL','xvKMy','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','KlBax','194530KizlbG','XVxYB','pJDMu','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','/conclude','LETfR','Failed\x20to\x20start\x20session:\x20','usLwv','/api/v1/mcp/features','/report','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','gitBranch','/sessions','Failed\x20to\x20update\x20scenario:\x20','Failed\x20to\x20list\x20sessions:\x20','stringify','Failed\x20to\x20create\x20scenario:\x20','\x0a\x0aUpgrade\x20your\x20plan:\x20','/api/v1/mcp/features/','/start','7974296kXMCPl','Failed\x20to\x20get\x20feature\x20review:\x20','gitRepoUrl','POST','lyhfO','Failed\x20to\x20delete\x20feature\x20review:\x20','CbMaQ','/feedback','application/json'];_0x399d=function(){return _0x4b654b;};return _0x399d();}export async function restoreFeature(_0xb1cfd4){const _0x27c4e6=_0x4b33,_0x11d071={'VCXad':function(_0x27f722){return _0x27f722();},'jnJnB':_0x27c4e6(0x1e9)},_0x171326=await _0x11d071[_0x27c4e6(0x1be)](getToken);if(!_0x171326)throw new Error(_0x27c4e6(0x1d5));const _0x21a007=getApiBaseUrl(),_0x2c3b65=await fetch(_0x21a007+_0x27c4e6(0x1e4)+_0xb1cfd4+_0x27c4e6(0x1c9),{'method':_0x11d071[_0x27c4e6(0x1a4)],'headers':{'Authorization':_0x27c4e6(0x1c0)+_0x171326}});if(!_0x2c3b65['ok']){const _0x5f0bac=await _0x2c3b65['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x5f0bac);}}
1
+ (function(_0x9021c8,_0x1c3817){const _0x38d498=_0x1110,_0x3dd7ef=_0x9021c8();while(!![]){try{const _0x4f82cd=parseInt(_0x38d498(0xb0))/0x1*(-parseInt(_0x38d498(0xb5))/0x2)+-parseInt(_0x38d498(0xe1))/0x3+-parseInt(_0x38d498(0xf3))/0x4+parseInt(_0x38d498(0xd3))/0x5*(parseInt(_0x38d498(0xc0))/0x6)+-parseInt(_0x38d498(0xb8))/0x7*(parseInt(_0x38d498(0xb9))/0x8)+parseInt(_0x38d498(0xd7))/0x9*(-parseInt(_0x38d498(0xea))/0xa)+parseInt(_0x38d498(0xf6))/0xb;if(_0x4f82cd===_0x1c3817)break;else _0x3dd7ef['push'](_0x3dd7ef['shift']());}catch(_0x59efef){_0x3dd7ef['push'](_0x3dd7ef['shift']());}}}(_0x3854,0x4735c));import{getToken}from'./keychain.js';function _0x1110(_0x42ade3,_0x34261b){_0x42ade3=_0x42ade3-0xa7;const _0x3854c1=_0x3854();let _0x111073=_0x3854c1[_0x42ade3];return _0x111073;}import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x350663){const _0x32e73e=_0x1110,_0x148f84={'xfsig':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','sHEvg':function(_0x4d9f30){return _0x4d9f30();},'OCmVH':'POST','fLcWq':'application/json','omrbN':'https://dashboard.ranger.net/billing'},_0x4c9727=await getToken();if(!_0x4c9727)throw new Error(_0x148f84['xfsig']);const _0x4c999a=_0x148f84[_0x32e73e(0xee)](getApiBaseUrl),_0x44fc38=await fetch(_0x4c999a+_0x32e73e(0xac),{'method':_0x148f84[_0x32e73e(0xe7)],'headers':{'Authorization':_0x32e73e(0xb6)+_0x4c9727,'Content-Type':_0x148f84[_0x32e73e(0xe2)]},'body':JSON[_0x32e73e(0xc1)](_0x350663)});if(!_0x44fc38['ok']){if(_0x44fc38[_0x32e73e(0xcf)]===0x192){const _0x11ac4e=await _0x44fc38[_0x32e73e(0xd9)](),_0x507146=_0x11ac4e['billingUrl']||_0x148f84['omrbN'];throw new Error((_0x11ac4e[_0x32e73e(0xe5)]||'Feature\x20limit\x20exceeded')+_0x32e73e(0xf7)+_0x507146);}const _0x39932c=await _0x44fc38['text']();throw new Error(_0x32e73e(0xcc)+_0x39932c);}return _0x44fc38[_0x32e73e(0xd9)]();}function _0x3854(){const _0x42af13=['/checklist-items/','10903739kxKGeP','\x0a\x0aUpgrade\x20your\x20plan:\x20','toString','VOHpn','OVbwD','UxTVY','/checklist','beZfT','/api/v1/mcp/features','GZtEe','/report','includeDeleted','124175vEWULc','application/json','set','offset','Failed\x20to\x20create\x20scenario:\x20','6KNVbwA','Bearer\x20','EEyiZ','287EjWnFZ','36528MDElaD','text','YclRp','style','DVxEj','udVdP','IWHUV','6HnLNtV','stringify','/report/markdown','ZkfTu','PATCH','KnACK','itemIds','Failed\x20to\x20delete\x20feature\x20review:\x20','MdaER','/api/v1/mcp/features/','RsDpT','LMQIj','Failed\x20to\x20create\x20feature\x20review:\x20','fwOwp','Failed\x20to\x20update\x20scenario:\x20','status','GET','dAwYM','Failed\x20to\x20conclude\x20session:\x20','2596485MTShrR','Failed\x20to\x20start\x20session:\x20','sessionId','gitBranch','639vSnBWN','/restore','json','VYqNz','DELETE','/sessions','dMKzg','gitRepoUrl','POST','Failed\x20to\x20get\x20action\x20items:\x20','303027uqwnRI','fLcWq','JkrnH','YUuIl','message','wFgEb','OCmVH','xeUbl','pSEOF','13510HfwBps','/action-items','Failed\x20to\x20list\x20sessions:\x20','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','sHEvg','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','/checklist/','BGhIp','join','1848836kFyoTf','Failed\x20to\x20update\x20feature\x20review:\x20'];_0x3854=function(){return _0x42af13;};return _0x3854();}export async function listFeatures(_0x3754fa){const _0x2fdb6b=_0x1110,_0x327a59={'MYYUn':_0x2fdb6b(0xef),'rUvKC':_0x2fdb6b(0xd6),'YclRp':'offset','JkrnH':'true','iiBYc':'GET'},_0x416dd8=await getToken();if(!_0x416dd8)throw new Error(_0x327a59['MYYUn']);const _0x160c29=getApiBaseUrl(),_0x32a4a7=new URLSearchParams();if(_0x3754fa?.['gitRepoUrl'])_0x32a4a7[_0x2fdb6b(0xb2)]('gitRepoUrl',_0x3754fa[_0x2fdb6b(0xde)]);if(_0x3754fa?.['gitBranch'])_0x32a4a7[_0x2fdb6b(0xb2)](_0x327a59['rUvKC'],_0x3754fa['gitBranch']);if(_0x3754fa?.['limit'])_0x32a4a7[_0x2fdb6b(0xb2)]('limit',_0x3754fa['limit']['toString']());if(_0x3754fa?.[_0x2fdb6b(0xb3)])_0x32a4a7['set'](_0x327a59[_0x2fdb6b(0xbb)],_0x3754fa['offset'][_0x2fdb6b(0xf8)]());if(_0x3754fa?.[_0x2fdb6b(0xaf)])_0x32a4a7[_0x2fdb6b(0xb2)](_0x2fdb6b(0xaf),_0x327a59[_0x2fdb6b(0xe3)]);const _0x145535=_0x160c29+_0x2fdb6b(0xac)+(_0x32a4a7[_0x2fdb6b(0xf8)]()?'?'+_0x32a4a7['toString']():''),_0x5b1a1d=await fetch(_0x145535,{'method':_0x327a59['iiBYc'],'headers':{'Authorization':'Bearer\x20'+_0x416dd8}});if(!_0x5b1a1d['ok']){const _0x1a0360=await _0x5b1a1d[_0x2fdb6b(0xba)]();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x1a0360);}return _0x5b1a1d[_0x2fdb6b(0xd9)]();}export async function getFeature(_0x140f72){const _0x4e3c43=_0x1110,_0x5f4191={'pSEOF':function(_0x215d77){return _0x215d77();},'VOHpn':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','VYqNz':function(_0x59f192,_0x585ab9,_0x3be834){return _0x59f192(_0x585ab9,_0x3be834);}},_0xfa21d=await _0x5f4191[_0x4e3c43(0xe9)](getToken);if(!_0xfa21d)throw new Error(_0x5f4191[_0x4e3c43(0xa7)]);const _0x53d8ae=getApiBaseUrl(),_0x2600bb=await _0x5f4191[_0x4e3c43(0xda)](fetch,_0x53d8ae+'/api/v1/mcp/features/'+_0x140f72,{'method':'GET','headers':{'Authorization':_0x4e3c43(0xb6)+_0xfa21d}});if(!_0x2600bb['ok']){const _0x233099=await _0x2600bb['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x233099);}return _0x2600bb[_0x4e3c43(0xd9)]();}export async function updateFeature(_0xd3e8ba,_0x4bf37f){const _0x258061=_0x1110,_0x25fb0e={'wFgEb':function(_0x85b70c){return _0x85b70c();},'DVxEj':function(_0x20e334,_0x5d3b2f,_0x22f9cc){return _0x20e334(_0x5d3b2f,_0x22f9cc);},'KnACK':'PATCH','OVbwD':_0x258061(0xb1)},_0x473d3a=await _0x25fb0e[_0x258061(0xe6)](getToken);if(!_0x473d3a)throw new Error(_0x258061(0xef));const _0x15c888=_0x25fb0e[_0x258061(0xe6)](getApiBaseUrl),_0x2d3c95=await _0x25fb0e[_0x258061(0xbd)](fetch,_0x15c888+'/api/v1/mcp/features/'+_0xd3e8ba,{'method':_0x25fb0e[_0x258061(0xc5)],'headers':{'Authorization':'Bearer\x20'+_0x473d3a,'Content-Type':_0x25fb0e[_0x258061(0xa8)]},'body':JSON[_0x258061(0xc1)](_0x4bf37f)});if(!_0x2d3c95['ok']){const _0x1e6cbe=await _0x2d3c95['text']();throw new Error(_0x258061(0xf4)+_0x1e6cbe);}return _0x2d3c95[_0x258061(0xd9)]();}export async function createChecklistItem(_0x3a1d1e,_0xd8143,_0x442ea6){const _0x6f8288=_0x1110,_0x5b3ddb={'ScZjV':function(_0x149542,_0x344baf,_0x56c6e5){return _0x149542(_0x344baf,_0x56c6e5);},'beZfT':_0x6f8288(0xb1)},_0x111daf=await getToken();if(!_0x111daf)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x57e2c5=getApiBaseUrl(),_0x30681d=await _0x5b3ddb['ScZjV'](fetch,_0x57e2c5+_0x6f8288(0xc9)+_0x3a1d1e+_0x6f8288(0xaa),{'method':'POST','headers':{'Authorization':_0x6f8288(0xb6)+_0x111daf,'Content-Type':_0x5b3ddb[_0x6f8288(0xab)]},'body':JSON['stringify']({'description':_0xd8143,'position':_0x442ea6})});if(!_0x30681d['ok']){const _0x6540a8=await _0x30681d['text']();throw new Error(_0x6f8288(0xb4)+_0x6540a8);}return _0x30681d[_0x6f8288(0xd9)]();}export async function updateChecklistItem(_0x126742,_0x1f6219,_0x31a246){const _0x1a7626=_0x1110,_0x1f13cb={'MdaER':function(_0x1e4f1e){return _0x1e4f1e();},'UWuUj':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ZkfTu':function(_0x440574,_0x4ecb8a,_0x10d104){return _0x440574(_0x4ecb8a,_0x10d104);},'IiwQu':_0x1a7626(0xc4),'UxTVY':_0x1a7626(0xb1),'ojQXF':'updateChecklistItem'};return withRetry(async()=>{const _0x12f321=_0x1a7626,_0x1a3a06=await _0x1f13cb[_0x12f321(0xc8)](getToken);if(!_0x1a3a06)throw new Error(_0x1f13cb['UWuUj']);const _0x170de9=getApiBaseUrl(),_0x52b798=await _0x1f13cb[_0x12f321(0xc3)](fetch,_0x170de9+'/api/v1/mcp/features/'+_0x126742+_0x12f321(0xf0)+_0x1f6219,{'method':_0x1f13cb['IiwQu'],'headers':{'Authorization':'Bearer\x20'+_0x1a3a06,'Content-Type':_0x1f13cb[_0x12f321(0xa9)]},'body':JSON[_0x12f321(0xc1)](_0x31a246)});if(!_0x52b798['ok']){const _0x2f31d0=await _0x52b798['text']();throw new Error(_0x12f321(0xce)+_0x2f31d0);}return _0x52b798['json']();},{'label':_0x1f13cb['ojQXF']});}export async function getFeatureReport(_0x256aa0){const _0x2de946=_0x1110,_0x4d3cc7={'caURX':function(_0x377f15){return _0x377f15();},'nRbxl':function(_0x8f7658,_0x2919f0,_0xeb3a92){return _0x8f7658(_0x2919f0,_0xeb3a92);},'ULNwV':'GET'},_0x3a6e06=await _0x4d3cc7['caURX'](getToken);if(!_0x3a6e06)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2df6f8=getApiBaseUrl(),_0x4e982f=await _0x4d3cc7['nRbxl'](fetch,_0x2df6f8+_0x2de946(0xc9)+_0x256aa0+_0x2de946(0xae),{'method':_0x4d3cc7['ULNwV'],'headers':{'Authorization':'Bearer\x20'+_0x3a6e06}});if(!_0x4e982f['ok']){const _0x5cfc3d=await _0x4e982f['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x5cfc3d);}return _0x4e982f[_0x2de946(0xd9)]();}export async function getFeatureReportMarkdown(_0x553a21,_0x5e1385){const _0x1c235c=_0x1110,_0x4d30ef={'YiLBW':_0x1c235c(0xef),'rVmPn':function(_0x7c3fd1){return _0x7c3fd1();},'BbgAx':'itemIds','uSaol':function(_0x5cdcf5,_0x1d1000){return _0x5cdcf5&&_0x1d1000;},'xeUbl':'style','dAwYM':function(_0x472116,_0x1d28fc,_0x5bc0b6){return _0x472116(_0x1d28fc,_0x5bc0b6);}},_0x160878=await getToken();if(!_0x160878)throw new Error(_0x4d30ef['YiLBW']);const _0x9a1bad=_0x4d30ef['rVmPn'](getApiBaseUrl),_0x2ec471=new URLSearchParams(),_0x18b587=(_0x5e1385?.['itemIds']?.['length']??0x0)>0x0,_0x46fb5e=Boolean(_0x5e1385?.['sessionId']);_0x18b587&&_0x5e1385?.[_0x1c235c(0xc6)]&&_0x2ec471['set'](_0x4d30ef['BbgAx'],_0x5e1385['itemIds'][_0x1c235c(0xf2)](','));_0x46fb5e&&_0x5e1385?.['sessionId']&&_0x2ec471['set'](_0x1c235c(0xd5),_0x5e1385[_0x1c235c(0xd5)]);_0x4d30ef['uSaol'](!_0x18b587,!_0x46fb5e)&&_0x5e1385?.['style']&&_0x2ec471[_0x1c235c(0xb2)](_0x4d30ef[_0x1c235c(0xe8)],_0x5e1385[_0x1c235c(0xbc)]);const _0x124090=_0x9a1bad+'/api/v1/mcp/features/'+_0x553a21+_0x1c235c(0xc2),_0xc9e7db=''+_0x124090+(_0x2ec471['toString']()?'?'+_0x2ec471[_0x1c235c(0xf8)]():''),_0x162efe=await _0x4d30ef[_0x1c235c(0xd1)](fetch,_0xc9e7db,{'method':'GET','headers':{'Authorization':_0x1c235c(0xb6)+_0x160878}});if(!_0x162efe['ok']){const _0x3f0ccf=await _0x162efe[_0x1c235c(0xba)]();throw new Error(_0x1c235c(0xed)+_0x3f0ccf);}return _0x162efe[_0x1c235c(0xba)]();}export async function listFeatureSessions(_0x5516b0){const _0x4bc728=_0x1110,_0x18195e={'ajKLc':function(_0x315288){return _0x315288();}},_0x5c6b00=await _0x18195e['ajKLc'](getToken);if(!_0x5c6b00)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5eb87e=_0x18195e['ajKLc'](getApiBaseUrl),_0x1232b8=await fetch(_0x5eb87e+'/api/v1/mcp/features/'+_0x5516b0+_0x4bc728(0xdc),{'method':_0x4bc728(0xd0),'headers':{'Authorization':'Bearer\x20'+_0x5c6b00}});if(!_0x1232b8['ok']){const _0x1d83d9=await _0x1232b8[_0x4bc728(0xba)]();throw new Error(_0x4bc728(0xec)+_0x1d83d9);}return _0x1232b8['json']();}export async function startSession(_0x27149f,_0xfbd2e2){const _0x4e334d=_0x1110,_0x1e650f={'dMKzg':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','IWHUV':function(_0x1dd762,_0x42986b,_0x50b1f5){return _0x1dd762(_0x42986b,_0x50b1f5);}},_0x4f4bea=await getToken();if(!_0x4f4bea)throw new Error(_0x1e650f[_0x4e334d(0xdd)]);const _0x3dc9e4=getApiBaseUrl(),_0x2b0499=await _0x1e650f[_0x4e334d(0xbf)](fetch,_0x3dc9e4+_0x4e334d(0xc9)+_0x27149f+'/sessions/'+_0xfbd2e2+'/start',{'method':_0x4e334d(0xdf),'headers':{'Authorization':_0x4e334d(0xb6)+_0x4f4bea}});if(!_0x2b0499['ok']){const _0x4dc27d=await _0x2b0499[_0x4e334d(0xba)]();throw new Error(_0x4e334d(0xd4)+_0x4dc27d);}return _0x2b0499[_0x4e334d(0xd9)]();}export async function concludeSession(_0x40b9d9,_0x5a97f4){const _0x3ba3c2=_0x1110,_0x2cb911={'uqBEN':function(_0x55897f){return _0x55897f();},'RsDpT':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','EEyiZ':function(_0x1b5384,_0x332350,_0x18a96a){return _0x1b5384(_0x332350,_0x18a96a);},'Vvbtd':'POST'},_0x23381e=await _0x2cb911['uqBEN'](getToken);if(!_0x23381e)throw new Error(_0x2cb911[_0x3ba3c2(0xca)]);const _0x4a3b13=getApiBaseUrl(),_0x34e6d8=await _0x2cb911[_0x3ba3c2(0xb7)](fetch,_0x4a3b13+_0x3ba3c2(0xc9)+_0x40b9d9+'/sessions/'+_0x5a97f4+'/conclude',{'method':_0x2cb911['Vvbtd'],'headers':{'Authorization':_0x3ba3c2(0xb6)+_0x23381e}});if(!_0x34e6d8['ok']){const _0x30f9f5=await _0x34e6d8[_0x3ba3c2(0xba)]();throw new Error(_0x3ba3c2(0xd2)+_0x30f9f5);}return _0x34e6d8['json']();}export async function getActionItems(_0x20d39e){const _0x23570c=_0x1110,_0x578b8a={'YUuIl':function(_0xb4f1f9){return _0xb4f1f9();},'fwnEw':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ZhFdc':function(_0x38af86,_0x1532a6,_0x5580be){return _0x38af86(_0x1532a6,_0x5580be);},'GZtEe':'GET'},_0x272b28=await _0x578b8a[_0x23570c(0xe4)](getToken);if(!_0x272b28)throw new Error(_0x578b8a['fwnEw']);const _0x240abb=getApiBaseUrl(),_0x1bef31=await _0x578b8a['ZhFdc'](fetch,_0x240abb+'/api/v1/mcp/features/'+_0x20d39e+_0x23570c(0xeb),{'method':_0x578b8a[_0x23570c(0xad)],'headers':{'Authorization':'Bearer\x20'+_0x272b28}});if(!_0x1bef31['ok']){const _0x31f548=await _0x1bef31['text']();throw new Error(_0x23570c(0xe0)+_0x31f548);}return _0x1bef31['json']();}export async function getItemFeedback(_0x20e73c,_0x3ddde0){const _0x38abfd=_0x1110,_0x83bac6={'Matry':function(_0x21dba2){return _0x21dba2();},'udVdP':function(_0x45b37f,_0x390c5f,_0x33630a){return _0x45b37f(_0x390c5f,_0x33630a);}},_0x499c29=await _0x83bac6['Matry'](getToken);if(!_0x499c29)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x285b76=_0x83bac6['Matry'](getApiBaseUrl),_0x304d73=await _0x83bac6[_0x38abfd(0xbe)](fetch,_0x285b76+'/api/v1/mcp/features/'+_0x20e73c+_0x38abfd(0xf5)+_0x3ddde0+'/feedback',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x499c29}});if(!_0x304d73['ok']){const _0x4427ab=await _0x304d73['text']();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x4427ab);}return _0x304d73[_0x38abfd(0xd9)]();}export async function markCommentsAddressed(_0x16a9a9,_0x3245f6,_0x3b22a5){const _0x2b8baf=_0x1110,_0x56dccb={'BGhIp':function(_0x5742ff,_0x43a26a,_0x21a564){return _0x5742ff(_0x43a26a,_0x21a564);},'XLdDX':'application/json'},_0x2c9f7e=await getToken();if(!_0x2c9f7e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x438562=getApiBaseUrl(),_0x16c118=await _0x56dccb[_0x2b8baf(0xf1)](fetch,_0x438562+'/api/v1/mcp/features/'+_0x16a9a9+'/comments/address',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x2c9f7e,'Content-Type':_0x56dccb['XLdDX']},'body':JSON['stringify']({'checklistItemId':_0x3245f6,'commentIds':_0x3b22a5})});if(!_0x16c118['ok']){const _0x2ea392=await _0x16c118['text']();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x2ea392);}}export async function softDeleteFeature(_0x26c49f){const _0x3f9fb6=_0x1110,_0x52b8a6={'OVOsf':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x4f6175=await getToken();if(!_0x4f6175)throw new Error(_0x52b8a6['OVOsf']);const _0x10b0b2=getApiBaseUrl(),_0x2a556b=await fetch(_0x10b0b2+'/api/v1/mcp/features/'+_0x26c49f,{'method':_0x3f9fb6(0xdb),'headers':{'Authorization':_0x3f9fb6(0xb6)+_0x4f6175}});if(!_0x2a556b['ok']){const _0x521175=await _0x2a556b[_0x3f9fb6(0xba)]();throw new Error(_0x3f9fb6(0xc7)+_0x521175);}}export async function restoreFeature(_0x55adb0){const _0x3e9c3e=_0x1110,_0x33416b={'fwOwp':function(_0x477b1a){return _0x477b1a();},'LMQIj':function(_0x147548){return _0x147548();},'CXuxF':'POST'},_0x491336=await _0x33416b[_0x3e9c3e(0xcd)](getToken);if(!_0x491336)throw new Error(_0x3e9c3e(0xef));const _0x5425c7=_0x33416b[_0x3e9c3e(0xcb)](getApiBaseUrl),_0x40e153=await fetch(_0x5425c7+_0x3e9c3e(0xc9)+_0x55adb0+_0x3e9c3e(0xd8),{'method':_0x33416b['CXuxF'],'headers':{'Authorization':'Bearer\x20'+_0x491336}});if(!_0x40e153['ok']){const _0x2824e1=await _0x40e153['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x2824e1);}}