@ranger-testing/ranger-cli 3.1.7-alpha.387730d-58 → 3.1.7-alpha.9ed0a8d-59
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +1 -1
- package/build/commands/addEnv.js +1 -1
- package/build/commands/authEncrypt.js +1 -1
- package/build/commands/clean.js +1 -1
- package/build/commands/config.js +1 -1
- package/build/commands/deleteProfile.js +1 -1
- package/build/commands/env.js +1 -1
- package/build/commands/feature.js +1 -1
- package/build/commands/hook.js +1 -1
- package/build/commands/hooks/autoPrompt.js +1 -1
- package/build/commands/hooks/disable.js +1 -1
- package/build/commands/hooks/enable.js +1 -1
- package/build/commands/hooks/exitPlanMode.js +1 -1
- package/build/commands/hooks/index.js +1 -1
- package/build/commands/hooks/output.js +1 -1
- package/build/commands/hooks/planReminder.js +1 -1
- package/build/commands/hooks/planStart.js +1 -1
- package/build/commands/hooks/postEdit.js +1 -1
- package/build/commands/hooks/preCompact.js +1 -1
- package/build/commands/hooks/sessionEnd.js +1 -1
- package/build/commands/hooks/sessionStart.js +1 -1
- package/build/commands/hooks/stopHook.js +1 -1
- package/build/commands/index.js +1 -1
- package/build/commands/login.js +1 -1
- package/build/commands/mcpBootstrap.js +1 -1
- package/build/commands/migrateProfile.js +1 -1
- package/build/commands/setup/claude.js +1 -1
- package/build/commands/setup/opencode.js +1 -1
- package/build/commands/setupCi.js +1 -1
- package/build/commands/skillup.js +1 -1
- package/build/commands/start.js +1 -1
- package/build/commands/status.js +1 -1
- package/build/commands/update.js +1 -1
- package/build/commands/updateEnv.js +1 -1
- package/build/commands/useEnv.js +1 -1
- package/build/commands/utils/activeProfile.js +1 -1
- package/build/commands/utils/agentEnv.js +1 -1
- package/build/commands/utils/browserSessionsApi.js +1 -1
- package/build/commands/utils/claudeConfig.js +1 -1
- package/build/commands/utils/claudeOverrideSettings.js +1 -1
- package/build/commands/utils/claudePlugin.js +1 -1
- package/build/commands/utils/cloudProfile.js +1 -1
- package/build/commands/utils/cloudProfileSession.js +1 -1
- package/build/commands/utils/crypto.js +1 -1
- package/build/commands/utils/desirePathLog.js +1 -1
- package/build/commands/utils/deviceAuth.js +1 -1
- package/build/commands/utils/environment.js +1 -1
- package/build/commands/utils/featureApi.js +1 -1
- package/build/commands/utils/fixWebmDuration.js +1 -1
- package/build/commands/utils/gitTracked.js +1 -1
- package/build/commands/utils/keychain.js +1 -1
- package/build/commands/utils/legacyWarning.js +1 -1
- package/build/commands/utils/localAgentInstallationsApi.js +1 -1
- package/build/commands/utils/matchAuthEnvironment.js +1 -1
- package/build/commands/utils/mcpImageBase64.js +1 -1
- package/build/commands/utils/model.js +1 -1
- package/build/commands/utils/novaActCli.js +1 -1
- package/build/commands/utils/opencodeConfig.js +1 -1
- package/build/commands/utils/organizationEnvApi.js +1 -1
- package/build/commands/utils/playwrightCli.js +1 -1
- package/build/commands/utils/profileMessages.js +1 -1
- package/build/commands/utils/profileSetupBanner.js +1 -1
- package/build/commands/utils/projectsConfig.js +1 -1
- package/build/commands/utils/rangerConfig.js +1 -1
- package/build/commands/utils/rangerRoot.js +1 -1
- package/build/commands/utils/rangerwrightCli.js +1 -1
- package/build/commands/utils/resolveProfileContext.js +1 -1
- package/build/commands/utils/resolveProfileUrl.js +1 -1
- package/build/commands/utils/retry.js +1 -1
- package/build/commands/utils/scenarioOriginCheck.js +1 -1
- package/build/commands/utils/sessionCache.js +1 -1
- package/build/commands/utils/settings.js +1 -1
- package/build/commands/utils/skillContent.js +1 -1
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/stitchWebmFiles.js +1 -1
- package/build/commands/utils/telemetry.js +1 -1
- package/build/commands/utils/tokenRefresh.js +1 -1
- package/build/commands/utils/traceSnapshotMapper.js +1 -1
- package/build/commands/utils/tunnelClient.js +1 -1
- package/build/commands/utils/userApi.js +1 -1
- package/build/commands/utils/version.js +1 -1
- package/build/commands/verifyFeature.js +1 -1
- package/build/commands/verifyFeatureCli.js +1 -1
- package/build/commands/verifyFeatureNovaCli.js +1 -1
- package/build/commands/verifyFeatureRangerwrightCli.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x1e8167=_0x486f;(function(_0x5cbe39,_0x2bda8a){const _0x3c40ec=_0x486f,_0x35f071=_0x5cbe39();while(!![]){try{const _0x17c738=-parseInt(_0x3c40ec(0xf1))/0x1+-parseInt(_0x3c40ec(0x18c))/0x2*(parseInt(_0x3c40ec(0x129))/0x3)+parseInt(_0x3c40ec(0xfc))/0x4+parseInt(_0x3c40ec(0x14d))/0x5+-parseInt(_0x3c40ec(0x13e))/0x6+parseInt(_0x3c40ec(0x17c))/0x7+-parseInt(_0x3c40ec(0x162))/0x8;if(_0x17c738===_0x2bda8a)break;else _0x35f071['push'](_0x35f071['shift']());}catch(_0x2369a6){_0x35f071['push'](_0x35f071['shift']());}}}(_0x4747,0xb0c44));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x3f7ac0 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,isBareLocalhost,isCachedSessionLive,isInteractive,needsTunnel,orderLoginDomains,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x333db3){const _0x1bbdaf=_0x486f,_0x1f954c={'iBdMe':_0x1bbdaf(0x14c)};try{return new URL(_0x333db3)['host'];}catch{return _0x1f954c['iBdMe'];}}function errorMessageForTelemetry(_0x137c79){const _0xccbae7=_0x486f,_0x5233fb={'zcTEQ':function(_0xfd933b,_0x3c0466){return _0xfd933b instanceof _0x3c0466;}};return _0x5233fb[_0xccbae7(0xff)](_0x137c79,Error)?_0x137c79[_0xccbae7(0x141)]:undefined;}function trackBridgeEvent(_0xf3eacf,_0x409686){const _0x1307b3=_0x486f,_0x48a4f0={'kDQmy':'tunnel_bridge_event','mWlCU':function(_0x4413d7,_0x446fdb){return _0x4413d7===_0x446fdb;},'YlMJM':'local_ws_error','iNeIo':'tunnel_bridge'};if(!_0xf3eacf)return;const _0x2ff472={'tunnelSessionId':_0x409686[_0x1307b3(0x198)],'tunnelEventType':_0x409686[_0x1307b3(0x14e)],'connectionId':_0x409686['connectionId'],'code':_0x409686[_0x1307b3(0x12f)],'reason':_0x409686['reason'],'error':_0x409686[_0x1307b3(0x195)],'elapsedMs':_0x409686[_0x1307b3(0x116)],'activeLocalConnections':_0x409686[_0x1307b3(0x100)],'pendingLocalConnections':_0x409686[_0x1307b3(0x13a)]};_0xf3eacf[_0x1307b3(0x17e)](_0x48a4f0[_0x1307b3(0xef)],_0x2ff472),(_0x409686[_0x1307b3(0x14e)]===_0x1307b3(0x13f)||_0x48a4f0[_0x1307b3(0x187)](_0x409686['type'],_0x48a4f0[_0x1307b3(0x18a)]))&&void _0xf3eacf[_0x1307b3(0x11b)](_0x48a4f0[_0x1307b3(0x160)],new Error(_0x409686['error']??_0x409686['type']),_0x2ff472);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;function _0x486f(_0x427f2a,_0x4e2a15){_0x427f2a=_0x427f2a-0xef;const _0x4747b5=_0x4747();let _0x486ff9=_0x4747b5[_0x427f2a];return _0x486ff9;}async function requireToken(){const _0x57a6fd=_0x486f,_0x4c580f={'XzFou':function(_0x5ca5ca){return _0x5ca5ca();},'zFzpT':_0x57a6fd(0x14f)},_0x2a6a76=await _0x4c580f[_0x57a6fd(0x10d)](getToken);if(!_0x2a6a76)throw new Error(_0x4c580f[_0x57a6fd(0x17b)]);return _0x2a6a76;}async function apiRequest(_0x33c57a,_0x2fb471={}){const _0x14932f=_0x486f,_0x2f3fd9={'aqEgF':function(_0x29dcd4){return _0x29dcd4();},'IgqtT':function(_0x2a589a,_0x626845){return _0x2a589a===_0x626845;},'FTAzj':function(_0x4a1e5e,_0x5ec938){return _0x4a1e5e===_0x5ec938;},'KijSG':function(_0x5bab1b,_0x5cd3ea){return _0x5bab1b===_0x5cd3ea;}},_0x525f7d=await requireToken(),_0x3507d3=_0x2f3fd9['aqEgF'](getApiBaseUrl),_0x27ce55=await fetch(''+_0x3507d3+_0x33c57a,{..._0x2fb471,'headers':{'Authorization':_0x14932f(0xf2)+_0x525f7d,'Content-Type':_0x14932f(0x139),..._0x2fb471['headers']??{}}});if(!_0x27ce55['ok']){let _0x4eb135='',_0x2adf7d;try{const _0x27fba9=await _0x27ce55['json'](),_0x2ae4d0=(_0x2f3fd9['IgqtT'](typeof _0x27fba9['error'],'string')?_0x27fba9['error']:undefined)??JSON['stringify'](_0x27fba9);_0x4eb135=_0x2ae4d0;_0x2f3fd9['FTAzj'](typeof _0x27fba9['test_output'],_0x14932f(0x102))&&_0x27fba9[_0x14932f(0x173)]&&(_0x4eb135=_0x4eb135+'\x0a'+_0x27fba9['test_output']);if(typeof _0x27fba9['code']===_0x14932f(0x102))_0x2adf7d=_0x27fba9[_0x14932f(0x12f)];}catch{_0x4eb135=_0x27ce55[_0x14932f(0x184)];}throw new ApiError(_0x14932f(0x18e)+_0x33c57a+'\x20failed\x20('+_0x27ce55[_0x14932f(0x108)]+'):\x20'+_0x4eb135,_0x27ce55['status'],_0x4eb135,_0x2adf7d);}if(_0x2f3fd9['KijSG'](_0x27ce55[_0x14932f(0x108)],0xcc))return undefined;return _0x27ce55['json']();}export class ApiError extends Error{[_0x1e8167(0x108)];[_0x1e8167(0x12a)];['code'];constructor(_0x2ab18d,_0x340379,_0x2b788b,_0x3e107a){const _0x51c810=_0x1e8167;super(_0x2ab18d),this['status']=_0x340379,this[_0x51c810(0x12a)]=_0x2b788b,this['code']=_0x3e107a,this[_0x51c810(0x164)]='ApiError';}}export async function fetchCloudProfile(_0x5a1820){const _0x4d8c75=_0x1e8167,_0x465169={'nzArF':function(_0x17851e,_0x45a970){return _0x17851e(_0x45a970);}};try{return await _0x465169[_0x4d8c75(0x167)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x5a1820));}catch(_0x530c6f){if(_0x530c6f instanceof ApiError&&_0x530c6f['status']===0x194)return null;throw _0x530c6f;}}function _0x4747(){const _0x4822a0=['gGPMO','true','catch','AUGkX','\x20\x20Cloud\x20profile\x20\x22','No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22','error','stringify','PCEiO','sessionId','ecITR','invalidateOn','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','session_state','/api/v1/profiles/','\x22,\x20attempting\x20login...','cCjDx','cookies','QhJTY','profiles','domains','tunnelUrl','kDQmy','FNILG','930613hmawvB','Bearer\x20','/login','environmentKey','sJbhg','\x20--url\x20','MhpGe','url','\x22\x20for\x20','env','close','5197868YWGmaM','forceLogin','huYbw','zcTEQ','activeLocalConnections','tjmKo','string','fDZTR','/api/v1/profiles','tunnel_session_id','RIQwj','storageStatePath','status','uXSNb','settings','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','CHVAL','XzFou',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','telemetry','loginInstructions','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','\x22.\x0a','save','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','elapsedMs','KIrWk','lQQux','\x22,\x20cached\x20locally','auth','trackPhaseError','HWUmQ','auth_config','tunnel','\x22;\x20using\x20\x22','cykUc','pBezm','kmcgw','utf-8','confirm','agent','2|0|4|3|1','\x22\x20not\x20found.','username','3515331RwGWdO','detail','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','toLowerCase','wuYBN','\x20\x20Created\x20cloud\x20profile\x20\x22','code','VHNma','RANGER_TEST_USERNAME','force','WXthL','iyenm','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','persistSessionState','keys','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','application/json','pendingLocalConnections','raw','HcpxC','/api/v1/tunnel/sessions/','822270kAhUTU','tunnel_error','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','message','pwEndpoint','password','effectiveBaseUrl','pw_endpoint','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','\x22,\x20refreshing\x20session...','key','launch','sessionState','\x20Available:\x20','invalid-url','4189120ZhPIFl','type','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','browserOptions','tunnel_login_request','xvRZb','bFZuU','prompt','No\x20saved\x20session\x20for\x20\x22','ambiguous','defaultEnvironmentKey','tunnel_login_setup','tunnel_login_cleanup','EmPby','assertedEnv','nnRas','fxWkX','PUT','iNeIo','organizationId','2177808LsZoyA','RANGER_TEST_PASSWORD','name','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','nzArF','userAgent','Pass\x20--base-url\x20<your-app-url>\x20so\x20Ranger\x20can\x20match\x20the\x20right\x20one,\x20or\x20create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`.','QuPUF','setupHeaders','\x22\x20instead.','XiANy','log','isArray','jrKTL','then','clientIp','test_output','origin','\x22;\x20proceeding\x20with\x20loginInstructions.','\x20\x20Cloud\x20session\x20for\x20\x22','about:blank','\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','join','zFzpT','7688842cNxjoB','replace','trackPhaseEnd','sessionCheckPath','vkFqq','decui','cEKtl','length','statusText','not_configured',').\x20','mWlCU','environments','POST','YlMJM','yqqYc','2sSayve','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','API\x20request\x20'];_0x4747=function(){return _0x4822a0;};return _0x4747();}export async function listCloudProfiles(){const _0x4cda4b=_0x1e8167,_0x47dbbf={'emyho':function(_0x4aaa2d,_0x3f58a0){return _0x4aaa2d(_0x3f58a0);},'kmcgw':_0x4cda4b(0x104)},_0x35fe4c=await _0x47dbbf['emyho'](apiRequest,_0x47dbbf[_0x4cda4b(0x122)]);return _0x35fe4c[_0x4cda4b(0x1a2)];}export async function deleteCloudProfile(_0x5858f4){const _0xda29ff=_0x1e8167;try{await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x5858f4),{'method':'DELETE'});}catch(_0x113259){if(_0x113259 instanceof ApiError&&_0x113259['status']===0x194)throw new Error('Cloud\x20profile\x20\x22'+_0x5858f4+_0xda29ff(0x127));throw _0x113259;}}export async function createCloudProfile(_0x3db164,_0x25517e,_0x559a44={}){const _0xd0abd9=_0x1e8167,_0x230b1c={'yLDSk':function(_0x2dbad5,_0x34b5dd,_0x494324){return _0x2dbad5(_0x34b5dd,_0x494324);},'pBezm':'/api/v1/profiles','bGEMB':_0xd0abd9(0x189)},_0x55b95f={'name':_0x3db164};if(_0x25517e)_0x55b95f['environment_key']=_0x25517e;_0x559a44['settings']&&Object['keys'](_0x559a44['settings'])['length']>0x0&&(_0x55b95f[_0xd0abd9(0x10a)]=_0x559a44[_0xd0abd9(0x10a)]);if(_0x559a44[_0xd0abd9(0x128)])_0x55b95f['username']=_0x559a44['username'];if(_0x559a44['password'])_0x55b95f[_0xd0abd9(0x143)]=_0x559a44['password'];return await _0x230b1c['yLDSk'](apiRequest,_0x230b1c[_0xd0abd9(0x121)],{'method':_0x230b1c['bGEMB'],'body':JSON[_0xd0abd9(0x196)](_0x55b95f)});}export async function uploadCloudProfileSession(_0x36ef13,_0x28e85d){const _0x2b460b=_0x1e8167,_0x2d697a={'kZWVr':function(_0x409ad7,_0x2b60a5){return _0x409ad7(_0x2b60a5);}};return await apiRequest(_0x2b460b(0x19d)+_0x2d697a['kZWVr'](encodeURIComponent,_0x36ef13)+'/session',{'method':_0x2b460b(0x189),'body':JSON[_0x2b460b(0x196)]({'session_state':_0x28e85d})});}export async function saveCloudProfileCredentials(_0x4c3be2,_0x340af6,_0x4cf3d9){const _0x1d4a38=_0x1e8167,_0x5d0691={'NuFeV':function(_0xfe57af,_0x15acdd,_0x1f878e){return _0xfe57af(_0x15acdd,_0x1f878e);}};await _0x5d0691['NuFeV'](apiRequest,_0x1d4a38(0x19d)+encodeURIComponent(_0x4c3be2),{'method':_0x1d4a38(0x15f),'body':JSON[_0x1d4a38(0x196)]({'username':_0x340af6,'password':_0x4cf3d9})});}export async function fetchAuthConfig(){const _0x472402=_0x1e8167,_0x256d89={'nnRas':function(_0x433e34,_0x5aae0f){return _0x433e34(_0x5aae0f);},'kyutR':function(_0x3658eb,_0x9b102c){return _0x3658eb instanceof _0x9b102c;}};try{const _0x58f192=await _0x256d89[_0x472402(0x15d)](apiRequest,'/api/v1/profiles/auth-config');return _0x58f192[_0x472402(0x11d)];}catch(_0x24508b){return _0x256d89['kyutR'](_0x24508b,ApiError)&&_0x24508b['status']!==0x194&&console[_0x472402(0x195)](_0x472402(0x135)+_0x24508b[_0x472402(0x141)]),null;}}async function createTunnelSession(_0x59487f){const _0x1db2f4=_0x1e8167,_0x19e7fe={'FNILG':function(_0xbb948f,_0x1bfcda,_0x4cb216){return _0xbb948f(_0x1bfcda,_0x4cb216);},'yqqYc':'/api/v1/tunnel/sessions'};return await _0x19e7fe[_0x1db2f4(0xf0)](apiRequest,_0x19e7fe[_0x1db2f4(0x18b)],{'method':'POST','body':JSON[_0x1db2f4(0x196)]({'targetUrl':_0x59487f,'mode':_0x1db2f4(0x125)})});}async function deleteTunnelSession(_0x2f1e5b){const _0x10b474=_0x1e8167,_0x4d935e={'PCEiO':'DELETE'};await apiRequest(_0x10b474(0x13d)+_0x2f1e5b,{'method':_0x4d935e[_0x10b474(0x197)]});}export function pickAdHocEnvKey(_0x41e138,_0x2f6311,_0x206e1a){const _0x36ef32=_0x1e8167,_0x47371e={'zrYwS':function(_0x34cfef,_0x2a7400){return _0x34cfef+_0x2a7400;},'WXthL':function(_0x1a8f46,_0x249cec){return _0x1a8f46+_0x249cec;},'HBJIR':function(_0x5cb153,_0x49455b){return _0x5cb153 in _0x49455b;},'SFSQs':'key','bFZuU':function(_0x57f6da,_0x3b8f39){return _0x57f6da+_0x3b8f39;},'NzANO':function(_0x5d60be,_0x594f35){return _0x5d60be===_0x594f35;},'RIQwj':function(_0x1c58a6,_0x15ac45){return _0x1c58a6===_0x15ac45;},'gMWVP':function(_0x4ed64b,_0x2dada8){return _0x4ed64b+_0x2dada8;}};if(_0x206e1a){if(!_0x41e138?.['environments']?.[_0x206e1a]){const _0x2e9651=Object[_0x36ef32(0x137)](_0x41e138?.[_0x36ef32(0x188)]??{});throw new Error(_0x47371e['zrYwS'](_0x47371e[_0x36ef32(0x133)]('Auth\x20environment\x20\x22'+_0x206e1a+_0x36ef32(0x179),_0x2e9651[_0x36ef32(0x183)]?_0x36ef32(0x14b)+_0x2e9651['join'](',\x20')+'.':_0x36ef32(0x165)),'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)'));}return _0x206e1a;}if(!_0x41e138)return null;if(_0x2f6311){const _0x1a1833=matchAuthEnvironmentExact(_0x2f6311,_0x41e138);if(_0x1a1833)return _0x1a1833;const _0x39a50a=matchAuthEnvironmentByHost(_0x2f6311,_0x41e138);if(_0x39a50a&&_0x47371e['HBJIR'](_0x47371e['SFSQs'],_0x39a50a))return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x39a50a[_0x36ef32(0x148)]+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x2f6311+_0x36ef32(0x19b)),_0x39a50a['key'];if(_0x39a50a&&_0x47371e['HBJIR'](_0x36ef32(0x157),_0x39a50a))throw new Error(_0x36ef32(0x146)+_0x39a50a[_0x36ef32(0x157)][_0x36ef32(0x17a)](',\x20')+_0x36ef32(0x10e));if(needsTunnel(_0x2f6311))throw new Error(_0x47371e[_0x36ef32(0x154)](_0x36ef32(0x194)+_0x2f6311+_0x36ef32(0x113)+_0x36ef32(0x140)+'\x20\x20Options:\x0a'+'\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a',_0x36ef32(0x178)+_0x2f6311[_0x36ef32(0x17d)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a')+(_0x36ef32(0x111)+_0x2f6311+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x41e138['defaultEnvironmentKey'])return _0x41e138[_0x36ef32(0x158)];const _0x441e41=Object[_0x36ef32(0x137)](_0x41e138['environments']??{});if(_0x47371e['NzANO'](_0x441e41['length'],0x1))return _0x441e41[0x0];if(_0x47371e[_0x36ef32(0x106)](_0x441e41[_0x36ef32(0x183)],0x0))return null;throw new Error(_0x47371e['gMWVP']('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x441e41[_0x36ef32(0x17a)](',\x20')+_0x36ef32(0x186),_0x36ef32(0x169)));}export function adHocProfileName(_0x29e7cf,_0x1b9a65,_0x4fcb32){const _0x177cad={'DPpUU':function(_0x3111e3,_0xae3adc){return _0x3111e3===_0xae3adc;}};if(!_0x1b9a65||_0x177cad['DPpUU'](_0x1b9a65,_0x4fcb32))return _0x29e7cf;return _0x29e7cf+':'+_0x1b9a65;}export async function resolveAdHocProfile(_0x215c3b={},_0x5565e5=process['env']){const _0x36d3e3=_0x1e8167,_0x315893={'kXXqU':function(_0x72bc18,_0x3b921d,_0x126bf,_0x457f64){return _0x72bc18(_0x3b921d,_0x126bf,_0x457f64);},'iSpKA':function(_0x3d4137,_0x16775b){return _0x3d4137(_0x16775b);},'decui':function(_0xfef454,_0x4350e6){return _0xfef454&&_0x4350e6;},'oWIfo':function(_0x221338,_0x28a796){return _0x221338(_0x28a796);},'LbrIg':function(_0x495888,_0x476eda){return _0x495888??_0x476eda;}},_0x545258=_0x5565e5['RANGER_TEST_USERNAME'];if(!_0x545258)return null;const _0x59c9a7=await fetchAuthConfig(),_0x16ea31=pickAdHocEnvKey(_0x59c9a7,_0x215c3b['targetUrl'],_0x215c3b['envKey']);let _0x2768e6=_0x315893['kXXqU'](adHocProfileName,_0x545258,_0x16ea31,_0x59c9a7?.['defaultEnvironmentKey']),_0x565a3f=await _0x315893['iSpKA'](fetchCloudProfile,_0x2768e6);_0x315893[_0x36d3e3(0x181)](_0x565a3f,_0x16ea31)&&_0x565a3f[_0x36d3e3(0xf4)]!==_0x16ea31&&(console[_0x36d3e3(0x16e)](_0x36d3e3(0x193)+_0x2768e6+'\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22'+(_0x565a3f['environmentKey']??'none')+_0x36d3e3(0x166)+_0x16ea31+_0x36d3e3(0x11f)+_0x545258+':'+_0x16ea31+_0x36d3e3(0x16c)),_0x2768e6=_0x545258+':'+_0x16ea31,_0x565a3f=await _0x315893['oWIfo'](fetchCloudProfile,_0x2768e6));if(_0x565a3f)return{'name':_0x565a3f['name'],'profile':_0x565a3f};const _0x25893b=_0x5565e5[_0x36d3e3(0x163)],_0x29d2a7=await _0x315893['kXXqU'](createCloudProfile,_0x2768e6,_0x315893['LbrIg'](_0x16ea31,undefined),{'username':_0x545258,'password':_0x25893b});return console[_0x36d3e3(0x16e)](_0x36d3e3(0x12e)+_0x29d2a7['name']+_0x36d3e3(0xf9)+_0x545258+(_0x16ea31?'\x20(auth\x20env:\x20'+_0x16ea31+')':'')),{'name':_0x29d2a7[_0x36d3e3(0x164)],'profile':_0x29d2a7};}export async function writeSessionToLocalCache(_0x327b34,_0x3f6743,_0x1504ea,_0x152b53,_0x4418d9,_0x1ae7fa,_0x2a93f0){const _0x2f21cd=_0x1e8167,_0x1b30f9={'zNaIy':function(_0x1cf559,_0x478024){return _0x1cf559(_0x478024);},'vraVQ':function(_0x4155b8,_0x8bcce4,_0x1a08d2){return _0x4155b8(_0x8bcce4,_0x1a08d2);},'zekoO':_0x2f21cd(0x11a),'iaOsz':function(_0x949b8b,_0x5f48ec,_0x1f351b){return _0x949b8b(_0x5f48ec,_0x1f351b);},'XiANy':function(_0xe1e556,_0x5c96ac,_0x28d716){return _0xe1e556(_0x5c96ac,_0x28d716);}},_0x29385e=_0x1b30f9['zNaIy'](sessionCacheHash,{'orgId':_0x3f6743,'profileName':_0x327b34,'effectiveBaseUrl':_0x1504ea,'setupHeaders':_0x152b53,'invalidateOn':_0x2a93f0?.[_0x2f21cd(0x19a)],'userAgent':_0x2a93f0?.['userAgent'],'clientIp':_0x2a93f0?.[_0x2f21cd(0x172)]}),_0xa1af20=getSessionCachePath(_0x29385e,_0x327b34),_0x349ac4=_0x1b30f9['vraVQ'](join,getRangerHomeDir(),_0x1b30f9['zekoO']);!existsSync(_0x349ac4)&&await _0x1b30f9['vraVQ'](mkdir,_0x349ac4,{'recursive':!![]});const _0x8316f6={..._0x4418d9};_0x1ae7fa&&_0x1ae7fa['length']>0x0&&Array[_0x2f21cd(0x16f)](_0x8316f6[_0x2f21cd(0x1a0)])&&(_0x8316f6[_0x2f21cd(0x1a0)]=_0x1b30f9['vraVQ'](duplicateCookiesForDomains,_0x8316f6[_0x2f21cd(0x1a0)],_0x1ae7fa));const _0x251525={'cached_at':new Date()['toISOString'](),'session_state':_0x8316f6};await _0x1b30f9['iaOsz'](writeFile,_0xa1af20,JSON['stringify'](_0x251525,null,0x2));const _0x1fdeef=_0x1b30f9['zNaIy'](getStorageStatePath,_0xa1af20);return await _0x1b30f9[_0x2f21cd(0x16d)](writeFile,_0x1fdeef,JSON[_0x2f21cd(0x196)](_0x8316f6,null,0x2)),_0x1fdeef;}export async function checkLocalCache(_0x5172dc,_0x4f55e2,_0x662055,_0x17f87d,_0x508ca5){const _0x3e1442=_0x1e8167,_0x2544dd={'WSSFV':function(_0x19e2e8,_0x314087){return _0x19e2e8(_0x314087);},'BRFEE':_0x3e1442(0x123)},_0x3986e0=sessionCacheHash({'orgId':_0x4f55e2,'profileName':_0x5172dc,'effectiveBaseUrl':_0x662055,'setupHeaders':_0x17f87d,'invalidateOn':_0x508ca5?.[_0x3e1442(0x19a)],'userAgent':_0x508ca5?.[_0x3e1442(0x168)],'clientIp':_0x508ca5?.[_0x3e1442(0x172)]}),_0x4eaf93=getSessionCachePath(_0x3986e0,_0x5172dc),_0x1f0dfb=_0x2544dd['WSSFV'](getStorageStatePath,_0x4eaf93);if(!existsSync(_0x4eaf93)||!existsSync(_0x1f0dfb))return null;try{const _0x3f2441=await readFile(_0x4eaf93,_0x2544dd['BRFEE']);return JSON['parse'](_0x3f2441),{'storageStatePath':_0x1f0dfb};}catch{return null;}}function launchRealBrowser(){const _0x208363=_0x1e8167;return chromium[_0x208363(0x149)]({'headless':!![]});}function emitSessionValidationHint(_0x3d5134,_0x2c72ba){const _0x522633=_0x1e8167,_0x22db1f={'kodIe':function(_0x250482,_0x187aac){return _0x250482===_0x187aac;},'gkJaa':function(_0x5ed630,_0x2181af){return _0x5ed630+_0x2181af;},'VHNma':function(_0x4aa351,_0x248380){return _0x4aa351+_0x248380;}};if(!_0x2c72ba||!_0x2c72ba[_0x522633(0x1a3)]?.[_0x522633(0x183)])return;let _0x27803e;try{_0x27803e=new URL(_0x3d5134);}catch{return;}const _0x5012b9=[];for(const _0x7d2fc8 of _0x2c72ba['domains']){try{_0x5012b9['push']({'raw':_0x7d2fc8,'url':new URL(_0x7d2fc8)});}catch{}}if(_0x22db1f['kodIe'](_0x5012b9[_0x522633(0x183)],0x0))return;if(_0x5012b9['some'](_0x28a6a8=>_0x28a6a8[_0x522633(0xf8)]['origin']===_0x27803e[_0x522633(0x174)]))return;const _0x105a7b=_0x5012b9['map'](_0x3d5329=>'\x22'+_0x3d5329[_0x522633(0x13b)]+'\x22')[_0x522633(0x17a)](',\x20');console[_0x522633(0x16e)](_0x22db1f['gkJaa'](_0x22db1f[_0x522633(0x130)]('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x105a7b+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x3d5134+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20'),'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.'));}export async function serverSideLogin(_0x476e91,_0x3afdd3){const _0x45702b=_0x1e8167,_0x53efda={'WVNCK':function(_0x192a4f,_0x499919){return _0x192a4f(_0x499919);},'MhpGe':_0x45702b(0x189),'jrKTL':function(_0x4061f6,_0x3b1202){return _0x4061f6===_0x3b1202;}},_0x16fa5e=process['env']['RANGER_TEST_USERNAME'],_0x361643=process[_0x45702b(0xfa)][_0x45702b(0x163)],_0x230931={};if(_0x16fa5e)_0x230931[_0x45702b(0x128)]=_0x16fa5e;if(_0x361643)_0x230931['password']=_0x361643;if(_0x3afdd3?.['force'])_0x230931['force']=!![];if(_0x3afdd3?.['targetUrl'])_0x230931['target_url']=_0x3afdd3['targetUrl'];if(_0x3afdd3?.[_0x45702b(0xfa)])_0x230931['env']=_0x3afdd3[_0x45702b(0xfa)];_0x3afdd3?.[_0x45702b(0x11e)]&&(_0x230931[_0x45702b(0x105)]=_0x3afdd3['tunnel']['sessionId'],_0x230931[_0x45702b(0x145)]=_0x3afdd3[_0x45702b(0x11e)][_0x45702b(0x142)]);try{return await apiRequest(_0x45702b(0x19d)+_0x53efda['WVNCK'](encodeURIComponent,_0x476e91)+_0x45702b(0xf3),{'method':_0x53efda[_0x45702b(0xf7)],'body':JSON['stringify'](_0x230931)});}catch(_0x41caf6){if(_0x41caf6 instanceof ApiError&&_0x53efda[_0x45702b(0x170)](_0x41caf6['status'],0x190)&&_0x53efda['jrKTL'](_0x41caf6['code'],_0x45702b(0x185)))return{'status':'not_configured','error':_0x41caf6[_0x45702b(0x12a)]};throw _0x41caf6;}}async function serverSideLoginWithOptionalTunnel(_0x270c85,_0x14f7a3,_0xf0d3ba={}){const _0x315326=_0x1e8167,_0x1afc59={'SrJOb':'tunnel_login_request','gGPMO':function(_0x3b09fd,_0x1620d7){return _0x3b09fd(_0x1620d7);},'uAJgM':function(_0x4c9171,_0x595e9f){return _0x4c9171===_0x595e9f;},'xvRZb':function(_0x2ad9f8,_0x2b5610){return _0x2ad9f8(_0x2b5610);},'fDZTR':'tunnel_login_setup','OrBrY':_0x315326(0x115),'sJbhg':function(_0xfd41f2){return _0xfd41f2();},'Wiout':function(_0x2211c4,_0x1e6c54){return _0x2211c4(_0x1e6c54);},'fxWkX':function(_0x282f47,_0x27de25){return _0x282f47(_0x27de25);}};if(!needsTunnel(_0x14f7a3))return await serverSideLogin(_0x270c85,{'force':_0xf0d3ba['force'],'env':_0xf0d3ba['env']});let _0x36de87=null,_0x5c4093=null,_0x5a7547=null,_0x1c09a2=null,_0x26873f=![];const _0x4ea1a6=process['env']['RANGER_TUNNEL_LOGIN_HEADED']?.[_0x315326(0x12c)](),_0x4e5f25=_0x1afc59['uAJgM'](_0x4ea1a6,'1')||_0x1afc59['uAJgM'](_0x4ea1a6,_0x315326(0x190)),_0x2b23c2={'profileName':_0x270c85,'targetUrlHost':_0x1afc59[_0x315326(0x153)](targetHostForTelemetry,_0x14f7a3),'tunnelRequired':!![],'forceLogin':Boolean(_0xf0d3ba['force']),'localBrowserServerHeaded':_0x4e5f25};try{_0xf0d3ba[_0x315326(0x10f)]?.['trackPhaseStart'](_0x1afc59[_0x315326(0x103)],_0x2b23c2);_0x4e5f25&&console['log'](_0x1afc59['OrBrY']);_0x36de87=await launchBrowserServer({'headless':!_0x4e5f25}),_0x5c4093=await createTunnelSession(_0x14f7a3);const _0x247147=await _0x1afc59[_0x315326(0xf5)](requireToken);_0x5a7547=await _0x1afc59['Wiout'](createTunnelBridge,{'localWsUrl':_0x36de87['wsEndpoint'],'tunnelServerUrl':_0x5c4093[_0x315326(0x1a4)],'sessionId':_0x5c4093['sessionId'],'apiKey':_0x247147,'onError':_0x2509b3=>{_0x1c09a2=_0x2509b3;},'onClose':()=>{const _0x276c19=_0x315326;_0x1c09a2??=new Error(_0x276c19(0x10b)+_0x270c85);},'onEvent':_0x368873=>trackBridgeEvent(_0xf0d3ba[_0x315326(0x10f)],_0x368873)}),_0xf0d3ba[_0x315326(0x10f)]?.['trackPhaseEnd'](_0x315326(0x159),{..._0x2b23c2,'tunnelSessionId':_0x5c4093['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x4e5f25}),_0x26873f=!![];try{return _0xf0d3ba[_0x315326(0x10f)]?.['trackPhaseStart'](_0x1afc59['SrJOb'],{..._0x2b23c2,'tunnelSessionId':_0x5c4093[_0x315326(0x198)]}),await serverSideLogin(_0x270c85,{'force':_0xf0d3ba[_0x315326(0x132)],'targetUrl':_0x14f7a3,'env':_0xf0d3ba['env'],'tunnel':{'sessionId':_0x5c4093['sessionId'],'pwEndpoint':_0x5c4093['pwEndpoint']}})[_0x315326(0x171)](_0x1143e1=>{const _0x6e788b=_0x315326;return _0xf0d3ba['telemetry']?.[_0x6e788b(0x17e)](_0x1afc59['SrJOb'],{..._0x2b23c2,'tunnelSessionId':_0x5c4093?.[_0x6e788b(0x198)],'loginStatus':_0x1143e1[_0x6e788b(0x108)],'hasSessionState':Boolean(_0x1143e1['session_state']),'hasTestOutput':_0x1afc59[_0x6e788b(0x18f)](Boolean,_0x1143e1['test_output']),'bridgeError':errorMessageForTelemetry(_0x1c09a2)}),_0x1143e1;});}catch(_0x67c87b){await _0xf0d3ba['telemetry']?.[_0x315326(0x11b)](_0x315326(0x152),_0x1c09a2??_0x67c87b,{..._0x2b23c2,'tunnelSessionId':_0x5c4093['sessionId'],'bridgeError':errorMessageForTelemetry(_0x1c09a2)});throw _0x1c09a2??_0x67c87b;}}catch(_0x15bb28){!_0x26873f&&await _0xf0d3ba['telemetry']?.['trackPhaseError'](_0x1afc59['fDZTR'],_0x15bb28,{..._0x2b23c2,'tunnelSessionId':_0x5c4093?.['sessionId']});throw _0x15bb28;}finally{if(_0x5c4093||_0x36de87||_0x5a7547){const _0x4f8160=_0x315326(0x126)['split']('|');let _0x8e162c=0x0;while(!![]){switch(_0x4f8160[_0x8e162c++]){case'0':_0x5a7547?.['close']();continue;case'1':_0xf0d3ba[_0x315326(0x10f)]?.[_0x315326(0x17e)]('tunnel_login_cleanup',{..._0x2b23c2,'tunnelSessionId':_0x5c4093?.[_0x315326(0x198)]});continue;case'2':_0xf0d3ba[_0x315326(0x10f)]?.['trackPhaseStart'](_0x315326(0x15a),{..._0x2b23c2,'tunnelSessionId':_0x5c4093?.['sessionId']});continue;case'3':_0x5c4093&&await _0x1afc59[_0x315326(0x15e)](deleteTunnelSession,_0x5c4093['sessionId'])[_0x315326(0x191)](()=>{});continue;case'4':_0x36de87&&await _0x36de87[_0x315326(0xfb)]()['catch'](()=>{});continue;}break;}}}}export async function manualBrowserLogin(_0xf58daf,_0x582076,_0x4ce478={}){const _0x43edeb=_0x1e8167,_0x529827={'HWUmQ':function(_0x43798e,_0x394bd0){return _0x43798e+_0x394bd0;},'eAZga':'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','QuPUF':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','wuYBN':function(_0x26281f,_0x54fc6f){return _0x26281f>_0x54fc6f;},'huYbw':_0x43edeb(0x177),'HcpxC':_0x43edeb(0x12b),'vzmOJ':'Browser\x20login\x20timed\x20out\x20before\x20completion.','VhULg':'Browser\x20closed\x20before\x20authentication\x20was\x20saved.','UlENl':function(_0x1e8e42,_0x525f39){return _0x1e8e42!==_0x525f39;},'cykUc':function(_0x4354d4,_0x4c4b51){return _0x4354d4(_0x4c4b51);},'AUGkX':'cli:manual-login'};if(!isInteractive())throw new Error(_0x529827[_0x43edeb(0x11c)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0xf58daf[_0x43edeb(0x164)]+'\x22.\x0a'+_0x529827['eAZga'],_0x529827[_0x43edeb(0x16a)]));const _0x592dc2=_0x582076&&_0x529827[_0x43edeb(0x12d)](_0x582076[_0x43edeb(0x1a3)]['length'],0x0)?_0x582076['domains'][0x0]:_0x529827[_0x43edeb(0xfe)];console[_0x43edeb(0x16e)](_0x529827[_0x43edeb(0x13c)]),console[_0x43edeb(0x16e)]('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x2da01d=>setTimeout(_0x2da01d,0x7d0));const _0x2d4277=await chromium['launch']({'headless':![]});let _0x5a5df9=null;try{const _0x47403d={'ignoreHTTPSErrors':!![]};_0x582076?.[_0x43edeb(0x16b)]&&(_0x47403d['extraHTTPHeaders']=_0x582076['setupHeaders']);const _0x106ac0=await _0x2d4277['newContext'](_0x47403d);await addProfileSetupBanner(_0x106ac0);const _0x2972e1=await _0x106ac0['newPage']();await _0x2972e1['goto'](_0x592dc2);let _0x16f79f=![];await new Promise(_0x55a9ce=>{const _0x26bb76=setTimeout(()=>{const _0x4cf1d1=_0x486f;_0x16f79f=!![],console['error']('Browser\x20login\x20timed\x20out\x20after\x20'+MANUAL_LOGIN_TIMEOUT_MS/0xea60+_0x4cf1d1(0x138)),_0x55a9ce();},MANUAL_LOGIN_TIMEOUT_MS);_0x2972e1['on']('close',async()=>{clearTimeout(_0x26bb76);try{const _0x45354b=await _0x106ac0['storageState']();_0x5a5df9=_0x45354b;}catch{}_0x55a9ce();});});if(_0x16f79f&&!_0x5a5df9)throw new Error(_0x529827['vzmOJ']);}finally{await _0x2d4277['close']()['catch'](()=>{});}if(!_0x5a5df9)throw new Error(_0x529827['VhULg']);return _0x529827['UlENl'](_0x4ce478[_0x43edeb(0x136)],![])&&await apiRequest(_0x43edeb(0x19d)+_0x529827[_0x43edeb(0x120)](encodeURIComponent,_0xf58daf['name'])+'/session',{'method':_0x43edeb(0x189),'body':JSON['stringify']({'session_state':_0x5a5df9,'updated_by':_0x529827[_0x43edeb(0x192)]})}),{'sessionState':_0x5a5df9};}export async function promptSaveCredentials(_0x3aefc9){const _0x3ecedb=_0x1e8167,_0x1a2d9e={'sGLQM':_0x3ecedb(0x15f)},_0x3fdd74=process['env'][_0x3ecedb(0x131)],_0x17b42e=process[_0x3ecedb(0xfa)]['RANGER_TEST_PASSWORD'];if(!_0x3fdd74||!_0x17b42e)return;if(!isInteractive())return;const {save:_0x27ff08}=await _0x3f7ac0[_0x3ecedb(0x155)]([{'type':_0x3ecedb(0x124),'name':_0x3ecedb(0x114),'message':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','default':![]}]);if(!_0x27ff08)return;await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x3aefc9),{'method':_0x1a2d9e['sGLQM'],'body':JSON[_0x3ecedb(0x196)]({'username':_0x3fdd74,'password':_0x17b42e})}),console['log'](_0x3ecedb(0x18d));}export async function resolveCloudProfileSession(_0x39fc5a,_0xc8894a={}){const _0x4bd20c=_0x1e8167,_0x2a1420={'lQQux':function(_0x4e7754,_0x58008){return _0x4e7754===_0x58008;},'CHVAL':'string','xnZkl':function(_0x1bf846,_0xd4e7c0){return _0x1bf846||_0xd4e7c0;},'iyenm':function(_0x4937ae,_0xf2471c){return _0x4937ae(_0xf2471c);},'tjmKo':function(_0x43c841,_0x24c42b){return _0x43c841(_0x24c42b);},'hxnrz':function(_0x3fb6ba,_0x5825be){return _0x3fb6ba(_0x5825be);},'uXSNb':function(_0x2f0f5b,_0x34be2a,_0x3cfaac,_0xeca6bf,_0x565b2e,_0x479627){return _0x2f0f5b(_0x34be2a,_0x3cfaac,_0xeca6bf,_0x565b2e,_0x479627);},'vkFqq':function(_0x5f28fc,_0x9b162e,_0x1c9f41,_0x3546e2,_0x3ef288,_0x322717,_0x10c062,_0x3c6493){return _0x5f28fc(_0x9b162e,_0x1c9f41,_0x3546e2,_0x3ef288,_0x322717,_0x10c062,_0x3c6493);},'cEKtl':function(_0x2bd4f5,_0x27ced3,_0x40c06c,_0x3dde20,_0xe19e42){return _0x2bd4f5(_0x27ced3,_0x40c06c,_0x3dde20,_0xe19e42);},'ruFIA':function(_0x4cde79,_0x8491eb,_0x214538){return _0x4cde79(_0x8491eb,_0x214538);},'WivxF':function(_0x490f44,_0xe00292){return _0x490f44||_0xe00292;},'KIrWk':function(_0x308844,_0x24090e,_0x42ed0a,_0x1fea9e){return _0x308844(_0x24090e,_0x42ed0a,_0x1fea9e);},'RwNyk':function(_0x109dd2,_0x2b73a1,_0x4f0b4f){return _0x109dd2(_0x2b73a1,_0x4f0b4f);},'EmPby':'\x20\x20Login\x20successful.\x20Session\x20cached.','PWJAN':function(_0x21a73d,_0x28e049,_0x5c15ef,_0x90ac0d,_0x57d542,_0x187389,_0x41a570,_0x4c7d6b){return _0x21a73d(_0x28e049,_0x5c15ef,_0x90ac0d,_0x57d542,_0x187389,_0x41a570,_0x4c7d6b);},'ecITR':function(_0x309758,_0x3fe641){return _0x309758&&_0x3fe641;},'QwYwx':function(_0xad28a0,_0x3094b9){return _0xad28a0(_0x3094b9);},'QhJTY':_0x4bd20c(0x150),'cCjDx':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...'},_0x3c661f=_0x39fc5a[_0x4bd20c(0x10a)]??{},_0x3cc820=await fetchAuthConfig(),_0x5db732=_0x3cc820?resolveAuthEnvironmentLocally(_0x3cc820,_0xc8894a['assertedEnv']??_0x39fc5a[_0x4bd20c(0xf4)]):null,_0x50a92b=typeof _0x5db732?.['loginInstructions']===_0x4bd20c(0x102)&&_0x5db732[_0x4bd20c(0x110)]['trim']()?_0x5db732['loginInstructions']:undefined,_0x1a7f9c=_0x2a1420['lQQux'](typeof _0x3c661f[_0x4bd20c(0x110)],_0x2a1420[_0x4bd20c(0x10c)])&&_0x3c661f[_0x4bd20c(0x110)]['trim']()?_0x3c661f['loginInstructions']:undefined,_0x200e8c=_0x2a1420['xnZkl'](_0x1a7f9c,!_0x50a92b)?_0x3c661f:{..._0x3c661f,'loginInstructions':_0x50a92b},_0x2c65d6=_0x2a1420['iyenm'](Boolean,_0x200e8c[_0x4bd20c(0x110)]?.['trim']()),_0x24b2de=_0x2a1420[_0x4bd20c(0x101)](Boolean,_0x3c661f[_0x4bd20c(0xfd)]||_0x5db732?.[_0x4bd20c(0xfd)]),_0x2b45a6=_0x5db732?.['domains'],_0x363d1f=_0x3c661f[_0x4bd20c(0x16b)],_0x522c5b=_0x363d1f??_0x5db732?.['setupHeaders'],_0xb960df=_0xc8894a[_0x4bd20c(0x144)]??_0x3c661f['baseUrl']??(_0x2b45a6&&_0x2b45a6['length']>0x0?_0x2b45a6[0x0]:''),_0x390b5d=_0xb960df?_0x2a1420['hxnrz'](needsTunnel,_0xb960df):![],_0x3163d5={'invalidateOn':_0x5db732?.['invalidateOn'],'userAgent':_0x5db732?.[_0x4bd20c(0x151)]?.['userAgent']??_0x3c661f[_0x4bd20c(0x168)]};_0x24b2de&&console[_0x4bd20c(0x16e)]('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x39fc5a[_0x4bd20c(0x164)]+_0x4bd20c(0x147));if(!_0x24b2de){const _0x58d45a=await _0x2a1420[_0x4bd20c(0x109)](checkLocalCache,_0x39fc5a[_0x4bd20c(0x164)],_0x39fc5a['organizationId'],_0xb960df,_0x522c5b,_0x3163d5);if(_0x58d45a){if(_0xb960df&&!_0x390b5d){const _0x1e5395=await isCachedSessionLive(_0x58d45a[_0x4bd20c(0x107)],_0xb960df,{'sessionCheckPath':_0x5db732?.['sessionCheckPath'],'setupHeaders':_0x522c5b},{'launchBrowser':launchRealBrowser});if(_0x1e5395)return console[_0x4bd20c(0x16e)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x39fc5a['name']+'\x22'),{'authPath':_0x58d45a[_0x4bd20c(0x107)],'settings':_0x200e8c,'resolvedEnv':_0x5db732};console[_0x4bd20c(0x16e)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x39fc5a['name']+'\x22\x20failed\x20validation\x20—\x20refreshing...'),emitSessionValidationHint(_0xb960df,_0x5db732);}else return _0x390b5d&&console['log']('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x39fc5a['name']+'\x22'),{'authPath':_0x58d45a[_0x4bd20c(0x107)],'settings':_0x200e8c,'resolvedEnv':_0x5db732};}}if(!_0x24b2de&&_0x39fc5a[_0x4bd20c(0x14a)]){const _0x1a7ea1=await _0x2a1420[_0x4bd20c(0x180)](writeSessionToLocalCache,_0x39fc5a['name'],_0x39fc5a[_0x4bd20c(0x161)],_0xb960df,_0x522c5b,_0x39fc5a['sessionState'],_0x2b45a6,_0x3163d5);if(_0xb960df){const _0x455b88=await _0x2a1420[_0x4bd20c(0x182)](isCachedSessionLive,_0x1a7ea1,_0xb960df,{'sessionCheckPath':_0x5db732?.[_0x4bd20c(0x17f)],'setupHeaders':_0x522c5b},{'launchBrowser':launchRealBrowser});if(_0x455b88)return console['log']('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x39fc5a['name']+_0x4bd20c(0x119)),{'authPath':_0x1a7ea1,'settings':_0x200e8c,'resolvedEnv':_0x5db732};console[_0x4bd20c(0x16e)](_0x4bd20c(0x176)+_0x39fc5a[_0x4bd20c(0x164)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x2a1420['ruFIA'](emitSessionValidationHint,_0xb960df,_0x5db732);}else return{'authPath':_0x1a7ea1,'settings':_0x200e8c,'resolvedEnv':_0x5db732};}if(_0x2c65d6)return console[_0x4bd20c(0x16e)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x39fc5a[_0x4bd20c(0x164)]+_0x4bd20c(0x175)),{'authPath':undefined,'settings':_0x200e8c,'resolvedEnv':_0x5db732};console[_0x4bd20c(0x16e)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x39fc5a['name']+_0x4bd20c(0x19e));const _0x31c70e=Boolean(process['env'][_0x4bd20c(0x131)])&&_0x2a1420['iyenm'](Boolean,process['env']['RANGER_TEST_PASSWORD']),_0x574eae=_0x2a1420['hxnrz'](Boolean,_0x39fc5a[_0x4bd20c(0x128)]),_0x191a70=Boolean(_0xc8894a['assertedEnv']),_0x326afb=_0xb960df?_0x2a1420[_0x4bd20c(0x134)](isBareLocalhost,_0xb960df):![],_0x8ab3df=(_0x31c70e||_0x574eae)&&_0x2a1420['WivxF'](!_0x326afb,_0x191a70);if(_0x8ab3df)try{const _0x1eb325=_0xb960df?await _0x2a1420[_0x4bd20c(0x117)](serverSideLoginWithOptionalTunnel,_0x39fc5a['name'],_0xb960df,{'force':_0x24b2de,'telemetry':_0xc8894a[_0x4bd20c(0x10f)],'env':_0xc8894a[_0x4bd20c(0x15c)]}):await _0x2a1420['RwNyk'](serverSideLogin,_0x39fc5a[_0x4bd20c(0x164)],{'force':_0x24b2de,'env':_0xc8894a['assertedEnv']});if(_0x2a1420[_0x4bd20c(0x118)](_0x1eb325['status'],_0x4bd20c(0x185)))console['log'](_0x4bd20c(0x112));else{if(_0x2a1420[_0x4bd20c(0x118)](_0x1eb325['status'],'success')&&_0x1eb325['session_state']){console['log'](_0x2a1420[_0x4bd20c(0x15b)]);const _0x37f1e2=await _0x2a1420['PWJAN'](writeSessionToLocalCache,_0x39fc5a[_0x4bd20c(0x164)],_0x39fc5a[_0x4bd20c(0x161)],_0xb960df,_0x522c5b,_0x1eb325[_0x4bd20c(0x19c)],_0x2b45a6,_0x3163d5);return _0x2a1420[_0x4bd20c(0x199)](_0x31c70e,!_0x574eae)&&await _0x2a1420['QwYwx'](promptSaveCredentials,_0x39fc5a[_0x4bd20c(0x164)]),{'authPath':_0x37f1e2,'settings':_0x200e8c,'resolvedEnv':_0x5db732};}else _0x1eb325['test_output']&&(console[_0x4bd20c(0x16e)](_0x2a1420[_0x4bd20c(0x1a1)]),console['log'](_0x1eb325[_0x4bd20c(0x173)])),console[_0x4bd20c(0x16e)](_0x2a1420[_0x4bd20c(0x19f)]);}}catch(_0xa293d){console[_0x4bd20c(0x16e)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0xa293d instanceof Error?_0xa293d['message']:String(_0xa293d))),console[_0x4bd20c(0x16e)](_0x2a1420[_0x4bd20c(0x19f)]);}if(_0x326afb&&!_0x191a70&&!isInteractive())throw new Error(_0x4bd20c(0x156)+_0xb960df+'\x22\x20on\x20profile\x20\x22'+_0x39fc5a[_0x4bd20c(0x164)]+'\x22,\x20and\x20cloud\x20sessions\x20don\x27t\x20apply\x20to\x20localhost.\x0a'+('\x20\x20•\x20capture\x20one\x20(a\x20browser\x20opens):\x20ranger\x20profile\x20add\x20'+_0x39fc5a[_0x4bd20c(0x164)]+_0x4bd20c(0xf6)+_0xb960df+'\x0a')+'\x20\x20•\x20or\x20pass\x20--env\x20<key>\x20to\x20run\x20an\x20automated\x20login\x20for\x20this\x20target.');const _0x21202d=_0x5db732?{..._0x5db732,'domains':orderLoginDomains(_0xb960df,_0x5db732['domains']),'setupHeaders':_0x522c5b}:_0xb960df?{'key':_0x39fc5a['environmentKey']??'','domains':[_0xb960df],'setupHeaders':_0x522c5b}:null,{sessionState:_0x3b14ba}=await _0x2a1420[_0x4bd20c(0x117)](manualBrowserLogin,_0x39fc5a,_0x21202d,{'persistSessionState':!_0x390b5d}),_0x20a9f9=await writeSessionToLocalCache(_0x39fc5a[_0x4bd20c(0x164)],_0x39fc5a['organizationId'],_0xb960df,_0x522c5b,_0x3b14ba,_0x2b45a6,_0x3163d5);return{'authPath':_0x20a9f9,'settings':_0x200e8c,'resolvedEnv':_0x5db732};}
|
|
1
|
+
const _0x53b5fb=_0x3317;(function(_0x3966a8,_0x481d57){const _0x62efd0=_0x3317,_0x1191a8=_0x3966a8();while(!![]){try{const _0x447a3f=parseInt(_0x62efd0(0xad))/0x1+parseInt(_0x62efd0(0x104))/0x2+-parseInt(_0x62efd0(0xcb))/0x3*(parseInt(_0x62efd0(0xc0))/0x4)+-parseInt(_0x62efd0(0xc4))/0x5+-parseInt(_0x62efd0(0xca))/0x6*(parseInt(_0x62efd0(0xf9))/0x7)+-parseInt(_0x62efd0(0xaa))/0x8*(parseInt(_0x62efd0(0xc6))/0x9)+-parseInt(_0x62efd0(0xcd))/0xa*(-parseInt(_0x62efd0(0xc2))/0xb);if(_0x447a3f===_0x481d57)break;else _0x1191a8['push'](_0x1191a8['shift']());}catch(_0x548ea9){_0x1191a8['push'](_0x1191a8['shift']());}}}(_0x7a98,0x2c00e));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x426f01 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,isBareLocalhost,isCachedSessionLive,isInteractive,needsTunnel,orderLoginDomains,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x3e5eed){const _0x4b3a23=_0x3317,_0x5b9bea={'wFrYV':_0x4b3a23(0xa1)};try{return new URL(_0x3e5eed)['host'];}catch{return _0x5b9bea[_0x4b3a23(0x127)];}}function errorMessageForTelemetry(_0x5a9c1e){return _0x5a9c1e instanceof Error?_0x5a9c1e['message']:undefined;}function trackBridgeEvent(_0x329021,_0x1cecf1){const _0x52f77f=_0x3317,_0x4f5999={'XaRMC':function(_0x345551,_0x1dd2c4){return _0x345551===_0x1dd2c4;}};if(!_0x329021)return;const _0x237ae0={'tunnelSessionId':_0x1cecf1[_0x52f77f(0x71)],'tunnelEventType':_0x1cecf1[_0x52f77f(0x121)],'connectionId':_0x1cecf1[_0x52f77f(0x117)],'code':_0x1cecf1['code'],'reason':_0x1cecf1[_0x52f77f(0x126)],'error':_0x1cecf1[_0x52f77f(0x72)],'elapsedMs':_0x1cecf1[_0x52f77f(0x70)],'activeLocalConnections':_0x1cecf1['activeLocalConnections'],'pendingLocalConnections':_0x1cecf1[_0x52f77f(0x103)]};_0x329021[_0x52f77f(0xa3)](_0x52f77f(0x77),_0x237ae0),(_0x1cecf1['type']==='tunnel_error'||_0x4f5999['XaRMC'](_0x1cecf1['type'],_0x52f77f(0xe0)))&&void _0x329021['trackPhaseError'](_0x52f77f(0x8b),new Error(_0x1cecf1['error']??_0x1cecf1[_0x52f77f(0x121)]),_0x237ae0);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x4ad5be=await getToken();if(!_0x4ad5be)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');return _0x4ad5be;}async function apiRequest(_0x4edfbd,_0x598649={}){const _0x270293=_0x3317,_0x3c0916={'YyKOI':function(_0xb00bd9){return _0xb00bd9();},'FEZFs':'application/json','oGXQo':function(_0x586d6c,_0x5e9dfd){return _0x586d6c===_0x5e9dfd;},'uoOky':_0x270293(0xb5),'YJwpk':function(_0x5946ce,_0x288193){return _0x5946ce===_0x288193;}},_0x2d4ae7=await requireToken(),_0x2bfb81=_0x3c0916[_0x270293(0x119)](getApiBaseUrl),_0x558fd6=await fetch(''+_0x2bfb81+_0x4edfbd,{..._0x598649,'headers':{'Authorization':'Bearer\x20'+_0x2d4ae7,'Content-Type':_0x3c0916[_0x270293(0xb8)],..._0x598649['headers']??{}}});if(!_0x558fd6['ok']){let _0x412ae4='',_0x1d60b6;try{const _0x5498ef=await _0x558fd6['json'](),_0x131d47=(_0x3c0916['oGXQo'](typeof _0x5498ef['error'],_0x270293(0xb5))?_0x5498ef['error']:undefined)??JSON['stringify'](_0x5498ef);_0x412ae4=_0x131d47;typeof _0x5498ef['test_output']===_0x3c0916[_0x270293(0x83)]&&_0x5498ef['test_output']&&(_0x412ae4=_0x412ae4+'\x0a'+_0x5498ef[_0x270293(0xf5)]);if(_0x3c0916['YJwpk'](typeof _0x5498ef['code'],_0x3c0916[_0x270293(0x83)]))_0x1d60b6=_0x5498ef['code'];}catch{_0x412ae4=_0x558fd6[_0x270293(0x129)];}throw new ApiError(_0x270293(0xbb)+_0x4edfbd+_0x270293(0x8f)+_0x558fd6[_0x270293(0xf3)]+'):\x20'+_0x412ae4,_0x558fd6[_0x270293(0xf3)],_0x412ae4,_0x1d60b6);}if(_0x3c0916[_0x270293(0x9a)](_0x558fd6['status'],0xcc))return undefined;return _0x558fd6[_0x270293(0x102)]();}export class ApiError extends Error{['status'];[_0x53b5fb(0xe3)];['code'];constructor(_0x5089e6,_0x4cdea5,_0xedd239,_0x37ddf2){const _0xa9791d=_0x53b5fb,_0x514472={'zlbcK':'ApiError'},_0x375b7e='3|4|2|0|1'['split']('|');let _0x3655a5=0x0;while(!![]){switch(_0x375b7e[_0x3655a5++]){case'0':this['code']=_0x37ddf2;continue;case'1':this[_0xa9791d(0x10e)]=_0x514472['zlbcK'];continue;case'2':this[_0xa9791d(0xe3)]=_0xedd239;continue;case'3':super(_0x5089e6);continue;case'4':this[_0xa9791d(0xf3)]=_0x4cdea5;continue;}break;}}}export async function fetchCloudProfile(_0x68e568){const _0x57b4ef={'PJPvT':function(_0x48fa68,_0x173bfe){return _0x48fa68(_0x173bfe);},'UKBZL':function(_0x4910ef,_0xadb94f){return _0x4910ef===_0xadb94f;}};try{return await _0x57b4ef['PJPvT'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x68e568));}catch(_0x19628e){if(_0x19628e instanceof ApiError&&_0x57b4ef['UKBZL'](_0x19628e['status'],0x194))return null;throw _0x19628e;}}export async function listCloudProfiles(){const _0x20112a=_0x53b5fb,_0x1cb453={'mybZA':'/api/v1/profiles'},_0x450a49=await apiRequest(_0x1cb453[_0x20112a(0x122)]);return _0x450a49[_0x20112a(0x97)];}function _0x7a98(){const _0x5edec4=['test_output','username','Nwihm','HLPzW','681464Hghzzx','\x22\x20instead.','DELETE','PUT','\x22;\x20using\x20\x22','raw','\x20Available:\x20','environment_key','EvWkJ','json','pendingLocalConnections','152334irzRcf','NRQCJ','POST','origin','/api/v1/tunnel/sessions/','userAgent','\x20\x20Cloud\x20session\x20for\x20\x22','RANGER_TUNNEL_LOGIN_HEADED','baseUrl','UAqQF','name','cookies','assertedEnv','RANGER_TEST_PASSWORD','URtui','XfPEz','isArray','session_state','defaultEnvironmentKey','connectionId','settings','YyKOI','qlHYL','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','daQnb','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','TYfRH','keys','FChbX','type','mybZA','wsEndpoint','tkfPi','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','reason','wFrYV','save','statusText','ewHtK','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','elapsedMs','sessionId','error','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','mQaON','pw_endpoint','Browser\x20login\x20timed\x20out\x20before\x20completion.','tunnel_bridge_event','\x20\x20No\x20live\x20session\x20for\x20\x22','mVcNH','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','\x22;\x20proceeding\x20with\x20loginInstructions.','launch','\x22\x20matched\x20by\x20host\x20for\x20','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','mPRAr','organizationId','true','effectiveBaseUrl','uoOky','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','storageStatePath','tunnel_session_id','password','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','SRIJy','tunnel_bridge','\x20\x20Cloud\x20profile\x20\x22','\x22.\x0a','ambiguous','\x20failed\x20(','environmentKey','BxZOY','\x20\x20•\x20capture\x20one\x20(a\x20browser\x20opens):\x20ranger\x20profile\x20add\x20','auth_config','RANGER_TEST_USERNAME','kHFTU','length','profiles','trim','mVhUu','YJwpk','TYGWz','Vlhat','EjNaI','\x20\x20Cached\x20session\x20for\x20\x22','pwCQH','\x22,\x20cached\x20locally','invalid-url','BSMtY','trackPhaseEnd','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a','qutiq','trackPhaseStart','crTso','tunnel_login_request','/session','19704bcFKEj','agent','domains','150435dIwvQe','AamUQ','/login','telemetry','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','environments','auth','tunnel','string','persistSessionState','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','FEZFs','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','/api/v1/profiles/auth-config','API\x20request\x20','message','forceLogin','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','key','772ExWQOr','\x20\x20•\x20or\x20pass\x20--env\x20<key>\x20to\x20run\x20an\x20automated\x20login\x20for\x20this\x20target.','77JAEYVF','tunnelUrl','1077065GzVOMT','success','549IGzSFV','join','toISOString','pwEndpoint','6IhMJSL','1383kVtBPL','Cloud\x20profile\x20\x22','722310WkOmkI',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','map','\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)','stringify','close','slhHa','clientIp','setupHeaders','\x20\x20Options:\x0a','qlhpE','you\x27re\x20now\x20at\x20\x22','MWlGU','HgypP','PanYc','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','zNouC','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','local_ws_error','dodoT','qXUPM','detail','\x22,\x20and\x20cloud\x20sessions\x20don\x27t\x20apply\x20to\x20localhost.\x0a','No\x20saved\x20session\x20for\x20\x22','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','loginInstructions','Browser\x20login\x20timed\x20out\x20after\x20','wwRCj','parse','sessionState','prompt','/api/v1/profiles/','log','mhkNx','SOqad','sessionCheckPath','some','status','env'];_0x7a98=function(){return _0x5edec4;};return _0x7a98();}export async function deleteCloudProfile(_0xa804cc){const _0x3c36d7=_0x53b5fb,_0x23e68e={'ujnAe':function(_0x2f9046,_0x4a2074,_0x3b74a3){return _0x2f9046(_0x4a2074,_0x3b74a3);},'HLPzW':function(_0x6265e7,_0x38baf9){return _0x6265e7(_0x38baf9);},'ewHtK':_0x3c36d7(0xfb)};try{await _0x23e68e['ujnAe'](apiRequest,'/api/v1/profiles/'+_0x23e68e[_0x3c36d7(0xf8)](encodeURIComponent,_0xa804cc),{'method':_0x23e68e[_0x3c36d7(0x6e)]});}catch(_0xd9cb3){if(_0xd9cb3 instanceof ApiError&&_0xd9cb3['status']===0x194)throw new Error(_0x3c36d7(0xcc)+_0xa804cc+'\x22\x20not\x20found.');throw _0xd9cb3;}}export async function createCloudProfile(_0x579d67,_0x71fcb4,_0x59486d={}){const _0x25a1c7=_0x53b5fb,_0x19d849={'tkfPi':function(_0x3c9f4d,_0x5f4697){return _0x3c9f4d>_0x5f4697;},'mVhUu':'/api/v1/profiles'},_0x1a15c5={'name':_0x579d67};if(_0x71fcb4)_0x1a15c5[_0x25a1c7(0x100)]=_0x71fcb4;_0x59486d['settings']&&_0x19d849[_0x25a1c7(0x124)](Object[_0x25a1c7(0x11f)](_0x59486d['settings'])[_0x25a1c7(0x96)],0x0)&&(_0x1a15c5[_0x25a1c7(0x118)]=_0x59486d[_0x25a1c7(0x118)]);if(_0x59486d['username'])_0x1a15c5[_0x25a1c7(0xf6)]=_0x59486d[_0x25a1c7(0xf6)];if(_0x59486d[_0x25a1c7(0x87)])_0x1a15c5[_0x25a1c7(0x87)]=_0x59486d['password'];return await apiRequest(_0x19d849[_0x25a1c7(0x99)],{'method':_0x25a1c7(0x106),'body':JSON[_0x25a1c7(0xd1)](_0x1a15c5)});}export async function uploadCloudProfileSession(_0x9587cf,_0x35ea9f){const _0x53fe83=_0x53b5fb,_0x26e9f7={'tZoPw':function(_0x2e2e47,_0x512052,_0x2acfb2){return _0x2e2e47(_0x512052,_0x2acfb2);},'Vlhat':_0x53fe83(0x106)};return await _0x26e9f7['tZoPw'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x9587cf)+_0x53fe83(0xa9),{'method':_0x26e9f7[_0x53fe83(0x9c)],'body':JSON['stringify']({'session_state':_0x35ea9f})});}export async function saveCloudProfileCredentials(_0x3a3bb5,_0x3f9770,_0x1fac66){const _0x444678=_0x53b5fb;await apiRequest(_0x444678(0xed)+encodeURIComponent(_0x3a3bb5),{'method':_0x444678(0xfc),'body':JSON['stringify']({'username':_0x3f9770,'password':_0x1fac66})});}export async function fetchAuthConfig(){const _0x5a6bd9=_0x53b5fb,_0x2bd2b3={'dodoT':function(_0x1d1559,_0xb599bc){return _0x1d1559 instanceof _0xb599bc;}};try{const _0x387598=await apiRequest(_0x5a6bd9(0xba));return _0x387598[_0x5a6bd9(0x93)];}catch(_0x20c666){return _0x2bd2b3[_0x5a6bd9(0xe1)](_0x20c666,ApiError)&&_0x20c666[_0x5a6bd9(0xf3)]!==0x194&&console['error'](_0x5a6bd9(0x73)+_0x20c666['message']),null;}}async function createTunnelSession(_0x40d379){const _0x4cd936=_0x53b5fb;return await apiRequest('/api/v1/tunnel/sessions',{'method':_0x4cd936(0x106),'body':JSON[_0x4cd936(0xd1)]({'targetUrl':_0x40d379,'mode':_0x4cd936(0xab)})});}async function deleteTunnelSession(_0x2d8fa6){const _0x285ef5=_0x53b5fb,_0x5c74c1={'wwWoA':'DELETE'};await apiRequest(_0x285ef5(0x108)+_0x2d8fa6,{'method':_0x5c74c1['wwWoA']});}export function pickAdHocEnvKey(_0x5801c3,_0x37c443,_0x5d8915){const _0x1c4911=_0x53b5fb,_0x2d1578={'qlhpE':function(_0x3ce032,_0xe13f2c){return _0x3ce032+_0xe13f2c;},'BxZOY':'\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','mAxiu':function(_0x51a611,_0x4031c5){return _0x51a611(_0x4031c5);},'tLLId':function(_0x8655a7,_0x1cd950){return _0x8655a7===_0x1cd950;},'gJbUr':function(_0x28fed9,_0x704630){return _0x28fed9+_0x704630;}};if(_0x5d8915){if(!_0x5801c3?.['environments']?.[_0x5d8915]){const _0x396710=Object[_0x1c4911(0x11f)](_0x5801c3?.[_0x1c4911(0xb2)]??{});throw new Error(_0x2d1578[_0x1c4911(0xd7)]('Auth\x20environment\x20\x22'+_0x5d8915+_0x1c4911(0x88),_0x396710[_0x1c4911(0x96)]?_0x1c4911(0xff)+_0x396710['join'](',\x20')+'.':_0x2d1578[_0x1c4911(0x91)])+_0x1c4911(0xd0));}return _0x5d8915;}if(!_0x5801c3)return null;if(_0x37c443){const _0x5a18c9=matchAuthEnvironmentExact(_0x37c443,_0x5801c3);if(_0x5a18c9)return _0x5a18c9;const _0x14cb0a=matchAuthEnvironmentByHost(_0x37c443,_0x5801c3);if(_0x14cb0a&&'key'in _0x14cb0a)return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x14cb0a[_0x1c4911(0xbf)]+_0x1c4911(0x7d)+_0x37c443+_0x1c4911(0xb9)),_0x14cb0a['key'];if(_0x14cb0a&&_0x1c4911(0x8e)in _0x14cb0a)throw new Error('Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20('+_0x14cb0a[_0x1c4911(0x8e)][_0x1c4911(0xc7)](',\x20')+_0x1c4911(0xce));if(_0x2d1578['mAxiu'](needsTunnel,_0x37c443))throw new Error(_0x2d1578['qlhpE']('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x37c443+_0x1c4911(0x8d)+_0x1c4911(0x7a)+_0x1c4911(0xd6)+_0x1c4911(0xa4),'\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x37c443['replace'](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a')+(_0x1c4911(0x7e)+_0x37c443+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x5801c3[_0x1c4911(0x116)])return _0x5801c3[_0x1c4911(0x116)];const _0x74759a=Object['keys'](_0x5801c3[_0x1c4911(0xb2)]??{});if(_0x2d1578['tLLId'](_0x74759a[_0x1c4911(0x96)],0x1))return _0x74759a[0x0];if(_0x74759a['length']===0x0)return null;throw new Error(_0x2d1578['gJbUr']('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x74759a['join'](',\x20')+').\x20','Pass\x20--base-url\x20<your-app-url>\x20so\x20Ranger\x20can\x20match\x20the\x20right\x20one,\x20or\x20create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`.'));}function _0x3317(_0x225507,_0x490a7d){_0x225507=_0x225507-0x6e;const _0x7a986b=_0x7a98();let _0x331721=_0x7a986b[_0x225507];return _0x331721;}export function adHocProfileName(_0x47013d,_0x217e09,_0x186cca){const _0xaf1d11={'VxDXB':function(_0x42bd97,_0x11c8dd){return _0x42bd97===_0x11c8dd;}};if(!_0x217e09||_0xaf1d11['VxDXB'](_0x217e09,_0x186cca))return _0x47013d;return _0x47013d+':'+_0x217e09;}export async function resolveAdHocProfile(_0x5784bf={},_0xc2cfd2=process[_0x53b5fb(0xf4)]){const _0x5f241f=_0x53b5fb,_0x488370={'UAqQF':function(_0x564952,_0x5f4278,_0x4ca010,_0x349170){return _0x564952(_0x5f4278,_0x4ca010,_0x349170);},'NRQCJ':function(_0x95ddd4,_0x29cce3){return _0x95ddd4(_0x29cce3);},'SRIJy':function(_0xac28ed,_0xd2dc0d){return _0xac28ed&&_0xd2dc0d;}},_0x9eb644=_0xc2cfd2['RANGER_TEST_USERNAME'];if(!_0x9eb644)return null;const _0x49b8ce=await fetchAuthConfig(),_0x29c3dc=_0x488370[_0x5f241f(0x10d)](pickAdHocEnvKey,_0x49b8ce,_0x5784bf['targetUrl'],_0x5784bf['envKey']);let _0x3c45b1=adHocProfileName(_0x9eb644,_0x29c3dc,_0x49b8ce?.[_0x5f241f(0x116)]),_0x21e11f=await _0x488370[_0x5f241f(0x105)](fetchCloudProfile,_0x3c45b1);_0x488370[_0x5f241f(0x8a)](_0x21e11f,_0x29c3dc)&&_0x21e11f[_0x5f241f(0x90)]!==_0x29c3dc&&(console['log'](_0x5f241f(0x8c)+_0x3c45b1+_0x5f241f(0x84)+(_0x21e11f[_0x5f241f(0x90)]??'none')+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x29c3dc+_0x5f241f(0xfd)+_0x9eb644+':'+_0x29c3dc+_0x5f241f(0xfa)),_0x3c45b1=_0x9eb644+':'+_0x29c3dc,_0x21e11f=await _0x488370[_0x5f241f(0x105)](fetchCloudProfile,_0x3c45b1));if(_0x21e11f)return{'name':_0x21e11f[_0x5f241f(0x10e)],'profile':_0x21e11f};const _0x32825a=_0xc2cfd2['RANGER_TEST_PASSWORD'],_0x109f6d=await createCloudProfile(_0x3c45b1,_0x29c3dc??undefined,{'username':_0x9eb644,'password':_0x32825a});return console['log']('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x109f6d['name']+'\x22\x20for\x20'+_0x9eb644+(_0x29c3dc?'\x20(auth\x20env:\x20'+_0x29c3dc+')':'')),{'name':_0x109f6d['name'],'profile':_0x109f6d};}export async function writeSessionToLocalCache(_0x9e1217,_0x420c12,_0x2f8048,_0x30e13f,_0x162440,_0x3bff75,_0x4d6aae){const _0xd2ae5f=_0x53b5fb,_0x3cfc6e={'Eqpqg':function(_0x45c634,_0x1b999e){return _0x45c634(_0x1b999e);},'ZYkdC':function(_0xa4a2ad,_0x55544d,_0x554d1f){return _0xa4a2ad(_0x55544d,_0x554d1f);},'qlHYL':function(_0x22c27b,_0xc085ac,_0x2eb388){return _0x22c27b(_0xc085ac,_0x2eb388);},'JBxPP':function(_0x4016f3){return _0x4016f3();},'NIOJC':_0xd2ae5f(0xb3),'mPRAr':function(_0x59382f,_0x248565,_0x96d880){return _0x59382f(_0x248565,_0x96d880);},'BSMtY':function(_0x3af2b9,_0x1a4d8b,_0x2b9ed3){return _0x3af2b9(_0x1a4d8b,_0x2b9ed3);}},_0x49d68e=_0x3cfc6e['Eqpqg'](sessionCacheHash,{'orgId':_0x420c12,'profileName':_0x9e1217,'effectiveBaseUrl':_0x2f8048,'setupHeaders':_0x30e13f,'invalidateOn':_0x4d6aae?.['invalidateOn'],'userAgent':_0x4d6aae?.[_0xd2ae5f(0x109)],'clientIp':_0x4d6aae?.[_0xd2ae5f(0xd4)]}),_0x2fabff=_0x3cfc6e['ZYkdC'](getSessionCachePath,_0x49d68e,_0x9e1217),_0x93262c=_0x3cfc6e[_0xd2ae5f(0x11a)](join,_0x3cfc6e['JBxPP'](getRangerHomeDir),_0x3cfc6e['NIOJC']);!existsSync(_0x93262c)&&await mkdir(_0x93262c,{'recursive':!![]});const _0x4a08b6={..._0x162440};_0x3bff75&&_0x3bff75['length']>0x0&&Array[_0xd2ae5f(0x114)](_0x4a08b6[_0xd2ae5f(0x10f)])&&(_0x4a08b6['cookies']=_0x3cfc6e[_0xd2ae5f(0x7f)](duplicateCookiesForDomains,_0x4a08b6[_0xd2ae5f(0x10f)],_0x3bff75));const _0xe83a9a={'cached_at':new Date()[_0xd2ae5f(0xc8)](),'session_state':_0x4a08b6};await _0x3cfc6e[_0xd2ae5f(0xa2)](writeFile,_0x2fabff,JSON[_0xd2ae5f(0xd1)](_0xe83a9a,null,0x2));const _0x1bb75f=getStorageStatePath(_0x2fabff);return await writeFile(_0x1bb75f,JSON[_0xd2ae5f(0xd1)](_0x4a08b6,null,0x2)),_0x1bb75f;}export async function checkLocalCache(_0x4769db,_0x47e45c,_0x1a8da5,_0x2c7b46,_0x6a87bf){const _0x2558eb=_0x53b5fb,_0x546600={'Nwihm':function(_0xeb8fbd,_0x52c6b9){return _0xeb8fbd(_0x52c6b9);},'yMIHr':function(_0x30cff0,_0x42a4a3){return _0x30cff0(_0x42a4a3);}},_0x4d3745=_0x546600[_0x2558eb(0xf7)](sessionCacheHash,{'orgId':_0x47e45c,'profileName':_0x4769db,'effectiveBaseUrl':_0x1a8da5,'setupHeaders':_0x2c7b46,'invalidateOn':_0x6a87bf?.['invalidateOn'],'userAgent':_0x6a87bf?.[_0x2558eb(0x109)],'clientIp':_0x6a87bf?.[_0x2558eb(0xd4)]}),_0x38fed0=getSessionCachePath(_0x4d3745,_0x4769db),_0x2f19eb=getStorageStatePath(_0x38fed0);if(!existsSync(_0x38fed0)||!_0x546600['yMIHr'](existsSync,_0x2f19eb))return null;try{const _0x26a901=await readFile(_0x38fed0,'utf-8');return JSON[_0x2558eb(0xea)](_0x26a901),{'storageStatePath':_0x2f19eb};}catch{return null;}}function launchRealBrowser(){const _0x33f8b5=_0x53b5fb;return chromium[_0x33f8b5(0x7c)]({'headless':!![]});}function emitSessionValidationHint(_0x52c158,_0x51eaf5){const _0x52d823=_0x53b5fb;if(!_0x51eaf5||!_0x51eaf5['domains']?.[_0x52d823(0x96)])return;let _0x33ac8b;try{_0x33ac8b=new URL(_0x52c158);}catch{return;}const _0xa0e7e9=[];for(const _0x3112e2 of _0x51eaf5['domains']){try{_0xa0e7e9['push']({'raw':_0x3112e2,'url':new URL(_0x3112e2)});}catch{}}if(_0xa0e7e9['length']===0x0)return;if(_0xa0e7e9[_0x52d823(0xf2)](_0x23b8a7=>_0x23b8a7['url'][_0x52d823(0x107)]===_0x33ac8b['origin']))return;const _0x539ff=_0xa0e7e9[_0x52d823(0xcf)](_0x267978=>'\x22'+_0x267978[_0x52d823(0xfe)]+'\x22')['join'](',\x20');console['log'](_0x52d823(0xdd)+_0x539ff+';\x20'+(_0x52d823(0xd8)+_0x52c158+_0x52d823(0x11d))+_0x52d823(0xb7));}export async function serverSideLogin(_0x383c14,_0x4dd0e1){const _0x4c6011=_0x53b5fb,_0x2c3bb6={'daQnb':function(_0x73a49e,_0x461232,_0x352b08){return _0x73a49e(_0x461232,_0x352b08);},'zvEVS':_0x4c6011(0x106),'ilnSs':function(_0x2b49ca,_0xfa53e7){return _0x2b49ca instanceof _0xfa53e7;},'kHFTU':function(_0x478a8f,_0x5a11c6){return _0x478a8f===_0x5a11c6;},'xkfYA':'not_configured'},_0x5eb8ec=process[_0x4c6011(0xf4)][_0x4c6011(0x94)],_0x2ed571=process[_0x4c6011(0xf4)]['RANGER_TEST_PASSWORD'],_0x2e1344={};if(_0x5eb8ec)_0x2e1344['username']=_0x5eb8ec;if(_0x2ed571)_0x2e1344[_0x4c6011(0x87)]=_0x2ed571;if(_0x4dd0e1?.['force'])_0x2e1344['force']=!![];if(_0x4dd0e1?.['targetUrl'])_0x2e1344['target_url']=_0x4dd0e1['targetUrl'];if(_0x4dd0e1?.['env'])_0x2e1344[_0x4c6011(0xf4)]=_0x4dd0e1[_0x4c6011(0xf4)];_0x4dd0e1?.['tunnel']&&(_0x2e1344[_0x4c6011(0x86)]=_0x4dd0e1[_0x4c6011(0xb4)][_0x4c6011(0x71)],_0x2e1344[_0x4c6011(0x75)]=_0x4dd0e1['tunnel'][_0x4c6011(0xc9)]);try{return await _0x2c3bb6[_0x4c6011(0x11c)](apiRequest,_0x4c6011(0xed)+encodeURIComponent(_0x383c14)+_0x4c6011(0xaf),{'method':_0x2c3bb6['zvEVS'],'body':JSON['stringify'](_0x2e1344)});}catch(_0x26f887){if(_0x2c3bb6['ilnSs'](_0x26f887,ApiError)&&_0x26f887[_0x4c6011(0xf3)]===0x190&&_0x2c3bb6[_0x4c6011(0x95)](_0x26f887['code'],_0x2c3bb6['xkfYA']))return{'status':'not_configured','error':_0x26f887['detail']};throw _0x26f887;}}async function serverSideLoginWithOptionalTunnel(_0x1e8f70,_0x586f80,_0x4425fa={}){const _0x289f23=_0x53b5fb,_0x5b7caa={'wwRCj':function(_0x560935,_0x3440ae){return _0x560935(_0x3440ae);},'HgypP':function(_0x1fc5b2,_0x3e9d4f){return _0x1fc5b2(_0x3e9d4f);},'PanYc':function(_0x21c5d4,_0x15dcbe){return _0x21c5d4===_0x15dcbe;},'qutiq':_0x289f23(0x81),'EjNaI':_0x289f23(0x125),'RVlYj':function(_0x2eb90b){return _0x2eb90b();},'BMDrz':function(_0x215854,_0x43b4b9,_0x2dd839){return _0x215854(_0x43b4b9,_0x2dd839);},'HTjpC':function(_0x5f3b56,_0x11a0ad){return _0x5f3b56??_0x11a0ad;},'URtui':'tunnel_login_setup','lMcNx':function(_0x4eeb07,_0x49ad03){return _0x4eeb07||_0x49ad03;},'MWlGU':'tunnel_login_cleanup'};if(!_0x5b7caa['HgypP'](needsTunnel,_0x586f80))return await serverSideLogin(_0x1e8f70,{'force':_0x4425fa['force'],'env':_0x4425fa[_0x289f23(0xf4)]});let _0x1b47bf=null,_0x1c0e7b=null,_0x55126c=null,_0x2509a1=null,_0x25373e=![];const _0x4863a4=process['env'][_0x289f23(0x10b)]?.['toLowerCase'](),_0x54c762=_0x4863a4==='1'||_0x5b7caa[_0x289f23(0xdb)](_0x4863a4,_0x5b7caa[_0x289f23(0xa5)]),_0x2462ed={'profileName':_0x1e8f70,'targetUrlHost':targetHostForTelemetry(_0x586f80),'tunnelRequired':!![],'forceLogin':_0x5b7caa[_0x289f23(0xe9)](Boolean,_0x4425fa['force']),'localBrowserServerHeaded':_0x54c762};try{_0x4425fa['telemetry']?.['trackPhaseStart']('tunnel_login_setup',_0x2462ed);_0x54c762&&console['log'](_0x5b7caa[_0x289f23(0x9d)]);_0x1b47bf=await launchBrowserServer({'headless':!_0x54c762}),_0x1c0e7b=await _0x5b7caa[_0x289f23(0xe9)](createTunnelSession,_0x586f80);const _0x57bf58=await _0x5b7caa['RVlYj'](requireToken);_0x55126c=await createTunnelBridge({'localWsUrl':_0x1b47bf[_0x289f23(0x123)],'tunnelServerUrl':_0x1c0e7b[_0x289f23(0xc3)],'sessionId':_0x1c0e7b['sessionId'],'apiKey':_0x57bf58,'onError':_0x499dbd=>{_0x2509a1=_0x499dbd;},'onClose':()=>{const _0x42daef=_0x289f23;_0x2509a1??=new Error(_0x42daef(0xdf)+_0x1e8f70);},'onEvent':_0x9683e0=>trackBridgeEvent(_0x4425fa[_0x289f23(0xb0)],_0x9683e0)}),_0x4425fa['telemetry']?.[_0x289f23(0xa3)]('tunnel_login_setup',{..._0x2462ed,'tunnelSessionId':_0x1c0e7b[_0x289f23(0x71)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x54c762}),_0x25373e=!![];try{return _0x4425fa[_0x289f23(0xb0)]?.[_0x289f23(0xa6)](_0x289f23(0xa8),{..._0x2462ed,'tunnelSessionId':_0x1c0e7b['sessionId']}),await _0x5b7caa['BMDrz'](serverSideLogin,_0x1e8f70,{'force':_0x4425fa['force'],'targetUrl':_0x586f80,'env':_0x4425fa['env'],'tunnel':{'sessionId':_0x1c0e7b['sessionId'],'pwEndpoint':_0x1c0e7b[_0x289f23(0xc9)]}})['then'](_0x3a0b89=>{const _0x17268a=_0x289f23;return _0x4425fa[_0x17268a(0xb0)]?.[_0x17268a(0xa3)]('tunnel_login_request',{..._0x2462ed,'tunnelSessionId':_0x1c0e7b?.[_0x17268a(0x71)],'loginStatus':_0x3a0b89[_0x17268a(0xf3)],'hasSessionState':_0x5b7caa['wwRCj'](Boolean,_0x3a0b89[_0x17268a(0x115)]),'hasTestOutput':Boolean(_0x3a0b89['test_output']),'bridgeError':errorMessageForTelemetry(_0x2509a1)}),_0x3a0b89;});}catch(_0x12c092){await _0x4425fa['telemetry']?.['trackPhaseError']('tunnel_login_request',_0x5b7caa['HTjpC'](_0x2509a1,_0x12c092),{..._0x2462ed,'tunnelSessionId':_0x1c0e7b['sessionId'],'bridgeError':errorMessageForTelemetry(_0x2509a1)});throw _0x2509a1??_0x12c092;}}catch(_0x3e1f1c){!_0x25373e&&await _0x4425fa[_0x289f23(0xb0)]?.['trackPhaseError'](_0x5b7caa[_0x289f23(0x112)],_0x3e1f1c,{..._0x2462ed,'tunnelSessionId':_0x1c0e7b?.['sessionId']});throw _0x3e1f1c;}finally{(_0x5b7caa['lMcNx'](_0x1c0e7b,_0x1b47bf)||_0x55126c)&&(_0x4425fa['telemetry']?.[_0x289f23(0xa6)](_0x5b7caa[_0x289f23(0xd9)],{..._0x2462ed,'tunnelSessionId':_0x1c0e7b?.[_0x289f23(0x71)]}),_0x55126c?.[_0x289f23(0xd2)](),_0x1b47bf&&await _0x1b47bf[_0x289f23(0xd2)]()['catch'](()=>{}),_0x1c0e7b&&await _0x5b7caa[_0x289f23(0xda)](deleteTunnelSession,_0x1c0e7b['sessionId'])['catch'](()=>{}),_0x4425fa['telemetry']?.['trackPhaseEnd'](_0x5b7caa['MWlGU'],{..._0x2462ed,'tunnelSessionId':_0x1c0e7b?.[_0x289f23(0x71)]}));}}export async function manualBrowserLogin(_0x208bf7,_0x341a0e,_0x491144={}){const _0x566cf0=_0x53b5fb,_0x34eba2={'EvWkJ':function(_0x596382){return _0x596382();},'XzaiK':_0x566cf0(0xd2),'AWWzt':function(_0x127d05){return _0x127d05();},'oVGOU':function(_0x4a327f,_0x12221d){return _0x4a327f+_0x12221d;},'FChbX':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','AamUQ':function(_0x31cdc5,_0x3b71ec){return _0x31cdc5>_0x3b71ec;},'dchiR':'Browser\x20closed\x20before\x20authentication\x20was\x20saved.','XfPEz':function(_0x5d2dd1,_0x5b7744){return _0x5d2dd1!==_0x5b7744;},'PzjGt':function(_0x54bbe3,_0xc0f3a8){return _0x54bbe3(_0xc0f3a8);},'sljAu':'cli:manual-login'};if(!_0x34eba2['AWWzt'](isInteractive))throw new Error(_0x34eba2['oVGOU']('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x208bf7[_0x566cf0(0x10e)]+_0x566cf0(0x8d),'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20')+_0x34eba2[_0x566cf0(0x120)]);const _0x49a4da=_0x341a0e&&_0x34eba2[_0x566cf0(0xae)](_0x341a0e[_0x566cf0(0xac)][_0x566cf0(0x96)],0x0)?_0x341a0e['domains'][0x0]:'about:blank';console[_0x566cf0(0xee)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console['log'](_0x566cf0(0xdc)),await new Promise(_0x2ed742=>setTimeout(_0x2ed742,0x7d0));const _0x239e97=await chromium[_0x566cf0(0x7c)]({'headless':![]});let _0xc3f248=null;try{const _0x107d37={'ignoreHTTPSErrors':!![]};_0x341a0e?.[_0x566cf0(0xd5)]&&(_0x107d37['extraHTTPHeaders']=_0x341a0e[_0x566cf0(0xd5)]);const _0x27c482=await _0x239e97['newContext'](_0x107d37);await addProfileSetupBanner(_0x27c482);const _0x234e86=await _0x27c482['newPage']();await _0x234e86['goto'](_0x49a4da);let _0x3df6ed=![];await new Promise(_0x1bf653=>{const _0x1b9e25={'SOqad':function(_0x35acb4,_0x467c82){return _0x35acb4(_0x467c82);}},_0xd8bd16=setTimeout(()=>{const _0x5859a0=_0x3317;_0x3df6ed=!![],console[_0x5859a0(0x72)](_0x5859a0(0xe8)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x34eba2[_0x5859a0(0x101)](_0x1bf653);},MANUAL_LOGIN_TIMEOUT_MS);_0x234e86['on'](_0x34eba2['XzaiK'],async()=>{const _0x336960=_0x3317;_0x1b9e25[_0x336960(0xf0)](clearTimeout,_0xd8bd16);try{const _0x4587a2=await _0x27c482['storageState']();_0xc3f248=_0x4587a2;}catch{}_0x1bf653();});});if(_0x3df6ed&&!_0xc3f248)throw new Error(_0x566cf0(0x76));}finally{await _0x239e97[_0x566cf0(0xd2)]()['catch'](()=>{});}if(!_0xc3f248)throw new Error(_0x34eba2['dchiR']);return _0x34eba2[_0x566cf0(0x113)](_0x491144[_0x566cf0(0xb6)],![])&&await apiRequest('/api/v1/profiles/'+_0x34eba2['PzjGt'](encodeURIComponent,_0x208bf7['name'])+_0x566cf0(0xa9),{'method':'POST','body':JSON['stringify']({'session_state':_0xc3f248,'updated_by':_0x34eba2['sljAu']})}),{'sessionState':_0xc3f248};}export async function promptSaveCredentials(_0x245558){const _0x31b545=_0x53b5fb,_0x525006={'UVmAu':function(_0x5cafd5,_0x1d0fd0){return _0x5cafd5||_0x1d0fd0;},'TaCWO':'confirm','Iiekp':_0x31b545(0x128),'Dephq':_0x31b545(0x11b)},_0x569aab=process[_0x31b545(0xf4)][_0x31b545(0x94)],_0x54f0d1=process['env'][_0x31b545(0x111)];if(_0x525006['UVmAu'](!_0x569aab,!_0x54f0d1))return;if(!isInteractive())return;const {save:_0x1bad6d}=await _0x426f01[_0x31b545(0xec)]([{'type':_0x525006['TaCWO'],'name':_0x525006['Iiekp'],'message':_0x31b545(0x6f),'default':![]}]);if(!_0x1bad6d)return;await apiRequest(_0x31b545(0xed)+encodeURIComponent(_0x245558),{'method':'PUT','body':JSON['stringify']({'username':_0x569aab,'password':_0x54f0d1})}),console['log'](_0x525006['Dephq']);}export async function resolveCloudProfileSession(_0x281f26,_0xd37cee={}){const _0x2e4844=_0x53b5fb,_0x4f22f5={'TYfRH':function(_0x557ba4){return _0x557ba4();},'dbnEE':function(_0x39d5e5,_0x20ce9,_0x30b94f){return _0x39d5e5(_0x20ce9,_0x30b94f);},'crTso':_0x2e4844(0xb5),'zNouC':function(_0x29ceb1,_0x169809){return _0x29ceb1===_0x169809;},'qXUPM':function(_0x473e1d,_0x50c1c3){return _0x473e1d||_0x50c1c3;},'mhkNx':function(_0x259cea,_0x596b64){return _0x259cea(_0x596b64);},'mVcNH':function(_0x497bf0,_0x5b7554){return _0x497bf0>_0x5b7554;},'yTwMQ':function(_0x3822b1,_0x5b956c,_0x222796,_0x5097fe,_0x360193,_0x4af339){return _0x3822b1(_0x5b956c,_0x222796,_0x5097fe,_0x360193,_0x4af339);},'uIwAU':function(_0x4b9851,_0x381212){return _0x4b9851(_0x381212);},'pwCQH':function(_0x20ba08,_0x56c9d9){return _0x20ba08||_0x56c9d9;},'mQaON':'not_configured','PVLBi':_0x2e4844(0xc5),'TYGWz':'\x20\x20Login\x20successful.\x20Session\x20cached.','EUkci':function(_0x2e72e5,_0x1a9f4a,_0x4e33d8,_0x2261ec,_0x5e90c3,_0x41e005,_0x1bdd1f,_0x2c2e52){return _0x2e72e5(_0x1a9f4a,_0x4e33d8,_0x2261ec,_0x5e90c3,_0x41e005,_0x1bdd1f,_0x2c2e52);},'ecTvH':function(_0x200b47,_0x18683d){return _0x200b47 instanceof _0x18683d;},'IdSrq':function(_0x23f713,_0x17a197){return _0x23f713(_0x17a197);},'FijBx':_0x2e4844(0xe6),'aUbax':_0x2e4844(0xc1),'ARHJu':function(_0x57a584,_0x2d71b6,_0x43fbb1,_0x4693fe){return _0x57a584(_0x2d71b6,_0x43fbb1,_0x4693fe);},'slhHa':function(_0x45a275,_0x33cd85,_0x420b7b,_0x181ec1,_0xcc0993,_0x4980f6,_0x4553fb,_0x18f4f7){return _0x45a275(_0x33cd85,_0x420b7b,_0x181ec1,_0xcc0993,_0x4980f6,_0x4553fb,_0x18f4f7);}},_0x2ba892=_0x281f26['settings']??{},_0x262c0e=await _0x4f22f5[_0x2e4844(0x11e)](fetchAuthConfig),_0xea7a2e=_0x262c0e?_0x4f22f5['dbnEE'](resolveAuthEnvironmentLocally,_0x262c0e,_0xd37cee[_0x2e4844(0x110)]??_0x281f26[_0x2e4844(0x90)]):null,_0x138503=typeof _0xea7a2e?.['loginInstructions']===_0x4f22f5[_0x2e4844(0xa7)]&&_0xea7a2e['loginInstructions']['trim']()?_0xea7a2e['loginInstructions']:undefined,_0xa19eaf=_0x4f22f5[_0x2e4844(0xde)](typeof _0x2ba892['loginInstructions'],_0x4f22f5[_0x2e4844(0xa7)])&&_0x2ba892[_0x2e4844(0xe7)][_0x2e4844(0x98)]()?_0x2ba892[_0x2e4844(0xe7)]:undefined,_0x5b87c1=_0x4f22f5[_0x2e4844(0xe2)](_0xa19eaf,!_0x138503)?_0x2ba892:{..._0x2ba892,'loginInstructions':_0x138503},_0x4d5653=_0x4f22f5['mhkNx'](Boolean,_0x5b87c1['loginInstructions']?.['trim']()),_0x110d8f=_0x4f22f5[_0x2e4844(0xef)](Boolean,_0x2ba892[_0x2e4844(0xbd)]||_0xea7a2e?.[_0x2e4844(0xbd)]),_0x4988e7=_0xea7a2e?.[_0x2e4844(0xac)],_0x1f6f08=_0x2ba892['setupHeaders'],_0x4dadd4=_0x1f6f08??_0xea7a2e?.[_0x2e4844(0xd5)],_0x104044=_0xd37cee[_0x2e4844(0x82)]??_0x2ba892[_0x2e4844(0x10c)]??(_0x4988e7&&_0x4f22f5[_0x2e4844(0x79)](_0x4988e7[_0x2e4844(0x96)],0x0)?_0x4988e7[0x0]:''),_0x3be095=_0x104044?needsTunnel(_0x104044):![],_0x46f069={'invalidateOn':_0xea7a2e?.['invalidateOn'],'userAgent':_0xea7a2e?.['browserOptions']?.['userAgent']??_0x2ba892['userAgent']};_0x110d8f&&console['log']('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x281f26[_0x2e4844(0x10e)]+'\x22,\x20refreshing\x20session...');if(!_0x110d8f){const _0x58d312=await _0x4f22f5['yTwMQ'](checkLocalCache,_0x281f26[_0x2e4844(0x10e)],_0x281f26['organizationId'],_0x104044,_0x4dadd4,_0x46f069);if(_0x58d312){if(_0x104044&&!_0x3be095){const _0x3b53e4=await isCachedSessionLive(_0x58d312['storageStatePath'],_0x104044,{'sessionCheckPath':_0xea7a2e?.[_0x2e4844(0xf1)],'setupHeaders':_0x4dadd4},{'launchBrowser':launchRealBrowser});if(_0x3b53e4)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x281f26[_0x2e4844(0x10e)]+'\x22'),{'authPath':_0x58d312[_0x2e4844(0x85)],'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};console[_0x2e4844(0xee)](_0x2e4844(0x9e)+_0x281f26[_0x2e4844(0x10e)]+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x4f22f5['dbnEE'](emitSessionValidationHint,_0x104044,_0xea7a2e);}else return _0x3be095&&console[_0x2e4844(0xee)](_0x2e4844(0xbe)+_0x281f26['name']+'\x22'),{'authPath':_0x58d312['storageStatePath'],'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};}}if(!_0x110d8f&&_0x281f26[_0x2e4844(0xeb)]){const _0xb5796e=await writeSessionToLocalCache(_0x281f26[_0x2e4844(0x10e)],_0x281f26['organizationId'],_0x104044,_0x4dadd4,_0x281f26[_0x2e4844(0xeb)],_0x4988e7,_0x46f069);if(_0x104044){const _0x51aff1=await isCachedSessionLive(_0xb5796e,_0x104044,{'sessionCheckPath':_0xea7a2e?.['sessionCheckPath'],'setupHeaders':_0x4dadd4},{'launchBrowser':launchRealBrowser});if(_0x51aff1)return console[_0x2e4844(0xee)]('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x281f26[_0x2e4844(0x10e)]+_0x2e4844(0xa0)),{'authPath':_0xb5796e,'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};console['log'](_0x2e4844(0x10a)+_0x281f26['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),emitSessionValidationHint(_0x104044,_0xea7a2e);}else return{'authPath':_0xb5796e,'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};}if(_0x4d5653)return console['log'](_0x2e4844(0x78)+_0x281f26['name']+_0x2e4844(0x7b)),{'authPath':undefined,'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};console[_0x2e4844(0xee)](_0x2e4844(0x78)+_0x281f26[_0x2e4844(0x10e)]+'\x22,\x20attempting\x20login...');const _0x10cc90=Boolean(process[_0x2e4844(0xf4)]['RANGER_TEST_USERNAME'])&&_0x4f22f5['uIwAU'](Boolean,process[_0x2e4844(0xf4)][_0x2e4844(0x111)]),_0x180f3c=_0x4f22f5['mhkNx'](Boolean,_0x281f26['username']),_0x569ad0=Boolean(_0xd37cee['assertedEnv']),_0x172ddf=_0x104044?_0x4f22f5[_0x2e4844(0xef)](isBareLocalhost,_0x104044):![],_0x3e71b5=_0x4f22f5['qXUPM'](_0x10cc90,_0x180f3c)&&_0x4f22f5[_0x2e4844(0x9f)](!_0x172ddf,_0x569ad0);if(_0x3e71b5)try{const _0x3c06fd=_0x104044?await serverSideLoginWithOptionalTunnel(_0x281f26['name'],_0x104044,{'force':_0x110d8f,'telemetry':_0xd37cee[_0x2e4844(0xb0)],'env':_0xd37cee['assertedEnv']}):await serverSideLogin(_0x281f26['name'],{'force':_0x110d8f,'env':_0xd37cee['assertedEnv']});if(_0x3c06fd[_0x2e4844(0xf3)]===_0x4f22f5[_0x2e4844(0x74)])console['log'](_0x2e4844(0xb1));else{if(_0x3c06fd[_0x2e4844(0xf3)]===_0x4f22f5['PVLBi']&&_0x3c06fd[_0x2e4844(0x115)]){console[_0x2e4844(0xee)](_0x4f22f5[_0x2e4844(0x9b)]);const _0x5df487=await _0x4f22f5['EUkci'](writeSessionToLocalCache,_0x281f26[_0x2e4844(0x10e)],_0x281f26['organizationId'],_0x104044,_0x4dadd4,_0x3c06fd['session_state'],_0x4988e7,_0x46f069);return _0x10cc90&&!_0x180f3c&&await promptSaveCredentials(_0x281f26['name']),{'authPath':_0x5df487,'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};}else _0x3c06fd[_0x2e4844(0xf5)]&&(console['log'](_0x2e4844(0x89)),console[_0x2e4844(0xee)](_0x3c06fd[_0x2e4844(0xf5)])),console['log']('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}}catch(_0x4497db){console['log']('\x20\x20Server-side\x20login\x20error:\x20'+(_0x4f22f5['ecTvH'](_0x4497db,Error)?_0x4497db[_0x2e4844(0xbc)]:_0x4f22f5['IdSrq'](String,_0x4497db))),console[_0x2e4844(0xee)](_0x4f22f5['FijBx']);}if(_0x172ddf&&!_0x569ad0&&!isInteractive())throw new Error(_0x2e4844(0xe5)+_0x104044+'\x22\x20on\x20profile\x20\x22'+_0x281f26['name']+_0x2e4844(0xe4)+(_0x2e4844(0x92)+_0x281f26[_0x2e4844(0x10e)]+'\x20--url\x20'+_0x104044+'\x0a')+_0x4f22f5['aUbax']);const _0x5ec4c9=_0xea7a2e?{..._0xea7a2e,'domains':_0x4f22f5['dbnEE'](orderLoginDomains,_0x104044,_0xea7a2e[_0x2e4844(0xac)]),'setupHeaders':_0x4dadd4}:_0x104044?{'key':_0x281f26[_0x2e4844(0x90)]??'','domains':[_0x104044],'setupHeaders':_0x4dadd4}:null,{sessionState:_0x39f4b4}=await _0x4f22f5['ARHJu'](manualBrowserLogin,_0x281f26,_0x5ec4c9,{'persistSessionState':!_0x3be095}),_0x24f01b=await _0x4f22f5[_0x2e4844(0xd3)](writeSessionToLocalCache,_0x281f26[_0x2e4844(0x10e)],_0x281f26[_0x2e4844(0x80)],_0x104044,_0x4dadd4,_0x39f4b4,_0x4988e7,_0x46f069);return{'authPath':_0x24f01b,'settings':_0x5b87c1,'resolvedEnv':_0xea7a2e};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x33dbb0=_0x4121;function _0x4121(_0x178702,_0x46c567){_0x178702=_0x178702-0x17b;const _0x4cc7dc=_0x4cc7();let _0x412168=_0x4cc7dc[_0x178702];return _0x412168;}(function(_0x1ee242,_0x4dcd95){const _0x594fc6=_0x4121,_0xdf8fa5=_0x1ee242();while(!![]){try{const _0x3b89c7=-parseInt(_0x594fc6(0x194))/0x1+-parseInt(_0x594fc6(0x1aa))/0x2*(-parseInt(_0x594fc6(0x199))/0x3)+-parseInt(_0x594fc6(0x18c))/0x4+-parseInt(_0x594fc6(0x1a5))/0x5+parseInt(_0x594fc6(0x196))/0x6*(parseInt(_0x594fc6(0x195))/0x7)+parseInt(_0x594fc6(0x1af))/0x8*(-parseInt(_0x594fc6(0x17d))/0x9)+-parseInt(_0x594fc6(0x17c))/0xa*(-parseInt(_0x594fc6(0x198))/0xb);if(_0x3b89c7===_0x4dcd95)break;else _0xdf8fa5['push'](_0xdf8fa5['shift']());}catch(_0x18c086){_0xdf8fa5['push'](_0xdf8fa5['shift']());}}}(_0x4cc7,0x3809c));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x307bc5=process[_0x33dbb0(0x17b)],_0x5b1dc1={'stdin':process[_0x33dbb0(0x186)],'stdout':process[_0x33dbb0(0x19f)]}){const _0x155bdb=_0x33dbb0,_0x10daf6={'cfhty':function(_0x5b6353,_0x30ecf3){return _0x5b6353(_0x30ecf3);}};if(_0x307bc5['CI'])return![];return _0x10daf6[_0x155bdb(0x1a4)](Boolean,_0x5b1dc1['stdin']['isTTY'])&&_0x10daf6['cfhty'](Boolean,_0x5b1dc1[_0x155bdb(0x19f)]['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x314ec5){const _0x5cdeee=_0x33dbb0,_0x495e56={'ZGpYc':function(_0x14bd80,_0x1d491a){return _0x14bd80(_0x1d491a);},'AzaTl':'baseUrl','imyIs':'setupHeaders','ijhHm':'port','lrpev':_0x5cdeee(0x1a3),'qsSzN':function(_0x237d30,_0x5ece7d){return _0x237d30!==_0x5ece7d;},'nykKD':'clientIp','aRsEY':_0x5cdeee(0x1a2)},_0x15d334=new Set(_0x314ec5[_0x5cdeee(0x182)]??DEFAULT_INVALIDATE_ON);_0x314ec5['effectiveBaseUrl']&&_0x495e56[_0x5cdeee(0x1ae)](needsTunnel,_0x314ec5['effectiveBaseUrl'])&&_0x15d334[_0x5cdeee(0x190)](_0x495e56[_0x5cdeee(0x19b)]);const _0x480b2f={'orgId':_0x314ec5[_0x5cdeee(0x18e)],'profileName':_0x314ec5[_0x5cdeee(0x192)]};return _0x15d334[_0x5cdeee(0x1b0)]('baseUrl')&&(_0x480b2f['effectiveBaseUrl']=_0x314ec5[_0x5cdeee(0x1ac)]),_0x15d334[_0x5cdeee(0x1b0)](_0x495e56['imyIs'])&&(_0x480b2f[_0x5cdeee(0x188)]=_0x314ec5['setupHeaders']?sortObjectKeys(_0x314ec5['setupHeaders']):_0x314ec5['setupHeaders']),_0x15d334[_0x5cdeee(0x1b0)](_0x495e56[_0x5cdeee(0x184)])&&(_0x480b2f['port']=extractPort(_0x314ec5['effectiveBaseUrl'])),_0x15d334[_0x5cdeee(0x1b0)](_0x495e56[_0x5cdeee(0x1a6)])&&_0x495e56['qsSzN'](_0x314ec5['userAgent'],undefined)&&(_0x480b2f[_0x5cdeee(0x1a3)]=_0x314ec5['userAgent']),_0x15d334[_0x5cdeee(0x1b0)](_0x495e56['nykKD'])&&_0x314ec5[_0x5cdeee(0x197)]!==undefined&&(_0x480b2f[_0x5cdeee(0x197)]=_0x314ec5[_0x5cdeee(0x197)]),createHash('sha256')['update'](JSON[_0x5cdeee(0x181)](_0x480b2f))['digest'](_0x495e56['aRsEY'])['slice'](0x0,0xc);}function extractPort(_0x1ece60){const _0xafbad1=_0x33dbb0;try{return new URL(_0x1ece60)[_0xafbad1(0x17f)];}catch{return'';}}function sortObjectKeys(_0x20d7c6){const _0x4b4a7c=_0x33dbb0,_0x3baa4f={};for(const _0x509717 of Object['keys'](_0x20d7c6)[_0x4b4a7c(0x187)]()){_0x3baa4f[_0x509717]=_0x20d7c6[_0x509717];}return _0x3baa4f;}export function getSessionCachePath(_0x1d777f,_0x53bbe1){const _0x4c9dec=_0x33dbb0,_0x1e1481={'zgegf':function(_0x4fb323,_0x2279dc,_0x5a33c5,_0x52e66a){return _0x4fb323(_0x2279dc,_0x5a33c5,_0x52e66a);},'HXefp':function(_0x2b4d5e){return _0x2b4d5e();}};return _0x1e1481['zgegf'](join,_0x1e1481['HXefp'](getRangerHomeDir),_0x4c9dec(0x18a),_0x1d777f+'-'+_0x53bbe1+'.json');}export function getStorageStatePath(_0x12608e){const _0x2b2f9d=_0x33dbb0,_0x1b7141={'xsyYd':'.storageState.json'};return _0x12608e[_0x2b2f9d(0x183)](/\.json$/,_0x1b7141['xsyYd']);}export function needsTunnel(_0x46ab55){const _0x122cd2=_0x33dbb0,_0x4dbf69={'SrMvZ':function(_0x274d95,_0x232683){return _0x274d95===_0x232683;},'QdrGH':_0x122cd2(0x193)};let _0x117c05;try{_0x117c05=new URL(_0x46ab55)[_0x122cd2(0x1a1)];}catch{return![];}if(_0x4dbf69['SrMvZ'](_0x117c05,'localhost')||_0x117c05==='127.0.0.1')return!![];if(_0x117c05[_0x122cd2(0x1a0)](_0x4dbf69[_0x122cd2(0x17e)]))return!![];if(_0x117c05['includes']('localhost.'))return!![];return![];}export function isBareLocalhost(_0x57a069){const _0x116ac9=_0x33dbb0,_0x264d59={'KbOMi':function(_0x47066e,_0x430d38){return _0x47066e===_0x430d38;},'wEdbU':_0x116ac9(0x1a9)};let _0xff1f14;try{_0xff1f14=new URL(_0x57a069)['hostname'];}catch{return![];}return _0xff1f14===_0x116ac9(0x180)||_0x264d59[_0x116ac9(0x189)](_0xff1f14,_0x264d59['wEdbU'])||_0x264d59[_0x116ac9(0x189)](_0xff1f14,'::1')||_0xff1f14==='[::1]';}export function orderLoginDomains(_0x1481e5,_0x29875e){const _0x406d3a=_0x33dbb0,_0x2a8aa1=_0x29875e??[];if(!_0x1481e5)return _0x2a8aa1;return[_0x1481e5,..._0x2a8aa1[_0x406d3a(0x19e)](_0x3e4bf4=>_0x3e4bf4!==_0x1481e5)];}export function hostnameOf(_0xd343ff){return new URL(_0xd343ff)['hostname'];}export function duplicateCookiesForDomains(_0x147c88,_0x3ea853){const _0xd29ede=_0x33dbb0,_0x5adc59={'CGoEZ':function(_0x1c8055,_0x307d17){return _0x1c8055(_0x307d17);}},_0x23d647=[..._0x147c88],_0x3cbdd4=new Set(_0x147c88[_0xd29ede(0x18f)](_0x175307=>_0x175307['domain']));for(const _0xd7dd33 of _0x3ea853){let _0x32489d;try{_0x32489d=_0x5adc59['CGoEZ'](hostnameOf,_0xd7dd33);}catch{continue;}if(!_0x32489d)continue;const _0x5732f7=_0x32489d[_0xd29ede(0x19d)]('.')?_0x32489d:'.'+_0x32489d;if(_0x3cbdd4[_0xd29ede(0x1b0)](_0x32489d)||_0x3cbdd4[_0xd29ede(0x1b0)](_0x5732f7))continue;for(const _0x1c56ec of _0x147c88){_0x23d647['push']({..._0x1c56ec,'domain':_0x5732f7});}_0x3cbdd4[_0xd29ede(0x190)](_0x5732f7);}return _0x23d647;}export function resolveAuthEnvironmentLocally(_0x3ea3fc,_0x3f507d){const _0x52caa3=_0x33dbb0,_0x2e5b8e=_0x3ea3fc['environments'];if(_0x3f507d){const _0x2f0a52=_0x2e5b8e[_0x3f507d];if(!_0x2f0a52)return null;return{'key':_0x3f507d,..._0x2f0a52};}if(_0x3ea3fc[_0x52caa3(0x1a7)]){const _0x1b0e36=_0x2e5b8e[_0x3ea3fc['defaultEnvironmentKey']];if(!_0x1b0e36)return null;return{'key':_0x3ea3fc[_0x52caa3(0x1a7)],..._0x1b0e36};}const _0x4b96b4=Object['keys'](_0x2e5b8e);if(_0x4b96b4['length']===0x1){const _0xa07fe=_0x4b96b4[0x0];return{'key':_0xa07fe,..._0x2e5b8e[_0xa07fe]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x5cedc2,_0x441d2c){try{if(_0x441d2c)return new URL(_0x441d2c,_0x5cedc2)['toString']();return new URL(_0x5cedc2)['toString']();}catch{return null;}}function _0x4cc7(){const _0x54e642=['env','220qqenzd','9LtrYpu','QdrGH','port','localhost','stringify','invalidateOn','replace','ijhHm','fmIXN','stdin','sort','setupHeaders','KbOMi','auth','newContext','1423264TOfmsI','close','orgId','map','add','sessionCheckPath','profileName','.localhost','440000wtiWym','135002SdoYqg','102UMQTEF','clientIp','574442rKRUxx','3TVRLdl','test','AzaTl','domcontentloaded','startsWith','filter','stdout','endsWith','hostname','hex','userAgent','cfhty','1630095AzSanG','lrpev','defaultEnvironmentKey','AcIgP','127.0.0.1','482596OUftFQ','launchBrowser','effectiveBaseUrl','newPage','ZGpYc','2933416mgjqFT','has'];_0x4cc7=function(){return _0x54e642;};return _0x4cc7();}export function looksLikeLoginUrl(_0x1c9ee5){const _0x16dfb0=_0x33dbb0;try{const _0x5c0dca=new URL(_0x1c9ee5);return LOGIN_URL_PATTERN['test'](_0x5c0dca['pathname']);}catch{return LOGIN_URL_PATTERN[_0x16dfb0(0x19a)](_0x1c9ee5);}}export async function isCachedSessionLive(_0x32fe2b,_0x2b9c5c,_0x26966f={},_0x1fd3c5={}){const _0x28c25a=_0x33dbb0,_0x35bb7f={'AcIgP':_0x28c25a(0x19c),'fmIXN':function(_0x472fff,_0x4e4340){return _0x472fff===_0x4e4340;}},_0x4504a6=buildSessionCheckUrl(_0x2b9c5c,_0x26966f[_0x28c25a(0x191)]);if(!_0x4504a6)return!![];if(!_0x1fd3c5['launchBrowser'])return!![];let _0xd41492=null;try{_0xd41492=await _0x1fd3c5[_0x28c25a(0x1ab)]();const _0x483c46=await _0xd41492[_0x28c25a(0x18b)]({'storageState':_0x32fe2b,'ignoreHTTPSErrors':!![],..._0x26966f[_0x28c25a(0x188)]?{'extraHTTPHeaders':_0x26966f[_0x28c25a(0x188)]}:{}}),_0x5f3e76=await _0x483c46[_0x28c25a(0x1ad)](),_0x4031e6=await _0x5f3e76['goto'](_0x4504a6,{'waitUntil':_0x35bb7f[_0x28c25a(0x1a8)],'timeout':0x3a98}),_0x3d3095=_0x4031e6?.['status']();if(_0x3d3095===0x191||_0x35bb7f[_0x28c25a(0x185)](_0x3d3095,0x193))return![];const _0x4788fd=_0x5f3e76['url']();if(looksLikeLoginUrl(_0x4788fd))return![];return!![];}catch{return![];}finally{if(_0xd41492)await _0xd41492[_0x28c25a(0x18d)]()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x1a92e3=_0x44bc;(function(_0x3e3a12,_0x5688af){const _0x5d0829=_0x44bc,_0x1baa7c=_0x3e3a12();while(!![]){try{const _0x30b8e1=parseInt(_0x5d0829(0x146))/0x1+parseInt(_0x5d0829(0x13a))/0x2+parseInt(_0x5d0829(0x139))/0x3+parseInt(_0x5d0829(0x13f))/0x4+-parseInt(_0x5d0829(0x145))/0x5+-parseInt(_0x5d0829(0x137))/0x6+parseInt(_0x5d0829(0x143))/0x7*(parseInt(_0x5d0829(0x141))/0x8);if(_0x30b8e1===_0x5688af)break;else _0x1baa7c['push'](_0x1baa7c['shift']());}catch(_0x33796d){_0x1baa7c['push'](_0x1baa7c['shift']());}}}(_0x43e2,0x3fe60));function _0x44bc(_0x39b44e,_0x55b8dd){_0x39b44e=_0x39b44e-0x136;const _0x43e28f=_0x43e2();let _0x44bcbe=_0x43e28f[_0x39b44e];return _0x44bcbe;}import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM='aes-256-gcm',SALT=_0x1a92e3(0x138),KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x37bd3d){const _0x141003={'bhHkb':'sha256'};return pbkdf2Sync(_0x37bd3d,SALT,0x186a0,KEY_LENGTH,_0x141003['bhHkb']);}function _0x43e2(){const _0x374453=['utf8','26472PNsmFS','subarray','21rNHttD','YxSbm','2031815INELOm','305105nHSNPF','concat','2464410DrUWkT','ranger-auth-encryption','578121uusypd','859492KYqxhO','myBNf','YAtQv','final','UvIHv','565364WfBTUx'];_0x43e2=function(){return _0x374453;};return _0x43e2();}export function encrypt(_0x3b894e,_0x246d05){const _0x4aa936=_0x1a92e3,_0xa5dbba={'myBNf':function(_0x2c983e,_0xd8f114){return _0x2c983e(_0xd8f114);},'DPtfB':function(_0x10dac7,_0x56e3ad,_0x1f1bb3,_0x519235){return _0x10dac7(_0x56e3ad,_0x1f1bb3,_0x519235);}},_0x46bbc1=_0xa5dbba[_0x4aa936(0x13b)](deriveKey,_0x246d05),_0x349dfb=randomBytes(IV_LENGTH),_0x3faa33=_0xa5dbba['DPtfB'](createCipheriv,ALGORITHM,_0x46bbc1,_0x349dfb),_0x5490e2=Buffer[_0x4aa936(0x136)]([_0x3faa33['update'](_0x3b894e,'utf8'),_0x3faa33[_0x4aa936(0x13d)]()]),_0x26e17b=_0x3faa33['getAuthTag']();return Buffer[_0x4aa936(0x136)]([_0x349dfb,_0x26e17b,_0x5490e2]);}export function decrypt(_0xa23473,_0x43e34e){const _0x327395=_0x1a92e3,_0x4b1e0f={'YxSbm':function(_0x20a86a,_0x3c2e09){return _0x20a86a+_0x3c2e09;},'UvIHv':function(_0xffe55e,_0x314505){return _0xffe55e+_0x314505;},'YAtQv':_0x327395(0x140)},_0x295411=deriveKey(_0x43e34e),_0x5f59b1=_0xa23473['subarray'](0x0,IV_LENGTH),_0x134610=_0xa23473['subarray'](IV_LENGTH,_0x4b1e0f[_0x327395(0x144)](IV_LENGTH,TAG_LENGTH)),_0x177f3c=_0xa23473[_0x327395(0x142)](IV_LENGTH+TAG_LENGTH),_0x5bccf1=createDecipheriv(ALGORITHM,_0x295411,_0x5f59b1);return _0x5bccf1['setAuthTag'](_0x134610),_0x4b1e0f[_0x327395(0x13e)](_0x5bccf1['update'](_0x177f3c),_0x5bccf1['final'](_0x4b1e0f[_0x327395(0x13c)]));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x2a3c0e=_0x5c2d;(function(_0x35774d,_0x5e282c){const _0x186b0b=_0x5c2d,_0x5dda8a=_0x35774d();while(!![]){try{const _0x1791d9=parseInt(_0x186b0b(0x135))/0x1*(parseInt(_0x186b0b(0x139))/0x2)+parseInt(_0x186b0b(0x13e))/0x3+parseInt(_0x186b0b(0x151))/0x4*(parseInt(_0x186b0b(0x14d))/0x5)+parseInt(_0x186b0b(0x140))/0x6+parseInt(_0x186b0b(0x15e))/0x7+-parseInt(_0x186b0b(0x144))/0x8*(-parseInt(_0x186b0b(0x146))/0x9)+-parseInt(_0x186b0b(0x141))/0xa;if(_0x1791d9===_0x5e282c)break;else _0x5dda8a['push'](_0x5dda8a['shift']());}catch(_0x5788ef){_0x5dda8a['push'](_0x5dda8a['shift']());}}}(_0x16ad,0x652f9));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x16ad(){const _0x3c3b61=['[desire-path]\x20Payload:\x20','join','LnLpJ','mvQVF','777479MYPxjQ','--pass','slice','[REDACTED]','2nUUnzz','/api/v1/mcp/desire-path-logs','stringify','=[REDACTED]','stdout','2115471srnyhD','DEBUG','4052046MBdJuR','29499840BDZzQV','HTNSD','BcrSs','4325512evgUJH','--auth','9pbHYQU','missing_option','BNoNW','error','Xlazy','--credentials','errorMessage','354895RZQloD','length','--secret','includes','8Mgestp','--token','missing_required_argument','no_token','POST','Unknown\x20command','Not\x20enough\x20non-option\x20arguments','push','[desire-path]\x20Failed\x20to\x20send:\x20','uFGCr','Bearer\x20','sHllH','PJgun','3666719yDMmGn','isTTY','syntax_error','--header','HjgrZ','--key','catch','unknown_command'];_0x16ad=function(){return _0x3c3b61;};return _0x16ad();}import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0x2a3c0e(0x152),'-t',_0x2a3c0e(0x14f),'--api-key','--apikey',_0x2a3c0e(0x12e),'--password',_0x2a3c0e(0x136),_0x2a3c0e(0x145),'--authorization',_0x2a3c0e(0x12c),'--cookie',_0x2a3c0e(0x14b)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function _0x5c2d(_0x43cf72,_0x3253d6){_0x43cf72=_0x43cf72-0x12b;const _0x16adb6=_0x16ad();let _0x5c2d44=_0x16adb6[_0x43cf72];return _0x5c2d44;}function looksLikeToken(_0x3ecd2d){return TOKEN_PATTERNS['some'](_0x185e3a=>_0x185e3a['test'](_0x3ecd2d));}export function sanitizeArgs(_0x240ebc){const _0x3e1859=_0x2a3c0e,_0x1f878a={'mvQVF':function(_0x330fd1,_0x26518d){return _0x330fd1(_0x26518d);},'BcrSs':_0x3e1859(0x138)},_0x32e5a7=[];let _0x54df61=![];for(let _0xc70ee7=0x0;_0xc70ee7<_0x240ebc[_0x3e1859(0x14e)];_0xc70ee7++){const _0x44f189=_0x240ebc[_0xc70ee7];if(_0x54df61){_0x32e5a7['push']('[REDACTED]'),_0x54df61=![];continue;}if(_0x44f189['startsWith']('--')||_0x44f189['startsWith']('-')){const _0x28223f=_0x44f189['indexOf']('=');if(_0x28223f!==-0x1){const _0x13a452=_0x44f189[_0x3e1859(0x137)](0x0,_0x28223f)['toLowerCase']();if(SENSITIVE_FLAGS['has'](_0x13a452)){_0x32e5a7[_0x3e1859(0x158)](_0x44f189['slice'](0x0,_0x28223f)+_0x3e1859(0x13c));continue;}}else{const _0x3b8388=_0x44f189['toLowerCase']();SENSITIVE_FLAGS['has'](_0x3b8388)&&(_0x54df61=!![]);}_0x32e5a7['push'](_0x44f189);}else _0x1f878a[_0x3e1859(0x134)](looksLikeToken,_0x44f189)?_0x32e5a7[_0x3e1859(0x158)](_0x1f878a[_0x3e1859(0x143)]):_0x32e5a7[_0x3e1859(0x158)](_0x44f189);}return _0x32e5a7[_0x3e1859(0x132)]('\x20');}export async function logDesirePath(_0xecfbaf){const _0x1cd2b9=_0x2a3c0e,_0x44b802={'uFGCr':function(_0x527e68){return _0x527e68();},'LnLpJ':function(_0x363ca4){return _0x363ca4();},'iotBa':_0x1cd2b9(0x154),'sHllH':'application/json','BCibc':'Authorization','BNoNW':_0x1cd2b9(0x155)};try{const _0x284018=await _0x44b802[_0x1cd2b9(0x15a)](getToken)[_0x1cd2b9(0x12f)](()=>null),_0x510e5f=_0x44b802['uFGCr'](getApiBaseUrl),_0x26d0da=_0x44b802[_0x1cd2b9(0x133)](getCurrentVersion),_0x39098b=_0x284018?'has_token':_0x44b802['iotBa'],_0x16f7c9={..._0xecfbaf['metadata'],'authStatus':_0x39098b,'isTty':process[_0x1cd2b9(0x13d)][_0x1cd2b9(0x15f)]??![]},_0x2e57b9={'Content-Type':_0x44b802[_0x1cd2b9(0x15c)]};_0x284018&&(_0x2e57b9[_0x44b802['BCibc']]=_0x1cd2b9(0x15b)+_0x284018);const _0x427bec={'rawCommand':_0xecfbaf['rawCommand'],'errorMessage':_0xecfbaf[_0x1cd2b9(0x14c)],'errorType':_0xecfbaf['errorType'],'featureId':_0xecfbaf['featureId'],'sessionId':_0xecfbaf['sessionId'],'metadata':_0x16f7c9,'cliVersion':_0x26d0da};process['env'][_0x1cd2b9(0x13f)]&&(console['error']('[desire-path]\x20Sending\x20log\x20to\x20'+_0x510e5f+'/api/v1/mcp/desire-path-logs'),console['error'](_0x1cd2b9(0x131)+JSON[_0x1cd2b9(0x13b)](_0x427bec,null,0x2))),await fetch(_0x510e5f+_0x1cd2b9(0x13a),{'method':_0x44b802[_0x1cd2b9(0x148)],'headers':_0x2e57b9,'body':JSON['stringify'](_0x427bec)});}catch(_0x4b4fba){process['env'][_0x1cd2b9(0x13f)]&&console[_0x1cd2b9(0x149)](_0x1cd2b9(0x159)+_0x4b4fba);}}export function getErrorType(_0x3a0358,_0x1d500b){const _0x24791d=_0x2a3c0e,_0x1fa349={'Xlazy':'runtime_error','HTNSD':'unknown','foDKK':_0x24791d(0x130),'OueIe':'Unknown\x20argument','PJgun':_0x24791d(0x153),'fZZri':'invalid_option_value','HjgrZ':_0x24791d(0x147)};if(_0x1d500b)return _0x1fa349[_0x24791d(0x14a)];if(!_0x3a0358)return _0x1fa349[_0x24791d(0x142)];if(_0x3a0358['includes'](_0x24791d(0x156)))return _0x1fa349['foDKK'];if(_0x3a0358['includes'](_0x1fa349['OueIe']))return'unknown_argument';if(_0x3a0358[_0x24791d(0x150)](_0x24791d(0x157)))return _0x1fa349[_0x24791d(0x15d)];if(_0x3a0358['includes']('Invalid\x20values'))return _0x1fa349['fZZri'];if(_0x3a0358['includes']('Missing\x20required\x20argument'))return _0x1fa349[_0x24791d(0x12d)];return _0x24791d(0x12b);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0xe04653=_0x1bfd;function _0x1bfd(_0x525b64,_0x1aa7f9){_0x525b64=_0x525b64-0x16a;const _0x46d49e=_0x46d4();let _0x1bfdbf=_0x46d49e[_0x525b64];return _0x1bfdbf;}(function(_0x482101,_0x44109a){const _0x24deca=_0x1bfd,_0x3126e5=_0x482101();while(!![]){try{const _0x119115=parseInt(_0x24deca(0x189))/0x1*(-parseInt(_0x24deca(0x1ba))/0x2)+-parseInt(_0x24deca(0x17e))/0x3*(parseInt(_0x24deca(0x19d))/0x4)+parseInt(_0x24deca(0x1b1))/0x5*(-parseInt(_0x24deca(0x174))/0x6)+-parseInt(_0x24deca(0x19f))/0x7+-parseInt(_0x24deca(0x18d))/0x8*(-parseInt(_0x24deca(0x16d))/0x9)+parseInt(_0x24deca(0x1a5))/0xa*(-parseInt(_0x24deca(0x1bf))/0xb)+parseInt(_0x24deca(0x1c0))/0xc*(parseInt(_0x24deca(0x1ac))/0xd);if(_0x119115===_0x44109a)break;else _0x3126e5['push'](_0x3126e5['shift']());}catch(_0x29a13e){_0x3126e5['push'](_0x3126e5['shift']());}}}(_0x46d4,0xebb75));import{spawn}from'child_process';import _0x324845 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';function _0x46d4(){const _0x544202=['access_token','stringify','CleVW','Failed\x20to\x20provision\x20CLI\x20token:\x20','log','list','258jFDhuf','Failed\x20to\x20create\x20organization:\x20','Invalid\x20JWT\x20format','email','workosClientId','NcUBm','prompt','sKwBh','EedNs','LdRWs','108HhBUtm','YDjgo','Setting\x20up\x20your\x20organization...','etUeb','slow_down','token','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','map','oudBj','selected','/organization/me','2JnzmyB','https://api.workos.com/user_management/authorize/device','DQxJS','/organization/my-memberships','12374880NyJHzC','text','base64url','mcp:write','json','status','device_code','organizationId','/api-keys','platform','from','darwin','etxUS','startsWith','refresh_token','parse','114484eLXImJ','isTTY','177387fZxeIS','error','dpfvS','FLjTn','apiKey','GET','47810MDUUPw','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','pAPPN','Failed\x20to\x20request\x20device\x20code:\x20','memberships','name','POST','7189ibUzDQ','foVkX','error_description','HQZSy','EQjnl','9430DwFcmk','now','length','application/json','split','wsodQ','user_code','application/x-www-form-urlencoded','eVBAy','940136TbEPxB','open','ITaDJ','Authentication\x20failed','sZfao','2497XXilzZ','56004hDoOvb','Waiting\x20for\x20authentication...','stdout','write','uVioG','9Ngcctv'];_0x46d4=function(){return _0x544202;};return _0x46d4();}const WORKOS_DEVICE_AUTH_URL=_0xe04653(0x18a),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0x1b3920){const _0x3a9dfd=_0xe04653,_0x305832={'rgaqj':function(_0x3d9535,_0x1bddde,_0x5e3a5e){return _0x3d9535(_0x1bddde,_0x5e3a5e);},'NcUBm':'application/x-www-form-urlencoded'},_0x18bc28=await _0x305832['rgaqj'](fetch,WORKOS_DEVICE_AUTH_URL,{'method':'POST','headers':{'Content-Type':_0x305832[_0x3a9dfd(0x179)]},'body':new URLSearchParams({'client_id':_0x1b3920})});if(!_0x18bc28['ok']){const _0xf27a52=await _0x18bc28['text']();throw new Error(_0x3a9dfd(0x1a8)+_0x18bc28['status']+'\x20'+_0xf27a52);}return _0x18bc28[_0x3a9dfd(0x191)]();}export async function pollForTokens(_0x5a2b18,_0x1df7f5,_0x163793,_0x2ab949){const _0x3003d5=_0xe04653,_0x43537e={'EedNs':function(_0x5bd6b7,_0x58e1a8){return _0x5bd6b7*_0x58e1a8;},'CleVW':function(_0x205d97,_0x45e360,_0x3c94dd){return _0x205d97(_0x45e360,_0x3c94dd);},'etxUS':_0x3003d5(0x1ab),'xWwNd':'urn:ietf:params:oauth:grant-type:device_code','etUeb':function(_0x49df73,_0x24bb4c){return _0x49df73===_0x24bb4c;},'zfpMy':_0x3003d5(0x182)},_0x584a51=Date['now']()+_0x43537e[_0x3003d5(0x17c)](_0x2ab949,0x3e8);let _0x2a8383=_0x43537e['EedNs'](_0x163793,0x3e8);while(Date[_0x3003d5(0x1b2)]()<_0x584a51){await sleep(_0x2a8383);const _0x151233=await _0x43537e[_0x3003d5(0x170)](fetch,WORKOS_TOKEN_URL,{'method':_0x43537e[_0x3003d5(0x199)],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x5a2b18,'device_code':_0x1df7f5,'grant_type':_0x43537e['xWwNd']})});if(_0x151233['ok'])return _0x151233['json']();const _0x3e59e7=await _0x151233['json']();if(_0x43537e[_0x3003d5(0x181)](_0x3e59e7[_0x3003d5(0x1a0)],'authorization_pending'))continue;if(_0x3e59e7[_0x3003d5(0x1a0)]===_0x43537e['zfpMy']){_0x2a8383+=0x3e8;continue;}throw new Error(_0x3e59e7[_0x3003d5(0x1ae)]||_0x3e59e7[_0x3003d5(0x1a0)]||_0x3003d5(0x1bd));}throw new Error('Device\x20authorization\x20timed\x20out');}async function fetchUserProfile(_0x15095d){const _0x2872f8=_0xe04653,_0x2a17cd={'dpfvS':function(_0x2dda11){return _0x2dda11();},'uVioG':function(_0xa4b97e,_0x5a399f,_0x211e40){return _0xa4b97e(_0x5a399f,_0x211e40);},'OuLxQ':_0x2872f8(0x1a4)},_0x3a1e99=_0x2a17cd[_0x2872f8(0x1a1)](getApiBaseUrl);try{const _0x121c46=await _0x2a17cd[_0x2872f8(0x16c)](fetch,_0x3a1e99+_0x2872f8(0x188),{'method':_0x2a17cd['OuLxQ'],'headers':{'workos-token':_0x15095d}});if(_0x121c46['ok'])return _0x121c46['json']();}catch{}return null;}function buildKeyName(_0x56e0c8,_0x5c73b4){const _0x2c1f0f=_0xe04653,_0x316673={'BVsLv':function(_0x409eb1,_0x2bbae8){return _0x409eb1===_0x2bbae8;}},_0x4cfa9d=_0x5c73b4['filter'](_0x30ae3f=>_0x30ae3f[_0x2c1f0f(0x1aa)]===_0x56e0c8||_0x30ae3f[_0x2c1f0f(0x1aa)][_0x2c1f0f(0x19a)](_0x56e0c8+'\x20('));if(_0x316673['BVsLv'](_0x4cfa9d['length'],0x0))return _0x56e0c8;return _0x56e0c8+'\x20('+(_0x4cfa9d['length']+0x1)+')';}export async function provisionApiKey(_0x2e17a8){const _0x693823=_0xe04653,_0x4a13c4={'lnlQQ':'application/json','FTqyx':'CLI\x20Key','pAPPN':function(_0x4563ee,_0x46fb61,_0x29a33b){return _0x4563ee(_0x46fb61,_0x29a33b);},'VYhQO':_0x693823(0x1ab),'ITaDJ':_0x693823(0x190)},_0x4b729e=getApiBaseUrl(),_0x3f3d18={'Content-Type':_0x4a13c4['lnlQQ'],'workos-token':_0x2e17a8},_0x5ea4df=await fetchUserProfile(_0x2e17a8),_0x5352d6=_0x5ea4df?.['firstName']||_0x5ea4df?.[_0x693823(0x177)]?.[_0x693823(0x1b5)]('@')[0x0],_0x563da2=_0x5352d6?_0x5352d6+'\x27s\x20CLI\x20Key':_0x4a13c4['FTqyx'];let _0x16bd8f=[];try{const _0x24601a=await _0x4a13c4['pAPPN'](fetch,_0x4b729e+_0x693823(0x195),{'method':'GET','headers':_0x3f3d18});if(_0x24601a['ok']){const _0x3bddcc=await _0x24601a[_0x693823(0x191)]();_0x16bd8f=_0x3bddcc['apiKeys'];}}catch{}const _0x3813ab=_0x4a13c4[_0x693823(0x1a7)](buildKeyName,_0x563da2,_0x16bd8f),_0xb390e6=await fetch(_0x4b729e+_0x693823(0x195),{'method':_0x4a13c4['VYhQO'],'headers':_0x3f3d18,'body':JSON[_0x693823(0x16f)]({'name':_0x3813ab,'scope':_0x4a13c4[_0x693823(0x1bc)]})});if(!_0xb390e6['ok']){const _0x4db28f=await _0xb390e6['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0xb390e6['status']+'\x20'+_0x4db28f);}const _0x2ef476=await _0xb390e6[_0x693823(0x191)]();return _0x2ef476[_0x693823(0x1a3)][_0x693823(0x183)];}export function openBrowser(_0x1ba138){const _0x307368=_0xe04653,_0x3099fd={'YDjgo':function(_0x55af9d,_0x1cb53b){return _0x55af9d===_0x1cb53b;},'LdRWs':function(_0x20c530,_0x51aaf2,_0x2f39c1,_0xd54ab7){return _0x20c530(_0x51aaf2,_0x2f39c1,_0xd54ab7);},'sKwBh':'ignore'};try{if(_0x3099fd[_0x307368(0x17f)](process[_0x307368(0x196)],'win32')){const _0x3aeaae=_0x3099fd['LdRWs'](spawn,'cmd',['/c','start','',_0x1ba138],{'detached':!![],'stdio':_0x3099fd[_0x307368(0x17b)],'windowsHide':!![]});_0x3aeaae['unref']();return;}const _0x5d55c7=process[_0x307368(0x196)]===_0x307368(0x198)?_0x307368(0x1bb):'xdg-open',_0x16dcb8=_0x3099fd[_0x307368(0x17d)](spawn,_0x5d55c7,[_0x1ba138],{'detached':!![],'stdio':_0x3099fd['sKwBh']});_0x16dcb8['unref']();}catch{}}function decodeJwtPayload(_0x33906a){const _0x495e46=_0xe04653,_0x38a27d={'wsodQ':_0x495e46(0x18f),'DQxJS':'utf-8'},_0x134607=_0x33906a['split']('.');if(_0x134607[_0x495e46(0x1b3)]!==0x3)throw new Error(_0x495e46(0x176));const _0x440578=Buffer[_0x495e46(0x197)](_0x134607[0x1],_0x38a27d[_0x495e46(0x1b6)])['toString'](_0x38a27d[_0x495e46(0x18b)]);return JSON[_0x495e46(0x19c)](_0x440578);}async function selfServeSignup(_0xdf20d1){const _0x34465d=_0xe04653,_0x333ff5={'lDHjf':function(_0x2c4370){return _0x2c4370();},'NjYCc':'POST','PGuDH':'application/json'},_0xfa4b6f=_0x333ff5['lDHjf'](getApiBaseUrl),_0x1dba41=await fetch(_0xfa4b6f+'/organization/self-serve-signup',{'method':_0x333ff5['NjYCc'],'headers':{'Content-Type':_0x333ff5['PGuDH'],'workos-token':_0xdf20d1}});if(!_0x1dba41['ok']){const _0x4a746c=await _0x1dba41[_0x34465d(0x18e)]();throw new Error(_0x34465d(0x175)+_0x1dba41['status']+'\x20'+_0x4a746c);}return _0x1dba41['json']();}async function fetchMyMemberships(_0x5ed369){const _0x2db417=_0xe04653,_0x47bb2c={'FLjTn':'GET'},_0x459d52=getApiBaseUrl(),_0x442692=await fetch(_0x459d52+_0x2db417(0x18c),{'method':_0x47bb2c[_0x2db417(0x1a2)],'headers':{'workos-token':_0x5ed369}});if(!_0x442692['ok']){const _0x405dac=await _0x442692[_0x2db417(0x18e)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x442692[_0x2db417(0x192)]+'\x20'+_0x405dac);}const _0x9004ff=await _0x442692[_0x2db417(0x191)]();return _0x9004ff[_0x2db417(0x1a9)];}async function refreshTokenWithOrg(_0x4442aa,_0x586e9f,_0x5afc15){const _0x482d70=_0xe04653,_0x5bef0d={'JvyXD':_0x482d70(0x1b8),'foVkX':_0x482d70(0x19b)},_0x36d09e=await fetch(WORKOS_TOKEN_URL,{'method':_0x482d70(0x1ab),'headers':{'Content-Type':_0x5bef0d['JvyXD']},'body':new URLSearchParams({'client_id':_0x4442aa,'grant_type':_0x5bef0d[_0x482d70(0x1ad)],'refresh_token':_0x586e9f,'organization_id':_0x5afc15})});if(!_0x36d09e['ok']){const _0x310f04=await _0x36d09e['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x36d09e['status']+'\x20'+_0x310f04);}return _0x36d09e['json']();}async function provisionCliToken(_0x3571c6){const _0x1c3729=_0xe04653,_0x395fab={'DsAPm':'POST','HQZSy':_0x1c3729(0x1b4)},_0x10440f=getApiBaseUrl(),_0x1c0bdd=await fetch(_0x10440f+'/cli-auth/token',{'method':_0x395fab['DsAPm'],'headers':{'Content-Type':_0x395fab[_0x1c3729(0x1af)],'workos-token':_0x3571c6}});if(!_0x1c0bdd['ok']){const _0x3cb6da=await _0x1c0bdd[_0x1c3729(0x18e)]();throw new Error(_0x1c3729(0x171)+_0x1c0bdd['status']+'\x20'+_0x3cb6da);}return _0x1c0bdd['json']();}export async function runDeviceAuthFlow(){const _0x4f96e9=_0xe04653,_0x2313d6={'eVBAy':function(_0xb82d0e,_0x2bd791){return _0xb82d0e(_0x2bd791);},'JuYcC':_0x4f96e9(0x1c1),'wXruX':function(_0x14fd18,_0x527ed6,_0x4d7995,_0xcac159,_0x18c671){return _0x14fd18(_0x527ed6,_0x4d7995,_0xcac159,_0x18c671);},'YURfm':function(_0x2c3e3d,_0x5c5f13){return _0x2c3e3d===_0x5c5f13;},'EQjnl':_0x4f96e9(0x180),'Yvxed':function(_0x5073c7,_0x2a83e8){return _0x5073c7(_0x2a83e8);},'SFRnk':function(_0x209832,_0x2654a){return _0x209832+_0x2654a;},'oudBj':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','sZfao':_0x4f96e9(0x1a6),'XZezP':_0x4f96e9(0x173),'aoJaQ':_0x4f96e9(0x187)},_0x1059c9=getCurrentEnvironment(),_0x417261=ENVIRONMENT_CONFIGS[_0x1059c9][_0x4f96e9(0x178)],_0x2d73e3=await requestDeviceCode(_0x417261);console['log']('\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...'),console['log'](_0x4f96e9(0x184)),_0x2313d6['eVBAy'](openBrowser,_0x2d73e3['verification_uri_complete']),console['log']('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x2d73e3['verification_uri_complete']),console['log']('Code:\x20'+_0x2d73e3[_0x4f96e9(0x1b7)]+'\x0a'),process[_0x4f96e9(0x16a)]['write'](_0x2313d6['JuYcC']);let _0x301bd7=await _0x2313d6['wXruX'](pollForTokens,_0x417261,_0x2d73e3[_0x4f96e9(0x193)],_0x2d73e3['interval'],_0x2d73e3['expires_in']);console['log']('\x20✓');const _0x256416=decodeJwtPayload(_0x301bd7['access_token']);if(!_0x256416['org_id']){const _0x1a5b1c=await _0x2313d6[_0x4f96e9(0x1b9)](fetchMyMemberships,_0x301bd7['access_token']);let _0x3a68ad;if(_0x2313d6['YURfm'](_0x1a5b1c['length'],0x0)){process['stdout']['write'](_0x2313d6[_0x4f96e9(0x1b0)]);const _0x16e7cb=await _0x2313d6['Yvxed'](selfServeSignup,_0x301bd7[_0x4f96e9(0x16e)]);_0x3a68ad=_0x16e7cb[_0x4f96e9(0x194)],console[_0x4f96e9(0x172)]('\x20✓');}else{if(_0x1a5b1c['length']===0x1)_0x3a68ad=_0x1a5b1c[0x0]['organizationId'],console['log']('Using\x20organization:\x20'+_0x1a5b1c[0x0]['name']);else{const _0x26ae80=process['stdin']['isTTY']&&process['stdout'][_0x4f96e9(0x19e)];if(!_0x26ae80)throw new Error(_0x2313d6['SFRnk'](_0x2313d6[_0x4f96e9(0x186)],_0x2313d6[_0x4f96e9(0x1be)]));const {selected:_0x136084}=await _0x324845[_0x4f96e9(0x17a)]([{'type':_0x2313d6['XZezP'],'name':_0x2313d6['aoJaQ'],'message':'Select\x20an\x20organization:','choices':_0x1a5b1c[_0x4f96e9(0x185)](_0x59a89c=>({'name':_0x59a89c['name'],'value':_0x59a89c[_0x4f96e9(0x194)]}))}]);_0x3a68ad=_0x136084;}}_0x301bd7=await refreshTokenWithOrg(_0x417261,_0x301bd7[_0x4f96e9(0x19b)],_0x3a68ad);}process['stdout'][_0x4f96e9(0x16b)]('Provisioning\x20CLI\x20token...');const _0x3cfc6b=await provisionCliToken(_0x301bd7['access_token']);return console[_0x4f96e9(0x172)]('\x20✓'),await storeToken(_0x3cfc6b['token']),_0x301bd7['refresh_token']&&await storeRefreshToken(_0x301bd7[_0x4f96e9(0x19b)]),_0x3cfc6b['token'];}function sleep(_0x158576){return new Promise(_0x4bc3b2=>setTimeout(_0x4bc3b2,_0x158576));}
|
|
1
|
+
const _0x3255f1=_0xaaf9;(function(_0x518482,_0x541bf4){const _0x1ab837=_0xaaf9,_0x5b7b59=_0x518482();while(!![]){try{const _0xa0385e=-parseInt(_0x1ab837(0x13a))/0x1*(-parseInt(_0x1ab837(0xf7))/0x2)+parseInt(_0x1ab837(0x101))/0x3*(-parseInt(_0x1ab837(0x138))/0x4)+parseInt(_0x1ab837(0x11e))/0x5+parseInt(_0x1ab837(0x10a))/0x6+-parseInt(_0x1ab837(0x12f))/0x7+parseInt(_0x1ab837(0x140))/0x8+-parseInt(_0x1ab837(0x104))/0x9;if(_0xa0385e===_0x541bf4)break;else _0x5b7b59['push'](_0x5b7b59['shift']());}catch(_0x3508ad){_0x5b7b59['push'](_0x5b7b59['shift']());}}}(_0x24ca,0xdafd7));import{spawn}from'child_process';import _0x384df5 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x3255f1(0x12b),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0x2c2506){const _0x5abd0b=_0x3255f1,_0x1f433f={'azVJQ':function(_0xf818ad,_0x5c87,_0x3ea5ff){return _0xf818ad(_0x5c87,_0x3ea5ff);},'Duaxp':_0x5abd0b(0xf0),'XCjVk':'application/x-www-form-urlencoded'},_0x5aa197=await _0x1f433f['azVJQ'](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x1f433f[_0x5abd0b(0xf9)],'headers':{'Content-Type':_0x1f433f[_0x5abd0b(0xf1)]},'body':new URLSearchParams({'client_id':_0x2c2506})});if(!_0x5aa197['ok']){const _0xd109e8=await _0x5aa197[_0x5abd0b(0x107)]();throw new Error(_0x5abd0b(0x102)+_0x5aa197[_0x5abd0b(0x144)]+'\x20'+_0xd109e8);}return _0x5aa197[_0x5abd0b(0x12e)]();}function _0xaaf9(_0x2facbf,_0x149d5c){_0x2facbf=_0x2facbf-0xf0;const _0x24ca37=_0x24ca();let _0xaaf9a9=_0x24ca37[_0x2facbf];return _0xaaf9a9;}function _0x24ca(){const _0x294355=['Using\x20organization:\x20','yxnLJ','/organization/self-serve-signup','xdg-open','application/x-www-form-urlencoded','device_code','/organization/my-memberships','name','toString','Setting\x20up\x20your\x20organization...','urn:ietf:params:oauth:grant-type:device_code','email','7284830jScleV','CLI\x20Key','fIIHq','lELHT','hADWN','\x27s\x20CLI\x20Key','uVNsW','write','firstName','YhQKg','Failed\x20to\x20fetch\x20memberships:\x20','Device\x20authorization\x20timed\x20out','workosClientId','https://api.workos.com/user_management/authorize/device','organizationId','interval','json','5897815tYgslD','parse','dgHbF','dulbk','selected','RapSn','unref','stdout','now','1528xnVxTL','apiKeys','10ZtllnQ','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','JDNpP','kirOb','SsgVl','/organization/me','4164000HYJCVL','fsJMR','refresh_token','length','status','access_token','authorization_pending','JBTuU','expires_in','dViPv','POST','XCjVk','apiKey','utf-8','Code:\x20','startsWith','tGuKD','282358VxwLWH','memberships','Duaxp','cmd','list','RbfcK','pRXzg','stringify','ignore','GET','10722ZdhDBE','Failed\x20to\x20request\x20device\x20code:\x20','error','15765183wbwiJd','bAgID','/cli-auth/token','text','Ikskc','lOvnd','8803362InEdtW','application/json','Waiting\x20for\x20authentication...','/api-keys','log','Select\x20an\x20organization:','Failed\x20to\x20create\x20organization:\x20','FdpOt'];_0x24ca=function(){return _0x294355;};return _0x24ca();}export async function pollForTokens(_0x1c55d3,_0x15db9d,_0x4a0298,_0x4838cb){const _0x3e003d=_0x3255f1,_0x4b0fb3={'dhUBj':function(_0x29c4fe,_0x5c251c){return _0x29c4fe*_0x5c251c;},'JBTuU':function(_0x1629f7,_0x5bfb49){return _0x1629f7*_0x5bfb49;},'mCRij':function(_0x356abd,_0x342aec){return _0x356abd<_0x342aec;},'yIdjY':function(_0x483c1a,_0x1ac298){return _0x483c1a(_0x1ac298);},'YhQKg':function(_0x32b43b,_0xf46c78,_0x530850){return _0x32b43b(_0xf46c78,_0x530850);},'lELHT':_0x3e003d(0x11c),'JDNpP':function(_0x29b267,_0x3212f2){return _0x29b267===_0x3212f2;}},_0x5cf54a=Date[_0x3e003d(0x137)]()+_0x4b0fb3['dhUBj'](_0x4838cb,0x3e8);let _0x1b970a=_0x4b0fb3[_0x3e003d(0x147)](_0x4a0298,0x3e8);while(_0x4b0fb3['mCRij'](Date[_0x3e003d(0x137)](),_0x5cf54a)){await _0x4b0fb3['yIdjY'](sleep,_0x1b970a);const _0x5b13ad=await _0x4b0fb3[_0x3e003d(0x127)](fetch,WORKOS_TOKEN_URL,{'method':_0x3e003d(0xf0),'headers':{'Content-Type':_0x3e003d(0x116)},'body':new URLSearchParams({'client_id':_0x1c55d3,'device_code':_0x15db9d,'grant_type':_0x4b0fb3[_0x3e003d(0x121)]})});if(_0x5b13ad['ok'])return _0x5b13ad['json']();const _0x107cb6=await _0x5b13ad['json']();if(_0x107cb6['error']===_0x3e003d(0x146))continue;if(_0x4b0fb3[_0x3e003d(0x13c)](_0x107cb6[_0x3e003d(0x103)],'slow_down')){_0x1b970a+=0x3e8;continue;}throw new Error(_0x107cb6['error_description']||_0x107cb6[_0x3e003d(0x103)]||'Authentication\x20failed');}throw new Error(_0x3e003d(0x129));}async function fetchUserProfile(_0x298049){const _0x508e64=_0x3255f1,_0x2fd947=getApiBaseUrl();try{const _0x46033b=await fetch(_0x2fd947+_0x508e64(0x13f),{'method':'GET','headers':{'workos-token':_0x298049}});if(_0x46033b['ok'])return _0x46033b['json']();}catch{}return null;}function buildKeyName(_0x2d9124,_0x58e735){const _0x5755bc=_0x3255f1,_0x2cbfa5={'WuBwB':function(_0x1dc5ce,_0x7bd627){return _0x1dc5ce===_0x7bd627;}},_0x5f224f=_0x58e735['filter'](_0x282492=>_0x282492['name']===_0x2d9124||_0x282492['name'][_0x5755bc(0xf5)](_0x2d9124+'\x20('));if(_0x2cbfa5['WuBwB'](_0x5f224f['length'],0x0))return _0x2d9124;return _0x2d9124+'\x20('+(_0x5f224f[_0x5755bc(0x143)]+0x1)+')';}export async function provisionApiKey(_0x515b0a){const _0x3b88e5=_0x3255f1,_0x3b4996={'IYClw':function(_0x26ba56){return _0x26ba56();},'CyXdk':function(_0x119d52,_0x4a538e){return _0x119d52(_0x4a538e);},'Zpxct':_0x3b88e5(0x11f),'lOvnd':_0x3b88e5(0x100),'swBQF':function(_0x1b13a6,_0x31ed32,_0x10f5f2){return _0x1b13a6(_0x31ed32,_0x10f5f2);},'uVNsW':function(_0x4366b1,_0x4a9424,_0x134904){return _0x4366b1(_0x4a9424,_0x134904);}},_0x122a0b=_0x3b4996['IYClw'](getApiBaseUrl),_0x23db3c={'Content-Type':'application/json','workos-token':_0x515b0a},_0x127e54=await _0x3b4996['CyXdk'](fetchUserProfile,_0x515b0a),_0x2b291e=_0x127e54?.[_0x3b88e5(0x126)]||_0x127e54?.[_0x3b88e5(0x11d)]?.['split']('@')[0x0],_0x5d244e=_0x2b291e?_0x2b291e+_0x3b88e5(0x123):_0x3b4996['Zpxct'];let _0x2a523e=[];try{const _0x1f2a37=await fetch(_0x122a0b+'/api-keys',{'method':_0x3b4996[_0x3b88e5(0x109)],'headers':_0x23db3c});if(_0x1f2a37['ok']){const _0x5b56f5=await _0x1f2a37[_0x3b88e5(0x12e)]();_0x2a523e=_0x5b56f5[_0x3b88e5(0x139)];}}catch{}const _0x1a84cb=_0x3b4996['swBQF'](buildKeyName,_0x5d244e,_0x2a523e),_0x40b5c2=await _0x3b4996[_0x3b88e5(0x124)](fetch,_0x122a0b+_0x3b88e5(0x10d),{'method':'POST','headers':_0x23db3c,'body':JSON[_0x3b88e5(0xfe)]({'name':_0x1a84cb,'scope':'mcp:write'})});if(!_0x40b5c2['ok']){const _0x4e139f=await _0x40b5c2['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x40b5c2['status']+'\x20'+_0x4e139f);}const _0x32ec1e=await _0x40b5c2[_0x3b88e5(0x12e)]();return _0x32ec1e[_0x3b88e5(0xf2)]['token'];}export function openBrowser(_0x4cef76){const _0x3fa80f=_0x3255f1,_0x423db4={'hADWN':_0x3fa80f(0xfa),'pRXzg':'start','SsgVl':_0x3fa80f(0xff),'yxnLJ':function(_0x449e29,_0x139385){return _0x449e29===_0x139385;},'AMIXL':'darwin'};try{if(process['platform']==='win32'){const _0x516f42=spawn(_0x423db4[_0x3fa80f(0x122)],['/c',_0x423db4[_0x3fa80f(0xfd)],'',_0x4cef76],{'detached':!![],'stdio':_0x423db4[_0x3fa80f(0x13e)],'windowsHide':!![]});_0x516f42['unref']();return;}const _0x39f71d=_0x423db4[_0x3fa80f(0x113)](process['platform'],_0x423db4['AMIXL'])?'open':_0x3fa80f(0x115),_0x379c1d=spawn(_0x39f71d,[_0x4cef76],{'detached':!![],'stdio':'ignore'});_0x379c1d[_0x3fa80f(0x135)]();}catch{}}function decodeJwtPayload(_0x331139){const _0xed2fa3=_0x3255f1,_0x3b5078={'BVuhi':'Invalid\x20JWT\x20format','bAgID':'base64url'},_0x7dd591=_0x331139['split']('.');if(_0x7dd591[_0xed2fa3(0x143)]!==0x3)throw new Error(_0x3b5078['BVuhi']);const _0x20d4e2=Buffer['from'](_0x7dd591[0x1],_0x3b5078[_0xed2fa3(0x105)])[_0xed2fa3(0x11a)](_0xed2fa3(0xf3));return JSON[_0xed2fa3(0x130)](_0x20d4e2);}async function selfServeSignup(_0x827549){const _0x1d8749=_0x3255f1,_0x3c126e={'RbfcK':function(_0x111ddc){return _0x111ddc();},'niXTv':'POST','PWEUk':_0x1d8749(0x10b)},_0x576838=_0x3c126e[_0x1d8749(0xfc)](getApiBaseUrl),_0x206c41=await fetch(_0x576838+_0x1d8749(0x114),{'method':_0x3c126e['niXTv'],'headers':{'Content-Type':_0x3c126e['PWEUk'],'workos-token':_0x827549}});if(!_0x206c41['ok']){const _0x54d085=await _0x206c41[_0x1d8749(0x107)]();throw new Error(_0x1d8749(0x110)+_0x206c41[_0x1d8749(0x144)]+'\x20'+_0x54d085);}return _0x206c41['json']();}async function fetchMyMemberships(_0xda3e36){const _0x5e8f89=_0x3255f1,_0x3440a8={'Ikskc':function(_0x24bf44){return _0x24bf44();},'kirOb':function(_0x4b2ace,_0x339568,_0x162dad){return _0x4b2ace(_0x339568,_0x162dad);}},_0x53a3e3=_0x3440a8[_0x5e8f89(0x108)](getApiBaseUrl),_0x591474=await _0x3440a8[_0x5e8f89(0x13d)](fetch,_0x53a3e3+_0x5e8f89(0x118),{'method':'GET','headers':{'workos-token':_0xda3e36}});if(!_0x591474['ok']){const _0x322e6e=await _0x591474['text']();throw new Error(_0x5e8f89(0x128)+_0x591474['status']+'\x20'+_0x322e6e);}const _0x444b91=await _0x591474[_0x5e8f89(0x12e)]();return _0x444b91[_0x5e8f89(0xf8)];}async function refreshTokenWithOrg(_0x22c451,_0xb60820,_0xb702a7){const _0x5b8607=_0x3255f1,_0x48b1a1={'dgHbF':function(_0x3ea3a2,_0x40e207,_0x401854){return _0x3ea3a2(_0x40e207,_0x401854);},'TaSUs':_0x5b8607(0x116),'gBEbR':_0x5b8607(0x142)},_0x4de1ea=await _0x48b1a1[_0x5b8607(0x131)](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x48b1a1['TaSUs']},'body':new URLSearchParams({'client_id':_0x22c451,'grant_type':_0x48b1a1['gBEbR'],'refresh_token':_0xb60820,'organization_id':_0xb702a7})});if(!_0x4de1ea['ok']){const _0x5c9e92=await _0x4de1ea[_0x5b8607(0x107)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x4de1ea[_0x5b8607(0x144)]+'\x20'+_0x5c9e92);}return _0x4de1ea[_0x5b8607(0x12e)]();}async function provisionCliToken(_0x2ebee0){const _0x5e0942=_0x3255f1,_0x3337d4={'FdpOt':_0x5e0942(0x10b)},_0x4b15b0=getApiBaseUrl(),_0x2c9531=await fetch(_0x4b15b0+_0x5e0942(0x106),{'method':'POST','headers':{'Content-Type':_0x3337d4[_0x5e0942(0x111)],'workos-token':_0x2ebee0}});if(!_0x2c9531['ok']){const _0x137aa8=await _0x2c9531[_0x5e0942(0x107)]();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x2c9531[_0x5e0942(0x144)]+'\x20'+_0x137aa8);}return _0x2c9531['json']();}export async function runDeviceAuthFlow(){const _0x1b5455=_0x3255f1,_0x3d5d9e={'RapSn':function(_0x197be6,_0x527750){return _0x197be6(_0x527750);},'fIIHq':'\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','dViPv':_0x1b5455(0x10c),'wXHEU':function(_0x418ae1,_0x273044,_0x164477,_0x276ab1,_0x37d276){return _0x418ae1(_0x273044,_0x164477,_0x276ab1,_0x37d276);},'jiZaU':function(_0x26efab,_0x924c03){return _0x26efab===_0x924c03;},'tGuKD':_0x1b5455(0x11b),'fsJMR':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','dulbk':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','Qszyd':_0x1b5455(0xfb),'KqGKv':function(_0x717478,_0x4d9d93,_0x6e2f5f,_0x4a22a3){return _0x717478(_0x4d9d93,_0x6e2f5f,_0x4a22a3);},'LwNFl':function(_0x1f6048,_0x5c9711){return _0x1f6048(_0x5c9711);}},_0x292fc1=getCurrentEnvironment(),_0x57e5b6=ENVIRONMENT_CONFIGS[_0x292fc1][_0x1b5455(0x12a)],_0x1cf76b=await _0x3d5d9e[_0x1b5455(0x134)](requestDeviceCode,_0x57e5b6);console['log'](_0x1b5455(0x13b)),console['log'](_0x3d5d9e[_0x1b5455(0x120)]),_0x3d5d9e['RapSn'](openBrowser,_0x1cf76b['verification_uri_complete']),console['log']('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x1cf76b['verification_uri_complete']),console[_0x1b5455(0x10e)](_0x1b5455(0xf4)+_0x1cf76b['user_code']+'\x0a'),process['stdout']['write'](_0x3d5d9e[_0x1b5455(0x149)]);let _0x3de616=await _0x3d5d9e['wXHEU'](pollForTokens,_0x57e5b6,_0x1cf76b[_0x1b5455(0x117)],_0x1cf76b[_0x1b5455(0x12d)],_0x1cf76b[_0x1b5455(0x148)]);console['log']('\x20✓');const _0x4dc3ac=decodeJwtPayload(_0x3de616[_0x1b5455(0x145)]);if(!_0x4dc3ac['org_id']){const _0x1c7e5f=await _0x3d5d9e['RapSn'](fetchMyMemberships,_0x3de616['access_token']);let _0x498a41;if(_0x3d5d9e['jiZaU'](_0x1c7e5f[_0x1b5455(0x143)],0x0)){process[_0x1b5455(0x136)][_0x1b5455(0x125)](_0x3d5d9e[_0x1b5455(0xf6)]);const _0x54eb89=await selfServeSignup(_0x3de616[_0x1b5455(0x145)]);_0x498a41=_0x54eb89[_0x1b5455(0x12c)],console[_0x1b5455(0x10e)]('\x20✓');}else{if(_0x1c7e5f[_0x1b5455(0x143)]===0x1)_0x498a41=_0x1c7e5f[0x0]['organizationId'],console[_0x1b5455(0x10e)](_0x1b5455(0x112)+_0x1c7e5f[0x0]['name']);else{const _0x5befba=process['stdin']['isTTY']&&process['stdout']['isTTY'];if(!_0x5befba)throw new Error(_0x3d5d9e[_0x1b5455(0x141)]+_0x3d5d9e[_0x1b5455(0x132)]);const {selected:_0x5ab4a3}=await _0x384df5['prompt']([{'type':_0x3d5d9e['Qszyd'],'name':_0x1b5455(0x133),'message':_0x1b5455(0x10f),'choices':_0x1c7e5f['map'](_0x43ce13=>({'name':_0x43ce13[_0x1b5455(0x119)],'value':_0x43ce13[_0x1b5455(0x12c)]}))}]);_0x498a41=_0x5ab4a3;}}_0x3de616=await _0x3d5d9e['KqGKv'](refreshTokenWithOrg,_0x57e5b6,_0x3de616[_0x1b5455(0x142)],_0x498a41);}process[_0x1b5455(0x136)][_0x1b5455(0x125)]('Provisioning\x20CLI\x20token...');const _0x4550ff=await provisionCliToken(_0x3de616['access_token']);return console['log']('\x20✓'),await storeToken(_0x4550ff['token']),_0x3de616[_0x1b5455(0x142)]&&await _0x3d5d9e['LwNFl'](storeRefreshToken,_0x3de616[_0x1b5455(0x142)]),_0x4550ff['token'];}function sleep(_0x5dbe9c){return new Promise(_0x38d0af=>setTimeout(_0x38d0af,_0x5dbe9c));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function _0xa790(_0x346e54,_0x709af){_0x346e54=_0x346e54-0x176;const _0x355622=_0x3556();let _0xa7907d=_0x355622[_0x346e54];return _0xa7907d;}const _0x4c178a=_0xa790;function _0x3556(){const _0x234b97=['mOmEu','EqvMQ','client_01J9CBYM2DKWV9HM17D95Z540K','xxruY','find','error','RANGER_CLI_ENV','2636860WdYUJA','https://api.staging.ranger.net','nova-act-cli','toLowerCase','BmTFg','114WAOqrt','CCMJp','staging','114SlISLZ','Invalid\x20RANGER_TRANSPORT=\x22','277434QNesde','client_01J9CBYM7M5ZETCF7G6614DXR2','4475XZdyvx','https://ai-proxy-301751771437.us-central1.run.app','16426ctbqIe','211099kpSPxB','mcp','rangerwright-cli','FpJVw','RANGER_MCP_AUTH_URL','vWxly','prod','104VCbsGy','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.','330850YybTmW','RANGER_TRANSPORT','https://ai-proxy-716115358910.us-central1.run.app','ZkuJN','RANGER_USE_NOVA_ACT','10908425lcVUDa','true','auto','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','env','2936Fwjiuf','local','off'];_0x3556=function(){return _0x234b97;};return _0x3556();}(function(_0x57d3ba,_0x4d365b){const _0x3f280f=_0xa790,_0x4939a5=_0x57d3ba();while(!![]){try{const _0x5595f6=-parseInt(_0x3f280f(0x188))/0x1+parseInt(_0x3f280f(0x17e))/0x2*(parseInt(_0x3f280f(0x178))/0x3)+parseInt(_0x3f280f(0x192))/0x4*(parseInt(_0x3f280f(0x17c))/0x5)+parseInt(_0x3f280f(0x1a1))/0x6*(-parseInt(_0x3f280f(0x17f))/0x7)+parseInt(_0x3f280f(0x186))/0x8*(-parseInt(_0x3f280f(0x17a))/0x9)+-parseInt(_0x3f280f(0x19c))/0xa+parseInt(_0x3f280f(0x18d))/0xb;if(_0x5595f6===_0x4d365b)break;else _0x4939a5['push'](_0x4939a5['shift']());}catch(_0x2452f8){_0x4939a5['push'](_0x4939a5['shift']());}}}(_0x3556,0x5fcfa));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':_0x4c178a(0x17b),'aiProxyUrl':_0x4c178a(0x18a),'mcpAuthUrl':'https://mcp-auth.ranger.net/mcp'},'staging':{'apiBaseUrl':_0x4c178a(0x19d),'workosClientId':_0x4c178a(0x197),'aiProxyUrl':_0x4c178a(0x17d),'mcpAuthUrl':'https://mcp-auth.staging.ranger.net/mcp'},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':_0x4c178a(0x197),'aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT=_0x4c178a(0x185);export function isValidEnvironment(_0x42891c){const _0x2454bd=_0x4c178a,_0x31dda3={'ZkuJN':'prod','vWxly':_0x2454bd(0x177),'hWsAU':function(_0x12a331,_0x5e0d42){return _0x12a331===_0x5e0d42;}};return _0x42891c===_0x31dda3[_0x2454bd(0x18b)]||_0x42891c===_0x31dda3[_0x2454bd(0x184)]||_0x31dda3['hWsAU'](_0x42891c,_0x2454bd(0x193));}export function getCurrentEnvironment(){const _0x3b25c6=_0x4c178a,_0x12f952={'vBXGl':function(_0x4586d3,_0x750025){return _0x4586d3(_0x750025);}},_0x254f4f=process[_0x3b25c6(0x191)][_0x3b25c6(0x19b)];if(_0x254f4f&&_0x12f952['vBXGl'](isValidEnvironment,_0x254f4f))return _0x254f4f;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['apiBaseUrl'];}export function getAiProxyUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x25c946=_0x4c178a,_0x3f61a5={'BmTFg':function(_0x35054d){return _0x35054d();}};return process[_0x25c946(0x191)][_0x25c946(0x183)]??ENVIRONMENT_CONFIGS[_0x3f61a5[_0x25c946(0x1a0)](getCurrentEnvironment)]['mcpAuthUrl'];}export function isByokEnabled(){const _0x5e0985=_0x4c178a,_0x5d54cb={'bfmDm':_0x5e0985(0x18e)};return process['env']['RANGER_BYOK']===_0x5d54cb['bfmDm'];}function isVerificationTransport(_0x5dea5e){const _0x1120a9=_0x4c178a,_0xd3bc7={'QTKaA':function(_0xd310d,_0x16363a){return _0xd310d===_0x16363a;},'FpJVw':_0x1120a9(0x180),'TgpuJ':function(_0x1aa89f,_0x54f89f){return _0x1aa89f===_0x54f89f;},'CCMJp':'playwright-cli','EqvMQ':_0x1120a9(0x181)};return _0xd3bc7['QTKaA'](_0x5dea5e,_0xd3bc7[_0x1120a9(0x182)])||_0xd3bc7['TgpuJ'](_0x5dea5e,_0xd3bc7[_0x1120a9(0x176)])||_0x5dea5e===_0x1120a9(0x19e)||_0x5dea5e===_0xd3bc7[_0x1120a9(0x196)];}const LEGACY_TRANSPORT_ENV_VARS=[_0x4c178a(0x18c),'RANGER_DISABLE_MCP'];export function getVerificationTransport(){const _0x2842f0=_0x4c178a,_0x1d2fad={'CAXzS':function(_0x142fa5,_0x7df511){return _0x142fa5(_0x7df511);}},_0xe0c68a=process['env'][_0x2842f0(0x189)]?.['trim']();if(_0xe0c68a){if(_0x1d2fad['CAXzS'](isVerificationTransport,_0xe0c68a))return _0xe0c68a;throw new Error(_0x2842f0(0x179)+_0xe0c68a+_0x2842f0(0x190));}const _0x145823=LEGACY_TRANSPORT_ENV_VARS[_0x2842f0(0x199)](_0xa69b0=>process['env'][_0xa69b0]);if(_0x145823)throw new Error(_0x145823+'\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.');return'mcp';}export function resolveHookMode(_0x14f596=process[_0x4c178a(0x191)]){const _0x49e19e=_0x4c178a,_0x348d20={'xxruY':_0x49e19e(0x18f),'RXggP':_0x49e19e(0x194),'mOmEu':function(_0x5292a7,_0x39cd83){return _0x5292a7===_0x39cd83;},'wCfcG':function(_0x1afbe5,_0x4320df){return _0x1afbe5===_0x4320df;}},_0x5076db=_0x14f596['RANGER_HOOKS']?.['trim']()[_0x49e19e(0x19f)]();if(!_0x5076db)return _0x348d20[_0x49e19e(0x198)];if(_0x5076db===_0x348d20['RXggP']||_0x348d20[_0x49e19e(0x195)](_0x5076db,'on')||_0x348d20['wCfcG'](_0x5076db,_0x348d20['xxruY']))return _0x5076db;return console[_0x49e19e(0x19a)]('[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22'+_0x14f596['RANGER_HOOKS']+'\x22.\x20'+_0x49e19e(0x187)),_0x348d20['xxruY'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x1c22bd,_0x30722b){const _0x37a3bd=_0x1a9a,_0x589e1e=_0x1c22bd();while(!![]){try{const _0xd55e7d=parseInt(_0x37a3bd(0xb5))/0x1+parseInt(_0x37a3bd(0xd2))/0x2+-parseInt(_0x37a3bd(0xdc))/0x3+-parseInt(_0x37a3bd(0xe1))/0x4+parseInt(_0x37a3bd(0xb6))/0x5+parseInt(_0x37a3bd(0xb8))/0x6+parseInt(_0x37a3bd(0xd9))/0x7;if(_0xd55e7d===_0x30722b)break;else _0x589e1e['push'](_0x589e1e['shift']());}catch(_0x24bc5f){_0x589e1e['push'](_0x589e1e['shift']());}}}(_0x1132,0x98c8a));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x16f2dd){const _0x2c4447=_0x1a9a,_0x4423f3={'kDnuv':function(_0x150681){return _0x150681();},'LXaFU':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','LEdSF':'POST','puvIS':function(_0x31308e,_0x48499f){return _0x31308e===_0x48499f;},'gKUsP':'https://dashboard.ranger.net/billing','uICWs':'Feature\x20limit\x20exceeded'},_0x2ba699=await _0x4423f3['kDnuv'](getToken);if(!_0x2ba699)throw new Error(_0x4423f3[_0x2c4447(0xb1)]);const _0x4f799d=getApiBaseUrl(),_0x67dd26=await fetch(_0x4f799d+_0x2c4447(0xd4),{'method':_0x4423f3['LEdSF'],'headers':{'Authorization':'Bearer\x20'+_0x2ba699,'Content-Type':'application/json'},'body':JSON[_0x2c4447(0xb9)](_0x16f2dd)});if(!_0x67dd26['ok']){if(_0x4423f3['puvIS'](_0x67dd26['status'],0x192)){const _0x3b82e5=await _0x67dd26[_0x2c4447(0xd6)](),_0x10eaf0=_0x3b82e5['billingUrl']||_0x4423f3['gKUsP'];throw new Error((_0x3b82e5[_0x2c4447(0xd5)]||_0x4423f3[_0x2c4447(0xce)])+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x10eaf0);}const _0x117cd9=await _0x67dd26['text']();throw new Error(_0x2c4447(0xe8)+_0x117cd9);}return _0x67dd26[_0x2c4447(0xd6)]();}export async function listFeatures(_0x29897b){const _0x2c2aee=_0x1a9a,_0x53fd6f={'pCjbn':function(_0x16c8e2){return _0x16c8e2();},'ApaNQ':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','AOtZM':'gitBranch','LgPbw':'offset','ghqjS':function(_0x3f1192,_0x4414cd,_0x43f5c7){return _0x3f1192(_0x4414cd,_0x43f5c7);},'NZGii':_0x2c2aee(0xd1)},_0x2065c5=await _0x53fd6f[_0x2c2aee(0xea)](getToken);if(!_0x2065c5)throw new Error(_0x53fd6f[_0x2c2aee(0xb7)]);const _0x37322c=_0x53fd6f['pCjbn'](getApiBaseUrl),_0x56d9f2=new URLSearchParams();if(_0x29897b?.[_0x2c2aee(0xe0)])_0x56d9f2[_0x2c2aee(0xbe)]('gitRepoUrl',_0x29897b[_0x2c2aee(0xe0)]);if(_0x29897b?.[_0x2c2aee(0xe7)])_0x56d9f2['set'](_0x53fd6f[_0x2c2aee(0xdd)],_0x29897b['gitBranch']);if(_0x29897b?.['limit'])_0x56d9f2[_0x2c2aee(0xbe)]('limit',_0x29897b[_0x2c2aee(0xe5)]['toString']());if(_0x29897b?.[_0x2c2aee(0xc0)])_0x56d9f2[_0x2c2aee(0xbe)](_0x53fd6f['LgPbw'],_0x29897b['offset'][_0x2c2aee(0xec)]());if(_0x29897b?.[_0x2c2aee(0xd0)])_0x56d9f2[_0x2c2aee(0xbe)](_0x2c2aee(0xd0),_0x2c2aee(0xed));const _0x2f737c=_0x37322c+_0x2c2aee(0xd4)+(_0x56d9f2['toString']()?'?'+_0x56d9f2['toString']():''),_0x1b6453=await _0x53fd6f['ghqjS'](fetch,_0x2f737c,{'method':_0x53fd6f[_0x2c2aee(0xe6)],'headers':{'Authorization':_0x2c2aee(0xf2)+_0x2065c5}});if(!_0x1b6453['ok']){const _0x2264af=await _0x1b6453['text']();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x2264af);}return _0x1b6453[_0x2c2aee(0xd6)]();}export async function getFeature(_0x3a7b3c){const _0x3e10ff=_0x1a9a,_0x572e08={'YzSQu':function(_0x42aa77){return _0x42aa77();},'PdtNM':_0x3e10ff(0xd1)},_0x4cf469=await getToken();if(!_0x4cf469)throw new Error(_0x3e10ff(0xdf));const _0x1aca1e=_0x572e08[_0x3e10ff(0xd3)](getApiBaseUrl),_0x5ada41=await fetch(_0x1aca1e+'/api/v1/mcp/features/'+_0x3a7b3c,{'method':_0x572e08['PdtNM'],'headers':{'Authorization':'Bearer\x20'+_0x4cf469}});if(!_0x5ada41['ok']){const _0x27662f=await _0x5ada41['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x27662f);}return _0x5ada41['json']();}export async function updateFeature(_0x366603,_0x9fbcc){const _0x2182dc=_0x1a9a,_0x1397c6={'VhTag':_0x2182dc(0xdf),'KIPjj':function(_0x291071){return _0x291071();},'pzBvt':function(_0x190ffd,_0x2427cd,_0x3c081c){return _0x190ffd(_0x2427cd,_0x3c081c);},'RYYdu':'PATCH','NguxB':_0x2182dc(0xc8)},_0x214d9f=await getToken();if(!_0x214d9f)throw new Error(_0x1397c6['VhTag']);const _0x3a5698=_0x1397c6[_0x2182dc(0xca)](getApiBaseUrl),_0x2a6a5f=await _0x1397c6[_0x2182dc(0xb3)](fetch,_0x3a5698+_0x2182dc(0xb2)+_0x366603,{'method':_0x1397c6['RYYdu'],'headers':{'Authorization':'Bearer\x20'+_0x214d9f,'Content-Type':_0x1397c6['NguxB']},'body':JSON['stringify'](_0x9fbcc)});if(!_0x2a6a5f['ok']){const _0x45bdf9=await _0x2a6a5f['text']();throw new Error(_0x2182dc(0xcf)+_0x45bdf9);}return _0x2a6a5f['json']();}export async function createChecklistItem(_0x519027,_0x39a6e9,_0x47f36a){const _0x1dd747=_0x1a9a,_0x4063bb={'iUcnt':function(_0x24e5ce){return _0x24e5ce();},'cdLtK':function(_0x3bae45,_0x44fbe0,_0x42c688){return _0x3bae45(_0x44fbe0,_0x42c688);},'GkCnF':_0x1dd747(0xc9)},_0x47ea77=await getToken();if(!_0x47ea77)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x542806=_0x4063bb['iUcnt'](getApiBaseUrl),_0x517699=await _0x4063bb['cdLtK'](fetch,_0x542806+_0x1dd747(0xb2)+_0x519027+_0x1dd747(0xc6),{'method':_0x4063bb['GkCnF'],'headers':{'Authorization':'Bearer\x20'+_0x47ea77,'Content-Type':_0x1dd747(0xc8)},'body':JSON[_0x1dd747(0xb9)]({'description':_0x39a6e9,'position':_0x47f36a})});if(!_0x517699['ok']){const _0x35645a=await _0x517699[_0x1dd747(0xf0)]();throw new Error(_0x1dd747(0xdb)+_0x35645a);}return _0x517699['json']();}function _0x1132(){const _0x14c098=['/checklist','sessionId','application/json','POST','KIPjj','/report','PXbin','FHJri','uICWs','Failed\x20to\x20update\x20feature\x20review:\x20','includeDeleted','GET','606638boncFo','YzSQu','/api/v1/mcp/features','message','json','OLGtr','Failed\x20to\x20update\x20scenario:\x20','3608402wnfZbY','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','Failed\x20to\x20create\x20scenario:\x20','899634UzZGAA','AOtZM','Failed\x20to\x20get\x20item\x20feedback:\x20','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','gitRepoUrl','4421160EHqeTT','/feedback','aFudQ','UgQOb','limit','NZGii','gitBranch','Failed\x20to\x20create\x20feature\x20review:\x20','WGxBg','pCjbn','/sessions','toString','true','/sessions/','bPprx','text','Owhwx','Bearer\x20','itemIds','LXaFU','/api/v1/mcp/features/','pzBvt','Failed\x20to\x20start\x20session:\x20','80076wiZMBJ','5399225GFscbP','ApaNQ','313464spcPrZ','stringify','length','ZMohD','EElbp','/report/markdown','set','PmjMU','offset','CEeOW','/conclude','TkjWd','/restore','jJXBj'];_0x1132=function(){return _0x14c098;};return _0x1132();}export async function updateChecklistItem(_0x363332,_0x58bd69,_0x5659a4){const _0x3278dc={'aFudQ':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','WGxBg':'application/json'};return withRetry(async()=>{const _0x122510=_0x1a9a,_0x42d43d=await getToken();if(!_0x42d43d)throw new Error(_0x3278dc[_0x122510(0xe3)]);const _0x1c6fda=getApiBaseUrl(),_0x47d54e=await fetch(_0x1c6fda+'/api/v1/mcp/features/'+_0x363332+'/checklist/'+_0x58bd69,{'method':'PATCH','headers':{'Authorization':_0x122510(0xf2)+_0x42d43d,'Content-Type':_0x3278dc[_0x122510(0xe9)]},'body':JSON['stringify'](_0x5659a4)});if(!_0x47d54e['ok']){const _0x154db=await _0x47d54e['text']();throw new Error(_0x122510(0xd8)+_0x154db);}return _0x47d54e[_0x122510(0xd6)]();},{'label':'updateChecklistItem'});}export async function getFeatureReport(_0x5161a6){const _0x213cdc=_0x1a9a,_0x22cf23={'RbuAH':function(_0xd7a93){return _0xd7a93();},'jJXBj':function(_0x5c0e18,_0x47c1c0,_0x3a584b){return _0x5c0e18(_0x47c1c0,_0x3a584b);}},_0x40ecde=await _0x22cf23['RbuAH'](getToken);if(!_0x40ecde)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x411871=getApiBaseUrl(),_0x1ad0a8=await _0x22cf23[_0x213cdc(0xc5)](fetch,_0x411871+'/api/v1/mcp/features/'+_0x5161a6+_0x213cdc(0xcb),{'method':_0x213cdc(0xd1),'headers':{'Authorization':_0x213cdc(0xf2)+_0x40ecde}});if(!_0x1ad0a8['ok']){const _0x4f0c3c=await _0x1ad0a8['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x4f0c3c);}return _0x1ad0a8[_0x213cdc(0xd6)]();}function _0x1a9a(_0x3a1a9c,_0x2b0903){_0x3a1a9c=_0x3a1a9c-0xb1;const _0x1132e2=_0x1132();let _0x1a9a69=_0x1132e2[_0x3a1a9c];return _0x1a9a69;}export async function getFeatureReportMarkdown(_0x6618b6,_0x4a4aa6){const _0x31266a=_0x1a9a,_0x17a5db={'XDQAN':function(_0x2e8865){return _0x2e8865();},'ZFCAf':_0x31266a(0xdf),'PXbin':function(_0x144b7a){return _0x144b7a();},'bPprx':function(_0x212519,_0x5dcfd7){return _0x212519>_0x5dcfd7;},'PmjMU':_0x31266a(0xf3),'BDmRe':function(_0x2afb36,_0x5ddea4){return _0x2afb36&&_0x5ddea4;},'WwlIA':function(_0x73f52e,_0x3090df,_0x3955b5){return _0x73f52e(_0x3090df,_0x3955b5);}},_0x3b1c63=await _0x17a5db['XDQAN'](getToken);if(!_0x3b1c63)throw new Error(_0x17a5db['ZFCAf']);const _0x3deb39=_0x17a5db[_0x31266a(0xcc)](getApiBaseUrl),_0x8ff13f=new URLSearchParams(),_0x14daf5=_0x17a5db[_0x31266a(0xef)](_0x4a4aa6?.['itemIds']?.[_0x31266a(0xba)]??0x0,0x0),_0x20bd85=Boolean(_0x4a4aa6?.['sessionId']);_0x14daf5&&_0x4a4aa6?.[_0x31266a(0xf3)]&&_0x8ff13f[_0x31266a(0xbe)](_0x17a5db[_0x31266a(0xbf)],_0x4a4aa6[_0x31266a(0xf3)]['join'](','));_0x20bd85&&_0x4a4aa6?.[_0x31266a(0xc7)]&&_0x8ff13f[_0x31266a(0xbe)](_0x31266a(0xc7),_0x4a4aa6[_0x31266a(0xc7)]);_0x17a5db['BDmRe'](!_0x14daf5,!_0x20bd85)&&_0x4a4aa6?.['style']&&_0x8ff13f['set']('style',_0x4a4aa6['style']);const _0x4c88f7=_0x3deb39+'/api/v1/mcp/features/'+_0x6618b6+_0x31266a(0xbd),_0x52dfc6=''+_0x4c88f7+(_0x8ff13f['toString']()?'?'+_0x8ff13f['toString']():''),_0x572a18=await _0x17a5db['WwlIA'](fetch,_0x52dfc6,{'method':_0x31266a(0xd1),'headers':{'Authorization':_0x31266a(0xf2)+_0x3b1c63}});if(!_0x572a18['ok']){const _0x3a1f10=await _0x572a18['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x3a1f10);}return _0x572a18['text']();}export async function listFeatureSessions(_0x244301){const _0x5b934b=_0x1a9a,_0x448b33={'UgQOb':function(_0x26518d){return _0x26518d();},'TkjWd':function(_0x4da942,_0x5b8edf,_0x2f7208){return _0x4da942(_0x5b8edf,_0x2f7208);},'tbPbX':_0x5b934b(0xd1)},_0x41d282=await getToken();if(!_0x41d282)throw new Error(_0x5b934b(0xdf));const _0x4c4d04=_0x448b33[_0x5b934b(0xe4)](getApiBaseUrl),_0x5bd62a=await _0x448b33[_0x5b934b(0xc3)](fetch,_0x4c4d04+'/api/v1/mcp/features/'+_0x244301+_0x5b934b(0xeb),{'method':_0x448b33['tbPbX'],'headers':{'Authorization':'Bearer\x20'+_0x41d282}});if(!_0x5bd62a['ok']){const _0x4240e0=await _0x5bd62a['text']();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x4240e0);}return _0x5bd62a[_0x5b934b(0xd6)]();}export async function startSession(_0x85d647,_0xbaa00){const _0x19d70d=_0x1a9a,_0x193fbd={'EElbp':function(_0x526da9){return _0x526da9();},'qFMJQ':function(_0x22391f){return _0x22391f();}},_0x2cf909=await _0x193fbd[_0x19d70d(0xbc)](getToken);if(!_0x2cf909)throw new Error(_0x19d70d(0xdf));const _0x2c41d5=_0x193fbd['qFMJQ'](getApiBaseUrl),_0x2ce9ab=await fetch(_0x2c41d5+'/api/v1/mcp/features/'+_0x85d647+'/sessions/'+_0xbaa00+'/start',{'method':'POST','headers':{'Authorization':_0x19d70d(0xf2)+_0x2cf909}});if(!_0x2ce9ab['ok']){const _0x30a5ff=await _0x2ce9ab['text']();throw new Error(_0x19d70d(0xb4)+_0x30a5ff);}return _0x2ce9ab[_0x19d70d(0xd6)]();}export async function concludeSession(_0x36a644,_0x147a30){const _0x14a1cd=_0x1a9a,_0x3f3580={'FHJri':_0x14a1cd(0xdf)},_0x4ab84b=await getToken();if(!_0x4ab84b)throw new Error(_0x3f3580[_0x14a1cd(0xcd)]);const _0x302c09=getApiBaseUrl(),_0x534d43=await fetch(_0x302c09+'/api/v1/mcp/features/'+_0x36a644+_0x14a1cd(0xee)+_0x147a30+_0x14a1cd(0xc2),{'method':_0x14a1cd(0xc9),'headers':{'Authorization':'Bearer\x20'+_0x4ab84b}});if(!_0x534d43['ok']){const _0x5ad6e8=await _0x534d43[_0x14a1cd(0xf0)]();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x5ad6e8);}return _0x534d43[_0x14a1cd(0xd6)]();}export async function getActionItems(_0x4c258d){const _0x12616c=_0x1a9a,_0x380a2e={'pkyuK':function(_0x429804){return _0x429804();},'CEeOW':_0x12616c(0xd1)},_0xdf3c00=await getToken();if(!_0xdf3c00)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x32b0de=_0x380a2e['pkyuK'](getApiBaseUrl),_0x500b35=await fetch(_0x32b0de+'/api/v1/mcp/features/'+_0x4c258d+'/action-items',{'method':_0x380a2e[_0x12616c(0xc1)],'headers':{'Authorization':_0x12616c(0xf2)+_0xdf3c00}});if(!_0x500b35['ok']){const _0x2feb2a=await _0x500b35['text']();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0x2feb2a);}return _0x500b35['json']();}export async function getItemFeedback(_0x4976b4,_0x2a11c1){const _0x2b2304=_0x1a9a,_0x5f12a7={'BSGlW':function(_0x3617cb){return _0x3617cb();},'sWWZT':_0x2b2304(0xdf),'NTkNh':function(_0x2b3722){return _0x2b3722();},'huMJe':function(_0x5070bb,_0x12f9de,_0x39172c){return _0x5070bb(_0x12f9de,_0x39172c);},'ZMohD':'GET'},_0x4e09d9=await _0x5f12a7['BSGlW'](getToken);if(!_0x4e09d9)throw new Error(_0x5f12a7['sWWZT']);const _0x4e9679=_0x5f12a7['NTkNh'](getApiBaseUrl),_0x3534a5=await _0x5f12a7['huMJe'](fetch,_0x4e9679+'/api/v1/mcp/features/'+_0x4976b4+'/checklist-items/'+_0x2a11c1+_0x2b2304(0xe2),{'method':_0x5f12a7[_0x2b2304(0xbb)],'headers':{'Authorization':_0x2b2304(0xf2)+_0x4e09d9}});if(!_0x3534a5['ok']){const _0x36d2cb=await _0x3534a5[_0x2b2304(0xf0)]();throw new Error(_0x2b2304(0xde)+_0x36d2cb);}return _0x3534a5['json']();}export async function markCommentsAddressed(_0x5b55a7,_0x2b0b6c,_0x401ed2){const _0x348eca=_0x1a9a,_0x40cf9e={'OLGtr':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','voNfb':function(_0x3c6247){return _0x3c6247();},'Owhwx':function(_0x2dda1,_0x4d654e,_0x4edb80){return _0x2dda1(_0x4d654e,_0x4edb80);},'skAnC':'POST','KGsGy':_0x348eca(0xc8)},_0x59f2d8=await getToken();if(!_0x59f2d8)throw new Error(_0x40cf9e[_0x348eca(0xd7)]);const _0x5667ca=_0x40cf9e['voNfb'](getApiBaseUrl),_0x23273f=await _0x40cf9e[_0x348eca(0xf1)](fetch,_0x5667ca+_0x348eca(0xb2)+_0x5b55a7+'/comments/address',{'method':_0x40cf9e['skAnC'],'headers':{'Authorization':_0x348eca(0xf2)+_0x59f2d8,'Content-Type':_0x40cf9e['KGsGy']},'body':JSON['stringify']({'checklistItemId':_0x2b0b6c,'commentIds':_0x401ed2})});if(!_0x23273f['ok']){const _0x2d4c1c=await _0x23273f[_0x348eca(0xf0)]();throw new Error(_0x348eca(0xda)+_0x2d4c1c);}}export async function softDeleteFeature(_0x23c404){const _0x94daa9=_0x1a9a,_0x42dc78={'myDgf':_0x94daa9(0xdf)},_0x45f27e=await getToken();if(!_0x45f27e)throw new Error(_0x42dc78['myDgf']);const _0x3d1ce8=getApiBaseUrl(),_0x3eb3ab=await fetch(_0x3d1ce8+_0x94daa9(0xb2)+_0x23c404,{'method':'DELETE','headers':{'Authorization':'Bearer\x20'+_0x45f27e}});if(!_0x3eb3ab['ok']){const _0x48c418=await _0x3eb3ab[_0x94daa9(0xf0)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x48c418);}}export async function restoreFeature(_0x4e72c8){const _0x2f9332=_0x1a9a,_0x5ddb6d={'kugtu':_0x2f9332(0xdf),'TMgOu':function(_0x2f2eed){return _0x2f2eed();},'mkGDX':_0x2f9332(0xc9)},_0x416002=await getToken();if(!_0x416002)throw new Error(_0x5ddb6d['kugtu']);const _0x39696f=_0x5ddb6d['TMgOu'](getApiBaseUrl),_0x4cd12f=await fetch(_0x39696f+_0x2f9332(0xb2)+_0x4e72c8+_0x2f9332(0xc4),{'method':_0x5ddb6d['mkGDX'],'headers':{'Authorization':_0x2f9332(0xf2)+_0x416002}});if(!_0x4cd12f['ok']){const _0x3eef39=await _0x4cd12f[_0x2f9332(0xf0)]();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x3eef39);}}
|
|
1
|
+
(function(_0x1b7ecf,_0x13fae1){const _0x295b9c=_0x453c,_0x38811e=_0x1b7ecf();while(!![]){try{const _0xa40586=parseInt(_0x295b9c(0x108))/0x1*(parseInt(_0x295b9c(0x149))/0x2)+parseInt(_0x295b9c(0x116))/0x3+-parseInt(_0x295b9c(0x13c))/0x4*(parseInt(_0x295b9c(0x11b))/0x5)+-parseInt(_0x295b9c(0x14b))/0x6+parseInt(_0x295b9c(0x10e))/0x7*(parseInt(_0x295b9c(0x137))/0x8)+-parseInt(_0x295b9c(0x13a))/0x9*(parseInt(_0x295b9c(0x115))/0xa)+parseInt(_0x295b9c(0x125))/0xb;if(_0xa40586===_0x13fae1)break;else _0x38811e['push'](_0x38811e['shift']());}catch(_0x3ed1fa){_0x38811e['push'](_0x38811e['shift']());}}}(_0x3d20,0xb93f8));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x19d5c6){const _0x5ab06f=_0x453c,_0x281ac4={'pXGFj':function(_0x3f8764){return _0x3f8764();},'FrgJj':function(_0x3c2d9a,_0x15c93e){return _0x3c2d9a===_0x15c93e;}},_0x1da807=await _0x281ac4['pXGFj'](getToken);if(!_0x1da807)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xf190ea=getApiBaseUrl(),_0x1d506c=await fetch(_0xf190ea+'/api/v1/mcp/features',{'method':_0x5ab06f(0x120),'headers':{'Authorization':'Bearer\x20'+_0x1da807,'Content-Type':'application/json'},'body':JSON['stringify'](_0x19d5c6)});if(!_0x1d506c['ok']){if(_0x281ac4['FrgJj'](_0x1d506c['status'],0x192)){const _0x1798e0=await _0x1d506c[_0x5ab06f(0x146)](),_0x15bcd8=_0x1798e0[_0x5ab06f(0x145)]||_0x5ab06f(0x106);throw new Error((_0x1798e0['message']||_0x5ab06f(0x10a))+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x15bcd8);}const _0x370bba=await _0x1d506c[_0x5ab06f(0x148)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x370bba);}return _0x1d506c['json']();}export async function listFeatures(_0x522080){const _0x4a8e50=_0x453c,_0x48730e={'NJaRx':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ZbyuQ':'gitRepoUrl','vkazZ':'gitBranch','Ijqcj':'offset','CDttK':_0x4a8e50(0x127),'TnIDK':'GET'},_0x34ca7a=await getToken();if(!_0x34ca7a)throw new Error(_0x48730e['NJaRx']);const _0x14cfaf=getApiBaseUrl(),_0x28f8b3=new URLSearchParams();if(_0x522080?.[_0x4a8e50(0x119)])_0x28f8b3['set'](_0x48730e[_0x4a8e50(0x13e)],_0x522080[_0x4a8e50(0x119)]);if(_0x522080?.[_0x4a8e50(0x12a)])_0x28f8b3['set'](_0x48730e['vkazZ'],_0x522080['gitBranch']);if(_0x522080?.[_0x4a8e50(0x11a)])_0x28f8b3[_0x4a8e50(0x10b)]('limit',_0x522080[_0x4a8e50(0x11a)]['toString']());if(_0x522080?.['offset'])_0x28f8b3['set'](_0x48730e['Ijqcj'],_0x522080[_0x4a8e50(0x118)]['toString']());if(_0x522080?.['includeDeleted'])_0x28f8b3['set']('includeDeleted',_0x48730e['CDttK']);const _0x19c89d=_0x14cfaf+'/api/v1/mcp/features'+(_0x28f8b3[_0x4a8e50(0x10c)]()?'?'+_0x28f8b3['toString']():''),_0x15ef86=await fetch(_0x19c89d,{'method':_0x48730e[_0x4a8e50(0x12c)],'headers':{'Authorization':'Bearer\x20'+_0x34ca7a}});if(!_0x15ef86['ok']){const _0x210e01=await _0x15ef86['text']();throw new Error(_0x4a8e50(0x142)+_0x210e01);}return _0x15ef86[_0x4a8e50(0x146)]();}export async function getFeature(_0x27a558){const _0x101074=_0x453c,_0x37130c={'MFSBj':function(_0x326c51){return _0x326c51();},'rNefc':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','VcRZA':function(_0x280ebe,_0x4180ab,_0x18ce78){return _0x280ebe(_0x4180ab,_0x18ce78);},'dmAgE':_0x101074(0x110)},_0x11c7af=await _0x37130c['MFSBj'](getToken);if(!_0x11c7af)throw new Error(_0x37130c['rNefc']);const _0x1e78c4=_0x37130c['MFSBj'](getApiBaseUrl),_0x250a8f=await _0x37130c[_0x101074(0x130)](fetch,_0x1e78c4+'/api/v1/mcp/features/'+_0x27a558,{'method':_0x37130c['dmAgE'],'headers':{'Authorization':'Bearer\x20'+_0x11c7af}});if(!_0x250a8f['ok']){const _0x3bbd34=await _0x250a8f['text']();throw new Error(_0x101074(0x133)+_0x3bbd34);}return _0x250a8f['json']();}export async function updateFeature(_0x153da1,_0x2ac258){const _0x54ea56=_0x453c,_0x22a134={'VtgIH':function(_0x74eba6){return _0x74eba6();},'ulHwt':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','kYPMK':function(_0x45744b,_0x26c597,_0x3f340b){return _0x45744b(_0x26c597,_0x3f340b);},'qdGPh':_0x54ea56(0x147)},_0x5e83ee=await _0x22a134['VtgIH'](getToken);if(!_0x5e83ee)throw new Error(_0x22a134['ulHwt']);const _0x24e575=getApiBaseUrl(),_0x556bbe=await _0x22a134['kYPMK'](fetch,_0x24e575+_0x54ea56(0x129)+_0x153da1,{'method':_0x22a134['qdGPh'],'headers':{'Authorization':_0x54ea56(0x135)+_0x5e83ee,'Content-Type':'application/json'},'body':JSON['stringify'](_0x2ac258)});if(!_0x556bbe['ok']){const _0x3c8331=await _0x556bbe[_0x54ea56(0x148)]();throw new Error(_0x54ea56(0x140)+_0x3c8331);}return _0x556bbe['json']();}export async function createChecklistItem(_0x1ece83,_0x1a060b,_0x8da945){const _0xed90fd=_0x453c,_0x1b1834={'SLWmM':function(_0x284b21){return _0x284b21();},'rdQqG':function(_0x1c9c50){return _0x1c9c50();},'iabQE':_0xed90fd(0x120),'vSqGw':_0xed90fd(0x14c)},_0x5d3c43=await _0x1b1834[_0xed90fd(0x105)](getToken);if(!_0x5d3c43)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3ffa45=_0x1b1834[_0xed90fd(0x11e)](getApiBaseUrl),_0x424a2f=await fetch(_0x3ffa45+_0xed90fd(0x129)+_0x1ece83+_0xed90fd(0x109),{'method':_0x1b1834['iabQE'],'headers':{'Authorization':'Bearer\x20'+_0x5d3c43,'Content-Type':_0x1b1834[_0xed90fd(0x11c)]},'body':JSON['stringify']({'description':_0x1a060b,'position':_0x8da945})});if(!_0x424a2f['ok']){const _0x30ba0=await _0x424a2f[_0xed90fd(0x148)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x30ba0);}return _0x424a2f[_0xed90fd(0x146)]();}export async function updateChecklistItem(_0x3d36e2,_0x35284c,_0x2aa257){const _0xef9b1e=_0x453c,_0x865f89={'DoayX':function(_0x399200){return _0x399200();},'dbtrF':function(_0x9dc3f4,_0x1fad9c,_0x43e1db){return _0x9dc3f4(_0x1fad9c,_0x43e1db);},'cYSZI':'application/json'};return _0x865f89['dbtrF'](withRetry,async()=>{const _0x39cc48=_0x453c,_0x4fa611=await getToken();if(!_0x4fa611)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x314193=_0x865f89['DoayX'](getApiBaseUrl),_0x3c369a=await _0x865f89['dbtrF'](fetch,_0x314193+'/api/v1/mcp/features/'+_0x3d36e2+_0x39cc48(0x124)+_0x35284c,{'method':'PATCH','headers':{'Authorization':_0x39cc48(0x135)+_0x4fa611,'Content-Type':_0x865f89[_0x39cc48(0x134)]},'body':JSON['stringify'](_0x2aa257)});if(!_0x3c369a['ok']){const _0x3d84fd=await _0x3c369a['text']();throw new Error(_0x39cc48(0x13d)+_0x3d84fd);}return _0x3c369a['json']();},{'label':_0xef9b1e(0x113)});}export async function getFeatureReport(_0x368109){const _0x90432e=_0x453c,_0x431bde=await getToken();if(!_0x431bde)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2240a3=getApiBaseUrl(),_0xcc615=await fetch(_0x2240a3+'/api/v1/mcp/features/'+_0x368109+_0x90432e(0x122),{'method':'GET','headers':{'Authorization':_0x90432e(0x135)+_0x431bde}});if(!_0xcc615['ok']){const _0x4b7309=await _0xcc615[_0x90432e(0x148)]();throw new Error(_0x90432e(0x112)+_0x4b7309);}return _0xcc615['json']();}export async function getFeatureReportMarkdown(_0x1ee020,_0x147a86){const _0x15f229=_0x453c,_0x15389a={'ThCfh':function(_0x343404){return _0x343404();},'AWNxd':function(_0x2ad5a3){return _0x2ad5a3();},'OKlmQ':function(_0x370af9,_0x27faf4){return _0x370af9(_0x27faf4);},'HzmjF':_0x15f229(0x11d),'RehIi':function(_0x414a73,_0x373239){return _0x414a73&&_0x373239;},'kbYgA':'style','WSGUm':_0x15f229(0x110)},_0x380d82=await _0x15389a['ThCfh'](getToken);if(!_0x380d82)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x369b85=_0x15389a[_0x15f229(0x131)](getApiBaseUrl),_0x566e4f=new URLSearchParams(),_0x3530d9=(_0x147a86?.['itemIds']?.['length']??0x0)>0x0,_0xb380d7=_0x15389a[_0x15f229(0x12d)](Boolean,_0x147a86?.[_0x15f229(0x12b)]);_0x3530d9&&_0x147a86?.[_0x15f229(0x11d)]&&_0x566e4f[_0x15f229(0x10b)](_0x15389a['HzmjF'],_0x147a86[_0x15f229(0x11d)]['join'](','));_0xb380d7&&_0x147a86?.[_0x15f229(0x12b)]&&_0x566e4f['set'](_0x15f229(0x12b),_0x147a86[_0x15f229(0x12b)]);_0x15389a[_0x15f229(0x141)](!_0x3530d9,!_0xb380d7)&&_0x147a86?.[_0x15f229(0x128)]&&_0x566e4f[_0x15f229(0x10b)](_0x15389a[_0x15f229(0x107)],_0x147a86[_0x15f229(0x128)]);const _0x1a5c00=_0x369b85+'/api/v1/mcp/features/'+_0x1ee020+'/report/markdown',_0x2bb73c=''+_0x1a5c00+(_0x566e4f['toString']()?'?'+_0x566e4f[_0x15f229(0x10c)]():''),_0x279248=await fetch(_0x2bb73c,{'method':_0x15389a[_0x15f229(0x111)],'headers':{'Authorization':'Bearer\x20'+_0x380d82}});if(!_0x279248['ok']){const _0x1275e0=await _0x279248['text']();throw new Error(_0x15f229(0x123)+_0x1275e0);}return _0x279248[_0x15f229(0x148)]();}export async function listFeatureSessions(_0x405b60){const _0x2c4e5d=_0x453c,_0x7450d5=await getToken();if(!_0x7450d5)throw new Error(_0x2c4e5d(0x126));const _0x29f34d=getApiBaseUrl(),_0x6a6a22=await fetch(_0x29f34d+'/api/v1/mcp/features/'+_0x405b60+'/sessions',{'method':'GET','headers':{'Authorization':_0x2c4e5d(0x135)+_0x7450d5}});if(!_0x6a6a22['ok']){const _0x36c8f8=await _0x6a6a22['text']();throw new Error(_0x2c4e5d(0x10f)+_0x36c8f8);}return _0x6a6a22[_0x2c4e5d(0x146)]();}function _0x453c(_0xec537b,_0x15de4f){_0xec537b=_0xec537b-0x102;const _0x3d202d=_0x3d20();let _0x453c93=_0x3d202d[_0xec537b];return _0x453c93;}export async function startSession(_0x3c24f5,_0x7d9c4a){const _0x8623e4=_0x453c,_0xa191bd={'TnpDT':function(_0x28c96b){return _0x28c96b();},'irGsW':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','mexbt':function(_0x2914db){return _0x2914db();},'yroYe':'POST'},_0x540943=await _0xa191bd[_0x8623e4(0x12f)](getToken);if(!_0x540943)throw new Error(_0xa191bd['irGsW']);const _0x59d53b=_0xa191bd[_0x8623e4(0x14a)](getApiBaseUrl),_0x4f42b0=await fetch(_0x59d53b+'/api/v1/mcp/features/'+_0x3c24f5+_0x8623e4(0x143)+_0x7d9c4a+_0x8623e4(0x117),{'method':_0xa191bd['yroYe'],'headers':{'Authorization':'Bearer\x20'+_0x540943}});if(!_0x4f42b0['ok']){const _0x3d9604=await _0x4f42b0[_0x8623e4(0x148)]();throw new Error(_0x8623e4(0x114)+_0x3d9604);}return _0x4f42b0[_0x8623e4(0x146)]();}export async function concludeSession(_0x3eae3c,_0x569810){const _0x3d83cb=_0x453c,_0x5b5cc9={'UtzWj':function(_0x137ce4){return _0x137ce4();},'oxokH':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','CGmEW':_0x3d83cb(0x120)},_0x20a15c=await _0x5b5cc9[_0x3d83cb(0x13f)](getToken);if(!_0x20a15c)throw new Error(_0x5b5cc9[_0x3d83cb(0x13b)]);const _0x4cdd69=getApiBaseUrl(),_0x2898e5=await fetch(_0x4cdd69+_0x3d83cb(0x129)+_0x3eae3c+'/sessions/'+_0x569810+_0x3d83cb(0x121),{'method':_0x5b5cc9[_0x3d83cb(0x11f)],'headers':{'Authorization':'Bearer\x20'+_0x20a15c}});if(!_0x2898e5['ok']){const _0x52a4c3=await _0x2898e5[_0x3d83cb(0x148)]();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x52a4c3);}return _0x2898e5['json']();}export async function getActionItems(_0x60c077){const _0x581fab=_0x453c,_0x232889={'OYnGk':_0x581fab(0x126),'FezzJ':function(_0x11bd65){return _0x11bd65();},'Xwdlq':_0x581fab(0x110)},_0x254cd4=await getToken();if(!_0x254cd4)throw new Error(_0x232889[_0x581fab(0x10d)]);const _0x36cc63=_0x232889[_0x581fab(0x138)](getApiBaseUrl),_0x57bd63=await fetch(_0x36cc63+_0x581fab(0x129)+_0x60c077+_0x581fab(0x102),{'method':_0x232889[_0x581fab(0x12e)],'headers':{'Authorization':'Bearer\x20'+_0x254cd4}});if(!_0x57bd63['ok']){const _0x39d4a0=await _0x57bd63[_0x581fab(0x148)]();throw new Error(_0x581fab(0x136)+_0x39d4a0);}return _0x57bd63[_0x581fab(0x146)]();}export async function getItemFeedback(_0xcc383c,_0x22d892){const _0x17fee4=_0x453c,_0x50c99a={'rOnrN':function(_0xa5fc90){return _0xa5fc90();},'Sdqhr':'GET'},_0x4c4876=await getToken();if(!_0x4c4876)throw new Error(_0x17fee4(0x126));const _0x2e3f86=_0x50c99a['rOnrN'](getApiBaseUrl),_0x104fef=await fetch(_0x2e3f86+_0x17fee4(0x129)+_0xcc383c+'/checklist-items/'+_0x22d892+_0x17fee4(0x103),{'method':_0x50c99a[_0x17fee4(0x144)],'headers':{'Authorization':_0x17fee4(0x135)+_0x4c4876}});if(!_0x104fef['ok']){const _0x400e01=await _0x104fef[_0x17fee4(0x148)]();throw new Error(_0x17fee4(0x14e)+_0x400e01);}return _0x104fef[_0x17fee4(0x146)]();}export async function markCommentsAddressed(_0x5ccdb9,_0x4d8af6,_0x221988){const _0x4fd129=_0x453c,_0x2d9667={'uAAoY':_0x4fd129(0x126),'dqwvr':_0x4fd129(0x14c)},_0x1e2375=await getToken();if(!_0x1e2375)throw new Error(_0x2d9667[_0x4fd129(0x104)]);const _0x370ac6=getApiBaseUrl(),_0x333d7a=await fetch(_0x370ac6+_0x4fd129(0x129)+_0x5ccdb9+'/comments/address',{'method':'POST','headers':{'Authorization':_0x4fd129(0x135)+_0x1e2375,'Content-Type':_0x2d9667[_0x4fd129(0x132)]},'body':JSON['stringify']({'checklistItemId':_0x4d8af6,'commentIds':_0x221988})});if(!_0x333d7a['ok']){const _0x2d2520=await _0x333d7a['text']();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x2d2520);}}function _0x3d20(){const _0x48669d=['/conclude','/report','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','/checklist/','7692080bGzAuD','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','true','style','/api/v1/mcp/features/','gitBranch','sessionId','TnIDK','OKlmQ','Xwdlq','TnpDT','VcRZA','AWNxd','dqwvr','Failed\x20to\x20get\x20feature\x20review:\x20','cYSZI','Bearer\x20','Failed\x20to\x20get\x20action\x20items:\x20','8rIgvFB','FezzJ','/restore','27LrEBvK','oxokH','568fDKDyl','Failed\x20to\x20update\x20scenario:\x20','ZbyuQ','UtzWj','Failed\x20to\x20update\x20feature\x20review:\x20','RehIi','Failed\x20to\x20list\x20feature\x20reviews:\x20','/sessions/','Sdqhr','billingUrl','json','PATCH','text','170LxtgxQ','mexbt','2874654hrrFHb','application/json','DELETE','Failed\x20to\x20get\x20item\x20feedback:\x20','/action-items','/feedback','uAAoY','SLWmM','https://dashboard.ranger.net/billing','kbYgA','10779fOgLOj','/checklist','Feature\x20limit\x20exceeded','set','toString','OYnGk','5890178GctKTQ','Failed\x20to\x20list\x20sessions:\x20','GET','WSGUm','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','updateChecklistItem','Failed\x20to\x20start\x20session:\x20','418550tADRUt','766929rgKEiS','/start','offset','gitRepoUrl','limit','47505QuQauc','vSqGw','itemIds','rdQqG','CGmEW','POST'];_0x3d20=function(){return _0x48669d;};return _0x3d20();}export async function softDeleteFeature(_0x507fec){const _0x4943c2=_0x453c,_0x1eb7dc={'wNWBo':function(_0x532c70){return _0x532c70();}},_0x3e16a0=await getToken();if(!_0x3e16a0)throw new Error(_0x4943c2(0x126));const _0x10addb=_0x1eb7dc['wNWBo'](getApiBaseUrl),_0x27ae76=await fetch(_0x10addb+_0x4943c2(0x129)+_0x507fec,{'method':_0x4943c2(0x14d),'headers':{'Authorization':'Bearer\x20'+_0x3e16a0}});if(!_0x27ae76['ok']){const _0x32443b=await _0x27ae76['text']();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x32443b);}}export async function restoreFeature(_0x36f8fe){const _0x15f192=_0x453c,_0x32bb1b=await getToken();if(!_0x32bb1b)throw new Error(_0x15f192(0x126));const _0x47809c=getApiBaseUrl(),_0x5d1e45=await fetch(_0x47809c+'/api/v1/mcp/features/'+_0x36f8fe+_0x15f192(0x139),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x32bb1b}});if(!_0x5d1e45['ok']){const _0x44984b=await _0x5d1e45[_0x15f192(0x148)]();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x44984b);}}
|