@ranger-testing/ranger-cli 3.1.3 → 3.1.4-alpha.96fdd81-47
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 -0
- 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
|
-
function _0x533e(){const _0x3383a3=['PUT','\x20failed\x20(','telemetry','JWWOA','environmentKey','lRRHQ','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','CyXGf','goto','cli:manual-login','type','\x20\x20Created\x20cloud\x20profile\x20\x22','orCEy','Ylquz','HeIRx','\x22,\x20refreshing\x20session...','BCLsf','143852BsrPpu','ulGng','then','10QoLuMF','not_configured','headers','dRIZe','fvjmd','length','organizationId','wYNSf','\x22\x20on\x20profile\x20\x22','RANGER_TEST_USERNAME','local_ws_error','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','\x22\x20not\x20found.','\x22.\x0a','RANGER_TEST_PASSWORD','3Vluxrs','zWUtO','loginInstructions','tunnelUrl','trim','browserOptions','802744sPoVvl','/session','environment_key','newContext','env','lMdXa','ewRxw','\x20\x20Login\x20successful.\x20Session\x20cached.','settings','stringify','ShMVX','trackPhaseEnd','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','effectiveBaseUrl','force','llHni','RLKVX','catch','TNHxO','tunnel_login_request','/api/v1/profiles','POST','1460916kabzTr','ucvmn','message','tunnel','tunnel_bridge_event','session_state','toISOString','FyDXW','vMDpa','YrEWe','100008xTeueq','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','statusText','901938ztKVqE','tunnel_error','ZleKs','\x20\x20No\x20live\x20session\x20for\x20\x22','ujYUz','tunnel_bridge','trackPhaseStart','tunnel_login_cleanup','WSjfJ','WhOrn','username','5wlCbVZ','zVheJ','rcxHD','YBzkf','confirm','detail','invalidateOn','invalid-url','pendingLocalConnections','host','BIIpK','sessionCheckPath','persistSessionState','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','fIFTp','PlARe','userAgent','clientIp','/api/v1/profiles/','KrIgX','url','sessionId','log','WZoDG','pFTiy','utf-8','jvNum','origin','name','RTdZD','defaultEnvironmentKey','parse','pIfnt','QhhFe','QjTIB','tunnel_session_id','some','DELETE','test_output','yGswk','pGhpI','btNoU','13737768VkwbuK','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','DComE','rwHqu','\x20\x20forceLogin\x20enabled\x20for\x20\x22','VXsZg','tDZRH','Cloud\x20profile\x20\x22','password','UpjWQ','Bearer\x20','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','350XNGZJM','FSshK','profiles','nHBNB','BSluV','launch','aeBHl','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','kuUtb','tunnel_login_setup','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','dAiUV','\x20\x20Server-side\x20login\x20error:\x20','auth','error','lIKRw','sessionState','\x22\x20failed\x20validation\x20—\x20refreshing...','cookies','GsEax','code','trackPhaseError','elapsedMs','string','mfPji','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','zPzua','nFYUD','405278FtHJmp','UxZHS','json','target_url','toLowerCase','storageStatePath','pwEndpoint','status','):\x20','storageState','2|0|3|1|4'];_0x533e=function(){return _0x3383a3;};return _0x533e();}const _0x29e5ed=_0x404c;(function(_0x508fcc,_0x42263d){const _0x5f7992=_0x404c,_0x4afa16=_0x508fcc();while(!![]){try{const _0x2be089=parseInt(_0x5f7992(0x23f))/0x1+-parseInt(_0x5f7992(0x273))/0x2*(parseInt(_0x5f7992(0x26d))/0x3)+-parseInt(_0x5f7992(0x25b))/0x4+parseInt(_0x5f7992(0x2a1))/0x5*(parseInt(_0x5f7992(0x296))/0x6)+parseInt(_0x5f7992(0x223))/0x7*(-parseInt(_0x5f7992(0x293))/0x8)+-parseInt(_0x5f7992(0x289))/0x9*(parseInt(_0x5f7992(0x25e))/0xa)+parseInt(_0x5f7992(0x217))/0xb;if(_0x2be089===_0x42263d)break;else _0x4afa16['push'](_0x4afa16['shift']());}catch(_0x506af7){_0x4afa16['push'](_0x4afa16['shift']());}}}(_0x533e,0x8d8c4));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x49363e from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x4eac93){const _0x575a41=_0x404c,_0x118eb9={'CyXGf':_0x575a41(0x1f4)};try{return new URL(_0x4eac93)[_0x575a41(0x1f6)];}catch{return _0x118eb9[_0x575a41(0x251)];}}function errorMessageForTelemetry(_0x4c25ad){const _0x2bbfe4=_0x404c;return _0x4c25ad instanceof Error?_0x4c25ad[_0x2bbfe4(0x28b)]:undefined;}function trackBridgeEvent(_0x128892,_0xda541f){const _0x136453=_0x404c,_0x429322={'KmhQa':_0x136453(0x28d),'rcxHD':_0x136453(0x297),'SgguT':_0x136453(0x268),'QhhFe':_0x136453(0x29b)};if(!_0x128892)return;const _0x35a199={'tunnelSessionId':_0xda541f['sessionId'],'tunnelEventType':_0xda541f[_0x136453(0x254)],'connectionId':_0xda541f['connectionId'],'code':_0xda541f[_0x136453(0x237)],'reason':_0xda541f['reason'],'error':_0xda541f['error'],'elapsedMs':_0xda541f[_0x136453(0x239)],'activeLocalConnections':_0xda541f['activeLocalConnections'],'pendingLocalConnections':_0xda541f[_0x136453(0x1f5)]};_0x128892['trackPhaseEnd'](_0x429322['KmhQa'],_0x35a199),(_0xda541f['type']===_0x429322[_0x136453(0x2a3)]||_0xda541f['type']===_0x429322['SgguT'])&&void _0x128892[_0x136453(0x238)](_0x429322[_0x136453(0x20e)],new Error(_0xda541f['error']??_0xda541f['type']),_0x35a199);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0xd5b59c=_0x404c,_0x5c4067={'YBzkf':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x115376=await getToken();if(!_0x115376)throw new Error(_0x5c4067[_0xd5b59c(0x2a4)]);return _0x115376;}async function apiRequest(_0x511c30,_0x271ba9={}){const _0x166059=_0x404c,_0xed4b9a={'BSluV':function(_0x264344){return _0x264344();},'WhOrn':function(_0x77258f,_0x250246){return _0x77258f===_0x250246;},'PlARe':_0x166059(0x23a)},_0x1efe93=await _0xed4b9a[_0x166059(0x227)](requireToken),_0x410f62=getApiBaseUrl(),_0x1e2653=await fetch(''+_0x410f62+_0x511c30,{..._0x271ba9,'headers':{'Authorization':_0x166059(0x221)+_0x1efe93,'Content-Type':'application/json',..._0x271ba9[_0x166059(0x260)]??{}}});if(!_0x1e2653['ok']){let _0x467ae7='',_0x321d6d;try{const _0x546a99=await _0x1e2653['json'](),_0x67450c=(_0xed4b9a[_0x166059(0x29f)](typeof _0x546a99[_0x166059(0x231)],_0x166059(0x23a))?_0x546a99[_0x166059(0x231)]:undefined)??JSON[_0x166059(0x27c)](_0x546a99);_0x467ae7=_0x67450c;_0xed4b9a[_0x166059(0x29f)](typeof _0x546a99['test_output'],_0xed4b9a[_0x166059(0x1fc)])&&_0x546a99[_0x166059(0x213)]&&(_0x467ae7=_0x467ae7+'\x0a'+_0x546a99['test_output']);if(typeof _0x546a99[_0x166059(0x237)]===_0x166059(0x23a))_0x321d6d=_0x546a99['code'];}catch{_0x467ae7=_0x1e2653[_0x166059(0x295)];}throw new ApiError('API\x20request\x20'+_0x511c30+_0x166059(0x24b)+_0x1e2653[_0x166059(0x246)]+_0x166059(0x247)+_0x467ae7,_0x1e2653[_0x166059(0x246)],_0x467ae7,_0x321d6d);}if(_0xed4b9a['WhOrn'](_0x1e2653['status'],0xcc))return undefined;return _0x1e2653[_0x166059(0x241)]();}export class ApiError extends Error{[_0x29e5ed(0x246)];[_0x29e5ed(0x2a6)];['code'];constructor(_0x5d5994,_0x35642f,_0x2391b3,_0x411c86){const _0x1a78ee=_0x29e5ed,_0x1b265f={'ShMVX':_0x1a78ee(0x249),'lIKRw':'ApiError'},_0x4f6a6e=_0x1b265f[_0x1a78ee(0x27d)]['split']('|');let _0x14ee01=0x0;while(!![]){switch(_0x4f6a6e[_0x14ee01++]){case'0':this['status']=_0x35642f;continue;case'1':this[_0x1a78ee(0x237)]=_0x411c86;continue;case'2':super(_0x5d5994);continue;case'3':this['detail']=_0x2391b3;continue;case'4':this[_0x1a78ee(0x209)]=_0x1b265f[_0x1a78ee(0x232)];continue;}break;}}}export async function fetchCloudProfile(_0x3df847){const _0x487fbe=_0x29e5ed,_0x5391a9={'GFtyU':function(_0x13b528,_0x2920b5){return _0x13b528(_0x2920b5);},'WWRpn':function(_0x512a96,_0x41e3b3){return _0x512a96 instanceof _0x41e3b3;},'ulGng':function(_0x4007c1,_0x156fd7){return _0x4007c1===_0x156fd7;}};try{return await _0x5391a9['GFtyU'](apiRequest,'/api/v1/profiles/'+_0x5391a9['GFtyU'](encodeURIComponent,_0x3df847));}catch(_0x134e14){if(_0x5391a9['WWRpn'](_0x134e14,ApiError)&&_0x5391a9[_0x487fbe(0x25c)](_0x134e14[_0x487fbe(0x246)],0x194))return null;throw _0x134e14;}}function _0x404c(_0x367e68,_0x55200f){_0x367e68=_0x367e68-0x1f3;const _0x533ecb=_0x533e();let _0x404cf9=_0x533ecb[_0x367e68];return _0x404cf9;}export async function listCloudProfiles(){const _0x18eb5c=_0x29e5ed,_0x2958ad={'qLEUf':function(_0x157626,_0xf1add){return _0x157626(_0xf1add);},'wYNSf':_0x18eb5c(0x287)},_0x3eef27=await _0x2958ad['qLEUf'](apiRequest,_0x2958ad[_0x18eb5c(0x265)]);return _0x3eef27[_0x18eb5c(0x225)];}export async function deleteCloudProfile(_0x28a118){const _0x1e4d4b=_0x29e5ed,_0x96e11f={'FoHcC':function(_0x4e60cb,_0x489fd3){return _0x4e60cb(_0x489fd3);},'QjTIB':function(_0x4a7954,_0x220afa){return _0x4a7954===_0x220afa;}};try{await apiRequest(_0x1e4d4b(0x1ff)+_0x96e11f['FoHcC'](encodeURIComponent,_0x28a118),{'method':'DELETE'});}catch(_0x42515a){if(_0x42515a instanceof ApiError&&_0x96e11f[_0x1e4d4b(0x20f)](_0x42515a['status'],0x194))throw new Error(_0x1e4d4b(0x21e)+_0x28a118+_0x1e4d4b(0x26a));throw _0x42515a;}}export async function createCloudProfile(_0x2de768,_0x36d4f5,_0x1c492c={}){const _0x1d79ab=_0x29e5ed,_0x5e43ad={'CNVFm':function(_0xe2a905,_0x1fe29e){return _0xe2a905>_0x1fe29e;},'fIFTp':function(_0x4505a0,_0x21aca4,_0x4b36e0){return _0x4505a0(_0x21aca4,_0x4b36e0);},'aVBVk':_0x1d79ab(0x287),'WZoDG':_0x1d79ab(0x288)},_0x3d8a49={'name':_0x2de768};if(_0x36d4f5)_0x3d8a49[_0x1d79ab(0x275)]=_0x36d4f5;_0x1c492c[_0x1d79ab(0x27b)]&&_0x5e43ad['CNVFm'](Object['keys'](_0x1c492c[_0x1d79ab(0x27b)])['length'],0x0)&&(_0x3d8a49[_0x1d79ab(0x27b)]=_0x1c492c['settings']);if(_0x1c492c[_0x1d79ab(0x2a0)])_0x3d8a49[_0x1d79ab(0x2a0)]=_0x1c492c[_0x1d79ab(0x2a0)];if(_0x1c492c[_0x1d79ab(0x21f)])_0x3d8a49['password']=_0x1c492c['password'];return await _0x5e43ad[_0x1d79ab(0x1fb)](apiRequest,_0x5e43ad['aVBVk'],{'method':_0x5e43ad[_0x1d79ab(0x204)],'body':JSON['stringify'](_0x3d8a49)});}export async function uploadCloudProfileSession(_0x21a620,_0x2df4e4){const _0x7cc21b=_0x29e5ed,_0x110962={'ZleKs':function(_0x19b863,_0x50fc70,_0x566a5f){return _0x19b863(_0x50fc70,_0x566a5f);},'Grhtx':_0x7cc21b(0x288)};return await _0x110962[_0x7cc21b(0x298)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x21a620)+_0x7cc21b(0x274),{'method':_0x110962['Grhtx'],'body':JSON['stringify']({'session_state':_0x2df4e4})});}export async function saveCloudProfileCredentials(_0x5dd251,_0x518e08,_0x4d9683){const _0x3effdf=_0x29e5ed,_0x27fd95={'nHBNB':function(_0x4f10d7,_0x53ffbd){return _0x4f10d7(_0x53ffbd);}};await apiRequest('/api/v1/profiles/'+_0x27fd95[_0x3effdf(0x226)](encodeURIComponent,_0x5dd251),{'method':_0x3effdf(0x24a),'body':JSON[_0x3effdf(0x27c)]({'username':_0x518e08,'password':_0x4d9683})});}export async function fetchAuthConfig(){const _0xbae061=_0x29e5ed,_0x222c09={'nFYUD':function(_0x56fb5f,_0x45d3d5){return _0x56fb5f(_0x45d3d5);},'QuDdn':'/api/v1/profiles/auth-config','tDZRH':function(_0x3ec069,_0x4755e4){return _0x3ec069!==_0x4755e4;}};try{const _0x3c2dfe=await _0x222c09[_0xbae061(0x23e)](apiRequest,_0x222c09['QuDdn']);return _0x3c2dfe['auth_config'];}catch(_0x360bd9){return _0x360bd9 instanceof ApiError&&_0x222c09[_0xbae061(0x21d)](_0x360bd9['status'],0x194)&&console[_0xbae061(0x231)]('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x360bd9[_0xbae061(0x28b)]),null;}}async function createTunnelSession(_0x51649e){const _0x4650e3=_0x29e5ed,_0x3e36b7={'pGhpI':'/api/v1/tunnel/sessions','FSshK':_0x4650e3(0x288)};return await apiRequest(_0x3e36b7[_0x4650e3(0x215)],{'method':_0x3e36b7[_0x4650e3(0x224)],'body':JSON['stringify']({'targetUrl':_0x51649e,'mode':'agent'})});}async function deleteTunnelSession(_0x45b612){const _0x3ba25=_0x29e5ed,_0x24edd7={'VXsZg':_0x3ba25(0x212)};await apiRequest('/api/v1/tunnel/sessions/'+_0x45b612,{'method':_0x24edd7[_0x3ba25(0x21c)]});}export function pickAdHocEnvKey(_0x23cc79){const _0x4eadad=_0x29e5ed,_0x281bf0={'zPzua':function(_0x577caf,_0x2cb6cf){return _0x577caf===_0x2cb6cf;},'bMeij':function(_0x3bb6e9,_0x3bec41){return _0x3bb6e9+_0x3bec41;}};if(!_0x23cc79)return null;if(_0x23cc79[_0x4eadad(0x20b)])return _0x23cc79[_0x4eadad(0x20b)];const _0x15e7ce=Object['keys'](_0x23cc79['environments']??{});if(_0x281bf0['zPzua'](_0x15e7ce[_0x4eadad(0x263)],0x1))return _0x15e7ce[0x0];if(_0x281bf0[_0x4eadad(0x23d)](_0x15e7ce[_0x4eadad(0x263)],0x0))return null;throw new Error(_0x281bf0['bMeij']('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x15e7ce['join'](',\x20')+').\x20','Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.'));}export async function resolveAdHocProfile(_0x11e3d9=process['env']){const _0x104461=_0x29e5ed,_0x92f5cd={'YrEWe':function(_0x1c53ba,_0x3a15fc){return _0x1c53ba(_0x3a15fc);},'TNHxO':function(_0x3a9745){return _0x3a9745();}},_0x44c004=_0x11e3d9[_0x104461(0x267)];if(!_0x44c004)return null;const _0x48349b=await _0x92f5cd['YrEWe'](fetchCloudProfile,_0x44c004);if(_0x48349b)return{'name':_0x48349b[_0x104461(0x209)],'profile':_0x48349b};const _0x52079d=await _0x92f5cd[_0x104461(0x285)](fetchAuthConfig),_0x5d0e5b=_0x92f5cd[_0x104461(0x292)](pickAdHocEnvKey,_0x52079d),_0x18d562=_0x11e3d9['RANGER_TEST_PASSWORD'],_0x5cb779=await createCloudProfile(_0x44c004,_0x5d0e5b??undefined,{'username':_0x44c004,'password':_0x18d562});return console['log'](_0x104461(0x255)+_0x5cb779[_0x104461(0x209)]+'\x22\x20for\x20'+_0x44c004),{'name':_0x5cb779['name'],'profile':_0x5cb779};}export async function writeSessionToLocalCache(_0x2a3185,_0x3e0196,_0x46c5b2,_0x29cf86,_0x5404ce,_0x534647,_0x38f992){const _0xb30273=_0x29e5ed,_0x30b32e={'vMDpa':function(_0x351abf,_0x2b9e77,_0x5b4ca3){return _0x351abf(_0x2b9e77,_0x5b4ca3);},'pIfnt':function(_0x3c698e){return _0x3c698e();},'tKhDP':_0xb30273(0x230),'zWUtO':function(_0x50c318,_0x19830b){return _0x50c318(_0x19830b);},'WOdEW':function(_0x1c836c,_0x40cbd4){return _0x1c836c>_0x40cbd4;},'dAiUV':function(_0x13e361,_0xbbd132,_0x167570){return _0x13e361(_0xbbd132,_0x167570);},'xKJci':function(_0x5c8198,_0x74fbb7,_0x4dffb4){return _0x5c8198(_0x74fbb7,_0x4dffb4);}},_0x1679d8=sessionCacheHash({'orgId':_0x3e0196,'profileName':_0x2a3185,'effectiveBaseUrl':_0x46c5b2,'setupHeaders':_0x29cf86,'invalidateOn':_0x38f992?.['invalidateOn'],'userAgent':_0x38f992?.[_0xb30273(0x1fd)],'clientIp':_0x38f992?.['clientIp']}),_0x3b4ef1=_0x30b32e[_0xb30273(0x291)](getSessionCachePath,_0x1679d8,_0x2a3185),_0x4e327f=_0x30b32e['vMDpa'](join,_0x30b32e[_0xb30273(0x20d)](getRangerHomeDir),_0x30b32e['tKhDP']);!_0x30b32e[_0xb30273(0x26e)](existsSync,_0x4e327f)&&await _0x30b32e[_0xb30273(0x291)](mkdir,_0x4e327f,{'recursive':!![]});const _0x328660={..._0x5404ce};_0x534647&&_0x30b32e['WOdEW'](_0x534647['length'],0x0)&&Array['isArray'](_0x328660['cookies'])&&(_0x328660[_0xb30273(0x235)]=_0x30b32e[_0xb30273(0x22e)](duplicateCookiesForDomains,_0x328660[_0xb30273(0x235)],_0x534647));const _0xe47bd2={'cached_at':new Date()[_0xb30273(0x28f)](),'session_state':_0x328660};await _0x30b32e['xKJci'](writeFile,_0x3b4ef1,JSON['stringify'](_0xe47bd2,null,0x2));const _0x3ab5c0=getStorageStatePath(_0x3b4ef1);return await writeFile(_0x3ab5c0,JSON[_0xb30273(0x27c)](_0x328660,null,0x2)),_0x3ab5c0;}export async function checkLocalCache(_0x3626b4,_0xe4f32e,_0x10e400,_0x50705f,_0x5123d1){const _0x225166=_0x29e5ed,_0x490060={'WSjfJ':function(_0x3eeaa9,_0x18ad9,_0x33d1d0){return _0x3eeaa9(_0x18ad9,_0x33d1d0);}},_0x12fc08=sessionCacheHash({'orgId':_0xe4f32e,'profileName':_0x3626b4,'effectiveBaseUrl':_0x10e400,'setupHeaders':_0x50705f,'invalidateOn':_0x5123d1?.[_0x225166(0x1f3)],'userAgent':_0x5123d1?.['userAgent'],'clientIp':_0x5123d1?.[_0x225166(0x1fe)]}),_0x192b39=_0x490060[_0x225166(0x29e)](getSessionCachePath,_0x12fc08,_0x3626b4),_0x1bc78e=getStorageStatePath(_0x192b39);if(!existsSync(_0x192b39)||!existsSync(_0x1bc78e))return null;try{const _0x277b72=await _0x490060['WSjfJ'](readFile,_0x192b39,_0x225166(0x206));return JSON[_0x225166(0x20c)](_0x277b72),{'storageStatePath':_0x1bc78e};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x4f8370,_0x246f8a){const _0x39830a=_0x29e5ed,_0x1f1ae8={'ucvmn':function(_0x5f06f2,_0x3964ba){return _0x5f06f2+_0x3964ba;}};if(!_0x246f8a||!_0x246f8a['domains']?.[_0x39830a(0x263)])return;let _0x34416e;try{_0x34416e=new URL(_0x4f8370);}catch{return;}const _0x3459ad=[];for(const _0x5e94df of _0x246f8a['domains']){try{_0x3459ad['push']({'raw':_0x5e94df,'url':new URL(_0x5e94df)});}catch{}}if(_0x3459ad[_0x39830a(0x263)]===0x0)return;if(_0x3459ad[_0x39830a(0x211)](_0x1c57bb=>_0x1c57bb[_0x39830a(0x201)][_0x39830a(0x208)]===_0x34416e[_0x39830a(0x208)]))return;const _0x528fea=_0x3459ad['map'](_0x447a1b=>'\x22'+_0x447a1b['raw']+'\x22')['join'](',\x20');console[_0x39830a(0x203)](_0x1f1ae8[_0x39830a(0x28a)](_0x39830a(0x1fa)+_0x528fea+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x4f8370+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+_0x39830a(0x250));}export async function serverSideLogin(_0x4427ac,_0x13b4ca){const _0x4013fe=_0x29e5ed,_0x2218ff={'mfPji':function(_0x24ad14,_0xe11d0e){return _0x24ad14===_0xe11d0e;},'SutpZ':function(_0x59055c,_0x35f7c5){return _0x59055c===_0x35f7c5;}},_0x19b1d9=process[_0x4013fe(0x277)][_0x4013fe(0x267)],_0x410b36=process[_0x4013fe(0x277)][_0x4013fe(0x26c)],_0x40b475={};if(_0x19b1d9)_0x40b475['username']=_0x19b1d9;if(_0x410b36)_0x40b475[_0x4013fe(0x21f)]=_0x410b36;if(_0x13b4ca?.['force'])_0x40b475['force']=!![];if(_0x13b4ca?.['targetUrl'])_0x40b475[_0x4013fe(0x242)]=_0x13b4ca['targetUrl'];_0x13b4ca?.[_0x4013fe(0x28c)]&&(_0x40b475[_0x4013fe(0x210)]=_0x13b4ca['tunnel']['sessionId'],_0x40b475['pw_endpoint']=_0x13b4ca['tunnel'][_0x4013fe(0x245)]);try{return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x4427ac)+'/login',{'method':'POST','body':JSON['stringify'](_0x40b475)});}catch(_0x73f0cb){if(_0x73f0cb instanceof ApiError&&_0x2218ff[_0x4013fe(0x23b)](_0x73f0cb['status'],0x190)&&_0x2218ff['SutpZ'](_0x73f0cb['code'],'not_configured'))return{'status':'not_configured','error':_0x73f0cb[_0x4013fe(0x2a6)]};throw _0x73f0cb;}}async function serverSideLoginWithOptionalTunnel(_0x500c10,_0x281a85,_0x1f6d48={}){const _0x11d187=_0x29e5ed,_0x48c20a={'IaGQu':function(_0x4623a4,_0x490666){return _0x4623a4(_0x490666);},'Xeyuj':function(_0x351a21,_0x2a09d9){return _0x351a21===_0x2a09d9;},'Nkjjl':'true','BIIpK':function(_0x4ec566,_0x77a81d){return _0x4ec566(_0x77a81d);},'aeBHl':'\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','pWiet':function(_0x505743,_0x23c9d7){return _0x505743(_0x23c9d7);},'UpjWQ':function(_0x808103){return _0x808103();},'wPMUM':_0x11d187(0x22c),'taBTO':_0x11d187(0x286),'Ylquz':function(_0x1862f4,_0x580f1c,_0x57051e){return _0x1862f4(_0x580f1c,_0x57051e);},'zVheJ':function(_0x4b68c8,_0x376018){return _0x4b68c8??_0x376018;},'RshVJ':function(_0x17dde2,_0x465239){return _0x17dde2(_0x465239);},'RLKVX':function(_0x163340,_0x274554){return _0x163340||_0x274554;},'pFTiy':function(_0x545883,_0xc421ef){return _0x545883(_0xc421ef);},'DKACR':_0x11d187(0x29d)};if(!needsTunnel(_0x281a85))return await serverSideLogin(_0x500c10,{'force':_0x1f6d48[_0x11d187(0x281)]});let _0x53d58e=null,_0x2d3df9=null,_0x1ddd83=null,_0x2b8f0f=null,_0x305154=![];const _0x43f443=process['env']['RANGER_TUNNEL_LOGIN_HEADED']?.[_0x11d187(0x243)](),_0x29e454=_0x43f443==='1'||_0x48c20a['Xeyuj'](_0x43f443,_0x48c20a['Nkjjl']),_0x278462={'profileName':_0x500c10,'targetUrlHost':targetHostForTelemetry(_0x281a85),'tunnelRequired':!![],'forceLogin':_0x48c20a[_0x11d187(0x1f7)](Boolean,_0x1f6d48[_0x11d187(0x281)]),'localBrowserServerHeaded':_0x29e454};try{_0x1f6d48[_0x11d187(0x24c)]?.[_0x11d187(0x29c)](_0x11d187(0x22c),_0x278462);_0x29e454&&console[_0x11d187(0x203)](_0x48c20a[_0x11d187(0x229)]);_0x53d58e=await _0x48c20a['pWiet'](launchBrowserServer,{'headless':!_0x29e454}),_0x2d3df9=await createTunnelSession(_0x281a85);const _0x19fba3=await _0x48c20a[_0x11d187(0x220)](requireToken);_0x1ddd83=await _0x48c20a['pWiet'](createTunnelBridge,{'localWsUrl':_0x53d58e['wsEndpoint'],'tunnelServerUrl':_0x2d3df9[_0x11d187(0x270)],'sessionId':_0x2d3df9[_0x11d187(0x202)],'apiKey':_0x19fba3,'onError':_0x12abce=>{_0x2b8f0f=_0x12abce;},'onClose':()=>{_0x2b8f0f??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x500c10);},'onEvent':_0x1cf71c=>trackBridgeEvent(_0x1f6d48[_0x11d187(0x24c)],_0x1cf71c)}),_0x1f6d48[_0x11d187(0x24c)]?.['trackPhaseEnd'](_0x48c20a['wPMUM'],{..._0x278462,'tunnelSessionId':_0x2d3df9['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x29e454}),_0x305154=!![];try{return _0x1f6d48[_0x11d187(0x24c)]?.['trackPhaseStart'](_0x48c20a['taBTO'],{..._0x278462,'tunnelSessionId':_0x2d3df9[_0x11d187(0x202)]}),await _0x48c20a[_0x11d187(0x257)](serverSideLogin,_0x500c10,{'force':_0x1f6d48['force'],'targetUrl':_0x281a85,'tunnel':{'sessionId':_0x2d3df9[_0x11d187(0x202)],'pwEndpoint':_0x2d3df9[_0x11d187(0x245)]}})[_0x11d187(0x25d)](_0x54825d=>{const _0x120caf=_0x11d187;return _0x1f6d48[_0x120caf(0x24c)]?.[_0x120caf(0x27e)]('tunnel_login_request',{..._0x278462,'tunnelSessionId':_0x2d3df9?.[_0x120caf(0x202)],'loginStatus':_0x54825d['status'],'hasSessionState':_0x48c20a['IaGQu'](Boolean,_0x54825d['session_state']),'hasTestOutput':Boolean(_0x54825d[_0x120caf(0x213)]),'bridgeError':errorMessageForTelemetry(_0x2b8f0f)}),_0x54825d;});}catch(_0x3a4595){await _0x1f6d48[_0x11d187(0x24c)]?.['trackPhaseError'](_0x48c20a['taBTO'],_0x48c20a[_0x11d187(0x2a2)](_0x2b8f0f,_0x3a4595),{..._0x278462,'tunnelSessionId':_0x2d3df9[_0x11d187(0x202)],'bridgeError':_0x48c20a['RshVJ'](errorMessageForTelemetry,_0x2b8f0f)});throw _0x2b8f0f??_0x3a4595;}}catch(_0x1aedea){!_0x305154&&await _0x1f6d48['telemetry']?.['trackPhaseError'](_0x48c20a['wPMUM'],_0x1aedea,{..._0x278462,'tunnelSessionId':_0x2d3df9?.['sessionId']});throw _0x1aedea;}finally{if(_0x48c20a[_0x11d187(0x283)](_0x2d3df9,_0x53d58e)||_0x1ddd83){const _0x2aeb24='2|3|1|0|4'['split']('|');let _0x2eb5f5=0x0;while(!![]){switch(_0x2aeb24[_0x2eb5f5++]){case'0':_0x2d3df9&&await _0x48c20a[_0x11d187(0x205)](deleteTunnelSession,_0x2d3df9[_0x11d187(0x202)])[_0x11d187(0x284)](()=>{});continue;case'1':_0x53d58e&&await _0x53d58e['close']()['catch'](()=>{});continue;case'2':_0x1f6d48[_0x11d187(0x24c)]?.['trackPhaseStart'](_0x48c20a['DKACR'],{..._0x278462,'tunnelSessionId':_0x2d3df9?.['sessionId']});continue;case'3':_0x1ddd83?.['close']();continue;case'4':_0x1f6d48['telemetry']?.['trackPhaseEnd'](_0x48c20a['DKACR'],{..._0x278462,'tunnelSessionId':_0x2d3df9?.['sessionId']});continue;}break;}}}}export async function manualBrowserLogin(_0x2a3781,_0x43c95c,_0x257f05={}){const _0x4b0c0d=_0x29e5ed,_0x19afeb={'btNoU':function(_0x34f397){return _0x34f397();},'oAyAw':'close','lMdXa':'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','FyDXW':function(_0x21af27,_0x373e9c){return _0x21af27>_0x373e9c;},'yGswk':'\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','KRxiq':function(_0x577213,_0x1e0a5f){return _0x577213(_0x1e0a5f);},'HeIRx':function(_0x38566d,_0x17b943){return _0x38566d&&_0x17b943;},'kuUtb':'Browser\x20login\x20timed\x20out\x20before\x20completion.','KrIgX':_0x4b0c0d(0x22a),'lRRHQ':function(_0x17bb26,_0x8257bb,_0x1e1931){return _0x17bb26(_0x8257bb,_0x1e1931);},'HPUTa':_0x4b0c0d(0x288),'DComE':_0x4b0c0d(0x253)};if(!isInteractive())throw new Error('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x2a3781[_0x4b0c0d(0x209)]+_0x4b0c0d(0x26b)+_0x19afeb[_0x4b0c0d(0x278)]+_0x4b0c0d(0x23c));const _0xfd0b0c=_0x43c95c&&_0x19afeb[_0x4b0c0d(0x290)](_0x43c95c['domains']['length'],0x0)?_0x43c95c['domains'][0x0]:'about:blank';console[_0x4b0c0d(0x203)](_0x4b0c0d(0x218)),console[_0x4b0c0d(0x203)](_0x19afeb[_0x4b0c0d(0x214)]),await new Promise(_0xfcbd8=>setTimeout(_0xfcbd8,0x7d0));const _0x5cdb81=await chromium[_0x4b0c0d(0x228)]({'headless':![]});let _0x424156=null;try{const _0x19a5b9={'ignoreHTTPSErrors':!![]};_0x43c95c?.['setupHeaders']&&(_0x19a5b9['extraHTTPHeaders']=_0x43c95c['setupHeaders']);const _0x46f6d4=await _0x5cdb81[_0x4b0c0d(0x276)](_0x19a5b9);await _0x19afeb['KRxiq'](addProfileSetupBanner,_0x46f6d4);const _0x338402=await _0x46f6d4['newPage']();await _0x338402[_0x4b0c0d(0x252)](_0xfd0b0c);let _0x28d6ba=![];await new Promise(_0x1d0944=>{const _0x5f186a={'XyyLo':function(_0x11fddb,_0x58b937){return _0x11fddb/_0x58b937;}},_0x4e2f54=setTimeout(()=>{const _0x415bf1=_0x404c;_0x28d6ba=!![],console[_0x415bf1(0x231)]('Browser\x20login\x20timed\x20out\x20after\x20'+_0x5f186a['XyyLo'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+_0x415bf1(0x27f)),_0x1d0944();},MANUAL_LOGIN_TIMEOUT_MS);_0x338402['on'](_0x19afeb['oAyAw'],async()=>{const _0x3fd911=_0x404c;clearTimeout(_0x4e2f54);try{const _0x4a21a8=await _0x46f6d4[_0x3fd911(0x248)]();_0x424156=_0x4a21a8;}catch{}_0x19afeb[_0x3fd911(0x216)](_0x1d0944);});});if(_0x19afeb[_0x4b0c0d(0x258)](_0x28d6ba,!_0x424156))throw new Error(_0x19afeb[_0x4b0c0d(0x22b)]);}finally{await _0x5cdb81['close']()['catch'](()=>{});}if(!_0x424156)throw new Error(_0x19afeb[_0x4b0c0d(0x200)]);return _0x257f05[_0x4b0c0d(0x1f9)]!==![]&&await _0x19afeb[_0x4b0c0d(0x24f)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x2a3781['name'])+'/session',{'method':_0x19afeb['HPUTa'],'body':JSON[_0x4b0c0d(0x27c)]({'session_state':_0x424156,'updated_by':_0x19afeb[_0x4b0c0d(0x219)]})}),{'sessionState':_0x424156};}export async function promptSaveCredentials(_0xa9f036){const _0x2128ec=_0x29e5ed,_0x2ea9db={'JWWOA':function(_0x449acf,_0x250c38){return _0x449acf||_0x250c38;},'ujYUz':_0x2128ec(0x2a5),'llHni':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','ZZuEj':function(_0xdffb2e,_0xebbfc){return _0xdffb2e(_0xebbfc);}},_0x43e960=process[_0x2128ec(0x277)][_0x2128ec(0x267)],_0x2ace00=process['env']['RANGER_TEST_PASSWORD'];if(_0x2ea9db[_0x2128ec(0x24d)](!_0x43e960,!_0x2ace00))return;if(!isInteractive())return;const {save:_0x57d3e9}=await _0x49363e['prompt']([{'type':_0x2ea9db[_0x2128ec(0x29a)],'name':'save','message':_0x2ea9db[_0x2128ec(0x282)],'default':![]}]);if(!_0x57d3e9)return;await apiRequest(_0x2128ec(0x1ff)+_0x2ea9db['ZZuEj'](encodeURIComponent,_0xa9f036),{'method':_0x2128ec(0x24a),'body':JSON[_0x2128ec(0x27c)]({'username':_0x43e960,'password':_0x2ace00})}),console[_0x2128ec(0x203)](_0x2128ec(0x22d));}export async function resolveCloudProfileSession(_0x3b2e50,_0x3d0c7b={}){const _0x32f8df=_0x29e5ed,_0x573009={'fvjmd':function(_0xac0301){return _0xac0301();},'orCEy':function(_0x271150,_0x7e7ce7,_0x2e19ff){return _0x271150(_0x7e7ce7,_0x2e19ff);},'RTdZD':function(_0x47c0b6,_0x229ce6){return _0x47c0b6===_0x229ce6;},'BCLsf':_0x32f8df(0x23a),'rwHqu':function(_0x56926d,_0x2bedab){return _0x56926d||_0x2bedab;},'dRIZe':function(_0x55cb7f,_0x408d04){return _0x55cb7f(_0x408d04);},'XPemD':function(_0x127f6e,_0x4ebbf6){return _0x127f6e>_0x4ebbf6;},'IHgXn':function(_0x297244,_0x5399f6,_0xfda0c2,_0xa3e78e,_0xf8573c,_0x4df7ae){return _0x297244(_0x5399f6,_0xfda0c2,_0xa3e78e,_0xf8573c,_0x4df7ae);},'UEoXJ':function(_0x483dc9,_0xf96768,_0x2040c9,_0x2ce778,_0x448793,_0x3f9244,_0x546836,_0x275da9){return _0x483dc9(_0xf96768,_0x2040c9,_0x2ce778,_0x448793,_0x3f9244,_0x546836,_0x275da9);},'GsEax':function(_0x3a5642,_0x33e10a,_0x396b38,_0x3481a6,_0x4934a2){return _0x3a5642(_0x33e10a,_0x396b38,_0x3481a6,_0x4934a2);},'jvNum':function(_0x2f613a,_0x41a006){return _0x2f613a(_0x41a006);},'qxIZp':function(_0x32e17e,_0x931aa9){return _0x32e17e||_0x931aa9;},'ewRxw':function(_0x3bface,_0xd1143c,_0x5ed756,_0x1584b7){return _0x3bface(_0xd1143c,_0x5ed756,_0x1584b7);},'HEbuZ':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','XxOQS':'success','sjATl':_0x32f8df(0x27a),'UxZHS':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...'},_0x3c5cac=_0x3b2e50[_0x32f8df(0x27b)]??{},_0x4c97fb=await _0x573009[_0x32f8df(0x262)](fetchAuthConfig),_0x4d0f9a=_0x4c97fb?_0x573009[_0x32f8df(0x256)](resolveAuthEnvironmentLocally,_0x4c97fb,_0x3b2e50['environmentKey']):null,_0x10e3b4=_0x573009[_0x32f8df(0x20a)](typeof _0x4d0f9a?.['loginInstructions'],_0x32f8df(0x23a))&&_0x4d0f9a['loginInstructions']['trim']()?_0x4d0f9a[_0x32f8df(0x26f)]:undefined,_0x4035b2=typeof _0x3c5cac['loginInstructions']===_0x573009[_0x32f8df(0x25a)]&&_0x3c5cac[_0x32f8df(0x26f)][_0x32f8df(0x271)]()?_0x3c5cac[_0x32f8df(0x26f)]:undefined,_0x49b099=_0x573009[_0x32f8df(0x21a)](_0x4035b2,!_0x10e3b4)?_0x3c5cac:{..._0x3c5cac,'loginInstructions':_0x10e3b4},_0x26bd66=_0x573009[_0x32f8df(0x261)](Boolean,_0x49b099['loginInstructions']?.['trim']()),_0x58e48a=Boolean(_0x3c5cac['forceLogin']||_0x4d0f9a?.['forceLogin']),_0x40430a=_0x4d0f9a?.['domains'],_0x5064eb=_0x3c5cac['setupHeaders'],_0x5c2d19=_0x5064eb??_0x4d0f9a?.['setupHeaders'],_0x2d6d23=_0x3d0c7b[_0x32f8df(0x280)]??_0x3c5cac['baseUrl']??(_0x40430a&&_0x573009['XPemD'](_0x40430a['length'],0x0)?_0x40430a[0x0]:''),_0x496ebd=_0x2d6d23?needsTunnel(_0x2d6d23):![],_0x450dc2={'invalidateOn':_0x4d0f9a?.[_0x32f8df(0x1f3)],'userAgent':_0x4d0f9a?.[_0x32f8df(0x272)]?.[_0x32f8df(0x1fd)]??_0x3c5cac['userAgent']};_0x58e48a&&console['log'](_0x32f8df(0x21b)+_0x3b2e50[_0x32f8df(0x209)]+_0x32f8df(0x259));if(!_0x58e48a){const _0xaf3dcf=await _0x573009['IHgXn'](checkLocalCache,_0x3b2e50[_0x32f8df(0x209)],_0x3b2e50[_0x32f8df(0x264)],_0x2d6d23,_0x5c2d19,_0x450dc2);if(_0xaf3dcf){if(_0x2d6d23&&!_0x496ebd){const _0x563e98=await isCachedSessionLive(_0xaf3dcf[_0x32f8df(0x244)],_0x2d6d23,{'sessionCheckPath':_0x4d0f9a?.[_0x32f8df(0x1f8)],'setupHeaders':_0x5c2d19},{'launchBrowser':launchRealBrowser});if(_0x563e98)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x3b2e50['name']+'\x22'),{'authPath':_0xaf3dcf['storageStatePath'],'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};console[_0x32f8df(0x203)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x3b2e50[_0x32f8df(0x209)]+_0x32f8df(0x234)),emitSessionValidationHint(_0x2d6d23,_0x4d0f9a);}else return _0x496ebd&&console['log'](_0x32f8df(0x294)+_0x3b2e50['name']+'\x22'),{'authPath':_0xaf3dcf[_0x32f8df(0x244)],'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};}}if(!_0x58e48a&&_0x3b2e50[_0x32f8df(0x233)]){if(_0x496ebd)console['log']('\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22'+_0x2d6d23+_0x32f8df(0x266)+_0x3b2e50['name']+'\x22');else{const _0x48200e=await _0x573009['UEoXJ'](writeSessionToLocalCache,_0x3b2e50['name'],_0x3b2e50['organizationId'],_0x2d6d23,_0x5c2d19,_0x3b2e50[_0x32f8df(0x233)],_0x40430a,_0x450dc2);if(_0x2d6d23){const _0x270b79=await _0x573009[_0x32f8df(0x236)](isCachedSessionLive,_0x48200e,_0x2d6d23,{'sessionCheckPath':_0x4d0f9a?.['sessionCheckPath'],'setupHeaders':_0x5c2d19},{'launchBrowser':launchRealBrowser});if(_0x270b79)return console['log'](_0x32f8df(0x222)+_0x3b2e50[_0x32f8df(0x209)]+'\x22,\x20cached\x20locally'),{'authPath':_0x48200e,'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};console['log']('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x3b2e50['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x573009['orCEy'](emitSessionValidationHint,_0x2d6d23,_0x4d0f9a);}else return{'authPath':_0x48200e,'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};}}if(_0x26bd66)return console['log'](_0x32f8df(0x299)+_0x3b2e50['name']+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};console[_0x32f8df(0x203)](_0x32f8df(0x299)+_0x3b2e50[_0x32f8df(0x209)]+'\x22,\x20attempting\x20login...');const _0x1020d7=Boolean(process[_0x32f8df(0x277)]['RANGER_TEST_USERNAME'])&&_0x573009[_0x32f8df(0x207)](Boolean,process['env'][_0x32f8df(0x26c)]),_0x1fab49=Boolean(_0x3b2e50['username']);if(_0x573009['qxIZp'](_0x1020d7,_0x1fab49))try{const _0xa88410=_0x2d6d23?await _0x573009['ewRxw'](serverSideLoginWithOptionalTunnel,_0x3b2e50[_0x32f8df(0x209)],_0x2d6d23,{'force':_0x58e48a,'telemetry':_0x3d0c7b['telemetry']}):await _0x573009['orCEy'](serverSideLogin,_0x3b2e50[_0x32f8df(0x209)],{'force':_0x58e48a});if(_0xa88410['status']===_0x32f8df(0x25f))console['log'](_0x573009['HEbuZ']);else{if(_0x573009['RTdZD'](_0xa88410[_0x32f8df(0x246)],_0x573009['XxOQS'])&&_0xa88410[_0x32f8df(0x28e)]){console['log'](_0x573009['sjATl']);const _0x583ef0=await writeSessionToLocalCache(_0x3b2e50['name'],_0x3b2e50[_0x32f8df(0x264)],_0x2d6d23,_0x5c2d19,_0xa88410[_0x32f8df(0x28e)],_0x40430a,_0x450dc2);return _0x1020d7&&!_0x1fab49&&await _0x573009['dRIZe'](promptSaveCredentials,_0x3b2e50[_0x32f8df(0x209)]),{'authPath':_0x583ef0,'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};}else _0xa88410[_0x32f8df(0x213)]&&(console[_0x32f8df(0x203)](_0x32f8df(0x269)),console['log'](_0xa88410['test_output'])),console['log'](_0x573009[_0x32f8df(0x240)]);}}catch(_0x11ea54){console['log'](_0x32f8df(0x22f)+(_0x11ea54 instanceof Error?_0x11ea54['message']:String(_0x11ea54))),console[_0x32f8df(0x203)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}const _0x5df96b=_0x4d0f9a?{..._0x4d0f9a,'setupHeaders':_0x5c2d19}:_0x2d6d23?{'key':_0x3b2e50[_0x32f8df(0x24e)]??'','domains':[_0x2d6d23],'setupHeaders':_0x5c2d19}:null,{sessionState:_0x59f8fa}=await _0x573009[_0x32f8df(0x279)](manualBrowserLogin,_0x3b2e50,_0x5df96b,{'persistSessionState':!_0x496ebd}),_0x268277=await writeSessionToLocalCache(_0x3b2e50['name'],_0x3b2e50[_0x32f8df(0x264)],_0x2d6d23,_0x5c2d19,_0x59f8fa,_0x40430a,_0x450dc2);return{'authPath':_0x268277,'settings':_0x49b099,'resolvedEnv':_0x4d0f9a};}
|
|
1
|
+
const _0x2f6d51=_0x29b1;(function(_0x27c087,_0x3d4855){const _0x50c95d=_0x29b1,_0x236bfe=_0x27c087();while(!![]){try{const _0x4b5c8b=-parseInt(_0x50c95d(0x207))/0x1*(-parseInt(_0x50c95d(0x21b))/0x2)+-parseInt(_0x50c95d(0x1d1))/0x3*(parseInt(_0x50c95d(0x1e6))/0x4)+parseInt(_0x50c95d(0x1bc))/0x5+parseInt(_0x50c95d(0x198))/0x6+-parseInt(_0x50c95d(0x1ea))/0x7+parseInt(_0x50c95d(0x167))/0x8*(parseInt(_0x50c95d(0x1ba))/0x9)+-parseInt(_0x50c95d(0x19c))/0xa*(-parseInt(_0x50c95d(0x1c6))/0xb);if(_0x4b5c8b===_0x3d4855)break;else _0x236bfe['push'](_0x236bfe['shift']());}catch(_0x120181){_0x236bfe['push'](_0x236bfe['shift']());}}}(_0x268b,0xd44a1));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x284cac 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(_0x5094a9){const _0x1b2109=_0x29b1;try{return new URL(_0x5094a9)[_0x1b2109(0x20c)];}catch{return _0x1b2109(0x1e3);}}function errorMessageForTelemetry(_0x3ff44a){const _0x26cc4d=_0x29b1;return _0x3ff44a instanceof Error?_0x3ff44a[_0x26cc4d(0x169)]:undefined;}function trackBridgeEvent(_0x31ca07,_0x39847f){const _0x2c942a=_0x29b1,_0xe2f2b4={'VSwPP':'tunnel_bridge'};if(!_0x31ca07)return;const _0x27c908={'tunnelSessionId':_0x39847f[_0x2c942a(0x1a1)],'tunnelEventType':_0x39847f[_0x2c942a(0x182)],'connectionId':_0x39847f[_0x2c942a(0x1f0)],'code':_0x39847f['code'],'reason':_0x39847f[_0x2c942a(0x17f)],'error':_0x39847f['error'],'elapsedMs':_0x39847f[_0x2c942a(0x180)],'activeLocalConnections':_0x39847f[_0x2c942a(0x1a4)],'pendingLocalConnections':_0x39847f['pendingLocalConnections']};_0x31ca07[_0x2c942a(0x1a5)](_0x2c942a(0x1e2),_0x27c908),(_0x39847f[_0x2c942a(0x182)]==='tunnel_error'||_0x39847f[_0x2c942a(0x182)]==='local_ws_error')&&void _0x31ca07[_0x2c942a(0x214)](_0xe2f2b4[_0x2c942a(0x183)],new Error(_0x39847f[_0x2c942a(0x187)]??_0x39847f[_0x2c942a(0x182)]),_0x27c908);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x5e1e5c={'UXUkU':function(_0xfb4370){return _0xfb4370();},'zuDWV':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0xbc145e=await _0x5e1e5c['UXUkU'](getToken);if(!_0xbc145e)throw new Error(_0x5e1e5c['zuDWV']);return _0xbc145e;}function _0x268b(){const _0x97ef71=['sessionId','cookies','targetUrl','activeLocalConnections','trackPhaseEnd','/api/v1/profiles','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','dUyrw','\x20failed\x20(','POST','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','statusText','log','\x22\x20failed\x20validation\x20—\x20refreshing...','code','tunnel_session_id','baseUrl','\x20\x20No\x20live\x20session\x20for\x20\x22','headers','toISOString','\x22\x20on\x20profile\x20\x22','ekezx','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','CvNvL','2303379YcapFg','goGPL','1142955UlUrrC','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','none','pwEndpoint','close','forceLogin','ErrGr','/session','hpuFj','invalidateOn','363ciYPnG','loginInstructions','XAKEy','sessionCheckPath','GfXZq','telemetry','YFGck','):\x20','environment_key','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','ApiError','3JGSMMh','Ghznx','session_state','ambiguous','PUT','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>`.','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','tunnel_login_setup','OiLry','tYrhp','length','xkHUt','GIYvM','env','\x20\x20Cloud\x20session\x20for\x20\x22','newPage','\x20\x20Created\x20cloud\x20profile\x20\x22','tunnel_bridge_event','invalid-url','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','tunnel','5912356XwfLpN','UtwVv','aMAez','qsWwn','5504345eLXGts','tfDHs','goto','organizationId','storageState','API\x20request\x20','connectionId','\x22;\x20proceeding\x20with\x20loginInstructions.','RANGER_TEST_PASSWORD','xXXqu','xKfGm','string','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','environments','/api/v1/tunnel/sessions/','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','\x22.\x0a','auth','\x22;\x20using\x20\x22','trackPhaseStart','/api/v1/profiles/','fKKua','heSux','ttbhU','settings','iKwFC',').\x20','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','tunnel_login_request','2868WDMKcw','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','XxDIL','KaAWL','username','host','envKey','domains','force','tEWNL','KNdjg','ZJaBh','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','trackPhaseError','2|0|1|4|3','VPcjx','password','catch','name','json','834tpcZRY','launch','\x20\x20Cached\x20session\x20for\x20\x22','raw','utf-8','wsEndpoint','8QtAMNU','ioTjV','message','cli:manual-login','rTyuc','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','\x20Available:\x20','newContext','AYZfB','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','join','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','status','FPIex','setupHeaders','pw_endpoint','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','keys','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a','VqBkh','\x22,\x20refreshing\x20session...','environmentKey','QXmRP','reason','elapsedMs','agent','type','VSwPP','prompt','qxjty','target_url','error','KPWLv','\x20\x20Server-side\x20login\x20error:\x20','RANGER_TEST_USERNAME','userAgent','zDaGD','DELETE','stringify','profiles','browserOptions','VYlmN','yJZtU','JsSlT','not_configured','\x20\x20Login\x20successful.\x20Session\x20cached.','success','test_output','1444794dGGuVN','\x20\x20Auth\x20env\x20\x22','defaultEnvironmentKey','map','367480rqwJRd','tunnelUrl','\x22,\x20attempting\x20login...','save','push'];_0x268b=function(){return _0x97ef71;};return _0x268b();}async function apiRequest(_0x53a59e,_0x4fa337={}){const _0x14714c=_0x29b1,_0x1ddcb7={'DcOQm':'string','KPWLv':function(_0x39da25,_0x9165a0){return _0x39da25===_0x9165a0;},'RrESY':function(_0x256bbc,_0x2f706e){return _0x256bbc===_0x2f706e;}},_0x5c5c38=await requireToken(),_0xfa8859=getApiBaseUrl(),_0xd00ea9=await fetch(''+_0xfa8859+_0x53a59e,{..._0x4fa337,'headers':{'Authorization':'Bearer\x20'+_0x5c5c38,'Content-Type':'application/json',..._0x4fa337[_0x14714c(0x1b3)]??{}}});if(!_0xd00ea9['ok']){let _0x419862='',_0x217d62;try{const _0x577984=await _0xd00ea9[_0x14714c(0x21a)](),_0x20ac42=(typeof _0x577984['error']===_0x1ddcb7['DcOQm']?_0x577984['error']:undefined)??JSON['stringify'](_0x577984);_0x419862=_0x20ac42;_0x1ddcb7['KPWLv'](typeof _0x577984['test_output'],_0x14714c(0x1f5))&&_0x577984[_0x14714c(0x197)]&&(_0x419862=_0x419862+'\x0a'+_0x577984[_0x14714c(0x197)]);if(_0x1ddcb7[_0x14714c(0x188)](typeof _0x577984[_0x14714c(0x1af)],'string'))_0x217d62=_0x577984['code'];}catch{_0x419862=_0xd00ea9[_0x14714c(0x1ac)];}throw new ApiError(_0x14714c(0x1ef)+_0x53a59e+_0x14714c(0x1a9)+_0xd00ea9[_0x14714c(0x173)]+_0x14714c(0x1cd)+_0x419862,_0xd00ea9[_0x14714c(0x173)],_0x419862,_0x217d62);}if(_0x1ddcb7['RrESY'](_0xd00ea9[_0x14714c(0x173)],0xcc))return undefined;return _0xd00ea9['json']();}export class ApiError extends Error{['status'];['detail'];[_0x2f6d51(0x1af)];constructor(_0x421435,_0x3141aa,_0x8b13f7,_0x44ea49){const _0x253289=_0x2f6d51,_0x2199ac={'fKKua':_0x253289(0x1d0)};super(_0x421435),this['status']=_0x3141aa,this['detail']=_0x8b13f7,this[_0x253289(0x1af)]=_0x44ea49,this[_0x253289(0x219)]=_0x2199ac[_0x253289(0x1ff)];}}export async function fetchCloudProfile(_0x5db542){const _0x5af929=_0x2f6d51,_0x4563ff={'ErrGr':function(_0x459c12,_0x3f92dc){return _0x459c12(_0x3f92dc);},'YufOU':function(_0x48a436,_0x3ad6e9){return _0x48a436 instanceof _0x3ad6e9;}};try{return await apiRequest(_0x5af929(0x1fe)+_0x4563ff[_0x5af929(0x1c2)](encodeURIComponent,_0x5db542));}catch(_0x4d86b5){if(_0x4563ff['YufOU'](_0x4d86b5,ApiError)&&_0x4d86b5[_0x5af929(0x173)]===0x194)return null;throw _0x4d86b5;}}export async function listCloudProfiles(){const _0x26361d=_0x2f6d51,_0x2e03e6=await apiRequest(_0x26361d(0x1a6));return _0x2e03e6[_0x26361d(0x18f)];}export async function deleteCloudProfile(_0x21b875){const _0x390da0=_0x2f6d51,_0x1dec4d={'rlBlZ':function(_0x43dca8,_0x254ef7){return _0x43dca8(_0x254ef7);},'ryjaw':'DELETE','zmfJO':function(_0x4ce856,_0xdd81b5){return _0x4ce856 instanceof _0xdd81b5;},'YFGck':function(_0x7a299,_0x470775){return _0x7a299===_0x470775;}};try{await apiRequest('/api/v1/profiles/'+_0x1dec4d['rlBlZ'](encodeURIComponent,_0x21b875),{'method':_0x1dec4d['ryjaw']});}catch(_0x29a917){if(_0x1dec4d['zmfJO'](_0x29a917,ApiError)&&_0x1dec4d[_0x390da0(0x1cc)](_0x29a917[_0x390da0(0x173)],0x194))throw new Error('Cloud\x20profile\x20\x22'+_0x21b875+'\x22\x20not\x20found.');throw _0x29a917;}}export async function createCloudProfile(_0x4286da,_0x8006e0,_0x4feefb={}){const _0x2a77f7=_0x2f6d51,_0x25679b={'umwuQ':function(_0xc614a3,_0x1782d2){return _0xc614a3>_0x1782d2;},'OiLry':'/api/v1/profiles'},_0x462741={'name':_0x4286da};if(_0x8006e0)_0x462741[_0x2a77f7(0x1ce)]=_0x8006e0;_0x4feefb[_0x2a77f7(0x202)]&&_0x25679b['umwuQ'](Object['keys'](_0x4feefb[_0x2a77f7(0x202)])['length'],0x0)&&(_0x462741['settings']=_0x4feefb[_0x2a77f7(0x202)]);if(_0x4feefb[_0x2a77f7(0x20b)])_0x462741['username']=_0x4feefb['username'];if(_0x4feefb[_0x2a77f7(0x217)])_0x462741[_0x2a77f7(0x217)]=_0x4feefb['password'];return await apiRequest(_0x25679b[_0x2a77f7(0x1d9)],{'method':'POST','body':JSON['stringify'](_0x462741)});}export async function uploadCloudProfileSession(_0x1da42d,_0x3bb226){const _0x7a373b=_0x2f6d51;return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x1da42d)+_0x7a373b(0x1c3),{'method':_0x7a373b(0x1aa),'body':JSON['stringify']({'session_state':_0x3bb226})});}export async function saveCloudProfileCredentials(_0x3582aa,_0x54f491,_0x18784f){const _0x5aae4f=_0x2f6d51,_0x186c82={'ioTjV':function(_0x4743ad,_0x349a72,_0x184f64){return _0x4743ad(_0x349a72,_0x184f64);},'BhBDh':function(_0x3eecbf,_0x3edd07){return _0x3eecbf(_0x3edd07);}};await _0x186c82[_0x5aae4f(0x168)](apiRequest,'/api/v1/profiles/'+_0x186c82['BhBDh'](encodeURIComponent,_0x3582aa),{'method':_0x5aae4f(0x1d5),'body':JSON['stringify']({'username':_0x54f491,'password':_0x18784f})});}export async function fetchAuthConfig(){const _0x569fd9=_0x2f6d51,_0x1c36da={'Xdqad':function(_0x4d523e,_0x2b8c1c){return _0x4d523e instanceof _0x2b8c1c;}};try{const _0x3969c2=await apiRequest('/api/v1/profiles/auth-config');return _0x3969c2['auth_config'];}catch(_0x3995b5){return _0x1c36da['Xdqad'](_0x3995b5,ApiError)&&_0x3995b5[_0x569fd9(0x173)]!==0x194&&console['error'](_0x569fd9(0x177)+_0x3995b5['message']),null;}}async function createTunnelSession(_0x4f3a68){const _0x319482=_0x2f6d51,_0x48b3b3={'DNdvv':'/api/v1/tunnel/sessions','IakmE':_0x319482(0x1aa),'kThvw':_0x319482(0x181)};return await apiRequest(_0x48b3b3['DNdvv'],{'method':_0x48b3b3['IakmE'],'body':JSON['stringify']({'targetUrl':_0x4f3a68,'mode':_0x48b3b3['kThvw']})});}async function deleteTunnelSession(_0x3c086f){const _0x3877cc=_0x2f6d51,_0x5b7fed={'zDaGD':_0x3877cc(0x18d)};await apiRequest(_0x3877cc(0x1f8)+_0x3c086f,{'method':_0x5b7fed[_0x3877cc(0x18c)]});}export function pickAdHocEnvKey(_0x295175,_0x33df3d,_0x24404d){const _0x4c075a=_0x2f6d51,_0x53db0d={'qsWwn':function(_0x506743,_0x4c17bf){return _0x506743+_0x4c17bf;},'Hmwqf':function(_0x526933,_0x250397){return _0x526933 in _0x250397;},'heSux':function(_0xdb463e,_0x210220){return _0xdb463e in _0x210220;},'xKfGm':'ambiguous'};if(_0x24404d){if(!_0x295175?.['environments']?.[_0x24404d]){const _0x2315fc=Object[_0x4c075a(0x179)](_0x295175?.[_0x4c075a(0x1f7)]??{});throw new Error(_0x53db0d[_0x4c075a(0x1e9)]('Auth\x20environment\x20\x22'+_0x24404d+_0x4c075a(0x16c),_0x2315fc[_0x4c075a(0x1db)]?_0x4c075a(0x16d)+_0x2315fc[_0x4c075a(0x171)](',\x20')+'.':'\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.')+'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)');}return _0x24404d;}if(!_0x295175)return null;if(_0x33df3d){const _0x4e0458=matchAuthEnvironmentExact(_0x33df3d,_0x295175);if(_0x4e0458)return _0x4e0458;const _0xfe26ff=matchAuthEnvironmentByHost(_0x33df3d,_0x295175);if(_0xfe26ff&&_0x53db0d['Hmwqf']('key',_0xfe26ff))return console[_0x4c075a(0x1ad)](_0x4c075a(0x199)+_0xfe26ff['key']+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x33df3d+_0x4c075a(0x1f9)),_0xfe26ff['key'];if(_0xfe26ff&&_0x53db0d[_0x4c075a(0x200)](_0x53db0d[_0x4c075a(0x1f4)],_0xfe26ff))throw new Error(_0x4c075a(0x1b8)+_0xfe26ff[_0x4c075a(0x1d4)][_0x4c075a(0x171)](',\x20')+');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.');if(needsTunnel(_0x33df3d))throw new Error(_0x53db0d[_0x4c075a(0x1e9)](_0x53db0d['qsWwn'](_0x53db0d['qsWwn']('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x33df3d+_0x4c075a(0x1fa)+_0x4c075a(0x17a),'\x20\x20Options:\x0a')+'\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'+_0x33df3d['replace'](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),'\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20'+_0x33df3d+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x295175[_0x4c075a(0x19a)])return _0x295175['defaultEnvironmentKey'];const _0x9a14fa=Object['keys'](_0x295175[_0x4c075a(0x1f7)]??{});if(_0x9a14fa[_0x4c075a(0x1db)]===0x1)return _0x9a14fa[0x0];if(_0x9a14fa['length']===0x0)return null;throw new Error(_0x53db0d['qsWwn']('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x9a14fa[_0x4c075a(0x171)](',\x20')+_0x4c075a(0x204),_0x4c075a(0x1d6)));}export function adHocProfileName(_0x178354,_0x143e93,_0x4282ee){if(!_0x143e93||_0x143e93===_0x4282ee)return _0x178354;return _0x178354+':'+_0x143e93;}export async function resolveAdHocProfile(_0x2416ad={},_0x4abe92=process['env']){const _0x1abfac=_0x2f6d51,_0x110d4e={'qxjty':function(_0x28dc17,_0x481f4a){return _0x28dc17&&_0x481f4a;},'yJZtU':function(_0x11e06f,_0x20e9ea){return _0x11e06f!==_0x20e9ea;},'RYyhc':_0x1abfac(0x1be),'YIDnD':function(_0x512977,_0x327ce3,_0x5a5445,_0x151d96){return _0x512977(_0x327ce3,_0x5a5445,_0x151d96);}},_0x2e7afc=_0x4abe92['RANGER_TEST_USERNAME'];if(!_0x2e7afc)return null;const _0x4ea078=await fetchAuthConfig(),_0x4005ed=pickAdHocEnvKey(_0x4ea078,_0x2416ad['targetUrl'],_0x2416ad[_0x1abfac(0x20d)]);let _0x3ecd4a=adHocProfileName(_0x2e7afc,_0x4005ed,_0x4ea078?.[_0x1abfac(0x19a)]),_0x1db1b0=await fetchCloudProfile(_0x3ecd4a);_0x110d4e[_0x1abfac(0x185)](_0x1db1b0,_0x4005ed)&&_0x110d4e[_0x1abfac(0x192)](_0x1db1b0[_0x1abfac(0x17d)],_0x4005ed)&&(console[_0x1abfac(0x1ad)]('\x20\x20Cloud\x20profile\x20\x22'+_0x3ecd4a+_0x1abfac(0x1a7)+(_0x1db1b0['environmentKey']??_0x110d4e['RYyhc'])+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x4005ed+_0x1abfac(0x1fc)+_0x2e7afc+':'+_0x4005ed+'\x22\x20instead.'),_0x3ecd4a=_0x2e7afc+':'+_0x4005ed,_0x1db1b0=await fetchCloudProfile(_0x3ecd4a));if(_0x1db1b0)return{'name':_0x1db1b0[_0x1abfac(0x219)],'profile':_0x1db1b0};const _0x543340=_0x4abe92['RANGER_TEST_PASSWORD'],_0x1a8959=await _0x110d4e['YIDnD'](createCloudProfile,_0x3ecd4a,_0x4005ed??undefined,{'username':_0x2e7afc,'password':_0x543340});return console[_0x1abfac(0x1ad)](_0x1abfac(0x1e1)+_0x1a8959[_0x1abfac(0x219)]+'\x22\x20for\x20'+_0x2e7afc+(_0x4005ed?'\x20(auth\x20env:\x20'+_0x4005ed+')':'')),{'name':_0x1a8959['name'],'profile':_0x1a8959};}function _0x29b1(_0x4815a2,_0x5013e9){_0x4815a2=_0x4815a2-0x166;const _0x268b3f=_0x268b();let _0x29b1f2=_0x268b3f[_0x4815a2];return _0x29b1f2;}export async function writeSessionToLocalCache(_0xd7f48f,_0x10427f,_0x5eb489,_0x3c402d,_0x38ed2e,_0x1c1233,_0x461e13){const _0x551707=_0x2f6d51,_0x289a2c={'muayp':function(_0x1b3cd8,_0x5928e4){return _0x1b3cd8(_0x5928e4);},'VqBkh':function(_0x7c2e71,_0x4be7fb,_0x14f6e5){return _0x7c2e71(_0x4be7fb,_0x14f6e5);},'rTyuc':function(_0x5b61ab){return _0x5b61ab();},'GfXZq':_0x551707(0x1fb),'pyXhA':function(_0x40b933,_0x1bb452){return _0x40b933>_0x1bb452;},'VYlmN':function(_0x378510,_0x39ebf3,_0x3e41e7){return _0x378510(_0x39ebf3,_0x3e41e7);}},_0x234c7e=_0x289a2c['muayp'](sessionCacheHash,{'orgId':_0x10427f,'profileName':_0xd7f48f,'effectiveBaseUrl':_0x5eb489,'setupHeaders':_0x3c402d,'invalidateOn':_0x461e13?.[_0x551707(0x1c5)],'userAgent':_0x461e13?.['userAgent'],'clientIp':_0x461e13?.['clientIp']}),_0x27c66a=_0x289a2c[_0x551707(0x17b)](getSessionCachePath,_0x234c7e,_0xd7f48f),_0x50b65e=join(_0x289a2c[_0x551707(0x16b)](getRangerHomeDir),_0x289a2c[_0x551707(0x1ca)]);!existsSync(_0x50b65e)&&await mkdir(_0x50b65e,{'recursive':!![]});const _0xa57f14={..._0x38ed2e};_0x1c1233&&_0x289a2c['pyXhA'](_0x1c1233['length'],0x0)&&Array['isArray'](_0xa57f14[_0x551707(0x1a2)])&&(_0xa57f14['cookies']=duplicateCookiesForDomains(_0xa57f14[_0x551707(0x1a2)],_0x1c1233));const _0x2da243={'cached_at':new Date()[_0x551707(0x1b4)](),'session_state':_0xa57f14};await _0x289a2c['VqBkh'](writeFile,_0x27c66a,JSON['stringify'](_0x2da243,null,0x2));const _0x11f035=getStorageStatePath(_0x27c66a);return await _0x289a2c[_0x551707(0x191)](writeFile,_0x11f035,JSON['stringify'](_0xa57f14,null,0x2)),_0x11f035;}export async function checkLocalCache(_0x57bc85,_0x4b8279,_0x244fb4,_0x1f3f32,_0x516de6){const _0x4d4352=_0x2f6d51,_0x5588a9={'eWxKT':function(_0x299c22,_0x11f695,_0x565deb){return _0x299c22(_0x11f695,_0x565deb);},'KNdjg':function(_0x4441d3,_0x2d06d2){return _0x4441d3(_0x2d06d2);}},_0x3f09fb=sessionCacheHash({'orgId':_0x4b8279,'profileName':_0x57bc85,'effectiveBaseUrl':_0x244fb4,'setupHeaders':_0x1f3f32,'invalidateOn':_0x516de6?.['invalidateOn'],'userAgent':_0x516de6?.['userAgent'],'clientIp':_0x516de6?.['clientIp']}),_0x566ba0=_0x5588a9['eWxKT'](getSessionCachePath,_0x3f09fb,_0x57bc85),_0x34fb31=_0x5588a9[_0x4d4352(0x211)](getStorageStatePath,_0x566ba0);if(!existsSync(_0x566ba0)||!existsSync(_0x34fb31))return null;try{const _0x459371=await _0x5588a9['eWxKT'](readFile,_0x566ba0,_0x4d4352(0x21f));return JSON['parse'](_0x459371),{'storageStatePath':_0x34fb31};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x44a100,_0x165476){const _0x3e1faa=_0x2f6d51,_0x20bb21={'yMKeB':function(_0x1b5cb0,_0x188f14){return _0x1b5cb0+_0x188f14;}};if(!_0x165476||!_0x165476['domains']?.[_0x3e1faa(0x1db)])return;let _0x591372;try{_0x591372=new URL(_0x44a100);}catch{return;}const _0x2c496b=[];for(const _0x4b5282 of _0x165476[_0x3e1faa(0x20e)]){try{_0x2c496b[_0x3e1faa(0x1a0)]({'raw':_0x4b5282,'url':new URL(_0x4b5282)});}catch{}}if(_0x2c496b[_0x3e1faa(0x1db)]===0x0)return;if(_0x2c496b['some'](_0x5c810c=>_0x5c810c['url']['origin']===_0x591372['origin']))return;const _0x506fa8=_0x2c496b[_0x3e1faa(0x19b)](_0xbfcc81=>'\x22'+_0xbfcc81[_0x3e1faa(0x21e)]+'\x22')['join'](',\x20');console['log'](_0x20bb21['yMKeB']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x506fa8+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x44a100+_0x3e1faa(0x1bd))+'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.');}export async function serverSideLogin(_0x46aa21,_0x3143af){const _0x38fe02=_0x2f6d51,_0x12fb9e={'exUEi':function(_0x90105a,_0x1b0e4a,_0x3faa97){return _0x90105a(_0x1b0e4a,_0x3faa97);},'XgTvz':function(_0x45a195,_0x5991e1){return _0x45a195 instanceof _0x5991e1;},'pZQNK':function(_0xb69f4a,_0x2a7e1c){return _0xb69f4a===_0x2a7e1c;},'QXmRP':'not_configured'},_0x3d732d=process[_0x38fe02(0x1de)]['RANGER_TEST_USERNAME'],_0x2b2a2d=process[_0x38fe02(0x1de)]['RANGER_TEST_PASSWORD'],_0x3d1e9a={};if(_0x3d732d)_0x3d1e9a['username']=_0x3d732d;if(_0x2b2a2d)_0x3d1e9a[_0x38fe02(0x217)]=_0x2b2a2d;if(_0x3143af?.['force'])_0x3d1e9a[_0x38fe02(0x20f)]=!![];if(_0x3143af?.['targetUrl'])_0x3d1e9a[_0x38fe02(0x186)]=_0x3143af[_0x38fe02(0x1a3)];_0x3143af?.[_0x38fe02(0x1e5)]&&(_0x3d1e9a[_0x38fe02(0x1b0)]=_0x3143af[_0x38fe02(0x1e5)]['sessionId'],_0x3d1e9a[_0x38fe02(0x176)]=_0x3143af[_0x38fe02(0x1e5)][_0x38fe02(0x1bf)]);try{return await _0x12fb9e['exUEi'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x46aa21)+'/login',{'method':_0x38fe02(0x1aa),'body':JSON['stringify'](_0x3d1e9a)});}catch(_0x16f248){if(_0x12fb9e['XgTvz'](_0x16f248,ApiError)&&_0x16f248['status']===0x190&&_0x12fb9e['pZQNK'](_0x16f248['code'],_0x12fb9e[_0x38fe02(0x17e)]))return{'status':'not_configured','error':_0x16f248['detail']};throw _0x16f248;}}async function serverSideLoginWithOptionalTunnel(_0x5a76d0,_0x886145,_0x5025ad={}){const _0xf62f00=_0x2f6d51,_0x274b41={'Ghznx':function(_0x14b878,_0x4d3232){return _0x14b878(_0x4d3232);},'tEWNL':function(_0x474ca1,_0x39eec9,_0x4326d5){return _0x474ca1(_0x39eec9,_0x4326d5);},'oJvlO':'true','CBZMl':function(_0x2baff1,_0x1e5d6b){return _0x2baff1(_0x1e5d6b);},'AYZfB':_0xf62f00(0x1d8),'xXXqu':_0xf62f00(0x1cf),'zQUsW':function(_0x2fe6c3,_0x1ff830){return _0x2fe6c3??_0x1ff830;},'GIYvM':function(_0x15a0bd,_0x73f40){return _0x15a0bd(_0x73f40);},'dKLAq':function(_0x49687d,_0x2068f2){return _0x49687d??_0x2068f2;},'xpNMv':function(_0x36b4a1,_0xae96b2){return _0x36b4a1||_0xae96b2;},'goGPL':_0xf62f00(0x215),'FPIex':'tunnel_login_cleanup'};if(!needsTunnel(_0x886145))return await _0x274b41[_0xf62f00(0x210)](serverSideLogin,_0x5a76d0,{'force':_0x5025ad['force']});let _0x2fa03c=null,_0x555afe=null,_0x43eb59=null,_0x13711f=null,_0x3aa9e2=![];const _0x2d38ce=process[_0xf62f00(0x1de)]['RANGER_TUNNEL_LOGIN_HEADED']?.['toLowerCase'](),_0x292a89=_0x2d38ce==='1'||_0x2d38ce===_0x274b41['oJvlO'],_0x14a000={'profileName':_0x5a76d0,'targetUrlHost':_0x274b41['CBZMl'](targetHostForTelemetry,_0x886145),'tunnelRequired':!![],'forceLogin':_0x274b41[_0xf62f00(0x1d2)](Boolean,_0x5025ad['force']),'localBrowserServerHeaded':_0x292a89};try{_0x5025ad['telemetry']?.['trackPhaseStart'](_0x274b41[_0xf62f00(0x16f)],_0x14a000);_0x292a89&&console['log'](_0x274b41[_0xf62f00(0x1f3)]);_0x2fa03c=await _0x274b41['Ghznx'](launchBrowserServer,{'headless':!_0x292a89}),_0x555afe=await _0x274b41['Ghznx'](createTunnelSession,_0x886145);const _0x2674fb=await requireToken();_0x43eb59=await createTunnelBridge({'localWsUrl':_0x2fa03c[_0xf62f00(0x166)],'tunnelServerUrl':_0x555afe[_0xf62f00(0x19d)],'sessionId':_0x555afe['sessionId'],'apiKey':_0x2674fb,'onError':_0x44465e=>{_0x13711f=_0x44465e;},'onClose':()=>{_0x13711f??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x5a76d0);},'onEvent':_0x2c454c=>trackBridgeEvent(_0x5025ad[_0xf62f00(0x1cb)],_0x2c454c)}),_0x5025ad['telemetry']?.['trackPhaseEnd'](_0xf62f00(0x1d8),{..._0x14a000,'tunnelSessionId':_0x555afe['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x292a89}),_0x3aa9e2=!![];try{return _0x5025ad['telemetry']?.[_0xf62f00(0x1fd)]('tunnel_login_request',{..._0x14a000,'tunnelSessionId':_0x555afe[_0xf62f00(0x1a1)]}),await _0x274b41[_0xf62f00(0x210)](serverSideLogin,_0x5a76d0,{'force':_0x5025ad['force'],'targetUrl':_0x886145,'tunnel':{'sessionId':_0x555afe[_0xf62f00(0x1a1)],'pwEndpoint':_0x555afe[_0xf62f00(0x1bf)]}})['then'](_0x31b32b=>{const _0x47df4a=_0xf62f00;return _0x5025ad['telemetry']?.[_0x47df4a(0x1a5)]('tunnel_login_request',{..._0x14a000,'tunnelSessionId':_0x555afe?.[_0x47df4a(0x1a1)],'loginStatus':_0x31b32b[_0x47df4a(0x173)],'hasSessionState':Boolean(_0x31b32b[_0x47df4a(0x1d3)]),'hasTestOutput':_0x274b41['Ghznx'](Boolean,_0x31b32b['test_output']),'bridgeError':errorMessageForTelemetry(_0x13711f)}),_0x31b32b;});}catch(_0x5a9a68){await _0x5025ad['telemetry']?.['trackPhaseError'](_0xf62f00(0x206),_0x274b41['zQUsW'](_0x13711f,_0x5a9a68),{..._0x14a000,'tunnelSessionId':_0x555afe[_0xf62f00(0x1a1)],'bridgeError':_0x274b41[_0xf62f00(0x1dd)](errorMessageForTelemetry,_0x13711f)});throw _0x274b41['dKLAq'](_0x13711f,_0x5a9a68);}}catch(_0x5d4a39){!_0x3aa9e2&&await _0x5025ad['telemetry']?.[_0xf62f00(0x214)](_0xf62f00(0x1d8),_0x5d4a39,{..._0x14a000,'tunnelSessionId':_0x555afe?.['sessionId']});throw _0x5d4a39;}finally{if(_0x274b41['xpNMv'](_0x555afe,_0x2fa03c)||_0x43eb59){const _0x553bf3=_0x274b41[_0xf62f00(0x1bb)]['split']('|');let _0x34c796=0x0;while(!![]){switch(_0x553bf3[_0x34c796++]){case'0':_0x43eb59?.['close']();continue;case'1':_0x2fa03c&&await _0x2fa03c[_0xf62f00(0x1c0)]()['catch'](()=>{});continue;case'2':_0x5025ad[_0xf62f00(0x1cb)]?.['trackPhaseStart'](_0x274b41['FPIex'],{..._0x14a000,'tunnelSessionId':_0x555afe?.[_0xf62f00(0x1a1)]});continue;case'3':_0x5025ad[_0xf62f00(0x1cb)]?.[_0xf62f00(0x1a5)](_0x274b41[_0xf62f00(0x174)],{..._0x14a000,'tunnelSessionId':_0x555afe?.['sessionId']});continue;case'4':_0x555afe&&await deleteTunnelSession(_0x555afe[_0xf62f00(0x1a1)])['catch'](()=>{});continue;}break;}}}}export async function manualBrowserLogin(_0x52b62a,_0x58ff67,_0x482fe9={}){const _0x437c2c=_0x2f6d51,_0xd0e57e={'smUqa':function(_0x53b463,_0x451942){return _0x53b463/_0x451942;},'XgSPn':function(_0x56d14b){return _0x56d14b();},'hpuFj':function(_0x2caea0){return _0x2caea0();},'IFQaf':function(_0x54b238,_0x4b335b,_0x288b1a){return _0x54b238(_0x4b335b,_0x288b1a);},'JsSlT':'close','KaAWL':function(_0x1222ae){return _0x1222ae();},'vAguO':function(_0x3d6663,_0x25d240){return _0x3d6663+_0x25d240;},'hSKPn':_0x437c2c(0x205),'owHxG':function(_0xdf2ee2,_0x23342a){return _0xdf2ee2>_0x23342a;},'sGQyD':_0x437c2c(0x170),'rwJZf':function(_0x3f6b5d,_0x1d8282){return _0x3f6b5d&&_0x1d8282;},'JWjmh':'Browser\x20closed\x20before\x20authentication\x20was\x20saved.','tfDHs':function(_0x568c7c,_0x4c42d5){return _0x568c7c!==_0x4c42d5;},'MMlZn':function(_0x42bc90,_0x5ab75c){return _0x42bc90(_0x5ab75c);},'AdyTS':_0x437c2c(0x1aa)};if(!_0xd0e57e[_0x437c2c(0x20a)](isInteractive))throw new Error(_0xd0e57e['vAguO'](_0x437c2c(0x1d7)+_0x52b62a['name']+'\x22.\x0a',_0xd0e57e['hSKPn'])+_0x437c2c(0x1e4));const _0x334e2a=_0x58ff67&&_0xd0e57e['owHxG'](_0x58ff67['domains']['length'],0x0)?_0x58ff67['domains'][0x0]:'about:blank';console[_0x437c2c(0x1ad)](_0xd0e57e['sGQyD']),console['log']('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x4af9af=>setTimeout(_0x4af9af,0x7d0));const _0x36a910=await chromium[_0x437c2c(0x21c)]({'headless':![]});let _0x5664=null;try{const _0x9ea69a={'ignoreHTTPSErrors':!![]};_0x58ff67?.['setupHeaders']&&(_0x9ea69a['extraHTTPHeaders']=_0x58ff67[_0x437c2c(0x175)]);const _0x55a6e8=await _0x36a910[_0x437c2c(0x16e)](_0x9ea69a);await addProfileSetupBanner(_0x55a6e8);const _0x2a942a=await _0x55a6e8[_0x437c2c(0x1e0)]();await _0x2a942a[_0x437c2c(0x1ec)](_0x334e2a);let _0x8cee65=![];await new Promise(_0x31969d=>{const _0x291d24=_0x437c2c,_0x54700d={'xkHUt':function(_0x26725c){const _0x2bd007=_0x29b1;return _0xd0e57e[_0x2bd007(0x1c4)](_0x26725c);}},_0x118cfe=_0xd0e57e['IFQaf'](setTimeout,()=>{const _0x222bcd=_0x29b1;_0x8cee65=!![],console['error']('Browser\x20login\x20timed\x20out\x20after\x20'+_0xd0e57e['smUqa'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+_0x222bcd(0x1f6)),_0xd0e57e['XgSPn'](_0x31969d);},MANUAL_LOGIN_TIMEOUT_MS);_0x2a942a['on'](_0xd0e57e[_0x291d24(0x193)],async()=>{const _0x2aa800=_0x291d24;clearTimeout(_0x118cfe);try{const _0x26932c=await _0x55a6e8[_0x2aa800(0x1ee)]();_0x5664=_0x26932c;}catch{}_0x54700d[_0x2aa800(0x1dc)](_0x31969d);});});if(_0xd0e57e['rwJZf'](_0x8cee65,!_0x5664))throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x36a910['close']()[_0x437c2c(0x218)](()=>{});}if(!_0x5664)throw new Error(_0xd0e57e['JWjmh']);return _0xd0e57e[_0x437c2c(0x1eb)](_0x482fe9['persistSessionState'],![])&&await apiRequest('/api/v1/profiles/'+_0xd0e57e['MMlZn'](encodeURIComponent,_0x52b62a[_0x437c2c(0x219)])+_0x437c2c(0x1c3),{'method':_0xd0e57e['AdyTS'],'body':JSON[_0x437c2c(0x18e)]({'session_state':_0x5664,'updated_by':_0x437c2c(0x16a)})}),{'sessionState':_0x5664};}export async function promptSaveCredentials(_0x4f3f94){const _0x2dccef=_0x2f6d51,_0x1f723c={'ytgWZ':function(_0x2b814b,_0x346959){return _0x2b814b||_0x346959;}},_0xaba71f=process[_0x2dccef(0x1de)]['RANGER_TEST_USERNAME'],_0x388b2e=process['env']['RANGER_TEST_PASSWORD'];if(_0x1f723c['ytgWZ'](!_0xaba71f,!_0x388b2e))return;if(!isInteractive())return;const {save:_0x408f1f}=await _0x284cac[_0x2dccef(0x184)]([{'type':'confirm','name':_0x2dccef(0x19f),'message':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','default':![]}]);if(!_0x408f1f)return;await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x4f3f94),{'method':'PUT','body':JSON[_0x2dccef(0x18e)]({'username':_0xaba71f,'password':_0x388b2e})}),console[_0x2dccef(0x1ad)](_0x2dccef(0x1b7));}export async function resolveCloudProfileSession(_0x4038c1,_0x13fba2={}){const _0x46a2eb=_0x2f6d51,_0x42abd7={'KduDO':function(_0x1c7e37){return _0x1c7e37();},'ttbhU':function(_0x21727a,_0x5d3789){return _0x21727a===_0x5d3789;},'GHAuo':function(_0x196b9b,_0x306b8e){return _0x196b9b===_0x306b8e;},'dUyrw':'string','XxDIL':function(_0x1e7979,_0x25648a){return _0x1e7979||_0x25648a;},'CvNvL':function(_0x5f5610,_0x92ca0b){return _0x5f5610(_0x92ca0b);},'XAKEy':function(_0x5ee54f,_0x25323e){return _0x5ee54f>_0x25323e;},'aMAez':function(_0x3f9aa6,_0x53fdfe){return _0x3f9aa6(_0x53fdfe);},'baRfR':function(_0x189c6b,_0x11207a,_0x2c8633,_0x1be328,_0x474c48){return _0x189c6b(_0x11207a,_0x2c8633,_0x1be328,_0x474c48);},'iKwFC':function(_0x119e57,_0x3e0185,_0x156b88,_0x1139a5,_0x4d32fd,_0x58680f,_0x1eb06d,_0x4726c2){return _0x119e57(_0x3e0185,_0x156b88,_0x1139a5,_0x4d32fd,_0x58680f,_0x1eb06d,_0x4726c2);},'ekezx':function(_0x3f5350,_0xcf3ac4,_0x381c95,_0x48b43d,_0x13007f){return _0x3f5350(_0xcf3ac4,_0x381c95,_0x48b43d,_0x13007f);},'GEdhr':function(_0x374c24,_0x5b5627){return _0x374c24(_0x5b5627);},'tYrhp':_0x46a2eb(0x194),'VPcjx':_0x46a2eb(0x196),'UtwVv':'\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','ZJaBh':_0x46a2eb(0x172)},_0x563efa=_0x4038c1[_0x46a2eb(0x202)]??{},_0x103028=await _0x42abd7['KduDO'](fetchAuthConfig),_0x17b0fc=_0x103028?resolveAuthEnvironmentLocally(_0x103028,_0x4038c1[_0x46a2eb(0x17d)]):null,_0x15daea=_0x42abd7[_0x46a2eb(0x201)](typeof _0x17b0fc?.['loginInstructions'],'string')&&_0x17b0fc['loginInstructions']['trim']()?_0x17b0fc['loginInstructions']:undefined,_0x3996a1=_0x42abd7['GHAuo'](typeof _0x563efa['loginInstructions'],_0x42abd7[_0x46a2eb(0x1a8)])&&_0x563efa['loginInstructions']['trim']()?_0x563efa['loginInstructions']:undefined,_0x306ea0=_0x42abd7[_0x46a2eb(0x209)](_0x3996a1,!_0x15daea)?_0x563efa:{..._0x563efa,'loginInstructions':_0x15daea},_0x39e61b=_0x42abd7[_0x46a2eb(0x1b9)](Boolean,_0x306ea0[_0x46a2eb(0x1c7)]?.['trim']()),_0xecc1dc=Boolean(_0x563efa[_0x46a2eb(0x1c1)]||_0x17b0fc?.[_0x46a2eb(0x1c1)]),_0x31a769=_0x17b0fc?.['domains'],_0x2ee94f=_0x563efa['setupHeaders'],_0x31797b=_0x2ee94f??_0x17b0fc?.[_0x46a2eb(0x175)],_0x206c17=_0x13fba2['effectiveBaseUrl']??_0x563efa[_0x46a2eb(0x1b1)]??(_0x31a769&&_0x42abd7[_0x46a2eb(0x1c8)](_0x31a769[_0x46a2eb(0x1db)],0x0)?_0x31a769[0x0]:''),_0x5c9752=_0x206c17?_0x42abd7['aMAez'](needsTunnel,_0x206c17):![],_0xcc59eb={'invalidateOn':_0x17b0fc?.['invalidateOn'],'userAgent':_0x17b0fc?.[_0x46a2eb(0x190)]?.[_0x46a2eb(0x18b)]??_0x563efa['userAgent']};_0xecc1dc&&console['log']('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x4038c1[_0x46a2eb(0x219)]+_0x46a2eb(0x17c));if(!_0xecc1dc){const _0x43ee2b=await checkLocalCache(_0x4038c1['name'],_0x4038c1[_0x46a2eb(0x1ed)],_0x206c17,_0x31797b,_0xcc59eb);if(_0x43ee2b){if(_0x206c17&&!_0x5c9752){const _0xe5910e=await _0x42abd7['baRfR'](isCachedSessionLive,_0x43ee2b['storageStatePath'],_0x206c17,{'sessionCheckPath':_0x17b0fc?.[_0x46a2eb(0x1c9)],'setupHeaders':_0x31797b},{'launchBrowser':launchRealBrowser});if(_0xe5910e)return console['log'](_0x46a2eb(0x1ab)+_0x4038c1['name']+'\x22'),{'authPath':_0x43ee2b['storageStatePath'],'settings':_0x306ea0,'resolvedEnv':_0x17b0fc};console['log'](_0x46a2eb(0x21d)+_0x4038c1[_0x46a2eb(0x219)]+_0x46a2eb(0x1ae)),emitSessionValidationHint(_0x206c17,_0x17b0fc);}else return _0x5c9752&&console[_0x46a2eb(0x1ad)]('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x4038c1[_0x46a2eb(0x219)]+'\x22'),{'authPath':_0x43ee2b['storageStatePath'],'settings':_0x306ea0,'resolvedEnv':_0x17b0fc};}}if(!_0xecc1dc&&_0x4038c1['sessionState']){if(_0x5c9752)console[_0x46a2eb(0x1ad)](_0x46a2eb(0x208)+_0x206c17+_0x46a2eb(0x1b5)+_0x4038c1['name']+'\x22');else{const _0x55d32e=await _0x42abd7[_0x46a2eb(0x203)](writeSessionToLocalCache,_0x4038c1['name'],_0x4038c1[_0x46a2eb(0x1ed)],_0x206c17,_0x31797b,_0x4038c1['sessionState'],_0x31a769,_0xcc59eb);if(_0x206c17){const _0x188ecf=await _0x42abd7[_0x46a2eb(0x1b6)](isCachedSessionLive,_0x55d32e,_0x206c17,{'sessionCheckPath':_0x17b0fc?.[_0x46a2eb(0x1c9)],'setupHeaders':_0x31797b},{'launchBrowser':launchRealBrowser});if(_0x188ecf)return console[_0x46a2eb(0x1ad)](_0x46a2eb(0x213)+_0x4038c1[_0x46a2eb(0x219)]+'\x22,\x20cached\x20locally'),{'authPath':_0x55d32e,'settings':_0x306ea0,'resolvedEnv':_0x17b0fc};console[_0x46a2eb(0x1ad)](_0x46a2eb(0x1df)+_0x4038c1['name']+_0x46a2eb(0x178)),emitSessionValidationHint(_0x206c17,_0x17b0fc);}else return{'authPath':_0x55d32e,'settings':_0x306ea0,'resolvedEnv':_0x17b0fc};}}if(_0x39e61b)return console['log'](_0x46a2eb(0x1b2)+_0x4038c1[_0x46a2eb(0x219)]+_0x46a2eb(0x1f1)),{'authPath':undefined,'settings':_0x306ea0,'resolvedEnv':_0x17b0fc};console[_0x46a2eb(0x1ad)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x4038c1[_0x46a2eb(0x219)]+_0x46a2eb(0x19e));const _0x5382f4=_0x42abd7[_0x46a2eb(0x1e8)](Boolean,process[_0x46a2eb(0x1de)][_0x46a2eb(0x18a)])&&_0x42abd7[_0x46a2eb(0x1b9)](Boolean,process[_0x46a2eb(0x1de)][_0x46a2eb(0x1f2)]),_0x4be202=_0x42abd7['GEdhr'](Boolean,_0x4038c1[_0x46a2eb(0x20b)]);if(_0x42abd7['XxDIL'](_0x5382f4,_0x4be202))try{const _0x2030ee=_0x206c17?await serverSideLoginWithOptionalTunnel(_0x4038c1[_0x46a2eb(0x219)],_0x206c17,{'force':_0xecc1dc,'telemetry':_0x13fba2[_0x46a2eb(0x1cb)]}):await serverSideLogin(_0x4038c1[_0x46a2eb(0x219)],{'force':_0xecc1dc});if(_0x2030ee['status']===_0x42abd7[_0x46a2eb(0x1da)])console['log']('\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...');else{if(_0x42abd7['GHAuo'](_0x2030ee['status'],_0x42abd7[_0x46a2eb(0x216)])&&_0x2030ee[_0x46a2eb(0x1d3)]){console['log'](_0x46a2eb(0x195));const _0x46bdc4=await _0x42abd7[_0x46a2eb(0x203)](writeSessionToLocalCache,_0x4038c1[_0x46a2eb(0x219)],_0x4038c1[_0x46a2eb(0x1ed)],_0x206c17,_0x31797b,_0x2030ee['session_state'],_0x31a769,_0xcc59eb);return _0x5382f4&&!_0x4be202&&await promptSaveCredentials(_0x4038c1['name']),{'authPath':_0x46bdc4,'settings':_0x306ea0,'resolvedEnv':_0x17b0fc};}else _0x2030ee[_0x46a2eb(0x197)]&&(console[_0x46a2eb(0x1ad)](_0x42abd7[_0x46a2eb(0x1e7)]),console['log'](_0x2030ee['test_output'])),console[_0x46a2eb(0x1ad)](_0x42abd7[_0x46a2eb(0x212)]);}}catch(_0x37ee4f){console[_0x46a2eb(0x1ad)](_0x46a2eb(0x189)+(_0x37ee4f instanceof Error?_0x37ee4f['message']:String(_0x37ee4f))),console[_0x46a2eb(0x1ad)](_0x46a2eb(0x172));}const _0x542b75=_0x17b0fc?{..._0x17b0fc,'setupHeaders':_0x31797b}:_0x206c17?{'key':_0x4038c1['environmentKey']??'','domains':[_0x206c17],'setupHeaders':_0x31797b}:null,{sessionState:_0x612dd6}=await manualBrowserLogin(_0x4038c1,_0x542b75,{'persistSessionState':!_0x5c9752}),_0x1e48b1=await _0x42abd7[_0x46a2eb(0x203)](writeSessionToLocalCache,_0x4038c1[_0x46a2eb(0x219)],_0x4038c1['organizationId'],_0x206c17,_0x31797b,_0x612dd6,_0x31a769,_0xcc59eb);return{'authPath':_0x1e48b1,'settings':_0x306ea0,'resolvedEnv':_0x17b0fc};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x352e7d=_0x5794;(function(_0x37bf09,_0xe0353c){const _0x5eb491=_0x5794,_0x41262f=_0x37bf09();while(!![]){try{const _0x45e633=-parseInt(_0x5eb491(0xba))/0x1+-parseInt(_0x5eb491(0xa9))/0x2*(parseInt(_0x5eb491(0xc8))/0x3)+-parseInt(_0x5eb491(0xc3))/0x4*(parseInt(_0x5eb491(0xaf))/0x5)+-parseInt(_0x5eb491(0xb8))/0x6*(parseInt(_0x5eb491(0xbf))/0x7)+-parseInt(_0x5eb491(0xc7))/0x8+parseInt(_0x5eb491(0xb5))/0x9*(-parseInt(_0x5eb491(0x95))/0xa)+parseInt(_0x5eb491(0xc1))/0xb*(parseInt(_0x5eb491(0x9f))/0xc);if(_0x45e633===_0xe0353c)break;else _0x41262f['push'](_0x41262f['shift']());}catch(_0xd2490c){_0x41262f['push'](_0x41262f['shift']());}}}(_0x1946,0xe1376));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x14e2ad=process['env'],_0x1b883a={'stdin':process[_0x352e7d(0xb4)],'stdout':process[_0x352e7d(0xc6)]}){const _0x254558=_0x352e7d;if(_0x14e2ad['CI'])return![];return Boolean(_0x1b883a[_0x254558(0xb4)][_0x254558(0xa0)])&&Boolean(_0x1b883a['stdout']['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x501bad){const _0x2ca751=_0x352e7d,_0x3739f7={'twlLB':function(_0x5ef7f3,_0x1fc7fd){return _0x5ef7f3(_0x1fc7fd);},'kZNxz':_0x2ca751(0xb7),'TznTs':_0x2ca751(0xb6),'LbkNJ':'port','TgCIt':function(_0x44b066,_0x539993){return _0x44b066!==_0x539993;},'itiiP':'clientIp','FMQSw':'sha256'},_0x550cf1=new Set(_0x501bad['invalidateOn']??DEFAULT_INVALIDATE_ON);_0x501bad['effectiveBaseUrl']&&_0x3739f7['twlLB'](needsTunnel,_0x501bad[_0x2ca751(0xa1)])&&_0x550cf1[_0x2ca751(0xa2)](_0x3739f7['kZNxz']);const _0x29d4dc={'orgId':_0x501bad[_0x2ca751(0x9c)],'profileName':_0x501bad[_0x2ca751(0xa7)]};return _0x550cf1['has'](_0x3739f7[_0x2ca751(0xb9)])&&(_0x29d4dc[_0x2ca751(0xa1)]=_0x501bad[_0x2ca751(0xa1)]),_0x550cf1[_0x2ca751(0xa3)](_0x3739f7['TznTs'])&&(_0x29d4dc[_0x2ca751(0xb6)]=_0x501bad['setupHeaders']?sortObjectKeys(_0x501bad['setupHeaders']):_0x501bad['setupHeaders']),_0x550cf1[_0x2ca751(0xa3)](_0x3739f7['LbkNJ'])&&(_0x29d4dc[_0x2ca751(0xb2)]=extractPort(_0x501bad[_0x2ca751(0xa1)])),_0x550cf1['has']('userAgent')&&_0x3739f7[_0x2ca751(0xa5)](_0x501bad['userAgent'],undefined)&&(_0x29d4dc[_0x2ca751(0xa8)]=_0x501bad[_0x2ca751(0xa8)]),_0x550cf1['has'](_0x3739f7['itiiP'])&&_0x501bad[_0x2ca751(0xc5)]!==undefined&&(_0x29d4dc[_0x2ca751(0xc5)]=_0x501bad[_0x2ca751(0xc5)]),createHash(_0x3739f7['FMQSw'])['update'](JSON['stringify'](_0x29d4dc))['digest'](_0x2ca751(0xac))[_0x2ca751(0xab)](0x0,0xc);}function extractPort(_0x357941){try{return new URL(_0x357941)['port'];}catch{return'';}}function sortObjectKeys(_0x29e034){const _0x9731ab=_0x352e7d,_0x58bdd7={};for(const _0x22d60e of Object['keys'](_0x29e034)[_0x9731ab(0xc2)]()){_0x58bdd7[_0x22d60e]=_0x29e034[_0x22d60e];}return _0x58bdd7;}function _0x1946(){const _0x49f174=['launchBrowser','.localhost','sdJxJ','localhost.','test','orgId','KCHmi','environments','4779240XytAeM','isTTY','effectiveBaseUrl','add','has','sessionCheckPath','TgCIt','defaultEnvironmentKey','profileName','userAgent','16urtwVw','startsWith','slice','hex','endsWith','.storageState.json','6903115Xxplqo','.json','url','port','wjTrJ','stdin','9738FRzfig','setupHeaders','baseUrl','5963124fjVDqO','kZNxz','74841lqeWFZ','XxkXK','includes','hostname','map','7KsOtqg','length','187GjsiCI','sort','4TQdsRI','localhost','clientIp','stdout','7205344RIYlDB','333444srfuli','14870nCUVqC','pathname'];_0x1946=function(){return _0x49f174;};return _0x1946();}export function getSessionCachePath(_0x45c731,_0x1081c0){const _0x5e1dde=_0x352e7d;return join(getRangerHomeDir(),'auth',_0x45c731+'-'+_0x1081c0+_0x5e1dde(0xb0));}export function getStorageStatePath(_0x17c27f){const _0x369f52=_0x352e7d,_0x511777={'jzAXT':_0x369f52(0xae)};return _0x17c27f['replace'](/\.json$/,_0x511777['jzAXT']);}export function needsTunnel(_0x48b23f){const _0x531b26=_0x352e7d,_0x5e3d88={'wjTrJ':_0x531b26(0xc4),'KCHmi':function(_0x1652ad,_0x1aad38){return _0x1652ad===_0x1aad38;},'HzthN':_0x531b26(0x98)};let _0x443411;try{_0x443411=new URL(_0x48b23f)[_0x531b26(0xbd)];}catch{return![];}if(_0x443411===_0x5e3d88[_0x531b26(0xb3)]||_0x5e3d88[_0x531b26(0x9d)](_0x443411,'127.0.0.1'))return!![];if(_0x443411[_0x531b26(0xad)](_0x5e3d88['HzthN']))return!![];if(_0x443411[_0x531b26(0xbc)](_0x531b26(0x9a)))return!![];return![];}function _0x5794(_0x2af878,_0x17a0ba){_0x2af878=_0x2af878-0x95;const _0x194685=_0x1946();let _0x57943b=_0x194685[_0x2af878];return _0x57943b;}export function hostnameOf(_0x19203b){const _0x53af76=_0x352e7d;return new URL(_0x19203b)[_0x53af76(0xbd)];}export function duplicateCookiesForDomains(_0x5da90f,_0x1eb29b){const _0x3f9c4f=_0x352e7d,_0x1e5911=[..._0x5da90f],_0x35f62f=new Set(_0x5da90f[_0x3f9c4f(0xbe)](_0x5ef881=>_0x5ef881['domain']));for(const _0x421fdf of _0x1eb29b){let _0x24dbc4;try{_0x24dbc4=hostnameOf(_0x421fdf);}catch{continue;}if(!_0x24dbc4)continue;const _0x338156=_0x24dbc4[_0x3f9c4f(0xaa)]('.')?_0x24dbc4:'.'+_0x24dbc4;if(_0x35f62f['has'](_0x24dbc4)||_0x35f62f[_0x3f9c4f(0xa3)](_0x338156))continue;for(const _0x5a85d1 of _0x5da90f){_0x1e5911['push']({..._0x5a85d1,'domain':_0x338156});}_0x35f62f[_0x3f9c4f(0xa2)](_0x338156);}return _0x1e5911;}export function resolveAuthEnvironmentLocally(_0x3ce830,_0x3a8666){const _0x2e2623=_0x352e7d,_0x1b9543={'sIcKm':function(_0x4a0250,_0x4f057d){return _0x4a0250===_0x4f057d;}},_0x41bd3c=_0x3ce830[_0x2e2623(0x9e)];if(_0x3a8666){const _0x5b1f5f=_0x41bd3c[_0x3a8666];if(!_0x5b1f5f)return null;return{'key':_0x3a8666,..._0x5b1f5f};}if(_0x3ce830['defaultEnvironmentKey']){const _0x21dd5b=_0x41bd3c[_0x3ce830[_0x2e2623(0xa6)]];if(!_0x21dd5b)return null;return{'key':_0x3ce830[_0x2e2623(0xa6)],..._0x21dd5b};}const _0x5df305=Object['keys'](_0x41bd3c);if(_0x1b9543['sIcKm'](_0x5df305[_0x2e2623(0xc0)],0x1)){const _0x4a5cd8=_0x5df305[0x0];return{'key':_0x4a5cd8,..._0x41bd3c[_0x4a5cd8]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x4b1961,_0x1c5cb9){try{if(_0x1c5cb9)return new URL(_0x1c5cb9,_0x4b1961)['toString']();return new URL(_0x4b1961)['toString']();}catch{return null;}}export function looksLikeLoginUrl(_0x40d229){const _0x189326=_0x352e7d;try{const _0x563035=new URL(_0x40d229);return LOGIN_URL_PATTERN[_0x189326(0x9b)](_0x563035[_0x189326(0x96)]);}catch{return LOGIN_URL_PATTERN[_0x189326(0x9b)](_0x40d229);}}export async function isCachedSessionLive(_0x3906b4,_0x32206b,_0x109647={},_0x3d31aa={}){const _0x10d6e7=_0x352e7d,_0xabea0d={'FwLlU':function(_0x4850fc,_0x4b2215,_0x5c3139){return _0x4850fc(_0x4b2215,_0x5c3139);},'sdJxJ':'domcontentloaded','XxkXK':function(_0x1b1cb1,_0x54964d){return _0x1b1cb1(_0x54964d);}},_0x4642c6=_0xabea0d['FwLlU'](buildSessionCheckUrl,_0x32206b,_0x109647[_0x10d6e7(0xa4)]);if(!_0x4642c6)return!![];if(!_0x3d31aa[_0x10d6e7(0x97)])return!![];let _0x4b92ae=null;try{_0x4b92ae=await _0x3d31aa[_0x10d6e7(0x97)]();const _0x2077f5=await _0x4b92ae['newContext']({'storageState':_0x3906b4,'ignoreHTTPSErrors':!![],..._0x109647['setupHeaders']?{'extraHTTPHeaders':_0x109647['setupHeaders']}:{}}),_0x28aa30=await _0x2077f5['newPage'](),_0x4b497b=await _0x28aa30['goto'](_0x4642c6,{'waitUntil':_0xabea0d[_0x10d6e7(0x99)],'timeout':0x3a98}),_0x214754=_0x4b497b?.['status']();if(_0x214754===0x191||_0x214754===0x193)return![];const _0x190ac8=_0x28aa30[_0x10d6e7(0xb1)]();if(_0xabea0d[_0x10d6e7(0xbb)](looksLikeLoginUrl,_0x190ac8))return![];return!![];}catch{return![];}finally{if(_0x4b92ae)await _0x4b92ae['close']()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
(function(_0x3c8a1e,_0x209cad){const _0xbbc9c8=_0x5299,_0x37d5f5=_0x3c8a1e();while(!![]){try{const _0x56e0ee=parseInt(_0xbbc9c8(0xdf))/0x1*(parseInt(_0xbbc9c8(0xeb))/0x2)+-parseInt(_0xbbc9c8(0xec))/0x3*(parseInt(_0xbbc9c8(0xe2))/0x4)+parseInt(_0xbbc9c8(0xe0))/0x5+-parseInt(_0xbbc9c8(0xe5))/0x6+-parseInt(_0xbbc9c8(0xdd))/0x7*(-parseInt(_0xbbc9c8(0xee))/0x8)+-parseInt(_0xbbc9c8(0xea))/0x9*(parseInt(_0xbbc9c8(0xe8))/0xa)+parseInt(_0xbbc9c8(0xe4))/0xb*(-parseInt(_0xbbc9c8(0xe1))/0xc);if(_0x56e0ee===_0x209cad)break;else _0x37d5f5['push'](_0x37d5f5['shift']());}catch(_0x398ea6){_0x37d5f5['push'](_0x37d5f5['shift']());}}}(_0x4644,0x59c1a));function _0x4644(){const _0x2ddc2c=['oOQSA','14IJPZeN','sha256','33QYNjqF','3060460MMhnTq','1907700EQJllv','2960yTirqm','NfumF','11nlcLfV','247188dyPOyM','RUVzE','concat','500830LWBpPk','final','108IyEOoF','29398smBuZb','1098CuchkJ','rFZmJ','1369968GjXYcu','subarray','getAuthTag','setAuthTag'];_0x4644=function(){return _0x2ddc2c;};return _0x4644();}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(_0x20ac12){const _0x369556=_0x5299,_0x3acd5c={'rFZmJ':function(_0x4249eb,_0x172a12,_0x3caf0c,_0x2a0445,_0x46366c,_0x4b6d1d){return _0x4249eb(_0x172a12,_0x3caf0c,_0x2a0445,_0x46366c,_0x4b6d1d);},'aFhel':_0x369556(0xde)};return _0x3acd5c[_0x369556(0xed)](pbkdf2Sync,_0x20ac12,SALT,0x186a0,KEY_LENGTH,_0x3acd5c['aFhel']);}export function encrypt(_0x268628,_0x311a39){const _0x302d15=_0x5299,_0x4f4fb0={'QHVzR':function(_0x31e4ba,_0x4b631f){return _0x31e4ba(_0x4b631f);},'NfumF':function(_0x21d3b6,_0x9a2cbe,_0x1df4d0,_0x229ac7){return _0x21d3b6(_0x9a2cbe,_0x1df4d0,_0x229ac7);},'RUVzE':'utf8'},_0x354fc5=deriveKey(_0x311a39),_0x3e7240=_0x4f4fb0['QHVzR'](randomBytes,IV_LENGTH),_0x136bcc=_0x4f4fb0[_0x302d15(0xe3)](createCipheriv,ALGORITHM,_0x354fc5,_0x3e7240),_0x5deca7=Buffer['concat']([_0x136bcc['update'](_0x268628,_0x4f4fb0[_0x302d15(0xe6)]),_0x136bcc[_0x302d15(0xe9)]()]),_0x333952=_0x136bcc[_0x302d15(0xda)]();return Buffer[_0x302d15(0xe7)]([_0x3e7240,_0x333952,_0x5deca7]);}function _0x5299(_0xb27865,_0x23ec32){_0xb27865=_0xb27865-0xd9;const _0x46446f=_0x4644();let _0x529996=_0x46446f[_0xb27865];return _0x529996;}export function decrypt(_0x15e573,_0x56b0ec){const _0x3a0b0c=_0x5299,_0x34cc92={'oOQSA':function(_0x525b25,_0x3e4fb7){return _0x525b25(_0x3e4fb7);},'rgKKx':function(_0x50ceab,_0xb6800d){return _0x50ceab+_0xb6800d;}},_0x17339b=_0x34cc92[_0x3a0b0c(0xdc)](deriveKey,_0x56b0ec),_0x2b1fff=_0x15e573[_0x3a0b0c(0xd9)](0x0,IV_LENGTH),_0x39bf2b=_0x15e573[_0x3a0b0c(0xd9)](IV_LENGTH,IV_LENGTH+TAG_LENGTH),_0x4a9312=_0x15e573['subarray'](_0x34cc92['rgKKx'](IV_LENGTH,TAG_LENGTH)),_0x5cc676=createDecipheriv(ALGORITHM,_0x17339b,_0x2b1fff);return _0x5cc676[_0x3a0b0c(0xdb)](_0x39bf2b),_0x5cc676['update'](_0x4a9312)+_0x5cc676['final']('utf8');}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x518c2b=_0x51d9;(function(_0x593781,_0x5c2c0c){const _0x1bf5fd=_0x51d9,_0x2e83bd=_0x593781();while(!![]){try{const _0xf20c70=parseInt(_0x1bf5fd(0x1c7))/0x1+parseInt(_0x1bf5fd(0x1c9))/0x2*(-parseInt(_0x1bf5fd(0x1d6))/0x3)+parseInt(_0x1bf5fd(0x1e5))/0x4+-parseInt(_0x1bf5fd(0x1d2))/0x5*(parseInt(_0x1bf5fd(0x1c3))/0x6)+parseInt(_0x1bf5fd(0x1cb))/0x7+parseInt(_0x1bf5fd(0x1e3))/0x8+parseInt(_0x1bf5fd(0x1b6))/0x9*(-parseInt(_0x1bf5fd(0x1e1))/0xa);if(_0xf20c70===_0x5c2c0c)break;else _0x2e83bd['push'](_0x2e83bd['shift']());}catch(_0xd19551){_0x2e83bd['push'](_0x2e83bd['shift']());}}}(_0x28e7,0x81217));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set(['--token','-t',_0x518c2b(0x1d5),'--api-key','--apikey',_0x518c2b(0x1c5),_0x518c2b(0x1d3),_0x518c2b(0x1db),_0x518c2b(0x1c1),'--authorization','--header',_0x518c2b(0x1e2),'--credentials']),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function _0x51d9(_0x224cbc,_0x4c27ca){_0x224cbc=_0x224cbc-0x1b6;const _0x28e7be=_0x28e7();let _0x51d995=_0x28e7be[_0x224cbc];return _0x51d995;}function looksLikeToken(_0x46c634){const _0x1c3d0b=_0x518c2b;return TOKEN_PATTERNS['some'](_0x2492e3=>_0x2492e3[_0x1c3d0b(0x1e7)](_0x46c634));}function _0x28e7(){const _0x36bf61=['isTTY','1224JhXjkT','env','luUxc','WxWpF','XgEXr','Missing\x20required\x20argument','unknown_argument','stringify','join','BoDkq','error','--auth','has','6CVfiPM','split','--key','Bearer\x20','306648BoXTnQ','DxCPR','334nohgmt','missing_required_argument','323981lVaxIw','Unknown\x20argument','uEkjY','startsWith','[desire-path]\x20Failed\x20to\x20send:\x20','4|5|1|7|2|3|6|0','invalid_option_value','3627385FStdQK','--password','yXqZR','--secret','51OVICvg','DEBUG','[desire-path]\x20Sending\x20log\x20to\x20','stdout','includes','--pass','rawCommand','Invalid\x20values','jpAZa','toLowerCase','Not\x20enough\x20non-option\x20arguments','57410OIPihc','--cookie','6058304PEkFMh','lnYfn','3711168nHCoiS','EOOht','test','push','missing_option'];_0x28e7=function(){return _0x36bf61;};return _0x28e7();}export function sanitizeArgs(_0x261bcf){const _0x3686ea=_0x518c2b,_0x50f7ec={'DxCPR':'[REDACTED]','FKWVG':function(_0x4e52bf,_0x193bbe){return _0x4e52bf(_0x193bbe);}},_0x27eb7d=[];let _0x9f73c2=![];for(let _0x2d86d0=0x0;_0x2d86d0<_0x261bcf['length'];_0x2d86d0++){const _0x961259=_0x261bcf[_0x2d86d0];if(_0x9f73c2){_0x27eb7d[_0x3686ea(0x1e8)](_0x50f7ec['DxCPR']),_0x9f73c2=![];continue;}if(_0x961259['startsWith']('--')||_0x961259[_0x3686ea(0x1ce)]('-')){const _0xceba67=_0x961259['indexOf']('=');if(_0xceba67!==-0x1){const _0x3efb6b=_0x961259['slice'](0x0,_0xceba67)[_0x3686ea(0x1df)]();if(SENSITIVE_FLAGS[_0x3686ea(0x1c2)](_0x3efb6b)){_0x27eb7d[_0x3686ea(0x1e8)](_0x961259['slice'](0x0,_0xceba67)+'=[REDACTED]');continue;}}else{const _0x2711c4=_0x961259[_0x3686ea(0x1df)]();SENSITIVE_FLAGS['has'](_0x2711c4)&&(_0x9f73c2=!![]);}_0x27eb7d['push'](_0x961259);}else _0x50f7ec['FKWVG'](looksLikeToken,_0x961259)?_0x27eb7d[_0x3686ea(0x1e8)](_0x50f7ec[_0x3686ea(0x1c8)]):_0x27eb7d['push'](_0x961259);}return _0x27eb7d[_0x3686ea(0x1be)]('\x20');}export async function logDesirePath(_0x42f95d){const _0x1fc622=_0x518c2b,_0x56768d={'EOOht':function(_0x5f5415){return _0x5f5415();},'yXqZR':'no_token','uEkjY':'application/json','lnYfn':'Authorization','WxWpF':function(_0x3f0fab,_0x3da245,_0x19e51b){return _0x3f0fab(_0x3da245,_0x19e51b);},'lLSAR':'POST'};try{const _0x21a039=await getToken()['catch'](()=>null),_0x1909eb=_0x56768d['EOOht'](getApiBaseUrl),_0x5491eb=_0x56768d[_0x1fc622(0x1e6)](getCurrentVersion),_0x4f332d=_0x21a039?'has_token':_0x56768d[_0x1fc622(0x1d4)],_0x41961e={..._0x42f95d['metadata'],'authStatus':_0x4f332d,'isTty':process[_0x1fc622(0x1d9)][_0x1fc622(0x1ea)]??![]},_0x7faa9f={'Content-Type':_0x56768d[_0x1fc622(0x1cd)]};_0x21a039&&(_0x7faa9f[_0x56768d[_0x1fc622(0x1e4)]]=_0x1fc622(0x1c6)+_0x21a039);const _0x19464b={'rawCommand':_0x42f95d[_0x1fc622(0x1dc)],'errorMessage':_0x42f95d['errorMessage'],'errorType':_0x42f95d['errorType'],'featureId':_0x42f95d['featureId'],'sessionId':_0x42f95d['sessionId'],'metadata':_0x41961e,'cliVersion':_0x5491eb};process['env']['DEBUG']&&(console['error'](_0x1fc622(0x1d8)+_0x1909eb+'/api/v1/mcp/desire-path-logs'),console[_0x1fc622(0x1c0)]('[desire-path]\x20Payload:\x20'+JSON[_0x1fc622(0x1bd)](_0x19464b,null,0x2))),await _0x56768d[_0x1fc622(0x1b9)](fetch,_0x1909eb+'/api/v1/mcp/desire-path-logs',{'method':_0x56768d['lLSAR'],'headers':_0x7faa9f,'body':JSON[_0x1fc622(0x1bd)](_0x19464b)});}catch(_0x36d1c3){process[_0x1fc622(0x1b7)][_0x1fc622(0x1d7)]&&console[_0x1fc622(0x1c0)](_0x1fc622(0x1cf)+_0x36d1c3);}}export function getErrorType(_0x2b2cf0,_0x57580d){const _0x23de1a=_0x518c2b,_0xaea66c={'pHyBq':_0x23de1a(0x1d0),'QWvEu':'Unknown\x20command','BoDkq':_0x23de1a(0x1e0),'luUxc':_0x23de1a(0x1dd),'jpAZa':_0x23de1a(0x1d1),'UaKnS':_0x23de1a(0x1e9),'XgEXr':_0x23de1a(0x1cc),'SBOll':_0x23de1a(0x1bc)},_0x9313db=_0xaea66c['pHyBq'][_0x23de1a(0x1c4)]('|');let _0x8ca0c5=0x0;while(!![]){switch(_0x9313db[_0x8ca0c5++]){case'0':return'syntax_error';case'1':if(_0x2b2cf0['includes'](_0xaea66c['QWvEu']))return'unknown_command';continue;case'2':if(_0x2b2cf0['includes'](_0xaea66c[_0x23de1a(0x1bf)]))return _0x23de1a(0x1ca);continue;case'3':if(_0x2b2cf0[_0x23de1a(0x1da)](_0xaea66c[_0x23de1a(0x1b8)]))return _0xaea66c[_0x23de1a(0x1de)];continue;case'4':if(_0x57580d)return'runtime_error';continue;case'5':if(!_0x2b2cf0)return'unknown';continue;case'6':if(_0x2b2cf0[_0x23de1a(0x1da)](_0x23de1a(0x1bb)))return _0xaea66c['UaKnS'];continue;case'7':if(_0x2b2cf0[_0x23de1a(0x1da)](_0xaea66c[_0x23de1a(0x1ba)]))return _0xaea66c['SBOll'];continue;}break;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x3e883b=_0x4d9b;(function(_0x2fcfcc,_0xef7f6f){const _0x343fdc=_0x4d9b,_0x31bc9a=_0x2fcfcc();while(!![]){try{const _0x35728b=parseInt(_0x343fdc(0x11e))/0x1*(-parseInt(_0x343fdc(0x117))/0x2)+parseInt(_0x343fdc(0x135))/0x3*(parseInt(_0x343fdc(0x14c))/0x4)+-parseInt(_0x343fdc(0x139))/0x5+parseInt(_0x343fdc(0x122))/0x6*(parseInt(_0x343fdc(0x128))/0x7)+-parseInt(_0x343fdc(0x161))/0x8*(-parseInt(_0x343fdc(0x147))/0x9)+-parseInt(_0x343fdc(0x158))/0xa*(-parseInt(_0x343fdc(0x151))/0xb)+parseInt(_0x343fdc(0x146))/0xc;if(_0x35728b===_0xef7f6f)break;else _0x31bc9a['push'](_0x31bc9a['shift']());}catch(_0x50e9de){_0x31bc9a['push'](_0x31bc9a['shift']());}}}(_0x54c7,0xa9718));function _0x54c7(){const _0x3c3303=['18uJsToJ','Failed\x20to\x20provision\x20API\x20key:\x20','Device\x20authorization\x20timed\x20out','status','4754650qpiGzI','write','FNjar','PdCYA','nEkoU','access_token','GxZyb','jPPAD','unref','stringify','Authentication\x20failed','stdout','split','8564592Xzdwpw','9VjMKTK','YryKR','text','https://api.workos.com/user_management/authenticate','POST','328056OEzele','apiKeys','token','length','xdg-open','8888374MKkeqg','/organization/me','Invalid\x20JWT\x20format','application/x-www-form-urlencoded','Using\x20organization:\x20','open','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','10YXNEwV','workosClientId','mcp:write','device_code','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','tEdbM','application/json','nfLJT','HbwqJ','1114032iGVSih','GET','org_id','Failed\x20to\x20fetch\x20memberships:\x20','log','Failed\x20to\x20provision\x20CLI\x20token:\x20','apiKey','aNCsO','WPrwg','json','Failed\x20to\x20create\x20organization:\x20','verification_uri_complete','utf-8','10TaEvfc','ieiES','from','now','authorization_pending','XKmYI','name','212945bSaFbT','zvHva','refresh_token','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','3339642jHlkuw','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','Failed\x20to\x20request\x20device\x20code:\x20','gAMUj','/cli-auth/token','tgtgW','7srbQhi','NmylB','organizationId','XeKnv','map','/organization/self-serve-signup','Setting\x20up\x20your\x20organization...','startsWith','gZbWT','/api-keys','error','NQHcV','isTTY'];_0x54c7=function(){return _0x3c3303;};return _0x54c7();}import{spawn}from'child_process';import _0x1c0726 from'inquirer';function _0x4d9b(_0x508377,_0x1da5bb){_0x508377=_0x508377-0x111;const _0x54c7ee=_0x54c7();let _0x4d9bb6=_0x54c7ee[_0x508377];return _0x4d9bb6;}import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL='https://api.workos.com/user_management/authorize/device',WORKOS_TOKEN_URL=_0x3e883b(0x14a);export async function requestDeviceCode(_0x3d2b19){const _0x57877c=_0x3e883b,_0x597748={'SiQrU':function(_0x42c20f,_0x27f42e,_0x57588b){return _0x42c20f(_0x27f42e,_0x57588b);}},_0x4ef4bd=await _0x597748['SiQrU'](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x57877c(0x14b),'headers':{'Content-Type':_0x57877c(0x154)},'body':new URLSearchParams({'client_id':_0x3d2b19})});if(!_0x4ef4bd['ok']){const _0x26d357=await _0x4ef4bd['text']();throw new Error(_0x57877c(0x124)+_0x4ef4bd['status']+'\x20'+_0x26d357);}return _0x4ef4bd[_0x57877c(0x113)]();}export async function pollForTokens(_0x5b3bdd,_0xeb639,_0x3e7eba,_0x2f55e3){const _0x34dc49=_0x3e883b,_0x1f52ff={'svUmA':function(_0x442efe,_0x442442){return _0x442efe+_0x442442;},'nEkoU':function(_0x4e3049,_0x365c35){return _0x4e3049*_0x365c35;},'NQHcV':function(_0x35daf9,_0x133ee9){return _0x35daf9<_0x133ee9;},'GxZyb':function(_0x32fd2d,_0x15dc98){return _0x32fd2d(_0x15dc98);},'mAuZZ':function(_0x5f2be4,_0x4a6639,_0x183101){return _0x5f2be4(_0x4a6639,_0x183101);},'tgtgW':_0x34dc49(0x154),'lKwGv':'slow_down','SMOYc':_0x34dc49(0x143)},_0x4fb564=_0x1f52ff['svUmA'](Date[_0x34dc49(0x11a)](),_0x1f52ff[_0x34dc49(0x13d)](_0x2f55e3,0x3e8));let _0x497d7b=_0x3e7eba*0x3e8;while(_0x1f52ff[_0x34dc49(0x133)](Date['now'](),_0x4fb564)){await _0x1f52ff[_0x34dc49(0x13f)](sleep,_0x497d7b);const _0x10b88d=await _0x1f52ff['mAuZZ'](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x1f52ff[_0x34dc49(0x127)]},'body':new URLSearchParams({'client_id':_0x5b3bdd,'device_code':_0xeb639,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x10b88d['ok'])return _0x10b88d[_0x34dc49(0x113)]();const _0x1907e9=await _0x10b88d[_0x34dc49(0x113)]();if(_0x1907e9[_0x34dc49(0x132)]===_0x34dc49(0x11b))continue;if(_0x1907e9[_0x34dc49(0x132)]===_0x1f52ff['lKwGv']){_0x497d7b+=0x3e8;continue;}throw new Error(_0x1907e9['error_description']||_0x1907e9['error']||_0x1f52ff['SMOYc']);}throw new Error(_0x34dc49(0x137));}async function fetchUserProfile(_0x44b4a5){const _0x29d198=_0x3e883b,_0x5e2459={'tEdbM':function(_0x51aec9,_0x2e0340,_0x59b91f){return _0x51aec9(_0x2e0340,_0x59b91f);}},_0x5776b6=getApiBaseUrl();try{const _0x12a660=await _0x5e2459[_0x29d198(0x15d)](fetch,_0x5776b6+_0x29d198(0x152),{'method':_0x29d198(0x162),'headers':{'workos-token':_0x44b4a5}});if(_0x12a660['ok'])return _0x12a660['json']();}catch{}return null;}function buildKeyName(_0x25140d,_0x43d39a){const _0x8e2481=_0x3e883b,_0x18f79d={'chdhi':function(_0x30252d,_0x48b092){return _0x30252d===_0x48b092;}},_0x4cfafb=_0x43d39a['filter'](_0x363a1d=>_0x363a1d['name']===_0x25140d||_0x363a1d['name'][_0x8e2481(0x12f)](_0x25140d+'\x20('));if(_0x18f79d['chdhi'](_0x4cfafb[_0x8e2481(0x14f)],0x0))return _0x25140d;return _0x25140d+'\x20('+(_0x4cfafb[_0x8e2481(0x14f)]+0x1)+')';}export async function provisionApiKey(_0x366b88){const _0x539f43=_0x3e883b,_0x4dea1e={'hhixi':function(_0x5bc940){return _0x5bc940();},'AWSbw':function(_0x151c0e,_0x1bb7aa,_0x4b2277){return _0x151c0e(_0x1bb7aa,_0x4b2277);},'aNCsO':_0x539f43(0x162),'wajYC':function(_0x5d3720,_0x59351e,_0x348936){return _0x5d3720(_0x59351e,_0x348936);},'QzLCc':_0x539f43(0x15a)},_0x2716ab=_0x4dea1e['hhixi'](getApiBaseUrl),_0x5bc099={'Content-Type':'application/json','workos-token':_0x366b88},_0x1fdf0a=await fetchUserProfile(_0x366b88),_0x4a8208=_0x1fdf0a?.['firstName']||_0x1fdf0a?.['email']?.['split']('@')[0x0],_0x4a6651=_0x4a8208?_0x4a8208+'\x27s\x20CLI\x20Key':'CLI\x20Key';let _0x3d8a70=[];try{const _0x4edc4f=await _0x4dea1e['AWSbw'](fetch,_0x2716ab+_0x539f43(0x131),{'method':_0x4dea1e[_0x539f43(0x111)],'headers':_0x5bc099});if(_0x4edc4f['ok']){const _0x455a54=await _0x4edc4f[_0x539f43(0x113)]();_0x3d8a70=_0x455a54[_0x539f43(0x14d)];}}catch{}const _0xd4d4b1=_0x4dea1e['wajYC'](buildKeyName,_0x4a6651,_0x3d8a70),_0x311a64=await fetch(_0x2716ab+'/api-keys',{'method':'POST','headers':_0x5bc099,'body':JSON[_0x539f43(0x142)]({'name':_0xd4d4b1,'scope':_0x4dea1e['QzLCc']})});if(!_0x311a64['ok']){const _0x22fd76=await _0x311a64[_0x539f43(0x149)]();throw new Error(_0x539f43(0x136)+_0x311a64[_0x539f43(0x138)]+'\x20'+_0x22fd76);}const _0x1e70b1=await _0x311a64['json']();return _0x1e70b1[_0x539f43(0x167)][_0x539f43(0x14e)];}export function openBrowser(_0x2f2b82){const _0x4582b7=_0x3e883b,_0x5caaba={'oAwDY':function(_0x2a1564,_0x11b7df){return _0x2a1564===_0x11b7df;},'nfLJT':function(_0x15ab8a,_0x503857,_0x588291,_0x46506b){return _0x15ab8a(_0x503857,_0x588291,_0x46506b);},'ZkKDt':_0x4582b7(0x156),'XhaVb':'ignore'};try{if(_0x5caaba['oAwDY'](process['platform'],'win32')){const _0x701100=_0x5caaba[_0x4582b7(0x15f)](spawn,'cmd',['/c','start','',_0x2f2b82],{'detached':!![],'stdio':'ignore','windowsHide':!![]});_0x701100[_0x4582b7(0x141)]();return;}const _0x46c5c2=process['platform']==='darwin'?_0x5caaba['ZkKDt']:_0x4582b7(0x150),_0x35ec31=spawn(_0x46c5c2,[_0x2f2b82],{'detached':!![],'stdio':_0x5caaba['XhaVb']});_0x35ec31['unref']();}catch{}}function decodeJwtPayload(_0x14a7e6){const _0x2a6261=_0x3e883b,_0x207d42={'FNjar':function(_0x2fd128,_0x1cc9c5){return _0x2fd128!==_0x1cc9c5;},'HnNku':_0x2a6261(0x153)},_0x5131f3=_0x14a7e6[_0x2a6261(0x145)]('.');if(_0x207d42[_0x2a6261(0x13b)](_0x5131f3[_0x2a6261(0x14f)],0x3))throw new Error(_0x207d42['HnNku']);const _0x4235ec=Buffer[_0x2a6261(0x119)](_0x5131f3[0x1],'base64url')['toString'](_0x2a6261(0x116));return JSON['parse'](_0x4235ec);}async function selfServeSignup(_0x4c6052){const _0x490c83=_0x3e883b,_0x48114b={'ieiES':_0x490c83(0x14b)},_0x5611b2=getApiBaseUrl(),_0x15de62=await fetch(_0x5611b2+_0x490c83(0x12d),{'method':_0x48114b[_0x490c83(0x118)],'headers':{'Content-Type':'application/json','workos-token':_0x4c6052}});if(!_0x15de62['ok']){const _0x28306b=await _0x15de62[_0x490c83(0x149)]();throw new Error(_0x490c83(0x114)+_0x15de62['status']+'\x20'+_0x28306b);}return _0x15de62[_0x490c83(0x113)]();}async function fetchMyMemberships(_0xaff331){const _0x142b0d=_0x3e883b,_0x3b927b={'YryKR':function(_0x4683bd){return _0x4683bd();}},_0x5156ed=_0x3b927b[_0x142b0d(0x148)](getApiBaseUrl),_0x4017fc=await fetch(_0x5156ed+'/organization/my-memberships',{'method':_0x142b0d(0x162),'headers':{'workos-token':_0xaff331}});if(!_0x4017fc['ok']){const _0x3b1f1f=await _0x4017fc['text']();throw new Error(_0x142b0d(0x164)+_0x4017fc[_0x142b0d(0x138)]+'\x20'+_0x3b1f1f);}const _0x43da63=await _0x4017fc[_0x142b0d(0x113)]();return _0x43da63['memberships'];}async function refreshTokenWithOrg(_0x55ee94,_0x3e8186,_0x2a9ae9){const _0x2d4d98=_0x3e883b,_0x3fa895={'MiPcD':function(_0x292fba,_0x3956d7,_0xff2c68){return _0x292fba(_0x3956d7,_0xff2c68);},'HbwqJ':_0x2d4d98(0x14b),'KeHvW':_0x2d4d98(0x120)},_0x154b63=await _0x3fa895['MiPcD'](fetch,WORKOS_TOKEN_URL,{'method':_0x3fa895[_0x2d4d98(0x160)],'headers':{'Content-Type':_0x2d4d98(0x154)},'body':new URLSearchParams({'client_id':_0x55ee94,'grant_type':_0x3fa895['KeHvW'],'refresh_token':_0x3e8186,'organization_id':_0x2a9ae9})});if(!_0x154b63['ok']){const _0x374eb7=await _0x154b63['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x154b63['status']+'\x20'+_0x374eb7);}return _0x154b63['json']();}async function provisionCliToken(_0x1e0e8f){const _0x4b20b4=_0x3e883b,_0x24e1a0={'DocEc':function(_0x3071d0){return _0x3071d0();},'XeKnv':function(_0x15698a,_0x3b0889,_0x503237){return _0x15698a(_0x3b0889,_0x503237);},'NmylB':_0x4b20b4(0x14b)},_0x4ff185=_0x24e1a0['DocEc'](getApiBaseUrl),_0x5c5ea9=await _0x24e1a0[_0x4b20b4(0x12b)](fetch,_0x4ff185+_0x4b20b4(0x126),{'method':_0x24e1a0[_0x4b20b4(0x129)],'headers':{'Content-Type':_0x4b20b4(0x15e),'workos-token':_0x1e0e8f}});if(!_0x5c5ea9['ok']){const _0x216ff4=await _0x5c5ea9['text']();throw new Error(_0x4b20b4(0x166)+_0x5c5ea9[_0x4b20b4(0x138)]+'\x20'+_0x216ff4);}return _0x5c5ea9[_0x4b20b4(0x113)]();}export async function runDeviceAuthFlow(){const _0x162383=_0x3e883b,_0x1145cb={'WPrwg':_0x162383(0x121),'PdCYA':'Waiting\x20for\x20authentication...','IXPeO':function(_0x5db029,_0x261730,_0x494fdb,_0x4d61d1,_0x9205a5){return _0x5db029(_0x261730,_0x494fdb,_0x4d61d1,_0x9205a5);},'jPPAD':function(_0x435db5,_0x5ad776){return _0x435db5===_0x5ad776;},'gAMUj':_0x162383(0x12e),'foSnG':function(_0xe032d,_0x353756){return _0xe032d(_0x353756);},'wLasH':'list','gZbWT':'selected','jYEms':'Select\x20an\x20organization:','zvHva':'Provisioning\x20CLI\x20token...','XKmYI':function(_0x540b31,_0x2a4bb4){return _0x540b31(_0x2a4bb4);}},_0x481b6d=getCurrentEnvironment(),_0x1f1920=ENVIRONMENT_CONFIGS[_0x481b6d][_0x162383(0x159)],_0x52a5ec=await requestDeviceCode(_0x1f1920);console['log'](_0x162383(0x157)),console[_0x162383(0x165)](_0x1145cb[_0x162383(0x112)]),openBrowser(_0x52a5ec[_0x162383(0x115)]),console['log'](_0x162383(0x123)+_0x52a5ec['verification_uri_complete']),console[_0x162383(0x165)]('Code:\x20'+_0x52a5ec['user_code']+'\x0a'),process['stdout']['write'](_0x1145cb[_0x162383(0x13c)]);let _0x42a76e=await _0x1145cb['IXPeO'](pollForTokens,_0x1f1920,_0x52a5ec[_0x162383(0x15b)],_0x52a5ec['interval'],_0x52a5ec['expires_in']);console[_0x162383(0x165)]('\x20✓');const _0x5880e5=decodeJwtPayload(_0x42a76e[_0x162383(0x13e)]);if(!_0x5880e5[_0x162383(0x163)]){const _0x292803=await fetchMyMemberships(_0x42a76e['access_token']);let _0x32aeea;if(_0x1145cb['jPPAD'](_0x292803[_0x162383(0x14f)],0x0)){process['stdout'][_0x162383(0x13a)](_0x1145cb[_0x162383(0x125)]);const _0x1c3159=await _0x1145cb['foSnG'](selfServeSignup,_0x42a76e['access_token']);_0x32aeea=_0x1c3159[_0x162383(0x12a)],console['log']('\x20✓');}else{if(_0x1145cb[_0x162383(0x140)](_0x292803['length'],0x1))_0x32aeea=_0x292803[0x0]['organizationId'],console[_0x162383(0x165)](_0x162383(0x155)+_0x292803[0x0][_0x162383(0x11d)]);else{const _0x3f2117=process['stdin'][_0x162383(0x134)]&&process[_0x162383(0x144)][_0x162383(0x134)];if(!_0x3f2117)throw new Error(_0x162383(0x15c)+'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.');const {selected:_0x4e5cb5}=await _0x1c0726['prompt']([{'type':_0x1145cb['wLasH'],'name':_0x1145cb[_0x162383(0x130)],'message':_0x1145cb['jYEms'],'choices':_0x292803[_0x162383(0x12c)](_0x4c0f52=>({'name':_0x4c0f52['name'],'value':_0x4c0f52[_0x162383(0x12a)]}))}]);_0x32aeea=_0x4e5cb5;}}_0x42a76e=await refreshTokenWithOrg(_0x1f1920,_0x42a76e[_0x162383(0x120)],_0x32aeea);}process['stdout'][_0x162383(0x13a)](_0x1145cb[_0x162383(0x11f)]);const _0x27d1ec=await provisionCliToken(_0x42a76e['access_token']);return console[_0x162383(0x165)]('\x20✓'),await _0x1145cb[_0x162383(0x11c)](storeToken,_0x27d1ec[_0x162383(0x14e)]),_0x42a76e['refresh_token']&&await storeRefreshToken(_0x42a76e[_0x162383(0x120)]),_0x27d1ec[_0x162383(0x14e)];}function sleep(_0x4b6fbd){return new Promise(_0x12c038=>setTimeout(_0x12c038,_0x4b6fbd));}
|
|
1
|
+
const _0x224128=_0x2aa6;(function(_0x5cd0ab,_0x2c6882){const _0x48c6e0=_0x2aa6,_0x560d01=_0x5cd0ab();while(!![]){try{const _0xa2865f=-parseInt(_0x48c6e0(0x108))/0x1*(parseInt(_0x48c6e0(0x102))/0x2)+parseInt(_0x48c6e0(0x110))/0x3*(-parseInt(_0x48c6e0(0x14c))/0x4)+parseInt(_0x48c6e0(0x118))/0x5+-parseInt(_0x48c6e0(0x14f))/0x6*(parseInt(_0x48c6e0(0x120))/0x7)+-parseInt(_0x48c6e0(0x145))/0x8+-parseInt(_0x48c6e0(0x11e))/0x9*(-parseInt(_0x48c6e0(0x13e))/0xa)+parseInt(_0x48c6e0(0x104))/0xb;if(_0xa2865f===_0x2c6882)break;else _0x560d01['push'](_0x560d01['shift']());}catch(_0x55417a){_0x560d01['push'](_0x560d01['shift']());}}}(_0x337e,0xf3e43));import{spawn}from'child_process';import _0x54a5f5 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x224128(0x131),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0x5c8295){const _0x4fb8bf=_0x224128,_0x3a6997={'IqXxU':_0x4fb8bf(0x14e)},_0x4fb4dc=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x4fb8bf(0x114),'headers':{'Content-Type':_0x3a6997[_0x4fb8bf(0x138)]},'body':new URLSearchParams({'client_id':_0x5c8295})});if(!_0x4fb4dc['ok']){const _0x1ac76b=await _0x4fb4dc['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x4fb4dc[_0x4fb8bf(0x125)]+'\x20'+_0x1ac76b);}return _0x4fb4dc[_0x4fb8bf(0x103)]();}export async function pollForTokens(_0x51aaac,_0x332836,_0x49cf2,_0xade676){const _0x3aad99=_0x224128,_0x3bf8d8={'exDkY':function(_0x1144ee,_0x272e45){return _0x1144ee+_0x272e45;},'lEqLY':function(_0x22626b,_0x12a591){return _0x22626b<_0x12a591;}},_0x97c315=_0x3bf8d8[_0x3aad99(0x127)](Date[_0x3aad99(0x136)](),_0xade676*0x3e8);let _0x5c38f2=_0x49cf2*0x3e8;while(_0x3bf8d8[_0x3aad99(0x128)](Date[_0x3aad99(0x136)](),_0x97c315)){await sleep(_0x5c38f2);const _0x3af192=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x3aad99(0x14e)},'body':new URLSearchParams({'client_id':_0x51aaac,'device_code':_0x332836,'grant_type':_0x3aad99(0x141)})});if(_0x3af192['ok'])return _0x3af192[_0x3aad99(0x103)]();const _0x5b3aeb=await _0x3af192[_0x3aad99(0x103)]();if(_0x5b3aeb[_0x3aad99(0x150)]==='authorization_pending')continue;if(_0x5b3aeb[_0x3aad99(0x150)]===_0x3aad99(0x11c)){_0x5c38f2+=0x3e8;continue;}throw new Error(_0x5b3aeb['error_description']||_0x5b3aeb['error']||'Authentication\x20failed');}throw new Error('Device\x20authorization\x20timed\x20out');}async function fetchUserProfile(_0x11e591){const _0x5068f0=_0x224128,_0x3671d3={'OxJMZ':function(_0x3c2c3c){return _0x3c2c3c();},'HxpFE':_0x5068f0(0x10b)},_0x4992a4=_0x3671d3[_0x5068f0(0x143)](getApiBaseUrl);try{const _0x3a1808=await fetch(_0x4992a4+_0x5068f0(0x134),{'method':_0x3671d3['HxpFE'],'headers':{'workos-token':_0x11e591}});if(_0x3a1808['ok'])return _0x3a1808[_0x5068f0(0x103)]();}catch{}return null;}function buildKeyName(_0x2ee2d9,_0x33ab12){const _0x4798f9=_0x224128,_0xae1865={'pmHJz':function(_0x280cbb,_0x1b54c5){return _0x280cbb===_0x1b54c5;}},_0x4fa6b0=_0x33ab12['filter'](_0x174550=>_0x174550['name']===_0x2ee2d9||_0x174550[_0x4798f9(0x14d)][_0x4798f9(0x121)](_0x2ee2d9+'\x20('));if(_0xae1865[_0x4798f9(0x14b)](_0x4fa6b0[_0x4798f9(0x12d)],0x0))return _0x2ee2d9;return _0x2ee2d9+'\x20('+(_0x4fa6b0['length']+0x1)+')';}export async function provisionApiKey(_0x3240df){const _0x25ecee=_0x224128,_0x3fe841={'YjPfo':function(_0x3c27cb){return _0x3c27cb();},'qwaCi':_0x25ecee(0x100),'qtjZi':'GET','JpCTV':function(_0x28a93b,_0x56e73d,_0x57c2d9){return _0x28a93b(_0x56e73d,_0x57c2d9);},'fItxL':_0x25ecee(0x114)},_0x329083=_0x3fe841[_0x25ecee(0x123)](getApiBaseUrl),_0x2df7e9={'Content-Type':_0x25ecee(0x10e),'workos-token':_0x3240df},_0x46e2a4=await fetchUserProfile(_0x3240df),_0x5c4c39=_0x46e2a4?.['firstName']||_0x46e2a4?.[_0x25ecee(0x12c)]?.[_0x25ecee(0x111)]('@')[0x0],_0x360ec2=_0x5c4c39?_0x5c4c39+'\x27s\x20CLI\x20Key':_0x3fe841['qwaCi'];let _0x100b74=[];try{const _0x2d45f7=await fetch(_0x329083+_0x25ecee(0x140),{'method':_0x3fe841['qtjZi'],'headers':_0x2df7e9});if(_0x2d45f7['ok']){const _0x532535=await _0x2d45f7['json']();_0x100b74=_0x532535['apiKeys'];}}catch{}const _0x381c55=_0x3fe841[_0x25ecee(0x144)](buildKeyName,_0x360ec2,_0x100b74),_0x349a12=await fetch(_0x329083+_0x25ecee(0x140),{'method':_0x3fe841['fItxL'],'headers':_0x2df7e9,'body':JSON[_0x25ecee(0x13d)]({'name':_0x381c55,'scope':'mcp:write'})});if(!_0x349a12['ok']){const _0x1c46cb=await _0x349a12[_0x25ecee(0x13a)]();throw new Error(_0x25ecee(0x129)+_0x349a12[_0x25ecee(0x125)]+'\x20'+_0x1c46cb);}const _0x37ab39=await _0x349a12['json']();return _0x37ab39[_0x25ecee(0x101)]['token'];}export function openBrowser(_0x27d222){const _0x11fc43=_0x224128,_0x56a8d4={'InBdY':_0x11fc43(0x149),'RJZof':'cmd','sUMRE':'ignore','VFmYn':_0x11fc43(0x11a),'wwTyv':_0x11fc43(0x133),'BdFwq':function(_0x22b8fb,_0x33baa0,_0x41db7d,_0x5a4b8e){return _0x22b8fb(_0x33baa0,_0x41db7d,_0x5a4b8e);}};try{if(process['platform']===_0x56a8d4[_0x11fc43(0x12b)]){const _0x1b48ae=spawn(_0x56a8d4['RJZof'],['/c','start','',_0x27d222],{'detached':!![],'stdio':_0x56a8d4[_0x11fc43(0x130)],'windowsHide':!![]});_0x1b48ae['unref']();return;}const _0x59422e=process[_0x11fc43(0x14a)]===_0x56a8d4[_0x11fc43(0x13c)]?_0x11fc43(0x12f):_0x56a8d4[_0x11fc43(0x109)],_0xbbfa75=_0x56a8d4['BdFwq'](spawn,_0x59422e,[_0x27d222],{'detached':!![],'stdio':'ignore'});_0xbbfa75['unref']();}catch{}}function decodeJwtPayload(_0x5f32ba){const _0x5d2254=_0x224128,_0x578679={'LeFJx':function(_0x1b5634,_0x5cc20e){return _0x1b5634!==_0x5cc20e;},'WZjYv':_0x5d2254(0x137)},_0x5e2f5b=_0x5f32ba['split']('.');if(_0x578679[_0x5d2254(0xff)](_0x5e2f5b['length'],0x3))throw new Error('Invalid\x20JWT\x20format');const _0x3490c4=Buffer[_0x5d2254(0x122)](_0x5e2f5b[0x1],_0x578679[_0x5d2254(0x11f)])['toString']('utf-8');return JSON[_0x5d2254(0x135)](_0x3490c4);}async function selfServeSignup(_0x523c60){const _0x1fdb7d=_0x224128,_0xc986d8={'TmKFI':'POST'},_0x529f42=getApiBaseUrl(),_0x2d927b=await fetch(_0x529f42+'/organization/self-serve-signup',{'method':_0xc986d8['TmKFI'],'headers':{'Content-Type':_0x1fdb7d(0x10e),'workos-token':_0x523c60}});if(!_0x2d927b['ok']){const _0x2094cd=await _0x2d927b['text']();throw new Error(_0x1fdb7d(0x11d)+_0x2d927b[_0x1fdb7d(0x125)]+'\x20'+_0x2094cd);}return _0x2d927b['json']();}async function fetchMyMemberships(_0x2bed5b){const _0x50269b=_0x224128,_0x366aa9={'wDsPC':function(_0x2e4843){return _0x2e4843();},'sWTLg':function(_0x2b91eb,_0x112228,_0x4c2671){return _0x2b91eb(_0x112228,_0x4c2671);}},_0x312d87=_0x366aa9[_0x50269b(0x107)](getApiBaseUrl),_0x157f4e=await _0x366aa9[_0x50269b(0x10f)](fetch,_0x312d87+_0x50269b(0x12e),{'method':'GET','headers':{'workos-token':_0x2bed5b}});if(!_0x157f4e['ok']){const _0x799753=await _0x157f4e['text']();throw new Error(_0x50269b(0x117)+_0x157f4e['status']+'\x20'+_0x799753);}const _0x5e5e6d=await _0x157f4e['json']();return _0x5e5e6d['memberships'];}async function refreshTokenWithOrg(_0x35460b,_0x2f14a2,_0x28a23f){const _0x1259f9=_0x224128,_0x5f2f4e={'prjVj':function(_0x2e1d76,_0x3963b4,_0x126705){return _0x2e1d76(_0x3963b4,_0x126705);},'yBAUk':'application/x-www-form-urlencoded'},_0x317420=await _0x5f2f4e['prjVj'](fetch,WORKOS_TOKEN_URL,{'method':_0x1259f9(0x114),'headers':{'Content-Type':_0x5f2f4e['yBAUk']},'body':new URLSearchParams({'client_id':_0x35460b,'grant_type':_0x1259f9(0x106),'refresh_token':_0x2f14a2,'organization_id':_0x28a23f})});if(!_0x317420['ok']){const _0x35a68e=await _0x317420['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x317420[_0x1259f9(0x125)]+'\x20'+_0x35a68e);}return _0x317420['json']();}async function provisionCliToken(_0x3d9d99){const _0x1c6a55=_0x224128,_0x251e57={'cObns':function(_0x5b7fd3){return _0x5b7fd3();},'MFKFs':_0x1c6a55(0x10e)},_0x201e00=_0x251e57[_0x1c6a55(0x146)](getApiBaseUrl),_0x26021c=await fetch(_0x201e00+_0x1c6a55(0x112),{'method':_0x1c6a55(0x114),'headers':{'Content-Type':_0x251e57['MFKFs'],'workos-token':_0x3d9d99}});if(!_0x26021c['ok']){const _0x130f27=await _0x26021c['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x26021c[_0x1c6a55(0x125)]+'\x20'+_0x130f27);}return _0x26021c[_0x1c6a55(0x103)]();}function _0x337e(){const _0x163acd=['wDsPC','139EQdfpL','wwTyv','FpOay','GET','token','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','application/json','sWTLg','531BHnuyk','split','/cli-auth/token','stdout','POST','yqFYX','LmbdB','Failed\x20to\x20fetch\x20memberships:\x20','1784740jnPBeX','write','darwin','access_token','slow_down','Failed\x20to\x20create\x20organization:\x20','9lKgoqG','WZjYv','1555295wEOuMz','startsWith','from','YjPfo','device_code','status','organizationId','exDkY','lEqLY','Failed\x20to\x20provision\x20API\x20key:\x20','list','InBdY','email','length','/organization/my-memberships','open','sUMRE','https://api.workos.com/user_management/authorize/device','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','xdg-open','/organization/me','parse','now','base64url','IqXxU','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','text','expires_in','VFmYn','stringify','4022810giHLbs','Select\x20an\x20organization:','/api-keys','urn:ietf:params:oauth:grant-type:device_code','log','OxJMZ','JpCTV','2478960vHUJHz','cObns','fMePw','uUeEM','win32','platform','pmHJz','13332KOsiwq','name','application/x-www-form-urlencoded','6bbLEes','error','selected','rtqQe','LeFJx','CLI\x20Key','apiKey','21232jSGWcu','json','31211070IJMlaD','Setting\x20up\x20your\x20organization...','refresh_token'];_0x337e=function(){return _0x163acd;};return _0x337e();}function _0x2aa6(_0x105924,_0x5aa9e8){_0x105924=_0x105924-0xfd;const _0x337ec8=_0x337e();let _0x2aa65e=_0x337ec8[_0x105924];return _0x2aa65e;}export async function runDeviceAuthFlow(){const _0x132120=_0x224128,_0x26e1af={'LmbdB':function(_0x1f8a7d,_0x2f8e93){return _0x1f8a7d(_0x2f8e93);},'uUeEM':_0x132120(0x10d),'yqFYX':_0x132120(0x132),'rtqQe':function(_0x56e7c8,_0x50f068,_0x357d2d,_0x87d49a,_0x553d4c){return _0x56e7c8(_0x50f068,_0x357d2d,_0x87d49a,_0x553d4c);},'efbvh':function(_0x1e8c45,_0x126a6b){return _0x1e8c45===_0x126a6b;},'tbJLc':function(_0x433f72,_0x24b60b){return _0x433f72+_0x24b60b;},'fMePw':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','TwVQK':_0x132120(0xfd),'BfNZR':_0x132120(0x13f),'FpOay':function(_0x1573c4,_0x3d799c){return _0x1573c4(_0x3d799c);}},_0x11fe35=getCurrentEnvironment(),_0xb35f40=ENVIRONMENT_CONFIGS[_0x11fe35]['workosClientId'],_0x427aa1=await _0x26e1af[_0x132120(0x116)](requestDeviceCode,_0xb35f40);console[_0x132120(0x142)](_0x26e1af[_0x132120(0x148)]),console[_0x132120(0x142)](_0x26e1af[_0x132120(0x115)]),openBrowser(_0x427aa1['verification_uri_complete']),console[_0x132120(0x142)](_0x132120(0x139)+_0x427aa1['verification_uri_complete']),console['log']('Code:\x20'+_0x427aa1['user_code']+'\x0a'),process['stdout'][_0x132120(0x119)]('Waiting\x20for\x20authentication...');let _0x440481=await _0x26e1af[_0x132120(0xfe)](pollForTokens,_0xb35f40,_0x427aa1[_0x132120(0x124)],_0x427aa1['interval'],_0x427aa1[_0x132120(0x13b)]);console['log']('\x20✓');const _0x196b1f=_0x26e1af['LmbdB'](decodeJwtPayload,_0x440481['access_token']);if(!_0x196b1f['org_id']){const _0x5d25f9=await fetchMyMemberships(_0x440481[_0x132120(0x11b)]);let _0x249f44;if(_0x5d25f9['length']===0x0){process[_0x132120(0x113)]['write'](_0x132120(0x105));const _0x21fb8e=await selfServeSignup(_0x440481['access_token']);_0x249f44=_0x21fb8e['organizationId'],console[_0x132120(0x142)]('\x20✓');}else{if(_0x26e1af['efbvh'](_0x5d25f9[_0x132120(0x12d)],0x1))_0x249f44=_0x5d25f9[0x0][_0x132120(0x126)],console[_0x132120(0x142)]('Using\x20organization:\x20'+_0x5d25f9[0x0]['name']);else{const _0x1b5d5a=process['stdin']['isTTY']&&process['stdout']['isTTY'];if(!_0x1b5d5a)throw new Error(_0x26e1af['tbJLc'](_0x26e1af[_0x132120(0x147)],'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.'));const {selected:_0x5bd021}=await _0x54a5f5['prompt']([{'type':_0x132120(0x12a),'name':_0x26e1af['TwVQK'],'message':_0x26e1af['BfNZR'],'choices':_0x5d25f9['map'](_0x51c956=>({'name':_0x51c956['name'],'value':_0x51c956[_0x132120(0x126)]}))}]);_0x249f44=_0x5bd021;}}_0x440481=await refreshTokenWithOrg(_0xb35f40,_0x440481['refresh_token'],_0x249f44);}process[_0x132120(0x113)][_0x132120(0x119)]('Provisioning\x20CLI\x20token...');const _0x43f314=await provisionCliToken(_0x440481['access_token']);return console[_0x132120(0x142)]('\x20✓'),await storeToken(_0x43f314['token']),_0x440481[_0x132120(0x106)]&&await _0x26e1af[_0x132120(0x10a)](storeRefreshToken,_0x440481['refresh_token']),_0x43f314[_0x132120(0x10c)];}function sleep(_0x12aa1b){return new Promise(_0x4007d6=>setTimeout(_0x4007d6,_0x12aa1b));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x544583=_0x1b5d;(function(_0x49ae4a,_0x2231bc){const _0x5196d1=_0x1b5d,_0x5a2975=_0x49ae4a();while(!![]){try{const _0x196b1f=parseInt(_0x5196d1(0xa8))/0x1*(-parseInt(_0x5196d1(0xbf))/0x2)+-parseInt(_0x5196d1(0xbd))/0x3*(parseInt(_0x5196d1(0xc7))/0x4)+-parseInt(_0x5196d1(0xc3))/0x5+-parseInt(_0x5196d1(0xc6))/0x6+-parseInt(_0x5196d1(0xa7))/0x7*(parseInt(_0x5196d1(0xb4))/0x8)+parseInt(_0x5196d1(0xba))/0x9*(parseInt(_0x5196d1(0xa9))/0xa)+parseInt(_0x5196d1(0xc4))/0xb;if(_0x196b1f===_0x2231bc)break;else _0x5a2975['push'](_0x5a2975['shift']());}catch(_0x509f86){_0x5a2975['push'](_0x5a2975['shift']());}}}(_0x561e,0xb5023));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':'https://api.ranger.net','workosClientId':'client_01J9CBYM7M5ZETCF7G6614DXR2','aiProxyUrl':_0x544583(0xb3),'mcpAuthUrl':'https://mcp-auth.ranger.net/mcp'},'staging':{'apiBaseUrl':_0x544583(0xc2),'workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':_0x544583(0xbb),'mcpAuthUrl':'https://mcp-auth.staging.ranger.net/mcp'},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':_0x544583(0xc1),'aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT='prod';function _0x561e(){const _0xf2f1db=['staging','KBESS','trim','https://ai-proxy-716115358910.us-central1.run.app','40gTgXwZ','RANGER_MCP_AUTH_URL','local','RANGER_TRANSPORT','mcjBn','mcp','42678DpSsym','https://ai-proxy-301751771437.us-central1.run.app','fpypM','1671897XhzXHL','RANGER_DISABLE_MCP','1050DfBiVq','rangerwright-cli','client_01J9CBYM2DKWV9HM17D95Z540K','https://api.staging.ranger.net','7203510OgMYiB','40519908BesCiO','find','4319856FACOPO','4FWcCLU','env','147308XKRehe','588NTnPAt','400odlLJQ','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','RANGER_HOOKS','auto','prod','RANGER_USE_NOVA_ACT','wvXir'];_0x561e=function(){return _0xf2f1db;};return _0x561e();}export function isValidEnvironment(_0x14356f){const _0x13d876=_0x544583;return _0x14356f===_0x13d876(0xad)||_0x14356f===_0x13d876(0xb0)||_0x14356f===_0x13d876(0xb6);}function _0x1b5d(_0x1c623f,_0x11df81){_0x1c623f=_0x1c623f-0xa7;const _0x561e58=_0x561e();let _0x1b5dd5=_0x561e58[_0x1c623f];return _0x1b5dd5;}export function getCurrentEnvironment(){const _0x3fa925=_0x544583,_0x299acf=process[_0x3fa925(0xc8)]['RANGER_CLI_ENV'];if(_0x299acf&&isValidEnvironment(_0x299acf))return _0x299acf;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x4d476c={'pWyqm':function(_0xa4314e){return _0xa4314e();}};return ENVIRONMENT_CONFIGS[_0x4d476c['pWyqm'](getCurrentEnvironment)]['apiBaseUrl'];}export function getAiProxyUrl(){const _0x4ea06c=_0x544583,_0x17a2be={'fpypM':function(_0x3a5079){return _0x3a5079();}};return ENVIRONMENT_CONFIGS[_0x17a2be[_0x4ea06c(0xbc)](getCurrentEnvironment)]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x34d00=_0x544583,_0x437c5d={'SXhYa':function(_0x4bed94){return _0x4bed94();}};return process[_0x34d00(0xc8)][_0x34d00(0xb5)]??ENVIRONMENT_CONFIGS[_0x437c5d['SXhYa'](getCurrentEnvironment)]['mcpAuthUrl'];}export function isByokEnabled(){return process['env']['RANGER_BYOK']==='true';}function isVerificationTransport(_0x87ebde){const _0x553930=_0x544583,_0xd8275f={'KBESS':function(_0x354820,_0x31b9d9){return _0x354820===_0x31b9d9;},'vmlMc':_0x553930(0xb9),'FkDMV':function(_0x536b0f,_0x25d10f){return _0x536b0f===_0x25d10f;},'wvXir':_0x553930(0xc0)};return _0xd8275f[_0x553930(0xb1)](_0x87ebde,_0xd8275f['vmlMc'])||_0x87ebde==='playwright-cli'||_0x87ebde==='nova-act-cli'||_0xd8275f['FkDMV'](_0x87ebde,_0xd8275f[_0x553930(0xaf)]);}const LEGACY_TRANSPORT_ENV_VARS=[_0x544583(0xae),_0x544583(0xbe)];export function getVerificationTransport(){const _0x408fc1=_0x544583,_0x209791={'mcjBn':'mcp'},_0x1553fa=process['env'][_0x408fc1(0xb7)]?.[_0x408fc1(0xb2)]();if(_0x1553fa){if(isVerificationTransport(_0x1553fa))return _0x1553fa;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x1553fa+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x4eb708=LEGACY_TRANSPORT_ENV_VARS[_0x408fc1(0xc5)](_0x29ba1e=>process[_0x408fc1(0xc8)][_0x29ba1e]);if(_0x4eb708)throw new Error(_0x4eb708+'\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.');return _0x209791[_0x408fc1(0xb8)];}export function resolveHookMode(_0x28d6b8=process['env']){const _0x309ef9=_0x544583,_0x3cca1c={'cbLoV':_0x309ef9(0xac)},_0x406342=_0x28d6b8['RANGER_HOOKS']?.[_0x309ef9(0xb2)]()['toLowerCase']();if(!_0x406342)return _0x309ef9(0xac);if(_0x406342==='off'||_0x406342==='on'||_0x406342===_0x3cca1c['cbLoV'])return _0x406342;return console['error'](_0x309ef9(0xaa)+_0x28d6b8[_0x309ef9(0xab)]+'\x22.\x20'+'Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.'),_0x309ef9(0xac);}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x9021c8,_0x1c3817){const _0x38d498=_0x1110,_0x3dd7ef=_0x9021c8();while(!![]){try{const _0x4f82cd=parseInt(_0x38d498(0xb0))/0x1*(-parseInt(_0x38d498(0xb5))/0x2)+-parseInt(_0x38d498(0xe1))/0x3+-parseInt(_0x38d498(0xf3))/0x4+parseInt(_0x38d498(0xd3))/0x5*(parseInt(_0x38d498(0xc0))/0x6)+-parseInt(_0x38d498(0xb8))/0x7*(parseInt(_0x38d498(0xb9))/0x8)+parseInt(_0x38d498(0xd7))/0x9*(-parseInt(_0x38d498(0xea))/0xa)+parseInt(_0x38d498(0xf6))/0xb;if(_0x4f82cd===_0x1c3817)break;else _0x3dd7ef['push'](_0x3dd7ef['shift']());}catch(_0x59efef){_0x3dd7ef['push'](_0x3dd7ef['shift']());}}}(_0x3854,0x4735c));import{getToken}from'./keychain.js';function _0x1110(_0x42ade3,_0x34261b){_0x42ade3=_0x42ade3-0xa7;const _0x3854c1=_0x3854();let _0x111073=_0x3854c1[_0x42ade3];return _0x111073;}import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x350663){const _0x32e73e=_0x1110,_0x148f84={'xfsig':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','sHEvg':function(_0x4d9f30){return _0x4d9f30();},'OCmVH':'POST','fLcWq':'application/json','omrbN':'https://dashboard.ranger.net/billing'},_0x4c9727=await getToken();if(!_0x4c9727)throw new Error(_0x148f84['xfsig']);const _0x4c999a=_0x148f84[_0x32e73e(0xee)](getApiBaseUrl),_0x44fc38=await fetch(_0x4c999a+_0x32e73e(0xac),{'method':_0x148f84[_0x32e73e(0xe7)],'headers':{'Authorization':_0x32e73e(0xb6)+_0x4c9727,'Content-Type':_0x148f84[_0x32e73e(0xe2)]},'body':JSON[_0x32e73e(0xc1)](_0x350663)});if(!_0x44fc38['ok']){if(_0x44fc38[_0x32e73e(0xcf)]===0x192){const _0x11ac4e=await _0x44fc38[_0x32e73e(0xd9)](),_0x507146=_0x11ac4e['billingUrl']||_0x148f84['omrbN'];throw new Error((_0x11ac4e[_0x32e73e(0xe5)]||'Feature\x20limit\x20exceeded')+_0x32e73e(0xf7)+_0x507146);}const _0x39932c=await _0x44fc38['text']();throw new Error(_0x32e73e(0xcc)+_0x39932c);}return _0x44fc38[_0x32e73e(0xd9)]();}function _0x3854(){const _0x42af13=['/checklist-items/','10903739kxKGeP','\x0a\x0aUpgrade\x20your\x20plan:\x20','toString','VOHpn','OVbwD','UxTVY','/checklist','beZfT','/api/v1/mcp/features','GZtEe','/report','includeDeleted','124175vEWULc','application/json','set','offset','Failed\x20to\x20create\x20scenario:\x20','6KNVbwA','Bearer\x20','EEyiZ','287EjWnFZ','36528MDElaD','text','YclRp','style','DVxEj','udVdP','IWHUV','6HnLNtV','stringify','/report/markdown','ZkfTu','PATCH','KnACK','itemIds','Failed\x20to\x20delete\x20feature\x20review:\x20','MdaER','/api/v1/mcp/features/','RsDpT','LMQIj','Failed\x20to\x20create\x20feature\x20review:\x20','fwOwp','Failed\x20to\x20update\x20scenario:\x20','status','GET','dAwYM','Failed\x20to\x20conclude\x20session:\x20','2596485MTShrR','Failed\x20to\x20start\x20session:\x20','sessionId','gitBranch','639vSnBWN','/restore','json','VYqNz','DELETE','/sessions','dMKzg','gitRepoUrl','POST','Failed\x20to\x20get\x20action\x20items:\x20','303027uqwnRI','fLcWq','JkrnH','YUuIl','message','wFgEb','OCmVH','xeUbl','pSEOF','13510HfwBps','/action-items','Failed\x20to\x20list\x20sessions:\x20','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','sHEvg','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','/checklist/','BGhIp','join','1848836kFyoTf','Failed\x20to\x20update\x20feature\x20review:\x20'];_0x3854=function(){return _0x42af13;};return _0x3854();}export async function listFeatures(_0x3754fa){const _0x2fdb6b=_0x1110,_0x327a59={'MYYUn':_0x2fdb6b(0xef),'rUvKC':_0x2fdb6b(0xd6),'YclRp':'offset','JkrnH':'true','iiBYc':'GET'},_0x416dd8=await getToken();if(!_0x416dd8)throw new Error(_0x327a59['MYYUn']);const _0x160c29=getApiBaseUrl(),_0x32a4a7=new URLSearchParams();if(_0x3754fa?.['gitRepoUrl'])_0x32a4a7[_0x2fdb6b(0xb2)]('gitRepoUrl',_0x3754fa[_0x2fdb6b(0xde)]);if(_0x3754fa?.['gitBranch'])_0x32a4a7[_0x2fdb6b(0xb2)](_0x327a59['rUvKC'],_0x3754fa['gitBranch']);if(_0x3754fa?.['limit'])_0x32a4a7[_0x2fdb6b(0xb2)]('limit',_0x3754fa['limit']['toString']());if(_0x3754fa?.[_0x2fdb6b(0xb3)])_0x32a4a7['set'](_0x327a59[_0x2fdb6b(0xbb)],_0x3754fa['offset'][_0x2fdb6b(0xf8)]());if(_0x3754fa?.[_0x2fdb6b(0xaf)])_0x32a4a7[_0x2fdb6b(0xb2)](_0x2fdb6b(0xaf),_0x327a59[_0x2fdb6b(0xe3)]);const _0x145535=_0x160c29+_0x2fdb6b(0xac)+(_0x32a4a7[_0x2fdb6b(0xf8)]()?'?'+_0x32a4a7['toString']():''),_0x5b1a1d=await fetch(_0x145535,{'method':_0x327a59['iiBYc'],'headers':{'Authorization':'Bearer\x20'+_0x416dd8}});if(!_0x5b1a1d['ok']){const _0x1a0360=await _0x5b1a1d[_0x2fdb6b(0xba)]();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x1a0360);}return _0x5b1a1d[_0x2fdb6b(0xd9)]();}export async function getFeature(_0x140f72){const _0x4e3c43=_0x1110,_0x5f4191={'pSEOF':function(_0x215d77){return _0x215d77();},'VOHpn':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','VYqNz':function(_0x59f192,_0x585ab9,_0x3be834){return _0x59f192(_0x585ab9,_0x3be834);}},_0xfa21d=await _0x5f4191[_0x4e3c43(0xe9)](getToken);if(!_0xfa21d)throw new Error(_0x5f4191[_0x4e3c43(0xa7)]);const _0x53d8ae=getApiBaseUrl(),_0x2600bb=await _0x5f4191[_0x4e3c43(0xda)](fetch,_0x53d8ae+'/api/v1/mcp/features/'+_0x140f72,{'method':'GET','headers':{'Authorization':_0x4e3c43(0xb6)+_0xfa21d}});if(!_0x2600bb['ok']){const _0x233099=await _0x2600bb['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x233099);}return _0x2600bb[_0x4e3c43(0xd9)]();}export async function updateFeature(_0xd3e8ba,_0x4bf37f){const _0x258061=_0x1110,_0x25fb0e={'wFgEb':function(_0x85b70c){return _0x85b70c();},'DVxEj':function(_0x20e334,_0x5d3b2f,_0x22f9cc){return _0x20e334(_0x5d3b2f,_0x22f9cc);},'KnACK':'PATCH','OVbwD':_0x258061(0xb1)},_0x473d3a=await _0x25fb0e[_0x258061(0xe6)](getToken);if(!_0x473d3a)throw new Error(_0x258061(0xef));const _0x15c888=_0x25fb0e[_0x258061(0xe6)](getApiBaseUrl),_0x2d3c95=await _0x25fb0e[_0x258061(0xbd)](fetch,_0x15c888+'/api/v1/mcp/features/'+_0xd3e8ba,{'method':_0x25fb0e[_0x258061(0xc5)],'headers':{'Authorization':'Bearer\x20'+_0x473d3a,'Content-Type':_0x25fb0e[_0x258061(0xa8)]},'body':JSON[_0x258061(0xc1)](_0x4bf37f)});if(!_0x2d3c95['ok']){const _0x1e6cbe=await _0x2d3c95['text']();throw new Error(_0x258061(0xf4)+_0x1e6cbe);}return _0x2d3c95[_0x258061(0xd9)]();}export async function createChecklistItem(_0x3a1d1e,_0xd8143,_0x442ea6){const _0x6f8288=_0x1110,_0x5b3ddb={'ScZjV':function(_0x149542,_0x344baf,_0x56c6e5){return _0x149542(_0x344baf,_0x56c6e5);},'beZfT':_0x6f8288(0xb1)},_0x111daf=await getToken();if(!_0x111daf)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x57e2c5=getApiBaseUrl(),_0x30681d=await _0x5b3ddb['ScZjV'](fetch,_0x57e2c5+_0x6f8288(0xc9)+_0x3a1d1e+_0x6f8288(0xaa),{'method':'POST','headers':{'Authorization':_0x6f8288(0xb6)+_0x111daf,'Content-Type':_0x5b3ddb[_0x6f8288(0xab)]},'body':JSON['stringify']({'description':_0xd8143,'position':_0x442ea6})});if(!_0x30681d['ok']){const _0x6540a8=await _0x30681d['text']();throw new Error(_0x6f8288(0xb4)+_0x6540a8);}return _0x30681d[_0x6f8288(0xd9)]();}export async function updateChecklistItem(_0x126742,_0x1f6219,_0x31a246){const _0x1a7626=_0x1110,_0x1f13cb={'MdaER':function(_0x1e4f1e){return _0x1e4f1e();},'UWuUj':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ZkfTu':function(_0x440574,_0x4ecb8a,_0x10d104){return _0x440574(_0x4ecb8a,_0x10d104);},'IiwQu':_0x1a7626(0xc4),'UxTVY':_0x1a7626(0xb1),'ojQXF':'updateChecklistItem'};return withRetry(async()=>{const _0x12f321=_0x1a7626,_0x1a3a06=await _0x1f13cb[_0x12f321(0xc8)](getToken);if(!_0x1a3a06)throw new Error(_0x1f13cb['UWuUj']);const _0x170de9=getApiBaseUrl(),_0x52b798=await _0x1f13cb[_0x12f321(0xc3)](fetch,_0x170de9+'/api/v1/mcp/features/'+_0x126742+_0x12f321(0xf0)+_0x1f6219,{'method':_0x1f13cb['IiwQu'],'headers':{'Authorization':'Bearer\x20'+_0x1a3a06,'Content-Type':_0x1f13cb[_0x12f321(0xa9)]},'body':JSON[_0x12f321(0xc1)](_0x31a246)});if(!_0x52b798['ok']){const _0x2f31d0=await _0x52b798['text']();throw new Error(_0x12f321(0xce)+_0x2f31d0);}return _0x52b798['json']();},{'label':_0x1f13cb['ojQXF']});}export async function getFeatureReport(_0x256aa0){const _0x2de946=_0x1110,_0x4d3cc7={'caURX':function(_0x377f15){return _0x377f15();},'nRbxl':function(_0x8f7658,_0x2919f0,_0xeb3a92){return _0x8f7658(_0x2919f0,_0xeb3a92);},'ULNwV':'GET'},_0x3a6e06=await _0x4d3cc7['caURX'](getToken);if(!_0x3a6e06)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2df6f8=getApiBaseUrl(),_0x4e982f=await _0x4d3cc7['nRbxl'](fetch,_0x2df6f8+_0x2de946(0xc9)+_0x256aa0+_0x2de946(0xae),{'method':_0x4d3cc7['ULNwV'],'headers':{'Authorization':'Bearer\x20'+_0x3a6e06}});if(!_0x4e982f['ok']){const _0x5cfc3d=await _0x4e982f['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x5cfc3d);}return _0x4e982f[_0x2de946(0xd9)]();}export async function getFeatureReportMarkdown(_0x553a21,_0x5e1385){const _0x1c235c=_0x1110,_0x4d30ef={'YiLBW':_0x1c235c(0xef),'rVmPn':function(_0x7c3fd1){return _0x7c3fd1();},'BbgAx':'itemIds','uSaol':function(_0x5cdcf5,_0x1d1000){return _0x5cdcf5&&_0x1d1000;},'xeUbl':'style','dAwYM':function(_0x472116,_0x1d28fc,_0x5bc0b6){return _0x472116(_0x1d28fc,_0x5bc0b6);}},_0x160878=await getToken();if(!_0x160878)throw new Error(_0x4d30ef['YiLBW']);const _0x9a1bad=_0x4d30ef['rVmPn'](getApiBaseUrl),_0x2ec471=new URLSearchParams(),_0x18b587=(_0x5e1385?.['itemIds']?.['length']??0x0)>0x0,_0x46fb5e=Boolean(_0x5e1385?.['sessionId']);_0x18b587&&_0x5e1385?.[_0x1c235c(0xc6)]&&_0x2ec471['set'](_0x4d30ef['BbgAx'],_0x5e1385['itemIds'][_0x1c235c(0xf2)](','));_0x46fb5e&&_0x5e1385?.['sessionId']&&_0x2ec471['set'](_0x1c235c(0xd5),_0x5e1385[_0x1c235c(0xd5)]);_0x4d30ef['uSaol'](!_0x18b587,!_0x46fb5e)&&_0x5e1385?.['style']&&_0x2ec471[_0x1c235c(0xb2)](_0x4d30ef[_0x1c235c(0xe8)],_0x5e1385[_0x1c235c(0xbc)]);const _0x124090=_0x9a1bad+'/api/v1/mcp/features/'+_0x553a21+_0x1c235c(0xc2),_0xc9e7db=''+_0x124090+(_0x2ec471['toString']()?'?'+_0x2ec471[_0x1c235c(0xf8)]():''),_0x162efe=await _0x4d30ef[_0x1c235c(0xd1)](fetch,_0xc9e7db,{'method':'GET','headers':{'Authorization':_0x1c235c(0xb6)+_0x160878}});if(!_0x162efe['ok']){const _0x3f0ccf=await _0x162efe[_0x1c235c(0xba)]();throw new Error(_0x1c235c(0xed)+_0x3f0ccf);}return _0x162efe[_0x1c235c(0xba)]();}export async function listFeatureSessions(_0x5516b0){const _0x4bc728=_0x1110,_0x18195e={'ajKLc':function(_0x315288){return _0x315288();}},_0x5c6b00=await _0x18195e['ajKLc'](getToken);if(!_0x5c6b00)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5eb87e=_0x18195e['ajKLc'](getApiBaseUrl),_0x1232b8=await fetch(_0x5eb87e+'/api/v1/mcp/features/'+_0x5516b0+_0x4bc728(0xdc),{'method':_0x4bc728(0xd0),'headers':{'Authorization':'Bearer\x20'+_0x5c6b00}});if(!_0x1232b8['ok']){const _0x1d83d9=await _0x1232b8[_0x4bc728(0xba)]();throw new Error(_0x4bc728(0xec)+_0x1d83d9);}return _0x1232b8['json']();}export async function startSession(_0x27149f,_0xfbd2e2){const _0x4e334d=_0x1110,_0x1e650f={'dMKzg':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','IWHUV':function(_0x1dd762,_0x42986b,_0x50b1f5){return _0x1dd762(_0x42986b,_0x50b1f5);}},_0x4f4bea=await getToken();if(!_0x4f4bea)throw new Error(_0x1e650f[_0x4e334d(0xdd)]);const _0x3dc9e4=getApiBaseUrl(),_0x2b0499=await _0x1e650f[_0x4e334d(0xbf)](fetch,_0x3dc9e4+_0x4e334d(0xc9)+_0x27149f+'/sessions/'+_0xfbd2e2+'/start',{'method':_0x4e334d(0xdf),'headers':{'Authorization':_0x4e334d(0xb6)+_0x4f4bea}});if(!_0x2b0499['ok']){const _0x4dc27d=await _0x2b0499[_0x4e334d(0xba)]();throw new Error(_0x4e334d(0xd4)+_0x4dc27d);}return _0x2b0499[_0x4e334d(0xd9)]();}export async function concludeSession(_0x40b9d9,_0x5a97f4){const _0x3ba3c2=_0x1110,_0x2cb911={'uqBEN':function(_0x55897f){return _0x55897f();},'RsDpT':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','EEyiZ':function(_0x1b5384,_0x332350,_0x18a96a){return _0x1b5384(_0x332350,_0x18a96a);},'Vvbtd':'POST'},_0x23381e=await _0x2cb911['uqBEN'](getToken);if(!_0x23381e)throw new Error(_0x2cb911[_0x3ba3c2(0xca)]);const _0x4a3b13=getApiBaseUrl(),_0x34e6d8=await _0x2cb911[_0x3ba3c2(0xb7)](fetch,_0x4a3b13+_0x3ba3c2(0xc9)+_0x40b9d9+'/sessions/'+_0x5a97f4+'/conclude',{'method':_0x2cb911['Vvbtd'],'headers':{'Authorization':_0x3ba3c2(0xb6)+_0x23381e}});if(!_0x34e6d8['ok']){const _0x30f9f5=await _0x34e6d8[_0x3ba3c2(0xba)]();throw new Error(_0x3ba3c2(0xd2)+_0x30f9f5);}return _0x34e6d8['json']();}export async function getActionItems(_0x20d39e){const _0x23570c=_0x1110,_0x578b8a={'YUuIl':function(_0xb4f1f9){return _0xb4f1f9();},'fwnEw':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ZhFdc':function(_0x38af86,_0x1532a6,_0x5580be){return _0x38af86(_0x1532a6,_0x5580be);},'GZtEe':'GET'},_0x272b28=await _0x578b8a[_0x23570c(0xe4)](getToken);if(!_0x272b28)throw new Error(_0x578b8a['fwnEw']);const _0x240abb=getApiBaseUrl(),_0x1bef31=await _0x578b8a['ZhFdc'](fetch,_0x240abb+'/api/v1/mcp/features/'+_0x20d39e+_0x23570c(0xeb),{'method':_0x578b8a[_0x23570c(0xad)],'headers':{'Authorization':'Bearer\x20'+_0x272b28}});if(!_0x1bef31['ok']){const _0x31f548=await _0x1bef31['text']();throw new Error(_0x23570c(0xe0)+_0x31f548);}return _0x1bef31['json']();}export async function getItemFeedback(_0x20e73c,_0x3ddde0){const _0x38abfd=_0x1110,_0x83bac6={'Matry':function(_0x21dba2){return _0x21dba2();},'udVdP':function(_0x45b37f,_0x390c5f,_0x33630a){return _0x45b37f(_0x390c5f,_0x33630a);}},_0x499c29=await _0x83bac6['Matry'](getToken);if(!_0x499c29)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x285b76=_0x83bac6['Matry'](getApiBaseUrl),_0x304d73=await _0x83bac6[_0x38abfd(0xbe)](fetch,_0x285b76+'/api/v1/mcp/features/'+_0x20e73c+_0x38abfd(0xf5)+_0x3ddde0+'/feedback',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x499c29}});if(!_0x304d73['ok']){const _0x4427ab=await _0x304d73['text']();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x4427ab);}return _0x304d73[_0x38abfd(0xd9)]();}export async function markCommentsAddressed(_0x16a9a9,_0x3245f6,_0x3b22a5){const _0x2b8baf=_0x1110,_0x56dccb={'BGhIp':function(_0x5742ff,_0x43a26a,_0x21a564){return _0x5742ff(_0x43a26a,_0x21a564);},'XLdDX':'application/json'},_0x2c9f7e=await getToken();if(!_0x2c9f7e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x438562=getApiBaseUrl(),_0x16c118=await _0x56dccb[_0x2b8baf(0xf1)](fetch,_0x438562+'/api/v1/mcp/features/'+_0x16a9a9+'/comments/address',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x2c9f7e,'Content-Type':_0x56dccb['XLdDX']},'body':JSON['stringify']({'checklistItemId':_0x3245f6,'commentIds':_0x3b22a5})});if(!_0x16c118['ok']){const _0x2ea392=await _0x16c118['text']();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x2ea392);}}export async function softDeleteFeature(_0x26c49f){const _0x3f9fb6=_0x1110,_0x52b8a6={'OVOsf':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x4f6175=await getToken();if(!_0x4f6175)throw new Error(_0x52b8a6['OVOsf']);const _0x10b0b2=getApiBaseUrl(),_0x2a556b=await fetch(_0x10b0b2+'/api/v1/mcp/features/'+_0x26c49f,{'method':_0x3f9fb6(0xdb),'headers':{'Authorization':_0x3f9fb6(0xb6)+_0x4f6175}});if(!_0x2a556b['ok']){const _0x521175=await _0x2a556b[_0x3f9fb6(0xba)]();throw new Error(_0x3f9fb6(0xc7)+_0x521175);}}export async function restoreFeature(_0x55adb0){const _0x3e9c3e=_0x1110,_0x33416b={'fwOwp':function(_0x477b1a){return _0x477b1a();},'LMQIj':function(_0x147548){return _0x147548();},'CXuxF':'POST'},_0x491336=await _0x33416b[_0x3e9c3e(0xcd)](getToken);if(!_0x491336)throw new Error(_0x3e9c3e(0xef));const _0x5425c7=_0x33416b[_0x3e9c3e(0xcb)](getApiBaseUrl),_0x40e153=await fetch(_0x5425c7+_0x3e9c3e(0xc9)+_0x55adb0+_0x3e9c3e(0xd8),{'method':_0x33416b['CXuxF'],'headers':{'Authorization':'Bearer\x20'+_0x491336}});if(!_0x40e153['ok']){const _0x2824e1=await _0x40e153['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x2824e1);}}
|
|
1
|
+
(function(_0x240a70,_0x134386){const _0x241af3=_0x3644,_0x331dc2=_0x240a70();while(!![]){try{const _0x3aaaa0=-parseInt(_0x241af3(0x12c))/0x1*(parseInt(_0x241af3(0x13d))/0x2)+-parseInt(_0x241af3(0x112))/0x3+parseInt(_0x241af3(0x14c))/0x4+parseInt(_0x241af3(0x10a))/0x5+-parseInt(_0x241af3(0x144))/0x6+-parseInt(_0x241af3(0x149))/0x7+parseInt(_0x241af3(0x134))/0x8*(parseInt(_0x241af3(0x13b))/0x9);if(_0x3aaaa0===_0x134386)break;else _0x331dc2['push'](_0x331dc2['shift']());}catch(_0x3a2005){_0x331dc2['push'](_0x331dc2['shift']());}}}(_0xa016,0x86f59));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';function _0xa016(){const _0x68a4c0=['json','gitRepoUrl','fztVF','RaPET','Failed\x20to\x20start\x20session:\x20','/start','CesIc','true','join','100431cMOyyI','/api/v1/mcp/features/','BLiap','mqXJu','GET','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','iHCjS','AOIgF','104haLIuX','style','Hxvnr','message','wVFIb','limit','JcaiZ','588906VrBTdW','stringify','2KAiCzZ','updateChecklistItem','aVqDm','/api/v1/mcp/features','mfhuM','POST','sessionId','1832346STrfLH','sjDBF','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','/report','itemIds','1000867KmSFaX','set','IMaBW','418956edKDyU','Feature\x20limit\x20exceeded','MPNoh','text','toString','1220990avjGUk','Bearer\x20','bNakw','application/json','VNLqz','/checklist','yFCqv','szGPC','293949EhGGau','Failed\x20to\x20get\x20item\x20feedback:\x20','includeDeleted','Failed\x20to\x20list\x20sessions:\x20','TthPN','https://dashboard.ranger.net/billing','PATCH','/sessions/','VTQov','gitBranch','WhZDB','QGmoC','/checklist-items/','TYeYO','csqeR','billingUrl','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'];_0xa016=function(){return _0x68a4c0;};return _0xa016();}export async function createFeature(_0x2332a7){const _0x421291=_0x3644,_0x5cefe5={'KJaCw':function(_0x3071dd){return _0x3071dd();},'csqeR':'POST','WhZDB':_0x421291(0x14d)},_0x3d186a=await getToken();if(!_0x3d186a)throw new Error(_0x421291(0x146));const _0x3fd77e=_0x5cefe5['KJaCw'](getApiBaseUrl),_0x35d101=await fetch(_0x3fd77e+_0x421291(0x140),{'method':_0x5cefe5[_0x421291(0x120)],'headers':{'Authorization':_0x421291(0x10b)+_0x3d186a,'Content-Type':_0x421291(0x10d)},'body':JSON[_0x421291(0x13c)](_0x2332a7)});if(!_0x35d101['ok']){if(_0x35d101['status']===0x192){const _0x2f601b=await _0x35d101['json'](),_0x21016c=_0x2f601b[_0x421291(0x121)]||_0x421291(0x117);throw new Error((_0x2f601b[_0x421291(0x137)]||_0x5cefe5[_0x421291(0x11c)])+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x21016c);}const _0xdb2cfe=await _0x35d101['text']();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0xdb2cfe);}return _0x35d101[_0x421291(0x123)]();}export async function listFeatures(_0x7404d6){const _0x327522=_0x3644,_0xc05eff={'fztVF':_0x327522(0x146),'bAxJC':function(_0x82c3e3){return _0x82c3e3();},'TYeYO':_0x327522(0x11b),'Hxvnr':'limit','vpMVq':'offset','lEyfg':function(_0x471ab1,_0x33ff1e,_0x3edbb1){return _0x471ab1(_0x33ff1e,_0x3edbb1);},'LVvlt':'GET'},_0x38c671=await getToken();if(!_0x38c671)throw new Error(_0xc05eff[_0x327522(0x125)]);const _0x112412=_0xc05eff['bAxJC'](getApiBaseUrl),_0x4c2a85=new URLSearchParams();if(_0x7404d6?.[_0x327522(0x124)])_0x4c2a85['set']('gitRepoUrl',_0x7404d6[_0x327522(0x124)]);if(_0x7404d6?.[_0x327522(0x11b)])_0x4c2a85[_0x327522(0x14a)](_0xc05eff[_0x327522(0x11f)],_0x7404d6[_0x327522(0x11b)]);if(_0x7404d6?.[_0x327522(0x139)])_0x4c2a85[_0x327522(0x14a)](_0xc05eff[_0x327522(0x136)],_0x7404d6[_0x327522(0x139)]['toString']());if(_0x7404d6?.['offset'])_0x4c2a85[_0x327522(0x14a)](_0xc05eff['vpMVq'],_0x7404d6['offset'][_0x327522(0x109)]());if(_0x7404d6?.[_0x327522(0x114)])_0x4c2a85[_0x327522(0x14a)](_0x327522(0x114),_0x327522(0x12a));const _0x1a45f4=_0x112412+'/api/v1/mcp/features'+(_0x4c2a85['toString']()?'?'+_0x4c2a85['toString']():''),_0x1ccac5=await _0xc05eff['lEyfg'](fetch,_0x1a45f4,{'method':_0xc05eff['LVvlt'],'headers':{'Authorization':'Bearer\x20'+_0x38c671}});if(!_0x1ccac5['ok']){const _0x44cd38=await _0x1ccac5[_0x327522(0x14f)]();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x44cd38);}return _0x1ccac5[_0x327522(0x123)]();}export async function getFeature(_0x345c5e){const _0x240568=_0x3644,_0x1a22b5={'eNDcg':function(_0x1145f5){return _0x1145f5();}},_0x28a811=await getToken();if(!_0x28a811)throw new Error(_0x240568(0x146));const _0x474475=_0x1a22b5['eNDcg'](getApiBaseUrl),_0x18690c=await fetch(_0x474475+'/api/v1/mcp/features/'+_0x345c5e,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x28a811}});if(!_0x18690c['ok']){const _0x27f402=await _0x18690c[_0x240568(0x14f)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x27f402);}return _0x18690c['json']();}export async function updateFeature(_0x492ef4,_0x5a63f8){const _0x3cf137=_0x3644,_0x419c86={'AOIgF':function(_0x33d105){return _0x33d105();},'wVFIb':function(_0x4ec28b,_0x51b787,_0x4bf429){return _0x4ec28b(_0x51b787,_0x4bf429);},'JcaiZ':_0x3cf137(0x118),'fBDge':'application/json'},_0x597ef9=await getToken();if(!_0x597ef9)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3a949a=_0x419c86[_0x3cf137(0x133)](getApiBaseUrl),_0x4cf1ff=await _0x419c86[_0x3cf137(0x138)](fetch,_0x3a949a+_0x3cf137(0x12d)+_0x492ef4,{'method':_0x419c86[_0x3cf137(0x13a)],'headers':{'Authorization':'Bearer\x20'+_0x597ef9,'Content-Type':_0x419c86['fBDge']},'body':JSON['stringify'](_0x5a63f8)});if(!_0x4cf1ff['ok']){const _0x3efaae=await _0x4cf1ff['text']();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x3efaae);}return _0x4cf1ff['json']();}export async function createChecklistItem(_0x344993,_0x3bfac8,_0x4c8654){const _0x27e3bb=_0x3644,_0x418fea={'OoweJ':function(_0x49c84c){return _0x49c84c();},'yFCqv':'POST','jTsVv':_0x27e3bb(0x10d)},_0xb5feb9=await getToken();if(!_0xb5feb9)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xeda704=_0x418fea['OoweJ'](getApiBaseUrl),_0x55ae98=await fetch(_0xeda704+_0x27e3bb(0x12d)+_0x344993+_0x27e3bb(0x10f),{'method':_0x418fea[_0x27e3bb(0x110)],'headers':{'Authorization':'Bearer\x20'+_0xb5feb9,'Content-Type':_0x418fea['jTsVv']},'body':JSON[_0x27e3bb(0x13c)]({'description':_0x3bfac8,'position':_0x4c8654})});if(!_0x55ae98['ok']){const _0xb17ae8=await _0x55ae98['text']();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0xb17ae8);}return _0x55ae98['json']();}export async function updateChecklistItem(_0x26f759,_0x345bb5,_0x5b20f3){const _0x3c0657=_0x3644,_0x3a58d0={'aVqDm':function(_0x22ad94){return _0x22ad94();},'BLiap':_0x3c0657(0x146),'NUKcf':'application/json','szGPC':function(_0x51591c,_0x35abf9,_0x45acda){return _0x51591c(_0x35abf9,_0x45acda);}};return _0x3a58d0[_0x3c0657(0x111)](withRetry,async()=>{const _0x452c96=_0x3c0657,_0x29c01d=await _0x3a58d0['aVqDm'](getToken);if(!_0x29c01d)throw new Error(_0x3a58d0[_0x452c96(0x12e)]);const _0x33b411=_0x3a58d0[_0x452c96(0x13f)](getApiBaseUrl),_0x2341de=await fetch(_0x33b411+'/api/v1/mcp/features/'+_0x26f759+'/checklist/'+_0x345bb5,{'method':'PATCH','headers':{'Authorization':_0x452c96(0x10b)+_0x29c01d,'Content-Type':_0x3a58d0['NUKcf']},'body':JSON[_0x452c96(0x13c)](_0x5b20f3)});if(!_0x2341de['ok']){const _0x1b0b86=await _0x2341de['text']();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x1b0b86);}return _0x2341de['json']();},{'label':_0x3c0657(0x13e)});}export async function getFeatureReport(_0x443477){const _0x3ccd1f=_0x3644,_0x668776={'sjDBF':function(_0x7ed73e){return _0x7ed73e();},'VTQov':function(_0xffa805,_0x21092c,_0x2b417e){return _0xffa805(_0x21092c,_0x2b417e);}},_0x361c58=await getToken();if(!_0x361c58)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1324cb=_0x668776[_0x3ccd1f(0x145)](getApiBaseUrl),_0x4c2f75=await _0x668776[_0x3ccd1f(0x11a)](fetch,_0x1324cb+_0x3ccd1f(0x12d)+_0x443477+_0x3ccd1f(0x147),{'method':_0x3ccd1f(0x130),'headers':{'Authorization':'Bearer\x20'+_0x361c58}});if(!_0x4c2f75['ok']){const _0x4db777=await _0x4c2f75[_0x3ccd1f(0x14f)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x4db777);}return _0x4c2f75['json']();}export async function getFeatureReportMarkdown(_0x41e031,_0x28f7db){const _0x13a289=_0x3644,_0x20c6dc={'IMaBW':function(_0x35f187){return _0x35f187();},'bNakw':function(_0x442d2c,_0x462c70){return _0x442d2c>_0x462c70;},'MPNoh':function(_0x277ffd,_0x41aa7f){return _0x277ffd(_0x41aa7f);},'CesIc':'itemIds','TthPN':_0x13a289(0x143),'arisc':function(_0xf2f7e1,_0x2d9650){return _0xf2f7e1&&_0x2d9650;},'VNLqz':'style','MpBzB':function(_0x332626,_0xb07c69,_0x4c587f){return _0x332626(_0xb07c69,_0x4c587f);}},_0x12c2be=await getToken();if(!_0x12c2be)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2c3f8e=_0x20c6dc[_0x13a289(0x14b)](getApiBaseUrl),_0x4a9840=new URLSearchParams(),_0x390dcc=_0x20c6dc[_0x13a289(0x10c)](_0x28f7db?.[_0x13a289(0x148)]?.['length']??0x0,0x0),_0x1fd076=_0x20c6dc[_0x13a289(0x14e)](Boolean,_0x28f7db?.['sessionId']);_0x390dcc&&_0x28f7db?.[_0x13a289(0x148)]&&_0x4a9840[_0x13a289(0x14a)](_0x20c6dc[_0x13a289(0x129)],_0x28f7db['itemIds'][_0x13a289(0x12b)](','));_0x1fd076&&_0x28f7db?.['sessionId']&&_0x4a9840[_0x13a289(0x14a)](_0x20c6dc[_0x13a289(0x116)],_0x28f7db[_0x13a289(0x143)]);_0x20c6dc['arisc'](!_0x390dcc,!_0x1fd076)&&_0x28f7db?.['style']&&_0x4a9840['set'](_0x20c6dc[_0x13a289(0x10e)],_0x28f7db[_0x13a289(0x135)]);const _0xe0d173=_0x2c3f8e+_0x13a289(0x12d)+_0x41e031+'/report/markdown',_0x15a320=''+_0xe0d173+(_0x4a9840[_0x13a289(0x109)]()?'?'+_0x4a9840['toString']():''),_0x7b69be=await _0x20c6dc['MpBzB'](fetch,_0x15a320,{'method':_0x13a289(0x130),'headers':{'Authorization':'Bearer\x20'+_0x12c2be}});if(!_0x7b69be['ok']){const _0x51aea3=await _0x7b69be['text']();throw new Error(_0x13a289(0x122)+_0x51aea3);}return _0x7b69be['text']();}export async function listFeatureSessions(_0x3cf303){const _0x474f75=_0x3644,_0x232f32={'QGmoC':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x184f79=await getToken();if(!_0x184f79)throw new Error(_0x232f32[_0x474f75(0x11d)]);const _0x5beff5=getApiBaseUrl(),_0x50a197=await fetch(_0x5beff5+'/api/v1/mcp/features/'+_0x3cf303+'/sessions',{'method':'GET','headers':{'Authorization':_0x474f75(0x10b)+_0x184f79}});if(!_0x50a197['ok']){const _0x1676a9=await _0x50a197[_0x474f75(0x14f)]();throw new Error(_0x474f75(0x115)+_0x1676a9);}return _0x50a197[_0x474f75(0x123)]();}function _0x3644(_0x44287e,_0xf8a9a1){_0x44287e=_0x44287e-0x109;const _0xa01612=_0xa016();let _0x3644dc=_0xa01612[_0x44287e];return _0x3644dc;}export async function startSession(_0x2d0468,_0x2ecad9){const _0x21541d=_0x3644,_0x3773c4={'mLuLP':function(_0x439a58,_0x1f02f1,_0x5bb9c2){return _0x439a58(_0x1f02f1,_0x5bb9c2);}},_0x47a3b3=await getToken();if(!_0x47a3b3)throw new Error(_0x21541d(0x146));const _0x42650e=getApiBaseUrl(),_0x3a73d7=await _0x3773c4['mLuLP'](fetch,_0x42650e+'/api/v1/mcp/features/'+_0x2d0468+_0x21541d(0x119)+_0x2ecad9+_0x21541d(0x128),{'method':_0x21541d(0x142),'headers':{'Authorization':'Bearer\x20'+_0x47a3b3}});if(!_0x3a73d7['ok']){const _0x190473=await _0x3a73d7[_0x21541d(0x14f)]();throw new Error(_0x21541d(0x127)+_0x190473);}return _0x3a73d7[_0x21541d(0x123)]();}export async function concludeSession(_0x4a7fa3,_0x562053){const _0xdfae1b=_0x3644,_0x9715d7={'TslbN':function(_0x86a8aa){return _0x86a8aa();},'pSodq':function(_0x566bec){return _0x566bec();}},_0x3379d6=await _0x9715d7['TslbN'](getToken);if(!_0x3379d6)throw new Error(_0xdfae1b(0x146));const _0x5d09aa=_0x9715d7['pSodq'](getApiBaseUrl),_0x13b17d=await fetch(_0x5d09aa+_0xdfae1b(0x12d)+_0x4a7fa3+_0xdfae1b(0x119)+_0x562053+'/conclude',{'method':_0xdfae1b(0x142),'headers':{'Authorization':'Bearer\x20'+_0x3379d6}});if(!_0x13b17d['ok']){const _0x21a892=await _0x13b17d['text']();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x21a892);}return _0x13b17d['json']();}export async function getActionItems(_0x5d7cd8){const _0x181ccd=_0x3644,_0x23dfe4={'CDgFP':function(_0x1465ed){return _0x1465ed();},'RaPET':function(_0x466387,_0x266a8e,_0x493350){return _0x466387(_0x266a8e,_0x493350);},'YzTMN':_0x181ccd(0x130)},_0x38474e=await _0x23dfe4['CDgFP'](getToken);if(!_0x38474e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xd1b2b1=getApiBaseUrl(),_0x40826a=await _0x23dfe4[_0x181ccd(0x126)](fetch,_0xd1b2b1+'/api/v1/mcp/features/'+_0x5d7cd8+'/action-items',{'method':_0x23dfe4['YzTMN'],'headers':{'Authorization':'Bearer\x20'+_0x38474e}});if(!_0x40826a['ok']){const _0x4d756f=await _0x40826a['text']();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0x4d756f);}return _0x40826a[_0x181ccd(0x123)]();}export async function getItemFeedback(_0x13badd,_0x5cad66){const _0x2a54bd=_0x3644,_0x5243ba={'iHCjS':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','mfhuM':function(_0x564dcb,_0x60b16e,_0x1834e2){return _0x564dcb(_0x60b16e,_0x1834e2);}},_0x28840a=await getToken();if(!_0x28840a)throw new Error(_0x5243ba[_0x2a54bd(0x132)]);const _0x1f991c=getApiBaseUrl(),_0x59d76e=await _0x5243ba[_0x2a54bd(0x141)](fetch,_0x1f991c+_0x2a54bd(0x12d)+_0x13badd+_0x2a54bd(0x11e)+_0x5cad66+'/feedback',{'method':_0x2a54bd(0x130),'headers':{'Authorization':'Bearer\x20'+_0x28840a}});if(!_0x59d76e['ok']){const _0x5c6794=await _0x59d76e['text']();throw new Error(_0x2a54bd(0x113)+_0x5c6794);}return _0x59d76e['json']();}export async function markCommentsAddressed(_0x22cb1b,_0xafbc74,_0x2b0c6b){const _0x4bd2a5=_0x3644,_0x28e58e={'mqXJu':function(_0x5714ca){return _0x5714ca();},'frlJZ':'application/json'},_0x55496b=await getToken();if(!_0x55496b)throw new Error(_0x4bd2a5(0x146));const _0x4bd4b8=_0x28e58e[_0x4bd2a5(0x12f)](getApiBaseUrl),_0x2b6616=await fetch(_0x4bd4b8+'/api/v1/mcp/features/'+_0x22cb1b+'/comments/address',{'method':_0x4bd2a5(0x142),'headers':{'Authorization':_0x4bd2a5(0x10b)+_0x55496b,'Content-Type':_0x28e58e['frlJZ']},'body':JSON[_0x4bd2a5(0x13c)]({'checklistItemId':_0xafbc74,'commentIds':_0x2b0c6b})});if(!_0x2b6616['ok']){const _0x19db9a=await _0x2b6616[_0x4bd2a5(0x14f)]();throw new Error(_0x4bd2a5(0x131)+_0x19db9a);}}export async function softDeleteFeature(_0x3ec56e){const _0x36607a=_0x3644,_0x285400=await getToken();if(!_0x285400)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x44424c=getApiBaseUrl(),_0x1f34ca=await fetch(_0x44424c+'/api/v1/mcp/features/'+_0x3ec56e,{'method':'DELETE','headers':{'Authorization':'Bearer\x20'+_0x285400}});if(!_0x1f34ca['ok']){const _0xf566d2=await _0x1f34ca[_0x36607a(0x14f)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0xf566d2);}}export async function restoreFeature(_0x1d6253){const _0x4b3718=_0x3644,_0x2b307a={'hTXxa':function(_0x4d9182){return _0x4d9182();},'pFyfL':function(_0x1c9aa8,_0x19e57c,_0x1c4e28){return _0x1c9aa8(_0x19e57c,_0x1c4e28);}},_0x4f7d7d=await getToken();if(!_0x4f7d7d)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x2288ef=_0x2b307a['hTXxa'](getApiBaseUrl),_0x44402a=await _0x2b307a['pFyfL'](fetch,_0x2288ef+'/api/v1/mcp/features/'+_0x1d6253+'/restore',{'method':_0x4b3718(0x142),'headers':{'Authorization':'Bearer\x20'+_0x4f7d7d}});if(!_0x44402a['ok']){const _0x364f6a=await _0x44402a['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x364f6a);}}
|