@ranger-testing/ranger-cli 3.1.7-alpha.be2850d-64 → 3.1.7-alpha.d64f22a-65
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/package.json +14 -5
|
@@ -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 _0x473257=_0x4cd6;(function(_0x95776a,_0x2367d5){const _0x3c7982=_0x4cd6,_0x5635a8=_0x95776a();while(!![]){try{const _0x5783b9=-parseInt(_0x3c7982(0x124))/0x1+-parseInt(_0x3c7982(0x159))/0x2+-parseInt(_0x3c7982(0x15c))/0x3*(-parseInt(_0x3c7982(0xdc))/0x4)+parseInt(_0x3c7982(0x151))/0x5+-parseInt(_0x3c7982(0x173))/0x6+parseInt(_0x3c7982(0x136))/0x7*(parseInt(_0x3c7982(0xeb))/0x8)+parseInt(_0x3c7982(0x10c))/0x9;if(_0x5783b9===_0x2367d5)break;else _0x5635a8['push'](_0x5635a8['shift']());}catch(_0x1f0d19){_0x5635a8['push'](_0x5635a8['shift']());}}}(_0x2a92,0x4f5bc));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x2ef7c3 from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';function _0x2a92(){const _0xa98c60=['agent','headers','trackPhaseError','force','ambiguous','defaultEnvironmentKey','gNocX','\x20Available:\x20','agyvl','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','\x22,\x20refreshing\x20session...','/api/v1/profiles/auth-config','GwGBG','jKoQb','application/json','IRJue','GuxjO','7BIkTND','pwEndpoint','auth_config','yIQlN','detail','jFaNs','FqPLG','name','environmentKey','No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22','effectiveBaseUrl','\x22\x20for\x20','\x20\x20Login\x20successful.\x20Session\x20cached.','forceLogin','/api/v1/profiles/','/api/v1/tunnel/sessions/','rPLuj','\x20\x20Cached\x20session\x20for\x20\x22','SuPey','you\x27re\x20now\x20at\x20\x22','\x22;\x20proceeding\x20with\x20loginInstructions.','daQzH','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','ROTwh','PqUXo','\x22\x20on\x20profile\x20\x22','/api/v1/tunnel/sessions','2469410fbtHYt','PqhGe','sessionCheckPath','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','targetUrl','tunnel_session_id','\x20\x20Created\x20cloud\x20profile\x20\x22','json','1225666ipWUYG','goto','clientIp','19638dNfifu','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','close','sessionState','invalid-url','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','sNLYq','tunnel_bridge','No\x20saved\x20session\x20for\x20\x22','Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20(','origin','tunnelUrl','jackF','nUjdx','POST','gwjGi','stringify','settings','profiles','\x20\x20•\x20capture\x20one\x20(a\x20browser\x20opens):\x20ranger\x20profile\x20add\x20','Cloud\x20profile\x20\x22','CwMZx','/api/v1/profiles','3403590HWwPjw','qPIyF','WhEXY','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','type','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','env','storageState','session_state','trim','userAgent','cookies','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','organizationId','some','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','tunnel_login_setup','true','message','isArray','cvuKe','uzaUh','\x22.\x0a','ALKPM','key','AvrcP','map','domains','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a','prompt','duxAQ','mCwUW','CoxCJ','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','\x20\x20No\x20live\x20session\x20for\x20\x22','sessionId','extraHTTPHeaders','\x20\x20Options:\x0a','log','212aGhMfc','raw','length','bJGeh','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','DELETE','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','vpXqY','vhBgX','success','environments','username','jazYG','connectionId','invalidateOn','64248lmUZTw','target_url','yHSZZ','Bearer\x20','HPCym','CQrRK','AxGUA','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','string','error','\x22,\x20cached\x20locally','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','assertedEnv','parse','UugLv','INeDH','aRjgT','\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22','newContext','nCeOi','XeDup','password','status','fgmOJ','UKipH','pw_endpoint','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','UNstX','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>`.','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','not_configured','tunnel_login_cleanup','8704566OssPZJ','trackPhaseEnd','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','setupHeaders','\x22,\x20and\x20cloud\x20sessions\x20don\x27t\x20apply\x20to\x20localhost.\x0a','launch','yvqzr','elapsedMs','telemetry','\x20\x20Cloud\x20profile\x20\x22','loginInstructions','tunnel','pendingLocalConnections','RANGER_TEST_PASSWORD','uYtyG','split','code','catch','save','TLUDX','VKVxD','mdwJk','newPage','join','310875mpcLGi'];_0x2a92=function(){return _0xa98c60;};return _0x2a92();}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(_0x416a89){const _0x42fe81=_0x4cd6,_0x3e6222={'trtBi':_0x42fe81(0x160)};try{return new URL(_0x416a89)['host'];}catch{return _0x3e6222['trtBi'];}}function errorMessageForTelemetry(_0x1e730c){const _0x48dbde=_0x4cd6;return _0x1e730c instanceof Error?_0x1e730c[_0x48dbde(0x185)]:undefined;}function trackBridgeEvent(_0x1b2230,_0x4f6d7f){const _0x40e245=_0x4cd6,_0x3b3434={'yHSZZ':function(_0x18fe7d,_0x528583){return _0x18fe7d===_0x528583;},'CoxCJ':'local_ws_error','iIUAl':_0x40e245(0x163)};if(!_0x1b2230)return;const _0x699025={'tunnelSessionId':_0x4f6d7f[_0x40e245(0xd8)],'tunnelEventType':_0x4f6d7f[_0x40e245(0x177)],'connectionId':_0x4f6d7f[_0x40e245(0xe9)],'code':_0x4f6d7f[_0x40e245(0x11c)],'reason':_0x4f6d7f['reason'],'error':_0x4f6d7f[_0x40e245(0xf4)],'elapsedMs':_0x4f6d7f[_0x40e245(0x113)],'activeLocalConnections':_0x4f6d7f['activeLocalConnections'],'pendingLocalConnections':_0x4f6d7f[_0x40e245(0x118)]};_0x1b2230[_0x40e245(0x10d)]('tunnel_bridge_event',_0x699025),(_0x4f6d7f['type']==='tunnel_error'||_0x3b3434[_0x40e245(0xed)](_0x4f6d7f['type'],_0x3b3434[_0x40e245(0xd5)]))&&void _0x1b2230[_0x40e245(0x127)](_0x3b3434['iIUAl'],new Error(_0x4f6d7f['error']??_0x4f6d7f['type']),_0x699025);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x5ef00f={'xqput':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x53402f=await getToken();if(!_0x53402f)throw new Error(_0x5ef00f['xqput']);return _0x53402f;}async function apiRequest(_0x123a22,_0x5a0f92={}){const _0x1e3dd1=_0x4cd6,_0x236ac5={'qPIyF':function(_0x29ff58){return _0x29ff58();},'YgFBk':_0x1e3dd1(0x133),'UKipH':function(_0x3a3cd1,_0x432148){return _0x3a3cd1===_0x432148;},'vpXqY':'string','KFlXZ':function(_0xc50a52,_0x257ac9){return _0xc50a52===_0x257ac9;}},_0x453512=await _0x236ac5[_0x1e3dd1(0x174)](requireToken),_0x47c5ee=getApiBaseUrl(),_0x2d2fc5=await fetch(''+_0x47c5ee+_0x123a22,{..._0x5a0f92,'headers':{'Authorization':_0x1e3dd1(0xee)+_0x453512,'Content-Type':_0x236ac5['YgFBk'],..._0x5a0f92[_0x1e3dd1(0x126)]??{}}});if(!_0x2d2fc5['ok']){let _0x113bd0='',_0x5d3d70;try{const _0x5c3356=await _0x2d2fc5[_0x1e3dd1(0x158)](),_0x280865=(_0x236ac5[_0x1e3dd1(0x103)](typeof _0x5c3356['error'],_0x236ac5['vpXqY'])?_0x5c3356[_0x1e3dd1(0xf4)]:undefined)??JSON['stringify'](_0x5c3356);_0x113bd0=_0x280865;typeof _0x5c3356['test_output']===_0x236ac5[_0x1e3dd1(0xe3)]&&_0x5c3356['test_output']&&(_0x113bd0=_0x113bd0+'\x0a'+_0x5c3356['test_output']);if(_0x236ac5[_0x1e3dd1(0x103)](typeof _0x5c3356[_0x1e3dd1(0x11c)],_0x236ac5['vpXqY']))_0x5d3d70=_0x5c3356['code'];}catch{_0x113bd0=_0x2d2fc5['statusText'];}throw new ApiError('API\x20request\x20'+_0x123a22+'\x20failed\x20('+_0x2d2fc5['status']+'):\x20'+_0x113bd0,_0x2d2fc5[_0x1e3dd1(0x101)],_0x113bd0,_0x5d3d70);}if(_0x236ac5['KFlXZ'](_0x2d2fc5['status'],0xcc))return undefined;return _0x2d2fc5[_0x1e3dd1(0x158)]();}export class ApiError extends Error{['status'];[_0x473257(0x13a)];['code'];constructor(_0x9869ac,_0xc8dc93,_0x30c620,_0x2ed922){const _0x4ec072=_0x473257,_0x37134f={'nUjdx':'2|1|4|3|0'},_0x449d96=_0x37134f[_0x4ec072(0x169)][_0x4ec072(0x11b)]('|');let _0x3a4082=0x0;while(!![]){switch(_0x449d96[_0x3a4082++]){case'0':this[_0x4ec072(0x13d)]='ApiError';continue;case'1':this[_0x4ec072(0x101)]=_0xc8dc93;continue;case'2':super(_0x9869ac);continue;case'3':this['code']=_0x2ed922;continue;case'4':this['detail']=_0x30c620;continue;}break;}}}export async function fetchCloudProfile(_0x4ebf9d){const _0x47c378=_0x473257,_0xb8a21b={'XeDup':function(_0x22f36a,_0x17024a,_0x10722a){return _0x22f36a(_0x17024a,_0x10722a);},'jXGNn':function(_0x52b6d6,_0x37c8bf){return _0x52b6d6===_0x37c8bf;}};try{return await _0xb8a21b[_0x47c378(0xff)](apiRequest,_0x47c378(0x144)+encodeURIComponent(_0x4ebf9d),{'signal':AbortSignal['timeout'](0x3a98)});}catch(_0xc450e1){if(_0xc450e1 instanceof ApiError&&_0xb8a21b['jXGNn'](_0xc450e1['status'],0x194))return null;throw _0xc450e1;}}export async function listCloudProfiles(){const _0x61e9ca=_0x473257,_0x1f34da=await apiRequest(_0x61e9ca(0x172));return _0x1f34da[_0x61e9ca(0x16e)];}export async function deleteCloudProfile(_0x482ad1){const _0x4205bf=_0x473257,_0x5e991b={'jackF':function(_0x25baca,_0x4a45f5){return _0x25baca instanceof _0x4a45f5;}};try{await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x482ad1),{'method':_0x4205bf(0xe1)});}catch(_0x33678c){if(_0x5e991b[_0x4205bf(0x168)](_0x33678c,ApiError)&&_0x33678c['status']===0x194)throw new Error(_0x4205bf(0x170)+_0x482ad1+'\x22\x20not\x20found.');throw _0x33678c;}}export async function createCloudProfile(_0x2e989,_0x1a59d5,_0x5f32d0={}){const _0x3c6377=_0x473257,_0x373bc9={'INeDH':function(_0x3862c3,_0x1c2b73){return _0x3862c3>_0x1c2b73;},'JzGQG':function(_0x39f0fe,_0xca448f,_0x325d5c){return _0x39f0fe(_0xca448f,_0x325d5c);},'ARXTi':'POST'},_0x53cf9c={'name':_0x2e989};if(_0x1a59d5)_0x53cf9c['environment_key']=_0x1a59d5;_0x5f32d0[_0x3c6377(0x16d)]&&_0x373bc9[_0x3c6377(0xfa)](Object['keys'](_0x5f32d0[_0x3c6377(0x16d)])['length'],0x0)&&(_0x53cf9c[_0x3c6377(0x16d)]=_0x5f32d0[_0x3c6377(0x16d)]);if(_0x5f32d0[_0x3c6377(0xe7)])_0x53cf9c[_0x3c6377(0xe7)]=_0x5f32d0['username'];if(_0x5f32d0['password'])_0x53cf9c['password']=_0x5f32d0[_0x3c6377(0x100)];return await _0x373bc9['JzGQG'](apiRequest,_0x3c6377(0x172),{'method':_0x373bc9['ARXTi'],'body':JSON[_0x3c6377(0x16c)](_0x53cf9c)});}export async function uploadCloudProfileSession(_0x382393,_0x4571f2){const _0x24fbc1=_0x473257;return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x382393)+'/session',{'method':_0x24fbc1(0x16a),'body':JSON[_0x24fbc1(0x16c)]({'session_state':_0x4571f2})});}export async function saveCloudProfileCredentials(_0x1fd1a1,_0x3fa480,_0x1a061f){const _0x52431a=_0x473257,_0x188973={'bJGeh':function(_0x20729e,_0x11ae2a,_0x1d1a74){return _0x20729e(_0x11ae2a,_0x1d1a74);}};await _0x188973[_0x52431a(0xdf)](apiRequest,_0x52431a(0x144)+encodeURIComponent(_0x1fd1a1),{'method':'PUT','body':JSON[_0x52431a(0x16c)]({'username':_0x3fa480,'password':_0x1a061f})});}export async function fetchAuthConfig(){const _0x3d787b=_0x473257,_0x648298={'vGnSb':_0x3d787b(0x130),'haRQD':function(_0x40cf64,_0x273de2){return _0x40cf64 instanceof _0x273de2;}};try{const _0x40deeb=await apiRequest(_0x648298['vGnSb']);return _0x40deeb[_0x3d787b(0x138)];}catch(_0x3ea15a){return _0x648298['haRQD'](_0x3ea15a,ApiError)&&_0x3ea15a[_0x3d787b(0x101)]!==0x194&&console[_0x3d787b(0xf4)](_0x3d787b(0xf6)+_0x3ea15a[_0x3d787b(0x185)]),null;}}async function createTunnelSession(_0x8b4a66){const _0x580ef3=_0x473257,_0x2a062b={'PqUXo':_0x580ef3(0x150),'fgmOJ':_0x580ef3(0x125)};return await apiRequest(_0x2a062b[_0x580ef3(0x14e)],{'method':_0x580ef3(0x16a),'body':JSON[_0x580ef3(0x16c)]({'targetUrl':_0x8b4a66,'mode':_0x2a062b[_0x580ef3(0x102)]})});}async function deleteTunnelSession(_0x880a4d){const _0x3b11dc=_0x473257,_0x583c68={'CwMZx':function(_0x53f2bf,_0x3bd6b5,_0x554f36){return _0x53f2bf(_0x3bd6b5,_0x554f36);}};await _0x583c68[_0x3b11dc(0x171)](apiRequest,_0x3b11dc(0x145)+_0x880a4d,{'method':_0x3b11dc(0xe1)});}export function pickAdHocEnvKey(_0xae78e0,_0x561cde,_0x27915e){const _0x5ce58b=_0x473257,_0x49cc5b={'qaMah':function(_0x3fe16a,_0x1b7153){return _0x3fe16a+_0x1b7153;},'FqPLG':function(_0x249ee6,_0x2ea2d5,_0xecdac0){return _0x249ee6(_0x2ea2d5,_0xecdac0);},'agyvl':function(_0x4fbe8e,_0xc55ad6){return _0x4fbe8e in _0xc55ad6;},'UugLv':function(_0xed53a1,_0x33e5fd){return _0xed53a1+_0x33e5fd;},'qbudh':function(_0x86d47e,_0x48c007){return _0x86d47e+_0x48c007;},'PqhGe':function(_0x435573,_0x227e3c){return _0x435573===_0x227e3c;}};if(_0x27915e){if(!_0xae78e0?.[_0x5ce58b(0xe6)]?.[_0x27915e]){const _0x58b7ab=Object['keys'](_0xae78e0?.[_0x5ce58b(0xe6)]??{});throw new Error(_0x49cc5b['qaMah']('Auth\x20environment\x20\x22'+_0x27915e+'\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.'+(_0x58b7ab['length']?_0x5ce58b(0x12c)+_0x58b7ab[_0x5ce58b(0x123)](',\x20')+'.':_0x5ce58b(0xd6)),'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)'));}return _0x27915e;}if(!_0xae78e0)return null;if(_0x561cde){const _0xc3311e=_0x49cc5b[_0x5ce58b(0x13c)](matchAuthEnvironmentExact,_0x561cde,_0xae78e0);if(_0xc3311e)return _0xc3311e;const _0x377585=matchAuthEnvironmentByHost(_0x561cde,_0xae78e0);if(_0x377585&&_0x49cc5b[_0x5ce58b(0x12d)](_0x5ce58b(0x18b),_0x377585))return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x377585['key']+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x561cde+'\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).'),_0x377585['key'];if(_0x377585&&_0x49cc5b[_0x5ce58b(0x12d)]('ambiguous',_0x377585))throw new Error(_0x5ce58b(0xe2)+_0x377585[_0x5ce58b(0x129)]['join'](',\x20')+');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.');if(needsTunnel(_0x561cde))throw new Error(_0x49cc5b[_0x5ce58b(0xf9)](_0x49cc5b['UugLv'](_0x49cc5b['qaMah'](_0x49cc5b['qbudh'](_0x5ce58b(0x13f)+_0x561cde+_0x5ce58b(0x189),_0x5ce58b(0x105)),_0x5ce58b(0xda)),_0x5ce58b(0xd1)),_0x5ce58b(0xfc)+_0x561cde['replace'](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a')+('\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20'+_0x561cde+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0xae78e0['defaultEnvironmentKey'])return _0xae78e0['defaultEnvironmentKey'];const _0xe5b3a9=Object['keys'](_0xae78e0['environments']??{});if(_0x49cc5b['PqhGe'](_0xe5b3a9[_0x5ce58b(0xde)],0x1))return _0xe5b3a9[0x0];if(_0x49cc5b[_0x5ce58b(0x152)](_0xe5b3a9[_0x5ce58b(0xde)],0x0))return null;throw new Error(_0x5ce58b(0x165)+_0xe5b3a9['join'](',\x20')+').\x20'+_0x5ce58b(0x107));}export function adHocProfileName(_0x3db0f4,_0x118b56,_0x11e5e7){if(!_0x118b56||_0x118b56===_0x11e5e7)return _0x3db0f4;return _0x3db0f4+':'+_0x118b56;}export async function resolveAdHocProfile(_0x5e4375={},_0x5f0d52=process['env']){const _0x330f1c=_0x473257,_0x4cce1c={'ZCUgq':function(_0x30fd43,_0xfdebed,_0x28c26b,_0x390408){return _0x30fd43(_0xfdebed,_0x28c26b,_0x390408);},'yvqzr':function(_0x18ecf2,_0x1fa40a){return _0x18ecf2&&_0x1fa40a;},'aRjgT':function(_0x11d64a,_0x118778){return _0x11d64a!==_0x118778;},'pUErh':'none'},_0xe6c888=_0x5f0d52['RANGER_TEST_USERNAME'];if(!_0xe6c888)return null;const _0x693248=await fetchAuthConfig(),_0x27b4e7=pickAdHocEnvKey(_0x693248,_0x5e4375[_0x330f1c(0x155)],_0x5e4375['envKey']);let _0xe9de23=_0x4cce1c['ZCUgq'](adHocProfileName,_0xe6c888,_0x27b4e7,_0x693248?.[_0x330f1c(0x12a)]),_0x2e01f9=await fetchCloudProfile(_0xe9de23);_0x4cce1c[_0x330f1c(0x112)](_0x2e01f9,_0x27b4e7)&&_0x4cce1c[_0x330f1c(0xfb)](_0x2e01f9['environmentKey'],_0x27b4e7)&&(console[_0x330f1c(0xdb)](_0x330f1c(0x115)+_0xe9de23+_0x330f1c(0x108)+(_0x2e01f9[_0x330f1c(0x13e)]??_0x4cce1c['pUErh'])+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x27b4e7+'\x22;\x20using\x20\x22'+_0xe6c888+':'+_0x27b4e7+'\x22\x20instead.'),_0xe9de23=_0xe6c888+':'+_0x27b4e7,_0x2e01f9=await fetchCloudProfile(_0xe9de23));if(_0x2e01f9)return{'name':_0x2e01f9['name'],'profile':_0x2e01f9};const _0x4e1cee=_0x5f0d52[_0x330f1c(0x119)],_0x24c455=await _0x4cce1c['ZCUgq'](createCloudProfile,_0xe9de23,_0x27b4e7??undefined,{'username':_0xe6c888,'password':_0x4e1cee});return console[_0x330f1c(0xdb)](_0x330f1c(0x157)+_0x24c455[_0x330f1c(0x13d)]+_0x330f1c(0x141)+_0xe6c888+(_0x27b4e7?'\x20(auth\x20env:\x20'+_0x27b4e7+')':'')),{'name':_0x24c455[_0x330f1c(0x13d)],'profile':_0x24c455};}export async function writeSessionToLocalCache(_0xe7531b,_0x26b3bf,_0x171f18,_0x38b81d,_0x17505c,_0x2a9e17,_0x552fe6){const _0x1fc229=_0x473257,_0x52f318={'WhEXY':function(_0xe2d3c7,_0x5a54de){return _0xe2d3c7(_0x5a54de);},'mXhyL':function(_0x361496,_0x1ce11d,_0x3eb9de){return _0x361496(_0x1ce11d,_0x3eb9de);},'MrkWL':function(_0x75621d,_0x47f3b2){return _0x75621d>_0x47f3b2;}},_0x2b4f5c=_0x52f318[_0x1fc229(0x175)](sessionCacheHash,{'orgId':_0x26b3bf,'profileName':_0xe7531b,'effectiveBaseUrl':_0x171f18,'setupHeaders':_0x38b81d,'invalidateOn':_0x552fe6?.['invalidateOn'],'userAgent':_0x552fe6?.['userAgent'],'clientIp':_0x552fe6?.['clientIp']}),_0x2658e9=getSessionCachePath(_0x2b4f5c,_0xe7531b),_0x4a12c4=_0x52f318['mXhyL'](join,getRangerHomeDir(),'auth');!_0x52f318[_0x1fc229(0x175)](existsSync,_0x4a12c4)&&await mkdir(_0x4a12c4,{'recursive':!![]});const _0x4a1e1e={..._0x17505c};_0x2a9e17&&_0x52f318['MrkWL'](_0x2a9e17['length'],0x0)&&Array[_0x1fc229(0x186)](_0x4a1e1e[_0x1fc229(0x17e)])&&(_0x4a1e1e[_0x1fc229(0x17e)]=_0x52f318['mXhyL'](duplicateCookiesForDomains,_0x4a1e1e[_0x1fc229(0x17e)],_0x2a9e17));const _0x28b8a1={'cached_at':new Date()['toISOString'](),'session_state':_0x4a1e1e};await _0x52f318['mXhyL'](writeFile,_0x2658e9,JSON['stringify'](_0x28b8a1,null,0x2));const _0x57c506=getStorageStatePath(_0x2658e9);return await writeFile(_0x57c506,JSON['stringify'](_0x4a1e1e,null,0x2)),_0x57c506;}export async function checkLocalCache(_0xce4c5f,_0x276988,_0x49105e,_0xac4439,_0x1aff3c){const _0x1bb20a=_0x473257,_0x4eac90={'sNLYq':function(_0x35f203,_0x5ebef2,_0x49b542){return _0x35f203(_0x5ebef2,_0x49b542);}},_0x4e55ab=sessionCacheHash({'orgId':_0x276988,'profileName':_0xce4c5f,'effectiveBaseUrl':_0x49105e,'setupHeaders':_0xac4439,'invalidateOn':_0x1aff3c?.['invalidateOn'],'userAgent':_0x1aff3c?.[_0x1bb20a(0x17d)],'clientIp':_0x1aff3c?.[_0x1bb20a(0x15b)]}),_0x56d554=_0x4eac90[_0x1bb20a(0x162)](getSessionCachePath,_0x4e55ab,_0xce4c5f),_0xd3e9a9=getStorageStatePath(_0x56d554);if(!existsSync(_0x56d554)||!existsSync(_0xd3e9a9))return null;try{const _0x27eefb=await _0x4eac90['sNLYq'](readFile,_0x56d554,'utf-8');return JSON[_0x1bb20a(0xf8)](_0x27eefb),{'storageStatePath':_0xd3e9a9};}catch{return null;}}function launchRealBrowser(){const _0x427e70=_0x473257;return chromium[_0x427e70(0x111)]({'headless':!![]});}function emitSessionValidationHint(_0x227d1f,_0x45854e){const _0xfda083=_0x473257,_0x2281bf={'vtBsz':function(_0x5bb7f8,_0x17b787){return _0x5bb7f8===_0x17b787;},'HxbPE':function(_0x18549e,_0x5eb5b8){return _0x18549e+_0x5eb5b8;}};if(!_0x45854e||!_0x45854e['domains']?.['length'])return;let _0x292cc9;try{_0x292cc9=new URL(_0x227d1f);}catch{return;}const _0x908013=[];for(const _0x40c9be of _0x45854e['domains']){try{_0x908013['push']({'raw':_0x40c9be,'url':new URL(_0x40c9be)});}catch{}}if(_0x2281bf['vtBsz'](_0x908013[_0xfda083(0xde)],0x0))return;if(_0x908013[_0xfda083(0x181)](_0x10db1c=>_0x10db1c['url'][_0xfda083(0x166)]===_0x292cc9[_0xfda083(0x166)]))return;const _0x398561=_0x908013[_0xfda083(0xcf)](_0x16dcbf=>'\x22'+_0x16dcbf[_0xfda083(0xdd)]+'\x22')['join'](',\x20');console['log'](_0x2281bf['HxbPE'](_0x2281bf['HxbPE'](_0xfda083(0xf2)+_0x398561+';\x20',_0xfda083(0x149)+_0x227d1f+_0xfda083(0x14c)),_0xfda083(0x176)));}function _0x4cd6(_0x555f65,_0x133d35){_0x555f65=_0x555f65-0xce;const _0x2a923f=_0x2a92();let _0x4cd64f=_0x2a923f[_0x555f65];return _0x4cd64f;}export async function serverSideLogin(_0x203dc7,_0x9e66aa){const _0x3abe0c=_0x473257,_0x36b29c={'yIIsf':function(_0x54ae72,_0x793900,_0x2c1b4a){return _0x54ae72(_0x793900,_0x2c1b4a);},'VKVxD':function(_0x4277d4,_0x3b83c0){return _0x4277d4(_0x3b83c0);},'XcGov':'POST','SuPey':function(_0x1c3a73,_0x174017){return _0x1c3a73 instanceof _0x174017;},'AvrcP':function(_0x1d2a8a,_0x153b65){return _0x1d2a8a===_0x153b65;}},_0xd874b3=process['env']['RANGER_TEST_USERNAME'],_0x55e2fe=process[_0x3abe0c(0x179)][_0x3abe0c(0x119)],_0x4861f1={};if(_0xd874b3)_0x4861f1['username']=_0xd874b3;if(_0x55e2fe)_0x4861f1['password']=_0x55e2fe;if(_0x9e66aa?.[_0x3abe0c(0x128)])_0x4861f1[_0x3abe0c(0x128)]=!![];if(_0x9e66aa?.['targetUrl'])_0x4861f1[_0x3abe0c(0xec)]=_0x9e66aa['targetUrl'];if(_0x9e66aa?.['env'])_0x4861f1[_0x3abe0c(0x179)]=_0x9e66aa[_0x3abe0c(0x179)];_0x9e66aa?.[_0x3abe0c(0x117)]&&(_0x4861f1[_0x3abe0c(0x156)]=_0x9e66aa[_0x3abe0c(0x117)]['sessionId'],_0x4861f1[_0x3abe0c(0x104)]=_0x9e66aa['tunnel'][_0x3abe0c(0x137)]);try{return await _0x36b29c['yIIsf'](apiRequest,'/api/v1/profiles/'+_0x36b29c[_0x3abe0c(0x120)](encodeURIComponent,_0x203dc7)+'/login',{'method':_0x36b29c['XcGov'],'body':JSON[_0x3abe0c(0x16c)](_0x4861f1)});}catch(_0x43d31d){if(_0x36b29c[_0x3abe0c(0x148)](_0x43d31d,ApiError)&&_0x36b29c[_0x3abe0c(0xce)](_0x43d31d[_0x3abe0c(0x101)],0x190)&&_0x43d31d[_0x3abe0c(0x11c)]===_0x3abe0c(0x10a))return{'status':'not_configured','error':_0x43d31d[_0x3abe0c(0x13a)]};throw _0x43d31d;}}async function serverSideLoginWithOptionalTunnel(_0x36336b,_0x288403,_0x4af198={}){const _0x15878a=_0x473257,_0x32df1={'UNstX':function(_0x2abcf4,_0x2e1adf){return _0x2abcf4(_0x2e1adf);},'WKECN':function(_0x46a5d9,_0x51a2b4){return _0x46a5d9(_0x51a2b4);},'TLUDX':function(_0x3581f6,_0x163304){return _0x3581f6===_0x163304;},'GwGBG':_0x15878a(0x183),'cnoyL':function(_0x25ac71){return _0x25ac71();},'gNocX':function(_0x170139,_0x5d1433){return _0x170139(_0x5d1433);},'IRJue':'tunnel_login_request','VGell':function(_0x41913a,_0x2684ee){return _0x41913a??_0x2684ee;},'uYtyG':function(_0x35e219,_0xaaf27a){return _0x35e219||_0xaaf27a;},'yIQlN':function(_0x25bbf3,_0x2c2775){return _0x25bbf3(_0x2c2775);},'nCeOi':'tunnel_login_cleanup'};if(!_0x32df1['WKECN'](needsTunnel,_0x288403))return await serverSideLogin(_0x36336b,{'force':_0x4af198['force'],'env':_0x4af198['env']});let _0x239ef1=null,_0x537ffc=null,_0x18ebe2=null,_0x65cd2c=null,_0x33ed22=![];const _0xe8514c=process[_0x15878a(0x179)]['RANGER_TUNNEL_LOGIN_HEADED']?.['toLowerCase'](),_0x5ba156=_0xe8514c==='1'||_0x32df1[_0x15878a(0x11f)](_0xe8514c,_0x15878a(0x184)),_0x2ee3bc={'profileName':_0x36336b,'targetUrlHost':targetHostForTelemetry(_0x288403),'tunnelRequired':!![],'forceLogin':_0x32df1['WKECN'](Boolean,_0x4af198['force']),'localBrowserServerHeaded':_0x5ba156};try{_0x4af198[_0x15878a(0x114)]?.['trackPhaseStart'](_0x32df1[_0x15878a(0x131)],_0x2ee3bc);_0x5ba156&&console[_0x15878a(0xdb)]('\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...');_0x239ef1=await launchBrowserServer({'headless':!_0x5ba156}),_0x537ffc=await createTunnelSession(_0x288403);const _0x1d8913=await _0x32df1['cnoyL'](requireToken);_0x18ebe2=await _0x32df1[_0x15878a(0x12b)](createTunnelBridge,{'localWsUrl':_0x239ef1['wsEndpoint'],'tunnelServerUrl':_0x537ffc[_0x15878a(0x167)],'sessionId':_0x537ffc['sessionId'],'apiKey':_0x1d8913,'onError':_0x407c58=>{_0x65cd2c=_0x407c58;},'onClose':()=>{const _0x1677f7=_0x15878a;_0x65cd2c??=new Error(_0x1677f7(0x15d)+_0x36336b);},'onEvent':_0x49b69e=>trackBridgeEvent(_0x4af198[_0x15878a(0x114)],_0x49b69e)}),_0x4af198[_0x15878a(0x114)]?.[_0x15878a(0x10d)](_0x32df1[_0x15878a(0x131)],{..._0x2ee3bc,'tunnelSessionId':_0x537ffc[_0x15878a(0xd8)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x5ba156}),_0x33ed22=!![];try{return _0x4af198[_0x15878a(0x114)]?.['trackPhaseStart'](_0x32df1[_0x15878a(0x134)],{..._0x2ee3bc,'tunnelSessionId':_0x537ffc['sessionId']}),await serverSideLogin(_0x36336b,{'force':_0x4af198[_0x15878a(0x128)],'targetUrl':_0x288403,'env':_0x4af198[_0x15878a(0x179)],'tunnel':{'sessionId':_0x537ffc[_0x15878a(0xd8)],'pwEndpoint':_0x537ffc['pwEndpoint']}})['then'](_0x4890b3=>{const _0x50ec9a=_0x15878a;return _0x4af198['telemetry']?.['trackPhaseEnd']('tunnel_login_request',{..._0x2ee3bc,'tunnelSessionId':_0x537ffc?.[_0x50ec9a(0xd8)],'loginStatus':_0x4890b3[_0x50ec9a(0x101)],'hasSessionState':_0x32df1[_0x50ec9a(0x106)](Boolean,_0x4890b3['session_state']),'hasTestOutput':_0x32df1[_0x50ec9a(0x106)](Boolean,_0x4890b3['test_output']),'bridgeError':_0x32df1[_0x50ec9a(0x106)](errorMessageForTelemetry,_0x65cd2c)}),_0x4890b3;});}catch(_0x5bbfce){await _0x4af198['telemetry']?.[_0x15878a(0x127)](_0x32df1[_0x15878a(0x134)],_0x32df1['VGell'](_0x65cd2c,_0x5bbfce),{..._0x2ee3bc,'tunnelSessionId':_0x537ffc[_0x15878a(0xd8)],'bridgeError':_0x32df1['WKECN'](errorMessageForTelemetry,_0x65cd2c)});throw _0x32df1['VGell'](_0x65cd2c,_0x5bbfce);}}catch(_0x19573c){!_0x33ed22&&await _0x4af198[_0x15878a(0x114)]?.['trackPhaseError'](_0x32df1[_0x15878a(0x131)],_0x19573c,{..._0x2ee3bc,'tunnelSessionId':_0x537ffc?.['sessionId']});throw _0x19573c;}finally{(_0x32df1[_0x15878a(0x11a)](_0x537ffc,_0x239ef1)||_0x18ebe2)&&(_0x4af198['telemetry']?.['trackPhaseStart'](_0x15878a(0x10b),{..._0x2ee3bc,'tunnelSessionId':_0x537ffc?.['sessionId']}),_0x18ebe2?.['close'](),_0x239ef1&&await _0x239ef1['close']()[_0x15878a(0x11d)](()=>{}),_0x537ffc&&await _0x32df1[_0x15878a(0x139)](deleteTunnelSession,_0x537ffc[_0x15878a(0xd8)])['catch'](()=>{}),_0x4af198[_0x15878a(0x114)]?.[_0x15878a(0x10d)](_0x32df1[_0x15878a(0xfe)],{..._0x2ee3bc,'tunnelSessionId':_0x537ffc?.['sessionId']}));}}export async function manualBrowserLogin(_0x36e412,_0x4cd4a6,_0x30424b={}){const _0x31fc64=_0x473257,_0x247f1b={'Klhsw':function(_0x18baff,_0xa57e91){return _0x18baff/_0xa57e91;},'ZTXUR':function(_0x284501){return _0x284501();},'jFaNs':function(_0x295a4c,_0x24e3be,_0xbe70a1){return _0x295a4c(_0x24e3be,_0xbe70a1);},'PIMcM':function(_0x3f5414){return _0x3f5414();},'HPCym':function(_0x1ab578,_0x587b7a){return _0x1ab578+_0x587b7a;},'ROTwh':function(_0x164922,_0x3a9c12){return _0x164922>_0x3a9c12;},'vhBgX':'about:blank','AxGUA':_0x31fc64(0x109),'FKzJV':function(_0x4ef526,_0x49877e){return _0x4ef526(_0x49877e);},'XHTrX':'Browser\x20login\x20timed\x20out\x20before\x20completion.','jazYG':function(_0x59a833,_0x5022d0){return _0x59a833(_0x5022d0);},'VyWNa':'cli:manual-login'};if(!_0x247f1b['PIMcM'](isInteractive))throw new Error(_0x247f1b[_0x31fc64(0xef)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x36e412['name']+_0x31fc64(0x189)+'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20',_0x31fc64(0x161)));const _0x599946=_0x4cd4a6&&_0x247f1b[_0x31fc64(0x14d)](_0x4cd4a6['domains']['length'],0x0)?_0x4cd4a6['domains'][0x0]:_0x247f1b[_0x31fc64(0xe4)];console[_0x31fc64(0xdb)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console['log'](_0x247f1b[_0x31fc64(0xf1)]),await new Promise(_0x457fcf=>setTimeout(_0x457fcf,0x7d0));const _0x516d5a=await chromium[_0x31fc64(0x111)]({'headless':![]});let _0x454edf=null;try{const _0x38fdf3={'ignoreHTTPSErrors':!![]};_0x4cd4a6?.['setupHeaders']&&(_0x38fdf3[_0x31fc64(0xd9)]=_0x4cd4a6[_0x31fc64(0x10f)]);const _0x14e5c5=await _0x516d5a[_0x31fc64(0xfd)](_0x38fdf3);await _0x247f1b['FKzJV'](addProfileSetupBanner,_0x14e5c5);const _0xcf694b=await _0x14e5c5[_0x31fc64(0x122)]();await _0xcf694b[_0x31fc64(0x15a)](_0x599946);let _0xa64fc7=![];await new Promise(_0x4d5108=>{const _0xb34fd4=_0x31fc64,_0x274811={'jKoQb':function(_0x4a3276,_0x57e778){return _0x247f1b['Klhsw'](_0x4a3276,_0x57e778);},'rPLuj':function(_0x1d0068){return _0x247f1b['ZTXUR'](_0x1d0068);}},_0x3ef09b=_0x247f1b[_0xb34fd4(0x13b)](setTimeout,()=>{const _0x28f444=_0xb34fd4;_0xa64fc7=!![],console[_0x28f444(0xf4)]('Browser\x20login\x20timed\x20out\x20after\x20'+_0x274811[_0x28f444(0x132)](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x274811[_0x28f444(0x146)](_0x4d5108);},MANUAL_LOGIN_TIMEOUT_MS);_0xcf694b['on'](_0xb34fd4(0x15e),async()=>{const _0x1c9b48=_0xb34fd4;clearTimeout(_0x3ef09b);try{const _0x50fc9d=await _0x14e5c5[_0x1c9b48(0x17a)]();_0x454edf=_0x50fc9d;}catch{}_0x4d5108();});});if(_0xa64fc7&&!_0x454edf)throw new Error(_0x247f1b['XHTrX']);}finally{await _0x516d5a[_0x31fc64(0x15e)]()['catch'](()=>{});}if(!_0x454edf)throw new Error(_0x31fc64(0x154));return _0x30424b['persistSessionState']!==![]&&await _0x247f1b['jFaNs'](apiRequest,_0x31fc64(0x144)+_0x247f1b[_0x31fc64(0xe8)](encodeURIComponent,_0x36e412['name'])+'/session',{'method':_0x31fc64(0x16a),'body':JSON[_0x31fc64(0x16c)]({'session_state':_0x454edf,'updated_by':_0x247f1b['VyWNa']})}),{'sessionState':_0x454edf};}export async function promptSaveCredentials(_0x14f1f7){const _0x582959=_0x473257,_0x3f9f6a={'ALKPM':function(_0x27c42f,_0x191051){return _0x27c42f||_0x191051;},'daQzH':'confirm','KSHYl':_0x582959(0x11e),'mdwJk':function(_0x52a96f,_0x455c2b,_0x3aa343){return _0x52a96f(_0x455c2b,_0x3aa343);},'mRVoC':function(_0x49d919,_0x212240){return _0x49d919(_0x212240);},'ZjiIH':'\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.'},_0xd50d2d=process[_0x582959(0x179)]['RANGER_TEST_USERNAME'],_0x19b001=process['env']['RANGER_TEST_PASSWORD'];if(_0x3f9f6a[_0x582959(0x18a)](!_0xd50d2d,!_0x19b001))return;if(!isInteractive())return;const {save:_0x2166d6}=await _0x2ef7c3[_0x582959(0xd2)]([{'type':_0x3f9f6a[_0x582959(0x14b)],'name':_0x3f9f6a['KSHYl'],'message':_0x582959(0xe0),'default':![]}]);if(!_0x2166d6)return;await _0x3f9f6a[_0x582959(0x121)](apiRequest,'/api/v1/profiles/'+_0x3f9f6a['mRVoC'](encodeURIComponent,_0x14f1f7),{'method':'PUT','body':JSON[_0x582959(0x16c)]({'username':_0xd50d2d,'password':_0x19b001})}),console[_0x582959(0xdb)](_0x3f9f6a['ZjiIH']);}export async function resolveCloudProfileSession(_0x403c04,_0x1efe6e={}){const _0x4d4d9a=_0x473257,_0x2317d4={'dZAQO':function(_0x3bc311){return _0x3bc311();},'GuxjO':function(_0xf2799c,_0x47f6e1){return _0xf2799c===_0x47f6e1;},'rxazj':_0x4d4d9a(0xf3),'mCwUW':function(_0x5787ee,_0xcb2874){return _0x5787ee||_0xcb2874;},'uzaUh':function(_0x14283f,_0x223d27){return _0x14283f(_0x223d27);},'xjtrG':function(_0x404eef,_0x4523aa,_0x4de92a,_0x595e18,_0x14aa96){return _0x404eef(_0x4523aa,_0x4de92a,_0x595e18,_0x14aa96);},'VsaZh':function(_0x502765,_0x4d7d2e,_0x3fb993){return _0x502765(_0x4d7d2e,_0x3fb993);},'duxAQ':function(_0x140cbd,_0x302b57,_0x11a206,_0x3f928f,_0x2fb1ca,_0x3c6478,_0x3b86a5,_0x16649a){return _0x140cbd(_0x302b57,_0x11a206,_0x3f928f,_0x2fb1ca,_0x3c6478,_0x3b86a5,_0x16649a);},'SzMmb':_0x4d4d9a(0x178),'CQrRK':'\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','cvuKe':function(_0x5230c2,_0x37a86a){return _0x5230c2(_0x37a86a);},'gwjGi':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','eAOnk':function(_0x3d6425,_0x5410dd){return _0x3d6425+_0x5410dd;},'kaSVq':function(_0x40cce1,_0x13f4ac,_0x13486b,_0x2cde7a){return _0x40cce1(_0x13f4ac,_0x13486b,_0x2cde7a);}},_0x27cc15=_0x403c04['settings']??{},_0x762058=await _0x2317d4['dZAQO'](fetchAuthConfig),_0x4f6f3a=_0x762058?resolveAuthEnvironmentLocally(_0x762058,_0x1efe6e['assertedEnv']??_0x403c04[_0x4d4d9a(0x13e)]):null,_0x2382b0=_0x2317d4[_0x4d4d9a(0x135)](typeof _0x4f6f3a?.['loginInstructions'],_0x2317d4['rxazj'])&&_0x4f6f3a[_0x4d4d9a(0x116)]['trim']()?_0x4f6f3a['loginInstructions']:undefined,_0xa86ad0=typeof _0x27cc15[_0x4d4d9a(0x116)]===_0x2317d4['rxazj']&&_0x27cc15[_0x4d4d9a(0x116)]['trim']()?_0x27cc15[_0x4d4d9a(0x116)]:undefined,_0x582665=_0x2317d4[_0x4d4d9a(0xd4)](_0xa86ad0,!_0x2382b0)?_0x27cc15:{..._0x27cc15,'loginInstructions':_0x2382b0},_0xb56211=_0x2317d4[_0x4d4d9a(0x188)](Boolean,_0x582665['loginInstructions']?.[_0x4d4d9a(0x17c)]()),_0x4d168d=Boolean(_0x27cc15[_0x4d4d9a(0x143)]||_0x4f6f3a?.[_0x4d4d9a(0x143)]),_0x45736b=_0x4f6f3a?.[_0x4d4d9a(0xd0)],_0x24a709=_0x27cc15[_0x4d4d9a(0x10f)],_0x49bee9=_0x24a709??_0x4f6f3a?.['setupHeaders'],_0x489415=_0x1efe6e[_0x4d4d9a(0x140)]??_0x27cc15['baseUrl']??(_0x45736b&&_0x45736b[_0x4d4d9a(0xde)]>0x0?_0x45736b[0x0]:''),_0x44dbb8=_0x489415?needsTunnel(_0x489415):![],_0x293e3f={'invalidateOn':_0x4f6f3a?.[_0x4d4d9a(0xea)],'userAgent':_0x4f6f3a?.['browserOptions']?.['userAgent']??_0x27cc15['userAgent']};_0x4d168d&&console[_0x4d4d9a(0xdb)]('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x403c04[_0x4d4d9a(0x13d)]+_0x4d4d9a(0x12f));if(!_0x4d168d){const _0x2e2deb=await checkLocalCache(_0x403c04['name'],_0x403c04[_0x4d4d9a(0x180)],_0x489415,_0x49bee9,_0x293e3f);if(_0x2e2deb){if(_0x489415&&!_0x44dbb8){const _0x501b9f=await _0x2317d4['xjtrG'](isCachedSessionLive,_0x2e2deb['storageStatePath'],_0x489415,{'sessionCheckPath':_0x4f6f3a?.[_0x4d4d9a(0x153)],'setupHeaders':_0x49bee9},{'launchBrowser':launchRealBrowser});if(_0x501b9f)return console[_0x4d4d9a(0xdb)](_0x4d4d9a(0x17f)+_0x403c04['name']+'\x22'),{'authPath':_0x2e2deb['storageStatePath'],'settings':_0x582665,'resolvedEnv':_0x4f6f3a};console['log'](_0x4d4d9a(0x147)+_0x403c04[_0x4d4d9a(0x13d)]+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x2317d4['VsaZh'](emitSessionValidationHint,_0x489415,_0x4f6f3a);}else return _0x44dbb8&&console[_0x4d4d9a(0xdb)](_0x4d4d9a(0x12e)+_0x403c04['name']+'\x22'),{'authPath':_0x2e2deb['storageStatePath'],'settings':_0x582665,'resolvedEnv':_0x4f6f3a};}}if(!_0x4d168d&&_0x403c04[_0x4d4d9a(0x15f)]){const _0x588b75=await _0x2317d4[_0x4d4d9a(0xd3)](writeSessionToLocalCache,_0x403c04['name'],_0x403c04['organizationId'],_0x489415,_0x49bee9,_0x403c04['sessionState'],_0x45736b,_0x293e3f);if(_0x489415){const _0x52545d=await _0x2317d4['xjtrG'](isCachedSessionLive,_0x588b75,_0x489415,{'sessionCheckPath':_0x4f6f3a?.[_0x4d4d9a(0x153)],'setupHeaders':_0x49bee9},{'launchBrowser':launchRealBrowser});if(_0x52545d)return console['log'](_0x4d4d9a(0x10e)+_0x403c04[_0x4d4d9a(0x13d)]+_0x4d4d9a(0xf5)),{'authPath':_0x588b75,'settings':_0x582665,'resolvedEnv':_0x4f6f3a};console[_0x4d4d9a(0xdb)]('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x403c04['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),emitSessionValidationHint(_0x489415,_0x4f6f3a);}else return{'authPath':_0x588b75,'settings':_0x582665,'resolvedEnv':_0x4f6f3a};}if(_0xb56211)return console[_0x4d4d9a(0xdb)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x403c04['name']+_0x4d4d9a(0x14a)),{'authPath':undefined,'settings':_0x582665,'resolvedEnv':_0x4f6f3a};console[_0x4d4d9a(0xdb)](_0x4d4d9a(0xd7)+_0x403c04[_0x4d4d9a(0x13d)]+'\x22,\x20attempting\x20login...');const _0x264846=Boolean(process['env']['RANGER_TEST_USERNAME'])&&_0x2317d4['uzaUh'](Boolean,process['env'][_0x4d4d9a(0x119)]),_0x136ad7=_0x2317d4['uzaUh'](Boolean,_0x403c04['username']),_0x20d491=_0x2317d4[_0x4d4d9a(0x188)](Boolean,_0x1efe6e['assertedEnv']),_0x346a3a=_0x489415?_0x2317d4[_0x4d4d9a(0x188)](isBareLocalhost,_0x489415):![],_0x23c2e8=(_0x264846||_0x136ad7)&&(!_0x346a3a||_0x20d491);if(_0x23c2e8)try{const _0x256156=_0x489415?await serverSideLoginWithOptionalTunnel(_0x403c04['name'],_0x489415,{'force':_0x4d168d,'telemetry':_0x1efe6e['telemetry'],'env':_0x1efe6e['assertedEnv']}):await _0x2317d4['VsaZh'](serverSideLogin,_0x403c04[_0x4d4d9a(0x13d)],{'force':_0x4d168d,'env':_0x1efe6e[_0x4d4d9a(0xf7)]});if(_0x2317d4[_0x4d4d9a(0x135)](_0x256156['status'],'not_configured'))console[_0x4d4d9a(0xdb)](_0x2317d4['SzMmb']);else{if(_0x2317d4['GuxjO'](_0x256156[_0x4d4d9a(0x101)],_0x4d4d9a(0xe5))&&_0x256156[_0x4d4d9a(0x17b)]){console[_0x4d4d9a(0xdb)](_0x4d4d9a(0x142));const _0x27d142=await writeSessionToLocalCache(_0x403c04[_0x4d4d9a(0x13d)],_0x403c04['organizationId'],_0x489415,_0x49bee9,_0x256156[_0x4d4d9a(0x17b)],_0x45736b,_0x293e3f);return _0x264846&&!_0x136ad7&&await _0x2317d4['uzaUh'](promptSaveCredentials,_0x403c04[_0x4d4d9a(0x13d)]),{'authPath':_0x27d142,'settings':_0x582665,'resolvedEnv':_0x4f6f3a};}else _0x256156['test_output']&&(console['log'](_0x2317d4[_0x4d4d9a(0xf0)]),console['log'](_0x256156['test_output'])),console['log'](_0x4d4d9a(0x182));}}catch(_0x303687){console[_0x4d4d9a(0xdb)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0x303687 instanceof Error?_0x303687['message']:_0x2317d4[_0x4d4d9a(0x187)](String,_0x303687))),console['log'](_0x2317d4[_0x4d4d9a(0x16b)]);}if(_0x346a3a&&!_0x20d491&&!isInteractive())throw new Error(_0x2317d4['eAOnk'](_0x4d4d9a(0x164)+_0x489415+_0x4d4d9a(0x14f)+_0x403c04[_0x4d4d9a(0x13d)]+_0x4d4d9a(0x110)+(_0x4d4d9a(0x16f)+_0x403c04[_0x4d4d9a(0x13d)]+'\x20--url\x20'+_0x489415+'\x0a'),'\x20\x20•\x20or\x20pass\x20--env\x20<key>\x20to\x20run\x20an\x20automated\x20login\x20for\x20this\x20target.'));const _0xa15514=_0x4f6f3a?{..._0x4f6f3a,'domains':orderLoginDomains(_0x489415,_0x4f6f3a[_0x4d4d9a(0xd0)]),'setupHeaders':_0x49bee9}:_0x489415?{'key':_0x403c04['environmentKey']??'','domains':[_0x489415],'setupHeaders':_0x49bee9}:null,{sessionState:_0x36d073}=await _0x2317d4['kaSVq'](manualBrowserLogin,_0x403c04,_0xa15514,{'persistSessionState':!_0x44dbb8}),_0x4f1c51=await writeSessionToLocalCache(_0x403c04['name'],_0x403c04['organizationId'],_0x489415,_0x49bee9,_0x36d073,_0x45736b,_0x293e3f);return{'authPath':_0x4f1c51,'settings':_0x582665,'resolvedEnv':_0x4f6f3a};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
const _0x456319=_0x501c;function _0x501c(_0x54035f,_0x15d13d){_0x54035f=_0x54035f-0x8b;const _0x4816ed=_0x4816();let _0x501ca9=_0x4816ed[_0x54035f];return _0x501ca9;}function _0x4816(){const _0x34b498=['[::1]','baseUrl','496245xiuSIe','pathname','defaultEnvironmentKey','has','fzGto','toString','sessionCheckPath','142zIHLuz','stringify','startsWith','localhost.','includes','isTTY','newPage','port','892602GPSgCR','clientIp','map','.storageState.json','close','8622576vynFDi','.json','test','filter','5788lDALrI','28KmvjRx','localhost','crfFA','28VHszBF','hex','setupHeaders','add','update','61340mcNUXX','profileName','auth','slice','domcontentloaded','561TDPkks','push','invalidateOn','effectiveBaseUrl','replace','QrkXD','.localhost','DUarG','hostname','rVgOh','4649280YdVDwh','orgId','stdin','userAgent','215610IADrfQ','HRHkJ','bhOli','EqSfC','Rjumg','oEQqx','endsWith'];_0x4816=function(){return _0x34b498;};return _0x4816();}(function(_0x1a6741,_0x3356c7){const _0x31c98b=_0x501c,_0x1e2c6a=_0x1a6741();while(!![]){try{const _0x2f9c70=parseInt(_0x31c98b(0x9f))/0x1*(parseInt(_0x31c98b(0xb0))/0x2)+parseInt(_0x31c98b(0xa7))/0x3+parseInt(_0x31c98b(0xb4))/0x4*(parseInt(_0x31c98b(0x98))/0x5)+-parseInt(_0x31c98b(0x8f))/0x6*(parseInt(_0x31c98b(0xb1))/0x7)+parseInt(_0x31c98b(0x8b))/0x8+-parseInt(_0x31c98b(0xac))/0x9+-parseInt(_0x31c98b(0xb9))/0xa*(parseInt(_0x31c98b(0xbe))/0xb);if(_0x2f9c70===_0x3356c7)break;else _0x1e2c6a['push'](_0x1e2c6a['shift']());}catch(_0x50fd19){_0x1e2c6a['push'](_0x1e2c6a['shift']());}}}(_0x4816,0x8b193));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x2b31a6=process['env'],_0x40d8e8={'stdin':process[_0x456319(0x8d)],'stdout':process['stdout']}){const _0x3ebe5a=_0x456319,_0x1db427={'cfETS':function(_0x53c548,_0x439634){return _0x53c548(_0x439634);}};if(_0x2b31a6['CI'])return![];return Boolean(_0x40d8e8[_0x3ebe5a(0x8d)][_0x3ebe5a(0xa4)])&&_0x1db427['cfETS'](Boolean,_0x40d8e8['stdout'][_0x3ebe5a(0xa4)]);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x3a1324){const _0x1ed3e9=_0x456319,_0x14c536={'dGGsi':function(_0x5403b8,_0x1c4cf3){return _0x5403b8(_0x1c4cf3);},'TSYHh':_0x1ed3e9(0x97),'HRHkJ':function(_0x3100c5,_0x768b9b){return _0x3100c5(_0x768b9b);},'czcEx':_0x1ed3e9(0xa6),'Luxzu':_0x1ed3e9(0x8e),'bhOli':function(_0xe14df1,_0x4e39b3){return _0xe14df1!==_0x4e39b3;},'UeQoG':'clientIp','aNRfB':function(_0x5cc362,_0x36a18b){return _0x5cc362(_0x36a18b);},'QrkXD':'sha256'},_0x322f3e=new Set(_0x3a1324[_0x1ed3e9(0xc0)]??DEFAULT_INVALIDATE_ON);_0x3a1324[_0x1ed3e9(0xc1)]&&_0x14c536['dGGsi'](needsTunnel,_0x3a1324['effectiveBaseUrl'])&&_0x322f3e[_0x1ed3e9(0xb7)](_0x14c536['TSYHh']);const _0xbd0afe={'orgId':_0x3a1324[_0x1ed3e9(0x8c)],'profileName':_0x3a1324[_0x1ed3e9(0xba)]};return _0x322f3e['has'](_0x1ed3e9(0x97))&&(_0xbd0afe[_0x1ed3e9(0xc1)]=_0x3a1324['effectiveBaseUrl']),_0x322f3e['has'](_0x1ed3e9(0xb6))&&(_0xbd0afe['setupHeaders']=_0x3a1324['setupHeaders']?_0x14c536[_0x1ed3e9(0x90)](sortObjectKeys,_0x3a1324['setupHeaders']):_0x3a1324['setupHeaders']),_0x322f3e[_0x1ed3e9(0x9b)](_0x14c536['czcEx'])&&(_0xbd0afe[_0x1ed3e9(0xa6)]=_0x14c536['dGGsi'](extractPort,_0x3a1324[_0x1ed3e9(0xc1)])),_0x322f3e['has'](_0x14c536['Luxzu'])&&_0x14c536[_0x1ed3e9(0x91)](_0x3a1324['userAgent'],undefined)&&(_0xbd0afe[_0x1ed3e9(0x8e)]=_0x3a1324['userAgent']),_0x322f3e['has'](_0x14c536['UeQoG'])&&_0x3a1324[_0x1ed3e9(0xa8)]!==undefined&&(_0xbd0afe[_0x1ed3e9(0xa8)]=_0x3a1324['clientIp']),_0x14c536['aNRfB'](createHash,_0x14c536[_0x1ed3e9(0xc3)])[_0x1ed3e9(0xb8)](JSON[_0x1ed3e9(0xa0)](_0xbd0afe))['digest'](_0x1ed3e9(0xb5))[_0x1ed3e9(0xbc)](0x0,0xc);}function extractPort(_0x1cd7a4){const _0x3611ed=_0x456319;try{return new URL(_0x1cd7a4)[_0x3611ed(0xa6)];}catch{return'';}}function sortObjectKeys(_0x1253fa){const _0x5ee512={};for(const _0xa3d87d of Object['keys'](_0x1253fa)['sort']()){_0x5ee512[_0xa3d87d]=_0x1253fa[_0xa3d87d];}return _0x5ee512;}export function getSessionCachePath(_0x4f1ac8,_0x22359a){const _0x48b8f1=_0x456319,_0x10b650={'Rhahx':function(_0x4b5678){return _0x4b5678();},'crfFA':_0x48b8f1(0xbb)};return join(_0x10b650['Rhahx'](getRangerHomeDir),_0x10b650[_0x48b8f1(0xb3)],_0x4f1ac8+'-'+_0x22359a+_0x48b8f1(0xad));}export function getStorageStatePath(_0x48721a){const _0x2d31a5=_0x456319;return _0x48721a[_0x2d31a5(0xc2)](/\.json$/,_0x2d31a5(0xaa));}export function needsTunnel(_0xb5de66){const _0x4a0331=_0x456319,_0x3968e3={'fzGto':function(_0x3b0313,_0x3341d8){return _0x3b0313===_0x3341d8;},'bKBMv':_0x4a0331(0xb2),'GRdZQ':function(_0x4cd0ef,_0x2e06fb){return _0x4cd0ef===_0x2e06fb;}};let _0x43c17d;try{_0x43c17d=new URL(_0xb5de66)[_0x4a0331(0xc6)];}catch{return![];}if(_0x3968e3[_0x4a0331(0x9c)](_0x43c17d,_0x3968e3['bKBMv'])||_0x3968e3['GRdZQ'](_0x43c17d,'127.0.0.1'))return!![];if(_0x43c17d[_0x4a0331(0x95)](_0x4a0331(0xc4)))return!![];if(_0x43c17d[_0x4a0331(0xa3)](_0x4a0331(0xa2)))return!![];return![];}export function isBareLocalhost(_0x3a9c18){const _0x38ceb7=_0x456319,_0x36f692={'rVgOh':function(_0x5472fe,_0x1ad970){return _0x5472fe===_0x1ad970;},'EqSfC':'localhost'};let _0x260d6d;try{_0x260d6d=new URL(_0x3a9c18)[_0x38ceb7(0xc6)];}catch{return![];}return _0x36f692['rVgOh'](_0x260d6d,_0x36f692[_0x38ceb7(0x92)])||_0x36f692[_0x38ceb7(0xc7)](_0x260d6d,'127.0.0.1')||_0x260d6d==='::1'||_0x260d6d===_0x38ceb7(0x96);}export function orderLoginDomains(_0x1feef5,_0x22d46f){const _0x3483ee=_0x456319,_0x15202c=_0x22d46f??[];if(!_0x1feef5)return _0x15202c;return[_0x1feef5,..._0x15202c[_0x3483ee(0xaf)](_0x44f835=>_0x44f835!==_0x1feef5)];}export function hostnameOf(_0x3bb04c){return new URL(_0x3bb04c)['hostname'];}export function duplicateCookiesForDomains(_0x3e23b2,_0x41c5a6){const _0x35b1a5=_0x456319,_0x500514={'VYPLQ':function(_0x6d67dd,_0x45e9db){return _0x6d67dd(_0x45e9db);}},_0x48f15a=[..._0x3e23b2],_0x27b0c9=new Set(_0x3e23b2[_0x35b1a5(0xa9)](_0x23d8a5=>_0x23d8a5['domain']));for(const _0x306f7c of _0x41c5a6){let _0x1f3545;try{_0x1f3545=_0x500514['VYPLQ'](hostnameOf,_0x306f7c);}catch{continue;}if(!_0x1f3545)continue;const _0x312f07=_0x1f3545[_0x35b1a5(0xa1)]('.')?_0x1f3545:'.'+_0x1f3545;if(_0x27b0c9[_0x35b1a5(0x9b)](_0x1f3545)||_0x27b0c9[_0x35b1a5(0x9b)](_0x312f07))continue;for(const _0x5c6924 of _0x3e23b2){_0x48f15a[_0x35b1a5(0xbf)]({..._0x5c6924,'domain':_0x312f07});}_0x27b0c9[_0x35b1a5(0xb7)](_0x312f07);}return _0x48f15a;}export function resolveAuthEnvironmentLocally(_0x5a1e3b,_0x28f72c){const _0x2ea55a=_0x456319,_0x454b34=_0x5a1e3b['environments'];if(_0x28f72c){const _0x282678=_0x454b34[_0x28f72c];if(!_0x282678)return null;return{'key':_0x28f72c,..._0x282678};}if(_0x5a1e3b[_0x2ea55a(0x9a)]){const _0xc4a08c=_0x454b34[_0x5a1e3b[_0x2ea55a(0x9a)]];if(!_0xc4a08c)return null;return{'key':_0x5a1e3b[_0x2ea55a(0x9a)],..._0xc4a08c};}const _0x4dc48f=Object['keys'](_0x454b34);if(_0x4dc48f['length']===0x1){const _0x4f01b9=_0x4dc48f[0x0];return{'key':_0x4f01b9,..._0x454b34[_0x4f01b9]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x92586b,_0x52f5c6){const _0x2daf6b=_0x456319;try{if(_0x52f5c6)return new URL(_0x52f5c6,_0x92586b)[_0x2daf6b(0x9d)]();return new URL(_0x92586b)[_0x2daf6b(0x9d)]();}catch{return null;}}export function looksLikeLoginUrl(_0x2a9013){const _0x1a9bc3=_0x456319;try{const _0x287ddc=new URL(_0x2a9013);return LOGIN_URL_PATTERN['test'](_0x287ddc[_0x1a9bc3(0x99)]);}catch{return LOGIN_URL_PATTERN[_0x1a9bc3(0xae)](_0x2a9013);}}export async function isCachedSessionLive(_0x1c0a4e,_0x310493,_0x5d3110={},_0x1ba58f={}){const _0x3c2fea=_0x456319,_0xb48d34={'oEQqx':function(_0x1e9e5c,_0xcefccf,_0x4c27fc){return _0x1e9e5c(_0xcefccf,_0x4c27fc);},'Rjumg':function(_0x497a66,_0x57522e){return _0x497a66===_0x57522e;},'DUarG':function(_0x47a150,_0x4bb626){return _0x47a150(_0x4bb626);}},_0x5962e8=_0xb48d34[_0x3c2fea(0x94)](buildSessionCheckUrl,_0x310493,_0x5d3110[_0x3c2fea(0x9e)]);if(!_0x5962e8)return!![];if(!_0x1ba58f['launchBrowser'])return!![];let _0x560d0f=null;try{_0x560d0f=await _0x1ba58f['launchBrowser']();const _0x48d51f=await _0x560d0f['newContext']({'storageState':_0x1c0a4e,'ignoreHTTPSErrors':!![],..._0x5d3110['setupHeaders']?{'extraHTTPHeaders':_0x5d3110[_0x3c2fea(0xb6)]}:{}}),_0x2a2150=await _0x48d51f[_0x3c2fea(0xa5)](),_0x188b8e=await _0x2a2150['goto'](_0x5962e8,{'waitUntil':_0x3c2fea(0xbd),'timeout':0x3a98}),_0x3a32f8=_0x188b8e?.['status']();if(_0xb48d34[_0x3c2fea(0x93)](_0x3a32f8,0x191)||_0xb48d34[_0x3c2fea(0x93)](_0x3a32f8,0x193))return![];const _0x32df58=_0x2a2150['url']();if(_0xb48d34[_0x3c2fea(0xc5)](looksLikeLoginUrl,_0x32df58))return![];return!![];}catch{return![];}finally{if(_0x560d0f)await _0x560d0f[_0x3c2fea(0xab)]()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x23830a=_0x4166;(function(_0x582470,_0x318dc5){const _0x4f23c1=_0x4166,_0x14c679=_0x582470();while(!![]){try{const _0x447bc0=parseInt(_0x4f23c1(0x14b))/0x1*(parseInt(_0x4f23c1(0x144))/0x2)+-parseInt(_0x4f23c1(0x13f))/0x3+parseInt(_0x4f23c1(0x141))/0x4*(-parseInt(_0x4f23c1(0x146))/0x5)+parseInt(_0x4f23c1(0x149))/0x6+-parseInt(_0x4f23c1(0x14a))/0x7+-parseInt(_0x4f23c1(0x13c))/0x8*(parseInt(_0x4f23c1(0x13d))/0x9)+parseInt(_0x4f23c1(0x145))/0xa*(parseInt(_0x4f23c1(0x13a))/0xb);if(_0x447bc0===_0x318dc5)break;else _0x14c679['push'](_0x14c679['shift']());}catch(_0x46a6e2){_0x14c679['push'](_0x14c679['shift']());}}}(_0x40db,0x959e5));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';function _0x4166(_0x30587a,_0x4f5f37){_0x30587a=_0x30587a-0x13a;const _0x40db52=_0x40db();let _0x4166d6=_0x40db52[_0x30587a];return _0x4166d6;}const ALGORITHM=_0x23830a(0x142),SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x13cbf7){const _0x1cd36b={'uNblW':function(_0x1a2e7f,_0x267de4,_0x5b0285,_0x4e29d3,_0x5e7955,_0x41e69a){return _0x1a2e7f(_0x267de4,_0x5b0285,_0x4e29d3,_0x5e7955,_0x41e69a);}};return _0x1cd36b['uNblW'](pbkdf2Sync,_0x13cbf7,SALT,0x186a0,KEY_LENGTH,'sha256');}function _0x40db(){const _0x4b55b8=['utf8','44868WGgigs','aes-256-gcm','tyisq','98TGxUDr','10XKRoRa','470GWCJVY','update','TlQwY','987648BLftoj','5909190hVnKZU','15429lojdsP','37980921kcUMOo','elQae','2672ZaxydW','22374YSCrAo','subarray','3095133GCoOYC'];_0x40db=function(){return _0x4b55b8;};return _0x40db();}export function encrypt(_0x499d71,_0x2d138f){const _0x3d1be9=_0x23830a,_0x4a53d2={'tyisq':function(_0xfe78bc,_0xfdf754){return _0xfe78bc(_0xfdf754);},'mpXRH':'utf8'},_0xac5624=_0x4a53d2[_0x3d1be9(0x143)](deriveKey,_0x2d138f),_0x451253=randomBytes(IV_LENGTH),_0x1ab695=createCipheriv(ALGORITHM,_0xac5624,_0x451253),_0x341817=Buffer['concat']([_0x1ab695['update'](_0x499d71,_0x4a53d2['mpXRH']),_0x1ab695['final']()]),_0x14b21f=_0x1ab695['getAuthTag']();return Buffer['concat']([_0x451253,_0x14b21f,_0x341817]);}export function decrypt(_0xdadfa9,_0x5e668f){const _0x4de49d=_0x23830a,_0x3a3836={'elQae':function(_0x352727,_0x4ab706){return _0x352727(_0x4ab706);},'TlQwY':function(_0x3017c1,_0x1d4e7f){return _0x3017c1+_0x1d4e7f;},'Wdbhn':_0x4de49d(0x140)},_0x559c6=_0x3a3836[_0x4de49d(0x13b)](deriveKey,_0x5e668f),_0x41f581=_0xdadfa9[_0x4de49d(0x13e)](0x0,IV_LENGTH),_0x1464d8=_0xdadfa9['subarray'](IV_LENGTH,_0x3a3836[_0x4de49d(0x148)](IV_LENGTH,TAG_LENGTH)),_0x1a37d1=_0xdadfa9[_0x4de49d(0x13e)](_0x3a3836['TlQwY'](IV_LENGTH,TAG_LENGTH)),_0x30b9c6=createDecipheriv(ALGORITHM,_0x559c6,_0x41f581);return _0x30b9c6['setAuthTag'](_0x1464d8),_0x30b9c6[_0x4de49d(0x147)](_0x1a37d1)+_0x30b9c6['final'](_0x3a3836['Wdbhn']);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x17e143=_0x23a9;(function(_0x1c6f7a,_0xcde2f7){const _0x3fe177=_0x23a9,_0x27a35c=_0x1c6f7a();while(!![]){try{const _0x58ebd4=-parseInt(_0x3fe177(0x1ad))/0x1*(-parseInt(_0x3fe177(0x199))/0x2)+parseInt(_0x3fe177(0x1a9))/0x3+-parseInt(_0x3fe177(0x1a5))/0x4+-parseInt(_0x3fe177(0x19f))/0x5+parseInt(_0x3fe177(0x1b0))/0x6*(parseInt(_0x3fe177(0x18e))/0x7)+-parseInt(_0x3fe177(0x1a2))/0x8+parseInt(_0x3fe177(0x18f))/0x9;if(_0x58ebd4===_0xcde2f7)break;else _0x27a35c['push'](_0x27a35c['shift']());}catch(_0x265fbf){_0x27a35c['push'](_0x27a35c['shift']());}}}(_0x384f,0xc9e8c));function _0x23a9(_0x7c6ee3,_0x1e1bd3){_0x7c6ee3=_0x7c6ee3-0x17f;const _0x384f97=_0x384f();let _0x23a981=_0x384f97[_0x7c6ee3];return _0x23a981;}import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0x17e143(0x1a3),'-t','--secret','--api-key','--apikey',_0x17e143(0x191),'--password','--pass',_0x17e143(0x19d),_0x17e143(0x1a6),_0x17e143(0x185),_0x17e143(0x1a4),_0x17e143(0x1a8)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function _0x384f(){const _0x508121=['toLowerCase','POST','okXDw','tpbSa','join','14CDiNPB','18879039cWJApQ','some','--key','has_token','Qqyyg','stringify','startsWith','yDbgR','env','missing_option','5984vokaEr','/api/v1/mcp/desire-path-logs','runtime_error','Uomgh','--auth','[desire-path]\x20Failed\x20to\x20send:\x20','5175940GihdKS','syntax_error','includes','11883640prPwDa','--token','--cookie','6067580hkmYvK','--authorization','test','--credentials','2259255gZyxwu','[desire-path]\x20Payload:\x20','unknown_command','qPikp','173BBlOmE','rawCommand','errorMessage','4488558oNrLPX','has','[REDACTED]','slice','errorType','Authorization','RYieQ','isTTY','stdout','--header','error','LmEOc','=[REDACTED]'];_0x384f=function(){return _0x508121;};return _0x384f();}function looksLikeToken(_0x5a6931){const _0x32a60b=_0x17e143;return TOKEN_PATTERNS[_0x32a60b(0x190)](_0x5605a1=>_0x5605a1[_0x32a60b(0x1a7)](_0x5a6931));}export function sanitizeArgs(_0x4a6151){const _0x3fbca2=_0x17e143,_0x2cb14c={'Qqyyg':function(_0xb6ee1,_0x874f31){return _0xb6ee1<_0x874f31;},'Uomgh':_0x3fbca2(0x1b2),'vmgzA':function(_0x1364b3,_0x104df3){return _0x1364b3!==_0x104df3;},'cuTbG':function(_0xbbf1a7,_0x280950){return _0xbbf1a7(_0x280950);}},_0x187700=[];let _0x5ece17=![];for(let _0xc7fafb=0x0;_0x2cb14c[_0x3fbca2(0x193)](_0xc7fafb,_0x4a6151['length']);_0xc7fafb++){const _0x42b486=_0x4a6151[_0xc7fafb];if(_0x5ece17){_0x187700['push'](_0x2cb14c['Uomgh']),_0x5ece17=![];continue;}if(_0x42b486[_0x3fbca2(0x195)]('--')||_0x42b486[_0x3fbca2(0x195)]('-')){const _0x509c55=_0x42b486['indexOf']('=');if(_0x2cb14c['vmgzA'](_0x509c55,-0x1)){const _0x244225=_0x42b486[_0x3fbca2(0x17f)](0x0,_0x509c55)['toLowerCase']();if(SENSITIVE_FLAGS[_0x3fbca2(0x1b1)](_0x244225)){_0x187700['push'](_0x42b486[_0x3fbca2(0x17f)](0x0,_0x509c55)+_0x3fbca2(0x188));continue;}}else{const _0x4144ef=_0x42b486[_0x3fbca2(0x189)]();SENSITIVE_FLAGS[_0x3fbca2(0x1b1)](_0x4144ef)&&(_0x5ece17=!![]);}_0x187700['push'](_0x42b486);}else _0x2cb14c['cuTbG'](looksLikeToken,_0x42b486)?_0x187700['push'](_0x2cb14c[_0x3fbca2(0x19c)]):_0x187700['push'](_0x42b486);}return _0x187700[_0x3fbca2(0x18d)]('\x20');}export async function logDesirePath(_0x32eccf){const _0x54fb28=_0x17e143,_0x505e62={'kLxkp':function(_0x3cc46b){return _0x3cc46b();},'kcpFg':_0x54fb28(0x192),'okXDw':'application/json','XnbNL':function(_0x27f9ef,_0x2cebec,_0x4133a1){return _0x27f9ef(_0x2cebec,_0x4133a1);},'WrcOL':_0x54fb28(0x18a)};try{const _0x45b861=await getToken()['catch'](()=>null),_0x5db4cd=getApiBaseUrl(),_0x23c06d=_0x505e62['kLxkp'](getCurrentVersion),_0x47d61f=_0x45b861?_0x505e62['kcpFg']:'no_token',_0x53b2e4={..._0x32eccf['metadata'],'authStatus':_0x47d61f,'isTty':process[_0x54fb28(0x184)][_0x54fb28(0x183)]??![]},_0x4e5910={'Content-Type':_0x505e62[_0x54fb28(0x18b)]};_0x45b861&&(_0x4e5910[_0x54fb28(0x181)]='Bearer\x20'+_0x45b861);const _0x2d0f74={'rawCommand':_0x32eccf[_0x54fb28(0x1ae)],'errorMessage':_0x32eccf[_0x54fb28(0x1af)],'errorType':_0x32eccf[_0x54fb28(0x180)],'featureId':_0x32eccf['featureId'],'sessionId':_0x32eccf['sessionId'],'metadata':_0x53b2e4,'cliVersion':_0x23c06d};process[_0x54fb28(0x197)]['DEBUG']&&(console['error']('[desire-path]\x20Sending\x20log\x20to\x20'+_0x5db4cd+'/api/v1/mcp/desire-path-logs'),console[_0x54fb28(0x186)](_0x54fb28(0x1aa)+JSON[_0x54fb28(0x194)](_0x2d0f74,null,0x2))),await _0x505e62['XnbNL'](fetch,_0x5db4cd+_0x54fb28(0x19a),{'method':_0x505e62['WrcOL'],'headers':_0x4e5910,'body':JSON[_0x54fb28(0x194)](_0x2d0f74)});}catch(_0x5a4bd3){process['env']['DEBUG']&&console[_0x54fb28(0x186)](_0x54fb28(0x19e)+_0x5a4bd3);}}export function getErrorType(_0x108afa,_0x21645a){const _0x302a59=_0x17e143,_0x565fb2={'tpbSa':_0x302a59(0x19b),'qPikp':'unknown','CuiTV':'Unknown\x20command','xkPIq':_0x302a59(0x1ab),'sgizg':'Unknown\x20argument','RYieQ':'Not\x20enough\x20non-option\x20arguments','yDbgR':'Invalid\x20values','LmEOc':_0x302a59(0x198),'yGrSY':_0x302a59(0x1a0)};if(_0x21645a)return _0x565fb2[_0x302a59(0x18c)];if(!_0x108afa)return _0x565fb2[_0x302a59(0x1ac)];if(_0x108afa['includes'](_0x565fb2['CuiTV']))return _0x565fb2['xkPIq'];if(_0x108afa['includes'](_0x565fb2['sgizg']))return'unknown_argument';if(_0x108afa[_0x302a59(0x1a1)](_0x565fb2[_0x302a59(0x182)]))return'missing_required_argument';if(_0x108afa['includes'](_0x565fb2[_0x302a59(0x196)]))return'invalid_option_value';if(_0x108afa[_0x302a59(0x1a1)]('Missing\x20required\x20argument'))return _0x565fb2[_0x302a59(0x187)];return _0x565fb2['yGrSY'];}
|
|
@@ -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 _0x16a076=_0x4ece;(function(_0x1ac6a8,_0x1d273c){const _0x1e6ef3=_0x4ece,_0x53f3c2=_0x1ac6a8();while(!![]){try{const _0x50dcab=-parseInt(_0x1e6ef3(0xf5))/0x1*(-parseInt(_0x1e6ef3(0x129))/0x2)+-parseInt(_0x1e6ef3(0x100))/0x3*(parseInt(_0x1e6ef3(0x11f))/0x4)+-parseInt(_0x1e6ef3(0x10d))/0x5*(parseInt(_0x1e6ef3(0xf7))/0x6)+parseInt(_0x1e6ef3(0xe8))/0x7+-parseInt(_0x1e6ef3(0x111))/0x8*(-parseInt(_0x1e6ef3(0x133))/0x9)+-parseInt(_0x1e6ef3(0xeb))/0xa*(parseInt(_0x1e6ef3(0x112))/0xb)+parseInt(_0x1e6ef3(0x130))/0xc*(parseInt(_0x1e6ef3(0x102))/0xd);if(_0x50dcab===_0x1d273c)break;else _0x53f3c2['push'](_0x53f3c2['shift']());}catch(_0x4bcb2c){_0x53f3c2['push'](_0x53f3c2['shift']());}}}(_0x92fd,0x81f94));import{spawn}from'child_process';import _0x569490 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x16a076(0xe4),WORKOS_TOKEN_URL=_0x16a076(0xdf);function _0x92fd(){const _0x3d70b2=['143SEtKjz','Code:\x20','mcp:write','QRhdl','access_token','OeaIX','memberships','Invalid\x20JWT\x20format','Failed\x20to\x20fetch\x20memberships:\x20','XSZPe','Setting\x20up\x20your\x20organization...','stdout','parse','28hkEreO','organizationId','qWUBT','error','bJNzf','tMqiD','/api-keys','status','WSIuy','soAWO','6170HsmWAa','text','isTTY','PGObO','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','POST','sksdR','355944wGvRLA','Failed\x20to\x20provision\x20API\x20key:\x20','split','23274yijXdy','Failed\x20to\x20request\x20device\x20code:\x20','user_code','UViis','AEpmA','/organization/self-serve-signup','write','GET','https://api.workos.com/user_management/authenticate','NqVwk','QeEFv','firstName','iyAmX','https://api.workos.com/user_management/authorize/device','cPZLX','iaAcJ','now','4943715MWTZEw','toString','apiKey','792410bTcmWu','darwin','IiFXi','jqgha','name','CCKRv','fNrTt','token','/cli-auth/token','application/json','263JcutEw','cmd','30vdeVuu','uWqjA','application/x-www-form-urlencoded','json','length','yKVoO','SIXGv','verification_uri_complete','authorization_pending','271137iwtzrm','unref','208hBHOUe','ignore','Waiting\x20for\x20authentication...','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','expires_in','org_id','log','from','refresh_token','\x27s\x20CLI\x20Key','730580dcIzTA','startsWith','sxAet','blrPD','2888BvRjBv'];_0x92fd=function(){return _0x3d70b2;};return _0x92fd();}export async function requestDeviceCode(_0x2f600b){const _0x532a56=_0x16a076,_0x5a8669={'OeaIX':function(_0x304ea5,_0x2acfc7,_0x269ea2){return _0x304ea5(_0x2acfc7,_0x269ea2);},'yKVoO':'application/x-www-form-urlencoded'},_0x683642=await _0x5a8669[_0x532a56(0x117)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x532a56(0x12e),'headers':{'Content-Type':_0x5a8669[_0x532a56(0xfc)]},'body':new URLSearchParams({'client_id':_0x2f600b})});if(!_0x683642['ok']){const _0x543057=await _0x683642['text']();throw new Error(_0x532a56(0x134)+_0x683642['status']+'\x20'+_0x543057);}return _0x683642['json']();}export async function pollForTokens(_0x4281e2,_0x5748c5,_0x3857e1,_0x4a34ad){const _0x1cab7b=_0x16a076,_0x103566={'iTRJZ':function(_0x53c607,_0x528110){return _0x53c607*_0x528110;},'oZTid':_0x1cab7b(0xf9),'soAWO':function(_0x425e0d,_0x4d5829){return _0x425e0d===_0x4d5829;},'FHHZc':_0x1cab7b(0xff),'PGObO':'slow_down','XSZPe':'Authentication\x20failed','OMZIK':'Device\x20authorization\x20timed\x20out'},_0x379552=Date['now']()+_0x4a34ad*0x3e8;let _0x57d345=_0x103566['iTRJZ'](_0x3857e1,0x3e8);while(Date[_0x1cab7b(0xe7)]()<_0x379552){await sleep(_0x57d345);const _0x35ff57=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x103566['oZTid']},'body':new URLSearchParams({'client_id':_0x4281e2,'device_code':_0x5748c5,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x35ff57['ok'])return _0x35ff57['json']();const _0x2ec5d5=await _0x35ff57[_0x1cab7b(0xfa)]();if(_0x103566[_0x1cab7b(0x128)](_0x2ec5d5['error'],_0x103566['FHHZc']))continue;if(_0x2ec5d5['error']===_0x103566[_0x1cab7b(0x12c)]){_0x57d345+=0x3e8;continue;}throw new Error(_0x2ec5d5['error_description']||_0x2ec5d5[_0x1cab7b(0x122)]||_0x103566[_0x1cab7b(0x11b)]);}throw new Error(_0x103566['OMZIK']);}async function fetchUserProfile(_0x34d87d){const _0x407a3e=_0x16a076,_0x501834={'cWdJi':function(_0x2773ff){return _0x2773ff();},'LRhUc':function(_0x3e508d,_0x181ee1,_0x12a845){return _0x3e508d(_0x181ee1,_0x12a845);},'iyAmX':_0x407a3e(0xde)},_0xd189af=_0x501834['cWdJi'](getApiBaseUrl);try{const _0x3b7f1e=await _0x501834['LRhUc'](fetch,_0xd189af+'/organization/me',{'method':_0x501834[_0x407a3e(0xe3)],'headers':{'workos-token':_0x34d87d}});if(_0x3b7f1e['ok'])return _0x3b7f1e[_0x407a3e(0xfa)]();}catch{}return null;}function _0x4ece(_0x4a0885,_0x11e270){_0x4a0885=_0x4a0885-0xdc;const _0x92fdca=_0x92fd();let _0x4eced6=_0x92fdca[_0x4a0885];return _0x4eced6;}function buildKeyName(_0x2a684d,_0x343628){const _0x38aa6c=_0x16a076,_0x3764d6={'blrPD':function(_0x280f69,_0x62a998){return _0x280f69===_0x62a998;}},_0x51bc07=_0x343628['filter'](_0x313f77=>_0x313f77[_0x38aa6c(0xef)]===_0x2a684d||_0x313f77['name'][_0x38aa6c(0x10e)](_0x2a684d+'\x20('));if(_0x3764d6[_0x38aa6c(0x110)](_0x51bc07['length'],0x0))return _0x2a684d;return _0x2a684d+'\x20('+(_0x51bc07['length']+0x1)+')';}export async function provisionApiKey(_0xe3b4cc){const _0x3f3225=_0x16a076,_0x22516c={'oNTXM':function(_0x192e17){return _0x192e17();},'ELaba':function(_0x3dff7e,_0xa61e4c){return _0x3dff7e(_0xa61e4c);},'gTTwB':'CLI\x20Key','QRhdl':function(_0x5badc2,_0x46f7d3,_0xc76160){return _0x5badc2(_0x46f7d3,_0xc76160);},'iaAcJ':function(_0x19201b,_0x3b150,_0x5028ec){return _0x19201b(_0x3b150,_0x5028ec);},'NzuLR':_0x3f3225(0x114)},_0x407aad=_0x22516c['oNTXM'](getApiBaseUrl),_0x58a264={'Content-Type':_0x3f3225(0xf4),'workos-token':_0xe3b4cc},_0x13bbb1=await _0x22516c['ELaba'](fetchUserProfile,_0xe3b4cc),_0x215cec=_0x13bbb1?.[_0x3f3225(0xe2)]||_0x13bbb1?.['email']?.[_0x3f3225(0x132)]('@')[0x0],_0x47f818=_0x215cec?_0x215cec+_0x3f3225(0x10c):_0x22516c['gTTwB'];let _0x3b6aa4=[];try{const _0x24a208=await _0x22516c[_0x3f3225(0x115)](fetch,_0x407aad+_0x3f3225(0x125),{'method':_0x3f3225(0xde),'headers':_0x58a264});if(_0x24a208['ok']){const _0x3c6732=await _0x24a208['json']();_0x3b6aa4=_0x3c6732['apiKeys'];}}catch{}const _0x1a0de7=_0x22516c[_0x3f3225(0xe6)](buildKeyName,_0x47f818,_0x3b6aa4),_0x428e29=await fetch(_0x407aad+'/api-keys',{'method':_0x3f3225(0x12e),'headers':_0x58a264,'body':JSON['stringify']({'name':_0x1a0de7,'scope':_0x22516c['NzuLR']})});if(!_0x428e29['ok']){const _0x573ea4=await _0x428e29['text']();throw new Error(_0x3f3225(0x131)+_0x428e29[_0x3f3225(0x126)]+'\x20'+_0x573ea4);}const _0x27811d=await _0x428e29[_0x3f3225(0xfa)]();return _0x27811d[_0x3f3225(0xea)][_0x3f3225(0xf2)];}export function openBrowser(_0x4c363d){const _0x3ded0d=_0x16a076,_0x29da3a={'sLzlJ':'win32','yjbyx':function(_0x44dfc2,_0x5a0e51,_0x49c485,_0x19c6b8){return _0x44dfc2(_0x5a0e51,_0x49c485,_0x19c6b8);},'IiFXi':'start','TLqhP':_0x3ded0d(0x103),'UViis':function(_0x13fd77,_0x563879){return _0x13fd77===_0x563879;},'bJNzf':_0x3ded0d(0xec),'CCKRv':'xdg-open'};try{if(process['platform']===_0x29da3a['sLzlJ']){const _0x3e80f9=_0x29da3a['yjbyx'](spawn,_0x3ded0d(0xf6),['/c',_0x29da3a[_0x3ded0d(0xed)],'',_0x4c363d],{'detached':!![],'stdio':_0x29da3a['TLqhP'],'windowsHide':!![]});_0x3e80f9[_0x3ded0d(0x101)]();return;}const _0x3d416a=_0x29da3a[_0x3ded0d(0x136)](process['platform'],_0x29da3a[_0x3ded0d(0x123)])?'open':_0x29da3a[_0x3ded0d(0xf0)],_0x2c2793=spawn(_0x3d416a,[_0x4c363d],{'detached':!![],'stdio':_0x3ded0d(0x103)});_0x2c2793['unref']();}catch{}}function decodeJwtPayload(_0xe6e068){const _0x11a052=_0x16a076,_0x3c2fd7=_0xe6e068[_0x11a052(0x132)]('.');if(_0x3c2fd7[_0x11a052(0xfb)]!==0x3)throw new Error(_0x11a052(0x119));const _0x192fde=Buffer[_0x11a052(0x10a)](_0x3c2fd7[0x1],'base64url')[_0x11a052(0xe9)]('utf-8');return JSON[_0x11a052(0x11e)](_0x192fde);}async function selfServeSignup(_0x2efc2c){const _0x5bd81b=_0x16a076,_0x231d12={'NqVwk':function(_0x25202b,_0x457c6b,_0x5f40bb){return _0x25202b(_0x457c6b,_0x5f40bb);},'qWUBT':_0x5bd81b(0xf4)},_0x25bda4=getApiBaseUrl(),_0x140253=await _0x231d12[_0x5bd81b(0xe0)](fetch,_0x25bda4+_0x5bd81b(0xdc),{'method':_0x5bd81b(0x12e),'headers':{'Content-Type':_0x231d12[_0x5bd81b(0x121)],'workos-token':_0x2efc2c}});if(!_0x140253['ok']){const _0x225a6e=await _0x140253[_0x5bd81b(0x12a)]();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0x140253[_0x5bd81b(0x126)]+'\x20'+_0x225a6e);}return _0x140253['json']();}async function fetchMyMemberships(_0x52344a){const _0x3fdce9=_0x16a076,_0x306378={'SLbKL':'GET'},_0x1664e1=getApiBaseUrl(),_0x26e8d5=await fetch(_0x1664e1+'/organization/my-memberships',{'method':_0x306378['SLbKL'],'headers':{'workos-token':_0x52344a}});if(!_0x26e8d5['ok']){const _0x454d1d=await _0x26e8d5[_0x3fdce9(0x12a)]();throw new Error(_0x3fdce9(0x11a)+_0x26e8d5['status']+'\x20'+_0x454d1d);}const _0x33bc1c=await _0x26e8d5[_0x3fdce9(0xfa)]();return _0x33bc1c[_0x3fdce9(0x118)];}async function refreshTokenWithOrg(_0x4eebf6,_0x2766d2,_0x26e7a2){const _0x4aa8a7=_0x16a076,_0x55c213={'SIXGv':_0x4aa8a7(0xf9)},_0x5719c3=await fetch(WORKOS_TOKEN_URL,{'method':_0x4aa8a7(0x12e),'headers':{'Content-Type':_0x55c213[_0x4aa8a7(0xfd)]},'body':new URLSearchParams({'client_id':_0x4eebf6,'grant_type':_0x4aa8a7(0x10b),'refresh_token':_0x2766d2,'organization_id':_0x26e7a2})});if(!_0x5719c3['ok']){const _0x27c022=await _0x5719c3['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x5719c3['status']+'\x20'+_0x27c022);}return _0x5719c3[_0x4aa8a7(0xfa)]();}async function provisionCliToken(_0x364764){const _0x1bc57b=_0x16a076,_0x14cc27=getApiBaseUrl(),_0x28cf1d=await fetch(_0x14cc27+_0x1bc57b(0xf3),{'method':'POST','headers':{'Content-Type':_0x1bc57b(0xf4),'workos-token':_0x364764}});if(!_0x28cf1d['ok']){const _0x577f06=await _0x28cf1d[_0x1bc57b(0x12a)]();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x28cf1d['status']+'\x20'+_0x577f06);}return _0x28cf1d[_0x1bc57b(0xfa)]();}export async function runDeviceAuthFlow(){const _0x3f932e=_0x16a076,_0x183f15={'WSIuy':function(_0x29f30a){return _0x29f30a();},'OeANy':_0x3f932e(0x12d),'QeEFv':_0x3f932e(0x104),'sxAet':function(_0x3ba8b0,_0x2d8ce4){return _0x3ba8b0(_0x2d8ce4);},'uWqjA':function(_0x3e7eed,_0x567f61){return _0x3e7eed(_0x567f61);},'AEpmA':function(_0x54caf0,_0x275d7c){return _0x54caf0===_0x275d7c;},'jqgha':_0x3f932e(0x11c),'cPZLX':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','ljDeP':'list','sksdR':'Select\x20an\x20organization:','fNrTt':function(_0x3f50db,_0x504c5d,_0x109d3e,_0x1e4ae5){return _0x3f50db(_0x504c5d,_0x109d3e,_0x1e4ae5);},'tMqiD':'Provisioning\x20CLI\x20token...'},_0x2aadc9=_0x183f15[_0x3f932e(0x127)](getCurrentEnvironment),_0x175e22=ENVIRONMENT_CONFIGS[_0x2aadc9]['workosClientId'],_0x1389a9=await requestDeviceCode(_0x175e22);console[_0x3f932e(0x109)](_0x183f15['OeANy']),console['log'](_0x3f932e(0x105)),openBrowser(_0x1389a9['verification_uri_complete']),console[_0x3f932e(0x109)](_0x3f932e(0x106)+_0x1389a9[_0x3f932e(0xfe)]),console[_0x3f932e(0x109)](_0x3f932e(0x113)+_0x1389a9[_0x3f932e(0x135)]+'\x0a'),process['stdout'][_0x3f932e(0xdd)](_0x183f15[_0x3f932e(0xe1)]);let _0x5198f7=await pollForTokens(_0x175e22,_0x1389a9['device_code'],_0x1389a9['interval'],_0x1389a9[_0x3f932e(0x107)]);console[_0x3f932e(0x109)]('\x20✓');const _0x569487=_0x183f15[_0x3f932e(0x10f)](decodeJwtPayload,_0x5198f7[_0x3f932e(0x116)]);if(!_0x569487[_0x3f932e(0x108)]){const _0xa33d18=await _0x183f15[_0x3f932e(0xf8)](fetchMyMemberships,_0x5198f7[_0x3f932e(0x116)]);let _0x223bb9;if(_0x183f15[_0x3f932e(0x137)](_0xa33d18['length'],0x0)){process[_0x3f932e(0x11d)]['write'](_0x183f15[_0x3f932e(0xee)]);const _0x3187b8=await selfServeSignup(_0x5198f7[_0x3f932e(0x116)]);_0x223bb9=_0x3187b8[_0x3f932e(0x120)],console[_0x3f932e(0x109)]('\x20✓');}else{if(_0xa33d18[_0x3f932e(0xfb)]===0x1)_0x223bb9=_0xa33d18[0x0][_0x3f932e(0x120)],console['log']('Using\x20organization:\x20'+_0xa33d18[0x0][_0x3f932e(0xef)]);else{const _0x2ec0ac=process['stdin']['isTTY']&&process[_0x3f932e(0x11d)][_0x3f932e(0x12b)];if(!_0x2ec0ac)throw new Error('Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a'+_0x183f15[_0x3f932e(0xe5)]);const {selected:_0x4ff88f}=await _0x569490['prompt']([{'type':_0x183f15['ljDeP'],'name':'selected','message':_0x183f15[_0x3f932e(0x12f)],'choices':_0xa33d18['map'](_0x56496a=>({'name':_0x56496a['name'],'value':_0x56496a['organizationId']}))}]);_0x223bb9=_0x4ff88f;}}_0x5198f7=await _0x183f15[_0x3f932e(0xf1)](refreshTokenWithOrg,_0x175e22,_0x5198f7[_0x3f932e(0x10b)],_0x223bb9);}process[_0x3f932e(0x11d)][_0x3f932e(0xdd)](_0x183f15[_0x3f932e(0x124)]);const _0x3b5681=await provisionCliToken(_0x5198f7[_0x3f932e(0x116)]);return console['log']('\x20✓'),await storeToken(_0x3b5681[_0x3f932e(0xf2)]),_0x5198f7['refresh_token']&&await _0x183f15['sxAet'](storeRefreshToken,_0x5198f7[_0x3f932e(0x10b)]),_0x3b5681[_0x3f932e(0xf2)];}function sleep(_0x1f7dca){return new Promise(_0x4a1bb1=>setTimeout(_0x4a1bb1,_0x1f7dca));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x538886=_0x1dd0;(function(_0x31ed3e,_0xb3a055){const _0x4b6f79=_0x1dd0,_0x342a02=_0x31ed3e();while(!![]){try{const _0x295d23=-parseInt(_0x4b6f79(0x15b))/0x1+parseInt(_0x4b6f79(0x169))/0x2*(-parseInt(_0x4b6f79(0x162))/0x3)+parseInt(_0x4b6f79(0x156))/0x4+-parseInt(_0x4b6f79(0x168))/0x5+-parseInt(_0x4b6f79(0x161))/0x6+-parseInt(_0x4b6f79(0x163))/0x7+parseInt(_0x4b6f79(0x175))/0x8*(parseInt(_0x4b6f79(0x15d))/0x9);if(_0x295d23===_0xb3a055)break;else _0x342a02['push'](_0x342a02['shift']());}catch(_0x22d4ea){_0x342a02['push'](_0x342a02['shift']());}}}(_0x171b,0x4cb2b));export const DEFAULT_VERIFICATION_TRANSPORT=_0x538886(0x153);export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':_0x538886(0x155),'workosClientId':_0x538886(0x151),'aiProxyUrl':'https://ai-proxy-716115358910.us-central1.run.app','mcpAuthUrl':'https://mcp-auth.ranger.net/mcp'},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':_0x538886(0x16c),'mcpAuthUrl':_0x538886(0x16d)},'local':{'apiBaseUrl':_0x538886(0x16e),'workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT='prod';export function isValidEnvironment(_0x39538f){const _0x4a604b=_0x538886,_0x339f89={'MXylm':'prod','cZzbo':_0x4a604b(0x157)};return _0x39538f===_0x339f89['MXylm']||_0x39538f===_0x4a604b(0x15c)||_0x39538f===_0x339f89[_0x4a604b(0x166)];}export function getCurrentEnvironment(){const _0x3d446f=_0x538886,_0x226b76=process[_0x3d446f(0x16f)]['RANGER_CLI_ENV'];if(_0x226b76&&isValidEnvironment(_0x226b76))return _0x226b76;return DEFAULT_ENVIRONMENT;}function _0x171b(){const _0x19e390=['https://ai-proxy-301751771437.us-central1.run.app','https://mcp-auth.staging.ranger.net/mcp','http://localhost:8080','env','apiBaseUrl','RANGER_AI_PROXY_URL','RANGER_API_URL','ccHAy','Xyovj','224MESKDZ','NFabB','oaBme','client_01J9CBYM7M5ZETCF7G6614DXR2','RANGER_USE_NOVA_ACT','rangerwright-cli','mcpAuthUrl','https://api.ranger.net','247300ELvAOa','local','RANGER_HOOKS','playwright-cli','bDgbY','250399fdOWZn','staging','689868RquQHs','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','RANGER_BYOK','RANGER_TRANSPORT','3627048Plrwie','12CgAwCL','3110849IEAnsh','auto','nova-act-cli','cZzbo','true','1762600CUnqOJ','121046oCoYSZ','qGRrr','Invalid\x20RANGER_TRANSPORT=\x22'];_0x171b=function(){return _0x19e390;};return _0x171b();}function _0x1dd0(_0x8ee720,_0x2c3d45){_0x8ee720=_0x8ee720-0x150;const _0x171be8=_0x171b();let _0x1dd01f=_0x171be8[_0x8ee720];return _0x1dd01f;}export function getApiBaseUrl(){const _0x421045=_0x538886,_0x1fc0bc={'zlIjN':function(_0x24c194){return _0x24c194();}};return process['env'][_0x421045(0x172)]||ENVIRONMENT_CONFIGS[_0x1fc0bc['zlIjN'](getCurrentEnvironment)][_0x421045(0x170)];}export function getAiProxyUrl(){const _0x3fb52d=_0x538886,_0x729c9b={'NFabB':function(_0x372bcd){return _0x372bcd();}};return process[_0x3fb52d(0x16f)][_0x3fb52d(0x171)]||ENVIRONMENT_CONFIGS[_0x729c9b[_0x3fb52d(0x176)](getCurrentEnvironment)]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x3339ae=_0x538886;return process['env']['RANGER_MCP_AUTH_URL']??ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x3339ae(0x154)];}export function isByokEnabled(){const _0x37c3f7=_0x538886,_0x5e2900={'HNWGV':function(_0x5b4b51,_0x83aec4){return _0x5b4b51===_0x83aec4;}};return _0x5e2900['HNWGV'](process[_0x37c3f7(0x16f)][_0x37c3f7(0x15f)],_0x37c3f7(0x167));}function isVerificationTransport(_0x15288e){const _0x45289d=_0x538886,_0x321a86={'Xyovj':function(_0xb10212,_0x47b85a){return _0xb10212===_0x47b85a;},'qGRrr':_0x45289d(0x153)};return _0x15288e==='mcp'||_0x15288e===_0x45289d(0x159)||_0x321a86['Xyovj'](_0x15288e,_0x45289d(0x165))||_0x321a86[_0x45289d(0x174)](_0x15288e,_0x321a86[_0x45289d(0x16a)]);}const LEGACY_TRANSPORT_ENV_VARS=[_0x538886(0x152),'RANGER_DISABLE_MCP'];export function getVerificationTransport(){const _0x1caa73=_0x538886,_0x38d459={'jCsao':function(_0x1b5c29,_0x186d4e){return _0x1b5c29(_0x186d4e);}},_0x312e3e=process[_0x1caa73(0x16f)][_0x1caa73(0x160)]?.['trim']();if(_0x312e3e){if(_0x38d459['jCsao'](isVerificationTransport,_0x312e3e))return _0x312e3e;throw new Error(_0x1caa73(0x16b)+_0x312e3e+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x5cc2f6=LEGACY_TRANSPORT_ENV_VARS['find'](_0x3e2ae6=>process[_0x1caa73(0x16f)][_0x3e2ae6]);if(_0x5cc2f6)throw new Error(_0x5cc2f6+_0x1caa73(0x15e));return DEFAULT_VERIFICATION_TRANSPORT;}export function resolveHookMode(_0x479fb6=process[_0x538886(0x16f)]){const _0x148a8b=_0x538886,_0x451323={'bDgbY':'auto','KQzFW':function(_0x26be16,_0x5c495d){return _0x26be16===_0x5c495d;},'BIyKa':'off','oaBme':function(_0x420df4,_0x4d5fbd){return _0x420df4===_0x4d5fbd;},'ccHAy':function(_0x25692d,_0x462a8c){return _0x25692d+_0x462a8c;}},_0x28523e=_0x479fb6[_0x148a8b(0x158)]?.['trim']()['toLowerCase']();if(!_0x28523e)return _0x451323[_0x148a8b(0x15a)];if(_0x451323['KQzFW'](_0x28523e,_0x451323['BIyKa'])||_0x451323[_0x148a8b(0x150)](_0x28523e,'on')||_0x28523e===_0x148a8b(0x164))return _0x28523e;return console['error'](_0x451323[_0x148a8b(0x173)]('[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22'+_0x479fb6['RANGER_HOOKS']+'\x22.\x20','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.')),_0x451323[_0x148a8b(0x15a)];}
|
|
@@ -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(_0xc8fc6a,_0x3fc505){const _0x161849=_0x5ab3,_0x45db96=_0xc8fc6a();while(!![]){try{const _0x2ff89b=parseInt(_0x161849(0x1c8))/0x1*(parseInt(_0x161849(0x1c4))/0x2)+-parseInt(_0x161849(0x1dc))/0x3+-parseInt(_0x161849(0x1d2))/0x4+parseInt(_0x161849(0x1bf))/0x5*(parseInt(_0x161849(0x1b3))/0x6)+-parseInt(_0x161849(0x1d3))/0x7*(-parseInt(_0x161849(0x1c6))/0x8)+-parseInt(_0x161849(0x1ee))/0x9+-parseInt(_0x161849(0x1e9))/0xa*(-parseInt(_0x161849(0x1e2))/0xb);if(_0x2ff89b===_0x3fc505)break;else _0x45db96['push'](_0x45db96['shift']());}catch(_0x300555){_0x45db96['push'](_0x45db96['shift']());}}}(_0xf971,0x89347));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x2c8654){const _0x1b0f56=_0x5ab3,_0x530363={'iUuya':function(_0x1b97fb,_0xf3b0ed,_0x3ad6ea){return _0x1b97fb(_0xf3b0ed,_0x3ad6ea);},'nNVga':'POST','ytNiz':_0x1b0f56(0x1c7),'RriVj':_0x1b0f56(0x1d6)},_0x1267cc=await getToken();if(!_0x1267cc)throw new Error(_0x1b0f56(0x1be));const _0x1351b1=getApiBaseUrl(),_0x5edd2c=await _0x530363['iUuya'](fetch,_0x1351b1+_0x1b0f56(0x1ae),{'method':_0x530363[_0x1b0f56(0x1b0)],'headers':{'Authorization':_0x1b0f56(0x1b4)+_0x1267cc,'Content-Type':_0x1b0f56(0x1c5)},'body':JSON[_0x1b0f56(0x1e8)](_0x2c8654)});if(!_0x5edd2c['ok']){if(_0x5edd2c['status']===0x192){const _0x426d50=await _0x5edd2c[_0x1b0f56(0x1cd)](),_0xcddc2e=_0x426d50['billingUrl']||_0x530363['ytNiz'];throw new Error((_0x426d50[_0x1b0f56(0x1b2)]||_0x530363['RriVj'])+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0xcddc2e);}const _0x10b4ff=await _0x5edd2c[_0x1b0f56(0x1dd)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x10b4ff);}return _0x5edd2c[_0x1b0f56(0x1cd)]();}export async function listFeatures(_0x5590a9){const _0x45ccb0=_0x5ab3,_0x1cebc3={'sPuKw':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','dPBmC':_0x45ccb0(0x1e4),'NmgaF':_0x45ccb0(0x1d1),'ByhDX':_0x45ccb0(0x1b5),'iPLPI':'true','ojsVC':_0x45ccb0(0x1da)},_0x5e0e30=await getToken();if(!_0x5e0e30)throw new Error(_0x1cebc3['sPuKw']);const _0x58247c=getApiBaseUrl(),_0x5f648a=new URLSearchParams();if(_0x5590a9?.['gitRepoUrl'])_0x5f648a['set'](_0x45ccb0(0x1d8),_0x5590a9['gitRepoUrl']);if(_0x5590a9?.['gitBranch'])_0x5f648a[_0x45ccb0(0x1cb)](_0x45ccb0(0x1c3),_0x5590a9[_0x45ccb0(0x1c3)]);if(_0x5590a9?.[_0x45ccb0(0x1e4)])_0x5f648a[_0x45ccb0(0x1cb)](_0x1cebc3[_0x45ccb0(0x1e7)],_0x5590a9[_0x45ccb0(0x1e4)]['toString']());if(_0x5590a9?.['offset'])_0x5f648a[_0x45ccb0(0x1cb)](_0x1cebc3['NmgaF'],_0x5590a9['offset']['toString']());if(_0x5590a9?.['includeDeleted'])_0x5f648a[_0x45ccb0(0x1cb)](_0x1cebc3[_0x45ccb0(0x1c1)],_0x1cebc3['iPLPI']);const _0x298137=_0x58247c+'/api/v1/mcp/features'+(_0x5f648a['toString']()?'?'+_0x5f648a['toString']():''),_0x41b440=await fetch(_0x298137,{'method':_0x1cebc3[_0x45ccb0(0x1c2)],'headers':{'Authorization':_0x45ccb0(0x1b4)+_0x5e0e30}});if(!_0x41b440['ok']){const _0x4f86ad=await _0x41b440[_0x45ccb0(0x1dd)]();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x4f86ad);}return _0x41b440['json']();}export async function getFeature(_0x5e78af){const _0x365488=_0x5ab3,_0x307e4a={'CsGUn':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ZaqAq':function(_0x26b942){return _0x26b942();},'QhLFT':function(_0x61eafc,_0x4c6bdb,_0x1b96a2){return _0x61eafc(_0x4c6bdb,_0x1b96a2);},'FRxfc':'GET'},_0x207f14=await getToken();if(!_0x207f14)throw new Error(_0x307e4a['CsGUn']);const _0x26bb6f=_0x307e4a['ZaqAq'](getApiBaseUrl),_0x1281c5=await _0x307e4a['QhLFT'](fetch,_0x26bb6f+_0x365488(0x1ea)+_0x5e78af,{'method':_0x307e4a[_0x365488(0x1de)],'headers':{'Authorization':_0x365488(0x1b4)+_0x207f14}});if(!_0x1281c5['ok']){const _0xdc5fa3=await _0x1281c5[_0x365488(0x1dd)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0xdc5fa3);}return _0x1281c5['json']();}export async function updateFeature(_0x4cec26,_0x526a04){const _0x174050=_0x5ab3,_0x359a61={'WuMEy':function(_0x577392){return _0x577392();},'aGpub':_0x174050(0x1be),'dypBT':function(_0xd63b77,_0x17d9e3,_0x290c82){return _0xd63b77(_0x17d9e3,_0x290c82);},'oUCUU':_0x174050(0x1c5)},_0x1385a5=await _0x359a61[_0x174050(0x1db)](getToken);if(!_0x1385a5)throw new Error(_0x359a61[_0x174050(0x1c0)]);const _0x28696c=getApiBaseUrl(),_0x4d0c39=await _0x359a61['dypBT'](fetch,_0x28696c+_0x174050(0x1ea)+_0x4cec26,{'method':'PATCH','headers':{'Authorization':_0x174050(0x1b4)+_0x1385a5,'Content-Type':_0x359a61[_0x174050(0x1bc)]},'body':JSON['stringify'](_0x526a04)});if(!_0x4d0c39['ok']){const _0x4c57de=await _0x4d0c39[_0x174050(0x1dd)]();throw new Error(_0x174050(0x1e0)+_0x4c57de);}return _0x4d0c39[_0x174050(0x1cd)]();}export async function createChecklistItem(_0x304019,_0x29eb4a,_0x94e7eb){const _0x12aafc=_0x5ab3,_0xef097={'AzYMW':function(_0x402f36){return _0x402f36();},'gtYPC':_0x12aafc(0x1be),'Qblke':function(_0x507dd7,_0x39eb11,_0x407963){return _0x507dd7(_0x39eb11,_0x407963);},'IwABC':'POST','jourz':_0x12aafc(0x1c5)},_0x246bbf=await _0xef097['AzYMW'](getToken);if(!_0x246bbf)throw new Error(_0xef097[_0x12aafc(0x1bd)]);const _0x57b707=getApiBaseUrl(),_0x240d86=await _0xef097[_0x12aafc(0x1ab)](fetch,_0x57b707+'/api/v1/mcp/features/'+_0x304019+'/checklist',{'method':_0xef097['IwABC'],'headers':{'Authorization':_0x12aafc(0x1b4)+_0x246bbf,'Content-Type':_0xef097['jourz']},'body':JSON['stringify']({'description':_0x29eb4a,'position':_0x94e7eb})});if(!_0x240d86['ok']){const _0x3564cb=await _0x240d86[_0x12aafc(0x1dd)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x3564cb);}return _0x240d86[_0x12aafc(0x1cd)]();}function _0xf971(){const _0x5e4015=['POST','GET','WuMEy','3331512KADSoF','text','FRxfc','QmLNv','Failed\x20to\x20update\x20feature\x20review:\x20','style','165ksjiUE','HxNwL','limit','JZkBX','/report','dPBmC','stringify','696770SUlory','/api/v1/mcp/features/','nnuTS','xiauD','pOACF','7139736fwfJip','zNAxf','join','RfZMm','llLYs','Qblke','FmQio','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','/api/v1/mcp/features','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','nNVga','bmiKS','message','2988774zYwhOG','Bearer\x20','includeDeleted','FWQJL','/sessions','/action-items','itemIds','ECTfL','/sessions/','oUCUU','gtYPC','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','5fRMpfa','aGpub','ByhDX','ojsVC','gitBranch','2ftvwew','application/json','363704KFcjwS','https://dashboard.ranger.net/billing','1064311IuqNFh','mZTJK','gPgbw','set','URPsy','json','sessionId','PATCH','Failed\x20to\x20get\x20action\x20items:\x20','offset','749036KaMaht','7wmwOCS','/checklist/','Failed\x20to\x20restore\x20feature\x20review:\x20','Feature\x20limit\x20exceeded','toString','gitRepoUrl'];_0xf971=function(){return _0x5e4015;};return _0xf971();}export async function updateChecklistItem(_0xdb0043,_0x37a051,_0x323f8f){const _0x2cb7c4=_0x5ab3,_0x37d0b4={'ECTfL':_0x2cb7c4(0x1be),'bmiKS':function(_0x96897c){return _0x96897c();},'AZajk':function(_0x505e89,_0x308433,_0x319a5a){return _0x505e89(_0x308433,_0x319a5a);},'FmQio':'updateChecklistItem'};return withRetry(async()=>{const _0x58862a=_0x2cb7c4,_0x32dcfd=await getToken();if(!_0x32dcfd)throw new Error(_0x37d0b4[_0x58862a(0x1ba)]);const _0x24bf04=_0x37d0b4[_0x58862a(0x1b1)](getApiBaseUrl),_0x4af4e4=await _0x37d0b4['AZajk'](fetch,_0x24bf04+'/api/v1/mcp/features/'+_0xdb0043+_0x58862a(0x1d4)+_0x37a051,{'method':_0x58862a(0x1cf),'headers':{'Authorization':'Bearer\x20'+_0x32dcfd,'Content-Type':_0x58862a(0x1c5)},'body':JSON[_0x58862a(0x1e8)](_0x323f8f)});if(!_0x4af4e4['ok']){const _0x7fdaec=await _0x4af4e4[_0x58862a(0x1dd)]();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x7fdaec);}return _0x4af4e4['json']();},{'label':_0x37d0b4[_0x2cb7c4(0x1ac)]});}export async function getFeatureReport(_0x5b346d){const _0x366ded=_0x5ab3,_0x53a82b={'zNAxf':function(_0x217856){return _0x217856();},'DcEOi':_0x366ded(0x1be),'dnMJC':function(_0x331bf4,_0xa1fc43,_0x54d97f){return _0x331bf4(_0xa1fc43,_0x54d97f);}},_0x4b4d31=await _0x53a82b[_0x366ded(0x1ef)](getToken);if(!_0x4b4d31)throw new Error(_0x53a82b['DcEOi']);const _0x55af09=getApiBaseUrl(),_0x15d394=await _0x53a82b['dnMJC'](fetch,_0x55af09+'/api/v1/mcp/features/'+_0x5b346d+_0x366ded(0x1e6),{'method':'GET','headers':{'Authorization':_0x366ded(0x1b4)+_0x4b4d31}});if(!_0x15d394['ok']){const _0x44c6c3=await _0x15d394['text']();throw new Error(_0x366ded(0x1af)+_0x44c6c3);}return _0x15d394['json']();}export async function getFeatureReportMarkdown(_0x16aecf,_0x5ce775){const _0x3792ef=_0x5ab3,_0x43aa2e={'zOHcB':function(_0x11071c){return _0x11071c();},'SXFgQ':function(_0x10ef16){return _0x10ef16();},'VpNsI':function(_0x4b75a2,_0x2ffdc9){return _0x4b75a2>_0x2ffdc9;},'gFFxq':'style','gPgbw':function(_0x1cf4d1,_0xf26e75,_0x2237d1){return _0x1cf4d1(_0xf26e75,_0x2237d1);}},_0x332f65=await _0x43aa2e['zOHcB'](getToken);if(!_0x332f65)throw new Error(_0x3792ef(0x1be));const _0x33bcd3=_0x43aa2e['SXFgQ'](getApiBaseUrl),_0x793ffe=new URLSearchParams(),_0x43746c=_0x43aa2e['VpNsI'](_0x5ce775?.[_0x3792ef(0x1b9)]?.['length']??0x0,0x0),_0x42c30f=Boolean(_0x5ce775?.[_0x3792ef(0x1ce)]);_0x43746c&&_0x5ce775?.[_0x3792ef(0x1b9)]&&_0x793ffe[_0x3792ef(0x1cb)]('itemIds',_0x5ce775['itemIds'][_0x3792ef(0x1f0)](','));_0x42c30f&&_0x5ce775?.['sessionId']&&_0x793ffe['set'](_0x3792ef(0x1ce),_0x5ce775[_0x3792ef(0x1ce)]);!_0x43746c&&!_0x42c30f&&_0x5ce775?.['style']&&_0x793ffe['set'](_0x43aa2e['gFFxq'],_0x5ce775[_0x3792ef(0x1e1)]);const _0x39edb2=_0x33bcd3+_0x3792ef(0x1ea)+_0x16aecf+'/report/markdown',_0x138a7d=''+_0x39edb2+(_0x793ffe[_0x3792ef(0x1d7)]()?'?'+_0x793ffe['toString']():''),_0x3d2515=await _0x43aa2e[_0x3792ef(0x1ca)](fetch,_0x138a7d,{'method':_0x3792ef(0x1da),'headers':{'Authorization':_0x3792ef(0x1b4)+_0x332f65}});if(!_0x3d2515['ok']){const _0x504cce=await _0x3d2515[_0x3792ef(0x1dd)]();throw new Error(_0x3792ef(0x1ad)+_0x504cce);}return _0x3d2515['text']();}export async function listFeatureSessions(_0x54daec){const _0xbd55d5=_0x5ab3,_0x10672a={'NdliS':function(_0x52da43){return _0x52da43();}},_0xe9a5c7=await getToken();if(!_0xe9a5c7)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x30d0f9=_0x10672a['NdliS'](getApiBaseUrl),_0x36f358=await fetch(_0x30d0f9+_0xbd55d5(0x1ea)+_0x54daec+_0xbd55d5(0x1b7),{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0xe9a5c7}});if(!_0x36f358['ok']){const _0x2c9007=await _0x36f358['text']();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x2c9007);}return _0x36f358['json']();}export async function startSession(_0x2261f9,_0x56b94f){const _0xaf718e=_0x5ab3,_0x3fb96d={'llLYs':function(_0x4e157f){return _0x4e157f();},'URPsy':_0xaf718e(0x1be),'XnHAr':_0xaf718e(0x1d9)},_0x5bd505=await _0x3fb96d[_0xaf718e(0x1aa)](getToken);if(!_0x5bd505)throw new Error(_0x3fb96d[_0xaf718e(0x1cc)]);const _0x4c2de9=_0x3fb96d['llLYs'](getApiBaseUrl),_0x5d21fd=await fetch(_0x4c2de9+_0xaf718e(0x1ea)+_0x2261f9+_0xaf718e(0x1bb)+_0x56b94f+'/start',{'method':_0x3fb96d['XnHAr'],'headers':{'Authorization':_0xaf718e(0x1b4)+_0x5bd505}});if(!_0x5d21fd['ok']){const _0x35eeb5=await _0x5d21fd['text']();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x35eeb5);}return _0x5d21fd['json']();}export async function concludeSession(_0x590558,_0xb9e7a){const _0x4b98e6=_0x5ab3,_0x3c53f9={'nnuTS':function(_0x59d485){return _0x59d485();},'gRGJR':function(_0x4653fc){return _0x4653fc();},'SLzMa':_0x4b98e6(0x1d9)},_0x4249e9=await _0x3c53f9[_0x4b98e6(0x1eb)](getToken);if(!_0x4249e9)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x22e727=_0x3c53f9['gRGJR'](getApiBaseUrl),_0x49cf5d=await fetch(_0x22e727+_0x4b98e6(0x1ea)+_0x590558+'/sessions/'+_0xb9e7a+'/conclude',{'method':_0x3c53f9['SLzMa'],'headers':{'Authorization':_0x4b98e6(0x1b4)+_0x4249e9}});if(!_0x49cf5d['ok']){const _0x4d4cf5=await _0x49cf5d[_0x4b98e6(0x1dd)]();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x4d4cf5);}return _0x49cf5d['json']();}function _0x5ab3(_0x3bcc0,_0x1c0982){_0x3bcc0=_0x3bcc0-0x1aa;const _0xf9714f=_0xf971();let _0x5ab341=_0xf9714f[_0x3bcc0];return _0x5ab341;}export async function getActionItems(_0x3bdbca){const _0x15557e=_0x5ab3,_0x23934e={'HxNwL':_0x15557e(0x1be),'DlARo':function(_0x2c72f3){return _0x2c72f3();},'fHVIp':function(_0x1bf540,_0x1a1d9c,_0x107b76){return _0x1bf540(_0x1a1d9c,_0x107b76);}},_0x8a6fbc=await getToken();if(!_0x8a6fbc)throw new Error(_0x23934e[_0x15557e(0x1e3)]);const _0x1a7dd3=_0x23934e['DlARo'](getApiBaseUrl),_0x104b2f=await _0x23934e['fHVIp'](fetch,_0x1a7dd3+'/api/v1/mcp/features/'+_0x3bdbca+_0x15557e(0x1b8),{'method':_0x15557e(0x1da),'headers':{'Authorization':_0x15557e(0x1b4)+_0x8a6fbc}});if(!_0x104b2f['ok']){const _0x3ad4b3=await _0x104b2f[_0x15557e(0x1dd)]();throw new Error(_0x15557e(0x1d0)+_0x3ad4b3);}return _0x104b2f[_0x15557e(0x1cd)]();}export async function getItemFeedback(_0x48ddca,_0x4ff8a9){const _0x4db05b=_0x5ab3,_0x1402e1={'FWQJL':function(_0x4e9453){return _0x4e9453();}},_0x1b36da=await getToken();if(!_0x1b36da)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5a04db=_0x1402e1[_0x4db05b(0x1b6)](getApiBaseUrl),_0x231830=await fetch(_0x5a04db+'/api/v1/mcp/features/'+_0x48ddca+'/checklist-items/'+_0x4ff8a9+'/feedback',{'method':_0x4db05b(0x1da),'headers':{'Authorization':_0x4db05b(0x1b4)+_0x1b36da}});if(!_0x231830['ok']){const _0x5aa91d=await _0x231830[_0x4db05b(0x1dd)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x5aa91d);}return _0x231830[_0x4db05b(0x1cd)]();}export async function markCommentsAddressed(_0x3457ba,_0x53a804,_0x51ddfe){const _0x1e7b3e=_0x5ab3,_0x135dbb={'QmLNv':function(_0x3a3449){return _0x3a3449();},'tTLVS':function(_0x3b26a2,_0x2a25c3,_0x4f4a0c){return _0x3b26a2(_0x2a25c3,_0x4f4a0c);},'RfZMm':'POST','HxQvx':'application/json'},_0x5eb290=await _0x135dbb['QmLNv'](getToken);if(!_0x5eb290)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x74107d=_0x135dbb[_0x1e7b3e(0x1df)](getApiBaseUrl),_0x3bde11=await _0x135dbb['tTLVS'](fetch,_0x74107d+'/api/v1/mcp/features/'+_0x3457ba+'/comments/address',{'method':_0x135dbb[_0x1e7b3e(0x1f1)],'headers':{'Authorization':'Bearer\x20'+_0x5eb290,'Content-Type':_0x135dbb['HxQvx']},'body':JSON['stringify']({'checklistItemId':_0x53a804,'commentIds':_0x51ddfe})});if(!_0x3bde11['ok']){const _0x1bb433=await _0x3bde11['text']();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x1bb433);}}export async function softDeleteFeature(_0x114554){const _0xfe0c88=_0x5ab3,_0x6d3a4f={'xiauD':function(_0x5e05c5){return _0x5e05c5();},'mZTJK':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','cLeGW':function(_0x11018e,_0x414962,_0x1cee8c){return _0x11018e(_0x414962,_0x1cee8c);}},_0x478dbe=await _0x6d3a4f[_0xfe0c88(0x1ec)](getToken);if(!_0x478dbe)throw new Error(_0x6d3a4f[_0xfe0c88(0x1c9)]);const _0x55a8d9=_0x6d3a4f['xiauD'](getApiBaseUrl),_0x5da8cc=await _0x6d3a4f['cLeGW'](fetch,_0x55a8d9+_0xfe0c88(0x1ea)+_0x114554,{'method':'DELETE','headers':{'Authorization':'Bearer\x20'+_0x478dbe}});if(!_0x5da8cc['ok']){const _0x42c9b6=await _0x5da8cc[_0xfe0c88(0x1dd)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x42c9b6);}}export async function restoreFeature(_0x38d684){const _0x16b836=_0x5ab3,_0x422020={'JZkBX':function(_0x4aa872){return _0x4aa872();},'pOACF':function(_0x348a26,_0x5e65c0,_0x1774f3){return _0x348a26(_0x5e65c0,_0x1774f3);},'mizjI':'POST'},_0x50c2f8=await _0x422020['JZkBX'](getToken);if(!_0x50c2f8)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4e0a48=_0x422020[_0x16b836(0x1e5)](getApiBaseUrl),_0x196f13=await _0x422020[_0x16b836(0x1ed)](fetch,_0x4e0a48+'/api/v1/mcp/features/'+_0x38d684+'/restore',{'method':_0x422020['mizjI'],'headers':{'Authorization':'Bearer\x20'+_0x50c2f8}});if(!_0x196f13['ok']){const _0x1fe187=await _0x196f13[_0x16b836(0x1dd)]();throw new Error(_0x16b836(0x1d5)+_0x1fe187);}}
|