@ranger-testing/ranger-cli 3.1.7-alpha.be2850d-64 → 3.1.7-alpha.e26cd28-63
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/actors.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/build/skills/ranger/SKILL.md +0 -8
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x4cea8c=_0xfc90;(function(_0x5cc134,_0x1ff955){const _0x32c09e=_0xfc90,_0x218dd8=_0x5cc134();while(!![]){try{const _0x4f242a=parseInt(_0x32c09e(0x28e))/0x1*(-parseInt(_0x32c09e(0x242))/0x2)+-parseInt(_0x32c09e(0x258))/0x3*(parseInt(_0x32c09e(0x22c))/0x4)+-parseInt(_0x32c09e(0x257))/0x5*(parseInt(_0x32c09e(0x245))/0x6)+-parseInt(_0x32c09e(0x256))/0x7*(parseInt(_0x32c09e(0x201))/0x8)+parseInt(_0x32c09e(0x223))/0x9+-parseInt(_0x32c09e(0x260))/0xa+parseInt(_0x32c09e(0x28f))/0xb;if(_0x4f242a===_0x1ff955)break;else _0x218dd8['push'](_0x218dd8['shift']());}catch(_0x4baa21){_0x218dd8['push'](_0x218dd8['shift']());}}}(_0xfc7c,0x3441b));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x2951a1 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(_0x3ac631){const _0x139fdf=_0xfc90;try{return new URL(_0x3ac631)['host'];}catch{return _0x139fdf(0x287);}}function errorMessageForTelemetry(_0x529e22){const _0x11cc50=_0xfc90,_0x1da9be={'bcECw':function(_0xa3980c,_0x21c571){return _0xa3980c instanceof _0x21c571;}};return _0x1da9be['bcECw'](_0x529e22,Error)?_0x529e22[_0x11cc50(0x249)]:undefined;}function trackBridgeEvent(_0x276483,_0x1918a9){const _0x336960=_0xfc90,_0x5d9014={'JSwuu':function(_0x2b2da2,_0x363d0a){return _0x2b2da2===_0x363d0a;},'dhQYa':_0x336960(0x1dd)};if(!_0x276483)return;const _0x22fe5a={'tunnelSessionId':_0x1918a9[_0x336960(0x264)],'tunnelEventType':_0x1918a9['type'],'connectionId':_0x1918a9['connectionId'],'code':_0x1918a9['code'],'reason':_0x1918a9[_0x336960(0x20e)],'error':_0x1918a9[_0x336960(0x261)],'elapsedMs':_0x1918a9['elapsedMs'],'activeLocalConnections':_0x1918a9[_0x336960(0x27d)],'pendingLocalConnections':_0x1918a9[_0x336960(0x1db)]};_0x276483[_0x336960(0x1ff)](_0x336960(0x266),_0x22fe5a),(_0x5d9014['JSwuu'](_0x1918a9['type'],'tunnel_error')||_0x5d9014[_0x336960(0x248)](_0x1918a9['type'],_0x5d9014['dhQYa']))&&void _0x276483['trackPhaseError']('tunnel_bridge',new Error(_0x1918a9[_0x336960(0x261)]??_0x1918a9[_0x336960(0x262)]),_0x22fe5a);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x3f0e0e=_0xfc90,_0xbb7816={'UDCGp':function(_0x4c70b2){return _0x4c70b2();}},_0x350f43=await _0xbb7816[_0x3f0e0e(0x23b)](getToken);if(!_0x350f43)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');return _0x350f43;}async function apiRequest(_0x97f584,_0x1454c4={}){const _0x5870fc=_0xfc90,_0x461b26={'MmbJb':function(_0x2e1328){return _0x2e1328();},'AGQdd':function(_0x11d382,_0x34c01c,_0x527c00){return _0x11d382(_0x34c01c,_0x527c00);},'rxRHi':function(_0x31cae8,_0x167777){return _0x31cae8===_0x167777;},'yimcw':function(_0x41ce13,_0x511e1b){return _0x41ce13===_0x511e1b;},'VZqSr':function(_0x2d66a5,_0x334d7b){return _0x2d66a5===_0x334d7b;}},_0x5dcac6=await _0x461b26[_0x5870fc(0x21f)](requireToken),_0x12790d=_0x461b26[_0x5870fc(0x21f)](getApiBaseUrl),_0x506603=await _0x461b26['AGQdd'](fetch,''+_0x12790d+_0x97f584,{..._0x1454c4,'headers':{'Authorization':'Bearer\x20'+_0x5dcac6,'Content-Type':'application/json',..._0x1454c4[_0x5870fc(0x215)]??{}}});if(!_0x506603['ok']){let _0x3cb4fb='',_0x44235e;try{const _0x5d0797=await _0x506603['json'](),_0x553c0f=(_0x461b26['rxRHi'](typeof _0x5d0797[_0x5870fc(0x261)],_0x5870fc(0x25a))?_0x5d0797['error']:undefined)??JSON[_0x5870fc(0x1ed)](_0x5d0797);_0x3cb4fb=_0x553c0f;_0x461b26[_0x5870fc(0x1df)](typeof _0x5d0797['test_output'],'string')&&_0x5d0797[_0x5870fc(0x277)]&&(_0x3cb4fb=_0x3cb4fb+'\x0a'+_0x5d0797['test_output']);if(_0x461b26['VZqSr'](typeof _0x5d0797['code'],'string'))_0x44235e=_0x5d0797[_0x5870fc(0x23d)];}catch{_0x3cb4fb=_0x506603[_0x5870fc(0x21d)];}throw new ApiError(_0x5870fc(0x208)+_0x97f584+_0x5870fc(0x255)+_0x506603['status']+_0x5870fc(0x213)+_0x3cb4fb,_0x506603['status'],_0x3cb4fb,_0x44235e);}if(_0x461b26['rxRHi'](_0x506603['status'],0xcc))return undefined;return _0x506603[_0x5870fc(0x1e4)]();}export class ApiError extends Error{['status'];[_0x4cea8c(0x1f4)];[_0x4cea8c(0x23d)];constructor(_0x16c922,_0x94197a,_0x16e450,_0x4cb946){const _0x57378a=_0x4cea8c,_0x2dd495={'FCNGa':_0x57378a(0x288)};super(_0x16c922),this['status']=_0x94197a,this[_0x57378a(0x1f4)]=_0x16e450,this['code']=_0x4cb946,this[_0x57378a(0x26d)]=_0x2dd495['FCNGa'];}}function _0xfc7c(){const _0x3067bb=['HFpUX','envKey','mMmkp','wsEndpoint','isArray','invalid-url','ApiError','timeout','trackPhaseError','iiCEL','/api/v1/tunnel/sessions/','\x20\x20Login\x20successful.\x20Session\x20cached.','2383OdKpsK','11470932TuUTYV','pendingLocalConnections','xiyuq','local_ws_error','\x20Available:\x20','yimcw','newPage','ihJhF','UZxsF','/api/v1/tunnel/sessions','json','Ljnde','GUyWx','force','vQIZC','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','/session','replace','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','stringify','dvcRz','forceLogin','environmentKey','naYGz','environment_key','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','detail','aMELf','aDBau','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','username','tAwBH','launch','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','toISOString','kGMZD','ciiwT','trackPhaseEnd','\x22\x20on\x20profile\x20\x22','24uUjtwH','ArRuu','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','env','true','DELETE','password','API\x20request\x20','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','\x20\x20Cloud\x20session\x20for\x20\x22','confirm','extraHTTPHeaders','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','reason','organizationId','\x20\x20Server-side\x20login\x20error:\x20','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','/api/v1/profiles/','):\x20','not_configured','headers','Kxmba','/api/v1/profiles','POST','origin','goto','/login','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','statusText','target_url','MmbJb','PrWLD','storageState','Browser\x20login\x20timed\x20out\x20before\x20completion.','412245bsZmmt','mZiVT','tunnelUrl','lhIDa','vHLJJ','toLowerCase','\x20\x20forceLogin\x20enabled\x20for\x20\x22','\x20(auth\x20env:\x20','sPHEQ','16UpQTMW','MpYTA','WzBAX','utf-8','none','tunnel_session_id','ibltA','loginInstructions','Iafir','invalidateOn','ggPti','RANGER_TEST_USERNAME','ueTxS','session_state','map','UDCGp','\x22\x20not\x20found.','code','status','\x22\x20for\x20','JvvdQ','\x20\x20Created\x20cloud\x20profile\x20\x22','2aPqpKb','auth_config','Auth\x20environment\x20\x22','6ixClwq','tunnel_login_cleanup','pwEndpoint','JSwuu','message','setupHeaders','FnJHR','rPPAM','key','userAgent','targetUrl','settings','nGCFr','environments','join','\x20\x20Auth\x20env\x20\x22','\x20failed\x20(','701211UEjdlz','39055dFRCMP','307497JdWsez','telemetry','string','VkeeE','defaultEnvironmentKey','domains','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','sessionState','1538650JHuMTW','error','type','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','sessionId','some','tunnel_bridge_event','Browser\x20login\x20timed\x20out\x20after\x20','cNCef','log','close','catch','trim','name','storageStatePath','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','tunnel','\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22','vqYJE','\x22\x20instead.','rAaaR','\x22;\x20using\x20\x22','zeoOA','test_output','\x22;\x20proceeding\x20with\x20loginInstructions.','RANGER_TUNNEL_LOGIN_HEADED','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','RmOGU','length','activeLocalConnections','tEElS','NgQwP','assertedEnv','cookies'];_0xfc7c=function(){return _0x3067bb;};return _0xfc7c();}export async function fetchCloudProfile(_0x3f364b){const _0x67890e=_0x4cea8c,_0x2ab00c={'dtCGK':function(_0x180995,_0x44c4f5){return _0x180995===_0x44c4f5;}};try{return await apiRequest(_0x67890e(0x212)+encodeURIComponent(_0x3f364b),{'signal':AbortSignal[_0x67890e(0x289)](0x3a98)});}catch(_0x2a5722){if(_0x2a5722 instanceof ApiError&&_0x2ab00c['dtCGK'](_0x2a5722['status'],0x194))return null;throw _0x2a5722;}}export async function listCloudProfiles(){const _0x4d3d32=_0x4cea8c,_0xf395ce={'rAaaR':_0x4d3d32(0x217)},_0xa137cf=await apiRequest(_0xf395ce[_0x4d3d32(0x274)]);return _0xa137cf['profiles'];}export async function deleteCloudProfile(_0x7aa921){const _0x1feeaf=_0x4cea8c,_0x5eead7={'iHReh':function(_0x44a86a,_0x53b428,_0x1e004f){return _0x44a86a(_0x53b428,_0x1e004f);},'jnmrD':function(_0x256522,_0x15ee88){return _0x256522(_0x15ee88);},'gFDkV':function(_0x37b6b9,_0x2eba13){return _0x37b6b9 instanceof _0x2eba13;},'poQDy':function(_0x413cee,_0x1ec38c){return _0x413cee===_0x1ec38c;}};try{await _0x5eead7['iHReh'](apiRequest,'/api/v1/profiles/'+_0x5eead7['jnmrD'](encodeURIComponent,_0x7aa921),{'method':_0x1feeaf(0x206)});}catch(_0x2507d4){if(_0x5eead7['gFDkV'](_0x2507d4,ApiError)&&_0x5eead7['poQDy'](_0x2507d4[_0x1feeaf(0x23e)],0x194))throw new Error('Cloud\x20profile\x20\x22'+_0x7aa921+_0x1feeaf(0x23c));throw _0x2507d4;}}export async function createCloudProfile(_0x34120d,_0x2aed79,_0x2b0abe={}){const _0x2f7f40=_0x4cea8c,_0x246d6b={'ueTxS':_0x2f7f40(0x217),'Ljnde':'POST'},_0x36670d={'name':_0x34120d};if(_0x2aed79)_0x36670d[_0x2f7f40(0x1f2)]=_0x2aed79;_0x2b0abe['settings']&&Object['keys'](_0x2b0abe['settings'])['length']>0x0&&(_0x36670d['settings']=_0x2b0abe['settings']);if(_0x2b0abe[_0x2f7f40(0x1f8)])_0x36670d[_0x2f7f40(0x1f8)]=_0x2b0abe[_0x2f7f40(0x1f8)];if(_0x2b0abe['password'])_0x36670d['password']=_0x2b0abe[_0x2f7f40(0x207)];return await apiRequest(_0x246d6b[_0x2f7f40(0x238)],{'method':_0x246d6b[_0x2f7f40(0x1e5)],'body':JSON['stringify'](_0x36670d)});}export async function uploadCloudProfileSession(_0x3bd02e,_0x26172d){const _0x5096ba=_0x4cea8c;return await apiRequest(_0x5096ba(0x212)+encodeURIComponent(_0x3bd02e)+_0x5096ba(0x1ea),{'method':'POST','body':JSON['stringify']({'session_state':_0x26172d})});}export async function saveCloudProfileCredentials(_0x416ca6,_0x160382,_0x4f4bd8){const _0x5c2881={'jOLER':function(_0xcbb137,_0x4ce9fe,_0x5b6e22){return _0xcbb137(_0x4ce9fe,_0x5b6e22);}};await _0x5c2881['jOLER'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x416ca6),{'method':'PUT','body':JSON['stringify']({'username':_0x160382,'password':_0x4f4bd8})});}function _0xfc90(_0x3012af,_0x4f1ff6){_0x3012af=_0x3012af-0x1db;const _0xfc7cf4=_0xfc7c();let _0xfc90b4=_0xfc7cf4[_0x3012af];return _0xfc90b4;}export async function fetchAuthConfig(){const _0x59e1fe=_0x4cea8c,_0x3d9e25={'iiCEL':function(_0x44d70f,_0x15ee12){return _0x44d70f(_0x15ee12);},'SqgLp':'/api/v1/profiles/auth-config','nQjQR':function(_0x83bde6,_0x4956a7){return _0x83bde6!==_0x4956a7;}};try{const _0x3e8f8f=await _0x3d9e25[_0x59e1fe(0x28b)](apiRequest,_0x3d9e25['SqgLp']);return _0x3e8f8f[_0x59e1fe(0x243)];}catch(_0xdbfd4f){return _0xdbfd4f instanceof ApiError&&_0x3d9e25['nQjQR'](_0xdbfd4f['status'],0x194)&&console['error'](_0x59e1fe(0x1ec)+_0xdbfd4f['message']),null;}}async function createTunnelSession(_0xdd90e3){const _0x3ec507=_0x4cea8c,_0x1f952b={'XnNGQ':'agent'};return await apiRequest(_0x3ec507(0x1e3),{'method':_0x3ec507(0x218),'body':JSON[_0x3ec507(0x1ed)]({'targetUrl':_0xdd90e3,'mode':_0x1f952b['XnNGQ']})});}async function deleteTunnelSession(_0x36a400){const _0x3b9d60=_0x4cea8c;await apiRequest(_0x3b9d60(0x28c)+_0x36a400,{'method':'DELETE'});}export function pickAdHocEnvKey(_0x17ae48,_0x570dea,_0x581edb){const _0x1b082b=_0x4cea8c,_0x580d12={'NgQwP':function(_0x415075,_0xfaf61c){return _0x415075+_0xfaf61c;},'dvcRz':function(_0x20117f,_0x515939,_0x389c4d){return _0x20117f(_0x515939,_0x389c4d);},'kVdIb':function(_0x3871aa,_0x15f85b){return _0x3871aa in _0x15f85b;},'GLejv':'ambiguous','ciiwT':function(_0x4b5551,_0x1d77a9){return _0x4b5551(_0x1d77a9);},'cDqEn':function(_0x112218,_0x2025d7){return _0x112218===_0x2025d7;}};if(_0x581edb){if(!_0x17ae48?.['environments']?.[_0x581edb]){const _0x5e26b7=Object['keys'](_0x17ae48?.[_0x1b082b(0x252)]??{});throw new Error(_0x580d12['NgQwP'](_0x1b082b(0x244)+_0x581edb+'\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.',_0x5e26b7[_0x1b082b(0x27c)]?_0x1b082b(0x1de)+_0x5e26b7['join'](',\x20')+'.':'\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.')+'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)');}return _0x581edb;}if(!_0x17ae48)return null;if(_0x570dea){const _0x243edd=matchAuthEnvironmentExact(_0x570dea,_0x17ae48);if(_0x243edd)return _0x243edd;const _0x5940c4=_0x580d12[_0x1b082b(0x1ee)](matchAuthEnvironmentByHost,_0x570dea,_0x17ae48);if(_0x5940c4&&_0x580d12['kVdIb'](_0x1b082b(0x24d),_0x5940c4))return console['log'](_0x1b082b(0x254)+_0x5940c4['key']+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x570dea+_0x1b082b(0x203)),_0x5940c4[_0x1b082b(0x24d)];if(_0x5940c4&&_0x580d12['GLejv']in _0x5940c4)throw new Error('Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20('+_0x5940c4['ambiguous'][_0x1b082b(0x253)](',\x20')+');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.');if(_0x580d12[_0x1b082b(0x1fe)](needsTunnel,_0x570dea))throw new Error(_0x580d12[_0x1b082b(0x27f)](_0x580d12[_0x1b082b(0x27f)]('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x570dea+'\x22.\x0a'+_0x1b082b(0x26f),'\x20\x20Options:\x0a'),'\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a')+(_0x1b082b(0x271)+_0x570dea[_0x1b082b(0x1eb)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a')+(_0x1b082b(0x211)+_0x570dea+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x17ae48[_0x1b082b(0x25c)])return _0x17ae48['defaultEnvironmentKey'];const _0x4e54df=Object['keys'](_0x17ae48[_0x1b082b(0x252)]??{});if(_0x580d12['cDqEn'](_0x4e54df['length'],0x1))return _0x4e54df[0x0];if(_0x580d12['cDqEn'](_0x4e54df[_0x1b082b(0x27c)],0x0))return null;throw new Error('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x4e54df[_0x1b082b(0x253)](',\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>`.');}export function adHocProfileName(_0xb3053f,_0x1ea701,_0x189d6b){const _0x165e09=_0x4cea8c,_0x4204c2={'ihJhF':function(_0x1547f9,_0x553de9){return _0x1547f9===_0x553de9;}};if(!_0x1ea701||_0x4204c2[_0x165e09(0x1e1)](_0x1ea701,_0x189d6b))return _0xb3053f;return _0xb3053f+':'+_0x1ea701;}export async function resolveAdHocProfile(_0x69c846={},_0x2c3808=process[_0x4cea8c(0x204)]){const _0x28856c=_0x4cea8c,_0x3fee52={'xiyuq':function(_0x5a3900,_0x139b6c,_0x1e737a,_0x5efb77){return _0x5a3900(_0x139b6c,_0x1e737a,_0x5efb77);},'cNCef':function(_0x1239de,_0x40aaa2){return _0x1239de(_0x40aaa2);},'Iafir':function(_0x1a9036,_0x59790a){return _0x1a9036&&_0x59790a;},'lyvFg':function(_0x81e982,_0x3ae988){return _0x81e982!==_0x3ae988;},'WNEie':function(_0x170ea4,_0x192aed){return _0x170ea4??_0x192aed;}},_0x44e681=_0x2c3808[_0x28856c(0x237)];if(!_0x44e681)return null;const _0x50a58f=await fetchAuthConfig(),_0x319741=pickAdHocEnvKey(_0x50a58f,_0x69c846[_0x28856c(0x24f)],_0x69c846[_0x28856c(0x283)]);let _0x51e943=_0x3fee52[_0x28856c(0x1dc)](adHocProfileName,_0x44e681,_0x319741,_0x50a58f?.['defaultEnvironmentKey']),_0x4cca7a=await _0x3fee52[_0x28856c(0x268)](fetchCloudProfile,_0x51e943);_0x3fee52[_0x28856c(0x234)](_0x4cca7a,_0x319741)&&_0x3fee52['lyvFg'](_0x4cca7a['environmentKey'],_0x319741)&&(console['log']('\x20\x20Cloud\x20profile\x20\x22'+_0x51e943+'\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22'+(_0x4cca7a['environmentKey']??_0x28856c(0x230))+_0x28856c(0x27a)+_0x319741+_0x28856c(0x275)+_0x44e681+':'+_0x319741+_0x28856c(0x273)),_0x51e943=_0x44e681+':'+_0x319741,_0x4cca7a=await fetchCloudProfile(_0x51e943));if(_0x4cca7a)return{'name':_0x4cca7a[_0x28856c(0x26d)],'profile':_0x4cca7a};const _0x38fd0c=_0x2c3808['RANGER_TEST_PASSWORD'],_0x598967=await createCloudProfile(_0x51e943,_0x3fee52['WNEie'](_0x319741,undefined),{'username':_0x44e681,'password':_0x38fd0c});return console['log'](_0x28856c(0x241)+_0x598967['name']+_0x28856c(0x23f)+_0x44e681+(_0x319741?_0x28856c(0x22a)+_0x319741+')':'')),{'name':_0x598967[_0x28856c(0x26d)],'profile':_0x598967};}export async function writeSessionToLocalCache(_0xe473ac,_0x5f4ec0,_0xa58f73,_0x1b471f,_0x4a7a7b,_0x226bad,_0x256aaf){const _0x388e47=_0x4cea8c,_0x14f7d5={'VkeeE':function(_0x513cd7,_0x19e604,_0x4cb14e){return _0x513cd7(_0x19e604,_0x4cb14e);},'lHOWU':'auth','ggPti':function(_0x5beed6,_0xe49627){return _0x5beed6>_0xe49627;}},_0x4cefec=sessionCacheHash({'orgId':_0x5f4ec0,'profileName':_0xe473ac,'effectiveBaseUrl':_0xa58f73,'setupHeaders':_0x1b471f,'invalidateOn':_0x256aaf?.['invalidateOn'],'userAgent':_0x256aaf?.['userAgent'],'clientIp':_0x256aaf?.['clientIp']}),_0x5eb415=_0x14f7d5['VkeeE'](getSessionCachePath,_0x4cefec,_0xe473ac),_0x4a836b=_0x14f7d5['VkeeE'](join,getRangerHomeDir(),_0x14f7d5['lHOWU']);!existsSync(_0x4a836b)&&await _0x14f7d5['VkeeE'](mkdir,_0x4a836b,{'recursive':!![]});const _0x2814f4={..._0x4a7a7b};_0x226bad&&_0x14f7d5[_0x388e47(0x236)](_0x226bad[_0x388e47(0x27c)],0x0)&&Array[_0x388e47(0x286)](_0x2814f4[_0x388e47(0x281)])&&(_0x2814f4[_0x388e47(0x281)]=_0x14f7d5[_0x388e47(0x25b)](duplicateCookiesForDomains,_0x2814f4['cookies'],_0x226bad));const _0x2d38f8={'cached_at':new Date()[_0x388e47(0x1fc)](),'session_state':_0x2814f4};await writeFile(_0x5eb415,JSON['stringify'](_0x2d38f8,null,0x2));const _0x1f263d=getStorageStatePath(_0x5eb415);return await _0x14f7d5['VkeeE'](writeFile,_0x1f263d,JSON[_0x388e47(0x1ed)](_0x2814f4,null,0x2)),_0x1f263d;}export async function checkLocalCache(_0x239026,_0x5172e7,_0x235e9f,_0x227bb7,_0x354ff3){const _0x1bc300=_0x4cea8c,_0x33ab58={'kGMZD':function(_0x5c5db2,_0x1c58c6){return _0x5c5db2(_0x1c58c6);},'RTSfj':function(_0x4c08e1,_0x4448dc){return _0x4c08e1(_0x4448dc);},'Kxmba':_0x1bc300(0x22f)},_0x134b17=_0x33ab58[_0x1bc300(0x1fd)](sessionCacheHash,{'orgId':_0x5172e7,'profileName':_0x239026,'effectiveBaseUrl':_0x235e9f,'setupHeaders':_0x227bb7,'invalidateOn':_0x354ff3?.['invalidateOn'],'userAgent':_0x354ff3?.['userAgent'],'clientIp':_0x354ff3?.['clientIp']}),_0x3f9666=getSessionCachePath(_0x134b17,_0x239026),_0x31636d=_0x33ab58['kGMZD'](getStorageStatePath,_0x3f9666);if(!_0x33ab58['RTSfj'](existsSync,_0x3f9666)||!existsSync(_0x31636d))return null;try{const _0x56c6c5=await readFile(_0x3f9666,_0x33ab58[_0x1bc300(0x216)]);return JSON['parse'](_0x56c6c5),{'storageStatePath':_0x31636d};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x4a728b,_0xc20d77){const _0x25572b=_0x4cea8c;if(!_0xc20d77||!_0xc20d77[_0x25572b(0x25d)]?.[_0x25572b(0x27c)])return;let _0x135f74;try{_0x135f74=new URL(_0x4a728b);}catch{return;}const _0xd91c12=[];for(const _0x3ed56a of _0xc20d77[_0x25572b(0x25d)]){try{_0xd91c12['push']({'raw':_0x3ed56a,'url':new URL(_0x3ed56a)});}catch{}}if(_0xd91c12[_0x25572b(0x27c)]===0x0)return;if(_0xd91c12[_0x25572b(0x265)](_0x3d49b6=>_0x3d49b6['url'][_0x25572b(0x219)]===_0x135f74[_0x25572b(0x219)]))return;const _0x2d2df1=_0xd91c12[_0x25572b(0x23a)](_0x2daf22=>'\x22'+_0x2daf22['raw']+'\x22')['join'](',\x20');console['log']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x2d2df1+';\x20'+('you\x27re\x20now\x20at\x20\x22'+_0x4a728b+_0x25572b(0x25e))+'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.');}export async function serverSideLogin(_0xd2f9fc,_0x30d68f){const _0x5227b9=_0x4cea8c,_0x30f4c8={'unDnE':function(_0x28c5fb,_0x5164c9){return _0x28c5fb===_0x5164c9;},'nGCFr':'not_configured'},_0x2e7c50=process[_0x5227b9(0x204)][_0x5227b9(0x237)],_0x532442=process['env']['RANGER_TEST_PASSWORD'],_0x4caa69={};if(_0x2e7c50)_0x4caa69['username']=_0x2e7c50;if(_0x532442)_0x4caa69[_0x5227b9(0x207)]=_0x532442;if(_0x30d68f?.[_0x5227b9(0x1e7)])_0x4caa69[_0x5227b9(0x1e7)]=!![];if(_0x30d68f?.[_0x5227b9(0x24f)])_0x4caa69[_0x5227b9(0x21e)]=_0x30d68f[_0x5227b9(0x24f)];if(_0x30d68f?.['env'])_0x4caa69['env']=_0x30d68f[_0x5227b9(0x204)];_0x30d68f?.[_0x5227b9(0x270)]&&(_0x4caa69[_0x5227b9(0x231)]=_0x30d68f[_0x5227b9(0x270)][_0x5227b9(0x264)],_0x4caa69['pw_endpoint']=_0x30d68f['tunnel'][_0x5227b9(0x247)]);try{return await apiRequest(_0x5227b9(0x212)+encodeURIComponent(_0xd2f9fc)+_0x5227b9(0x21b),{'method':_0x5227b9(0x218),'body':JSON['stringify'](_0x4caa69)});}catch(_0x1c43ee){if(_0x1c43ee instanceof ApiError&&_0x30f4c8['unDnE'](_0x1c43ee[_0x5227b9(0x23e)],0x190)&&_0x1c43ee['code']===_0x30f4c8[_0x5227b9(0x251)])return{'status':'not_configured','error':_0x1c43ee['detail']};throw _0x1c43ee;}}async function serverSideLoginWithOptionalTunnel(_0x27d375,_0x469297,_0x1b762e={}){const _0x4f605a=_0x4cea8c,_0x138464={'tEElS':function(_0x10dbfe,_0x29916d){return _0x10dbfe(_0x29916d);},'aDBau':function(_0x1ddf6c,_0x21042b){return _0x1ddf6c===_0x21042b;},'mZiVT':_0x4f605a(0x205),'WzBAX':function(_0x4843f5,_0x1e2141){return _0x4843f5(_0x1e2141);},'PctrE':function(_0x2f5be1){return _0x2f5be1();},'NOPhu':'tunnel_login_setup','ksqJW':'tunnel_login_request','akFec':function(_0x32b4ab,_0x343b5c,_0x15910b){return _0x32b4ab(_0x343b5c,_0x15910b);},'FnJHR':function(_0x576cd5,_0xf42887){return _0x576cd5??_0xf42887;},'UZxsF':function(_0x2feda8,_0x548039){return _0x2feda8||_0x548039;},'ttrNw':_0x4f605a(0x246)};if(!_0x138464[_0x4f605a(0x27e)](needsTunnel,_0x469297))return await serverSideLogin(_0x27d375,{'force':_0x1b762e[_0x4f605a(0x1e7)],'env':_0x1b762e['env']});let _0x4d7fda=null,_0x44ea5e=null,_0x505dcf=null,_0x2941c9=null,_0x12fb9f=![];const _0x5ebdea=process[_0x4f605a(0x204)][_0x4f605a(0x279)]?.[_0x4f605a(0x228)](),_0x305c1c=_0x138464[_0x4f605a(0x1f6)](_0x5ebdea,'1')||_0x5ebdea===_0x138464[_0x4f605a(0x224)],_0x27fb15={'profileName':_0x27d375,'targetUrlHost':_0x138464[_0x4f605a(0x22e)](targetHostForTelemetry,_0x469297),'tunnelRequired':!![],'forceLogin':Boolean(_0x1b762e[_0x4f605a(0x1e7)]),'localBrowserServerHeaded':_0x305c1c};try{_0x1b762e[_0x4f605a(0x259)]?.['trackPhaseStart']('tunnel_login_setup',_0x27fb15);_0x305c1c&&console['log']('\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...');_0x4d7fda=await launchBrowserServer({'headless':!_0x305c1c}),_0x44ea5e=await _0x138464[_0x4f605a(0x22e)](createTunnelSession,_0x469297);const _0x3105b3=await _0x138464['PctrE'](requireToken);_0x505dcf=await _0x138464['WzBAX'](createTunnelBridge,{'localWsUrl':_0x4d7fda[_0x4f605a(0x285)],'tunnelServerUrl':_0x44ea5e[_0x4f605a(0x225)],'sessionId':_0x44ea5e[_0x4f605a(0x264)],'apiKey':_0x3105b3,'onError':_0x33df94=>{_0x2941c9=_0x33df94;},'onClose':()=>{_0x2941c9??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x27d375);},'onEvent':_0x10af74=>trackBridgeEvent(_0x1b762e[_0x4f605a(0x259)],_0x10af74)}),_0x1b762e[_0x4f605a(0x259)]?.[_0x4f605a(0x1ff)](_0x138464['NOPhu'],{..._0x27fb15,'tunnelSessionId':_0x44ea5e[_0x4f605a(0x264)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x305c1c}),_0x12fb9f=!![];try{return _0x1b762e[_0x4f605a(0x259)]?.['trackPhaseStart'](_0x138464['ksqJW'],{..._0x27fb15,'tunnelSessionId':_0x44ea5e[_0x4f605a(0x264)]}),await _0x138464['akFec'](serverSideLogin,_0x27d375,{'force':_0x1b762e['force'],'targetUrl':_0x469297,'env':_0x1b762e[_0x4f605a(0x204)],'tunnel':{'sessionId':_0x44ea5e['sessionId'],'pwEndpoint':_0x44ea5e['pwEndpoint']}})['then'](_0x33e37f=>{const _0x5cf051=_0x4f605a;return _0x1b762e[_0x5cf051(0x259)]?.[_0x5cf051(0x1ff)]('tunnel_login_request',{..._0x27fb15,'tunnelSessionId':_0x44ea5e?.['sessionId'],'loginStatus':_0x33e37f[_0x5cf051(0x23e)],'hasSessionState':Boolean(_0x33e37f[_0x5cf051(0x239)]),'hasTestOutput':_0x138464[_0x5cf051(0x27e)](Boolean,_0x33e37f[_0x5cf051(0x277)]),'bridgeError':errorMessageForTelemetry(_0x2941c9)}),_0x33e37f;});}catch(_0x321f29){await _0x1b762e['telemetry']?.['trackPhaseError'](_0x138464['ksqJW'],_0x138464[_0x4f605a(0x24b)](_0x2941c9,_0x321f29),{..._0x27fb15,'tunnelSessionId':_0x44ea5e['sessionId'],'bridgeError':errorMessageForTelemetry(_0x2941c9)});throw _0x138464[_0x4f605a(0x24b)](_0x2941c9,_0x321f29);}}catch(_0x2c0fb0){!_0x12fb9f&&await _0x1b762e['telemetry']?.[_0x4f605a(0x28a)]('tunnel_login_setup',_0x2c0fb0,{..._0x27fb15,'tunnelSessionId':_0x44ea5e?.['sessionId']});throw _0x2c0fb0;}finally{if(_0x138464[_0x4f605a(0x1e2)](_0x44ea5e,_0x4d7fda)||_0x505dcf){const _0x43d860='2|0|1|3|4'['split']('|');let _0x2be9ee=0x0;while(!![]){switch(_0x43d860[_0x2be9ee++]){case'0':_0x505dcf?.['close']();continue;case'1':_0x4d7fda&&await _0x4d7fda[_0x4f605a(0x26a)]()['catch'](()=>{});continue;case'2':_0x1b762e[_0x4f605a(0x259)]?.['trackPhaseStart']('tunnel_login_cleanup',{..._0x27fb15,'tunnelSessionId':_0x44ea5e?.[_0x4f605a(0x264)]});continue;case'3':_0x44ea5e&&await deleteTunnelSession(_0x44ea5e['sessionId'])[_0x4f605a(0x26b)](()=>{});continue;case'4':_0x1b762e['telemetry']?.[_0x4f605a(0x1ff)](_0x138464['ttrNw'],{..._0x27fb15,'tunnelSessionId':_0x44ea5e?.[_0x4f605a(0x264)]});continue;}break;}}}}export async function manualBrowserLogin(_0x1387e3,_0x78298f,_0x46ab4a={}){const _0x3f0f0d=_0x4cea8c,_0x5a0405={'RmOGU':function(_0x1eea71,_0xefb866){return _0x1eea71(_0xefb866);},'PrWLD':function(_0x49e613){return _0x49e613();},'tdfSl':function(_0x3a8112,_0x2f3b17){return _0x3a8112+_0x2f3b17;},'vHLJJ':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','mhfZW':_0x3f0f0d(0x1e9),'JvvdQ':'\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','qTaQi':function(_0xf1f1a4,_0x1c9215){return _0xf1f1a4(_0x1c9215);},'tAwBH':function(_0x48cee3,_0x399ee5){return _0x48cee3&&_0x399ee5;},'vqYJE':_0x3f0f0d(0x20d),'XISlQ':function(_0x1b7c7e,_0x467628,_0x190fdc){return _0x1b7c7e(_0x467628,_0x190fdc);},'KQOjU':'POST','ZlgOc':'cli:manual-login'};if(!isInteractive())throw new Error(_0x5a0405['tdfSl'](_0x3f0f0d(0x1f3)+_0x1387e3['name']+'\x22.\x0a',_0x3f0f0d(0x209))+_0x5a0405[_0x3f0f0d(0x227)]);const _0x3c3d61=_0x78298f&&_0x78298f['domains'][_0x3f0f0d(0x27c)]>0x0?_0x78298f['domains'][0x0]:'about:blank';console[_0x3f0f0d(0x269)](_0x5a0405['mhfZW']),console[_0x3f0f0d(0x269)](_0x5a0405[_0x3f0f0d(0x240)]),await new Promise(_0x1280db=>setTimeout(_0x1280db,0x7d0));const _0xfa9dd7=await chromium[_0x3f0f0d(0x1fa)]({'headless':![]});let _0x23129c=null;try{const _0x2812db={'ignoreHTTPSErrors':!![]};_0x78298f?.[_0x3f0f0d(0x24a)]&&(_0x2812db[_0x3f0f0d(0x20c)]=_0x78298f[_0x3f0f0d(0x24a)]);const _0x48753c=await _0xfa9dd7['newContext'](_0x2812db);await _0x5a0405['qTaQi'](addProfileSetupBanner,_0x48753c);const _0x27e660=await _0x48753c[_0x3f0f0d(0x1e0)]();await _0x27e660[_0x3f0f0d(0x21a)](_0x3c3d61);let _0x354769=![];await new Promise(_0x12547d=>{const _0x2d1a4f=_0x3f0f0d,_0x58638b={'mMmkp':function(_0x557f37,_0x46c576){return _0x557f37/_0x46c576;},'HFpUX':function(_0x449895){const _0x1fc285=_0xfc90;return _0x5a0405[_0x1fc285(0x220)](_0x449895);}},_0xa4d049=setTimeout(()=>{const _0x10ed0f=_0xfc90;_0x354769=!![],console[_0x10ed0f(0x261)](_0x10ed0f(0x267)+_0x58638b[_0x10ed0f(0x284)](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x58638b[_0x10ed0f(0x282)](_0x12547d);},MANUAL_LOGIN_TIMEOUT_MS);_0x27e660['on'](_0x2d1a4f(0x26a),async()=>{const _0xb65625=_0x2d1a4f;_0x5a0405[_0xb65625(0x27b)](clearTimeout,_0xa4d049);try{const _0x46caa6=await _0x48753c[_0xb65625(0x221)]();_0x23129c=_0x46caa6;}catch{}_0x12547d();});});if(_0x5a0405[_0x3f0f0d(0x1f9)](_0x354769,!_0x23129c))throw new Error(_0x3f0f0d(0x222));}finally{await _0xfa9dd7[_0x3f0f0d(0x26a)]()['catch'](()=>{});}if(!_0x23129c)throw new Error(_0x5a0405[_0x3f0f0d(0x272)]);return _0x46ab4a['persistSessionState']!==![]&&await _0x5a0405['XISlQ'](apiRequest,'/api/v1/profiles/'+_0x5a0405['qTaQi'](encodeURIComponent,_0x1387e3[_0x3f0f0d(0x26d)])+_0x3f0f0d(0x1ea),{'method':_0x5a0405['KQOjU'],'body':JSON[_0x3f0f0d(0x1ed)]({'session_state':_0x23129c,'updated_by':_0x5a0405['ZlgOc']})}),{'sessionState':_0x23129c};}export async function promptSaveCredentials(_0x4829fd){const _0x3356e9=_0x4cea8c,_0x1d031f={'sdddY':function(_0x52da9d){return _0x52da9d();},'DpZKa':function(_0x35676b,_0x98d473,_0x546f9f){return _0x35676b(_0x98d473,_0x546f9f);}},_0x132593=process['env']['RANGER_TEST_USERNAME'],_0x6e0923=process['env']['RANGER_TEST_PASSWORD'];if(!_0x132593||!_0x6e0923)return;if(!_0x1d031f['sdddY'](isInteractive))return;const {save:_0x246377}=await _0x2951a1['prompt']([{'type':_0x3356e9(0x20b),'name':'save','message':_0x3356e9(0x1f7),'default':![]}]);if(!_0x246377)return;await _0x1d031f['DpZKa'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x4829fd),{'method':'PUT','body':JSON[_0x3356e9(0x1ed)]({'username':_0x132593,'password':_0x6e0923})}),console['log'](_0x3356e9(0x263));}export async function resolveCloudProfileSession(_0x1df0b1,_0x225c31={}){const _0x2ad0c0=_0x4cea8c,_0x261828={'SWmkn':function(_0x40eb56){return _0x40eb56();},'ArRuu':function(_0x5ebaed,_0x5b1043,_0x333909){return _0x5ebaed(_0x5b1043,_0x333909);},'vQIZC':function(_0xf2fcc8,_0x2a78cf){return _0xf2fcc8===_0x2a78cf;},'XLGli':'string','sPHEQ':function(_0x4ba1b8,_0x18d0df){return _0x4ba1b8||_0x18d0df;},'MpYTA':function(_0x490b45,_0x25ecf0){return _0x490b45(_0x25ecf0);},'lhIDa':function(_0xe5c10e,_0x38ba22,_0x5813dd,_0x5b739f,_0x29aaed,_0x425a39,_0x4283b5,_0xe83b42){return _0xe5c10e(_0x38ba22,_0x5813dd,_0x5b739f,_0x29aaed,_0x425a39,_0x4283b5,_0xe83b42);},'rPPAM':function(_0x13d77f,_0x1339fc,_0x4158d8){return _0x13d77f(_0x1339fc,_0x4158d8);},'naYGz':function(_0x480567,_0x2b914a){return _0x480567(_0x2b914a);},'GUyWx':function(_0x39760a,_0x3c0584){return _0x39760a||_0x3c0584;},'aMELf':function(_0x3cb004,_0x5dfb8a,_0x587ba2,_0x2419c3){return _0x3cb004(_0x5dfb8a,_0x587ba2,_0x2419c3);},'BbIuv':_0x2ad0c0(0x28d),'omHkP':function(_0x5ddf6a,_0x46ea87){return _0x5ddf6a&&_0x46ea87;},'ZwpKe':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','ibltA':function(_0x21b0f6){return _0x21b0f6();},'zeoOA':function(_0x591d82,_0x5e67ae){return _0x591d82+_0x5e67ae;}},_0x209b69=_0x1df0b1[_0x2ad0c0(0x250)]??{},_0x58eeef=await _0x261828['SWmkn'](fetchAuthConfig),_0x6fe77e=_0x58eeef?_0x261828[_0x2ad0c0(0x202)](resolveAuthEnvironmentLocally,_0x58eeef,_0x225c31['assertedEnv']??_0x1df0b1[_0x2ad0c0(0x1f0)]):null,_0xbf6921=_0x261828[_0x2ad0c0(0x1e8)](typeof _0x6fe77e?.['loginInstructions'],_0x261828['XLGli'])&&_0x6fe77e[_0x2ad0c0(0x233)]['trim']()?_0x6fe77e['loginInstructions']:undefined,_0x3842b1=typeof _0x209b69[_0x2ad0c0(0x233)]==='string'&&_0x209b69['loginInstructions'][_0x2ad0c0(0x26c)]()?_0x209b69[_0x2ad0c0(0x233)]:undefined,_0x82bd95=_0x261828['sPHEQ'](_0x3842b1,!_0xbf6921)?_0x209b69:{..._0x209b69,'loginInstructions':_0xbf6921},_0x43590c=Boolean(_0x82bd95[_0x2ad0c0(0x233)]?.['trim']()),_0x22f84e=_0x261828['MpYTA'](Boolean,_0x209b69['forceLogin']||_0x6fe77e?.[_0x2ad0c0(0x1ef)]),_0x376b45=_0x6fe77e?.['domains'],_0x2b37c6=_0x209b69[_0x2ad0c0(0x24a)],_0x96d1e6=_0x2b37c6??_0x6fe77e?.['setupHeaders'],_0x2afca6=_0x225c31['effectiveBaseUrl']??_0x209b69['baseUrl']??(_0x376b45&&_0x376b45['length']>0x0?_0x376b45[0x0]:''),_0xf1effd=_0x2afca6?needsTunnel(_0x2afca6):![],_0x4929a4={'invalidateOn':_0x6fe77e?.[_0x2ad0c0(0x235)],'userAgent':_0x6fe77e?.['browserOptions']?.['userAgent']??_0x209b69[_0x2ad0c0(0x24e)]};_0x22f84e&&console['log'](_0x2ad0c0(0x229)+_0x1df0b1['name']+'\x22,\x20refreshing\x20session...');if(!_0x22f84e){const _0x4398d4=await checkLocalCache(_0x1df0b1[_0x2ad0c0(0x26d)],_0x1df0b1[_0x2ad0c0(0x20f)],_0x2afca6,_0x96d1e6,_0x4929a4);if(_0x4398d4){if(_0x2afca6&&!_0xf1effd){const _0x28f32a=await isCachedSessionLive(_0x4398d4[_0x2ad0c0(0x26e)],_0x2afca6,{'sessionCheckPath':_0x6fe77e?.['sessionCheckPath'],'setupHeaders':_0x96d1e6},{'launchBrowser':launchRealBrowser});if(_0x28f32a)return console[_0x2ad0c0(0x269)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x1df0b1['name']+'\x22'),{'authPath':_0x4398d4['storageStatePath'],'settings':_0x82bd95,'resolvedEnv':_0x6fe77e};console['log']('\x20\x20Cached\x20session\x20for\x20\x22'+_0x1df0b1[_0x2ad0c0(0x26d)]+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x261828[_0x2ad0c0(0x202)](emitSessionValidationHint,_0x2afca6,_0x6fe77e);}else return _0xf1effd&&console[_0x2ad0c0(0x269)]('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x1df0b1['name']+'\x22'),{'authPath':_0x4398d4['storageStatePath'],'settings':_0x82bd95,'resolvedEnv':_0x6fe77e};}}if(!_0x22f84e&&_0x1df0b1['sessionState']){const _0xc0655d=await _0x261828[_0x2ad0c0(0x226)](writeSessionToLocalCache,_0x1df0b1[_0x2ad0c0(0x26d)],_0x1df0b1[_0x2ad0c0(0x20f)],_0x2afca6,_0x96d1e6,_0x1df0b1[_0x2ad0c0(0x25f)],_0x376b45,_0x4929a4);if(_0x2afca6){const _0x3c651a=await isCachedSessionLive(_0xc0655d,_0x2afca6,{'sessionCheckPath':_0x6fe77e?.['sessionCheckPath'],'setupHeaders':_0x96d1e6},{'launchBrowser':launchRealBrowser});if(_0x3c651a)return console['log']('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x1df0b1[_0x2ad0c0(0x26d)]+'\x22,\x20cached\x20locally'),{'authPath':_0xc0655d,'settings':_0x82bd95,'resolvedEnv':_0x6fe77e};console[_0x2ad0c0(0x269)](_0x2ad0c0(0x20a)+_0x1df0b1['name']+_0x2ad0c0(0x1fb)),_0x261828[_0x2ad0c0(0x24c)](emitSessionValidationHint,_0x2afca6,_0x6fe77e);}else return{'authPath':_0xc0655d,'settings':_0x82bd95,'resolvedEnv':_0x6fe77e};}if(_0x43590c)return console['log']('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x1df0b1[_0x2ad0c0(0x26d)]+_0x2ad0c0(0x278)),{'authPath':undefined,'settings':_0x82bd95,'resolvedEnv':_0x6fe77e};console[_0x2ad0c0(0x269)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x1df0b1['name']+'\x22,\x20attempting\x20login...');const _0x389da2=_0x261828[_0x2ad0c0(0x22d)](Boolean,process[_0x2ad0c0(0x204)][_0x2ad0c0(0x237)])&&Boolean(process['env']['RANGER_TEST_PASSWORD']),_0x5fea8e=_0x261828[_0x2ad0c0(0x1f1)](Boolean,_0x1df0b1['username']),_0x4951fb=Boolean(_0x225c31[_0x2ad0c0(0x280)]),_0x9cf730=_0x2afca6?isBareLocalhost(_0x2afca6):![],_0xe74b76=_0x261828[_0x2ad0c0(0x1e6)](_0x389da2,_0x5fea8e)&&_0x261828[_0x2ad0c0(0x22b)](!_0x9cf730,_0x4951fb);if(_0xe74b76)try{const _0x265e9a=_0x2afca6?await _0x261828[_0x2ad0c0(0x1f5)](serverSideLoginWithOptionalTunnel,_0x1df0b1['name'],_0x2afca6,{'force':_0x22f84e,'telemetry':_0x225c31['telemetry'],'env':_0x225c31['assertedEnv']}):await serverSideLogin(_0x1df0b1['name'],{'force':_0x22f84e,'env':_0x225c31['assertedEnv']});if(_0x265e9a['status']===_0x2ad0c0(0x214))console[_0x2ad0c0(0x269)](_0x2ad0c0(0x21c));else{if(_0x261828[_0x2ad0c0(0x1e8)](_0x265e9a['status'],'success')&&_0x265e9a['session_state']){console['log'](_0x261828['BbIuv']);const _0x30929f=await _0x261828['lhIDa'](writeSessionToLocalCache,_0x1df0b1['name'],_0x1df0b1['organizationId'],_0x2afca6,_0x96d1e6,_0x265e9a[_0x2ad0c0(0x239)],_0x376b45,_0x4929a4);return _0x261828['omHkP'](_0x389da2,!_0x5fea8e)&&await promptSaveCredentials(_0x1df0b1[_0x2ad0c0(0x26d)]),{'authPath':_0x30929f,'settings':_0x82bd95,'resolvedEnv':_0x6fe77e};}else _0x265e9a['test_output']&&(console[_0x2ad0c0(0x269)]('\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:'),console['log'](_0x265e9a['test_output'])),console[_0x2ad0c0(0x269)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}}catch(_0x39d8cc){console[_0x2ad0c0(0x269)](_0x2ad0c0(0x210)+(_0x39d8cc instanceof Error?_0x39d8cc['message']:String(_0x39d8cc))),console['log'](_0x261828['ZwpKe']);}if(_0x9cf730&&!_0x4951fb&&!_0x261828[_0x2ad0c0(0x232)](isInteractive))throw new Error(_0x261828[_0x2ad0c0(0x276)]('No\x20saved\x20session\x20for\x20\x22'+_0x2afca6+_0x2ad0c0(0x200)+_0x1df0b1['name']+'\x22,\x20and\x20cloud\x20sessions\x20don\x27t\x20apply\x20to\x20localhost.\x0a','\x20\x20•\x20capture\x20one\x20(a\x20browser\x20opens):\x20ranger\x20profile\x20add\x20'+_0x1df0b1[_0x2ad0c0(0x26d)]+'\x20--url\x20'+_0x2afca6+'\x0a')+'\x20\x20•\x20or\x20pass\x20--env\x20<key>\x20to\x20run\x20an\x20automated\x20login\x20for\x20this\x20target.');const _0x3e38e0=_0x6fe77e?{..._0x6fe77e,'domains':orderLoginDomains(_0x2afca6,_0x6fe77e[_0x2ad0c0(0x25d)]),'setupHeaders':_0x96d1e6}:_0x2afca6?{'key':_0x1df0b1['environmentKey']??'','domains':[_0x2afca6],'setupHeaders':_0x96d1e6}:null,{sessionState:_0x45df94}=await manualBrowserLogin(_0x1df0b1,_0x3e38e0,{'persistSessionState':!_0xf1effd}),_0x14e493=await _0x261828[_0x2ad0c0(0x226)](writeSessionToLocalCache,_0x1df0b1[_0x2ad0c0(0x26d)],_0x1df0b1['organizationId'],_0x2afca6,_0x96d1e6,_0x45df94,_0x376b45,_0x4929a4);return{'authPath':_0x14e493,'settings':_0x82bd95,'resolvedEnv':_0x6fe77e};}
|
|
1
|
+
const _0xd1edc9=_0xcfb7;(function(_0x2b8749,_0x3e6986){const _0x29407c=_0xcfb7,_0x131cbe=_0x2b8749();while(!![]){try{const _0x3f233f=-parseInt(_0x29407c(0xf8))/0x1*(parseInt(_0x29407c(0x12a))/0x2)+parseInt(_0x29407c(0x130))/0x3*(-parseInt(_0x29407c(0xfc))/0x4)+-parseInt(_0x29407c(0xe3))/0x5+parseInt(_0x29407c(0xdb))/0x6*(parseInt(_0x29407c(0xb5))/0x7)+parseInt(_0x29407c(0x116))/0x8+parseInt(_0x29407c(0x12d))/0x9+-parseInt(_0x29407c(0x156))/0xa;if(_0x3f233f===_0x3e6986)break;else _0x131cbe['push'](_0x131cbe['shift']());}catch(_0x15814d){_0x131cbe['push'](_0x131cbe['shift']());}}}(_0x4835,0xe4318));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';function _0xcfb7(_0x1b2160,_0x2be2b9){_0x1b2160=_0x1b2160-0xab;const _0x48354f=_0x4835();let _0xcfb71d=_0x48354f[_0x1b2160];return _0xcfb71d;}import _0x564955 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(_0x431efd){const _0x32f82e=_0xcfb7;try{return new URL(_0x431efd)['host'];}catch{return _0x32f82e(0x137);}}function errorMessageForTelemetry(_0x52daa5){return _0x52daa5 instanceof Error?_0x52daa5['message']:undefined;}function trackBridgeEvent(_0x413ecd,_0x411de3){const _0x149a1e=_0xcfb7,_0x2ba0f5={'hjaeH':function(_0x4e6038,_0x4e246b){return _0x4e6038===_0x4e246b;},'azayt':_0x149a1e(0xb3)};if(!_0x413ecd)return;const _0x4010c5={'tunnelSessionId':_0x411de3[_0x149a1e(0x157)],'tunnelEventType':_0x411de3['type'],'connectionId':_0x411de3[_0x149a1e(0x11d)],'code':_0x411de3['code'],'reason':_0x411de3[_0x149a1e(0xad)],'error':_0x411de3['error'],'elapsedMs':_0x411de3['elapsedMs'],'activeLocalConnections':_0x411de3['activeLocalConnections'],'pendingLocalConnections':_0x411de3[_0x149a1e(0x153)]};_0x413ecd['trackPhaseEnd']('tunnel_bridge_event',_0x4010c5),(_0x2ba0f5['hjaeH'](_0x411de3['type'],'tunnel_error')||_0x411de3['type']===_0x2ba0f5['azayt'])&&void _0x413ecd[_0x149a1e(0xca)]('tunnel_bridge',new Error(_0x411de3[_0x149a1e(0x13e)]??_0x411de3['type']),_0x4010c5);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x51362f=_0xcfb7,_0x581c97={'aZmNm':function(_0x139c2f){return _0x139c2f();},'zGbBF':_0x51362f(0xf0)},_0x185566=await _0x581c97[_0x51362f(0xf2)](getToken);if(!_0x185566)throw new Error(_0x581c97['zGbBF']);return _0x185566;}async function apiRequest(_0x28b405,_0xc5c4e={}){const _0x4f1cb4=_0xcfb7,_0x5af022={'dOfpn':function(_0x2f63f1,_0x4a45c2,_0x97dbcf){return _0x2f63f1(_0x4a45c2,_0x97dbcf);},'sxOHo':function(_0x112c7f,_0x3d7c3a){return _0x112c7f===_0x3d7c3a;},'qqTJy':'string'},_0x115d32=await requireToken(),_0x59c16e=getApiBaseUrl(),_0x2bd758=await _0x5af022[_0x4f1cb4(0xf1)](fetch,''+_0x59c16e+_0x28b405,{..._0xc5c4e,'headers':{'Authorization':_0x4f1cb4(0x136)+_0x115d32,'Content-Type':'application/json',..._0xc5c4e['headers']??{}}});if(!_0x2bd758['ok']){let _0x507c75='',_0x5a6489;try{const _0x364ac6=await _0x2bd758['json'](),_0x147984=(typeof _0x364ac6[_0x4f1cb4(0x13e)]==='string'?_0x364ac6[_0x4f1cb4(0x13e)]:undefined)??JSON['stringify'](_0x364ac6);_0x507c75=_0x147984;_0x5af022['sxOHo'](typeof _0x364ac6[_0x4f1cb4(0x14a)],_0x5af022['qqTJy'])&&_0x364ac6['test_output']&&(_0x507c75=_0x507c75+'\x0a'+_0x364ac6['test_output']);if(typeof _0x364ac6['code']===_0x4f1cb4(0xc4))_0x5a6489=_0x364ac6['code'];}catch{_0x507c75=_0x2bd758['statusText'];}throw new ApiError(_0x4f1cb4(0x105)+_0x28b405+_0x4f1cb4(0x12f)+_0x2bd758['status']+_0x4f1cb4(0x133)+_0x507c75,_0x2bd758[_0x4f1cb4(0x13b)],_0x507c75,_0x5a6489);}if(_0x2bd758[_0x4f1cb4(0x13b)]===0xcc)return undefined;return _0x2bd758[_0x4f1cb4(0xd1)]();}export class ApiError extends Error{[_0xd1edc9(0x13b)];[_0xd1edc9(0xdf)];[_0xd1edc9(0xd5)];constructor(_0x52b8c4,_0x29f610,_0x374cb8,_0x50bec4){const _0x43da38=_0xd1edc9,_0x536a48={'sszbF':'4|3|2|0|1'},_0x1f1c42=_0x536a48[_0x43da38(0xb2)]['split']('|');let _0x4cc2d1=0x0;while(!![]){switch(_0x1f1c42[_0x4cc2d1++]){case'0':this['code']=_0x50bec4;continue;case'1':this['name']=_0x43da38(0x132);continue;case'2':this[_0x43da38(0xdf)]=_0x374cb8;continue;case'3':this[_0x43da38(0x13b)]=_0x29f610;continue;case'4':super(_0x52b8c4);continue;}break;}}}export async function fetchCloudProfile(_0x39ea7f){const _0x4e81c6=_0xd1edc9,_0x63289b={'ODaZv':function(_0x53b522,_0x25b90c){return _0x53b522(_0x25b90c);},'RRGhf':function(_0x299f00,_0x3746f6){return _0x299f00 instanceof _0x3746f6;}};try{return await apiRequest(_0x4e81c6(0xf4)+_0x63289b['ODaZv'](encodeURIComponent,_0x39ea7f),{'signal':AbortSignal['timeout'](0x3a98)});}catch(_0x51e87d){if(_0x63289b['RRGhf'](_0x51e87d,ApiError)&&_0x51e87d['status']===0x194)return null;throw _0x51e87d;}}export async function listCloudProfiles(){const _0x452032=_0xd1edc9,_0x3a078e={'wWpoT':function(_0x81bf50,_0x452757){return _0x81bf50(_0x452757);},'WcdYu':_0x452032(0x12b)},_0x599dfc=await _0x3a078e['wWpoT'](apiRequest,_0x3a078e[_0x452032(0xe8)]);return _0x599dfc['profiles'];}export async function deleteCloudProfile(_0x49cf56){const _0x435c68=_0xd1edc9,_0x1a2324={'HGioQ':function(_0x5ec630,_0x2df873,_0x376ff3){return _0x5ec630(_0x2df873,_0x376ff3);},'GpGml':function(_0x3a90e5,_0x128947){return _0x3a90e5===_0x128947;}};try{await _0x1a2324['HGioQ'](apiRequest,_0x435c68(0xf4)+encodeURIComponent(_0x49cf56),{'method':'DELETE'});}catch(_0x19de35){if(_0x19de35 instanceof ApiError&&_0x1a2324[_0x435c68(0x109)](_0x19de35[_0x435c68(0x13b)],0x194))throw new Error(_0x435c68(0xc6)+_0x49cf56+_0x435c68(0xb4));throw _0x19de35;}}export async function createCloudProfile(_0x445dc0,_0x1fe974,_0x417d8a={}){const _0x28f24d=_0xd1edc9,_0x281c0b={'JyzPP':function(_0x117a56,_0x3c15ee){return _0x117a56>_0x3c15ee;},'EqUYK':_0x28f24d(0x12b)},_0x1ea3ff={'name':_0x445dc0};if(_0x1fe974)_0x1ea3ff['environment_key']=_0x1fe974;_0x417d8a['settings']&&_0x281c0b[_0x28f24d(0x14e)](Object['keys'](_0x417d8a[_0x28f24d(0x11e)])['length'],0x0)&&(_0x1ea3ff[_0x28f24d(0x11e)]=_0x417d8a['settings']);if(_0x417d8a[_0x28f24d(0x115)])_0x1ea3ff['username']=_0x417d8a['username'];if(_0x417d8a[_0x28f24d(0xc1)])_0x1ea3ff[_0x28f24d(0xc1)]=_0x417d8a[_0x28f24d(0xc1)];return await apiRequest(_0x281c0b['EqUYK'],{'method':'POST','body':JSON['stringify'](_0x1ea3ff)});}export async function uploadCloudProfileSession(_0x5c3c1e,_0x4dbb34){const _0x1069a3=_0xd1edc9,_0x2efb96={'iuErA':function(_0x2dd09c,_0x4b9337,_0x274c3e){return _0x2dd09c(_0x4b9337,_0x274c3e);},'Waldx':function(_0x1ef928,_0x43eb53){return _0x1ef928(_0x43eb53);}};return await _0x2efb96['iuErA'](apiRequest,_0x1069a3(0xf4)+_0x2efb96['Waldx'](encodeURIComponent,_0x5c3c1e)+_0x1069a3(0xc5),{'method':_0x1069a3(0xb8),'body':JSON[_0x1069a3(0xe5)]({'session_state':_0x4dbb34})});}export async function saveCloudProfileCredentials(_0x1a3fc1,_0x5ad3d2,_0x14f3a3){const _0x2d8074=_0xd1edc9,_0x1c8c77={'jHDbF':function(_0x238af2,_0x1b97bc,_0x278fbe){return _0x238af2(_0x1b97bc,_0x278fbe);}};await _0x1c8c77[_0x2d8074(0xe0)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x1a3fc1),{'method':_0x2d8074(0xf7),'body':JSON[_0x2d8074(0xe5)]({'username':_0x5ad3d2,'password':_0x14f3a3})});}export async function fetchAuthConfig(){const _0x48d005=_0xd1edc9,_0x3374be={'Cjjri':function(_0x2cb91d,_0x2ffd6c){return _0x2cb91d(_0x2ffd6c);}};try{const _0x50dead=await _0x3374be['Cjjri'](apiRequest,'/api/v1/profiles/auth-config');return _0x50dead['auth_config'];}catch(_0x5a04eb){return _0x5a04eb instanceof ApiError&&_0x5a04eb[_0x48d005(0x13b)]!==0x194&&console[_0x48d005(0x13e)]('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x5a04eb[_0x48d005(0xd3)]),null;}}async function createTunnelSession(_0x2490a2){const _0x282456=_0xd1edc9,_0x2da5f1={'UolRO':'/api/v1/tunnel/sessions','DqvmV':_0x282456(0xb8),'XPocL':'agent'};return await apiRequest(_0x2da5f1['UolRO'],{'method':_0x2da5f1[_0x282456(0xeb)],'body':JSON['stringify']({'targetUrl':_0x2490a2,'mode':_0x2da5f1['XPocL']})});}async function deleteTunnelSession(_0x50bdb2){await apiRequest('/api/v1/tunnel/sessions/'+_0x50bdb2,{'method':'DELETE'});}export function pickAdHocEnvKey(_0x21b579,_0x4f8677,_0x1dd982){const _0x5a1eee=_0xd1edc9,_0x3877bf={'PqAzZ':function(_0x869d06,_0x42c9f4){return _0x869d06+_0x42c9f4;},'KDHDp':function(_0x4c7c18,_0x175023,_0xa1b8ad){return _0x4c7c18(_0x175023,_0xa1b8ad);},'rBhQI':function(_0x4071df,_0x2d8a90,_0x3fa3be){return _0x4071df(_0x2d8a90,_0x3fa3be);},'lSzfJ':function(_0x8ee55b,_0x2521d3){return _0x8ee55b in _0x2521d3;},'TztiV':_0x5a1eee(0x107),'wdsLX':function(_0x51afc3,_0x26604e){return _0x51afc3 in _0x26604e;},'UaAyY':'ambiguous','JpNiP':function(_0x4c5488,_0x2591d5){return _0x4c5488(_0x2591d5);},'KwPea':function(_0x107f8a,_0x3b8e06){return _0x107f8a===_0x3b8e06;},'GnWDn':function(_0x23b928,_0xab1058){return _0x23b928===_0xab1058;},'BeLFA':function(_0x74f404,_0x1dddae){return _0x74f404+_0x1dddae;}};if(_0x1dd982){if(!_0x21b579?.['environments']?.[_0x1dd982]){const _0x552663=Object['keys'](_0x21b579?.['environments']??{});throw new Error(_0x3877bf['PqAzZ']('Auth\x20environment\x20\x22'+_0x1dd982+'\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.'+(_0x552663['length']?'\x20Available:\x20'+_0x552663['join'](',\x20')+'.':'\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.'),'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)'));}return _0x1dd982;}if(!_0x21b579)return null;if(_0x4f8677){const _0x26175c=_0x3877bf[_0x5a1eee(0xbb)](matchAuthEnvironmentExact,_0x4f8677,_0x21b579);if(_0x26175c)return _0x26175c;const _0xcaa131=_0x3877bf['rBhQI'](matchAuthEnvironmentByHost,_0x4f8677,_0x21b579);if(_0xcaa131&&_0x3877bf[_0x5a1eee(0x14f)](_0x3877bf[_0x5a1eee(0x129)],_0xcaa131))return console[_0x5a1eee(0x104)]('\x20\x20Auth\x20env\x20\x22'+_0xcaa131[_0x5a1eee(0x107)]+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x4f8677+_0x5a1eee(0xc3)),_0xcaa131['key'];if(_0xcaa131&&_0x3877bf[_0x5a1eee(0xd4)](_0x3877bf['UaAyY'],_0xcaa131))throw new Error(_0x5a1eee(0x149)+_0xcaa131[_0x5a1eee(0x125)]['join'](',\x20')+');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.');if(_0x3877bf['JpNiP'](needsTunnel,_0x4f8677))throw new Error(_0x3877bf['PqAzZ'](_0x5a1eee(0xbf)+_0x4f8677+'\x22.\x0a'+_0x5a1eee(0x128)+'\x20\x20Options:\x0a'+'\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a',_0x5a1eee(0xc0)+_0x4f8677['replace'](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a')+(_0x5a1eee(0x150)+_0x4f8677+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x21b579[_0x5a1eee(0x113)])return _0x21b579[_0x5a1eee(0x113)];const _0x4f7bf2=Object[_0x5a1eee(0xe9)](_0x21b579[_0x5a1eee(0xef)]??{});if(_0x3877bf['KwPea'](_0x4f7bf2[_0x5a1eee(0x10d)],0x1))return _0x4f7bf2[0x0];if(_0x3877bf['GnWDn'](_0x4f7bf2['length'],0x0))return null;throw new Error(_0x3877bf['BeLFA']('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x4f7bf2['join'](',\x20')+_0x5a1eee(0x14b),_0x5a1eee(0x144)));}export function adHocProfileName(_0x2199c4,_0xaf655c,_0x492445){const _0x5b8050={'EAgFc':function(_0x1a572,_0x27a811){return _0x1a572===_0x27a811;}};if(!_0xaf655c||_0x5b8050['EAgFc'](_0xaf655c,_0x492445))return _0x2199c4;return _0x2199c4+':'+_0xaf655c;}export async function resolveAdHocProfile(_0x11dd2d={},_0x4dbbec=process['env']){const _0x3d7651=_0xd1edc9,_0xcdb946={'arAOf':function(_0x55aa46,_0x294980,_0x451316,_0x5795e2){return _0x55aa46(_0x294980,_0x451316,_0x5795e2);},'ZigCk':function(_0x1d6f68,_0x2ca1ea){return _0x1d6f68(_0x2ca1ea);},'yiiqd':_0x3d7651(0x152)},_0x26c1da=_0x4dbbec[_0x3d7651(0x126)];if(!_0x26c1da)return null;const _0x47dc46=await fetchAuthConfig(),_0x436753=_0xcdb946['arAOf'](pickAdHocEnvKey,_0x47dc46,_0x11dd2d['targetUrl'],_0x11dd2d['envKey']);let _0x20369e=_0xcdb946['arAOf'](adHocProfileName,_0x26c1da,_0x436753,_0x47dc46?.[_0x3d7651(0x113)]),_0x14f0b2=await _0xcdb946['ZigCk'](fetchCloudProfile,_0x20369e);_0x14f0b2&&_0x436753&&_0x14f0b2[_0x3d7651(0xed)]!==_0x436753&&(console['log']('\x20\x20Cloud\x20profile\x20\x22'+_0x20369e+_0x3d7651(0x10e)+(_0x14f0b2['environmentKey']??_0xcdb946['yiiqd'])+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x436753+'\x22;\x20using\x20\x22'+_0x26c1da+':'+_0x436753+_0x3d7651(0x139)),_0x20369e=_0x26c1da+':'+_0x436753,_0x14f0b2=await _0xcdb946['ZigCk'](fetchCloudProfile,_0x20369e));if(_0x14f0b2)return{'name':_0x14f0b2[_0x3d7651(0x117)],'profile':_0x14f0b2};const _0x1a9cd4=_0x4dbbec['RANGER_TEST_PASSWORD'],_0xcc0e7e=await createCloudProfile(_0x20369e,_0x436753??undefined,{'username':_0x26c1da,'password':_0x1a9cd4});return console[_0x3d7651(0x104)](_0x3d7651(0xbc)+_0xcc0e7e[_0x3d7651(0x117)]+'\x22\x20for\x20'+_0x26c1da+(_0x436753?'\x20(auth\x20env:\x20'+_0x436753+')':'')),{'name':_0xcc0e7e[_0x3d7651(0x117)],'profile':_0xcc0e7e};}export async function writeSessionToLocalCache(_0x11deb9,_0x9ba19d,_0x452200,_0x5d6c2d,_0x3f67ea,_0x59ad37,_0x42f151){const _0x15fb79=_0xd1edc9,_0x305d56={'BRpId':function(_0x3787dc,_0x4dd38c){return _0x3787dc(_0x4dd38c);},'uHFdb':function(_0x2662cf,_0x51cc96,_0x4aadf6){return _0x2662cf(_0x51cc96,_0x4aadf6);},'ZcUEo':'auth','czTDN':function(_0xd2f782,_0x5a2da0,_0x2f6149){return _0xd2f782(_0x5a2da0,_0x2f6149);},'reXxh':function(_0x347132,_0x5398cc,_0xa6e2a2){return _0x347132(_0x5398cc,_0xa6e2a2);}},_0x3b7da1=_0x305d56['BRpId'](sessionCacheHash,{'orgId':_0x9ba19d,'profileName':_0x11deb9,'effectiveBaseUrl':_0x452200,'setupHeaders':_0x5d6c2d,'invalidateOn':_0x42f151?.[_0x15fb79(0x119)],'userAgent':_0x42f151?.['userAgent'],'clientIp':_0x42f151?.[_0x15fb79(0xae)]}),_0x3366fc=getSessionCachePath(_0x3b7da1,_0x11deb9),_0x2e3181=_0x305d56['uHFdb'](join,getRangerHomeDir(),_0x305d56[_0x15fb79(0x10b)]);!existsSync(_0x2e3181)&&await _0x305d56['czTDN'](mkdir,_0x2e3181,{'recursive':!![]});const _0x134513={..._0x3f67ea};_0x59ad37&&_0x59ad37['length']>0x0&&Array['isArray'](_0x134513[_0x15fb79(0x123)])&&(_0x134513['cookies']=_0x305d56[_0x15fb79(0xd8)](duplicateCookiesForDomains,_0x134513[_0x15fb79(0x123)],_0x59ad37));const _0xc7cab8={'cached_at':new Date()[_0x15fb79(0xcc)](),'session_state':_0x134513};await writeFile(_0x3366fc,JSON['stringify'](_0xc7cab8,null,0x2));const _0xa6c8bf=getStorageStatePath(_0x3366fc);return await _0x305d56[_0x15fb79(0xd8)](writeFile,_0xa6c8bf,JSON['stringify'](_0x134513,null,0x2)),_0xa6c8bf;}function _0x4835(){const _0x1ed4b9=['length','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','GgSkV','cli:manual-login','\x22\x20on\x20profile\x20\x22','VsQod','defaultEnvironmentKey','pOWhE','username','11031040QunaPh','name','deKeQ','invalidateOn','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','storageState','idBKe','connectionId','settings','telemetry','toLowerCase','\x22.\x0a','AfWZf','cookies','OMhGD','ambiguous','RANGER_TEST_USERNAME','origin','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','TztiV','2CZSwLT','/api/v1/profiles','\x22,\x20attempting\x20login...','15408837XgOytZ','IREPO','\x20failed\x20(','131403BGZtow','wZTOl','ApiError','):\x20','success','yrQqC','Bearer\x20','invalid-url','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','\x22\x20instead.','launch','status','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','sNMrR','error','naNKu','UcVTY','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','IpGEq','bSQWi','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>`.','/login','UDzGk','force','DhnfY','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','test_output',').\x20','cuQfh','tunnel','JyzPP','lSzfJ','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','tunnel_login_setup','none','pendingLocalConnections','confirm','domains','14448890iezhWK','sessionId','\x22;\x20proceeding\x20with\x20loginInstructions.','tunnelUrl','reason','clientIp','targetUrl','\x20\x20No\x20live\x20session\x20for\x20\x22','session_state','sszbF','local_ws_error','\x22\x20not\x20found.','7iSFTGN','qNYLv','kMSMS','POST','assertedEnv','about:blank','KDHDp','\x20\x20Created\x20cloud\x20profile\x20\x22','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','true','No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22','\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22','password','FTdwe','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','string','/session','Cloud\x20profile\x20\x22','not_configured','bCPyq','close','trackPhaseError','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','toISOString','prompt','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','env','esDGx','json','Jevka','message','wdsLX','code','you\x27re\x20now\x20at\x20\x22','itwUj','reXxh','No\x20saved\x20session\x20for\x20\x22','userAgent','1133610OMsdHA','sCCnS','RANGER_TUNNEL_LOGIN_HEADED','browserOptions','detail','jHDbF','setupHeaders','\x20\x20Cloud\x20session\x20for\x20\x22','626970lTVocS','\x22,\x20refreshing\x20session...','stringify','RANGER_TEST_PASSWORD','\x20\x20•\x20capture\x20one\x20(a\x20browser\x20opens):\x20ranger\x20profile\x20add\x20','WcdYu','keys','url','DqvmV','organizationId','environmentKey','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','environments','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','dOfpn','aZmNm','trackPhaseStart','/api/v1/profiles/','pwEndpoint','catch','PUT','161731pzCZZu','ybpFL','UhNqm','JWQBG','56eCuReD','KdoMf','goto','fZvqJ','forceLogin','loginInstructions','join','sessionCheckPath','log','API\x20request\x20','wsEndpoint','key','LGZvA','GpGml','bZBeK','ZcUEo','\x22,\x20and\x20cloud\x20sessions\x20don\x27t\x20apply\x20to\x20localhost.\x0a'];_0x4835=function(){return _0x1ed4b9;};return _0x4835();}export async function checkLocalCache(_0x1950cd,_0x276cbe,_0xc02cf8,_0x4d2f42,_0xe7984e){const _0x32cdb2=_0xd1edc9,_0x39fba1={'deKeQ':function(_0x43fca0,_0x3d66d0){return _0x43fca0(_0x3d66d0);},'IREPO':function(_0x2b7b7a,_0x33a329,_0x19d0ae){return _0x2b7b7a(_0x33a329,_0x19d0ae);},'HxLWJ':function(_0x1b2fe0,_0x79dee4,_0x38ddbf){return _0x1b2fe0(_0x79dee4,_0x38ddbf);}},_0x17753a=_0x39fba1['deKeQ'](sessionCacheHash,{'orgId':_0x276cbe,'profileName':_0x1950cd,'effectiveBaseUrl':_0xc02cf8,'setupHeaders':_0x4d2f42,'invalidateOn':_0xe7984e?.[_0x32cdb2(0x119)],'userAgent':_0xe7984e?.['userAgent'],'clientIp':_0xe7984e?.['clientIp']}),_0x958874=_0x39fba1[_0x32cdb2(0x12e)](getSessionCachePath,_0x17753a,_0x1950cd),_0x335a5b=_0x39fba1[_0x32cdb2(0x118)](getStorageStatePath,_0x958874);if(!_0x39fba1[_0x32cdb2(0x118)](existsSync,_0x958874)||!existsSync(_0x335a5b))return null;try{const _0xc50223=await _0x39fba1['HxLWJ'](readFile,_0x958874,'utf-8');return JSON['parse'](_0xc50223),{'storageStatePath':_0x335a5b};}catch{return null;}}function launchRealBrowser(){const _0x588194=_0xd1edc9;return chromium[_0x588194(0x13a)]({'headless':!![]});}function emitSessionValidationHint(_0x28f1e5,_0xdfe894){const _0x625043=_0xd1edc9,_0x32829a={'OMhGD':function(_0x2bd381,_0x2b724b){return _0x2bd381===_0x2b724b;},'Jevka':function(_0x990dc0,_0x4c167f){return _0x990dc0+_0x4c167f;}};if(!_0xdfe894||!_0xdfe894['domains']?.[_0x625043(0x10d)])return;let _0x211dd7;try{_0x211dd7=new URL(_0x28f1e5);}catch{return;}const _0xdc58cd=[];for(const _0x365761 of _0xdfe894['domains']){try{_0xdc58cd['push']({'raw':_0x365761,'url':new URL(_0x365761)});}catch{}}if(_0x32829a[_0x625043(0x124)](_0xdc58cd['length'],0x0))return;if(_0xdc58cd['some'](_0x23fb2b=>_0x23fb2b[_0x625043(0xea)]['origin']===_0x211dd7[_0x625043(0x127)]))return;const _0x3ea4b1=_0xdc58cd['map'](_0x231713=>'\x22'+_0x231713['raw']+'\x22')[_0x625043(0x102)](',\x20');console['log'](_0x32829a[_0x625043(0xd2)]('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x3ea4b1+';\x20',_0x625043(0xd6)+_0x28f1e5+_0x625043(0x141))+'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.');}export async function serverSideLogin(_0x3ce744,_0x1eb53f){const _0x4fcb01=_0xd1edc9,_0x146183={'RyIwF':'POST','sCCnS':function(_0x43c734,_0x2bf734){return _0x43c734===_0x2bf734;},'RHHeK':'not_configured'},_0x587d58=process[_0x4fcb01(0xcf)][_0x4fcb01(0x126)],_0x2e54b4=process[_0x4fcb01(0xcf)][_0x4fcb01(0xe6)],_0x21c9de={};if(_0x587d58)_0x21c9de['username']=_0x587d58;if(_0x2e54b4)_0x21c9de['password']=_0x2e54b4;if(_0x1eb53f?.[_0x4fcb01(0x147)])_0x21c9de['force']=!![];if(_0x1eb53f?.['targetUrl'])_0x21c9de['target_url']=_0x1eb53f[_0x4fcb01(0xaf)];if(_0x1eb53f?.['env'])_0x21c9de[_0x4fcb01(0xcf)]=_0x1eb53f[_0x4fcb01(0xcf)];_0x1eb53f?.[_0x4fcb01(0x14d)]&&(_0x21c9de['tunnel_session_id']=_0x1eb53f['tunnel'][_0x4fcb01(0x157)],_0x21c9de['pw_endpoint']=_0x1eb53f['tunnel'][_0x4fcb01(0xf5)]);try{return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x3ce744)+_0x4fcb01(0x145),{'method':_0x146183['RyIwF'],'body':JSON['stringify'](_0x21c9de)});}catch(_0x497a64){if(_0x497a64 instanceof ApiError&&_0x497a64[_0x4fcb01(0x13b)]===0x190&&_0x146183[_0x4fcb01(0xdc)](_0x497a64['code'],'not_configured'))return{'status':_0x146183['RHHeK'],'error':_0x497a64['detail']};throw _0x497a64;}}async function serverSideLoginWithOptionalTunnel(_0x53fb5f,_0x596653,_0x201847={}){const _0x58a81d=_0xd1edc9,_0x44d171={'VsQod':'tunnel_login_request','itwUj':function(_0x4b6799,_0x3b89d2){return _0x4b6799(_0x3b89d2);},'cuQfh':function(_0x59ce13,_0x2c0e6a){return _0x59ce13(_0x2c0e6a);},'bSQWi':_0x58a81d(0xbe),'uWNRS':_0x58a81d(0x151),'qNYLv':function(_0x2ab85b,_0x2a802e){return _0x2ab85b??_0x2a802e;},'eAfNw':function(_0xc9a33c,_0xdf37dc){return _0xc9a33c(_0xdf37dc);},'bCPyq':function(_0x5c83d8,_0x1903ea){return _0x5c83d8||_0x1903ea;},'UhNqm':'tunnel_login_cleanup'};if(!_0x44d171[_0x58a81d(0x14c)](needsTunnel,_0x596653))return await serverSideLogin(_0x53fb5f,{'force':_0x201847[_0x58a81d(0x147)],'env':_0x201847['env']});let _0xb5041b=null,_0x3b123e=null,_0x4a70c3=null,_0xd65ac3=null,_0x147301=![];const _0x221dd2=process[_0x58a81d(0xcf)][_0x58a81d(0xdd)]?.[_0x58a81d(0x120)](),_0x9ac7b5=_0x221dd2==='1'||_0x221dd2===_0x44d171[_0x58a81d(0x143)],_0x2c0abd={'profileName':_0x53fb5f,'targetUrlHost':targetHostForTelemetry(_0x596653),'tunnelRequired':!![],'forceLogin':Boolean(_0x201847[_0x58a81d(0x147)]),'localBrowserServerHeaded':_0x9ac7b5};try{_0x201847['telemetry']?.['trackPhaseStart'](_0x44d171['uWNRS'],_0x2c0abd);_0x9ac7b5&&console['log']('\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...');_0xb5041b=await launchBrowserServer({'headless':!_0x9ac7b5}),_0x3b123e=await _0x44d171['cuQfh'](createTunnelSession,_0x596653);const _0x2171f1=await requireToken();_0x4a70c3=await _0x44d171['itwUj'](createTunnelBridge,{'localWsUrl':_0xb5041b[_0x58a81d(0x106)],'tunnelServerUrl':_0x3b123e[_0x58a81d(0xac)],'sessionId':_0x3b123e[_0x58a81d(0x157)],'apiKey':_0x2171f1,'onError':_0x457324=>{_0xd65ac3=_0x457324;},'onClose':()=>{const _0x19c472=_0x58a81d;_0xd65ac3??=new Error(_0x19c472(0xbd)+_0x53fb5f);},'onEvent':_0x5d79a5=>trackBridgeEvent(_0x201847[_0x58a81d(0x11f)],_0x5d79a5)}),_0x201847[_0x58a81d(0x11f)]?.['trackPhaseEnd'](_0x58a81d(0x151),{..._0x2c0abd,'tunnelSessionId':_0x3b123e['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x9ac7b5}),_0x147301=!![];try{return _0x201847['telemetry']?.['trackPhaseStart'](_0x44d171[_0x58a81d(0x112)],{..._0x2c0abd,'tunnelSessionId':_0x3b123e['sessionId']}),await serverSideLogin(_0x53fb5f,{'force':_0x201847[_0x58a81d(0x147)],'targetUrl':_0x596653,'env':_0x201847[_0x58a81d(0xcf)],'tunnel':{'sessionId':_0x3b123e['sessionId'],'pwEndpoint':_0x3b123e['pwEndpoint']}})['then'](_0x4ed122=>{const _0x51d203=_0x58a81d;return _0x201847['telemetry']?.['trackPhaseEnd'](_0x44d171[_0x51d203(0x112)],{..._0x2c0abd,'tunnelSessionId':_0x3b123e?.['sessionId'],'loginStatus':_0x4ed122['status'],'hasSessionState':_0x44d171[_0x51d203(0xd7)](Boolean,_0x4ed122['session_state']),'hasTestOutput':Boolean(_0x4ed122['test_output']),'bridgeError':_0x44d171[_0x51d203(0xd7)](errorMessageForTelemetry,_0xd65ac3)}),_0x4ed122;});}catch(_0x42dd4e){await _0x201847[_0x58a81d(0x11f)]?.[_0x58a81d(0xca)](_0x44d171[_0x58a81d(0x112)],_0x44d171[_0x58a81d(0xb6)](_0xd65ac3,_0x42dd4e),{..._0x2c0abd,'tunnelSessionId':_0x3b123e[_0x58a81d(0x157)],'bridgeError':_0x44d171['eAfNw'](errorMessageForTelemetry,_0xd65ac3)});throw _0xd65ac3??_0x42dd4e;}}catch(_0x451eb6){!_0x147301&&await _0x201847['telemetry']?.[_0x58a81d(0xca)]('tunnel_login_setup',_0x451eb6,{..._0x2c0abd,'tunnelSessionId':_0x3b123e?.['sessionId']});throw _0x451eb6;}finally{(_0x44d171[_0x58a81d(0xc8)](_0x3b123e,_0xb5041b)||_0x4a70c3)&&(_0x201847[_0x58a81d(0x11f)]?.[_0x58a81d(0xf3)](_0x44d171[_0x58a81d(0xfa)],{..._0x2c0abd,'tunnelSessionId':_0x3b123e?.[_0x58a81d(0x157)]}),_0x4a70c3?.[_0x58a81d(0xc9)](),_0xb5041b&&await _0xb5041b[_0x58a81d(0xc9)]()['catch'](()=>{}),_0x3b123e&&await deleteTunnelSession(_0x3b123e['sessionId'])[_0x58a81d(0xf6)](()=>{}),_0x201847[_0x58a81d(0x11f)]?.['trackPhaseEnd'](_0x44d171['UhNqm'],{..._0x2c0abd,'tunnelSessionId':_0x3b123e?.['sessionId']}));}}export async function manualBrowserLogin(_0x382c73,_0x4dc73a,_0x47ed3e={}){const _0x49fb09=_0xd1edc9,_0x30decc={'ZrfXj':function(_0x15c987,_0x23afd4){return _0x15c987/_0x23afd4;},'wZTOl':function(_0x15fde5){return _0x15fde5();},'EaDIh':function(_0x5c9c07,_0x48d02c){return _0x5c9c07+_0x48d02c;},'JWQBG':_0x49fb09(0x11a),'rJMPE':function(_0x1876df,_0x38ce1e){return _0x1876df>_0x38ce1e;},'ybpFL':_0x49fb09(0xba),'hRcXm':'\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','TuZqc':function(_0x5191ab,_0x1294e1){return _0x5191ab(_0x1294e1);},'pOWhE':function(_0x558f6b,_0x1bb9c2){return _0x558f6b&&_0x1bb9c2;},'QmCeB':function(_0xaee09f,_0x2a6070){return _0xaee09f!==_0x2a6070;},'UDzGk':function(_0x34d486,_0x3fb70a,_0x3beea8){return _0x34d486(_0x3fb70a,_0x3beea8);}};if(!_0x30decc['wZTOl'](isInteractive))throw new Error(_0x30decc['EaDIh']('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x382c73['name']+_0x49fb09(0x121),_0x49fb09(0xcb))+_0x30decc[_0x49fb09(0xfb)]);const _0x55bf11=_0x4dc73a&&_0x30decc['rJMPE'](_0x4dc73a['domains'][_0x49fb09(0x10d)],0x0)?_0x4dc73a[_0x49fb09(0x155)][0x0]:_0x30decc[_0x49fb09(0xf9)];console['log']('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console[_0x49fb09(0x104)](_0x30decc['hRcXm']),await new Promise(_0x4440cc=>setTimeout(_0x4440cc,0x7d0));const _0x2fa2fe=await chromium['launch']({'headless':![]});let _0x2c1d8c=null;try{const _0x121f4d={'ignoreHTTPSErrors':!![]};_0x4dc73a?.['setupHeaders']&&(_0x121f4d['extraHTTPHeaders']=_0x4dc73a[_0x49fb09(0xe1)]);const _0x15ed5e=await _0x2fa2fe['newContext'](_0x121f4d);await _0x30decc['TuZqc'](addProfileSetupBanner,_0x15ed5e);const _0x5d87ce=await _0x15ed5e['newPage']();await _0x5d87ce[_0x49fb09(0xfe)](_0x55bf11);let _0x15899e=![];await new Promise(_0x4529af=>{const _0x34061f=_0x49fb09,_0x448374={'FVaQK':function(_0x2163d9,_0x318e6b){return _0x30decc['ZrfXj'](_0x2163d9,_0x318e6b);},'eOaIB':function(_0x32c03c){const _0x746ad=_0xcfb7;return _0x30decc[_0x746ad(0x131)](_0x32c03c);}},_0x5eaed0=setTimeout(()=>{const _0x3e61d4=_0xcfb7;_0x15899e=!![],console[_0x3e61d4(0x13e)]('Browser\x20login\x20timed\x20out\x20after\x20'+_0x448374['FVaQK'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x448374['eOaIB'](_0x4529af);},MANUAL_LOGIN_TIMEOUT_MS);_0x5d87ce['on'](_0x34061f(0xc9),async()=>{const _0x156b98=_0x34061f;clearTimeout(_0x5eaed0);try{const _0x14a858=await _0x15ed5e[_0x156b98(0x11b)]();_0x2c1d8c=_0x14a858;}catch{}_0x4529af();});});if(_0x30decc[_0x49fb09(0x114)](_0x15899e,!_0x2c1d8c))throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x2fa2fe['close']()['catch'](()=>{});}if(!_0x2c1d8c)throw new Error('Browser\x20closed\x20before\x20authentication\x20was\x20saved.');return _0x30decc['QmCeB'](_0x47ed3e['persistSessionState'],![])&&await _0x30decc[_0x49fb09(0x146)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x382c73[_0x49fb09(0x117)])+_0x49fb09(0xc5),{'method':'POST','body':JSON['stringify']({'session_state':_0x2c1d8c,'updated_by':_0x49fb09(0x110)})}),{'sessionState':_0x2c1d8c};}export async function promptSaveCredentials(_0x3cb264){const _0x54833c=_0xd1edc9,_0x42343c={'DhnfY':function(_0xc2f72){return _0xc2f72();},'idBKe':_0x54833c(0x154),'naNKu':function(_0x5ac8b0,_0x4ebc63,_0x1d970d){return _0x5ac8b0(_0x4ebc63,_0x1d970d);},'IpGEq':function(_0x58f433,_0x3475ea){return _0x58f433(_0x3475ea);},'fZvqJ':'PUT','GgSkV':_0x54833c(0x138)},_0x23f3f8=process[_0x54833c(0xcf)][_0x54833c(0x126)],_0x23537e=process[_0x54833c(0xcf)]['RANGER_TEST_PASSWORD'];if(!_0x23f3f8||!_0x23537e)return;if(!_0x42343c[_0x54833c(0x148)](isInteractive))return;const {save:_0x21c8fd}=await _0x564955[_0x54833c(0xcd)]([{'type':_0x42343c[_0x54833c(0x11c)],'name':'save','message':_0x54833c(0xce),'default':![]}]);if(!_0x21c8fd)return;await _0x42343c[_0x54833c(0x13f)](apiRequest,'/api/v1/profiles/'+_0x42343c[_0x54833c(0x142)](encodeURIComponent,_0x3cb264),{'method':_0x42343c[_0x54833c(0xff)],'body':JSON[_0x54833c(0xe5)]({'username':_0x23f3f8,'password':_0x23537e})}),console[_0x54833c(0x104)](_0x42343c[_0x54833c(0x10f)]);}export async function resolveCloudProfileSession(_0x550b41,_0xc48ae0={}){const _0x2b9c74=_0xd1edc9,_0x5d0a59={'yrQqC':function(_0x2573d7,_0x2996b2){return _0x2573d7===_0x2996b2;},'obUsi':_0x2b9c74(0xc4),'KdoMf':function(_0x4b679e,_0x327745){return _0x4b679e===_0x327745;},'UcVTY':function(_0x27ba95,_0x187ccb){return _0x27ba95(_0x187ccb);},'MijFJ':function(_0xa82a2c,_0x4a29a5){return _0xa82a2c>_0x4a29a5;},'FTdwe':function(_0x43c18d,_0x348539){return _0x43c18d&&_0x348539;},'KmZvF':function(_0x530096,_0x22af8a,_0xfe0fea,_0x874c38,_0x331744){return _0x530096(_0x22af8a,_0xfe0fea,_0x874c38,_0x331744);},'bZBeK':function(_0x296b0c,_0x47ebbd,_0x26cf9e){return _0x296b0c(_0x47ebbd,_0x26cf9e);},'ixRaC':function(_0x263543,_0x4988f4,_0x122d9d,_0x5c27ec,_0x297317,_0x39ecc7,_0x529866,_0x2e61a0){return _0x263543(_0x4988f4,_0x122d9d,_0x5c27ec,_0x297317,_0x39ecc7,_0x529866,_0x2e61a0);},'AfWZf':function(_0x140d8d,_0x8653e0,_0x35ff58){return _0x140d8d(_0x8653e0,_0x35ff58);},'Ifcwp':function(_0x3b7bd1,_0x7bf27d){return _0x3b7bd1(_0x7bf27d);},'cpsuF':function(_0x3a4eb9,_0x4d341f){return _0x3a4eb9||_0x4d341f;},'kMSMS':function(_0x2fec35,_0x19f711){return _0x2fec35||_0x19f711;},'fHxGi':function(_0x1383a9,_0x9fb58f,_0x16457e){return _0x1383a9(_0x9fb58f,_0x16457e);},'pPthD':_0x2b9c74(0x13c),'Traic':function(_0xf93b55,_0x93e8bd,_0x974e82,_0x36cb3e,_0x198dca,_0xd3df5,_0x4c6772,_0x31c5d8){return _0xf93b55(_0x93e8bd,_0x974e82,_0x36cb3e,_0x198dca,_0xd3df5,_0x4c6772,_0x31c5d8);},'bthMg':function(_0x3f1b4e,_0x4d8902){return _0x3f1b4e(_0x4d8902);},'sNMrR':function(_0x4c015d,_0x42a0c0){return _0x4c015d instanceof _0x42a0c0;},'LGZvA':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','jBrHM':function(_0x44776f,_0x4d4dbe){return _0x44776f+_0x4d4dbe;},'vZGLS':function(_0x146089,_0x8ef600){return _0x146089+_0x8ef600;},'eENls':'\x20\x20•\x20or\x20pass\x20--env\x20<key>\x20to\x20run\x20an\x20automated\x20login\x20for\x20this\x20target.','esDGx':function(_0x10d50d,_0x227a29,_0x3115b1){return _0x10d50d(_0x227a29,_0x3115b1);}},_0x5f2b5d=_0x550b41[_0x2b9c74(0x11e)]??{},_0x401e12=await fetchAuthConfig(),_0x27aca3=_0x401e12?resolveAuthEnvironmentLocally(_0x401e12,_0xc48ae0['assertedEnv']??_0x550b41[_0x2b9c74(0xed)]):null,_0x2a4aaa=_0x5d0a59['yrQqC'](typeof _0x27aca3?.[_0x2b9c74(0x101)],_0x5d0a59['obUsi'])&&_0x27aca3[_0x2b9c74(0x101)]['trim']()?_0x27aca3[_0x2b9c74(0x101)]:undefined,_0x56d1e2=_0x5d0a59[_0x2b9c74(0xfd)](typeof _0x5f2b5d['loginInstructions'],_0x5d0a59['obUsi'])&&_0x5f2b5d[_0x2b9c74(0x101)]['trim']()?_0x5f2b5d['loginInstructions']:undefined,_0x5f0dbc=_0x56d1e2||!_0x2a4aaa?_0x5f2b5d:{..._0x5f2b5d,'loginInstructions':_0x2a4aaa},_0x277d8d=Boolean(_0x5f0dbc['loginInstructions']?.['trim']()),_0x457773=_0x5d0a59[_0x2b9c74(0x140)](Boolean,_0x5f2b5d['forceLogin']||_0x27aca3?.[_0x2b9c74(0x100)]),_0x304328=_0x27aca3?.['domains'],_0x41bc16=_0x5f2b5d['setupHeaders'],_0x3c96a6=_0x41bc16??_0x27aca3?.['setupHeaders'],_0x233df9=_0xc48ae0['effectiveBaseUrl']??_0x5f2b5d['baseUrl']??(_0x304328&&_0x5d0a59['MijFJ'](_0x304328['length'],0x0)?_0x304328[0x0]:''),_0x5a0814=_0x233df9?needsTunnel(_0x233df9):![],_0x608300={'invalidateOn':_0x27aca3?.['invalidateOn'],'userAgent':_0x27aca3?.[_0x2b9c74(0xde)]?.['userAgent']??_0x5f2b5d[_0x2b9c74(0xda)]};_0x457773&&console[_0x2b9c74(0x104)]('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x550b41[_0x2b9c74(0x117)]+_0x2b9c74(0xe4));if(!_0x457773){const _0x3df46f=await checkLocalCache(_0x550b41[_0x2b9c74(0x117)],_0x550b41['organizationId'],_0x233df9,_0x3c96a6,_0x608300);if(_0x3df46f){if(_0x5d0a59['FTdwe'](_0x233df9,!_0x5a0814)){const _0x155729=await _0x5d0a59['KmZvF'](isCachedSessionLive,_0x3df46f['storageStatePath'],_0x233df9,{'sessionCheckPath':_0x27aca3?.[_0x2b9c74(0x103)],'setupHeaders':_0x3c96a6},{'launchBrowser':launchRealBrowser});if(_0x155729)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x550b41['name']+'\x22'),{'authPath':_0x3df46f['storageStatePath'],'settings':_0x5f0dbc,'resolvedEnv':_0x27aca3};console[_0x2b9c74(0x104)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x550b41[_0x2b9c74(0x117)]+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x5d0a59[_0x2b9c74(0x10a)](emitSessionValidationHint,_0x233df9,_0x27aca3);}else return _0x5a0814&&console[_0x2b9c74(0x104)]('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x550b41['name']+'\x22'),{'authPath':_0x3df46f['storageStatePath'],'settings':_0x5f0dbc,'resolvedEnv':_0x27aca3};}}if(!_0x457773&&_0x550b41['sessionState']){const _0x39d726=await _0x5d0a59['ixRaC'](writeSessionToLocalCache,_0x550b41[_0x2b9c74(0x117)],_0x550b41[_0x2b9c74(0xec)],_0x233df9,_0x3c96a6,_0x550b41['sessionState'],_0x304328,_0x608300);if(_0x233df9){const _0xe74b0c=await _0x5d0a59['KmZvF'](isCachedSessionLive,_0x39d726,_0x233df9,{'sessionCheckPath':_0x27aca3?.['sessionCheckPath'],'setupHeaders':_0x3c96a6},{'launchBrowser':launchRealBrowser});if(_0xe74b0c)return console[_0x2b9c74(0x104)]('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x550b41[_0x2b9c74(0x117)]+'\x22,\x20cached\x20locally'),{'authPath':_0x39d726,'settings':_0x5f0dbc,'resolvedEnv':_0x27aca3};console['log'](_0x2b9c74(0xe2)+_0x550b41[_0x2b9c74(0x117)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x5d0a59[_0x2b9c74(0x122)](emitSessionValidationHint,_0x233df9,_0x27aca3);}else return{'authPath':_0x39d726,'settings':_0x5f0dbc,'resolvedEnv':_0x27aca3};}if(_0x277d8d)return console['log'](_0x2b9c74(0xb0)+_0x550b41[_0x2b9c74(0x117)]+_0x2b9c74(0xab)),{'authPath':undefined,'settings':_0x5f0dbc,'resolvedEnv':_0x27aca3};console[_0x2b9c74(0x104)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x550b41['name']+_0x2b9c74(0x12c));const _0x1f233e=Boolean(process['env']['RANGER_TEST_USERNAME'])&&_0x5d0a59[_0x2b9c74(0x140)](Boolean,process[_0x2b9c74(0xcf)]['RANGER_TEST_PASSWORD']),_0x5ed670=Boolean(_0x550b41['username']),_0x19fc29=_0x5d0a59['Ifcwp'](Boolean,_0xc48ae0['assertedEnv']),_0x288d6b=_0x233df9?_0x5d0a59[_0x2b9c74(0x140)](isBareLocalhost,_0x233df9):![],_0x3f8c29=_0x5d0a59['cpsuF'](_0x1f233e,_0x5ed670)&&_0x5d0a59[_0x2b9c74(0xb7)](!_0x288d6b,_0x19fc29);if(_0x3f8c29)try{const _0x5b6d47=_0x233df9?await serverSideLoginWithOptionalTunnel(_0x550b41[_0x2b9c74(0x117)],_0x233df9,{'force':_0x457773,'telemetry':_0xc48ae0['telemetry'],'env':_0xc48ae0[_0x2b9c74(0xb9)]}):await _0x5d0a59['fHxGi'](serverSideLogin,_0x550b41[_0x2b9c74(0x117)],{'force':_0x457773,'env':_0xc48ae0['assertedEnv']});if(_0x5d0a59[_0x2b9c74(0x135)](_0x5b6d47['status'],_0x2b9c74(0xc7)))console['log'](_0x5d0a59['pPthD']);else{if(_0x5d0a59['KdoMf'](_0x5b6d47['status'],_0x2b9c74(0x134))&&_0x5b6d47[_0x2b9c74(0xb1)]){console[_0x2b9c74(0x104)]('\x20\x20Login\x20successful.\x20Session\x20cached.');const _0x5a6a40=await _0x5d0a59['Traic'](writeSessionToLocalCache,_0x550b41['name'],_0x550b41['organizationId'],_0x233df9,_0x3c96a6,_0x5b6d47['session_state'],_0x304328,_0x608300);return _0x5d0a59[_0x2b9c74(0xc2)](_0x1f233e,!_0x5ed670)&&await _0x5d0a59['bthMg'](promptSaveCredentials,_0x550b41['name']),{'authPath':_0x5a6a40,'settings':_0x5f0dbc,'resolvedEnv':_0x27aca3};}else _0x5b6d47[_0x2b9c74(0x14a)]&&(console[_0x2b9c74(0x104)]('\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:'),console['log'](_0x5b6d47[_0x2b9c74(0x14a)])),console[_0x2b9c74(0x104)](_0x2b9c74(0xee));}}catch(_0xd03f3){console['log']('\x20\x20Server-side\x20login\x20error:\x20'+(_0x5d0a59[_0x2b9c74(0x13d)](_0xd03f3,Error)?_0xd03f3['message']:String(_0xd03f3))),console[_0x2b9c74(0x104)](_0x5d0a59[_0x2b9c74(0x108)]);}if(_0x288d6b&&!_0x19fc29&&!isInteractive())throw new Error(_0x5d0a59['jBrHM'](_0x5d0a59['vZGLS'](_0x2b9c74(0xd9)+_0x233df9+_0x2b9c74(0x111)+_0x550b41['name']+_0x2b9c74(0x10c),_0x2b9c74(0xe7)+_0x550b41[_0x2b9c74(0x117)]+'\x20--url\x20'+_0x233df9+'\x0a'),_0x5d0a59['eENls']));const _0x4c40c8=_0x27aca3?{..._0x27aca3,'domains':_0x5d0a59[_0x2b9c74(0xd0)](orderLoginDomains,_0x233df9,_0x27aca3['domains']),'setupHeaders':_0x3c96a6}:_0x233df9?{'key':_0x550b41['environmentKey']??'','domains':[_0x233df9],'setupHeaders':_0x3c96a6}:null,{sessionState:_0x5f5703}=await manualBrowserLogin(_0x550b41,_0x4c40c8,{'persistSessionState':!_0x5a0814}),_0x5ecb68=await writeSessionToLocalCache(_0x550b41[_0x2b9c74(0x117)],_0x550b41[_0x2b9c74(0xec)],_0x233df9,_0x3c96a6,_0x5f5703,_0x304328,_0x608300);return{'authPath':_0x5ecb68,'settings':_0x5f0dbc,'resolvedEnv':_0x27aca3};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const _0x2da3cf=_0x1cb8;(function(_0x51500b,_0x183764){const _0x1000bb=_0x1cb8,_0x4bd6cf=_0x51500b();while(!![]){try{const _0x188aeb=parseInt(_0x1000bb(0x11f))/0x1+-parseInt(_0x1000bb(0xf6))/0x2*(parseInt(_0x1000bb(0xfd))/0x3)+-parseInt(_0x1000bb(0x127))/0x4+parseInt(_0x1000bb(0x10a))/0x5+-parseInt(_0x1000bb(0x120))/0x6+parseInt(_0x1000bb(0x112))/0x7*(parseInt(_0x1000bb(0x121))/0x8)+parseInt(_0x1000bb(0x129))/0x9*(parseInt(_0x1000bb(0x10e))/0xa);if(_0x188aeb===_0x183764)break;else _0x4bd6cf['push'](_0x4bd6cf['shift']());}catch(_0x43dd45){_0x4bd6cf['push'](_0x4bd6cf['shift']());}}}(_0x56a7,0x5e5d4));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x1e5ce3=process[_0x2da3cf(0xfc)],_0x368576={'stdin':process['stdin'],'stdout':process['stdout']}){const _0x19d24f=_0x2da3cf,_0x18d303={'DSTVZ':function(_0x5a3c21,_0x33d67){return _0x5a3c21(_0x33d67);}};if(_0x1e5ce3['CI'])return![];return _0x18d303[_0x19d24f(0x110)](Boolean,_0x368576['stdin'][_0x19d24f(0x122)])&&Boolean(_0x368576[_0x19d24f(0x109)]['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x42274e){const _0x49dddf=_0x2da3cf,_0x3740ea={'MxWXH':_0x49dddf(0x113),'XBACN':_0x49dddf(0x100),'imUIw':function(_0x243e1b,_0x4caa40){return _0x243e1b(_0x4caa40);},'rSvxV':'clientIp','vmHPy':function(_0x2f350e,_0x97dbe6){return _0x2f350e!==_0x97dbe6;},'aiTFL':function(_0x1c8748,_0x31d82a){return _0x1c8748(_0x31d82a);}},_0x9aa8c0=new Set(_0x42274e[_0x49dddf(0x12b)]??DEFAULT_INVALIDATE_ON);_0x42274e[_0x49dddf(0x108)]&&needsTunnel(_0x42274e['effectiveBaseUrl'])&&_0x9aa8c0['add'](_0x3740ea[_0x49dddf(0x111)]);const _0xec1db8={'orgId':_0x42274e['orgId'],'profileName':_0x42274e['profileName']};return _0x9aa8c0['has'](_0x3740ea[_0x49dddf(0x111)])&&(_0xec1db8['effectiveBaseUrl']=_0x42274e[_0x49dddf(0x108)]),_0x9aa8c0[_0x49dddf(0x107)]('setupHeaders')&&(_0xec1db8['setupHeaders']=_0x42274e['setupHeaders']?sortObjectKeys(_0x42274e['setupHeaders']):_0x42274e[_0x49dddf(0xf9)]),_0x9aa8c0[_0x49dddf(0x107)](_0x3740ea[_0x49dddf(0x12c)])&&(_0xec1db8['port']=_0x3740ea[_0x49dddf(0x10d)](extractPort,_0x42274e[_0x49dddf(0x108)])),_0x9aa8c0[_0x49dddf(0x107)](_0x49dddf(0x10b))&&_0x42274e['userAgent']!==undefined&&(_0xec1db8['userAgent']=_0x42274e[_0x49dddf(0x10b)]),_0x9aa8c0[_0x49dddf(0x107)](_0x3740ea[_0x49dddf(0x114)])&&_0x3740ea['vmHPy'](_0x42274e['clientIp'],undefined)&&(_0xec1db8[_0x49dddf(0x103)]=_0x42274e['clientIp']),_0x3740ea['aiTFL'](createHash,_0x49dddf(0x106))['update'](JSON[_0x49dddf(0x10f)](_0xec1db8))[_0x49dddf(0x126)]('hex')[_0x49dddf(0x115)](0x0,0xc);}function extractPort(_0xb67fb8){try{return new URL(_0xb67fb8)['port'];}catch{return'';}}function sortObjectKeys(_0x2ffa40){const _0x25162f=_0x2da3cf,_0x279d8b={};for(const _0x3193bc of Object[_0x25162f(0x12d)](_0x2ffa40)[_0x25162f(0xf8)]()){_0x279d8b[_0x3193bc]=_0x2ffa40[_0x3193bc];}return _0x279d8b;}export function getSessionCachePath(_0x4e2ba4,_0x1f63e8){const _0x2e14e0=_0x2da3cf;return join(getRangerHomeDir(),_0x2e14e0(0x118),_0x4e2ba4+'-'+_0x1f63e8+_0x2e14e0(0xf5));}export function getStorageStatePath(_0x334bbb){const _0x1e10d6=_0x2da3cf;return _0x334bbb['replace'](/\.json$/,_0x1e10d6(0x124));}export function needsTunnel(_0x322fd4){const _0x6dda53=_0x2da3cf,_0x5d8e51={'YZzGy':function(_0x5434ed,_0x3bd15e){return _0x5434ed===_0x3bd15e;},'nMear':'127.0.0.1','MXVps':_0x6dda53(0x128)};let _0x12ccf0;try{_0x12ccf0=new URL(_0x322fd4)['hostname'];}catch{return![];}if(_0x5d8e51['YZzGy'](_0x12ccf0,'localhost')||_0x5d8e51['YZzGy'](_0x12ccf0,_0x5d8e51['nMear']))return!![];if(_0x12ccf0['endsWith']('.localhost'))return!![];if(_0x12ccf0[_0x6dda53(0xfb)](_0x5d8e51['MXVps']))return!![];return![];}export function isBareLocalhost(_0x5eb1cc){const _0x4094f6=_0x2da3cf,_0x5ec6a6={'XvzIE':_0x4094f6(0x12a),'mcivF':_0x4094f6(0x11d),'Lnyir':function(_0x5d692d,_0x4b9351){return _0x5d692d===_0x4b9351;}};let _0x559277;try{_0x559277=new URL(_0x5eb1cc)[_0x4094f6(0x11e)];}catch{return![];}return _0x559277===_0x5ec6a6['XvzIE']||_0x559277==='127.0.0.1'||_0x559277===_0x5ec6a6['mcivF']||_0x5ec6a6['Lnyir'](_0x559277,'[::1]');}export function orderLoginDomains(_0x4340d8,_0x52c87e){const _0x2b5ff5=_0x2da3cf,_0x5b286f=_0x52c87e??[];if(!_0x4340d8)return _0x5b286f;return[_0x4340d8,..._0x5b286f[_0x2b5ff5(0xff)](_0x2ef6c7=>_0x2ef6c7!==_0x4340d8)];}export function hostnameOf(_0xe22933){const _0x50018c=_0x2da3cf;return new URL(_0xe22933)[_0x50018c(0x11e)];}export function duplicateCookiesForDomains(_0x5e0c42,_0x43e279){const _0x4a7e4a=_0x2da3cf,_0x5406ec={'RyvcY':function(_0x4be516,_0x489d8e){return _0x4be516(_0x489d8e);}},_0x13c5b0=[..._0x5e0c42],_0x46439c=new Set(_0x5e0c42['map'](_0x2bd829=>_0x2bd829[_0x4a7e4a(0x101)]));for(const _0x4485d4 of _0x43e279){let _0x23066d;try{_0x23066d=_0x5406ec[_0x4a7e4a(0x102)](hostnameOf,_0x4485d4);}catch{continue;}if(!_0x23066d)continue;const _0xcd5b9f=_0x23066d['startsWith']('.')?_0x23066d:'.'+_0x23066d;if(_0x46439c['has'](_0x23066d)||_0x46439c[_0x4a7e4a(0x107)](_0xcd5b9f))continue;for(const _0x347a5a of _0x5e0c42){_0x13c5b0['push']({..._0x347a5a,'domain':_0xcd5b9f});}_0x46439c['add'](_0xcd5b9f);}return _0x13c5b0;}export function resolveAuthEnvironmentLocally(_0x3c44d6,_0x13cb3d){const _0x162ddf=_0x2da3cf,_0x18e88a=_0x3c44d6[_0x162ddf(0x10c)];if(_0x13cb3d){const _0xab6056=_0x18e88a[_0x13cb3d];if(!_0xab6056)return null;return{'key':_0x13cb3d,..._0xab6056};}if(_0x3c44d6['defaultEnvironmentKey']){const _0x443a36=_0x18e88a[_0x3c44d6[_0x162ddf(0x104)]];if(!_0x443a36)return null;return{'key':_0x3c44d6['defaultEnvironmentKey'],..._0x443a36};}const _0x19cf3b=Object[_0x162ddf(0x12d)](_0x18e88a);if(_0x19cf3b['length']===0x1){const _0x2bd136=_0x19cf3b[0x0];return{'key':_0x2bd136,..._0x18e88a[_0x2bd136]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x15902d,_0x2cba65){const _0xfd7c59=_0x2da3cf;try{if(_0x2cba65)return new URL(_0x2cba65,_0x15902d)['toString']();return new URL(_0x15902d)[_0xfd7c59(0x116)]();}catch{return null;}}export function looksLikeLoginUrl(_0x225ce7){const _0x466b38=_0x2da3cf;try{const _0x3ac293=new URL(_0x225ce7);return LOGIN_URL_PATTERN[_0x466b38(0x119)](_0x3ac293[_0x466b38(0x11a)]);}catch{return LOGIN_URL_PATTERN[_0x466b38(0x119)](_0x225ce7);}}export async function isCachedSessionLive(_0x523f01,_0x37f549,_0xa58d87={},_0x460785={}){const _0x5ea50f=_0x2da3cf,_0x4cb91a={'PJLSs':function(_0x1ec56e,_0xe453ed,_0x816a87){return _0x1ec56e(_0xe453ed,_0x816a87);},'ARTfX':function(_0x393c72,_0x4d1e79){return _0x393c72===_0x4d1e79;},'sgoYD':function(_0x3210ab,_0xd24bbd){return _0x3210ab(_0xd24bbd);}},_0x45b298=_0x4cb91a[_0x5ea50f(0x11b)](buildSessionCheckUrl,_0x37f549,_0xa58d87[_0x5ea50f(0x105)]);if(!_0x45b298)return!![];if(!_0x460785[_0x5ea50f(0x11c)])return!![];let _0x88a725=null;try{_0x88a725=await _0x460785[_0x5ea50f(0x11c)]();const _0x12d55a=await _0x88a725['newContext']({'storageState':_0x523f01,'ignoreHTTPSErrors':!![],..._0xa58d87['setupHeaders']?{'extraHTTPHeaders':_0xa58d87[_0x5ea50f(0xf9)]}:{}}),_0x1db204=await _0x12d55a['newPage'](),_0x284a76=await _0x1db204[_0x5ea50f(0xfa)](_0x45b298,{'waitUntil':_0x5ea50f(0xfe),'timeout':0x3a98}),_0x7389d=_0x284a76?.['status']();if(_0x4cb91a[_0x5ea50f(0x123)](_0x7389d,0x191)||_0x4cb91a['ARTfX'](_0x7389d,0x193))return![];const _0x49af00=_0x1db204['url']();if(_0x4cb91a[_0x5ea50f(0x125)](looksLikeLoginUrl,_0x49af00))return![];return!![];}catch{return![];}finally{if(_0x88a725)await _0x88a725[_0x5ea50f(0xf7)]()[_0x5ea50f(0x117)](()=>{});}}function _0x1cb8(_0x15071b,_0x49fc2e){_0x15071b=_0x15071b-0xf5;const _0x56a77a=_0x56a7();let _0x1cb813=_0x56a77a[_0x15071b];return _0x1cb813;}function _0x56a7(){const _0x587906=['DSTVZ','MxWXH','4428179yFevNb','baseUrl','rSvxV','slice','toString','catch','auth','test','pathname','PJLSs','launchBrowser','::1','hostname','434708dYfcEW','2575890tCcwMz','8NZVxQk','isTTY','ARTfX','.storageState.json','sgoYD','digest','1237764uPwBCj','localhost.','171qsNTfr','localhost','invalidateOn','XBACN','keys','.json','1181772RiXvAr','close','sort','setupHeaders','goto','includes','env','3NzpCgC','domcontentloaded','filter','port','domain','RyvcY','clientIp','defaultEnvironmentKey','sessionCheckPath','sha256','has','effectiveBaseUrl','stdout','106035UgnBzW','userAgent','environments','imUIw','330340wbhvkB','stringify'];_0x56a7=function(){return _0x587906;};return _0x56a7();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x5300e5=_0x367a;function _0xe0ea(){const _0x4f800b=['setAuthTag','2973200PcXSbr','OIKGF','aes-256-gcm','subarray','10005294yVzqQj','40131MzudBB','13256264FTARvL','final','2753109nygHYF','1590312Gnpruj','XwzVA','1912100wbJcfh','7ciObAK','utf8','182bBGuML','5PRLfUY'];_0xe0ea=function(){return _0x4f800b;};return _0xe0ea();}(function(_0x396ba2,_0x1cc502){const _0x508ba3=_0x367a,_0x3e44da=_0x396ba2();while(!![]){try{const _0x404b79=parseInt(_0x508ba3(0x117))/0x1+-parseInt(_0x508ba3(0x11c))/0x2*(parseInt(_0x508ba3(0x113))/0x3)+parseInt(_0x508ba3(0x119))/0x4*(parseInt(_0x508ba3(0x11d))/0x5)+-parseInt(_0x508ba3(0x112))/0x6*(parseInt(_0x508ba3(0x11a))/0x7)+parseInt(_0x508ba3(0x114))/0x8+parseInt(_0x508ba3(0x116))/0x9+-parseInt(_0x508ba3(0x11f))/0xa;if(_0x404b79===_0x1cc502)break;else _0x3e44da['push'](_0x3e44da['shift']());}catch(_0x49ea36){_0x3e44da['push'](_0x3e44da['shift']());}}}(_0xe0ea,0xcf4c7));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM=_0x5300e5(0x121),SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;function _0x367a(_0x3a2af9,_0x32e0f4){_0x3a2af9=_0x3a2af9-0x112;const _0xe0ea73=_0xe0ea();let _0x367a28=_0xe0ea73[_0x3a2af9];return _0x367a28;}export function deriveKey(_0x4e1b81){const _0x57f635={'QphEu':'sha256'};return pbkdf2Sync(_0x4e1b81,SALT,0x186a0,KEY_LENGTH,_0x57f635['QphEu']);}export function encrypt(_0x5d3263,_0x5cccac){const _0x30a297={'Arqqs':function(_0x5495d0,_0x58a1cb,_0x196b5a,_0x4f0904){return _0x5495d0(_0x58a1cb,_0x196b5a,_0x4f0904);}},_0x352d9e=deriveKey(_0x5cccac),_0xf4c3b5=randomBytes(IV_LENGTH),_0x40f0b8=_0x30a297['Arqqs'](createCipheriv,ALGORITHM,_0x352d9e,_0xf4c3b5),_0xdfb943=Buffer['concat']([_0x40f0b8['update'](_0x5d3263,'utf8'),_0x40f0b8['final']()]),_0x362c22=_0x40f0b8['getAuthTag']();return Buffer['concat']([_0xf4c3b5,_0x362c22,_0xdfb943]);}export function decrypt(_0x172ce4,_0x3bc18c){const _0x2c3bdf=_0x5300e5,_0x649300={'xdPwy':function(_0x52866c,_0x3a2ad8){return _0x52866c(_0x3a2ad8);},'XwzVA':function(_0x167f43,_0x3cf7ba){return _0x167f43+_0x3cf7ba;},'OIKGF':_0x2c3bdf(0x11b)},_0x1fdc76=_0x649300['xdPwy'](deriveKey,_0x3bc18c),_0x5504de=_0x172ce4[_0x2c3bdf(0x122)](0x0,IV_LENGTH),_0x379bf4=_0x172ce4[_0x2c3bdf(0x122)](IV_LENGTH,_0x649300[_0x2c3bdf(0x118)](IV_LENGTH,TAG_LENGTH)),_0x8fdd62=_0x172ce4['subarray'](_0x649300[_0x2c3bdf(0x118)](IV_LENGTH,TAG_LENGTH)),_0x155ca8=createDecipheriv(ALGORITHM,_0x1fdc76,_0x5504de);return _0x155ca8[_0x2c3bdf(0x11e)](_0x379bf4),_0x155ca8['update'](_0x8fdd62)+_0x155ca8[_0x2c3bdf(0x115)](_0x649300[_0x2c3bdf(0x120)]);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x1f4d9d=_0x3a9e;function _0x29c5(){const _0x23e667=['wfTkB','2564520sFvfzI','invalid_option_value','POST','DEBUG','application/json','701919YZhzAQ','errorType','Tdond','toLowerCase','missing_required_argument','indexOf','includes','1744720gjUNEW','test','19VqjhFC','11537847rpSIRU','544254UFUdvJ','push','[desire-path]\x20Sending\x20log\x20to\x20','--header','stringify','4MVohca','[REDACTED]','RcVqE','Bearer\x20','6452utmGAq','--key','--password','no_token','unknown_command','env','startsWith','764735mfnOPt','--auth','error','KKauf','errorMessage','Missing\x20required\x20argument','peDHK','35sVesXZ','xRwiA','Unknown\x20command','/api/v1/mcp/desire-path-logs','[desire-path]\x20Payload:\x20','[desire-path]\x20Failed\x20to\x20send:\x20','IwZNF'];_0x29c5=function(){return _0x23e667;};return _0x29c5();}(function(_0x731d32,_0x4d0eaf){const _0x4667a2=_0x3a9e,_0xfe765e=_0x731d32();while(!![]){try{const _0x1270db=-parseInt(_0x4667a2(0x142))/0x1*(-parseInt(_0x4667a2(0x14d))/0x2)+-parseInt(_0x4667a2(0x139))/0x3+parseInt(_0x4667a2(0x149))/0x4*(-parseInt(_0x4667a2(0x154))/0x5)+-parseInt(_0x4667a2(0x144))/0x6*(-parseInt(_0x4667a2(0x12c))/0x7)+-parseInt(_0x4667a2(0x134))/0x8+parseInt(_0x4667a2(0x143))/0x9+-parseInt(_0x4667a2(0x140))/0xa;if(_0x1270db===_0x4d0eaf)break;else _0xfe765e['push'](_0xfe765e['shift']());}catch(_0x2b48eb){_0xfe765e['push'](_0xfe765e['shift']());}}}(_0x29c5,0xdf5b1));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set(['--token','-t','--secret','--api-key','--apikey',_0x1f4d9d(0x14e),_0x1f4d9d(0x14f),'--pass',_0x1f4d9d(0x155),'--authorization',_0x1f4d9d(0x147),'--cookie','--credentials']),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x24f89c){const _0x314446=_0x1f4d9d;return TOKEN_PATTERNS['some'](_0x33a787=>_0x33a787[_0x314446(0x141)](_0x24f89c));}function _0x3a9e(_0x4c5f11,_0x1a1e10){_0x4c5f11=_0x4c5f11-0x128;const _0x29c53f=_0x29c5();let _0x3a9e04=_0x29c53f[_0x4c5f11];return _0x3a9e04;}export function sanitizeArgs(_0x5913cb){const _0x39e6f3=_0x1f4d9d,_0x16aeaa={'Tdond':_0x39e6f3(0x14a),'Ukkso':function(_0x502e2c,_0x582d5a){return _0x502e2c!==_0x582d5a;}},_0x4070bc=[];let _0xeb0d75=![];for(let _0x4dab3c=0x0;_0x4dab3c<_0x5913cb['length'];_0x4dab3c++){const _0xa19264=_0x5913cb[_0x4dab3c];if(_0xeb0d75){_0x4070bc['push'](_0x16aeaa[_0x39e6f3(0x13b)]),_0xeb0d75=![];continue;}if(_0xa19264[_0x39e6f3(0x153)]('--')||_0xa19264[_0x39e6f3(0x153)]('-')){const _0x53287d=_0xa19264[_0x39e6f3(0x13e)]('=');if(_0x16aeaa['Ukkso'](_0x53287d,-0x1)){const _0x4b857b=_0xa19264['slice'](0x0,_0x53287d)['toLowerCase']();if(SENSITIVE_FLAGS['has'](_0x4b857b)){_0x4070bc[_0x39e6f3(0x145)](_0xa19264['slice'](0x0,_0x53287d)+'=[REDACTED]');continue;}}else{const _0xe503d5=_0xa19264[_0x39e6f3(0x13c)]();SENSITIVE_FLAGS['has'](_0xe503d5)&&(_0xeb0d75=!![]);}_0x4070bc[_0x39e6f3(0x145)](_0xa19264);}else looksLikeToken(_0xa19264)?_0x4070bc['push']('[REDACTED]'):_0x4070bc['push'](_0xa19264);}return _0x4070bc['join']('\x20');}export async function logDesirePath(_0x28a5ed){const _0x63873c=_0x1f4d9d,_0x2b67aa={'peDHK':function(_0x62f1b3){return _0x62f1b3();},'HmVdw':function(_0x54507f){return _0x54507f();},'gFvEK':'has_token','IwZNF':_0x63873c(0x138),'JrJBy':'Authorization','oRTsp':function(_0xc77e52,_0x23531e,_0x5c22cf){return _0xc77e52(_0x23531e,_0x5c22cf);},'KKauf':_0x63873c(0x136)};try{const _0x2165e6=await _0x2b67aa[_0x63873c(0x12b)](getToken)['catch'](()=>null),_0x13e501=_0x2b67aa['peDHK'](getApiBaseUrl),_0x233e50=_0x2b67aa['HmVdw'](getCurrentVersion),_0x1434af=_0x2165e6?_0x2b67aa['gFvEK']:_0x63873c(0x150),_0x4d736e={..._0x28a5ed['metadata'],'authStatus':_0x1434af,'isTty':process['stdout']['isTTY']??![]},_0x5857e0={'Content-Type':_0x2b67aa[_0x63873c(0x132)]};_0x2165e6&&(_0x5857e0[_0x2b67aa['JrJBy']]=_0x63873c(0x14c)+_0x2165e6);const _0x5644d1={'rawCommand':_0x28a5ed['rawCommand'],'errorMessage':_0x28a5ed[_0x63873c(0x129)],'errorType':_0x28a5ed[_0x63873c(0x13a)],'featureId':_0x28a5ed['featureId'],'sessionId':_0x28a5ed['sessionId'],'metadata':_0x4d736e,'cliVersion':_0x233e50};process[_0x63873c(0x152)]['DEBUG']&&(console[_0x63873c(0x156)](_0x63873c(0x146)+_0x13e501+'/api/v1/mcp/desire-path-logs'),console[_0x63873c(0x156)](_0x63873c(0x130)+JSON[_0x63873c(0x148)](_0x5644d1,null,0x2))),await _0x2b67aa['oRTsp'](fetch,_0x13e501+_0x63873c(0x12f),{'method':_0x2b67aa[_0x63873c(0x128)],'headers':_0x5857e0,'body':JSON['stringify'](_0x5644d1)});}catch(_0x43fcd1){process[_0x63873c(0x152)][_0x63873c(0x137)]&&console[_0x63873c(0x156)](_0x63873c(0x131)+_0x43fcd1);}}export function getErrorType(_0x44f697,_0x1dc887){const _0x354817=_0x1f4d9d,_0x234c6c={'wfTkB':'runtime_error','xRwiA':_0x354817(0x12e),'XbllG':_0x354817(0x151),'XXqnl':_0x354817(0x13d),'RcVqE':_0x354817(0x135)};if(_0x1dc887)return _0x234c6c[_0x354817(0x133)];if(!_0x44f697)return'unknown';if(_0x44f697[_0x354817(0x13f)](_0x234c6c[_0x354817(0x12d)]))return _0x234c6c['XbllG'];if(_0x44f697[_0x354817(0x13f)]('Unknown\x20argument'))return'unknown_argument';if(_0x44f697[_0x354817(0x13f)]('Not\x20enough\x20non-option\x20arguments'))return _0x234c6c['XXqnl'];if(_0x44f697['includes']('Invalid\x20values'))return _0x234c6c[_0x354817(0x14b)];if(_0x44f697['includes'](_0x354817(0x12a)))return'missing_option';return'syntax_error';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x4f70fc=_0x4785;(function(_0xaa4533,_0x2ff3bc){const _0x61f225=_0x4785,_0x9d64d8=_0xaa4533();while(!![]){try{const _0x160eae=-parseInt(_0x61f225(0x1ab))/0x1+parseInt(_0x61f225(0x1aa))/0x2+parseInt(_0x61f225(0x1a9))/0x3+-parseInt(_0x61f225(0x1c5))/0x4+-parseInt(_0x61f225(0x1c7))/0x5+-parseInt(_0x61f225(0x1a6))/0x6*(-parseInt(_0x61f225(0x1b8))/0x7)+parseInt(_0x61f225(0x19f))/0x8;if(_0x160eae===_0x2ff3bc)break;else _0x9d64d8['push'](_0x9d64d8['shift']());}catch(_0x1061f7){_0x9d64d8['push'](_0x9d64d8['shift']());}}}(_0x5e8f,0x6758a));import{spawn}from'child_process';import _0x19dc82 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';function _0x5e8f(){const _0x3d499f=['name','access_token','slow_down','BeBHw','aMrPM','organizationId','FDyOB','win32','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','yJiHu','1539784aBWqRl','firstName','platform','application/x-www-form-urlencoded','lOZPq','lbiwt','QOMTg','12rTxImi','aPjkd','darwin','2013900YYRcTw','1020692UhQbMJ','5980MJXRzI','filter','token','ignore','apiKeys','cAEDt','fZYGC','text','Authentication\x20failed','yXzIX','now','liQNd','yOpmm','2280026EGMBJg','stdout','Using\x20organization:\x20','unref','refresh_token','iVnJw','https://api.workos.com/user_management/authenticate','json','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','error','length','org_id','list','3209880aRMMEC','Failed\x20to\x20provision\x20API\x20key:\x20','3968995KIUbtf','isTTY','utf-8','/organization/my-memberships','verification_uri_complete','oCHKn','POST','Failed\x20to\x20create\x20organization:\x20','CLI\x20Key','startsWith','urn:ietf:params:oauth:grant-type:device_code','CIqXo','log','Setting\x20up\x20your\x20organization...','xYALK','error_description','Failed\x20to\x20provision\x20CLI\x20token:\x20','status','workosClientId','Waiting\x20for\x20authentication...','\x27s\x20CLI\x20Key','toString','/api-keys','xdg-open','device_code','UTHUe','tGmqa','email'];_0x5e8f=function(){return _0x3d499f;};return _0x5e8f();}import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL='https://api.workos.com/user_management/authorize/device',WORKOS_TOKEN_URL=_0x4f70fc(0x1be);export async function requestDeviceCode(_0x4ea630){const _0x3a82cd=_0x4f70fc,_0x12a1ef={'rTvPM':_0x3a82cd(0x1a2)},_0x5654a9=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x3a82cd(0x1cd),'headers':{'Content-Type':_0x12a1ef['rTvPM']},'body':new URLSearchParams({'client_id':_0x4ea630})});if(!_0x5654a9['ok']){const _0x404fab=await _0x5654a9['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x5654a9['status']+'\x20'+_0x404fab);}return _0x5654a9[_0x3a82cd(0x1bf)]();}export async function pollForTokens(_0x52b9ba,_0x4ff509,_0x43464a,_0x16b1bf){const _0x1b9a5a=_0x4f70fc,_0x4a19ce={'TXXei':function(_0x13d2d7,_0x39c491){return _0x13d2d7+_0x39c491;},'yJiHu':function(_0x385d57,_0x54f667){return _0x385d57*_0x54f667;},'CIqXo':_0x1b9a5a(0x1cd),'liQNd':'application/x-www-form-urlencoded','aMrPM':_0x1b9a5a(0x1d1),'QlGRz':function(_0x1ffb9f,_0x4dee74){return _0x1ffb9f===_0x4dee74;},'yOpmm':'authorization_pending','eeTWF':function(_0x30bdc6,_0x33fb92){return _0x30bdc6===_0x33fb92;},'eNbYA':'Device\x20authorization\x20timed\x20out'},_0xa1f551=_0x4a19ce['TXXei'](Date[_0x1b9a5a(0x1b5)](),_0x4a19ce['yJiHu'](_0x16b1bf,0x3e8));let _0x38bc86=_0x4a19ce[_0x1b9a5a(0x19e)](_0x43464a,0x3e8);while(Date[_0x1b9a5a(0x1b5)]()<_0xa1f551){await sleep(_0x38bc86);const _0x1dc918=await fetch(WORKOS_TOKEN_URL,{'method':_0x4a19ce[_0x1b9a5a(0x1d2)],'headers':{'Content-Type':_0x4a19ce[_0x1b9a5a(0x1b6)]},'body':new URLSearchParams({'client_id':_0x52b9ba,'device_code':_0x4ff509,'grant_type':_0x4a19ce[_0x1b9a5a(0x1e7)]})});if(_0x1dc918['ok'])return _0x1dc918['json']();const _0x1d5973=await _0x1dc918['json']();if(_0x4a19ce['QlGRz'](_0x1d5973[_0x1b9a5a(0x1c1)],_0x4a19ce[_0x1b9a5a(0x1b7)]))continue;if(_0x4a19ce['eeTWF'](_0x1d5973[_0x1b9a5a(0x1c1)],_0x1b9a5a(0x1e5))){_0x38bc86+=0x3e8;continue;}throw new Error(_0x1d5973[_0x1b9a5a(0x1d6)]||_0x1d5973[_0x1b9a5a(0x1c1)]||_0x1b9a5a(0x1b3));}throw new Error(_0x4a19ce['eNbYA']);}async function fetchUserProfile(_0x2d78de){const _0x5f1ff9={'nOPCn':function(_0x19ff3e){return _0x19ff3e();}},_0x40b96b=_0x5f1ff9['nOPCn'](getApiBaseUrl);try{const _0x33c256=await fetch(_0x40b96b+'/organization/me',{'method':'GET','headers':{'workos-token':_0x2d78de}});if(_0x33c256['ok'])return _0x33c256['json']();}catch{}return null;}function buildKeyName(_0x4547c5,_0x491605){const _0x47074a=_0x4f70fc,_0x42b8f8=_0x491605[_0x47074a(0x1ac)](_0x52253c=>_0x52253c['name']===_0x4547c5||_0x52253c[_0x47074a(0x1e3)][_0x47074a(0x1d0)](_0x4547c5+'\x20('));if(_0x42b8f8['length']===0x0)return _0x4547c5;return _0x4547c5+'\x20('+(_0x42b8f8['length']+0x1)+')';}export async function provisionApiKey(_0x9d59b4){const _0x41ce59=_0x4f70fc,_0xa5c3b5={'xwfpA':'application/json','cypNr':function(_0xf7b869,_0x2426f8){return _0xf7b869(_0x2426f8);},'xYALK':function(_0x57f4a8,_0xd60019,_0x51e3de){return _0x57f4a8(_0xd60019,_0x51e3de);},'BeBHw':'mcp:write'},_0x4c29c0=getApiBaseUrl(),_0x3cff11={'Content-Type':_0xa5c3b5['xwfpA'],'workos-token':_0x9d59b4},_0x215ad9=await _0xa5c3b5['cypNr'](fetchUserProfile,_0x9d59b4),_0x23f284=_0x215ad9?.[_0x41ce59(0x1a0)]||_0x215ad9?.[_0x41ce59(0x1e2)]?.['split']('@')[0x0],_0x4d0745=_0x23f284?_0x23f284+_0x41ce59(0x1db):_0x41ce59(0x1cf);let _0x17ecc6=[];try{const _0x4cb6a4=await fetch(_0x4c29c0+_0x41ce59(0x1dd),{'method':'GET','headers':_0x3cff11});if(_0x4cb6a4['ok']){const _0x4af750=await _0x4cb6a4[_0x41ce59(0x1bf)]();_0x17ecc6=_0x4af750[_0x41ce59(0x1af)];}}catch{}const _0x1e9123=_0xa5c3b5['xYALK'](buildKeyName,_0x4d0745,_0x17ecc6),_0xcd42d6=await _0xa5c3b5[_0x41ce59(0x1d5)](fetch,_0x4c29c0+_0x41ce59(0x1dd),{'method':'POST','headers':_0x3cff11,'body':JSON['stringify']({'name':_0x1e9123,'scope':_0xa5c3b5[_0x41ce59(0x1e6)]})});if(!_0xcd42d6['ok']){const _0xe2cfdb=await _0xcd42d6['text']();throw new Error(_0x41ce59(0x1c6)+_0xcd42d6[_0x41ce59(0x1d8)]+'\x20'+_0xe2cfdb);}const _0x5c5df7=await _0xcd42d6[_0x41ce59(0x1bf)]();return _0x5c5df7['apiKey'][_0x41ce59(0x1ad)];}export function openBrowser(_0x152761){const _0x34c4d8=_0x4f70fc,_0x2d244c={'xBWNu':_0x34c4d8(0x19c),'JMXxZ':function(_0x6d7f22,_0x4b8c92,_0x10ee37,_0x44b992){return _0x6d7f22(_0x4b8c92,_0x10ee37,_0x44b992);},'yXzIX':'open','UcATD':_0x34c4d8(0x1de),'FDyOB':'ignore'};try{if(process[_0x34c4d8(0x1a1)]===_0x2d244c['xBWNu']){const _0x442c51=_0x2d244c['JMXxZ'](spawn,'cmd',['/c','start','',_0x152761],{'detached':!![],'stdio':_0x34c4d8(0x1ae),'windowsHide':!![]});_0x442c51[_0x34c4d8(0x1bb)]();return;}const _0x1a2933=process['platform']===_0x34c4d8(0x1a8)?_0x2d244c[_0x34c4d8(0x1b4)]:_0x2d244c['UcATD'],_0x2b6218=spawn(_0x1a2933,[_0x152761],{'detached':!![],'stdio':_0x2d244c[_0x34c4d8(0x19b)]});_0x2b6218['unref']();}catch{}}function decodeJwtPayload(_0x2ff24a){const _0x304aac=_0x4f70fc,_0x1dc869={'CyBTl':'Invalid\x20JWT\x20format','tGmqa':'base64url','fZYGC':_0x304aac(0x1c9)},_0x17a15d=_0x2ff24a['split']('.');if(_0x17a15d[_0x304aac(0x1c2)]!==0x3)throw new Error(_0x1dc869['CyBTl']);const _0x1ce885=Buffer['from'](_0x17a15d[0x1],_0x1dc869[_0x304aac(0x1e1)])[_0x304aac(0x1dc)](_0x1dc869[_0x304aac(0x1b1)]);return JSON['parse'](_0x1ce885);}async function selfServeSignup(_0x4d914f){const _0x81d2fc=_0x4f70fc,_0x2bd25e={'XYeSf':function(_0x43af71){return _0x43af71();},'hhbar':'POST','aPjkd':'application/json'},_0x45e239=_0x2bd25e['XYeSf'](getApiBaseUrl),_0x2db7d2=await fetch(_0x45e239+'/organization/self-serve-signup',{'method':_0x2bd25e['hhbar'],'headers':{'Content-Type':_0x2bd25e[_0x81d2fc(0x1a7)],'workos-token':_0x4d914f}});if(!_0x2db7d2['ok']){const _0x235d0b=await _0x2db7d2['text']();throw new Error(_0x81d2fc(0x1ce)+_0x2db7d2[_0x81d2fc(0x1d8)]+'\x20'+_0x235d0b);}return _0x2db7d2[_0x81d2fc(0x1bf)]();}async function fetchMyMemberships(_0x5eb38a){const _0x2c49ae=_0x4f70fc,_0x1125a3=getApiBaseUrl(),_0x1a0536=await fetch(_0x1125a3+_0x2c49ae(0x1ca),{'method':'GET','headers':{'workos-token':_0x5eb38a}});if(!_0x1a0536['ok']){const _0x192365=await _0x1a0536[_0x2c49ae(0x1b2)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x1a0536['status']+'\x20'+_0x192365);}const _0x4fe44a=await _0x1a0536[_0x2c49ae(0x1bf)]();return _0x4fe44a['memberships'];}async function refreshTokenWithOrg(_0x326ab7,_0x93c2c0,_0x25a12b){const _0xc5ab37=_0x4f70fc,_0x1666e7=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x326ab7,'grant_type':'refresh_token','refresh_token':_0x93c2c0,'organization_id':_0x25a12b})});if(!_0x1666e7['ok']){const _0x1d2171=await _0x1666e7[_0xc5ab37(0x1b2)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x1666e7['status']+'\x20'+_0x1d2171);}return _0x1666e7['json']();}function _0x4785(_0x3d5b38,_0x103a81){_0x3d5b38=_0x3d5b38-0x19b;const _0x5e8f25=_0x5e8f();let _0x478541=_0x5e8f25[_0x3d5b38];return _0x478541;}async function provisionCliToken(_0x398571){const _0x41025d=_0x4f70fc,_0x463547={'QOMTg':function(_0xf33d0e,_0x2ca95e,_0x1c9bed){return _0xf33d0e(_0x2ca95e,_0x1c9bed);}},_0x2ae6f7=getApiBaseUrl(),_0x24dd4e=await _0x463547[_0x41025d(0x1a5)](fetch,_0x2ae6f7+'/cli-auth/token',{'method':'POST','headers':{'Content-Type':'application/json','workos-token':_0x398571}});if(!_0x24dd4e['ok']){const _0x2701f7=await _0x24dd4e[_0x41025d(0x1b2)]();throw new Error(_0x41025d(0x1d7)+_0x24dd4e['status']+'\x20'+_0x2701f7);}return _0x24dd4e['json']();}export async function runDeviceAuthFlow(){const _0x38de27=_0x4f70fc,_0x146c5c={'fAimg':function(_0x4aa700,_0x232941){return _0x4aa700(_0x232941);},'oCHKn':function(_0x3ef403,_0x172dc5){return _0x3ef403(_0x172dc5);},'pxtmb':function(_0x2fbb73,_0x20d39f){return _0x2fbb73(_0x20d39f);},'iVnJw':function(_0x1fa1fb,_0x3d4f94){return _0x1fa1fb===_0x3d4f94;},'lbiwt':_0x38de27(0x1d4),'UTHUe':function(_0x5b01cf,_0x20fd7d){return _0x5b01cf+_0x20fd7d;},'lOZPq':_0x38de27(0x19d),'KBGVF':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','BZDNc':_0x38de27(0x1c4),'cAEDt':'selected','FbzYF':'Provisioning\x20CLI\x20token...'},_0x40873b=getCurrentEnvironment(),_0x5d1484=ENVIRONMENT_CONFIGS[_0x40873b][_0x38de27(0x1d9)],_0x239951=await _0x146c5c['fAimg'](requestDeviceCode,_0x5d1484);console['log']('\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...'),console['log'](_0x38de27(0x1c0)),openBrowser(_0x239951['verification_uri_complete']),console['log']('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x239951[_0x38de27(0x1cb)]),console[_0x38de27(0x1d3)]('Code:\x20'+_0x239951['user_code']+'\x0a'),process[_0x38de27(0x1b9)]['write'](_0x38de27(0x1da));let _0x39feaa=await pollForTokens(_0x5d1484,_0x239951[_0x38de27(0x1df)],_0x239951['interval'],_0x239951['expires_in']);console[_0x38de27(0x1d3)]('\x20✓');const _0x5ba425=_0x146c5c[_0x38de27(0x1cc)](decodeJwtPayload,_0x39feaa[_0x38de27(0x1e4)]);if(!_0x5ba425[_0x38de27(0x1c3)]){const _0x128803=await _0x146c5c['pxtmb'](fetchMyMemberships,_0x39feaa['access_token']);let _0x4d1238;if(_0x146c5c['iVnJw'](_0x128803['length'],0x0)){process[_0x38de27(0x1b9)]['write'](_0x146c5c[_0x38de27(0x1a4)]);const _0x2b8b67=await _0x146c5c['fAimg'](selfServeSignup,_0x39feaa['access_token']);_0x4d1238=_0x2b8b67[_0x38de27(0x1e8)],console[_0x38de27(0x1d3)]('\x20✓');}else{if(_0x146c5c[_0x38de27(0x1bd)](_0x128803['length'],0x1))_0x4d1238=_0x128803[0x0]['organizationId'],console['log'](_0x38de27(0x1ba)+_0x128803[0x0][_0x38de27(0x1e3)]);else{const _0x265c7e=process['stdin'][_0x38de27(0x1c8)]&&process['stdout']['isTTY'];if(!_0x265c7e)throw new Error(_0x146c5c[_0x38de27(0x1e0)](_0x146c5c[_0x38de27(0x1a3)],_0x146c5c['KBGVF']));const {selected:_0x153c1f}=await _0x19dc82['prompt']([{'type':_0x146c5c['BZDNc'],'name':_0x146c5c[_0x38de27(0x1b0)],'message':'Select\x20an\x20organization:','choices':_0x128803['map'](_0x4664ad=>({'name':_0x4664ad[_0x38de27(0x1e3)],'value':_0x4664ad[_0x38de27(0x1e8)]}))}]);_0x4d1238=_0x153c1f;}}_0x39feaa=await refreshTokenWithOrg(_0x5d1484,_0x39feaa[_0x38de27(0x1bc)],_0x4d1238);}process['stdout']['write'](_0x146c5c['FbzYF']);const _0x351fd1=await provisionCliToken(_0x39feaa['access_token']);return console[_0x38de27(0x1d3)]('\x20✓'),await storeToken(_0x351fd1[_0x38de27(0x1ad)]),_0x39feaa['refresh_token']&&await storeRefreshToken(_0x39feaa['refresh_token']),_0x351fd1[_0x38de27(0x1ad)];}function sleep(_0x4f9f7f){return new Promise(_0x5345d6=>setTimeout(_0x5345d6,_0x4f9f7f));}
|
|
1
|
+
const _0x193a1c=_0xecea;(function(_0x30bc9d,_0x1dc690){const _0xe6e4d0=_0xecea,_0x348509=_0x30bc9d();while(!![]){try{const _0x376128=-parseInt(_0xe6e4d0(0xc4))/0x1*(parseInt(_0xe6e4d0(0xd5))/0x2)+parseInt(_0xe6e4d0(0xc1))/0x3+parseInt(_0xe6e4d0(0xb0))/0x4+-parseInt(_0xe6e4d0(0xd4))/0x5+parseInt(_0xe6e4d0(0xcf))/0x6+parseInt(_0xe6e4d0(0xd3))/0x7*(parseInt(_0xe6e4d0(0xbe))/0x8)+-parseInt(_0xe6e4d0(0xe6))/0x9;if(_0x376128===_0x1dc690)break;else _0x348509['push'](_0x348509['shift']());}catch(_0x375750){_0x348509['push'](_0x348509['shift']());}}}(_0x2316,0x75ec3));import{spawn}from'child_process';import _0x3bfa72 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x193a1c(0x99),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0x24ee09){const _0x59b45c=_0x193a1c,_0xda62d5={'CAehk':function(_0x4f4813,_0xe66d58,_0x153aef){return _0x4f4813(_0xe66d58,_0x153aef);},'zvdmi':_0x59b45c(0xa7),'ZBgiD':'application/x-www-form-urlencoded'},_0x20b939=await _0xda62d5[_0x59b45c(0x9e)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0xda62d5[_0x59b45c(0xa9)],'headers':{'Content-Type':_0xda62d5[_0x59b45c(0xc0)]},'body':new URLSearchParams({'client_id':_0x24ee09})});if(!_0x20b939['ok']){const _0x593af6=await _0x20b939['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x20b939['status']+'\x20'+_0x593af6);}return _0x20b939[_0x59b45c(0xc8)]();}export async function pollForTokens(_0x271828,_0x1a2ce4,_0x1b01c6,_0x18d0e5){const _0x2532da=_0x193a1c,_0x1a2a62={'KNcmD':function(_0x134493,_0x58f043){return _0x134493+_0x58f043;},'zHGqy':function(_0x128094,_0x2653de){return _0x128094(_0x2653de);},'DHUVJ':function(_0x3a2f0e,_0x5e81d9,_0x2e8466){return _0x3a2f0e(_0x5e81d9,_0x2e8466);},'RWxcP':_0x2532da(0xa7),'IQPtj':_0x2532da(0xbc),'fYBYl':function(_0x4ce0ab,_0x1b233d){return _0x4ce0ab===_0x1b233d;},'pZckJ':_0x2532da(0xaa),'IqdHD':_0x2532da(0xd2),'wgzhU':_0x2532da(0x9c)},_0x360716=_0x1a2a62[_0x2532da(0xbd)](Date[_0x2532da(0xdc)](),_0x18d0e5*0x3e8);let _0x1b502c=_0x1b01c6*0x3e8;while(Date[_0x2532da(0xdc)]()<_0x360716){await _0x1a2a62['zHGqy'](sleep,_0x1b502c);const _0xbf7f55=await _0x1a2a62['DHUVJ'](fetch,WORKOS_TOKEN_URL,{'method':_0x1a2a62['RWxcP'],'headers':{'Content-Type':_0x2532da(0x9a)},'body':new URLSearchParams({'client_id':_0x271828,'device_code':_0x1a2ce4,'grant_type':_0x1a2a62['IQPtj']})});if(_0xbf7f55['ok'])return _0xbf7f55['json']();const _0x5279be=await _0xbf7f55[_0x2532da(0xc8)]();if(_0x1a2a62[_0x2532da(0xad)](_0x5279be['error'],_0x1a2a62[_0x2532da(0xc5)]))continue;if(_0x5279be[_0x2532da(0xa3)]===_0x1a2a62[_0x2532da(0x93)]){_0x1b502c+=0x3e8;continue;}throw new Error(_0x5279be['error_description']||_0x5279be['error']||_0x1a2a62['wgzhU']);}throw new Error(_0x2532da(0x92));}async function fetchUserProfile(_0x2b8912){const _0x3a3303=_0x193a1c,_0x53248d={'BNFeH':function(_0x10a323){return _0x10a323();}},_0xbac7f7=_0x53248d['BNFeH'](getApiBaseUrl);try{const _0x43ce35=await fetch(_0xbac7f7+_0x3a3303(0xea),{'method':'GET','headers':{'workos-token':_0x2b8912}});if(_0x43ce35['ok'])return _0x43ce35[_0x3a3303(0xc8)]();}catch{}return null;}function buildKeyName(_0x5eb0df,_0x415fbe){const _0x246026=_0x193a1c,_0x4855a3=_0x415fbe['filter'](_0x3e1f7b=>_0x3e1f7b['name']===_0x5eb0df||_0x3e1f7b[_0x246026(0xe4)][_0x246026(0xae)](_0x5eb0df+'\x20('));if(_0x4855a3[_0x246026(0xd9)]===0x0)return _0x5eb0df;return _0x5eb0df+'\x20('+(_0x4855a3[_0x246026(0xd9)]+0x1)+')';}export async function provisionApiKey(_0xaf2878){const _0x515667=_0x193a1c,_0x4bdbc2={'VARbU':function(_0x3e9921,_0x16c79d){return _0x3e9921(_0x16c79d);},'xtDfc':'GET'},_0x2ebb95=getApiBaseUrl(),_0x3860db={'Content-Type':_0x515667(0x9f),'workos-token':_0xaf2878},_0x47b3a4=await _0x4bdbc2[_0x515667(0xe5)](fetchUserProfile,_0xaf2878),_0x575033=_0x47b3a4?.['firstName']||_0x47b3a4?.['email']?.['split']('@')[0x0],_0x52bac9=_0x575033?_0x575033+'\x27s\x20CLI\x20Key':_0x515667(0xbf);let _0xbfb35b=[];try{const _0x866a9d=await fetch(_0x2ebb95+'/api-keys',{'method':_0x4bdbc2['xtDfc'],'headers':_0x3860db});if(_0x866a9d['ok']){const _0xcc1a67=await _0x866a9d['json']();_0xbfb35b=_0xcc1a67['apiKeys'];}}catch{}const _0x72f7a6=buildKeyName(_0x52bac9,_0xbfb35b),_0x333464=await fetch(_0x2ebb95+_0x515667(0xc9),{'method':_0x515667(0xa7),'headers':_0x3860db,'body':JSON[_0x515667(0xb9)]({'name':_0x72f7a6,'scope':'mcp:write'})});if(!_0x333464['ok']){const _0xb740de=await _0x333464[_0x515667(0xb4)]();throw new Error(_0x515667(0xa1)+_0x333464['status']+'\x20'+_0xb740de);}const _0x3f5188=await _0x333464[_0x515667(0xc8)]();return _0x3f5188[_0x515667(0xa4)][_0x515667(0xcd)];}export function openBrowser(_0xfed64){const _0x422410=_0x193a1c,_0x16148e={'gGOtb':function(_0x202dfc,_0x7ae5d3){return _0x202dfc===_0x7ae5d3;},'czLrd':_0x422410(0xe0),'lrPUC':function(_0x205719,_0x12a0d3){return _0x205719===_0x12a0d3;},'Lbolm':'darwin','iIwPw':_0x422410(0xdd),'fwdUS':'xdg-open','wUrgc':function(_0x3239f9,_0x5e5fc0,_0x248ca5,_0x5abec1){return _0x3239f9(_0x5e5fc0,_0x248ca5,_0x5abec1);}};try{if(_0x16148e['gGOtb'](process[_0x422410(0xc7)],'win32')){const _0x37ae58=spawn(_0x422410(0xe8),['/c','start','',_0xfed64],{'detached':!![],'stdio':_0x16148e[_0x422410(0xe9)],'windowsHide':!![]});_0x37ae58[_0x422410(0xda)]();return;}const _0xb9117b=_0x16148e[_0x422410(0xce)](process['platform'],_0x16148e[_0x422410(0x98)])?_0x16148e[_0x422410(0xcc)]:_0x16148e['fwdUS'],_0x5cad94=_0x16148e[_0x422410(0x9d)](spawn,_0xb9117b,[_0xfed64],{'detached':!![],'stdio':_0x16148e['czLrd']});_0x5cad94['unref']();}catch{}}function decodeJwtPayload(_0x5c1234){const _0x2fc82c=_0x193a1c,_0x234a6d={'YlfGO':function(_0x5b4f7c,_0x25c2e7){return _0x5b4f7c!==_0x25c2e7;},'LJVVT':_0x2fc82c(0xac)},_0x263233=_0x5c1234['split']('.');if(_0x234a6d['YlfGO'](_0x263233['length'],0x3))throw new Error(_0x234a6d[_0x2fc82c(0xe3)]);const _0x5824f0=Buffer[_0x2fc82c(0xa6)](_0x263233[0x1],'base64url')[_0x2fc82c(0xc2)](_0x2fc82c(0xa5));return JSON['parse'](_0x5824f0);}async function selfServeSignup(_0x173286){const _0x4f525d=_0x193a1c,_0x5b2904={'fJAju':function(_0x305b7f,_0x48fca4,_0x21b152){return _0x305b7f(_0x48fca4,_0x21b152);},'CnFRs':_0x4f525d(0x9f)},_0x57f990=getApiBaseUrl(),_0x5d5ad9=await _0x5b2904['fJAju'](fetch,_0x57f990+'/organization/self-serve-signup',{'method':_0x4f525d(0xa7),'headers':{'Content-Type':_0x5b2904[_0x4f525d(0xd8)],'workos-token':_0x173286}});if(!_0x5d5ad9['ok']){const _0x296ff3=await _0x5d5ad9['text']();throw new Error(_0x4f525d(0xe1)+_0x5d5ad9['status']+'\x20'+_0x296ff3);}return _0x5d5ad9[_0x4f525d(0xc8)]();}async function fetchMyMemberships(_0x26405b){const _0x3014c5=_0x193a1c,_0x31c7fa={'EZGZX':function(_0x4693b7,_0x5cbde2,_0x19d60b){return _0x4693b7(_0x5cbde2,_0x19d60b);}},_0x50b3ee=getApiBaseUrl(),_0x4a3ffb=await _0x31c7fa[_0x3014c5(0xc6)](fetch,_0x50b3ee+_0x3014c5(0xde),{'method':'GET','headers':{'workos-token':_0x26405b}});if(!_0x4a3ffb['ok']){const _0xff9692=await _0x4a3ffb['text']();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x4a3ffb[_0x3014c5(0xb5)]+'\x20'+_0xff9692);}const _0x2aec12=await _0x4a3ffb[_0x3014c5(0xc8)]();return _0x2aec12[_0x3014c5(0xd0)];}async function refreshTokenWithOrg(_0x28f38a,_0x10fbe5,_0x77cdcd){const _0x2b3a71=_0x193a1c,_0x2b8969={'SqVyy':'POST','chBkI':_0x2b3a71(0x9a)},_0xf24646=await fetch(WORKOS_TOKEN_URL,{'method':_0x2b8969[_0x2b3a71(0xab)],'headers':{'Content-Type':_0x2b8969['chBkI']},'body':new URLSearchParams({'client_id':_0x28f38a,'grant_type':'refresh_token','refresh_token':_0x10fbe5,'organization_id':_0x77cdcd})});if(!_0xf24646['ok']){const _0x264b54=await _0xf24646[_0x2b3a71(0xb4)]();throw new Error(_0x2b3a71(0xb6)+_0xf24646[_0x2b3a71(0xb5)]+'\x20'+_0x264b54);}return _0xf24646['json']();}async function provisionCliToken(_0x5370ab){const _0x3dfd27=_0x193a1c,_0x3ddd57={'ZZmUO':function(_0x4e3c4a){return _0x4e3c4a();},'RVBQz':function(_0x117c33,_0x603244,_0x135024){return _0x117c33(_0x603244,_0x135024);},'btHZb':'POST','arGZp':_0x3dfd27(0x9f)},_0x414387=_0x3ddd57[_0x3dfd27(0xb7)](getApiBaseUrl),_0x25de0e=await _0x3ddd57[_0x3dfd27(0x97)](fetch,_0x414387+_0x3dfd27(0xa2),{'method':_0x3ddd57[_0x3dfd27(0xcb)],'headers':{'Content-Type':_0x3ddd57['arGZp'],'workos-token':_0x5370ab}});if(!_0x25de0e['ok']){const _0xaa359=await _0x25de0e[_0x3dfd27(0xb4)]();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x25de0e['status']+'\x20'+_0xaa359);}return _0x25de0e['json']();}export async function runDeviceAuthFlow(){const _0x398bdc=_0x193a1c,_0x50b5bb={'pcBHI':function(_0x169ae4,_0x362b07){return _0x169ae4(_0x362b07);},'ALAYI':function(_0x4322fc,_0x2a747a){return _0x4322fc(_0x2a747a);},'izRlr':'Setting\x20up\x20your\x20organization...','jczZn':function(_0x5e87a8,_0x3c71b3){return _0x5e87a8(_0x3c71b3);},'fzeTO':_0x398bdc(0xe7),'DMCJu':'list','pRovy':function(_0x96dd8a,_0x19fbad){return _0x96dd8a(_0x19fbad);}},_0x255fda=getCurrentEnvironment(),_0x33dee3=ENVIRONMENT_CONFIGS[_0x255fda]['workosClientId'],_0x12a917=await _0x50b5bb[_0x398bdc(0x95)](requestDeviceCode,_0x33dee3);console[_0x398bdc(0x94)](_0x398bdc(0xe2)),console['log']('\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a'),_0x50b5bb['ALAYI'](openBrowser,_0x12a917[_0x398bdc(0xc3)]),console['log']('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x12a917['verification_uri_complete']),console['log']('Code:\x20'+_0x12a917[_0x398bdc(0xd6)]+'\x0a'),process['stdout']['write'](_0x398bdc(0xa8));let _0x43b23d=await pollForTokens(_0x33dee3,_0x12a917[_0x398bdc(0xaf)],_0x12a917['interval'],_0x12a917[_0x398bdc(0xbb)]);console[_0x398bdc(0x94)]('\x20✓');const _0x16191b=decodeJwtPayload(_0x43b23d['access_token']);if(!_0x16191b[_0x398bdc(0xb3)]){const _0x2d06f8=await fetchMyMemberships(_0x43b23d[_0x398bdc(0xba)]);let _0x2ec395;if(_0x2d06f8['length']===0x0){process[_0x398bdc(0xb2)][_0x398bdc(0xa0)](_0x50b5bb[_0x398bdc(0xb1)]);const _0x331faa=await _0x50b5bb['jczZn'](selfServeSignup,_0x43b23d['access_token']);_0x2ec395=_0x331faa[_0x398bdc(0xb8)],console[_0x398bdc(0x94)]('\x20✓');}else{if(_0x2d06f8['length']===0x1)_0x2ec395=_0x2d06f8[0x0][_0x398bdc(0xb8)],console[_0x398bdc(0x94)]('Using\x20organization:\x20'+_0x2d06f8[0x0]['name']);else{const _0x31e660=process['stdin'][_0x398bdc(0x96)]&&process['stdout']['isTTY'];if(!_0x31e660)throw new Error(_0x50b5bb[_0x398bdc(0xdf)]+_0x398bdc(0x9b));const {selected:_0x5827bf}=await _0x3bfa72[_0x398bdc(0xdb)]([{'type':_0x50b5bb['DMCJu'],'name':'selected','message':_0x398bdc(0xd1),'choices':_0x2d06f8[_0x398bdc(0xca)](_0x135b0a=>({'name':_0x135b0a['name'],'value':_0x135b0a['organizationId']}))}]);_0x2ec395=_0x5827bf;}}_0x43b23d=await refreshTokenWithOrg(_0x33dee3,_0x43b23d[_0x398bdc(0xd7)],_0x2ec395);}process['stdout'][_0x398bdc(0xa0)]('Provisioning\x20CLI\x20token...');const _0x51d45f=await provisionCliToken(_0x43b23d['access_token']);return console[_0x398bdc(0x94)]('\x20✓'),await _0x50b5bb['pRovy'](storeToken,_0x51d45f['token']),_0x43b23d[_0x398bdc(0xd7)]&&await storeRefreshToken(_0x43b23d['refresh_token']),_0x51d45f[_0x398bdc(0xcd)];}function _0xecea(_0x3c1f19,_0x76b2ea){_0x3c1f19=_0x3c1f19-0x92;const _0x2316f8=_0x2316();let _0xecea08=_0x2316f8[_0x3c1f19];return _0xecea08;}function sleep(_0xbc53d9){return new Promise(_0x54ece8=>setTimeout(_0x54ece8,_0xbc53d9));}function _0x2316(){const _0x347dac=['pZckJ','EZGZX','platform','json','/api-keys','map','btHZb','iIwPw','token','lrPUC','3351396kKOPUB','memberships','Select\x20an\x20organization:','slow_down','4011GMecKR','160430uiJSId','17452veqvSS','user_code','refresh_token','CnFRs','length','unref','prompt','now','open','/organization/my-memberships','fzeTO','ignore','Failed\x20to\x20create\x20organization:\x20','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','LJVVT','name','VARbU','12376737dqkSgz','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','cmd','czLrd','/organization/me','Device\x20authorization\x20timed\x20out','IqdHD','log','pcBHI','isTTY','RVBQz','Lbolm','https://api.workos.com/user_management/authorize/device','application/x-www-form-urlencoded','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','Authentication\x20failed','wUrgc','CAehk','application/json','write','Failed\x20to\x20provision\x20API\x20key:\x20','/cli-auth/token','error','apiKey','utf-8','from','POST','Waiting\x20for\x20authentication...','zvdmi','authorization_pending','SqVyy','Invalid\x20JWT\x20format','fYBYl','startsWith','device_code','3065248klbISe','izRlr','stdout','org_id','text','status','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','ZZmUO','organizationId','stringify','access_token','expires_in','urn:ietf:params:oauth:grant-type:device_code','KNcmD','9096YamtZB','CLI\x20Key','ZBgiD','500895CjjeGD','toString','verification_uri_complete','29pdXQUA'];_0x2316=function(){return _0x347dac;};return _0x2316();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x171ced=_0x3aad;(function(_0x98e75f,_0x55b90a){const _0x39c9d6=_0x3aad,_0x430dd7=_0x98e75f();while(!![]){try{const _0x4ea819=-parseInt(_0x39c9d6(0xd2))/0x1+parseInt(_0x39c9d6(0xdc))/0x2+-parseInt(_0x39c9d6(0xc0))/0x3*(-parseInt(_0x39c9d6(0xce))/0x4)+-parseInt(_0x39c9d6(0xc5))/0x5+-parseInt(_0x39c9d6(0xd8))/0x6*(-parseInt(_0x39c9d6(0xc4))/0x7)+parseInt(_0x39c9d6(0xdd))/0x8*(-parseInt(_0x39c9d6(0xcd))/0x9)+parseInt(_0x39c9d6(0xd4))/0xa;if(_0x4ea819===_0x55b90a)break;else _0x430dd7['push'](_0x430dd7['shift']());}catch(_0x1f1a26){_0x430dd7['push'](_0x430dd7['shift']());}}}(_0x4739,0xcc884));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':_0x171ced(0xca),'workosClientId':_0x171ced(0xd0),'aiProxyUrl':_0x171ced(0xd5),'mcpAuthUrl':_0x171ced(0xd7)},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':_0x171ced(0xdb),'mcpAuthUrl':'https://mcp-auth.staging.ranger.net/mcp'},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT='prod';export function isValidEnvironment(_0x4a4892){const _0x207fe9=_0x171ced,_0x121667={'cHNLx':function(_0x57fca5,_0x26395e){return _0x57fca5===_0x26395e;},'wShLV':'prod','jdrCh':_0x207fe9(0xd1)};return _0x121667['cHNLx'](_0x4a4892,_0x121667['wShLV'])||_0x4a4892===_0x121667['jdrCh']||_0x4a4892==='local';}export function getCurrentEnvironment(){const _0x5552a1=_0x171ced,_0x2776e9=process[_0x5552a1(0xc9)][_0x5552a1(0xcb)];if(_0x2776e9&&isValidEnvironment(_0x2776e9))return _0x2776e9;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x579de3=_0x171ced;return process[_0x579de3(0xc9)]['RANGER_API_URL']||ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x579de3(0xda)];}export function getAiProxyUrl(){const _0x3ad9c7=_0x171ced,_0x3d70e1={'VegWL':function(_0x4a7f40){return _0x4a7f40();}};return process[_0x3ad9c7(0xc9)][_0x3ad9c7(0xd3)]||ENVIRONMENT_CONFIGS[_0x3d70e1['VegWL'](getCurrentEnvironment)]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x45471d=_0x171ced;return process[_0x45471d(0xc9)][_0x45471d(0xc6)]??ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['mcpAuthUrl'];}function _0x3aad(_0x4318c1,_0x2f9e01){_0x4318c1=_0x4318c1-0xbe;const _0x473968=_0x4739();let _0x3aad58=_0x473968[_0x4318c1];return _0x3aad58;}export function isByokEnabled(){const _0x194be3=_0x171ced,_0x121aec={'sEVPa':function(_0x1b8c32,_0x73c077){return _0x1b8c32===_0x73c077;}};return _0x121aec[_0x194be3(0xc8)](process[_0x194be3(0xc9)]['RANGER_BYOK'],'true');}function isVerificationTransport(_0x2422e6){const _0x271b43=_0x171ced,_0x10c567={'BSjkL':'playwright-cli','ZRNFe':function(_0xbfce23,_0x48e0a8){return _0xbfce23===_0x48e0a8;},'YsFXy':'rangerwright-cli'};return _0x2422e6==='mcp'||_0x2422e6===_0x10c567[_0x271b43(0xd6)]||_0x10c567['ZRNFe'](_0x2422e6,_0x271b43(0xc2))||_0x10c567['ZRNFe'](_0x2422e6,_0x10c567[_0x271b43(0xbe)]);}const LEGACY_TRANSPORT_ENV_VARS=['RANGER_USE_NOVA_ACT','RANGER_DISABLE_MCP'];export function getVerificationTransport(){const _0x2b8684=_0x171ced,_0xdbf03e={'Jnvvj':'mcp'},_0x4c384a=process[_0x2b8684(0xc9)]['RANGER_TRANSPORT']?.[_0x2b8684(0xcc)]();if(_0x4c384a){if(isVerificationTransport(_0x4c384a))return _0x4c384a;throw new Error(_0x2b8684(0xc7)+_0x4c384a+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x33bd1c=LEGACY_TRANSPORT_ENV_VARS['find'](_0x55c014=>process['env'][_0x55c014]);if(_0x33bd1c)throw new Error(_0x33bd1c+_0x2b8684(0xc1));return _0xdbf03e[_0x2b8684(0xc3)];}function _0x4739(){const _0x5ac33e=['Jnvvj','219107mkRxkj','7946945qHNdti','RANGER_MCP_AUTH_URL','Invalid\x20RANGER_TRANSPORT=\x22','sEVPa','env','https://api.ranger.net','RANGER_CLI_ENV','trim','72rLtbex','248YxinuO','RANGER_HOOKS','client_01J9CBYM7M5ZETCF7G6614DXR2','staging','1170399fFRbDF','RANGER_AI_PROXY_URL','29994040dDFNYA','https://ai-proxy-716115358910.us-central1.run.app','BSjkL','https://mcp-auth.ranger.net/mcp','246RFcoBq','auto','apiBaseUrl','https://ai-proxy-301751771437.us-central1.run.app','1564950eoTuyU','1581872RZTjoC','dWCcX','YsFXy','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.','5526hGQEPp','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','nova-act-cli'];_0x4739=function(){return _0x5ac33e;};return _0x4739();}export function resolveHookMode(_0x558118=process['env']){const _0x1dbd18=_0x171ced,_0x51ba4d={'dWCcX':function(_0x1f96a7,_0x41f038){return _0x1f96a7===_0x41f038;},'NqyrD':'off','QkVBC':function(_0x334848,_0x2314dd){return _0x334848===_0x2314dd;},'CfXpK':function(_0x4eb698,_0x5a838a){return _0x4eb698+_0x5a838a;}},_0x131d43=_0x558118[_0x1dbd18(0xcf)]?.[_0x1dbd18(0xcc)]()['toLowerCase']();if(!_0x131d43)return _0x1dbd18(0xd9);if(_0x51ba4d['dWCcX'](_0x131d43,_0x51ba4d['NqyrD'])||_0x51ba4d['QkVBC'](_0x131d43,'on')||_0x51ba4d[_0x1dbd18(0xde)](_0x131d43,_0x1dbd18(0xd9)))return _0x131d43;return console['error'](_0x51ba4d['CfXpK']('[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22'+_0x558118['RANGER_HOOKS']+'\x22.\x20',_0x1dbd18(0xbf))),_0x1dbd18(0xd9);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x12c4ba,_0x257bb7){const _0x4257b1=_0x1d81,_0x1cd3f3=_0x12c4ba();while(!![]){try{const _0x5d0395=-parseInt(_0x4257b1(0x104))/0x1*(-parseInt(_0x4257b1(0xdf))/0x2)+-parseInt(_0x4257b1(0x10c))/0x3*(-parseInt(_0x4257b1(0xe1))/0x4)+-parseInt(_0x4257b1(0xfb))/0x5+parseInt(_0x4257b1(0x10b))/0x6+parseInt(_0x4257b1(0x10d))/0x7+-parseInt(_0x4257b1(0xe3))/0x8+-parseInt(_0x4257b1(0x100))/0x9;if(_0x5d0395===_0x257bb7)break;else _0x1cd3f3['push'](_0x1cd3f3['shift']());}catch(_0x242903){_0x1cd3f3['push'](_0x1cd3f3['shift']());}}}(_0x26f7,0xb5258));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x56693d){const _0xcee1d9=_0x1d81,_0xd4898a={'laWAv':function(_0x7c8352,_0x545ed8){return _0x7c8352===_0x545ed8;},'WcmzC':_0xcee1d9(0xff)},_0x446781=await getToken();if(!_0x446781)throw new Error(_0xcee1d9(0xfe));const _0x26839f=getApiBaseUrl(),_0x6ef78c=await fetch(_0x26839f+'/api/v1/mcp/features',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x446781,'Content-Type':_0xcee1d9(0xd0)},'body':JSON[_0xcee1d9(0xed)](_0x56693d)});if(!_0x6ef78c['ok']){if(_0xd4898a['laWAv'](_0x6ef78c['status'],0x192)){const _0xa88e9f=await _0x6ef78c['json'](),_0x50e274=_0xa88e9f['billingUrl']||_0xd4898a['WcmzC'];throw new Error((_0xa88e9f[_0xcee1d9(0xfa)]||'Feature\x20limit\x20exceeded')+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x50e274);}const _0x218100=await _0x6ef78c['text']();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x218100);}return _0x6ef78c[_0xcee1d9(0xf3)]();}export async function listFeatures(_0x4c7722){const _0x18e7d4=_0x1d81,_0x555766={'OrgOI':function(_0x36a743){return _0x36a743();},'wxvOL':'gitRepoUrl','ojYwy':_0x18e7d4(0xe9),'winBP':'includeDeleted'},_0xede20b=await getToken();if(!_0xede20b)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5a526b=_0x555766[_0x18e7d4(0xde)](getApiBaseUrl),_0x3088f2=new URLSearchParams();if(_0x4c7722?.[_0x18e7d4(0x109)])_0x3088f2[_0x18e7d4(0xe2)](_0x555766[_0x18e7d4(0xd9)],_0x4c7722[_0x18e7d4(0x109)]);if(_0x4c7722?.['gitBranch'])_0x3088f2['set'](_0x18e7d4(0xf9),_0x4c7722['gitBranch']);if(_0x4c7722?.[_0x18e7d4(0xe9)])_0x3088f2[_0x18e7d4(0xe2)](_0x555766[_0x18e7d4(0xd1)],_0x4c7722[_0x18e7d4(0xe9)][_0x18e7d4(0xf4)]());if(_0x4c7722?.[_0x18e7d4(0xf7)])_0x3088f2['set']('offset',_0x4c7722['offset'][_0x18e7d4(0xf4)]());if(_0x4c7722?.[_0x18e7d4(0xf8)])_0x3088f2[_0x18e7d4(0xe2)](_0x555766['winBP'],'true');const _0x5d1c69=_0x5a526b+_0x18e7d4(0xee)+(_0x3088f2['toString']()?'?'+_0x3088f2['toString']():''),_0x4c2b94=await fetch(_0x5d1c69,{'method':'GET','headers':{'Authorization':_0x18e7d4(0xeb)+_0xede20b}});if(!_0x4c2b94['ok']){const _0x1b197d=await _0x4c2b94[_0x18e7d4(0xda)]();throw new Error(_0x18e7d4(0xe7)+_0x1b197d);}return _0x4c2b94['json']();}export async function getFeature(_0x175fa0){const _0x440b93=_0x1d81,_0x295dce={'soUtM':function(_0x4b2077){return _0x4b2077();},'BRept':function(_0x517ba9,_0x119b60,_0x437add){return _0x517ba9(_0x119b60,_0x437add);}},_0x546f8f=await _0x295dce['soUtM'](getToken);if(!_0x546f8f)throw new Error(_0x440b93(0xfe));const _0x33f58d=_0x295dce[_0x440b93(0xef)](getApiBaseUrl),_0x3e9e0d=await _0x295dce[_0x440b93(0xfd)](fetch,_0x33f58d+_0x440b93(0xdb)+_0x175fa0,{'method':_0x440b93(0x10e),'headers':{'Authorization':_0x440b93(0xeb)+_0x546f8f}});if(!_0x3e9e0d['ok']){const _0x4db7ca=await _0x3e9e0d[_0x440b93(0xda)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x4db7ca);}return _0x3e9e0d[_0x440b93(0xf3)]();}export async function updateFeature(_0x4278b2,_0x287759){const _0x22132f=_0x1d81,_0x1b9fb0={'slAPf':function(_0x2e6d80){return _0x2e6d80();}},_0x1aa427=await _0x1b9fb0['slAPf'](getToken);if(!_0x1aa427)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1e784a=_0x1b9fb0['slAPf'](getApiBaseUrl),_0x49eaff=await fetch(_0x1e784a+'/api/v1/mcp/features/'+_0x4278b2,{'method':_0x22132f(0x101),'headers':{'Authorization':_0x22132f(0xeb)+_0x1aa427,'Content-Type':'application/json'},'body':JSON[_0x22132f(0xed)](_0x287759)});if(!_0x49eaff['ok']){const _0xc66272=await _0x49eaff[_0x22132f(0xda)]();throw new Error(_0x22132f(0xe6)+_0xc66272);}return _0x49eaff[_0x22132f(0xf3)]();}export async function createChecklistItem(_0x2c22d7,_0xcb7b6e,_0x676d1f){const _0x312d82=_0x1d81,_0x178694={'RsARe':function(_0x293926){return _0x293926();},'rkfQz':'POST','kMccU':_0x312d82(0xd0)},_0x5ae426=await _0x178694['RsARe'](getToken);if(!_0x5ae426)throw new Error(_0x312d82(0xfe));const _0xf81574=_0x178694['RsARe'](getApiBaseUrl),_0x4e99a8=await fetch(_0xf81574+'/api/v1/mcp/features/'+_0x2c22d7+'/checklist',{'method':_0x178694[_0x312d82(0xcf)],'headers':{'Authorization':'Bearer\x20'+_0x5ae426,'Content-Type':_0x178694['kMccU']},'body':JSON[_0x312d82(0xed)]({'description':_0xcb7b6e,'position':_0x676d1f})});if(!_0x4e99a8['ok']){const _0x514cd3=await _0x4e99a8['text']();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x514cd3);}return _0x4e99a8[_0x312d82(0xf3)]();}export async function updateChecklistItem(_0x55ffa3,_0x4284f7,_0x44782b){const _0x5b250d=_0x1d81,_0x1740c4={'KOLaz':function(_0x59fcc3){return _0x59fcc3();},'SmhwD':function(_0x532c53,_0x5d1351,_0xf88bf1){return _0x532c53(_0x5d1351,_0xf88bf1);},'TjoOq':'PATCH','PJDpm':_0x5b250d(0xd0),'zmzzy':'updateChecklistItem'};return withRetry(async()=>{const _0x1faf07=_0x5b250d,_0x28187c=await getToken();if(!_0x28187c)throw new Error(_0x1faf07(0xfe));const _0x1cd8f0=_0x1740c4[_0x1faf07(0xf2)](getApiBaseUrl),_0x2980d5=await _0x1740c4[_0x1faf07(0x108)](fetch,_0x1cd8f0+'/api/v1/mcp/features/'+_0x55ffa3+'/checklist/'+_0x4284f7,{'method':_0x1740c4['TjoOq'],'headers':{'Authorization':'Bearer\x20'+_0x28187c,'Content-Type':_0x1740c4['PJDpm']},'body':JSON['stringify'](_0x44782b)});if(!_0x2980d5['ok']){const _0x468f8e=await _0x2980d5['text']();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x468f8e);}return _0x2980d5[_0x1faf07(0xf3)]();},{'label':_0x1740c4[_0x5b250d(0xf6)]});}function _0x1d81(_0xbd1b61,_0x248df6){_0xbd1b61=_0xbd1b61-0xcf;const _0x26f77b=_0x26f7();let _0x1d815e=_0x26f77b[_0xbd1b61];return _0x1d815e;}export async function getFeatureReport(_0xf64615){const _0x3104ed=_0x1d81,_0x3a2b56={'roZcM':_0x3104ed(0xfe),'ltStI':'GET'},_0x2cb5d3=await getToken();if(!_0x2cb5d3)throw new Error(_0x3a2b56[_0x3104ed(0xdc)]);const _0x57e2b6=getApiBaseUrl(),_0x12afb3=await fetch(_0x57e2b6+'/api/v1/mcp/features/'+_0xf64615+_0x3104ed(0x10a),{'method':_0x3a2b56['ltStI'],'headers':{'Authorization':_0x3104ed(0xeb)+_0x2cb5d3}});if(!_0x12afb3['ok']){const _0x371bfa=await _0x12afb3['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x371bfa);}return _0x12afb3['json']();}export async function getFeatureReportMarkdown(_0x57db63,_0x4def06){const _0x557fa0=_0x1d81,_0x212c64={'nwdtK':function(_0x5f5ad0,_0x4ecb7a){return _0x5f5ad0(_0x4ecb7a);},'fGeOD':_0x557fa0(0x102),'KjGSQ':'sessionId','wdYWA':_0x557fa0(0x10e)},_0x1f9212=await getToken();if(!_0x1f9212)throw new Error(_0x557fa0(0xfe));const _0x470c90=getApiBaseUrl(),_0x3af1b9=new URLSearchParams(),_0x7f3562=(_0x4def06?.['itemIds']?.[_0x557fa0(0xd7)]??0x0)>0x0,_0x5bc820=_0x212c64[_0x557fa0(0xfc)](Boolean,_0x4def06?.['sessionId']);_0x7f3562&&_0x4def06?.[_0x557fa0(0x102)]&&_0x3af1b9[_0x557fa0(0xe2)](_0x212c64['fGeOD'],_0x4def06['itemIds']['join'](','));_0x5bc820&&_0x4def06?.[_0x557fa0(0xd5)]&&_0x3af1b9['set'](_0x212c64['KjGSQ'],_0x4def06[_0x557fa0(0xd5)]);!_0x7f3562&&!_0x5bc820&&_0x4def06?.[_0x557fa0(0x106)]&&_0x3af1b9[_0x557fa0(0xe2)](_0x557fa0(0x106),_0x4def06['style']);const _0xc15345=_0x470c90+'/api/v1/mcp/features/'+_0x57db63+_0x557fa0(0xe4),_0x3be8db=''+_0xc15345+(_0x3af1b9[_0x557fa0(0xf4)]()?'?'+_0x3af1b9[_0x557fa0(0xf4)]():''),_0x5a6272=await fetch(_0x3be8db,{'method':_0x212c64['wdYWA'],'headers':{'Authorization':'Bearer\x20'+_0x1f9212}});if(!_0x5a6272['ok']){const _0xcc85e5=await _0x5a6272['text']();throw new Error(_0x557fa0(0xd6)+_0xcc85e5);}return _0x5a6272[_0x557fa0(0xda)]();}function _0x26f7(){const _0x146607=['gitRepoUrl','/report','8461614PiKNan','9NNGtli','3702454DIoIsG','GET','rkfQz','application/json','ojYwy','/sessions/','/feedback','/comments/address','sessionId','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','length','unRwf','wxvOL','text','/api/v1/mcp/features/','roZcM','Failed\x20to\x20restore\x20feature\x20review:\x20','OrgOI','1682BCqROI','KeAqY','968292xDAblv','set','8612056RRUaNt','/report/markdown','BaIVY','Failed\x20to\x20update\x20feature\x20review:\x20','Failed\x20to\x20list\x20feature\x20reviews:\x20','TJDvk','limit','hmJWn','Bearer\x20','bXjIv','stringify','/api/v1/mcp/features','soUtM','POST','DELETE','KOLaz','json','toString','xhEIt','zmzzy','offset','includeDeleted','gitBranch','message','1882855hQfFio','nwdtK','BRept','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','https://dashboard.ranger.net/billing','9690453hzYTFy','PATCH','itemIds','Failed\x20to\x20start\x20session:\x20','721voOStf','/start','style','/restore','SmhwD'];_0x26f7=function(){return _0x146607;};return _0x26f7();}export async function listFeatureSessions(_0x463f15){const _0x40769e=_0x1d81,_0x37bcdf={'fHECC':function(_0x2d02ae){return _0x2d02ae();},'LKJyX':_0x40769e(0x10e)},_0xc3e6dd=await _0x37bcdf['fHECC'](getToken);if(!_0xc3e6dd)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x165456=getApiBaseUrl(),_0x5b911c=await fetch(_0x165456+'/api/v1/mcp/features/'+_0x463f15+'/sessions',{'method':_0x37bcdf['LKJyX'],'headers':{'Authorization':'Bearer\x20'+_0xc3e6dd}});if(!_0x5b911c['ok']){const _0x5770be=await _0x5b911c['text']();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x5770be);}return _0x5b911c['json']();}export async function startSession(_0x3c716d,_0x293456){const _0x312a28=_0x1d81,_0x2a097e={'unRwf':function(_0x12be10,_0x4cb643,_0x33152f){return _0x12be10(_0x4cb643,_0x33152f);},'bXjIv':_0x312a28(0xf0)},_0x505155=await getToken();if(!_0x505155)throw new Error(_0x312a28(0xfe));const _0xfbcdf1=getApiBaseUrl(),_0x387017=await _0x2a097e[_0x312a28(0xd8)](fetch,_0xfbcdf1+_0x312a28(0xdb)+_0x3c716d+_0x312a28(0xd2)+_0x293456+_0x312a28(0x105),{'method':_0x2a097e[_0x312a28(0xec)],'headers':{'Authorization':_0x312a28(0xeb)+_0x505155}});if(!_0x387017['ok']){const _0x20e759=await _0x387017[_0x312a28(0xda)]();throw new Error(_0x312a28(0x103)+_0x20e759);}return _0x387017['json']();}export async function concludeSession(_0x2804b1,_0x127595){const _0x4dead9=_0x1d81,_0x2bff95={'hmJWn':function(_0x556977){return _0x556977();},'KeAqY':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x67f07b=await _0x2bff95[_0x4dead9(0xea)](getToken);if(!_0x67f07b)throw new Error(_0x2bff95[_0x4dead9(0xe0)]);const _0x4bab39=getApiBaseUrl(),_0x5d6e51=await fetch(_0x4bab39+_0x4dead9(0xdb)+_0x2804b1+_0x4dead9(0xd2)+_0x127595+'/conclude',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x67f07b}});if(!_0x5d6e51['ok']){const _0x3d718f=await _0x5d6e51['text']();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x3d718f);}return _0x5d6e51[_0x4dead9(0xf3)]();}export async function getActionItems(_0x475ef1){const _0x4a77ff=_0x1d81,_0x651c3e={'tZflV':function(_0x1280b0){return _0x1280b0();},'TJDvk':function(_0x41ec08,_0x309ba7,_0x1d891f){return _0x41ec08(_0x309ba7,_0x1d891f);}},_0x101774=await getToken();if(!_0x101774)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4850d1=_0x651c3e['tZflV'](getApiBaseUrl),_0x3cad77=await _0x651c3e[_0x4a77ff(0xe8)](fetch,_0x4850d1+'/api/v1/mcp/features/'+_0x475ef1+'/action-items',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x101774}});if(!_0x3cad77['ok']){const _0x1ed9f5=await _0x3cad77['text']();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0x1ed9f5);}return _0x3cad77['json']();}export async function getItemFeedback(_0x395b36,_0x370041){const _0x2a371f=_0x1d81,_0x3a695b={'HEgeJ':_0x2a371f(0xfe),'JBOgE':function(_0x46cc5f){return _0x46cc5f();},'TDoPJ':function(_0x1b7c56,_0xd967f2,_0x5a84d){return _0x1b7c56(_0xd967f2,_0x5a84d);},'xhEIt':'GET'},_0x5c1495=await getToken();if(!_0x5c1495)throw new Error(_0x3a695b['HEgeJ']);const _0x1d8edc=_0x3a695b['JBOgE'](getApiBaseUrl),_0x263954=await _0x3a695b['TDoPJ'](fetch,_0x1d8edc+_0x2a371f(0xdb)+_0x395b36+'/checklist-items/'+_0x370041+_0x2a371f(0xd3),{'method':_0x3a695b[_0x2a371f(0xf5)],'headers':{'Authorization':_0x2a371f(0xeb)+_0x5c1495}});if(!_0x263954['ok']){const _0x35449f=await _0x263954[_0x2a371f(0xda)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x35449f);}return _0x263954[_0x2a371f(0xf3)]();}export async function markCommentsAddressed(_0xb13e06,_0x1cf257,_0x3f4287){const _0x16a732=_0x1d81,_0x213ccd={'boQru':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','oujqi':function(_0x5291dd,_0x373865,_0x5f1e34){return _0x5291dd(_0x373865,_0x5f1e34);}},_0x49d812=await getToken();if(!_0x49d812)throw new Error(_0x213ccd['boQru']);const _0x40d877=getApiBaseUrl(),_0x1bc222=await _0x213ccd['oujqi'](fetch,_0x40d877+'/api/v1/mcp/features/'+_0xb13e06+_0x16a732(0xd4),{'method':_0x16a732(0xf0),'headers':{'Authorization':'Bearer\x20'+_0x49d812,'Content-Type':'application/json'},'body':JSON['stringify']({'checklistItemId':_0x1cf257,'commentIds':_0x3f4287})});if(!_0x1bc222['ok']){const _0x347a2e=await _0x1bc222['text']();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x347a2e);}}export async function softDeleteFeature(_0x24ab93){const _0x362c42=_0x1d81,_0x2e7f6d={'AwmQA':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','BaIVY':function(_0x3265d8){return _0x3265d8();}},_0x4c96c1=await getToken();if(!_0x4c96c1)throw new Error(_0x2e7f6d['AwmQA']);const _0x2b9c5f=_0x2e7f6d[_0x362c42(0xe5)](getApiBaseUrl),_0x59c6db=await fetch(_0x2b9c5f+'/api/v1/mcp/features/'+_0x24ab93,{'method':_0x362c42(0xf1),'headers':{'Authorization':_0x362c42(0xeb)+_0x4c96c1}});if(!_0x59c6db['ok']){const _0x1b4280=await _0x59c6db[_0x362c42(0xda)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x1b4280);}}export async function restoreFeature(_0x37238d){const _0x1f29a7=_0x1d81,_0x4804a3={'NwJCt':function(_0xba8592){return _0xba8592();}},_0x3c2359=await getToken();if(!_0x3c2359)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x53a0f9=_0x4804a3['NwJCt'](getApiBaseUrl),_0x1a93bc=await fetch(_0x53a0f9+'/api/v1/mcp/features/'+_0x37238d+_0x1f29a7(0x107),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x3c2359}});if(!_0x1a93bc['ok']){const _0x3845d5=await _0x1a93bc[_0x1f29a7(0xda)]();throw new Error(_0x1f29a7(0xdd)+_0x3845d5);}}
|
|
1
|
+
(function(_0x31a151,_0x19ddfd){const _0x16e57c=_0x37fd,_0xb3c94a=_0x31a151();while(!![]){try{const _0x9f8961=-parseInt(_0x16e57c(0x1d8))/0x1*(parseInt(_0x16e57c(0x1ce))/0x2)+-parseInt(_0x16e57c(0x1ed))/0x3+parseInt(_0x16e57c(0x1cb))/0x4+parseInt(_0x16e57c(0x1d7))/0x5*(-parseInt(_0x16e57c(0x1b4))/0x6)+parseInt(_0x16e57c(0x1e0))/0x7*(parseInt(_0x16e57c(0x1e7))/0x8)+-parseInt(_0x16e57c(0x1da))/0x9+-parseInt(_0x16e57c(0x1ec))/0xa*(-parseInt(_0x16e57c(0x1e9))/0xb);if(_0x9f8961===_0x19ddfd)break;else _0xb3c94a['push'](_0xb3c94a['shift']());}catch(_0x3c459f){_0xb3c94a['push'](_0xb3c94a['shift']());}}}(_0x5183,0x539b3));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x4a1603){const _0x57d170=_0x37fd,_0x2538a1={'wNMDG':function(_0x50e577){return _0x50e577();},'uyMaF':function(_0x196af8){return _0x196af8();},'roBQa':function(_0x2be859,_0x3afe69,_0x85a4a7){return _0x2be859(_0x3afe69,_0x85a4a7);},'FnJQy':_0x57d170(0x1f9)},_0x861b58=await _0x2538a1[_0x57d170(0x1c5)](getToken);if(!_0x861b58)throw new Error(_0x57d170(0x1c9));const _0x3c74ef=_0x2538a1['uyMaF'](getApiBaseUrl),_0x30c765=await _0x2538a1[_0x57d170(0x1f8)](fetch,_0x3c74ef+_0x57d170(0x1d6),{'method':_0x57d170(0x1ee),'headers':{'Authorization':_0x57d170(0x1e6)+_0x861b58,'Content-Type':_0x57d170(0x1dc)},'body':JSON[_0x57d170(0x1fb)](_0x4a1603)});if(!_0x30c765['ok']){if(_0x30c765['status']===0x192){const _0x175671=await _0x30c765['json'](),_0x200771=_0x175671[_0x57d170(0x1d1)]||_0x2538a1['FnJQy'];throw new Error((_0x175671[_0x57d170(0x1d0)]||'Feature\x20limit\x20exceeded')+_0x57d170(0x1d2)+_0x200771);}const _0x3b67cc=await _0x30c765[_0x57d170(0x1f5)]();throw new Error(_0x57d170(0x1c3)+_0x3b67cc);}return _0x30c765['json']();}export async function listFeatures(_0x5d5349){const _0x4641ba=_0x37fd,_0x5c336e={'QvKCW':function(_0x1d888f){return _0x1d888f();},'ChIbx':_0x4641ba(0x1bc),'JHBOu':function(_0x34f445,_0x44d2ae,_0x15478f){return _0x34f445(_0x44d2ae,_0x15478f);}},_0x39cbc5=await _0x5c336e[_0x4641ba(0x1d4)](getToken);if(!_0x39cbc5)throw new Error(_0x4641ba(0x1c9));const _0x308764=getApiBaseUrl(),_0x2f82f8=new URLSearchParams();if(_0x5d5349?.[_0x4641ba(0x1be)])_0x2f82f8['set'](_0x4641ba(0x1be),_0x5d5349['gitRepoUrl']);if(_0x5d5349?.['gitBranch'])_0x2f82f8['set'](_0x4641ba(0x1bf),_0x5d5349['gitBranch']);if(_0x5d5349?.[_0x4641ba(0x1b7)])_0x2f82f8[_0x4641ba(0x1c7)]('limit',_0x5d5349[_0x4641ba(0x1b7)]['toString']());if(_0x5d5349?.[_0x4641ba(0x1ef)])_0x2f82f8[_0x4641ba(0x1c7)]('offset',_0x5d5349['offset']['toString']());if(_0x5d5349?.[_0x4641ba(0x1bc)])_0x2f82f8[_0x4641ba(0x1c7)](_0x5c336e[_0x4641ba(0x1b5)],_0x4641ba(0x1ea));const _0x499e8b=_0x308764+_0x4641ba(0x1d6)+(_0x2f82f8[_0x4641ba(0x1fd)]()?'?'+_0x2f82f8[_0x4641ba(0x1fd)]():''),_0x3f51ac=await _0x5c336e[_0x4641ba(0x1eb)](fetch,_0x499e8b,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x39cbc5}});if(!_0x3f51ac['ok']){const _0x226f85=await _0x3f51ac['text']();throw new Error(_0x4641ba(0x1fa)+_0x226f85);}return _0x3f51ac['json']();}export async function getFeature(_0x437325){const _0x400e82=_0x37fd,_0x46ad80={'oFYMo':function(_0x31fdc4){return _0x31fdc4();},'exeRz':function(_0x4f9a42,_0x5e9f49,_0x4e19ce){return _0x4f9a42(_0x5e9f49,_0x4e19ce);},'nOaNY':_0x400e82(0x1b6)},_0x4dfe46=await getToken();if(!_0x4dfe46)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5f13f9=_0x46ad80[_0x400e82(0x1dd)](getApiBaseUrl),_0x19116c=await _0x46ad80['exeRz'](fetch,_0x5f13f9+_0x400e82(0x1f6)+_0x437325,{'method':_0x46ad80['nOaNY'],'headers':{'Authorization':_0x400e82(0x1e6)+_0x4dfe46}});if(!_0x19116c['ok']){const _0x54fdeb=await _0x19116c['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x54fdeb);}return _0x19116c[_0x400e82(0x1f7)]();}export async function updateFeature(_0x33b463,_0x3168de){const _0x4fdc3b=_0x37fd,_0x13c200={'ORhDY':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','EjRas':function(_0xf2103c,_0xa02bf0,_0xbbd354){return _0xf2103c(_0xa02bf0,_0xbbd354);},'gRjBi':_0x4fdc3b(0x1c6),'vhGEd':_0x4fdc3b(0x1dc)},_0x241712=await getToken();if(!_0x241712)throw new Error(_0x13c200['ORhDY']);const _0x57db31=getApiBaseUrl(),_0x4c2d9a=await _0x13c200[_0x4fdc3b(0x1bb)](fetch,_0x57db31+'/api/v1/mcp/features/'+_0x33b463,{'method':_0x13c200['gRjBi'],'headers':{'Authorization':_0x4fdc3b(0x1e6)+_0x241712,'Content-Type':_0x13c200[_0x4fdc3b(0x1b8)]},'body':JSON['stringify'](_0x3168de)});if(!_0x4c2d9a['ok']){const _0x2b956d=await _0x4c2d9a['text']();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x2b956d);}return _0x4c2d9a['json']();}export async function createChecklistItem(_0x65bdb1,_0x574d00,_0x20839d){const _0x19bfa9=_0x37fd,_0x4573e8={'lxPvx':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','XvFLN':_0x19bfa9(0x1ee)},_0x2e179e=await getToken();if(!_0x2e179e)throw new Error(_0x4573e8['lxPvx']);const _0x1876fa=getApiBaseUrl(),_0x3e4128=await fetch(_0x1876fa+'/api/v1/mcp/features/'+_0x65bdb1+_0x19bfa9(0x1e1),{'method':_0x4573e8['XvFLN'],'headers':{'Authorization':_0x19bfa9(0x1e6)+_0x2e179e,'Content-Type':_0x19bfa9(0x1dc)},'body':JSON[_0x19bfa9(0x1fb)]({'description':_0x574d00,'position':_0x20839d})});if(!_0x3e4128['ok']){const _0x15dd18=await _0x3e4128['text']();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x15dd18);}return _0x3e4128['json']();}export async function updateChecklistItem(_0x2a5ae8,_0xdb60c9,_0x33bd68){const _0x39c2e6=_0x37fd,_0x540413={'DqQan':function(_0xe624ff){return _0xe624ff();},'hgUdX':_0x39c2e6(0x1c9),'ClSgv':function(_0x1c0c46,_0x2e15eb,_0x54970d){return _0x1c0c46(_0x2e15eb,_0x54970d);},'WQwJW':'PATCH'};return _0x540413['ClSgv'](withRetry,async()=>{const _0x46daed=_0x39c2e6,_0x8c26a1=await _0x540413[_0x46daed(0x1c8)](getToken);if(!_0x8c26a1)throw new Error(_0x540413['hgUdX']);const _0x47340b=_0x540413['DqQan'](getApiBaseUrl),_0x4f896e=await _0x540413['ClSgv'](fetch,_0x47340b+_0x46daed(0x1f6)+_0x2a5ae8+_0x46daed(0x1d3)+_0xdb60c9,{'method':_0x540413[_0x46daed(0x1c4)],'headers':{'Authorization':_0x46daed(0x1e6)+_0x8c26a1,'Content-Type':'application/json'},'body':JSON['stringify'](_0x33bd68)});if(!_0x4f896e['ok']){const _0x5988fd=await _0x4f896e['text']();throw new Error(_0x46daed(0x1f4)+_0x5988fd);}return _0x4f896e['json']();},{'label':'updateChecklistItem'});}export async function getFeatureReport(_0x4da658){const _0x1f8ae1=_0x37fd,_0x4cb4c0={'RXJYI':function(_0x46ae77){return _0x46ae77();}},_0x5e68cc=await _0x4cb4c0['RXJYI'](getToken);if(!_0x5e68cc)throw new Error(_0x1f8ae1(0x1c9));const _0x3f6876=getApiBaseUrl(),_0x11cb51=await fetch(_0x3f6876+_0x1f8ae1(0x1f6)+_0x4da658+'/report',{'method':'GET','headers':{'Authorization':_0x1f8ae1(0x1e6)+_0x5e68cc}});if(!_0x11cb51['ok']){const _0x23952c=await _0x11cb51['text']();throw new Error(_0x1f8ae1(0x1b3)+_0x23952c);}return _0x11cb51[_0x1f8ae1(0x1f7)]();}export async function getFeatureReportMarkdown(_0x4d9e59,_0x475aaa){const _0x72c30=_0x37fd,_0x3d5cdd={'cyQap':function(_0x5c5ed9){return _0x5c5ed9();},'Biois':function(_0x296a29,_0x2c9df1){return _0x296a29>_0x2c9df1;},'oZQwE':_0x72c30(0x1e3),'ELkzg':'sessionId','sAikL':_0x72c30(0x1e5),'cGsVW':function(_0x17314d,_0x5ec6ad,_0x10d540){return _0x17314d(_0x5ec6ad,_0x10d540);}},_0x54a56c=await getToken();if(!_0x54a56c)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1d57ac=_0x3d5cdd['cyQap'](getApiBaseUrl),_0x54b21d=new URLSearchParams(),_0x13bdd1=_0x3d5cdd[_0x72c30(0x1bd)](_0x475aaa?.[_0x72c30(0x1e3)]?.['length']??0x0,0x0),_0x3062f5=Boolean(_0x475aaa?.[_0x72c30(0x1e2)]);_0x13bdd1&&_0x475aaa?.['itemIds']&&_0x54b21d['set'](_0x3d5cdd['oZQwE'],_0x475aaa['itemIds'][_0x72c30(0x1cf)](','));_0x3062f5&&_0x475aaa?.[_0x72c30(0x1e2)]&&_0x54b21d[_0x72c30(0x1c7)](_0x3d5cdd[_0x72c30(0x1e8)],_0x475aaa['sessionId']);!_0x13bdd1&&!_0x3062f5&&_0x475aaa?.[_0x72c30(0x1e5)]&&_0x54b21d['set'](_0x3d5cdd['sAikL'],_0x475aaa[_0x72c30(0x1e5)]);const _0x48c867=_0x1d57ac+'/api/v1/mcp/features/'+_0x4d9e59+'/report/markdown',_0x20dee5=''+_0x48c867+(_0x54b21d['toString']()?'?'+_0x54b21d[_0x72c30(0x1fd)]():''),_0xfc7f82=await _0x3d5cdd[_0x72c30(0x1d5)](fetch,_0x20dee5,{'method':_0x72c30(0x1b6),'headers':{'Authorization':'Bearer\x20'+_0x54a56c}});if(!_0xfc7f82['ok']){const _0x43ebc7=await _0xfc7f82[_0x72c30(0x1f5)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x43ebc7);}return _0xfc7f82['text']();}export async function listFeatureSessions(_0x2c19e4){const _0x329bd8=_0x37fd,_0x9a615f={'iJAzY':function(_0x47a78d){return _0x47a78d();},'zEuml':'GET'},_0x221941=await getToken();if(!_0x221941)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x40e411=_0x9a615f['iJAzY'](getApiBaseUrl),_0x4132bc=await fetch(_0x40e411+_0x329bd8(0x1f6)+_0x2c19e4+_0x329bd8(0x1ba),{'method':_0x9a615f['zEuml'],'headers':{'Authorization':'Bearer\x20'+_0x221941}});if(!_0x4132bc['ok']){const _0x4093ff=await _0x4132bc['text']();throw new Error(_0x329bd8(0x1e4)+_0x4093ff);}return _0x4132bc['json']();}export async function startSession(_0x16541d,_0x4bc3c3){const _0x3968e3=_0x37fd,_0x5f2155={'zbJfw':function(_0x30d8cb){return _0x30d8cb();},'RKYQf':_0x3968e3(0x1c9),'GvMkH':'POST'},_0x5c338d=await _0x5f2155[_0x3968e3(0x1f0)](getToken);if(!_0x5c338d)throw new Error(_0x5f2155['RKYQf']);const _0x43edf0=_0x5f2155[_0x3968e3(0x1f0)](getApiBaseUrl),_0x587ddf=await fetch(_0x43edf0+_0x3968e3(0x1f6)+_0x16541d+'/sessions/'+_0x4bc3c3+'/start',{'method':_0x5f2155[_0x3968e3(0x1f1)],'headers':{'Authorization':_0x3968e3(0x1e6)+_0x5c338d}});if(!_0x587ddf['ok']){const _0x1f7e9f=await _0x587ddf[_0x3968e3(0x1f5)]();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x1f7e9f);}return _0x587ddf['json']();}export async function concludeSession(_0x59f68c,_0x714809){const _0x3dc234=_0x37fd,_0x603a5b={'ejtmv':function(_0x17aa91){return _0x17aa91();},'SDPkf':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x3794af=await _0x603a5b[_0x3dc234(0x1d9)](getToken);if(!_0x3794af)throw new Error(_0x603a5b['SDPkf']);const _0x7373fe=_0x603a5b[_0x3dc234(0x1d9)](getApiBaseUrl),_0x55237b=await fetch(_0x7373fe+_0x3dc234(0x1f6)+_0x59f68c+_0x3dc234(0x1c1)+_0x714809+'/conclude',{'method':'POST','headers':{'Authorization':_0x3dc234(0x1e6)+_0x3794af}});if(!_0x55237b['ok']){const _0x50fc39=await _0x55237b[_0x3dc234(0x1f5)]();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x50fc39);}return _0x55237b[_0x3dc234(0x1f7)]();}export async function getActionItems(_0x2c6a86){const _0x3cfe63=_0x37fd,_0x552985={'sGEpf':function(_0x361269){return _0x361269();},'ivYsq':_0x3cfe63(0x1c9),'TpmCi':function(_0xa1f936,_0x4dd123,_0xf5da5){return _0xa1f936(_0x4dd123,_0xf5da5);},'SELQu':'GET'},_0x476d38=await _0x552985['sGEpf'](getToken);if(!_0x476d38)throw new Error(_0x552985['ivYsq']);const _0x4907c8=getApiBaseUrl(),_0x4902db=await _0x552985[_0x3cfe63(0x1df)](fetch,_0x4907c8+'/api/v1/mcp/features/'+_0x2c6a86+_0x3cfe63(0x1c2),{'method':_0x552985['SELQu'],'headers':{'Authorization':_0x3cfe63(0x1e6)+_0x476d38}});if(!_0x4902db['ok']){const _0x598a77=await _0x4902db[_0x3cfe63(0x1f5)]();throw new Error(_0x3cfe63(0x1fc)+_0x598a77);}return _0x4902db['json']();}function _0x37fd(_0xff743c,_0x43ade0){_0xff743c=_0xff743c-0x1b3;const _0x5183ee=_0x5183();let _0x37fdfd=_0x5183ee[_0xff743c];return _0x37fdfd;}export async function getItemFeedback(_0x271973,_0x23f7c3){const _0x16fd3b=_0x37fd,_0xbb4fc5=await getToken();if(!_0xbb4fc5)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xf81296=getApiBaseUrl(),_0x57c833=await fetch(_0xf81296+_0x16fd3b(0x1f6)+_0x271973+'/checklist-items/'+_0x23f7c3+'/feedback',{'method':_0x16fd3b(0x1b6),'headers':{'Authorization':_0x16fd3b(0x1e6)+_0xbb4fc5}});if(!_0x57c833['ok']){const _0x4b1f85=await _0x57c833['text']();throw new Error(_0x16fd3b(0x1f3)+_0x4b1f85);}return _0x57c833['json']();}function _0x5183(){const _0x160e41=['roBQa','https://dashboard.ranger.net/billing','Failed\x20to\x20list\x20feature\x20reviews:\x20','stringify','Failed\x20to\x20get\x20action\x20items:\x20','toString','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','18ZUMdrP','ChIbx','GET','limit','vhGEd','GDGoC','/sessions','EjRas','includeDeleted','Biois','gitRepoUrl','gitBranch','rzmJW','/sessions/','/action-items','Failed\x20to\x20create\x20feature\x20review:\x20','WQwJW','wNMDG','PATCH','set','DqQan','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','/comments/address','172164upJOlK','DELETE','PsHSf','475844eZlKxl','join','message','billingUrl','\x0a\x0aUpgrade\x20your\x20plan:\x20','/checklist/','QvKCW','cGsVW','/api/v1/mcp/features','45025rKcTQW','2XWzPNy','ejtmv','316044Aamoal','XwYug','application/json','oFYMo','Failed\x20to\x20delete\x20feature\x20review:\x20','TpmCi','973phXZgO','/checklist','sessionId','itemIds','Failed\x20to\x20list\x20sessions:\x20','style','Bearer\x20','31528zywSCD','ELkzg','39193tmXzza','true','JHBOu','1070KrXifn','274965VghnNz','POST','offset','zbJfw','GvMkH','Rutpc','Failed\x20to\x20get\x20item\x20feedback:\x20','Failed\x20to\x20update\x20scenario:\x20','text','/api/v1/mcp/features/','json'];_0x5183=function(){return _0x160e41;};return _0x5183();}export async function markCommentsAddressed(_0x2c7d3b,_0x962443,_0x2f6e55){const _0x29d0e0=_0x37fd,_0x27aadb={'dcPEE':function(_0x22f555){return _0x22f555();},'PWrld':function(_0x30ae4d){return _0x30ae4d();},'IxYRh':function(_0x42f23a,_0x914e81,_0xfe300d){return _0x42f23a(_0x914e81,_0xfe300d);},'Rutpc':_0x29d0e0(0x1ee)},_0x4eda93=await _0x27aadb['dcPEE'](getToken);if(!_0x4eda93)throw new Error(_0x29d0e0(0x1c9));const _0x118acd=_0x27aadb['PWrld'](getApiBaseUrl),_0x23c70b=await _0x27aadb['IxYRh'](fetch,_0x118acd+_0x29d0e0(0x1f6)+_0x2c7d3b+_0x29d0e0(0x1ca),{'method':_0x27aadb[_0x29d0e0(0x1f2)],'headers':{'Authorization':_0x29d0e0(0x1e6)+_0x4eda93,'Content-Type':'application/json'},'body':JSON['stringify']({'checklistItemId':_0x962443,'commentIds':_0x2f6e55})});if(!_0x23c70b['ok']){const _0x5609f1=await _0x23c70b[_0x29d0e0(0x1f5)]();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x5609f1);}}export async function softDeleteFeature(_0x11904c){const _0x437c56=_0x37fd,_0x4f2ac7={'GDGoC':_0x437c56(0x1c9),'rzmJW':function(_0x273468){return _0x273468();},'AIHZP':function(_0xe13843,_0x4dda02,_0x2d142b){return _0xe13843(_0x4dda02,_0x2d142b);}},_0x15ec9a=await getToken();if(!_0x15ec9a)throw new Error(_0x4f2ac7[_0x437c56(0x1b9)]);const _0x26a770=_0x4f2ac7[_0x437c56(0x1c0)](getApiBaseUrl),_0x32fbe3=await _0x4f2ac7['AIHZP'](fetch,_0x26a770+_0x437c56(0x1f6)+_0x11904c,{'method':_0x437c56(0x1cc),'headers':{'Authorization':'Bearer\x20'+_0x15ec9a}});if(!_0x32fbe3['ok']){const _0x3fd7cd=await _0x32fbe3['text']();throw new Error(_0x437c56(0x1de)+_0x3fd7cd);}}export async function restoreFeature(_0x4e339e){const _0x2a23f8=_0x37fd,_0x4229c0={'PsHSf':function(_0x3bad4b){return _0x3bad4b();},'XwYug':_0x2a23f8(0x1ee)},_0x5b2ca1=await _0x4229c0[_0x2a23f8(0x1cd)](getToken);if(!_0x5b2ca1)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1d6a33=getApiBaseUrl(),_0x39a0fb=await fetch(_0x1d6a33+'/api/v1/mcp/features/'+_0x4e339e+'/restore',{'method':_0x4229c0[_0x2a23f8(0x1db)],'headers':{'Authorization':_0x2a23f8(0x1e6)+_0x5b2ca1}});if(!_0x39a0fb['ok']){const _0x616a83=await _0x39a0fb[_0x2a23f8(0x1f5)]();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x616a83);}}
|