@ranger-testing/ranger-cli 3.1.4 → 3.1.5-alpha.9b89f77-48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +1 -1
- package/build/commands/addEnv.js +1 -1
- package/build/commands/authEncrypt.js +1 -1
- package/build/commands/clean.js +1 -1
- package/build/commands/config.js +1 -1
- package/build/commands/deleteProfile.js +1 -1
- package/build/commands/env.js +1 -1
- package/build/commands/feature.js +1 -1
- package/build/commands/hook.js +1 -1
- package/build/commands/hooks/autoPrompt.js +1 -1
- package/build/commands/hooks/disable.js +1 -1
- package/build/commands/hooks/enable.js +1 -1
- package/build/commands/hooks/exitPlanMode.js +1 -1
- package/build/commands/hooks/index.js +1 -1
- package/build/commands/hooks/output.js +1 -1
- package/build/commands/hooks/planReminder.js +1 -1
- package/build/commands/hooks/planStart.js +1 -1
- package/build/commands/hooks/postEdit.js +1 -1
- package/build/commands/hooks/preCompact.js +1 -1
- package/build/commands/hooks/sessionEnd.js +1 -1
- package/build/commands/hooks/sessionStart.js +1 -1
- package/build/commands/hooks/stopHook.js +1 -1
- package/build/commands/index.js +1 -1
- package/build/commands/login.js +1 -1
- package/build/commands/mcpBootstrap.js +1 -1
- package/build/commands/migrateProfile.js +1 -1
- package/build/commands/setup/claude.js +1 -1
- package/build/commands/setup/opencode.js +1 -1
- package/build/commands/setupCi.js +1 -1
- package/build/commands/skillup.js +1 -1
- package/build/commands/start.js +1 -1
- package/build/commands/status.js +1 -1
- package/build/commands/update.js +1 -1
- package/build/commands/updateEnv.js +1 -1
- package/build/commands/useEnv.js +1 -1
- package/build/commands/utils/activeProfile.js +1 -1
- package/build/commands/utils/agentEnv.js +1 -1
- package/build/commands/utils/browserSessionsApi.js +1 -1
- package/build/commands/utils/claudeConfig.js +1 -1
- package/build/commands/utils/claudeOverrideSettings.js +1 -1
- package/build/commands/utils/claudePlugin.js +1 -1
- package/build/commands/utils/cloudProfile.js +1 -1
- package/build/commands/utils/cloudProfileSession.js +1 -1
- package/build/commands/utils/crypto.js +1 -1
- package/build/commands/utils/desirePathLog.js +1 -1
- package/build/commands/utils/deviceAuth.js +1 -1
- package/build/commands/utils/environment.js +1 -1
- package/build/commands/utils/featureApi.js +1 -1
- package/build/commands/utils/fixWebmDuration.js +1 -1
- package/build/commands/utils/gitTracked.js +1 -1
- package/build/commands/utils/keychain.js +1 -1
- package/build/commands/utils/legacyWarning.js +1 -1
- package/build/commands/utils/localAgentInstallationsApi.js +1 -1
- package/build/commands/utils/matchAuthEnvironment.js +1 -1
- package/build/commands/utils/mcpImageBase64.js +1 -1
- package/build/commands/utils/model.js +1 -1
- package/build/commands/utils/novaActCli.js +1 -1
- package/build/commands/utils/opencodeConfig.js +1 -1
- package/build/commands/utils/organizationEnvApi.js +1 -1
- package/build/commands/utils/playwrightCli.js +1 -1
- package/build/commands/utils/profileMessages.js +1 -1
- package/build/commands/utils/profileSetupBanner.js +1 -1
- package/build/commands/utils/projectsConfig.js +1 -1
- package/build/commands/utils/rangerConfig.js +1 -1
- package/build/commands/utils/rangerRoot.js +1 -1
- package/build/commands/utils/rangerwrightCli.js +1 -1
- package/build/commands/utils/resolveProfileContext.js +1 -1
- package/build/commands/utils/resolveProfileUrl.js +1 -1
- package/build/commands/utils/retry.js +1 -1
- package/build/commands/utils/scenarioOriginCheck.js +1 -1
- package/build/commands/utils/sessionCache.js +1 -1
- package/build/commands/utils/settings.js +1 -1
- package/build/commands/utils/skillContent.js +1 -1
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/stitchWebmFiles.js +1 -1
- package/build/commands/utils/telemetry.js +1 -1
- package/build/commands/utils/tokenRefresh.js +1 -1
- package/build/commands/utils/traceSnapshotMapper.js +1 -1
- package/build/commands/utils/tunnelClient.js +1 -1
- package/build/commands/utils/userApi.js +1 -1
- package/build/commands/utils/version.js +1 -1
- package/build/commands/verifyFeature.js +1 -1
- package/build/commands/verifyFeatureCli.js +1 -1
- package/build/commands/verifyFeatureNovaCli.js +1 -1
- package/build/commands/verifyFeatureRangerwrightCli.js +1 -1
- package/package.json +2 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x34624b=_0x21a5;(function(_0xe61449,_0x432dd3){const _0x96b5f=_0x21a5,_0x47b6f1=_0xe61449();while(!![]){try{const _0x50193=parseInt(_0x96b5f(0x188))/0x1+parseInt(_0x96b5f(0x1a5))/0x2*(parseInt(_0x96b5f(0x22e))/0x3)+-parseInt(_0x96b5f(0x1f6))/0x4*(parseInt(_0x96b5f(0x184))/0x5)+parseInt(_0x96b5f(0x1e5))/0x6*(parseInt(_0x96b5f(0x1f2))/0x7)+-parseInt(_0x96b5f(0x205))/0x8+-parseInt(_0x96b5f(0x237))/0x9+parseInt(_0x96b5f(0x211))/0xa;if(_0x50193===_0x432dd3)break;else _0x47b6f1['push'](_0x47b6f1['shift']());}catch(_0x31d51d){_0x47b6f1['push'](_0x47b6f1['shift']());}}}(_0x105c,0x8c75c));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x16a05a from'inquirer';import{chromium}from'playwright';function _0x105c(){const _0x37a34d=['stGhI','session_state','2053478thQNpr',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','trackPhaseError','Bearer\x20','4xIqLwm','RANGER_TEST_PASSWORD','Browser\x20login\x20timed\x20out\x20before\x20completion.','LfXIs','IYZeq','json','FdvNT','txluT','\x22,\x20attempting\x20login...','EtZoP','trackPhaseStart','cookies','\x20Available:\x20','organizationId','some','5629024CQlZvG','VUTAp','type','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','jGNzc','EFfcF','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','trackPhaseEnd','invalidateOn','361580QBJRtt','trim','\x22.\x0a','tunnel_bridge','uBWoU','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','nnIZY','/api/v1/tunnel/sessions','userAgent','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','storageStatePath','hLFYp','password','uAPYf','catch','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','storageState','XCDDe','close','QuTfy','detail','not_configured','pNdIf','sLNKF','yREfQ','test_output','Cloud\x20profile\x20\x22','/login','sessionId','3327SLEUKx','TqbTp','OSMuo','mWjZi','jZdcE','prompt','hMPeX','\x20\x20Options:\x0a','kyhcs','389601QrwKHN','origin','wsEndpoint','ilVui','cpSwT','\x20\x20Login\x20successful.\x20Session\x20cached.','3627055LXUlkV','SNOTw','pttcT','nysiT','671244SZSHks','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','env','\x20\x20Auth\x20env\x20\x22','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','YfdZm','FVLsd','keys','/api/v1/profiles/','vZcwc','error','length','elapsedMs','API\x20request\x20','agent','NtIst','EDrvh','Browser\x20login\x20timed\x20out\x20after\x20','ambiguous','log','cli:manual-login','Pxifv','environments','goto','domains','gcPRM','status','url','1888MXusng','ZcjcX','\x22\x20failed\x20validation\x20—\x20refreshing...','OVxVi','/api/v1/profiles','SpaWU','GzFBy','code','bPCYy','eSXan','wVMsD','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','about:blank','ZCoyc','RwmUA','\x20\x20Cloud\x20profile\x20\x22','telemetry','join','duqtY','force','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','local_ws_error','sessionState','DXgUf','\x20\x20No\x20live\x20session\x20for\x20\x22','sqZJF','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','headers','/session','targetUrl','ApiError','auth','clientIp','\x22;\x20proceeding\x20with\x20loginInstructions.','name','tunnel','string','isArray','hIkRd','push','HbkON','loginInstructions','RTnwM','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','JadLZ','envKey','RANGER_TEST_USERNAME','stringify','tunnel_login_cleanup','Kflwb','sessionCheckPath','pw_endpoint','\x20\x20Created\x20cloud\x20profile\x20\x22','tunnel_login_setup','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','ZZQnb','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','ZgrgQ','environment_key','wVoUN','\x22,\x20refreshing\x20session...','POST','/api/v1/profiles/auth-config','tunnelUrl','6gAJQur','parse','DONxv','setupHeaders','wYGmx','key','DELETE','eBCVD','none','settings','environmentKey'];_0x105c=function(){return _0x37a34d;};return _0x105c();}import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x5172ee){const _0x3d7339={'dfqBt':'invalid-url'};try{return new URL(_0x5172ee)['host'];}catch{return _0x3d7339['dfqBt'];}}function errorMessageForTelemetry(_0x198fc4){return _0x198fc4 instanceof Error?_0x198fc4['message']:undefined;}function trackBridgeEvent(_0x387a96,_0x174396){const _0x541ed8=_0x21a5,_0x9356ee={'inazp':'tunnel_bridge_event','kyhcs':function(_0x2ef5fa,_0x40a7da){return _0x2ef5fa===_0x40a7da;},'ChPzD':'tunnel_error','stGhI':_0x541ed8(0x1ba),'HxKhf':_0x541ed8(0x214)};if(!_0x387a96)return;const _0x416f89={'tunnelSessionId':_0x174396['sessionId'],'tunnelEventType':_0x174396[_0x541ed8(0x207)],'connectionId':_0x174396['connectionId'],'code':_0x174396[_0x541ed8(0x1ac)],'reason':_0x174396['reason'],'error':_0x174396['error'],'elapsedMs':_0x174396[_0x541ed8(0x195)],'activeLocalConnections':_0x174396['activeLocalConnections'],'pendingLocalConnections':_0x174396['pendingLocalConnections']};_0x387a96[_0x541ed8(0x20f)](_0x9356ee['inazp'],_0x416f89),(_0x9356ee[_0x541ed8(0x236)](_0x174396['type'],_0x9356ee['ChPzD'])||_0x174396[_0x541ed8(0x207)]===_0x9356ee[_0x541ed8(0x1f0)])&&void _0x387a96[_0x541ed8(0x1f4)](_0x9356ee['HxKhf'],new Error(_0x174396[_0x541ed8(0x193)]??_0x174396[_0x541ed8(0x207)]),_0x416f89);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x31125d=_0x21a5,_0x4255da=await getToken();if(!_0x4255da)throw new Error(_0x31125d(0x189));return _0x4255da;}async function apiRequest(_0x3473eb,_0x1c7605={}){const _0x2e5971=_0x21a5,_0x3760b0={'EtZoP':'string','VUTAp':function(_0x2d738d,_0x3adad2){return _0x2d738d===_0x3adad2;}},_0x1cc977=await requireToken(),_0x3b5fe4=getApiBaseUrl(),_0x590266=await fetch(''+_0x3b5fe4+_0x3473eb,{..._0x1c7605,'headers':{'Authorization':_0x2e5971(0x1f5)+_0x1cc977,'Content-Type':'application/json',..._0x1c7605[_0x2e5971(0x1c0)]??{}}});if(!_0x590266['ok']){let _0x12d7b8='',_0x37a2e8;try{const _0x4d2100=await _0x590266[_0x2e5971(0x1fb)](),_0x38effb=(typeof _0x4d2100['error']===_0x3760b0['EtZoP']?_0x4d2100['error']:undefined)??JSON['stringify'](_0x4d2100);_0x12d7b8=_0x38effb;typeof _0x4d2100['test_output']===_0x3760b0[_0x2e5971(0x1ff)]&&_0x4d2100[_0x2e5971(0x22a)]&&(_0x12d7b8=_0x12d7b8+'\x0a'+_0x4d2100[_0x2e5971(0x22a)]);if(_0x3760b0[_0x2e5971(0x206)](typeof _0x4d2100['code'],_0x2e5971(0x1c9)))_0x37a2e8=_0x4d2100['code'];}catch{_0x12d7b8=_0x590266['statusText'];}throw new ApiError(_0x2e5971(0x196)+_0x3473eb+'\x20failed\x20('+_0x590266['status']+'):\x20'+_0x12d7b8,_0x590266[_0x2e5971(0x1a3)],_0x12d7b8,_0x37a2e8);}if(_0x590266[_0x2e5971(0x1a3)]===0xcc)return undefined;return _0x590266[_0x2e5971(0x1fb)]();}export class ApiError extends Error{['status'];[_0x34624b(0x225)];[_0x34624b(0x1ac)];constructor(_0x1e1509,_0x250690,_0x5ad460,_0x4ac475){const _0x246695=_0x34624b,_0x54b06a={'QuTfy':_0x246695(0x1c3)},_0x2f4ff8='4|3|0|2|1'['split']('|');let _0x1df8d4=0x0;while(!![]){switch(_0x2f4ff8[_0x1df8d4++]){case'0':this[_0x246695(0x225)]=_0x5ad460;continue;case'1':this[_0x246695(0x1c7)]=_0x54b06a[_0x246695(0x224)];continue;case'2':this[_0x246695(0x1ac)]=_0x4ac475;continue;case'3':this['status']=_0x250690;continue;case'4':super(_0x1e1509);continue;}break;}}}export async function fetchCloudProfile(_0x5d1262){const _0x184c82=_0x34624b,_0x199883={'nysiT':function(_0xabbc6c,_0x4e5090){return _0xabbc6c(_0x4e5090);},'Kflwb':function(_0x389f95,_0x2c823d){return _0x389f95 instanceof _0x2c823d;}};try{return await _0x199883[_0x184c82(0x187)](apiRequest,'/api/v1/profiles/'+_0x199883[_0x184c82(0x187)](encodeURIComponent,_0x5d1262));}catch(_0x93df6){if(_0x199883[_0x184c82(0x1d6)](_0x93df6,ApiError)&&_0x93df6['status']===0x194)return null;throw _0x93df6;}}export async function listCloudProfiles(){const _0x505c42={'vIacv':function(_0x30ae4d,_0x2678fc){return _0x30ae4d(_0x2678fc);}},_0x9652e8=await _0x505c42['vIacv'](apiRequest,'/api/v1/profiles');return _0x9652e8['profiles'];}export async function deleteCloudProfile(_0x2521bd){const _0x11d150=_0x34624b,_0xfdc224={'DCMXy':function(_0x33d83c,_0x36714c){return _0x33d83c(_0x36714c);}};try{await apiRequest(_0x11d150(0x191)+_0xfdc224['DCMXy'](encodeURIComponent,_0x2521bd),{'method':_0x11d150(0x1eb)});}catch(_0x446378){if(_0x446378 instanceof ApiError&&_0x446378['status']===0x194)throw new Error(_0x11d150(0x22b)+_0x2521bd+'\x22\x20not\x20found.');throw _0x446378;}}export async function createCloudProfile(_0x2a9c21,_0x2aaa9a,_0x4391a3={}){const _0x3457ec=_0x34624b,_0x1474e1={'wYGmx':function(_0x508b48,_0x56da8f,_0x2e0a77){return _0x508b48(_0x56da8f,_0x2e0a77);},'YovvO':_0x3457ec(0x1e2)},_0x3d11b5={'name':_0x2a9c21};if(_0x2aaa9a)_0x3d11b5[_0x3457ec(0x1df)]=_0x2aaa9a;_0x4391a3[_0x3457ec(0x1ee)]&&Object[_0x3457ec(0x190)](_0x4391a3[_0x3457ec(0x1ee)])['length']>0x0&&(_0x3d11b5[_0x3457ec(0x1ee)]=_0x4391a3[_0x3457ec(0x1ee)]);if(_0x4391a3['username'])_0x3d11b5['username']=_0x4391a3['username'];if(_0x4391a3[_0x3457ec(0x21d)])_0x3d11b5['password']=_0x4391a3['password'];return await _0x1474e1[_0x3457ec(0x1e9)](apiRequest,_0x3457ec(0x1a9),{'method':_0x1474e1['YovvO'],'body':JSON[_0x3457ec(0x1d4)](_0x3d11b5)});}export async function uploadCloudProfileSession(_0x4b02c8,_0x4f4a3f){const _0x5d06e7=_0x34624b,_0x2877e7={'QOtSe':function(_0x58ae70,_0xf17c8f,_0x5b8819){return _0x58ae70(_0xf17c8f,_0x5b8819);},'vaZOB':function(_0x3c5575,_0x2eda0b){return _0x3c5575(_0x2eda0b);}};return await _0x2877e7['QOtSe'](apiRequest,_0x5d06e7(0x191)+_0x2877e7['vaZOB'](encodeURIComponent,_0x4b02c8)+_0x5d06e7(0x1c1),{'method':_0x5d06e7(0x1e2),'body':JSON['stringify']({'session_state':_0x4f4a3f})});}export async function saveCloudProfileCredentials(_0x58e9ae,_0x1484fb,_0x25d945){const _0x459118=_0x34624b,_0x5cd2c4={'lHeJR':function(_0x1447ec,_0x34ff3c,_0x1b4457){return _0x1447ec(_0x34ff3c,_0x1b4457);},'NtIst':function(_0x42e248,_0x4eb1c4){return _0x42e248(_0x4eb1c4);}};await _0x5cd2c4['lHeJR'](apiRequest,_0x459118(0x191)+_0x5cd2c4[_0x459118(0x198)](encodeURIComponent,_0x58e9ae),{'method':'PUT','body':JSON['stringify']({'username':_0x1484fb,'password':_0x25d945})});}export async function fetchAuthConfig(){const _0x42b21b=_0x34624b,_0x26bf1d={'EFfcF':function(_0x496ff8,_0x593b7d){return _0x496ff8 instanceof _0x593b7d;},'RTnwM':function(_0x4ee341,_0x1b6b1c){return _0x4ee341!==_0x1b6b1c;}};try{const _0x50b141=await apiRequest(_0x42b21b(0x1e3));return _0x50b141['auth_config'];}catch(_0x21b27d){return _0x26bf1d[_0x42b21b(0x20c)](_0x21b27d,ApiError)&&_0x26bf1d[_0x42b21b(0x1cf)](_0x21b27d[_0x42b21b(0x1a3)],0x194)&&console['error']('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x21b27d['message']),null;}}async function createTunnelSession(_0x23eef7){const _0x251fd3=_0x34624b,_0x144e1e={'gcPRM':function(_0x5ba87b,_0x3f3fed,_0xa501c){return _0x5ba87b(_0x3f3fed,_0xa501c);},'txluT':_0x251fd3(0x218)};return await _0x144e1e[_0x251fd3(0x1a2)](apiRequest,_0x144e1e[_0x251fd3(0x1fd)],{'method':_0x251fd3(0x1e2),'body':JSON[_0x251fd3(0x1d4)]({'targetUrl':_0x23eef7,'mode':_0x251fd3(0x197)})});}async function deleteTunnelSession(_0x356276){const _0x3e7601=_0x34624b,_0x47f6d4={'OSMuo':function(_0x22b0a0,_0x4735a9,_0x52fdd){return _0x22b0a0(_0x4735a9,_0x52fdd);}};await _0x47f6d4[_0x3e7601(0x230)](apiRequest,'/api/v1/tunnel/sessions/'+_0x356276,{'method':_0x3e7601(0x1eb)});}export function pickAdHocEnvKey(_0x2d3019,_0x857b5b,_0x5940f5){const _0x12ce70=_0x34624b,_0x386e69={'XCDDe':function(_0x4752cb,_0x2823ef,_0x3b6d40){return _0x4752cb(_0x2823ef,_0x3b6d40);},'SNOTw':function(_0x16c104,_0x42a1a0){return _0x16c104 in _0x42a1a0;},'SpaWU':_0x12ce70(0x19b),'jGNzc':function(_0x1e78f3,_0x10ff23){return _0x1e78f3+_0x10ff23;},'dTwqc':function(_0x1175c8,_0x28c162){return _0x1175c8===_0x28c162;},'zKaue':function(_0x4068ae,_0x4daf47){return _0x4068ae===_0x4daf47;}};if(_0x5940f5){if(!_0x2d3019?.[_0x12ce70(0x19f)]?.[_0x5940f5]){const _0x1bb1bb=Object['keys'](_0x2d3019?.[_0x12ce70(0x19f)]??{});throw new Error('Auth\x20environment\x20\x22'+_0x5940f5+_0x12ce70(0x1bf)+(_0x1bb1bb[_0x12ce70(0x194)]?_0x12ce70(0x202)+_0x1bb1bb['join'](',\x20')+'.':_0x12ce70(0x216))+'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)');}return _0x5940f5;}if(!_0x2d3019)return null;if(_0x857b5b){const _0x8ddab=_0x386e69[_0x12ce70(0x222)](matchAuthEnvironmentExact,_0x857b5b,_0x2d3019);if(_0x8ddab)return _0x8ddab;const _0x39506c=_0x386e69['XCDDe'](matchAuthEnvironmentByHost,_0x857b5b,_0x2d3019);if(_0x39506c&&'key'in _0x39506c)return console[_0x12ce70(0x19c)](_0x12ce70(0x18c)+_0x39506c['key']+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x857b5b+_0x12ce70(0x1dd)),_0x39506c[_0x12ce70(0x1ea)];if(_0x39506c&&_0x386e69[_0x12ce70(0x185)](_0x386e69[_0x12ce70(0x1aa)],_0x39506c))throw new Error('Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20('+_0x39506c['ambiguous'][_0x12ce70(0x1b6)](',\x20')+_0x12ce70(0x1f3));if(needsTunnel(_0x857b5b))throw new Error(_0x386e69['jGNzc'](_0x386e69[_0x12ce70(0x20b)]('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x857b5b+_0x12ce70(0x213)+_0x12ce70(0x18d),_0x12ce70(0x235))+'\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a'+('\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x857b5b['replace'](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),_0x12ce70(0x20a)+_0x857b5b+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x2d3019['defaultEnvironmentKey'])return _0x2d3019['defaultEnvironmentKey'];const _0x2f33f5=Object[_0x12ce70(0x190)](_0x2d3019['environments']??{});if(_0x386e69['dTwqc'](_0x2f33f5['length'],0x1))return _0x2f33f5[0x0];if(_0x386e69['zKaue'](_0x2f33f5[_0x12ce70(0x194)],0x0))return null;throw new Error(_0x386e69['jGNzc']('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x2f33f5[_0x12ce70(0x1b6)](',\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(_0x247abe,_0x549263,_0x7cfdb3){if(!_0x549263||_0x549263===_0x7cfdb3)return _0x247abe;return _0x247abe+':'+_0x549263;}export async function resolveAdHocProfile(_0x3f7370={},_0x20b223=process['env']){const _0x480a08=_0x34624b,_0x12498f={'ZcjcX':function(_0x56fd3a){return _0x56fd3a();},'DXgUf':function(_0x1f7302,_0x3aadae,_0x28d56c,_0x4dcf3a){return _0x1f7302(_0x3aadae,_0x28d56c,_0x4dcf3a);},'ilVui':function(_0x388599,_0x56d71b){return _0x388599(_0x56d71b);},'Pxifv':function(_0x4506a4,_0x34cd34){return _0x4506a4??_0x34cd34;}},_0x39adf6=_0x20b223[_0x480a08(0x1d3)];if(!_0x39adf6)return null;const _0x151bf8=await _0x12498f[_0x480a08(0x1a6)](fetchAuthConfig),_0x3edb86=_0x12498f[_0x480a08(0x1bc)](pickAdHocEnvKey,_0x151bf8,_0x3f7370['targetUrl'],_0x3f7370[_0x480a08(0x1d2)]);let _0x46236a=adHocProfileName(_0x39adf6,_0x3edb86,_0x151bf8?.['defaultEnvironmentKey']),_0x427e6e=await _0x12498f['ilVui'](fetchCloudProfile,_0x46236a);_0x427e6e&&_0x3edb86&&_0x427e6e['environmentKey']!==_0x3edb86&&(console['log'](_0x480a08(0x1b4)+_0x46236a+_0x480a08(0x209)+(_0x427e6e['environmentKey']??_0x480a08(0x1ed))+_0x480a08(0x21a)+_0x3edb86+'\x22;\x20using\x20\x22'+_0x39adf6+':'+_0x3edb86+'\x22\x20instead.'),_0x46236a=_0x39adf6+':'+_0x3edb86,_0x427e6e=await _0x12498f[_0x480a08(0x181)](fetchCloudProfile,_0x46236a));if(_0x427e6e)return{'name':_0x427e6e[_0x480a08(0x1c7)],'profile':_0x427e6e};const _0x1dd6de=_0x20b223['RANGER_TEST_PASSWORD'],_0x2a5b82=await createCloudProfile(_0x46236a,_0x12498f[_0x480a08(0x19e)](_0x3edb86,undefined),{'username':_0x39adf6,'password':_0x1dd6de});return console['log'](_0x480a08(0x1d9)+_0x2a5b82[_0x480a08(0x1c7)]+'\x22\x20for\x20'+_0x39adf6+(_0x3edb86?'\x20(auth\x20env:\x20'+_0x3edb86+')':'')),{'name':_0x2a5b82['name'],'profile':_0x2a5b82};}export async function writeSessionToLocalCache(_0x7b9367,_0x2b6466,_0x5590b3,_0x3c6638,_0x4abd32,_0x335aec,_0x3c8f15){const _0x5b15b3=_0x34624b,_0x148640={'LfXIs':function(_0x1867be,_0x1d8e95){return _0x1867be(_0x1d8e95);},'YfdZm':function(_0x2ab28b,_0x538e3c,_0x17987f){return _0x2ab28b(_0x538e3c,_0x17987f);},'koDKP':function(_0x1186c4,_0x4c009f,_0x1ca8b9){return _0x1186c4(_0x4c009f,_0x1ca8b9);}},_0x2b384f=_0x148640[_0x5b15b3(0x1f9)](sessionCacheHash,{'orgId':_0x2b6466,'profileName':_0x7b9367,'effectiveBaseUrl':_0x5590b3,'setupHeaders':_0x3c6638,'invalidateOn':_0x3c8f15?.['invalidateOn'],'userAgent':_0x3c8f15?.['userAgent'],'clientIp':_0x3c8f15?.[_0x5b15b3(0x1c5)]}),_0x32b62b=getSessionCachePath(_0x2b384f,_0x7b9367),_0x320dbf=join(getRangerHomeDir(),_0x5b15b3(0x1c4));!_0x148640['LfXIs'](existsSync,_0x320dbf)&&await mkdir(_0x320dbf,{'recursive':!![]});const _0x8ca26d={..._0x4abd32};_0x335aec&&_0x335aec[_0x5b15b3(0x194)]>0x0&&Array[_0x5b15b3(0x1ca)](_0x8ca26d[_0x5b15b3(0x201)])&&(_0x8ca26d['cookies']=_0x148640['YfdZm'](duplicateCookiesForDomains,_0x8ca26d[_0x5b15b3(0x201)],_0x335aec));const _0x489e7e={'cached_at':new Date()['toISOString'](),'session_state':_0x8ca26d};await _0x148640[_0x5b15b3(0x18e)](writeFile,_0x32b62b,JSON[_0x5b15b3(0x1d4)](_0x489e7e,null,0x2));const _0x216cf2=_0x148640[_0x5b15b3(0x1f9)](getStorageStatePath,_0x32b62b);return await _0x148640['koDKP'](writeFile,_0x216cf2,JSON[_0x5b15b3(0x1d4)](_0x8ca26d,null,0x2)),_0x216cf2;}export async function checkLocalCache(_0x53941b,_0x1fa9e3,_0x3a2397,_0x16de63,_0x43855f){const _0x288899=_0x34624b,_0x24a01c={'gkrWZ':function(_0x51e110,_0xe76c02){return _0x51e110(_0xe76c02);},'yREfQ':function(_0x2c1d21,_0x49726b){return _0x2c1d21(_0x49726b);},'TqbTp':function(_0x3fba4c,_0x169bfe,_0x283c43){return _0x3fba4c(_0x169bfe,_0x283c43);}},_0x53442b=sessionCacheHash({'orgId':_0x1fa9e3,'profileName':_0x53941b,'effectiveBaseUrl':_0x3a2397,'setupHeaders':_0x16de63,'invalidateOn':_0x43855f?.['invalidateOn'],'userAgent':_0x43855f?.[_0x288899(0x219)],'clientIp':_0x43855f?.[_0x288899(0x1c5)]}),_0x2fef11=getSessionCachePath(_0x53442b,_0x53941b),_0x1c3cec=getStorageStatePath(_0x2fef11);if(!_0x24a01c['gkrWZ'](existsSync,_0x2fef11)||!_0x24a01c[_0x288899(0x229)](existsSync,_0x1c3cec))return null;try{const _0xfcf701=await _0x24a01c[_0x288899(0x22f)](readFile,_0x2fef11,'utf-8');return JSON[_0x288899(0x1e6)](_0xfcf701),{'storageStatePath':_0x1c3cec};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x31c133,_0x56f22d){const _0x4051ba=_0x34624b,_0x419a6b={'cpSwT':function(_0x1a35c1,_0x38704e){return _0x1a35c1+_0x38704e;}};if(!_0x56f22d||!_0x56f22d[_0x4051ba(0x1a1)]?.[_0x4051ba(0x194)])return;let _0x253359;try{_0x253359=new URL(_0x31c133);}catch{return;}const _0x22b453=[];for(const _0x13977c of _0x56f22d[_0x4051ba(0x1a1)]){try{_0x22b453[_0x4051ba(0x1cc)]({'raw':_0x13977c,'url':new URL(_0x13977c)});}catch{}}if(_0x22b453['length']===0x0)return;if(_0x22b453[_0x4051ba(0x204)](_0x47f13b=>_0x47f13b[_0x4051ba(0x1a4)][_0x4051ba(0x238)]===_0x253359['origin']))return;const _0x45f97d=_0x22b453['map'](_0x1cb4c1=>'\x22'+_0x1cb4c1['raw']+'\x22')['join'](',\x20');console['log'](_0x419a6b[_0x4051ba(0x182)](_0x4051ba(0x1db)+_0x45f97d+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x31c133+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+_0x4051ba(0x20d));}export async function serverSideLogin(_0x3c60bd,_0x457bee){const _0x38238b=_0x34624b,_0x5da04c={'nGNjQ':function(_0x17275c,_0x303b70){return _0x17275c(_0x303b70);},'nTDrd':_0x38238b(0x1e2),'jZdcE':function(_0x940321,_0x3dd72e){return _0x940321===_0x3dd72e;},'bkEEY':_0x38238b(0x226)},_0x4088d3=process[_0x38238b(0x18b)][_0x38238b(0x1d3)],_0x410879=process['env'][_0x38238b(0x1f7)],_0x4fb899={};if(_0x4088d3)_0x4fb899['username']=_0x4088d3;if(_0x410879)_0x4fb899[_0x38238b(0x21d)]=_0x410879;if(_0x457bee?.[_0x38238b(0x1b8)])_0x4fb899[_0x38238b(0x1b8)]=!![];if(_0x457bee?.['targetUrl'])_0x4fb899['target_url']=_0x457bee[_0x38238b(0x1c2)];_0x457bee?.['tunnel']&&(_0x4fb899['tunnel_session_id']=_0x457bee[_0x38238b(0x1c8)]['sessionId'],_0x4fb899[_0x38238b(0x1d8)]=_0x457bee['tunnel']['pwEndpoint']);try{return await apiRequest('/api/v1/profiles/'+_0x5da04c['nGNjQ'](encodeURIComponent,_0x3c60bd)+_0x38238b(0x22c),{'method':_0x5da04c['nTDrd'],'body':JSON[_0x38238b(0x1d4)](_0x4fb899)});}catch(_0x309a54){if(_0x309a54 instanceof ApiError&&_0x309a54['status']===0x190&&_0x5da04c[_0x38238b(0x232)](_0x309a54[_0x38238b(0x1ac)],'not_configured'))return{'status':_0x5da04c['bkEEY'],'error':_0x309a54[_0x38238b(0x225)]};throw _0x309a54;}}function _0x21a5(_0xaf58a0,_0x4d09a3){_0xaf58a0=_0xaf58a0-0x181;const _0x105ca5=_0x105c();let _0x21a595=_0x105ca5[_0xaf58a0];return _0x21a595;}async function serverSideLoginWithOptionalTunnel(_0x533f00,_0x12c7ec,_0x439250={}){const _0xb9a559=_0x34624b,_0x431242={'EDrvh':function(_0x45b413,_0x406260){return _0x45b413(_0x406260);},'GzFBy':function(_0x290414,_0x527338){return _0x290414(_0x527338);},'FdvNT':function(_0x3c5ac0,_0x51063b){return _0x3c5ac0(_0x51063b);},'RwmUA':function(_0x4011a5,_0x551137){return _0x4011a5===_0x551137;},'hMPeX':'true','WwoQz':'\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','IYZeq':function(_0x5880cb){return _0x5880cb();},'KIITv':'tunnel_login_request','hIkRd':function(_0x29880e,_0x4b0f6c,_0x347d05){return _0x29880e(_0x4b0f6c,_0x347d05);},'HbkON':function(_0x59e529,_0x13418b){return _0x59e529??_0x13418b;},'JdaLZ':'tunnel_login_cleanup'};if(!_0x431242[_0xb9a559(0x1fc)](needsTunnel,_0x12c7ec))return await serverSideLogin(_0x533f00,{'force':_0x439250['force']});let _0x1bfc81=null,_0x5bf0af=null,_0x23b952=null,_0x375b22=null,_0x3341c6=![];const _0x51979b=process[_0xb9a559(0x18b)]['RANGER_TUNNEL_LOGIN_HEADED']?.['toLowerCase'](),_0x369872=_0x431242[_0xb9a559(0x1b3)](_0x51979b,'1')||_0x51979b===_0x431242[_0xb9a559(0x234)],_0x46bbcd={'profileName':_0x533f00,'targetUrlHost':targetHostForTelemetry(_0x12c7ec),'tunnelRequired':!![],'forceLogin':_0x431242[_0xb9a559(0x199)](Boolean,_0x439250[_0xb9a559(0x1b8)]),'localBrowserServerHeaded':_0x369872};try{_0x439250[_0xb9a559(0x1b5)]?.[_0xb9a559(0x200)]('tunnel_login_setup',_0x46bbcd);_0x369872&&console[_0xb9a559(0x19c)](_0x431242['WwoQz']);_0x1bfc81=await launchBrowserServer({'headless':!_0x369872}),_0x5bf0af=await createTunnelSession(_0x12c7ec);const _0x48524c=await _0x431242[_0xb9a559(0x1fa)](requireToken);_0x23b952=await createTunnelBridge({'localWsUrl':_0x1bfc81[_0xb9a559(0x239)],'tunnelServerUrl':_0x5bf0af[_0xb9a559(0x1e4)],'sessionId':_0x5bf0af['sessionId'],'apiKey':_0x48524c,'onError':_0x2e81c9=>{_0x375b22=_0x2e81c9;},'onClose':()=>{_0x375b22??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x533f00);},'onEvent':_0xb71e77=>trackBridgeEvent(_0x439250[_0xb9a559(0x1b5)],_0xb71e77)}),_0x439250['telemetry']?.[_0xb9a559(0x20f)](_0xb9a559(0x1da),{..._0x46bbcd,'tunnelSessionId':_0x5bf0af['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x369872}),_0x3341c6=!![];try{return _0x439250[_0xb9a559(0x1b5)]?.[_0xb9a559(0x200)](_0x431242['KIITv'],{..._0x46bbcd,'tunnelSessionId':_0x5bf0af[_0xb9a559(0x22d)]}),await _0x431242[_0xb9a559(0x1cb)](serverSideLogin,_0x533f00,{'force':_0x439250['force'],'targetUrl':_0x12c7ec,'tunnel':{'sessionId':_0x5bf0af[_0xb9a559(0x22d)],'pwEndpoint':_0x5bf0af['pwEndpoint']}})['then'](_0x3b1398=>{const _0x1f698e=_0xb9a559;return _0x439250['telemetry']?.[_0x1f698e(0x20f)]('tunnel_login_request',{..._0x46bbcd,'tunnelSessionId':_0x5bf0af?.['sessionId'],'loginStatus':_0x3b1398[_0x1f698e(0x1a3)],'hasSessionState':_0x431242['EDrvh'](Boolean,_0x3b1398[_0x1f698e(0x1f1)]),'hasTestOutput':_0x431242[_0x1f698e(0x1ab)](Boolean,_0x3b1398[_0x1f698e(0x22a)]),'bridgeError':_0x431242['EDrvh'](errorMessageForTelemetry,_0x375b22)}),_0x3b1398;});}catch(_0x4ee46c){await _0x439250['telemetry']?.['trackPhaseError'](_0x431242['KIITv'],_0x375b22??_0x4ee46c,{..._0x46bbcd,'tunnelSessionId':_0x5bf0af[_0xb9a559(0x22d)],'bridgeError':errorMessageForTelemetry(_0x375b22)});throw _0x431242[_0xb9a559(0x1cd)](_0x375b22,_0x4ee46c);}}catch(_0x343546){!_0x3341c6&&await _0x439250['telemetry']?.[_0xb9a559(0x1f4)](_0xb9a559(0x1da),_0x343546,{..._0x46bbcd,'tunnelSessionId':_0x5bf0af?.['sessionId']});throw _0x343546;}finally{(_0x5bf0af||_0x1bfc81||_0x23b952)&&(_0x439250[_0xb9a559(0x1b5)]?.['trackPhaseStart'](_0x431242['JdaLZ'],{..._0x46bbcd,'tunnelSessionId':_0x5bf0af?.[_0xb9a559(0x22d)]}),_0x23b952?.[_0xb9a559(0x223)](),_0x1bfc81&&await _0x1bfc81['close']()[_0xb9a559(0x21f)](()=>{}),_0x5bf0af&&await deleteTunnelSession(_0x5bf0af['sessionId'])[_0xb9a559(0x21f)](()=>{}),_0x439250['telemetry']?.[_0xb9a559(0x20f)](_0xb9a559(0x1d5),{..._0x46bbcd,'tunnelSessionId':_0x5bf0af?.['sessionId']}));}}export async function manualBrowserLogin(_0x3df7ff,_0x22d07a,_0x5108b7={}){const _0x2a13d2=_0x34624b,_0x511f88={'wVoUN':function(_0x160130,_0x4ef26c){return _0x160130/_0x4ef26c;},'eSXan':function(_0xee7ae7,_0x4d72cd){return _0xee7ae7(_0x4d72cd);},'ZZQnb':'close','nnIZY':function(_0x97243){return _0x97243();},'wVMsD':function(_0x4c9ed8,_0x56ca21){return _0x4c9ed8+_0x56ca21;},'fLPou':function(_0x2e8caa,_0x43c692){return _0x2e8caa+_0x43c692;},'uAPYf':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','BcMOU':function(_0x24ccdd,_0x30b951){return _0x24ccdd>_0x30b951;},'APgox':_0x2a13d2(0x1b1),'JadLZ':_0x2a13d2(0x208),'qtbrP':function(_0x4b6c1d,_0x26624f){return _0x4b6c1d(_0x26624f);},'AbDAJ':_0x2a13d2(0x18a),'sqZJF':function(_0x56c86b,_0x1bac3e){return _0x56c86b!==_0x1bac3e;},'Ndyph':'POST','ZgrgQ':_0x2a13d2(0x19d)};if(!_0x511f88[_0x2a13d2(0x217)](isInteractive))throw new Error(_0x511f88[_0x2a13d2(0x1af)](_0x511f88['fLPou']('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x3df7ff[_0x2a13d2(0x1c7)]+'\x22.\x0a','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20'),_0x511f88[_0x2a13d2(0x21e)]));const _0x4c045f=_0x22d07a&&_0x511f88['BcMOU'](_0x22d07a['domains']['length'],0x0)?_0x22d07a[_0x2a13d2(0x1a1)][0x0]:_0x511f88['APgox'];console['log'](_0x511f88[_0x2a13d2(0x1d1)]),console[_0x2a13d2(0x19c)]('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x386f97=>setTimeout(_0x386f97,0x7d0));const _0x35bcb8=await chromium['launch']({'headless':![]});let _0x21c4ad=null;try{const _0x20abf8={'ignoreHTTPSErrors':!![]};_0x22d07a?.[_0x2a13d2(0x1e8)]&&(_0x20abf8['extraHTTPHeaders']=_0x22d07a[_0x2a13d2(0x1e8)]);const _0x2d4389=await _0x35bcb8['newContext'](_0x20abf8);await _0x511f88['qtbrP'](addProfileSetupBanner,_0x2d4389);const _0x3466fe=await _0x2d4389['newPage']();await _0x3466fe[_0x2a13d2(0x1a0)](_0x4c045f);let _0x571f13=![];await new Promise(_0x19f492=>{const _0x208af4=_0x2a13d2,_0x333dd6=setTimeout(()=>{const _0x4523cd=_0x21a5;_0x571f13=!![],console[_0x4523cd(0x193)](_0x4523cd(0x19a)+_0x511f88[_0x4523cd(0x1e0)](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x19f492();},MANUAL_LOGIN_TIMEOUT_MS);_0x3466fe['on'](_0x511f88[_0x208af4(0x1dc)],async()=>{const _0x58e730=_0x208af4;_0x511f88[_0x58e730(0x1ae)](clearTimeout,_0x333dd6);try{const _0x117f08=await _0x2d4389[_0x58e730(0x221)]();_0x21c4ad=_0x117f08;}catch{}_0x19f492();});});if(_0x571f13&&!_0x21c4ad)throw new Error(_0x2a13d2(0x1f8));}finally{await _0x35bcb8[_0x2a13d2(0x223)]()['catch'](()=>{});}if(!_0x21c4ad)throw new Error(_0x511f88['AbDAJ']);return _0x511f88[_0x2a13d2(0x1be)](_0x5108b7['persistSessionState'],![])&&await apiRequest(_0x2a13d2(0x191)+_0x511f88['eSXan'](encodeURIComponent,_0x3df7ff['name'])+'/session',{'method':_0x511f88['Ndyph'],'body':JSON['stringify']({'session_state':_0x21c4ad,'updated_by':_0x511f88[_0x2a13d2(0x1de)]})}),{'sessionState':_0x21c4ad};}export async function promptSaveCredentials(_0x239622){const _0xcea68e=_0x34624b,_0x36ffb5={'IpNen':function(_0x415daf){return _0x415daf();},'UTpPT':function(_0x27ebff,_0x59d510,_0x50bf36){return _0x27ebff(_0x59d510,_0x50bf36);},'pNdIf':'PUT','hLFYp':_0xcea68e(0x20e)},_0x3c79ec=process[_0xcea68e(0x18b)]['RANGER_TEST_USERNAME'],_0x105f41=process['env']['RANGER_TEST_PASSWORD'];if(!_0x3c79ec||!_0x105f41)return;if(!_0x36ffb5['IpNen'](isInteractive))return;const {save:_0x4ea4e0}=await _0x16a05a[_0xcea68e(0x233)]([{'type':'confirm','name':'save','message':_0xcea68e(0x220),'default':![]}]);if(!_0x4ea4e0)return;await _0x36ffb5['UTpPT'](apiRequest,_0xcea68e(0x191)+encodeURIComponent(_0x239622),{'method':_0x36ffb5[_0xcea68e(0x227)],'body':JSON[_0xcea68e(0x1d4)]({'username':_0x3c79ec,'password':_0x105f41})}),console[_0xcea68e(0x19c)](_0x36ffb5[_0xcea68e(0x21c)]);}export async function resolveCloudProfileSession(_0x33ffcf,_0x4c22a9={}){const _0x55a4c1=_0x34624b,_0x30fb05={'duqtY':function(_0xeda9b5){return _0xeda9b5();},'kKHkz':function(_0x5e6aaa,_0x3ab3d6){return _0x5e6aaa===_0x3ab3d6;},'eBCVD':'string','vZcwc':function(_0x175033,_0x273b0a){return _0x175033(_0x273b0a);},'EAuIo':function(_0x41fc10,_0x121458){return _0x41fc10>_0x121458;},'OVxVi':function(_0x4b82d7,_0x2a8e17,_0x5a7b99,_0x4f3c7e,_0xd4d53b,_0x4ff2b8){return _0x4b82d7(_0x2a8e17,_0x5a7b99,_0x4f3c7e,_0xd4d53b,_0x4ff2b8);},'inkHy':function(_0x8b1e83,_0xdb64df,_0x2fd15c,_0x495605,_0x48229b){return _0x8b1e83(_0xdb64df,_0x2fd15c,_0x495605,_0x48229b);},'DONxv':function(_0x2cfe5a,_0x35812c,_0x589d96){return _0x2cfe5a(_0x35812c,_0x589d96);},'TzHHw':function(_0x1c8593,_0x104b48,_0x39cb1c,_0x5f4187,_0x4a462a,_0x19c28d,_0x2993fd,_0x597530){return _0x1c8593(_0x104b48,_0x39cb1c,_0x5f4187,_0x4a462a,_0x19c28d,_0x2993fd,_0x597530);},'UMLvM':function(_0x21ec4f,_0x12d062){return _0x21ec4f||_0x12d062;},'FVLsd':function(_0x3daff5,_0x305aba){return _0x3daff5===_0x305aba;},'bPCYy':'not_configured','sLNKF':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','bujyx':_0x55a4c1(0x183),'uBWoU':_0x55a4c1(0x1d0),'pttcT':_0x55a4c1(0x1b9),'mWjZi':function(_0x3e4aca,_0x4b7933){return _0x3e4aca instanceof _0x4b7933;},'ZCoyc':function(_0x203d6d,_0x50da4c){return _0x203d6d(_0x50da4c);}},_0x4c0c32=_0x33ffcf['settings']??{},_0x202c0b=await _0x30fb05[_0x55a4c1(0x1b7)](fetchAuthConfig),_0x36ff25=_0x202c0b?resolveAuthEnvironmentLocally(_0x202c0b,_0x33ffcf['environmentKey']):null,_0x7f37be=typeof _0x36ff25?.[_0x55a4c1(0x1ce)]===_0x55a4c1(0x1c9)&&_0x36ff25['loginInstructions']['trim']()?_0x36ff25['loginInstructions']:undefined,_0x1d6bd8=_0x30fb05['kKHkz'](typeof _0x4c0c32[_0x55a4c1(0x1ce)],_0x30fb05[_0x55a4c1(0x1ec)])&&_0x4c0c32['loginInstructions'][_0x55a4c1(0x212)]()?_0x4c0c32[_0x55a4c1(0x1ce)]:undefined,_0x27a766=_0x1d6bd8||!_0x7f37be?_0x4c0c32:{..._0x4c0c32,'loginInstructions':_0x7f37be},_0x38b44d=_0x30fb05[_0x55a4c1(0x192)](Boolean,_0x27a766[_0x55a4c1(0x1ce)]?.[_0x55a4c1(0x212)]()),_0x40f36b=Boolean(_0x4c0c32['forceLogin']||_0x36ff25?.['forceLogin']),_0xb5fea1=_0x36ff25?.['domains'],_0x5261cc=_0x4c0c32['setupHeaders'],_0x5c58be=_0x5261cc??_0x36ff25?.['setupHeaders'],_0x2a0aaa=_0x4c22a9['effectiveBaseUrl']??_0x4c0c32['baseUrl']??(_0xb5fea1&&_0x30fb05['EAuIo'](_0xb5fea1['length'],0x0)?_0xb5fea1[0x0]:''),_0x3ca004=_0x2a0aaa?needsTunnel(_0x2a0aaa):![],_0x1dc633={'invalidateOn':_0x36ff25?.[_0x55a4c1(0x210)],'userAgent':_0x36ff25?.['browserOptions']?.['userAgent']??_0x4c0c32['userAgent']};_0x40f36b&&console['log']('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+_0x55a4c1(0x1e1));if(!_0x40f36b){const _0x1fe7b2=await _0x30fb05[_0x55a4c1(0x1a8)](checkLocalCache,_0x33ffcf['name'],_0x33ffcf[_0x55a4c1(0x203)],_0x2a0aaa,_0x5c58be,_0x1dc633);if(_0x1fe7b2){if(_0x2a0aaa&&!_0x3ca004){const _0x13208a=await _0x30fb05['inkHy'](isCachedSessionLive,_0x1fe7b2['storageStatePath'],_0x2a0aaa,{'sessionCheckPath':_0x36ff25?.['sessionCheckPath'],'setupHeaders':_0x5c58be},{'launchBrowser':launchRealBrowser});if(_0x13208a)return console[_0x55a4c1(0x19c)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x33ffcf['name']+'\x22'),{'authPath':_0x1fe7b2[_0x55a4c1(0x21b)],'settings':_0x27a766,'resolvedEnv':_0x36ff25};console[_0x55a4c1(0x19c)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+_0x55a4c1(0x1a7)),_0x30fb05['DONxv'](emitSessionValidationHint,_0x2a0aaa,_0x36ff25);}else return _0x3ca004&&console['log']('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+'\x22'),{'authPath':_0x1fe7b2[_0x55a4c1(0x21b)],'settings':_0x27a766,'resolvedEnv':_0x36ff25};}}if(!_0x40f36b&&_0x33ffcf[_0x55a4c1(0x1bb)]){if(_0x3ca004)console[_0x55a4c1(0x19c)](_0x55a4c1(0x1b0)+_0x2a0aaa+'\x22\x20on\x20profile\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+'\x22');else{const _0x138626=await _0x30fb05['TzHHw'](writeSessionToLocalCache,_0x33ffcf['name'],_0x33ffcf['organizationId'],_0x2a0aaa,_0x5c58be,_0x33ffcf[_0x55a4c1(0x1bb)],_0xb5fea1,_0x1dc633);if(_0x2a0aaa){const _0x531a3b=await isCachedSessionLive(_0x138626,_0x2a0aaa,{'sessionCheckPath':_0x36ff25?.[_0x55a4c1(0x1d7)],'setupHeaders':_0x5c58be},{'launchBrowser':launchRealBrowser});if(_0x531a3b)return console[_0x55a4c1(0x19c)]('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+'\x22,\x20cached\x20locally'),{'authPath':_0x138626,'settings':_0x27a766,'resolvedEnv':_0x36ff25};console[_0x55a4c1(0x19c)]('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x30fb05[_0x55a4c1(0x1e7)](emitSessionValidationHint,_0x2a0aaa,_0x36ff25);}else return{'authPath':_0x138626,'settings':_0x27a766,'resolvedEnv':_0x36ff25};}}if(_0x38b44d)return console['log'](_0x55a4c1(0x1bd)+_0x33ffcf['name']+_0x55a4c1(0x1c6)),{'authPath':undefined,'settings':_0x27a766,'resolvedEnv':_0x36ff25};console['log']('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x33ffcf[_0x55a4c1(0x1c7)]+_0x55a4c1(0x1fe));const _0x4db9d6=Boolean(process['env'][_0x55a4c1(0x1d3)])&&_0x30fb05['vZcwc'](Boolean,process[_0x55a4c1(0x18b)][_0x55a4c1(0x1f7)]),_0x5f56a7=Boolean(_0x33ffcf['username']);if(_0x30fb05['UMLvM'](_0x4db9d6,_0x5f56a7))try{const _0x1d8e5b=_0x2a0aaa?await serverSideLoginWithOptionalTunnel(_0x33ffcf['name'],_0x2a0aaa,{'force':_0x40f36b,'telemetry':_0x4c22a9['telemetry']}):await _0x30fb05[_0x55a4c1(0x1e7)](serverSideLogin,_0x33ffcf[_0x55a4c1(0x1c7)],{'force':_0x40f36b});if(_0x30fb05[_0x55a4c1(0x18f)](_0x1d8e5b['status'],_0x30fb05[_0x55a4c1(0x1ad)]))console[_0x55a4c1(0x19c)](_0x30fb05[_0x55a4c1(0x228)]);else{if(_0x30fb05[_0x55a4c1(0x18f)](_0x1d8e5b['status'],'success')&&_0x1d8e5b[_0x55a4c1(0x1f1)]){console['log'](_0x30fb05['bujyx']);const _0x2ec836=await _0x30fb05['TzHHw'](writeSessionToLocalCache,_0x33ffcf['name'],_0x33ffcf['organizationId'],_0x2a0aaa,_0x5c58be,_0x1d8e5b[_0x55a4c1(0x1f1)],_0xb5fea1,_0x1dc633);return _0x4db9d6&&!_0x5f56a7&&await promptSaveCredentials(_0x33ffcf[_0x55a4c1(0x1c7)]),{'authPath':_0x2ec836,'settings':_0x27a766,'resolvedEnv':_0x36ff25};}else _0x1d8e5b['test_output']&&(console['log'](_0x30fb05[_0x55a4c1(0x215)]),console[_0x55a4c1(0x19c)](_0x1d8e5b[_0x55a4c1(0x22a)])),console['log'](_0x30fb05['pttcT']);}}catch(_0xc72078){console[_0x55a4c1(0x19c)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0x30fb05[_0x55a4c1(0x231)](_0xc72078,Error)?_0xc72078['message']:_0x30fb05[_0x55a4c1(0x1b2)](String,_0xc72078))),console['log'](_0x30fb05[_0x55a4c1(0x186)]);}const _0x2cdd25=_0x36ff25?{..._0x36ff25,'setupHeaders':_0x5c58be}:_0x2a0aaa?{'key':_0x33ffcf[_0x55a4c1(0x1ef)]??'','domains':[_0x2a0aaa],'setupHeaders':_0x5c58be}:null,{sessionState:_0x2cc045}=await manualBrowserLogin(_0x33ffcf,_0x2cdd25,{'persistSessionState':!_0x3ca004}),_0x3675c6=await writeSessionToLocalCache(_0x33ffcf['name'],_0x33ffcf['organizationId'],_0x2a0aaa,_0x5c58be,_0x2cc045,_0xb5fea1,_0x1dc633);return{'authPath':_0x3675c6,'settings':_0x27a766,'resolvedEnv':_0x36ff25};}
|
|
1
|
+
const _0x4bac8e=_0x24ab;(function(_0x3cefb7,_0xb08a73){const _0xdb78b=_0x24ab,_0x1f311c=_0x3cefb7();while(!![]){try{const _0x2215df=-parseInt(_0xdb78b(0x1e1))/0x1*(parseInt(_0xdb78b(0x1b2))/0x2)+-parseInt(_0xdb78b(0x1ea))/0x3*(parseInt(_0xdb78b(0x1e4))/0x4)+parseInt(_0xdb78b(0x191))/0x5+parseInt(_0xdb78b(0x196))/0x6+parseInt(_0xdb78b(0x178))/0x7+-parseInt(_0xdb78b(0x1a4))/0x8+parseInt(_0xdb78b(0x195))/0x9;if(_0x2215df===_0xb08a73)break;else _0x1f311c['push'](_0x1f311c['shift']());}catch(_0x59cfa0){_0x1f311c['push'](_0x1f311c['shift']());}}}(_0x34c4,0x74eba));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x25107d from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x4a6003){const _0xc96b23=_0x24ab,_0x3b83f6={'yWUQK':'invalid-url'};try{return new URL(_0x4a6003)[_0xc96b23(0x17a)];}catch{return _0x3b83f6[_0xc96b23(0x1ac)];}}function errorMessageForTelemetry(_0x179eab){const _0x52e210={'TUFyg':function(_0x4e1e8a,_0x2c14db){return _0x4e1e8a instanceof _0x2c14db;}};return _0x52e210['TUFyg'](_0x179eab,Error)?_0x179eab['message']:undefined;}function trackBridgeEvent(_0x215f30,_0x581bac){const _0x20e872=_0x24ab,_0x42c35f={'gPEZo':function(_0x575a9d,_0x4a6a95){return _0x575a9d===_0x4a6a95;},'SDnvr':'local_ws_error','xnpeW':'tunnel_bridge'};if(!_0x215f30)return;const _0x19ce99={'tunnelSessionId':_0x581bac[_0x20e872(0x15f)],'tunnelEventType':_0x581bac['type'],'connectionId':_0x581bac[_0x20e872(0x15d)],'code':_0x581bac['code'],'reason':_0x581bac['reason'],'error':_0x581bac[_0x20e872(0x1e3)],'elapsedMs':_0x581bac[_0x20e872(0x18a)],'activeLocalConnections':_0x581bac[_0x20e872(0x17d)],'pendingLocalConnections':_0x581bac['pendingLocalConnections']};_0x215f30[_0x20e872(0x1d4)]('tunnel_bridge_event',_0x19ce99),(_0x42c35f[_0x20e872(0x1ef)](_0x581bac[_0x20e872(0x1b5)],_0x20e872(0x162))||_0x42c35f['gPEZo'](_0x581bac[_0x20e872(0x1b5)],_0x42c35f['SDnvr']))&&void _0x215f30[_0x20e872(0x1e8)](_0x42c35f[_0x20e872(0x1a0)],new Error(_0x581bac['error']??_0x581bac['type']),_0x19ce99);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x4d103c=_0x24ab,_0x359024={'jhBjS':_0x4d103c(0x1f8)},_0x2de857=await getToken();if(!_0x2de857)throw new Error(_0x359024['jhBjS']);return _0x2de857;}function _0x34c4(){const _0x530407=['utf-8','ambiguous','\x20\x20forceLogin\x20enabled\x20for\x20\x22','prompt','Auth\x20environment\x20\x22','4726449fSrmFH','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','host','/api/v1/tunnel/sessions/','confirm','activeLocalConnections','GrmOq','\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.','tunnel_login_request','JUpIu','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','statusText','join','RCVPe','not_configured','storageState','newPage','ukAoe','elapsedMs','\x20\x20No\x20live\x20session\x20for\x20\x22','goto','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','catch','you\x27re\x20now\x20at\x20\x22','trim','2392265dtaQjI','VbCNt','string','oDGNs','5826528FyXuRY','4154766WEmCFI','tKnjN','log','\x22\x20failed\x20validation\x20—\x20refreshing...','RANGER_TUNNEL_LOGIN_HEADED','test_output','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','settings','YFLYX','\x22\x20matched\x20by\x20host\x20for\x20','xnpeW','sessionState','CwJlE','\x20\x20Cloud\x20session\x20for\x20\x22','5353200TkzmPb','BDsBV','\x22.\x0a','clientIp','):\x20','code','tzuVy','password','yWUQK','rUnTn','fBcfq','FaOjJ','isArray','environmentKey','42EjGzBJ','NBrNy','status','type','ehaaD','Iojya','TIliU','defaultEnvironmentKey','WWNhd','username','invalidateOn','trackPhaseStart','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','env','POST','JbsfZ','auth','/api/v1/profiles/','gywRK','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','length','/login','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','storageStatePath','session_state','zITYm','\x20\x20Login\x20successful.\x20Session\x20cached.','TEjIF','/session','browserOptions','RVWzM','profiles','wsEndpoint','AbXym','trackPhaseEnd','userAgent','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','detail','airpa','application/json','force',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','setupHeaders','parse','sessionCheckPath','forceLogin','Cloud\x20profile\x20\x22','25131cLrkNi','replace','error','188UdWRty','telemetry','yfxIj','EUtLH','trackPhaseError','/api/v1/profiles','52194pkyJrC','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','tunnel_login_setup','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','RANGER_TEST_USERNAME','gPEZo','glEgc','xElKP','\x22\x20on\x20profile\x20\x22','obLFB','domains','\x22,\x20refreshing\x20session...','IwzfU','RANGER_TEST_PASSWORD','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','agent','environments','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','/api/v1/tunnel/sessions','aDFiA','iUJJr','\x22;\x20using\x20\x22','dLDnj','jGlTJ','\x20\x20Options:\x0a','WrmhS','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','EuwXC','TDuxI','success','connectionId','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','sessionId','name','true','tunnel_error','cookies','launch','organizationId','loginInstructions','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','tunnel','raw','stringify','close','key','effectiveBaseUrl','ApiError','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','Browser\x20login\x20timed\x20out\x20after\x20','json','targetUrl'];_0x34c4=function(){return _0x530407;};return _0x34c4();}async function apiRequest(_0x318ca3,_0x17cd40={}){const _0x26eb7e=_0x24ab,_0x5362e8={'RVWzM':function(_0x37a73f){return _0x37a73f();},'TIliU':function(_0x144200,_0x3bb011,_0x5e6b89){return _0x144200(_0x3bb011,_0x5e6b89);},'QOykO':function(_0xae88ab,_0x13feb0){return _0xae88ab===_0x13feb0;},'dLDnj':_0x26eb7e(0x193),'yfxIj':function(_0x563fa1,_0x744b6e){return _0x563fa1===_0x744b6e;}},_0x5c0eef=await _0x5362e8[_0x26eb7e(0x1d0)](requireToken),_0x5e3e6f=_0x5362e8['RVWzM'](getApiBaseUrl),_0x4c3e0c=await _0x5362e8[_0x26eb7e(0x1b8)](fetch,''+_0x5e3e6f+_0x318ca3,{..._0x17cd40,'headers':{'Authorization':'Bearer\x20'+_0x5c0eef,'Content-Type':_0x26eb7e(0x1d9),..._0x17cd40['headers']??{}}});if(!_0x4c3e0c['ok']){let _0x302983='',_0x180197;try{const _0x413609=await _0x4c3e0c[_0x26eb7e(0x171)](),_0x29963b=(_0x5362e8['QOykO'](typeof _0x413609[_0x26eb7e(0x1e3)],'string')?_0x413609['error']:undefined)??JSON[_0x26eb7e(0x16a)](_0x413609);_0x302983=_0x29963b;typeof _0x413609['test_output']===_0x5362e8[_0x26eb7e(0x155)]&&_0x413609[_0x26eb7e(0x19b)]&&(_0x302983=_0x302983+'\x0a'+_0x413609[_0x26eb7e(0x19b)]);if(typeof _0x413609[_0x26eb7e(0x1a9)]===_0x5362e8[_0x26eb7e(0x155)])_0x180197=_0x413609[_0x26eb7e(0x1a9)];}catch{_0x302983=_0x4c3e0c[_0x26eb7e(0x183)];}throw new ApiError('API\x20request\x20'+_0x318ca3+'\x20failed\x20('+_0x4c3e0c[_0x26eb7e(0x1b4)]+_0x26eb7e(0x1a8)+_0x302983,_0x4c3e0c[_0x26eb7e(0x1b4)],_0x302983,_0x180197);}if(_0x5362e8[_0x26eb7e(0x1e6)](_0x4c3e0c['status'],0xcc))return undefined;return _0x4c3e0c[_0x26eb7e(0x171)]();}export class ApiError extends Error{[_0x4bac8e(0x1b4)];['detail'];[_0x4bac8e(0x1a9)];constructor(_0x593625,_0x50ecec,_0x4a31da,_0x4bd011){const _0x425495=_0x4bac8e,_0x32be43={'qGmCu':_0x425495(0x16e)};super(_0x593625),this[_0x425495(0x1b4)]=_0x50ecec,this[_0x425495(0x1d7)]=_0x4a31da,this['code']=_0x4bd011,this['name']=_0x32be43['qGmCu'];}}export async function fetchCloudProfile(_0x57bc9a){const _0x113e53=_0x4bac8e,_0x59776e={'WrmhS':function(_0x422354,_0x464e23){return _0x422354(_0x464e23);},'IYsXf':function(_0x375114,_0x153df){return _0x375114(_0x153df);},'rNNTA':function(_0x35920f,_0x272db9){return _0x35920f instanceof _0x272db9;}};try{return await _0x59776e[_0x113e53(0x158)](apiRequest,_0x113e53(0x1c3)+_0x59776e['IYsXf'](encodeURIComponent,_0x57bc9a));}catch(_0x50543c){if(_0x59776e['rNNTA'](_0x50543c,ApiError)&&_0x50543c[_0x113e53(0x1b4)]===0x194)return null;throw _0x50543c;}}export async function listCloudProfiles(){const _0x92e9ee=_0x4bac8e,_0x1f8436={'oDGNs':_0x92e9ee(0x1e9)},_0x5688b6=await apiRequest(_0x1f8436[_0x92e9ee(0x194)]);return _0x5688b6[_0x92e9ee(0x1d1)];}export async function deleteCloudProfile(_0x111084){const _0xc808a4=_0x4bac8e,_0x25af54={'sAOSI':function(_0x5424b2,_0x196c79,_0x26f620){return _0x5424b2(_0x196c79,_0x26f620);},'TDuxI':function(_0x5a456d,_0x3a05a0){return _0x5a456d===_0x3a05a0;}};try{await _0x25af54['sAOSI'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x111084),{'method':'DELETE'});}catch(_0x3a3e6d){if(_0x3a3e6d instanceof ApiError&&_0x25af54[_0xc808a4(0x15b)](_0x3a3e6d[_0xc808a4(0x1b4)],0x194))throw new Error(_0xc808a4(0x1e0)+_0x111084+'\x22\x20not\x20found.');throw _0x3a3e6d;}}function _0x24ab(_0x10993a,_0x4c2f4a){_0x10993a=_0x10993a-0x155;const _0x34c435=_0x34c4();let _0x24ab02=_0x34c435[_0x10993a];return _0x24ab02;}export async function createCloudProfile(_0x30bed3,_0x5a84ab,_0x2b13e9={}){const _0x9e19cf=_0x4bac8e,_0x46b475={'pHyyi':function(_0x3889ed,_0x1ad666){return _0x3889ed>_0x1ad666;},'CwJlE':function(_0x468684,_0x3b5b48,_0xad5980){return _0x468684(_0x3b5b48,_0xad5980);},'CPhIC':_0x9e19cf(0x1c0)},_0x37135a={'name':_0x30bed3};if(_0x5a84ab)_0x37135a['environment_key']=_0x5a84ab;_0x2b13e9[_0x9e19cf(0x19d)]&&_0x46b475['pHyyi'](Object['keys'](_0x2b13e9[_0x9e19cf(0x19d)])['length'],0x0)&&(_0x37135a[_0x9e19cf(0x19d)]=_0x2b13e9['settings']);if(_0x2b13e9[_0x9e19cf(0x1bb)])_0x37135a['username']=_0x2b13e9[_0x9e19cf(0x1bb)];if(_0x2b13e9[_0x9e19cf(0x1ab)])_0x37135a['password']=_0x2b13e9[_0x9e19cf(0x1ab)];return await _0x46b475[_0x9e19cf(0x1a2)](apiRequest,'/api/v1/profiles',{'method':_0x46b475['CPhIC'],'body':JSON[_0x9e19cf(0x16a)](_0x37135a)});}export async function uploadCloudProfileSession(_0x32a4b1,_0x3596be){const _0x119e72=_0x4bac8e,_0x3c543a={'tmOTI':function(_0x82c93f,_0x2ad552,_0x14faaa){return _0x82c93f(_0x2ad552,_0x14faaa);}};return await _0x3c543a['tmOTI'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x32a4b1)+_0x119e72(0x1ce),{'method':'POST','body':JSON['stringify']({'session_state':_0x3596be})});}export async function saveCloudProfileCredentials(_0x274aa6,_0x2033da,_0x39dd60){const _0x5d211e=_0x4bac8e,_0x11e566={'sYDRR':'PUT'};await apiRequest(_0x5d211e(0x1c3)+encodeURIComponent(_0x274aa6),{'method':_0x11e566['sYDRR'],'body':JSON[_0x5d211e(0x16a)]({'username':_0x2033da,'password':_0x39dd60})});}export async function fetchAuthConfig(){const _0x5badf7=_0x4bac8e;try{const _0x27a2be=await apiRequest('/api/v1/profiles/auth-config');return _0x27a2be['auth_config'];}catch(_0x3399d8){return _0x3399d8 instanceof ApiError&&_0x3399d8['status']!==0x194&&console[_0x5badf7(0x1e3)](_0x5badf7(0x16f)+_0x3399d8['message']),null;}}async function createTunnelSession(_0x529c22){const _0x1b9c82=_0x4bac8e;return await apiRequest(_0x1b9c82(0x1fc),{'method':'POST','body':JSON['stringify']({'targetUrl':_0x529c22,'mode':_0x1b9c82(0x1f9)})});}async function deleteTunnelSession(_0x14bea9){const _0x157009=_0x4bac8e,_0x20dad2={'JUpIu':'DELETE'};await apiRequest(_0x157009(0x17b)+_0x14bea9,{'method':_0x20dad2[_0x157009(0x181)]});}export function pickAdHocEnvKey(_0x1ed67e,_0x53ffd8,_0x5cc9ee){const _0x4d07fe=_0x4bac8e,_0x54a498={'MOFvV':function(_0xabcf8c,_0x21ff8d,_0x4ce2e9){return _0xabcf8c(_0x21ff8d,_0x4ce2e9);},'TEjIF':function(_0x1beef4,_0x151397){return _0x1beef4 in _0x151397;},'Iojya':_0x4d07fe(0x16c),'EuwXC':function(_0x4033fc,_0x52ad05){return _0x4033fc(_0x52ad05);},'glEgc':function(_0x3124ba,_0x21d6a3){return _0x3124ba+_0x21d6a3;},'aDFiA':function(_0x3f38c3,_0x4c2585){return _0x3f38c3+_0x4c2585;}};if(_0x5cc9ee){if(!_0x1ed67e?.['environments']?.[_0x5cc9ee]){const _0x592360=Object['keys'](_0x1ed67e?.[_0x4d07fe(0x1fa)]??{});throw new Error(_0x4d07fe(0x177)+_0x5cc9ee+'\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.'+(_0x592360[_0x4d07fe(0x1c6)]?'\x20Available:\x20'+_0x592360[_0x4d07fe(0x184)](',\x20')+'.':_0x4d07fe(0x167))+'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)');}return _0x5cc9ee;}if(!_0x1ed67e)return null;if(_0x53ffd8){const _0x48d736=_0x54a498['MOFvV'](matchAuthEnvironmentExact,_0x53ffd8,_0x1ed67e);if(_0x48d736)return _0x48d736;const _0x37ba3b=matchAuthEnvironmentByHost(_0x53ffd8,_0x1ed67e);if(_0x37ba3b&&_0x54a498[_0x4d07fe(0x1cd)](_0x54a498[_0x4d07fe(0x1b7)],_0x37ba3b))return console[_0x4d07fe(0x198)]('\x20\x20Auth\x20env\x20\x22'+_0x37ba3b['key']+_0x4d07fe(0x19f)+_0x53ffd8+'\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).'),_0x37ba3b['key'];if(_0x37ba3b&&_0x4d07fe(0x174)in _0x37ba3b)throw new Error(_0x4d07fe(0x1be)+_0x37ba3b[_0x4d07fe(0x174)][_0x4d07fe(0x184)](',\x20')+_0x4d07fe(0x1db));if(_0x54a498[_0x4d07fe(0x15a)](needsTunnel,_0x53ffd8))throw new Error(_0x54a498['glEgc'](_0x54a498[_0x4d07fe(0x1f0)](_0x54a498['glEgc']('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x53ffd8+_0x4d07fe(0x1a6)+'\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a',_0x4d07fe(0x157)),'\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a'),'\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x53ffd8[_0x4d07fe(0x1e2)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a')+('\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20'+_0x53ffd8+_0x4d07fe(0x17f)));}if(_0x1ed67e['defaultEnvironmentKey'])return _0x1ed67e['defaultEnvironmentKey'];const _0x156e0f=Object['keys'](_0x1ed67e[_0x4d07fe(0x1fa)]??{});if(_0x156e0f[_0x4d07fe(0x1c6)]===0x1)return _0x156e0f[0x0];if(_0x156e0f['length']===0x0)return null;throw new Error(_0x54a498[_0x4d07fe(0x1fd)]('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x156e0f['join'](',\x20')+').\x20','Pass\x20--base-url\x20<your-app-url>\x20so\x20Ranger\x20can\x20match\x20the\x20right\x20one,\x20or\x20create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`.'));}export function adHocProfileName(_0x3380e2,_0x48b488,_0x3f3d92){if(!_0x48b488||_0x48b488===_0x3f3d92)return _0x3380e2;return _0x3380e2+':'+_0x48b488;}export async function resolveAdHocProfile(_0x4854e9={},_0x117e51=process[_0x4bac8e(0x1bf)]){const _0xb8c278=_0x4bac8e,_0x26a616={'RouDM':'none','IwzfU':function(_0x3035b7,_0x57aa5c){return _0x3035b7(_0x57aa5c);},'WWNhd':function(_0x29a87b,_0x65f629,_0x4acbfc,_0x3460f6){return _0x29a87b(_0x65f629,_0x4acbfc,_0x3460f6);}},_0x5d4d2e=_0x117e51['RANGER_TEST_USERNAME'];if(!_0x5d4d2e)return null;const _0x3c5f7e=await fetchAuthConfig(),_0x230721=pickAdHocEnvKey(_0x3c5f7e,_0x4854e9[_0xb8c278(0x172)],_0x4854e9['envKey']);let _0x1c45cc=adHocProfileName(_0x5d4d2e,_0x230721,_0x3c5f7e?.[_0xb8c278(0x1b9)]),_0x1c4e96=await fetchCloudProfile(_0x1c45cc);_0x1c4e96&&_0x230721&&_0x1c4e96[_0xb8c278(0x1b1)]!==_0x230721&&(console['log']('\x20\x20Cloud\x20profile\x20\x22'+_0x1c45cc+'\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22'+(_0x1c4e96['environmentKey']??_0x26a616['RouDM'])+_0xb8c278(0x1eb)+_0x230721+_0xb8c278(0x1ff)+_0x5d4d2e+':'+_0x230721+'\x22\x20instead.'),_0x1c45cc=_0x5d4d2e+':'+_0x230721,_0x1c4e96=await _0x26a616[_0xb8c278(0x1f6)](fetchCloudProfile,_0x1c45cc));if(_0x1c4e96)return{'name':_0x1c4e96['name'],'profile':_0x1c4e96};const _0x455ccd=_0x117e51[_0xb8c278(0x1f7)],_0x5ad473=await _0x26a616[_0xb8c278(0x1ba)](createCloudProfile,_0x1c45cc,_0x230721??undefined,{'username':_0x5d4d2e,'password':_0x455ccd});return console[_0xb8c278(0x198)]('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x5ad473['name']+'\x22\x20for\x20'+_0x5d4d2e+(_0x230721?'\x20(auth\x20env:\x20'+_0x230721+')':'')),{'name':_0x5ad473[_0xb8c278(0x160)],'profile':_0x5ad473};}export async function writeSessionToLocalCache(_0x1a9fcc,_0xf19486,_0x2b0e4c,_0x40e459,_0x138a5f,_0x2ac039,_0x25b3c4){const _0x4b4407=_0x4bac8e,_0x481457={'TRuqH':function(_0x49729d){return _0x49729d();},'xoBUd':_0x4b4407(0x1c2),'xElKP':function(_0x5bf479,_0x359553,_0xcb6db8){return _0x5bf479(_0x359553,_0xcb6db8);},'vUxiH':function(_0x54f1d3,_0x4c48d8,_0x413b7e){return _0x54f1d3(_0x4c48d8,_0x413b7e);},'XCGNn':function(_0x1a4b05,_0x2279be,_0x4b8cf6){return _0x1a4b05(_0x2279be,_0x4b8cf6);},'WGxny':function(_0x5f4b57,_0x214d99){return _0x5f4b57(_0x214d99);}},_0xced09e=sessionCacheHash({'orgId':_0xf19486,'profileName':_0x1a9fcc,'effectiveBaseUrl':_0x2b0e4c,'setupHeaders':_0x40e459,'invalidateOn':_0x25b3c4?.['invalidateOn'],'userAgent':_0x25b3c4?.[_0x4b4407(0x1d5)],'clientIp':_0x25b3c4?.['clientIp']}),_0x4b669f=getSessionCachePath(_0xced09e,_0x1a9fcc),_0x1913ea=join(_0x481457['TRuqH'](getRangerHomeDir),_0x481457['xoBUd']);!existsSync(_0x1913ea)&&await _0x481457[_0x4b4407(0x1f1)](mkdir,_0x1913ea,{'recursive':!![]});const _0x4ac7aa={..._0x138a5f};_0x2ac039&&_0x2ac039['length']>0x0&&Array[_0x4b4407(0x1b0)](_0x4ac7aa['cookies'])&&(_0x4ac7aa['cookies']=_0x481457['vUxiH'](duplicateCookiesForDomains,_0x4ac7aa[_0x4b4407(0x163)],_0x2ac039));const _0xf9c022={'cached_at':new Date()['toISOString'](),'session_state':_0x4ac7aa};await _0x481457['XCGNn'](writeFile,_0x4b669f,JSON['stringify'](_0xf9c022,null,0x2));const _0x2909da=_0x481457['WGxny'](getStorageStatePath,_0x4b669f);return await writeFile(_0x2909da,JSON['stringify'](_0x4ac7aa,null,0x2)),_0x2909da;}export async function checkLocalCache(_0x5edfe5,_0x1a3a95,_0xac23d9,_0x46f20c,_0x2b0ca2){const _0x524ad2=_0x4bac8e,_0x10bf1b={'FZoxY':function(_0x1df707,_0x196f9f,_0x4e5b02){return _0x1df707(_0x196f9f,_0x4e5b02);},'nEVdD':function(_0xae44d6,_0x14b03f){return _0xae44d6(_0x14b03f);},'iUJJr':function(_0x2f6fdf,_0x58cb52,_0x3ed551){return _0x2f6fdf(_0x58cb52,_0x3ed551);}},_0x518f91=sessionCacheHash({'orgId':_0x1a3a95,'profileName':_0x5edfe5,'effectiveBaseUrl':_0xac23d9,'setupHeaders':_0x46f20c,'invalidateOn':_0x2b0ca2?.[_0x524ad2(0x1bc)],'userAgent':_0x2b0ca2?.[_0x524ad2(0x1d5)],'clientIp':_0x2b0ca2?.[_0x524ad2(0x1a7)]}),_0x4ba44a=_0x10bf1b['FZoxY'](getSessionCachePath,_0x518f91,_0x5edfe5),_0x569139=getStorageStatePath(_0x4ba44a);if(!existsSync(_0x4ba44a)||!_0x10bf1b['nEVdD'](existsSync,_0x569139))return null;try{const _0x25b567=await _0x10bf1b[_0x524ad2(0x1fe)](readFile,_0x4ba44a,_0x524ad2(0x173));return JSON[_0x524ad2(0x1dd)](_0x25b567),{'storageStatePath':_0x569139};}catch{return null;}}function launchRealBrowser(){const _0x8f7cc4=_0x4bac8e;return chromium[_0x8f7cc4(0x164)]({'headless':!![]});}function emitSessionValidationHint(_0x54de2f,_0x4f5542){const _0x17f3e3=_0x4bac8e;if(!_0x4f5542||!_0x4f5542[_0x17f3e3(0x1f4)]?.[_0x17f3e3(0x1c6)])return;let _0x52c08a;try{_0x52c08a=new URL(_0x54de2f);}catch{return;}const _0x5b577e=[];for(const _0xf24fb2 of _0x4f5542[_0x17f3e3(0x1f4)]){try{_0x5b577e['push']({'raw':_0xf24fb2,'url':new URL(_0xf24fb2)});}catch{}}if(_0x5b577e['length']===0x0)return;if(_0x5b577e['some'](_0x5090f5=>_0x5090f5['url']['origin']===_0x52c08a['origin']))return;const _0x4a2d08=_0x5b577e['map'](_0x26e81b=>'\x22'+_0x26e81b[_0x17f3e3(0x169)]+'\x22')[_0x17f3e3(0x184)](',\x20');console[_0x17f3e3(0x198)](_0x17f3e3(0x19c)+_0x4a2d08+';\x20'+(_0x17f3e3(0x18f)+_0x54de2f+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.');}export async function serverSideLogin(_0x2c6eb5,_0x110e49){const _0x3ac140=_0x4bac8e,_0x2f4e29={'zITYm':'POST','SVpwh':function(_0x3f17dd,_0x1aca25){return _0x3f17dd===_0x1aca25;},'rUnTn':_0x3ac140(0x186)},_0x5af870=process[_0x3ac140(0x1bf)][_0x3ac140(0x1ee)],_0x32fb79=process['env'][_0x3ac140(0x1f7)],_0x50e0dc={};if(_0x5af870)_0x50e0dc[_0x3ac140(0x1bb)]=_0x5af870;if(_0x32fb79)_0x50e0dc[_0x3ac140(0x1ab)]=_0x32fb79;if(_0x110e49?.['force'])_0x50e0dc[_0x3ac140(0x1da)]=!![];if(_0x110e49?.[_0x3ac140(0x172)])_0x50e0dc['target_url']=_0x110e49[_0x3ac140(0x172)];_0x110e49?.[_0x3ac140(0x168)]&&(_0x50e0dc['tunnel_session_id']=_0x110e49['tunnel'][_0x3ac140(0x15f)],_0x50e0dc['pw_endpoint']=_0x110e49['tunnel']['pwEndpoint']);try{return await apiRequest(_0x3ac140(0x1c3)+encodeURIComponent(_0x2c6eb5)+_0x3ac140(0x1c7),{'method':_0x2f4e29[_0x3ac140(0x1cb)],'body':JSON['stringify'](_0x50e0dc)});}catch(_0x595c9b){if(_0x595c9b instanceof ApiError&&_0x595c9b[_0x3ac140(0x1b4)]===0x190&&_0x2f4e29['SVpwh'](_0x595c9b[_0x3ac140(0x1a9)],'not_configured'))return{'status':_0x2f4e29[_0x3ac140(0x1ad)],'error':_0x595c9b[_0x3ac140(0x1d7)]};throw _0x595c9b;}}async function serverSideLoginWithOptionalTunnel(_0x4df715,_0xe867b,_0x3f038c={}){const _0x4cf0c2=_0x4bac8e,_0xfe303c={'FxnuU':function(_0xc0e38c,_0x37f536){return _0xc0e38c(_0x37f536);},'jGlTJ':function(_0x3b32fb,_0xe97824){return _0x3b32fb===_0xe97824;},'NBrNy':_0x4cf0c2(0x1ec),'ySoso':_0x4cf0c2(0x1ed),'yRkrN':function(_0x59c51f,_0x254ff7){return _0x59c51f(_0x254ff7);},'JbsfZ':_0x4cf0c2(0x180),'pfHMb':function(_0x2904e1,_0x5c0523,_0x126e56){return _0x2904e1(_0x5c0523,_0x126e56);},'dRMDd':function(_0x5cfc68,_0x3d48c2){return _0x5cfc68(_0x3d48c2);},'YFLYX':function(_0x3d0abb,_0x192989){return _0x3d0abb(_0x192989);}};if(!_0xfe303c['FxnuU'](needsTunnel,_0xe867b))return await serverSideLogin(_0x4df715,{'force':_0x3f038c['force']});let _0x412a51=null,_0x37f1c1=null,_0x38e643=null,_0x3a4cbd=null,_0x185ce8=![];const _0x19798b=process['env'][_0x4cf0c2(0x19a)]?.['toLowerCase'](),_0x4df15c=_0x19798b==='1'||_0xfe303c[_0x4cf0c2(0x156)](_0x19798b,_0x4cf0c2(0x161)),_0x1a1a8c={'profileName':_0x4df715,'targetUrlHost':targetHostForTelemetry(_0xe867b),'tunnelRequired':!![],'forceLogin':Boolean(_0x3f038c[_0x4cf0c2(0x1da)]),'localBrowserServerHeaded':_0x4df15c};try{_0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1bd)](_0xfe303c[_0x4cf0c2(0x1b3)],_0x1a1a8c);_0x4df15c&&console[_0x4cf0c2(0x198)](_0xfe303c['ySoso']);_0x412a51=await launchBrowserServer({'headless':!_0x4df15c}),_0x37f1c1=await createTunnelSession(_0xe867b);const _0x2c3756=await requireToken();_0x38e643=await _0xfe303c['yRkrN'](createTunnelBridge,{'localWsUrl':_0x412a51[_0x4cf0c2(0x1d2)],'tunnelServerUrl':_0x37f1c1['tunnelUrl'],'sessionId':_0x37f1c1[_0x4cf0c2(0x15f)],'apiKey':_0x2c3756,'onError':_0x4916d5=>{_0x3a4cbd=_0x4916d5;},'onClose':()=>{const _0x3c73a5=_0x4cf0c2;_0x3a4cbd??=new Error(_0x3c73a5(0x18d)+_0x4df715);},'onEvent':_0x3c76df=>trackBridgeEvent(_0x3f038c[_0x4cf0c2(0x1e5)],_0x3c76df)}),_0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1d4)](_0xfe303c[_0x4cf0c2(0x1b3)],{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1[_0x4cf0c2(0x15f)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x4df15c}),_0x185ce8=!![];try{return _0x3f038c['telemetry']?.[_0x4cf0c2(0x1bd)](_0xfe303c[_0x4cf0c2(0x1c1)],{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1['sessionId']}),await _0xfe303c['pfHMb'](serverSideLogin,_0x4df715,{'force':_0x3f038c['force'],'targetUrl':_0xe867b,'tunnel':{'sessionId':_0x37f1c1[_0x4cf0c2(0x15f)],'pwEndpoint':_0x37f1c1['pwEndpoint']}})['then'](_0x185586=>{const _0x44bf01=_0x4cf0c2;return _0x3f038c['telemetry']?.[_0x44bf01(0x1d4)](_0x44bf01(0x180),{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x44bf01(0x15f)],'loginStatus':_0x185586[_0x44bf01(0x1b4)],'hasSessionState':_0xfe303c['FxnuU'](Boolean,_0x185586[_0x44bf01(0x1ca)]),'hasTestOutput':Boolean(_0x185586[_0x44bf01(0x19b)]),'bridgeError':_0xfe303c['FxnuU'](errorMessageForTelemetry,_0x3a4cbd)}),_0x185586;});}catch(_0x420eec){await _0x3f038c['telemetry']?.[_0x4cf0c2(0x1e8)](_0xfe303c['JbsfZ'],_0x3a4cbd??_0x420eec,{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1['sessionId'],'bridgeError':_0xfe303c['dRMDd'](errorMessageForTelemetry,_0x3a4cbd)});throw _0x3a4cbd??_0x420eec;}}catch(_0x5f38f2){!_0x185ce8&&await _0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1e8)](_0x4cf0c2(0x1ec),_0x5f38f2,{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x4cf0c2(0x15f)]});throw _0x5f38f2;}finally{(_0x37f1c1||_0x412a51||_0x38e643)&&(_0x3f038c['telemetry']?.[_0x4cf0c2(0x1bd)]('tunnel_login_cleanup',{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x4cf0c2(0x15f)]}),_0x38e643?.[_0x4cf0c2(0x16b)](),_0x412a51&&await _0x412a51[_0x4cf0c2(0x16b)]()['catch'](()=>{}),_0x37f1c1&&await _0xfe303c[_0x4cf0c2(0x19e)](deleteTunnelSession,_0x37f1c1['sessionId'])[_0x4cf0c2(0x18e)](()=>{}),_0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1d4)]('tunnel_login_cleanup',{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x4cf0c2(0x15f)]}));}}export async function manualBrowserLogin(_0xfdd2f7,_0x11e038,_0xcb9f00={}){const _0x217c5f=_0x4bac8e,_0x4ff482={'ukAoe':function(_0x68c206){return _0x68c206();},'EUtLH':function(_0x2adf3b,_0x1845f5,_0x31c07a){return _0x2adf3b(_0x1845f5,_0x31c07a);},'tKnjN':function(_0x5ec392){return _0x5ec392();},'tzuVy':function(_0x1e59dd,_0x164b1b){return _0x1e59dd+_0x164b1b;},'AbXym':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','FaOjJ':'about:blank','aYoIo':'Browser\x20closed\x20before\x20authentication\x20was\x20saved.'};if(!_0x4ff482[_0x217c5f(0x197)](isInteractive))throw new Error(_0x4ff482[_0x217c5f(0x1aa)](_0x4ff482[_0x217c5f(0x1aa)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0xfdd2f7['name']+_0x217c5f(0x1a6),'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20'),_0x4ff482[_0x217c5f(0x1d3)]));const _0x22502b=_0x11e038&&_0x11e038[_0x217c5f(0x1f4)][_0x217c5f(0x1c6)]>0x0?_0x11e038[_0x217c5f(0x1f4)][0x0]:_0x4ff482[_0x217c5f(0x1af)];console[_0x217c5f(0x198)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console['log']('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x10f889=>setTimeout(_0x10f889,0x7d0));const _0x4486d3=await chromium[_0x217c5f(0x164)]({'headless':![]});let _0x225cd9=null;try{const _0x1479ae={'ignoreHTTPSErrors':!![]};_0x11e038?.['setupHeaders']&&(_0x1479ae['extraHTTPHeaders']=_0x11e038['setupHeaders']);const _0x15d372=await _0x4486d3['newContext'](_0x1479ae);await addProfileSetupBanner(_0x15d372);const _0x187a4d=await _0x15d372[_0x217c5f(0x188)]();await _0x187a4d[_0x217c5f(0x18c)](_0x22502b);let _0x24d02b=![];await new Promise(_0x4d8059=>{const _0x21d1c4=_0x217c5f,_0xfa511b=_0x4ff482[_0x21d1c4(0x1e7)](setTimeout,()=>{const _0x2a9ac1=_0x21d1c4;_0x24d02b=!![],console['error'](_0x2a9ac1(0x170)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x4ff482['ukAoe'](_0x4d8059);},MANUAL_LOGIN_TIMEOUT_MS);_0x187a4d['on']('close',async()=>{const _0x2bac68=_0x21d1c4;clearTimeout(_0xfa511b);try{const _0x58901c=await _0x15d372[_0x2bac68(0x187)]();_0x225cd9=_0x58901c;}catch{}_0x4ff482[_0x2bac68(0x189)](_0x4d8059);});});if(_0x24d02b&&!_0x225cd9)throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x4486d3[_0x217c5f(0x16b)]()[_0x217c5f(0x18e)](()=>{});}if(!_0x225cd9)throw new Error(_0x4ff482['aYoIo']);return _0xcb9f00['persistSessionState']!==![]&&await _0x4ff482['EUtLH'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0xfdd2f7['name'])+'/session',{'method':_0x217c5f(0x1c0),'body':JSON['stringify']({'session_state':_0x225cd9,'updated_by':'cli:manual-login'})}),{'sessionState':_0x225cd9};}export async function promptSaveCredentials(_0x59d87e){const _0x4ac7a1=_0x4bac8e,_0x3f3550={'ehaaD':function(_0x20efb,_0x2f9d7e){return _0x20efb||_0x2f9d7e;},'VbCNt':_0x4ac7a1(0x182),'isGYn':function(_0x42fd8e,_0x5533f1,_0x45255c){return _0x42fd8e(_0x5533f1,_0x45255c);},'fBcfq':'PUT'},_0x519c3a=process['env'][_0x4ac7a1(0x1ee)],_0x4650cd=process[_0x4ac7a1(0x1bf)]['RANGER_TEST_PASSWORD'];if(_0x3f3550[_0x4ac7a1(0x1b6)](!_0x519c3a,!_0x4650cd))return;if(!isInteractive())return;const {save:_0x9b5fa5}=await _0x25107d[_0x4ac7a1(0x176)]([{'type':_0x4ac7a1(0x17c),'name':'save','message':_0x3f3550[_0x4ac7a1(0x192)],'default':![]}]);if(!_0x9b5fa5)return;await _0x3f3550['isGYn'](apiRequest,_0x4ac7a1(0x1c3)+encodeURIComponent(_0x59d87e),{'method':_0x3f3550[_0x4ac7a1(0x1ae)],'body':JSON['stringify']({'username':_0x519c3a,'password':_0x4650cd})}),console['log'](_0x4ac7a1(0x179));}export async function resolveCloudProfileSession(_0x672803,_0x38409d={}){const _0x4afa7c=_0x4bac8e,_0xc182a={'GjEZc':function(_0x449374){return _0x449374();},'TGKSy':function(_0x270fd5,_0x2f06cc,_0x54fe52){return _0x270fd5(_0x2f06cc,_0x54fe52);},'BDsBV':function(_0x3d77c6,_0x583c22){return _0x3d77c6===_0x583c22;},'airpa':_0x4afa7c(0x193),'PUAyj':function(_0x2cfd62,_0x47198d){return _0x2cfd62(_0x47198d);},'MDRja':function(_0x40de80,_0x24129d,_0x4880c7,_0x3e3f15,_0x5098b3,_0x6033ba){return _0x40de80(_0x24129d,_0x4880c7,_0x3e3f15,_0x5098b3,_0x6033ba);},'obLFB':function(_0x3b84b7,_0x359cc7){return _0x3b84b7&&_0x359cc7;},'uKDzV':function(_0x4c4a6f,_0x4e7df7,_0xd6bd43){return _0x4c4a6f(_0x4e7df7,_0xd6bd43);},'gcFnY':function(_0x2b40f4,_0x545531,_0x5d27c4,_0x482ad1,_0x38aaec){return _0x2b40f4(_0x545531,_0x5d27c4,_0x482ad1,_0x38aaec);},'vusBl':function(_0x49338f,_0x12afaa,_0xe4c00f){return _0x49338f(_0x12afaa,_0xe4c00f);},'zKkpy':function(_0x402845,_0x208f45){return _0x402845(_0x208f45);},'wXKFP':function(_0xf88672,_0x5e789b){return _0xf88672||_0x5e789b;},'SbQgm':function(_0x5c9c62,_0x160a78,_0x41e7b4,_0x31a4de){return _0x5c9c62(_0x160a78,_0x41e7b4,_0x31a4de);},'WBpHT':_0x4afa7c(0x186),'gywRK':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','RCVPe':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','ATBGN':function(_0x265262,_0x3b9c03){return _0x265262 instanceof _0x3b9c03;},'PvroN':function(_0x1f1f8e,_0x5cc158){return _0x1f1f8e(_0x5cc158);},'GrmOq':function(_0x1f2141,_0x199cb2,_0x2a2005,_0x392c9c,_0x58893e,_0x3be7f6,_0x44262c,_0x42c55a){return _0x1f2141(_0x199cb2,_0x2a2005,_0x392c9c,_0x58893e,_0x3be7f6,_0x44262c,_0x42c55a);}},_0x3a4d07=_0x672803[_0x4afa7c(0x19d)]??{},_0x385bb4=await _0xc182a['GjEZc'](fetchAuthConfig),_0x2b5569=_0x385bb4?_0xc182a['TGKSy'](resolveAuthEnvironmentLocally,_0x385bb4,_0x672803[_0x4afa7c(0x1b1)]):null,_0xc56582=typeof _0x2b5569?.['loginInstructions']==='string'&&_0x2b5569['loginInstructions']['trim']()?_0x2b5569[_0x4afa7c(0x166)]:undefined,_0x57abea=_0xc182a[_0x4afa7c(0x1a5)](typeof _0x3a4d07[_0x4afa7c(0x166)],_0xc182a[_0x4afa7c(0x1d8)])&&_0x3a4d07['loginInstructions'][_0x4afa7c(0x190)]()?_0x3a4d07['loginInstructions']:undefined,_0x462dc5=_0x57abea||!_0xc56582?_0x3a4d07:{..._0x3a4d07,'loginInstructions':_0xc56582},_0x282aa3=_0xc182a['PUAyj'](Boolean,_0x462dc5['loginInstructions']?.['trim']()),_0x13bbc8=_0xc182a['PUAyj'](Boolean,_0x3a4d07[_0x4afa7c(0x1df)]||_0x2b5569?.[_0x4afa7c(0x1df)]),_0x2cea7e=_0x2b5569?.['domains'],_0x53073e=_0x3a4d07['setupHeaders'],_0x1a0971=_0x53073e??_0x2b5569?.[_0x4afa7c(0x1dc)],_0xc3b665=_0x38409d[_0x4afa7c(0x16d)]??_0x3a4d07['baseUrl']??(_0x2cea7e&&_0x2cea7e[_0x4afa7c(0x1c6)]>0x0?_0x2cea7e[0x0]:''),_0x49183f=_0xc3b665?_0xc182a['PUAyj'](needsTunnel,_0xc3b665):![],_0x29faaf={'invalidateOn':_0x2b5569?.['invalidateOn'],'userAgent':_0x2b5569?.[_0x4afa7c(0x1cf)]?.[_0x4afa7c(0x1d5)]??_0x3a4d07['userAgent']};_0x13bbc8&&console[_0x4afa7c(0x198)](_0x4afa7c(0x175)+_0x672803['name']+_0x4afa7c(0x1f5));if(!_0x13bbc8){const _0x428aac=await _0xc182a['MDRja'](checkLocalCache,_0x672803[_0x4afa7c(0x160)],_0x672803[_0x4afa7c(0x165)],_0xc3b665,_0x1a0971,_0x29faaf);if(_0x428aac){if(_0xc182a[_0x4afa7c(0x1f3)](_0xc3b665,!_0x49183f)){const _0xf3f3bc=await isCachedSessionLive(_0x428aac[_0x4afa7c(0x1c9)],_0xc3b665,{'sessionCheckPath':_0x2b5569?.['sessionCheckPath'],'setupHeaders':_0x1a0971},{'launchBrowser':launchRealBrowser});if(_0xf3f3bc)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x672803[_0x4afa7c(0x160)]+'\x22'),{'authPath':_0x428aac['storageStatePath'],'settings':_0x462dc5,'resolvedEnv':_0x2b5569};console['log']('\x20\x20Cached\x20session\x20for\x20\x22'+_0x672803[_0x4afa7c(0x160)]+_0x4afa7c(0x199)),_0xc182a['uKDzV'](emitSessionValidationHint,_0xc3b665,_0x2b5569);}else return _0x49183f&&console[_0x4afa7c(0x198)](_0x4afa7c(0x1c5)+_0x672803['name']+'\x22'),{'authPath':_0x428aac['storageStatePath'],'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}}if(!_0x13bbc8&&_0x672803['sessionState']){if(_0x49183f)console[_0x4afa7c(0x198)](_0x4afa7c(0x1fb)+_0xc3b665+_0x4afa7c(0x1f2)+_0x672803['name']+'\x22');else{const _0x13181a=await writeSessionToLocalCache(_0x672803[_0x4afa7c(0x160)],_0x672803[_0x4afa7c(0x165)],_0xc3b665,_0x1a0971,_0x672803[_0x4afa7c(0x1a1)],_0x2cea7e,_0x29faaf);if(_0xc3b665){const _0x41e47a=await _0xc182a['gcFnY'](isCachedSessionLive,_0x13181a,_0xc3b665,{'sessionCheckPath':_0x2b5569?.[_0x4afa7c(0x1de)],'setupHeaders':_0x1a0971},{'launchBrowser':launchRealBrowser});if(_0x41e47a)return console[_0x4afa7c(0x198)](_0x4afa7c(0x1c8)+_0x672803['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x13181a,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};console['log'](_0x4afa7c(0x1a3)+_0x672803[_0x4afa7c(0x160)]+_0x4afa7c(0x1d6)),_0xc182a['vusBl'](emitSessionValidationHint,_0xc3b665,_0x2b5569);}else return{'authPath':_0x13181a,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}}if(_0x282aa3)return console['log'](_0x4afa7c(0x18b)+_0x672803[_0x4afa7c(0x160)]+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};console[_0x4afa7c(0x198)](_0x4afa7c(0x18b)+_0x672803['name']+'\x22,\x20attempting\x20login...');const _0x1d48a9=Boolean(process['env']['RANGER_TEST_USERNAME'])&&_0xc182a['zKkpy'](Boolean,process[_0x4afa7c(0x1bf)]['RANGER_TEST_PASSWORD']),_0x41038a=Boolean(_0x672803[_0x4afa7c(0x1bb)]);if(_0xc182a['wXKFP'](_0x1d48a9,_0x41038a))try{const _0x2f806c=_0xc3b665?await _0xc182a['SbQgm'](serverSideLoginWithOptionalTunnel,_0x672803['name'],_0xc3b665,{'force':_0x13bbc8,'telemetry':_0x38409d['telemetry']}):await serverSideLogin(_0x672803[_0x4afa7c(0x160)],{'force':_0x13bbc8});if(_0x2f806c[_0x4afa7c(0x1b4)]===_0xc182a['WBpHT'])console[_0x4afa7c(0x198)](_0xc182a[_0x4afa7c(0x1c4)]);else{if(_0x2f806c[_0x4afa7c(0x1b4)]===_0x4afa7c(0x15c)&&_0x2f806c[_0x4afa7c(0x1ca)]){console[_0x4afa7c(0x198)](_0x4afa7c(0x1cc));const _0x489096=await writeSessionToLocalCache(_0x672803['name'],_0x672803['organizationId'],_0xc3b665,_0x1a0971,_0x2f806c['session_state'],_0x2cea7e,_0x29faaf);return _0x1d48a9&&!_0x41038a&&await promptSaveCredentials(_0x672803[_0x4afa7c(0x160)]),{'authPath':_0x489096,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}else _0x2f806c[_0x4afa7c(0x19b)]&&(console[_0x4afa7c(0x198)](_0x4afa7c(0x15e)),console[_0x4afa7c(0x198)](_0x2f806c[_0x4afa7c(0x19b)])),console[_0x4afa7c(0x198)](_0xc182a[_0x4afa7c(0x185)]);}}catch(_0x5a186e){console[_0x4afa7c(0x198)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0xc182a['ATBGN'](_0x5a186e,Error)?_0x5a186e['message']:_0xc182a['PvroN'](String,_0x5a186e))),console['log'](_0x4afa7c(0x159));}const _0x448177=_0x2b5569?{..._0x2b5569,'setupHeaders':_0x1a0971}:_0xc3b665?{'key':_0x672803['environmentKey']??'','domains':[_0xc3b665],'setupHeaders':_0x1a0971}:null,{sessionState:_0x21b24c}=await manualBrowserLogin(_0x672803,_0x448177,{'persistSessionState':!_0x49183f}),_0x2d730d=await _0xc182a[_0x4afa7c(0x17e)](writeSessionToLocalCache,_0x672803[_0x4afa7c(0x160)],_0x672803['organizationId'],_0xc3b665,_0x1a0971,_0x21b24c,_0x2cea7e,_0x29faaf);return{'authPath':_0x2d730d,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x2c9d22,_0x472230){const _0xff663f=_0x26be,_0x233c50=_0x2c9d22();while(!![]){try{const _0x1a5471=-parseInt(_0xff663f(0xda))/0x1+parseInt(_0xff663f(0xd9))/0x2+-parseInt(_0xff663f(0xc7))/0x3+parseInt(_0xff663f(0xce))/0x4*(-parseInt(_0xff663f(0xbe))/0x5)+-parseInt(_0xff663f(0xcb))/0x6*(-parseInt(_0xff663f(0xca))/0x7)+-parseInt(_0xff663f(0xc1))/0x8*(parseInt(_0xff663f(0xb8))/0x9)+parseInt(_0xff663f(0xc3))/0xa;if(_0x1a5471===_0x472230)break;else _0x233c50['push'](_0x233c50['shift']());}catch(_0x393d68){_0x233c50['push'](_0x233c50['shift']());}}}(_0x5ee8,0xc7862));import{createHash}from'crypto';function _0x5ee8(){const _0x1811b9=['port','has','url','baseUrl','tucAS','842452RzIsJQ','1268867PYtzLR','.storageState.json','close','pemvc','toString','effectiveBaseUrl','clientIp','DFtBZ','DkIgu','push','localhost','userAgent','newContext','AthSR','sha256','ywHTe','1818rINFrL','newPage','slice','.json','dzpep','ZGJPE','150ebRSyX','stdin','localhost.','16872YjmxgS','isTTY','17294780MjRBhq','hex','test','stdout','483558rzYsNE','defaultEnvironmentKey','launchBrowser','413XITNxu','92058rfGxTY','MSDia','setupHeaders','51016OhNGwp','pathname','status','boesI','127.0.0.1','add'];_0x5ee8=function(){return _0x1811b9;};return _0x5ee8();}import{join}from'path';function _0x26be(_0x541fe3,_0x3d1666){_0x541fe3=_0x541fe3-0xaf;const _0x5ee80c=_0x5ee8();let _0x26be8c=_0x5ee80c[_0x541fe3];return _0x26be8c;}import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x565e8a=process['env'],_0x4e41d5={'stdin':process['stdin'],'stdout':process['stdout']}){const _0x327446=_0x26be,_0x20d4c9={'AthSR':function(_0x169ed2,_0x4e382c){return _0x169ed2(_0x4e382c);}};if(_0x565e8a['CI'])return![];return _0x20d4c9[_0x327446(0xb5)](Boolean,_0x4e41d5[_0x327446(0xbf)][_0x327446(0xc2)])&&_0x20d4c9[_0x327446(0xb5)](Boolean,_0x4e41d5[_0x327446(0xc6)][_0x327446(0xc2)]);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x4e7820){const _0x9902d6=_0x26be,_0x54b889={'DkIgu':function(_0x4eee20,_0x140524){return _0x4eee20(_0x140524);},'pemvc':_0x9902d6(0xd7),'tPvUB':'port','yEKiW':'clientIp','DFtBZ':function(_0x4ed350,_0x51bf90){return _0x4ed350!==_0x51bf90;},'boesI':_0x9902d6(0xb6),'ywHTe':_0x9902d6(0xc4)},_0x4bdc5f=new Set(_0x4e7820['invalidateOn']??DEFAULT_INVALIDATE_ON);_0x4e7820[_0x9902d6(0xdf)]&&_0x54b889[_0x9902d6(0xb0)](needsTunnel,_0x4e7820['effectiveBaseUrl'])&&_0x4bdc5f['add']('baseUrl');const _0x397677={'orgId':_0x4e7820['orgId'],'profileName':_0x4e7820['profileName']};return _0x4bdc5f['has'](_0x54b889[_0x9902d6(0xdd)])&&(_0x397677[_0x9902d6(0xdf)]=_0x4e7820[_0x9902d6(0xdf)]),_0x4bdc5f['has'](_0x9902d6(0xcd))&&(_0x397677[_0x9902d6(0xcd)]=_0x4e7820['setupHeaders']?_0x54b889['DkIgu'](sortObjectKeys,_0x4e7820['setupHeaders']):_0x4e7820[_0x9902d6(0xcd)]),_0x4bdc5f[_0x9902d6(0xd5)](_0x54b889['tPvUB'])&&(_0x397677['port']=extractPort(_0x4e7820['effectiveBaseUrl'])),_0x4bdc5f['has']('userAgent')&&_0x4e7820['userAgent']!==undefined&&(_0x397677['userAgent']=_0x4e7820[_0x9902d6(0xb3)]),_0x4bdc5f['has'](_0x54b889['yEKiW'])&&_0x54b889[_0x9902d6(0xaf)](_0x4e7820[_0x9902d6(0xe0)],undefined)&&(_0x397677[_0x9902d6(0xe0)]=_0x4e7820[_0x9902d6(0xe0)]),_0x54b889['DkIgu'](createHash,_0x54b889[_0x9902d6(0xd1)])['update'](JSON['stringify'](_0x397677))['digest'](_0x54b889[_0x9902d6(0xb7)])[_0x9902d6(0xba)](0x0,0xc);}function extractPort(_0x5738eb){const _0x1d696f=_0x26be;try{return new URL(_0x5738eb)[_0x1d696f(0xd4)];}catch{return'';}}function sortObjectKeys(_0x1a448a){const _0x41c642={};for(const _0x439361 of Object['keys'](_0x1a448a)['sort']()){_0x41c642[_0x439361]=_0x1a448a[_0x439361];}return _0x41c642;}export function getSessionCachePath(_0x5ef14b,_0x41e895){const _0xa66f9=_0x26be,_0x8ecd6d={'ZGJPE':function(_0xb8c30e,_0x2d1a12,_0x4c4138,_0x3d0b60){return _0xb8c30e(_0x2d1a12,_0x4c4138,_0x3d0b60);},'FZSpi':'auth'};return _0x8ecd6d[_0xa66f9(0xbd)](join,getRangerHomeDir(),_0x8ecd6d['FZSpi'],_0x5ef14b+'-'+_0x41e895+_0xa66f9(0xbb));}export function getStorageStatePath(_0x398787){const _0x5330fb=_0x26be;return _0x398787['replace'](/\.json$/,_0x5330fb(0xdb));}export function needsTunnel(_0x412fc5){const _0x23520b=_0x26be,_0x260ecd={'muQXS':function(_0x1c5873,_0x10be69){return _0x1c5873===_0x10be69;},'hqcIu':_0x23520b(0xd2),'dzpep':'.localhost','qfZVb':_0x23520b(0xc0)};let _0xcec776;try{_0xcec776=new URL(_0x412fc5)['hostname'];}catch{return![];}if(_0x260ecd['muQXS'](_0xcec776,_0x23520b(0xb2))||_0xcec776===_0x260ecd['hqcIu'])return!![];if(_0xcec776['endsWith'](_0x260ecd[_0x23520b(0xbc)]))return!![];if(_0xcec776['includes'](_0x260ecd['qfZVb']))return!![];return![];}export function hostnameOf(_0x83f236){return new URL(_0x83f236)['hostname'];}export function duplicateCookiesForDomains(_0x53bf60,_0x40a439){const _0x5e5959=_0x26be,_0x49b424=[..._0x53bf60],_0x4efdd6=new Set(_0x53bf60['map'](_0x377a91=>_0x377a91['domain']));for(const _0x4dbf88 of _0x40a439){let _0x1642b1;try{_0x1642b1=hostnameOf(_0x4dbf88);}catch{continue;}if(!_0x1642b1)continue;const _0x4cb81e=_0x1642b1['startsWith']('.')?_0x1642b1:'.'+_0x1642b1;if(_0x4efdd6['has'](_0x1642b1)||_0x4efdd6[_0x5e5959(0xd5)](_0x4cb81e))continue;for(const _0x1d42c4 of _0x53bf60){_0x49b424[_0x5e5959(0xb1)]({..._0x1d42c4,'domain':_0x4cb81e});}_0x4efdd6[_0x5e5959(0xd3)](_0x4cb81e);}return _0x49b424;}export function resolveAuthEnvironmentLocally(_0x58c0a9,_0x39d138){const _0x247c43=_0x26be,_0x303ea1={'MSDia':function(_0x2b761d,_0xc15550){return _0x2b761d===_0xc15550;}},_0x17952d=_0x58c0a9['environments'];if(_0x39d138){const _0x5a030e=_0x17952d[_0x39d138];if(!_0x5a030e)return null;return{'key':_0x39d138,..._0x5a030e};}if(_0x58c0a9[_0x247c43(0xc8)]){const _0x296a10=_0x17952d[_0x58c0a9['defaultEnvironmentKey']];if(!_0x296a10)return null;return{'key':_0x58c0a9[_0x247c43(0xc8)],..._0x296a10};}const _0x11471b=Object['keys'](_0x17952d);if(_0x303ea1[_0x247c43(0xcc)](_0x11471b['length'],0x1)){const _0x3fee0d=_0x11471b[0x0];return{'key':_0x3fee0d,..._0x17952d[_0x3fee0d]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x43a1e5,_0xb81bb0){const _0x3f6094=_0x26be;try{if(_0xb81bb0)return new URL(_0xb81bb0,_0x43a1e5)[_0x3f6094(0xde)]();return new URL(_0x43a1e5)[_0x3f6094(0xde)]();}catch{return null;}}export function looksLikeLoginUrl(_0x7772e8){const _0x2ae1a8=_0x26be;try{const _0x13cee7=new URL(_0x7772e8);return LOGIN_URL_PATTERN[_0x2ae1a8(0xc5)](_0x13cee7[_0x2ae1a8(0xcf)]);}catch{return LOGIN_URL_PATTERN[_0x2ae1a8(0xc5)](_0x7772e8);}}export async function isCachedSessionLive(_0x298c0c,_0x3b9dfd,_0x3bf7e6={},_0x3b5630={}){const _0x1853fb=_0x26be,_0x533e50={'RRLsA':function(_0xc4294b,_0x3956e9,_0x5e292a){return _0xc4294b(_0x3956e9,_0x5e292a);},'NitfV':'domcontentloaded','tucAS':function(_0x5c787a,_0x5b69a3){return _0x5c787a===_0x5b69a3;}},_0x22767f=_0x533e50['RRLsA'](buildSessionCheckUrl,_0x3b9dfd,_0x3bf7e6['sessionCheckPath']);if(!_0x22767f)return!![];if(!_0x3b5630[_0x1853fb(0xc9)])return!![];let _0x4f6bd2=null;try{_0x4f6bd2=await _0x3b5630[_0x1853fb(0xc9)]();const _0x6bdd02=await _0x4f6bd2[_0x1853fb(0xb4)]({'storageState':_0x298c0c,'ignoreHTTPSErrors':!![],..._0x3bf7e6['setupHeaders']?{'extraHTTPHeaders':_0x3bf7e6['setupHeaders']}:{}}),_0x4a38b1=await _0x6bdd02[_0x1853fb(0xb9)](),_0x27e9ab=await _0x4a38b1['goto'](_0x22767f,{'waitUntil':_0x533e50['NitfV'],'timeout':0x3a98}),_0x232971=_0x27e9ab?.[_0x1853fb(0xd0)]();if(_0x232971===0x191||_0x533e50[_0x1853fb(0xd8)](_0x232971,0x193))return![];const _0x2ed27f=_0x4a38b1[_0x1853fb(0xd6)]();if(looksLikeLoginUrl(_0x2ed27f))return![];return!![];}catch{return![];}finally{if(_0x4f6bd2)await _0x4f6bd2[_0x1853fb(0xdc)]()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0xe663(_0x5aecfc,_0x517a5f){_0x5aecfc=_0x5aecfc-0x79;const _0x191ea0=_0x191e();let _0xe663cd=_0x191ea0[_0x5aecfc];return _0xe663cd;}(function(_0x367609,_0x1f96c6){const _0xf955c8=_0xe663,_0x49af5f=_0x367609();while(!![]){try{const _0x46961f=-parseInt(_0xf955c8(0x7a))/0x1+parseInt(_0xf955c8(0x7b))/0x2*(-parseInt(_0xf955c8(0x7c))/0x3)+parseInt(_0xf955c8(0x86))/0x4+-parseInt(_0xf955c8(0x79))/0x5*(-parseInt(_0xf955c8(0x84))/0x6)+parseInt(_0xf955c8(0x83))/0x7+-parseInt(_0xf955c8(0x81))/0x8*(parseInt(_0xf955c8(0x82))/0x9)+-parseInt(_0xf955c8(0x87))/0xa;if(_0x46961f===_0x1f96c6)break;else _0x49af5f['push'](_0x49af5f['shift']());}catch(_0x3c1d00){_0x49af5f['push'](_0x49af5f['shift']());}}}(_0x191e,0x3f21e));import{createCipheriv,createDecipheriv,randomBytes,pbkdf2Sync}from'crypto';const ALGORITHM='aes-256-gcm',SALT='ranger-auth-encryption',KEY_LENGTH=0x20,IV_LENGTH=0x10,TAG_LENGTH=0x10;export function deriveKey(_0x3bb293){const _0x168d7e={'rdBPx':function(_0x4d334c,_0x4baa30,_0x54c622,_0x3baa54,_0x196c4c,_0x16f0ac){return _0x4d334c(_0x4baa30,_0x54c622,_0x3baa54,_0x196c4c,_0x16f0ac);}};return _0x168d7e['rdBPx'](pbkdf2Sync,_0x3bb293,SALT,0x186a0,KEY_LENGTH,'sha256');}export function encrypt(_0x2fe8ee,_0x4fd2e2){const _0x318010=_0xe663,_0x36801b={'lEyPd':function(_0x38a3ee,_0x48ea43){return _0x38a3ee(_0x48ea43);},'QBYDS':'utf8'},_0x3284f6=_0x36801b['lEyPd'](deriveKey,_0x4fd2e2),_0x4a4edd=randomBytes(IV_LENGTH),_0x23bc0a=createCipheriv(ALGORITHM,_0x3284f6,_0x4a4edd),_0x465bcf=Buffer['concat']([_0x23bc0a['update'](_0x2fe8ee,_0x36801b[_0x318010(0x85)]),_0x23bc0a[_0x318010(0x80)]()]),_0xea45b9=_0x23bc0a['getAuthTag']();return Buffer['concat']([_0x4a4edd,_0xea45b9,_0x465bcf]);}function _0x191e(){const _0x477fb1=['3175536FxtjiS','10734bIfiEZ','QBYDS','1501504qbTiLL','2857830TFnDuB','175QvuYwr','38530AkVymO','1066mUcblH','1563ATLNrq','hJxDh','subarray','utf8','final','248344xLFgdX','9nNwQBc'];_0x191e=function(){return _0x477fb1;};return _0x191e();}export function decrypt(_0x123ab1,_0x2ba913){const _0x3d3e56=_0xe663,_0x4f9e2d={'KwPZG':function(_0x40052f,_0x55abe3){return _0x40052f(_0x55abe3);},'TTdBK':function(_0x2810d7,_0x4baa9d){return _0x2810d7+_0x4baa9d;},'hJxDh':function(_0x1fda3a,_0x7ecbd5,_0x46778c,_0x116052){return _0x1fda3a(_0x7ecbd5,_0x46778c,_0x116052);}},_0x5cfb32=_0x4f9e2d['KwPZG'](deriveKey,_0x2ba913),_0x30343d=_0x123ab1['subarray'](0x0,IV_LENGTH),_0x2234c0=_0x123ab1[_0x3d3e56(0x7e)](IV_LENGTH,_0x4f9e2d['TTdBK'](IV_LENGTH,TAG_LENGTH)),_0x2eda44=_0x123ab1['subarray'](IV_LENGTH+TAG_LENGTH),_0x44b176=_0x4f9e2d[_0x3d3e56(0x7d)](createDecipheriv,ALGORITHM,_0x5cfb32,_0x30343d);return _0x44b176['setAuthTag'](_0x2234c0),_0x44b176['update'](_0x2eda44)+_0x44b176[_0x3d3e56(0x80)](_0x3d3e56(0x7f));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x52ec34=_0x3d69;(function(_0x24398d,_0x48c13b){const _0x121399=_0x3d69,_0x3d353e=_0x24398d();while(!![]){try{const _0x4e34f5=parseInt(_0x121399(0x127))/0x1+-parseInt(_0x121399(0x131))/0x2+parseInt(_0x121399(0x151))/0x3*(parseInt(_0x121399(0x123))/0x4)+-parseInt(_0x121399(0x133))/0x5+parseInt(_0x121399(0x14b))/0x6*(-parseInt(_0x121399(0x136))/0x7)+-parseInt(_0x121399(0x13e))/0x8*(-parseInt(_0x121399(0x130))/0x9)+parseInt(_0x121399(0x12a))/0xa;if(_0x4e34f5===_0x48c13b)break;else _0x3d353e['push'](_0x3d353e['shift']());}catch(_0x4342bf){_0x3d353e['push'](_0x3d353e['shift']());}}}(_0x196c,0xaa5e4));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';function _0x3d69(_0xddaa53,_0x286db7){_0xddaa53=_0xddaa53-0x11e;const _0x196cfd=_0x196c();let _0x3d690b=_0x196cfd[_0xddaa53];return _0x3d690b;}const SENSITIVE_FLAGS=new Set([_0x52ec34(0x146),'-t',_0x52ec34(0x12f),'--api-key','--apikey',_0x52ec34(0x132),_0x52ec34(0x126),_0x52ec34(0x134),'--auth',_0x52ec34(0x11f),_0x52ec34(0x128),_0x52ec34(0x120),_0x52ec34(0x145)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x5b0846){return TOKEN_PATTERNS['some'](_0xa86b37=>_0xa86b37['test'](_0x5b0846));}export function sanitizeArgs(_0xe79a7e){const _0x26b8ad=_0x52ec34,_0x4a26cf={'lnoXu':function(_0x872bae,_0x54f341){return _0x872bae<_0x54f341;},'sBsYX':_0x26b8ad(0x14a),'AmlYa':function(_0x3708d1,_0x1fe86f){return _0x3708d1!==_0x1fe86f;},'wPFHJ':function(_0x1b1500,_0x3122ee){return _0x1b1500(_0x3122ee);}},_0x8ea53e=[];let _0x25c973=![];for(let _0x2545ac=0x0;_0x4a26cf['lnoXu'](_0x2545ac,_0xe79a7e['length']);_0x2545ac++){const _0x220273=_0xe79a7e[_0x2545ac];if(_0x25c973){_0x8ea53e['push'](_0x4a26cf[_0x26b8ad(0x129)]),_0x25c973=![];continue;}if(_0x220273['startsWith']('--')||_0x220273['startsWith']('-')){const _0x2d06a4=_0x220273[_0x26b8ad(0x150)]('=');if(_0x4a26cf['AmlYa'](_0x2d06a4,-0x1)){const _0x1b5cf8=_0x220273['slice'](0x0,_0x2d06a4)['toLowerCase']();if(SENSITIVE_FLAGS['has'](_0x1b5cf8)){_0x8ea53e['push'](_0x220273[_0x26b8ad(0x122)](0x0,_0x2d06a4)+_0x26b8ad(0x124));continue;}}else{const _0x2dc3b8=_0x220273['toLowerCase']();SENSITIVE_FLAGS['has'](_0x2dc3b8)&&(_0x25c973=!![]);}_0x8ea53e['push'](_0x220273);}else _0x4a26cf['wPFHJ'](looksLikeToken,_0x220273)?_0x8ea53e[_0x26b8ad(0x11e)](_0x4a26cf[_0x26b8ad(0x129)]):_0x8ea53e[_0x26b8ad(0x11e)](_0x220273);}return _0x8ea53e['join']('\x20');}export async function logDesirePath(_0x1feb89){const _0xb59f4d=_0x52ec34,_0x5dff2f={'qfdDG':function(_0x2325fa){return _0x2325fa();},'YwBLx':'application/json','vFZFY':_0xb59f4d(0x121)};try{const _0x2b35ab=await getToken()[_0xb59f4d(0x139)](()=>null),_0x49ad52=_0x5dff2f[_0xb59f4d(0x13b)](getApiBaseUrl),_0x2a6470=_0x5dff2f['qfdDG'](getCurrentVersion),_0x96c81f=_0x2b35ab?_0xb59f4d(0x147):'no_token',_0x494fa6={..._0x1feb89[_0xb59f4d(0x142)],'authStatus':_0x96c81f,'isTty':process['stdout']['isTTY']??![]},_0x21c080={'Content-Type':_0x5dff2f[_0xb59f4d(0x13a)]};_0x2b35ab&&(_0x21c080['Authorization']='Bearer\x20'+_0x2b35ab);const _0x215b75={'rawCommand':_0x1feb89[_0xb59f4d(0x12c)],'errorMessage':_0x1feb89['errorMessage'],'errorType':_0x1feb89['errorType'],'featureId':_0x1feb89[_0xb59f4d(0x140)],'sessionId':_0x1feb89['sessionId'],'metadata':_0x494fa6,'cliVersion':_0x2a6470};process[_0xb59f4d(0x13c)]['DEBUG']&&(console[_0xb59f4d(0x135)](_0xb59f4d(0x12e)+_0x49ad52+'/api/v1/mcp/desire-path-logs'),console['error'](_0xb59f4d(0x125)+JSON[_0xb59f4d(0x138)](_0x215b75,null,0x2))),await fetch(_0x49ad52+'/api/v1/mcp/desire-path-logs',{'method':_0x5dff2f['vFZFY'],'headers':_0x21c080,'body':JSON[_0xb59f4d(0x138)](_0x215b75)});}catch(_0x54935e){process[_0xb59f4d(0x13c)][_0xb59f4d(0x148)]&&console['error']('[desire-path]\x20Failed\x20to\x20send:\x20'+_0x54935e);}}function _0x196c(){const _0x25ab9c=['metadata','nWhhG','unknown_argument','--credentials','--token','has_token','DEBUG','epzAD','[REDACTED]','684642mMenzR','Not\x20enough\x20non-option\x20arguments','missing_required_argument','split','includes','indexOf','3645ETvMPv','push','--authorization','--cookie','POST','slice','4428HMqZjQ','=[REDACTED]','[desire-path]\x20Payload:\x20','--password','1159979IspmEw','--header','sBsYX','9159320MSASHh','goKrG','rawCommand','Missing\x20required\x20argument','[desire-path]\x20Sending\x20log\x20to\x20','--secret','27nLsUsY','2051092LJzTwY','--key','2996515lBjcjs','--pass','error','70nKjSkO','HTRLo','stringify','catch','YwBLx','qfdDG','env','XKZwd','114216hkSLcB','ZedXh','featureId','Unknown\x20argument'];_0x196c=function(){return _0x25ab9c;};return _0x196c();}export function getErrorType(_0x56c24d,_0x395dfb){const _0x44621f=_0x52ec34,_0x488117={'ZedXh':'0|5|4|3|6|2|7|1','goKrG':'Unknown\x20command','nWhhG':'unknown_command','XKZwd':'unknown','HTRLo':_0x44621f(0x14d),'epzAD':_0x44621f(0x12d)},_0x557a49=_0x488117[_0x44621f(0x13f)][_0x44621f(0x14e)]('|');let _0x316227=0x0;while(!![]){switch(_0x557a49[_0x316227++]){case'0':if(_0x395dfb)return'runtime_error';continue;case'1':return'syntax_error';case'2':if(_0x56c24d['includes']('Invalid\x20values'))return'invalid_option_value';continue;case'3':if(_0x56c24d['includes'](_0x44621f(0x141)))return _0x44621f(0x144);continue;case'4':if(_0x56c24d[_0x44621f(0x14f)](_0x488117[_0x44621f(0x12b)]))return _0x488117[_0x44621f(0x143)];continue;case'5':if(!_0x56c24d)return _0x488117[_0x44621f(0x13d)];continue;case'6':if(_0x56c24d['includes'](_0x44621f(0x14c)))return _0x488117[_0x44621f(0x137)];continue;case'7':if(_0x56c24d['includes'](_0x488117[_0x44621f(0x149)]))return'missing_option';continue;}break;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x2de186=_0x4bde;(function(_0x14a4c6,_0x2f974a){const _0x3bb80d=_0x4bde,_0x5a74fc=_0x14a4c6();while(!![]){try{const _0x436128=parseInt(_0x3bb80d(0x1dd))/0x1*(-parseInt(_0x3bb80d(0x1c4))/0x2)+-parseInt(_0x3bb80d(0x1c3))/0x3+-parseInt(_0x3bb80d(0x1ee))/0x4*(-parseInt(_0x3bb80d(0x1a8))/0x5)+-parseInt(_0x3bb80d(0x1af))/0x6+parseInt(_0x3bb80d(0x1bc))/0x7*(-parseInt(_0x3bb80d(0x1e7))/0x8)+parseInt(_0x3bb80d(0x1d9))/0x9+parseInt(_0x3bb80d(0x1eb))/0xa;if(_0x436128===_0x2f974a)break;else _0x5a74fc['push'](_0x5a74fc['shift']());}catch(_0x24ab2a){_0x5a74fc['push'](_0x5a74fc['shift']());}}}(_0x1933,0xbb762));import{spawn}from'child_process';import _0x5e647c from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';function _0x4bde(_0x578ee5,_0x379dcd){_0x578ee5=_0x578ee5-0x1a8;const _0x1933e2=_0x1933();let _0x4bde69=_0x1933e2[_0x578ee5];return _0x4bde69;}import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x2de186(0x1cc),WORKOS_TOKEN_URL=_0x2de186(0x1d2);function _0x1933(){const _0x5dc692=['toString','7hAOgGZ','GET','gglhy','MTqTV','filter','startsWith','sLQYv','4267212HZOljH','2754AJZzoK','length','esAoC','hSOiO','start','isTTY','json','RKIOd','https://api.workos.com/user_management/authorize/device','DPLFU','selected','win32','HOtgi','workosClientId','https://api.workos.com/user_management/authenticate','org_id','platform','memberships','vUewV','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','/api-keys','1752615XhAcYN','KIijc','sYqel','log','459VpRqDq','apiKeys','Select\x20an\x20organization:','split','qRGdx','application/x-www-form-urlencoded','kXQNk','VOyWZ','open','unref','9974744XyAqil','Invalid\x20JWT\x20format','RUcfR','firstName','41733750uaTJBh','token','name','8QTAbnQ','refresh_token','utf-8','list','error_description','write','POST','stringify','mcp:write','ignore','error','status','application/json','20005kvzkhL','device_code','tqKyW','Failed\x20to\x20fetch\x20memberships:\x20','mPlHX','deucM','kDLLY','1841880rwoBCx','text','expires_in','from','SgwtS','XAsgn','/organization/self-serve-signup','stdout','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','/organization/my-memberships','verification_uri_complete','OHwUq'];_0x1933=function(){return _0x5dc692;};return _0x1933();}export async function requestDeviceCode(_0x36bfc0){const _0x54fd7d=_0x2de186,_0x46feba={'mPlHX':_0x54fd7d(0x1f4),'deucM':_0x54fd7d(0x1e2)},_0x57496b=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x46feba[_0x54fd7d(0x1ac)],'headers':{'Content-Type':_0x46feba[_0x54fd7d(0x1ad)]},'body':new URLSearchParams({'client_id':_0x36bfc0})});if(!_0x57496b['ok']){const _0x170197=await _0x57496b['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x57496b[_0x54fd7d(0x1f9)]+'\x20'+_0x170197);}return _0x57496b[_0x54fd7d(0x1ca)]();}export async function pollForTokens(_0x1b4b2e,_0x1f4a53,_0x5a22d3,_0x57dcac){const _0x41dc62=_0x2de186,_0x2aa9b3={'RUcfR':function(_0x45c3de,_0x55752a){return _0x45c3de*_0x55752a;},'VOyWZ':function(_0x3cf3a1,_0x128fdb){return _0x3cf3a1(_0x128fdb);},'qRGdx':'POST','SgwtS':'application/x-www-form-urlencoded','DPLFU':'Authentication\x20failed','oucNT':'Device\x20authorization\x20timed\x20out'},_0x23d484=Date['now']()+_0x2aa9b3[_0x41dc62(0x1e9)](_0x57dcac,0x3e8);let _0x2c1805=_0x5a22d3*0x3e8;while(Date['now']()<_0x23d484){await _0x2aa9b3[_0x41dc62(0x1e4)](sleep,_0x2c1805);const _0x5b3833=await fetch(WORKOS_TOKEN_URL,{'method':_0x2aa9b3[_0x41dc62(0x1e1)],'headers':{'Content-Type':_0x2aa9b3[_0x41dc62(0x1b3)]},'body':new URLSearchParams({'client_id':_0x1b4b2e,'device_code':_0x1f4a53,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x5b3833['ok'])return _0x5b3833['json']();const _0x42e251=await _0x5b3833['json']();if(_0x42e251[_0x41dc62(0x1f8)]==='authorization_pending')continue;if(_0x42e251['error']==='slow_down'){_0x2c1805+=0x3e8;continue;}throw new Error(_0x42e251[_0x41dc62(0x1f2)]||_0x42e251['error']||_0x2aa9b3[_0x41dc62(0x1cd)]);}throw new Error(_0x2aa9b3['oucNT']);}async function fetchUserProfile(_0x58186a){const _0x566671=_0x2de186,_0x57d9f4={'trvHK':function(_0x3c29c1){return _0x3c29c1();},'baJcr':function(_0x4ce806,_0x4fcd2e,_0x2a6ec3){return _0x4ce806(_0x4fcd2e,_0x2a6ec3);}},_0x566896=_0x57d9f4['trvHK'](getApiBaseUrl);try{const _0x1f4de4=await _0x57d9f4['baJcr'](fetch,_0x566896+'/organization/me',{'method':'GET','headers':{'workos-token':_0x58186a}});if(_0x1f4de4['ok'])return _0x1f4de4[_0x566671(0x1ca)]();}catch{}return null;}function buildKeyName(_0x1e67df,_0x5dc61e){const _0x23ac67=_0x2de186,_0x633e67={'XAsgn':function(_0x226874,_0x4af354){return _0x226874===_0x4af354;}},_0x29e2dc=_0x5dc61e[_0x23ac67(0x1c0)](_0x16749d=>_0x16749d['name']===_0x1e67df||_0x16749d[_0x23ac67(0x1ed)][_0x23ac67(0x1c1)](_0x1e67df+'\x20('));if(_0x633e67[_0x23ac67(0x1b4)](_0x29e2dc[_0x23ac67(0x1c5)],0x0))return _0x1e67df;return _0x1e67df+'\x20('+(_0x29e2dc[_0x23ac67(0x1c5)]+0x1)+')';}export async function provisionApiKey(_0x39e9f6){const _0x3de3b2=_0x2de186,_0x157a19={'EpeCG':function(_0xe17ff5){return _0xe17ff5();},'sLQYv':'CLI\x20Key','dYfzH':function(_0x304ea5,_0xeb856b,_0x3ac792){return _0x304ea5(_0xeb856b,_0x3ac792);},'CPUyO':_0x3de3b2(0x1f6)},_0x284966=_0x157a19['EpeCG'](getApiBaseUrl),_0x1d88a4={'Content-Type':_0x3de3b2(0x1fa),'workos-token':_0x39e9f6},_0x95d670=await fetchUserProfile(_0x39e9f6),_0x45d012=_0x95d670?.[_0x3de3b2(0x1ea)]||_0x95d670?.['email']?.[_0x3de3b2(0x1e0)]('@')[0x0],_0x2bf1e0=_0x45d012?_0x45d012+'\x27s\x20CLI\x20Key':_0x157a19[_0x3de3b2(0x1c2)];let _0x1853c1=[];try{const _0x4dd5e9=await fetch(_0x284966+_0x3de3b2(0x1d8),{'method':_0x3de3b2(0x1bd),'headers':_0x1d88a4});if(_0x4dd5e9['ok']){const _0x38885a=await _0x4dd5e9[_0x3de3b2(0x1ca)]();_0x1853c1=_0x38885a[_0x3de3b2(0x1de)];}}catch{}const _0x3c788c=_0x157a19['dYfzH'](buildKeyName,_0x2bf1e0,_0x1853c1),_0x16732f=await fetch(_0x284966+_0x3de3b2(0x1d8),{'method':'POST','headers':_0x1d88a4,'body':JSON[_0x3de3b2(0x1f5)]({'name':_0x3c788c,'scope':_0x157a19['CPUyO']})});if(!_0x16732f['ok']){const _0x4895a1=await _0x16732f['text']();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x16732f[_0x3de3b2(0x1f9)]+'\x20'+_0x4895a1);}const _0x2b6470=await _0x16732f['json']();return _0x2b6470['apiKey'][_0x3de3b2(0x1ec)];}export function openBrowser(_0x1e26ac){const _0x23df28=_0x2de186,_0x309c65={'HTMZa':_0x23df28(0x1c8),'lzPkv':'darwin','xysvF':function(_0x5483f6,_0x119824,_0x3bc40d,_0x41f339){return _0x5483f6(_0x119824,_0x3bc40d,_0x41f339);},'KIijc':_0x23df28(0x1f7)};try{if(process[_0x23df28(0x1d4)]===_0x23df28(0x1cf)){const _0xc8f92c=spawn('cmd',['/c',_0x309c65['HTMZa'],'',_0x1e26ac],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0xc8f92c[_0x23df28(0x1e6)]();return;}const _0x11f8dc=process[_0x23df28(0x1d4)]===_0x309c65['lzPkv']?_0x23df28(0x1e5):'xdg-open',_0x465ba1=_0x309c65['xysvF'](spawn,_0x11f8dc,[_0x1e26ac],{'detached':!![],'stdio':_0x309c65[_0x23df28(0x1da)]});_0x465ba1['unref']();}catch{}}function decodeJwtPayload(_0x5b6ff0){const _0x40a901=_0x2de186,_0x5a78d9={'LrPZx':_0x40a901(0x1e8),'vUewV':'base64url','vGclB':_0x40a901(0x1f0)},_0x23ee6e=_0x5b6ff0[_0x40a901(0x1e0)]('.');if(_0x23ee6e[_0x40a901(0x1c5)]!==0x3)throw new Error(_0x5a78d9['LrPZx']);const _0x527e8c=Buffer[_0x40a901(0x1b2)](_0x23ee6e[0x1],_0x5a78d9[_0x40a901(0x1d6)])[_0x40a901(0x1bb)](_0x5a78d9['vGclB']);return JSON['parse'](_0x527e8c);}async function selfServeSignup(_0x1e544d){const _0x7d41e1=_0x2de186,_0x297489={'sYqel':function(_0x322687){return _0x322687();},'nyBoL':function(_0x2a9d52,_0x59f4f1,_0x1c86ff){return _0x2a9d52(_0x59f4f1,_0x1c86ff);},'MTqTV':_0x7d41e1(0x1f4)},_0x2151a6=_0x297489[_0x7d41e1(0x1db)](getApiBaseUrl),_0x32e0ba=await _0x297489['nyBoL'](fetch,_0x2151a6+_0x7d41e1(0x1b5),{'method':_0x297489[_0x7d41e1(0x1bf)],'headers':{'Content-Type':'application/json','workos-token':_0x1e544d}});if(!_0x32e0ba['ok']){const _0x507be=await _0x32e0ba[_0x7d41e1(0x1b0)]();throw new Error('Failed\x20to\x20create\x20organization:\x20'+_0x32e0ba[_0x7d41e1(0x1f9)]+'\x20'+_0x507be);}return _0x32e0ba['json']();}async function fetchMyMemberships(_0x28aea9){const _0x18dae3=_0x2de186,_0x49b134={'gglhy':function(_0x263a66){return _0x263a66();},'kXQNk':function(_0x2dab7c,_0x2d167e,_0x59127b){return _0x2dab7c(_0x2d167e,_0x59127b);}},_0x46d25a=_0x49b134[_0x18dae3(0x1be)](getApiBaseUrl),_0x417cd6=await _0x49b134[_0x18dae3(0x1e3)](fetch,_0x46d25a+_0x18dae3(0x1b8),{'method':_0x18dae3(0x1bd),'headers':{'workos-token':_0x28aea9}});if(!_0x417cd6['ok']){const _0x3794b5=await _0x417cd6['text']();throw new Error(_0x18dae3(0x1ab)+_0x417cd6['status']+'\x20'+_0x3794b5);}const _0x4e2814=await _0x417cd6[_0x18dae3(0x1ca)]();return _0x4e2814[_0x18dae3(0x1d5)];}async function refreshTokenWithOrg(_0x252907,_0x3a2db6,_0x5d65f3){const _0x3eaa31=_0x2de186,_0x5f29f9={'yaaEi':_0x3eaa31(0x1f4),'LcJnl':'refresh_token'},_0x52581d=await fetch(WORKOS_TOKEN_URL,{'method':_0x5f29f9['yaaEi'],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x252907,'grant_type':_0x5f29f9['LcJnl'],'refresh_token':_0x3a2db6,'organization_id':_0x5d65f3})});if(!_0x52581d['ok']){const _0x27ead5=await _0x52581d[_0x3eaa31(0x1b0)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x52581d[_0x3eaa31(0x1f9)]+'\x20'+_0x27ead5);}return _0x52581d[_0x3eaa31(0x1ca)]();}async function provisionCliToken(_0x43b4a0){const _0x42f28f=_0x2de186,_0x118feb={'uFHQi':function(_0x535862,_0x2969ae,_0x4695d6){return _0x535862(_0x2969ae,_0x4695d6);},'hSOiO':'POST','esAoC':_0x42f28f(0x1fa)},_0x15191f=getApiBaseUrl(),_0x2d0053=await _0x118feb['uFHQi'](fetch,_0x15191f+'/cli-auth/token',{'method':_0x118feb[_0x42f28f(0x1c7)],'headers':{'Content-Type':_0x118feb[_0x42f28f(0x1c6)],'workos-token':_0x43b4a0}});if(!_0x2d0053['ok']){const _0x765039=await _0x2d0053['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x2d0053['status']+'\x20'+_0x765039);}return _0x2d0053[_0x42f28f(0x1ca)]();}export async function runDeviceAuthFlow(){const _0x173723=_0x2de186,_0x39e9c5={'KSGgR':_0x173723(0x1d7),'HOtgi':'\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','JgEmy':function(_0x329100,_0x417e39){return _0x329100(_0x417e39);},'kDLLY':'Waiting\x20for\x20authentication...','OHwUq':'Setting\x20up\x20your\x20organization...','dvlnE':function(_0x2d1b36,_0x533792){return _0x2d1b36+_0x533792;},'tqKyW':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','RKIOd':_0x173723(0x1df),'xLDYN':function(_0x448064,_0x7674d7,_0x14b736,_0x93adae){return _0x448064(_0x7674d7,_0x14b736,_0x93adae);},'WQSFn':'Provisioning\x20CLI\x20token...'},_0xf5b0=getCurrentEnvironment(),_0x47dc19=ENVIRONMENT_CONFIGS[_0xf5b0][_0x173723(0x1d1)],_0x5a7260=await requestDeviceCode(_0x47dc19);console['log'](_0x39e9c5['KSGgR']),console['log'](_0x39e9c5[_0x173723(0x1d0)]),_0x39e9c5['JgEmy'](openBrowser,_0x5a7260[_0x173723(0x1b9)]),console[_0x173723(0x1dc)](_0x173723(0x1b7)+_0x5a7260['verification_uri_complete']),console[_0x173723(0x1dc)]('Code:\x20'+_0x5a7260['user_code']+'\x0a'),process[_0x173723(0x1b6)][_0x173723(0x1f3)](_0x39e9c5[_0x173723(0x1ae)]);let _0x586ea8=await pollForTokens(_0x47dc19,_0x5a7260[_0x173723(0x1a9)],_0x5a7260['interval'],_0x5a7260[_0x173723(0x1b1)]);console['log']('\x20✓');const _0x737ad0=decodeJwtPayload(_0x586ea8['access_token']);if(!_0x737ad0[_0x173723(0x1d3)]){const _0x135266=await fetchMyMemberships(_0x586ea8['access_token']);let _0x305cb1;if(_0x135266['length']===0x0){process[_0x173723(0x1b6)][_0x173723(0x1f3)](_0x39e9c5[_0x173723(0x1ba)]);const _0x1f00ef=await selfServeSignup(_0x586ea8['access_token']);_0x305cb1=_0x1f00ef['organizationId'],console[_0x173723(0x1dc)]('\x20✓');}else{if(_0x135266[_0x173723(0x1c5)]===0x1)_0x305cb1=_0x135266[0x0]['organizationId'],console['log']('Using\x20organization:\x20'+_0x135266[0x0]['name']);else{const _0x11bf37=process['stdin']['isTTY']&&process['stdout'][_0x173723(0x1c9)];if(!_0x11bf37)throw new Error(_0x39e9c5['dvlnE'](_0x39e9c5[_0x173723(0x1aa)],'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.'));const {selected:_0x127468}=await _0x5e647c['prompt']([{'type':_0x173723(0x1f1),'name':_0x173723(0x1ce),'message':_0x39e9c5[_0x173723(0x1cb)],'choices':_0x135266['map'](_0x4cd7d0=>({'name':_0x4cd7d0['name'],'value':_0x4cd7d0['organizationId']}))}]);_0x305cb1=_0x127468;}}_0x586ea8=await _0x39e9c5['xLDYN'](refreshTokenWithOrg,_0x47dc19,_0x586ea8['refresh_token'],_0x305cb1);}process['stdout'][_0x173723(0x1f3)](_0x39e9c5['WQSFn']);const _0x275072=await provisionCliToken(_0x586ea8['access_token']);return console['log']('\x20✓'),await _0x39e9c5['JgEmy'](storeToken,_0x275072[_0x173723(0x1ec)]),_0x586ea8[_0x173723(0x1ef)]&&await storeRefreshToken(_0x586ea8['refresh_token']),_0x275072[_0x173723(0x1ec)];}function sleep(_0x8ce0b1){return new Promise(_0x751d65=>setTimeout(_0x751d65,_0x8ce0b1));}
|
|
1
|
+
function _0xdb17(_0x2732ca,_0xcdd564){_0x2732ca=_0x2732ca-0x163;const _0x32e180=_0x32e1();let _0xdb17c2=_0x32e180[_0x2732ca];return _0xdb17c2;}const _0x40f7de=_0xdb17;(function(_0x3df51f,_0x170a7c){const _0x14fb33=_0xdb17,_0x3284e4=_0x3df51f();while(!![]){try{const _0x1cfe5c=parseInt(_0x14fb33(0x190))/0x1+parseInt(_0x14fb33(0x1a5))/0x2+parseInt(_0x14fb33(0x1ad))/0x3*(-parseInt(_0x14fb33(0x172))/0x4)+-parseInt(_0x14fb33(0x19a))/0x5+-parseInt(_0x14fb33(0x184))/0x6+-parseInt(_0x14fb33(0x195))/0x7+parseInt(_0x14fb33(0x199))/0x8;if(_0x1cfe5c===_0x170a7c)break;else _0x3284e4['push'](_0x3284e4['shift']());}catch(_0x2b0183){_0x3284e4['push'](_0x3284e4['shift']());}}}(_0x32e1,0xc85b4));import{spawn}from'child_process';import _0xbc9f05 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x40f7de(0x1a8),WORKOS_TOKEN_URL=_0x40f7de(0x163);export async function requestDeviceCode(_0x9befa2){const _0x100687=_0x40f7de,_0x1b9fd9={'FjcEC':function(_0x466c9,_0x2665d5,_0x3fb63e){return _0x466c9(_0x2665d5,_0x3fb63e);},'ReWAi':'application/x-www-form-urlencoded'},_0x4a5bd2=await _0x1b9fd9[_0x100687(0x175)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':'POST','headers':{'Content-Type':_0x1b9fd9['ReWAi']},'body':new URLSearchParams({'client_id':_0x9befa2})});if(!_0x4a5bd2['ok']){const _0x4137c3=await _0x4a5bd2['text']();throw new Error(_0x100687(0x1aa)+_0x4a5bd2[_0x100687(0x182)]+'\x20'+_0x4137c3);}return _0x4a5bd2[_0x100687(0x197)]();}export async function pollForTokens(_0x1cab0,_0x18d416,_0x49a897,_0x4f0937){const _0x30009f=_0x40f7de,_0x3c75ca={'qKdpq':function(_0x55f831,_0x41907a){return _0x55f831*_0x41907a;},'QlBJf':function(_0x51d398,_0x271f78){return _0x51d398(_0x271f78);},'xiptc':function(_0x43d94a,_0x5f518b,_0x3cf50a){return _0x43d94a(_0x5f518b,_0x3cf50a);},'sfGqU':function(_0x181e4f,_0x51b5a1){return _0x181e4f===_0x51b5a1;}},_0x1b3dc0=Date['now']()+_0x4f0937*0x3e8;let _0x4268e2=_0x3c75ca[_0x30009f(0x18f)](_0x49a897,0x3e8);while(Date['now']()<_0x1b3dc0){await _0x3c75ca['QlBJf'](sleep,_0x4268e2);const _0x1094f7=await _0x3c75ca['xiptc'](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x30009f(0x1ab)},'body':new URLSearchParams({'client_id':_0x1cab0,'device_code':_0x18d416,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x1094f7['ok'])return _0x1094f7[_0x30009f(0x197)]();const _0x35f9ff=await _0x1094f7[_0x30009f(0x197)]();if(_0x3c75ca[_0x30009f(0x1ac)](_0x35f9ff[_0x30009f(0x178)],_0x30009f(0x192)))continue;if(_0x35f9ff['error']==='slow_down'){_0x4268e2+=0x3e8;continue;}throw new Error(_0x35f9ff['error_description']||_0x35f9ff['error']||'Authentication\x20failed');}throw new Error('Device\x20authorization\x20timed\x20out');}async function fetchUserProfile(_0x4a9502){const _0x1f3a94=_0x40f7de,_0xd2d7dd={'VSOSQ':function(_0x4c427f){return _0x4c427f();},'kOCgx':function(_0x7df561,_0x4f5edf,_0x29d24){return _0x7df561(_0x4f5edf,_0x29d24);}},_0x2d93b5=_0xd2d7dd[_0x1f3a94(0x174)](getApiBaseUrl);try{const _0x2b6279=await _0xd2d7dd['kOCgx'](fetch,_0x2d93b5+_0x1f3a94(0x1b1),{'method':'GET','headers':{'workos-token':_0x4a9502}});if(_0x2b6279['ok'])return _0x2b6279[_0x1f3a94(0x197)]();}catch{}return null;}function buildKeyName(_0x3e3d57,_0x2bc998){const _0x141358=_0x40f7de,_0x17b972={'VrqbF':function(_0x51c869,_0x59b78a){return _0x51c869===_0x59b78a;},'cVPgz':function(_0x33a46b,_0x2b02eb){return _0x33a46b+_0x2b02eb;}},_0x7f7d53=_0x2bc998[_0x141358(0x189)](_0x4aed93=>_0x4aed93[_0x141358(0x19f)]===_0x3e3d57||_0x4aed93[_0x141358(0x19f)]['startsWith'](_0x3e3d57+'\x20('));if(_0x17b972['VrqbF'](_0x7f7d53['length'],0x0))return _0x3e3d57;return _0x3e3d57+'\x20('+_0x17b972[_0x141358(0x169)](_0x7f7d53['length'],0x1)+')';}export async function provisionApiKey(_0x57de90){const _0x412eae=_0x40f7de,_0x5080c7={'jDCvJ':function(_0x1e5361){return _0x1e5361();},'XoRhK':_0x412eae(0x18e),'DLbmL':function(_0x57e6a3,_0x4f5464){return _0x57e6a3(_0x4f5464);},'VJWuQ':function(_0x3c1848,_0x418d67,_0x33b26b){return _0x3c1848(_0x418d67,_0x33b26b);},'aFluE':function(_0x4a3cc2,_0x4d70d5,_0x4d43fc){return _0x4a3cc2(_0x4d70d5,_0x4d43fc);},'KAhdm':'POST','lWwgA':_0x412eae(0x16c)},_0x27dcd9=_0x5080c7['jDCvJ'](getApiBaseUrl),_0x34f607={'Content-Type':_0x5080c7['XoRhK'],'workos-token':_0x57de90},_0x2e68e3=await _0x5080c7[_0x412eae(0x1a6)](fetchUserProfile,_0x57de90),_0x528111=_0x2e68e3?.[_0x412eae(0x164)]||_0x2e68e3?.['email']?.[_0x412eae(0x16d)]('@')[0x0],_0x31a0d8=_0x528111?_0x528111+'\x27s\x20CLI\x20Key':_0x412eae(0x193);let _0x59d278=[];try{const _0xb4da6e=await _0x5080c7[_0x412eae(0x1ae)](fetch,_0x27dcd9+'/api-keys',{'method':_0x412eae(0x16a),'headers':_0x34f607});if(_0xb4da6e['ok']){const _0x3620f1=await _0xb4da6e['json']();_0x59d278=_0x3620f1['apiKeys'];}}catch{}const _0x2f699a=_0x5080c7[_0x412eae(0x1ae)](buildKeyName,_0x31a0d8,_0x59d278),_0x47a827=await _0x5080c7['aFluE'](fetch,_0x27dcd9+_0x412eae(0x17a),{'method':_0x5080c7[_0x412eae(0x1a7)],'headers':_0x34f607,'body':JSON['stringify']({'name':_0x2f699a,'scope':_0x5080c7['lWwgA']})});if(!_0x47a827['ok']){const _0x2ba160=await _0x47a827[_0x412eae(0x16f)]();throw new Error(_0x412eae(0x196)+_0x47a827['status']+'\x20'+_0x2ba160);}const _0x29f462=await _0x47a827['json']();return _0x29f462[_0x412eae(0x1a3)]['token'];}export function openBrowser(_0x221517){const _0x2bb075=_0x40f7de,_0x57e72d={'dAbHv':_0x2bb075(0x17f),'uaXdU':function(_0x363201,_0x4bed17){return _0x363201===_0x4bed17;},'blDvT':'open','EOAtk':function(_0x18075e,_0x2e72cf,_0x102901,_0x3a7ec4){return _0x18075e(_0x2e72cf,_0x102901,_0x3a7ec4);}};try{if(process['platform']===_0x2bb075(0x183)){const _0x4b69a3=spawn(_0x2bb075(0x165),['/c','start','',_0x221517],{'detached':!![],'stdio':_0x57e72d['dAbHv'],'windowsHide':!![]});_0x4b69a3['unref']();return;}const _0x5316c4=_0x57e72d['uaXdU'](process['platform'],_0x2bb075(0x1b2))?_0x57e72d['blDvT']:'xdg-open',_0x40d2cc=_0x57e72d[_0x2bb075(0x185)](spawn,_0x5316c4,[_0x221517],{'detached':!![],'stdio':_0x57e72d[_0x2bb075(0x198)]});_0x40d2cc[_0x2bb075(0x179)]();}catch{}}function decodeJwtPayload(_0x359b0a){const _0x4548a4=_0x40f7de,_0x4c14af={'iUghE':'Invalid\x20JWT\x20format'},_0x15d622=_0x359b0a[_0x4548a4(0x16d)]('.');if(_0x15d622[_0x4548a4(0x173)]!==0x3)throw new Error(_0x4c14af['iUghE']);const _0x29fe3d=Buffer[_0x4548a4(0x18b)](_0x15d622[0x1],_0x4548a4(0x1a9))[_0x4548a4(0x170)]('utf-8');return JSON['parse'](_0x29fe3d);}async function selfServeSignup(_0x2105a4){const _0x539454=_0x40f7de,_0x2d15de={'yamQJ':function(_0x1a3e64){return _0x1a3e64();},'VfWxw':'POST'},_0x41314a=_0x2d15de['yamQJ'](getApiBaseUrl),_0x105299=await fetch(_0x41314a+_0x539454(0x181),{'method':_0x2d15de['VfWxw'],'headers':{'Content-Type':'application/json','workos-token':_0x2105a4}});if(!_0x105299['ok']){const _0x2c98e5=await _0x105299[_0x539454(0x16f)]();throw new Error(_0x539454(0x19e)+_0x105299['status']+'\x20'+_0x2c98e5);}return _0x105299[_0x539454(0x197)]();}async function fetchMyMemberships(_0x32f2f8){const _0x227065=_0x40f7de,_0x5eb70e={'oboxE':function(_0x31756d,_0x1a1e39,_0x568d92){return _0x31756d(_0x1a1e39,_0x568d92);},'QONOo':'GET'},_0x5890cd=getApiBaseUrl(),_0x309423=await _0x5eb70e[_0x227065(0x17e)](fetch,_0x5890cd+'/organization/my-memberships',{'method':_0x5eb70e[_0x227065(0x180)],'headers':{'workos-token':_0x32f2f8}});if(!_0x309423['ok']){const _0x28acb2=await _0x309423['text']();throw new Error(_0x227065(0x18d)+_0x309423[_0x227065(0x182)]+'\x20'+_0x28acb2);}const _0x4cb85d=await _0x309423['json']();return _0x4cb85d['memberships'];}async function refreshTokenWithOrg(_0x58fbaf,_0x23ca22,_0x3c6a0e){const _0x295c3f=_0x40f7de,_0xc8d408={'bSHHB':_0x295c3f(0x17d),'MKkqQ':'application/x-www-form-urlencoded'},_0x582148=await fetch(WORKOS_TOKEN_URL,{'method':_0xc8d408[_0x295c3f(0x19b)],'headers':{'Content-Type':_0xc8d408['MKkqQ']},'body':new URLSearchParams({'client_id':_0x58fbaf,'grant_type':_0x295c3f(0x177),'refresh_token':_0x23ca22,'organization_id':_0x3c6a0e})});if(!_0x582148['ok']){const _0x49cd71=await _0x582148[_0x295c3f(0x16f)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x582148['status']+'\x20'+_0x49cd71);}return _0x582148[_0x295c3f(0x197)]();}async function provisionCliToken(_0x162261){const _0x1cf133=_0x40f7de,_0x585ad6={'CCUxq':function(_0x3faa51,_0xd75dba,_0x378ba1){return _0x3faa51(_0xd75dba,_0x378ba1);},'WDOer':'POST'},_0x4a7446=getApiBaseUrl(),_0x56c37a=await _0x585ad6['CCUxq'](fetch,_0x4a7446+_0x1cf133(0x188),{'method':_0x585ad6['WDOer'],'headers':{'Content-Type':_0x1cf133(0x18e),'workos-token':_0x162261}});if(!_0x56c37a['ok']){const _0x514016=await _0x56c37a['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x56c37a['status']+'\x20'+_0x514016);}return _0x56c37a[_0x1cf133(0x197)]();}export async function runDeviceAuthFlow(){const _0x55e484=_0x40f7de,_0x432363={'CNJAz':function(_0x5f14a0){return _0x5f14a0();},'XKzsp':'\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','GKnGz':'\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','TDyAT':function(_0x1ea595,_0x3e4702,_0x2dca9e,_0x1c056d,_0x51e9f8){return _0x1ea595(_0x3e4702,_0x2dca9e,_0x1c056d,_0x51e9f8);},'zZgUO':function(_0x5624e0,_0x53f526){return _0x5624e0(_0x53f526);},'UaTgS':'Setting\x20up\x20your\x20organization...','aQFYs':function(_0x14512a,_0x4dc955){return _0x14512a(_0x4dc955);},'jvgFq':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','YSUbg':'list','HVtgU':'selected','prJhW':function(_0x17fcf5,_0x52a233,_0x21e901,_0x14f3d0){return _0x17fcf5(_0x52a233,_0x21e901,_0x14f3d0);},'fzyjH':_0x55e484(0x1a2),'osiKz':function(_0x2867f6,_0x563fe7){return _0x2867f6(_0x563fe7);}},_0x2034a5=_0x432363['CNJAz'](getCurrentEnvironment),_0x4654c5=ENVIRONMENT_CONFIGS[_0x2034a5]['workosClientId'],_0x22d2e5=await requestDeviceCode(_0x4654c5);console[_0x55e484(0x186)](_0x432363[_0x55e484(0x167)]),console['log'](_0x432363['GKnGz']),openBrowser(_0x22d2e5['verification_uri_complete']),console[_0x55e484(0x186)](_0x55e484(0x1af)+_0x22d2e5[_0x55e484(0x1a1)]),console[_0x55e484(0x186)]('Code:\x20'+_0x22d2e5['user_code']+'\x0a'),process[_0x55e484(0x18c)][_0x55e484(0x1a4)](_0x55e484(0x17c));let _0x1c5f49=await _0x432363[_0x55e484(0x194)](pollForTokens,_0x4654c5,_0x22d2e5['device_code'],_0x22d2e5[_0x55e484(0x16b)],_0x22d2e5['expires_in']);console['log']('\x20✓');const _0x2612b5=_0x432363['zZgUO'](decodeJwtPayload,_0x1c5f49[_0x55e484(0x171)]);if(!_0x2612b5[_0x55e484(0x19d)]){const _0x3ea38f=await fetchMyMemberships(_0x1c5f49['access_token']);let _0x4249ac;if(_0x3ea38f[_0x55e484(0x173)]===0x0){process[_0x55e484(0x18c)][_0x55e484(0x1a4)](_0x432363[_0x55e484(0x1b3)]);const _0x4cc2f6=await _0x432363[_0x55e484(0x168)](selfServeSignup,_0x1c5f49[_0x55e484(0x171)]);_0x4249ac=_0x4cc2f6[_0x55e484(0x166)],console['log']('\x20✓');}else{if(_0x3ea38f[_0x55e484(0x173)]===0x1)_0x4249ac=_0x3ea38f[0x0][_0x55e484(0x166)],console['log'](_0x55e484(0x176)+_0x3ea38f[0x0][_0x55e484(0x19f)]);else{const _0x445e1e=process['stdin']['isTTY']&&process['stdout'][_0x55e484(0x191)];if(!_0x445e1e)throw new Error(_0x432363['jvgFq']+_0x55e484(0x187));const {selected:_0x3e7ec8}=await _0xbc9f05['prompt']([{'type':_0x432363[_0x55e484(0x1b0)],'name':_0x432363[_0x55e484(0x18a)],'message':'Select\x20an\x20organization:','choices':_0x3ea38f[_0x55e484(0x1a0)](_0x4d62ee=>({'name':_0x4d62ee[_0x55e484(0x19f)],'value':_0x4d62ee[_0x55e484(0x166)]}))}]);_0x4249ac=_0x3e7ec8;}}_0x1c5f49=await _0x432363['prJhW'](refreshTokenWithOrg,_0x4654c5,_0x1c5f49[_0x55e484(0x177)],_0x4249ac);}process[_0x55e484(0x18c)][_0x55e484(0x1a4)](_0x432363[_0x55e484(0x17b)]);const _0x3aad9d=await _0x432363[_0x55e484(0x168)](provisionCliToken,_0x1c5f49['access_token']);return console[_0x55e484(0x186)]('\x20✓'),await _0x432363[_0x55e484(0x16e)](storeToken,_0x3aad9d['token']),_0x1c5f49['refresh_token']&&await storeRefreshToken(_0x1c5f49[_0x55e484(0x177)]),_0x3aad9d[_0x55e484(0x19c)];}function sleep(_0x187638){return new Promise(_0x42c42a=>setTimeout(_0x42c42a,_0x187638));}function _0x32e1(){const _0x39f029=['POST','oboxE','ignore','QONOo','/organization/self-serve-signup','status','win32','368922GMUOtj','EOAtk','log','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','/cli-auth/token','filter','HVtgU','from','stdout','Failed\x20to\x20fetch\x20memberships:\x20','application/json','qKdpq','103858QXXrnB','isTTY','authorization_pending','CLI\x20Key','TDyAT','11485992BmXSpV','Failed\x20to\x20provision\x20API\x20key:\x20','json','dAbHv','14015992vhKfER','809210wYfmMt','bSHHB','token','org_id','Failed\x20to\x20create\x20organization:\x20','name','map','verification_uri_complete','Provisioning\x20CLI\x20token...','apiKey','write','2870880RCauhZ','DLbmL','KAhdm','https://api.workos.com/user_management/authorize/device','base64url','Failed\x20to\x20request\x20device\x20code:\x20','application/x-www-form-urlencoded','sfGqU','165396oLoOqd','VJWuQ','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','YSUbg','/organization/me','darwin','UaTgS','https://api.workos.com/user_management/authenticate','firstName','cmd','organizationId','XKzsp','aQFYs','cVPgz','GET','interval','mcp:write','split','osiKz','text','toString','access_token','44jFlgef','length','VSOSQ','FjcEC','Using\x20organization:\x20','refresh_token','error','unref','/api-keys','fzyjH','Waiting\x20for\x20authentication...'];_0x32e1=function(){return _0x39f029;};return _0x32e1();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x57e934=_0xb46b;(function(_0x34732d,_0xc4cfdc){const _0x1a72c0=_0xb46b,_0x53ba19=_0x34732d();while(!![]){try{const _0x39ad95=-parseInt(_0x1a72c0(0x10b))/0x1+-parseInt(_0x1a72c0(0xed))/0x2+parseInt(_0x1a72c0(0x114))/0x3*(-parseInt(_0x1a72c0(0x115))/0x4)+parseInt(_0x1a72c0(0x10f))/0x5*(parseInt(_0x1a72c0(0x111))/0x6)+-parseInt(_0x1a72c0(0xf4))/0x7*(parseInt(_0x1a72c0(0xf1))/0x8)+parseInt(_0x1a72c0(0x100))/0x9+-parseInt(_0x1a72c0(0xf0))/0xa*(parseInt(_0x1a72c0(0x109))/0xb);if(_0x39ad95===_0xc4cfdc)break;else _0x53ba19['push'](_0x53ba19['shift']());}catch(_0x535d89){_0x53ba19['push'](_0x53ba19['shift']());}}}(_0x26dc,0x89642));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':'client_01J9CBYM7M5ZETCF7G6614DXR2','aiProxyUrl':_0x57e934(0xfa),'mcpAuthUrl':_0x57e934(0x10d)},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':_0x57e934(0x10e)},'local':{'apiBaseUrl':_0x57e934(0xf8),'workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'http://localhost:8090','mcpAuthUrl':_0x57e934(0x107)}};export const DEFAULT_ENVIRONMENT=_0x57e934(0xec);export function isValidEnvironment(_0x5e2e02){const _0x2c27cc=_0x57e934,_0x26fd35={'NgXLE':function(_0x5a2c92,_0x2a47e0){return _0x5a2c92===_0x2a47e0;},'qwllu':_0x2c27cc(0xec),'GHUkC':_0x2c27cc(0x10a),'ycehS':'local'};return _0x26fd35['NgXLE'](_0x5e2e02,_0x26fd35['qwllu'])||_0x5e2e02===_0x26fd35[_0x2c27cc(0xfb)]||_0x5e2e02===_0x26fd35['ycehS'];}export function getCurrentEnvironment(){const _0x13b530=process['env']['RANGER_CLI_ENV'];if(_0x13b530&&isValidEnvironment(_0x13b530))return _0x13b530;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x4249d7=_0x57e934,_0x54dc13={'SnLmA':function(_0xa81213){return _0xa81213();}};return ENVIRONMENT_CONFIGS[_0x54dc13[_0x4249d7(0x112)](getCurrentEnvironment)][_0x4249d7(0xee)];}function _0x26dc(){const _0x6840df=['trim','RANGER_HOOKS','jZUrQ','8501796FHVIai','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.','find','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','RANGER_TRANSPORT','siItI','error','http://localhost:8080/mcp','env','11TPmzeU','staging','182417buTaLG','aiProxyUrl','https://mcp-auth.ranger.net/mcp','https://mcp-auth.staging.ranger.net/mcp','70yklncF','jVOXY','446442ESfukw','SnLmA','XwLVm','9tXIWud','838788WPfScH','prod','154276hvYkOU','apiBaseUrl','RANGER_MCP_AUTH_URL','2483450dBBjYG','8QtOQaD','SmIHA','aHjHL','2006179PhpNqA','aRIJn','\x22.\x20','mcp','http://localhost:8080','uZbRG','https://ai-proxy-716115358910.us-central1.run.app','GHUkC','orwTz'];_0x26dc=function(){return _0x6840df;};return _0x26dc();}export function getAiProxyUrl(){const _0x500c97=_0x57e934,_0x5acc4b={'SmIHA':function(_0x151ffa){return _0x151ffa();}};return ENVIRONMENT_CONFIGS[_0x5acc4b[_0x500c97(0xf2)](getCurrentEnvironment)][_0x500c97(0x10c)];}export function getMcpAuthUrl(){const _0x2bcc97=_0x57e934,_0x4cf127={'siItI':function(_0x4864b5){return _0x4864b5();}};return process[_0x2bcc97(0x108)][_0x2bcc97(0xef)]??ENVIRONMENT_CONFIGS[_0x4cf127[_0x2bcc97(0x105)](getCurrentEnvironment)]['mcpAuthUrl'];}export function isByokEnabled(){const _0x4bd18d=_0x57e934,_0x4f8685={'XwLVm':function(_0x47e3d7,_0x25fe81){return _0x47e3d7===_0x25fe81;},'NJmeK':'true'};return _0x4f8685[_0x4bd18d(0x113)](process['env']['RANGER_BYOK'],_0x4f8685['NJmeK']);}function isVerificationTransport(_0x32d2d){const _0xa90436=_0x57e934,_0x1559e7={'uZbRG':function(_0x3bc990,_0x31a8fb){return _0x3bc990===_0x31a8fb;},'jZUrQ':'playwright-cli','EYply':'rangerwright-cli'};return _0x1559e7[_0xa90436(0xf9)](_0x32d2d,'mcp')||_0x32d2d===_0x1559e7[_0xa90436(0xff)]||_0x32d2d==='nova-act-cli'||_0x32d2d===_0x1559e7['EYply'];}const LEGACY_TRANSPORT_ENV_VARS=['RANGER_USE_NOVA_ACT','RANGER_DISABLE_MCP'];function _0xb46b(_0x26e7d0,_0x5b63bc){_0x26e7d0=_0x26e7d0-0xec;const _0x26dc91=_0x26dc();let _0xb46b5b=_0x26dc91[_0x26e7d0];return _0xb46b5b;}export function getVerificationTransport(){const _0x10beec=_0x57e934,_0x28f097={'aHjHL':function(_0xeb4c74,_0xc36140){return _0xeb4c74(_0xc36140);},'orwTz':_0x10beec(0xf7)},_0x502f82=process[_0x10beec(0x108)][_0x10beec(0x104)]?.[_0x10beec(0xfd)]();if(_0x502f82){if(_0x28f097[_0x10beec(0xf3)](isVerificationTransport,_0x502f82))return _0x502f82;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x502f82+_0x10beec(0x103));}const _0x38f54c=LEGACY_TRANSPORT_ENV_VARS[_0x10beec(0x102)](_0x5d9cd5=>process[_0x10beec(0x108)][_0x5d9cd5]);if(_0x38f54c)throw new Error(_0x38f54c+'\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.');return _0x28f097[_0x10beec(0xfc)];}export function resolveHookMode(_0x25b33d=process['env']){const _0xe697eb=_0x57e934,_0x42421a={'aRIJn':'auto','NAwxH':'off','jVOXY':function(_0x4c9b9f,_0x8b34f3){return _0x4c9b9f===_0x8b34f3;},'dCJZP':function(_0xba2108,_0x23e6e7){return _0xba2108+_0x23e6e7;}},_0x388728=_0x25b33d[_0xe697eb(0xfe)]?.['trim']()['toLowerCase']();if(!_0x388728)return _0x42421a[_0xe697eb(0xf5)];if(_0x388728===_0x42421a['NAwxH']||_0x388728==='on'||_0x42421a[_0xe697eb(0x110)](_0x388728,_0x42421a[_0xe697eb(0xf5)]))return _0x388728;return console[_0xe697eb(0x106)](_0x42421a['dCJZP']('[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22'+_0x25b33d['RANGER_HOOKS']+_0xe697eb(0xf6),_0xe697eb(0x101))),_0x42421a['aRIJn'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0xf9f2f9,_0x512f49){const _0x2b17fd=_0x3ffc,_0x474412=_0xf9f2f9();while(!![]){try{const _0x5195ba=-parseInt(_0x2b17fd(0x1b0))/0x1*(parseInt(_0x2b17fd(0x1cb))/0x2)+parseInt(_0x2b17fd(0x1c0))/0x3+parseInt(_0x2b17fd(0x1dd))/0x4*(-parseInt(_0x2b17fd(0x1bd))/0x5)+parseInt(_0x2b17fd(0x1ce))/0x6+parseInt(_0x2b17fd(0x1d0))/0x7+parseInt(_0x2b17fd(0x1e4))/0x8+-parseInt(_0x2b17fd(0x1c6))/0x9;if(_0x5195ba===_0x512f49)break;else _0x474412['push'](_0x474412['shift']());}catch(_0x40cee9){_0x474412['push'](_0x474412['shift']());}}}(_0x5148,0xd51f1));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x3e3626){const _0x26be7e=_0x3ffc,_0x1f03dc={'dcztR':function(_0x317b2f){return _0x317b2f();},'ijMnK':function(_0x2a86b1,_0x34c5fb,_0x65eec4){return _0x2a86b1(_0x34c5fb,_0x65eec4);},'HkxpF':'application/json','JYsOA':_0x26be7e(0x1d7)},_0x23e46f=await getToken();if(!_0x23e46f)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4dc44a=_0x1f03dc[_0x26be7e(0x1db)](getApiBaseUrl),_0x40daa6=await _0x1f03dc['ijMnK'](fetch,_0x4dc44a+_0x26be7e(0x1a8),{'method':_0x26be7e(0x1bc),'headers':{'Authorization':'Bearer\x20'+_0x23e46f,'Content-Type':_0x1f03dc['HkxpF']},'body':JSON[_0x26be7e(0x1b2)](_0x3e3626)});if(!_0x40daa6['ok']){if(_0x40daa6[_0x26be7e(0x1de)]===0x192){const _0x42bec3=await _0x40daa6['json'](),_0x2ce50f=_0x42bec3[_0x26be7e(0x1d1)]||'https://dashboard.ranger.net/billing';throw new Error((_0x42bec3['message']||_0x1f03dc[_0x26be7e(0x1c1)])+_0x26be7e(0x1e2)+_0x2ce50f);}const _0x9a9aca=await _0x40daa6[_0x26be7e(0x1c5)]();throw new Error(_0x26be7e(0x1ba)+_0x9a9aca);}return _0x40daa6[_0x26be7e(0x1c3)]();}export async function listFeatures(_0x5b5f41){const _0x5d39ce=_0x3ffc,_0x23ffe9={'FHBrB':function(_0x51e2d3){return _0x51e2d3();},'kddGA':_0x5d39ce(0x1b9),'GUTWJ':'gitBranch','zAceA':'offset','ZvAyJ':'includeDeleted','oATLr':function(_0x5e9e40,_0x542908,_0x3cfe2d){return _0x5e9e40(_0x542908,_0x3cfe2d);}},_0x4d429d=await _0x23ffe9['FHBrB'](getToken);if(!_0x4d429d)throw new Error(_0x23ffe9['kddGA']);const _0x5f8f8f=getApiBaseUrl(),_0x51a404=new URLSearchParams();if(_0x5b5f41?.[_0x5d39ce(0x1ec)])_0x51a404[_0x5d39ce(0x1d4)](_0x5d39ce(0x1ec),_0x5b5f41['gitRepoUrl']);if(_0x5b5f41?.['gitBranch'])_0x51a404['set'](_0x23ffe9[_0x5d39ce(0x1e0)],_0x5b5f41['gitBranch']);if(_0x5b5f41?.[_0x5d39ce(0x1bb)])_0x51a404['set'](_0x5d39ce(0x1bb),_0x5b5f41[_0x5d39ce(0x1bb)][_0x5d39ce(0x1d3)]());if(_0x5b5f41?.[_0x5d39ce(0x1a7)])_0x51a404['set'](_0x23ffe9['zAceA'],_0x5b5f41[_0x5d39ce(0x1a7)][_0x5d39ce(0x1d3)]());if(_0x5b5f41?.[_0x5d39ce(0x1ae)])_0x51a404['set'](_0x23ffe9[_0x5d39ce(0x1a3)],_0x5d39ce(0x1e3));const _0x53144a=_0x5f8f8f+_0x5d39ce(0x1a8)+(_0x51a404[_0x5d39ce(0x1d3)]()?'?'+_0x51a404[_0x5d39ce(0x1d3)]():''),_0x718c23=await _0x23ffe9['oATLr'](fetch,_0x53144a,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x4d429d}});if(!_0x718c23['ok']){const _0x384a3e=await _0x718c23['text']();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x384a3e);}return _0x718c23[_0x5d39ce(0x1c3)]();}export async function getFeature(_0x5ee3f3){const _0x5efca7=_0x3ffc,_0x692c5a={'ksVSj':_0x5efca7(0x1b9),'kyvve':function(_0x43c15c){return _0x43c15c();}},_0x3010c5=await getToken();if(!_0x3010c5)throw new Error(_0x692c5a[_0x5efca7(0x1b4)]);const _0x540acf=_0x692c5a[_0x5efca7(0x1ab)](getApiBaseUrl),_0x10271f=await fetch(_0x540acf+'/api/v1/mcp/features/'+_0x5ee3f3,{'method':_0x5efca7(0x1b8),'headers':{'Authorization':_0x5efca7(0x1ad)+_0x3010c5}});if(!_0x10271f['ok']){const _0x3eb2ba=await _0x10271f[_0x5efca7(0x1c5)]();throw new Error(_0x5efca7(0x1bf)+_0x3eb2ba);}return _0x10271f['json']();}export async function updateFeature(_0x40fbc9,_0x5e0e87){const _0x4bbedb=_0x3ffc,_0x55eff1={'yipOc':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','CtaOm':function(_0x31edde,_0x3d644e,_0x26c9fd){return _0x31edde(_0x3d644e,_0x26c9fd);},'hHBCZ':_0x4bbedb(0x1c4)},_0x12dd3e=await getToken();if(!_0x12dd3e)throw new Error(_0x55eff1[_0x4bbedb(0x1ef)]);const _0x19a050=getApiBaseUrl(),_0x535f51=await _0x55eff1[_0x4bbedb(0x1e9)](fetch,_0x19a050+_0x4bbedb(0x1e8)+_0x40fbc9,{'method':_0x4bbedb(0x1aa),'headers':{'Authorization':'Bearer\x20'+_0x12dd3e,'Content-Type':_0x55eff1['hHBCZ']},'body':JSON[_0x4bbedb(0x1b2)](_0x5e0e87)});if(!_0x535f51['ok']){const _0x33b0d7=await _0x535f51['text']();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x33b0d7);}return _0x535f51[_0x4bbedb(0x1c3)]();}function _0x3ffc(_0x399447,_0x22eeef){_0x399447=_0x399447-0x1a3;const _0x51482d=_0x5148();let _0x3ffc35=_0x51482d[_0x399447];return _0x3ffc35;}export async function createChecklistItem(_0x3eb94e,_0x2dd6f5,_0x13b416){const _0x3daa2d=_0x3ffc,_0x8cc73={'NPMGu':function(_0x3f3920,_0x4464b8,_0x30950e){return _0x3f3920(_0x4464b8,_0x30950e);},'mLgRv':'POST','wgbwL':'application/json'},_0x31a7ad=await getToken();if(!_0x31a7ad)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x239473=getApiBaseUrl(),_0x5142dc=await _0x8cc73[_0x3daa2d(0x1d9)](fetch,_0x239473+_0x3daa2d(0x1e8)+_0x3eb94e+'/checklist',{'method':_0x8cc73[_0x3daa2d(0x1c7)],'headers':{'Authorization':_0x3daa2d(0x1ad)+_0x31a7ad,'Content-Type':_0x8cc73[_0x3daa2d(0x1b3)]},'body':JSON['stringify']({'description':_0x2dd6f5,'position':_0x13b416})});if(!_0x5142dc['ok']){const _0xde8930=await _0x5142dc['text']();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0xde8930);}return _0x5142dc['json']();}export async function updateChecklistItem(_0x3b8871,_0x33efd9,_0x1a7fcc){const _0x2683fa=_0x3ffc,_0x26b99c={'kfnTD':function(_0x324a5e,_0x1faedf,_0x208d10){return _0x324a5e(_0x1faedf,_0x208d10);},'UTUxv':'PATCH','wPjcM':'application/json','rNgkE':function(_0x25212a,_0x36bda7,_0x3b7c81){return _0x25212a(_0x36bda7,_0x3b7c81);}};return _0x26b99c[_0x2683fa(0x1d8)](withRetry,async()=>{const _0x163b6c=_0x2683fa,_0x5443c0=await getToken();if(!_0x5443c0)throw new Error(_0x163b6c(0x1b9));const _0x168fdb=getApiBaseUrl(),_0x349107=await _0x26b99c[_0x163b6c(0x1a9)](fetch,_0x168fdb+'/api/v1/mcp/features/'+_0x3b8871+'/checklist/'+_0x33efd9,{'method':_0x26b99c[_0x163b6c(0x1b6)],'headers':{'Authorization':_0x163b6c(0x1ad)+_0x5443c0,'Content-Type':_0x26b99c['wPjcM']},'body':JSON[_0x163b6c(0x1b2)](_0x1a7fcc)});if(!_0x349107['ok']){const _0x384658=await _0x349107['text']();throw new Error(_0x163b6c(0x1cd)+_0x384658);}return _0x349107[_0x163b6c(0x1c3)]();},{'label':_0x2683fa(0x1e6)});}function _0x5148(){const _0x6d3ef9=['219057uqPuvm','/comments/address','stringify','wgbwL','ksVSj','ktmcs','UTUxv','/sessions','GET','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Failed\x20to\x20create\x20feature\x20review:\x20','limit','POST','7245860vbtqZh','style','Failed\x20to\x20get\x20feature\x20review:\x20','4759818yijgjt','JYsOA','mXVtM','json','application/json','text','5256540EdysJO','mLgRv','sessionId','UYOWf','/report','14LRRBLt','DELETE','Failed\x20to\x20update\x20scenario:\x20','9909132XZAAqB','/sessions/','541583otgkgi','billingUrl','nLgPc','toString','set','wtTIV','Failed\x20to\x20start\x20session:\x20','Feature\x20limit\x20exceeded','rNgkE','NPMGu','eGEkw','dcztR','itemIds','4ZxosaQ','status','QspSa','GUTWJ','/restore','\x0a\x0aUpgrade\x20your\x20plan:\x20','true','8992632KeSHnq','Failed\x20to\x20get\x20item\x20feedback:\x20','updateChecklistItem','jaZJF','/api/v1/mcp/features/','CtaOm','/feedback','JeqSc','gitRepoUrl','ewnjF','gXOGd','yipOc','Failed\x20to\x20conclude\x20session:\x20','ZvAyJ','pcBwI','GZeKy','rfTgj','offset','/api/v1/mcp/features','kfnTD','PATCH','kyvve','fuIUN','Bearer\x20','includeDeleted','length'];_0x5148=function(){return _0x6d3ef9;};return _0x5148();}export async function getFeatureReport(_0x1ec72d){const _0x530792=_0x3ffc,_0x1afc10={'gXOGd':_0x530792(0x1b9),'QemOf':function(_0x3b8f3f){return _0x3b8f3f();},'QspSa':function(_0x2be0ed,_0x3f97b7,_0x58cd9a){return _0x2be0ed(_0x3f97b7,_0x58cd9a);}},_0xc0674b=await getToken();if(!_0xc0674b)throw new Error(_0x1afc10[_0x530792(0x1ee)]);const _0x3f8166=_0x1afc10['QemOf'](getApiBaseUrl),_0x5afc1d=await _0x1afc10[_0x530792(0x1df)](fetch,_0x3f8166+_0x530792(0x1e8)+_0x1ec72d+_0x530792(0x1ca),{'method':_0x530792(0x1b8),'headers':{'Authorization':_0x530792(0x1ad)+_0xc0674b}});if(!_0x5afc1d['ok']){const _0x3106a6=await _0x5afc1d['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x3106a6);}return _0x5afc1d[_0x530792(0x1c3)]();}export async function getFeatureReportMarkdown(_0x113b67,_0x3521c7){const _0xac9d7b=_0x3ffc,_0xe02b2e={'tCAtO':_0xac9d7b(0x1b9),'ewnjF':function(_0xf2a20,_0xb342ff){return _0xf2a20>_0xb342ff;},'txHjy':'itemIds','ktmcs':'sessionId','fuIUN':function(_0x2c00fd,_0x158474){return _0x2c00fd&&_0x158474;},'tSSOO':_0xac9d7b(0x1b8)},_0x43d5b9=await getToken();if(!_0x43d5b9)throw new Error(_0xe02b2e['tCAtO']);const _0x347880=getApiBaseUrl(),_0x4823b6=new URLSearchParams(),_0xef9d22=_0xe02b2e[_0xac9d7b(0x1ed)](_0x3521c7?.['itemIds']?.[_0xac9d7b(0x1af)]??0x0,0x0),_0x103a9b=Boolean(_0x3521c7?.['sessionId']);_0xef9d22&&_0x3521c7?.[_0xac9d7b(0x1dc)]&&_0x4823b6['set'](_0xe02b2e['txHjy'],_0x3521c7['itemIds']['join'](','));_0x103a9b&&_0x3521c7?.['sessionId']&&_0x4823b6['set'](_0xe02b2e[_0xac9d7b(0x1b5)],_0x3521c7[_0xac9d7b(0x1c8)]);_0xe02b2e[_0xac9d7b(0x1ac)](!_0xef9d22,!_0x103a9b)&&_0x3521c7?.[_0xac9d7b(0x1be)]&&_0x4823b6[_0xac9d7b(0x1d4)]('style',_0x3521c7['style']);const _0x2e61b8=_0x347880+'/api/v1/mcp/features/'+_0x113b67+'/report/markdown',_0x342d9e=''+_0x2e61b8+(_0x4823b6['toString']()?'?'+_0x4823b6[_0xac9d7b(0x1d3)]():''),_0x25a537=await fetch(_0x342d9e,{'method':_0xe02b2e['tSSOO'],'headers':{'Authorization':_0xac9d7b(0x1ad)+_0x43d5b9}});if(!_0x25a537['ok']){const _0x397869=await _0x25a537[_0xac9d7b(0x1c5)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x397869);}return _0x25a537['text']();}export async function listFeatureSessions(_0x2b0db5){const _0x7dffc1=_0x3ffc,_0x40a8d1={'yDlHP':function(_0x5693c8){return _0x5693c8();},'BSXtN':function(_0x470be9,_0x1223cb,_0x1455a6){return _0x470be9(_0x1223cb,_0x1455a6);},'GZeKy':'GET'},_0x3b6f2c=await _0x40a8d1['yDlHP'](getToken);if(!_0x3b6f2c)throw new Error(_0x7dffc1(0x1b9));const _0x3ea8ec=getApiBaseUrl(),_0x4d6ad1=await _0x40a8d1['BSXtN'](fetch,_0x3ea8ec+'/api/v1/mcp/features/'+_0x2b0db5+_0x7dffc1(0x1b7),{'method':_0x40a8d1[_0x7dffc1(0x1a5)],'headers':{'Authorization':_0x7dffc1(0x1ad)+_0x3b6f2c}});if(!_0x4d6ad1['ok']){const _0x4b604f=await _0x4d6ad1[_0x7dffc1(0x1c5)]();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x4b604f);}return _0x4d6ad1['json']();}export async function startSession(_0x4b6492,_0x3b677d){const _0x2de3c7=_0x3ffc,_0x5ab986={'tlXoD':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','mVpwJ':'POST'},_0x3e41ea=await getToken();if(!_0x3e41ea)throw new Error(_0x5ab986['tlXoD']);const _0x58f695=getApiBaseUrl(),_0x15d475=await fetch(_0x58f695+'/api/v1/mcp/features/'+_0x4b6492+_0x2de3c7(0x1cf)+_0x3b677d+'/start',{'method':_0x5ab986['mVpwJ'],'headers':{'Authorization':_0x2de3c7(0x1ad)+_0x3e41ea}});if(!_0x15d475['ok']){const _0x1e6a88=await _0x15d475['text']();throw new Error(_0x2de3c7(0x1d6)+_0x1e6a88);}return _0x15d475['json']();}export async function concludeSession(_0x21d813,_0x45bc30){const _0x550b58=_0x3ffc,_0x3e635b={'htSTq':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x75d72e=await getToken();if(!_0x75d72e)throw new Error(_0x3e635b['htSTq']);const _0xf08a4c=getApiBaseUrl(),_0x10b2fa=await fetch(_0xf08a4c+_0x550b58(0x1e8)+_0x21d813+_0x550b58(0x1cf)+_0x45bc30+'/conclude',{'method':'POST','headers':{'Authorization':_0x550b58(0x1ad)+_0x75d72e}});if(!_0x10b2fa['ok']){const _0x3d61ea=await _0x10b2fa['text']();throw new Error(_0x550b58(0x1f0)+_0x3d61ea);}return _0x10b2fa[_0x550b58(0x1c3)]();}export async function getActionItems(_0x108420){const _0x427ac5=_0x3ffc,_0x26f4df={'rfTgj':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','SeghE':function(_0x7654d2){return _0x7654d2();}},_0x243bae=await getToken();if(!_0x243bae)throw new Error(_0x26f4df[_0x427ac5(0x1a6)]);const _0x29b3b3=_0x26f4df['SeghE'](getApiBaseUrl),_0x23397b=await fetch(_0x29b3b3+_0x427ac5(0x1e8)+_0x108420+'/action-items',{'method':'GET','headers':{'Authorization':_0x427ac5(0x1ad)+_0x243bae}});if(!_0x23397b['ok']){const _0xedf262=await _0x23397b[_0x427ac5(0x1c5)]();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0xedf262);}return _0x23397b['json']();}export async function getItemFeedback(_0x268e65,_0x5a056b){const _0xd902f4=_0x3ffc,_0x5077eb={'eGEkw':function(_0x4edcc6){return _0x4edcc6();},'pcBwI':function(_0x74a85,_0x2e4ad7,_0x59d101){return _0x74a85(_0x2e4ad7,_0x59d101);},'nLgPc':'GET'},_0x5b1994=await _0x5077eb[_0xd902f4(0x1da)](getToken);if(!_0x5b1994)throw new Error(_0xd902f4(0x1b9));const _0x448928=getApiBaseUrl(),_0x5eb19d=await _0x5077eb[_0xd902f4(0x1a4)](fetch,_0x448928+'/api/v1/mcp/features/'+_0x268e65+'/checklist-items/'+_0x5a056b+_0xd902f4(0x1ea),{'method':_0x5077eb[_0xd902f4(0x1d2)],'headers':{'Authorization':_0xd902f4(0x1ad)+_0x5b1994}});if(!_0x5eb19d['ok']){const _0x5a5f32=await _0x5eb19d[_0xd902f4(0x1c5)]();throw new Error(_0xd902f4(0x1e5)+_0x5a5f32);}return _0x5eb19d[_0xd902f4(0x1c3)]();}export async function markCommentsAddressed(_0x3516b9,_0xd0d343,_0x20d91f){const _0x12b788=_0x3ffc,_0x132d4e={'JeqSc':function(_0xe9ffa){return _0xe9ffa();},'mXVtM':'application/json'},_0x44cd35=await _0x132d4e[_0x12b788(0x1eb)](getToken);if(!_0x44cd35)throw new Error(_0x12b788(0x1b9));const _0x504e06=getApiBaseUrl(),_0x3c6f28=await fetch(_0x504e06+'/api/v1/mcp/features/'+_0x3516b9+_0x12b788(0x1b1),{'method':_0x12b788(0x1bc),'headers':{'Authorization':'Bearer\x20'+_0x44cd35,'Content-Type':_0x132d4e[_0x12b788(0x1c2)]},'body':JSON[_0x12b788(0x1b2)]({'checklistItemId':_0xd0d343,'commentIds':_0x20d91f})});if(!_0x3c6f28['ok']){const _0x1b1b34=await _0x3c6f28[_0x12b788(0x1c5)]();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x1b1b34);}}export async function softDeleteFeature(_0x75a112){const _0x250785=_0x3ffc,_0x28602e={'uLprJ':function(_0xd26093){return _0xd26093();},'UYOWf':_0x250785(0x1b9),'pjmok':function(_0xa98c30){return _0xa98c30();},'tPppQ':function(_0x194606,_0x2c619d,_0x352fe4){return _0x194606(_0x2c619d,_0x352fe4);},'wtTIV':_0x250785(0x1cc)},_0x48f08e=await _0x28602e['uLprJ'](getToken);if(!_0x48f08e)throw new Error(_0x28602e[_0x250785(0x1c9)]);const _0xfbd090=_0x28602e['pjmok'](getApiBaseUrl),_0x4cb67e=await _0x28602e['tPppQ'](fetch,_0xfbd090+'/api/v1/mcp/features/'+_0x75a112,{'method':_0x28602e[_0x250785(0x1d5)],'headers':{'Authorization':_0x250785(0x1ad)+_0x48f08e}});if(!_0x4cb67e['ok']){const _0x1ffe6d=await _0x4cb67e['text']();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x1ffe6d);}}export async function restoreFeature(_0x451579){const _0x24573e=_0x3ffc,_0x5eafff={'jaZJF':function(_0x2a1d4a,_0xa9d315,_0x615399){return _0x2a1d4a(_0xa9d315,_0x615399);}},_0xafb1fa=await getToken();if(!_0xafb1fa)throw new Error(_0x24573e(0x1b9));const _0x4d1d54=getApiBaseUrl(),_0x41f569=await _0x5eafff[_0x24573e(0x1e7)](fetch,_0x4d1d54+'/api/v1/mcp/features/'+_0x451579+_0x24573e(0x1e1),{'method':_0x24573e(0x1bc),'headers':{'Authorization':_0x24573e(0x1ad)+_0xafb1fa}});if(!_0x41f569['ok']){const _0xfad5fd=await _0x41f569['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0xfad5fd);}}
|
|
1
|
+
(function(_0x3348ba,_0x653be3){const _0x2656b4=_0x1adc,_0x4f8df9=_0x3348ba();while(!![]){try{const _0x1b2ac8=-parseInt(_0x2656b4(0x152))/0x1*(-parseInt(_0x2656b4(0x17e))/0x2)+parseInt(_0x2656b4(0x168))/0x3+parseInt(_0x2656b4(0x139))/0x4*(-parseInt(_0x2656b4(0x17d))/0x5)+parseInt(_0x2656b4(0x13a))/0x6+-parseInt(_0x2656b4(0x16d))/0x7+-parseInt(_0x2656b4(0x16b))/0x8*(-parseInt(_0x2656b4(0x169))/0x9)+-parseInt(_0x2656b4(0x143))/0xa*(-parseInt(_0x2656b4(0x13f))/0xb);if(_0x1b2ac8===_0x653be3)break;else _0x4f8df9['push'](_0x4f8df9['shift']());}catch(_0xa9e6eb){_0x4f8df9['push'](_0x4f8df9['shift']());}}}(_0x2877,0xf335e));function _0x2877(){const _0x49074a=['json','Feature\x20limit\x20exceeded','93407BWOnoZ','QLyMu','GET','toString','kdPok','Lqxub','jhwoE','LmwHj','sNzml','Failed\x20to\x20conclude\x20session:\x20','/report/markdown','pcvIN','stringify','limit','/conclude','zCOHn','nxOJe','xrazM','zjUHv','/sessions/','Bearer\x20','/sessions','4218903sSAFCx','9uGIkiE','/restore','3432128rhNcZT','GzXfa','13602729eKvFdu','itemIds','QQFOw','POST','mrucw','dKYsc','/action-items','SSJPk','DyziP','status','updateChecklistItem','Failed\x20to\x20list\x20sessions:\x20','/api/v1/mcp/features','text','klJKL','jnlBI','10CxrQjP','12FJVeMu','hpufn','uZjMK','set','https://dashboard.ranger.net/billing','843204MiSpag','1141170QNSYbH','gitRepoUrl','gitBranch','/start','/api/v1/mcp/features/','11sAiFzp','style','application/json','kdFlH','7750850GtBdfD','Failed\x20to\x20update\x20feature\x20review:\x20','offset','VXcVM','sessionId','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','fUeQE','ioRhB','wZOME','includeDeleted','PATCH','/comments/address'];_0x2877=function(){return _0x49074a;};return _0x2877();}import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';function _0x1adc(_0x1c5e90,_0x567c72){_0x1c5e90=_0x1c5e90-0x137;const _0x28779f=_0x2877();let _0x1adc97=_0x28779f[_0x1c5e90];return _0x1adc97;}export async function createFeature(_0x3a78b4){const _0x3941e6=_0x1adc,_0xad874e={'VXcVM':function(_0x4a9b51){return _0x4a9b51();},'SSJPk':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','QQFOw':_0x3941e6(0x141),'hpufn':function(_0x31a100,_0x5b071a){return _0x31a100===_0x5b071a;}},_0x417288=await _0xad874e[_0x3941e6(0x146)](getToken);if(!_0x417288)throw new Error(_0xad874e[_0x3941e6(0x174)]);const _0x586815=getApiBaseUrl(),_0x171277=await fetch(_0x586815+_0x3941e6(0x179),{'method':_0x3941e6(0x170),'headers':{'Authorization':'Bearer\x20'+_0x417288,'Content-Type':_0xad874e[_0x3941e6(0x16f)]},'body':JSON[_0x3941e6(0x15e)](_0x3a78b4)});if(!_0x171277['ok']){if(_0xad874e[_0x3941e6(0x17f)](_0x171277[_0x3941e6(0x176)],0x192)){const _0x47598b=await _0x171277[_0x3941e6(0x150)](),_0x4cfde4=_0x47598b['billingUrl']||_0x3941e6(0x138);throw new Error((_0x47598b['message']||_0x3941e6(0x151))+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x4cfde4);}const _0x56f53c=await _0x171277[_0x3941e6(0x17a)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x56f53c);}return _0x171277[_0x3941e6(0x150)]();}export async function listFeatures(_0x248d69){const _0x175a38=_0x1adc,_0x574d65={'Lqxub':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','kdFlH':_0x175a38(0x13b),'klJKL':_0x175a38(0x15f),'rwVDV':_0x175a38(0x145),'pcvIN':function(_0x4ed2de,_0x5affc4,_0x1d7239){return _0x4ed2de(_0x5affc4,_0x1d7239);}},_0x34b539=await getToken();if(!_0x34b539)throw new Error(_0x574d65[_0x175a38(0x157)]);const _0x3cd001=getApiBaseUrl(),_0x147383=new URLSearchParams();if(_0x248d69?.[_0x175a38(0x13b)])_0x147383[_0x175a38(0x137)](_0x574d65[_0x175a38(0x142)],_0x248d69['gitRepoUrl']);if(_0x248d69?.[_0x175a38(0x13c)])_0x147383['set']('gitBranch',_0x248d69['gitBranch']);if(_0x248d69?.[_0x175a38(0x15f)])_0x147383['set'](_0x574d65[_0x175a38(0x17b)],_0x248d69[_0x175a38(0x15f)]['toString']());if(_0x248d69?.[_0x175a38(0x145)])_0x147383['set'](_0x574d65['rwVDV'],_0x248d69['offset']['toString']());if(_0x248d69?.[_0x175a38(0x14d)])_0x147383['set'](_0x175a38(0x14d),'true');const _0x1d6970=_0x3cd001+_0x175a38(0x179)+(_0x147383['toString']()?'?'+_0x147383['toString']():''),_0x496e6f=await _0x574d65[_0x175a38(0x15d)](fetch,_0x1d6970,{'method':_0x175a38(0x154),'headers':{'Authorization':_0x175a38(0x166)+_0x34b539}});if(!_0x496e6f['ok']){const _0x23a93=await _0x496e6f[_0x175a38(0x17a)]();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x23a93);}return _0x496e6f['json']();}export async function getFeature(_0x4856ec){const _0x28d5e0=_0x1adc,_0x55bea9={'xrazM':_0x28d5e0(0x148)},_0x230092=await getToken();if(!_0x230092)throw new Error(_0x55bea9[_0x28d5e0(0x163)]);const _0x569f62=getApiBaseUrl(),_0x4b0ac6=await fetch(_0x569f62+_0x28d5e0(0x13e)+_0x4856ec,{'method':'GET','headers':{'Authorization':_0x28d5e0(0x166)+_0x230092}});if(!_0x4b0ac6['ok']){const _0x5b8fb5=await _0x4b0ac6[_0x28d5e0(0x17a)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x5b8fb5);}return _0x4b0ac6[_0x28d5e0(0x150)]();}export async function updateFeature(_0x21b444,_0x3d5a8c){const _0xa503f2=_0x1adc,_0x29abd8={'nxOJe':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','sPbBL':function(_0x386d3b,_0x575086,_0x5e70e1){return _0x386d3b(_0x575086,_0x5e70e1);}},_0x53c6e3=await getToken();if(!_0x53c6e3)throw new Error(_0x29abd8[_0xa503f2(0x162)]);const _0x44f42d=getApiBaseUrl(),_0x5e22f5=await _0x29abd8['sPbBL'](fetch,_0x44f42d+_0xa503f2(0x13e)+_0x21b444,{'method':_0xa503f2(0x14e),'headers':{'Authorization':'Bearer\x20'+_0x53c6e3,'Content-Type':_0xa503f2(0x141)},'body':JSON['stringify'](_0x3d5a8c)});if(!_0x5e22f5['ok']){const _0x2aa5be=await _0x5e22f5[_0xa503f2(0x17a)]();throw new Error(_0xa503f2(0x144)+_0x2aa5be);}return _0x5e22f5[_0xa503f2(0x150)]();}export async function createChecklistItem(_0x5698ff,_0x17519e,_0x17bf39){const _0x1fe2f6=_0x1adc,_0x3c3114={'hAiwj':function(_0x302bef){return _0x302bef();},'SQKlo':_0x1fe2f6(0x170),'kdPok':_0x1fe2f6(0x141)},_0xedd788=await _0x3c3114['hAiwj'](getToken);if(!_0xedd788)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x14acd7=getApiBaseUrl(),_0x2ee2ba=await fetch(_0x14acd7+_0x1fe2f6(0x13e)+_0x5698ff+'/checklist',{'method':_0x3c3114['SQKlo'],'headers':{'Authorization':_0x1fe2f6(0x166)+_0xedd788,'Content-Type':_0x3c3114[_0x1fe2f6(0x156)]},'body':JSON[_0x1fe2f6(0x15e)]({'description':_0x17519e,'position':_0x17bf39})});if(!_0x2ee2ba['ok']){const _0x1d0861=await _0x2ee2ba[_0x1fe2f6(0x17a)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x1d0861);}return _0x2ee2ba['json']();}export async function updateChecklistItem(_0x294d6d,_0x1bc018,_0x251946){const _0x5cb266=_0x1adc,_0x3ada83={'fUeQE':function(_0x19cf9d){return _0x19cf9d();},'beBoZ':_0x5cb266(0x141),'gefuY':_0x5cb266(0x177)};return withRetry(async()=>{const _0x41185a=_0x5cb266,_0x2639d5=await _0x3ada83[_0x41185a(0x14a)](getToken);if(!_0x2639d5)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x14a19f=getApiBaseUrl(),_0x11397e=await fetch(_0x14a19f+'/api/v1/mcp/features/'+_0x294d6d+'/checklist/'+_0x1bc018,{'method':'PATCH','headers':{'Authorization':_0x41185a(0x166)+_0x2639d5,'Content-Type':_0x3ada83['beBoZ']},'body':JSON['stringify'](_0x251946)});if(!_0x11397e['ok']){const _0x1a85e4=await _0x11397e['text']();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x1a85e4);}return _0x11397e['json']();},{'label':_0x3ada83['gefuY']});}export async function getFeatureReport(_0x102aaf){const _0x453423=_0x1adc,_0x4c2534={'QLyMu':_0x453423(0x154)},_0x29620d=await getToken();if(!_0x29620d)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x41cdd6=getApiBaseUrl(),_0x30d8dc=await fetch(_0x41cdd6+_0x453423(0x13e)+_0x102aaf+'/report',{'method':_0x4c2534[_0x453423(0x153)],'headers':{'Authorization':'Bearer\x20'+_0x29620d}});if(!_0x30d8dc['ok']){const _0x38b5d3=await _0x30d8dc['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x38b5d3);}return _0x30d8dc[_0x453423(0x150)]();}export async function getFeatureReportMarkdown(_0x459807,_0x10a856){const _0x25e2f9=_0x1adc,_0x2002ca={'jhwoE':function(_0x406330){return _0x406330();},'bjObH':function(_0x1cc630){return _0x1cc630();},'jnlBI':function(_0x51ecfe,_0x3ed123){return _0x51ecfe>_0x3ed123;},'LmwHj':function(_0x37c638,_0x10c2a9){return _0x37c638(_0x10c2a9);},'JiQQl':_0x25e2f9(0x16e),'mlJwL':_0x25e2f9(0x147),'sNzml':_0x25e2f9(0x154)},_0x15d64c=await _0x2002ca[_0x25e2f9(0x158)](getToken);if(!_0x15d64c)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1ccf6b=_0x2002ca['bjObH'](getApiBaseUrl),_0x4f880d=new URLSearchParams(),_0x43a234=_0x2002ca[_0x25e2f9(0x17c)](_0x10a856?.[_0x25e2f9(0x16e)]?.['length']??0x0,0x0),_0x4af2c3=_0x2002ca[_0x25e2f9(0x159)](Boolean,_0x10a856?.[_0x25e2f9(0x147)]);_0x43a234&&_0x10a856?.[_0x25e2f9(0x16e)]&&_0x4f880d['set'](_0x2002ca['JiQQl'],_0x10a856[_0x25e2f9(0x16e)]['join'](','));_0x4af2c3&&_0x10a856?.[_0x25e2f9(0x147)]&&_0x4f880d['set'](_0x2002ca['mlJwL'],_0x10a856[_0x25e2f9(0x147)]);!_0x43a234&&!_0x4af2c3&&_0x10a856?.[_0x25e2f9(0x140)]&&_0x4f880d[_0x25e2f9(0x137)](_0x25e2f9(0x140),_0x10a856[_0x25e2f9(0x140)]);const _0x5a865b=_0x1ccf6b+'/api/v1/mcp/features/'+_0x459807+_0x25e2f9(0x15c),_0x5c55a1=''+_0x5a865b+(_0x4f880d[_0x25e2f9(0x155)]()?'?'+_0x4f880d[_0x25e2f9(0x155)]():''),_0xb9bb88=await fetch(_0x5c55a1,{'method':_0x2002ca[_0x25e2f9(0x15a)],'headers':{'Authorization':'Bearer\x20'+_0x15d64c}});if(!_0xb9bb88['ok']){const _0x55f0f0=await _0xb9bb88['text']();throw new Error(_0x25e2f9(0x149)+_0x55f0f0);}return _0xb9bb88['text']();}export async function listFeatureSessions(_0x364d76){const _0x1c1162=_0x1adc,_0x1add9e={'mrucw':function(_0x4c148f,_0x461e2f,_0x4541e5){return _0x4c148f(_0x461e2f,_0x4541e5);}},_0x4ff5d4=await getToken();if(!_0x4ff5d4)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x504d43=getApiBaseUrl(),_0x30da08=await _0x1add9e[_0x1c1162(0x171)](fetch,_0x504d43+'/api/v1/mcp/features/'+_0x364d76+_0x1c1162(0x167),{'method':'GET','headers':{'Authorization':_0x1c1162(0x166)+_0x4ff5d4}});if(!_0x30da08['ok']){const _0xae651f=await _0x30da08[_0x1c1162(0x17a)]();throw new Error(_0x1c1162(0x178)+_0xae651f);}return _0x30da08[_0x1c1162(0x150)]();}export async function startSession(_0x2c78ce,_0x107860){const _0x1632e1=_0x1adc,_0xb30223={'PgckP':function(_0x43475e){return _0x43475e();}},_0xb7599=await getToken();if(!_0xb7599)throw new Error(_0x1632e1(0x148));const _0x5eb7f0=_0xb30223['PgckP'](getApiBaseUrl),_0x1db8fb=await fetch(_0x5eb7f0+'/api/v1/mcp/features/'+_0x2c78ce+_0x1632e1(0x165)+_0x107860+_0x1632e1(0x13d),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0xb7599}});if(!_0x1db8fb['ok']){const _0x513b67=await _0x1db8fb['text']();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x513b67);}return _0x1db8fb[_0x1632e1(0x150)]();}export async function concludeSession(_0x5119a3,_0x1852d8){const _0x137d8d=_0x1adc,_0x3ab2f6={'ioRhB':function(_0x144f2e){return _0x144f2e();},'BrUPq':function(_0x4f4c27,_0x3d08d8,_0x378a03){return _0x4f4c27(_0x3d08d8,_0x378a03);}},_0x1683ef=await getToken();if(!_0x1683ef)throw new Error(_0x137d8d(0x148));const _0xdf3203=_0x3ab2f6[_0x137d8d(0x14b)](getApiBaseUrl),_0x79fd27=await _0x3ab2f6['BrUPq'](fetch,_0xdf3203+_0x137d8d(0x13e)+_0x5119a3+_0x137d8d(0x165)+_0x1852d8+_0x137d8d(0x160),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x1683ef}});if(!_0x79fd27['ok']){const _0x1ee2bc=await _0x79fd27['text']();throw new Error(_0x137d8d(0x15b)+_0x1ee2bc);}return _0x79fd27['json']();}export async function getActionItems(_0x5c93f5){const _0x310a6b=_0x1adc,_0x31ae30={'uZjMK':_0x310a6b(0x148)},_0x3c9d5b=await getToken();if(!_0x3c9d5b)throw new Error(_0x31ae30[_0x310a6b(0x180)]);const _0x33d4c5=getApiBaseUrl(),_0xb3ba5d=await fetch(_0x33d4c5+_0x310a6b(0x13e)+_0x5c93f5+_0x310a6b(0x173),{'method':_0x310a6b(0x154),'headers':{'Authorization':_0x310a6b(0x166)+_0x3c9d5b}});if(!_0xb3ba5d['ok']){const _0x126973=await _0xb3ba5d[_0x310a6b(0x17a)]();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0x126973);}return _0xb3ba5d[_0x310a6b(0x150)]();}export async function getItemFeedback(_0x4b8c7c,_0x216540){const _0x3a11d0=_0x1adc,_0x48decf={'DyziP':function(_0x14fb9f){return _0x14fb9f();},'eMkXl':function(_0x14d14b,_0x305f02,_0xce5372){return _0x14d14b(_0x305f02,_0xce5372);}},_0x17bb11=await _0x48decf['DyziP'](getToken);if(!_0x17bb11)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x33f154=_0x48decf[_0x3a11d0(0x175)](getApiBaseUrl),_0x50d1d2=await _0x48decf['eMkXl'](fetch,_0x33f154+_0x3a11d0(0x13e)+_0x4b8c7c+'/checklist-items/'+_0x216540+'/feedback',{'method':'GET','headers':{'Authorization':_0x3a11d0(0x166)+_0x17bb11}});if(!_0x50d1d2['ok']){const _0x4fe779=await _0x50d1d2['text']();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x4fe779);}return _0x50d1d2[_0x3a11d0(0x150)]();}export async function markCommentsAddressed(_0x25f42d,_0x22b296,_0x2c3665){const _0x1ef55a=_0x1adc,_0x127210={'zCOHn':function(_0x320a6f){return _0x320a6f();},'eNYnp':function(_0x5f44fe){return _0x5f44fe();},'zjUHv':_0x1ef55a(0x170),'TBPav':'application/json'},_0x18a5d4=await _0x127210[_0x1ef55a(0x161)](getToken);if(!_0x18a5d4)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x227cd=_0x127210['eNYnp'](getApiBaseUrl),_0x57c066=await fetch(_0x227cd+_0x1ef55a(0x13e)+_0x25f42d+_0x1ef55a(0x14f),{'method':_0x127210[_0x1ef55a(0x164)],'headers':{'Authorization':_0x1ef55a(0x166)+_0x18a5d4,'Content-Type':_0x127210['TBPav']},'body':JSON[_0x1ef55a(0x15e)]({'checklistItemId':_0x22b296,'commentIds':_0x2c3665})});if(!_0x57c066['ok']){const _0x29e1c0=await _0x57c066[_0x1ef55a(0x17a)]();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x29e1c0);}}export async function softDeleteFeature(_0x1bc420){const _0x5b5af9=_0x1adc,_0x4d2ab0={'GzXfa':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','dKYsc':'DELETE'},_0x38ee23=await getToken();if(!_0x38ee23)throw new Error(_0x4d2ab0[_0x5b5af9(0x16c)]);const _0x2e0a87=getApiBaseUrl(),_0x28b69a=await fetch(_0x2e0a87+'/api/v1/mcp/features/'+_0x1bc420,{'method':_0x4d2ab0[_0x5b5af9(0x172)],'headers':{'Authorization':_0x5b5af9(0x166)+_0x38ee23}});if(!_0x28b69a['ok']){const _0xcac15e=await _0x28b69a[_0x5b5af9(0x17a)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0xcac15e);}}export async function restoreFeature(_0x44b760){const _0x449cac=_0x1adc,_0xc95574={'wZOME':_0x449cac(0x148),'YrEtq':_0x449cac(0x170)},_0xdba80f=await getToken();if(!_0xdba80f)throw new Error(_0xc95574[_0x449cac(0x14c)]);const _0x5d2c33=getApiBaseUrl(),_0x58cc06=await fetch(_0x5d2c33+'/api/v1/mcp/features/'+_0x44b760+_0x449cac(0x16a),{'method':_0xc95574['YrEtq'],'headers':{'Authorization':'Bearer\x20'+_0xdba80f}});if(!_0x58cc06['ok']){const _0x4a519f=await _0x58cc06['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x4a519f);}}
|