@ranger-testing/ranger-cli 3.1.0 → 3.1.1-alpha.b22d278-38

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 +1 -1
@@ -1 +1 @@
1
- const _0x3a83a9=_0x20a5;(function(_0x53a4ba,_0x4ad983){const _0x1afb52=_0x20a5,_0x3e25b1=_0x53a4ba();while(!![]){try{const _0x42757c=-parseInt(_0x1afb52(0x16e))/0x1+-parseInt(_0x1afb52(0x112))/0x2+parseInt(_0x1afb52(0x164))/0x3*(parseInt(_0x1afb52(0x10e))/0x4)+-parseInt(_0x1afb52(0x157))/0x5+-parseInt(_0x1afb52(0x136))/0x6*(parseInt(_0x1afb52(0xf4))/0x7)+parseInt(_0x1afb52(0x145))/0x8*(parseInt(_0x1afb52(0x12b))/0x9)+parseInt(_0x1afb52(0xf3))/0xa;if(_0x42757c===_0x4ad983)break;else _0x3e25b1['push'](_0x3e25b1['shift']());}catch(_0x4d86f2){_0x3e25b1['push'](_0x3e25b1['shift']());}}}(_0x9e98,0x4305e));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x1ab9dd from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';function _0x9e98(){const _0x434d70=['\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','iyCjJ','/api/v1/profiles/','qZUoV','RANGER_TEST_USERNAME','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','username','DELETE','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','220370xUGxCY','toISOString','organizationId','xoZfk','string','uAyJu','effectiveBaseUrl','detail','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','iOBZO','kVVik','\x20\x20Created\x20cloud\x20profile\x20\x22',').\x20','103227RMYJRZ','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','error','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','defaultEnvironmentKey','\x22;\x20proceeding\x20with\x20loginInstructions.','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','Bearer\x20','KXJfh','settings','136520NZBqCq','/api/v1/tunnel/sessions/','Cloud\x20profile\x20\x22','aoDIq','name','\x20failed\x20(','cBbvp','trim','IoBPJ','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','code','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','parse','HxARj','rfgOd','persistSessionState','save','8154900OtZflg','124432ZsyxKs','sessionCheckPath','auth','zISbG','\x22.\x0a','wxSPv','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','\x20\x20Server-side\x20login\x20error:\x20','tunnelUrl','json','RhYgW','\x22\x20not\x20found.','CfJFt','newContext','test_output','Jcadb','LNhxZ','FlZnk','Browser\x20login\x20timed\x20out\x20before\x20completion.','statusText','length','/api/v1/profiles','environments','close','log','agent','4bMhKyX','ZeKtM','/session','extraHTTPHeaders','800946jZQJXm','targetUrl','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','target_url','NYrmW','force','\x22\x20for\x20','origin','\x22,\x20refreshing\x20session...','not_configured','KBxUH','sessionId','\x20\x20No\x20live\x20session\x20for\x20\x22','DERsY','auWQO','browserOptions','\x22\x20on\x20profile\x20\x22','Hqnfe','status','setupHeaders','about:blank','KAsxg','session_state','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','userAgent','1625463VNnuRc','zQCOC','map','HkcwG','env','newPage','stringify','jcfKD','keys','pwEndpoint','RANGER_TEST_PASSWORD','120HxMqtO','POST','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ogarm','environmentKey','YyIvs','catch','loginInstructions','qvBpp','gXdDU','mLIGb','cookies','domains','KdPia','storageStatePath','16wWAZYV','YevbW','message','YccEc','tunnel','KcWgb','ztifs','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','baseUrl'];_0x9e98=function(){return _0x434d70;};return _0x9e98();}import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x36f48c=_0x20a5,_0xe66665={'FlZnk':function(_0xe44b11){return _0xe44b11();},'CfJFt':_0x36f48c(0x138)},_0x5bec78=await _0xe66665[_0x36f48c(0x105)](getToken);if(!_0x5bec78)throw new Error(_0xe66665[_0x36f48c(0x100)]);return _0x5bec78;}async function apiRequest(_0x4f49ac,_0x43dd61={}){const _0x4b2347=_0x20a5,_0x3c2942={'KcWgb':function(_0x52c490){return _0x52c490();},'qZUoV':function(_0x318cf9){return _0x318cf9();},'jcfKD':'application/json','HxARj':function(_0x1a9063,_0x254f86){return _0x1a9063===_0x254f86;},'mLIGb':function(_0x2d591b,_0x3e03ae){return _0x2d591b===_0x3e03ae;}},_0x3e7ae9=await _0x3c2942[_0x4b2347(0x14a)](requireToken),_0x4910ff=_0x3c2942[_0x4b2347(0x151)](getApiBaseUrl),_0x3849da=await fetch(''+_0x4910ff+_0x4f49ac,{..._0x43dd61,'headers':{'Authorization':_0x4b2347(0x16b)+_0x3e7ae9,'Content-Type':_0x3c2942[_0x4b2347(0x132)],..._0x43dd61['headers']??{}}});if(!_0x3849da['ok']){let _0x3fe5ba='',_0x4366f4;try{const _0x29a282=await _0x3849da['json']();_0x3fe5ba=(_0x3c2942[_0x4b2347(0xef)](typeof _0x29a282[_0x4b2347(0x166)],'string')?_0x29a282['error']:undefined)??JSON['stringify'](_0x29a282);if(_0x3c2942[_0x4b2347(0x140)](typeof _0x29a282[_0x4b2347(0xec)],'string'))_0x4366f4=_0x29a282['code'];}catch{_0x3fe5ba=_0x3849da[_0x4b2347(0x107)];}throw new ApiError('API\x20request\x20'+_0x4f49ac+_0x4b2347(0x173)+_0x3849da[_0x4b2347(0x124)]+'):\x20'+_0x3fe5ba,_0x3849da['status'],_0x3fe5ba,_0x4366f4);}if(_0x3c2942['HxARj'](_0x3849da[_0x4b2347(0x124)],0xcc))return undefined;return _0x3849da[_0x4b2347(0xfd)]();}export class ApiError extends Error{['status'];[_0x3a83a9(0x15e)];[_0x3a83a9(0xec)];constructor(_0x22bcf7,_0x4f985f,_0x3bb6b1,_0x104038){const _0x3cc73a=_0x3a83a9;super(_0x22bcf7),this['status']=_0x4f985f,this['detail']=_0x3bb6b1,this['code']=_0x104038,this[_0x3cc73a(0x172)]='ApiError';}}export async function fetchCloudProfile(_0x54c843){const _0x5658ab=_0x3a83a9,_0x46b7c1={'yEyyg':function(_0xc57ff7,_0x111e5e){return _0xc57ff7(_0x111e5e);},'auWQO':function(_0x22c783,_0x34575a){return _0x22c783===_0x34575a;}};try{return await apiRequest('/api/v1/profiles/'+_0x46b7c1['yEyyg'](encodeURIComponent,_0x54c843));}catch(_0x3b3f53){if(_0x3b3f53 instanceof ApiError&&_0x46b7c1[_0x5658ab(0x120)](_0x3b3f53['status'],0x194))return null;throw _0x3b3f53;}}export async function listCloudProfiles(){const _0x164e6a=_0x3a83a9,_0x3e41f4=await apiRequest(_0x164e6a(0x109));return _0x3e41f4['profiles'];}export async function deleteCloudProfile(_0x560818){const _0x32590e=_0x3a83a9,_0x2b3b0d={'zmsez':function(_0x43b4e7,_0x55149f,_0x366303){return _0x43b4e7(_0x55149f,_0x366303);},'gaaGL':function(_0x2219fa,_0x238aef){return _0x2219fa===_0x238aef;}};try{await _0x2b3b0d['zmsez'](apiRequest,_0x32590e(0x150)+encodeURIComponent(_0x560818),{'method':_0x32590e(0x155)});}catch(_0x5351b4){if(_0x5351b4 instanceof ApiError&&_0x2b3b0d['gaaGL'](_0x5351b4['status'],0x194))throw new Error(_0x32590e(0x170)+_0x560818+_0x32590e(0xff));throw _0x5351b4;}}export async function createCloudProfile(_0x302484,_0x151dde,_0x5ae8bf={}){const _0x402c73=_0x3a83a9,_0x1f8430={'KorFY':function(_0x3a9400,_0x2cb1c4,_0x276a36){return _0x3a9400(_0x2cb1c4,_0x276a36);},'DpJDq':'/api/v1/profiles'},_0x4b6b72={'name':_0x302484};if(_0x151dde)_0x4b6b72['environment_key']=_0x151dde;_0x5ae8bf[_0x402c73(0x16d)]&&Object['keys'](_0x5ae8bf[_0x402c73(0x16d)])['length']>0x0&&(_0x4b6b72[_0x402c73(0x16d)]=_0x5ae8bf['settings']);if(_0x5ae8bf[_0x402c73(0x154)])_0x4b6b72['username']=_0x5ae8bf[_0x402c73(0x154)];if(_0x5ae8bf['password'])_0x4b6b72['password']=_0x5ae8bf['password'];return await _0x1f8430['KorFY'](apiRequest,_0x1f8430['DpJDq'],{'method':'POST','body':JSON['stringify'](_0x4b6b72)});}export async function uploadCloudProfileSession(_0x3d852f,_0x247e28){const _0x1b1e71=_0x3a83a9,_0x59799b={'zQCOC':function(_0x3fbd13,_0x5d1f2a,_0x492eed){return _0x3fbd13(_0x5d1f2a,_0x492eed);},'lxmrA':'POST'};return await _0x59799b[_0x1b1e71(0x12c)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x3d852f)+_0x1b1e71(0x110),{'method':_0x59799b['lxmrA'],'body':JSON['stringify']({'session_state':_0x247e28})});}export async function saveCloudProfileCredentials(_0x3dbce8,_0x4fbc64,_0x1fc80c){const _0x1593b8={'eRiKo':function(_0x3acfaa,_0x2ca21d){return _0x3acfaa(_0x2ca21d);}};await apiRequest('/api/v1/profiles/'+_0x1593b8['eRiKo'](encodeURIComponent,_0x3dbce8),{'method':'PUT','body':JSON['stringify']({'username':_0x4fbc64,'password':_0x1fc80c})});}function _0x20a5(_0x32c190,_0x27ee43){_0x32c190=_0x32c190-0xec;const _0x9e982=_0x9e98();let _0x20a54a=_0x9e982[_0x32c190];return _0x20a54a;}export async function fetchAuthConfig(){const _0x4ef02e=_0x3a83a9,_0x2953ec={'ztifs':'/api/v1/profiles/auth-config'};try{const _0x20e8a6=await apiRequest(_0x2953ec[_0x4ef02e(0x14b)]);return _0x20e8a6['auth_config'];}catch(_0x175fb3){return _0x175fb3 instanceof ApiError&&_0x175fb3[_0x4ef02e(0x124)]!==0x194&&console[_0x4ef02e(0x166)](_0x4ef02e(0x14c)+_0x175fb3[_0x4ef02e(0x147)]),null;}}async function createTunnelSession(_0x59df70){const _0x5e0072=_0x3a83a9,_0x54afa1={'dpVjA':'/api/v1/tunnel/sessions','dkfoR':'POST'};return await apiRequest(_0x54afa1['dpVjA'],{'method':_0x54afa1['dkfoR'],'body':JSON[_0x5e0072(0x131)]({'targetUrl':_0x59df70,'mode':_0x5e0072(0x10d)})});}async function deleteTunnelSession(_0x2a4ff2){const _0x325d21=_0x3a83a9,_0x1e6101={'rzjSz':function(_0x55865a,_0x43127e,_0xcb536){return _0x55865a(_0x43127e,_0xcb536);}};await _0x1e6101['rzjSz'](apiRequest,_0x325d21(0x16f)+_0x2a4ff2,{'method':'DELETE'});}export function pickAdHocEnvKey(_0x1293f1){const _0xc5aab0=_0x3a83a9,_0x1482b1={'iyCjJ':function(_0xa060d4,_0x5c4ab4){return _0xa060d4===_0x5c4ab4;}};if(!_0x1293f1)return null;if(_0x1293f1[_0xc5aab0(0x168)])return _0x1293f1[_0xc5aab0(0x168)];const _0x5e2047=Object[_0xc5aab0(0x133)](_0x1293f1[_0xc5aab0(0x10a)]??{});if(_0x1482b1[_0xc5aab0(0x14f)](_0x5e2047['length'],0x1))return _0x5e2047[0x0];if(_0x1482b1[_0xc5aab0(0x14f)](_0x5e2047[_0xc5aab0(0x108)],0x0))return null;throw new Error('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x5e2047['join'](',\x20')+_0xc5aab0(0x163)+'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(_0x86772b=process[_0x3a83a9(0x12f)]){const _0x327eb0=_0x3a83a9,_0x282cd8={'YccEc':function(_0x4a2a57,_0xfdb744){return _0x4a2a57(_0xfdb744);},'IoBPJ':function(_0x1986cd,_0x9a2a1,_0x586430,_0x55a88c){return _0x1986cd(_0x9a2a1,_0x586430,_0x55a88c);}},_0x2bf704=_0x86772b['RANGER_TEST_USERNAME'];if(!_0x2bf704)return null;const _0x5c7ec0=await fetchCloudProfile(_0x2bf704);if(_0x5c7ec0)return{'name':_0x5c7ec0['name'],'profile':_0x5c7ec0};const _0x305c4c=await fetchAuthConfig(),_0x2cddfe=_0x282cd8[_0x327eb0(0x148)](pickAdHocEnvKey,_0x305c4c),_0x3aec18=_0x86772b[_0x327eb0(0x135)],_0x1faedc=await _0x282cd8[_0x327eb0(0x176)](createCloudProfile,_0x2bf704,_0x2cddfe??undefined,{'username':_0x2bf704,'password':_0x3aec18});return console[_0x327eb0(0x10c)](_0x327eb0(0x162)+_0x1faedc[_0x327eb0(0x172)]+_0x327eb0(0x118)+_0x2bf704),{'name':_0x1faedc[_0x327eb0(0x172)],'profile':_0x1faedc};}export async function writeSessionToLocalCache(_0x1536f6,_0x136ef8,_0x4d4d5b,_0x4f1a30,_0x56c02d,_0x481874,_0x57e82d){const _0x132082=_0x3a83a9,_0x15ff07={'LNhxZ':function(_0x11f36a,_0x2d61e2,_0x45aa7f){return _0x11f36a(_0x2d61e2,_0x45aa7f);},'BHTRQ':function(_0x4f82d8){return _0x4f82d8();},'JeyZE':function(_0x400d51,_0x3c9fa6){return _0x400d51(_0x3c9fa6);},'ZeKtM':function(_0x496f01,_0x4e9860,_0x2d6315){return _0x496f01(_0x4e9860,_0x2d6315);}},_0x417fc5=sessionCacheHash({'orgId':_0x136ef8,'profileName':_0x1536f6,'effectiveBaseUrl':_0x4d4d5b,'setupHeaders':_0x4f1a30,'invalidateOn':_0x57e82d?.['invalidateOn'],'userAgent':_0x57e82d?.[_0x132082(0x12a)],'clientIp':_0x57e82d?.['clientIp']}),_0x85bf5=getSessionCachePath(_0x417fc5,_0x1536f6),_0x4f7047=_0x15ff07['LNhxZ'](join,_0x15ff07['BHTRQ'](getRangerHomeDir),_0x132082(0xf6));!_0x15ff07['JeyZE'](existsSync,_0x4f7047)&&await _0x15ff07[_0x132082(0x10f)](mkdir,_0x4f7047,{'recursive':!![]});const _0xfc6e3d={..._0x56c02d};_0x481874&&_0x481874[_0x132082(0x108)]>0x0&&Array['isArray'](_0xfc6e3d[_0x132082(0x141)])&&(_0xfc6e3d[_0x132082(0x141)]=_0x15ff07[_0x132082(0x104)](duplicateCookiesForDomains,_0xfc6e3d[_0x132082(0x141)],_0x481874));const _0x104b0d={'cached_at':new Date()[_0x132082(0x158)](),'session_state':_0xfc6e3d};await _0x15ff07[_0x132082(0x104)](writeFile,_0x85bf5,JSON[_0x132082(0x131)](_0x104b0d,null,0x2));const _0x18d9ab=getStorageStatePath(_0x85bf5);return await _0x15ff07[_0x132082(0x10f)](writeFile,_0x18d9ab,JSON['stringify'](_0xfc6e3d,null,0x2)),_0x18d9ab;}export async function checkLocalCache(_0x54efcf,_0x59b59b,_0x302ef4,_0x50be82,_0x1083a2){const _0x11189f=_0x3a83a9,_0x2ff981={'zobMI':function(_0x4910e0,_0x33cf25){return _0x4910e0(_0x33cf25);},'uAyJu':function(_0x1fee21,_0x5198bc,_0x3e26fc){return _0x1fee21(_0x5198bc,_0x3e26fc);},'DERsY':function(_0x41b32e,_0x27b110){return _0x41b32e(_0x27b110);},'NYrmW':function(_0x6caad1,_0x8bfc5b,_0x19dae8){return _0x6caad1(_0x8bfc5b,_0x19dae8);},'oqfUd':'utf-8'},_0x5eb281=_0x2ff981['zobMI'](sessionCacheHash,{'orgId':_0x59b59b,'profileName':_0x54efcf,'effectiveBaseUrl':_0x302ef4,'setupHeaders':_0x50be82,'invalidateOn':_0x1083a2?.['invalidateOn'],'userAgent':_0x1083a2?.['userAgent'],'clientIp':_0x1083a2?.['clientIp']}),_0x50c83d=_0x2ff981[_0x11189f(0x15c)](getSessionCachePath,_0x5eb281,_0x54efcf),_0x47b90e=_0x2ff981[_0x11189f(0x11f)](getStorageStatePath,_0x50c83d);if(!existsSync(_0x50c83d)||!existsSync(_0x47b90e))return null;try{const _0x231e00=await _0x2ff981[_0x11189f(0x116)](readFile,_0x50c83d,_0x2ff981['oqfUd']);return JSON[_0x11189f(0xee)](_0x231e00),{'storageStatePath':_0x47b90e};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0xd9a7f3,_0x287431){const _0x7051f2=_0x3a83a9,_0x3dbee0={'yfbAK':function(_0x20fca0,_0x2f6a08){return _0x20fca0+_0x2f6a08;}};if(!_0x287431||!_0x287431[_0x7051f2(0x142)]?.[_0x7051f2(0x108)])return;let _0x3ec4bf;try{_0x3ec4bf=new URL(_0xd9a7f3);}catch{return;}const _0x3ee4b2=[];for(const _0x1bf349 of _0x287431[_0x7051f2(0x142)]){try{_0x3ee4b2['push']({'raw':_0x1bf349,'url':new URL(_0x1bf349)});}catch{}}if(_0x3ee4b2['length']===0x0)return;if(_0x3ee4b2['some'](_0x407cbd=>_0x407cbd['url'][_0x7051f2(0x119)]===_0x3ec4bf['origin']))return;const _0x4c5a7e=_0x3ee4b2[_0x7051f2(0x12d)](_0x4d20c1=>'\x22'+_0x4d20c1['raw']+'\x22')['join'](',\x20');console[_0x7051f2(0x10c)](_0x3dbee0['yfbAK'](_0x7051f2(0x16a)+_0x4c5a7e+';\x20','you\x27re\x20now\x20at\x20\x22'+_0xd9a7f3+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+_0x7051f2(0xed));}export async function serverSideLogin(_0x5618c4,_0x59b3c1){const _0x58ef2e=_0x3a83a9,_0x120cdc={'BDojl':function(_0x4671d1,_0x3f15ba,_0x5ecda6){return _0x4671d1(_0x3f15ba,_0x5ecda6);},'ogarm':_0x58ef2e(0x137)},_0x2f3843=process[_0x58ef2e(0x12f)][_0x58ef2e(0x152)],_0x213fc9=process[_0x58ef2e(0x12f)]['RANGER_TEST_PASSWORD'],_0x308500={};if(_0x2f3843)_0x308500[_0x58ef2e(0x154)]=_0x2f3843;if(_0x213fc9)_0x308500['password']=_0x213fc9;if(_0x59b3c1?.[_0x58ef2e(0x117)])_0x308500[_0x58ef2e(0x117)]=!![];if(_0x59b3c1?.[_0x58ef2e(0x113)])_0x308500[_0x58ef2e(0x115)]=_0x59b3c1[_0x58ef2e(0x113)];_0x59b3c1?.[_0x58ef2e(0x149)]&&(_0x308500['tunnel_session_id']=_0x59b3c1['tunnel'][_0x58ef2e(0x11d)],_0x308500['pw_endpoint']=_0x59b3c1[_0x58ef2e(0x149)]['pwEndpoint']);try{return await _0x120cdc['BDojl'](apiRequest,_0x58ef2e(0x150)+encodeURIComponent(_0x5618c4)+'/login',{'method':_0x120cdc[_0x58ef2e(0x139)],'body':JSON[_0x58ef2e(0x131)](_0x308500)});}catch(_0x26d4f1){if(_0x26d4f1 instanceof ApiError&&_0x26d4f1['status']===0x190&&_0x26d4f1[_0x58ef2e(0xec)]===_0x58ef2e(0x11b))return{'status':_0x58ef2e(0x11b),'error':_0x26d4f1['detail']};throw _0x26d4f1;}}async function serverSideLoginWithOptionalTunnel(_0x474ec2,_0x58addf,_0x26e980={}){const _0x489965=_0x3a83a9,_0x4b49b9={'cTpaA':function(_0x3a4f04,_0x3b36ab){return _0x3a4f04(_0x3b36ab);},'HkcwG':function(_0xe67c35){return _0xe67c35();}};if(!needsTunnel(_0x58addf))return await serverSideLogin(_0x474ec2,{'force':_0x26e980['force']});let _0x50e510=null,_0x2863a6=null,_0x882db=null;try{_0x50e510=await _0x4b49b9['cTpaA'](launchBrowserServer,{'headless':!![]}),_0x2863a6=await _0x4b49b9['cTpaA'](createTunnelSession,_0x58addf);const _0x2f783a=await _0x4b49b9[_0x489965(0x12e)](requireToken);return _0x882db=await createTunnelBridge({'localWsUrl':_0x50e510['wsEndpoint'],'tunnelServerUrl':_0x2863a6[_0x489965(0xfc)],'sessionId':_0x2863a6[_0x489965(0x11d)],'apiKey':_0x2f783a}),await serverSideLogin(_0x474ec2,{'force':_0x26e980[_0x489965(0x117)],'targetUrl':_0x58addf,'tunnel':{'sessionId':_0x2863a6['sessionId'],'pwEndpoint':_0x2863a6[_0x489965(0x134)]}});}finally{_0x882db?.['close'](),_0x50e510&&await _0x50e510[_0x489965(0x10b)]()[_0x489965(0x13c)](()=>{}),_0x2863a6&&await _0x4b49b9['cTpaA'](deleteTunnelSession,_0x2863a6[_0x489965(0x11d)])['catch'](()=>{});}}export async function manualBrowserLogin(_0x504fa4,_0x16e337,_0xf4119e={}){const _0x343109=_0x3a83a9,_0x24e8ba={'KBxUH':function(_0x5e288a){return _0x5e288a();},'cBbvp':function(_0x5b9ace,_0x1d09aa,_0x53e4d8){return _0x5b9ace(_0x1d09aa,_0x53e4d8);},'AuLcg':_0x343109(0x10b),'kVVik':function(_0x12b96c,_0x1dbde3){return _0x12b96c+_0x1dbde3;},'UPJoZ':_0x343109(0xfa),'YevbW':_0x343109(0x156),'wxSPv':function(_0x1cfd43,_0x21a055){return _0x1cfd43>_0x21a055;},'KXJfh':_0x343109(0x126),'zISbG':function(_0x295ecd,_0x44c219){return _0x295ecd(_0x44c219);},'rfgOd':function(_0x284893,_0x2eb81d){return _0x284893&&_0x2eb81d;},'hWGmg':_0x343109(0x106),'HZLCt':function(_0x44833e,_0x5a9510,_0x287436){return _0x44833e(_0x5a9510,_0x287436);}};if(!isInteractive())throw new Error(_0x24e8ba['kVVik'](_0x24e8ba[_0x343109(0x161)](_0x343109(0x165)+_0x504fa4[_0x343109(0x172)]+_0x343109(0xf8),_0x24e8ba['UPJoZ']),_0x24e8ba[_0x343109(0x146)]));const _0x31c582=_0x16e337&&_0x24e8ba[_0x343109(0xf9)](_0x16e337[_0x343109(0x142)][_0x343109(0x108)],0x0)?_0x16e337['domains'][0x0]:_0x24e8ba[_0x343109(0x16c)];console[_0x343109(0x10c)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console['log'](_0x343109(0x177)),await new Promise(_0x2434ea=>setTimeout(_0x2434ea,0x7d0));const _0x1ae9d2=await chromium['launch']({'headless':![]});let _0x5928b1=null;try{const _0x2611a3={'ignoreHTTPSErrors':!![]};_0x16e337?.[_0x343109(0x125)]&&(_0x2611a3[_0x343109(0x111)]=_0x16e337['setupHeaders']);const _0x216b7d=await _0x1ae9d2[_0x343109(0x101)](_0x2611a3);await _0x24e8ba[_0x343109(0xf7)](addProfileSetupBanner,_0x216b7d);const _0x550c0d=await _0x216b7d[_0x343109(0x130)]();await _0x550c0d['goto'](_0x31c582);let _0x1c7f55=![];await new Promise(_0x6c4e42=>{const _0x2a2539=_0x343109,_0x48f415={'xoZfk':function(_0x26b5f0){const _0x5afefa=_0x20a5;return _0x24e8ba[_0x5afefa(0x11c)](_0x26b5f0);},'aoDIq':function(_0x2498e3){return _0x2498e3();}},_0x2986a1=_0x24e8ba[_0x2a2539(0x174)](setTimeout,()=>{const _0x158e39=_0x2a2539;_0x1c7f55=!![],console['error']('Browser\x20login\x20timed\x20out\x20after\x20'+MANUAL_LOGIN_TIMEOUT_MS/0xea60+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x48f415[_0x158e39(0x15a)](_0x6c4e42);},MANUAL_LOGIN_TIMEOUT_MS);_0x550c0d['on'](_0x24e8ba['AuLcg'],async()=>{const _0x310aa9=_0x2a2539;clearTimeout(_0x2986a1);try{const _0x2dcc77=await _0x216b7d['storageState']();_0x5928b1=_0x2dcc77;}catch{}_0x48f415[_0x310aa9(0x171)](_0x6c4e42);});});if(_0x24e8ba[_0x343109(0xf0)](_0x1c7f55,!_0x5928b1))throw new Error(_0x24e8ba['hWGmg']);}finally{await _0x1ae9d2[_0x343109(0x10b)]()[_0x343109(0x13c)](()=>{});}if(!_0x5928b1)throw new Error(_0x343109(0x114));return _0xf4119e[_0x343109(0xf1)]!==![]&&await _0x24e8ba['HZLCt'](apiRequest,_0x343109(0x150)+_0x24e8ba[_0x343109(0xf7)](encodeURIComponent,_0x504fa4['name'])+'/session',{'method':_0x343109(0x137),'body':JSON[_0x343109(0x131)]({'session_state':_0x5928b1,'updated_by':'cli:manual-login'})}),{'sessionState':_0x5928b1};}export async function promptSaveCredentials(_0x378939){const _0x381114=_0x3a83a9,_0xda67d7={'wZGmg':function(_0x169896,_0x487827){return _0x169896||_0x487827;},'XMFDA':function(_0x5e243d,_0x34e92e,_0x42a255){return _0x5e243d(_0x34e92e,_0x42a255);},'RPFrk':function(_0x1a4bb4,_0x2aeaa2){return _0x1a4bb4(_0x2aeaa2);},'gXdDU':'PUT'},_0x1014e7=process[_0x381114(0x12f)]['RANGER_TEST_USERNAME'],_0xa8a385=process[_0x381114(0x12f)][_0x381114(0x135)];if(_0xda67d7['wZGmg'](!_0x1014e7,!_0xa8a385))return;if(!isInteractive())return;const {save:_0xdca2b8}=await _0x1ab9dd['prompt']([{'type':'confirm','name':_0x381114(0xf2),'message':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','default':![]}]);if(!_0xdca2b8)return;await _0xda67d7['XMFDA'](apiRequest,'/api/v1/profiles/'+_0xda67d7['RPFrk'](encodeURIComponent,_0x378939),{'method':_0xda67d7[_0x381114(0x13f)],'body':JSON['stringify']({'username':_0x1014e7,'password':_0xa8a385})}),console['log']('\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.');}export async function resolveCloudProfileSession(_0x253325,_0x310b04={}){const _0x7422b=_0x3a83a9,_0x5b3818={'oTarT':function(_0x4197cd,_0x51c785,_0x585215){return _0x4197cd(_0x51c785,_0x585215);},'wGLmJ':function(_0x469285,_0xf43982){return _0x469285===_0xf43982;},'YyIvs':function(_0xdc0550,_0x463a7f){return _0xdc0550||_0x463a7f;},'Jcadb':function(_0x1255b5,_0x5ee355){return _0x1255b5(_0x5ee355);},'qvBpp':function(_0x2d7869,_0x327d9a,_0x6f0600,_0x14e96f,_0x4fcb1b){return _0x2d7869(_0x327d9a,_0x6f0600,_0x14e96f,_0x4fcb1b);},'qMgDA':function(_0x5ba10c,_0x4f738c,_0x4d5977,_0x2d5a22,_0x1eba17,_0x515731,_0x465b88,_0x253303){return _0x5ba10c(_0x4f738c,_0x4d5977,_0x2d5a22,_0x1eba17,_0x515731,_0x465b88,_0x253303);},'Hqnfe':function(_0x5e0164,_0x51ff10,_0x345684,_0x2889b9,_0x4db1c0){return _0x5e0164(_0x51ff10,_0x345684,_0x2889b9,_0x4db1c0);},'PgkdG':function(_0xda5a8a,_0x395b38){return _0xda5a8a(_0x395b38);},'YgeEH':function(_0x4d2b69,_0x132dda){return _0x4d2b69(_0x132dda);},'imKPO':function(_0x27ded1,_0x346c78){return _0x27ded1===_0x346c78;},'IMXzH':_0x7422b(0x11b),'RhYgW':'success','iOBZO':'\x20\x20Login\x20successful.\x20Session\x20cached.','KAsxg':function(_0x34cd16,_0x4ccc0f){return _0x34cd16&&_0x4ccc0f;},'dQQmP':function(_0x5888f0,_0x1eb890){return _0x5888f0(_0x1eb890);},'KdPia':function(_0x913d85,_0x3dda7c,_0x3d4ce3,_0x137187){return _0x913d85(_0x3dda7c,_0x3d4ce3,_0x137187);}},_0x29efa4=_0x253325[_0x7422b(0x16d)]??{},_0x3324e4=await fetchAuthConfig(),_0x2e36e1=_0x3324e4?_0x5b3818['oTarT'](resolveAuthEnvironmentLocally,_0x3324e4,_0x253325['environmentKey']):null,_0x18d232=typeof _0x2e36e1?.[_0x7422b(0x13d)]===_0x7422b(0x15b)&&_0x2e36e1['loginInstructions']['trim']()?_0x2e36e1['loginInstructions']:undefined,_0x41af56=_0x5b3818['wGLmJ'](typeof _0x29efa4['loginInstructions'],_0x7422b(0x15b))&&_0x29efa4[_0x7422b(0x13d)]['trim']()?_0x29efa4['loginInstructions']:undefined,_0x4e68b6=_0x5b3818[_0x7422b(0x13b)](_0x41af56,!_0x18d232)?_0x29efa4:{..._0x29efa4,'loginInstructions':_0x18d232},_0x4e0144=Boolean(_0x4e68b6['loginInstructions']?.[_0x7422b(0x175)]()),_0x230c4e=_0x5b3818[_0x7422b(0x103)](Boolean,_0x29efa4['forceLogin']||_0x2e36e1?.['forceLogin']),_0x4f95ec=_0x2e36e1?.['domains'],_0x4d38eb=_0x29efa4[_0x7422b(0x125)],_0x1014fc=_0x4d38eb??_0x2e36e1?.['setupHeaders'],_0x14e9fb=_0x310b04[_0x7422b(0x15d)]??_0x29efa4[_0x7422b(0x14d)]??(_0x4f95ec&&_0x4f95ec['length']>0x0?_0x4f95ec[0x0]:''),_0x286ec2=_0x14e9fb?needsTunnel(_0x14e9fb):![],_0x574d7a={'invalidateOn':_0x2e36e1?.['invalidateOn'],'userAgent':_0x2e36e1?.[_0x7422b(0x121)]?.[_0x7422b(0x12a)]??_0x29efa4[_0x7422b(0x12a)]};_0x230c4e&&console['log']('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x253325[_0x7422b(0x172)]+_0x7422b(0x11a));if(!_0x230c4e){const _0x28334c=await checkLocalCache(_0x253325['name'],_0x253325[_0x7422b(0x159)],_0x14e9fb,_0x1014fc,_0x574d7a);if(_0x28334c){if(_0x14e9fb&&!_0x286ec2){const _0x8ef6ba=await _0x5b3818[_0x7422b(0x13e)](isCachedSessionLive,_0x28334c[_0x7422b(0x144)],_0x14e9fb,{'sessionCheckPath':_0x2e36e1?.[_0x7422b(0xf5)],'setupHeaders':_0x1014fc},{'launchBrowser':launchRealBrowser});if(_0x8ef6ba)return console[_0x7422b(0x10c)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x253325[_0x7422b(0x172)]+'\x22'),{'authPath':_0x28334c[_0x7422b(0x144)],'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};console[_0x7422b(0x10c)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x253325['name']+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x5b3818['oTarT'](emitSessionValidationHint,_0x14e9fb,_0x2e36e1);}else return _0x286ec2&&console[_0x7422b(0x10c)](_0x7422b(0x129)+_0x253325['name']+'\x22'),{'authPath':_0x28334c['storageStatePath'],'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};}}if(!_0x230c4e&&_0x253325['sessionState']){if(_0x286ec2)console['log'](_0x7422b(0x167)+_0x14e9fb+_0x7422b(0x122)+_0x253325[_0x7422b(0x172)]+'\x22');else{const _0x55126b=await _0x5b3818['qMgDA'](writeSessionToLocalCache,_0x253325[_0x7422b(0x172)],_0x253325[_0x7422b(0x159)],_0x14e9fb,_0x1014fc,_0x253325['sessionState'],_0x4f95ec,_0x574d7a);if(_0x14e9fb){const _0xaa4ce2=await _0x5b3818[_0x7422b(0x123)](isCachedSessionLive,_0x55126b,_0x14e9fb,{'sessionCheckPath':_0x2e36e1?.['sessionCheckPath'],'setupHeaders':_0x1014fc},{'launchBrowser':launchRealBrowser});if(_0xaa4ce2)return console['log'](_0x7422b(0x153)+_0x253325[_0x7422b(0x172)]+'\x22,\x20cached\x20locally'),{'authPath':_0x55126b,'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};console['log']('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x253325['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x5b3818['oTarT'](emitSessionValidationHint,_0x14e9fb,_0x2e36e1);}else return{'authPath':_0x55126b,'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};}}if(_0x4e0144)return console[_0x7422b(0x10c)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x253325['name']+_0x7422b(0x169)),{'authPath':undefined,'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};console[_0x7422b(0x10c)](_0x7422b(0x11e)+_0x253325[_0x7422b(0x172)]+'\x22,\x20attempting\x20login...');const _0x2729e8=_0x5b3818['PgkdG'](Boolean,process[_0x7422b(0x12f)]['RANGER_TEST_USERNAME'])&&Boolean(process[_0x7422b(0x12f)][_0x7422b(0x135)]),_0x18f6e3=_0x5b3818['YgeEH'](Boolean,_0x253325['username']);if(_0x2729e8||_0x18f6e3)try{const _0x2483a2=_0x14e9fb?await serverSideLoginWithOptionalTunnel(_0x253325[_0x7422b(0x172)],_0x14e9fb,{'force':_0x230c4e}):await serverSideLogin(_0x253325[_0x7422b(0x172)],{'force':_0x230c4e});if(_0x5b3818['imKPO'](_0x2483a2['status'],_0x5b3818['IMXzH']))console['log'](_0x7422b(0x15f));else{if(_0x2483a2['status']===_0x5b3818[_0x7422b(0xfe)]&&_0x2483a2[_0x7422b(0x128)]){console['log'](_0x5b3818[_0x7422b(0x160)]);const _0x5cca42=await writeSessionToLocalCache(_0x253325['name'],_0x253325[_0x7422b(0x159)],_0x14e9fb,_0x1014fc,_0x2483a2[_0x7422b(0x128)],_0x4f95ec,_0x574d7a);return _0x5b3818[_0x7422b(0x127)](_0x2729e8,!_0x18f6e3)&&await promptSaveCredentials(_0x253325['name']),{'authPath':_0x5cca42,'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};}else _0x2483a2[_0x7422b(0x102)]&&(console[_0x7422b(0x10c)]('\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:'),console[_0x7422b(0x10c)](_0x2483a2['test_output'])),console['log'](_0x7422b(0x14e));}}catch(_0x16f7a5){console[_0x7422b(0x10c)](_0x7422b(0xfb)+(_0x16f7a5 instanceof Error?_0x16f7a5[_0x7422b(0x147)]:_0x5b3818['dQQmP'](String,_0x16f7a5))),console[_0x7422b(0x10c)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}const _0x466500=_0x2e36e1?{..._0x2e36e1,'setupHeaders':_0x1014fc}:_0x14e9fb?{'key':_0x253325[_0x7422b(0x13a)]??'','domains':[_0x14e9fb],'setupHeaders':_0x1014fc}:null,{sessionState:_0x767afd}=await _0x5b3818[_0x7422b(0x143)](manualBrowserLogin,_0x253325,_0x466500,{'persistSessionState':!_0x286ec2}),_0x5b7198=await writeSessionToLocalCache(_0x253325[_0x7422b(0x172)],_0x253325[_0x7422b(0x159)],_0x14e9fb,_0x1014fc,_0x767afd,_0x4f95ec,_0x574d7a);return{'authPath':_0x5b7198,'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};}
1
+ const _0x267a7c=_0x5d69;(function(_0xace33e,_0x196374){const _0x47cc26=_0x5d69,_0x2bf79f=_0xace33e();while(!![]){try{const _0x3e09fe=parseInt(_0x47cc26(0x19c))/0x1*(parseInt(_0x47cc26(0x144))/0x2)+-parseInt(_0x47cc26(0x170))/0x3*(parseInt(_0x47cc26(0x165))/0x4)+-parseInt(_0x47cc26(0x1ab))/0x5*(parseInt(_0x47cc26(0x175))/0x6)+parseInt(_0x47cc26(0x164))/0x7*(-parseInt(_0x47cc26(0x17f))/0x8)+parseInt(_0x47cc26(0x17a))/0x9+-parseInt(_0x47cc26(0x159))/0xa+parseInt(_0x47cc26(0x1a8))/0xb*(parseInt(_0x47cc26(0x1ad))/0xc);if(_0x3e09fe===_0x196374)break;else _0x2bf79f['push'](_0x2bf79f['shift']());}catch(_0x45f647){_0x2bf79f['push'](_0x2bf79f['shift']());}}}(_0xfa94,0xf2324));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x3cdd1a from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x469649=await getToken();if(!_0x469649)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');return _0x469649;}async function apiRequest(_0x3ec3e5,_0xbffa8c={}){const _0x180d55=_0x5d69,_0x3c82aa={'Heyze':function(_0x51c318,_0x389db5){return _0x51c318===_0x389db5;},'ezdus':_0x180d55(0x169)},_0x26309f=await requireToken(),_0x365590=getApiBaseUrl(),_0x560f4f=await fetch(''+_0x365590+_0x3ec3e5,{..._0xbffa8c,'headers':{'Authorization':'Bearer\x20'+_0x26309f,'Content-Type':'application/json',..._0xbffa8c['headers']??{}}});if(!_0x560f4f['ok']){let _0xb2b4f='',_0x57eb0a;try{const _0x43b49c=await _0x560f4f[_0x180d55(0x1bc)]();_0xb2b4f=(_0x3c82aa['Heyze'](typeof _0x43b49c['error'],_0x3c82aa[_0x180d55(0x174)])?_0x43b49c['error']:undefined)??JSON['stringify'](_0x43b49c);if(typeof _0x43b49c[_0x180d55(0x15f)]===_0x3c82aa[_0x180d55(0x174)])_0x57eb0a=_0x43b49c[_0x180d55(0x15f)];}catch{_0xb2b4f=_0x560f4f[_0x180d55(0x1c6)];}throw new ApiError('API\x20request\x20'+_0x3ec3e5+'\x20failed\x20('+_0x560f4f['status']+_0x180d55(0x177)+_0xb2b4f,_0x560f4f['status'],_0xb2b4f,_0x57eb0a);}if(_0x3c82aa['Heyze'](_0x560f4f['status'],0xcc))return undefined;return _0x560f4f['json']();}export class ApiError extends Error{['status'];[_0x267a7c(0x19b)];[_0x267a7c(0x15f)];constructor(_0x4898bd,_0x3f712d,_0x3a5717,_0x176262){const _0x2fcc6c=_0x267a7c,_0x52c747={'NkGiV':_0x2fcc6c(0x162)};super(_0x4898bd),this[_0x2fcc6c(0x151)]=_0x3f712d,this['detail']=_0x3a5717,this[_0x2fcc6c(0x15f)]=_0x176262,this['name']=_0x52c747['NkGiV'];}}export async function fetchCloudProfile(_0x2ddb2a){const _0x40905c=_0x267a7c,_0x263908={'NVvnr':function(_0x278a46,_0x28c657){return _0x278a46(_0x28c657);},'qmewB':function(_0x5ee238,_0x22b4b3){return _0x5ee238(_0x22b4b3);},'GZvJl':function(_0x3504c7,_0x3fabd0){return _0x3504c7 instanceof _0x3fabd0;}};try{return await _0x263908['NVvnr'](apiRequest,_0x40905c(0x1c4)+_0x263908[_0x40905c(0x16c)](encodeURIComponent,_0x2ddb2a));}catch(_0x4079ea){if(_0x263908['GZvJl'](_0x4079ea,ApiError)&&_0x4079ea[_0x40905c(0x151)]===0x194)return null;throw _0x4079ea;}}export async function listCloudProfiles(){const _0xed4776=_0x267a7c,_0x547be8={'xsWTj':_0xed4776(0x18c)},_0x4357d9=await apiRequest(_0x547be8[_0xed4776(0x191)]);return _0x4357d9[_0xed4776(0x16d)];}export async function deleteCloudProfile(_0xd67576){const _0x5644e2=_0x267a7c,_0x5956db={'XGiCY':function(_0x2163e6,_0x3b28a4,_0x30c805){return _0x2163e6(_0x3b28a4,_0x30c805);},'CwzeG':'DELETE'};try{await _0x5956db['XGiCY'](apiRequest,_0x5644e2(0x1c4)+encodeURIComponent(_0xd67576),{'method':_0x5956db['CwzeG']});}catch(_0x507c16){if(_0x507c16 instanceof ApiError&&_0x507c16[_0x5644e2(0x151)]===0x194)throw new Error('Cloud\x20profile\x20\x22'+_0xd67576+_0x5644e2(0x194));throw _0x507c16;}}export async function createCloudProfile(_0x2401fc,_0xd848e3,_0x123018={}){const _0x724e73=_0x267a7c,_0x585746={'lKyDC':function(_0x3ba6b5,_0x298d3e){return _0x3ba6b5>_0x298d3e;},'ILFTz':function(_0x21b623,_0x36212d,_0x2ef8be){return _0x21b623(_0x36212d,_0x2ef8be);},'MpuOs':_0x724e73(0x18c),'ILjVn':'POST'},_0x6f93eb={'name':_0x2401fc};if(_0xd848e3)_0x6f93eb['environment_key']=_0xd848e3;_0x123018[_0x724e73(0x18d)]&&_0x585746[_0x724e73(0x161)](Object['keys'](_0x123018[_0x724e73(0x18d)])['length'],0x0)&&(_0x6f93eb[_0x724e73(0x18d)]=_0x123018['settings']);if(_0x123018[_0x724e73(0x14d)])_0x6f93eb[_0x724e73(0x14d)]=_0x123018[_0x724e73(0x14d)];if(_0x123018[_0x724e73(0x1b8)])_0x6f93eb['password']=_0x123018[_0x724e73(0x1b8)];return await _0x585746['ILFTz'](apiRequest,_0x585746['MpuOs'],{'method':_0x585746[_0x724e73(0x190)],'body':JSON[_0x724e73(0x1a3)](_0x6f93eb)});}function _0xfa94(){const _0x2daae8=['error','tunnelUrl','origin','ezdus','496938NZQolg','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','):\x20','forceLogin','catch','461394VHiRTx','ILQuo','XyfLZ','domains','nBuht','50392dvMSzm','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','xYNuN','map','isArray','cCZJi','utf-8','/api/v1/profiles/auth-config','clientIp','lCYSe','ZFKEg','\x20\x20No\x20live\x20session\x20for\x20\x22','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','/api/v1/profiles','settings','wsEndpoint','AmZiq','ILjVn','xsWTj','RANGER_TEST_USERNAME','newContext','\x22\x20not\x20found.','log','auth','\x22,\x20refreshing\x20session...','effectiveBaseUrl','environmentKey','nMFkg','detail','1WnFPUC','niMeh','OXqWQ','organizationId','ZdEVr','storageStatePath','toISOString','stringify','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','userAgent','session_state','bwqlq','36760999nWgFyo','HFHdg','POST','10WeyHlL','close','12Krhbjv','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','invalidateOn','raw','save','trim','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','Browser\x20login\x20timed\x20out\x20before\x20completion.','confirm','target_url',').\x20','password','not_configured','name','prompt','json','EtdBY','\x22\x20on\x20profile\x20\x22','you\x27re\x20now\x20at\x20\x22','loginInstructions','length','hHpmx','xGeAn','/api/v1/profiles/','BZIMK','statusText','setupHeaders','164690gfHATM','RANGER_TEST_PASSWORD','sessionCheckPath','Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.','dvvKc','\x20\x20Cloud\x20session\x20for\x20\x22','bEjrx','pwEndpoint','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','username','test_output','Gtcke','Browser\x20login\x20timed\x20out\x20after\x20','status','sessionId','force','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','tunnel','\x22,\x20cached\x20locally','targetUrl','5806520nHixcB','gRkmu','\x22;\x20proceeding\x20with\x20loginInstructions.','env','/api/v1/tunnel/sessions','parse','code','\x20\x20forceLogin\x20enabled\x20for\x20\x22','lKyDC','ApiError','launch','994uYCwsb','32DYHYDd','RFCqC','join','\x22\x20failed\x20validation\x20—\x20refreshing...','string','OCwQZ','zwsKE','qmewB','profiles','qgpYE','message','316023fakDdT'];_0xfa94=function(){return _0x2daae8;};return _0xfa94();}export async function uploadCloudProfileSession(_0x4c67f7,_0x571296){const _0x2b6a90=_0x267a7c;return await apiRequest(_0x2b6a90(0x1c4)+encodeURIComponent(_0x4c67f7)+'/session',{'method':'POST','body':JSON[_0x2b6a90(0x1a3)]({'session_state':_0x571296})});}export async function saveCloudProfileCredentials(_0x1290cc,_0x3509f5,_0x500d3f){await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x1290cc),{'method':'PUT','body':JSON['stringify']({'username':_0x3509f5,'password':_0x500d3f})});}export async function fetchAuthConfig(){const _0x5783ee=_0x267a7c,_0x1eca38={'xYNuN':function(_0x1117ec,_0x1d865a){return _0x1117ec(_0x1d865a);}};try{const _0x5ae3d9=await _0x1eca38[_0x5783ee(0x181)](apiRequest,_0x5783ee(0x186));return _0x5ae3d9['auth_config'];}catch(_0x44be34){return _0x44be34 instanceof ApiError&&_0x44be34[_0x5783ee(0x151)]!==0x194&&console['error']('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x44be34[_0x5783ee(0x16f)]),null;}}async function createTunnelSession(_0x5a198d){const _0x16cd50=_0x267a7c,_0x2b335e={'XyfLZ':function(_0xc7b812,_0x3a27e4,_0x2029b7){return _0xc7b812(_0x3a27e4,_0x2029b7);},'fsnMc':_0x16cd50(0x15d),'JUZwJ':_0x16cd50(0x1aa),'OCwQZ':'agent'};return await _0x2b335e[_0x16cd50(0x17c)](apiRequest,_0x2b335e['fsnMc'],{'method':_0x2b335e['JUZwJ'],'body':JSON['stringify']({'targetUrl':_0x5a198d,'mode':_0x2b335e[_0x16cd50(0x16a)]})});}async function deleteTunnelSession(_0x21e329){await apiRequest('/api/v1/tunnel/sessions/'+_0x21e329,{'method':'DELETE'});}export function pickAdHocEnvKey(_0x1e6874){const _0x2f2885=_0x267a7c,_0x192455={'fDPEC':function(_0x265cd3,_0x39fa34){return _0x265cd3+_0x39fa34;}};if(!_0x1e6874)return null;if(_0x1e6874['defaultEnvironmentKey'])return _0x1e6874['defaultEnvironmentKey'];const _0x3195dd=Object['keys'](_0x1e6874['environments']??{});if(_0x3195dd['length']===0x1)return _0x3195dd[0x0];if(_0x3195dd[_0x2f2885(0x1c1)]===0x0)return null;throw new Error(_0x192455['fDPEC']('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x3195dd['join'](',\x20')+_0x2f2885(0x1b7),_0x2f2885(0x147)));}export async function resolveAdHocProfile(_0x126ed9=process[_0x267a7c(0x15c)]){const _0x3f81a3=_0x267a7c,_0x456e8c={'OXqWQ':function(_0x10a185,_0x5e15d2){return _0x10a185(_0x5e15d2);},'aAEKN':function(_0x4dd669){return _0x4dd669();},'yOLBI':function(_0x251a3f,_0x2e5bf7){return _0x251a3f(_0x2e5bf7);},'hHpmx':function(_0x1d96b6,_0x2dbbda,_0x5b0e23,_0x4429d2){return _0x1d96b6(_0x2dbbda,_0x5b0e23,_0x4429d2);},'iAtyU':function(_0xbbe4dc,_0x1b3f2d){return _0xbbe4dc??_0x1b3f2d;}},_0x42624c=_0x126ed9[_0x3f81a3(0x192)];if(!_0x42624c)return null;const _0x4e0895=await _0x456e8c[_0x3f81a3(0x19e)](fetchCloudProfile,_0x42624c);if(_0x4e0895)return{'name':_0x4e0895['name'],'profile':_0x4e0895};const _0x240e00=await _0x456e8c['aAEKN'](fetchAuthConfig),_0x57493b=_0x456e8c['yOLBI'](pickAdHocEnvKey,_0x240e00),_0x1d9686=_0x126ed9['RANGER_TEST_PASSWORD'],_0x2a4bdf=await _0x456e8c[_0x3f81a3(0x1c2)](createCloudProfile,_0x42624c,_0x456e8c['iAtyU'](_0x57493b,undefined),{'username':_0x42624c,'password':_0x1d9686});return console['log']('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x2a4bdf['name']+'\x22\x20for\x20'+_0x42624c),{'name':_0x2a4bdf['name'],'profile':_0x2a4bdf};}export async function writeSessionToLocalCache(_0x3ab5e4,_0x4a2dc5,_0x24500d,_0xfda121,_0x5c79a0,_0x241c95,_0x24f4d5){const _0x3fbdf7=_0x267a7c,_0x557bb5={'IHSHk':function(_0xa862e6,_0x1006d1){return _0xa862e6(_0x1006d1);},'IiQzG':function(_0x559d53,_0x10f3d7,_0x40433d){return _0x559d53(_0x10f3d7,_0x40433d);},'HgIMz':function(_0xe1c492){return _0xe1c492();},'xGeAn':_0x3fbdf7(0x196),'XaAAg':function(_0x3b5b08,_0x57b101){return _0x3b5b08>_0x57b101;},'NLKSv':function(_0x15f0db,_0x3b9344,_0x3cd408){return _0x15f0db(_0x3b9344,_0x3cd408);},'FSooH':function(_0x13201d,_0x4b1d8b,_0x27487b){return _0x13201d(_0x4b1d8b,_0x27487b);},'fRerm':function(_0x153db5,_0x1c1242,_0x10f573){return _0x153db5(_0x1c1242,_0x10f573);}},_0x5b8e92=_0x557bb5['IHSHk'](sessionCacheHash,{'orgId':_0x4a2dc5,'profileName':_0x3ab5e4,'effectiveBaseUrl':_0x24500d,'setupHeaders':_0xfda121,'invalidateOn':_0x24f4d5?.[_0x3fbdf7(0x1af)],'userAgent':_0x24f4d5?.['userAgent'],'clientIp':_0x24f4d5?.[_0x3fbdf7(0x187)]}),_0x3cd23b=_0x557bb5['IiQzG'](getSessionCachePath,_0x5b8e92,_0x3ab5e4),_0x1d1a3c=join(_0x557bb5['HgIMz'](getRangerHomeDir),_0x557bb5[_0x3fbdf7(0x1c3)]);!_0x557bb5['IHSHk'](existsSync,_0x1d1a3c)&&await mkdir(_0x1d1a3c,{'recursive':!![]});const _0x3f0c76={..._0x5c79a0};_0x241c95&&_0x557bb5['XaAAg'](_0x241c95['length'],0x0)&&Array[_0x3fbdf7(0x183)](_0x3f0c76['cookies'])&&(_0x3f0c76['cookies']=_0x557bb5['NLKSv'](duplicateCookiesForDomains,_0x3f0c76['cookies'],_0x241c95));const _0x900f4={'cached_at':new Date()[_0x3fbdf7(0x1a2)](),'session_state':_0x3f0c76};await _0x557bb5['FSooH'](writeFile,_0x3cd23b,JSON['stringify'](_0x900f4,null,0x2));const _0x1797b2=getStorageStatePath(_0x3cd23b);return await _0x557bb5['fRerm'](writeFile,_0x1797b2,JSON[_0x3fbdf7(0x1a3)](_0x3f0c76,null,0x2)),_0x1797b2;}export async function checkLocalCache(_0xfd2b89,_0x4eae7e,_0x11b39b,_0x3251eb,_0x2ce630){const _0x511c08=_0x267a7c,_0x54cd82={'EtdBY':function(_0x164c8f,_0x188713){return _0x164c8f(_0x188713);},'oOsiz':function(_0x5d29f3,_0x54bec5,_0x440fb8){return _0x5d29f3(_0x54bec5,_0x440fb8);},'ycBcv':function(_0x397f66,_0x277888){return _0x397f66(_0x277888);},'FgQMo':function(_0x3b6e45,_0x83308b){return _0x3b6e45(_0x83308b);}},_0x458db6=_0x54cd82[_0x511c08(0x1bd)](sessionCacheHash,{'orgId':_0x4eae7e,'profileName':_0xfd2b89,'effectiveBaseUrl':_0x11b39b,'setupHeaders':_0x3251eb,'invalidateOn':_0x2ce630?.[_0x511c08(0x1af)],'userAgent':_0x2ce630?.['userAgent'],'clientIp':_0x2ce630?.[_0x511c08(0x187)]}),_0x3de158=_0x54cd82['oOsiz'](getSessionCachePath,_0x458db6,_0xfd2b89),_0x3ca207=_0x54cd82['EtdBY'](getStorageStatePath,_0x3de158);if(!_0x54cd82['ycBcv'](existsSync,_0x3de158)||!_0x54cd82['FgQMo'](existsSync,_0x3ca207))return null;try{const _0xfd994b=await _0x54cd82['oOsiz'](readFile,_0x3de158,_0x511c08(0x185));return JSON[_0x511c08(0x15e)](_0xfd994b),{'storageStatePath':_0x3ca207};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x1eec42,_0xdb4f8c){const _0x4ce480=_0x267a7c,_0x489fc6={'TiUzc':function(_0x3ca35b,_0xb81b73){return _0x3ca35b===_0xb81b73;},'dEZoj':function(_0x3495ff,_0x8da2be){return _0x3495ff+_0x8da2be;}};if(!_0xdb4f8c||!_0xdb4f8c['domains']?.['length'])return;let _0x51e155;try{_0x51e155=new URL(_0x1eec42);}catch{return;}const _0x1d6724=[];for(const _0xa3d34c of _0xdb4f8c[_0x4ce480(0x17d)]){try{_0x1d6724['push']({'raw':_0xa3d34c,'url':new URL(_0xa3d34c)});}catch{}}if(_0x489fc6['TiUzc'](_0x1d6724['length'],0x0))return;if(_0x1d6724['some'](_0x220c4c=>_0x220c4c['url'][_0x4ce480(0x173)]===_0x51e155['origin']))return;const _0x3b9df8=_0x1d6724[_0x4ce480(0x182)](_0x5c5571=>'\x22'+_0x5c5571[_0x4ce480(0x1b0)]+'\x22')[_0x4ce480(0x167)](',\x20');console['log'](_0x489fc6['dEZoj']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x3b9df8+';\x20',_0x4ce480(0x1bf)+_0x1eec42+_0x4ce480(0x14c))+_0x4ce480(0x1ae));}export async function serverSideLogin(_0x17ca33,_0x1c8b7b){const _0x342c45=_0x267a7c,_0x2ee7ae={'zwsKE':function(_0x4a4805,_0x3e7b34,_0x129a8f){return _0x4a4805(_0x3e7b34,_0x129a8f);},'WXWgP':function(_0x934022,_0xfdc4c2){return _0x934022(_0xfdc4c2);},'vbONL':function(_0x37428f,_0x513152){return _0x37428f instanceof _0x513152;}},_0x29815a=process['env']['RANGER_TEST_USERNAME'],_0x3acbc9=process['env'][_0x342c45(0x145)],_0x2134b4={};if(_0x29815a)_0x2134b4[_0x342c45(0x14d)]=_0x29815a;if(_0x3acbc9)_0x2134b4['password']=_0x3acbc9;if(_0x1c8b7b?.[_0x342c45(0x153)])_0x2134b4[_0x342c45(0x153)]=!![];if(_0x1c8b7b?.['targetUrl'])_0x2134b4[_0x342c45(0x1b6)]=_0x1c8b7b[_0x342c45(0x158)];_0x1c8b7b?.['tunnel']&&(_0x2134b4['tunnel_session_id']=_0x1c8b7b[_0x342c45(0x156)]['sessionId'],_0x2134b4['pw_endpoint']=_0x1c8b7b['tunnel'][_0x342c45(0x14b)]);try{return await _0x2ee7ae[_0x342c45(0x16b)](apiRequest,'/api/v1/profiles/'+_0x2ee7ae['WXWgP'](encodeURIComponent,_0x17ca33)+'/login',{'method':'POST','body':JSON['stringify'](_0x2134b4)});}catch(_0x38063b){if(_0x2ee7ae['vbONL'](_0x38063b,ApiError)&&_0x38063b[_0x342c45(0x151)]===0x190&&_0x38063b['code']===_0x342c45(0x1b9))return{'status':'not_configured','error':_0x38063b[_0x342c45(0x19b)]};throw _0x38063b;}}function _0x5d69(_0x3527e6,_0x4b6ef2){_0x3527e6=_0x3527e6-0x143;const _0xfa949=_0xfa94();let _0x5d69d5=_0xfa949[_0x3527e6];return _0x5d69d5;}async function serverSideLoginWithOptionalTunnel(_0x2c918a,_0x3e5eb2,_0x6f4af1={}){const _0x2b67f4=_0x267a7c,_0x26746e={'HFHdg':function(_0x1b7665,_0x2eb00f){return _0x1b7665(_0x2eb00f);},'ILQuo':function(_0x26ca1e,_0x232283,_0x193690){return _0x26ca1e(_0x232283,_0x193690);},'KAdgx':function(_0x320d8a,_0x4027ee){return _0x320d8a(_0x4027ee);}};if(!_0x26746e['HFHdg'](needsTunnel,_0x3e5eb2))return await _0x26746e['ILQuo'](serverSideLogin,_0x2c918a,{'force':_0x6f4af1['force']});let _0xe96b9d=null,_0x548026=null,_0x3dbfed=null;try{_0xe96b9d=await _0x26746e['HFHdg'](launchBrowserServer,{'headless':!![]}),_0x548026=await _0x26746e['KAdgx'](createTunnelSession,_0x3e5eb2);const _0x2b32fa=await requireToken();return _0x3dbfed=await _0x26746e[_0x2b67f4(0x1a9)](createTunnelBridge,{'localWsUrl':_0xe96b9d[_0x2b67f4(0x18e)],'tunnelServerUrl':_0x548026[_0x2b67f4(0x172)],'sessionId':_0x548026[_0x2b67f4(0x152)],'apiKey':_0x2b32fa}),await _0x26746e[_0x2b67f4(0x17b)](serverSideLogin,_0x2c918a,{'force':_0x6f4af1[_0x2b67f4(0x153)],'targetUrl':_0x3e5eb2,'tunnel':{'sessionId':_0x548026['sessionId'],'pwEndpoint':_0x548026['pwEndpoint']}});}finally{_0x3dbfed?.[_0x2b67f4(0x1ac)](),_0xe96b9d&&await _0xe96b9d[_0x2b67f4(0x1ac)]()[_0x2b67f4(0x179)](()=>{}),_0x548026&&await deleteTunnelSession(_0x548026[_0x2b67f4(0x152)])[_0x2b67f4(0x179)](()=>{});}}export async function manualBrowserLogin(_0x563d67,_0x2561da,_0x2f73d5={}){const _0x589517=_0x267a7c,_0x2767f5={'zKNMT':function(_0x238de0,_0x50e12f){return _0x238de0/_0x50e12f;},'qgpYE':function(_0x4b4635,_0x47d23c,_0x37e6b1){return _0x4b4635(_0x47d23c,_0x37e6b1);},'vBTfJ':function(_0x1b2c81){return _0x1b2c81();},'hHapX':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','gRkmu':function(_0xc9c5f3,_0x2f6d65){return _0xc9c5f3>_0x2f6d65;},'nMFkg':'about:blank','dvvKc':_0x589517(0x18b),'cCZJi':function(_0x2cecaa,_0x3e4f2b){return _0x2cecaa(_0x3e4f2b);}};if(!_0x2767f5['vBTfJ'](isInteractive))throw new Error('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x563d67[_0x589517(0x1ba)]+'\x22.\x0a'+'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20'+_0x2767f5['hHapX']);const _0x42f6f7=_0x2561da&&_0x2767f5[_0x589517(0x15a)](_0x2561da['domains']['length'],0x0)?_0x2561da['domains'][0x0]:_0x2767f5[_0x589517(0x19a)];console['log'](_0x2767f5[_0x589517(0x148)]),console[_0x589517(0x195)]('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0xdbd52f=>setTimeout(_0xdbd52f,0x7d0));const _0x5e95c6=await chromium[_0x589517(0x163)]({'headless':![]});let _0x47bacf=null;try{const _0x4bc88c={'ignoreHTTPSErrors':!![]};_0x2561da?.[_0x589517(0x143)]&&(_0x4bc88c['extraHTTPHeaders']=_0x2561da[_0x589517(0x143)]);const _0x56ea67=await _0x5e95c6[_0x589517(0x193)](_0x4bc88c);await _0x2767f5[_0x589517(0x184)](addProfileSetupBanner,_0x56ea67);const _0x55e338=await _0x56ea67['newPage']();await _0x55e338['goto'](_0x42f6f7);let _0x25b843=![];await new Promise(_0x1a3a25=>{const _0x31dac1=_0x589517,_0x57c86={'lCYSe':function(_0x2a0e94,_0x3cc25b){return _0x2767f5['zKNMT'](_0x2a0e94,_0x3cc25b);},'RFCqC':function(_0x227c4c){return _0x227c4c();}},_0x59efce=_0x2767f5[_0x31dac1(0x16e)](setTimeout,()=>{const _0x1e85d0=_0x31dac1;_0x25b843=!![],console[_0x1e85d0(0x171)](_0x1e85d0(0x150)+_0x57c86[_0x1e85d0(0x188)](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x57c86[_0x1e85d0(0x166)](_0x1a3a25);},MANUAL_LOGIN_TIMEOUT_MS);_0x55e338['on']('close',async()=>{clearTimeout(_0x59efce);try{const _0x53d4de=await _0x56ea67['storageState']();_0x47bacf=_0x53d4de;}catch{}_0x1a3a25();});});if(_0x25b843&&!_0x47bacf)throw new Error(_0x589517(0x1b4));}finally{await _0x5e95c6[_0x589517(0x1ac)]()['catch'](()=>{});}if(!_0x47bacf)throw new Error('Browser\x20closed\x20before\x20authentication\x20was\x20saved.');return _0x2f73d5['persistSessionState']!==![]&&await _0x2767f5['qgpYE'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x563d67[_0x589517(0x1ba)])+'/session',{'method':'POST','body':JSON['stringify']({'session_state':_0x47bacf,'updated_by':'cli:manual-login'})}),{'sessionState':_0x47bacf};}export async function promptSaveCredentials(_0x4e2bdf){const _0x41c882=_0x267a7c,_0x208133={'vskYL':function(_0x5b00ea,_0x155cb3){return _0x5b00ea||_0x155cb3;},'bwqlq':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','UQlxZ':function(_0x50c86a,_0x2ec96e,_0x1dde79){return _0x50c86a(_0x2ec96e,_0x1dde79);},'Gtcke':function(_0x130316,_0x586347){return _0x130316(_0x586347);}},_0x1ce4d5=process[_0x41c882(0x15c)][_0x41c882(0x192)],_0x56007b=process[_0x41c882(0x15c)]['RANGER_TEST_PASSWORD'];if(_0x208133['vskYL'](!_0x1ce4d5,!_0x56007b))return;if(!isInteractive())return;const {save:_0x57d5fe}=await _0x3cdd1a[_0x41c882(0x1bb)]([{'type':_0x41c882(0x1b5),'name':_0x41c882(0x1b1),'message':_0x208133[_0x41c882(0x1a7)],'default':![]}]);if(!_0x57d5fe)return;await _0x208133['UQlxZ'](apiRequest,_0x41c882(0x1c4)+_0x208133[_0x41c882(0x14f)](encodeURIComponent,_0x4e2bdf),{'method':'PUT','body':JSON['stringify']({'username':_0x1ce4d5,'password':_0x56007b})}),console[_0x41c882(0x195)](_0x41c882(0x1b3));}export async function resolveCloudProfileSession(_0x1aa68f,_0x3160f8={}){const _0x2aaa34=_0x267a7c,_0x2c7698={'ZFKEg':function(_0x14e6df,_0x2e39af){return _0x14e6df===_0x2e39af;},'niMeh':function(_0x56d736,_0x44e3e8){return _0x56d736(_0x44e3e8);},'nBuht':function(_0x373c4f,_0x139eb2){return _0x373c4f>_0x139eb2;},'SugkM':function(_0xbedfa9,_0x30980e,_0x4e26a6,_0x2cb200,_0xaf18bc){return _0xbedfa9(_0x30980e,_0x4e26a6,_0x2cb200,_0xaf18bc);},'ZdEVr':function(_0x285255,_0x4a1cd3,_0x408308){return _0x285255(_0x4a1cd3,_0x408308);},'RqDTN':function(_0x3e6fdd,_0x3ab4d6,_0x556920,_0x2a1cb9,_0x90cd1c){return _0x3e6fdd(_0x3ab4d6,_0x556920,_0x2a1cb9,_0x90cd1c);},'BZIMK':'not_configured','oCAKY':'\x20\x20Login\x20successful.\x20Session\x20cached.','AmZiq':_0x2aaa34(0x1a4),'ipIWv':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','bEjrx':function(_0x26aaac,_0x39c0f6){return _0x26aaac(_0x39c0f6);},'wXxle':function(_0x3b1cbd,_0x75f85,_0x304231,_0x579f97){return _0x3b1cbd(_0x75f85,_0x304231,_0x579f97);},'rfCRl':function(_0xa3ce58,_0x134323,_0x56dcac,_0x56ae8a,_0x4f8ff6,_0x1babbe,_0x2fb848,_0x192603){return _0xa3ce58(_0x134323,_0x56dcac,_0x56ae8a,_0x4f8ff6,_0x1babbe,_0x2fb848,_0x192603);}},_0x59efb1=_0x1aa68f[_0x2aaa34(0x18d)]??{},_0x3b82f5=await fetchAuthConfig(),_0x27a108=_0x3b82f5?resolveAuthEnvironmentLocally(_0x3b82f5,_0x1aa68f['environmentKey']):null,_0x5f405a=typeof _0x27a108?.[_0x2aaa34(0x1c0)]===_0x2aaa34(0x169)&&_0x27a108['loginInstructions'][_0x2aaa34(0x1b2)]()?_0x27a108['loginInstructions']:undefined,_0x444f9a=_0x2c7698[_0x2aaa34(0x189)](typeof _0x59efb1[_0x2aaa34(0x1c0)],'string')&&_0x59efb1['loginInstructions']['trim']()?_0x59efb1[_0x2aaa34(0x1c0)]:undefined,_0x1f13c9=_0x444f9a||!_0x5f405a?_0x59efb1:{..._0x59efb1,'loginInstructions':_0x5f405a},_0x4cad8b=_0x2c7698[_0x2aaa34(0x19d)](Boolean,_0x1f13c9[_0x2aaa34(0x1c0)]?.['trim']()),_0x39943b=Boolean(_0x59efb1['forceLogin']||_0x27a108?.[_0x2aaa34(0x178)]),_0x4f6494=_0x27a108?.['domains'],_0x3db2f9=_0x59efb1[_0x2aaa34(0x143)],_0x343c01=_0x3db2f9??_0x27a108?.[_0x2aaa34(0x143)],_0x2fc98e=_0x3160f8[_0x2aaa34(0x198)]??_0x59efb1['baseUrl']??(_0x4f6494&&_0x2c7698[_0x2aaa34(0x17e)](_0x4f6494[_0x2aaa34(0x1c1)],0x0)?_0x4f6494[0x0]:''),_0x411186=_0x2fc98e?needsTunnel(_0x2fc98e):![],_0x4b188e={'invalidateOn':_0x27a108?.[_0x2aaa34(0x1af)],'userAgent':_0x27a108?.['browserOptions']?.['userAgent']??_0x59efb1[_0x2aaa34(0x1a5)]};_0x39943b&&console[_0x2aaa34(0x195)](_0x2aaa34(0x160)+_0x1aa68f[_0x2aaa34(0x1ba)]+_0x2aaa34(0x197));if(!_0x39943b){const _0x5c5389=await checkLocalCache(_0x1aa68f['name'],_0x1aa68f[_0x2aaa34(0x19f)],_0x2fc98e,_0x343c01,_0x4b188e);if(_0x5c5389){if(_0x2fc98e&&!_0x411186){const _0x599d57=await _0x2c7698['SugkM'](isCachedSessionLive,_0x5c5389[_0x2aaa34(0x1a1)],_0x2fc98e,{'sessionCheckPath':_0x27a108?.[_0x2aaa34(0x146)],'setupHeaders':_0x343c01},{'launchBrowser':launchRealBrowser});if(_0x599d57)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x1aa68f['name']+'\x22'),{'authPath':_0x5c5389[_0x2aaa34(0x1a1)],'settings':_0x1f13c9,'resolvedEnv':_0x27a108};console[_0x2aaa34(0x195)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x1aa68f['name']+_0x2aaa34(0x168)),_0x2c7698[_0x2aaa34(0x1a0)](emitSessionValidationHint,_0x2fc98e,_0x27a108);}else return _0x411186&&console['log'](_0x2aaa34(0x180)+_0x1aa68f[_0x2aaa34(0x1ba)]+'\x22'),{'authPath':_0x5c5389['storageStatePath'],'settings':_0x1f13c9,'resolvedEnv':_0x27a108};}}if(!_0x39943b&&_0x1aa68f['sessionState']){if(_0x411186)console[_0x2aaa34(0x195)](_0x2aaa34(0x176)+_0x2fc98e+_0x2aaa34(0x1be)+_0x1aa68f[_0x2aaa34(0x1ba)]+'\x22');else{const _0xa57f5a=await writeSessionToLocalCache(_0x1aa68f[_0x2aaa34(0x1ba)],_0x1aa68f['organizationId'],_0x2fc98e,_0x343c01,_0x1aa68f['sessionState'],_0x4f6494,_0x4b188e);if(_0x2fc98e){const _0x30c268=await _0x2c7698['RqDTN'](isCachedSessionLive,_0xa57f5a,_0x2fc98e,{'sessionCheckPath':_0x27a108?.['sessionCheckPath'],'setupHeaders':_0x343c01},{'launchBrowser':launchRealBrowser});if(_0x30c268)return console['log'](_0x2aaa34(0x155)+_0x1aa68f['name']+_0x2aaa34(0x157)),{'authPath':_0xa57f5a,'settings':_0x1f13c9,'resolvedEnv':_0x27a108};console['log'](_0x2aaa34(0x149)+_0x1aa68f[_0x2aaa34(0x1ba)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x2c7698['ZdEVr'](emitSessionValidationHint,_0x2fc98e,_0x27a108);}else return{'authPath':_0xa57f5a,'settings':_0x1f13c9,'resolvedEnv':_0x27a108};}}if(_0x4cad8b)return console['log'](_0x2aaa34(0x18a)+_0x1aa68f[_0x2aaa34(0x1ba)]+_0x2aaa34(0x15b)),{'authPath':undefined,'settings':_0x1f13c9,'resolvedEnv':_0x27a108};console['log']('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x1aa68f['name']+'\x22,\x20attempting\x20login...');const _0x4d9927=_0x2c7698[_0x2aaa34(0x19d)](Boolean,process['env']['RANGER_TEST_USERNAME'])&&Boolean(process['env'][_0x2aaa34(0x145)]),_0x2c12c2=_0x2c7698[_0x2aaa34(0x19d)](Boolean,_0x1aa68f['username']);if(_0x4d9927||_0x2c12c2)try{const _0x4ba832=_0x2fc98e?await serverSideLoginWithOptionalTunnel(_0x1aa68f['name'],_0x2fc98e,{'force':_0x39943b}):await _0x2c7698['ZdEVr'](serverSideLogin,_0x1aa68f[_0x2aaa34(0x1ba)],{'force':_0x39943b});if(_0x4ba832[_0x2aaa34(0x151)]===_0x2c7698[_0x2aaa34(0x1c5)])console['log'](_0x2aaa34(0x154));else{if(_0x4ba832['status']==='success'&&_0x4ba832[_0x2aaa34(0x1a6)]){console['log'](_0x2c7698['oCAKY']);const _0x39599d=await writeSessionToLocalCache(_0x1aa68f[_0x2aaa34(0x1ba)],_0x1aa68f[_0x2aaa34(0x19f)],_0x2fc98e,_0x343c01,_0x4ba832[_0x2aaa34(0x1a6)],_0x4f6494,_0x4b188e);return _0x4d9927&&!_0x2c12c2&&await _0x2c7698['niMeh'](promptSaveCredentials,_0x1aa68f[_0x2aaa34(0x1ba)]),{'authPath':_0x39599d,'settings':_0x1f13c9,'resolvedEnv':_0x27a108};}else _0x4ba832['test_output']&&(console[_0x2aaa34(0x195)](_0x2c7698[_0x2aaa34(0x18f)]),console[_0x2aaa34(0x195)](_0x4ba832[_0x2aaa34(0x14e)])),console[_0x2aaa34(0x195)](_0x2c7698['ipIWv']);}}catch(_0x30a033){console[_0x2aaa34(0x195)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0x30a033 instanceof Error?_0x30a033[_0x2aaa34(0x16f)]:_0x2c7698[_0x2aaa34(0x14a)](String,_0x30a033))),console[_0x2aaa34(0x195)](_0x2c7698['ipIWv']);}const _0x1622f7=_0x27a108?{..._0x27a108,'setupHeaders':_0x343c01}:_0x2fc98e?{'key':_0x1aa68f[_0x2aaa34(0x199)]??'','domains':[_0x2fc98e],'setupHeaders':_0x343c01}:null,{sessionState:_0x128ca2}=await _0x2c7698['wXxle'](manualBrowserLogin,_0x1aa68f,_0x1622f7,{'persistSessionState':!_0x411186}),_0x207c0a=await _0x2c7698['rfCRl'](writeSessionToLocalCache,_0x1aa68f[_0x2aaa34(0x1ba)],_0x1aa68f[_0x2aaa34(0x19f)],_0x2fc98e,_0x343c01,_0x128ca2,_0x4f6494,_0x4b188e);return{'authPath':_0x207c0a,'settings':_0x1f13c9,'resolvedEnv':_0x27a108};}
@@ -1 +1 @@
1
- const _0x482b7c=_0x2bfe;(function(_0x3d21de,_0x22e1c2){const _0x55cca0=_0x2bfe,_0x5bbd20=_0x3d21de();while(!![]){try{const _0x284d86=-parseInt(_0x55cca0(0x1ee))/0x1*(parseInt(_0x55cca0(0x1ef))/0x2)+-parseInt(_0x55cca0(0x210))/0x3+-parseInt(_0x55cca0(0x21c))/0x4+parseInt(_0x55cca0(0x218))/0x5+-parseInt(_0x55cca0(0x1f7))/0x6+parseInt(_0x55cca0(0x211))/0x7*(parseInt(_0x55cca0(0x201))/0x8)+parseInt(_0x55cca0(0x21b))/0x9;if(_0x284d86===_0x22e1c2)break;else _0x5bbd20['push'](_0x5bbd20['shift']());}catch(_0x24fd3f){_0x5bbd20['push'](_0x5bbd20['shift']());}}}(_0x21b2,0x75f31));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x4292dc=process[_0x482b7c(0x1f4)],_0x360b5={'stdin':process[_0x482b7c(0x209)],'stdout':process[_0x482b7c(0x20b)]}){const _0x2506a5=_0x482b7c,_0x1712cd={'cBSVM':function(_0x21e5e7,_0x4a6506){return _0x21e5e7(_0x4a6506);}};if(_0x4292dc['CI'])return![];return Boolean(_0x360b5['stdin']['isTTY'])&&_0x1712cd[_0x2506a5(0x1f6)](Boolean,_0x360b5[_0x2506a5(0x20b)][_0x2506a5(0x213)]);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x365cdb){const _0x1e043f=_0x482b7c,_0x24d16b={'sypbt':'baseUrl','UgxAC':function(_0x526fce,_0x5a0f77){return _0x526fce(_0x5a0f77);},'XaCze':_0x1e043f(0x214),'ZpOXD':function(_0x455323,_0x681bc4){return _0x455323!==_0x681bc4;},'WESPQ':'clientIp','Tnbhy':'hex'},_0xcd6b9a=new Set(_0x365cdb['invalidateOn']??DEFAULT_INVALIDATE_ON),_0x48df23={'orgId':_0x365cdb['orgId'],'profileName':_0x365cdb['profileName']};return _0xcd6b9a['has'](_0x24d16b['sypbt'])&&(_0x48df23['effectiveBaseUrl']=_0x365cdb['effectiveBaseUrl']),_0xcd6b9a['has'](_0x1e043f(0x1f5))&&(_0x48df23['setupHeaders']=_0x365cdb[_0x1e043f(0x1f5)]?_0x24d16b[_0x1e043f(0x1f9)](sortObjectKeys,_0x365cdb['setupHeaders']):_0x365cdb[_0x1e043f(0x1f5)]),_0xcd6b9a['has'](_0x24d16b[_0x1e043f(0x219)])&&(_0x48df23[_0x1e043f(0x214)]=extractPort(_0x365cdb[_0x1e043f(0x1fd)])),_0xcd6b9a[_0x1e043f(0x21d)](_0x1e043f(0x215))&&_0x24d16b[_0x1e043f(0x1ec)](_0x365cdb[_0x1e043f(0x215)],undefined)&&(_0x48df23[_0x1e043f(0x215)]=_0x365cdb[_0x1e043f(0x215)]),_0xcd6b9a['has'](_0x24d16b['WESPQ'])&&_0x24d16b[_0x1e043f(0x1ec)](_0x365cdb['clientIp'],undefined)&&(_0x48df23['clientIp']=_0x365cdb[_0x1e043f(0x1fb)]),createHash('sha256')[_0x1e043f(0x204)](JSON[_0x1e043f(0x207)](_0x48df23))[_0x1e043f(0x212)](_0x24d16b['Tnbhy'])['slice'](0x0,0xc);}function extractPort(_0x22e3b9){try{return new URL(_0x22e3b9)['port'];}catch{return'';}}function sortObjectKeys(_0x2c1edc){const _0x4f3eb9={};for(const _0x5a5053 of Object['keys'](_0x2c1edc)['sort']()){_0x4f3eb9[_0x5a5053]=_0x2c1edc[_0x5a5053];}return _0x4f3eb9;}export function getSessionCachePath(_0x49c6b7,_0x544b94){const _0xa4b94e=_0x482b7c,_0x302c3b={'qnvdZ':function(_0x2d7d39,_0x37d8ca,_0x3dc40d,_0x983fff){return _0x2d7d39(_0x37d8ca,_0x3dc40d,_0x983fff);},'CFuZA':function(_0x2dedf4){return _0x2dedf4();},'LBnlG':_0xa4b94e(0x208)};return _0x302c3b[_0xa4b94e(0x1ed)](join,_0x302c3b['CFuZA'](getRangerHomeDir),_0x302c3b[_0xa4b94e(0x203)],_0x49c6b7+'-'+_0x544b94+_0xa4b94e(0x1fc));}export function getStorageStatePath(_0x1be6aa){const _0x1288cf=_0x482b7c,_0x453630={'pTQhQ':'.storageState.json'};return _0x1be6aa[_0x1288cf(0x217)](/\.json$/,_0x453630['pTQhQ']);}export function needsTunnel(_0x5c4b18){const _0x3fe812=_0x482b7c,_0x1aef22={'MGoyh':function(_0x7d84f2,_0x371b9b){return _0x7d84f2===_0x371b9b;},'EIsHT':_0x3fe812(0x206),'KwUst':_0x3fe812(0x1f8),'ADayu':'localhost.'};let _0x701d2f;try{_0x701d2f=new URL(_0x5c4b18)['hostname'];}catch{return![];}if(_0x1aef22['MGoyh'](_0x701d2f,_0x1aef22['EIsHT'])||_0x1aef22[_0x3fe812(0x1fe)](_0x701d2f,_0x3fe812(0x20a)))return!![];if(_0x701d2f['endsWith'](_0x1aef22[_0x3fe812(0x1ff)]))return!![];if(_0x701d2f['includes'](_0x1aef22['ADayu']))return!![];return![];}export function hostnameOf(_0x5a9b63){return new URL(_0x5a9b63)['hostname'];}export function duplicateCookiesForDomains(_0x2fd381,_0x554a5d){const _0x309915=_0x482b7c,_0x15d683=[..._0x2fd381],_0xac20b=new Set(_0x2fd381[_0x309915(0x1f0)](_0xf8267d=>_0xf8267d['domain']));for(const _0x15b602 of _0x554a5d){let _0xfc78d;try{_0xfc78d=hostnameOf(_0x15b602);}catch{continue;}if(!_0xfc78d)continue;const _0xe0aa93=_0xfc78d[_0x309915(0x20e)]('.')?_0xfc78d:'.'+_0xfc78d;if(_0xac20b['has'](_0xfc78d)||_0xac20b['has'](_0xe0aa93))continue;for(const _0x888a30 of _0x2fd381){_0x15d683['push']({..._0x888a30,'domain':_0xe0aa93});}_0xac20b['add'](_0xe0aa93);}return _0x15d683;}export function resolveAuthEnvironmentLocally(_0x5406af,_0x5df35d){const _0x497449=_0x482b7c,_0x16b4f1=_0x5406af['environments'];if(_0x5df35d){const _0x40d6fd=_0x16b4f1[_0x5df35d];if(!_0x40d6fd)return null;return{'key':_0x5df35d,..._0x40d6fd};}if(_0x5406af[_0x497449(0x1f1)]){const _0x384e26=_0x16b4f1[_0x5406af[_0x497449(0x1f1)]];if(!_0x384e26)return null;return{'key':_0x5406af[_0x497449(0x1f1)],..._0x384e26};}const _0x334cfd=Object['keys'](_0x16b4f1);if(_0x334cfd[_0x497449(0x202)]===0x1){const _0xa05f57=_0x334cfd[0x0];return{'key':_0xa05f57,..._0x16b4f1[_0xa05f57]};}return null;}function _0x21b2(){const _0x29fafa=['KwUst','catch','280ZEBklZ','length','LBnlG','update','toString','localhost','stringify','auth','stdin','127.0.0.1','stdout','sessionCheckPath','pathname','startsWith','yhkUo','1678404YaUfFx','134792EaUBQv','digest','isTTY','port','userAgent','url','replace','1752545JuccpN','XaCze','test','14786721MceMiG','1070684QdoCXp','has','ZpOXD','qnvdZ','12422PFsOoM','94KbMLQL','map','defaultEnvironmentKey','domcontentloaded','launchBrowser','env','setupHeaders','cBSVM','4640064sHYyrL','.localhost','UgxAC','newPage','clientIp','.json','effectiveBaseUrl','MGoyh'];_0x21b2=function(){return _0x29fafa;};return _0x21b2();}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x4d1f6f,_0x266ce9){const _0x3adaf8=_0x482b7c;try{if(_0x266ce9)return new URL(_0x266ce9,_0x4d1f6f)[_0x3adaf8(0x205)]();return new URL(_0x4d1f6f)['toString']();}catch{return null;}}function _0x2bfe(_0x23460d,_0x3b80ed){_0x23460d=_0x23460d-0x1ec;const _0x21b24d=_0x21b2();let _0x2bfe9a=_0x21b24d[_0x23460d];return _0x2bfe9a;}export function looksLikeLoginUrl(_0x2acdd0){const _0xa67e12=_0x482b7c;try{const _0x1079c3=new URL(_0x2acdd0);return LOGIN_URL_PATTERN['test'](_0x1079c3[_0xa67e12(0x20d)]);}catch{return LOGIN_URL_PATTERN[_0xa67e12(0x21a)](_0x2acdd0);}}export async function isCachedSessionLive(_0x9ff98a,_0x6cd4b0,_0x1d1835={},_0x24effb={}){const _0x19aca4=_0x482b7c,_0x328a8a={'jmEvD':function(_0x32ae42,_0x563335,_0x2723d2){return _0x32ae42(_0x563335,_0x2723d2);},'yhkUo':function(_0x46d445,_0x3e886e){return _0x46d445(_0x3e886e);}},_0x4a4d14=_0x328a8a['jmEvD'](buildSessionCheckUrl,_0x6cd4b0,_0x1d1835[_0x19aca4(0x20c)]);if(!_0x4a4d14)return!![];if(!_0x24effb['launchBrowser'])return!![];let _0x186d7a=null;try{_0x186d7a=await _0x24effb[_0x19aca4(0x1f3)]();const _0x30d092=await _0x186d7a['newContext']({'storageState':_0x9ff98a,'ignoreHTTPSErrors':!![],..._0x1d1835['setupHeaders']?{'extraHTTPHeaders':_0x1d1835[_0x19aca4(0x1f5)]}:{}}),_0x555715=await _0x30d092[_0x19aca4(0x1fa)](),_0x158dc6=await _0x555715['goto'](_0x4a4d14,{'waitUntil':_0x19aca4(0x1f2),'timeout':0x3a98}),_0x233e7b=_0x158dc6?.['status']();if(_0x233e7b===0x191||_0x233e7b===0x193)return![];const _0x28f362=_0x555715[_0x19aca4(0x216)]();if(_0x328a8a[_0x19aca4(0x20f)](looksLikeLoginUrl,_0x28f362))return![];return!![];}catch{return![];}finally{if(_0x186d7a)await _0x186d7a['close']()[_0x19aca4(0x200)](()=>{});}}
1
+ function _0x3b66(_0x4b615b,_0x44a362){_0x4b615b=_0x4b615b-0xa6;const _0x15f107=_0x15f1();let _0x3b6670=_0x15f107[_0x4b615b];return _0x3b6670;}const _0x2c6ce9=_0x3b66;(function(_0x219b6a,_0x2c4f25){const _0x44c7b1=_0x3b66,_0xa54d40=_0x219b6a();while(!![]){try{const _0x36194a=parseInt(_0x44c7b1(0xc8))/0x1+-parseInt(_0x44c7b1(0xac))/0x2*(parseInt(_0x44c7b1(0xd8))/0x3)+-parseInt(_0x44c7b1(0xbd))/0x4*(-parseInt(_0x44c7b1(0xc4))/0x5)+parseInt(_0x44c7b1(0xcc))/0x6+-parseInt(_0x44c7b1(0xb4))/0x7+parseInt(_0x44c7b1(0xd1))/0x8*(-parseInt(_0x44c7b1(0xb7))/0x9)+parseInt(_0x44c7b1(0xb0))/0xa;if(_0x36194a===_0x2c4f25)break;else _0xa54d40['push'](_0xa54d40['shift']());}catch(_0x5a92fd){_0xa54d40['push'](_0xa54d40['shift']());}}}(_0x15f1,0x489f6));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x11767d=process['env'],_0x2b07d3={'stdin':process['stdin'],'stdout':process[_0x2c6ce9(0xb1)]}){const _0x45c56b=_0x2c6ce9,_0x174ef2={'xdcfq':function(_0x4a6ed8,_0x3a6aed){return _0x4a6ed8(_0x3a6aed);},'GlcOP':function(_0x9e09aa,_0x52a338){return _0x9e09aa(_0x52a338);}};if(_0x11767d['CI'])return![];return _0x174ef2[_0x45c56b(0xae)](Boolean,_0x2b07d3[_0x45c56b(0xc9)][_0x45c56b(0xb8)])&&_0x174ef2['GlcOP'](Boolean,_0x2b07d3[_0x45c56b(0xb1)]['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x1d6210){const _0x9d712f=_0x2c6ce9,_0x1b81fa={'zKxcR':'baseUrl','pgBJD':_0x9d712f(0xd7),'JEdqt':function(_0x12358d,_0x464fba){return _0x12358d(_0x464fba);},'YRsrY':'userAgent','gDdYC':_0x9d712f(0xd4),'sBsAx':'sha256'},_0x55b730=new Set(_0x1d6210[_0x9d712f(0xd5)]??DEFAULT_INVALIDATE_ON),_0xc3f943={'orgId':_0x1d6210['orgId'],'profileName':_0x1d6210['profileName']};return _0x55b730['has'](_0x1b81fa[_0x9d712f(0xc7)])&&(_0xc3f943['effectiveBaseUrl']=_0x1d6210['effectiveBaseUrl']),_0x55b730['has'](_0x1b81fa[_0x9d712f(0xcf)])&&(_0xc3f943[_0x9d712f(0xd7)]=_0x1d6210[_0x9d712f(0xd7)]?_0x1b81fa['JEdqt'](sortObjectKeys,_0x1d6210['setupHeaders']):_0x1d6210['setupHeaders']),_0x55b730[_0x9d712f(0xad)](_0x9d712f(0xc1))&&(_0xc3f943[_0x9d712f(0xc1)]=extractPort(_0x1d6210['effectiveBaseUrl'])),_0x55b730['has'](_0x1b81fa['YRsrY'])&&_0x1d6210[_0x9d712f(0xa9)]!==undefined&&(_0xc3f943['userAgent']=_0x1d6210[_0x9d712f(0xa9)]),_0x55b730[_0x9d712f(0xad)](_0x1b81fa[_0x9d712f(0xba)])&&_0x1d6210[_0x9d712f(0xd4)]!==undefined&&(_0xc3f943[_0x9d712f(0xd4)]=_0x1d6210['clientIp']),createHash(_0x1b81fa[_0x9d712f(0xca)])[_0x9d712f(0xd3)](JSON[_0x9d712f(0xbe)](_0xc3f943))['digest']('hex')[_0x9d712f(0xcb)](0x0,0xc);}function extractPort(_0x201a03){try{return new URL(_0x201a03)['port'];}catch{return'';}}function sortObjectKeys(_0x811e43){const _0x244077=_0x2c6ce9,_0x3aec69={};for(const _0x22d319 of Object['keys'](_0x811e43)[_0x244077(0xa6)]()){_0x3aec69[_0x22d319]=_0x811e43[_0x22d319];}return _0x3aec69;}export function getSessionCachePath(_0x157175,_0x19ae53){const _0x5d4ffd=_0x2c6ce9,_0x34e9aa={'AhTOK':_0x5d4ffd(0xb2)};return join(getRangerHomeDir(),_0x34e9aa['AhTOK'],_0x157175+'-'+_0x19ae53+_0x5d4ffd(0xc2));}function _0x15f1(){const _0x37e196=['gDdYC','toString','JERSJ','903568JEkipP','stringify','status','goto','port','.json','YUGdf','5aXSGlk','keys','includes','zKxcR','173266IXdeoQ','stdin','sBsAx','slice','2620062hvKpdM','VhxML','NpQHz','pgBJD','sessionCheckPath','319528IlAMuM','launchBrowser','update','clientIp','invalidateOn','defaultEnvironmentKey','setupHeaders','22953rqKhaL','sort','hostname','push','userAgent','test','catch','50DIlKUw','has','xdcfq','url','831650MzbWeY','stdout','auth','startsWith','2452667dUVCkP','map','localhost.','18vMuuRw','isTTY','domcontentloaded'];_0x15f1=function(){return _0x37e196;};return _0x15f1();}export function getStorageStatePath(_0x10e349){return _0x10e349['replace'](/\.json$/,'.storageState.json');}export function needsTunnel(_0x25ae02){const _0x52d790=_0x2c6ce9,_0x345a80={'JERSJ':'127.0.0.1'};let _0x100214;try{_0x100214=new URL(_0x25ae02)['hostname'];}catch{return![];}if(_0x100214==='localhost'||_0x100214===_0x345a80[_0x52d790(0xbc)])return!![];if(_0x100214['endsWith']('.localhost'))return!![];if(_0x100214[_0x52d790(0xc6)](_0x52d790(0xb6)))return!![];return![];}export function hostnameOf(_0x332e3a){const _0x579507=_0x2c6ce9;return new URL(_0x332e3a)[_0x579507(0xa7)];}export function duplicateCookiesForDomains(_0x343970,_0x3b6cbb){const _0x5dbbc7=_0x2c6ce9,_0x55c7fa={'NpQHz':function(_0x31e6c8,_0x4cd6af){return _0x31e6c8(_0x4cd6af);}},_0x2e89f0=[..._0x343970],_0x28b6a4=new Set(_0x343970[_0x5dbbc7(0xb5)](_0x529579=>_0x529579['domain']));for(const _0x17b388 of _0x3b6cbb){let _0x3d9ff5;try{_0x3d9ff5=_0x55c7fa[_0x5dbbc7(0xce)](hostnameOf,_0x17b388);}catch{continue;}if(!_0x3d9ff5)continue;const _0x4b5c14=_0x3d9ff5[_0x5dbbc7(0xb3)]('.')?_0x3d9ff5:'.'+_0x3d9ff5;if(_0x28b6a4['has'](_0x3d9ff5)||_0x28b6a4['has'](_0x4b5c14))continue;for(const _0x488bf8 of _0x343970){_0x2e89f0[_0x5dbbc7(0xa8)]({..._0x488bf8,'domain':_0x4b5c14});}_0x28b6a4['add'](_0x4b5c14);}return _0x2e89f0;}export function resolveAuthEnvironmentLocally(_0x48791a,_0x227583){const _0x1b4839=_0x2c6ce9,_0x401a1d=_0x48791a['environments'];if(_0x227583){const _0x46c14e=_0x401a1d[_0x227583];if(!_0x46c14e)return null;return{'key':_0x227583,..._0x46c14e};}if(_0x48791a[_0x1b4839(0xd6)]){const _0x16de2c=_0x401a1d[_0x48791a[_0x1b4839(0xd6)]];if(!_0x16de2c)return null;return{'key':_0x48791a[_0x1b4839(0xd6)],..._0x16de2c};}const _0x1dc561=Object[_0x1b4839(0xc5)](_0x401a1d);if(_0x1dc561['length']===0x1){const _0x6a5f13=_0x1dc561[0x0];return{'key':_0x6a5f13,..._0x401a1d[_0x6a5f13]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x5409b6,_0x3597f8){const _0x224fe2=_0x2c6ce9;try{if(_0x3597f8)return new URL(_0x3597f8,_0x5409b6)[_0x224fe2(0xbb)]();return new URL(_0x5409b6)['toString']();}catch{return null;}}export function looksLikeLoginUrl(_0x58493d){const _0x118d07=_0x2c6ce9;try{const _0x7fe267=new URL(_0x58493d);return LOGIN_URL_PATTERN[_0x118d07(0xaa)](_0x7fe267['pathname']);}catch{return LOGIN_URL_PATTERN['test'](_0x58493d);}}export async function isCachedSessionLive(_0x462988,_0x25b0d4,_0x2c58d2={},_0x75f2c1={}){const _0xe9d531=_0x2c6ce9,_0x18a3bf={'VhxML':function(_0x15e592,_0x4a1704,_0x527b0d){return _0x15e592(_0x4a1704,_0x527b0d);},'YUGdf':function(_0x5b60a1,_0x57bd18){return _0x5b60a1===_0x57bd18;},'UnyWt':function(_0x2d3fd1,_0x800f05){return _0x2d3fd1(_0x800f05);}},_0xebcb10=_0x18a3bf[_0xe9d531(0xcd)](buildSessionCheckUrl,_0x25b0d4,_0x2c58d2[_0xe9d531(0xd0)]);if(!_0xebcb10)return!![];if(!_0x75f2c1['launchBrowser'])return!![];let _0xf9d1d9=null;try{_0xf9d1d9=await _0x75f2c1[_0xe9d531(0xd2)]();const _0x56aef7=await _0xf9d1d9['newContext']({'storageState':_0x462988,'ignoreHTTPSErrors':!![],..._0x2c58d2['setupHeaders']?{'extraHTTPHeaders':_0x2c58d2[_0xe9d531(0xd7)]}:{}}),_0x383667=await _0x56aef7['newPage'](),_0x418b4f=await _0x383667[_0xe9d531(0xc0)](_0xebcb10,{'waitUntil':_0xe9d531(0xb9),'timeout':0x3a98}),_0x5adf74=_0x418b4f?.[_0xe9d531(0xbf)]();if(_0x18a3bf[_0xe9d531(0xc3)](_0x5adf74,0x191)||_0x5adf74===0x193)return![];const _0x4f524d=_0x383667[_0xe9d531(0xaf)]();if(_0x18a3bf['UnyWt'](looksLikeLoginUrl,_0x4f524d))return![];return!![];}catch{return![];}finally{if(_0xf9d1d9)await _0xf9d1d9['close']()[_0xe9d531(0xab)](()=>{});}}
@@ -1 +1 @@
1
- (function(_0x4cddd7,_0x2e842d){const _0x5ccd4b=_0xdf53,_0x4714eb=_0x4cddd7();while(!![]){try{const _0x10dbce=-parseInt(_0x5ccd4b(0x14c))/0x1*(-parseInt(_0x5ccd4b(0x158))/0x2)+parseInt(_0x5ccd4b(0x15a))/0x3+parseInt(_0x5ccd4b(0x149))/0x4*(-parseInt(_0x5ccd4b(0x147))/0x5)+parseInt(_0x5ccd4b(0x155))/0x6*(-parseInt(_0x5ccd4b(0x14a))/0x7)+-parseInt(_0x5ccd4b(0x154))/0x8+-parseInt(_0x5ccd4b(0x151))/0x9*(parseInt(_0x5ccd4b(0x153))/0xa)+parseInt(_0x5ccd4b(0x156))/0xb*(parseInt(_0x5ccd4b(0x14e))/0xc);if(_0x10dbce===_0x2e842d)break;else _0x4714eb['push'](_0x4714eb['shift']());}catch(_0xa8de94){_0x4714eb['push'](_0x4714eb['shift']());}}}(_0x3c42,0x565c8));function _0x3c42(){const _0x277a3c=['585arYgnq','dQWev','56790YDfEzF','1732608hxzsrm','2766OmVZVb','1263647ALcutY','aVdvq','4098XFCTfu','sha256','1799673SceVLU','HJFSw','GKgWL','582305iUXBsW','subarray','4GfUyIT','9422YCzRAU','oyMpi','189uJeKZt','DxgPK','72zEnzdp','vKOPx','final'];_0x3c42=function(){return _0x277a3c;};return _0x3c42();}import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM='aes-256-gcm',SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;function _0xdf53(_0x298341,_0x138850){_0x298341=_0x298341-0x147;const _0x3c42d3=_0x3c42();let _0xdf532=_0x3c42d3[_0x298341];return _0xdf532;}export function deriveKey(_0x23b9b0){const _0x159b22=_0xdf53,_0x27d81f={'yOKBm':function(_0x303ffe,_0x13c0c2,_0x368d68,_0x4e4cf8,_0xa46419,_0x3c7e98){return _0x303ffe(_0x13c0c2,_0x368d68,_0x4e4cf8,_0xa46419,_0x3c7e98);}};return _0x27d81f['yOKBm'](pbkdf2Sync,_0x23b9b0,SALT,0x186a0,KEY_LENGTH,_0x159b22(0x159));}export function encrypt(_0x4323b5,_0x50edf4){const _0x9ee2d7=_0xdf53,_0xb071e={'aVdvq':function(_0x2dd94c,_0x1fdad7){return _0x2dd94c(_0x1fdad7);},'DxgPK':function(_0x35e730,_0x469967,_0x3e0c3a,_0x277016){return _0x35e730(_0x469967,_0x3e0c3a,_0x277016);},'dQWev':'utf8'},_0x373c0c=_0xb071e[_0x9ee2d7(0x157)](deriveKey,_0x50edf4),_0x336776=randomBytes(IV_LENGTH),_0x3a49ee=_0xb071e[_0x9ee2d7(0x14d)](createCipheriv,ALGORITHM,_0x373c0c,_0x336776),_0x594f38=Buffer['concat']([_0x3a49ee['update'](_0x4323b5,_0xb071e[_0x9ee2d7(0x152)]),_0x3a49ee[_0x9ee2d7(0x150)]()]),_0x138f45=_0x3a49ee['getAuthTag']();return Buffer['concat']([_0x336776,_0x138f45,_0x594f38]);}export function decrypt(_0x459b90,_0x31c627){const _0x2c4d46=_0xdf53,_0x5394c7={'GKgWL':function(_0x306622,_0x26d9a4){return _0x306622(_0x26d9a4);},'HJFSw':function(_0x54e984,_0x47f43c){return _0x54e984+_0x47f43c;},'vKOPx':function(_0x40f157,_0x5751ab,_0x1a84c1,_0x58cf79){return _0x40f157(_0x5751ab,_0x1a84c1,_0x58cf79);},'oyMpi':function(_0x419e17,_0xef86ab){return _0x419e17+_0xef86ab;},'zdvwI':'utf8'},_0x439043=_0x5394c7[_0x2c4d46(0x15c)](deriveKey,_0x31c627),_0x379bc8=_0x459b90[_0x2c4d46(0x148)](0x0,IV_LENGTH),_0x1d9e93=_0x459b90['subarray'](IV_LENGTH,IV_LENGTH+TAG_LENGTH),_0x519924=_0x459b90[_0x2c4d46(0x148)](_0x5394c7[_0x2c4d46(0x15b)](IV_LENGTH,TAG_LENGTH)),_0x958ad8=_0x5394c7[_0x2c4d46(0x14f)](createDecipheriv,ALGORITHM,_0x439043,_0x379bc8);return _0x958ad8['setAuthTag'](_0x1d9e93),_0x5394c7[_0x2c4d46(0x14b)](_0x958ad8['update'](_0x519924),_0x958ad8[_0x2c4d46(0x150)](_0x5394c7['zdvwI']));}
1
+ (function(_0x271ee0,_0x16480b){const _0x3782f8=_0x584e,_0x1b71be=_0x271ee0();while(!![]){try{const _0x41292d=-parseInt(_0x3782f8(0xab))/0x1*(-parseInt(_0x3782f8(0xb9))/0x2)+-parseInt(_0x3782f8(0xb8))/0x3*(parseInt(_0x3782f8(0xac))/0x4)+-parseInt(_0x3782f8(0xb1))/0x5+-parseInt(_0x3782f8(0xba))/0x6+parseInt(_0x3782f8(0xb5))/0x7+parseInt(_0x3782f8(0xbb))/0x8+parseInt(_0x3782f8(0xb2))/0x9*(parseInt(_0x3782f8(0xb6))/0xa);if(_0x41292d===_0x16480b)break;else _0x1b71be['push'](_0x1b71be['shift']());}catch(_0x208afc){_0x1b71be['push'](_0x1b71be['shift']());}}}(_0x3f35,0x30f86));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM='aes-256-gcm',SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x77ffe3){const _0x8481be=_0x584e,_0x26e54c={'kriOq':'sha256'};return pbkdf2Sync(_0x77ffe3,SALT,0x186a0,KEY_LENGTH,_0x26e54c[_0x8481be(0xb3)]);}function _0x584e(_0xa84cfd,_0xb75ad4){_0xa84cfd=_0xa84cfd-0xaa;const _0x3f35ef=_0x3f35();let _0x584ec0=_0x3f35ef[_0xa84cfd];return _0x584ec0;}export function encrypt(_0x3f91d3,_0x47ef5f){const _0x3ca021=_0x584e,_0x257e19={'pOfLD':function(_0x3ed7aa,_0x3e426e){return _0x3ed7aa(_0x3e426e);},'UbfHr':function(_0x562ebf,_0x23d815,_0x2e5cda,_0x2fcbdf){return _0x562ebf(_0x23d815,_0x2e5cda,_0x2fcbdf);},'rhtMj':_0x3ca021(0xaf)},_0x93aa03=deriveKey(_0x47ef5f),_0x1bf764=_0x257e19['pOfLD'](randomBytes,IV_LENGTH),_0x324ef9=_0x257e19['UbfHr'](createCipheriv,ALGORITHM,_0x93aa03,_0x1bf764),_0x3a81b0=Buffer['concat']([_0x324ef9[_0x3ca021(0xae)](_0x3f91d3,_0x257e19['rhtMj']),_0x324ef9[_0x3ca021(0xb7)]()]),_0x6d0648=_0x324ef9[_0x3ca021(0xb0)]();return Buffer[_0x3ca021(0xaa)]([_0x1bf764,_0x6d0648,_0x3a81b0]);}function _0x3f35(){const _0x15701b=['182111miyeLS','4enbELn','YvVXR','update','utf8','getAuthTag','1552285nNoZPc','1065177igiVgX','kriOq','subarray','267386kxpCmz','20ZqoXSD','final','465279arRRwI','4raBCyw','1565964aZKtiW','2304000BDhESq','concat'];_0x3f35=function(){return _0x15701b;};return _0x3f35();}export function decrypt(_0x9df49f,_0x35ae88){const _0x3ccfb4=_0x584e,_0x38ba8b={'YvVXR':function(_0x5e3389,_0x143625,_0x92bbbf,_0x4bc960){return _0x5e3389(_0x143625,_0x92bbbf,_0x4bc960);}},_0x28d682=deriveKey(_0x35ae88),_0x3903f2=_0x9df49f[_0x3ccfb4(0xb4)](0x0,IV_LENGTH),_0x293f1b=_0x9df49f[_0x3ccfb4(0xb4)](IV_LENGTH,IV_LENGTH+TAG_LENGTH),_0x41e2f9=_0x9df49f['subarray'](IV_LENGTH+TAG_LENGTH),_0x239117=_0x38ba8b[_0x3ccfb4(0xad)](createDecipheriv,ALGORITHM,_0x28d682,_0x3903f2);return _0x239117['setAuthTag'](_0x293f1b),_0x239117[_0x3ccfb4(0xae)](_0x41e2f9)+_0x239117['final']('utf8');}
@@ -1 +1 @@
1
- const _0x240ec0=_0x5afd;(function(_0x535f9d,_0x4c6fe1){const _0x23c4c2=_0x5afd,_0x4cdbc0=_0x535f9d();while(!![]){try{const _0x477ea7=-parseInt(_0x23c4c2(0x99))/0x1*(-parseInt(_0x23c4c2(0x8a))/0x2)+-parseInt(_0x23c4c2(0x8b))/0x3+-parseInt(_0x23c4c2(0x71))/0x4*(parseInt(_0x23c4c2(0x9b))/0x5)+parseInt(_0x23c4c2(0x70))/0x6+parseInt(_0x23c4c2(0x6d))/0x7+-parseInt(_0x23c4c2(0x9e))/0x8+parseInt(_0x23c4c2(0x8d))/0x9;if(_0x477ea7===_0x4c6fe1)break;else _0x4cdbc0['push'](_0x4cdbc0['shift']());}catch(_0x20a5ed){_0x4cdbc0['push'](_0x4cdbc0['shift']());}}}(_0x22d8,0xef268));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0x240ec0(0x75),'-t',_0x240ec0(0x7f),_0x240ec0(0x79),_0x240ec0(0x6f),_0x240ec0(0x81),'--password',_0x240ec0(0x9a),'--auth',_0x240ec0(0x78),_0x240ec0(0x69),'--cookie',_0x240ec0(0x8c)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x225527){const _0x229a24=_0x240ec0;return TOKEN_PATTERNS['some'](_0x26ff4e=>_0x26ff4e[_0x229a24(0x89)](_0x225527));}export function sanitizeArgs(_0x245225){const _0x534edc=_0x240ec0,_0x46e34d={'BkAUu':_0x534edc(0x8e)},_0x22a374=[];let _0x4dd84c=![];for(let _0x28560d=0x0;_0x28560d<_0x245225[_0x534edc(0x68)];_0x28560d++){const _0x5282fc=_0x245225[_0x28560d];if(_0x4dd84c){_0x22a374[_0x534edc(0x87)](_0x46e34d['BkAUu']),_0x4dd84c=![];continue;}if(_0x5282fc['startsWith']('--')||_0x5282fc[_0x534edc(0x73)]('-')){const _0x31888f=_0x5282fc['indexOf']('=');if(_0x31888f!==-0x1){const _0x71cf4b=_0x5282fc['slice'](0x0,_0x31888f)[_0x534edc(0x80)]();if(SENSITIVE_FLAGS['has'](_0x71cf4b)){_0x22a374[_0x534edc(0x87)](_0x5282fc[_0x534edc(0x83)](0x0,_0x31888f)+'=[REDACTED]');continue;}}else{const _0x455152=_0x5282fc[_0x534edc(0x80)]();SENSITIVE_FLAGS['has'](_0x455152)&&(_0x4dd84c=!![]);}_0x22a374['push'](_0x5282fc);}else looksLikeToken(_0x5282fc)?_0x22a374[_0x534edc(0x87)](_0x534edc(0x8e)):_0x22a374['push'](_0x5282fc);}return _0x22a374['join']('\x20');}function _0x5afd(_0x472124,_0x1cc73a){_0x472124=_0x472124-0x67;const _0x22d873=_0x22d8();let _0x5afdb8=_0x22d873[_0x472124];return _0x5afdb8;}function _0x22d8(){const _0x1e0080=['ZuRMz','Missing\x20required\x20argument','Authorization','DEBUG','UlYwP','no_token','[desire-path]\x20Payload:\x20','1GqeFDw','--pass','85bEfhWq','metadata','cXInT','2173232NSccOl','missing_required_argument','length','--header','Unknown\x20argument','env','/api/v1/mcp/desire-path-logs','717983WVAErF','invalid_option_value','--apikey','10005708fvBliW','277820Gnvmnz','XYIqz','startsWith','Invalid\x20values','--token','isTTY','missing_option','--authorization','--api-key','gPFOQ','sessionId','JBvcs','1|3|7|0|5|6|2|4','error','--secret','toLowerCase','--key','unknown','slice','errorMessage','includes','syntax_error','push','stringify','test','2390044SIkwkd','2613069LAeSUB','--credentials','3039867NtHPgi','[REDACTED]','stdout','unknown_command','has_token'];_0x22d8=function(){return _0x1e0080;};return _0x22d8();}export async function logDesirePath(_0x4d9d82){const _0x8fc416=_0x240ec0,_0x165acb={'rhaID':function(_0x532af2){return _0x532af2();},'LoHxb':function(_0x11d1f9){return _0x11d1f9();},'hErxj':_0x8fc416(0x91),'UlYwP':'application/json'};try{const _0x3f8909=await _0x165acb['rhaID'](getToken)['catch'](()=>null),_0x1a6495=getApiBaseUrl(),_0x7b3b81=_0x165acb['LoHxb'](getCurrentVersion),_0x1a341c=_0x3f8909?_0x165acb['hErxj']:_0x8fc416(0x97),_0x34d25e={..._0x4d9d82[_0x8fc416(0x9c)],'authStatus':_0x1a341c,'isTty':process[_0x8fc416(0x8f)][_0x8fc416(0x76)]??![]},_0x404108={'Content-Type':_0x165acb[_0x8fc416(0x96)]};_0x3f8909&&(_0x404108[_0x8fc416(0x94)]='Bearer\x20'+_0x3f8909);const _0x323a40={'rawCommand':_0x4d9d82['rawCommand'],'errorMessage':_0x4d9d82[_0x8fc416(0x84)],'errorType':_0x4d9d82['errorType'],'featureId':_0x4d9d82['featureId'],'sessionId':_0x4d9d82[_0x8fc416(0x7b)],'metadata':_0x34d25e,'cliVersion':_0x7b3b81};process['env'][_0x8fc416(0x95)]&&(console['error']('[desire-path]\x20Sending\x20log\x20to\x20'+_0x1a6495+'/api/v1/mcp/desire-path-logs'),console[_0x8fc416(0x7e)](_0x8fc416(0x98)+JSON[_0x8fc416(0x88)](_0x323a40,null,0x2))),await fetch(_0x1a6495+_0x8fc416(0x6c),{'method':'POST','headers':_0x404108,'body':JSON[_0x8fc416(0x88)](_0x323a40)});}catch(_0x3930ac){process[_0x8fc416(0x6b)][_0x8fc416(0x95)]&&console[_0x8fc416(0x7e)]('[desire-path]\x20Failed\x20to\x20send:\x20'+_0x3930ac);}}export function getErrorType(_0x3b95a0,_0x7248f2){const _0x4efa7b=_0x240ec0,_0x410c17={'ZuRMz':_0x4efa7b(0x7d),'umZTQ':_0x4efa7b(0x6a),'gPFOQ':'unknown_argument','smEPK':_0x4efa7b(0x93),'XYIqz':_0x4efa7b(0x86),'ryjje':'Not\x20enough\x20non-option\x20arguments','JBvcs':_0x4efa7b(0x67),'cXInT':_0x4efa7b(0x6e)},_0x49b9e9=_0x410c17[_0x4efa7b(0x92)]['split']('|');let _0x2998a1=0x0;while(!![]){switch(_0x49b9e9[_0x2998a1++]){case'0':if(_0x3b95a0[_0x4efa7b(0x85)](_0x410c17['umZTQ']))return _0x410c17[_0x4efa7b(0x7a)];continue;case'1':if(_0x7248f2)return'runtime_error';continue;case'2':if(_0x3b95a0['includes'](_0x410c17['smEPK']))return _0x4efa7b(0x77);continue;case'3':if(!_0x3b95a0)return _0x4efa7b(0x82);continue;case'4':return _0x410c17[_0x4efa7b(0x72)];case'5':if(_0x3b95a0[_0x4efa7b(0x85)](_0x410c17['ryjje']))return _0x410c17[_0x4efa7b(0x7c)];continue;case'6':if(_0x3b95a0[_0x4efa7b(0x85)](_0x4efa7b(0x74)))return _0x410c17[_0x4efa7b(0x9d)];continue;case'7':if(_0x3b95a0['includes']('Unknown\x20command'))return _0x4efa7b(0x90);continue;}break;}}
1
+ const _0x6a96d=_0x23fb;(function(_0x36d4f5,_0x2465ba){const _0x77228=_0x23fb,_0x112a5e=_0x36d4f5();while(!![]){try{const _0x375899=parseInt(_0x77228(0x18e))/0x1+-parseInt(_0x77228(0x1b1))/0x2*(-parseInt(_0x77228(0x18d))/0x3)+parseInt(_0x77228(0x1be))/0x4*(parseInt(_0x77228(0x1b7))/0x5)+-parseInt(_0x77228(0x1b4))/0x6*(parseInt(_0x77228(0x19d))/0x7)+-parseInt(_0x77228(0x1ad))/0x8*(parseInt(_0x77228(0x1c2))/0x9)+parseInt(_0x77228(0x195))/0xa+-parseInt(_0x77228(0x1ba))/0xb;if(_0x375899===_0x2465ba)break;else _0x112a5e['push'](_0x112a5e['shift']());}catch(_0x727814){_0x112a5e['push'](_0x112a5e['shift']());}}}(_0x8819,0x4124b));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0x6a96d(0x19a),'-t',_0x6a96d(0x1a7),'--api-key',_0x6a96d(0x1aa),_0x6a96d(0x1a4),_0x6a96d(0x19e),_0x6a96d(0x190),'--auth','--authorization','--header','--cookie',_0x6a96d(0x1b5)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x4438d4){const _0x435a3d=_0x6a96d;return TOKEN_PATTERNS[_0x435a3d(0x1a1)](_0x16db3f=>_0x16db3f['test'](_0x4438d4));}export function sanitizeArgs(_0xe7a7cc){const _0x147240=_0x6a96d,_0x1e5cfa={'RLedz':'[REDACTED]'},_0x57a816=[];let _0x1a731b=![];for(let _0x51ce8e=0x0;_0x51ce8e<_0xe7a7cc[_0x147240(0x1a3)];_0x51ce8e++){const _0x5962b5=_0xe7a7cc[_0x51ce8e];if(_0x1a731b){_0x57a816['push'](_0x1e5cfa[_0x147240(0x1a2)]),_0x1a731b=![];continue;}if(_0x5962b5['startsWith']('--')||_0x5962b5[_0x147240(0x1ae)]('-')){const _0x126a2a=_0x5962b5['indexOf']('=');if(_0x126a2a!==-0x1){const _0x2ca662=_0x5962b5['slice'](0x0,_0x126a2a)['toLowerCase']();if(SENSITIVE_FLAGS['has'](_0x2ca662)){_0x57a816['push'](_0x5962b5[_0x147240(0x191)](0x0,_0x126a2a)+'=[REDACTED]');continue;}}else{const _0x3da842=_0x5962b5[_0x147240(0x1b8)]();SENSITIVE_FLAGS['has'](_0x3da842)&&(_0x1a731b=!![]);}_0x57a816['push'](_0x5962b5);}else looksLikeToken(_0x5962b5)?_0x57a816[_0x147240(0x193)](_0x1e5cfa[_0x147240(0x1a2)]):_0x57a816[_0x147240(0x193)](_0x5962b5);}return _0x57a816[_0x147240(0x1ab)]('\x20');}function _0x23fb(_0x45b616,_0x26127b){_0x45b616=_0x45b616-0x18d;const _0x88194a=_0x8819();let _0x23fbbe=_0x88194a[_0x45b616];return _0x23fbbe;}export async function logDesirePath(_0x316e61){const _0x499725=_0x6a96d,_0x289910={'qXlUF':function(_0x226af0){return _0x226af0();},'zCZFz':'has_token','yvZjJ':_0x499725(0x1b3),'mdHxh':'application/json','zIEdE':'POST'};try{const _0x370a94=await _0x289910['qXlUF'](getToken)[_0x499725(0x196)](()=>null),_0x101ae4=getApiBaseUrl(),_0x1b1cd8=getCurrentVersion(),_0x135fd1=_0x370a94?_0x289910['zCZFz']:_0x289910['yvZjJ'],_0x43b8e1={..._0x316e61[_0x499725(0x1a6)],'authStatus':_0x135fd1,'isTty':process['stdout']['isTTY']??![]},_0x44d14c={'Content-Type':_0x289910[_0x499725(0x1a8)]};_0x370a94&&(_0x44d14c['Authorization']=_0x499725(0x1c3)+_0x370a94);const _0x3e4cf2={'rawCommand':_0x316e61[_0x499725(0x1c0)],'errorMessage':_0x316e61['errorMessage'],'errorType':_0x316e61[_0x499725(0x199)],'featureId':_0x316e61['featureId'],'sessionId':_0x316e61[_0x499725(0x1bc)],'metadata':_0x43b8e1,'cliVersion':_0x1b1cd8};process['env']['DEBUG']&&(console['error'](_0x499725(0x1b9)+_0x101ae4+_0x499725(0x197)),console['error'](_0x499725(0x19f)+JSON['stringify'](_0x3e4cf2,null,0x2))),await fetch(_0x101ae4+_0x499725(0x197),{'method':_0x289910[_0x499725(0x19c)],'headers':_0x44d14c,'body':JSON['stringify'](_0x3e4cf2)});}catch(_0x3ceaad){process['env']['DEBUG']&&console[_0x499725(0x19b)](_0x499725(0x1b6)+_0x3ceaad);}}function _0x8819(){const _0x21008=['runtime_error','unknown','38ugjtju','SRJIx','no_token','14082Txjnjf','--credentials','[desire-path]\x20Failed\x20to\x20send:\x20','1956495bTTDvB','toLowerCase','[desire-path]\x20Sending\x20log\x20to\x20','5154193aKXqUc','Not\x20enough\x20non-option\x20arguments','sessionId','FRuIx','4snKWKA','unknown_command','rawCommand','Unknown\x20command','21933YQGaLd','Bearer\x20','72489jhwKWf','131929AKAvHp','Unknown\x20argument','--pass','slice','syntax_error','push','DyOke','3947370uhCYJE','catch','/api/v1/mcp/desire-path-logs','Invalid\x20values','errorType','--token','error','zIEdE','511rHuwXs','--password','[desire-path]\x20Payload:\x20','aEOKd','some','RLedz','length','--key','includes','metadata','--secret','mdHxh','JTxbh','--apikey','join','gtDSB','1544mFotnD','startsWith'];_0x8819=function(){return _0x21008;};return _0x8819();}export function getErrorType(_0x157061,_0xd0434c){const _0x1988a9=_0x6a96d,_0x2fe9da={'gtDSB':_0x1988a9(0x1af),'GTOBl':_0x1988a9(0x1b0),'SRJIx':_0x1988a9(0x1c1),'JTxbh':_0x1988a9(0x1bf),'aEOKd':_0x1988a9(0x18f),'DyOke':_0x1988a9(0x198),'FOXdF':'invalid_option_value','FRuIx':'missing_option'};if(_0xd0434c)return _0x2fe9da[_0x1988a9(0x1ac)];if(!_0x157061)return _0x2fe9da['GTOBl'];if(_0x157061[_0x1988a9(0x1a5)](_0x2fe9da[_0x1988a9(0x1b2)]))return _0x2fe9da[_0x1988a9(0x1a9)];if(_0x157061[_0x1988a9(0x1a5)](_0x2fe9da[_0x1988a9(0x1a0)]))return'unknown_argument';if(_0x157061[_0x1988a9(0x1a5)](_0x1988a9(0x1bb)))return'missing_required_argument';if(_0x157061[_0x1988a9(0x1a5)](_0x2fe9da[_0x1988a9(0x194)]))return _0x2fe9da['FOXdF'];if(_0x157061['includes']('Missing\x20required\x20argument'))return _0x2fe9da[_0x1988a9(0x1bd)];return _0x1988a9(0x192);}
@@ -1 +1 @@
1
- const _0x3f6f9d=_0x4677;(function(_0x4e7be1,_0x92ab58){const _0x24e268=_0x4677,_0x1f8f8b=_0x4e7be1();while(!![]){try{const _0x513f6c=parseInt(_0x24e268(0x13d))/0x1+-parseInt(_0x24e268(0x128))/0x2*(parseInt(_0x24e268(0x17f))/0x3)+parseInt(_0x24e268(0x133))/0x4*(parseInt(_0x24e268(0x170))/0x5)+-parseInt(_0x24e268(0x163))/0x6*(parseInt(_0x24e268(0x169))/0x7)+parseInt(_0x24e268(0x131))/0x8*(parseInt(_0x24e268(0x132))/0x9)+-parseInt(_0x24e268(0x146))/0xa+parseInt(_0x24e268(0x142))/0xb;if(_0x513f6c===_0x92ab58)break;else _0x1f8f8b['push'](_0x1f8f8b['shift']());}catch(_0x5bfb69){_0x1f8f8b['push'](_0x1f8f8b['shift']());}}}(_0x2d43,0xa898e));function _0x2d43(){const _0x34f110=['9Ahgzcz','fOvZd','apiKeys','workosClientId','499308hkhsog','dlVoI','isTTY','POST','UTzik','UECKA','wYpLo','access_token','length','86120BLfXPY','981rtXMqO','4aFxuDO','application/json','/api-keys','apiKey','json','qCgTg','IZdhc','ScRtZ','Device\x20authorization\x20timed\x20out','GET','1083682puhXts','CLI\x20Key','Failed\x20to\x20request\x20device\x20code:\x20','YJbAS','iHGuh','9147710YrCOBY','device_code','WkZIi','xdg-open','13531910GKMDNO','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','jqBYC','Setting\x20up\x20your\x20organization...','from','Using\x20organization:\x20','stdout','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','Zgffu','zSaIr','jZJaP','map','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','Code:\x20','user_code','stdin','egvMo','JmnMB','Failed\x20to\x20create\x20organization:\x20','https://api.workos.com/user_management/authorize/device','/organization/my-memberships','organizationId','ddjns','log','verification_uri_complete','startsWith','wTMRs','stringify','Authentication\x20failed','6033318FQxMhp','QSwGu','parse','SvmQh','urn:ietf:params:oauth:grant-type:device_code','win32','7ZtzSYh','XUAge','text','mcp:write','org_id','pqgXc','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','3548015rAzMsv','status','/organization/me','error','/cli-auth/token','expires_in','utf-8','now','aAJrV','application/x-www-form-urlencoded','memberships','toString','vthkH','Failed\x20to\x20provision\x20API\x20key:\x20','platform'];_0x2d43=function(){return _0x34f110;};return _0x2d43();}import{spawn}from'child_process';import _0x27f7aa from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x3f6f9d(0x159),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';function _0x4677(_0x1ba513,_0x341e22){_0x1ba513=_0x1ba513-0x128;const _0x2d43c3=_0x2d43();let _0x46776c=_0x2d43c3[_0x1ba513];return _0x46776c;}export async function requestDeviceCode(_0x4828ab){const _0x326104=_0x3f6f9d,_0x247b7b=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x326104(0x12b),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x4828ab})});if(!_0x247b7b['ok']){const _0x50761e=await _0x247b7b[_0x326104(0x16b)]();throw new Error(_0x326104(0x13f)+_0x247b7b['status']+'\x20'+_0x50761e);}return _0x247b7b['json']();}export async function pollForTokens(_0xe78bae,_0xd3e7fb,_0x402531,_0x189083){const _0x465749=_0x3f6f9d,_0x4eaf4d={'XUAge':function(_0x170287,_0x194fb1){return _0x170287+_0x194fb1;},'DcMMG':_0x465749(0x12b),'IKGXg':function(_0x4e1e74,_0x285116){return _0x4e1e74===_0x285116;},'SvmQh':'authorization_pending','BnSNN':function(_0x202546,_0x5cc41d){return _0x202546===_0x5cc41d;},'pqgXc':_0x465749(0x162),'wFeAp':_0x465749(0x13b)},_0x383372=_0x4eaf4d[_0x465749(0x16a)](Date[_0x465749(0x177)](),_0x189083*0x3e8);let _0x536e4d=_0x402531*0x3e8;while(Date['now']()<_0x383372){await sleep(_0x536e4d);const _0x2de856=await fetch(WORKOS_TOKEN_URL,{'method':_0x4eaf4d['DcMMG'],'headers':{'Content-Type':_0x465749(0x179)},'body':new URLSearchParams({'client_id':_0xe78bae,'device_code':_0xd3e7fb,'grant_type':_0x465749(0x167)})});if(_0x2de856['ok'])return _0x2de856['json']();const _0x41ea75=await _0x2de856['json']();if(_0x4eaf4d['IKGXg'](_0x41ea75[_0x465749(0x173)],_0x4eaf4d[_0x465749(0x166)]))continue;if(_0x4eaf4d['BnSNN'](_0x41ea75['error'],'slow_down')){_0x536e4d+=0x3e8;continue;}throw new Error(_0x41ea75['error_description']||_0x41ea75[_0x465749(0x173)]||_0x4eaf4d[_0x465749(0x16e)]);}throw new Error(_0x4eaf4d['wFeAp']);}async function fetchUserProfile(_0x3f844f){const _0x40dafb=_0x3f6f9d,_0x30f29c={'IZdhc':function(_0x44bcf3){return _0x44bcf3();},'wYpLo':function(_0x3bdf9f,_0x557a61,_0x111fdd){return _0x3bdf9f(_0x557a61,_0x111fdd);},'JmnMB':'GET'},_0x1b5ebf=_0x30f29c[_0x40dafb(0x139)](getApiBaseUrl);try{const _0x539a6d=await _0x30f29c[_0x40dafb(0x12e)](fetch,_0x1b5ebf+_0x40dafb(0x172),{'method':_0x30f29c[_0x40dafb(0x157)],'headers':{'workos-token':_0x3f844f}});if(_0x539a6d['ok'])return _0x539a6d['json']();}catch{}return null;}function buildKeyName(_0x1e33b2,_0x25a4a){const _0x5bdfd0=_0x3f6f9d,_0x1166f0={'iHGuh':function(_0x191dcb,_0x218b0d){return _0x191dcb===_0x218b0d;}},_0x26821b=_0x25a4a['filter'](_0x17d7c3=>_0x17d7c3['name']===_0x1e33b2||_0x17d7c3['name'][_0x5bdfd0(0x15f)](_0x1e33b2+'\x20('));if(_0x1166f0[_0x5bdfd0(0x141)](_0x26821b[_0x5bdfd0(0x130)],0x0))return _0x1e33b2;return _0x1e33b2+'\x20('+(_0x26821b[_0x5bdfd0(0x130)]+0x1)+')';}export async function provisionApiKey(_0x5a0be5){const _0x13346b=_0x3f6f9d,_0xea5b2a={'aAJrV':function(_0x3606f3){return _0x3606f3();},'ZNlis':'application/json','dlVoI':'GET','zSaIr':_0x13346b(0x16c)},_0x1d5393=_0xea5b2a[_0x13346b(0x178)](getApiBaseUrl),_0x58ebc1={'Content-Type':_0xea5b2a['ZNlis'],'workos-token':_0x5a0be5},_0x110d77=await fetchUserProfile(_0x5a0be5),_0xe355ec=_0x110d77?.['firstName']||_0x110d77?.['email']?.['split']('@')[0x0],_0xe09ef=_0xe355ec?_0xe355ec+'\x27s\x20CLI\x20Key':_0x13346b(0x13e);let _0x5daa75=[];try{const _0x1c78c2=await fetch(_0x1d5393+'/api-keys',{'method':_0xea5b2a[_0x13346b(0x129)],'headers':_0x58ebc1});if(_0x1c78c2['ok']){const _0xd6f800=await _0x1c78c2[_0x13346b(0x137)]();_0x5daa75=_0xd6f800[_0x13346b(0x181)];}}catch{}const _0x529b0c=buildKeyName(_0xe09ef,_0x5daa75),_0x132518=await fetch(_0x1d5393+_0x13346b(0x135),{'method':_0x13346b(0x12b),'headers':_0x58ebc1,'body':JSON[_0x13346b(0x161)]({'name':_0x529b0c,'scope':_0xea5b2a[_0x13346b(0x14f)]})});if(!_0x132518['ok']){const _0x592547=await _0x132518['text']();throw new Error(_0x13346b(0x17d)+_0x132518['status']+'\x20'+_0x592547);}const _0x1d7938=await _0x132518[_0x13346b(0x137)]();return _0x1d7938[_0x13346b(0x136)]['token'];}export function openBrowser(_0x2ee556){const _0x4c86b7=_0x3f6f9d,_0x1fccb1={'nMyUp':function(_0x18d6d7,_0x498246){return _0x18d6d7===_0x498246;},'illbl':_0x4c86b7(0x168),'fOvZd':function(_0x19639e,_0x24cf9b,_0x1f155c,_0x26827a){return _0x19639e(_0x24cf9b,_0x1f155c,_0x26827a);},'jqBYC':'cmd','sfIbI':'start','ffkpx':'ignore','YDaST':_0x4c86b7(0x145)};try{if(_0x1fccb1['nMyUp'](process[_0x4c86b7(0x17e)],_0x1fccb1['illbl'])){const _0x598306=_0x1fccb1[_0x4c86b7(0x180)](spawn,_0x1fccb1[_0x4c86b7(0x148)],['/c',_0x1fccb1['sfIbI'],'',_0x2ee556],{'detached':!![],'stdio':_0x1fccb1['ffkpx'],'windowsHide':!![]});_0x598306['unref']();return;}const _0x32a3d5=process[_0x4c86b7(0x17e)]==='darwin'?'open':_0x1fccb1['YDaST'],_0x38cbe3=spawn(_0x32a3d5,[_0x2ee556],{'detached':!![],'stdio':_0x1fccb1['ffkpx']});_0x38cbe3['unref']();}catch{}}function decodeJwtPayload(_0x96c3c9){const _0x1f6743=_0x3f6f9d,_0x5b99ce=_0x96c3c9['split']('.');if(_0x5b99ce['length']!==0x3)throw new Error('Invalid\x20JWT\x20format');const _0x4f6afd=Buffer[_0x1f6743(0x14a)](_0x5b99ce[0x1],'base64url')[_0x1f6743(0x17b)](_0x1f6743(0x176));return JSON[_0x1f6743(0x165)](_0x4f6afd);}async function selfServeSignup(_0x1c3c85){const _0x107eb2=_0x3f6f9d,_0x45b805={'CJuHs':function(_0x12cbf9){return _0x12cbf9();},'pProL':function(_0x11f7bc,_0x2e4e51,_0x580666){return _0x11f7bc(_0x2e4e51,_0x580666);},'ScRtZ':'application/json'},_0x376f57=_0x45b805['CJuHs'](getApiBaseUrl),_0x3992a6=await _0x45b805['pProL'](fetch,_0x376f57+'/organization/self-serve-signup',{'method':_0x107eb2(0x12b),'headers':{'Content-Type':_0x45b805[_0x107eb2(0x13a)],'workos-token':_0x1c3c85}});if(!_0x3992a6['ok']){const _0x734870=await _0x3992a6['text']();throw new Error(_0x107eb2(0x158)+_0x3992a6['status']+'\x20'+_0x734870);}return _0x3992a6['json']();}async function fetchMyMemberships(_0x4b8a43){const _0x33b53b=_0x3f6f9d,_0x7575ad={'UTzik':function(_0x5c214d,_0x5851ce,_0x32aaca){return _0x5c214d(_0x5851ce,_0x32aaca);}},_0x365594=getApiBaseUrl(),_0x2384aa=await _0x7575ad[_0x33b53b(0x12c)](fetch,_0x365594+_0x33b53b(0x15a),{'method':_0x33b53b(0x13c),'headers':{'workos-token':_0x4b8a43}});if(!_0x2384aa['ok']){const _0x4f9494=await _0x2384aa['text']();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x2384aa['status']+'\x20'+_0x4f9494);}const _0x2bbeca=await _0x2384aa[_0x33b53b(0x137)]();return _0x2bbeca[_0x33b53b(0x17a)];}async function refreshTokenWithOrg(_0x187175,_0x59ac7c,_0x56fb73){const _0x43446a=_0x3f6f9d,_0x2c00ec={'IGtUl':function(_0x251175,_0x52b02c,_0x120e48){return _0x251175(_0x52b02c,_0x120e48);},'YIvBo':_0x43446a(0x12b),'NcdxK':'refresh_token'},_0x49e7df=await _0x2c00ec['IGtUl'](fetch,WORKOS_TOKEN_URL,{'method':_0x2c00ec['YIvBo'],'headers':{'Content-Type':_0x43446a(0x179)},'body':new URLSearchParams({'client_id':_0x187175,'grant_type':_0x2c00ec['NcdxK'],'refresh_token':_0x59ac7c,'organization_id':_0x56fb73})});if(!_0x49e7df['ok']){const _0x44c429=await _0x49e7df[_0x43446a(0x16b)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x49e7df[_0x43446a(0x171)]+'\x20'+_0x44c429);}return _0x49e7df['json']();}async function provisionCliToken(_0x14d876){const _0xc20ecd=_0x3f6f9d,_0x37627e={'XQCVa':function(_0x3029f2){return _0x3029f2();},'YJbAS':function(_0x5631f0,_0x460dd0,_0x5afd9c){return _0x5631f0(_0x460dd0,_0x5afd9c);},'jZJaP':_0xc20ecd(0x12b),'QSwGu':_0xc20ecd(0x134)},_0xa24f76=_0x37627e['XQCVa'](getApiBaseUrl),_0x5ecc51=await _0x37627e[_0xc20ecd(0x140)](fetch,_0xa24f76+_0xc20ecd(0x174),{'method':_0x37627e[_0xc20ecd(0x150)],'headers':{'Content-Type':_0x37627e[_0xc20ecd(0x164)],'workos-token':_0x14d876}});if(!_0x5ecc51['ok']){const _0x411d28=await _0x5ecc51['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x5ecc51[_0xc20ecd(0x171)]+'\x20'+_0x411d28);}return _0x5ecc51['json']();}export async function runDeviceAuthFlow(){const _0x2e1704=_0x3f6f9d,_0x5055f0={'wTMRs':function(_0x433720){return _0x433720();},'ddjns':function(_0x6e7838,_0x3867ce){return _0x6e7838(_0x3867ce);},'DJRbS':_0x2e1704(0x152),'qCgTg':'Waiting\x20for\x20authentication...','hAWIQ':function(_0x50fce0,_0x3c303d){return _0x50fce0(_0x3c303d);},'UECKA':function(_0x1a7085,_0x46e7b3){return _0x1a7085(_0x46e7b3);},'lyGZB':function(_0x14bcb3,_0x4a0e50){return _0x14bcb3(_0x4a0e50);},'Zgffu':function(_0x1ced2d,_0x24b3a6){return _0x1ced2d===_0x24b3a6;},'egvMo':function(_0x222c74,_0x3a26a5){return _0x222c74+_0x3a26a5;},'elnnn':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','vthkH':'selected','WkZIi':function(_0x37c656,_0x5ea30e,_0x542485,_0x138685){return _0x37c656(_0x5ea30e,_0x542485,_0x138685);},'TxhZp':function(_0x256e3e,_0x66e739){return _0x256e3e(_0x66e739);},'ojHru':function(_0x29db51,_0x22c9ce){return _0x29db51(_0x22c9ce);}},_0x381fec=_0x5055f0[_0x2e1704(0x160)](getCurrentEnvironment),_0x15ec78=ENVIRONMENT_CONFIGS[_0x381fec][_0x2e1704(0x182)],_0x3adfc6=await _0x5055f0[_0x2e1704(0x15c)](requestDeviceCode,_0x15ec78);console[_0x2e1704(0x15d)](_0x5055f0['DJRbS']),console[_0x2e1704(0x15d)](_0x2e1704(0x14d)),_0x5055f0['ddjns'](openBrowser,_0x3adfc6[_0x2e1704(0x15e)]),console[_0x2e1704(0x15d)](_0x2e1704(0x16f)+_0x3adfc6['verification_uri_complete']),console['log'](_0x2e1704(0x153)+_0x3adfc6[_0x2e1704(0x154)]+'\x0a'),process['stdout']['write'](_0x5055f0[_0x2e1704(0x138)]);let _0x15ec3f=await pollForTokens(_0x15ec78,_0x3adfc6[_0x2e1704(0x143)],_0x3adfc6['interval'],_0x3adfc6[_0x2e1704(0x175)]);console[_0x2e1704(0x15d)]('\x20✓');const _0x2bb197=_0x5055f0['hAWIQ'](decodeJwtPayload,_0x15ec3f['access_token']);if(!_0x2bb197[_0x2e1704(0x16d)]){const _0xdfa552=await _0x5055f0[_0x2e1704(0x12d)](fetchMyMemberships,_0x15ec3f['access_token']);let _0x4664e2;if(_0xdfa552[_0x2e1704(0x130)]===0x0){process[_0x2e1704(0x14c)]['write'](_0x2e1704(0x149));const _0x21848f=await _0x5055f0['lyGZB'](selfServeSignup,_0x15ec3f['access_token']);_0x4664e2=_0x21848f[_0x2e1704(0x15b)],console[_0x2e1704(0x15d)]('\x20✓');}else{if(_0x5055f0[_0x2e1704(0x14e)](_0xdfa552['length'],0x1))_0x4664e2=_0xdfa552[0x0]['organizationId'],console['log'](_0x2e1704(0x14b)+_0xdfa552[0x0]['name']);else{const _0x18591f=process[_0x2e1704(0x155)][_0x2e1704(0x12a)]&&process['stdout']['isTTY'];if(!_0x18591f)throw new Error(_0x5055f0[_0x2e1704(0x156)](_0x5055f0['elnnn'],_0x2e1704(0x147)));const {selected:_0x3c60e8}=await _0x27f7aa['prompt']([{'type':'list','name':_0x5055f0[_0x2e1704(0x17c)],'message':'Select\x20an\x20organization:','choices':_0xdfa552[_0x2e1704(0x151)](_0xd19f07=>({'name':_0xd19f07['name'],'value':_0xd19f07[_0x2e1704(0x15b)]}))}]);_0x4664e2=_0x3c60e8;}}_0x15ec3f=await _0x5055f0[_0x2e1704(0x144)](refreshTokenWithOrg,_0x15ec78,_0x15ec3f['refresh_token'],_0x4664e2);}process['stdout']['write']('Provisioning\x20CLI\x20token...');const _0x504610=await _0x5055f0['TxhZp'](provisionCliToken,_0x15ec3f[_0x2e1704(0x12f)]);return console[_0x2e1704(0x15d)]('\x20✓'),await _0x5055f0['ojHru'](storeToken,_0x504610['token']),_0x15ec3f['refresh_token']&&await storeRefreshToken(_0x15ec3f['refresh_token']),_0x504610['token'];}function sleep(_0x5eb155){return new Promise(_0xd97da8=>setTimeout(_0xd97da8,_0x5eb155));}
1
+ const _0xdd1a40=_0xaac7;(function(_0xfd4558,_0x4ad9f1){const _0x3c1e3b=_0xaac7,_0x573534=_0xfd4558();while(!![]){try{const _0x3df296=-parseInt(_0x3c1e3b(0x84))/0x1+parseInt(_0x3c1e3b(0xa8))/0x2*(parseInt(_0x3c1e3b(0x93))/0x3)+parseInt(_0x3c1e3b(0xb6))/0x4+parseInt(_0x3c1e3b(0x97))/0x5+-parseInt(_0x3c1e3b(0xa4))/0x6+parseInt(_0x3c1e3b(0x8f))/0x7*(-parseInt(_0x3c1e3b(0xaa))/0x8)+-parseInt(_0x3c1e3b(0x82))/0x9;if(_0x3df296===_0x4ad9f1)break;else _0x573534['push'](_0x573534['shift']());}catch(_0x21dd55){_0x573534['push'](_0x573534['shift']());}}}(_0x3ffa,0xd7bbb));import{spawn}from'child_process';import _0x471021 from'inquirer';function _0x3ffa(){const _0x165c92=['expires_in','startsWith','12307590KMeXDs','json','264581oZZgta','list','error_description','now','base64url','filter','GSzQR','isTTY','apiKey','XZyxq','firstName','3115BEIJTt','/organization/me','status','name','951FmmtFV','Failed\x20to\x20fetch\x20memberships:\x20','application/x-www-form-urlencoded','OxGVe','8829645eQfHlI','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','YpePG','prompt','iCMSd','Wakxq','OPYGq','ignore','fcvuW','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','text','Failed\x20to\x20provision\x20API\x20key:\x20','length','4379976aKAwpB','stdout','Failed\x20to\x20request\x20device\x20code:\x20','authorization_pending','8444wHqgAN','organizationId','14648efpxba','win32','from','lSMUM','cTbri','stdin','workosClientId','rObLr','Failed\x20to\x20create\x20organization:\x20','platform','refresh_token','interval','3824888seqUwi','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','apiKeys','token','darwin','access_token','Select\x20an\x20organization:','Authentication\x20failed','uUzIe','split','xdg-open','https://api.workos.com/user_management/authorize/device','oBxYr','write','/organization/my-memberships','ieLfa','lxrMU','ISouF','bdiWJ','GET','mcp:write','application/json','POST','error','WmFcb','open','Invalid\x20JWT\x20format','log','/organization/self-serve-signup','/api-keys','yBwbV','unref','jVefX','QdsWg','verification_uri_complete'];_0x3ffa=function(){return _0x165c92;};return _0x3ffa();}import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0xdd1a40(0xc2),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0x2fb00c){const _0x2fdf3e=_0xdd1a40,_0x1fe8f9={'jVefX':'POST'},_0x26b80a=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x1fe8f9[_0x2fdf3e(0x7d)],'headers':{'Content-Type':_0x2fdf3e(0x95)},'body':new URLSearchParams({'client_id':_0x2fb00c})});if(!_0x26b80a['ok']){const _0x1aa5cd=await _0x26b80a[_0x2fdf3e(0xa1)]();throw new Error(_0x2fdf3e(0xa6)+_0x26b80a[_0x2fdf3e(0x91)]+'\x20'+_0x1aa5cd);}return _0x26b80a[_0x2fdf3e(0x83)]();}export async function pollForTokens(_0x5a5682,_0x220018,_0x4dc460,_0x3a3ad8){const _0x18cfea=_0xdd1a40,_0x296504={'XZyxq':function(_0xa6114a,_0x58eb7a){return _0xa6114a*_0x58eb7a;},'DSbpN':function(_0x1bac27,_0x1d7759){return _0x1bac27<_0x1d7759;},'YNCca':function(_0x1a6d13,_0x2517f7,_0x58f2d5){return _0x1a6d13(_0x2517f7,_0x58f2d5);},'iCMSd':'POST','kwYXs':_0x18cfea(0x95),'GSzQR':'urn:ietf:params:oauth:grant-type:device_code','yBwbV':function(_0x27d82a,_0x432127){return _0x27d82a===_0x432127;},'oBxYr':function(_0x3eee3f,_0x3ba188){return _0x3eee3f===_0x3ba188;},'rObLr':'slow_down','aqqEQ':'Device\x20authorization\x20timed\x20out'},_0xfb9398=Date[_0x18cfea(0x87)]()+_0x3a3ad8*0x3e8;let _0x45a058=_0x296504[_0x18cfea(0x8d)](_0x4dc460,0x3e8);while(_0x296504['DSbpN'](Date['now'](),_0xfb9398)){await sleep(_0x45a058);const _0x4ef61e=await _0x296504['YNCca'](fetch,WORKOS_TOKEN_URL,{'method':_0x296504[_0x18cfea(0x9b)],'headers':{'Content-Type':_0x296504['kwYXs']},'body':new URLSearchParams({'client_id':_0x5a5682,'device_code':_0x220018,'grant_type':_0x296504[_0x18cfea(0x8a)]})});if(_0x4ef61e['ok'])return _0x4ef61e[_0x18cfea(0x83)]();const _0x4e9952=await _0x4ef61e['json']();if(_0x296504[_0x18cfea(0x7b)](_0x4e9952[_0x18cfea(0x74)],_0x18cfea(0xa7)))continue;if(_0x296504[_0x18cfea(0xc3)](_0x4e9952[_0x18cfea(0x74)],_0x296504[_0x18cfea(0xb1)])){_0x45a058+=0x3e8;continue;}throw new Error(_0x4e9952[_0x18cfea(0x86)]||_0x4e9952['error']||_0x18cfea(0xbe));}throw new Error(_0x296504['aqqEQ']);}async function fetchUserProfile(_0x59a884){const _0xc8a0b1=_0xdd1a40,_0x3b3fd7={'bdiWJ':function(_0x285a2e,_0x47fa1c,_0x331227){return _0x285a2e(_0x47fa1c,_0x331227);},'vdXMv':'GET'},_0x1c17b5=getApiBaseUrl();try{const _0x3e59a6=await _0x3b3fd7[_0xc8a0b1(0xc9)](fetch,_0x1c17b5+_0xc8a0b1(0x90),{'method':_0x3b3fd7['vdXMv'],'headers':{'workos-token':_0x59a884}});if(_0x3e59a6['ok'])return _0x3e59a6['json']();}catch{}return null;}function buildKeyName(_0x55e70f,_0x1b7acd){const _0xcef28c=_0xdd1a40,_0x24e95c={'MfXtS':function(_0x289a27,_0x1d53a8){return _0x289a27===_0x1d53a8;}},_0x57d7a6=_0x1b7acd[_0xcef28c(0x89)](_0xe2dfda=>_0xe2dfda[_0xcef28c(0x92)]===_0x55e70f||_0xe2dfda['name'][_0xcef28c(0x81)](_0x55e70f+'\x20('));if(_0x24e95c['MfXtS'](_0x57d7a6[_0xcef28c(0xa3)],0x0))return _0x55e70f;return _0x55e70f+'\x20('+(_0x57d7a6['length']+0x1)+')';}export async function provisionApiKey(_0x5de118){const _0x47632a=_0xdd1a40,_0x31d457={'ZqvSj':function(_0x2f7980,_0x273dea,_0x455016){return _0x2f7980(_0x273dea,_0x455016);},'lxrMU':function(_0x4a7b55,_0x54b7a0,_0x19fad2){return _0x4a7b55(_0x54b7a0,_0x19fad2);},'Wakxq':_0x47632a(0xcb)},_0x472ff7=getApiBaseUrl(),_0x174f1e={'Content-Type':'application/json','workos-token':_0x5de118},_0x5e7aff=await fetchUserProfile(_0x5de118),_0x34c1d8=_0x5e7aff?.[_0x47632a(0x8e)]||_0x5e7aff?.['email']?.['split']('@')[0x0],_0x2efe5b=_0x34c1d8?_0x34c1d8+'\x27s\x20CLI\x20Key':'CLI\x20Key';let _0x8832f7=[];try{const _0x4fec09=await _0x31d457['ZqvSj'](fetch,_0x472ff7+_0x47632a(0x7a),{'method':'GET','headers':_0x174f1e});if(_0x4fec09['ok']){const _0xbb2c1=await _0x4fec09['json']();_0x8832f7=_0xbb2c1[_0x47632a(0xb9)];}}catch{}const _0x5bd9ad=_0x31d457[_0x47632a(0xc7)](buildKeyName,_0x2efe5b,_0x8832f7),_0x3505df=await _0x31d457[_0x47632a(0xc7)](fetch,_0x472ff7+_0x47632a(0x7a),{'method':'POST','headers':_0x174f1e,'body':JSON['stringify']({'name':_0x5bd9ad,'scope':_0x31d457[_0x47632a(0x9c)]})});if(!_0x3505df['ok']){const _0x48e394=await _0x3505df[_0x47632a(0xa1)]();throw new Error(_0x47632a(0xa2)+_0x3505df[_0x47632a(0x91)]+'\x20'+_0x48e394);}const _0x2ca05e=await _0x3505df[_0x47632a(0x83)]();return _0x2ca05e[_0x47632a(0x8c)]['token'];}function _0xaac7(_0x318622,_0x43a8d8){_0x318622=_0x318622-0x72;const _0x3ffaf2=_0x3ffa();let _0xaac7e8=_0x3ffaf2[_0x318622];return _0xaac7e8;}export function openBrowser(_0x4dc7a2){const _0x23b939=_0xdd1a40,_0x72677={'jcoSo':function(_0x3450d9,_0x18028e,_0x1d0db6,_0x5a0d8d){return _0x3450d9(_0x18028e,_0x1d0db6,_0x5a0d8d);},'fInBm':'start','kyacW':function(_0x528a89,_0x5b2ef5){return _0x528a89===_0x5b2ef5;},'nBkTy':_0x23b939(0xbb),'lSMUM':_0x23b939(0x76),'OPYGq':function(_0x23f7b5,_0xb7501e,_0x39c40d,_0x1a7a25){return _0x23f7b5(_0xb7501e,_0x39c40d,_0x1a7a25);}};try{if(process[_0x23b939(0xb3)]===_0x23b939(0xab)){const _0x1cfec0=_0x72677['jcoSo'](spawn,'cmd',['/c',_0x72677['fInBm'],'',_0x4dc7a2],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0x1cfec0[_0x23b939(0x7c)]();return;}const _0x252f89=_0x72677['kyacW'](process['platform'],_0x72677['nBkTy'])?_0x72677[_0x23b939(0xad)]:_0x23b939(0xc1),_0x328cab=_0x72677[_0x23b939(0x9d)](spawn,_0x252f89,[_0x4dc7a2],{'detached':!![],'stdio':_0x23b939(0x9e)});_0x328cab[_0x23b939(0x7c)]();}catch{}}function decodeJwtPayload(_0x3e5b63){const _0x20b553=_0xdd1a40,_0x5b9db8=_0x3e5b63[_0x20b553(0xc0)]('.');if(_0x5b9db8['length']!==0x3)throw new Error(_0x20b553(0x77));const _0x28fe5c=Buffer[_0x20b553(0xac)](_0x5b9db8[0x1],_0x20b553(0x88))['toString']('utf-8');return JSON['parse'](_0x28fe5c);}async function selfServeSignup(_0x5390ec){const _0x46900d=_0xdd1a40,_0x634fa1={'tGINR':_0x46900d(0x73),'uSHZE':_0x46900d(0x72)},_0x57187f=getApiBaseUrl(),_0xb8f6b5=await fetch(_0x57187f+_0x46900d(0x79),{'method':_0x634fa1['tGINR'],'headers':{'Content-Type':_0x634fa1['uSHZE'],'workos-token':_0x5390ec}});if(!_0xb8f6b5['ok']){const _0x27646d=await _0xb8f6b5['text']();throw new Error(_0x46900d(0xb2)+_0xb8f6b5['status']+'\x20'+_0x27646d);}return _0xb8f6b5['json']();}async function fetchMyMemberships(_0xb179ce){const _0x350dfa=_0xdd1a40,_0x1441bf={'PzEhR':function(_0x5525ea){return _0x5525ea();},'WmFcb':_0x350dfa(0xca)},_0x6e9e5=_0x1441bf['PzEhR'](getApiBaseUrl),_0x4ef582=await fetch(_0x6e9e5+_0x350dfa(0xc5),{'method':_0x1441bf[_0x350dfa(0x75)],'headers':{'workos-token':_0xb179ce}});if(!_0x4ef582['ok']){const _0x579f6a=await _0x4ef582['text']();throw new Error(_0x350dfa(0x94)+_0x4ef582['status']+'\x20'+_0x579f6a);}const _0x4e2ef7=await _0x4ef582[_0x350dfa(0x83)]();return _0x4e2ef7['memberships'];}async function refreshTokenWithOrg(_0x2c59a3,_0xa4db4a,_0x34652c){const _0x42b4f6=_0xdd1a40,_0xfa1a5b={'ieLfa':'POST','QdsWg':_0x42b4f6(0xb4)},_0x5dfa20=await fetch(WORKOS_TOKEN_URL,{'method':_0xfa1a5b[_0x42b4f6(0xc6)],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x2c59a3,'grant_type':_0xfa1a5b[_0x42b4f6(0x7e)],'refresh_token':_0xa4db4a,'organization_id':_0x34652c})});if(!_0x5dfa20['ok']){const _0x429cd2=await _0x5dfa20['text']();throw new Error(_0x42b4f6(0xa0)+_0x5dfa20['status']+'\x20'+_0x429cd2);}return _0x5dfa20['json']();}async function provisionCliToken(_0x47a40b){const _0x35beb2=_0xdd1a40,_0x59418f={'ewZul':function(_0x5b7954){return _0x5b7954();},'HUzBF':_0x35beb2(0x72)},_0x4df45d=_0x59418f['ewZul'](getApiBaseUrl),_0x222b4a=await fetch(_0x4df45d+'/cli-auth/token',{'method':'POST','headers':{'Content-Type':_0x59418f['HUzBF'],'workos-token':_0x47a40b}});if(!_0x222b4a['ok']){const _0x36c45f=await _0x222b4a['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x222b4a[_0x35beb2(0x91)]+'\x20'+_0x36c45f);}return _0x222b4a[_0x35beb2(0x83)]();}export async function runDeviceAuthFlow(){const _0x18b524=_0xdd1a40,_0x231422={'YpePG':function(_0x4aab4d){return _0x4aab4d();},'QchfL':'\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','SwBUn':_0x18b524(0x98),'VtbgY':'Waiting\x20for\x20authentication...','JQarV':function(_0x4c19b5,_0x9f3190,_0x50b64f,_0x7b1e1b,_0x26cac7){return _0x4c19b5(_0x9f3190,_0x50b64f,_0x7b1e1b,_0x26cac7);},'ISouF':function(_0x3acbbc,_0x58bd56){return _0x3acbbc(_0x58bd56);},'cTbri':function(_0x438c8b,_0x2b5744){return _0x438c8b===_0x2b5744;},'fcvuW':'Setting\x20up\x20your\x20organization...','OxGVe':function(_0x1d4a54,_0x2f4d66){return _0x1d4a54+_0x2f4d66;},'yAgIl':_0x18b524(0x85),'nUwvQ':'selected','LtbwT':_0x18b524(0xbd),'uUzIe':function(_0xb3b0c,_0x424eff,_0x3d4a9b,_0x205f44){return _0xb3b0c(_0x424eff,_0x3d4a9b,_0x205f44);},'WnWIH':'Provisioning\x20CLI\x20token...'},_0x2e3129=_0x231422[_0x18b524(0x99)](getCurrentEnvironment),_0x54df67=ENVIRONMENT_CONFIGS[_0x2e3129][_0x18b524(0xb0)],_0x4185c1=await requestDeviceCode(_0x54df67);console[_0x18b524(0x78)](_0x231422['QchfL']),console['log'](_0x231422['SwBUn']),openBrowser(_0x4185c1['verification_uri_complete']),console[_0x18b524(0x78)](_0x18b524(0xb8)+_0x4185c1[_0x18b524(0x7f)]),console['log']('Code:\x20'+_0x4185c1['user_code']+'\x0a'),process[_0x18b524(0xa5)]['write'](_0x231422['VtbgY']);let _0x3ac8c1=await _0x231422['JQarV'](pollForTokens,_0x54df67,_0x4185c1['device_code'],_0x4185c1[_0x18b524(0xb5)],_0x4185c1[_0x18b524(0x80)]);console['log']('\x20✓');const _0x4bfb13=decodeJwtPayload(_0x3ac8c1['access_token']);if(!_0x4bfb13['org_id']){const _0x487d8a=await _0x231422[_0x18b524(0xc8)](fetchMyMemberships,_0x3ac8c1[_0x18b524(0xbc)]);let _0x42a833;if(_0x231422[_0x18b524(0xae)](_0x487d8a['length'],0x0)){process[_0x18b524(0xa5)][_0x18b524(0xc4)](_0x231422[_0x18b524(0x9f)]);const _0x3a7a61=await selfServeSignup(_0x3ac8c1[_0x18b524(0xbc)]);_0x42a833=_0x3a7a61[_0x18b524(0xa9)],console[_0x18b524(0x78)]('\x20✓');}else{if(_0x487d8a['length']===0x1)_0x42a833=_0x487d8a[0x0][_0x18b524(0xa9)],console[_0x18b524(0x78)]('Using\x20organization:\x20'+_0x487d8a[0x0][_0x18b524(0x92)]);else{const _0x29129f=process[_0x18b524(0xaf)][_0x18b524(0x8b)]&&process[_0x18b524(0xa5)]['isTTY'];if(!_0x29129f)throw new Error(_0x231422[_0x18b524(0x96)](_0x18b524(0xb7),'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.'));const {selected:_0x467e66}=await _0x471021[_0x18b524(0x9a)]([{'type':_0x231422['yAgIl'],'name':_0x231422['nUwvQ'],'message':_0x231422['LtbwT'],'choices':_0x487d8a['map'](_0x423302=>({'name':_0x423302[_0x18b524(0x92)],'value':_0x423302['organizationId']}))}]);_0x42a833=_0x467e66;}}_0x3ac8c1=await _0x231422[_0x18b524(0xbf)](refreshTokenWithOrg,_0x54df67,_0x3ac8c1[_0x18b524(0xb4)],_0x42a833);}process['stdout'][_0x18b524(0xc4)](_0x231422['WnWIH']);const _0x6420c4=await provisionCliToken(_0x3ac8c1[_0x18b524(0xbc)]);return console['log']('\x20✓'),await storeToken(_0x6420c4[_0x18b524(0xba)]),_0x3ac8c1['refresh_token']&&await storeRefreshToken(_0x3ac8c1[_0x18b524(0xb4)]),_0x6420c4['token'];}function sleep(_0x10650d){return new Promise(_0x40928f=>setTimeout(_0x40928f,_0x10650d));}
@@ -1 +1 @@
1
- function _0x4b89(){const _0x1a404a=['XaWvJ','mvGMo','off','iyZeS','ZEtTL','http://localhost:8080/mcp','16816869bBvUze','5ykNKZj','\x22.\x20','RANGER_CLI_ENV','https://ai-proxy-301751771437.us-central1.run.app','https://ai-proxy-716115358910.us-central1.run.app','RANGER_USE_NOVA_ACT','https://mcp-auth.ranger.net/mcp','728QhXdzy','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','auto','525656vqidxC','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','72320AyRXdk','trim','env','https://mcp-auth.staging.ranger.net/mcp','http://localhost:8080','client_01J9CBYM2DKWV9HM17D95Z540K','error','toLowerCase','Btrjd','230398IOcpgo','117257aXAYdg','QDOkL','RXUiY','2029299CNWECk','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','https://api.ranger.net','RANGER_HOOKS','4062222dPLfow','RANGER_TRANSPORT','nova-act-cli','mcpAuthUrl','prod','true','client_01J9CBYM7M5ZETCF7G6614DXR2','http://localhost:8090','playwright-cli','pHfDO'];_0x4b89=function(){return _0x1a404a;};return _0x4b89();}const _0x26f9dd=_0x179f;(function(_0x238c7a,_0x14bc40){const _0x4e5393=_0x179f,_0x28d5a6=_0x238c7a();while(!![]){try{const _0x4a264c=parseInt(_0x4e5393(0xef))/0x1+parseInt(_0x4e5393(0xee))/0x2+parseInt(_0x4e5393(0xf2))/0x3+-parseInt(_0x4e5393(0xe3))/0x4*(parseInt(_0x4e5393(0xd9))/0x5)+parseInt(_0x4e5393(0xf6))/0x6+parseInt(_0x4e5393(0xe0))/0x7*(parseInt(_0x4e5393(0xe5))/0x8)+-parseInt(_0x4e5393(0xd8))/0x9;if(_0x4a264c===_0x14bc40)break;else _0x28d5a6['push'](_0x28d5a6['shift']());}catch(_0x13703b){_0x28d5a6['push'](_0x28d5a6['shift']());}}}(_0x4b89,0x80733));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':_0x26f9dd(0xf4),'workosClientId':_0x26f9dd(0xfc),'aiProxyUrl':_0x26f9dd(0xdd),'mcpAuthUrl':_0x26f9dd(0xdf)},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':_0x26f9dd(0xea),'aiProxyUrl':_0x26f9dd(0xdc),'mcpAuthUrl':_0x26f9dd(0xe8)},'local':{'apiBaseUrl':_0x26f9dd(0xe9),'workosClientId':_0x26f9dd(0xea),'aiProxyUrl':_0x26f9dd(0xfd),'mcpAuthUrl':_0x26f9dd(0xd7)}};export const DEFAULT_ENVIRONMENT=_0x26f9dd(0xfa);export function isValidEnvironment(_0x5e2500){const _0x5e9da9=_0x26f9dd,_0x5b96f3={'FgQln':'prod','ZEtTL':function(_0x3612fe,_0x58218c){return _0x3612fe===_0x58218c;},'Altcj':'local'};return _0x5e2500===_0x5b96f3['FgQln']||_0x5b96f3[_0x5e9da9(0xd6)](_0x5e2500,'staging')||_0x5b96f3[_0x5e9da9(0xd6)](_0x5e2500,_0x5b96f3['Altcj']);}export function getCurrentEnvironment(){const _0x2b58a9=_0x26f9dd,_0x38902c=process[_0x2b58a9(0xe7)][_0x2b58a9(0xdb)];if(_0x38902c&&isValidEnvironment(_0x38902c))return _0x38902c;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x3114d5=_0x26f9dd,_0x2b5f0d={'iyZeS':function(_0x27fa55){return _0x27fa55();}};return ENVIRONMENT_CONFIGS[_0x2b5f0d[_0x3114d5(0xd5)](getCurrentEnvironment)]['apiBaseUrl'];}export function getAiProxyUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x54a432=_0x26f9dd;return process[_0x54a432(0xe7)]['RANGER_MCP_AUTH_URL']??ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x54a432(0xf9)];}function _0x179f(_0x2840cd,_0x420999){_0x2840cd=_0x2840cd-0xd4;const _0x4b89e3=_0x4b89();let _0x179f9f=_0x4b89e3[_0x2840cd];return _0x179f9f;}export function isByokEnabled(){const _0x36617c=_0x26f9dd;return process[_0x36617c(0xe7)]['RANGER_BYOK']===_0x36617c(0xfb);}function isVerificationTransport(_0x419e3a){const _0x1e26ab=_0x26f9dd,_0xba4aae={'Btrjd':'mcp','pHfDO':function(_0x214f69,_0x28e71c){return _0x214f69===_0x28e71c;},'uxNnd':'rangerwright-cli'};return _0x419e3a===_0xba4aae[_0x1e26ab(0xed)]||_0xba4aae[_0x1e26ab(0xff)](_0x419e3a,_0x1e26ab(0xfe))||_0x419e3a===_0x1e26ab(0xf8)||_0xba4aae['pHfDO'](_0x419e3a,_0xba4aae['uxNnd']);}const LEGACY_TRANSPORT_ENV_VARS=[_0x26f9dd(0xde),'RANGER_DISABLE_MCP'];export function getVerificationTransport(){const _0x479ebb=_0x26f9dd,_0x5813f0={'mvGMo':function(_0x1b46b5,_0x353bff){return _0x1b46b5(_0x353bff);}},_0x1bee7d=process[_0x479ebb(0xe7)][_0x479ebb(0xf7)]?.[_0x479ebb(0xe6)]();if(_0x1bee7d){if(_0x5813f0[_0x479ebb(0x101)](isVerificationTransport,_0x1bee7d))return _0x1bee7d;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x1bee7d+_0x479ebb(0xf3));}const _0x577a71=LEGACY_TRANSPORT_ENV_VARS['find'](_0x5c0704=>process[_0x479ebb(0xe7)][_0x5c0704]);if(_0x577a71)throw new Error(_0x577a71+_0x479ebb(0xe4));return'mcp';}export function resolveHookMode(_0x289207=process['env']){const _0x51eaf0=_0x26f9dd,_0x57c02f={'XaWvJ':function(_0x7f8122,_0xa8d186){return _0x7f8122===_0xa8d186;},'QDOkL':function(_0x3e0f11,_0x2908d0){return _0x3e0f11===_0x2908d0;},'RXUiY':function(_0x525af4,_0x3bf94c){return _0x525af4+_0x3bf94c;},'zeYGC':'auto'},_0xd7f12d=_0x289207[_0x51eaf0(0xf5)]?.[_0x51eaf0(0xe6)]()[_0x51eaf0(0xec)]();if(!_0xd7f12d)return'auto';if(_0x57c02f[_0x51eaf0(0x100)](_0xd7f12d,_0x51eaf0(0xd4))||_0xd7f12d==='on'||_0x57c02f[_0x51eaf0(0xf0)](_0xd7f12d,_0x51eaf0(0xe2)))return _0xd7f12d;return console[_0x51eaf0(0xeb)](_0x57c02f[_0x51eaf0(0xf1)](_0x51eaf0(0xe1)+_0x289207['RANGER_HOOKS']+_0x51eaf0(0xda),'Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.')),_0x57c02f['zeYGC'];}
1
+ const _0x4125d2=_0x92a7;(function(_0x5d4733,_0x1074cf){const _0x159bb0=_0x92a7,_0x21f154=_0x5d4733();while(!![]){try{const _0x367c41=-parseInt(_0x159bb0(0xcf))/0x1*(-parseInt(_0x159bb0(0xd5))/0x2)+-parseInt(_0x159bb0(0xca))/0x3+parseInt(_0x159bb0(0xdc))/0x4+parseInt(_0x159bb0(0xe4))/0x5*(-parseInt(_0x159bb0(0xde))/0x6)+-parseInt(_0x159bb0(0xef))/0x7*(parseInt(_0x159bb0(0xe1))/0x8)+-parseInt(_0x159bb0(0xd3))/0x9+parseInt(_0x159bb0(0xec))/0xa;if(_0x367c41===_0x1074cf)break;else _0x21f154['push'](_0x21f154['shift']());}catch(_0x2bdd19){_0x21f154['push'](_0x21f154['shift']());}}}(_0xdef8,0x84701));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':'client_01J9CBYM7M5ZETCF7G6614DXR2','aiProxyUrl':'https://ai-proxy-716115358910.us-central1.run.app','mcpAuthUrl':_0x4125d2(0xe6)},'staging':{'apiBaseUrl':_0x4125d2(0xcc),'workosClientId':_0x4125d2(0xd7),'aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':'https://mcp-auth.staging.ranger.net/mcp'},'local':{'apiBaseUrl':_0x4125d2(0xe2),'workosClientId':_0x4125d2(0xd7),'aiProxyUrl':_0x4125d2(0xd2),'mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT='prod';function _0xdef8(){const _0x334021=['auto','playwright-cli','RANGER_CLI_ENV','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.','22219990ngfyXf','mcp','oEUDw','819xowdUk','vSKam','pcOEP','2543802lymbed','staging','https://api.staging.ranger.net','nova-act-cli','env','1zxrIfl','RANGER_TRANSPORT','RANGER_DISABLE_MCP','http://localhost:8090','4048740ugpyFO','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','1162724DnMeFU','RANGER_MCP_AUTH_URL','client_01J9CBYM2DKWV9HM17D95Z540K','uDORs','mcpAuthUrl','RANGER_BYOK','UKgIV','3067460coVJqr','RANGER_USE_NOVA_ACT','59394GJMbNW','find','RANGER_HOOKS','54664ltopSJ','http://localhost:8080','HQLCf','470htwmRx','shUsH','https://mcp-auth.ranger.net/mcp','cLDrM'];_0xdef8=function(){return _0x334021;};return _0xdef8();}function _0x92a7(_0x57f0a1,_0x32a0d9){_0x57f0a1=_0x57f0a1-0xc8;const _0xdef897=_0xdef8();let _0x92a75c=_0xdef897[_0x57f0a1];return _0x92a75c;}export function isValidEnvironment(_0x1b5293){const _0x3f8b33=_0x4125d2,_0x3336ac={'GdnHr':function(_0x5a55dc,_0x59b09e){return _0x5a55dc===_0x59b09e;},'dCQxZ':'prod','oEUDw':function(_0x52e6a8,_0x54a684){return _0x52e6a8===_0x54a684;},'vSKam':_0x3f8b33(0xcb)};return _0x3336ac['GdnHr'](_0x1b5293,_0x3336ac['dCQxZ'])||_0x3336ac[_0x3f8b33(0xee)](_0x1b5293,_0x3336ac[_0x3f8b33(0xc8)])||_0x1b5293==='local';}export function getCurrentEnvironment(){const _0x1723fa=_0x4125d2,_0x37a906=process['env'][_0x1723fa(0xea)];if(_0x37a906&&isValidEnvironment(_0x37a906))return _0x37a906;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x37680e=_0x4125d2,_0x416caf={'shUsH':function(_0xa20e84){return _0xa20e84();}};return ENVIRONMENT_CONFIGS[_0x416caf[_0x37680e(0xe5)](getCurrentEnvironment)]['apiBaseUrl'];}export function getAiProxyUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x3b1492=_0x4125d2;return process['env'][_0x3b1492(0xd6)]??ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x3b1492(0xd9)];}export function isByokEnabled(){const _0x34eebe=_0x4125d2,_0x3929a0={'aarLf':'true'};return process['env'][_0x34eebe(0xda)]===_0x3929a0['aarLf'];}function isVerificationTransport(_0x4ac5b6){const _0x4677db=_0x4125d2,_0x22ea56={'jHWIY':function(_0x295253,_0x4041a3){return _0x295253===_0x4041a3;},'RsAHs':_0x4677db(0xed),'kfbim':function(_0x36f058,_0x526e20){return _0x36f058===_0x526e20;},'jNRJV':_0x4677db(0xcd),'uDORs':function(_0x46929d,_0x504d88){return _0x46929d===_0x504d88;},'abcaU':'rangerwright-cli'};return _0x22ea56['jHWIY'](_0x4ac5b6,_0x22ea56['RsAHs'])||_0x4ac5b6===_0x4677db(0xe9)||_0x22ea56['kfbim'](_0x4ac5b6,_0x22ea56['jNRJV'])||_0x22ea56[_0x4677db(0xd8)](_0x4ac5b6,_0x22ea56['abcaU']);}const LEGACY_TRANSPORT_ENV_VARS=[_0x4125d2(0xdd),_0x4125d2(0xd1)];export function getVerificationTransport(){const _0x3738a4=_0x4125d2,_0x2f36c1={'TmlFq':function(_0x39824f,_0x4b6378){return _0x39824f(_0x4b6378);},'HQLCf':'mcp'},_0x3b41bf=process[_0x3738a4(0xce)][_0x3738a4(0xd0)]?.['trim']();if(_0x3b41bf){if(_0x2f36c1['TmlFq'](isVerificationTransport,_0x3b41bf))return _0x3b41bf;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x3b41bf+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x5264b4=LEGACY_TRANSPORT_ENV_VARS[_0x3738a4(0xdf)](_0xff36b8=>process[_0x3738a4(0xce)][_0xff36b8]);if(_0x5264b4)throw new Error(_0x5264b4+_0x3738a4(0xd4));return _0x2f36c1[_0x3738a4(0xe3)];}export function resolveHookMode(_0x1170f9=process[_0x4125d2(0xce)]){const _0x57cc3b=_0x4125d2,_0x2b109a={'pcOEP':_0x57cc3b(0xe8),'UKgIV':function(_0xd86c53,_0x356656){return _0xd86c53===_0x356656;},'cLDrM':'off'},_0x446dc5=_0x1170f9['RANGER_HOOKS']?.['trim']()['toLowerCase']();if(!_0x446dc5)return _0x2b109a[_0x57cc3b(0xc9)];if(_0x2b109a[_0x57cc3b(0xdb)](_0x446dc5,_0x2b109a[_0x57cc3b(0xe7)])||_0x2b109a[_0x57cc3b(0xdb)](_0x446dc5,'on')||_0x2b109a[_0x57cc3b(0xdb)](_0x446dc5,_0x57cc3b(0xe8)))return _0x446dc5;return console['error']('[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22'+_0x1170f9[_0x57cc3b(0xe0)]+'\x22.\x20'+_0x57cc3b(0xeb)),_0x57cc3b(0xe8);}
@@ -1 +1 @@
1
- (function(_0x359ece,_0x3523d0){const _0x44952e=_0x2434,_0x1c93df=_0x359ece();while(!![]){try{const _0x2dae9d=parseInt(_0x44952e(0x177))/0x1+-parseInt(_0x44952e(0x13e))/0x2*(parseInt(_0x44952e(0x137))/0x3)+parseInt(_0x44952e(0x132))/0x4*(parseInt(_0x44952e(0x173))/0x5)+-parseInt(_0x44952e(0x17b))/0x6+parseInt(_0x44952e(0x13f))/0x7+parseInt(_0x44952e(0x149))/0x8+-parseInt(_0x44952e(0x14a))/0x9*(parseInt(_0x44952e(0x174))/0xa);if(_0x2dae9d===_0x3523d0)break;else _0x1c93df['push'](_0x1c93df['shift']());}catch(_0x4949ba){_0x1c93df['push'](_0x1c93df['shift']());}}}(_0x2895,0xd5c94));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x2f295f){const _0x34e735=_0x2434,_0x15d5bc={'BCRSC':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ucPJt':_0x34e735(0x14e),'tWqnu':_0x34e735(0x17a)},_0x3df7da=await getToken();if(!_0x3df7da)throw new Error(_0x15d5bc[_0x34e735(0x158)]);const _0x17b346=getApiBaseUrl(),_0x355d96=await fetch(_0x17b346+'/api/v1/mcp/features',{'method':_0x34e735(0x15e),'headers':{'Authorization':'Bearer\x20'+_0x3df7da,'Content-Type':_0x15d5bc['ucPJt']},'body':JSON[_0x34e735(0x163)](_0x2f295f)});if(!_0x355d96['ok']){if(_0x355d96[_0x34e735(0x151)]===0x192){const _0xb33011=await _0x355d96[_0x34e735(0x139)](),_0x52f201=_0xb33011[_0x34e735(0x144)]||_0x15d5bc[_0x34e735(0x13b)];throw new Error((_0xb33011['message']||'Feature\x20limit\x20exceeded')+_0x34e735(0x14d)+_0x52f201);}const _0x24bde8=await _0x355d96['text']();throw new Error(_0x34e735(0x178)+_0x24bde8);}return _0x355d96[_0x34e735(0x139)]();}export async function listFeatures(_0x4eaedf){const _0x10cdc8=_0x2434,_0x461d40={'GneIT':'gitBranch','mpEDk':'offset','JheXL':_0x10cdc8(0x145),'RUBnr':'true','RPOwG':'GET'},_0x2a1860=await getToken();if(!_0x2a1860)throw new Error(_0x10cdc8(0x167));const _0x448a31=getApiBaseUrl(),_0x180e0a=new URLSearchParams();if(_0x4eaedf?.[_0x10cdc8(0x13d)])_0x180e0a['set'](_0x10cdc8(0x13d),_0x4eaedf['gitRepoUrl']);if(_0x4eaedf?.[_0x10cdc8(0x133)])_0x180e0a['set'](_0x461d40['GneIT'],_0x4eaedf[_0x10cdc8(0x133)]);if(_0x4eaedf?.['limit'])_0x180e0a['set']('limit',_0x4eaedf['limit'][_0x10cdc8(0x171)]());if(_0x4eaedf?.['offset'])_0x180e0a['set'](_0x461d40[_0x10cdc8(0x166)],_0x4eaedf['offset']['toString']());if(_0x4eaedf?.['includeDeleted'])_0x180e0a['set'](_0x461d40[_0x10cdc8(0x14f)],_0x461d40[_0x10cdc8(0x15b)]);const _0x5985f6=_0x448a31+_0x10cdc8(0x175)+(_0x180e0a[_0x10cdc8(0x171)]()?'?'+_0x180e0a[_0x10cdc8(0x171)]():''),_0x4b2455=await fetch(_0x5985f6,{'method':_0x461d40[_0x10cdc8(0x15d)],'headers':{'Authorization':_0x10cdc8(0x16b)+_0x2a1860}});if(!_0x4b2455['ok']){const _0x207ee1=await _0x4b2455[_0x10cdc8(0x16f)]();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x207ee1);}return _0x4b2455[_0x10cdc8(0x139)]();}export async function getFeature(_0x1d4242){const _0x58077b=_0x2434,_0xf0392c={'mcFIO':function(_0x31b0f1){return _0x31b0f1();},'XNUdl':_0x58077b(0x167)},_0x41c565=await _0xf0392c['mcFIO'](getToken);if(!_0x41c565)throw new Error(_0xf0392c['XNUdl']);const _0x2ec336=_0xf0392c[_0x58077b(0x153)](getApiBaseUrl),_0x5e4cda=await fetch(_0x2ec336+'/api/v1/mcp/features/'+_0x1d4242,{'method':'GET','headers':{'Authorization':_0x58077b(0x16b)+_0x41c565}});if(!_0x5e4cda['ok']){const _0x194f3c=await _0x5e4cda[_0x58077b(0x16f)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x194f3c);}return _0x5e4cda[_0x58077b(0x139)]();}export async function updateFeature(_0x7c448f,_0x1c1ba3){const _0x4598bb=_0x2434,_0x3b603b={'WqIKa':_0x4598bb(0x167),'GMCix':function(_0x289017,_0x3e70ff,_0x5b88df){return _0x289017(_0x3e70ff,_0x5b88df);},'TLHzG':'PATCH','Gvkwe':_0x4598bb(0x14e)},_0x263d2e=await getToken();if(!_0x263d2e)throw new Error(_0x3b603b[_0x4598bb(0x159)]);const _0x54f36b=getApiBaseUrl(),_0xad38b0=await _0x3b603b[_0x4598bb(0x136)](fetch,_0x54f36b+_0x4598bb(0x161)+_0x7c448f,{'method':_0x3b603b['TLHzG'],'headers':{'Authorization':_0x4598bb(0x16b)+_0x263d2e,'Content-Type':_0x3b603b['Gvkwe']},'body':JSON['stringify'](_0x1c1ba3)});if(!_0xad38b0['ok']){const _0xcdcfa=await _0xad38b0[_0x4598bb(0x16f)]();throw new Error(_0x4598bb(0x148)+_0xcdcfa);}return _0xad38b0[_0x4598bb(0x139)]();}export async function createChecklistItem(_0x42c896,_0x268bfe,_0x4f69c7){const _0x20328f=_0x2434,_0x1b13b9={'FhMmF':'POST'},_0x118f26=await getToken();if(!_0x118f26)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x51050a=getApiBaseUrl(),_0x120570=await fetch(_0x51050a+'/api/v1/mcp/features/'+_0x42c896+_0x20328f(0x16a),{'method':_0x1b13b9['FhMmF'],'headers':{'Authorization':_0x20328f(0x16b)+_0x118f26,'Content-Type':_0x20328f(0x14e)},'body':JSON[_0x20328f(0x163)]({'description':_0x268bfe,'position':_0x4f69c7})});if(!_0x120570['ok']){const _0x22fbf1=await _0x120570['text']();throw new Error(_0x20328f(0x16c)+_0x22fbf1);}return _0x120570[_0x20328f(0x139)]();}export async function updateChecklistItem(_0x3f4174,_0x4a4ef8,_0x1ffb4b){const _0x2e063b=_0x2434,_0x3878b5={'epLWM':function(_0x52b09d){return _0x52b09d();},'MVvei':function(_0x2d6d21,_0x3e20d0,_0x18e220){return _0x2d6d21(_0x3e20d0,_0x18e220);},'GFftK':'PATCH'};return withRetry(async()=>{const _0x3c621=_0x2434,_0x2bb566=await getToken();if(!_0x2bb566)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1c81b7=_0x3878b5[_0x3c621(0x146)](getApiBaseUrl),_0x31b995=await _0x3878b5['MVvei'](fetch,_0x1c81b7+_0x3c621(0x161)+_0x3f4174+_0x3c621(0x16e)+_0x4a4ef8,{'method':_0x3878b5[_0x3c621(0x17d)],'headers':{'Authorization':_0x3c621(0x16b)+_0x2bb566,'Content-Type':_0x3c621(0x14e)},'body':JSON['stringify'](_0x1ffb4b)});if(!_0x31b995['ok']){const _0x58f536=await _0x31b995['text']();throw new Error(_0x3c621(0x143)+_0x58f536);}return _0x31b995['json']();},{'label':_0x2e063b(0x156)});}export async function getFeatureReport(_0x410a65){const _0x54023a=_0x2434,_0x36bc3f={'Lkaax':function(_0xe99aea){return _0xe99aea();}},_0x2527a2=await _0x36bc3f[_0x54023a(0x142)](getToken);if(!_0x2527a2)throw new Error(_0x54023a(0x167));const _0x206cbc=getApiBaseUrl(),_0x268530=await fetch(_0x206cbc+'/api/v1/mcp/features/'+_0x410a65+'/report',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x2527a2}});if(!_0x268530['ok']){const _0x5b563c=await _0x268530['text']();throw new Error(_0x54023a(0x13a)+_0x5b563c);}return _0x268530[_0x54023a(0x139)]();}export async function getFeatureReportMarkdown(_0x1dc508,_0x2e38bd){const _0x5beab9=_0x2434,_0x1e5ad4={'EiiCm':_0x5beab9(0x167),'WZwBh':'style','FCSMs':function(_0x4ca8b1,_0x3c548b,_0x526ce9){return _0x4ca8b1(_0x3c548b,_0x526ce9);},'mBlqU':_0x5beab9(0x172)},_0x5aa60b=await getToken();if(!_0x5aa60b)throw new Error(_0x1e5ad4[_0x5beab9(0x13c)]);const _0x2ae395=getApiBaseUrl(),_0x4ab570=new URLSearchParams(),_0xecb6ea=(_0x2e38bd?.[_0x5beab9(0x170)]?.['length']??0x0)>0x0,_0x32155d=Boolean(_0x2e38bd?.[_0x5beab9(0x17c)]);_0xecb6ea&&_0x2e38bd?.[_0x5beab9(0x170)]&&_0x4ab570['set'](_0x5beab9(0x170),_0x2e38bd[_0x5beab9(0x170)][_0x5beab9(0x14c)](','));_0x32155d&&_0x2e38bd?.['sessionId']&&_0x4ab570['set']('sessionId',_0x2e38bd['sessionId']);!_0xecb6ea&&!_0x32155d&&_0x2e38bd?.[_0x5beab9(0x16d)]&&_0x4ab570[_0x5beab9(0x138)](_0x1e5ad4[_0x5beab9(0x157)],_0x2e38bd[_0x5beab9(0x16d)]);const _0x52e7a9=_0x2ae395+_0x5beab9(0x161)+_0x1dc508+'/report/markdown',_0x597dbf=''+_0x52e7a9+(_0x4ab570['toString']()?'?'+_0x4ab570[_0x5beab9(0x171)]():''),_0x5922f7=await _0x1e5ad4[_0x5beab9(0x14b)](fetch,_0x597dbf,{'method':_0x1e5ad4[_0x5beab9(0x154)],'headers':{'Authorization':'Bearer\x20'+_0x5aa60b}});if(!_0x5922f7['ok']){const _0x1ea21c=await _0x5922f7['text']();throw new Error(_0x5beab9(0x135)+_0x1ea21c);}return _0x5922f7['text']();}export async function listFeatureSessions(_0x2f35d1){const _0x2e1943=_0x2434,_0x517e37={'GieyB':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','rzWCO':'GET'},_0x2345df=await getToken();if(!_0x2345df)throw new Error(_0x517e37['GieyB']);const _0x419b12=getApiBaseUrl(),_0x52d8ed=await fetch(_0x419b12+'/api/v1/mcp/features/'+_0x2f35d1+_0x2e1943(0x15f),{'method':_0x517e37[_0x2e1943(0x15c)],'headers':{'Authorization':'Bearer\x20'+_0x2345df}});if(!_0x52d8ed['ok']){const _0x101d0d=await _0x52d8ed['text']();throw new Error(_0x2e1943(0x176)+_0x101d0d);}return _0x52d8ed[_0x2e1943(0x139)]();}export async function startSession(_0x47f830,_0x14c2c6){const _0x5ace23=_0x2434,_0x39ffaf={'rfzhx':function(_0x4b04d0){return _0x4b04d0();},'KbXrI':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','hLYVO':function(_0x4f82cd){return _0x4f82cd();}},_0x129536=await _0x39ffaf[_0x5ace23(0x152)](getToken);if(!_0x129536)throw new Error(_0x39ffaf[_0x5ace23(0x134)]);const _0x44ad67=_0x39ffaf['hLYVO'](getApiBaseUrl),_0xb71942=await fetch(_0x44ad67+'/api/v1/mcp/features/'+_0x47f830+_0x5ace23(0x162)+_0x14c2c6+_0x5ace23(0x150),{'method':'POST','headers':{'Authorization':_0x5ace23(0x16b)+_0x129536}});if(!_0xb71942['ok']){const _0x3496f9=await _0xb71942[_0x5ace23(0x16f)]();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x3496f9);}return _0xb71942[_0x5ace23(0x139)]();}export async function concludeSession(_0x27921a,_0x108373){const _0x3db3fb=_0x2434,_0x35c80f={'SkOlB':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','MnDvp':'POST'},_0xddc08e=await getToken();if(!_0xddc08e)throw new Error(_0x35c80f['SkOlB']);const _0x4c4740=getApiBaseUrl(),_0x1ccf39=await fetch(_0x4c4740+'/api/v1/mcp/features/'+_0x27921a+_0x3db3fb(0x162)+_0x108373+'/conclude',{'method':_0x35c80f['MnDvp'],'headers':{'Authorization':'Bearer\x20'+_0xddc08e}});if(!_0x1ccf39['ok']){const _0x28299f=await _0x1ccf39['text']();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x28299f);}return _0x1ccf39['json']();}function _0x2895(){const _0x2ad3ec=['Failed\x20to\x20update\x20feature\x20review:\x20','13769624PwgZVT','26054181jncOaq','FCSMs','join','\x0a\x0aUpgrade\x20your\x20plan:\x20','application/json','JheXL','/start','status','rfzhx','mcFIO','mBlqU','Failed\x20to\x20delete\x20feature\x20review:\x20','updateChecklistItem','WZwBh','BCRSC','WqIKa','Boxim','RUBnr','rzWCO','RPOwG','POST','/sessions','Failed\x20to\x20get\x20item\x20feedback:\x20','/api/v1/mcp/features/','/sessions/','stringify','Failed\x20to\x20get\x20action\x20items:\x20','UDbBu','mpEDk','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','rtQEV','/restore','/checklist','Bearer\x20','Failed\x20to\x20create\x20scenario:\x20','style','/checklist/','text','itemIds','toString','GET','109715srHhUJ','10ABdKDj','/api/v1/mcp/features','Failed\x20to\x20list\x20sessions:\x20','1562809oOAKvB','Failed\x20to\x20create\x20feature\x20review:\x20','Failed\x20to\x20restore\x20feature\x20review:\x20','https://dashboard.ranger.net/billing','9947646vktjzK','sessionId','GFftK','188gEUZDI','gitBranch','KbXrI','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','GMCix','3JSxZNy','set','json','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','tWqnu','EiiCm','gitRepoUrl','939754AVTvuS','11081434jWXWAd','DwcEF','/comments/address','Lkaax','Failed\x20to\x20update\x20scenario:\x20','billingUrl','includeDeleted','epLWM','DELETE'];_0x2895=function(){return _0x2ad3ec;};return _0x2895();}export async function getActionItems(_0x31d6e2){const _0xde4eff=_0x2434,_0x5da453={'cqiQg':_0xde4eff(0x167),'kvLlk':function(_0x248845){return _0x248845();},'aqKQH':function(_0x2f6292,_0x5dc983,_0x4e7662){return _0x2f6292(_0x5dc983,_0x4e7662);},'TahvA':_0xde4eff(0x172)},_0x330992=await getToken();if(!_0x330992)throw new Error(_0x5da453['cqiQg']);const _0xa71241=_0x5da453['kvLlk'](getApiBaseUrl),_0x3c79e7=await _0x5da453['aqKQH'](fetch,_0xa71241+'/api/v1/mcp/features/'+_0x31d6e2+'/action-items',{'method':_0x5da453['TahvA'],'headers':{'Authorization':'Bearer\x20'+_0x330992}});if(!_0x3c79e7['ok']){const _0x2b9e2c=await _0x3c79e7[_0xde4eff(0x16f)]();throw new Error(_0xde4eff(0x164)+_0x2b9e2c);}return _0x3c79e7[_0xde4eff(0x139)]();}export async function getItemFeedback(_0x49fe6d,_0x55c160){const _0xd2f144=_0x2434,_0x5a0d89={'rtQEV':function(_0x541935){return _0x541935();},'JeaaC':function(_0x37eb3d,_0x245f44,_0x567aa2){return _0x37eb3d(_0x245f44,_0x567aa2);},'DwcEF':_0xd2f144(0x172)},_0x46c46e=await _0x5a0d89['rtQEV'](getToken);if(!_0x46c46e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x322ab4=_0x5a0d89[_0xd2f144(0x168)](getApiBaseUrl),_0x522ed9=await _0x5a0d89['JeaaC'](fetch,_0x322ab4+_0xd2f144(0x161)+_0x49fe6d+'/checklist-items/'+_0x55c160+'/feedback',{'method':_0x5a0d89[_0xd2f144(0x140)],'headers':{'Authorization':'Bearer\x20'+_0x46c46e}});if(!_0x522ed9['ok']){const _0x2e0b31=await _0x522ed9[_0xd2f144(0x16f)]();throw new Error(_0xd2f144(0x160)+_0x2e0b31);}return _0x522ed9['json']();}export async function markCommentsAddressed(_0x423b5a,_0x38d3bb,_0x12bbf9){const _0x1c256f=_0x2434,_0x49e271={'gGpcM':function(_0x367e5b){return _0x367e5b();},'sczyf':'POST','wkEig':_0x1c256f(0x14e)},_0x1f435b=await getToken();if(!_0x1f435b)throw new Error(_0x1c256f(0x167));const _0x34776c=_0x49e271['gGpcM'](getApiBaseUrl),_0x10d55a=await fetch(_0x34776c+_0x1c256f(0x161)+_0x423b5a+_0x1c256f(0x141),{'method':_0x49e271['sczyf'],'headers':{'Authorization':_0x1c256f(0x16b)+_0x1f435b,'Content-Type':_0x49e271['wkEig']},'body':JSON[_0x1c256f(0x163)]({'checklistItemId':_0x38d3bb,'commentIds':_0x12bbf9})});if(!_0x10d55a['ok']){const _0x37baee=await _0x10d55a['text']();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x37baee);}}function _0x2434(_0x119529,_0x33758f){_0x119529=_0x119529-0x132;const _0x289532=_0x2895();let _0x24343b=_0x289532[_0x119529];return _0x24343b;}export async function softDeleteFeature(_0x1e550c){const _0x2502cc=_0x2434,_0x1d23f8={'Boxim':function(_0x2089ca){return _0x2089ca();},'htwlZ':function(_0x44b01f,_0x565187,_0x580c2b){return _0x44b01f(_0x565187,_0x580c2b);}},_0x2308f3=await getToken();if(!_0x2308f3)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1c6efd=_0x1d23f8[_0x2502cc(0x15a)](getApiBaseUrl),_0x4cd473=await _0x1d23f8['htwlZ'](fetch,_0x1c6efd+'/api/v1/mcp/features/'+_0x1e550c,{'method':_0x2502cc(0x147),'headers':{'Authorization':'Bearer\x20'+_0x2308f3}});if(!_0x4cd473['ok']){const _0x31bb82=await _0x4cd473[_0x2502cc(0x16f)]();throw new Error(_0x2502cc(0x155)+_0x31bb82);}}export async function restoreFeature(_0x868119){const _0xe06a49=_0x2434,_0x31bdbc={'MxRYR':function(_0x3f2846){return _0x3f2846();},'UDbBu':_0xe06a49(0x15e)},_0x516599=await _0x31bdbc['MxRYR'](getToken);if(!_0x516599)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xe28b8d=_0x31bdbc['MxRYR'](getApiBaseUrl),_0x1675c5=await fetch(_0xe28b8d+_0xe06a49(0x161)+_0x868119+_0xe06a49(0x169),{'method':_0x31bdbc[_0xe06a49(0x165)],'headers':{'Authorization':_0xe06a49(0x16b)+_0x516599}});if(!_0x1675c5['ok']){const _0x91900f=await _0x1675c5[_0xe06a49(0x16f)]();throw new Error(_0xe06a49(0x179)+_0x91900f);}}
1
+ (function(_0x23c059,_0x449a70){const _0x3e8f20=_0x1c27,_0x513819=_0x23c059();while(!![]){try{const _0x2124ad=parseInt(_0x3e8f20(0xfc))/0x1*(-parseInt(_0x3e8f20(0xf2))/0x2)+parseInt(_0x3e8f20(0xed))/0x3*(-parseInt(_0x3e8f20(0xe7))/0x4)+-parseInt(_0x3e8f20(0xfa))/0x5+parseInt(_0x3e8f20(0x10b))/0x6*(parseInt(_0x3e8f20(0x103))/0x7)+parseInt(_0x3e8f20(0x10d))/0x8+parseInt(_0x3e8f20(0xe9))/0x9+-parseInt(_0x3e8f20(0x11c))/0xa*(-parseInt(_0x3e8f20(0xd4))/0xb);if(_0x2124ad===_0x449a70)break;else _0x513819['push'](_0x513819['shift']());}catch(_0x1b1ebf){_0x513819['push'](_0x513819['shift']());}}}(_0x5269,0xde2a3));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x5536c2){const _0x1357d1=_0x1c27,_0x5a9a3f={'ULjxA':function(_0x4e85f0){return _0x4e85f0();},'qfzkA':'application/json','kJreN':'https://dashboard.ranger.net/billing','EDfut':'Feature\x20limit\x20exceeded'},_0x5b236a=await _0x5a9a3f['ULjxA'](getToken);if(!_0x5b236a)throw new Error(_0x1357d1(0x10f));const _0x1140d3=getApiBaseUrl(),_0x5e363d=await fetch(_0x1140d3+_0x1357d1(0xf4),{'method':_0x1357d1(0xd5),'headers':{'Authorization':_0x1357d1(0xf6)+_0x5b236a,'Content-Type':_0x5a9a3f[_0x1357d1(0xd7)]},'body':JSON['stringify'](_0x5536c2)});if(!_0x5e363d['ok']){if(_0x5e363d['status']===0x192){const _0x2b824b=await _0x5e363d['json'](),_0x5ce816=_0x2b824b[_0x1357d1(0x10c)]||_0x5a9a3f['kJreN'];throw new Error((_0x2b824b['message']||_0x5a9a3f[_0x1357d1(0x102)])+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x5ce816);}const _0x7fd6ee=await _0x5e363d[_0x1357d1(0xe2)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x7fd6ee);}return _0x5e363d[_0x1357d1(0xe8)]();}export async function listFeatures(_0xa6fc7e){const _0x20f088=_0x1c27,_0x294e4d={'QriQK':function(_0x476fec){return _0x476fec();},'Hpfkg':_0x20f088(0x10f),'gZpyS':function(_0x17ab27){return _0x17ab27();},'ULVEm':'gitRepoUrl','LYwOJ':_0x20f088(0x107),'nTWbz':'includeDeleted'},_0x5a74ab=await _0x294e4d[_0x20f088(0x11b)](getToken);if(!_0x5a74ab)throw new Error(_0x294e4d['Hpfkg']);const _0x523196=_0x294e4d['gZpyS'](getApiBaseUrl),_0x2a5b39=new URLSearchParams();if(_0xa6fc7e?.['gitRepoUrl'])_0x2a5b39[_0x20f088(0xec)](_0x294e4d[_0x20f088(0x113)],_0xa6fc7e['gitRepoUrl']);if(_0xa6fc7e?.['gitBranch'])_0x2a5b39['set']('gitBranch',_0xa6fc7e['gitBranch']);if(_0xa6fc7e?.[_0x20f088(0x116)])_0x2a5b39[_0x20f088(0xec)]('limit',_0xa6fc7e[_0x20f088(0x116)]['toString']());if(_0xa6fc7e?.['offset'])_0x2a5b39[_0x20f088(0xec)](_0x294e4d[_0x20f088(0xf7)],_0xa6fc7e['offset']['toString']());if(_0xa6fc7e?.[_0x20f088(0xeb)])_0x2a5b39[_0x20f088(0xec)](_0x294e4d['nTWbz'],_0x20f088(0x114));const _0x54c626=_0x523196+'/api/v1/mcp/features'+(_0x2a5b39[_0x20f088(0x10a)]()?'?'+_0x2a5b39['toString']():''),_0x5e822a=await fetch(_0x54c626,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x5a74ab}});if(!_0x5e822a['ok']){const _0x514007=await _0x5e822a['text']();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x514007);}return _0x5e822a[_0x20f088(0xe8)]();}export async function getFeature(_0x32360e){const _0x4407f3=_0x1c27,_0x4ea55a={'eLzJJ':function(_0x56f492){return _0x56f492();},'Trsbf':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x1843ac=await _0x4ea55a['eLzJJ'](getToken);if(!_0x1843ac)throw new Error(_0x4ea55a['Trsbf']);const _0x371e58=_0x4ea55a['eLzJJ'](getApiBaseUrl),_0x4373e1=await fetch(_0x371e58+_0x4407f3(0xf1)+_0x32360e,{'method':'GET','headers':{'Authorization':_0x4407f3(0xf6)+_0x1843ac}});if(!_0x4373e1['ok']){const _0x19b99c=await _0x4373e1[_0x4407f3(0xe2)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x19b99c);}return _0x4373e1[_0x4407f3(0xe8)]();}export async function updateFeature(_0x24295a,_0x37d9d6){const _0x34d567=_0x1c27,_0x1421b4={'qYAOK':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','TUEEV':function(_0x20b16c){return _0x20b16c();},'cRoLO':_0x34d567(0xe0)},_0x8e9ad7=await getToken();if(!_0x8e9ad7)throw new Error(_0x1421b4[_0x34d567(0xfd)]);const _0x30ac32=_0x1421b4['TUEEV'](getApiBaseUrl),_0x2492b7=await fetch(_0x30ac32+'/api/v1/mcp/features/'+_0x24295a,{'method':_0x34d567(0xe4),'headers':{'Authorization':'Bearer\x20'+_0x8e9ad7,'Content-Type':_0x1421b4['cRoLO']},'body':JSON['stringify'](_0x37d9d6)});if(!_0x2492b7['ok']){const _0x4297a1=await _0x2492b7['text']();throw new Error(_0x34d567(0xe5)+_0x4297a1);}return _0x2492b7['json']();}export async function createChecklistItem(_0x1c8a6,_0x35a4c3,_0x579b75){const _0x521bd6=_0x1c27,_0x11a55e={'xaMrl':function(_0x296a31){return _0x296a31();},'mgRZu':function(_0x2f0a74){return _0x2f0a74();},'ZTWMi':function(_0x1e5b1c,_0x1d343b,_0x1b0e8b){return _0x1e5b1c(_0x1d343b,_0x1b0e8b);},'omyWZ':_0x521bd6(0xd5),'SkXCE':'application/json'},_0x23f9fa=await _0x11a55e[_0x521bd6(0x110)](getToken);if(!_0x23f9fa)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x223416=_0x11a55e[_0x521bd6(0xda)](getApiBaseUrl),_0x1d61b5=await _0x11a55e['ZTWMi'](fetch,_0x223416+'/api/v1/mcp/features/'+_0x1c8a6+_0x521bd6(0x104),{'method':_0x11a55e['omyWZ'],'headers':{'Authorization':_0x521bd6(0xf6)+_0x23f9fa,'Content-Type':_0x11a55e['SkXCE']},'body':JSON[_0x521bd6(0x112)]({'description':_0x35a4c3,'position':_0x579b75})});if(!_0x1d61b5['ok']){const _0x36f761=await _0x1d61b5[_0x521bd6(0xe2)]();throw new Error(_0x521bd6(0xd6)+_0x36f761);}return _0x1d61b5[_0x521bd6(0xe8)]();}export async function updateChecklistItem(_0x49c108,_0x42bb91,_0x88940b){const _0x288f23=_0x1c27,_0x3be7fd={'fgHGi':function(_0x17259e){return _0x17259e();},'cooav':'PATCH','BsJUd':_0x288f23(0xdc)};return withRetry(async()=>{const _0x2ca676=_0x288f23,_0x4039df=await getToken();if(!_0x4039df)throw new Error(_0x2ca676(0x10f));const _0x51e769=_0x3be7fd['fgHGi'](getApiBaseUrl),_0x5e6436=await fetch(_0x51e769+'/api/v1/mcp/features/'+_0x49c108+'/checklist/'+_0x42bb91,{'method':_0x3be7fd['cooav'],'headers':{'Authorization':_0x2ca676(0xf6)+_0x4039df,'Content-Type':_0x2ca676(0xe0)},'body':JSON['stringify'](_0x88940b)});if(!_0x5e6436['ok']){const _0x498991=await _0x5e6436['text']();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x498991);}return _0x5e6436[_0x2ca676(0xe8)]();},{'label':_0x3be7fd[_0x288f23(0xe6)]});}export async function getFeatureReport(_0x3da8f2){const _0x2efe92=_0x1c27,_0x1cc739={'MpNtH':function(_0x3a6b25){return _0x3a6b25();},'Nkjzm':function(_0x283dfb,_0x57bea3,_0x1ad2b5){return _0x283dfb(_0x57bea3,_0x1ad2b5);}},_0x161c53=await getToken();if(!_0x161c53)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x534fa2=_0x1cc739[_0x2efe92(0xcf)](getApiBaseUrl),_0x247adb=await _0x1cc739['Nkjzm'](fetch,_0x534fa2+'/api/v1/mcp/features/'+_0x3da8f2+'/report',{'method':_0x2efe92(0xd3),'headers':{'Authorization':_0x2efe92(0xf6)+_0x161c53}});if(!_0x247adb['ok']){const _0x278b63=await _0x247adb['text']();throw new Error(_0x2efe92(0xef)+_0x278b63);}return _0x247adb[_0x2efe92(0xe8)]();}function _0x5269(){const _0x318067=['No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','xaMrl','itemIds','stringify','ULVEm','true','vzxez','limit','joHiR','UuKUv','sessionId','KcXTs','QriQK','1484650TYBaYg','/action-items','MpNtH','/start','YnhEB','Failed\x20to\x20get\x20action\x20items:\x20','GET','11JzJZGC','POST','Failed\x20to\x20create\x20scenario:\x20','qfzkA','FfZnQ','/conclude','mgRZu','sJnLT','updateChecklistItem','AhHKR','style','Failed\x20to\x20get\x20item\x20feedback:\x20','application/json','/checklist-items/','text','truKK','PATCH','Failed\x20to\x20update\x20feature\x20review:\x20','BsJUd','1510408pSvxpr','json','11232135MXpuLj','RaEhZ','includeDeleted','set','6OfoEwA','gqcxw','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','Failed\x20to\x20start\x20session:\x20','/api/v1/mcp/features/','6862RXTYBR','DELETE','/api/v1/mcp/features','BTLWb','Bearer\x20','LYwOJ','/report/markdown','qklNP','5011970NDgcAJ','/sessions','284ERiWnF','qYAOK','PvdKd','SkwKn','/restore','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','EDfut','3904019ALgUux','/checklist','lrNIC','BJmVy','offset','fSfsw','QyhXo','toString','18gjJVeB','billingUrl','4578864xPhiRl','Failed\x20to\x20restore\x20feature\x20review:\x20'];_0x5269=function(){return _0x318067;};return _0x5269();}export async function getFeatureReportMarkdown(_0x6a1a6b,_0x46cf0e){const _0x5e03ce=_0x1c27,_0x408198={'NIciL':function(_0x29aecc){return _0x29aecc();},'gqcxw':_0x5e03ce(0x10f),'KcXTs':function(_0x537fd0,_0x2d91e7){return _0x537fd0>_0x2d91e7;},'jLbUg':function(_0x33f472,_0x13dd42){return _0x33f472(_0x13dd42);},'nKHnQ':_0x5e03ce(0x111),'BJmVy':_0x5e03ce(0xde),'BTLWb':function(_0x11c43c,_0x103e75,_0x4af2aa){return _0x11c43c(_0x103e75,_0x4af2aa);},'fSfsw':_0x5e03ce(0xd3)},_0x149d20=await _0x408198['NIciL'](getToken);if(!_0x149d20)throw new Error(_0x408198[_0x5e03ce(0xee)]);const _0x380432=getApiBaseUrl(),_0x4aa865=new URLSearchParams(),_0x288ef8=_0x408198[_0x5e03ce(0x11a)](_0x46cf0e?.['itemIds']?.['length']??0x0,0x0),_0x135d09=_0x408198['jLbUg'](Boolean,_0x46cf0e?.[_0x5e03ce(0x119)]);_0x288ef8&&_0x46cf0e?.[_0x5e03ce(0x111)]&&_0x4aa865[_0x5e03ce(0xec)](_0x408198['nKHnQ'],_0x46cf0e[_0x5e03ce(0x111)]['join'](','));_0x135d09&&_0x46cf0e?.['sessionId']&&_0x4aa865[_0x5e03ce(0xec)]('sessionId',_0x46cf0e[_0x5e03ce(0x119)]);!_0x288ef8&&!_0x135d09&&_0x46cf0e?.['style']&&_0x4aa865['set'](_0x408198[_0x5e03ce(0x106)],_0x46cf0e['style']);const _0x9f9e77=_0x380432+'/api/v1/mcp/features/'+_0x6a1a6b+_0x5e03ce(0xf8),_0x3ecfe3=''+_0x9f9e77+(_0x4aa865['toString']()?'?'+_0x4aa865['toString']():''),_0x4fca6a=await _0x408198[_0x5e03ce(0xf5)](fetch,_0x3ecfe3,{'method':_0x408198[_0x5e03ce(0x108)],'headers':{'Authorization':'Bearer\x20'+_0x149d20}});if(!_0x4fca6a['ok']){const _0x4cd501=await _0x4fca6a['text']();throw new Error(_0x5e03ce(0x101)+_0x4cd501);}return _0x4fca6a['text']();}function _0x1c27(_0xf0815c,_0x2d47e7){_0xf0815c=_0xf0815c-0xce;const _0x52690a=_0x5269();let _0x1c273d=_0x52690a[_0xf0815c];return _0x1c273d;}export async function listFeatureSessions(_0x331318){const _0x49ac7c=_0x1c27,_0x56b44d={'vzxez':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','FfZnQ':function(_0x3eaac3,_0x3f18d5,_0x48a221){return _0x3eaac3(_0x3f18d5,_0x48a221);},'guAOD':_0x49ac7c(0xd3)},_0x5ce7e2=await getToken();if(!_0x5ce7e2)throw new Error(_0x56b44d[_0x49ac7c(0x115)]);const _0x12a1e7=getApiBaseUrl(),_0x17a57c=await _0x56b44d[_0x49ac7c(0xd8)](fetch,_0x12a1e7+_0x49ac7c(0xf1)+_0x331318+_0x49ac7c(0xfb),{'method':_0x56b44d['guAOD'],'headers':{'Authorization':'Bearer\x20'+_0x5ce7e2}});if(!_0x17a57c['ok']){const _0x467dee=await _0x17a57c[_0x49ac7c(0xe2)]();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x467dee);}return _0x17a57c[_0x49ac7c(0xe8)]();}export async function startSession(_0x87ba96,_0x1481a2){const _0x26047a=_0x1c27,_0x2bb1c6={'uBuHA':function(_0x279d18){return _0x279d18();},'qklNP':_0x26047a(0x10f),'mvswS':function(_0x2afecb,_0x2240ce,_0x4b3368){return _0x2afecb(_0x2240ce,_0x4b3368);},'FypVS':_0x26047a(0xd5)},_0x8a2824=await _0x2bb1c6['uBuHA'](getToken);if(!_0x8a2824)throw new Error(_0x2bb1c6[_0x26047a(0xf9)]);const _0xf414d9=getApiBaseUrl(),_0x259ed4=await _0x2bb1c6['mvswS'](fetch,_0xf414d9+'/api/v1/mcp/features/'+_0x87ba96+'/sessions/'+_0x1481a2+_0x26047a(0xd0),{'method':_0x2bb1c6['FypVS'],'headers':{'Authorization':_0x26047a(0xf6)+_0x8a2824}});if(!_0x259ed4['ok']){const _0x15c03e=await _0x259ed4[_0x26047a(0xe2)]();throw new Error(_0x26047a(0xf0)+_0x15c03e);}return _0x259ed4[_0x26047a(0xe8)]();}export async function concludeSession(_0x1ae2c4,_0x2c6468){const _0x368097=_0x1c27,_0x37a72c={'AhHKR':function(_0x5e859f){return _0x5e859f();},'GSkCQ':function(_0x37a8ee,_0x50dfb4,_0x49c733){return _0x37a8ee(_0x50dfb4,_0x49c733);},'RaEhZ':_0x368097(0xd5)},_0x870d59=await _0x37a72c['AhHKR'](getToken);if(!_0x870d59)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x58420b=_0x37a72c[_0x368097(0xdd)](getApiBaseUrl),_0x3506ab=await _0x37a72c['GSkCQ'](fetch,_0x58420b+'/api/v1/mcp/features/'+_0x1ae2c4+'/sessions/'+_0x2c6468+_0x368097(0xd9),{'method':_0x37a72c[_0x368097(0xea)],'headers':{'Authorization':'Bearer\x20'+_0x870d59}});if(!_0x3506ab['ok']){const _0x4334e1=await _0x3506ab[_0x368097(0xe2)]();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x4334e1);}return _0x3506ab['json']();}export async function getActionItems(_0x16fe8d){const _0x572e5d=_0x1c27,_0x1fe402={'sJnLT':function(_0x49a893){return _0x49a893();},'UuKUv':function(_0x574f6d){return _0x574f6d();}},_0x41d339=await _0x1fe402[_0x572e5d(0xdb)](getToken);if(!_0x41d339)throw new Error(_0x572e5d(0x10f));const _0x565e70=_0x1fe402[_0x572e5d(0x118)](getApiBaseUrl),_0x40d002=await fetch(_0x565e70+_0x572e5d(0xf1)+_0x16fe8d+_0x572e5d(0xce),{'method':'GET','headers':{'Authorization':_0x572e5d(0xf6)+_0x41d339}});if(!_0x40d002['ok']){const _0x3c0258=await _0x40d002['text']();throw new Error(_0x572e5d(0xd2)+_0x3c0258);}return _0x40d002['json']();}export async function getItemFeedback(_0x2a5426,_0x480d4f){const _0x4514b8=_0x1c27,_0x1c8bf8={'pjUdH':function(_0x152655){return _0x152655();}},_0xf28238=await getToken();if(!_0xf28238)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x7f797d=_0x1c8bf8['pjUdH'](getApiBaseUrl),_0x3ba76b=await fetch(_0x7f797d+'/api/v1/mcp/features/'+_0x2a5426+_0x4514b8(0xe1)+_0x480d4f+'/feedback',{'method':_0x4514b8(0xd3),'headers':{'Authorization':_0x4514b8(0xf6)+_0xf28238}});if(!_0x3ba76b['ok']){const _0x3b88ce=await _0x3ba76b[_0x4514b8(0xe2)]();throw new Error(_0x4514b8(0xdf)+_0x3b88ce);}return _0x3ba76b['json']();}export async function markCommentsAddressed(_0x43734d,_0x2fa730,_0x130981){const _0x336606=_0x1c27,_0x56c51f={'YnhEB':function(_0x1e87ea){return _0x1e87ea();},'QyhXo':function(_0x12b350){return _0x12b350();},'joHiR':function(_0x31ba53,_0x31c0a4,_0x5b112e){return _0x31ba53(_0x31c0a4,_0x5b112e);}},_0x9c359b=await _0x56c51f[_0x336606(0xd1)](getToken);if(!_0x9c359b)throw new Error(_0x336606(0x10f));const _0x44bd6a=_0x56c51f[_0x336606(0x109)](getApiBaseUrl),_0xa945f0=await _0x56c51f[_0x336606(0x117)](fetch,_0x44bd6a+'/api/v1/mcp/features/'+_0x43734d+'/comments/address',{'method':'POST','headers':{'Authorization':_0x336606(0xf6)+_0x9c359b,'Content-Type':_0x336606(0xe0)},'body':JSON['stringify']({'checklistItemId':_0x2fa730,'commentIds':_0x130981})});if(!_0xa945f0['ok']){const _0xc88197=await _0xa945f0[_0x336606(0xe2)]();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0xc88197);}}export async function softDeleteFeature(_0x2ba5de){const _0x4a44af=_0x1c27,_0x51f249={'lrNIC':function(_0x5ed7c6){return _0x5ed7c6();},'PvdKd':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','xIYRs':_0x4a44af(0xf3)},_0x319cd3=await _0x51f249['lrNIC'](getToken);if(!_0x319cd3)throw new Error(_0x51f249[_0x4a44af(0xfe)]);const _0x5f4dab=_0x51f249[_0x4a44af(0x105)](getApiBaseUrl),_0x24be9d=await fetch(_0x5f4dab+_0x4a44af(0xf1)+_0x2ba5de,{'method':_0x51f249['xIYRs'],'headers':{'Authorization':_0x4a44af(0xf6)+_0x319cd3}});if(!_0x24be9d['ok']){const _0x49ef40=await _0x24be9d[_0x4a44af(0xe2)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x49ef40);}}export async function restoreFeature(_0x403d68){const _0x52e23a=_0x1c27,_0x5c286c={'SkwKn':_0x52e23a(0x10f),'truKK':function(_0x1ef145,_0x57e8e2,_0x7bb12d){return _0x1ef145(_0x57e8e2,_0x7bb12d);},'rmBiY':'POST'},_0x362000=await getToken();if(!_0x362000)throw new Error(_0x5c286c[_0x52e23a(0xff)]);const _0x3c82ba=getApiBaseUrl(),_0x502cbe=await _0x5c286c[_0x52e23a(0xe3)](fetch,_0x3c82ba+'/api/v1/mcp/features/'+_0x403d68+_0x52e23a(0x100),{'method':_0x5c286c['rmBiY'],'headers':{'Authorization':_0x52e23a(0xf6)+_0x362000}});if(!_0x502cbe['ok']){const _0x480a4c=await _0x502cbe[_0x52e23a(0xe2)]();throw new Error(_0x52e23a(0x10e)+_0x480a4c);}}