@ranger-testing/ranger-cli 3.1.6-alpha.aca5f9c-53 → 3.1.7-alpha.62f152a-54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +1 -1
- package/build/commands/addEnv.js +1 -1
- package/build/commands/authEncrypt.js +1 -1
- package/build/commands/clean.js +1 -1
- package/build/commands/config.js +1 -1
- package/build/commands/deleteProfile.js +1 -1
- package/build/commands/env.js +1 -1
- package/build/commands/feature.js +1 -1
- package/build/commands/hook.js +1 -1
- package/build/commands/hooks/autoPrompt.js +1 -1
- package/build/commands/hooks/disable.js +1 -1
- package/build/commands/hooks/enable.js +1 -1
- package/build/commands/hooks/exitPlanMode.js +1 -1
- package/build/commands/hooks/index.js +1 -1
- package/build/commands/hooks/output.js +1 -1
- package/build/commands/hooks/planReminder.js +1 -1
- package/build/commands/hooks/planStart.js +1 -1
- package/build/commands/hooks/postEdit.js +1 -1
- package/build/commands/hooks/preCompact.js +1 -1
- package/build/commands/hooks/sessionEnd.js +1 -1
- package/build/commands/hooks/sessionStart.js +1 -1
- package/build/commands/hooks/stopHook.js +1 -1
- package/build/commands/index.js +1 -1
- package/build/commands/login.js +1 -1
- package/build/commands/mcpBootstrap.js +1 -1
- package/build/commands/migrateProfile.js +1 -1
- package/build/commands/setup/claude.js +1 -1
- package/build/commands/setup/opencode.js +1 -1
- package/build/commands/setupCi.js +1 -1
- package/build/commands/skillup.js +1 -1
- package/build/commands/start.js +1 -1
- package/build/commands/status.js +1 -1
- package/build/commands/update.js +1 -1
- package/build/commands/updateEnv.js +1 -1
- package/build/commands/useEnv.js +1 -1
- package/build/commands/utils/activeProfile.js +1 -1
- package/build/commands/utils/agentEnv.js +1 -1
- package/build/commands/utils/browserSessionsApi.js +1 -1
- package/build/commands/utils/claudeConfig.js +1 -1
- package/build/commands/utils/claudeOverrideSettings.js +1 -1
- package/build/commands/utils/claudePlugin.js +1 -1
- package/build/commands/utils/cloudProfile.js +1 -1
- package/build/commands/utils/cloudProfileSession.js +1 -1
- package/build/commands/utils/crypto.js +1 -1
- package/build/commands/utils/desirePathLog.js +1 -1
- package/build/commands/utils/deviceAuth.js +1 -1
- package/build/commands/utils/environment.js +1 -1
- package/build/commands/utils/featureApi.js +1 -1
- package/build/commands/utils/fixWebmDuration.js +1 -1
- package/build/commands/utils/gitTracked.js +1 -1
- package/build/commands/utils/keychain.js +1 -1
- package/build/commands/utils/legacyWarning.js +1 -1
- package/build/commands/utils/localAgentInstallationsApi.js +1 -1
- package/build/commands/utils/matchAuthEnvironment.js +1 -1
- package/build/commands/utils/mcpImageBase64.js +1 -1
- package/build/commands/utils/model.js +1 -1
- package/build/commands/utils/novaActCli.js +1 -1
- package/build/commands/utils/opencodeConfig.js +1 -1
- package/build/commands/utils/organizationEnvApi.js +1 -1
- package/build/commands/utils/playwrightCli.js +1 -1
- package/build/commands/utils/profileMessages.js +1 -1
- package/build/commands/utils/profileSetupBanner.js +1 -1
- package/build/commands/utils/projectsConfig.js +1 -1
- package/build/commands/utils/rangerConfig.js +1 -1
- package/build/commands/utils/rangerRoot.js +1 -1
- package/build/commands/utils/rangerwrightCli.js +1 -1
- package/build/commands/utils/resolveProfileContext.js +1 -1
- package/build/commands/utils/resolveProfileUrl.js +1 -1
- package/build/commands/utils/retry.js +1 -1
- package/build/commands/utils/scenarioOriginCheck.js +1 -1
- package/build/commands/utils/sessionCache.js +1 -1
- package/build/commands/utils/settings.js +1 -1
- package/build/commands/utils/skillContent.js +1 -1
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/stitchWebmFiles.js +1 -1
- package/build/commands/utils/telemetry.js +1 -1
- package/build/commands/utils/tokenRefresh.js +1 -1
- package/build/commands/utils/traceSnapshotMapper.js +1 -1
- package/build/commands/utils/tunnelClient.js +1 -1
- package/build/commands/utils/userApi.js +1 -1
- package/build/commands/utils/version.js +1 -1
- package/build/commands/verifyFeature.js +1 -1
- package/build/commands/verifyFeatureCli.js +1 -1
- package/build/commands/verifyFeatureNovaCli.js +1 -1
- package/build/commands/verifyFeatureRangerwrightCli.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x5559ee=_0xa37e;(function(_0x5d200d,_0x24cc73){const _0x530bca=_0xa37e,_0x3bc326=_0x5d200d();while(!![]){try{const _0x338cf7=parseInt(_0x530bca(0x12c))/0x1*(parseInt(_0x530bca(0x182))/0x2)+-parseInt(_0x530bca(0xf0))/0x3+parseInt(_0x530bca(0x166))/0x4*(-parseInt(_0x530bca(0x10e))/0x5)+-parseInt(_0x530bca(0x184))/0x6+-parseInt(_0x530bca(0x175))/0x7*(-parseInt(_0x530bca(0x16b))/0x8)+-parseInt(_0x530bca(0x130))/0x9*(parseInt(_0x530bca(0x181))/0xa)+parseInt(_0x530bca(0x16d))/0xb;if(_0x338cf7===_0x24cc73)break;else _0x3bc326['push'](_0x3bc326['shift']());}catch(_0x5db4be){_0x3bc326['push'](_0x3bc326['shift']());}}}(_0x58f3,0xaa7ce));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x1bca08 from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isBareLocalhost,isCachedSessionLive,isInteractive,needsTunnel,orderLoginDomains,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x1bce2f){const _0x4116ce=_0xa37e,_0x5a303c={'jDgQq':'invalid-url'};try{return new URL(_0x1bce2f)['host'];}catch{return _0x5a303c[_0x4116ce(0x1a2)];}}function errorMessageForTelemetry(_0x6f7619){const _0x4292e7=_0xa37e;return _0x6f7619 instanceof Error?_0x6f7619[_0x4292e7(0x187)]:undefined;}function trackBridgeEvent(_0x3368a6,_0x3e914d){const _0x8c5cb0=_0xa37e,_0xf7db55={'urFBf':function(_0x427679,_0x25c360){return _0x427679===_0x25c360;},'qRFpR':'local_ws_error'};if(!_0x3368a6)return;const _0x45175d={'tunnelSessionId':_0x3e914d['sessionId'],'tunnelEventType':_0x3e914d['type'],'connectionId':_0x3e914d[_0x8c5cb0(0xde)],'code':_0x3e914d['code'],'reason':_0x3e914d['reason'],'error':_0x3e914d[_0x8c5cb0(0x11a)],'elapsedMs':_0x3e914d['elapsedMs'],'activeLocalConnections':_0x3e914d[_0x8c5cb0(0x197)],'pendingLocalConnections':_0x3e914d[_0x8c5cb0(0x167)]};_0x3368a6['trackPhaseEnd']('tunnel_bridge_event',_0x45175d),(_0x3e914d['type']===_0x8c5cb0(0x13c)||_0xf7db55[_0x8c5cb0(0x19c)](_0x3e914d[_0x8c5cb0(0x133)],_0xf7db55[_0x8c5cb0(0x153)]))&&void _0x3368a6['trackPhaseError'](_0x8c5cb0(0x1a1),new Error(_0x3e914d['error']??_0x3e914d[_0x8c5cb0(0x133)]),_0x45175d);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x1a8cfd=_0xa37e,_0x3133c1={'cbVGT':_0x1a8cfd(0xec)},_0x296e77=await getToken();if(!_0x296e77)throw new Error(_0x3133c1['cbVGT']);return _0x296e77;}async function apiRequest(_0x1053e7,_0xb30e8={}){const _0x226df7=_0xa37e,_0x6c0ee2={'opgFC':function(_0x384637){return _0x384637();},'INCAC':function(_0x45a2b8,_0x429042,_0x109b99){return _0x45a2b8(_0x429042,_0x109b99);},'vAIOF':function(_0x4b6a06,_0x1c80e8){return _0x4b6a06===_0x1c80e8;},'xNaiu':_0x226df7(0x198),'qjxyi':function(_0x2acbfa,_0x379af3){return _0x2acbfa===_0x379af3;},'BAVbq':function(_0xc5ca34,_0x3b0127){return _0xc5ca34===_0x3b0127;}},_0x3936b3=await _0x6c0ee2['opgFC'](requireToken),_0x5aa1c5=_0x6c0ee2[_0x226df7(0x100)](getApiBaseUrl),_0x55e1b9=await _0x6c0ee2['INCAC'](fetch,''+_0x5aa1c5+_0x1053e7,{..._0xb30e8,'headers':{'Authorization':'Bearer\x20'+_0x3936b3,'Content-Type':_0x226df7(0xe2),..._0xb30e8[_0x226df7(0x154)]??{}}});if(!_0x55e1b9['ok']){let _0x60e17='',_0xefd817;try{const _0x2c67e5=await _0x55e1b9[_0x226df7(0xfe)](),_0x51548b=(_0x6c0ee2[_0x226df7(0x190)](typeof _0x2c67e5['error'],_0x6c0ee2['xNaiu'])?_0x2c67e5['error']:undefined)??JSON['stringify'](_0x2c67e5);_0x60e17=_0x51548b;_0x6c0ee2[_0x226df7(0x183)](typeof _0x2c67e5[_0x226df7(0xfd)],_0x6c0ee2[_0x226df7(0x146)])&&_0x2c67e5['test_output']&&(_0x60e17=_0x60e17+'\x0a'+_0x2c67e5[_0x226df7(0xfd)]);if(_0x6c0ee2['BAVbq'](typeof _0x2c67e5['code'],_0x226df7(0x198)))_0xefd817=_0x2c67e5['code'];}catch{_0x60e17=_0x55e1b9[_0x226df7(0x15d)];}throw new ApiError(_0x226df7(0xe1)+_0x1053e7+'\x20failed\x20('+_0x55e1b9[_0x226df7(0x189)]+'):\x20'+_0x60e17,_0x55e1b9['status'],_0x60e17,_0xefd817);}if(_0x55e1b9['status']===0xcc)return undefined;return _0x55e1b9['json']();}export class ApiError extends Error{['status'];['detail'];[_0x5559ee(0x134)];constructor(_0x18b078,_0x5a33fd,_0xc9cd97,_0x3fb5fd){const _0x4f5476=_0x5559ee,_0x3791a9={'pRnJJ':'2|0|1|4|3'},_0x31ce1=_0x3791a9['pRnJJ'][_0x4f5476(0x160)]('|');let _0xf92c1=0x0;while(!![]){switch(_0x31ce1[_0xf92c1++]){case'0':this[_0x4f5476(0x189)]=_0x5a33fd;continue;case'1':this[_0x4f5476(0x12b)]=_0xc9cd97;continue;case'2':super(_0x18b078);continue;case'3':this[_0x4f5476(0xf5)]='ApiError';continue;case'4':this['code']=_0x3fb5fd;continue;}break;}}}export async function fetchCloudProfile(_0xfa4160){const _0x170e89=_0x5559ee,_0x4dfdac={'sNAfs':function(_0x552909,_0x111e89){return _0x552909(_0x111e89);},'jKahi':function(_0x42487c,_0x18946e){return _0x42487c(_0x18946e);},'ptboS':function(_0x40d048,_0x59d964){return _0x40d048 instanceof _0x59d964;},'VHCKH':function(_0x6b9b3e,_0x36a713){return _0x6b9b3e===_0x36a713;}};try{return await _0x4dfdac['sNAfs'](apiRequest,_0x170e89(0x18a)+_0x4dfdac['jKahi'](encodeURIComponent,_0xfa4160));}catch(_0x364632){if(_0x4dfdac['ptboS'](_0x364632,ApiError)&&_0x4dfdac['VHCKH'](_0x364632[_0x170e89(0x189)],0x194))return null;throw _0x364632;}}export async function listCloudProfiles(){const _0xf927d9=_0x5559ee,_0x35e0fc={'ZKiMR':function(_0x2d207a,_0x36e031){return _0x2d207a(_0x36e031);}},_0x3d3260=await _0x35e0fc['ZKiMR'](apiRequest,_0xf927d9(0x180));return _0x3d3260['profiles'];}export async function deleteCloudProfile(_0x1fe563){const _0x453d14=_0x5559ee,_0x492844={'CWUKI':function(_0x60f24f,_0x3db467){return _0x60f24f(_0x3db467);},'JOeGo':function(_0x11e94c,_0x3ccd61){return _0x11e94c instanceof _0x3ccd61;}};try{await apiRequest(_0x453d14(0x18a)+_0x492844[_0x453d14(0x172)](encodeURIComponent,_0x1fe563),{'method':_0x453d14(0x104)});}catch(_0x32db0c){if(_0x492844[_0x453d14(0xfa)](_0x32db0c,ApiError)&&_0x32db0c[_0x453d14(0x189)]===0x194)throw new Error(_0x453d14(0x17e)+_0x1fe563+'\x22\x20not\x20found.');throw _0x32db0c;}}export async function createCloudProfile(_0x12c1f7,_0xcfc95a,_0x3403bd={}){const _0x20774f=_0x5559ee,_0x52c57e={'pdXJs':function(_0x293d8a,_0x49ff22,_0x120941){return _0x293d8a(_0x49ff22,_0x120941);},'zcJFi':'POST'},_0x48b381={'name':_0x12c1f7};if(_0xcfc95a)_0x48b381['environment_key']=_0xcfc95a;_0x3403bd['settings']&&Object[_0x20774f(0xee)](_0x3403bd[_0x20774f(0x16a)])[_0x20774f(0x129)]>0x0&&(_0x48b381['settings']=_0x3403bd[_0x20774f(0x16a)]);if(_0x3403bd[_0x20774f(0x137)])_0x48b381['username']=_0x3403bd['username'];if(_0x3403bd[_0x20774f(0x17d)])_0x48b381[_0x20774f(0x17d)]=_0x3403bd['password'];return await _0x52c57e['pdXJs'](apiRequest,_0x20774f(0x180),{'method':_0x52c57e['zcJFi'],'body':JSON['stringify'](_0x48b381)});}export async function uploadCloudProfileSession(_0x22a258,_0x4e9a6e){const _0x330f84=_0x5559ee,_0x10a34f={'fzuUw':_0x330f84(0x152)};return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x22a258)+_0x330f84(0xf8),{'method':_0x10a34f['fzuUw'],'body':JSON[_0x330f84(0x148)]({'session_state':_0x4e9a6e})});}export async function saveCloudProfileCredentials(_0x44790a,_0x43cf60,_0x4293e5){const _0x4cd9b4=_0x5559ee,_0x4e3181={'HyLoo':function(_0x49ce71,_0x48ba35){return _0x49ce71(_0x48ba35);}};await apiRequest(_0x4cd9b4(0x18a)+_0x4e3181[_0x4cd9b4(0x12f)](encodeURIComponent,_0x44790a),{'method':'PUT','body':JSON['stringify']({'username':_0x43cf60,'password':_0x4293e5})});}export async function fetchAuthConfig(){const _0x364eff=_0x5559ee,_0x4d5193={'ofPME':function(_0x28ae50,_0xf95a0d){return _0x28ae50(_0xf95a0d);},'WEJAS':_0x364eff(0x115),'RWrrs':function(_0x377ca9,_0x1cdb40){return _0x377ca9 instanceof _0x1cdb40;}};try{const _0x4c2bef=await _0x4d5193['ofPME'](apiRequest,_0x4d5193[_0x364eff(0x17f)]);return _0x4c2bef[_0x364eff(0x19f)];}catch(_0xae01b5){return _0x4d5193['RWrrs'](_0xae01b5,ApiError)&&_0xae01b5['status']!==0x194&&console[_0x364eff(0x11a)](_0x364eff(0x19e)+_0xae01b5[_0x364eff(0x187)]),null;}}function _0x58f3(){const _0x3cf68b=[');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','detail','1210937dLqxHp','organizationId','trackPhaseEnd','HyLoo','9EOCGCF','setupHeaders','rSMRg','type','code','xdcZL','trackPhaseStart','username','HFVHF','PjxSb','env','newPage','tunnel_error','No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','ueMiw','pBlqI','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>`.','ZamGh','prompt','EXeuU','tunnel_login_request','xNaiu','goto','stringify','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','sQwrT','\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)','loginInstructions','storageStatePath','domains','qHKbE','targetUrl','\x22\x20for\x20','POST','qRFpR','headers','\x22,\x20and\x20cloud\x20sessions\x20don\x27t\x20apply\x20to\x20localhost.\x0a','\x20\x20Cloud\x20profile\x20\x22','RANGER_TEST_USERNAME','close','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','ZopbW','smewc','environments','statusText','Puukj','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','split','\x20\x20Login\x20successful.\x20Session\x20cached.','pw_endpoint','XAsxS','force','\x20\x20forceLogin\x20enabled\x20for\x20\x22','1239940DScTKw','pendingLocalConnections','beSYF','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','settings','56lcyFiM','Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20(','17586184pfzrbp','sPLEo','zePGR','clientIp','tunnel','CWUKI','mDmWg','ANbhs','174013oKoWAP','\x20\x20•\x20or\x20pass\x20--env\x20<key>\x20to\x20run\x20an\x20automated\x20login\x20for\x20this\x20target.','RANGER_TUNNEL_LOGIN_HEADED','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','KcrvR','defaultEnvironmentKey','WxIaN','sessionId','password','Cloud\x20profile\x20\x22','WEJAS','/api/v1/profiles','3346630qBvKLt','2doNThf','qjxyi','4344678gCOkxJ','utf-8','tunnelUrl','message','environmentKey','status','/api/v1/profiles/','replace','uioKG','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','tunnel_login_setup','success','vAIOF','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a','RANGER_TEST_PASSWORD','LdbgX','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','CaGdn','activeLocalConnections','string','not_configured','\x20\x20Cached\x20session\x20for\x20\x22','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','urFBf','telemetry','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','auth_config','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','tunnel_bridge','jDgQq','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','raw','connectionId','persistSessionState','Gdxcc','API\x20request\x20','application/json','kphaU','tunnel_login_cleanup','cli:manual-login','XSgff','toLowerCase','vkecR','Bqozt','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','\x20\x20Server-side\x20login\x20error:\x20','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','newContext','keys','1|2|4|3|0','1819890XtWbFI','wAJvN','\x20--url\x20','isArray','IehaO','name','\x20\x20Created\x20cloud\x20profile\x20\x22','\x20\x20Cloud\x20session\x20for\x20\x22','/session','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','JOeGo','HzCvy','\x22.\x0a','test_output','json','Auth\x20environment\x20\x22','opgFC','\x20\x20No\x20live\x20session\x20for\x20\x22','No\x20saved\x20session\x20for\x20\x22','vFIdR','DELETE','mjBGa','\x22;\x20proceeding\x20with\x20loginInstructions.','vxUCF','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','/api/v1/tunnel/sessions','gRfat','ambiguous','zbuNS','assertedEnv','10afDxNI','session_state','PKAKV','forceLogin','push','sessionCheckPath','TEEgV','/api/v1/profiles/auth-config','\x20(auth\x20env:\x20','join','log','OZJjE','error','some','launch','toISOString','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','invalidateOn','PtHqW','userAgent','OHpNp','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','catch','ulzPT','pwEndpoint','trim','origin','length'];_0x58f3=function(){return _0x3cf68b;};return _0x58f3();}async function createTunnelSession(_0x5d993d){const _0x17adfa=_0x5559ee,_0x11f004={'Teqrz':_0x17adfa(0x109),'uioKG':'agent'};return await apiRequest(_0x11f004['Teqrz'],{'method':_0x17adfa(0x152),'body':JSON['stringify']({'targetUrl':_0x5d993d,'mode':_0x11f004[_0x17adfa(0x18c)]})});}async function deleteTunnelSession(_0x271610){const _0x457044=_0x5559ee;await apiRequest('/api/v1/tunnel/sessions/'+_0x271610,{'method':_0x457044(0x104)});}export function pickAdHocEnvKey(_0x55171d,_0x3e4cda,_0x26d5a4){const _0x22db04=_0x5559ee,_0x46a957={'LdbgX':function(_0x3a2ce4,_0x1440b2){return _0x3a2ce4+_0x1440b2;},'HFVHF':function(_0x19b63f,_0xabbb85,_0x16b673){return _0x19b63f(_0xabbb85,_0x16b673);},'XSgff':function(_0x39dd18,_0x306416,_0x3fdd03){return _0x39dd18(_0x306416,_0x3fdd03);},'ZopbW':function(_0x1d8dc6,_0x56be80){return _0x1d8dc6 in _0x56be80;},'vxUCF':_0x22db04(0x10b),'fVJtS':function(_0x278651,_0x213561){return _0x278651(_0x213561);},'saCgY':function(_0x53a464,_0x277349){return _0x53a464+_0x277349;},'Bqozt':function(_0x5c6df3,_0x884d85){return _0x5c6df3+_0x884d85;},'TEEgV':function(_0x25951e,_0x575913){return _0x25951e===_0x575913;},'ESjkS':function(_0xfeefd0,_0x1741e0){return _0xfeefd0===_0x1741e0;}};if(_0x26d5a4){if(!_0x55171d?.[_0x22db04(0x15c)]?.[_0x26d5a4]){const _0x37911b=Object['keys'](_0x55171d?.[_0x22db04(0x15c)]??{});throw new Error(_0x46a957[_0x22db04(0x194)](_0x22db04(0xff)+_0x26d5a4+_0x22db04(0x123),_0x37911b[_0x22db04(0x129)]?'\x20Available:\x20'+_0x37911b[_0x22db04(0x117)](',\x20')+'.':'\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.')+_0x22db04(0x14b));}return _0x26d5a4;}if(!_0x55171d)return null;if(_0x3e4cda){const _0x5a300f=_0x46a957[_0x22db04(0x138)](matchAuthEnvironmentExact,_0x3e4cda,_0x55171d);if(_0x5a300f)return _0x5a300f;const _0x12dc1e=_0x46a957[_0x22db04(0xe6)](matchAuthEnvironmentByHost,_0x3e4cda,_0x55171d);if(_0x12dc1e&&'key'in _0x12dc1e)return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x12dc1e['key']+'\x22\x20matched\x20by\x20host\x20for\x20'+_0x3e4cda+'\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).'),_0x12dc1e['key'];if(_0x12dc1e&&_0x46a957[_0x22db04(0x15a)](_0x46a957[_0x22db04(0x107)],_0x12dc1e))throw new Error(_0x22db04(0x108)+_0x12dc1e[_0x22db04(0x10b)]['join'](',\x20')+_0x22db04(0x12a));if(_0x46a957['fVJtS'](needsTunnel,_0x3e4cda))throw new Error(_0x46a957['LdbgX'](_0x46a957['saCgY'](_0x46a957[_0x22db04(0xe9)](_0x22db04(0x13d)+_0x3e4cda+_0x22db04(0xfc)+'\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a'+'\x20\x20Options:\x0a',_0x22db04(0x192)),'\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x3e4cda[_0x22db04(0x18b)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),'\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20'+_0x3e4cda+'\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.'));}if(_0x55171d['defaultEnvironmentKey'])return _0x55171d[_0x22db04(0x17a)];const _0x5bb8f8=Object['keys'](_0x55171d[_0x22db04(0x15c)]??{});if(_0x46a957[_0x22db04(0x114)](_0x5bb8f8['length'],0x1))return _0x5bb8f8[0x0];if(_0x46a957['ESjkS'](_0x5bb8f8[_0x22db04(0x129)],0x0))return null;throw new Error(_0x22db04(0x16c)+_0x5bb8f8['join'](',\x20')+').\x20'+_0x22db04(0x141));}export function adHocProfileName(_0xa812b4,_0x15ace7,_0x404505){const _0x3eed7e={'ztQKr':function(_0x58be4b,_0x357e78){return _0x58be4b===_0x357e78;}};if(!_0x15ace7||_0x3eed7e['ztQKr'](_0x15ace7,_0x404505))return _0xa812b4;return _0xa812b4+':'+_0x15ace7;}export async function resolveAdHocProfile(_0x10bbd8={},_0x225132=process[_0x5559ee(0x13a)]){const _0x64d92d=_0x5559ee,_0x323641={'mjBGa':function(_0x5bfa6f,_0x2d5d8e,_0x5354f7,_0x538558){return _0x5bfa6f(_0x2d5d8e,_0x5354f7,_0x538558);},'KWaqL':function(_0x32040f,_0x3d31a5){return _0x32040f&&_0x3d31a5;},'qHKbE':function(_0x579f11,_0x57c30e){return _0x579f11!==_0x57c30e;},'FIRov':'none'},_0x554c52=_0x225132[_0x64d92d(0x157)];if(!_0x554c52)return null;const _0x65daed=await fetchAuthConfig(),_0x5025ce=pickAdHocEnvKey(_0x65daed,_0x10bbd8['targetUrl'],_0x10bbd8['envKey']);let _0x5154bd=_0x323641[_0x64d92d(0x105)](adHocProfileName,_0x554c52,_0x5025ce,_0x65daed?.[_0x64d92d(0x17a)]),_0x5bec82=await fetchCloudProfile(_0x5154bd);_0x323641['KWaqL'](_0x5bec82,_0x5025ce)&&_0x323641[_0x64d92d(0x14f)](_0x5bec82[_0x64d92d(0x188)],_0x5025ce)&&(console[_0x64d92d(0x118)](_0x64d92d(0x156)+_0x5154bd+_0x64d92d(0x169)+(_0x5bec82['environmentKey']??_0x323641['FIRov'])+_0x64d92d(0xea)+_0x5025ce+'\x22;\x20using\x20\x22'+_0x554c52+':'+_0x5025ce+'\x22\x20instead.'),_0x5154bd=_0x554c52+':'+_0x5025ce,_0x5bec82=await fetchCloudProfile(_0x5154bd));if(_0x5bec82)return{'name':_0x5bec82['name'],'profile':_0x5bec82};const _0x35596e=_0x225132[_0x64d92d(0x193)],_0x1d1f14=await createCloudProfile(_0x5154bd,_0x5025ce??undefined,{'username':_0x554c52,'password':_0x35596e});return console['log'](_0x64d92d(0xf6)+_0x1d1f14[_0x64d92d(0xf5)]+_0x64d92d(0x151)+_0x554c52+(_0x5025ce?_0x64d92d(0x116)+_0x5025ce+')':'')),{'name':_0x1d1f14['name'],'profile':_0x1d1f14};}export async function writeSessionToLocalCache(_0x2d7ece,_0x2ff446,_0x2b9a7d,_0x3215e6,_0xc538dd,_0x21ad3a,_0x1406e8){const _0x26073d=_0x5559ee,_0x3a2ec3={'wikWL':function(_0x2c4ed7,_0x17585f,_0x4254d3){return _0x2c4ed7(_0x17585f,_0x4254d3);},'CaGdn':function(_0x4a1be6){return _0x4a1be6();},'smewc':'auth','WxIaN':function(_0x65eded,_0x3a714f){return _0x65eded>_0x3a714f;},'sTkqO':function(_0x271896,_0x1325a1,_0x192e21){return _0x271896(_0x1325a1,_0x192e21);}},_0xd05117=sessionCacheHash({'orgId':_0x2ff446,'profileName':_0x2d7ece,'effectiveBaseUrl':_0x2b9a7d,'setupHeaders':_0x3215e6,'invalidateOn':_0x1406e8?.['invalidateOn'],'userAgent':_0x1406e8?.['userAgent'],'clientIp':_0x1406e8?.['clientIp']}),_0x1e9518=_0x3a2ec3['wikWL'](getSessionCachePath,_0xd05117,_0x2d7ece),_0x95a1b3=join(_0x3a2ec3[_0x26073d(0x196)](getRangerHomeDir),_0x3a2ec3[_0x26073d(0x15b)]);!existsSync(_0x95a1b3)&&await mkdir(_0x95a1b3,{'recursive':!![]});const _0x163561={..._0xc538dd};_0x21ad3a&&_0x3a2ec3[_0x26073d(0x17b)](_0x21ad3a[_0x26073d(0x129)],0x0)&&Array[_0x26073d(0xf3)](_0x163561['cookies'])&&(_0x163561['cookies']=_0x3a2ec3['sTkqO'](duplicateCookiesForDomains,_0x163561['cookies'],_0x21ad3a));const _0x125ba2={'cached_at':new Date()[_0x26073d(0x11d)](),'session_state':_0x163561};await writeFile(_0x1e9518,JSON['stringify'](_0x125ba2,null,0x2));const _0x571599=getStorageStatePath(_0x1e9518);return await writeFile(_0x571599,JSON[_0x26073d(0x148)](_0x163561,null,0x2)),_0x571599;}export async function checkLocalCache(_0x5b8d86,_0x3ebb1d,_0x119e76,_0x23c23c,_0x23666f){const _0x220560=_0x5559ee,_0xd1c576={'KHgGl':function(_0x2f1038,_0x2377e6){return _0x2f1038(_0x2377e6);},'fucXS':function(_0x5c831b,_0x4f741e){return _0x5c831b(_0x4f741e);},'HzCvy':function(_0x55b17b,_0x374fb9,_0xe46aeb){return _0x55b17b(_0x374fb9,_0xe46aeb);}},_0x4d2131=_0xd1c576['KHgGl'](sessionCacheHash,{'orgId':_0x3ebb1d,'profileName':_0x5b8d86,'effectiveBaseUrl':_0x119e76,'setupHeaders':_0x23c23c,'invalidateOn':_0x23666f?.[_0x220560(0x11f)],'userAgent':_0x23666f?.['userAgent'],'clientIp':_0x23666f?.[_0x220560(0x170)]}),_0xef29e8=getSessionCachePath(_0x4d2131,_0x5b8d86),_0x498b42=getStorageStatePath(_0xef29e8);if(!existsSync(_0xef29e8)||!_0xd1c576['fucXS'](existsSync,_0x498b42))return null;try{const _0x3f1f1d=await _0xd1c576[_0x220560(0xfb)](readFile,_0xef29e8,_0x220560(0x185));return JSON['parse'](_0x3f1f1d),{'storageStatePath':_0x498b42};}catch{return null;}}function launchRealBrowser(){const _0x35a1f3=_0x5559ee;return chromium[_0x35a1f3(0x11c)]({'headless':!![]});}function emitSessionValidationHint(_0xef48d,_0x571ba9){const _0x5b5db1=_0x5559ee,_0x33981f={'kphaU':function(_0x2c4376,_0x480de7){return _0x2c4376===_0x480de7;},'zePGR':function(_0x194f0f,_0x5484c2){return _0x194f0f+_0x5484c2;}};if(!_0x571ba9||!_0x571ba9['domains']?.[_0x5b5db1(0x129)])return;let _0x1adc56;try{_0x1adc56=new URL(_0xef48d);}catch{return;}const _0x349f27=[];for(const _0x428eea of _0x571ba9[_0x5b5db1(0x14e)]){try{_0x349f27[_0x5b5db1(0x112)]({'raw':_0x428eea,'url':new URL(_0x428eea)});}catch{}}if(_0x33981f[_0x5b5db1(0xe3)](_0x349f27[_0x5b5db1(0x129)],0x0))return;if(_0x349f27[_0x5b5db1(0x11b)](_0x4dc7cd=>_0x4dc7cd['url'][_0x5b5db1(0x128)]===_0x1adc56[_0x5b5db1(0x128)]))return;const _0x4c37b6=_0x349f27['map'](_0x23b4d5=>'\x22'+_0x23b4d5[_0x5b5db1(0xdd)]+'\x22')[_0x5b5db1(0x117)](',\x20');console[_0x5b5db1(0x118)](_0x33981f[_0x5b5db1(0x16f)](_0x5b5db1(0x195)+_0x4c37b6+';\x20'+('you\x27re\x20now\x20at\x20\x22'+_0xef48d+_0x5b5db1(0x178)),'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.'));}export async function serverSideLogin(_0x50da25,_0x51878c){const _0x2d50ea=_0x5559ee,_0x8d217a={'RAdyq':function(_0x2116e7,_0x3abdda){return _0x2116e7 instanceof _0x3abdda;},'Vbjce':function(_0x5e1cf6,_0x587b59){return _0x5e1cf6===_0x587b59;}},_0x2c8ed5=process['env'][_0x2d50ea(0x157)],_0x585f34=process[_0x2d50ea(0x13a)]['RANGER_TEST_PASSWORD'],_0xfeff5a={};if(_0x2c8ed5)_0xfeff5a[_0x2d50ea(0x137)]=_0x2c8ed5;if(_0x585f34)_0xfeff5a[_0x2d50ea(0x17d)]=_0x585f34;if(_0x51878c?.['force'])_0xfeff5a[_0x2d50ea(0x164)]=!![];if(_0x51878c?.['targetUrl'])_0xfeff5a['target_url']=_0x51878c[_0x2d50ea(0x150)];if(_0x51878c?.['env'])_0xfeff5a['env']=_0x51878c['env'];_0x51878c?.[_0x2d50ea(0x171)]&&(_0xfeff5a['tunnel_session_id']=_0x51878c[_0x2d50ea(0x171)]['sessionId'],_0xfeff5a[_0x2d50ea(0x162)]=_0x51878c['tunnel']['pwEndpoint']);try{return await apiRequest(_0x2d50ea(0x18a)+encodeURIComponent(_0x50da25)+'/login',{'method':'POST','body':JSON['stringify'](_0xfeff5a)});}catch(_0x4d8341){if(_0x8d217a['RAdyq'](_0x4d8341,ApiError)&&_0x8d217a['Vbjce'](_0x4d8341['status'],0x190)&&_0x4d8341[_0x2d50ea(0x134)]===_0x2d50ea(0x199))return{'status':_0x2d50ea(0x199),'error':_0x4d8341[_0x2d50ea(0x12b)]};throw _0x4d8341;}}async function serverSideLoginWithOptionalTunnel(_0x190e70,_0x1ea45c,_0x50fbe7={}){const _0x25cfa5=_0x5559ee,_0x367bb3={'QauNC':function(_0x2e5462,_0x30e26f){return _0x2e5462(_0x30e26f);},'ueMiw':function(_0xc8466f,_0x468407){return _0xc8466f(_0x468407);},'rSMRg':function(_0x4d1961,_0x52f706){return _0x4d1961(_0x52f706);},'KcrvR':_0x25cfa5(0x13e),'beSYF':'tunnel_login_setup','XAsxS':_0x25cfa5(0x145),'IehaO':function(_0x4cb43b,_0x5ec8b3){return _0x4cb43b??_0x5ec8b3;},'OZJjE':function(_0x48bbd5,_0x30bf7c){return _0x48bbd5||_0x30bf7c;},'mDmWg':_0x25cfa5(0xef),'vFIdR':function(_0x3c50e0,_0x41f15f){return _0x3c50e0(_0x41f15f);}};if(!_0x367bb3[_0x25cfa5(0x13f)](needsTunnel,_0x1ea45c))return await serverSideLogin(_0x190e70,{'force':_0x50fbe7['force'],'env':_0x50fbe7[_0x25cfa5(0x13a)]});let _0x44e7dc=null,_0x5cc2da=null,_0x5e9f00=null,_0x118709=null,_0x5bf4e0=![];const _0x3cfc1a=process['env'][_0x25cfa5(0x177)]?.[_0x25cfa5(0xe7)](),_0x3ac0d2=_0x3cfc1a==='1'||_0x3cfc1a==='true',_0x401a80={'profileName':_0x190e70,'targetUrlHost':targetHostForTelemetry(_0x1ea45c),'tunnelRequired':!![],'forceLogin':_0x367bb3[_0x25cfa5(0x132)](Boolean,_0x50fbe7['force']),'localBrowserServerHeaded':_0x3ac0d2};try{_0x50fbe7['telemetry']?.[_0x25cfa5(0x136)](_0x25cfa5(0x18e),_0x401a80);_0x3ac0d2&&console['log'](_0x367bb3[_0x25cfa5(0x179)]);_0x44e7dc=await launchBrowserServer({'headless':!_0x3ac0d2}),_0x5cc2da=await createTunnelSession(_0x1ea45c);const _0x1cf270=await requireToken();_0x5e9f00=await _0x367bb3['rSMRg'](createTunnelBridge,{'localWsUrl':_0x44e7dc['wsEndpoint'],'tunnelServerUrl':_0x5cc2da[_0x25cfa5(0x186)],'sessionId':_0x5cc2da[_0x25cfa5(0x17c)],'apiKey':_0x1cf270,'onError':_0x21da8b=>{_0x118709=_0x21da8b;},'onClose':()=>{const _0x421ad4=_0x25cfa5;_0x118709??=new Error(_0x421ad4(0x1a0)+_0x190e70);},'onEvent':_0x3ad3fb=>trackBridgeEvent(_0x50fbe7['telemetry'],_0x3ad3fb)}),_0x50fbe7[_0x25cfa5(0x19d)]?.[_0x25cfa5(0x12e)](_0x367bb3[_0x25cfa5(0x168)],{..._0x401a80,'tunnelSessionId':_0x5cc2da[_0x25cfa5(0x17c)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x3ac0d2}),_0x5bf4e0=!![];try{return _0x50fbe7['telemetry']?.[_0x25cfa5(0x136)](_0x367bb3[_0x25cfa5(0x163)],{..._0x401a80,'tunnelSessionId':_0x5cc2da[_0x25cfa5(0x17c)]}),await serverSideLogin(_0x190e70,{'force':_0x50fbe7[_0x25cfa5(0x164)],'targetUrl':_0x1ea45c,'env':_0x50fbe7[_0x25cfa5(0x13a)],'tunnel':{'sessionId':_0x5cc2da[_0x25cfa5(0x17c)],'pwEndpoint':_0x5cc2da[_0x25cfa5(0x126)]}})['then'](_0x514575=>{const _0x524eb5=_0x25cfa5;return _0x50fbe7[_0x524eb5(0x19d)]?.['trackPhaseEnd'](_0x524eb5(0x145),{..._0x401a80,'tunnelSessionId':_0x5cc2da?.[_0x524eb5(0x17c)],'loginStatus':_0x514575['status'],'hasSessionState':Boolean(_0x514575['session_state']),'hasTestOutput':Boolean(_0x514575['test_output']),'bridgeError':_0x367bb3['QauNC'](errorMessageForTelemetry,_0x118709)}),_0x514575;});}catch(_0x53980d){await _0x50fbe7[_0x25cfa5(0x19d)]?.['trackPhaseError'](_0x367bb3[_0x25cfa5(0x163)],_0x367bb3[_0x25cfa5(0xf4)](_0x118709,_0x53980d),{..._0x401a80,'tunnelSessionId':_0x5cc2da['sessionId'],'bridgeError':errorMessageForTelemetry(_0x118709)});throw _0x118709??_0x53980d;}}catch(_0x59227e){!_0x5bf4e0&&await _0x50fbe7[_0x25cfa5(0x19d)]?.['trackPhaseError'](_0x367bb3[_0x25cfa5(0x168)],_0x59227e,{..._0x401a80,'tunnelSessionId':_0x5cc2da?.['sessionId']});throw _0x59227e;}finally{if(_0x367bb3[_0x25cfa5(0x119)](_0x5cc2da,_0x44e7dc)||_0x5e9f00){const _0x27309a=_0x367bb3[_0x25cfa5(0x173)]['split']('|');let _0x303dff=0x0;while(!![]){switch(_0x27309a[_0x303dff++]){case'0':_0x50fbe7['telemetry']?.['trackPhaseEnd'](_0x25cfa5(0xe4),{..._0x401a80,'tunnelSessionId':_0x5cc2da?.[_0x25cfa5(0x17c)]});continue;case'1':_0x50fbe7['telemetry']?.[_0x25cfa5(0x136)]('tunnel_login_cleanup',{..._0x401a80,'tunnelSessionId':_0x5cc2da?.['sessionId']});continue;case'2':_0x5e9f00?.[_0x25cfa5(0x158)]();continue;case'3':_0x5cc2da&&await _0x367bb3[_0x25cfa5(0x103)](deleteTunnelSession,_0x5cc2da['sessionId'])[_0x25cfa5(0x124)](()=>{});continue;case'4':_0x44e7dc&&await _0x44e7dc['close']()[_0x25cfa5(0x124)](()=>{});continue;}break;}}}}function _0xa37e(_0x14b89c,_0x5e5394){_0x14b89c=_0x14b89c-0xdc;const _0x58f312=_0x58f3();let _0xa37e27=_0x58f312[_0x14b89c];return _0xa37e27;}export async function manualBrowserLogin(_0x21fc7a,_0x50dff2,_0x10f291={}){const _0x1f752f=_0x5559ee,_0x5cd8dd={'PKAKV':function(_0x4fd2a8,_0x16610a){return _0x4fd2a8(_0x16610a);},'OHpNp':function(_0x196ffa,_0x539d9b,_0x4be43d){return _0x196ffa(_0x539d9b,_0x4be43d);},'vkecR':function(_0x22e1c7,_0x411113){return _0x22e1c7+_0x411113;},'ltEsv':'about:blank','Gdxcc':'\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','Ugflz':_0x1f752f(0x149),'PjxSb':'Browser\x20login\x20timed\x20out\x20before\x20completion.','GMcta':'POST','PtHqW':_0x1f752f(0xe5)};if(!isInteractive())throw new Error(_0x5cd8dd[_0x1f752f(0xe8)](_0x5cd8dd['vkecR']('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x21fc7a[_0x1f752f(0xf5)]+_0x1f752f(0xfc),'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20'),_0x1f752f(0xf9)));const _0xd2fd86=_0x50dff2&&_0x50dff2[_0x1f752f(0x14e)]['length']>0x0?_0x50dff2[_0x1f752f(0x14e)][0x0]:_0x5cd8dd['ltEsv'];console['log'](_0x5cd8dd[_0x1f752f(0xe0)]),console['log'](_0x5cd8dd['Ugflz']),await new Promise(_0x50194a=>setTimeout(_0x50194a,0x7d0));const _0xe6b897=await chromium['launch']({'headless':![]});let _0x48cc24=null;try{const _0xd0f4dc={'ignoreHTTPSErrors':!![]};_0x50dff2?.['setupHeaders']&&(_0xd0f4dc['extraHTTPHeaders']=_0x50dff2['setupHeaders']);const _0x2cdeb1=await _0xe6b897[_0x1f752f(0xed)](_0xd0f4dc);await addProfileSetupBanner(_0x2cdeb1);const _0x319016=await _0x2cdeb1[_0x1f752f(0x13b)]();await _0x319016[_0x1f752f(0x147)](_0xd2fd86);let _0x3084b9=![];await new Promise(_0x4085a9=>{const _0x377ebf={'gRfat':function(_0x491d19,_0x4e2f37){const _0x3f8e2e=_0xa37e;return _0x5cd8dd[_0x3f8e2e(0x110)](_0x491d19,_0x4e2f37);}},_0x3e9e51=_0x5cd8dd['OHpNp'](setTimeout,()=>{const _0xb48c68=_0xa37e;_0x3084b9=!![],console['error']('Browser\x20login\x20timed\x20out\x20after\x20'+MANUAL_LOGIN_TIMEOUT_MS/0xea60+_0xb48c68(0x11e)),_0x4085a9();},MANUAL_LOGIN_TIMEOUT_MS);_0x319016['on']('close',async()=>{const _0x1dc1a9=_0xa37e;_0x377ebf[_0x1dc1a9(0x10a)](clearTimeout,_0x3e9e51);try{const _0x22f904=await _0x2cdeb1['storageState']();_0x48cc24=_0x22f904;}catch{}_0x4085a9();});});if(_0x3084b9&&!_0x48cc24)throw new Error(_0x5cd8dd[_0x1f752f(0x139)]);}finally{await _0xe6b897['close']()[_0x1f752f(0x124)](()=>{});}if(!_0x48cc24)throw new Error('Browser\x20closed\x20before\x20authentication\x20was\x20saved.');return _0x10f291[_0x1f752f(0xdf)]!==![]&&await _0x5cd8dd[_0x1f752f(0x122)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x21fc7a['name'])+_0x1f752f(0xf8),{'method':_0x5cd8dd['GMcta'],'body':JSON['stringify']({'session_state':_0x48cc24,'updated_by':_0x5cd8dd[_0x1f752f(0x120)]})}),{'sessionState':_0x48cc24};}export async function promptSaveCredentials(_0x408fa9){const _0x47d7e5=_0x5559ee,_0x365c2b={'yaRfW':function(_0x261332,_0x2a4730){return _0x261332||_0x2a4730;},'sQwrT':'confirm','PLQuB':_0x47d7e5(0xdc),'BkHOH':function(_0xae8abe,_0x100e8d,_0xbbde92){return _0xae8abe(_0x100e8d,_0xbbde92);}},_0x42bdd2=process[_0x47d7e5(0x13a)][_0x47d7e5(0x157)],_0xfa5470=process[_0x47d7e5(0x13a)]['RANGER_TEST_PASSWORD'];if(_0x365c2b['yaRfW'](!_0x42bdd2,!_0xfa5470))return;if(!isInteractive())return;const {save:_0x2cf52a}=await _0x1bca08[_0x47d7e5(0x143)]([{'type':_0x365c2b[_0x47d7e5(0x14a)],'name':'save','message':_0x365c2b['PLQuB'],'default':![]}]);if(!_0x2cf52a)return;await _0x365c2b['BkHOH'](apiRequest,_0x47d7e5(0x18a)+encodeURIComponent(_0x408fa9),{'method':'PUT','body':JSON['stringify']({'username':_0x42bdd2,'password':_0xfa5470})}),console['log'](_0x47d7e5(0x18d));}export async function resolveCloudProfileSession(_0x23042f,_0x6e9bb0={}){const _0x505300=_0x5559ee,_0x571b87={'kzoQY':function(_0x44bbcb,_0x1fc708){return _0x44bbcb===_0x1fc708;},'Puukj':'string','ZamGh':function(_0x5785c5,_0x5089d2){return _0x5785c5===_0x5089d2;},'ulzPT':function(_0x12a0fd,_0xc47f3c){return _0x12a0fd(_0xc47f3c);},'xdcZL':function(_0x1eebf9,_0x2b7497,_0x5a2f5d,_0x20156d,_0x192f95,_0x4e0a46){return _0x1eebf9(_0x2b7497,_0x5a2f5d,_0x20156d,_0x192f95,_0x4e0a46);},'LPEnT':function(_0x44df95,_0x3f63aa,_0xf418bf,_0x3b603b,_0x390385){return _0x44df95(_0x3f63aa,_0xf418bf,_0x3b603b,_0x390385);},'WJYfr':function(_0x55cbbc,_0x13b18d,_0x8ee172){return _0x55cbbc(_0x13b18d,_0x8ee172);},'wAJvN':function(_0x1cf751,_0x2275a3,_0x466386,_0x244feb,_0x4d90bc,_0x12849e,_0x18ff78,_0x339b53){return _0x1cf751(_0x2275a3,_0x466386,_0x244feb,_0x4d90bc,_0x12849e,_0x18ff78,_0x339b53);},'weFxq':function(_0x1e8354,_0x6351bc,_0x2f94e2){return _0x1e8354(_0x6351bc,_0x2f94e2);},'pNitv':function(_0x292f1d,_0x5264f3){return _0x292f1d(_0x5264f3);},'pBlqI':function(_0x110e2d,_0x5cece2){return _0x110e2d(_0x5cece2);},'cbZpr':function(_0x4066ec,_0x303d08){return _0x4066ec||_0x303d08;},'CBUXf':function(_0x2731f8,_0x3a2c45){return _0x2731f8||_0x3a2c45;},'zbuNS':function(_0x306770,_0x3a10c9){return _0x306770===_0x3a10c9;},'EXeuU':_0x505300(0x18f),'CHvOA':function(_0x1072dd,_0x36c02b){return _0x1072dd&&_0x36c02b;},'jpilV':_0x505300(0x159),'mOfem':function(_0x2aeefd,_0x522d80){return _0x2aeefd instanceof _0x522d80;},'fHrPt':function(_0x15a12a,_0x3b4b5c){return _0x15a12a(_0x3b4b5c);},'ySnUj':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','ANbhs':function(_0x2146b6,_0x4e2d5c){return _0x2146b6+_0x4e2d5c;},'sPLEo':_0x505300(0x176),'Aobuk':function(_0xb03823,_0x11c566,_0x499494){return _0xb03823(_0x11c566,_0x499494);}},_0x50d572=_0x23042f[_0x505300(0x16a)]??{},_0x10a005=await fetchAuthConfig(),_0x554a6d=_0x10a005?resolveAuthEnvironmentLocally(_0x10a005,_0x6e9bb0['assertedEnv']??_0x23042f['environmentKey']):null,_0x524412=_0x571b87['kzoQY'](typeof _0x554a6d?.['loginInstructions'],_0x571b87[_0x505300(0x15e)])&&_0x554a6d[_0x505300(0x14c)][_0x505300(0x127)]()?_0x554a6d['loginInstructions']:undefined,_0x20ec8a=_0x571b87[_0x505300(0x142)](typeof _0x50d572['loginInstructions'],_0x571b87['Puukj'])&&_0x50d572[_0x505300(0x14c)][_0x505300(0x127)]()?_0x50d572['loginInstructions']:undefined,_0x62cbb7=_0x20ec8a||!_0x524412?_0x50d572:{..._0x50d572,'loginInstructions':_0x524412},_0x55e1f9=_0x571b87['ulzPT'](Boolean,_0x62cbb7['loginInstructions']?.['trim']()),_0x45b924=Boolean(_0x50d572[_0x505300(0x111)]||_0x554a6d?.[_0x505300(0x111)]),_0x5e4f26=_0x554a6d?.['domains'],_0x545c3a=_0x50d572['setupHeaders'],_0x3b4d79=_0x545c3a??_0x554a6d?.[_0x505300(0x131)],_0x372252=_0x6e9bb0['effectiveBaseUrl']??_0x50d572['baseUrl']??(_0x5e4f26&&_0x5e4f26['length']>0x0?_0x5e4f26[0x0]:''),_0x1f6d93=_0x372252?needsTunnel(_0x372252):![],_0xd8c048={'invalidateOn':_0x554a6d?.[_0x505300(0x11f)],'userAgent':_0x554a6d?.['browserOptions']?.[_0x505300(0x121)]??_0x50d572[_0x505300(0x121)]};_0x45b924&&console[_0x505300(0x118)](_0x505300(0x165)+_0x23042f[_0x505300(0xf5)]+'\x22,\x20refreshing\x20session...');if(!_0x45b924){const _0x9fb2ed=await _0x571b87[_0x505300(0x135)](checkLocalCache,_0x23042f[_0x505300(0xf5)],_0x23042f['organizationId'],_0x372252,_0x3b4d79,_0xd8c048);if(_0x9fb2ed){if(_0x372252&&!_0x1f6d93){const _0x2f1676=await _0x571b87['LPEnT'](isCachedSessionLive,_0x9fb2ed[_0x505300(0x14d)],_0x372252,{'sessionCheckPath':_0x554a6d?.[_0x505300(0x113)],'setupHeaders':_0x3b4d79},{'launchBrowser':launchRealBrowser});if(_0x2f1676)return console['log'](_0x505300(0x191)+_0x23042f['name']+'\x22'),{'authPath':_0x9fb2ed[_0x505300(0x14d)],'settings':_0x62cbb7,'resolvedEnv':_0x554a6d};console[_0x505300(0x118)](_0x505300(0x19a)+_0x23042f[_0x505300(0xf5)]+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x571b87['WJYfr'](emitSessionValidationHint,_0x372252,_0x554a6d);}else return _0x1f6d93&&console[_0x505300(0x118)]('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x23042f['name']+'\x22'),{'authPath':_0x9fb2ed[_0x505300(0x14d)],'settings':_0x62cbb7,'resolvedEnv':_0x554a6d};}}if(!_0x45b924&&_0x23042f['sessionState']){const _0x577927=await _0x571b87['wAJvN'](writeSessionToLocalCache,_0x23042f['name'],_0x23042f['organizationId'],_0x372252,_0x3b4d79,_0x23042f['sessionState'],_0x5e4f26,_0xd8c048);if(_0x372252){const _0x211792=await isCachedSessionLive(_0x577927,_0x372252,{'sessionCheckPath':_0x554a6d?.['sessionCheckPath'],'setupHeaders':_0x3b4d79},{'launchBrowser':launchRealBrowser});if(_0x211792)return console['log'](_0x505300(0x19b)+_0x23042f['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x577927,'settings':_0x62cbb7,'resolvedEnv':_0x554a6d};console['log'](_0x505300(0xf7)+_0x23042f[_0x505300(0xf5)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x571b87['weFxq'](emitSessionValidationHint,_0x372252,_0x554a6d);}else return{'authPath':_0x577927,'settings':_0x62cbb7,'resolvedEnv':_0x554a6d};}if(_0x55e1f9)return console['log'](_0x505300(0x101)+_0x23042f[_0x505300(0xf5)]+_0x505300(0x106)),{'authPath':undefined,'settings':_0x62cbb7,'resolvedEnv':_0x554a6d};console['log']('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x23042f['name']+'\x22,\x20attempting\x20login...');const _0x10c63c=_0x571b87['ulzPT'](Boolean,process['env'][_0x505300(0x157)])&&_0x571b87['pNitv'](Boolean,process['env'][_0x505300(0x193)]),_0x262f8a=_0x571b87['pNitv'](Boolean,_0x23042f['username']),_0x4c7d68=_0x571b87[_0x505300(0x140)](Boolean,_0x6e9bb0[_0x505300(0x10d)]),_0x533df7=_0x372252?isBareLocalhost(_0x372252):![],_0x1b8fb7=_0x571b87['cbZpr'](_0x10c63c,_0x262f8a)&&_0x571b87['CBUXf'](!_0x533df7,_0x4c7d68);if(_0x1b8fb7)try{const _0x40435d=_0x372252?await serverSideLoginWithOptionalTunnel(_0x23042f['name'],_0x372252,{'force':_0x45b924,'telemetry':_0x6e9bb0['telemetry'],'env':_0x6e9bb0['assertedEnv']}):await serverSideLogin(_0x23042f[_0x505300(0xf5)],{'force':_0x45b924,'env':_0x6e9bb0['assertedEnv']});if(_0x571b87[_0x505300(0x10c)](_0x40435d['status'],_0x505300(0x199)))console[_0x505300(0x118)](_0x505300(0x15f));else{if(_0x40435d[_0x505300(0x189)]===_0x571b87[_0x505300(0x144)]&&_0x40435d[_0x505300(0x10f)]){console[_0x505300(0x118)](_0x505300(0x161));const _0x3fce47=await writeSessionToLocalCache(_0x23042f['name'],_0x23042f[_0x505300(0x12d)],_0x372252,_0x3b4d79,_0x40435d[_0x505300(0x10f)],_0x5e4f26,_0xd8c048);return _0x571b87['CHvOA'](_0x10c63c,!_0x262f8a)&&await _0x571b87[_0x505300(0x125)](promptSaveCredentials,_0x23042f[_0x505300(0xf5)]),{'authPath':_0x3fce47,'settings':_0x62cbb7,'resolvedEnv':_0x554a6d};}else _0x40435d['test_output']&&(console[_0x505300(0x118)](_0x571b87['jpilV']),console[_0x505300(0x118)](_0x40435d[_0x505300(0xfd)])),console['log']('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}}catch(_0x49a5e7){console['log'](_0x505300(0xeb)+(_0x571b87['mOfem'](_0x49a5e7,Error)?_0x49a5e7['message']:_0x571b87['fHrPt'](String,_0x49a5e7))),console[_0x505300(0x118)](_0x571b87['ySnUj']);}if(_0x571b87['CHvOA'](_0x533df7,!_0x4c7d68)&&!isInteractive())throw new Error(_0x571b87[_0x505300(0x174)](_0x505300(0x102)+_0x372252+'\x22\x20on\x20profile\x20\x22'+_0x23042f['name']+_0x505300(0x155)+('\x20\x20•\x20capture\x20one\x20(a\x20browser\x20opens):\x20ranger\x20profile\x20add\x20'+_0x23042f['name']+_0x505300(0xf2)+_0x372252+'\x0a'),_0x571b87[_0x505300(0x16e)]));const _0x447e11=_0x554a6d?{..._0x554a6d,'domains':_0x571b87['Aobuk'](orderLoginDomains,_0x372252,_0x554a6d[_0x505300(0x14e)]),'setupHeaders':_0x3b4d79}:_0x372252?{'key':_0x23042f[_0x505300(0x188)]??'','domains':[_0x372252],'setupHeaders':_0x3b4d79}:null,{sessionState:_0xa2a6e}=await manualBrowserLogin(_0x23042f,_0x447e11,{'persistSessionState':!_0x1f6d93}),_0x355755=await _0x571b87[_0x505300(0xf1)](writeSessionToLocalCache,_0x23042f['name'],_0x23042f['organizationId'],_0x372252,_0x3b4d79,_0xa2a6e,_0x5e4f26,_0xd8c048);return{'authPath':_0x355755,'settings':_0x62cbb7,'resolvedEnv':_0x554a6d};}
|
|
1
|
+
const _0x128150=_0x58e3;(function(_0x4b43ea,_0x1e53b7){const _0x2a0f63=_0x58e3,_0x54f78c=_0x4b43ea();while(!![]){try{const _0x4dd997=-parseInt(_0x2a0f63(0x1db))/0x1+parseInt(_0x2a0f63(0x203))/0x2*(-parseInt(_0x2a0f63(0x1eb))/0x3)+parseInt(_0x2a0f63(0x1cb))/0x4+-parseInt(_0x2a0f63(0x21e))/0x5*(parseInt(_0x2a0f63(0x160))/0x6)+-parseInt(_0x2a0f63(0x1a7))/0x7*(-parseInt(_0x2a0f63(0x210))/0x8)+parseInt(_0x2a0f63(0x175))/0x9*(parseInt(_0x2a0f63(0x1ba))/0xa)+-parseInt(_0x2a0f63(0x1b5))/0xb*(-parseInt(_0x2a0f63(0x1de))/0xc);if(_0x4dd997===_0x1e53b7)break;else _0x54f78c['push'](_0x54f78c['shift']());}catch(_0x150dbf){_0x54f78c['push'](_0x54f78c['shift']());}}}(_0xbd30,0xacb26));function _0x58e3(_0x567f99,_0x1ef247){_0x567f99=_0x567f99-0x15f;const _0xbd3090=_0xbd30();let _0x58e3f2=_0xbd3090[_0x567f99];return _0x58e3f2;}import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x329f71 from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isBareLocalhost,isCachedSessionLive,isInteractive,needsTunnel,orderLoginDomains,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x41440b){const _0x3ef00e=_0x58e3,_0x4db349={'inXPV':_0x3ef00e(0x165)};try{return new URL(_0x41440b)[_0x3ef00e(0x221)];}catch{return _0x4db349[_0x3ef00e(0x1e7)];}}function errorMessageForTelemetry(_0x3ddd32){const _0xe88ed9=_0x58e3;return _0x3ddd32 instanceof Error?_0x3ddd32[_0xe88ed9(0x167)]:undefined;}function trackBridgeEvent(_0x27a57b,_0x531b82){const _0x2df7fd=_0x58e3,_0x59b5d8={'YZoZS':'tunnel_bridge_event','Rzhvy':function(_0x38a1a8,_0x5431ee){return _0x38a1a8===_0x5431ee;},'inSNX':'local_ws_error','OZNyG':'tunnel_bridge'};if(!_0x27a57b)return;const _0x4a8f5c={'tunnelSessionId':_0x531b82[_0x2df7fd(0x1f4)],'tunnelEventType':_0x531b82[_0x2df7fd(0x21b)],'connectionId':_0x531b82['connectionId'],'code':_0x531b82[_0x2df7fd(0x1ac)],'reason':_0x531b82[_0x2df7fd(0x207)],'error':_0x531b82[_0x2df7fd(0x195)],'elapsedMs':_0x531b82['elapsedMs'],'activeLocalConnections':_0x531b82['activeLocalConnections'],'pendingLocalConnections':_0x531b82[_0x2df7fd(0x1d5)]};_0x27a57b['trackPhaseEnd'](_0x59b5d8[_0x2df7fd(0x163)],_0x4a8f5c),(_0x59b5d8[_0x2df7fd(0x1e4)](_0x531b82[_0x2df7fd(0x21b)],_0x2df7fd(0x1fd))||_0x59b5d8[_0x2df7fd(0x1e4)](_0x531b82[_0x2df7fd(0x21b)],_0x59b5d8['inSNX']))&&void _0x27a57b[_0x2df7fd(0x169)](_0x59b5d8[_0x2df7fd(0x1d6)],new Error(_0x531b82['error']??_0x531b82[_0x2df7fd(0x21b)]),_0x4a8f5c);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x13af7b=await getToken();if(!_0x13af7b)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');return _0x13af7b;}async function apiRequest(_0x368cbc,_0x518975={}){const _0x196cb9=_0x58e3,_0xab03c4={'igskq':function(_0x47e7e7){return _0x47e7e7();},'APVvw':function(_0x47670f,_0x5b04d6,_0x24b894){return _0x47670f(_0x5b04d6,_0x24b894);},'bzIig':function(_0x32c007,_0x5a051b){return _0x32c007===_0x5a051b;},'uYacF':_0x196cb9(0x18b)},_0x1f4b81=await _0xab03c4['igskq'](requireToken),_0x2d596f=getApiBaseUrl(),_0xe28e40=await _0xab03c4[_0x196cb9(0x20c)](fetch,''+_0x2d596f+_0x368cbc,{..._0x518975,'headers':{'Authorization':'Bearer\x20'+_0x1f4b81,'Content-Type':'application/json',..._0x518975[_0x196cb9(0x1b0)]??{}}});if(!_0xe28e40['ok']){let _0x360589='',_0xca63fd;try{const _0x352e76=await _0xe28e40[_0x196cb9(0x1f1)](),_0x266a97=(_0xab03c4[_0x196cb9(0x20b)](typeof _0x352e76[_0x196cb9(0x195)],_0x196cb9(0x18b))?_0x352e76[_0x196cb9(0x195)]:undefined)??JSON[_0x196cb9(0x18e)](_0x352e76);_0x360589=_0x266a97;typeof _0x352e76[_0x196cb9(0x1b6)]===_0xab03c4[_0x196cb9(0x1bb)]&&_0x352e76['test_output']&&(_0x360589=_0x360589+'\x0a'+_0x352e76['test_output']);if(typeof _0x352e76['code']===_0xab03c4[_0x196cb9(0x1bb)])_0xca63fd=_0x352e76['code'];}catch{_0x360589=_0xe28e40[_0x196cb9(0x1be)];}throw new ApiError('API\x20request\x20'+_0x368cbc+'\x20failed\x20('+_0xe28e40[_0x196cb9(0x1a2)]+_0x196cb9(0x1c1)+_0x360589,_0xe28e40['status'],_0x360589,_0xca63fd);}if(_0xe28e40['status']===0xcc)return undefined;return _0xe28e40[_0x196cb9(0x1f1)]();}export class ApiError extends Error{[_0x128150(0x1a2)];[_0x128150(0x1cf)];['code'];constructor(_0x48c7b2,_0x12071b,_0x4cc786,_0x47b00e){const _0x3b5e30=_0x128150,_0x508c34={'mwTlL':'ApiError'};super(_0x48c7b2),this[_0x3b5e30(0x1a2)]=_0x12071b,this[_0x3b5e30(0x1cf)]=_0x4cc786,this['code']=_0x47b00e,this['name']=_0x508c34[_0x3b5e30(0x212)];}}export async function fetchCloudProfile(_0x206433){const _0x3657ff=_0x128150,_0x4d5dc8={'otSqT':function(_0x1bb786,_0x303dbd){return _0x1bb786===_0x303dbd;}};try{return await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x206433));}catch(_0x5ee23b){if(_0x5ee23b instanceof ApiError&&_0x4d5dc8['otSqT'](_0x5ee23b[_0x3657ff(0x1a2)],0x194))return null;throw _0x5ee23b;}}export async function listCloudProfiles(){const _0x3dded2=_0x128150,_0x314b25={'KpUuZ':'/api/v1/profiles'},_0xc65e6f=await apiRequest(_0x314b25[_0x3dded2(0x179)]);return _0xc65e6f[_0x3dded2(0x172)];}export async function deleteCloudProfile(_0x51d1b2){const _0x1c9683=_0x128150,_0x522f1b={'aBqCn':function(_0x1f6c39,_0x3cf79f,_0x28bdd6){return _0x1f6c39(_0x3cf79f,_0x28bdd6);},'lEXHO':_0x1c9683(0x1dd),'UctrC':function(_0x4183da,_0x2ad822){return _0x4183da instanceof _0x2ad822;}};try{await _0x522f1b['aBqCn'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x51d1b2),{'method':_0x522f1b['lEXHO']});}catch(_0x39e8bb){if(_0x522f1b['UctrC'](_0x39e8bb,ApiError)&&_0x39e8bb['status']===0x194)throw new Error(_0x1c9683(0x187)+_0x51d1b2+'\x22\x20not\x20found.');throw _0x39e8bb;}}export async function createCloudProfile(_0x289cf3,_0x4e20f0,_0x105d63={}){const _0x15e6b4=_0x128150,_0x35b138={'QyXRf':function(_0x5b9557,_0x5cdb14){return _0x5b9557>_0x5cdb14;},'ejswp':function(_0x9025cf,_0x177d4a,_0x256259){return _0x9025cf(_0x177d4a,_0x256259);},'TrVTm':'/api/v1/profiles'},_0x43f83c={'name':_0x289cf3};if(_0x4e20f0)_0x43f83c[_0x15e6b4(0x176)]=_0x4e20f0;_0x105d63['settings']&&_0x35b138[_0x15e6b4(0x1e1)](Object[_0x15e6b4(0x1fa)](_0x105d63[_0x15e6b4(0x20d)])['length'],0x0)&&(_0x43f83c[_0x15e6b4(0x20d)]=_0x105d63['settings']);if(_0x105d63[_0x15e6b4(0x1d8)])_0x43f83c['username']=_0x105d63[_0x15e6b4(0x1d8)];if(_0x105d63['password'])_0x43f83c['password']=_0x105d63['password'];return await _0x35b138[_0x15e6b4(0x184)](apiRequest,_0x35b138['TrVTm'],{'method':_0x15e6b4(0x1a0),'body':JSON['stringify'](_0x43f83c)});}export async function uploadCloudProfileSession(_0x5a104c,_0xaaf14d){const _0x3ca12b=_0x128150,_0x4e66d8={'oZInz':function(_0x5186b9,_0x480419,_0x50add2){return _0x5186b9(_0x480419,_0x50add2);},'nPpAN':function(_0x2f33a0,_0x1bcbe1){return _0x2f33a0(_0x1bcbe1);}};return await _0x4e66d8['oZInz'](apiRequest,'/api/v1/profiles/'+_0x4e66d8[_0x3ca12b(0x1b9)](encodeURIComponent,_0x5a104c)+'/session',{'method':'POST','body':JSON[_0x3ca12b(0x18e)]({'session_state':_0xaaf14d})});}export async function saveCloudProfileCredentials(_0x67f4b,_0x3b0ea3,_0x2a374f){const _0x29b796=_0x128150;await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0x67f4b),{'method':_0x29b796(0x1a5),'body':JSON[_0x29b796(0x18e)]({'username':_0x3b0ea3,'password':_0x2a374f})});}export async function fetchAuthConfig(){const _0x40fc02=_0x128150,_0x2ef2f6={'eSule':function(_0xf4e551,_0x14d1a0){return _0xf4e551 instanceof _0x14d1a0;},'BZsSF':function(_0x457b1d,_0x143e37){return _0x457b1d!==_0x143e37;}};try{const _0x53932e=await apiRequest(_0x40fc02(0x205));return _0x53932e[_0x40fc02(0x166)];}catch(_0x32e211){return _0x2ef2f6['eSule'](_0x32e211,ApiError)&&_0x2ef2f6[_0x40fc02(0x219)](_0x32e211[_0x40fc02(0x1a2)],0x194)&&console['error']('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x32e211['message']),null;}}function _0xbd30(){const _0x33c408=['Browser\x20login\x20timed\x20out\x20after\x20','Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20(','PUT','vqITV','203KNpNTb','oSIaU','userAgent','\x20\x20Server-side\x20login\x20error:\x20','\x22.\x0a','code','pLOpK','toISOString','tunnel_login_request','headers','trackPhaseEnd','LCRXP','rtzLx','BzEuD','11mflGdH','test_output','/api/v1/tunnel/sessions/','log','nPpAN','2069440ycidVa','uYacF','domains','join','statusText','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.',').\x20','):\x20','/api/v1/profiles/','XuMrQ','GpaHa','newContext','RANGER_TEST_USERNAME','tunnel','fKpda','irjPD','\x22;\x20proceeding\x20with\x20loginInstructions.','2954304NkCbXk','\x20\x20Cloud\x20session\x20for\x20\x22','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','not_configured','detail','env','target_url','force','\x20\x20No\x20live\x20session\x20for\x20\x22','toLowerCase','pendingLocalConnections','OZNyG','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','username','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','iOPJZ','1381971vsICDt','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','DELETE','6474108nyaEdz',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','upqXP','QyXRf','browserOptions','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','Rzhvy','yOaua','sessionCheckPath','inXPV','KeAvp','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','assertedEnv','107259EELYdM','HpDre','XgpHw','oKTpq','\x20(auth\x20env:\x20','oISff','json','idPgu','persistSessionState','sessionId','rBCyA','VAatE','\x22\x20matched\x20by\x20host\x20for\x20','\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.','\x22;\x20using\x20\x22','keys','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)','tunnel_error','setupHeaders','targetUrl','\x20\x20Login\x20successful.\x20Session\x20cached.','/login','NQmYQ','46WusDZi','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','/api/v1/profiles/auth-config','ambiguous','reason','\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','4|0|2|1|3','bzIig','APVvw','settings','storageState','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','307696OKicVp','HtBsr','mwTlL','trim','environmentKey','organizationId','lyrOk','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','XQRad','BZsSF','\x20\x20Cached\x20session\x20for\x20\x22','type','newPage','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','67305rngJkM','FhAxT','parse','host','Auth\x20environment\x20\x22','138mPdqUq','tunnelUrl','cookies','YZoZS','url','invalid-url','auth_config','message','clientIp','trackPhaseError','save','BYdPw','UkTVM','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','iMSfX','utf-8','\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.','jUZMl','profiles','\x20\x20forceLogin\x20enabled\x20for\x20\x22','replace','36dbRRMZ','environment_key','key','sessionState','KpUuZ','tunnel_login_setup','mCcPt','telemetry','QnsQE','trackPhaseStart','loginInstructions','ybGET','length','iwxYI','catch','ejswp','\x20\x20Created\x20cloud\x20profile\x20\x22','\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22','Cloud\x20profile\x20\x22','aeppc','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','success','string','prompt','KfomG','stringify','baseUrl','\x22\x20instead.','defaultEnvironmentKey','hTigw','EIgUP','environments','error','\x20\x20•\x20or\x20pass\x20--env\x20<key>\x20to\x20run\x20an\x20automated\x20login\x20for\x20this\x20target.','origin','lrFkp','tunnel_session_id','\x22\x20for\x20','name','eWIEF','OECpQ','push','RANGER_TEST_PASSWORD','POST','\x22\x20on\x20profile\x20\x22','status'];_0xbd30=function(){return _0x33c408;};return _0xbd30();}async function createTunnelSession(_0x5601cf){const _0x3b8db2=_0x128150,_0xfce5b5={'iOPJZ':'/api/v1/tunnel/sessions'};return await apiRequest(_0xfce5b5[_0x3b8db2(0x1da)],{'method':_0x3b8db2(0x1a0),'body':JSON['stringify']({'targetUrl':_0x5601cf,'mode':'agent'})});}async function deleteTunnelSession(_0x29f8c7){const _0x5c5806=_0x128150;await apiRequest(_0x5c5806(0x1b7)+_0x29f8c7,{'method':'DELETE'});}export function pickAdHocEnvKey(_0xc9d2e2,_0x181afc,_0x1f8487){const _0x32eee3=_0x128150,_0x7a8023={'HpDre':function(_0x55c7f1,_0x2c7ee0){return _0x55c7f1+_0x2c7ee0;},'KeAvp':_0x32eee3(0x21d),'UkTVM':function(_0x7dd4d,_0x5097ce,_0x37c392){return _0x7dd4d(_0x5097ce,_0x37c392);},'eWIEF':'key','hTigw':function(_0x55262a,_0x41d034){return _0x55262a in _0x41d034;},'AXNZe':'ambiguous','bceVp':function(_0x46b036,_0x2bf8f5){return _0x46b036(_0x2bf8f5);},'CIWsK':function(_0x17d93c,_0x5fbd10){return _0x17d93c+_0x5fbd10;},'upqXP':function(_0x455d3c,_0x2ceb89){return _0x455d3c===_0x2ceb89;}};if(_0x1f8487){if(!_0xc9d2e2?.['environments']?.[_0x1f8487]){const _0x53b5e9=Object['keys'](_0xc9d2e2?.[_0x32eee3(0x194)]??{});throw new Error(_0x7a8023[_0x32eee3(0x1ec)](_0x32eee3(0x15f)+_0x1f8487+_0x32eee3(0x1f8),_0x53b5e9[_0x32eee3(0x181)]?'\x20Available:\x20'+_0x53b5e9['join'](',\x20')+'.':_0x7a8023[_0x32eee3(0x1e8)])+_0x32eee3(0x1fc));}return _0x1f8487;}if(!_0xc9d2e2)return null;if(_0x181afc){const _0x4604f3=_0x7a8023['UkTVM'](matchAuthEnvironmentExact,_0x181afc,_0xc9d2e2);if(_0x4604f3)return _0x4604f3;const _0x36124e=_0x7a8023[_0x32eee3(0x16c)](matchAuthEnvironmentByHost,_0x181afc,_0xc9d2e2);if(_0x36124e&&_0x7a8023[_0x32eee3(0x19c)]in _0x36124e)return console[_0x32eee3(0x1b8)]('\x20\x20Auth\x20env\x20\x22'+_0x36124e[_0x32eee3(0x177)]+_0x32eee3(0x1f7)+_0x181afc+'\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).'),_0x36124e['key'];if(_0x36124e&&_0x7a8023[_0x32eee3(0x192)](_0x7a8023['AXNZe'],_0x36124e))throw new Error(_0x32eee3(0x217)+_0x36124e[_0x32eee3(0x206)]['join'](',\x20')+_0x32eee3(0x1df));if(_0x7a8023['bceVp'](needsTunnel,_0x181afc))throw new Error(_0x7a8023['CIWsK'](_0x7a8023[_0x32eee3(0x1ec)]('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x181afc+_0x32eee3(0x1ab)+'\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a'+'\x20\x20Options:\x0a','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a')+(_0x32eee3(0x186)+_0x181afc[_0x32eee3(0x174)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),'\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20'+_0x181afc+_0x32eee3(0x170)));}if(_0xc9d2e2[_0x32eee3(0x191)])return _0xc9d2e2['defaultEnvironmentKey'];const _0x2b8355=Object['keys'](_0xc9d2e2[_0x32eee3(0x194)]??{});if(_0x7a8023[_0x32eee3(0x1e0)](_0x2b8355[_0x32eee3(0x181)],0x1))return _0x2b8355[0x0];if(_0x7a8023['upqXP'](_0x2b8355['length'],0x0))return null;throw new Error(_0x32eee3(0x1a4)+_0x2b8355['join'](',\x20')+_0x32eee3(0x1c0)+'Pass\x20--base-url\x20<your-app-url>\x20so\x20Ranger\x20can\x20match\x20the\x20right\x20one,\x20or\x20create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`.');}export function adHocProfileName(_0x51c33e,_0x18f6aa,_0x47722b){if(!_0x18f6aa||_0x18f6aa===_0x47722b)return _0x51c33e;return _0x51c33e+':'+_0x18f6aa;}export async function resolveAdHocProfile(_0x2c9839={},_0x398a89=process[_0x128150(0x1d0)]){const _0x56ee0f=_0x128150,_0x403496={'mCcPt':function(_0xc625ab,_0xd8f844,_0x33e52e,_0x4b8832){return _0xc625ab(_0xd8f844,_0x33e52e,_0x4b8832);},'xvGGv':function(_0x5d74a3,_0x14c9d4,_0xe935a1,_0x5b03f1){return _0x5d74a3(_0x14c9d4,_0xe935a1,_0x5b03f1);},'iwxYI':function(_0x36e29c,_0x54b498){return _0x36e29c!==_0x54b498;},'EIgUP':function(_0x5cc333,_0xb10f5){return _0x5cc333(_0xb10f5);},'EYTzw':function(_0x39fb40,_0x4ac6c4){return _0x39fb40??_0x4ac6c4;}},_0x7aafa1=_0x398a89['RANGER_TEST_USERNAME'];if(!_0x7aafa1)return null;const _0x32690a=await fetchAuthConfig(),_0x43380e=_0x403496[_0x56ee0f(0x17b)](pickAdHocEnvKey,_0x32690a,_0x2c9839['targetUrl'],_0x2c9839['envKey']);let _0x327b37=_0x403496['xvGGv'](adHocProfileName,_0x7aafa1,_0x43380e,_0x32690a?.['defaultEnvironmentKey']),_0x9df5dc=await fetchCloudProfile(_0x327b37);_0x9df5dc&&_0x43380e&&_0x403496[_0x56ee0f(0x182)](_0x9df5dc[_0x56ee0f(0x214)],_0x43380e)&&(console['log']('\x20\x20Cloud\x20profile\x20\x22'+_0x327b37+_0x56ee0f(0x1e9)+(_0x9df5dc[_0x56ee0f(0x214)]??'none')+'\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22'+_0x43380e+_0x56ee0f(0x1f9)+_0x7aafa1+':'+_0x43380e+_0x56ee0f(0x190)),_0x327b37=_0x7aafa1+':'+_0x43380e,_0x9df5dc=await _0x403496[_0x56ee0f(0x193)](fetchCloudProfile,_0x327b37));if(_0x9df5dc)return{'name':_0x9df5dc[_0x56ee0f(0x19b)],'profile':_0x9df5dc};const _0x3d279b=_0x398a89['RANGER_TEST_PASSWORD'],_0x2d4760=await _0x403496[_0x56ee0f(0x17b)](createCloudProfile,_0x327b37,_0x403496['EYTzw'](_0x43380e,undefined),{'username':_0x7aafa1,'password':_0x3d279b});return console['log'](_0x56ee0f(0x185)+_0x2d4760['name']+_0x56ee0f(0x19a)+_0x7aafa1+(_0x43380e?_0x56ee0f(0x1ef)+_0x43380e+')':'')),{'name':_0x2d4760['name'],'profile':_0x2d4760};}export async function writeSessionToLocalCache(_0x3428d1,_0x28297b,_0x3cc748,_0x1c1771,_0x13c6a2,_0x360c7c,_0x2e5701){const _0x3d5189=_0x128150,_0x20ba28={'XgpHw':function(_0x1e87f4,_0x2b7cf6){return _0x1e87f4(_0x2b7cf6);},'ybGET':function(_0x17dff0,_0x3271a3,_0x5788a5){return _0x17dff0(_0x3271a3,_0x5788a5);},'oISff':'auth','Lsnlm':function(_0x46db83,_0x380a8a,_0x288f81){return _0x46db83(_0x380a8a,_0x288f81);}},_0x2fdea9=_0x20ba28[_0x3d5189(0x1ed)](sessionCacheHash,{'orgId':_0x28297b,'profileName':_0x3428d1,'effectiveBaseUrl':_0x3cc748,'setupHeaders':_0x1c1771,'invalidateOn':_0x2e5701?.['invalidateOn'],'userAgent':_0x2e5701?.['userAgent'],'clientIp':_0x2e5701?.['clientIp']}),_0x197b3c=_0x20ba28[_0x3d5189(0x180)](getSessionCachePath,_0x2fdea9,_0x3428d1),_0x4184e2=join(getRangerHomeDir(),_0x20ba28[_0x3d5189(0x1f0)]);!existsSync(_0x4184e2)&&await mkdir(_0x4184e2,{'recursive':!![]});const _0x4972b3={..._0x13c6a2};_0x360c7c&&_0x360c7c[_0x3d5189(0x181)]>0x0&&Array['isArray'](_0x4972b3[_0x3d5189(0x162)])&&(_0x4972b3[_0x3d5189(0x162)]=duplicateCookiesForDomains(_0x4972b3['cookies'],_0x360c7c));const _0x26bf2c={'cached_at':new Date()[_0x3d5189(0x1ae)](),'session_state':_0x4972b3};await _0x20ba28['Lsnlm'](writeFile,_0x197b3c,JSON['stringify'](_0x26bf2c,null,0x2));const _0x31bb0f=getStorageStatePath(_0x197b3c);return await _0x20ba28['Lsnlm'](writeFile,_0x31bb0f,JSON[_0x3d5189(0x18e)](_0x4972b3,null,0x2)),_0x31bb0f;}export async function checkLocalCache(_0x13a50f,_0x1aa35c,_0x18aecb,_0x1ba1b5,_0x450f54){const _0x2f924f=_0x128150,_0x1c0e8b={'PDJAG':function(_0x4b9040,_0x1b661f){return _0x4b9040(_0x1b661f);},'BYdPw':function(_0x4a96d4,_0x176436,_0x3ea428){return _0x4a96d4(_0x176436,_0x3ea428);},'oQTAB':function(_0x4f64f1,_0x55ca10){return _0x4f64f1(_0x55ca10);}},_0x5a5a57=_0x1c0e8b['PDJAG'](sessionCacheHash,{'orgId':_0x1aa35c,'profileName':_0x13a50f,'effectiveBaseUrl':_0x18aecb,'setupHeaders':_0x1ba1b5,'invalidateOn':_0x450f54?.['invalidateOn'],'userAgent':_0x450f54?.['userAgent'],'clientIp':_0x450f54?.[_0x2f924f(0x168)]}),_0x59bf4f=_0x1c0e8b[_0x2f924f(0x16b)](getSessionCachePath,_0x5a5a57,_0x13a50f),_0x5614e1=_0x1c0e8b['PDJAG'](getStorageStatePath,_0x59bf4f);if(!_0x1c0e8b['oQTAB'](existsSync,_0x59bf4f)||!existsSync(_0x5614e1))return null;try{const _0x2164c3=await readFile(_0x59bf4f,_0x2f924f(0x16f));return JSON[_0x2f924f(0x220)](_0x2164c3),{'storageStatePath':_0x5614e1};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0x5a40f2,_0x394e9c){const _0x149b61=_0x128150,_0x895ff6={'KfomG':function(_0x56e5fe,_0x838fb6){return _0x56e5fe===_0x838fb6;},'RAbUD':function(_0x4cae9a,_0x51b797){return _0x4cae9a+_0x51b797;},'dapKE':function(_0x1ca7e7,_0x11253c){return _0x1ca7e7+_0x11253c;}};if(!_0x394e9c||!_0x394e9c['domains']?.[_0x149b61(0x181)])return;let _0x458afa;try{_0x458afa=new URL(_0x5a40f2);}catch{return;}const _0x9f8313=[];for(const _0x3ce531 of _0x394e9c[_0x149b61(0x1bc)]){try{_0x9f8313[_0x149b61(0x19e)]({'raw':_0x3ce531,'url':new URL(_0x3ce531)});}catch{}}if(_0x895ff6[_0x149b61(0x18d)](_0x9f8313['length'],0x0))return;if(_0x9f8313['some'](_0xbaeb63=>_0xbaeb63[_0x149b61(0x164)][_0x149b61(0x197)]===_0x458afa['origin']))return;const _0x47884d=_0x9f8313['map'](_0x12f8be=>'\x22'+_0x12f8be['raw']+'\x22')[_0x149b61(0x1bd)](',\x20');console[_0x149b61(0x1b8)](_0x895ff6['RAbUD'](_0x895ff6['dapKE']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x47884d+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x5a40f2+_0x149b61(0x208)),_0x149b61(0x1dc)));}export async function serverSideLogin(_0x37f62b,_0x18d4c4){const _0x5140a6=_0x128150,_0x351d9d={'dqJNh':function(_0x420435,_0x680722,_0x44e74f){return _0x420435(_0x680722,_0x44e74f);},'oSIaU':function(_0x30778c,_0x123e0b){return _0x30778c(_0x123e0b);},'BzEuD':function(_0x27f8c6,_0x4f9dd2){return _0x27f8c6===_0x4f9dd2;}},_0x56be3b=process[_0x5140a6(0x1d0)][_0x5140a6(0x1c6)],_0x14dfd6=process['env'][_0x5140a6(0x19f)],_0x5b322e={};if(_0x56be3b)_0x5b322e['username']=_0x56be3b;if(_0x14dfd6)_0x5b322e['password']=_0x14dfd6;if(_0x18d4c4?.['force'])_0x5b322e['force']=!![];if(_0x18d4c4?.[_0x5140a6(0x1ff)])_0x5b322e[_0x5140a6(0x1d1)]=_0x18d4c4[_0x5140a6(0x1ff)];if(_0x18d4c4?.['env'])_0x5b322e['env']=_0x18d4c4['env'];_0x18d4c4?.['tunnel']&&(_0x5b322e[_0x5140a6(0x199)]=_0x18d4c4['tunnel']['sessionId'],_0x5b322e['pw_endpoint']=_0x18d4c4[_0x5140a6(0x1c7)]['pwEndpoint']);try{return await _0x351d9d['dqJNh'](apiRequest,_0x5140a6(0x1c2)+_0x351d9d[_0x5140a6(0x1a8)](encodeURIComponent,_0x37f62b)+_0x5140a6(0x201),{'method':_0x5140a6(0x1a0),'body':JSON['stringify'](_0x5b322e)});}catch(_0x2f38b2){if(_0x2f38b2 instanceof ApiError&&_0x351d9d[_0x5140a6(0x1b4)](_0x2f38b2['status'],0x190)&&_0x351d9d[_0x5140a6(0x1b4)](_0x2f38b2['code'],'not_configured'))return{'status':_0x5140a6(0x1ce),'error':_0x2f38b2['detail']};throw _0x2f38b2;}}async function serverSideLoginWithOptionalTunnel(_0x3106c1,_0x4e2ad2,_0x4c4220={}){const _0x4a0c7b=_0x128150,_0x1bef9e={'aeppc':_0x4a0c7b(0x1af),'sQcJX':function(_0x426324,_0x3e519a){return _0x426324(_0x3e519a);},'rMcJy':function(_0x4fb3e0,_0x35ecc3){return _0x4fb3e0===_0x35ecc3;},'MTHnB':'true','FhAxT':_0x4a0c7b(0x1d7),'auiRK':function(_0x4c4905,_0x3f389d){return _0x4c4905(_0x3f389d);},'lrFkp':function(_0x4a018a,_0x3abda9){return _0x4a018a(_0x3abda9);},'BJKnS':function(_0x550724,_0x148fc5){return _0x550724(_0x148fc5);},'idPgu':function(_0x38358f,_0x408dfe,_0x7da630){return _0x38358f(_0x408dfe,_0x7da630);},'rBCyA':function(_0x456db3,_0x5186c9){return _0x456db3??_0x5186c9;},'tzKfm':function(_0x404667,_0x43c167){return _0x404667||_0x43c167;},'XuMrQ':function(_0x1178f4,_0x16c2c5){return _0x1178f4(_0x16c2c5);},'IOqbo':'tunnel_login_cleanup'};if(!needsTunnel(_0x4e2ad2))return await serverSideLogin(_0x3106c1,{'force':_0x4c4220['force'],'env':_0x4c4220[_0x4a0c7b(0x1d0)]});let _0x111476=null,_0xc71902=null,_0x5db885=null,_0x1e59f5=null,_0x21d418=![];const _0x20298b=process['env']['RANGER_TUNNEL_LOGIN_HEADED']?.[_0x4a0c7b(0x1d4)](),_0x34317f=_0x1bef9e['rMcJy'](_0x20298b,'1')||_0x20298b===_0x1bef9e['MTHnB'],_0x57c871={'profileName':_0x3106c1,'targetUrlHost':targetHostForTelemetry(_0x4e2ad2),'tunnelRequired':!![],'forceLogin':Boolean(_0x4c4220[_0x4a0c7b(0x1d2)]),'localBrowserServerHeaded':_0x34317f};try{_0x4c4220['telemetry']?.[_0x4a0c7b(0x17e)](_0x4a0c7b(0x17a),_0x57c871);_0x34317f&&console[_0x4a0c7b(0x1b8)](_0x1bef9e[_0x4a0c7b(0x21f)]);_0x111476=await _0x1bef9e['auiRK'](launchBrowserServer,{'headless':!_0x34317f}),_0xc71902=await _0x1bef9e[_0x4a0c7b(0x198)](createTunnelSession,_0x4e2ad2);const _0x1ed6b7=await requireToken();_0x5db885=await _0x1bef9e['BJKnS'](createTunnelBridge,{'localWsUrl':_0x111476['wsEndpoint'],'tunnelServerUrl':_0xc71902[_0x4a0c7b(0x161)],'sessionId':_0xc71902['sessionId'],'apiKey':_0x1ed6b7,'onError':_0x44cf32=>{_0x1e59f5=_0x44cf32;},'onClose':()=>{const _0x469245=_0x4a0c7b;_0x1e59f5??=new Error(_0x469245(0x1e3)+_0x3106c1);},'onEvent':_0x36a179=>trackBridgeEvent(_0x4c4220['telemetry'],_0x36a179)}),_0x4c4220[_0x4a0c7b(0x17c)]?.['trackPhaseEnd']('tunnel_login_setup',{..._0x57c871,'tunnelSessionId':_0xc71902['sessionId'],'localBrowserServer':!![],'localBrowserServerHeaded':_0x34317f}),_0x21d418=!![];try{return _0x4c4220['telemetry']?.['trackPhaseStart']('tunnel_login_request',{..._0x57c871,'tunnelSessionId':_0xc71902['sessionId']}),await _0x1bef9e[_0x4a0c7b(0x1f2)](serverSideLogin,_0x3106c1,{'force':_0x4c4220[_0x4a0c7b(0x1d2)],'targetUrl':_0x4e2ad2,'env':_0x4c4220['env'],'tunnel':{'sessionId':_0xc71902[_0x4a0c7b(0x1f4)],'pwEndpoint':_0xc71902['pwEndpoint']}})['then'](_0x4268b5=>{const _0x246cf5=_0x4a0c7b;return _0x4c4220['telemetry']?.[_0x246cf5(0x1b1)](_0x1bef9e[_0x246cf5(0x188)],{..._0x57c871,'tunnelSessionId':_0xc71902?.[_0x246cf5(0x1f4)],'loginStatus':_0x4268b5[_0x246cf5(0x1a2)],'hasSessionState':_0x1bef9e['sQcJX'](Boolean,_0x4268b5['session_state']),'hasTestOutput':Boolean(_0x4268b5['test_output']),'bridgeError':errorMessageForTelemetry(_0x1e59f5)}),_0x4268b5;});}catch(_0x3c6682){await _0x4c4220['telemetry']?.[_0x4a0c7b(0x169)]('tunnel_login_request',_0x1bef9e['rBCyA'](_0x1e59f5,_0x3c6682),{..._0x57c871,'tunnelSessionId':_0xc71902['sessionId'],'bridgeError':errorMessageForTelemetry(_0x1e59f5)});throw _0x1bef9e[_0x4a0c7b(0x1f5)](_0x1e59f5,_0x3c6682);}}catch(_0x4f47be){!_0x21d418&&await _0x4c4220['telemetry']?.['trackPhaseError'](_0x4a0c7b(0x17a),_0x4f47be,{..._0x57c871,'tunnelSessionId':_0xc71902?.['sessionId']});throw _0x4f47be;}finally{if(_0x1bef9e['tzKfm'](_0xc71902,_0x111476)||_0x5db885){const _0x5967bf=_0x4a0c7b(0x20a)['split']('|');let _0x531aa5=0x0;while(!![]){switch(_0x5967bf[_0x531aa5++]){case'0':_0x5db885?.['close']();continue;case'1':_0xc71902&&await _0x1bef9e[_0x4a0c7b(0x1c3)](deleteTunnelSession,_0xc71902['sessionId'])[_0x4a0c7b(0x183)](()=>{});continue;case'2':_0x111476&&await _0x111476['close']()['catch'](()=>{});continue;case'3':_0x4c4220['telemetry']?.['trackPhaseEnd'](_0x1bef9e['IOqbo'],{..._0x57c871,'tunnelSessionId':_0xc71902?.['sessionId']});continue;case'4':_0x4c4220[_0x4a0c7b(0x17c)]?.['trackPhaseStart']('tunnel_login_cleanup',{..._0x57c871,'tunnelSessionId':_0xc71902?.['sessionId']});continue;}break;}}}}export async function manualBrowserLogin(_0x4a57c8,_0xe202d6,_0x471442={}){const _0x908256=_0x128150,_0x5c28d8={'ULZPJ':function(_0x1de4a4){return _0x1de4a4();},'stApr':'close','cHHkG':function(_0x27e367,_0x4c9ebb){return _0x27e367+_0x4c9ebb;},'UxICH':_0x908256(0x1d9),'LCRXP':function(_0x3dbe1b,_0x5edeec){return _0x3dbe1b(_0x5edeec);},'vqITV':function(_0x3da7c2,_0x237147){return _0x3da7c2&&_0x237147;}};if(!isInteractive())throw new Error(_0x5c28d8['cHHkG']('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x4a57c8['name']+_0x908256(0x1ab)+'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20',_0x908256(0x209)));const _0x3de1f9=_0xe202d6&&_0xe202d6['domains'][_0x908256(0x181)]>0x0?_0xe202d6[_0x908256(0x1bc)][0x0]:'about:blank';console['log'](_0x908256(0x1bf)),console['log'](_0x5c28d8['UxICH']),await new Promise(_0x21c920=>setTimeout(_0x21c920,0x7d0));const _0x1d7282=await chromium['launch']({'headless':![]});let _0x408318=null;try{const _0x2a6a5f={'ignoreHTTPSErrors':!![]};_0xe202d6?.[_0x908256(0x1fe)]&&(_0x2a6a5f['extraHTTPHeaders']=_0xe202d6[_0x908256(0x1fe)]);const _0x4cd855=await _0x1d7282[_0x908256(0x1c5)](_0x2a6a5f);await _0x5c28d8[_0x908256(0x1b2)](addProfileSetupBanner,_0x4cd855);const _0x3f0c80=await _0x4cd855[_0x908256(0x21c)]();await _0x3f0c80['goto'](_0x3de1f9);let _0x401818=![];await new Promise(_0x468106=>{const _0x1469a4={'UBJpH':function(_0x27208f){return _0x27208f();},'zHDAY':function(_0xf740fc){return _0x5c28d8['ULZPJ'](_0xf740fc);}},_0x4dc606=setTimeout(()=>{const _0x34d31f=_0x58e3;_0x401818=!![],console[_0x34d31f(0x195)](_0x34d31f(0x1a3)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+_0x34d31f(0x20f)),_0x1469a4['UBJpH'](_0x468106);},MANUAL_LOGIN_TIMEOUT_MS);_0x3f0c80['on'](_0x5c28d8['stApr'],async()=>{const _0x3824dd=_0x58e3;clearTimeout(_0x4dc606);try{const _0x63a573=await _0x4cd855[_0x3824dd(0x20e)]();_0x408318=_0x63a573;}catch{}_0x1469a4['zHDAY'](_0x468106);});});if(_0x5c28d8[_0x908256(0x1a6)](_0x401818,!_0x408318))throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x1d7282['close']()[_0x908256(0x183)](()=>{});}if(!_0x408318)throw new Error(_0x908256(0x16d));return _0x471442[_0x908256(0x1f3)]!==![]&&await apiRequest(_0x908256(0x1c2)+encodeURIComponent(_0x4a57c8['name'])+'/session',{'method':_0x908256(0x1a0),'body':JSON['stringify']({'session_state':_0x408318,'updated_by':'cli:manual-login'})}),{'sessionState':_0x408318};}export async function promptSaveCredentials(_0x3ced73){const _0x3821fb=_0x128150,_0x43f7b2={'oKTpq':function(_0x4f8a1b,_0x5b9d46){return _0x4f8a1b||_0x5b9d46;},'OECpQ':_0x3821fb(0x204),'NQmYQ':function(_0x345135,_0x35fb54,_0x309be6){return _0x345135(_0x35fb54,_0x309be6);},'EeNoT':_0x3821fb(0x1a5),'ELsKB':'\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.'},_0xf41663=process[_0x3821fb(0x1d0)]['RANGER_TEST_USERNAME'],_0x185652=process[_0x3821fb(0x1d0)]['RANGER_TEST_PASSWORD'];if(_0x43f7b2[_0x3821fb(0x1ee)](!_0xf41663,!_0x185652))return;if(!isInteractive())return;const {save:_0x32c9ba}=await _0x329f71[_0x3821fb(0x18c)]([{'type':'confirm','name':_0x3821fb(0x16a),'message':_0x43f7b2[_0x3821fb(0x19d)],'default':![]}]);if(!_0x32c9ba)return;await _0x43f7b2[_0x3821fb(0x202)](apiRequest,_0x3821fb(0x1c2)+encodeURIComponent(_0x3ced73),{'method':_0x43f7b2['EeNoT'],'body':JSON['stringify']({'username':_0xf41663,'password':_0x185652})}),console['log'](_0x43f7b2['ELsKB']);}export async function resolveCloudProfileSession(_0x2c1145,_0x10637f={}){const _0x233ec7=_0x128150,_0x451cc6={'QnsQE':function(_0x550bf8,_0x2c5876,_0x993004){return _0x550bf8(_0x2c5876,_0x993004);},'XQRad':function(_0x36d45e,_0x3fb176){return _0x36d45e||_0x3fb176;},'lyrOk':function(_0x50e97a,_0x3d7db1){return _0x50e97a(_0x3d7db1);},'GpaHa':function(_0x313ae1,_0x4e5f54,_0x4b7642,_0x1bd2ce,_0x462ed5,_0x49fd6c){return _0x313ae1(_0x4e5f54,_0x4b7642,_0x1bd2ce,_0x462ed5,_0x49fd6c);},'VAatE':function(_0x5738d3,_0x220969,_0x2de22c,_0xc7c65b,_0x5f56e0){return _0x5738d3(_0x220969,_0x2de22c,_0xc7c65b,_0x5f56e0);},'cMMYL':function(_0x44f433,_0x5570e8,_0x2bf4eb){return _0x44f433(_0x5570e8,_0x2bf4eb);},'ZiDnd':function(_0x329c3e,_0x4515de){return _0x329c3e(_0x4515de);},'cslXs':function(_0xd29e4,_0x49e779){return _0xd29e4(_0x49e779);},'yOaua':function(_0x294900,_0x55d445){return _0x294900(_0x55d445);},'irjPD':function(_0x51bb69,_0x567c79,_0x9dff0d,_0x4f9410){return _0x51bb69(_0x567c79,_0x9dff0d,_0x4f9410);},'fKpda':_0x233ec7(0x18a),'oqrfv':_0x233ec7(0x200),'pLOpK':function(_0x45f7a8,_0x1bfb3a){return _0x45f7a8&&_0x1bfb3a;},'XcrSu':function(_0x2be434,_0x507b4a){return _0x2be434(_0x507b4a);},'EzDJj':'\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','jUZMl':_0x233ec7(0x1cd),'xBtJZ':function(_0x5c064d,_0x2c080a){return _0x5c064d instanceof _0x2c080a;},'HtBsr':function(_0x1f3433){return _0x1f3433();},'rtzLx':function(_0x38e471,_0x332dfc){return _0x38e471+_0x332dfc;},'UaYHC':function(_0x1d4368,_0x4820dd){return _0x1d4368+_0x4820dd;},'iMSfX':_0x233ec7(0x196),'HDkaq':function(_0x338e37,_0x5876bd,_0x522e1d,_0x810a63,_0x844e52,_0x3e15d3,_0x18b161,_0x1dfe56){return _0x338e37(_0x5876bd,_0x522e1d,_0x810a63,_0x844e52,_0x3e15d3,_0x18b161,_0x1dfe56);}},_0x1b3a4e=_0x2c1145[_0x233ec7(0x20d)]??{},_0x412462=await fetchAuthConfig(),_0xbf54f6=_0x412462?_0x451cc6[_0x233ec7(0x17d)](resolveAuthEnvironmentLocally,_0x412462,_0x10637f[_0x233ec7(0x1ea)]??_0x2c1145[_0x233ec7(0x214)]):null,_0x2f4810=typeof _0xbf54f6?.[_0x233ec7(0x17f)]===_0x233ec7(0x18b)&&_0xbf54f6[_0x233ec7(0x17f)]['trim']()?_0xbf54f6[_0x233ec7(0x17f)]:undefined,_0x556363=typeof _0x1b3a4e[_0x233ec7(0x17f)]===_0x233ec7(0x18b)&&_0x1b3a4e[_0x233ec7(0x17f)]['trim']()?_0x1b3a4e['loginInstructions']:undefined,_0x188bbb=_0x451cc6[_0x233ec7(0x218)](_0x556363,!_0x2f4810)?_0x1b3a4e:{..._0x1b3a4e,'loginInstructions':_0x2f4810},_0x587010=_0x451cc6[_0x233ec7(0x216)](Boolean,_0x188bbb['loginInstructions']?.[_0x233ec7(0x213)]()),_0x32f896=Boolean(_0x1b3a4e['forceLogin']||_0xbf54f6?.['forceLogin']),_0xe6db56=_0xbf54f6?.[_0x233ec7(0x1bc)],_0x4acd87=_0x1b3a4e['setupHeaders'],_0x4325ac=_0x4acd87??_0xbf54f6?.[_0x233ec7(0x1fe)],_0x54072f=_0x10637f['effectiveBaseUrl']??_0x1b3a4e[_0x233ec7(0x18f)]??(_0xe6db56&&_0xe6db56['length']>0x0?_0xe6db56[0x0]:''),_0x21a66c=_0x54072f?needsTunnel(_0x54072f):![],_0x4dce12={'invalidateOn':_0xbf54f6?.['invalidateOn'],'userAgent':_0xbf54f6?.[_0x233ec7(0x1e2)]?.[_0x233ec7(0x1a9)]??_0x1b3a4e['userAgent']};_0x32f896&&console[_0x233ec7(0x1b8)](_0x233ec7(0x173)+_0x2c1145['name']+'\x22,\x20refreshing\x20session...');if(!_0x32f896){const _0x60a9e4=await _0x451cc6[_0x233ec7(0x1c4)](checkLocalCache,_0x2c1145['name'],_0x2c1145['organizationId'],_0x54072f,_0x4325ac,_0x4dce12);if(_0x60a9e4){if(_0x54072f&&!_0x21a66c){const _0x30352f=await _0x451cc6[_0x233ec7(0x1f6)](isCachedSessionLive,_0x60a9e4['storageStatePath'],_0x54072f,{'sessionCheckPath':_0xbf54f6?.[_0x233ec7(0x1e6)],'setupHeaders':_0x4325ac},{'launchBrowser':launchRealBrowser});if(_0x30352f)return console['log'](_0x233ec7(0x189)+_0x2c1145[_0x233ec7(0x19b)]+'\x22'),{'authPath':_0x60a9e4['storageStatePath'],'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};console[_0x233ec7(0x1b8)](_0x233ec7(0x21a)+_0x2c1145['name']+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x451cc6['cMMYL'](emitSessionValidationHint,_0x54072f,_0xbf54f6);}else return _0x21a66c&&console[_0x233ec7(0x1b8)](_0x233ec7(0x1fb)+_0x2c1145['name']+'\x22'),{'authPath':_0x60a9e4['storageStatePath'],'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};}}if(!_0x32f896&&_0x2c1145[_0x233ec7(0x178)]){const _0x4650f1=await writeSessionToLocalCache(_0x2c1145[_0x233ec7(0x19b)],_0x2c1145[_0x233ec7(0x215)],_0x54072f,_0x4325ac,_0x2c1145['sessionState'],_0xe6db56,_0x4dce12);if(_0x54072f){const _0x1599b4=await isCachedSessionLive(_0x4650f1,_0x54072f,{'sessionCheckPath':_0xbf54f6?.['sessionCheckPath'],'setupHeaders':_0x4325ac},{'launchBrowser':launchRealBrowser});if(_0x1599b4)return console[_0x233ec7(0x1b8)]('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0x2c1145['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x4650f1,'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};console['log'](_0x233ec7(0x1cc)+_0x2c1145[_0x233ec7(0x19b)]+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x451cc6[_0x233ec7(0x17d)](emitSessionValidationHint,_0x54072f,_0xbf54f6);}else return{'authPath':_0x4650f1,'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};}if(_0x587010)return console['log'](_0x233ec7(0x1d3)+_0x2c1145['name']+_0x233ec7(0x1ca)),{'authPath':undefined,'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};console[_0x233ec7(0x1b8)](_0x233ec7(0x1d3)+_0x2c1145[_0x233ec7(0x19b)]+'\x22,\x20attempting\x20login...');const _0x3ff539=_0x451cc6['ZiDnd'](Boolean,process[_0x233ec7(0x1d0)][_0x233ec7(0x1c6)])&&Boolean(process['env']['RANGER_TEST_PASSWORD']),_0x25975b=Boolean(_0x2c1145['username']),_0x145526=_0x451cc6['cslXs'](Boolean,_0x10637f['assertedEnv']),_0x267ff5=_0x54072f?_0x451cc6[_0x233ec7(0x1e5)](isBareLocalhost,_0x54072f):![],_0x1f0c6b=(_0x3ff539||_0x25975b)&&(!_0x267ff5||_0x145526);if(_0x1f0c6b)try{const _0x40ce72=_0x54072f?await _0x451cc6[_0x233ec7(0x1c9)](serverSideLoginWithOptionalTunnel,_0x2c1145['name'],_0x54072f,{'force':_0x32f896,'telemetry':_0x10637f['telemetry'],'env':_0x10637f[_0x233ec7(0x1ea)]}):await serverSideLogin(_0x2c1145[_0x233ec7(0x19b)],{'force':_0x32f896,'env':_0x10637f['assertedEnv']});if(_0x40ce72[_0x233ec7(0x1a2)]===_0x233ec7(0x1ce))console['log']('\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...');else{if(_0x40ce72['status']===_0x451cc6[_0x233ec7(0x1c8)]&&_0x40ce72['session_state']){console['log'](_0x451cc6['oqrfv']);const _0x2fd663=await writeSessionToLocalCache(_0x2c1145[_0x233ec7(0x19b)],_0x2c1145['organizationId'],_0x54072f,_0x4325ac,_0x40ce72['session_state'],_0xe6db56,_0x4dce12);return _0x451cc6['pLOpK'](_0x3ff539,!_0x25975b)&&await _0x451cc6['XcrSu'](promptSaveCredentials,_0x2c1145['name']),{'authPath':_0x2fd663,'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};}else _0x40ce72['test_output']&&(console['log'](_0x451cc6['EzDJj']),console['log'](_0x40ce72[_0x233ec7(0x1b6)])),console[_0x233ec7(0x1b8)](_0x451cc6['jUZMl']);}}catch(_0x4e289d){console['log'](_0x233ec7(0x1aa)+(_0x451cc6['xBtJZ'](_0x4e289d,Error)?_0x4e289d['message']:String(_0x4e289d))),console['log'](_0x451cc6[_0x233ec7(0x171)]);}if(_0x451cc6[_0x233ec7(0x1ad)](_0x267ff5,!_0x145526)&&!_0x451cc6[_0x233ec7(0x211)](isInteractive))throw new Error(_0x451cc6[_0x233ec7(0x1b3)](_0x451cc6['UaYHC']('No\x20saved\x20session\x20for\x20\x22'+_0x54072f+_0x233ec7(0x1a1)+_0x2c1145[_0x233ec7(0x19b)]+'\x22,\x20and\x20cloud\x20sessions\x20don\x27t\x20apply\x20to\x20localhost.\x0a','\x20\x20•\x20capture\x20one\x20(a\x20browser\x20opens):\x20ranger\x20profile\x20add\x20'+_0x2c1145[_0x233ec7(0x19b)]+'\x20--url\x20'+_0x54072f+'\x0a'),_0x451cc6[_0x233ec7(0x16e)]));const _0x303ce6=_0xbf54f6?{..._0xbf54f6,'domains':orderLoginDomains(_0x54072f,_0xbf54f6[_0x233ec7(0x1bc)]),'setupHeaders':_0x4325ac}:_0x54072f?{'key':_0x2c1145['environmentKey']??'','domains':[_0x54072f],'setupHeaders':_0x4325ac}:null,{sessionState:_0x5e7f7d}=await _0x451cc6[_0x233ec7(0x1c9)](manualBrowserLogin,_0x2c1145,_0x303ce6,{'persistSessionState':!_0x21a66c}),_0x398075=await _0x451cc6['HDkaq'](writeSessionToLocalCache,_0x2c1145['name'],_0x2c1145['organizationId'],_0x54072f,_0x4325ac,_0x5e7f7d,_0xe6db56,_0x4dce12);return{'authPath':_0x398075,'settings':_0x188bbb,'resolvedEnv':_0xbf54f6};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0xec4cfd=_0xca3b;(function(_0x5bf44c,_0x5ed329){const _0x8a0b8e=_0xca3b,_0x23a6f5=_0x5bf44c();while(!![]){try{const _0x59849c=parseInt(_0x8a0b8e(0x130))/0x1+-parseInt(_0x8a0b8e(0x108))/0x2+parseInt(_0x8a0b8e(0x136))/0x3*(-parseInt(_0x8a0b8e(0x122))/0x4)+parseInt(_0x8a0b8e(0x10f))/0x5+-parseInt(_0x8a0b8e(0x12a))/0x6*(-parseInt(_0x8a0b8e(0x11c))/0x7)+-parseInt(_0x8a0b8e(0x10a))/0x8*(-parseInt(_0x8a0b8e(0x124))/0x9)+parseInt(_0x8a0b8e(0x116))/0xa*(-parseInt(_0x8a0b8e(0x11a))/0xb);if(_0x59849c===_0x5ed329)break;else _0x23a6f5['push'](_0x23a6f5['shift']());}catch(_0xdcb83a){_0x23a6f5['push'](_0x23a6f5['shift']());}}}(_0x1757,0x68664));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x3dbbe4=process['env'],_0x325cf7={'stdin':process['stdin'],'stdout':process[_0xec4cfd(0x115)]}){const _0x5d1925=_0xec4cfd,_0x3936ad={'kTXBL':function(_0x5e7108,_0xf5c5d3){return _0x5e7108(_0xf5c5d3);}};if(_0x3dbbe4['CI'])return![];return Boolean(_0x325cf7[_0x5d1925(0x10e)][_0x5d1925(0x109)])&&_0x3936ad[_0x5d1925(0x121)](Boolean,_0x325cf7[_0x5d1925(0x115)][_0x5d1925(0x109)]);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x198bbf){const _0x32aaa8=_0xec4cfd,_0x352800={'QwgFw':'baseUrl','hOuex':_0x32aaa8(0x105),'eOJEO':'port','qHJpc':function(_0x187257,_0xe41488){return _0x187257(_0xe41488);},'PydKB':'userAgent','MRisd':function(_0x1804ae,_0x4aa26e){return _0x1804ae!==_0x4aa26e;},'GkpWg':'clientIp','yvRgK':'hex'},_0x5f5d5b=new Set(_0x198bbf[_0x32aaa8(0x101)]??DEFAULT_INVALIDATE_ON);_0x198bbf[_0x32aaa8(0x11e)]&&needsTunnel(_0x198bbf[_0x32aaa8(0x11e)])&&_0x5f5d5b[_0x32aaa8(0x126)](_0x352800['QwgFw']);const _0x575dcf={'orgId':_0x198bbf['orgId'],'profileName':_0x198bbf[_0x32aaa8(0x120)]};return _0x5f5d5b['has'](_0x352800['QwgFw'])&&(_0x575dcf[_0x32aaa8(0x11e)]=_0x198bbf[_0x32aaa8(0x11e)]),_0x5f5d5b[_0x32aaa8(0x107)](_0x352800['hOuex'])&&(_0x575dcf[_0x32aaa8(0x105)]=_0x198bbf[_0x32aaa8(0x105)]?sortObjectKeys(_0x198bbf['setupHeaders']):_0x198bbf['setupHeaders']),_0x5f5d5b[_0x32aaa8(0x107)](_0x352800[_0x32aaa8(0x127)])&&(_0x575dcf[_0x32aaa8(0x12d)]=_0x352800[_0x32aaa8(0x128)](extractPort,_0x198bbf['effectiveBaseUrl'])),_0x5f5d5b[_0x32aaa8(0x107)](_0x352800['PydKB'])&&_0x352800['MRisd'](_0x198bbf[_0x32aaa8(0x12c)],undefined)&&(_0x575dcf[_0x32aaa8(0x12c)]=_0x198bbf['userAgent']),_0x5f5d5b[_0x32aaa8(0x107)](_0x352800['GkpWg'])&&_0x352800[_0x32aaa8(0x117)](_0x198bbf[_0x32aaa8(0x100)],undefined)&&(_0x575dcf[_0x32aaa8(0x100)]=_0x198bbf['clientIp']),createHash(_0x32aaa8(0x119))['update'](JSON['stringify'](_0x575dcf))['digest'](_0x352800[_0x32aaa8(0x132)])['slice'](0x0,0xc);}function extractPort(_0x577c7a){const _0x114ef7=_0xec4cfd;try{return new URL(_0x577c7a)[_0x114ef7(0x12d)];}catch{return'';}}function _0xca3b(_0x36a995,_0x4ecdaf){_0x36a995=_0x36a995-0x100;const _0x1757bd=_0x1757();let _0xca3bee=_0x1757bd[_0x36a995];return _0xca3bee;}function sortObjectKeys(_0xe9cd1f){const _0x3ea7bf=_0xec4cfd,_0x2fe95f={};for(const _0x1ba0ae of Object[_0x3ea7bf(0x137)](_0xe9cd1f)[_0x3ea7bf(0x10b)]()){_0x2fe95f[_0x1ba0ae]=_0xe9cd1f[_0x1ba0ae];}return _0x2fe95f;}export function getSessionCachePath(_0x14fce1,_0x531a83){const _0xb73a21=_0xec4cfd,_0x16f034={'YRQvv':function(_0x17ca1b,_0x1afb89,_0x3125cc,_0x1f27a2){return _0x17ca1b(_0x1afb89,_0x3125cc,_0x1f27a2);},'mtHrr':_0xb73a21(0x102)};return _0x16f034[_0xb73a21(0x106)](join,getRangerHomeDir(),_0x16f034['mtHrr'],_0x14fce1+'-'+_0x531a83+_0xb73a21(0x125));}function _0x1757(){const _0x4a93fd=['1960UZfZHx','toString','effectiveBaseUrl','gGkhn','profileName','kTXBL','8SyMZzv','newPage','9SzRMwp','.json','add','eOJEO','qHJpc','fUzAd','2226zvtMqu','ArUec','userAgent','port','::1','map','98021dlgous','url','yvRgK','filter','startsWith','includes','622416GedPnI','keys','clientIp','invalidateOn','auth','localhost.','domcontentloaded','setupHeaders','YRQvv','has','136272CoFTuo','isTTY','3055432ZLndCU','sort','length','localhost','stdin','3192200hddvqb','newContext','domain','defaultEnvironmentKey','environments','replace','stdout','311570WcNsxJ','MRisd','hostname','sha256','110AlwNof','BNHWk'];_0x1757=function(){return _0x4a93fd;};return _0x1757();}export function getStorageStatePath(_0xc5910d){const _0x3a42c1=_0xec4cfd,_0x3ead53={'ageVJ':'.storageState.json'};return _0xc5910d[_0x3a42c1(0x114)](/\.json$/,_0x3ead53['ageVJ']);}export function needsTunnel(_0xadb6f4){const _0x364f29=_0xec4cfd,_0x3f631a={'ULNkS':function(_0x5ef569,_0x5b28c0){return _0x5ef569===_0x5b28c0;},'fUzAd':'.localhost','GKHMw':_0x364f29(0x103)};let _0x13e7b7;try{_0x13e7b7=new URL(_0xadb6f4)['hostname'];}catch{return![];}if(_0x3f631a['ULNkS'](_0x13e7b7,_0x364f29(0x10d))||_0x13e7b7==='127.0.0.1')return!![];if(_0x13e7b7['endsWith'](_0x3f631a[_0x364f29(0x129)]))return!![];if(_0x13e7b7[_0x364f29(0x135)](_0x3f631a['GKHMw']))return!![];return![];}export function isBareLocalhost(_0x3192c3){const _0x3dd517=_0xec4cfd,_0x41bc7b={'ArUec':function(_0x597f89,_0xdfe9cc){return _0x597f89===_0xdfe9cc;},'BNHWk':'127.0.0.1','gGkhn':_0x3dd517(0x12e)};let _0x15028b;try{_0x15028b=new URL(_0x3192c3)['hostname'];}catch{return![];}return _0x15028b==='localhost'||_0x41bc7b[_0x3dd517(0x12b)](_0x15028b,_0x41bc7b[_0x3dd517(0x11b)])||_0x15028b===_0x41bc7b[_0x3dd517(0x11f)]||_0x41bc7b['ArUec'](_0x15028b,'[::1]');}export function orderLoginDomains(_0x524f0b,_0x2a0c98){const _0x1480f1=_0xec4cfd,_0x357a19=_0x2a0c98??[];if(!_0x524f0b)return _0x357a19;return[_0x524f0b,..._0x357a19[_0x1480f1(0x133)](_0x5c5067=>_0x5c5067!==_0x524f0b)];}export function hostnameOf(_0x5e7e3e){const _0x26fd9e=_0xec4cfd;return new URL(_0x5e7e3e)[_0x26fd9e(0x118)];}export function duplicateCookiesForDomains(_0x48d56f,_0x5a40fa){const _0x59c66d=_0xec4cfd,_0x2f6776={'iZYQJ':function(_0x1f7401,_0x57de04){return _0x1f7401(_0x57de04);}},_0x2d0ec7=[..._0x48d56f],_0x4e7b70=new Set(_0x48d56f[_0x59c66d(0x12f)](_0x12b40=>_0x12b40[_0x59c66d(0x111)]));for(const _0x5cc250 of _0x5a40fa){let _0x1d0d4b;try{_0x1d0d4b=_0x2f6776['iZYQJ'](hostnameOf,_0x5cc250);}catch{continue;}if(!_0x1d0d4b)continue;const _0x612d3b=_0x1d0d4b[_0x59c66d(0x134)]('.')?_0x1d0d4b:'.'+_0x1d0d4b;if(_0x4e7b70[_0x59c66d(0x107)](_0x1d0d4b)||_0x4e7b70['has'](_0x612d3b))continue;for(const _0x1dd9d1 of _0x48d56f){_0x2d0ec7['push']({..._0x1dd9d1,'domain':_0x612d3b});}_0x4e7b70[_0x59c66d(0x126)](_0x612d3b);}return _0x2d0ec7;}export function resolveAuthEnvironmentLocally(_0x8166e4,_0x477bbc){const _0x20ffc8=_0xec4cfd,_0x250ca1={'QGpmz':function(_0x4ae093,_0xead802){return _0x4ae093===_0xead802;}},_0x24f10a=_0x8166e4[_0x20ffc8(0x113)];if(_0x477bbc){const _0x6f8244=_0x24f10a[_0x477bbc];if(!_0x6f8244)return null;return{'key':_0x477bbc,..._0x6f8244};}if(_0x8166e4[_0x20ffc8(0x112)]){const _0x2a63cb=_0x24f10a[_0x8166e4['defaultEnvironmentKey']];if(!_0x2a63cb)return null;return{'key':_0x8166e4[_0x20ffc8(0x112)],..._0x2a63cb};}const _0x1a3bfc=Object['keys'](_0x24f10a);if(_0x250ca1['QGpmz'](_0x1a3bfc[_0x20ffc8(0x10c)],0x1)){const _0x29af3f=_0x1a3bfc[0x0];return{'key':_0x29af3f,..._0x24f10a[_0x29af3f]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x1feb30,_0x254fdd){const _0x341cd4=_0xec4cfd;try{if(_0x254fdd)return new URL(_0x254fdd,_0x1feb30)[_0x341cd4(0x11d)]();return new URL(_0x1feb30)[_0x341cd4(0x11d)]();}catch{return null;}}export function looksLikeLoginUrl(_0x1db524){try{const _0xdd5a72=new URL(_0x1db524);return LOGIN_URL_PATTERN['test'](_0xdd5a72['pathname']);}catch{return LOGIN_URL_PATTERN['test'](_0x1db524);}}export async function isCachedSessionLive(_0xc89c82,_0x48eaba,_0x49ef07={},_0x3466f6={}){const _0x1638c0=_0xec4cfd,_0xb1af0e={'vGNaG':function(_0x39a81e,_0x1dbeb0){return _0x39a81e(_0x1dbeb0);}},_0x925ae4=buildSessionCheckUrl(_0x48eaba,_0x49ef07['sessionCheckPath']);if(!_0x925ae4)return!![];if(!_0x3466f6['launchBrowser'])return!![];let _0x486017=null;try{_0x486017=await _0x3466f6['launchBrowser']();const _0x31f3d0=await _0x486017[_0x1638c0(0x110)]({'storageState':_0xc89c82,'ignoreHTTPSErrors':!![],..._0x49ef07['setupHeaders']?{'extraHTTPHeaders':_0x49ef07['setupHeaders']}:{}}),_0x2a9738=await _0x31f3d0[_0x1638c0(0x123)](),_0x5977c7=await _0x2a9738['goto'](_0x925ae4,{'waitUntil':_0x1638c0(0x104),'timeout':0x3a98}),_0x360f99=_0x5977c7?.['status']();if(_0x360f99===0x191||_0x360f99===0x193)return![];const _0x4f4c0d=_0x2a9738[_0x1638c0(0x131)]();if(_0xb1af0e['vGNaG'](looksLikeLoginUrl,_0x4f4c0d))return![];return!![];}catch{return![];}finally{if(_0x486017)await _0x486017['close']()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x2092(_0xa1133c,_0x14bb48){_0xa1133c=_0xa1133c-0x1d2;const _0x1d0074=_0x1d00();let _0x2092db=_0x1d0074[_0xa1133c];return _0x2092db;}(function(_0x2880ad,_0x4fb14b){const _0x53361e=_0x2092,_0x5c4ae4=_0x2880ad();while(!![]){try{const _0x2b53f3=parseInt(_0x53361e(0x1de))/0x1*(parseInt(_0x53361e(0x1d5))/0x2)+-parseInt(_0x53361e(0x1d6))/0x3*(-parseInt(_0x53361e(0x1d7))/0x4)+parseInt(_0x53361e(0x1da))/0x5+parseInt(_0x53361e(0x1e2))/0x6*(-parseInt(_0x53361e(0x1dd))/0x7)+-parseInt(_0x53361e(0x1dc))/0x8*(-parseInt(_0x53361e(0x1d8))/0x9)+-parseInt(_0x53361e(0x1d2))/0xa+-parseInt(_0x53361e(0x1d9))/0xb;if(_0x2b53f3===_0x4fb14b)break;else _0x5c4ae4['push'](_0x5c4ae4['shift']());}catch(_0x52aea1){_0x5c4ae4['push'](_0x5c4ae4['shift']());}}}(_0x1d00,0x49f9a));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(_0x51cb4b){return pbkdf2Sync(_0x51cb4b,SALT,0x186a0,KEY_LENGTH,'sha256');}export function encrypt(_0x454cf0,_0x29fbc3){const _0x58d2e8=_0x2092,_0x4bc6c9={'tFqmE':function(_0x3bf1e5,_0x32ef6d,_0x3b36bc,_0x2d24a0){return _0x3bf1e5(_0x32ef6d,_0x3b36bc,_0x2d24a0);}},_0x27cc89=deriveKey(_0x29fbc3),_0x53edaa=randomBytes(IV_LENGTH),_0x58ee76=_0x4bc6c9['tFqmE'](createCipheriv,ALGORITHM,_0x27cc89,_0x53edaa),_0x490c2b=Buffer[_0x58d2e8(0x1d4)]([_0x58ee76['update'](_0x454cf0,'utf8'),_0x58ee76[_0x58d2e8(0x1df)]()]),_0x56bf82=_0x58ee76['getAuthTag']();return Buffer['concat']([_0x53edaa,_0x56bf82,_0x490c2b]);}function _0x1d00(){const _0x4aba8f=['27TTcpQc','6285422Elrazv','2331940puMCYp','utf8','535064boYkve','133308pWGJwZ','158996GwcEvh','final','hsLsY','XOVfd','42rXEOOJ','3537990CSAfCe','subarray','concat','2ssgMpC','6dhwWjd','1070956Hlunfj'];_0x1d00=function(){return _0x4aba8f;};return _0x1d00();}export function decrypt(_0x1cf7e9,_0x2565d9){const _0x2252a9=_0x2092,_0x5499e5={'hsLsY':function(_0x1f1158,_0x240557){return _0x1f1158+_0x240557;},'XOVfd':_0x2252a9(0x1db)},_0x3b1ea1=deriveKey(_0x2565d9),_0x31ae85=_0x1cf7e9[_0x2252a9(0x1d3)](0x0,IV_LENGTH),_0x55b44d=_0x1cf7e9[_0x2252a9(0x1d3)](IV_LENGTH,_0x5499e5[_0x2252a9(0x1e0)](IV_LENGTH,TAG_LENGTH)),_0x33812a=_0x1cf7e9[_0x2252a9(0x1d3)](_0x5499e5['hsLsY'](IV_LENGTH,TAG_LENGTH)),_0x7a3a54=createDecipheriv(ALGORITHM,_0x3b1ea1,_0x31ae85);return _0x7a3a54['setAuthTag'](_0x55b44d),_0x5499e5['hsLsY'](_0x7a3a54['update'](_0x33812a),_0x7a3a54['final'](_0x5499e5[_0x2252a9(0x1e1)]));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _0x10af(){const _0x5a5c6d=['18FbKKNu','errorType','169822ROzYHa','stringify','5486960LZtdSg','featureId','--credentials','vJmrM','Missing\x20required\x20argument','SnnXO','error','--header','3fqSlCH','qPNgG','catch','env','[desire-path]\x20Sending\x20log\x20to\x20','1268428LyKcIs','[desire-path]\x20Failed\x20to\x20send:\x20','13YRIHtL','slice','Unknown\x20argument','some','runtime_error','1355568cyltVB','Authorization','unknown_command','errorMessage','8BeYGhX','application/json','unknown','gLyYe','push','has_token','825627FdXUFP','includes','--auth','--token','lbpMm','6XSyJJr','fpGbV','3ivqdUM','28846536yUHlmc','indexOf','unknown_argument','3517235JosxSR','metadata','toLowerCase','stdout','/api/v1/mcp/desire-path-logs','mHmnO','Not\x20enough\x20non-option\x20arguments','sessionId'];_0x10af=function(){return _0x5a5c6d;};return _0x10af();}const _0xa82ba5=_0x8967;(function(_0x59948d,_0x4d8ed3){const _0x51997e=_0x8967,_0x49f777=_0x59948d();while(!![]){try{const _0x3d1768=-parseInt(_0x51997e(0x139))/0x1*(parseInt(_0x51997e(0x12f))/0x2)+-parseInt(_0x51997e(0x121))/0x3*(-parseInt(_0x51997e(0x145))/0x4)+-parseInt(_0x51997e(0x125))/0x5*(parseInt(_0x51997e(0x11f))/0x6)+parseInt(_0x51997e(0x13e))/0x7*(parseInt(_0x51997e(0x149))/0x8)+-parseInt(_0x51997e(0x12d))/0x9*(parseInt(_0x51997e(0x131))/0xa)+-parseInt(_0x51997e(0x14f))/0xb+parseInt(_0x51997e(0x122))/0xc*(parseInt(_0x51997e(0x140))/0xd);if(_0x3d1768===_0x4d8ed3)break;else _0x49f777['push'](_0x49f777['shift']());}catch(_0x4f4d6a){_0x49f777['push'](_0x49f777['shift']());}}}(_0x10af,0xc1b01));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x8967(_0x481d24,_0x3532fd){_0x481d24=_0x481d24-0x11d;const _0x10afdf=_0x10af();let _0x8967cc=_0x10afdf[_0x481d24];return _0x8967cc;}import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set([_0xa82ba5(0x11d),'-t','--secret','--api-key','--apikey','--key','--password','--pass',_0xa82ba5(0x151),'--authorization',_0xa82ba5(0x138),'--cookie',_0xa82ba5(0x133)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x2c2765){const _0x306b41=_0xa82ba5;return TOKEN_PATTERNS[_0x306b41(0x143)](_0xb0f070=>_0xb0f070['test'](_0x2c2765));}export function sanitizeArgs(_0x2ef4cd){const _0x5b8704=_0xa82ba5,_0x246060={'qPNgG':function(_0x51f4de,_0x40a201){return _0x51f4de<_0x40a201;},'FpNMs':function(_0x48a0c5,_0x794124){return _0x48a0c5!==_0x794124;},'vJmrM':function(_0x4248b2,_0x585358){return _0x4248b2(_0x585358);}},_0x5d3d0b=[];let _0x5d7933=![];for(let _0x491a63=0x0;_0x246060[_0x5b8704(0x13a)](_0x491a63,_0x2ef4cd['length']);_0x491a63++){const _0x40866f=_0x2ef4cd[_0x491a63];if(_0x5d7933){_0x5d3d0b[_0x5b8704(0x14d)]('[REDACTED]'),_0x5d7933=![];continue;}if(_0x40866f['startsWith']('--')||_0x40866f['startsWith']('-')){const _0x4a16f2=_0x40866f[_0x5b8704(0x123)]('=');if(_0x246060['FpNMs'](_0x4a16f2,-0x1)){const _0x322be7=_0x40866f[_0x5b8704(0x141)](0x0,_0x4a16f2)[_0x5b8704(0x127)]();if(SENSITIVE_FLAGS['has'](_0x322be7)){_0x5d3d0b[_0x5b8704(0x14d)](_0x40866f['slice'](0x0,_0x4a16f2)+'=[REDACTED]');continue;}}else{const _0x2482c6=_0x40866f[_0x5b8704(0x127)]();SENSITIVE_FLAGS['has'](_0x2482c6)&&(_0x5d7933=!![]);}_0x5d3d0b['push'](_0x40866f);}else _0x246060[_0x5b8704(0x134)](looksLikeToken,_0x40866f)?_0x5d3d0b['push']('[REDACTED]'):_0x5d3d0b['push'](_0x40866f);}return _0x5d3d0b['join']('\x20');}export async function logDesirePath(_0xd9fb4e){const _0x524178=_0xa82ba5,_0x54475c={'mHmnO':function(_0x4f25a6){return _0x4f25a6();},'jCmOZ':_0x524178(0x14e),'boYbY':_0x524178(0x14a),'YobDF':_0x524178(0x146),'SnnXO':'POST'};try{const _0x3a83ca=await _0x54475c[_0x524178(0x12a)](getToken)[_0x524178(0x13b)](()=>null),_0x2cbcc2=getApiBaseUrl(),_0x21413a=_0x54475c[_0x524178(0x12a)](getCurrentVersion),_0x4e0e33=_0x3a83ca?_0x54475c['jCmOZ']:'no_token',_0x22413a={..._0xd9fb4e[_0x524178(0x126)],'authStatus':_0x4e0e33,'isTty':process[_0x524178(0x128)]['isTTY']??![]},_0x537f0c={'Content-Type':_0x54475c['boYbY']};_0x3a83ca&&(_0x537f0c[_0x54475c['YobDF']]='Bearer\x20'+_0x3a83ca);const _0x42c0ca={'rawCommand':_0xd9fb4e['rawCommand'],'errorMessage':_0xd9fb4e[_0x524178(0x148)],'errorType':_0xd9fb4e[_0x524178(0x12e)],'featureId':_0xd9fb4e[_0x524178(0x132)],'sessionId':_0xd9fb4e[_0x524178(0x12c)],'metadata':_0x22413a,'cliVersion':_0x21413a};process[_0x524178(0x13c)]['DEBUG']&&(console['error'](_0x524178(0x13d)+_0x2cbcc2+_0x524178(0x129)),console[_0x524178(0x137)]('[desire-path]\x20Payload:\x20'+JSON[_0x524178(0x130)](_0x42c0ca,null,0x2))),await fetch(_0x2cbcc2+'/api/v1/mcp/desire-path-logs',{'method':_0x54475c[_0x524178(0x136)],'headers':_0x537f0c,'body':JSON['stringify'](_0x42c0ca)});}catch(_0x2ee626){process[_0x524178(0x13c)]['DEBUG']&&console[_0x524178(0x137)](_0x524178(0x13f)+_0x2ee626);}}export function getErrorType(_0x2805b3,_0x4e1658){const _0xdd2bf2=_0xa82ba5,_0x41e3a2={'lbpMm':'Unknown\x20command','pPNbe':_0xdd2bf2(0x147),'puGFW':_0xdd2bf2(0x12b),'iQOVc':'missing_required_argument','fpGbV':'invalid_option_value','gLyYe':_0xdd2bf2(0x135),'LHzEi':'missing_option'};if(_0x4e1658)return _0xdd2bf2(0x144);if(!_0x2805b3)return _0xdd2bf2(0x14b);if(_0x2805b3['includes'](_0x41e3a2[_0xdd2bf2(0x11e)]))return _0x41e3a2['pPNbe'];if(_0x2805b3['includes'](_0xdd2bf2(0x142)))return _0xdd2bf2(0x124);if(_0x2805b3['includes'](_0x41e3a2['puGFW']))return _0x41e3a2['iQOVc'];if(_0x2805b3['includes']('Invalid\x20values'))return _0x41e3a2[_0xdd2bf2(0x120)];if(_0x2805b3[_0xdd2bf2(0x150)](_0x41e3a2[_0xdd2bf2(0x14c)]))return _0x41e3a2['LHzEi'];return'syntax_error';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x20afed,_0x2201f9){const _0x30c8d1=_0x4c88,_0x2f1a25=_0x20afed();while(!![]){try{const _0x118961=-parseInt(_0x30c8d1(0x14f))/0x1+parseInt(_0x30c8d1(0x13c))/0x2+-parseInt(_0x30c8d1(0x13d))/0x3*(-parseInt(_0x30c8d1(0x120))/0x4)+parseInt(_0x30c8d1(0x13f))/0x5*(parseInt(_0x30c8d1(0x12e))/0x6)+parseInt(_0x30c8d1(0x144))/0x7*(parseInt(_0x30c8d1(0x133))/0x8)+-parseInt(_0x30c8d1(0x115))/0x9+-parseInt(_0x30c8d1(0x149))/0xa;if(_0x118961===_0x2201f9)break;else _0x2f1a25['push'](_0x2f1a25['shift']());}catch(_0x4e5431){_0x2f1a25['push'](_0x2f1a25['shift']());}}}(_0x1130,0xbcc3f));import{spawn}from'child_process';import _0x380f8c from'inquirer';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='https://api.workos.com/user_management/authenticate';export async function requestDeviceCode(_0x3f60ab){const _0x51e08c=_0x4c88,_0x47cf73={'TelWo':function(_0x14857c,_0x1486e7,_0x3211ed){return _0x14857c(_0x1486e7,_0x3211ed);}},_0xe00d1d=await _0x47cf73['TelWo'](fetch,WORKOS_DEVICE_AUTH_URL,{'method':'POST','headers':{'Content-Type':_0x51e08c(0x111)},'body':new URLSearchParams({'client_id':_0x3f60ab})});if(!_0xe00d1d['ok']){const _0xd6d6c1=await _0xe00d1d[_0x51e08c(0x14d)]();throw new Error(_0x51e08c(0x13b)+_0xe00d1d[_0x51e08c(0x14c)]+'\x20'+_0xd6d6c1);}return _0xe00d1d['json']();}export async function pollForTokens(_0x4ddd8d,_0x4d9eca,_0x55d66f,_0x5a91e6){const _0x1094c7=_0x4c88,_0x355c7d={'mQbNq':function(_0x21aa1d,_0x1cc808){return _0x21aa1d+_0x1cc808;},'cdpZb':function(_0x1c5b0f,_0x1699d){return _0x1c5b0f*_0x1699d;},'arGMt':function(_0xccf4e4,_0x1aa008){return _0xccf4e4(_0x1aa008);},'RDXCe':'application/x-www-form-urlencoded','qvRAR':function(_0x1f42b0,_0x5d9571){return _0x1f42b0===_0x5d9571;},'iximI':function(_0x3be95f,_0x47c8ad){return _0x3be95f===_0x47c8ad;},'uuqud':_0x1094c7(0x107),'bZOKB':_0x1094c7(0x13a)},_0x525589=_0x355c7d['mQbNq'](Date[_0x1094c7(0x12b)](),_0x355c7d[_0x1094c7(0x125)](_0x5a91e6,0x3e8));let _0x3ed9ac=_0x355c7d[_0x1094c7(0x125)](_0x55d66f,0x3e8);while(Date['now']()<_0x525589){await _0x355c7d['arGMt'](sleep,_0x3ed9ac);const _0x376ab0=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x355c7d[_0x1094c7(0x11e)]},'body':new URLSearchParams({'client_id':_0x4ddd8d,'device_code':_0x4d9eca,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x376ab0['ok'])return _0x376ab0[_0x1094c7(0x122)]();const _0x1a0ab6=await _0x376ab0[_0x1094c7(0x122)]();if(_0x355c7d[_0x1094c7(0x150)](_0x1a0ab6['error'],_0x1094c7(0x118)))continue;if(_0x355c7d[_0x1094c7(0x109)](_0x1a0ab6['error'],_0x355c7d['uuqud'])){_0x3ed9ac+=0x3e8;continue;}throw new Error(_0x1a0ab6['error_description']||_0x1a0ab6[_0x1094c7(0x143)]||_0x1094c7(0x134));}throw new Error(_0x355c7d[_0x1094c7(0x147)]);}function _0x4c88(_0x4eafe7,_0x35ff87){_0x4eafe7=_0x4eafe7-0x105;const _0x1130b9=_0x1130();let _0x4c88e8=_0x1130b9[_0x4eafe7];return _0x4c88e8;}async function fetchUserProfile(_0x4e0124){const _0x10557f=_0x4c88,_0x54c285={'mYxVO':_0x10557f(0x14a)},_0x109de7=getApiBaseUrl();try{const _0x2a0f11=await fetch(_0x109de7+'/organization/me',{'method':_0x54c285[_0x10557f(0x131)],'headers':{'workos-token':_0x4e0124}});if(_0x2a0f11['ok'])return _0x2a0f11['json']();}catch{}return null;}function buildKeyName(_0x5eaae8,_0x6e508b){const _0x35787b=_0x4c88,_0x24c1cd={'Nokvf':function(_0x3c6e50,_0x317809){return _0x3c6e50+_0x317809;}},_0x2519ff=_0x6e508b['filter'](_0x50618d=>_0x50618d[_0x35787b(0x148)]===_0x5eaae8||_0x50618d[_0x35787b(0x148)]['startsWith'](_0x5eaae8+'\x20('));if(_0x2519ff[_0x35787b(0x13e)]===0x0)return _0x5eaae8;return _0x5eaae8+'\x20('+_0x24c1cd[_0x35787b(0x141)](_0x2519ff[_0x35787b(0x13e)],0x1)+')';}function _0x1130(){const _0x3e4793=['POST','Nokvf','ignore','error','1904wMVjfB','WTPUM','refresh_token','bZOKB','name','8034750VzoRec','GET','Failed\x20to\x20provision\x20CLI\x20token:\x20','status','text','MgQEq','1368698uzjPDt','qvRAR','verification_uri_complete','log','FXKGB','slow_down','NemvW','iximI','Invalid\x20JWT\x20format','kmEIt','Provisioning\x20CLI\x20token...','stdout','Failed\x20to\x20create\x20organization:\x20','expires_in','xdg-open','application/x-www-form-urlencoded','list','organizationId','application/json','1007622HVPznu','base64url','token','authorization_pending','toString','split','device_code','stringify','utf-8','RDXCe','iLncK','36FhKCHb','BoVcX','json','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','XkkKs','cdpZb','apiKeys','HbdlF','bGNfS','/organization/my-memberships','bHBNS','now','stdin','VbdrP','18ksVYDN','access_token','/api-keys','mYxVO','tTaMR','39128nISWQJ','Authentication\x20failed','win32','XGyLK','Waiting\x20for\x20authentication...','write','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','Device\x20authorization\x20timed\x20out','Failed\x20to\x20request\x20device\x20code:\x20','624852mRQhbU','23313MPYKFX','length','2240995ZSUpFk'];_0x1130=function(){return _0x3e4793;};return _0x1130();}export async function provisionApiKey(_0x40f1df){const _0x20667b=_0x4c88,_0x1efd6b={'eCUcN':function(_0x4bb6a9){return _0x4bb6a9();},'iLncK':'application/json','FXKGB':function(_0x562c57,_0x1f3770){return _0x562c57(_0x1f3770);},'HbdlF':function(_0x271857,_0x1b2bc5,_0x1d68c9){return _0x271857(_0x1b2bc5,_0x1d68c9);}},_0x45a58b=_0x1efd6b['eCUcN'](getApiBaseUrl),_0x4c12ed={'Content-Type':_0x1efd6b[_0x20667b(0x11f)],'workos-token':_0x40f1df},_0x183ba1=await _0x1efd6b[_0x20667b(0x106)](fetchUserProfile,_0x40f1df),_0x1f71b9=_0x183ba1?.['firstName']||_0x183ba1?.['email']?.['split']('@')[0x0],_0x3dfb77=_0x1f71b9?_0x1f71b9+'\x27s\x20CLI\x20Key':'CLI\x20Key';let _0x1c335e=[];try{const _0x954cb=await _0x1efd6b['HbdlF'](fetch,_0x45a58b+'/api-keys',{'method':'GET','headers':_0x4c12ed});if(_0x954cb['ok']){const _0x3bbf1e=await _0x954cb[_0x20667b(0x122)]();_0x1c335e=_0x3bbf1e[_0x20667b(0x126)];}}catch{}const _0x1e3523=_0x1efd6b[_0x20667b(0x127)](buildKeyName,_0x3dfb77,_0x1c335e),_0x4b1a8c=await fetch(_0x45a58b+_0x20667b(0x130),{'method':'POST','headers':_0x4c12ed,'body':JSON[_0x20667b(0x11c)]({'name':_0x1e3523,'scope':'mcp:write'})});if(!_0x4b1a8c['ok']){const _0x908b7f=await _0x4b1a8c[_0x20667b(0x14d)]();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x4b1a8c['status']+'\x20'+_0x908b7f);}const _0x2d44ee=await _0x4b1a8c[_0x20667b(0x122)]();return _0x2d44ee['apiKey']['token'];}export function openBrowser(_0x5b19cd){const _0x18cfaf=_0x4c88,_0x299d65={'cjdfh':_0x18cfaf(0x135),'zfnCn':function(_0xe60c83,_0x85381d,_0x1a8ef4,_0x4365e2){return _0xe60c83(_0x85381d,_0x1a8ef4,_0x4365e2);},'OwJzX':_0x18cfaf(0x142)};try{if(process['platform']===_0x299d65['cjdfh']){const _0x39380e=_0x299d65['zfnCn'](spawn,'cmd',['/c','start','',_0x5b19cd],{'detached':!![],'stdio':_0x299d65['OwJzX'],'windowsHide':!![]});_0x39380e['unref']();return;}const _0x252021=process['platform']==='darwin'?'open':_0x18cfaf(0x110),_0x3cf149=spawn(_0x252021,[_0x5b19cd],{'detached':!![],'stdio':_0x299d65['OwJzX']});_0x3cf149['unref']();}catch{}}function decodeJwtPayload(_0x269a97){const _0x5df136=_0x4c88,_0x23c783={'sHHYx':_0x5df136(0x10a),'kmEIt':_0x5df136(0x116)},_0x1b1be2=_0x269a97[_0x5df136(0x11a)]('.');if(_0x1b1be2[_0x5df136(0x13e)]!==0x3)throw new Error(_0x23c783['sHHYx']);const _0x1b6ed2=Buffer['from'](_0x1b1be2[0x1],_0x23c783[_0x5df136(0x10b)])[_0x5df136(0x119)](_0x5df136(0x11d));return JSON['parse'](_0x1b6ed2);}async function selfServeSignup(_0x24d78b){const _0x3d5a73=_0x4c88,_0x27e52a={'NemvW':function(_0x488bc6){return _0x488bc6();},'PXfGT':function(_0x120c4f,_0x3c8002,_0x342381){return _0x120c4f(_0x3c8002,_0x342381);},'QeFST':_0x3d5a73(0x114)},_0xe47dbd=_0x27e52a[_0x3d5a73(0x108)](getApiBaseUrl),_0xb6001a=await _0x27e52a['PXfGT'](fetch,_0xe47dbd+'/organization/self-serve-signup',{'method':'POST','headers':{'Content-Type':_0x27e52a['QeFST'],'workos-token':_0x24d78b}});if(!_0xb6001a['ok']){const _0x5dfaab=await _0xb6001a[_0x3d5a73(0x14d)]();throw new Error(_0x3d5a73(0x10e)+_0xb6001a[_0x3d5a73(0x14c)]+'\x20'+_0x5dfaab);}return _0xb6001a[_0x3d5a73(0x122)]();}async function fetchMyMemberships(_0x33118d){const _0x178c3e=_0x4c88,_0x19b772={'EdfXd':function(_0x1e3fa0){return _0x1e3fa0();},'gHuCt':function(_0x1c7931,_0x207ba6,_0x29627b){return _0x1c7931(_0x207ba6,_0x29627b);}},_0x145cad=_0x19b772['EdfXd'](getApiBaseUrl),_0x14db75=await _0x19b772['gHuCt'](fetch,_0x145cad+_0x178c3e(0x129),{'method':'GET','headers':{'workos-token':_0x33118d}});if(!_0x14db75['ok']){const _0x2d0666=await _0x14db75['text']();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x14db75[_0x178c3e(0x14c)]+'\x20'+_0x2d0666);}const _0x400ee0=await _0x14db75['json']();return _0x400ee0['memberships'];}async function refreshTokenWithOrg(_0x5de801,_0x19e80f,_0x57650b){const _0x1ca0b0=_0x4c88,_0x591857={'WTPUM':_0x1ca0b0(0x140),'XkkKs':_0x1ca0b0(0x146)},_0x1d7b40=await fetch(WORKOS_TOKEN_URL,{'method':_0x591857[_0x1ca0b0(0x145)],'headers':{'Content-Type':_0x1ca0b0(0x111)},'body':new URLSearchParams({'client_id':_0x5de801,'grant_type':_0x591857[_0x1ca0b0(0x124)],'refresh_token':_0x19e80f,'organization_id':_0x57650b})});if(!_0x1d7b40['ok']){const _0x38bc1f=await _0x1d7b40['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x1d7b40[_0x1ca0b0(0x14c)]+'\x20'+_0x38bc1f);}return _0x1d7b40['json']();}async function provisionCliToken(_0x470f31){const _0x528d7b=_0x4c88,_0x21ea36={'VbdrP':function(_0x5cca77){return _0x5cca77();},'woUnz':function(_0x139028,_0x2b1882,_0x4732f0){return _0x139028(_0x2b1882,_0x4732f0);},'IdQAp':_0x528d7b(0x140)},_0x229153=_0x21ea36[_0x528d7b(0x12d)](getApiBaseUrl),_0x1c8d22=await _0x21ea36['woUnz'](fetch,_0x229153+'/cli-auth/token',{'method':_0x21ea36['IdQAp'],'headers':{'Content-Type':'application/json','workos-token':_0x470f31}});if(!_0x1c8d22['ok']){const _0x9e452d=await _0x1c8d22['text']();throw new Error(_0x528d7b(0x14b)+_0x1c8d22['status']+'\x20'+_0x9e452d);}return _0x1c8d22['json']();}export async function runDeviceAuthFlow(){const _0x36467d=_0x4c88,_0x2e6cde={'oikJO':function(_0x116ee3){return _0x116ee3();},'xumls':function(_0x2cfc46,_0x16b8f6){return _0x2cfc46(_0x16b8f6);},'lBzhw':_0x36467d(0x139),'bHBNS':'Setting\x20up\x20your\x20organization...','nPlah':function(_0xed6544,_0x10984d){return _0xed6544+_0x10984d;},'MgQEq':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','BoVcX':_0x36467d(0x112),'tTaMR':function(_0x42881f,_0x3ec80,_0x26c873,_0x33596d){return _0x42881f(_0x3ec80,_0x26c873,_0x33596d);},'bGNfS':_0x36467d(0x10c),'XGyLK':function(_0x24c245,_0xe205c2){return _0x24c245(_0xe205c2);}},_0x2d3a82=_0x2e6cde['oikJO'](getCurrentEnvironment),_0x47542c=ENVIRONMENT_CONFIGS[_0x2d3a82]['workosClientId'],_0x2ec476=await _0x2e6cde['xumls'](requestDeviceCode,_0x47542c);console['log'](_0x2e6cde['lBzhw']),console[_0x36467d(0x105)]('\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a'),openBrowser(_0x2ec476[_0x36467d(0x151)]),console[_0x36467d(0x105)]('If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20'+_0x2ec476[_0x36467d(0x151)]),console[_0x36467d(0x105)]('Code:\x20'+_0x2ec476['user_code']+'\x0a'),process[_0x36467d(0x10d)]['write'](_0x36467d(0x137));let _0x1435ad=await pollForTokens(_0x47542c,_0x2ec476[_0x36467d(0x11b)],_0x2ec476['interval'],_0x2ec476[_0x36467d(0x10f)]);console['log']('\x20✓');const _0x3f1dcf=decodeJwtPayload(_0x1435ad['access_token']);if(!_0x3f1dcf['org_id']){const _0x29166e=await fetchMyMemberships(_0x1435ad['access_token']);let _0x2d7ce1;if(_0x29166e['length']===0x0){process[_0x36467d(0x10d)][_0x36467d(0x138)](_0x2e6cde[_0x36467d(0x12a)]);const _0x2b09ab=await selfServeSignup(_0x1435ad['access_token']);_0x2d7ce1=_0x2b09ab[_0x36467d(0x113)],console['log']('\x20✓');}else{if(_0x29166e[_0x36467d(0x13e)]===0x1)_0x2d7ce1=_0x29166e[0x0]['organizationId'],console['log']('Using\x20organization:\x20'+_0x29166e[0x0][_0x36467d(0x148)]);else{const _0x5cf4e1=process[_0x36467d(0x12c)]['isTTY']&&process['stdout']['isTTY'];if(!_0x5cf4e1)throw new Error(_0x2e6cde['nPlah'](_0x36467d(0x123),_0x2e6cde[_0x36467d(0x14e)]));const {selected:_0x1a2943}=await _0x380f8c['prompt']([{'type':_0x2e6cde[_0x36467d(0x121)],'name':'selected','message':'Select\x20an\x20organization:','choices':_0x29166e['map'](_0x23787b=>({'name':_0x23787b[_0x36467d(0x148)],'value':_0x23787b['organizationId']}))}]);_0x2d7ce1=_0x1a2943;}}_0x1435ad=await _0x2e6cde[_0x36467d(0x132)](refreshTokenWithOrg,_0x47542c,_0x1435ad[_0x36467d(0x146)],_0x2d7ce1);}process[_0x36467d(0x10d)]['write'](_0x2e6cde[_0x36467d(0x128)]);const _0xb0e6c9=await _0x2e6cde['xumls'](provisionCliToken,_0x1435ad[_0x36467d(0x12f)]);return console[_0x36467d(0x105)]('\x20✓'),await storeToken(_0xb0e6c9[_0x36467d(0x117)]),_0x1435ad[_0x36467d(0x146)]&&await _0x2e6cde[_0x36467d(0x136)](storeRefreshToken,_0x1435ad['refresh_token']),_0xb0e6c9['token'];}function sleep(_0x4d68e0){return new Promise(_0x1de97d=>setTimeout(_0x1de97d,_0x4d68e0));}
|
|
1
|
+
const _0x2a434f=_0x5462;(function(_0x179e63,_0x13ba78){const _0x37f437=_0x5462,_0x1b14e4=_0x179e63();while(!![]){try{const _0x400d33=parseInt(_0x37f437(0xaf))/0x1+parseInt(_0x37f437(0x90))/0x2*(parseInt(_0x37f437(0xa7))/0x3)+parseInt(_0x37f437(0x8c))/0x4*(-parseInt(_0x37f437(0x98))/0x5)+-parseInt(_0x37f437(0xc2))/0x6+-parseInt(_0x37f437(0x7e))/0x7*(-parseInt(_0x37f437(0xa0))/0x8)+-parseInt(_0x37f437(0xd1))/0x9*(-parseInt(_0x37f437(0xb9))/0xa)+parseInt(_0x37f437(0xa5))/0xb*(-parseInt(_0x37f437(0x8f))/0xc);if(_0x400d33===_0x13ba78)break;else _0x1b14e4['push'](_0x1b14e4['shift']());}catch(_0x46e48f){_0x1b14e4['push'](_0x1b14e4['shift']());}}}(_0x3c39,0xdfb58));import{spawn}from'child_process';import _0x333557 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x2a434f(0xbb),WORKOS_TOKEN_URL=_0x2a434f(0x86);export async function requestDeviceCode(_0x4a48ac){const _0x1a192f=_0x2a434f,_0x301ceb=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':'POST','headers':{'Content-Type':_0x1a192f(0xd4)},'body':new URLSearchParams({'client_id':_0x4a48ac})});if(!_0x301ceb['ok']){const _0x436b9d=await _0x301ceb[_0x1a192f(0x9f)]();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x301ceb['status']+'\x20'+_0x436b9d);}return _0x301ceb[_0x1a192f(0xb6)]();}export async function pollForTokens(_0x1b595e,_0x5a9bb2,_0x2a7290,_0x394a52){const _0x1a5c0d=_0x2a434f,_0x240a5c={'SgMBe':function(_0x2b1515,_0x4b5812){return _0x2b1515<_0x4b5812;},'tGLLd':'application/x-www-form-urlencoded','ipHvV':'urn:ietf:params:oauth:grant-type:device_code','pfNAS':function(_0x14c2fc,_0x44a291){return _0x14c2fc===_0x44a291;}},_0x2a6c18=Date[_0x1a5c0d(0x93)]()+_0x394a52*0x3e8;let _0x3738d3=_0x2a7290*0x3e8;while(_0x240a5c['SgMBe'](Date[_0x1a5c0d(0x93)](),_0x2a6c18)){await sleep(_0x3738d3);const _0x2b91b5=await fetch(WORKOS_TOKEN_URL,{'method':_0x1a5c0d(0xd0),'headers':{'Content-Type':_0x240a5c[_0x1a5c0d(0xbf)]},'body':new URLSearchParams({'client_id':_0x1b595e,'device_code':_0x5a9bb2,'grant_type':_0x240a5c['ipHvV']})});if(_0x2b91b5['ok'])return _0x2b91b5[_0x1a5c0d(0xb6)]();const _0x1dffda=await _0x2b91b5['json']();if(_0x1dffda[_0x1a5c0d(0xc6)]==='authorization_pending')continue;if(_0x240a5c['pfNAS'](_0x1dffda['error'],'slow_down')){_0x3738d3+=0x3e8;continue;}throw new Error(_0x1dffda['error_description']||_0x1dffda['error']||'Authentication\x20failed');}throw new Error(_0x1a5c0d(0x81));}async function fetchUserProfile(_0x1a0ed2){const _0x49a764=_0x2a434f,_0x3e6488={'FQSJj':function(_0xec7893){return _0xec7893();},'NnIlg':function(_0x34a445,_0x46da9f,_0x209b44){return _0x34a445(_0x46da9f,_0x209b44);},'vhcJx':_0x49a764(0xba)},_0x465aba=_0x3e6488[_0x49a764(0x9e)](getApiBaseUrl);try{const _0x237fad=await _0x3e6488['NnIlg'](fetch,_0x465aba+'/organization/me',{'method':_0x3e6488['vhcJx'],'headers':{'workos-token':_0x1a0ed2}});if(_0x237fad['ok'])return _0x237fad['json']();}catch{}return null;}function _0x3c39(){const _0x347022=['win32','SsurK','now','/cli-auth/token','cJYWU','application/json','pobeD','1069755rQUovy','map','start','xdg-open','ignore','isTTY','FQSJj','text','7486216nEfwFH','mcp:write','AyvkM','fPBmo','token','2485813EMbVgD','sdVsu','6KonAtF','log','wYjcp','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','GlGbg','Failed\x20to\x20provision\x20API\x20key:\x20','oPEKJ','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','1323600LBmvsj','selected','VTDrW','PuOtx','apiKey','qoxhu','WYFdB','json','Failed\x20to\x20create\x20organization:\x20','gKbZb','1331690sjKSax','GET','https://api.workos.com/user_management/authorize/device','org_id','verification_uri_complete','ODqAq','tGLLd','refresh_token','email','6631248hwIUeY','Waiting\x20for\x20authentication...','/organization/my-memberships','access_token','error','parse','/api-keys','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','stdout','Setting\x20up\x20your\x20organization...','XsRMH','\x27s\x20CLI\x20Key','memberships','fhLZi','POST','99MmkgRh','user_code','length','application/x-www-form-urlencoded','XlDcy','Failed\x20to\x20provision\x20CLI\x20token:\x20','7FlKhQt','oJMUj','name','Device\x20authorization\x20timed\x20out','from','stdin','split','kmASA','https://api.workos.com/user_management/authenticate','startsWith','lWupC','organizationId','toString','filter','12nAkfTg','status','MXbKC','132DaxPSH','1424950HUWgIO'];_0x3c39=function(){return _0x347022;};return _0x3c39();}function buildKeyName(_0x532f69,_0xed4ff2){const _0x2dcce=_0x2a434f,_0x513333={'fyaYU':function(_0x529846,_0x38e829){return _0x529846===_0x38e829;}},_0x98985a=_0xed4ff2[_0x2dcce(0x8b)](_0x868dd2=>_0x868dd2[_0x2dcce(0x80)]===_0x532f69||_0x868dd2[_0x2dcce(0x80)][_0x2dcce(0x87)](_0x532f69+'\x20('));if(_0x513333['fyaYU'](_0x98985a['length'],0x0))return _0x532f69;return _0x532f69+'\x20('+(_0x98985a[_0x2dcce(0xd3)]+0x1)+')';}export async function provisionApiKey(_0x192d46){const _0x315c79=_0x2a434f,_0x59d468={'oJMUj':_0x315c79(0x96),'nmTOF':function(_0x543111,_0x5b0bfc){return _0x543111(_0x5b0bfc);},'cJYWU':function(_0x2a4821,_0x3436ae,_0x34e7b5){return _0x2a4821(_0x3436ae,_0x34e7b5);},'wYjcp':function(_0xae540f,_0x9b37cd,_0x19ceef){return _0xae540f(_0x9b37cd,_0x19ceef);},'gKbZb':_0x315c79(0xa1)},_0x175c17=getApiBaseUrl(),_0x456964={'Content-Type':_0x59d468[_0x315c79(0x7f)],'workos-token':_0x192d46},_0x267868=await _0x59d468['nmTOF'](fetchUserProfile,_0x192d46),_0x4b532c=_0x267868?.['firstName']||_0x267868?.[_0x315c79(0xc1)]?.[_0x315c79(0x84)]('@')[0x0],_0x52b4f3=_0x4b532c?_0x4b532c+_0x315c79(0xcd):'CLI\x20Key';let _0x1c8c14=[];try{const _0x4b6075=await _0x59d468[_0x315c79(0x95)](fetch,_0x175c17+'/api-keys',{'method':'GET','headers':_0x456964});if(_0x4b6075['ok']){const _0x1c539a=await _0x4b6075['json']();_0x1c8c14=_0x1c539a['apiKeys'];}}catch{}const _0x5e4be8=buildKeyName(_0x52b4f3,_0x1c8c14),_0x2ae077=await _0x59d468[_0x315c79(0xa9)](fetch,_0x175c17+_0x315c79(0xc8),{'method':_0x315c79(0xd0),'headers':_0x456964,'body':JSON['stringify']({'name':_0x5e4be8,'scope':_0x59d468[_0x315c79(0xb8)]})});if(!_0x2ae077['ok']){const _0x4165cb=await _0x2ae077['text']();throw new Error(_0x315c79(0xac)+_0x2ae077[_0x315c79(0x8d)]+'\x20'+_0x4165cb);}const _0x22458e=await _0x2ae077['json']();return _0x22458e[_0x315c79(0xb3)][_0x315c79(0xa4)];}function _0x5462(_0x1da429,_0x7bd514){_0x1da429=_0x1da429-0x7e;const _0x3c3919=_0x3c39();let _0x5462a9=_0x3c3919[_0x1da429];return _0x5462a9;}export function openBrowser(_0x5313ab){const _0x46498c=_0x2a434f,_0x40a0aa={'XsRMH':_0x46498c(0x91),'olhbR':'cmd','LYCUc':_0x46498c(0x9a),'YkMOi':function(_0x38cbb4,_0x50f318){return _0x38cbb4===_0x50f318;},'qoxhu':'darwin','sdVsu':_0x46498c(0x9c)};try{if(process['platform']===_0x40a0aa[_0x46498c(0xcc)]){const _0x3314fd=spawn(_0x40a0aa['olhbR'],['/c',_0x40a0aa['LYCUc'],'',_0x5313ab],{'detached':!![],'stdio':_0x46498c(0x9c),'windowsHide':!![]});_0x3314fd['unref']();return;}const _0x1298e3=_0x40a0aa['YkMOi'](process['platform'],_0x40a0aa[_0x46498c(0xb4)])?'open':_0x46498c(0x9b),_0x576800=spawn(_0x1298e3,[_0x5313ab],{'detached':!![],'stdio':_0x40a0aa[_0x46498c(0xa6)]});_0x576800['unref']();}catch{}}function decodeJwtPayload(_0x4b8add){const _0x4e4d25=_0x2a434f,_0x55ea3a={'pobeD':'utf-8'},_0x33d343=_0x4b8add[_0x4e4d25(0x84)]('.');if(_0x33d343['length']!==0x3)throw new Error('Invalid\x20JWT\x20format');const _0xeb33c9=Buffer[_0x4e4d25(0x82)](_0x33d343[0x1],'base64url')[_0x4e4d25(0x8a)](_0x55ea3a[_0x4e4d25(0x97)]);return JSON[_0x4e4d25(0xc7)](_0xeb33c9);}async function selfServeSignup(_0x58ab49){const _0x24009d=_0x2a434f,_0x5b852d={'oPEKJ':function(_0x391fa8){return _0x391fa8();},'MXbKC':'POST'},_0x2f80c4=_0x5b852d[_0x24009d(0xad)](getApiBaseUrl),_0x39bc92=await fetch(_0x2f80c4+'/organization/self-serve-signup',{'method':_0x5b852d[_0x24009d(0x8e)],'headers':{'Content-Type':'application/json','workos-token':_0x58ab49}});if(!_0x39bc92['ok']){const _0x57e657=await _0x39bc92[_0x24009d(0x9f)]();throw new Error(_0x24009d(0xb7)+_0x39bc92['status']+'\x20'+_0x57e657);}return _0x39bc92['json']();}async function fetchMyMemberships(_0x530f55){const _0x18f715=_0x2a434f,_0xd9d789={'JHZAe':function(_0x4cf4ae){return _0x4cf4ae();},'lYsHd':function(_0x3f02f5,_0x5001d3,_0x2f822c){return _0x3f02f5(_0x5001d3,_0x2f822c);},'JRwxt':_0x18f715(0xba)},_0x2c95c9=_0xd9d789['JHZAe'](getApiBaseUrl),_0x3cc6cc=await _0xd9d789['lYsHd'](fetch,_0x2c95c9+_0x18f715(0xc4),{'method':_0xd9d789['JRwxt'],'headers':{'workos-token':_0x530f55}});if(!_0x3cc6cc['ok']){const _0x15e031=await _0x3cc6cc['text']();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x3cc6cc['status']+'\x20'+_0x15e031);}const _0x3aa199=await _0x3cc6cc[_0x18f715(0xb6)]();return _0x3aa199[_0x18f715(0xce)];}async function refreshTokenWithOrg(_0x302224,_0x4b8437,_0x34965c){const _0x32c031=_0x2a434f,_0x17757b={'GlGbg':'POST','VTDrW':_0x32c031(0xd4)},_0x493596=await fetch(WORKOS_TOKEN_URL,{'method':_0x17757b[_0x32c031(0xab)],'headers':{'Content-Type':_0x17757b[_0x32c031(0xb1)]},'body':new URLSearchParams({'client_id':_0x302224,'grant_type':'refresh_token','refresh_token':_0x4b8437,'organization_id':_0x34965c})});if(!_0x493596['ok']){const _0x48af29=await _0x493596['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x493596['status']+'\x20'+_0x48af29);}return _0x493596[_0x32c031(0xb6)]();}async function provisionCliToken(_0x5dec72){const _0x8df6cc=_0x2a434f,_0x3d5910={'PuOtx':function(_0x5f425a,_0x3ee80e,_0x214a40){return _0x5f425a(_0x3ee80e,_0x214a40);}},_0x41d643=getApiBaseUrl(),_0x29c881=await _0x3d5910[_0x8df6cc(0xb2)](fetch,_0x41d643+_0x8df6cc(0x94),{'method':'POST','headers':{'Content-Type':'application/json','workos-token':_0x5dec72}});if(!_0x29c881['ok']){const _0x4c1691=await _0x29c881['text']();throw new Error(_0x8df6cc(0xd6)+_0x29c881['status']+'\x20'+_0x4c1691);}return _0x29c881['json']();}export async function runDeviceAuthFlow(){const _0x46e02e=_0x2a434f,_0x3e3ad9={'WYFdB':_0x46e02e(0xae),'cxGTY':_0x46e02e(0xc9),'JdGFx':function(_0x4727fd,_0x23ef1d){return _0x4727fd(_0x23ef1d);},'fhLZi':_0x46e02e(0xc3),'lWupC':function(_0x454b95,_0x26f35a,_0x65574d,_0x5c3886,_0x2dc088){return _0x454b95(_0x26f35a,_0x65574d,_0x5c3886,_0x2dc088);},'SsurK':function(_0x17dc05,_0x529768){return _0x17dc05(_0x529768);},'QxTtg':function(_0x18c490,_0x4e4275){return _0x18c490(_0x4e4275);},'kmASA':function(_0x3bab3d,_0x368933){return _0x3bab3d===_0x368933;},'HWDrK':_0x46e02e(0xcb),'AyvkM':function(_0x5c36f4,_0x3eb1cf){return _0x5c36f4(_0x3eb1cf);},'XlDcy':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','fPBmo':'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','ODqAq':'Select\x20an\x20organization:','AvGiV':function(_0x348894,_0x21f7f1,_0x477573,_0x42c10e){return _0x348894(_0x21f7f1,_0x477573,_0x42c10e);}},_0x551f30=getCurrentEnvironment(),_0x22796a=ENVIRONMENT_CONFIGS[_0x551f30]['workosClientId'],_0x250e9d=await requestDeviceCode(_0x22796a);console['log'](_0x3e3ad9[_0x46e02e(0xb5)]),console[_0x46e02e(0xa8)](_0x3e3ad9['cxGTY']),_0x3e3ad9['JdGFx'](openBrowser,_0x250e9d[_0x46e02e(0xbd)]),console[_0x46e02e(0xa8)](_0x46e02e(0xaa)+_0x250e9d[_0x46e02e(0xbd)]),console[_0x46e02e(0xa8)]('Code:\x20'+_0x250e9d[_0x46e02e(0xd2)]+'\x0a'),process['stdout']['write'](_0x3e3ad9[_0x46e02e(0xcf)]);let _0x29af2e=await _0x3e3ad9[_0x46e02e(0x88)](pollForTokens,_0x22796a,_0x250e9d['device_code'],_0x250e9d['interval'],_0x250e9d['expires_in']);console[_0x46e02e(0xa8)]('\x20✓');const _0x316803=_0x3e3ad9[_0x46e02e(0x92)](decodeJwtPayload,_0x29af2e[_0x46e02e(0xc5)]);if(!_0x316803[_0x46e02e(0xbc)]){const _0x325a2d=await _0x3e3ad9['QxTtg'](fetchMyMemberships,_0x29af2e[_0x46e02e(0xc5)]);let _0x3e9d48;if(_0x3e3ad9[_0x46e02e(0x85)](_0x325a2d[_0x46e02e(0xd3)],0x0)){process['stdout']['write'](_0x3e3ad9['HWDrK']);const _0x2639f8=await _0x3e3ad9[_0x46e02e(0xa2)](selfServeSignup,_0x29af2e[_0x46e02e(0xc5)]);_0x3e9d48=_0x2639f8['organizationId'],console[_0x46e02e(0xa8)]('\x20✓');}else{if(_0x325a2d[_0x46e02e(0xd3)]===0x1)_0x3e9d48=_0x325a2d[0x0]['organizationId'],console[_0x46e02e(0xa8)]('Using\x20organization:\x20'+_0x325a2d[0x0][_0x46e02e(0x80)]);else{const _0x48addb=process[_0x46e02e(0x83)][_0x46e02e(0x9d)]&&process[_0x46e02e(0xca)][_0x46e02e(0x9d)];if(!_0x48addb)throw new Error(_0x3e3ad9[_0x46e02e(0xd5)]+_0x3e3ad9[_0x46e02e(0xa3)]);const {selected:_0x1400f1}=await _0x333557['prompt']([{'type':'list','name':_0x46e02e(0xb0),'message':_0x3e3ad9[_0x46e02e(0xbe)],'choices':_0x325a2d[_0x46e02e(0x99)](_0x36fd04=>({'name':_0x36fd04['name'],'value':_0x36fd04[_0x46e02e(0x89)]}))}]);_0x3e9d48=_0x1400f1;}}_0x29af2e=await _0x3e3ad9['AvGiV'](refreshTokenWithOrg,_0x22796a,_0x29af2e[_0x46e02e(0xc0)],_0x3e9d48);}process[_0x46e02e(0xca)]['write']('Provisioning\x20CLI\x20token...');const _0x2de501=await _0x3e3ad9[_0x46e02e(0x92)](provisionCliToken,_0x29af2e[_0x46e02e(0xc5)]);return console['log']('\x20✓'),await _0x3e3ad9['AyvkM'](storeToken,_0x2de501['token']),_0x29af2e[_0x46e02e(0xc0)]&&await _0x3e3ad9['JdGFx'](storeRefreshToken,_0x29af2e['refresh_token']),_0x2de501[_0x46e02e(0xa4)];}function sleep(_0x4da067){return new Promise(_0x1232b2=>setTimeout(_0x1232b2,_0x4da067));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x32d8e7=_0x4439;(function(_0x553b4e,_0x3fc29d){const _0x475c02=_0x4439,_0x2bd726=_0x553b4e();while(!![]){try{const _0xc1de6b=-parseInt(_0x475c02(0x1e3))/0x1*(parseInt(_0x475c02(0x1f9))/0x2)+-parseInt(_0x475c02(0x1e4))/0x3+parseInt(_0x475c02(0x1de))/0x4+parseInt(_0x475c02(0x1df))/0x5*(parseInt(_0x475c02(0x1dc))/0x6)+parseInt(_0x475c02(0x1db))/0x7*(-parseInt(_0x475c02(0x1f1))/0x8)+-parseInt(_0x475c02(0x1f6))/0x9*(parseInt(_0x475c02(0x1d9))/0xa)+parseInt(_0x475c02(0x1e0))/0xb;if(_0xc1de6b===_0x3fc29d)break;else _0x2bd726['push'](_0x2bd726['shift']());}catch(_0x16813f){_0x2bd726['push'](_0x2bd726['shift']());}}}(_0x1e9b,0xa3de0));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':_0x32d8e7(0x1e8),'workosClientId':_0x32d8e7(0x1e2),'aiProxyUrl':_0x32d8e7(0x1ee),'mcpAuthUrl':'https://mcp-auth.ranger.net/mcp'},'staging':{'apiBaseUrl':_0x32d8e7(0x1eb),'workosClientId':_0x32d8e7(0x1fb),'aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':'https://mcp-auth.staging.ranger.net/mcp'},'local':{'apiBaseUrl':'http://localhost:8080','workosClientId':'client_01J9CBYM2DKWV9HM17D95Z540K','aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT=_0x32d8e7(0x1e9);export function isValidEnvironment(_0x2957e1){const _0x43f6b6=_0x32d8e7,_0x463384={'ctIEb':'prod','BfntM':function(_0x2dbcc7,_0x42d8f6){return _0x2dbcc7===_0x42d8f6;},'rrHSl':'staging'};return _0x2957e1===_0x463384['ctIEb']||_0x463384['BfntM'](_0x2957e1,_0x463384[_0x43f6b6(0x1e7)])||_0x463384[_0x43f6b6(0x1e1)](_0x2957e1,_0x43f6b6(0x1f5));}function _0x4439(_0x496887,_0x347ead){_0x496887=_0x496887-0x1d6;const _0x1e9b1d=_0x1e9b();let _0x44391b=_0x1e9b1d[_0x496887];return _0x44391b;}export function getCurrentEnvironment(){const _0x31c174=_0x32d8e7,_0xb2d8c=process['env'][_0x31c174(0x1fa)];if(_0xb2d8c&&isValidEnvironment(_0xb2d8c))return _0xb2d8c;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x2148c4=_0x32d8e7;return ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x2148c4(0x1e6)];}export function getAiProxyUrl(){return ENVIRONMENT_CONFIGS[getCurrentEnvironment()]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x7a035=_0x32d8e7,_0xb3ee43={'FENMo':function(_0x9cd777){return _0x9cd777();}};return process['env'][_0x7a035(0x1f2)]??ENVIRONMENT_CONFIGS[_0xb3ee43[_0x7a035(0x1ef)](getCurrentEnvironment)][_0x7a035(0x1ea)];}function _0x1e9b(){const _0x509b3a=['524111XTwYwx','72FZmaNL','playwright-cli','5245196iGpNnJ','121465PQsUGf','9636077qmEVLi','BfntM','client_01J9CBYM7M5ZETCF7G6614DXR2','1Ncgkyf','382092WhSonu','trim','apiBaseUrl','rrHSl','https://api.ranger.net','prod','mcpAuthUrl','https://api.staging.ranger.net','error','YqbHv','https://ai-proxy-716115358910.us-central1.run.app','FENMo','env','56ujhHHL','RANGER_MCP_AUTH_URL','toLowerCase','TymcU','local','36YeQlBf','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.','Invalid\x20RANGER_TRANSPORT=\x22','543598hFcOlX','RANGER_CLI_ENV','client_01J9CBYM2DKWV9HM17D95Z540K','nova-act-cli','WCsRY','jPzwt','2210870JTdFSo','find'];_0x1e9b=function(){return _0x509b3a;};return _0x1e9b();}export function isByokEnabled(){return process['env']['RANGER_BYOK']==='true';}function isVerificationTransport(_0x587386){const _0x25eb52=_0x32d8e7,_0x3b583c={'TymcU':function(_0x291214,_0x2f5f10){return _0x291214===_0x2f5f10;}};return _0x587386==='mcp'||_0x3b583c[_0x25eb52(0x1f4)](_0x587386,_0x25eb52(0x1dd))||_0x3b583c[_0x25eb52(0x1f4)](_0x587386,_0x25eb52(0x1d6))||_0x3b583c[_0x25eb52(0x1f4)](_0x587386,'rangerwright-cli');}const LEGACY_TRANSPORT_ENV_VARS=['RANGER_USE_NOVA_ACT','RANGER_DISABLE_MCP'];export function getVerificationTransport(){const _0x1c317c=_0x32d8e7,_0x18633f={'jPzwt':function(_0x43aab4,_0x3b6b6e){return _0x43aab4(_0x3b6b6e);}},_0x12d6fb=process[_0x1c317c(0x1f0)]['RANGER_TRANSPORT']?.[_0x1c317c(0x1e5)]();if(_0x12d6fb){if(_0x18633f[_0x1c317c(0x1d8)](isVerificationTransport,_0x12d6fb))return _0x12d6fb;throw new Error(_0x1c317c(0x1f8)+_0x12d6fb+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x5ec17a=LEGACY_TRANSPORT_ENV_VARS[_0x1c317c(0x1da)](_0x939004=>process[_0x1c317c(0x1f0)][_0x939004]);if(_0x5ec17a)throw new Error(_0x5ec17a+'\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.');return'mcp';}export function resolveHookMode(_0x34f967=process['env']){const _0x4d818b=_0x32d8e7,_0x15d9f2={'FRwtG':'off','WCsRY':function(_0x4448c3,_0x294468){return _0x4448c3===_0x294468;},'CZtbc':function(_0x553601,_0x37dbef){return _0x553601===_0x37dbef;},'dpeDK':'auto','YqbHv':function(_0x4fb870,_0x9c3df){return _0x4fb870+_0x9c3df;}},_0x26d7b3=_0x34f967['RANGER_HOOKS']?.[_0x4d818b(0x1e5)]()[_0x4d818b(0x1f3)]();if(!_0x26d7b3)return'auto';if(_0x26d7b3===_0x15d9f2['FRwtG']||_0x15d9f2[_0x4d818b(0x1d7)](_0x26d7b3,'on')||_0x15d9f2['CZtbc'](_0x26d7b3,_0x15d9f2['dpeDK']))return _0x26d7b3;return console[_0x4d818b(0x1ec)](_0x15d9f2[_0x4d818b(0x1ed)]('[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22'+_0x34f967['RANGER_HOOKS']+'\x22.\x20',_0x4d818b(0x1f7))),'auto';}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x3b2ba8,_0x3a37f6){const _0x11897b=_0x16b3,_0x434d38=_0x3b2ba8();while(!![]){try{const _0x3204aa=-parseInt(_0x11897b(0x1c2))/0x1*(-parseInt(_0x11897b(0x1de))/0x2)+parseInt(_0x11897b(0x1c8))/0x3+parseInt(_0x11897b(0x1f9))/0x4+-parseInt(_0x11897b(0x1d2))/0x5+-parseInt(_0x11897b(0x1bf))/0x6*(-parseInt(_0x11897b(0x1f2))/0x7)+parseInt(_0x11897b(0x1e0))/0x8*(parseInt(_0x11897b(0x1f7))/0x9)+parseInt(_0x11897b(0x1fc))/0xa*(-parseInt(_0x11897b(0x1c9))/0xb);if(_0x3204aa===_0x3a37f6)break;else _0x434d38['push'](_0x434d38['shift']());}catch(_0x1df9ad){_0x434d38['push'](_0x434d38['shift']());}}}(_0x2790,0xe95d0));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x3b2dfd){const _0x2d1258=_0x16b3,_0x26056a={'UFZXb':function(_0x3fb19f){return _0x3fb19f();},'mdgfD':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Znhsk':function(_0x20c0a0){return _0x20c0a0();},'OvLpe':'POST','tVgwa':_0x2d1258(0x1d4)},_0x21173b=await _0x26056a['UFZXb'](getToken);if(!_0x21173b)throw new Error(_0x26056a[_0x2d1258(0x1e8)]);const _0x199dcc=_0x26056a['Znhsk'](getApiBaseUrl),_0x142442=await fetch(_0x199dcc+'/api/v1/mcp/features',{'method':_0x26056a[_0x2d1258(0x1e2)],'headers':{'Authorization':'Bearer\x20'+_0x21173b,'Content-Type':_0x2d1258(0x1e6)},'body':JSON['stringify'](_0x3b2dfd)});if(!_0x142442['ok']){if(_0x142442[_0x2d1258(0x1f1)]===0x192){const _0x23930b=await _0x142442['json'](),_0x31e0f9=_0x23930b[_0x2d1258(0x1e5)]||'https://dashboard.ranger.net/billing';throw new Error((_0x23930b[_0x2d1258(0x1ec)]||_0x26056a['tVgwa'])+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x31e0f9);}const _0x17cf9=await _0x142442['text']();throw new Error(_0x2d1258(0x1eb)+_0x17cf9);}return _0x142442[_0x2d1258(0x1ea)]();}function _0x16b3(_0x438e64,_0x18746e){_0x438e64=_0x438e64-0x1be;const _0x2790d3=_0x2790();let _0x16b3a3=_0x2790d3[_0x438e64];return _0x16b3a3;}export async function listFeatures(_0x3bd727){const _0x3d0b56=_0x16b3,_0x41c613={'ZjTjp':function(_0x2c7f34){return _0x2c7f34();},'lWXkt':function(_0x56deb3){return _0x56deb3();},'cMQMN':_0x3d0b56(0x1d3),'WvFOY':'gitBranch','XqmwF':'includeDeleted'},_0x51a6ff=await _0x41c613['ZjTjp'](getToken);if(!_0x51a6ff)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x859ca=_0x41c613[_0x3d0b56(0x1fa)](getApiBaseUrl),_0x425718=new URLSearchParams();if(_0x3bd727?.[_0x3d0b56(0x1d3)])_0x425718[_0x3d0b56(0x1d1)](_0x41c613[_0x3d0b56(0x200)],_0x3bd727['gitRepoUrl']);if(_0x3bd727?.['gitBranch'])_0x425718['set'](_0x41c613[_0x3d0b56(0x1fb)],_0x3bd727['gitBranch']);if(_0x3bd727?.['limit'])_0x425718[_0x3d0b56(0x1d1)]('limit',_0x3bd727['limit']['toString']());if(_0x3bd727?.[_0x3d0b56(0x1cd)])_0x425718['set']('offset',_0x3bd727[_0x3d0b56(0x1cd)][_0x3d0b56(0x1f3)]());if(_0x3bd727?.['includeDeleted'])_0x425718[_0x3d0b56(0x1d1)](_0x41c613[_0x3d0b56(0x1ff)],'true');const _0x96f309=_0x859ca+'/api/v1/mcp/features'+(_0x425718[_0x3d0b56(0x1f3)]()?'?'+_0x425718['toString']():''),_0x2a0fe6=await fetch(_0x96f309,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x51a6ff}});if(!_0x2a0fe6['ok']){const _0x48de79=await _0x2a0fe6[_0x3d0b56(0x1e9)]();throw new Error(_0x3d0b56(0x1ce)+_0x48de79);}return _0x2a0fe6['json']();}export async function getFeature(_0xb7f8b2){const _0xaa69e3=_0x16b3,_0x499b79={'jDZQQ':_0xaa69e3(0x1f8),'iSXtM':function(_0x287122,_0x5b7e91,_0x118902){return _0x287122(_0x5b7e91,_0x118902);},'xlXIv':_0xaa69e3(0x1cf)},_0x535a0b=await getToken();if(!_0x535a0b)throw new Error(_0x499b79[_0xaa69e3(0x1cb)]);const _0x271c28=getApiBaseUrl(),_0x36b965=await _0x499b79['iSXtM'](fetch,_0x271c28+'/api/v1/mcp/features/'+_0xb7f8b2,{'method':_0x499b79['xlXIv'],'headers':{'Authorization':'Bearer\x20'+_0x535a0b}});if(!_0x36b965['ok']){const _0x62f89d=await _0x36b965['text']();throw new Error(_0xaa69e3(0x201)+_0x62f89d);}return _0x36b965['json']();}export async function updateFeature(_0x5bb4c5,_0x50591d){const _0x4c966c=_0x16b3,_0x264be3={'yBUWj':function(_0x596bca){return _0x596bca();}},_0x35bac0=await _0x264be3['yBUWj'](getToken);if(!_0x35bac0)throw new Error(_0x4c966c(0x1f8));const _0x54c872=getApiBaseUrl(),_0x308d85=await fetch(_0x54c872+_0x4c966c(0x203)+_0x5bb4c5,{'method':_0x4c966c(0x1fe),'headers':{'Authorization':'Bearer\x20'+_0x35bac0,'Content-Type':'application/json'},'body':JSON[_0x4c966c(0x1dd)](_0x50591d)});if(!_0x308d85['ok']){const _0x2213e9=await _0x308d85[_0x4c966c(0x1e9)]();throw new Error(_0x4c966c(0x1c5)+_0x2213e9);}return _0x308d85['json']();}export async function createChecklistItem(_0x581ecf,_0x12862b,_0x5d243f){const _0x465440=_0x16b3,_0x8af448={'aFHDo':function(_0x33388e){return _0x33388e();},'AqijT':'POST'},_0x4b5108=await getToken();if(!_0x4b5108)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3155a5=_0x8af448[_0x465440(0x1c7)](getApiBaseUrl),_0xa0b614=await fetch(_0x3155a5+_0x465440(0x203)+_0x581ecf+_0x465440(0x1fd),{'method':_0x8af448['AqijT'],'headers':{'Authorization':_0x465440(0x1cc)+_0x4b5108,'Content-Type':_0x465440(0x1e6)},'body':JSON[_0x465440(0x1dd)]({'description':_0x12862b,'position':_0x5d243f})});if(!_0xa0b614['ok']){const _0x32ec24=await _0xa0b614['text']();throw new Error(_0x465440(0x1c0)+_0x32ec24);}return _0xa0b614[_0x465440(0x1ea)]();}export async function updateChecklistItem(_0x1b4908,_0x307407,_0x51af50){const _0x2b10a6=_0x16b3,_0x29f69f={'dVXGp':function(_0x3c7d53,_0x3807ff,_0x4644f3){return _0x3c7d53(_0x3807ff,_0x4644f3);},'GAwWG':_0x2b10a6(0x1e6),'NJYVl':'updateChecklistItem'};return withRetry(async()=>{const _0x4e20e9=_0x2b10a6,_0x2086c4=await getToken();if(!_0x2086c4)throw new Error(_0x4e20e9(0x1f8));const _0x23a4a3=getApiBaseUrl(),_0x962278=await _0x29f69f[_0x4e20e9(0x1e3)](fetch,_0x23a4a3+'/api/v1/mcp/features/'+_0x1b4908+'/checklist/'+_0x307407,{'method':'PATCH','headers':{'Authorization':'Bearer\x20'+_0x2086c4,'Content-Type':_0x29f69f['GAwWG']},'body':JSON['stringify'](_0x51af50)});if(!_0x962278['ok']){const _0x5c3fe2=await _0x962278[_0x4e20e9(0x1e9)]();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x5c3fe2);}return _0x962278[_0x4e20e9(0x1ea)]();},{'label':_0x29f69f[_0x2b10a6(0x1d6)]});}export async function getFeatureReport(_0x1fdbcb){const _0x48fa87=_0x16b3,_0x74c5d5={'SCLzn':_0x48fa87(0x1f8),'aQwZa':function(_0x15a6cd){return _0x15a6cd();},'HjzKU':function(_0x365781,_0x53572b,_0x12d7c4){return _0x365781(_0x53572b,_0x12d7c4);}},_0xf8af11=await getToken();if(!_0xf8af11)throw new Error(_0x74c5d5['SCLzn']);const _0x43d626=_0x74c5d5[_0x48fa87(0x1f6)](getApiBaseUrl),_0x3d1873=await _0x74c5d5['HjzKU'](fetch,_0x43d626+_0x48fa87(0x203)+_0x1fdbcb+_0x48fa87(0x1d5),{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0xf8af11}});if(!_0x3d1873['ok']){const _0xbdae43=await _0x3d1873[_0x48fa87(0x1e9)]();throw new Error(_0x48fa87(0x1d9)+_0xbdae43);}return _0x3d1873['json']();}export async function getFeatureReportMarkdown(_0x2fea23,_0x4a7c6b){const _0x3492f1=_0x16b3,_0x2ec19a={'mIgcm':_0x3492f1(0x1dc),'NbYGn':_0x3492f1(0x1d7),'xlgTO':'style','ndUad':function(_0x4f42a2,_0x26ca83,_0x4582e9){return _0x4f42a2(_0x26ca83,_0x4582e9);},'yknBA':'GET'},_0x154edf=await getToken();if(!_0x154edf)throw new Error(_0x3492f1(0x1f8));const _0x463dad=getApiBaseUrl(),_0x4ccffa=new URLSearchParams(),_0x2b3548=(_0x4a7c6b?.[_0x3492f1(0x1dc)]?.[_0x3492f1(0x1ed)]??0x0)>0x0,_0x11b52f=Boolean(_0x4a7c6b?.[_0x3492f1(0x1d7)]);_0x2b3548&&_0x4a7c6b?.['itemIds']&&_0x4ccffa['set'](_0x2ec19a['mIgcm'],_0x4a7c6b[_0x3492f1(0x1dc)]['join'](','));_0x11b52f&&_0x4a7c6b?.[_0x3492f1(0x1d7)]&&_0x4ccffa['set'](_0x2ec19a['NbYGn'],_0x4a7c6b['sessionId']);!_0x2b3548&&!_0x11b52f&&_0x4a7c6b?.[_0x3492f1(0x1d8)]&&_0x4ccffa['set'](_0x2ec19a['xlgTO'],_0x4a7c6b[_0x3492f1(0x1d8)]);const _0x3c0298=_0x463dad+_0x3492f1(0x203)+_0x2fea23+_0x3492f1(0x1e7),_0x41cb7e=''+_0x3c0298+(_0x4ccffa['toString']()?'?'+_0x4ccffa[_0x3492f1(0x1f3)]():''),_0x2562d2=await _0x2ec19a[_0x3492f1(0x1be)](fetch,_0x41cb7e,{'method':_0x2ec19a['yknBA'],'headers':{'Authorization':_0x3492f1(0x1cc)+_0x154edf}});if(!_0x2562d2['ok']){const _0x5e869b=await _0x2562d2['text']();throw new Error(_0x3492f1(0x1c6)+_0x5e869b);}return _0x2562d2[_0x3492f1(0x1e9)]();}export async function listFeatureSessions(_0x3cbcff){const _0x3fcf0b=_0x16b3,_0x3c7154={'CXbkP':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','wjTwA':function(_0x381540,_0x41c200,_0x383e56){return _0x381540(_0x41c200,_0x383e56);},'qUMby':_0x3fcf0b(0x1cf)},_0x3c5087=await getToken();if(!_0x3c5087)throw new Error(_0x3c7154['CXbkP']);const _0x22ca55=getApiBaseUrl(),_0x2b5b42=await _0x3c7154['wjTwA'](fetch,_0x22ca55+'/api/v1/mcp/features/'+_0x3cbcff+_0x3fcf0b(0x1ca),{'method':_0x3c7154['qUMby'],'headers':{'Authorization':_0x3fcf0b(0x1cc)+_0x3c5087}});if(!_0x2b5b42['ok']){const _0x1895ff=await _0x2b5b42['text']();throw new Error(_0x3fcf0b(0x1c1)+_0x1895ff);}return _0x2b5b42['json']();}export async function startSession(_0x4ca254,_0x2a6734){const _0x54444e=_0x16b3,_0x206def={'TNiHU':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','DqMAd':function(_0x550f18){return _0x550f18();},'BMtPV':function(_0x3d2401,_0x37320b,_0x3f7f88){return _0x3d2401(_0x37320b,_0x3f7f88);}},_0x301e5f=await getToken();if(!_0x301e5f)throw new Error(_0x206def['TNiHU']);const _0x1b9799=_0x206def['DqMAd'](getApiBaseUrl),_0x3ada97=await _0x206def[_0x54444e(0x1db)](fetch,_0x1b9799+'/api/v1/mcp/features/'+_0x4ca254+_0x54444e(0x1d0)+_0x2a6734+_0x54444e(0x1ee),{'method':_0x54444e(0x1c4),'headers':{'Authorization':'Bearer\x20'+_0x301e5f}});if(!_0x3ada97['ok']){const _0xd418fc=await _0x3ada97['text']();throw new Error(_0x54444e(0x1f0)+_0xd418fc);}return _0x3ada97['json']();}export async function concludeSession(_0x47ede5,_0x10402b){const _0x4c1fa9=_0x16b3,_0x5bf624={'KjxFY':function(_0x220334){return _0x220334();},'plbHU':'POST'},_0x3f4e1f=await getToken();if(!_0x3f4e1f)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x574b37=_0x5bf624['KjxFY'](getApiBaseUrl),_0x329f93=await fetch(_0x574b37+_0x4c1fa9(0x203)+_0x47ede5+'/sessions/'+_0x10402b+'/conclude',{'method':_0x5bf624[_0x4c1fa9(0x1df)],'headers':{'Authorization':'Bearer\x20'+_0x3f4e1f}});if(!_0x329f93['ok']){const _0x31f312=await _0x329f93['text']();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x31f312);}return _0x329f93[_0x4c1fa9(0x1ea)]();}export async function getActionItems(_0x1378f0){const _0x4b48a4=_0x16b3,_0x476389={'CKwFb':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ruKht':function(_0x4c2dc4){return _0x4c2dc4();},'vxMDn':'GET'},_0x212b61=await getToken();if(!_0x212b61)throw new Error(_0x476389['CKwFb']);const _0x428ac8=_0x476389[_0x4b48a4(0x202)](getApiBaseUrl),_0x10afd2=await fetch(_0x428ac8+_0x4b48a4(0x203)+_0x1378f0+'/action-items',{'method':_0x476389['vxMDn'],'headers':{'Authorization':'Bearer\x20'+_0x212b61}});if(!_0x10afd2['ok']){const _0x24f7d0=await _0x10afd2['text']();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0x24f7d0);}return _0x10afd2[_0x4b48a4(0x1ea)]();}function _0x2790(){const _0x20ff48=['message','length','/start','Failed\x20to\x20delete\x20feature\x20review:\x20','Failed\x20to\x20start\x20session:\x20','status','546119yXPFCx','toString','/restore','msZuB','aQwZa','9MznIVC','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','2643992LnsaII','lWXkt','WvFOY','17065660DrOmLy','/checklist','PATCH','XqmwF','cMQMN','Failed\x20to\x20get\x20feature\x20review:\x20','ruKht','/api/v1/mcp/features/','ndUad','126QsHrYm','Failed\x20to\x20create\x20scenario:\x20','Failed\x20to\x20list\x20sessions:\x20','17477DaPOdo','Failed\x20to\x20restore\x20feature\x20review:\x20','POST','Failed\x20to\x20update\x20feature\x20review:\x20','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','aFHDo','880563QiTmga','22VrtcYg','/sessions','jDZQQ','Bearer\x20','offset','Failed\x20to\x20list\x20feature\x20reviews:\x20','GET','/sessions/','set','4381265nYKicq','gitRepoUrl','Feature\x20limit\x20exceeded','/report','NJYVl','sessionId','style','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','/feedback','BMtPV','itemIds','stringify','154OLOvqm','plbHU','10453088NiXxyc','AUjEM','OvLpe','dVXGp','irOuk','billingUrl','application/json','/report/markdown','mdgfD','text','json','Failed\x20to\x20create\x20feature\x20review:\x20'];_0x2790=function(){return _0x20ff48;};return _0x2790();}export async function getItemFeedback(_0x245983,_0x1ddd47){const _0x8306b4=_0x16b3,_0x5b63e7={'irOuk':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','nAZWc':function(_0x38f937){return _0x38f937();},'dzYPE':function(_0x5a3bfa,_0x11e93d,_0x1cb304){return _0x5a3bfa(_0x11e93d,_0x1cb304);}},_0x4369d0=await getToken();if(!_0x4369d0)throw new Error(_0x5b63e7[_0x8306b4(0x1e4)]);const _0xc921f5=_0x5b63e7['nAZWc'](getApiBaseUrl),_0x7c91e7=await _0x5b63e7['dzYPE'](fetch,_0xc921f5+_0x8306b4(0x203)+_0x245983+'/checklist-items/'+_0x1ddd47+_0x8306b4(0x1da),{'method':_0x8306b4(0x1cf),'headers':{'Authorization':'Bearer\x20'+_0x4369d0}});if(!_0x7c91e7['ok']){const _0x1eff2a=await _0x7c91e7['text']();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x1eff2a);}return _0x7c91e7['json']();}export async function markCommentsAddressed(_0x3808b1,_0x1c1616,_0x446fd7){const _0xb52f07=_0x16b3,_0x193e86={'uKSQn':function(_0x393de5){return _0x393de5();},'KdEuK':_0xb52f07(0x1f8),'msZuB':function(_0x227efe,_0x3ebac7,_0x351d9f){return _0x227efe(_0x3ebac7,_0x351d9f);}},_0x2e4a69=await _0x193e86['uKSQn'](getToken);if(!_0x2e4a69)throw new Error(_0x193e86['KdEuK']);const _0x37fc18=getApiBaseUrl(),_0x3a5fb9=await _0x193e86[_0xb52f07(0x1f5)](fetch,_0x37fc18+'/api/v1/mcp/features/'+_0x3808b1+'/comments/address',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x2e4a69,'Content-Type':'application/json'},'body':JSON[_0xb52f07(0x1dd)]({'checklistItemId':_0x1c1616,'commentIds':_0x446fd7})});if(!_0x3a5fb9['ok']){const _0x196487=await _0x3a5fb9[_0xb52f07(0x1e9)]();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x196487);}}export async function softDeleteFeature(_0xce716){const _0x52e54d=_0x16b3,_0x3eceac={'WNwrA':function(_0x30b492){return _0x30b492();},'AUjEM':function(_0x470c17,_0x3dec0a,_0x30c555){return _0x470c17(_0x3dec0a,_0x30c555);},'Qsymn':'DELETE'},_0x592152=await _0x3eceac['WNwrA'](getToken);if(!_0x592152)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3af8e3=getApiBaseUrl(),_0x355fb2=await _0x3eceac[_0x52e54d(0x1e1)](fetch,_0x3af8e3+'/api/v1/mcp/features/'+_0xce716,{'method':_0x3eceac['Qsymn'],'headers':{'Authorization':_0x52e54d(0x1cc)+_0x592152}});if(!_0x355fb2['ok']){const _0x107945=await _0x355fb2[_0x52e54d(0x1e9)]();throw new Error(_0x52e54d(0x1ef)+_0x107945);}}export async function restoreFeature(_0xbcab53){const _0x385538=_0x16b3,_0x31f49b={'XGwJt':function(_0x45e0a3){return _0x45e0a3();},'JgXnA':function(_0x169e4e,_0x1e4c13,_0x27a38f){return _0x169e4e(_0x1e4c13,_0x27a38f);},'jJmxp':'POST'},_0x9afdb1=await _0x31f49b['XGwJt'](getToken);if(!_0x9afdb1)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3f449c=getApiBaseUrl(),_0x4b94ac=await _0x31f49b['JgXnA'](fetch,_0x3f449c+'/api/v1/mcp/features/'+_0xbcab53+_0x385538(0x1f4),{'method':_0x31f49b['jJmxp'],'headers':{'Authorization':'Bearer\x20'+_0x9afdb1}});if(!_0x4b94ac['ok']){const _0x12cb7d=await _0x4b94ac['text']();throw new Error(_0x385538(0x1c3)+_0x12cb7d);}}
|
|
1
|
+
(function(_0x414551,_0x44faa1){const _0x32ce87=_0x5771,_0x193c80=_0x414551();while(!![]){try{const _0x3c448e=-parseInt(_0x32ce87(0x1b7))/0x1+-parseInt(_0x32ce87(0x1be))/0x2+parseInt(_0x32ce87(0x1b2))/0x3*(parseInt(_0x32ce87(0x1ad))/0x4)+-parseInt(_0x32ce87(0x1e1))/0x5+-parseInt(_0x32ce87(0x1af))/0x6*(parseInt(_0x32ce87(0x1cc))/0x7)+-parseInt(_0x32ce87(0x1c2))/0x8+parseInt(_0x32ce87(0x1eb))/0x9;if(_0x3c448e===_0x44faa1)break;else _0x193c80['push'](_0x193c80['shift']());}catch(_0x44c1a1){_0x193c80['push'](_0x193c80['shift']());}}}(_0x56e9,0x6a14d));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';function _0x56e9(){const _0x4e8294=['iqsLF','2339588rgJjvn','xRSse','289218JpgEJL','zdATr','/api/v1/mcp/features/','3qcGmmV','length','itemIds','Failed\x20to\x20update\x20scenario:\x20','Failed\x20to\x20list\x20feature\x20reviews:\x20','518713ucHYZt','NYixJ','QpspB','Failed\x20to\x20delete\x20feature\x20review:\x20','/comments/address','/feedback','Failed\x20to\x20get\x20feature\x20review:\x20','199704McazmJ','Failed\x20to\x20get\x20action\x20items:\x20','MKtCb','sessionId','478768qfyImI','text','Failed\x20to\x20start\x20session:\x20','QWZhS','GET','fbCTZ','stringify','sOpYj','raMoi','DnblY','7udhycI','mTjMY','XpvkL','/restore','SNJih','application/json','/start','includeDeleted','/sessions/','mTpYJ','/checklist','iqaUZ','Failed\x20to\x20restore\x20feature\x20review:\x20','Failed\x20to\x20list\x20sessions:\x20','pcqpI','POST','Failed\x20to\x20conclude\x20session:\x20','Bearer\x20','/report/markdown','limit','/api/v1/mcp/features','1436795lKkSKm','GgPeD','Failed\x20to\x20create\x20feature\x20review:\x20','style','\x0a\x0aUpgrade\x20your\x20plan:\x20','RLPhd','SMteK','gitRepoUrl','Failed\x20to\x20update\x20feature\x20review:\x20','HRsmB','7772265qQkFjS','json','UWKMZ','MHuJC','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','set','gYHWj','toString','BRCqq'];_0x56e9=function(){return _0x4e8294;};return _0x56e9();}import{withRetry}from'./retry.js';export async function createFeature(_0x3d7dd9){const _0x551d0b=_0x5771,_0x22ded3={'sOpYj':function(_0x144db0){return _0x144db0();},'iqsLF':_0x551d0b(0x1a7),'MHuJC':'application/json','gTFxV':function(_0x25b410,_0x4c51d7){return _0x25b410===_0x4c51d7;},'KDank':'https://dashboard.ranger.net/billing'},_0x4cdaf9=await _0x22ded3[_0x551d0b(0x1c9)](getToken);if(!_0x4cdaf9)throw new Error(_0x22ded3[_0x551d0b(0x1ac)]);const _0x522ee7=_0x22ded3[_0x551d0b(0x1c9)](getApiBaseUrl),_0x521d4f=await fetch(_0x522ee7+'/api/v1/mcp/features',{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x4cdaf9,'Content-Type':_0x22ded3[_0x551d0b(0x1a6)]},'body':JSON[_0x551d0b(0x1c8)](_0x3d7dd9)});if(!_0x521d4f['ok']){if(_0x22ded3['gTFxV'](_0x521d4f['status'],0x192)){const _0x1cc8f4=await _0x521d4f['json'](),_0x58f4b0=_0x1cc8f4['billingUrl']||_0x22ded3['KDank'];throw new Error((_0x1cc8f4['message']||'Feature\x20limit\x20exceeded')+_0x551d0b(0x1e5)+_0x58f4b0);}const _0xf13d7a=await _0x521d4f['text']();throw new Error(_0x551d0b(0x1e3)+_0xf13d7a);}return _0x521d4f['json']();}export async function listFeatures(_0x5286d9){const _0x41d589=_0x5771,_0x3661a6={'XqVki':function(_0x21d9ef){return _0x21d9ef();},'GgPeD':function(_0x5c2369){return _0x5c2369();}},_0xedcb5f=await _0x3661a6['XqVki'](getToken);if(!_0xedcb5f)throw new Error(_0x41d589(0x1a7));const _0x2180ef=_0x3661a6[_0x41d589(0x1e2)](getApiBaseUrl),_0x4ae1fc=new URLSearchParams();if(_0x5286d9?.[_0x41d589(0x1e8)])_0x4ae1fc['set'](_0x41d589(0x1e8),_0x5286d9['gitRepoUrl']);if(_0x5286d9?.['gitBranch'])_0x4ae1fc['set']('gitBranch',_0x5286d9['gitBranch']);if(_0x5286d9?.['limit'])_0x4ae1fc['set']('limit',_0x5286d9[_0x41d589(0x1df)]['toString']());if(_0x5286d9?.['offset'])_0x4ae1fc[_0x41d589(0x1a8)]('offset',_0x5286d9['offset']['toString']());if(_0x5286d9?.[_0x41d589(0x1d3)])_0x4ae1fc[_0x41d589(0x1a8)](_0x41d589(0x1d3),'true');const _0x41c705=_0x2180ef+_0x41d589(0x1e0)+(_0x4ae1fc['toString']()?'?'+_0x4ae1fc[_0x41d589(0x1aa)]():''),_0x212c84=await fetch(_0x41c705,{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0xedcb5f}});if(!_0x212c84['ok']){const _0x38dbb5=await _0x212c84[_0x41d589(0x1c3)]();throw new Error(_0x41d589(0x1b6)+_0x38dbb5);}return _0x212c84[_0x41d589(0x1ec)]();}export async function getFeature(_0x27c041){const _0x5a206d=_0x5771,_0x146dc2={'mTjMY':function(_0x4b76f8){return _0x4b76f8();},'khdcF':function(_0x48fd66){return _0x48fd66();},'BRCqq':function(_0x27fde0,_0xcf1753,_0x58ab8b){return _0x27fde0(_0xcf1753,_0x58ab8b);},'OcUBd':'GET'},_0x16218a=await _0x146dc2[_0x5a206d(0x1cd)](getToken);if(!_0x16218a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5bddc1=_0x146dc2['khdcF'](getApiBaseUrl),_0xddf49d=await _0x146dc2[_0x5a206d(0x1ab)](fetch,_0x5bddc1+_0x5a206d(0x1b1)+_0x27c041,{'method':_0x146dc2['OcUBd'],'headers':{'Authorization':_0x5a206d(0x1dd)+_0x16218a}});if(!_0xddf49d['ok']){const _0x77a17d=await _0xddf49d[_0x5a206d(0x1c3)]();throw new Error(_0x5a206d(0x1bd)+_0x77a17d);}return _0xddf49d[_0x5a206d(0x1ec)]();}export async function updateFeature(_0x2e5da3,_0x1b0fdf){const _0x31dd87=_0x5771,_0x8bc776={'gmVoB':function(_0x2e4b7d){return _0x2e4b7d();},'xPKez':'PATCH'},_0x4b0c3b=await getToken();if(!_0x4b0c3b)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1e16e5=_0x8bc776['gmVoB'](getApiBaseUrl),_0x16739a=await fetch(_0x1e16e5+_0x31dd87(0x1b1)+_0x2e5da3,{'method':_0x8bc776['xPKez'],'headers':{'Authorization':_0x31dd87(0x1dd)+_0x4b0c3b,'Content-Type':'application/json'},'body':JSON[_0x31dd87(0x1c8)](_0x1b0fdf)});if(!_0x16739a['ok']){const _0xa733f0=await _0x16739a['text']();throw new Error(_0x31dd87(0x1e9)+_0xa733f0);}return _0x16739a['json']();}export async function createChecklistItem(_0x18fae0,_0x30663e,_0x5e65a6){const _0x478140=_0x5771,_0x106b99={'mTpYJ':function(_0x1cfbb8){return _0x1cfbb8();},'EbJLF':_0x478140(0x1a7),'XpvkL':'POST'},_0x396216=await _0x106b99[_0x478140(0x1d5)](getToken);if(!_0x396216)throw new Error(_0x106b99['EbJLF']);const _0x32fbfe=getApiBaseUrl(),_0x2c9f3b=await fetch(_0x32fbfe+_0x478140(0x1b1)+_0x18fae0+_0x478140(0x1d6),{'method':_0x106b99[_0x478140(0x1ce)],'headers':{'Authorization':'Bearer\x20'+_0x396216,'Content-Type':'application/json'},'body':JSON['stringify']({'description':_0x30663e,'position':_0x5e65a6})});if(!_0x2c9f3b['ok']){const _0x2bd247=await _0x2c9f3b[_0x478140(0x1c3)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x2bd247);}return _0x2c9f3b['json']();}export async function updateChecklistItem(_0x1699ce,_0x419b5c,_0x2edb38){const _0x2f4bec=_0x5771,_0xf462cb={'xRSse':_0x2f4bec(0x1a7),'uFxxu':'PATCH','nsUAb':'application/json','TRtrB':function(_0x3ca878,_0x3ce81c,_0x5a1044){return _0x3ca878(_0x3ce81c,_0x5a1044);}};return _0xf462cb['TRtrB'](withRetry,async()=>{const _0x17a782=_0x2f4bec,_0x1a3569=await getToken();if(!_0x1a3569)throw new Error(_0xf462cb[_0x17a782(0x1ae)]);const _0x3b1810=getApiBaseUrl(),_0x3032d4=await fetch(_0x3b1810+'/api/v1/mcp/features/'+_0x1699ce+'/checklist/'+_0x419b5c,{'method':_0xf462cb['uFxxu'],'headers':{'Authorization':'Bearer\x20'+_0x1a3569,'Content-Type':_0xf462cb['nsUAb']},'body':JSON[_0x17a782(0x1c8)](_0x2edb38)});if(!_0x3032d4['ok']){const _0x2080f2=await _0x3032d4['text']();throw new Error(_0x17a782(0x1b5)+_0x2080f2);}return _0x3032d4['json']();},{'label':'updateChecklistItem'});}export async function getFeatureReport(_0x4c62cd){const _0x5670ab=_0x5771,_0x281a51={'pcqpI':_0x5670ab(0x1a7),'RLPhd':function(_0x1925d3){return _0x1925d3();},'iqaUZ':function(_0x4deac5,_0x41e1bb,_0x36688a){return _0x4deac5(_0x41e1bb,_0x36688a);}},_0x5f0e52=await getToken();if(!_0x5f0e52)throw new Error(_0x281a51[_0x5670ab(0x1da)]);const _0x58134c=_0x281a51[_0x5670ab(0x1e6)](getApiBaseUrl),_0x2afc95=await _0x281a51[_0x5670ab(0x1d7)](fetch,_0x58134c+_0x5670ab(0x1b1)+_0x4c62cd+'/report',{'method':'GET','headers':{'Authorization':_0x5670ab(0x1dd)+_0x5f0e52}});if(!_0x2afc95['ok']){const _0x10035e=await _0x2afc95[_0x5670ab(0x1c3)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x10035e);}return _0x2afc95['json']();}export async function getFeatureReportMarkdown(_0x425f3e,_0x15e109){const _0x344124=_0x5771,_0x449d68={'gYHWj':function(_0x20e4ed){return _0x20e4ed();},'DnblY':_0x344124(0x1c1),'UWKMZ':function(_0x540a94,_0x3b2c20,_0xc7a61b){return _0x540a94(_0x3b2c20,_0xc7a61b);},'fEnTJ':'GET'},_0x4d28a5=await _0x449d68[_0x344124(0x1a9)](getToken);if(!_0x4d28a5)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x466aac=getApiBaseUrl(),_0x399f68=new URLSearchParams(),_0x13860=(_0x15e109?.['itemIds']?.[_0x344124(0x1b3)]??0x0)>0x0,_0x19c862=Boolean(_0x15e109?.[_0x344124(0x1c1)]);_0x13860&&_0x15e109?.['itemIds']&&_0x399f68[_0x344124(0x1a8)](_0x344124(0x1b4),_0x15e109['itemIds']['join'](','));_0x19c862&&_0x15e109?.[_0x344124(0x1c1)]&&_0x399f68[_0x344124(0x1a8)](_0x449d68[_0x344124(0x1cb)],_0x15e109['sessionId']);!_0x13860&&!_0x19c862&&_0x15e109?.['style']&&_0x399f68[_0x344124(0x1a8)](_0x344124(0x1e4),_0x15e109[_0x344124(0x1e4)]);const _0x155b7c=_0x466aac+'/api/v1/mcp/features/'+_0x425f3e+_0x344124(0x1de),_0x3a361c=''+_0x155b7c+(_0x399f68[_0x344124(0x1aa)]()?'?'+_0x399f68['toString']():''),_0x28b3d1=await _0x449d68[_0x344124(0x1a5)](fetch,_0x3a361c,{'method':_0x449d68['fEnTJ'],'headers':{'Authorization':_0x344124(0x1dd)+_0x4d28a5}});if(!_0x28b3d1['ok']){const _0x26840c=await _0x28b3d1[_0x344124(0x1c3)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x26840c);}return _0x28b3d1[_0x344124(0x1c3)]();}export async function listFeatureSessions(_0x4914dd){const _0xf13b94=_0x5771,_0xa889d2={'SNJih':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','NYixJ':function(_0xc4ec7){return _0xc4ec7();}},_0x57d8d7=await getToken();if(!_0x57d8d7)throw new Error(_0xa889d2[_0xf13b94(0x1d0)]);const _0x340191=_0xa889d2[_0xf13b94(0x1b8)](getApiBaseUrl),_0xc3176d=await fetch(_0x340191+'/api/v1/mcp/features/'+_0x4914dd+'/sessions',{'method':_0xf13b94(0x1c6),'headers':{'Authorization':_0xf13b94(0x1dd)+_0x57d8d7}});if(!_0xc3176d['ok']){const _0x397520=await _0xc3176d[_0xf13b94(0x1c3)]();throw new Error(_0xf13b94(0x1d9)+_0x397520);}return _0xc3176d[_0xf13b94(0x1ec)]();}export async function startSession(_0x555a2c,_0x3cb5e5){const _0x55fa4d=_0x5771,_0x179267=await getToken();if(!_0x179267)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x372156=getApiBaseUrl(),_0x1368f9=await fetch(_0x372156+_0x55fa4d(0x1b1)+_0x555a2c+_0x55fa4d(0x1d4)+_0x3cb5e5+_0x55fa4d(0x1d2),{'method':_0x55fa4d(0x1db),'headers':{'Authorization':'Bearer\x20'+_0x179267}});if(!_0x1368f9['ok']){const _0x353e36=await _0x1368f9[_0x55fa4d(0x1c3)]();throw new Error(_0x55fa4d(0x1c4)+_0x353e36);}return _0x1368f9[_0x55fa4d(0x1ec)]();}function _0x5771(_0x3739b1,_0x827419){_0x3739b1=_0x3739b1-0x1a5;const _0x56e93b=_0x56e9();let _0x5771e1=_0x56e93b[_0x3739b1];return _0x5771e1;}export async function concludeSession(_0x278fd3,_0x1e6c4b){const _0x17a822=_0x5771,_0x16e420={'eXQtH':function(_0x3425d3){return _0x3425d3();},'zdATr':function(_0x5d5602,_0x365513,_0x2e1de9){return _0x5d5602(_0x365513,_0x2e1de9);}},_0x522ff4=await getToken();if(!_0x522ff4)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x30cf36=_0x16e420['eXQtH'](getApiBaseUrl),_0xf17d70=await _0x16e420[_0x17a822(0x1b0)](fetch,_0x30cf36+'/api/v1/mcp/features/'+_0x278fd3+'/sessions/'+_0x1e6c4b+'/conclude',{'method':'POST','headers':{'Authorization':_0x17a822(0x1dd)+_0x522ff4}});if(!_0xf17d70['ok']){const _0xca3426=await _0xf17d70[_0x17a822(0x1c3)]();throw new Error(_0x17a822(0x1dc)+_0xca3426);}return _0xf17d70[_0x17a822(0x1ec)]();}export async function getActionItems(_0x5c390f){const _0x1aa429=_0x5771,_0x317b21={'raMoi':_0x1aa429(0x1a7),'MKtCb':_0x1aa429(0x1c6)},_0x68af11=await getToken();if(!_0x68af11)throw new Error(_0x317b21[_0x1aa429(0x1ca)]);const _0x328c27=getApiBaseUrl(),_0x56740e=await fetch(_0x328c27+'/api/v1/mcp/features/'+_0x5c390f+'/action-items',{'method':_0x317b21[_0x1aa429(0x1c0)],'headers':{'Authorization':'Bearer\x20'+_0x68af11}});if(!_0x56740e['ok']){const _0xacc914=await _0x56740e['text']();throw new Error(_0x1aa429(0x1bf)+_0xacc914);}return _0x56740e['json']();}export async function getItemFeedback(_0x16836f,_0x167af0){const _0x2f29bc=_0x5771,_0x6b8df2={'uBUiM':_0x2f29bc(0x1a7),'QWZhS':function(_0x293e50){return _0x293e50();},'XMMwv':function(_0x5e3c13,_0x12fdb0,_0x23ff0d){return _0x5e3c13(_0x12fdb0,_0x23ff0d);}},_0x3ab2cd=await getToken();if(!_0x3ab2cd)throw new Error(_0x6b8df2['uBUiM']);const _0x3c7dab=_0x6b8df2[_0x2f29bc(0x1c5)](getApiBaseUrl),_0x554ec5=await _0x6b8df2['XMMwv'](fetch,_0x3c7dab+_0x2f29bc(0x1b1)+_0x16836f+'/checklist-items/'+_0x167af0+_0x2f29bc(0x1bc),{'method':'GET','headers':{'Authorization':_0x2f29bc(0x1dd)+_0x3ab2cd}});if(!_0x554ec5['ok']){const _0x27b179=await _0x554ec5[_0x2f29bc(0x1c3)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x27b179);}return _0x554ec5[_0x2f29bc(0x1ec)]();}export async function markCommentsAddressed(_0x2dcc6f,_0x1c28be,_0x58c649){const _0x59a509=_0x5771,_0x24fe94={'QpspB':function(_0x558add){return _0x558add();},'fbCTZ':_0x59a509(0x1a7),'SMteK':'POST'},_0x26225a=await _0x24fe94[_0x59a509(0x1b9)](getToken);if(!_0x26225a)throw new Error(_0x24fe94[_0x59a509(0x1c7)]);const _0x36d461=_0x24fe94['QpspB'](getApiBaseUrl),_0x34fe92=await fetch(_0x36d461+_0x59a509(0x1b1)+_0x2dcc6f+_0x59a509(0x1bb),{'method':_0x24fe94[_0x59a509(0x1e7)],'headers':{'Authorization':'Bearer\x20'+_0x26225a,'Content-Type':_0x59a509(0x1d1)},'body':JSON['stringify']({'checklistItemId':_0x1c28be,'commentIds':_0x58c649})});if(!_0x34fe92['ok']){const _0x51b25b=await _0x34fe92[_0x59a509(0x1c3)]();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x51b25b);}}export async function softDeleteFeature(_0x3007c5){const _0x977aae=_0x5771,_0xed7960={'OmMyg':function(_0x56b777){return _0x56b777();},'HRsmB':function(_0x5210ee){return _0x5210ee();}},_0x517b5c=await _0xed7960['OmMyg'](getToken);if(!_0x517b5c)throw new Error(_0x977aae(0x1a7));const _0xf52a0a=_0xed7960[_0x977aae(0x1ea)](getApiBaseUrl),_0x2dc0dc=await fetch(_0xf52a0a+_0x977aae(0x1b1)+_0x3007c5,{'method':'DELETE','headers':{'Authorization':_0x977aae(0x1dd)+_0x517b5c}});if(!_0x2dc0dc['ok']){const _0x5316c5=await _0x2dc0dc['text']();throw new Error(_0x977aae(0x1ba)+_0x5316c5);}}export async function restoreFeature(_0x80fea0){const _0x2d1353=_0x5771,_0x3c0efc={'KbCPc':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','QiasZ':function(_0x2322b1,_0x289761,_0x183a39){return _0x2322b1(_0x289761,_0x183a39);}},_0x3cd647=await getToken();if(!_0x3cd647)throw new Error(_0x3c0efc['KbCPc']);const _0x2ac479=getApiBaseUrl(),_0x9ef00e=await _0x3c0efc['QiasZ'](fetch,_0x2ac479+'/api/v1/mcp/features/'+_0x80fea0+_0x2d1353(0x1cf),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x3cd647}});if(!_0x9ef00e['ok']){const _0x22d642=await _0x9ef00e[_0x2d1353(0x1c3)]();throw new Error(_0x2d1353(0x1d8)+_0x22d642);}}
|