@ranger-testing/ranger-cli 3.1.0 → 3.1.1-alpha.08fb70e-39
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/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 _0x3a83a9=_0x20a5;(function(_0x53a4ba,_0x4ad983){const _0x1afb52=_0x20a5,_0x3e25b1=_0x53a4ba();while(!![]){try{const _0x42757c=-parseInt(_0x1afb52(0x16e))/0x1+-parseInt(_0x1afb52(0x112))/0x2+parseInt(_0x1afb52(0x164))/0x3*(parseInt(_0x1afb52(0x10e))/0x4)+-parseInt(_0x1afb52(0x157))/0x5+-parseInt(_0x1afb52(0x136))/0x6*(parseInt(_0x1afb52(0xf4))/0x7)+parseInt(_0x1afb52(0x145))/0x8*(parseInt(_0x1afb52(0x12b))/0x9)+parseInt(_0x1afb52(0xf3))/0xa;if(_0x42757c===_0x4ad983)break;else _0x3e25b1['push'](_0x3e25b1['shift']());}catch(_0x4d86f2){_0x3e25b1['push'](_0x3e25b1['shift']());}}}(_0x9e98,0x4305e));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x1ab9dd from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';function _0x9e98(){const _0x434d70=['\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','iyCjJ','/api/v1/profiles/','qZUoV','RANGER_TEST_USERNAME','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','username','DELETE','or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','220370xUGxCY','toISOString','organizationId','xoZfk','string','uAyJu','effectiveBaseUrl','detail','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','iOBZO','kVVik','\x20\x20Created\x20cloud\x20profile\x20\x22',').\x20','103227RMYJRZ','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','error','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','defaultEnvironmentKey','\x22;\x20proceeding\x20with\x20loginInstructions.','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','Bearer\x20','KXJfh','settings','136520NZBqCq','/api/v1/tunnel/sessions/','Cloud\x20profile\x20\x22','aoDIq','name','\x20failed\x20(','cBbvp','trim','IoBPJ','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','code','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','parse','HxARj','rfgOd','persistSessionState','save','8154900OtZflg','124432ZsyxKs','sessionCheckPath','auth','zISbG','\x22.\x0a','wxSPv','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','\x20\x20Server-side\x20login\x20error:\x20','tunnelUrl','json','RhYgW','\x22\x20not\x20found.','CfJFt','newContext','test_output','Jcadb','LNhxZ','FlZnk','Browser\x20login\x20timed\x20out\x20before\x20completion.','statusText','length','/api/v1/profiles','environments','close','log','agent','4bMhKyX','ZeKtM','/session','extraHTTPHeaders','800946jZQJXm','targetUrl','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','target_url','NYrmW','force','\x22\x20for\x20','origin','\x22,\x20refreshing\x20session...','not_configured','KBxUH','sessionId','\x20\x20No\x20live\x20session\x20for\x20\x22','DERsY','auWQO','browserOptions','\x22\x20on\x20profile\x20\x22','Hqnfe','status','setupHeaders','about:blank','KAsxg','session_state','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','userAgent','1625463VNnuRc','zQCOC','map','HkcwG','env','newPage','stringify','jcfKD','keys','pwEndpoint','RANGER_TEST_PASSWORD','120HxMqtO','POST','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ogarm','environmentKey','YyIvs','catch','loginInstructions','qvBpp','gXdDU','mLIGb','cookies','domains','KdPia','storageStatePath','16wWAZYV','YevbW','message','YccEc','tunnel','KcWgb','ztifs','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','baseUrl'];_0x9e98=function(){return _0x434d70;};return _0x9e98();}import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x36f48c=_0x20a5,_0xe66665={'FlZnk':function(_0xe44b11){return _0xe44b11();},'CfJFt':_0x36f48c(0x138)},_0x5bec78=await _0xe66665[_0x36f48c(0x105)](getToken);if(!_0x5bec78)throw new Error(_0xe66665[_0x36f48c(0x100)]);return _0x5bec78;}async function apiRequest(_0x4f49ac,_0x43dd61={}){const _0x4b2347=_0x20a5,_0x3c2942={'KcWgb':function(_0x52c490){return _0x52c490();},'qZUoV':function(_0x318cf9){return _0x318cf9();},'jcfKD':'application/json','HxARj':function(_0x1a9063,_0x254f86){return _0x1a9063===_0x254f86;},'mLIGb':function(_0x2d591b,_0x3e03ae){return _0x2d591b===_0x3e03ae;}},_0x3e7ae9=await _0x3c2942[_0x4b2347(0x14a)](requireToken),_0x4910ff=_0x3c2942[_0x4b2347(0x151)](getApiBaseUrl),_0x3849da=await fetch(''+_0x4910ff+_0x4f49ac,{..._0x43dd61,'headers':{'Authorization':_0x4b2347(0x16b)+_0x3e7ae9,'Content-Type':_0x3c2942[_0x4b2347(0x132)],..._0x43dd61['headers']??{}}});if(!_0x3849da['ok']){let _0x3fe5ba='',_0x4366f4;try{const _0x29a282=await _0x3849da['json']();_0x3fe5ba=(_0x3c2942[_0x4b2347(0xef)](typeof _0x29a282[_0x4b2347(0x166)],'string')?_0x29a282['error']:undefined)??JSON['stringify'](_0x29a282);if(_0x3c2942[_0x4b2347(0x140)](typeof _0x29a282[_0x4b2347(0xec)],'string'))_0x4366f4=_0x29a282['code'];}catch{_0x3fe5ba=_0x3849da[_0x4b2347(0x107)];}throw new ApiError('API\x20request\x20'+_0x4f49ac+_0x4b2347(0x173)+_0x3849da[_0x4b2347(0x124)]+'):\x20'+_0x3fe5ba,_0x3849da['status'],_0x3fe5ba,_0x4366f4);}if(_0x3c2942['HxARj'](_0x3849da[_0x4b2347(0x124)],0xcc))return undefined;return _0x3849da[_0x4b2347(0xfd)]();}export class ApiError extends Error{['status'];[_0x3a83a9(0x15e)];[_0x3a83a9(0xec)];constructor(_0x22bcf7,_0x4f985f,_0x3bb6b1,_0x104038){const _0x3cc73a=_0x3a83a9;super(_0x22bcf7),this['status']=_0x4f985f,this['detail']=_0x3bb6b1,this['code']=_0x104038,this[_0x3cc73a(0x172)]='ApiError';}}export async function fetchCloudProfile(_0x54c843){const _0x5658ab=_0x3a83a9,_0x46b7c1={'yEyyg':function(_0xc57ff7,_0x111e5e){return _0xc57ff7(_0x111e5e);},'auWQO':function(_0x22c783,_0x34575a){return _0x22c783===_0x34575a;}};try{return await apiRequest('/api/v1/profiles/'+_0x46b7c1['yEyyg'](encodeURIComponent,_0x54c843));}catch(_0x3b3f53){if(_0x3b3f53 instanceof ApiError&&_0x46b7c1[_0x5658ab(0x120)](_0x3b3f53['status'],0x194))return null;throw _0x3b3f53;}}export async function listCloudProfiles(){const _0x164e6a=_0x3a83a9,_0x3e41f4=await apiRequest(_0x164e6a(0x109));return _0x3e41f4['profiles'];}export async function deleteCloudProfile(_0x560818){const _0x32590e=_0x3a83a9,_0x2b3b0d={'zmsez':function(_0x43b4e7,_0x55149f,_0x366303){return _0x43b4e7(_0x55149f,_0x366303);},'gaaGL':function(_0x2219fa,_0x238aef){return _0x2219fa===_0x238aef;}};try{await _0x2b3b0d['zmsez'](apiRequest,_0x32590e(0x150)+encodeURIComponent(_0x560818),{'method':_0x32590e(0x155)});}catch(_0x5351b4){if(_0x5351b4 instanceof ApiError&&_0x2b3b0d['gaaGL'](_0x5351b4['status'],0x194))throw new Error(_0x32590e(0x170)+_0x560818+_0x32590e(0xff));throw _0x5351b4;}}export async function createCloudProfile(_0x302484,_0x151dde,_0x5ae8bf={}){const _0x402c73=_0x3a83a9,_0x1f8430={'KorFY':function(_0x3a9400,_0x2cb1c4,_0x276a36){return _0x3a9400(_0x2cb1c4,_0x276a36);},'DpJDq':'/api/v1/profiles'},_0x4b6b72={'name':_0x302484};if(_0x151dde)_0x4b6b72['environment_key']=_0x151dde;_0x5ae8bf[_0x402c73(0x16d)]&&Object['keys'](_0x5ae8bf[_0x402c73(0x16d)])['length']>0x0&&(_0x4b6b72[_0x402c73(0x16d)]=_0x5ae8bf['settings']);if(_0x5ae8bf[_0x402c73(0x154)])_0x4b6b72['username']=_0x5ae8bf[_0x402c73(0x154)];if(_0x5ae8bf['password'])_0x4b6b72['password']=_0x5ae8bf['password'];return await _0x1f8430['KorFY'](apiRequest,_0x1f8430['DpJDq'],{'method':'POST','body':JSON['stringify'](_0x4b6b72)});}export async function uploadCloudProfileSession(_0x3d852f,_0x247e28){const _0x1b1e71=_0x3a83a9,_0x59799b={'zQCOC':function(_0x3fbd13,_0x5d1f2a,_0x492eed){return _0x3fbd13(_0x5d1f2a,_0x492eed);},'lxmrA':'POST'};return await _0x59799b[_0x1b1e71(0x12c)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x3d852f)+_0x1b1e71(0x110),{'method':_0x59799b['lxmrA'],'body':JSON['stringify']({'session_state':_0x247e28})});}export async function saveCloudProfileCredentials(_0x3dbce8,_0x4fbc64,_0x1fc80c){const _0x1593b8={'eRiKo':function(_0x3acfaa,_0x2ca21d){return _0x3acfaa(_0x2ca21d);}};await apiRequest('/api/v1/profiles/'+_0x1593b8['eRiKo'](encodeURIComponent,_0x3dbce8),{'method':'PUT','body':JSON['stringify']({'username':_0x4fbc64,'password':_0x1fc80c})});}function _0x20a5(_0x32c190,_0x27ee43){_0x32c190=_0x32c190-0xec;const _0x9e982=_0x9e98();let _0x20a54a=_0x9e982[_0x32c190];return _0x20a54a;}export async function fetchAuthConfig(){const _0x4ef02e=_0x3a83a9,_0x2953ec={'ztifs':'/api/v1/profiles/auth-config'};try{const _0x20e8a6=await apiRequest(_0x2953ec[_0x4ef02e(0x14b)]);return _0x20e8a6['auth_config'];}catch(_0x175fb3){return _0x175fb3 instanceof ApiError&&_0x175fb3[_0x4ef02e(0x124)]!==0x194&&console[_0x4ef02e(0x166)](_0x4ef02e(0x14c)+_0x175fb3[_0x4ef02e(0x147)]),null;}}async function createTunnelSession(_0x59df70){const _0x5e0072=_0x3a83a9,_0x54afa1={'dpVjA':'/api/v1/tunnel/sessions','dkfoR':'POST'};return await apiRequest(_0x54afa1['dpVjA'],{'method':_0x54afa1['dkfoR'],'body':JSON[_0x5e0072(0x131)]({'targetUrl':_0x59df70,'mode':_0x5e0072(0x10d)})});}async function deleteTunnelSession(_0x2a4ff2){const _0x325d21=_0x3a83a9,_0x1e6101={'rzjSz':function(_0x55865a,_0x43127e,_0xcb536){return _0x55865a(_0x43127e,_0xcb536);}};await _0x1e6101['rzjSz'](apiRequest,_0x325d21(0x16f)+_0x2a4ff2,{'method':'DELETE'});}export function pickAdHocEnvKey(_0x1293f1){const _0xc5aab0=_0x3a83a9,_0x1482b1={'iyCjJ':function(_0xa060d4,_0x5c4ab4){return _0xa060d4===_0x5c4ab4;}};if(!_0x1293f1)return null;if(_0x1293f1[_0xc5aab0(0x168)])return _0x1293f1[_0xc5aab0(0x168)];const _0x5e2047=Object[_0xc5aab0(0x133)](_0x1293f1[_0xc5aab0(0x10a)]??{});if(_0x1482b1[_0xc5aab0(0x14f)](_0x5e2047['length'],0x1))return _0x5e2047[0x0];if(_0x1482b1[_0xc5aab0(0x14f)](_0x5e2047[_0xc5aab0(0x108)],0x0))return null;throw new Error('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x5e2047['join'](',\x20')+_0xc5aab0(0x163)+'Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.');}export async function resolveAdHocProfile(_0x86772b=process[_0x3a83a9(0x12f)]){const _0x327eb0=_0x3a83a9,_0x282cd8={'YccEc':function(_0x4a2a57,_0xfdb744){return _0x4a2a57(_0xfdb744);},'IoBPJ':function(_0x1986cd,_0x9a2a1,_0x586430,_0x55a88c){return _0x1986cd(_0x9a2a1,_0x586430,_0x55a88c);}},_0x2bf704=_0x86772b['RANGER_TEST_USERNAME'];if(!_0x2bf704)return null;const _0x5c7ec0=await fetchCloudProfile(_0x2bf704);if(_0x5c7ec0)return{'name':_0x5c7ec0['name'],'profile':_0x5c7ec0};const _0x305c4c=await fetchAuthConfig(),_0x2cddfe=_0x282cd8[_0x327eb0(0x148)](pickAdHocEnvKey,_0x305c4c),_0x3aec18=_0x86772b[_0x327eb0(0x135)],_0x1faedc=await _0x282cd8[_0x327eb0(0x176)](createCloudProfile,_0x2bf704,_0x2cddfe??undefined,{'username':_0x2bf704,'password':_0x3aec18});return console[_0x327eb0(0x10c)](_0x327eb0(0x162)+_0x1faedc[_0x327eb0(0x172)]+_0x327eb0(0x118)+_0x2bf704),{'name':_0x1faedc[_0x327eb0(0x172)],'profile':_0x1faedc};}export async function writeSessionToLocalCache(_0x1536f6,_0x136ef8,_0x4d4d5b,_0x4f1a30,_0x56c02d,_0x481874,_0x57e82d){const _0x132082=_0x3a83a9,_0x15ff07={'LNhxZ':function(_0x11f36a,_0x2d61e2,_0x45aa7f){return _0x11f36a(_0x2d61e2,_0x45aa7f);},'BHTRQ':function(_0x4f82d8){return _0x4f82d8();},'JeyZE':function(_0x400d51,_0x3c9fa6){return _0x400d51(_0x3c9fa6);},'ZeKtM':function(_0x496f01,_0x4e9860,_0x2d6315){return _0x496f01(_0x4e9860,_0x2d6315);}},_0x417fc5=sessionCacheHash({'orgId':_0x136ef8,'profileName':_0x1536f6,'effectiveBaseUrl':_0x4d4d5b,'setupHeaders':_0x4f1a30,'invalidateOn':_0x57e82d?.['invalidateOn'],'userAgent':_0x57e82d?.[_0x132082(0x12a)],'clientIp':_0x57e82d?.['clientIp']}),_0x85bf5=getSessionCachePath(_0x417fc5,_0x1536f6),_0x4f7047=_0x15ff07['LNhxZ'](join,_0x15ff07['BHTRQ'](getRangerHomeDir),_0x132082(0xf6));!_0x15ff07['JeyZE'](existsSync,_0x4f7047)&&await _0x15ff07[_0x132082(0x10f)](mkdir,_0x4f7047,{'recursive':!![]});const _0xfc6e3d={..._0x56c02d};_0x481874&&_0x481874[_0x132082(0x108)]>0x0&&Array['isArray'](_0xfc6e3d[_0x132082(0x141)])&&(_0xfc6e3d[_0x132082(0x141)]=_0x15ff07[_0x132082(0x104)](duplicateCookiesForDomains,_0xfc6e3d[_0x132082(0x141)],_0x481874));const _0x104b0d={'cached_at':new Date()[_0x132082(0x158)](),'session_state':_0xfc6e3d};await _0x15ff07[_0x132082(0x104)](writeFile,_0x85bf5,JSON[_0x132082(0x131)](_0x104b0d,null,0x2));const _0x18d9ab=getStorageStatePath(_0x85bf5);return await _0x15ff07[_0x132082(0x10f)](writeFile,_0x18d9ab,JSON['stringify'](_0xfc6e3d,null,0x2)),_0x18d9ab;}export async function checkLocalCache(_0x54efcf,_0x59b59b,_0x302ef4,_0x50be82,_0x1083a2){const _0x11189f=_0x3a83a9,_0x2ff981={'zobMI':function(_0x4910e0,_0x33cf25){return _0x4910e0(_0x33cf25);},'uAyJu':function(_0x1fee21,_0x5198bc,_0x3e26fc){return _0x1fee21(_0x5198bc,_0x3e26fc);},'DERsY':function(_0x41b32e,_0x27b110){return _0x41b32e(_0x27b110);},'NYrmW':function(_0x6caad1,_0x8bfc5b,_0x19dae8){return _0x6caad1(_0x8bfc5b,_0x19dae8);},'oqfUd':'utf-8'},_0x5eb281=_0x2ff981['zobMI'](sessionCacheHash,{'orgId':_0x59b59b,'profileName':_0x54efcf,'effectiveBaseUrl':_0x302ef4,'setupHeaders':_0x50be82,'invalidateOn':_0x1083a2?.['invalidateOn'],'userAgent':_0x1083a2?.['userAgent'],'clientIp':_0x1083a2?.['clientIp']}),_0x50c83d=_0x2ff981[_0x11189f(0x15c)](getSessionCachePath,_0x5eb281,_0x54efcf),_0x47b90e=_0x2ff981[_0x11189f(0x11f)](getStorageStatePath,_0x50c83d);if(!existsSync(_0x50c83d)||!existsSync(_0x47b90e))return null;try{const _0x231e00=await _0x2ff981[_0x11189f(0x116)](readFile,_0x50c83d,_0x2ff981['oqfUd']);return JSON[_0x11189f(0xee)](_0x231e00),{'storageStatePath':_0x47b90e};}catch{return null;}}function launchRealBrowser(){return chromium['launch']({'headless':!![]});}function emitSessionValidationHint(_0xd9a7f3,_0x287431){const _0x7051f2=_0x3a83a9,_0x3dbee0={'yfbAK':function(_0x20fca0,_0x2f6a08){return _0x20fca0+_0x2f6a08;}};if(!_0x287431||!_0x287431[_0x7051f2(0x142)]?.[_0x7051f2(0x108)])return;let _0x3ec4bf;try{_0x3ec4bf=new URL(_0xd9a7f3);}catch{return;}const _0x3ee4b2=[];for(const _0x1bf349 of _0x287431[_0x7051f2(0x142)]){try{_0x3ee4b2['push']({'raw':_0x1bf349,'url':new URL(_0x1bf349)});}catch{}}if(_0x3ee4b2['length']===0x0)return;if(_0x3ee4b2['some'](_0x407cbd=>_0x407cbd['url'][_0x7051f2(0x119)]===_0x3ec4bf['origin']))return;const _0x4c5a7e=_0x3ee4b2[_0x7051f2(0x12d)](_0x4d20c1=>'\x22'+_0x4d20c1['raw']+'\x22')['join'](',\x20');console[_0x7051f2(0x10c)](_0x3dbee0['yfbAK'](_0x7051f2(0x16a)+_0x4c5a7e+';\x20','you\x27re\x20now\x20at\x20\x22'+_0xd9a7f3+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+_0x7051f2(0xed));}export async function serverSideLogin(_0x5618c4,_0x59b3c1){const _0x58ef2e=_0x3a83a9,_0x120cdc={'BDojl':function(_0x4671d1,_0x3f15ba,_0x5ecda6){return _0x4671d1(_0x3f15ba,_0x5ecda6);},'ogarm':_0x58ef2e(0x137)},_0x2f3843=process[_0x58ef2e(0x12f)][_0x58ef2e(0x152)],_0x213fc9=process[_0x58ef2e(0x12f)]['RANGER_TEST_PASSWORD'],_0x308500={};if(_0x2f3843)_0x308500[_0x58ef2e(0x154)]=_0x2f3843;if(_0x213fc9)_0x308500['password']=_0x213fc9;if(_0x59b3c1?.[_0x58ef2e(0x117)])_0x308500[_0x58ef2e(0x117)]=!![];if(_0x59b3c1?.[_0x58ef2e(0x113)])_0x308500[_0x58ef2e(0x115)]=_0x59b3c1[_0x58ef2e(0x113)];_0x59b3c1?.[_0x58ef2e(0x149)]&&(_0x308500['tunnel_session_id']=_0x59b3c1['tunnel'][_0x58ef2e(0x11d)],_0x308500['pw_endpoint']=_0x59b3c1[_0x58ef2e(0x149)]['pwEndpoint']);try{return await _0x120cdc['BDojl'](apiRequest,_0x58ef2e(0x150)+encodeURIComponent(_0x5618c4)+'/login',{'method':_0x120cdc[_0x58ef2e(0x139)],'body':JSON[_0x58ef2e(0x131)](_0x308500)});}catch(_0x26d4f1){if(_0x26d4f1 instanceof ApiError&&_0x26d4f1['status']===0x190&&_0x26d4f1[_0x58ef2e(0xec)]===_0x58ef2e(0x11b))return{'status':_0x58ef2e(0x11b),'error':_0x26d4f1['detail']};throw _0x26d4f1;}}async function serverSideLoginWithOptionalTunnel(_0x474ec2,_0x58addf,_0x26e980={}){const _0x489965=_0x3a83a9,_0x4b49b9={'cTpaA':function(_0x3a4f04,_0x3b36ab){return _0x3a4f04(_0x3b36ab);},'HkcwG':function(_0xe67c35){return _0xe67c35();}};if(!needsTunnel(_0x58addf))return await serverSideLogin(_0x474ec2,{'force':_0x26e980['force']});let _0x50e510=null,_0x2863a6=null,_0x882db=null;try{_0x50e510=await _0x4b49b9['cTpaA'](launchBrowserServer,{'headless':!![]}),_0x2863a6=await _0x4b49b9['cTpaA'](createTunnelSession,_0x58addf);const _0x2f783a=await _0x4b49b9[_0x489965(0x12e)](requireToken);return _0x882db=await createTunnelBridge({'localWsUrl':_0x50e510['wsEndpoint'],'tunnelServerUrl':_0x2863a6[_0x489965(0xfc)],'sessionId':_0x2863a6[_0x489965(0x11d)],'apiKey':_0x2f783a}),await serverSideLogin(_0x474ec2,{'force':_0x26e980[_0x489965(0x117)],'targetUrl':_0x58addf,'tunnel':{'sessionId':_0x2863a6['sessionId'],'pwEndpoint':_0x2863a6[_0x489965(0x134)]}});}finally{_0x882db?.['close'](),_0x50e510&&await _0x50e510[_0x489965(0x10b)]()[_0x489965(0x13c)](()=>{}),_0x2863a6&&await _0x4b49b9['cTpaA'](deleteTunnelSession,_0x2863a6[_0x489965(0x11d)])['catch'](()=>{});}}export async function manualBrowserLogin(_0x504fa4,_0x16e337,_0xf4119e={}){const _0x343109=_0x3a83a9,_0x24e8ba={'KBxUH':function(_0x5e288a){return _0x5e288a();},'cBbvp':function(_0x5b9ace,_0x1d09aa,_0x53e4d8){return _0x5b9ace(_0x1d09aa,_0x53e4d8);},'AuLcg':_0x343109(0x10b),'kVVik':function(_0x12b96c,_0x1dbde3){return _0x12b96c+_0x1dbde3;},'UPJoZ':_0x343109(0xfa),'YevbW':_0x343109(0x156),'wxSPv':function(_0x1cfd43,_0x21a055){return _0x1cfd43>_0x21a055;},'KXJfh':_0x343109(0x126),'zISbG':function(_0x295ecd,_0x44c219){return _0x295ecd(_0x44c219);},'rfgOd':function(_0x284893,_0x2eb81d){return _0x284893&&_0x2eb81d;},'hWGmg':_0x343109(0x106),'HZLCt':function(_0x44833e,_0x5a9510,_0x287436){return _0x44833e(_0x5a9510,_0x287436);}};if(!isInteractive())throw new Error(_0x24e8ba['kVVik'](_0x24e8ba[_0x343109(0x161)](_0x343109(0x165)+_0x504fa4[_0x343109(0x172)]+_0x343109(0xf8),_0x24e8ba['UPJoZ']),_0x24e8ba[_0x343109(0x146)]));const _0x31c582=_0x16e337&&_0x24e8ba[_0x343109(0xf9)](_0x16e337[_0x343109(0x142)][_0x343109(0x108)],0x0)?_0x16e337['domains'][0x0]:_0x24e8ba[_0x343109(0x16c)];console[_0x343109(0x10c)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console['log'](_0x343109(0x177)),await new Promise(_0x2434ea=>setTimeout(_0x2434ea,0x7d0));const _0x1ae9d2=await chromium['launch']({'headless':![]});let _0x5928b1=null;try{const _0x2611a3={'ignoreHTTPSErrors':!![]};_0x16e337?.[_0x343109(0x125)]&&(_0x2611a3[_0x343109(0x111)]=_0x16e337['setupHeaders']);const _0x216b7d=await _0x1ae9d2[_0x343109(0x101)](_0x2611a3);await _0x24e8ba[_0x343109(0xf7)](addProfileSetupBanner,_0x216b7d);const _0x550c0d=await _0x216b7d[_0x343109(0x130)]();await _0x550c0d['goto'](_0x31c582);let _0x1c7f55=![];await new Promise(_0x6c4e42=>{const _0x2a2539=_0x343109,_0x48f415={'xoZfk':function(_0x26b5f0){const _0x5afefa=_0x20a5;return _0x24e8ba[_0x5afefa(0x11c)](_0x26b5f0);},'aoDIq':function(_0x2498e3){return _0x2498e3();}},_0x2986a1=_0x24e8ba[_0x2a2539(0x174)](setTimeout,()=>{const _0x158e39=_0x2a2539;_0x1c7f55=!![],console['error']('Browser\x20login\x20timed\x20out\x20after\x20'+MANUAL_LOGIN_TIMEOUT_MS/0xea60+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x48f415[_0x158e39(0x15a)](_0x6c4e42);},MANUAL_LOGIN_TIMEOUT_MS);_0x550c0d['on'](_0x24e8ba['AuLcg'],async()=>{const _0x310aa9=_0x2a2539;clearTimeout(_0x2986a1);try{const _0x2dcc77=await _0x216b7d['storageState']();_0x5928b1=_0x2dcc77;}catch{}_0x48f415[_0x310aa9(0x171)](_0x6c4e42);});});if(_0x24e8ba[_0x343109(0xf0)](_0x1c7f55,!_0x5928b1))throw new Error(_0x24e8ba['hWGmg']);}finally{await _0x1ae9d2[_0x343109(0x10b)]()[_0x343109(0x13c)](()=>{});}if(!_0x5928b1)throw new Error(_0x343109(0x114));return _0xf4119e[_0x343109(0xf1)]!==![]&&await _0x24e8ba['HZLCt'](apiRequest,_0x343109(0x150)+_0x24e8ba[_0x343109(0xf7)](encodeURIComponent,_0x504fa4['name'])+'/session',{'method':_0x343109(0x137),'body':JSON[_0x343109(0x131)]({'session_state':_0x5928b1,'updated_by':'cli:manual-login'})}),{'sessionState':_0x5928b1};}export async function promptSaveCredentials(_0x378939){const _0x381114=_0x3a83a9,_0xda67d7={'wZGmg':function(_0x169896,_0x487827){return _0x169896||_0x487827;},'XMFDA':function(_0x5e243d,_0x34e92e,_0x42a255){return _0x5e243d(_0x34e92e,_0x42a255);},'RPFrk':function(_0x1a4bb4,_0x2aeaa2){return _0x1a4bb4(_0x2aeaa2);},'gXdDU':'PUT'},_0x1014e7=process[_0x381114(0x12f)]['RANGER_TEST_USERNAME'],_0xa8a385=process[_0x381114(0x12f)][_0x381114(0x135)];if(_0xda67d7['wZGmg'](!_0x1014e7,!_0xa8a385))return;if(!isInteractive())return;const {save:_0xdca2b8}=await _0x1ab9dd['prompt']([{'type':'confirm','name':_0x381114(0xf2),'message':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','default':![]}]);if(!_0xdca2b8)return;await _0xda67d7['XMFDA'](apiRequest,'/api/v1/profiles/'+_0xda67d7['RPFrk'](encodeURIComponent,_0x378939),{'method':_0xda67d7[_0x381114(0x13f)],'body':JSON['stringify']({'username':_0x1014e7,'password':_0xa8a385})}),console['log']('\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.');}export async function resolveCloudProfileSession(_0x253325,_0x310b04={}){const _0x7422b=_0x3a83a9,_0x5b3818={'oTarT':function(_0x4197cd,_0x51c785,_0x585215){return _0x4197cd(_0x51c785,_0x585215);},'wGLmJ':function(_0x469285,_0xf43982){return _0x469285===_0xf43982;},'YyIvs':function(_0xdc0550,_0x463a7f){return _0xdc0550||_0x463a7f;},'Jcadb':function(_0x1255b5,_0x5ee355){return _0x1255b5(_0x5ee355);},'qvBpp':function(_0x2d7869,_0x327d9a,_0x6f0600,_0x14e96f,_0x4fcb1b){return _0x2d7869(_0x327d9a,_0x6f0600,_0x14e96f,_0x4fcb1b);},'qMgDA':function(_0x5ba10c,_0x4f738c,_0x4d5977,_0x2d5a22,_0x1eba17,_0x515731,_0x465b88,_0x253303){return _0x5ba10c(_0x4f738c,_0x4d5977,_0x2d5a22,_0x1eba17,_0x515731,_0x465b88,_0x253303);},'Hqnfe':function(_0x5e0164,_0x51ff10,_0x345684,_0x2889b9,_0x4db1c0){return _0x5e0164(_0x51ff10,_0x345684,_0x2889b9,_0x4db1c0);},'PgkdG':function(_0xda5a8a,_0x395b38){return _0xda5a8a(_0x395b38);},'YgeEH':function(_0x4d2b69,_0x132dda){return _0x4d2b69(_0x132dda);},'imKPO':function(_0x27ded1,_0x346c78){return _0x27ded1===_0x346c78;},'IMXzH':_0x7422b(0x11b),'RhYgW':'success','iOBZO':'\x20\x20Login\x20successful.\x20Session\x20cached.','KAsxg':function(_0x34cd16,_0x4ccc0f){return _0x34cd16&&_0x4ccc0f;},'dQQmP':function(_0x5888f0,_0x1eb890){return _0x5888f0(_0x1eb890);},'KdPia':function(_0x913d85,_0x3dda7c,_0x3d4ce3,_0x137187){return _0x913d85(_0x3dda7c,_0x3d4ce3,_0x137187);}},_0x29efa4=_0x253325[_0x7422b(0x16d)]??{},_0x3324e4=await fetchAuthConfig(),_0x2e36e1=_0x3324e4?_0x5b3818['oTarT'](resolveAuthEnvironmentLocally,_0x3324e4,_0x253325['environmentKey']):null,_0x18d232=typeof _0x2e36e1?.[_0x7422b(0x13d)]===_0x7422b(0x15b)&&_0x2e36e1['loginInstructions']['trim']()?_0x2e36e1['loginInstructions']:undefined,_0x41af56=_0x5b3818['wGLmJ'](typeof _0x29efa4['loginInstructions'],_0x7422b(0x15b))&&_0x29efa4[_0x7422b(0x13d)]['trim']()?_0x29efa4['loginInstructions']:undefined,_0x4e68b6=_0x5b3818[_0x7422b(0x13b)](_0x41af56,!_0x18d232)?_0x29efa4:{..._0x29efa4,'loginInstructions':_0x18d232},_0x4e0144=Boolean(_0x4e68b6['loginInstructions']?.[_0x7422b(0x175)]()),_0x230c4e=_0x5b3818[_0x7422b(0x103)](Boolean,_0x29efa4['forceLogin']||_0x2e36e1?.['forceLogin']),_0x4f95ec=_0x2e36e1?.['domains'],_0x4d38eb=_0x29efa4[_0x7422b(0x125)],_0x1014fc=_0x4d38eb??_0x2e36e1?.['setupHeaders'],_0x14e9fb=_0x310b04[_0x7422b(0x15d)]??_0x29efa4[_0x7422b(0x14d)]??(_0x4f95ec&&_0x4f95ec['length']>0x0?_0x4f95ec[0x0]:''),_0x286ec2=_0x14e9fb?needsTunnel(_0x14e9fb):![],_0x574d7a={'invalidateOn':_0x2e36e1?.['invalidateOn'],'userAgent':_0x2e36e1?.[_0x7422b(0x121)]?.[_0x7422b(0x12a)]??_0x29efa4[_0x7422b(0x12a)]};_0x230c4e&&console['log']('\x20\x20forceLogin\x20enabled\x20for\x20\x22'+_0x253325[_0x7422b(0x172)]+_0x7422b(0x11a));if(!_0x230c4e){const _0x28334c=await checkLocalCache(_0x253325['name'],_0x253325[_0x7422b(0x159)],_0x14e9fb,_0x1014fc,_0x574d7a);if(_0x28334c){if(_0x14e9fb&&!_0x286ec2){const _0x8ef6ba=await _0x5b3818[_0x7422b(0x13e)](isCachedSessionLive,_0x28334c[_0x7422b(0x144)],_0x14e9fb,{'sessionCheckPath':_0x2e36e1?.[_0x7422b(0xf5)],'setupHeaders':_0x1014fc},{'launchBrowser':launchRealBrowser});if(_0x8ef6ba)return console[_0x7422b(0x10c)]('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x253325[_0x7422b(0x172)]+'\x22'),{'authPath':_0x28334c[_0x7422b(0x144)],'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};console[_0x7422b(0x10c)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0x253325['name']+'\x22\x20failed\x20validation\x20—\x20refreshing...'),_0x5b3818['oTarT'](emitSessionValidationHint,_0x14e9fb,_0x2e36e1);}else return _0x286ec2&&console[_0x7422b(0x10c)](_0x7422b(0x129)+_0x253325['name']+'\x22'),{'authPath':_0x28334c['storageStatePath'],'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};}}if(!_0x230c4e&&_0x253325['sessionState']){if(_0x286ec2)console['log'](_0x7422b(0x167)+_0x14e9fb+_0x7422b(0x122)+_0x253325[_0x7422b(0x172)]+'\x22');else{const _0x55126b=await _0x5b3818['qMgDA'](writeSessionToLocalCache,_0x253325[_0x7422b(0x172)],_0x253325[_0x7422b(0x159)],_0x14e9fb,_0x1014fc,_0x253325['sessionState'],_0x4f95ec,_0x574d7a);if(_0x14e9fb){const _0xaa4ce2=await _0x5b3818[_0x7422b(0x123)](isCachedSessionLive,_0x55126b,_0x14e9fb,{'sessionCheckPath':_0x2e36e1?.['sessionCheckPath'],'setupHeaders':_0x1014fc},{'launchBrowser':launchRealBrowser});if(_0xaa4ce2)return console['log'](_0x7422b(0x153)+_0x253325[_0x7422b(0x172)]+'\x22,\x20cached\x20locally'),{'authPath':_0x55126b,'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};console['log']('\x20\x20Cloud\x20session\x20for\x20\x22'+_0x253325['name']+'\x22\x20failed\x20validation\x20—\x20re-login\x20needed...'),_0x5b3818['oTarT'](emitSessionValidationHint,_0x14e9fb,_0x2e36e1);}else return{'authPath':_0x55126b,'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};}}if(_0x4e0144)return console[_0x7422b(0x10c)]('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x253325['name']+_0x7422b(0x169)),{'authPath':undefined,'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};console[_0x7422b(0x10c)](_0x7422b(0x11e)+_0x253325[_0x7422b(0x172)]+'\x22,\x20attempting\x20login...');const _0x2729e8=_0x5b3818['PgkdG'](Boolean,process[_0x7422b(0x12f)]['RANGER_TEST_USERNAME'])&&Boolean(process[_0x7422b(0x12f)][_0x7422b(0x135)]),_0x18f6e3=_0x5b3818['YgeEH'](Boolean,_0x253325['username']);if(_0x2729e8||_0x18f6e3)try{const _0x2483a2=_0x14e9fb?await serverSideLoginWithOptionalTunnel(_0x253325[_0x7422b(0x172)],_0x14e9fb,{'force':_0x230c4e}):await serverSideLogin(_0x253325[_0x7422b(0x172)],{'force':_0x230c4e});if(_0x5b3818['imKPO'](_0x2483a2['status'],_0x5b3818['IMXzH']))console['log'](_0x7422b(0x15f));else{if(_0x2483a2['status']===_0x5b3818[_0x7422b(0xfe)]&&_0x2483a2[_0x7422b(0x128)]){console['log'](_0x5b3818[_0x7422b(0x160)]);const _0x5cca42=await writeSessionToLocalCache(_0x253325['name'],_0x253325[_0x7422b(0x159)],_0x14e9fb,_0x1014fc,_0x2483a2[_0x7422b(0x128)],_0x4f95ec,_0x574d7a);return _0x5b3818[_0x7422b(0x127)](_0x2729e8,!_0x18f6e3)&&await promptSaveCredentials(_0x253325['name']),{'authPath':_0x5cca42,'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};}else _0x2483a2[_0x7422b(0x102)]&&(console[_0x7422b(0x10c)]('\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:'),console[_0x7422b(0x10c)](_0x2483a2['test_output'])),console['log'](_0x7422b(0x14e));}}catch(_0x16f7a5){console[_0x7422b(0x10c)](_0x7422b(0xfb)+(_0x16f7a5 instanceof Error?_0x16f7a5[_0x7422b(0x147)]:_0x5b3818['dQQmP'](String,_0x16f7a5))),console[_0x7422b(0x10c)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}const _0x466500=_0x2e36e1?{..._0x2e36e1,'setupHeaders':_0x1014fc}:_0x14e9fb?{'key':_0x253325[_0x7422b(0x13a)]??'','domains':[_0x14e9fb],'setupHeaders':_0x1014fc}:null,{sessionState:_0x767afd}=await _0x5b3818[_0x7422b(0x143)](manualBrowserLogin,_0x253325,_0x466500,{'persistSessionState':!_0x286ec2}),_0x5b7198=await writeSessionToLocalCache(_0x253325[_0x7422b(0x172)],_0x253325[_0x7422b(0x159)],_0x14e9fb,_0x1014fc,_0x767afd,_0x4f95ec,_0x574d7a);return{'authPath':_0x5b7198,'settings':_0x4e68b6,'resolvedEnv':_0x2e36e1};}
|
|
1
|
+
const _0x2d19f7=_0x246f;(function(_0x34156d,_0x2a38d4){const _0x37019a=_0x246f,_0x5c2948=_0x34156d();while(!![]){try{const _0x24df7c=parseInt(_0x37019a(0x255))/0x1+parseInt(_0x37019a(0x203))/0x2*(-parseInt(_0x37019a(0x1e8))/0x3)+parseInt(_0x37019a(0x1f8))/0x4+parseInt(_0x37019a(0x254))/0x5+parseInt(_0x37019a(0x207))/0x6*(parseInt(_0x37019a(0x25d))/0x7)+-parseInt(_0x37019a(0x245))/0x8*(parseInt(_0x37019a(0x24b))/0x9)+parseInt(_0x37019a(0x25e))/0xa*(parseInt(_0x37019a(0x20d))/0xb);if(_0x24df7c===_0x2a38d4)break;else _0x5c2948['push'](_0x5c2948['shift']());}catch(_0x5698f4){_0x5c2948['push'](_0x5c2948['shift']());}}}(_0x9975,0x1afb0));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x581739 from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';function _0x9975(){const _0x3e9fa8=['targetUrl','rFzLR','\x20\x20forceLogin\x20enabled\x20for\x20\x22','\x22\x20for\x20','defaultEnvironmentKey','\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','sessionState','launch','\x20\x20Cloud\x20session\x20for\x20\x22','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','tRHje','JdPmX','iCNMd','pwEndpoint','profiles','parse','xwrOd','ysdSI','close','domains','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','OCIHz','JIzxH','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','join','tunnel_session_id','tunnel','\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a','force','NEKoh','/api/v1/profiles','goto','XjEIO','session_state','sessionId','\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.','1760216NsgPnj','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','\x22\x20failed\x20validation\x20—\x20refreshing...','status','newContext','length','9PWGAzX','ApiError','wvNLP','/api/v1/profiles/auth-config','\x20\x20Created\x20cloud\x20profile\x20\x22','storageState','Browser\x20login\x20timed\x20out\x20after\x20','invalidateOn','pHXgY','67185xKoADq','101839ILnEZI','\x20\x20Server-side\x20login\x20error:\x20','string','Browser\x20closed\x20before\x20authentication\x20was\x20saved.','trim','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','statusText','setupHeaders','1069194GQJdxB','10RJuxuj','vhdDp','OGOds','ASXXS','KHLbM','auth','xHnqi','settings','Cloud\x20profile\x20\x22','stringify','jyKrP','sessionCheckPath','DObsz','uvLqc','test_output','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','27qgpDTn',').\x20','VpdNr','Create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`\x20so\x20Ranger\x20can\x20pick\x20the\x20right\x20one.','No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22','POST','detail','loginInstructions','error','tvgtV','browserOptions','userAgent','bujpa','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','env','zSabz','101240DoXTui','vSWll','confirm','/login','DELETE','vkmEW','RANGER_TEST_PASSWORD','organizationId','\x20\x20Cached\x20session\x20for\x20\x22','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','name','31908BDOMER','username','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','/session','6alFBHI','\x22,\x20attempting\x20login...','\x20\x20Login\x20successful.\x20Session\x20cached.','pw_endpoint','UeduV','Skplf','1988767vZwPKf','TKRcu','log','\x20\x20No\x20live\x20session\x20for\x20\x22','DeUIb','PUT','cookies','code','nLFLT','zFNAB','\x22;\x20proceeding\x20with\x20loginInstructions.','success','omwbX','password','not_configured','catch','/api/v1/profiles/','persistSessionState','forceLogin','RFOwS'];_0x9975=function(){return _0x3e9fa8;};return _0x9975();}import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x2a85a1=_0x246f,_0x44a28d=await getToken();if(!_0x44a28d)throw new Error(_0x2a85a1(0x235));return _0x44a28d;}async function apiRequest(_0x5602a9,_0x54e84b={}){const _0x3c9494=_0x246f,_0x320b8a={'vSWll':function(_0x5ef9f8){return _0x5ef9f8();},'Skplf':function(_0x39eca1,_0x177bfe,_0x249711){return _0x39eca1(_0x177bfe,_0x249711);},'cwUwI':function(_0x2a1e89,_0x4fe614){return _0x2a1e89===_0x4fe614;}},_0x327cfe=await _0x320b8a['vSWll'](requireToken),_0x20282e=_0x320b8a[_0x3c9494(0x1f9)](getApiBaseUrl),_0x435705=await _0x320b8a[_0x3c9494(0x20c)](fetch,''+_0x20282e+_0x5602a9,{..._0x54e84b,'headers':{'Authorization':'Bearer\x20'+_0x327cfe,'Content-Type':'application/json',..._0x54e84b['headers']??{}}});if(!_0x435705['ok']){let _0x29c3c6='',_0x2e8776;try{const _0x430860=await _0x435705['json']();_0x29c3c6=(typeof _0x430860[_0x3c9494(0x1f0)]==='string'?_0x430860['error']:undefined)??JSON[_0x3c9494(0x1e1)](_0x430860);if(_0x320b8a['cwUwI'](typeof _0x430860['code'],_0x3c9494(0x257)))_0x2e8776=_0x430860['code'];}catch{_0x29c3c6=_0x435705[_0x3c9494(0x25b)];}throw new ApiError('API\x20request\x20'+_0x5602a9+'\x20failed\x20('+_0x435705['status']+'):\x20'+_0x29c3c6,_0x435705[_0x3c9494(0x248)],_0x29c3c6,_0x2e8776);}if(_0x435705['status']===0xcc)return undefined;return _0x435705['json']();}export class ApiError extends Error{['status'];[_0x2d19f7(0x1ee)];[_0x2d19f7(0x214)];constructor(_0x2172a6,_0x20cd19,_0x313729,_0x599993){const _0x549307=_0x2d19f7,_0x50ceb9={'JqMxY':'3|0|4|2|1'},_0x43c52b=_0x50ceb9['JqMxY']['split']('|');let _0x40a32f=0x0;while(!![]){switch(_0x43c52b[_0x40a32f++]){case'0':this[_0x549307(0x248)]=_0x20cd19;continue;case'1':this[_0x549307(0x202)]=_0x549307(0x24c);continue;case'2':this[_0x549307(0x214)]=_0x599993;continue;case'3':super(_0x2172a6);continue;case'4':this['detail']=_0x313729;continue;}break;}}}export async function fetchCloudProfile(_0x23860e){const _0x4b4878=_0x2d19f7,_0x3dcba1={'Ubmkn':function(_0x555b7d,_0x4bd223){return _0x555b7d(_0x4bd223);},'vkmEW':function(_0xadc7bd,_0xac5093){return _0xadc7bd===_0xac5093;}};try{return await apiRequest(_0x4b4878(0x21d)+_0x3dcba1['Ubmkn'](encodeURIComponent,_0x23860e));}catch(_0x24413e){if(_0x24413e instanceof ApiError&&_0x3dcba1[_0x4b4878(0x1fd)](_0x24413e[_0x4b4878(0x248)],0x194))return null;throw _0x24413e;}}export async function listCloudProfiles(){const _0x39d845=_0x2d19f7,_0x53db28={'tvgtV':function(_0x560aa4,_0x1b4eff){return _0x560aa4(_0x1b4eff);},'zSabz':'/api/v1/profiles'},_0x19873a=await _0x53db28[_0x39d845(0x1f1)](apiRequest,_0x53db28[_0x39d845(0x1f7)]);return _0x19873a[_0x39d845(0x22f)];}export async function deleteCloudProfile(_0x53aebb){const _0x20ae28=_0x2d19f7,_0x38ccc5={'dnXHg':function(_0x382f71,_0x2e0216,_0x30f41b){return _0x382f71(_0x2e0216,_0x30f41b);},'WVuHk':function(_0x5e9cc4,_0x61835){return _0x5e9cc4(_0x61835);},'OGOds':function(_0x318cec,_0x3aadcd){return _0x318cec===_0x3aadcd;}};try{await _0x38ccc5['dnXHg'](apiRequest,_0x20ae28(0x21d)+_0x38ccc5['WVuHk'](encodeURIComponent,_0x53aebb),{'method':_0x20ae28(0x1fc)});}catch(_0x2d0835){if(_0x2d0835 instanceof ApiError&&_0x38ccc5[_0x20ae28(0x260)](_0x2d0835['status'],0x194))throw new Error(_0x20ae28(0x1e0)+_0x53aebb+'\x22\x20not\x20found.');throw _0x2d0835;}}export async function createCloudProfile(_0x108028,_0x56a830,_0x52d6c4={}){const _0x21f941=_0x2d19f7,_0x123aa8={'IOQJL':_0x21f941(0x1ed)},_0x549e2b={'name':_0x108028};if(_0x56a830)_0x549e2b['environment_key']=_0x56a830;_0x52d6c4[_0x21f941(0x1df)]&&Object['keys'](_0x52d6c4[_0x21f941(0x1df)])[_0x21f941(0x24a)]>0x0&&(_0x549e2b['settings']=_0x52d6c4[_0x21f941(0x1df)]);if(_0x52d6c4[_0x21f941(0x204)])_0x549e2b['username']=_0x52d6c4[_0x21f941(0x204)];if(_0x52d6c4[_0x21f941(0x21a)])_0x549e2b[_0x21f941(0x21a)]=_0x52d6c4['password'];return await apiRequest(_0x21f941(0x23f),{'method':_0x123aa8['IOQJL'],'body':JSON[_0x21f941(0x1e1)](_0x549e2b)});}export async function uploadCloudProfileSession(_0x16a3e1,_0x2675f4){const _0x1351b9=_0x2d19f7,_0x360edb={'tRHje':function(_0x85befd,_0x26d879,_0x14879d){return _0x85befd(_0x26d879,_0x14879d);}};return await _0x360edb[_0x1351b9(0x22b)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x16a3e1)+'/session',{'method':'POST','body':JSON[_0x1351b9(0x1e1)]({'session_state':_0x2675f4})});}export async function saveCloudProfileCredentials(_0x58ce3f,_0x506440,_0x5dab95){const _0xe531d8=_0x2d19f7;await apiRequest(_0xe531d8(0x21d)+encodeURIComponent(_0x58ce3f),{'method':_0xe531d8(0x212),'body':JSON[_0xe531d8(0x1e1)]({'username':_0x506440,'password':_0x5dab95})});}export async function fetchAuthConfig(){const _0x22940c=_0x2d19f7,_0x4bb4ac={'THqmI':function(_0x46c1ea,_0x385e7){return _0x46c1ea(_0x385e7);},'OHHGg':function(_0x3d4b2c,_0x3933cd){return _0x3d4b2c instanceof _0x3933cd;},'ARuzI':function(_0x58bc09,_0x1d4fda){return _0x58bc09!==_0x1d4fda;}};try{const _0x424d56=await _0x4bb4ac['THqmI'](apiRequest,_0x22940c(0x24e));return _0x424d56['auth_config'];}catch(_0x15f204){return _0x4bb4ac['OHHGg'](_0x15f204,ApiError)&&_0x4bb4ac['ARuzI'](_0x15f204['status'],0x194)&&console['error'](_0x22940c(0x25a)+_0x15f204['message']),null;}}async function createTunnelSession(_0x50b0fe){const _0x2f48f1=_0x2d19f7,_0x5b04b={'sSMiM':function(_0x3d6fca,_0x471d3c,_0x5ad6d1){return _0x3d6fca(_0x471d3c,_0x5ad6d1);},'FtNwC':'/api/v1/tunnel/sessions'};return await _0x5b04b['sSMiM'](apiRequest,_0x5b04b['FtNwC'],{'method':'POST','body':JSON[_0x2f48f1(0x1e1)]({'targetUrl':_0x50b0fe,'mode':'agent'})});}async function deleteTunnelSession(_0x10929d){const _0x4b92cb=_0x2d19f7,_0x18f628={'iCNMd':function(_0x22e143,_0x411ee5,_0x1cc5f0){return _0x22e143(_0x411ee5,_0x1cc5f0);}};await _0x18f628[_0x4b92cb(0x22d)](apiRequest,'/api/v1/tunnel/sessions/'+_0x10929d,{'method':'DELETE'});}export function pickAdHocEnvKey(_0x1840eb){const _0x1271a9=_0x2d19f7,_0x26627b={'UeduV':function(_0x4d2c6f,_0x4e2c55){return _0x4d2c6f+_0x4e2c55;}};if(!_0x1840eb)return null;if(_0x1840eb[_0x1271a9(0x225)])return _0x1840eb[_0x1271a9(0x225)];const _0x11e915=Object['keys'](_0x1840eb['environments']??{});if(_0x11e915[_0x1271a9(0x24a)]===0x1)return _0x11e915[0x0];if(_0x11e915['length']===0x0)return null;throw new Error(_0x26627b[_0x1271a9(0x20b)]('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x11e915[_0x1271a9(0x239)](',\x20')+_0x1271a9(0x1e9),_0x1271a9(0x1eb)));}export async function resolveAdHocProfile(_0xdd37e8=process['env']){const _0x30b23d=_0x2d19f7,_0x85f950={'VrSNk':function(_0x356773,_0x5147b0){return _0x356773(_0x5147b0);},'vJsAo':function(_0x178a5f,_0x1d1966){return _0x178a5f(_0x1d1966);}},_0x56bb06=_0xdd37e8['RANGER_TEST_USERNAME'];if(!_0x56bb06)return null;const _0xdf496a=await _0x85f950['VrSNk'](fetchCloudProfile,_0x56bb06);if(_0xdf496a)return{'name':_0xdf496a[_0x30b23d(0x202)],'profile':_0xdf496a};const _0x23e375=await fetchAuthConfig(),_0x4d0e4d=_0x85f950['vJsAo'](pickAdHocEnvKey,_0x23e375),_0x1755d2=_0xdd37e8['RANGER_TEST_PASSWORD'],_0x321362=await createCloudProfile(_0x56bb06,_0x4d0e4d??undefined,{'username':_0x56bb06,'password':_0x1755d2});return console['log'](_0x30b23d(0x24f)+_0x321362['name']+_0x30b23d(0x224)+_0x56bb06),{'name':_0x321362[_0x30b23d(0x202)],'profile':_0x321362};}export async function writeSessionToLocalCache(_0x41e65a,_0x55615c,_0x206a4d,_0x314edb,_0x37a8e6,_0x3159e6,_0x1f11b0){const _0x49752f=_0x2d19f7,_0x4c2f5a={'vhdDp':function(_0x47da73){return _0x47da73();},'xwrOd':_0x49752f(0x1dd),'KmFWZ':function(_0x470b75,_0x57fc8f){return _0x470b75>_0x57fc8f;},'uvLqc':function(_0x32e0e3,_0x1ceb15,_0x37e19d){return _0x32e0e3(_0x1ceb15,_0x37e19d);},'VpdNr':function(_0x4f95b3,_0x3a0511,_0x4be21a){return _0x4f95b3(_0x3a0511,_0x4be21a);},'DObsz':function(_0x4afa0c,_0x45a113){return _0x4afa0c(_0x45a113);}},_0x19b926=sessionCacheHash({'orgId':_0x55615c,'profileName':_0x41e65a,'effectiveBaseUrl':_0x206a4d,'setupHeaders':_0x314edb,'invalidateOn':_0x1f11b0?.[_0x49752f(0x252)],'userAgent':_0x1f11b0?.['userAgent'],'clientIp':_0x1f11b0?.['clientIp']}),_0x3fffd7=getSessionCachePath(_0x19b926,_0x41e65a),_0x52504c=join(_0x4c2f5a[_0x49752f(0x25f)](getRangerHomeDir),_0x4c2f5a[_0x49752f(0x231)]);!existsSync(_0x52504c)&&await mkdir(_0x52504c,{'recursive':!![]});const _0x22c619={..._0x37a8e6};_0x3159e6&&_0x4c2f5a['KmFWZ'](_0x3159e6['length'],0x0)&&Array['isArray'](_0x22c619[_0x49752f(0x213)])&&(_0x22c619[_0x49752f(0x213)]=_0x4c2f5a[_0x49752f(0x1e5)](duplicateCookiesForDomains,_0x22c619['cookies'],_0x3159e6));const _0x49d2ad={'cached_at':new Date()['toISOString'](),'session_state':_0x22c619};await _0x4c2f5a[_0x49752f(0x1ea)](writeFile,_0x3fffd7,JSON['stringify'](_0x49d2ad,null,0x2));const _0x23ccb6=_0x4c2f5a[_0x49752f(0x1e4)](getStorageStatePath,_0x3fffd7);return await writeFile(_0x23ccb6,JSON['stringify'](_0x22c619,null,0x2)),_0x23ccb6;}export async function checkLocalCache(_0x105a16,_0x3db20d,_0xfb4263,_0x1001b1,_0x45c94a){const _0x4d931c=_0x2d19f7,_0xb1fe84={'NufhL':function(_0x31a204,_0x18b4a2,_0x5e369d){return _0x31a204(_0x18b4a2,_0x5e369d);},'zbHQw':function(_0x447136,_0x36136b){return _0x447136(_0x36136b);},'KHLbM':'utf-8'},_0x5848f5=sessionCacheHash({'orgId':_0x3db20d,'profileName':_0x105a16,'effectiveBaseUrl':_0xfb4263,'setupHeaders':_0x1001b1,'invalidateOn':_0x45c94a?.['invalidateOn'],'userAgent':_0x45c94a?.[_0x4d931c(0x1f3)],'clientIp':_0x45c94a?.['clientIp']}),_0x88d72b=_0xb1fe84['NufhL'](getSessionCachePath,_0x5848f5,_0x105a16),_0x1292d9=_0xb1fe84['zbHQw'](getStorageStatePath,_0x88d72b);if(!existsSync(_0x88d72b)||!existsSync(_0x1292d9))return null;try{const _0x1ae36a=await readFile(_0x88d72b,_0xb1fe84[_0x4d931c(0x1dc)]);return JSON[_0x4d931c(0x230)](_0x1ae36a),{'storageStatePath':_0x1292d9};}catch{return null;}}function launchRealBrowser(){const _0x395a2d=_0x2d19f7;return chromium[_0x395a2d(0x228)]({'headless':!![]});}function emitSessionValidationHint(_0x15a813,_0x272405){const _0xa3a51d=_0x2d19f7,_0x417a01={'Jqxjr':function(_0x5300fb,_0x223b01){return _0x5300fb===_0x223b01;},'wvNLP':function(_0x161df3,_0x10c587){return _0x161df3+_0x10c587;}};if(!_0x272405||!_0x272405[_0xa3a51d(0x234)]?.[_0xa3a51d(0x24a)])return;let _0x3608bd;try{_0x3608bd=new URL(_0x15a813);}catch{return;}const _0x256acb=[];for(const _0x2aa6e7 of _0x272405[_0xa3a51d(0x234)]){try{_0x256acb['push']({'raw':_0x2aa6e7,'url':new URL(_0x2aa6e7)});}catch{}}if(_0x417a01['Jqxjr'](_0x256acb['length'],0x0))return;if(_0x256acb['some'](_0x4dad1f=>_0x4dad1f['url']['origin']===_0x3608bd['origin']))return;const _0x1e3ee8=_0x256acb['map'](_0x104c1e=>'\x22'+_0x104c1e['raw']+'\x22')['join'](',\x20');console[_0xa3a51d(0x20f)](_0x417a01[_0xa3a51d(0x24d)]('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x1e3ee8+';\x20','you\x27re\x20now\x20at\x20\x22'+_0x15a813+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+_0xa3a51d(0x246));}export async function serverSideLogin(_0x3d80bc,_0x56540d){const _0x36f331=_0x2d19f7,_0x1f9836={'ASXXS':function(_0x5e743d,_0x51e3a0){return _0x5e743d instanceof _0x51e3a0;},'KZLjm':function(_0x2f949b,_0x4406c8){return _0x2f949b===_0x4406c8;},'nQcFa':function(_0x5c2791,_0x5e30f8){return _0x5c2791===_0x5e30f8;}},_0xbb505f=process[_0x36f331(0x1f6)]['RANGER_TEST_USERNAME'],_0x4e31bf=process[_0x36f331(0x1f6)]['RANGER_TEST_PASSWORD'],_0xd9ee64={};if(_0xbb505f)_0xd9ee64['username']=_0xbb505f;if(_0x4e31bf)_0xd9ee64['password']=_0x4e31bf;if(_0x56540d?.['force'])_0xd9ee64[_0x36f331(0x23d)]=!![];if(_0x56540d?.[_0x36f331(0x221)])_0xd9ee64['target_url']=_0x56540d['targetUrl'];_0x56540d?.[_0x36f331(0x23b)]&&(_0xd9ee64[_0x36f331(0x23a)]=_0x56540d['tunnel']['sessionId'],_0xd9ee64[_0x36f331(0x20a)]=_0x56540d['tunnel'][_0x36f331(0x22e)]);try{return await apiRequest(_0x36f331(0x21d)+encodeURIComponent(_0x3d80bc)+_0x36f331(0x1fb),{'method':_0x36f331(0x1ed),'body':JSON[_0x36f331(0x1e1)](_0xd9ee64)});}catch(_0xd2b739){if(_0x1f9836[_0x36f331(0x1db)](_0xd2b739,ApiError)&&_0x1f9836['KZLjm'](_0xd2b739['status'],0x190)&&_0x1f9836['nQcFa'](_0xd2b739['code'],'not_configured'))return{'status':_0x36f331(0x21b),'error':_0xd2b739['detail']};throw _0xd2b739;}}async function serverSideLoginWithOptionalTunnel(_0x3b85d1,_0x2bfc3a,_0x52bcab={}){const _0x3d61fe=_0x2d19f7,_0x593547={'eKinZ':function(_0x12cda9,_0x1666ea){return _0x12cda9(_0x1666ea);},'jyKrP':function(_0x34ab2c,_0x492181){return _0x34ab2c(_0x492181);},'sYqJj':function(_0x204109,_0x14e705,_0x3aa9ac){return _0x204109(_0x14e705,_0x3aa9ac);},'NEKoh':function(_0x3dd142,_0x6df11f){return _0x3dd142(_0x6df11f);}};if(!_0x593547['eKinZ'](needsTunnel,_0x2bfc3a))return await serverSideLogin(_0x3b85d1,{'force':_0x52bcab['force']});let _0x2c6cfd=null,_0x1ccdeb=null,_0xc4215b=null,_0x2ebb3d=null;try{_0x2c6cfd=await _0x593547[_0x3d61fe(0x1e2)](launchBrowserServer,{'headless':!![]}),_0x1ccdeb=await _0x593547['jyKrP'](createTunnelSession,_0x2bfc3a);const _0x45e773=await requireToken();_0xc4215b=await _0x593547[_0x3d61fe(0x1e2)](createTunnelBridge,{'localWsUrl':_0x2c6cfd['wsEndpoint'],'tunnelServerUrl':_0x1ccdeb['tunnelUrl'],'sessionId':_0x1ccdeb[_0x3d61fe(0x243)],'apiKey':_0x45e773,'onError':_0xeddfdf=>{_0x2ebb3d=_0xeddfdf;}});try{return await _0x593547['sYqJj'](serverSideLogin,_0x3b85d1,{'force':_0x52bcab[_0x3d61fe(0x23d)],'targetUrl':_0x2bfc3a,'tunnel':{'sessionId':_0x1ccdeb[_0x3d61fe(0x243)],'pwEndpoint':_0x1ccdeb[_0x3d61fe(0x22e)]}});}catch(_0x38e7ad){throw _0x2ebb3d??_0x38e7ad;}}finally{_0xc4215b?.['close'](),_0x2c6cfd&&await _0x2c6cfd['close']()['catch'](()=>{}),_0x1ccdeb&&await _0x593547[_0x3d61fe(0x23e)](deleteTunnelSession,_0x1ccdeb[_0x3d61fe(0x243)])[_0x3d61fe(0x21c)](()=>{});}}export async function manualBrowserLogin(_0xb7af8a,_0x4616f9,_0x50c61d={}){const _0xb1bd98=_0x2d19f7,_0x1fe0a5={'bujpa':function(_0x191397){return _0x191397();},'OCsMq':_0xb1bd98(0x233),'VCbIB':function(_0x25eeac,_0x2c144b){return _0x25eeac+_0x2c144b;},'tZPdB':'about:blank','OCIHz':'\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','RFOwS':_0xb1bd98(0x23c),'nLFLT':function(_0x1058b6,_0x3c82af){return _0x1058b6&&_0x3c82af;},'JIzxH':'Browser\x20login\x20timed\x20out\x20before\x20completion.','nhyCT':_0xb1bd98(0x258),'jIjqH':'POST','uSLkX':'cli:manual-login'};if(!isInteractive())throw new Error(_0x1fe0a5['VCbIB'](_0xb1bd98(0x1ec)+_0xb7af8a[_0xb1bd98(0x202)]+'\x22.\x0a'+_0xb1bd98(0x201),'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.'));const _0x3d7c9d=_0x4616f9&&_0x4616f9[_0xb1bd98(0x234)]['length']>0x0?_0x4616f9['domains'][0x0]:_0x1fe0a5['tZPdB'];console['log'](_0x1fe0a5[_0xb1bd98(0x236)]),console[_0xb1bd98(0x20f)](_0x1fe0a5[_0xb1bd98(0x220)]),await new Promise(_0x4f7d71=>setTimeout(_0x4f7d71,0x7d0));const _0x1c67f7=await chromium['launch']({'headless':![]});let _0x36339e=null;try{const _0x3428e8={'ignoreHTTPSErrors':!![]};_0x4616f9?.['setupHeaders']&&(_0x3428e8['extraHTTPHeaders']=_0x4616f9['setupHeaders']);const _0x466d1c=await _0x1c67f7[_0xb1bd98(0x249)](_0x3428e8);await addProfileSetupBanner(_0x466d1c);const _0x1ca33f=await _0x466d1c['newPage']();await _0x1ca33f[_0xb1bd98(0x240)](_0x3d7c9d);let _0x55d4f8=![];await new Promise(_0x2c7df4=>{const _0x106a11={'JdPmX':function(_0x1865f9){const _0x49f6f3=_0x246f;return _0x1fe0a5[_0x49f6f3(0x1f4)](_0x1865f9);}},_0x4a7f87=setTimeout(()=>{const _0x5e46ec=_0x246f;_0x55d4f8=!![],console['error'](_0x5e46ec(0x251)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+_0x5e46ec(0x244)),_0x106a11[_0x5e46ec(0x22c)](_0x2c7df4);},MANUAL_LOGIN_TIMEOUT_MS);_0x1ca33f['on'](_0x1fe0a5['OCsMq'],async()=>{const _0x26eb74=_0x246f;clearTimeout(_0x4a7f87);try{const _0x40bce6=await _0x466d1c[_0x26eb74(0x250)]();_0x36339e=_0x40bce6;}catch{}_0x2c7df4();});});if(_0x1fe0a5[_0xb1bd98(0x215)](_0x55d4f8,!_0x36339e))throw new Error(_0x1fe0a5[_0xb1bd98(0x237)]);}finally{await _0x1c67f7[_0xb1bd98(0x233)]()[_0xb1bd98(0x21c)](()=>{});}if(!_0x36339e)throw new Error(_0x1fe0a5['nhyCT']);return _0x50c61d[_0xb1bd98(0x21e)]!==![]&&await apiRequest('/api/v1/profiles/'+encodeURIComponent(_0xb7af8a[_0xb1bd98(0x202)])+_0xb1bd98(0x206),{'method':_0x1fe0a5['jIjqH'],'body':JSON[_0xb1bd98(0x1e1)]({'session_state':_0x36339e,'updated_by':_0x1fe0a5['uSLkX']})}),{'sessionState':_0x36339e};}function _0x246f(_0x197251,_0x1d25bc){_0x197251=_0x197251-0x1db;const _0x9975bf=_0x9975();let _0x246f9d=_0x9975bf[_0x197251];return _0x246f9d;}export async function promptSaveCredentials(_0x4ea7e7){const _0x1088fa=_0x2d19f7,_0x263793={'sLPmg':_0x1088fa(0x205),'SieaD':function(_0x1b7ba0,_0x357a40,_0x169398){return _0x1b7ba0(_0x357a40,_0x169398);},'ZupGV':function(_0x5934c3,_0x1a2532){return _0x5934c3(_0x1a2532);},'xHnqi':'PUT'},_0x1cda37=process[_0x1088fa(0x1f6)]['RANGER_TEST_USERNAME'],_0x244d80=process[_0x1088fa(0x1f6)][_0x1088fa(0x1fe)];if(!_0x1cda37||!_0x244d80)return;if(!isInteractive())return;const {save:_0x2eff50}=await _0x581739['prompt']([{'type':_0x1088fa(0x1fa),'name':'save','message':_0x263793['sLPmg'],'default':![]}]);if(!_0x2eff50)return;await _0x263793['SieaD'](apiRequest,_0x1088fa(0x21d)+_0x263793['ZupGV'](encodeURIComponent,_0x4ea7e7),{'method':_0x263793[_0x1088fa(0x1de)],'body':JSON[_0x1088fa(0x1e1)]({'username':_0x1cda37,'password':_0x244d80})}),console[_0x1088fa(0x20f)](_0x1088fa(0x22a));}export async function resolveCloudProfileSession(_0x1a960e,_0x3c727f={}){const _0x445f36=_0x2d19f7,_0x14b88f={'Vrduh':_0x445f36(0x257),'pHXgY':function(_0x1c78a1,_0x29c64b){return _0x1c78a1(_0x29c64b);},'pSWAF':function(_0x250237,_0x2136cd){return _0x250237>_0x2136cd;},'XjEIO':function(_0x19eb3f,_0x11721c,_0xfa217c,_0x12abd4,_0x19b4a3,_0xed80d4){return _0x19eb3f(_0x11721c,_0xfa217c,_0x12abd4,_0x19b4a3,_0xed80d4);},'zFNAB':function(_0x3565b9,_0x409dd1,_0x1df6cb){return _0x3565b9(_0x409dd1,_0x1df6cb);},'jXreB':function(_0x407fc4,_0x3aa973,_0x56c3d9,_0x43f095,_0x49a349,_0x30db29,_0x40972e,_0x2565a3){return _0x407fc4(_0x3aa973,_0x56c3d9,_0x43f095,_0x49a349,_0x30db29,_0x40972e,_0x2565a3);},'ysdSI':function(_0x1887cd,_0x171a33,_0x128fd1,_0x5b1ea5,_0x80cd1d){return _0x1887cd(_0x171a33,_0x128fd1,_0x5b1ea5,_0x80cd1d);},'rFzLR':function(_0x2abf14,_0x388518){return _0x2abf14(_0x388518);},'DeUIb':function(_0x5686fa,_0x4434f5){return _0x5686fa||_0x4434f5;},'gfUHY':function(_0x3b8849,_0x11c08c,_0x1b39ce,_0x1b7f76){return _0x3b8849(_0x11c08c,_0x1b39ce,_0x1b7f76);},'FmWGm':function(_0x49ff5a,_0x4bb690){return _0x49ff5a===_0x4bb690;},'TKRcu':function(_0x2ea4b4,_0x4d709d){return _0x2ea4b4&&_0x4d709d;},'ecVfH':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','omwbX':function(_0xfc0936,_0xcf0f59){return _0xfc0936 instanceof _0xcf0f59;}},_0x7ca479=_0x1a960e[_0x445f36(0x1df)]??{},_0x346c44=await fetchAuthConfig(),_0x30d0cb=_0x346c44?resolveAuthEnvironmentLocally(_0x346c44,_0x1a960e['environmentKey']):null,_0x5874fb=typeof _0x30d0cb?.['loginInstructions']===_0x445f36(0x257)&&_0x30d0cb[_0x445f36(0x1ef)][_0x445f36(0x259)]()?_0x30d0cb['loginInstructions']:undefined,_0x1ad8bc=typeof _0x7ca479['loginInstructions']===_0x14b88f['Vrduh']&&_0x7ca479[_0x445f36(0x1ef)]['trim']()?_0x7ca479['loginInstructions']:undefined,_0x465e99=_0x1ad8bc||!_0x5874fb?_0x7ca479:{..._0x7ca479,'loginInstructions':_0x5874fb},_0x189e64=Boolean(_0x465e99['loginInstructions']?.['trim']()),_0x9133db=_0x14b88f[_0x445f36(0x253)](Boolean,_0x7ca479[_0x445f36(0x21f)]||_0x30d0cb?.['forceLogin']),_0x75a5f3=_0x30d0cb?.['domains'],_0x10de65=_0x7ca479[_0x445f36(0x25c)],_0x4909eb=_0x10de65??_0x30d0cb?.[_0x445f36(0x25c)],_0x1fe89c=_0x3c727f['effectiveBaseUrl']??_0x7ca479['baseUrl']??(_0x75a5f3&&_0x14b88f['pSWAF'](_0x75a5f3['length'],0x0)?_0x75a5f3[0x0]:''),_0x4635bc=_0x1fe89c?needsTunnel(_0x1fe89c):![],_0x2b2009={'invalidateOn':_0x30d0cb?.['invalidateOn'],'userAgent':_0x30d0cb?.[_0x445f36(0x1f2)]?.['userAgent']??_0x7ca479['userAgent']};_0x9133db&&console[_0x445f36(0x20f)](_0x445f36(0x223)+_0x1a960e[_0x445f36(0x202)]+'\x22,\x20refreshing\x20session...');if(!_0x9133db){const _0x26a391=await _0x14b88f[_0x445f36(0x241)](checkLocalCache,_0x1a960e['name'],_0x1a960e[_0x445f36(0x1ff)],_0x1fe89c,_0x4909eb,_0x2b2009);if(_0x26a391){if(_0x1fe89c&&!_0x4635bc){const _0x5a5e47=await isCachedSessionLive(_0x26a391['storageStatePath'],_0x1fe89c,{'sessionCheckPath':_0x30d0cb?.['sessionCheckPath'],'setupHeaders':_0x4909eb},{'launchBrowser':launchRealBrowser});if(_0x5a5e47)return console['log'](_0x445f36(0x1f5)+_0x1a960e[_0x445f36(0x202)]+'\x22'),{'authPath':_0x26a391['storageStatePath'],'settings':_0x465e99,'resolvedEnv':_0x30d0cb};console['log'](_0x445f36(0x200)+_0x1a960e['name']+_0x445f36(0x247)),_0x14b88f[_0x445f36(0x216)](emitSessionValidationHint,_0x1fe89c,_0x30d0cb);}else return _0x4635bc&&console['log']('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x1a960e['name']+'\x22'),{'authPath':_0x26a391['storageStatePath'],'settings':_0x465e99,'resolvedEnv':_0x30d0cb};}}if(!_0x9133db&&_0x1a960e['sessionState']){if(_0x4635bc)console['log']('\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22'+_0x1fe89c+'\x22\x20on\x20profile\x20\x22'+_0x1a960e[_0x445f36(0x202)]+'\x22');else{const _0x33c1b9=await _0x14b88f['jXreB'](writeSessionToLocalCache,_0x1a960e['name'],_0x1a960e[_0x445f36(0x1ff)],_0x1fe89c,_0x4909eb,_0x1a960e[_0x445f36(0x227)],_0x75a5f3,_0x2b2009);if(_0x1fe89c){const _0x15391e=await _0x14b88f[_0x445f36(0x232)](isCachedSessionLive,_0x33c1b9,_0x1fe89c,{'sessionCheckPath':_0x30d0cb?.[_0x445f36(0x1e3)],'setupHeaders':_0x4909eb},{'launchBrowser':launchRealBrowser});if(_0x15391e)return console[_0x445f36(0x20f)](_0x445f36(0x1e7)+_0x1a960e['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x33c1b9,'settings':_0x465e99,'resolvedEnv':_0x30d0cb};console[_0x445f36(0x20f)](_0x445f36(0x229)+_0x1a960e[_0x445f36(0x202)]+_0x445f36(0x238)),emitSessionValidationHint(_0x1fe89c,_0x30d0cb);}else return{'authPath':_0x33c1b9,'settings':_0x465e99,'resolvedEnv':_0x30d0cb};}}if(_0x189e64)return console['log'](_0x445f36(0x210)+_0x1a960e['name']+_0x445f36(0x217)),{'authPath':undefined,'settings':_0x465e99,'resolvedEnv':_0x30d0cb};console['log']('\x20\x20No\x20live\x20session\x20for\x20\x22'+_0x1a960e[_0x445f36(0x202)]+_0x445f36(0x208));const _0x4a183f=_0x14b88f['rFzLR'](Boolean,process[_0x445f36(0x1f6)]['RANGER_TEST_USERNAME'])&&_0x14b88f[_0x445f36(0x222)](Boolean,process['env'][_0x445f36(0x1fe)]),_0x2f168b=Boolean(_0x1a960e[_0x445f36(0x204)]);if(_0x14b88f[_0x445f36(0x211)](_0x4a183f,_0x2f168b))try{const _0x58e9e8=_0x1fe89c?await _0x14b88f['gfUHY'](serverSideLoginWithOptionalTunnel,_0x1a960e['name'],_0x1fe89c,{'force':_0x9133db}):await serverSideLogin(_0x1a960e[_0x445f36(0x202)],{'force':_0x9133db});if(_0x58e9e8[_0x445f36(0x248)]===_0x445f36(0x21b))console[_0x445f36(0x20f)](_0x445f36(0x226));else{if(_0x14b88f['FmWGm'](_0x58e9e8['status'],_0x445f36(0x218))&&_0x58e9e8[_0x445f36(0x242)]){console[_0x445f36(0x20f)](_0x445f36(0x209));const _0x196935=await writeSessionToLocalCache(_0x1a960e['name'],_0x1a960e[_0x445f36(0x1ff)],_0x1fe89c,_0x4909eb,_0x58e9e8['session_state'],_0x75a5f3,_0x2b2009);return _0x14b88f[_0x445f36(0x20e)](_0x4a183f,!_0x2f168b)&&await _0x14b88f['rFzLR'](promptSaveCredentials,_0x1a960e[_0x445f36(0x202)]),{'authPath':_0x196935,'settings':_0x465e99,'resolvedEnv':_0x30d0cb};}else _0x58e9e8[_0x445f36(0x1e6)]&&(console[_0x445f36(0x20f)]('\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:'),console[_0x445f36(0x20f)](_0x58e9e8[_0x445f36(0x1e6)])),console[_0x445f36(0x20f)](_0x14b88f['ecVfH']);}}catch(_0x12e8c0){console['log'](_0x445f36(0x256)+(_0x14b88f[_0x445f36(0x219)](_0x12e8c0,Error)?_0x12e8c0['message']:_0x14b88f[_0x445f36(0x253)](String,_0x12e8c0))),console[_0x445f36(0x20f)]('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}const _0x3379d4=_0x30d0cb?{..._0x30d0cb,'setupHeaders':_0x4909eb}:_0x1fe89c?{'key':_0x1a960e['environmentKey']??'','domains':[_0x1fe89c],'setupHeaders':_0x4909eb}:null,{sessionState:_0x4b9882}=await _0x14b88f['gfUHY'](manualBrowserLogin,_0x1a960e,_0x3379d4,{'persistSessionState':!_0x4635bc}),_0x18fed2=await writeSessionToLocalCache(_0x1a960e[_0x445f36(0x202)],_0x1a960e[_0x445f36(0x1ff)],_0x1fe89c,_0x4909eb,_0x4b9882,_0x75a5f3,_0x2b2009);return{'authPath':_0x18fed2,'settings':_0x465e99,'resolvedEnv':_0x30d0cb};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x1a9c71=_0x51d2;(function(_0x1e1294,_0x2919fa){const _0x52ab0b=_0x51d2,_0x7e4f28=_0x1e1294();while(!![]){try{const _0x4dfd0b=parseInt(_0x52ab0b(0xf2))/0x1+-parseInt(_0x52ab0b(0x100))/0x2*(parseInt(_0x52ab0b(0x101))/0x3)+-parseInt(_0x52ab0b(0xe6))/0x4+parseInt(_0x52ab0b(0xf6))/0x5+-parseInt(_0x52ab0b(0xe8))/0x6+-parseInt(_0x52ab0b(0xfa))/0x7*(parseInt(_0x52ab0b(0xf5))/0x8)+-parseInt(_0x52ab0b(0x105))/0x9*(-parseInt(_0x52ab0b(0xe1))/0xa);if(_0x4dfd0b===_0x2919fa)break;else _0x7e4f28['push'](_0x7e4f28['shift']());}catch(_0x22a255){_0x7e4f28['push'](_0x7e4f28['shift']());}}}(_0x3f7e,0x6822f));function _0x51d2(_0x27396b,_0x16accf){_0x27396b=_0x27396b-0xe0;const _0x3f7ebd=_0x3f7e();let _0x51d2b1=_0x3f7ebd[_0x27396b];return _0x51d2b1;}function _0x3f7e(){const _0x111717=['push','640YUHfxn','3462pocxnM','length','catch','hex','1408221ODryXD','port','Sahqj','has','.localhost','clientIp','keys','100lyAsJi','userAgent','TdZiZ','.json','setupHeaders','2414308JHXhLM','stdout','2951628PkcwWZ','eljWK','stringify','defaultEnvironmentKey','env','startsWith','slice','cHWpI','stdin','orgId','234374mTxrXF','goto','url','24KfPFFE','3256065FdDklL','effectiveBaseUrl','profileName','replace','1304191zSEICf','newContext','endsWith','toString','test'];_0x3f7e=function(){return _0x111717;};return _0x3f7e();}import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x2d8956=process[_0x1a9c71(0xec)],_0x542bd2={'stdin':process[_0x1a9c71(0xf0)],'stdout':process['stdout']}){const _0xec28d0=_0x1a9c71,_0x55015e={'lNzKV':function(_0x2ff16b,_0x80830e){return _0x2ff16b(_0x80830e);}};if(_0x2d8956['CI'])return![];return Boolean(_0x542bd2[_0xec28d0(0xf0)]['isTTY'])&&_0x55015e['lNzKV'](Boolean,_0x542bd2[_0xec28d0(0xe7)]['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x4ed9cb){const _0xd436fb=_0x1a9c71,_0x265079={'vRKIJ':_0xd436fb(0x106),'OypXr':_0xd436fb(0xe2),'cHWpI':function(_0x2b87f3,_0x546e2b){return _0x2b87f3!==_0x546e2b;},'yZYLc':function(_0x5ac46c,_0x4030ee){return _0x5ac46c!==_0x4030ee;},'RNkyo':'sha256','xiWgr':_0xd436fb(0x104)},_0x469dfe=new Set(_0x4ed9cb['invalidateOn']??DEFAULT_INVALIDATE_ON),_0x214bfe={'orgId':_0x4ed9cb[_0xd436fb(0xf1)],'profileName':_0x4ed9cb[_0xd436fb(0xf8)]};return _0x469dfe['has']('baseUrl')&&(_0x214bfe[_0xd436fb(0xf7)]=_0x4ed9cb['effectiveBaseUrl']),_0x469dfe['has'](_0xd436fb(0xe5))&&(_0x214bfe['setupHeaders']=_0x4ed9cb[_0xd436fb(0xe5)]?sortObjectKeys(_0x4ed9cb[_0xd436fb(0xe5)]):_0x4ed9cb[_0xd436fb(0xe5)]),_0x469dfe[_0xd436fb(0x108)](_0x265079['vRKIJ'])&&(_0x214bfe['port']=extractPort(_0x4ed9cb[_0xd436fb(0xf7)])),_0x469dfe['has'](_0x265079['OypXr'])&&_0x265079[_0xd436fb(0xef)](_0x4ed9cb['userAgent'],undefined)&&(_0x214bfe['userAgent']=_0x4ed9cb['userAgent']),_0x469dfe['has']('clientIp')&&_0x265079['yZYLc'](_0x4ed9cb[_0xd436fb(0x10a)],undefined)&&(_0x214bfe[_0xd436fb(0x10a)]=_0x4ed9cb[_0xd436fb(0x10a)]),createHash(_0x265079['RNkyo'])['update'](JSON[_0xd436fb(0xea)](_0x214bfe))['digest'](_0x265079['xiWgr'])[_0xd436fb(0xee)](0x0,0xc);}function extractPort(_0x263411){const _0x1b14a1=_0x1a9c71;try{return new URL(_0x263411)[_0x1b14a1(0x106)];}catch{return'';}}function sortObjectKeys(_0x60ace9){const _0x27f0ec={};for(const _0xf403 of Object['keys'](_0x60ace9)['sort']()){_0x27f0ec[_0xf403]=_0x60ace9[_0xf403];}return _0x27f0ec;}export function getSessionCachePath(_0x4eff7d,_0x412734){const _0x545a96=_0x1a9c71,_0x29978c={'AXQBQ':function(_0x312c98,_0x4f6dab,_0x15a2c7,_0x5c0fea){return _0x312c98(_0x4f6dab,_0x15a2c7,_0x5c0fea);}};return _0x29978c['AXQBQ'](join,getRangerHomeDir(),'auth',_0x4eff7d+'-'+_0x412734+_0x545a96(0xe4));}export function getStorageStatePath(_0x98fa10){const _0x23d774=_0x1a9c71,_0x53c281={'TdZiZ':'.storageState.json'};return _0x98fa10[_0x23d774(0xf9)](/\.json$/,_0x53c281[_0x23d774(0xe3)]);}export function needsTunnel(_0x79ede5){const _0x2f3248=_0x1a9c71,_0xef08a5={'jUSOO':function(_0x467bbf,_0x6fc2fa){return _0x467bbf===_0x6fc2fa;},'Sahqj':'localhost','IZZHI':_0x2f3248(0x109)};let _0x5a6621;try{_0x5a6621=new URL(_0x79ede5)['hostname'];}catch{return![];}if(_0xef08a5['jUSOO'](_0x5a6621,_0xef08a5[_0x2f3248(0x107)])||_0x5a6621==='127.0.0.1')return!![];if(_0x5a6621[_0x2f3248(0xfc)](_0xef08a5['IZZHI']))return!![];if(_0x5a6621['includes']('localhost.'))return!![];return![];}export function hostnameOf(_0x2a7445){return new URL(_0x2a7445)['hostname'];}export function duplicateCookiesForDomains(_0x37407a,_0x6061c1){const _0x1c725a=_0x1a9c71,_0x819566=[..._0x37407a],_0xb9014e=new Set(_0x37407a['map'](_0x5a4fc6=>_0x5a4fc6['domain']));for(const _0x2c34db of _0x6061c1){let _0x430f2f;try{_0x430f2f=hostnameOf(_0x2c34db);}catch{continue;}if(!_0x430f2f)continue;const _0x178d74=_0x430f2f[_0x1c725a(0xed)]('.')?_0x430f2f:'.'+_0x430f2f;if(_0xb9014e['has'](_0x430f2f)||_0xb9014e[_0x1c725a(0x108)](_0x178d74))continue;for(const _0xccd874 of _0x37407a){_0x819566[_0x1c725a(0xff)]({..._0xccd874,'domain':_0x178d74});}_0xb9014e['add'](_0x178d74);}return _0x819566;}export function resolveAuthEnvironmentLocally(_0x2f9f38,_0x583c12){const _0x499470=_0x1a9c71,_0x1cc78d={'QXwoQ':function(_0x26d97c,_0x17d6ab){return _0x26d97c===_0x17d6ab;}},_0x5ce60a=_0x2f9f38['environments'];if(_0x583c12){const _0x19e620=_0x5ce60a[_0x583c12];if(!_0x19e620)return null;return{'key':_0x583c12,..._0x19e620};}if(_0x2f9f38[_0x499470(0xeb)]){const _0x53fd88=_0x5ce60a[_0x2f9f38[_0x499470(0xeb)]];if(!_0x53fd88)return null;return{'key':_0x2f9f38['defaultEnvironmentKey'],..._0x53fd88};}const _0x271a90=Object[_0x499470(0xe0)](_0x5ce60a);if(_0x1cc78d['QXwoQ'](_0x271a90[_0x499470(0x102)],0x1)){const _0x4971e2=_0x271a90[0x0];return{'key':_0x4971e2,..._0x5ce60a[_0x4971e2]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x4f5feb,_0x7a40a2){const _0x13551a=_0x1a9c71;try{if(_0x7a40a2)return new URL(_0x7a40a2,_0x4f5feb)[_0x13551a(0xfd)]();return new URL(_0x4f5feb)[_0x13551a(0xfd)]();}catch{return null;}}export function looksLikeLoginUrl(_0xde54e8){const _0x118a33=_0x1a9c71;try{const _0x13a5ef=new URL(_0xde54e8);return LOGIN_URL_PATTERN[_0x118a33(0xfe)](_0x13a5ef['pathname']);}catch{return LOGIN_URL_PATTERN['test'](_0xde54e8);}}export async function isCachedSessionLive(_0x6b3428,_0x4dad9a,_0x4fd1f0={},_0x440729={}){const _0x23b752=_0x1a9c71,_0x3788fb={'Shqdm':'domcontentloaded','eljWK':function(_0x325029,_0x256492){return _0x325029(_0x256492);}},_0x33e169=buildSessionCheckUrl(_0x4dad9a,_0x4fd1f0['sessionCheckPath']);if(!_0x33e169)return!![];if(!_0x440729['launchBrowser'])return!![];let _0x273c6d=null;try{_0x273c6d=await _0x440729['launchBrowser']();const _0x1376d7=await _0x273c6d[_0x23b752(0xfb)]({'storageState':_0x6b3428,'ignoreHTTPSErrors':!![],..._0x4fd1f0['setupHeaders']?{'extraHTTPHeaders':_0x4fd1f0[_0x23b752(0xe5)]}:{}}),_0xc48fca=await _0x1376d7['newPage'](),_0x1391b8=await _0xc48fca[_0x23b752(0xf3)](_0x33e169,{'waitUntil':_0x3788fb['Shqdm'],'timeout':0x3a98}),_0x197e13=_0x1391b8?.['status']();if(_0x197e13===0x191||_0x197e13===0x193)return![];const _0x507969=_0xc48fca[_0x23b752(0xf4)]();if(_0x3788fb[_0x23b752(0xe9)](looksLikeLoginUrl,_0x507969))return![];return!![];}catch{return![];}finally{if(_0x273c6d)await _0x273c6d['close']()[_0x23b752(0x103)](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
function _0x478b(){const _0x8d1a11=['16fczEym','4VwwmfC','27116PQreGx','update','getAuthTag','164cdKGBO','11135040NMRTUn','NdyDE','subarray','180025ANyoBu','10566780cWEXqL','3773541KTDbkX','11905641FcrPnD','lbeCX','3442159wDZCqL','utf8','final'];_0x478b=function(){return _0x8d1a11;};return _0x478b();}(function(_0x1fb9ff,_0x19c3e3){const _0x17374a=_0x1894,_0x111f73=_0x1fb9ff();while(!![]){try{const _0x2e97ff=parseInt(_0x17374a(0xc3))/0x1*(parseInt(_0x17374a(0xc4))/0x2)+parseInt(_0x17374a(0xbc))/0x3+parseInt(_0x17374a(0xc7))/0x4*(-parseInt(_0x17374a(0xba))/0x5)+parseInt(_0x17374a(0xc8))/0x6+-parseInt(_0x17374a(0xbf))/0x7*(parseInt(_0x17374a(0xc2))/0x8)+parseInt(_0x17374a(0xbd))/0x9+-parseInt(_0x17374a(0xbb))/0xa;if(_0x2e97ff===_0x19c3e3)break;else _0x111f73['push'](_0x111f73['shift']());}catch(_0x4c8cb0){_0x111f73['push'](_0x111f73['shift']());}}}(_0x478b,0xede4b));function _0x1894(_0x4da869,_0x30f77b){_0x4da869=_0x4da869-0xb8;const _0x478b43=_0x478b();let _0x18946e=_0x478b43[_0x4da869];return _0x18946e;}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(_0xc37df4){const _0x2b202a={'wBmOH':'sha256'};return pbkdf2Sync(_0xc37df4,SALT,0x186a0,KEY_LENGTH,_0x2b202a['wBmOH']);}export function encrypt(_0x1e2b54,_0x3dfcd8){const _0x168b8c=_0x1894,_0xcf6c9={'xGwlZ':function(_0xa24e46,_0x2d244f){return _0xa24e46(_0x2d244f);},'NdyDE':function(_0x45e213,_0xe76870){return _0x45e213(_0xe76870);}},_0xd1752b=_0xcf6c9['xGwlZ'](deriveKey,_0x3dfcd8),_0x381215=_0xcf6c9[_0x168b8c(0xb8)](randomBytes,IV_LENGTH),_0x230301=createCipheriv(ALGORITHM,_0xd1752b,_0x381215),_0x28b5b0=Buffer['concat']([_0x230301[_0x168b8c(0xc5)](_0x1e2b54,'utf8'),_0x230301['final']()]),_0x18e0c=_0x230301[_0x168b8c(0xc6)]();return Buffer['concat']([_0x381215,_0x18e0c,_0x28b5b0]);}export function decrypt(_0x338b08,_0x33f286){const _0x291586=_0x1894,_0x102d94={'uTkFs':function(_0x266ec8,_0x3adff0){return _0x266ec8+_0x3adff0;},'VQSfa':function(_0x149743,_0x1a930b){return _0x149743+_0x1a930b;},'lbeCX':_0x291586(0xc0)},_0x51e8c9=deriveKey(_0x33f286),_0x8065b6=_0x338b08['subarray'](0x0,IV_LENGTH),_0x271c48=_0x338b08[_0x291586(0xb9)](IV_LENGTH,_0x102d94['uTkFs'](IV_LENGTH,TAG_LENGTH)),_0x563e7f=_0x338b08[_0x291586(0xb9)](_0x102d94['uTkFs'](IV_LENGTH,TAG_LENGTH)),_0x153a0f=createDecipheriv(ALGORITHM,_0x51e8c9,_0x8065b6);return _0x153a0f['setAuthTag'](_0x271c48),_0x102d94['VQSfa'](_0x153a0f[_0x291586(0xc5)](_0x563e7f),_0x153a0f[_0x291586(0xc1)](_0x102d94[_0x291586(0xbe)]));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x3c82ca=_0x3f25;(function(_0x1a82c0,_0x406a79){const _0x2fc175=_0x3f25,_0x37b319=_0x1a82c0();while(!![]){try{const _0x299d06=parseInt(_0x2fc175(0x9b))/0x1*(-parseInt(_0x2fc175(0xa8))/0x2)+parseInt(_0x2fc175(0xa1))/0x3*(parseInt(_0x2fc175(0xaf))/0x4)+parseInt(_0x2fc175(0xb9))/0x5+-parseInt(_0x2fc175(0xbd))/0x6+parseInt(_0x2fc175(0xa2))/0x7*(parseInt(_0x2fc175(0xa4))/0x8)+-parseInt(_0x2fc175(0xbe))/0x9*(-parseInt(_0x2fc175(0xc8))/0xa)+parseInt(_0x2fc175(0xb2))/0xb*(-parseInt(_0x2fc175(0xc0))/0xc);if(_0x299d06===_0x406a79)break;else _0x37b319['push'](_0x37b319['shift']());}catch(_0x427a27){_0x37b319['push'](_0x37b319['shift']());}}}(_0x5459,0xeee1f));import{getToken}from'./keychain.js';function _0x3f25(_0x173745,_0x1a56fe){_0x173745=_0x173745-0x8f;const _0x5459b4=_0x5459();let _0x3f25c8=_0x5459b4[_0x173745];return _0x3f25c8;}import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';function _0x5459(){const _0x244287=['length','oEkhb','push','errorType','15BDzRMY','3727423BgyXjR','test','24mkYmXf','--secret','ydbyH','DEBUG','39174mQoIGh','--credentials','indexOf','Authorization','--pass','startsWith','runtime_error','1195468xrNnTN','Aabph','LzwLE','38390txJUTe','has_token','includes','nflIR','errorMessage','--apikey','--password','5589015chlcDW','IgCRe','error','AjXye','5693226WGpiri','2602134cvZXim','/api/v1/mcp/desire-path-logs','8556EQFNsR','featureId','has','invalid_option_value','unknown_argument','mxAqu','unknown','metadata','20rPkEEq','missing_option','Not\x20enough\x20non-option\x20arguments','IkGzM','[REDACTED]','Missing\x20required\x20argument','ofKbw','stringify','join','EWvIk','--api-key','Bearer\x20','unknown_command','Unknown\x20argument','slice','stdout','isTTY','SHLCV','19XdXDQI','Csryv'];_0x5459=function(){return _0x244287;};return _0x5459();}const SENSITIVE_FLAGS=new Set(['--token','-t',_0x3c82ca(0xa5),_0x3c82ca(0x93),_0x3c82ca(0xb7),'--key',_0x3c82ca(0xb8),_0x3c82ca(0xac),'--auth','--authorization','--header','--cookie',_0x3c82ca(0xa9)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x4f8438){const _0x7d61ef=_0x3c82ca;return TOKEN_PATTERNS['some'](_0x517fce=>_0x517fce[_0x7d61ef(0xa3)](_0x4f8438));}export function sanitizeArgs(_0x1e07a5){const _0x45a91c=_0x3c82ca,_0x4af5a4={'Aabph':function(_0x5bf26b,_0x2590db){return _0x5bf26b<_0x2590db;},'IgCRe':_0x45a91c(0xcc),'LzwLE':function(_0x3c39ca,_0x3c1059){return _0x3c39ca!==_0x3c1059;}},_0x2b14b9=[];let _0x39796d=![];for(let _0x28fd26=0x0;_0x4af5a4[_0x45a91c(0xb0)](_0x28fd26,_0x1e07a5[_0x45a91c(0x9d)]);_0x28fd26++){const _0x293878=_0x1e07a5[_0x28fd26];if(_0x39796d){_0x2b14b9['push'](_0x4af5a4[_0x45a91c(0xba)]),_0x39796d=![];continue;}if(_0x293878[_0x45a91c(0xad)]('--')||_0x293878[_0x45a91c(0xad)]('-')){const _0x4e9cd2=_0x293878[_0x45a91c(0xaa)]('=');if(_0x4af5a4[_0x45a91c(0xb1)](_0x4e9cd2,-0x1)){const _0x12672f=_0x293878[_0x45a91c(0x97)](0x0,_0x4e9cd2)['toLowerCase']();if(SENSITIVE_FLAGS[_0x45a91c(0xc2)](_0x12672f)){_0x2b14b9['push'](_0x293878[_0x45a91c(0x97)](0x0,_0x4e9cd2)+'=[REDACTED]');continue;}}else{const _0x39e269=_0x293878['toLowerCase']();SENSITIVE_FLAGS['has'](_0x39e269)&&(_0x39796d=!![]);}_0x2b14b9[_0x45a91c(0x9f)](_0x293878);}else looksLikeToken(_0x293878)?_0x2b14b9['push'](_0x45a91c(0xcc)):_0x2b14b9[_0x45a91c(0x9f)](_0x293878);}return _0x2b14b9[_0x45a91c(0x91)]('\x20');}export async function logDesirePath(_0x55a3ed){const _0x43d022=_0x3c82ca,_0x58dd1c={'nflIR':function(_0x1db174){return _0x1db174();},'LMQpl':'no_token','mxAqu':'application/json','MCFaX':function(_0x508ee8,_0x1396db,_0x5316e7){return _0x508ee8(_0x1396db,_0x5316e7);},'IkGzM':'POST'};try{const _0x2468f2=await _0x58dd1c[_0x43d022(0xb5)](getToken)['catch'](()=>null),_0x2c3970=getApiBaseUrl(),_0x373948=_0x58dd1c['nflIR'](getCurrentVersion),_0x2028e1=_0x2468f2?_0x43d022(0xb3):_0x58dd1c['LMQpl'],_0x2bde75={..._0x55a3ed[_0x43d022(0xc7)],'authStatus':_0x2028e1,'isTty':process[_0x43d022(0x98)][_0x43d022(0x99)]??![]},_0x2f99dc={'Content-Type':_0x58dd1c[_0x43d022(0xc5)]};_0x2468f2&&(_0x2f99dc[_0x43d022(0xab)]=_0x43d022(0x94)+_0x2468f2);const _0x54160f={'rawCommand':_0x55a3ed['rawCommand'],'errorMessage':_0x55a3ed[_0x43d022(0xb6)],'errorType':_0x55a3ed[_0x43d022(0xa0)],'featureId':_0x55a3ed[_0x43d022(0xc1)],'sessionId':_0x55a3ed['sessionId'],'metadata':_0x2bde75,'cliVersion':_0x373948};process['env']['DEBUG']&&(console['error']('[desire-path]\x20Sending\x20log\x20to\x20'+_0x2c3970+_0x43d022(0xbf)),console['error']('[desire-path]\x20Payload:\x20'+JSON['stringify'](_0x54160f,null,0x2))),await _0x58dd1c['MCFaX'](fetch,_0x2c3970+_0x43d022(0xbf),{'method':_0x58dd1c[_0x43d022(0xcb)],'headers':_0x2f99dc,'body':JSON[_0x43d022(0x90)](_0x54160f)});}catch(_0x194d1a){process['env'][_0x43d022(0xa7)]&&console[_0x43d022(0xbb)]('[desire-path]\x20Failed\x20to\x20send:\x20'+_0x194d1a);}}export function getErrorType(_0x47f08e,_0xea2d1e){const _0x59aa9d=_0x3c82ca,_0x1f7ef8={'AjXye':_0x59aa9d(0xae),'ydbyH':'Unknown\x20command','EWvIk':_0x59aa9d(0x96),'qTuUn':_0x59aa9d(0xca),'oEkhb':'Invalid\x20values','Csryv':_0x59aa9d(0xcd),'ofKbw':_0x59aa9d(0xc9),'SHLCV':'syntax_error'};if(_0xea2d1e)return _0x1f7ef8[_0x59aa9d(0xbc)];if(!_0x47f08e)return _0x59aa9d(0xc6);if(_0x47f08e['includes'](_0x1f7ef8[_0x59aa9d(0xa6)]))return _0x59aa9d(0x95);if(_0x47f08e[_0x59aa9d(0xb4)](_0x1f7ef8[_0x59aa9d(0x92)]))return _0x59aa9d(0xc4);if(_0x47f08e['includes'](_0x1f7ef8['qTuUn']))return'missing_required_argument';if(_0x47f08e['includes'](_0x1f7ef8[_0x59aa9d(0x9e)]))return _0x59aa9d(0xc3);if(_0x47f08e[_0x59aa9d(0xb4)](_0x1f7ef8[_0x59aa9d(0x9c)]))return _0x1f7ef8[_0x59aa9d(0x8f)];return _0x1f7ef8[_0x59aa9d(0x9a)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x3f6f9d=_0x4677;(function(_0x4e7be1,_0x92ab58){const _0x24e268=_0x4677,_0x1f8f8b=_0x4e7be1();while(!![]){try{const _0x513f6c=parseInt(_0x24e268(0x13d))/0x1+-parseInt(_0x24e268(0x128))/0x2*(parseInt(_0x24e268(0x17f))/0x3)+parseInt(_0x24e268(0x133))/0x4*(parseInt(_0x24e268(0x170))/0x5)+-parseInt(_0x24e268(0x163))/0x6*(parseInt(_0x24e268(0x169))/0x7)+parseInt(_0x24e268(0x131))/0x8*(parseInt(_0x24e268(0x132))/0x9)+-parseInt(_0x24e268(0x146))/0xa+parseInt(_0x24e268(0x142))/0xb;if(_0x513f6c===_0x92ab58)break;else _0x1f8f8b['push'](_0x1f8f8b['shift']());}catch(_0x5bfb69){_0x1f8f8b['push'](_0x1f8f8b['shift']());}}}(_0x2d43,0xa898e));function _0x2d43(){const _0x34f110=['9Ahgzcz','fOvZd','apiKeys','workosClientId','499308hkhsog','dlVoI','isTTY','POST','UTzik','UECKA','wYpLo','access_token','length','86120BLfXPY','981rtXMqO','4aFxuDO','application/json','/api-keys','apiKey','json','qCgTg','IZdhc','ScRtZ','Device\x20authorization\x20timed\x20out','GET','1083682puhXts','CLI\x20Key','Failed\x20to\x20request\x20device\x20code:\x20','YJbAS','iHGuh','9147710YrCOBY','device_code','WkZIi','xdg-open','13531910GKMDNO','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','jqBYC','Setting\x20up\x20your\x20organization...','from','Using\x20organization:\x20','stdout','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','Zgffu','zSaIr','jZJaP','map','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','Code:\x20','user_code','stdin','egvMo','JmnMB','Failed\x20to\x20create\x20organization:\x20','https://api.workos.com/user_management/authorize/device','/organization/my-memberships','organizationId','ddjns','log','verification_uri_complete','startsWith','wTMRs','stringify','Authentication\x20failed','6033318FQxMhp','QSwGu','parse','SvmQh','urn:ietf:params:oauth:grant-type:device_code','win32','7ZtzSYh','XUAge','text','mcp:write','org_id','pqgXc','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','3548015rAzMsv','status','/organization/me','error','/cli-auth/token','expires_in','utf-8','now','aAJrV','application/x-www-form-urlencoded','memberships','toString','vthkH','Failed\x20to\x20provision\x20API\x20key:\x20','platform'];_0x2d43=function(){return _0x34f110;};return _0x2d43();}import{spawn}from'child_process';import _0x27f7aa from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x3f6f9d(0x159),WORKOS_TOKEN_URL='https://api.workos.com/user_management/authenticate';function _0x4677(_0x1ba513,_0x341e22){_0x1ba513=_0x1ba513-0x128;const _0x2d43c3=_0x2d43();let _0x46776c=_0x2d43c3[_0x1ba513];return _0x46776c;}export async function requestDeviceCode(_0x4828ab){const _0x326104=_0x3f6f9d,_0x247b7b=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x326104(0x12b),'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x4828ab})});if(!_0x247b7b['ok']){const _0x50761e=await _0x247b7b[_0x326104(0x16b)]();throw new Error(_0x326104(0x13f)+_0x247b7b['status']+'\x20'+_0x50761e);}return _0x247b7b['json']();}export async function pollForTokens(_0xe78bae,_0xd3e7fb,_0x402531,_0x189083){const _0x465749=_0x3f6f9d,_0x4eaf4d={'XUAge':function(_0x170287,_0x194fb1){return _0x170287+_0x194fb1;},'DcMMG':_0x465749(0x12b),'IKGXg':function(_0x4e1e74,_0x285116){return _0x4e1e74===_0x285116;},'SvmQh':'authorization_pending','BnSNN':function(_0x202546,_0x5cc41d){return _0x202546===_0x5cc41d;},'pqgXc':_0x465749(0x162),'wFeAp':_0x465749(0x13b)},_0x383372=_0x4eaf4d[_0x465749(0x16a)](Date[_0x465749(0x177)](),_0x189083*0x3e8);let _0x536e4d=_0x402531*0x3e8;while(Date['now']()<_0x383372){await sleep(_0x536e4d);const _0x2de856=await fetch(WORKOS_TOKEN_URL,{'method':_0x4eaf4d['DcMMG'],'headers':{'Content-Type':_0x465749(0x179)},'body':new URLSearchParams({'client_id':_0xe78bae,'device_code':_0xd3e7fb,'grant_type':_0x465749(0x167)})});if(_0x2de856['ok'])return _0x2de856['json']();const _0x41ea75=await _0x2de856['json']();if(_0x4eaf4d['IKGXg'](_0x41ea75[_0x465749(0x173)],_0x4eaf4d[_0x465749(0x166)]))continue;if(_0x4eaf4d['BnSNN'](_0x41ea75['error'],'slow_down')){_0x536e4d+=0x3e8;continue;}throw new Error(_0x41ea75['error_description']||_0x41ea75[_0x465749(0x173)]||_0x4eaf4d[_0x465749(0x16e)]);}throw new Error(_0x4eaf4d['wFeAp']);}async function fetchUserProfile(_0x3f844f){const _0x40dafb=_0x3f6f9d,_0x30f29c={'IZdhc':function(_0x44bcf3){return _0x44bcf3();},'wYpLo':function(_0x3bdf9f,_0x557a61,_0x111fdd){return _0x3bdf9f(_0x557a61,_0x111fdd);},'JmnMB':'GET'},_0x1b5ebf=_0x30f29c[_0x40dafb(0x139)](getApiBaseUrl);try{const _0x539a6d=await _0x30f29c[_0x40dafb(0x12e)](fetch,_0x1b5ebf+_0x40dafb(0x172),{'method':_0x30f29c[_0x40dafb(0x157)],'headers':{'workos-token':_0x3f844f}});if(_0x539a6d['ok'])return _0x539a6d['json']();}catch{}return null;}function buildKeyName(_0x1e33b2,_0x25a4a){const _0x5bdfd0=_0x3f6f9d,_0x1166f0={'iHGuh':function(_0x191dcb,_0x218b0d){return _0x191dcb===_0x218b0d;}},_0x26821b=_0x25a4a['filter'](_0x17d7c3=>_0x17d7c3['name']===_0x1e33b2||_0x17d7c3['name'][_0x5bdfd0(0x15f)](_0x1e33b2+'\x20('));if(_0x1166f0[_0x5bdfd0(0x141)](_0x26821b[_0x5bdfd0(0x130)],0x0))return _0x1e33b2;return _0x1e33b2+'\x20('+(_0x26821b[_0x5bdfd0(0x130)]+0x1)+')';}export async function provisionApiKey(_0x5a0be5){const _0x13346b=_0x3f6f9d,_0xea5b2a={'aAJrV':function(_0x3606f3){return _0x3606f3();},'ZNlis':'application/json','dlVoI':'GET','zSaIr':_0x13346b(0x16c)},_0x1d5393=_0xea5b2a[_0x13346b(0x178)](getApiBaseUrl),_0x58ebc1={'Content-Type':_0xea5b2a['ZNlis'],'workos-token':_0x5a0be5},_0x110d77=await fetchUserProfile(_0x5a0be5),_0xe355ec=_0x110d77?.['firstName']||_0x110d77?.['email']?.['split']('@')[0x0],_0xe09ef=_0xe355ec?_0xe355ec+'\x27s\x20CLI\x20Key':_0x13346b(0x13e);let _0x5daa75=[];try{const _0x1c78c2=await fetch(_0x1d5393+'/api-keys',{'method':_0xea5b2a[_0x13346b(0x129)],'headers':_0x58ebc1});if(_0x1c78c2['ok']){const _0xd6f800=await _0x1c78c2[_0x13346b(0x137)]();_0x5daa75=_0xd6f800[_0x13346b(0x181)];}}catch{}const _0x529b0c=buildKeyName(_0xe09ef,_0x5daa75),_0x132518=await fetch(_0x1d5393+_0x13346b(0x135),{'method':_0x13346b(0x12b),'headers':_0x58ebc1,'body':JSON[_0x13346b(0x161)]({'name':_0x529b0c,'scope':_0xea5b2a[_0x13346b(0x14f)]})});if(!_0x132518['ok']){const _0x592547=await _0x132518['text']();throw new Error(_0x13346b(0x17d)+_0x132518['status']+'\x20'+_0x592547);}const _0x1d7938=await _0x132518[_0x13346b(0x137)]();return _0x1d7938[_0x13346b(0x136)]['token'];}export function openBrowser(_0x2ee556){const _0x4c86b7=_0x3f6f9d,_0x1fccb1={'nMyUp':function(_0x18d6d7,_0x498246){return _0x18d6d7===_0x498246;},'illbl':_0x4c86b7(0x168),'fOvZd':function(_0x19639e,_0x24cf9b,_0x1f155c,_0x26827a){return _0x19639e(_0x24cf9b,_0x1f155c,_0x26827a);},'jqBYC':'cmd','sfIbI':'start','ffkpx':'ignore','YDaST':_0x4c86b7(0x145)};try{if(_0x1fccb1['nMyUp'](process[_0x4c86b7(0x17e)],_0x1fccb1['illbl'])){const _0x598306=_0x1fccb1[_0x4c86b7(0x180)](spawn,_0x1fccb1[_0x4c86b7(0x148)],['/c',_0x1fccb1['sfIbI'],'',_0x2ee556],{'detached':!![],'stdio':_0x1fccb1['ffkpx'],'windowsHide':!![]});_0x598306['unref']();return;}const _0x32a3d5=process[_0x4c86b7(0x17e)]==='darwin'?'open':_0x1fccb1['YDaST'],_0x38cbe3=spawn(_0x32a3d5,[_0x2ee556],{'detached':!![],'stdio':_0x1fccb1['ffkpx']});_0x38cbe3['unref']();}catch{}}function decodeJwtPayload(_0x96c3c9){const _0x1f6743=_0x3f6f9d,_0x5b99ce=_0x96c3c9['split']('.');if(_0x5b99ce['length']!==0x3)throw new Error('Invalid\x20JWT\x20format');const _0x4f6afd=Buffer[_0x1f6743(0x14a)](_0x5b99ce[0x1],'base64url')[_0x1f6743(0x17b)](_0x1f6743(0x176));return JSON[_0x1f6743(0x165)](_0x4f6afd);}async function selfServeSignup(_0x1c3c85){const _0x107eb2=_0x3f6f9d,_0x45b805={'CJuHs':function(_0x12cbf9){return _0x12cbf9();},'pProL':function(_0x11f7bc,_0x2e4e51,_0x580666){return _0x11f7bc(_0x2e4e51,_0x580666);},'ScRtZ':'application/json'},_0x376f57=_0x45b805['CJuHs'](getApiBaseUrl),_0x3992a6=await _0x45b805['pProL'](fetch,_0x376f57+'/organization/self-serve-signup',{'method':_0x107eb2(0x12b),'headers':{'Content-Type':_0x45b805[_0x107eb2(0x13a)],'workos-token':_0x1c3c85}});if(!_0x3992a6['ok']){const _0x734870=await _0x3992a6['text']();throw new Error(_0x107eb2(0x158)+_0x3992a6['status']+'\x20'+_0x734870);}return _0x3992a6['json']();}async function fetchMyMemberships(_0x4b8a43){const _0x33b53b=_0x3f6f9d,_0x7575ad={'UTzik':function(_0x5c214d,_0x5851ce,_0x32aaca){return _0x5c214d(_0x5851ce,_0x32aaca);}},_0x365594=getApiBaseUrl(),_0x2384aa=await _0x7575ad[_0x33b53b(0x12c)](fetch,_0x365594+_0x33b53b(0x15a),{'method':_0x33b53b(0x13c),'headers':{'workos-token':_0x4b8a43}});if(!_0x2384aa['ok']){const _0x4f9494=await _0x2384aa['text']();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x2384aa['status']+'\x20'+_0x4f9494);}const _0x2bbeca=await _0x2384aa[_0x33b53b(0x137)]();return _0x2bbeca[_0x33b53b(0x17a)];}async function refreshTokenWithOrg(_0x187175,_0x59ac7c,_0x56fb73){const _0x43446a=_0x3f6f9d,_0x2c00ec={'IGtUl':function(_0x251175,_0x52b02c,_0x120e48){return _0x251175(_0x52b02c,_0x120e48);},'YIvBo':_0x43446a(0x12b),'NcdxK':'refresh_token'},_0x49e7df=await _0x2c00ec['IGtUl'](fetch,WORKOS_TOKEN_URL,{'method':_0x2c00ec['YIvBo'],'headers':{'Content-Type':_0x43446a(0x179)},'body':new URLSearchParams({'client_id':_0x187175,'grant_type':_0x2c00ec['NcdxK'],'refresh_token':_0x59ac7c,'organization_id':_0x56fb73})});if(!_0x49e7df['ok']){const _0x44c429=await _0x49e7df[_0x43446a(0x16b)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x49e7df[_0x43446a(0x171)]+'\x20'+_0x44c429);}return _0x49e7df['json']();}async function provisionCliToken(_0x14d876){const _0xc20ecd=_0x3f6f9d,_0x37627e={'XQCVa':function(_0x3029f2){return _0x3029f2();},'YJbAS':function(_0x5631f0,_0x460dd0,_0x5afd9c){return _0x5631f0(_0x460dd0,_0x5afd9c);},'jZJaP':_0xc20ecd(0x12b),'QSwGu':_0xc20ecd(0x134)},_0xa24f76=_0x37627e['XQCVa'](getApiBaseUrl),_0x5ecc51=await _0x37627e[_0xc20ecd(0x140)](fetch,_0xa24f76+_0xc20ecd(0x174),{'method':_0x37627e[_0xc20ecd(0x150)],'headers':{'Content-Type':_0x37627e[_0xc20ecd(0x164)],'workos-token':_0x14d876}});if(!_0x5ecc51['ok']){const _0x411d28=await _0x5ecc51['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x5ecc51[_0xc20ecd(0x171)]+'\x20'+_0x411d28);}return _0x5ecc51['json']();}export async function runDeviceAuthFlow(){const _0x2e1704=_0x3f6f9d,_0x5055f0={'wTMRs':function(_0x433720){return _0x433720();},'ddjns':function(_0x6e7838,_0x3867ce){return _0x6e7838(_0x3867ce);},'DJRbS':_0x2e1704(0x152),'qCgTg':'Waiting\x20for\x20authentication...','hAWIQ':function(_0x50fce0,_0x3c303d){return _0x50fce0(_0x3c303d);},'UECKA':function(_0x1a7085,_0x46e7b3){return _0x1a7085(_0x46e7b3);},'lyGZB':function(_0x14bcb3,_0x4a0e50){return _0x14bcb3(_0x4a0e50);},'Zgffu':function(_0x1ced2d,_0x24b3a6){return _0x1ced2d===_0x24b3a6;},'egvMo':function(_0x222c74,_0x3a26a5){return _0x222c74+_0x3a26a5;},'elnnn':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','vthkH':'selected','WkZIi':function(_0x37c656,_0x5ea30e,_0x542485,_0x138685){return _0x37c656(_0x5ea30e,_0x542485,_0x138685);},'TxhZp':function(_0x256e3e,_0x66e739){return _0x256e3e(_0x66e739);},'ojHru':function(_0x29db51,_0x22c9ce){return _0x29db51(_0x22c9ce);}},_0x381fec=_0x5055f0[_0x2e1704(0x160)](getCurrentEnvironment),_0x15ec78=ENVIRONMENT_CONFIGS[_0x381fec][_0x2e1704(0x182)],_0x3adfc6=await _0x5055f0[_0x2e1704(0x15c)](requestDeviceCode,_0x15ec78);console[_0x2e1704(0x15d)](_0x5055f0['DJRbS']),console[_0x2e1704(0x15d)](_0x2e1704(0x14d)),_0x5055f0['ddjns'](openBrowser,_0x3adfc6[_0x2e1704(0x15e)]),console[_0x2e1704(0x15d)](_0x2e1704(0x16f)+_0x3adfc6['verification_uri_complete']),console['log'](_0x2e1704(0x153)+_0x3adfc6[_0x2e1704(0x154)]+'\x0a'),process['stdout']['write'](_0x5055f0[_0x2e1704(0x138)]);let _0x15ec3f=await pollForTokens(_0x15ec78,_0x3adfc6[_0x2e1704(0x143)],_0x3adfc6['interval'],_0x3adfc6[_0x2e1704(0x175)]);console[_0x2e1704(0x15d)]('\x20✓');const _0x2bb197=_0x5055f0['hAWIQ'](decodeJwtPayload,_0x15ec3f['access_token']);if(!_0x2bb197[_0x2e1704(0x16d)]){const _0xdfa552=await _0x5055f0[_0x2e1704(0x12d)](fetchMyMemberships,_0x15ec3f['access_token']);let _0x4664e2;if(_0xdfa552[_0x2e1704(0x130)]===0x0){process[_0x2e1704(0x14c)]['write'](_0x2e1704(0x149));const _0x21848f=await _0x5055f0['lyGZB'](selfServeSignup,_0x15ec3f['access_token']);_0x4664e2=_0x21848f[_0x2e1704(0x15b)],console[_0x2e1704(0x15d)]('\x20✓');}else{if(_0x5055f0[_0x2e1704(0x14e)](_0xdfa552['length'],0x1))_0x4664e2=_0xdfa552[0x0]['organizationId'],console['log'](_0x2e1704(0x14b)+_0xdfa552[0x0]['name']);else{const _0x18591f=process[_0x2e1704(0x155)][_0x2e1704(0x12a)]&&process['stdout']['isTTY'];if(!_0x18591f)throw new Error(_0x5055f0[_0x2e1704(0x156)](_0x5055f0['elnnn'],_0x2e1704(0x147)));const {selected:_0x3c60e8}=await _0x27f7aa['prompt']([{'type':'list','name':_0x5055f0[_0x2e1704(0x17c)],'message':'Select\x20an\x20organization:','choices':_0xdfa552[_0x2e1704(0x151)](_0xd19f07=>({'name':_0xd19f07['name'],'value':_0xd19f07[_0x2e1704(0x15b)]}))}]);_0x4664e2=_0x3c60e8;}}_0x15ec3f=await _0x5055f0[_0x2e1704(0x144)](refreshTokenWithOrg,_0x15ec78,_0x15ec3f['refresh_token'],_0x4664e2);}process['stdout']['write']('Provisioning\x20CLI\x20token...');const _0x504610=await _0x5055f0['TxhZp'](provisionCliToken,_0x15ec3f[_0x2e1704(0x12f)]);return console[_0x2e1704(0x15d)]('\x20✓'),await _0x5055f0['ojHru'](storeToken,_0x504610['token']),_0x15ec3f['refresh_token']&&await storeRefreshToken(_0x15ec3f['refresh_token']),_0x504610['token'];}function sleep(_0x5eb155){return new Promise(_0xd97da8=>setTimeout(_0xd97da8,_0x5eb155));}
|
|
1
|
+
(function(_0x1c5a7e,_0x1fc12d){const _0x2b1f31=_0x2e26,_0x1471df=_0x1c5a7e();while(!![]){try{const _0x3db07b=-parseInt(_0x2b1f31(0x155))/0x1+-parseInt(_0x2b1f31(0x157))/0x2+-parseInt(_0x2b1f31(0x17a))/0x3*(-parseInt(_0x2b1f31(0x169))/0x4)+parseInt(_0x2b1f31(0x154))/0x5*(-parseInt(_0x2b1f31(0x172))/0x6)+-parseInt(_0x2b1f31(0x153))/0x7*(-parseInt(_0x2b1f31(0x156))/0x8)+-parseInt(_0x2b1f31(0x16e))/0x9*(-parseInt(_0x2b1f31(0x181))/0xa)+parseInt(_0x2b1f31(0x151))/0xb;if(_0x3db07b===_0x1fc12d)break;else _0x1471df['push'](_0x1471df['shift']());}catch(_0x4c56ee){_0x1471df['push'](_0x1471df['shift']());}}}(_0x1be7,0x4db87));import{spawn}from'child_process';function _0x2e26(_0x49b54a,_0x16690d){_0x49b54a=_0x49b54a-0x14a;const _0x1be7b4=_0x1be7();let _0x2e2648=_0x1be7b4[_0x49b54a];return _0x2e2648;}import _0x1c036e 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(_0x49e675){const _0x2b7350=_0x2e26,_0x185a47={'UJvLM':'POST','XLYQd':'application/x-www-form-urlencoded'},_0x13ac19=await fetch(WORKOS_DEVICE_AUTH_URL,{'method':_0x185a47[_0x2b7350(0x1a1)],'headers':{'Content-Type':_0x185a47[_0x2b7350(0x18a)]},'body':new URLSearchParams({'client_id':_0x49e675})});if(!_0x13ac19['ok']){const _0x176a4b=await _0x13ac19['text']();throw new Error('Failed\x20to\x20request\x20device\x20code:\x20'+_0x13ac19['status']+'\x20'+_0x176a4b);}return _0x13ac19['json']();}export async function pollForTokens(_0xf6e3dc,_0x532ebc,_0x26bc57,_0x569256){const _0x53d8d3=_0x2e26,_0x41433e={'EPRCw':function(_0x3632d5,_0x4002ae){return _0x3632d5+_0x4002ae;},'aexxC':function(_0x252ffa,_0x256cde){return _0x252ffa*_0x256cde;},'KGeaj':function(_0x280a1f,_0x2cc526){return _0x280a1f*_0x2cc526;},'sAoKO':function(_0x456294,_0x358832){return _0x456294<_0x358832;},'PbiVb':'POST','SCqHM':_0x53d8d3(0x1a5),'aYEIB':function(_0x175c0d,_0x463d59){return _0x175c0d===_0x463d59;},'BOWsh':_0x53d8d3(0x158),'DfRrb':_0x53d8d3(0x1a2)},_0x190119=_0x41433e[_0x53d8d3(0x16a)](Date['now'](),_0x41433e['aexxC'](_0x569256,0x3e8));let _0x458948=_0x41433e[_0x53d8d3(0x152)](_0x26bc57,0x3e8);while(_0x41433e['sAoKO'](Date[_0x53d8d3(0x186)](),_0x190119)){await sleep(_0x458948);const _0x116841=await fetch(WORKOS_TOKEN_URL,{'method':_0x41433e['PbiVb'],'headers':{'Content-Type':_0x53d8d3(0x189)},'body':new URLSearchParams({'client_id':_0xf6e3dc,'device_code':_0x532ebc,'grant_type':_0x41433e['SCqHM']})});if(_0x116841['ok'])return _0x116841['json']();const _0x2906b6=await _0x116841['json']();if(_0x41433e[_0x53d8d3(0x160)](_0x2906b6[_0x53d8d3(0x15d)],_0x53d8d3(0x190)))continue;if(_0x2906b6['error']===_0x53d8d3(0x14d)){_0x458948+=0x3e8;continue;}throw new Error(_0x2906b6['error_description']||_0x2906b6[_0x53d8d3(0x15d)]||_0x41433e[_0x53d8d3(0x177)]);}throw new Error(_0x41433e[_0x53d8d3(0x16c)]);}async function fetchUserProfile(_0x41bbbb){const _0x210f57=_0x2e26,_0x562dac={'kkdzz':function(_0x153217,_0x52056d,_0x53f4a5){return _0x153217(_0x52056d,_0x53f4a5);},'VNsoO':_0x210f57(0x165)},_0x32e3c9=getApiBaseUrl();try{const _0x22aa9f=await _0x562dac[_0x210f57(0x18d)](fetch,_0x32e3c9+_0x210f57(0x170),{'method':_0x562dac[_0x210f57(0x14b)],'headers':{'workos-token':_0x41bbbb}});if(_0x22aa9f['ok'])return _0x22aa9f['json']();}catch{}return null;}function buildKeyName(_0x4394b6,_0x6288e1){const _0x24c490=_0x2e26,_0x4a936e=_0x6288e1['filter'](_0x30b2a9=>_0x30b2a9[_0x24c490(0x18f)]===_0x4394b6||_0x30b2a9[_0x24c490(0x18f)]['startsWith'](_0x4394b6+'\x20('));if(_0x4a936e['length']===0x0)return _0x4394b6;return _0x4394b6+'\x20('+(_0x4a936e[_0x24c490(0x15e)]+0x1)+')';}function _0x1be7(){const _0x4ff926=['mcp:write','json','access_token','yUsQx','sFuEo','refresh_token','unref','status','xdg-open','organizationId','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','Zhkyb','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','toString','UJvLM','Device\x20authorization\x20timed\x20out','wNJJu','Failed\x20to\x20refresh\x20token\x20with\x20org:\x20','urn:ietf:params:oauth:grant-type:device_code','ICVWk','email','split','memberships','VNsoO','HOqZv','slow_down','from','KPemA','FrGcC','4350126XnqGmO','KGeaj','3647YBKsqc','25DYHGwF','581189WCHRhk','7768uJkDBv','507636AyDZnx','Authentication\x20failed','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','cmd','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','sPsgz','error','length','VeriQ','aYEIB','parse','apiKeys','darwin','platform','GET','list','token','POST','524DOawLO','EPRCw','log','DfRrb','firstName','9yvxVSL','isTTY','/organization/me','Failed\x20to\x20create\x20organization:\x20','381462eQQaRg','/api-keys','application/json','YJkWz','text','BOWsh','start','write','321YZfViz','hZkqX','HsVgX','map','/organization/my-memberships','verification_uri_complete','selected','5558610RbVOmR','ignore','stdout','stringify','aziFY','now','Code:\x20','aOWZa','application/x-www-form-urlencoded','XLYQd','user_code','MXaWr','kkdzz','prompt','name','authorization_pending','apiKey','lkEHq'];_0x1be7=function(){return _0x4ff926;};return _0x1be7();}export async function provisionApiKey(_0x354964){const _0x2b3bf5=_0x2e26,_0xaa3dd2={'cRUyM':'application/json','aziFY':function(_0x48bee9,_0x3842be){return _0x48bee9(_0x3842be);},'Zhkyb':function(_0x4b45d8,_0x51b0d1,_0x1f0b95){return _0x4b45d8(_0x51b0d1,_0x1f0b95);},'cvPwv':'GET','sFuEo':function(_0x53884d,_0x34d417,_0xe85c7b){return _0x53884d(_0x34d417,_0xe85c7b);}},_0x55ae21=getApiBaseUrl(),_0x42ff93={'Content-Type':_0xaa3dd2['cRUyM'],'workos-token':_0x354964},_0x258151=await _0xaa3dd2[_0x2b3bf5(0x185)](fetchUserProfile,_0x354964),_0x5d4c62=_0x258151?.[_0x2b3bf5(0x16d)]||_0x258151?.[_0x2b3bf5(0x1a7)]?.['split']('@')[0x0],_0x160d8a=_0x5d4c62?_0x5d4c62+'\x27s\x20CLI\x20Key':'CLI\x20Key';let _0x157270=[];try{const _0x397de7=await _0xaa3dd2[_0x2b3bf5(0x19e)](fetch,_0x55ae21+_0x2b3bf5(0x173),{'method':_0xaa3dd2['cvPwv'],'headers':_0x42ff93});if(_0x397de7['ok']){const _0x2a8986=await _0x397de7[_0x2b3bf5(0x194)]();_0x157270=_0x2a8986[_0x2b3bf5(0x162)];}}catch{}const _0x1adc72=_0xaa3dd2['Zhkyb'](buildKeyName,_0x160d8a,_0x157270),_0x30570d=await _0xaa3dd2[_0x2b3bf5(0x197)](fetch,_0x55ae21+'/api-keys',{'method':_0x2b3bf5(0x168),'headers':_0x42ff93,'body':JSON[_0x2b3bf5(0x184)]({'name':_0x1adc72,'scope':_0x2b3bf5(0x193)})});if(!_0x30570d['ok']){const _0x9d442d=await _0x30570d[_0x2b3bf5(0x176)]();throw new Error('Failed\x20to\x20provision\x20API\x20key:\x20'+_0x30570d['status']+'\x20'+_0x9d442d);}const _0x12d227=await _0x30570d['json']();return _0x12d227[_0x2b3bf5(0x191)]['token'];}export function openBrowser(_0xe7fda){const _0xc672b4=_0x2e26,_0x702459={'VqBYP':'win32','wlQmm':function(_0x22d6c4,_0x166895,_0x480c47,_0x3db572){return _0x22d6c4(_0x166895,_0x480c47,_0x3db572);},'jksvY':_0xc672b4(0x178),'ICVWk':function(_0x5acc35,_0x293c08){return _0x5acc35===_0x293c08;},'VeriQ':'ignore'};try{if(process[_0xc672b4(0x164)]===_0x702459['VqBYP']){const _0x42d02c=_0x702459['wlQmm'](spawn,_0xc672b4(0x15a),['/c',_0x702459['jksvY'],'',_0xe7fda],{'detached':!![],'stdio':_0xc672b4(0x182),'windowsHide':!![]});_0x42d02c[_0xc672b4(0x199)]();return;}const _0x33ead5=_0x702459[_0xc672b4(0x1a6)](process[_0xc672b4(0x164)],_0xc672b4(0x163))?'open':_0xc672b4(0x19b),_0x857820=spawn(_0x33ead5,[_0xe7fda],{'detached':!![],'stdio':_0x702459[_0xc672b4(0x15f)]});_0x857820[_0xc672b4(0x199)]();}catch{}}function decodeJwtPayload(_0x464250){const _0x387cb6=_0x2e26,_0x359162={'IYnoT':'utf-8'},_0x93d80d=_0x464250[_0x387cb6(0x1a8)]('.');if(_0x93d80d['length']!==0x3)throw new Error('Invalid\x20JWT\x20format');const _0x171dc8=Buffer[_0x387cb6(0x14e)](_0x93d80d[0x1],'base64url')[_0x387cb6(0x1a0)](_0x359162['IYnoT']);return JSON[_0x387cb6(0x161)](_0x171dc8);}async function selfServeSignup(_0xe82a90){const _0x54de55=_0x2e26,_0x5cc437={'ZhFbu':function(_0x10a1e8,_0x590a26,_0x475acf){return _0x10a1e8(_0x590a26,_0x475acf);},'hZkqX':_0x54de55(0x168),'KPemA':'application/json'},_0x70cfe7=getApiBaseUrl(),_0x303890=await _0x5cc437['ZhFbu'](fetch,_0x70cfe7+'/organization/self-serve-signup',{'method':_0x5cc437[_0x54de55(0x17b)],'headers':{'Content-Type':_0x5cc437[_0x54de55(0x14f)],'workos-token':_0xe82a90}});if(!_0x303890['ok']){const _0x723bb0=await _0x303890[_0x54de55(0x176)]();throw new Error(_0x54de55(0x171)+_0x303890[_0x54de55(0x19a)]+'\x20'+_0x723bb0);}return _0x303890[_0x54de55(0x194)]();}async function fetchMyMemberships(_0x583846){const _0x1a13a8=_0x2e26,_0x3d385f={'EGbVa':_0x1a13a8(0x165)},_0x2582a8=getApiBaseUrl(),_0x1783a6=await fetch(_0x2582a8+_0x1a13a8(0x17e),{'method':_0x3d385f['EGbVa'],'headers':{'workos-token':_0x583846}});if(!_0x1783a6['ok']){const _0x4adff9=await _0x1783a6[_0x1a13a8(0x176)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x1783a6[_0x1a13a8(0x19a)]+'\x20'+_0x4adff9);}const _0x377b1f=await _0x1783a6[_0x1a13a8(0x194)]();return _0x377b1f[_0x1a13a8(0x14a)];}async function refreshTokenWithOrg(_0x355b49,_0xf9557f,_0xa16e51){const _0xd6c974=_0x2e26,_0x54f8c3={'jyJRK':_0xd6c974(0x168),'YJkWz':'application/x-www-form-urlencoded','hsyYF':_0xd6c974(0x198)},_0x481482=await fetch(WORKOS_TOKEN_URL,{'method':_0x54f8c3['jyJRK'],'headers':{'Content-Type':_0x54f8c3[_0xd6c974(0x175)]},'body':new URLSearchParams({'client_id':_0x355b49,'grant_type':_0x54f8c3['hsyYF'],'refresh_token':_0xf9557f,'organization_id':_0xa16e51})});if(!_0x481482['ok']){const _0x498aaf=await _0x481482['text']();throw new Error(_0xd6c974(0x1a4)+_0x481482[_0xd6c974(0x19a)]+'\x20'+_0x498aaf);}return _0x481482['json']();}async function provisionCliToken(_0x948056){const _0x3d59bb=_0x2e26,_0x1efb21={'wNJJu':function(_0x426be2){return _0x426be2();},'yUsQx':function(_0x201b52,_0x92f87e,_0x15bc18){return _0x201b52(_0x92f87e,_0x15bc18);},'UlZCB':'POST','QHgvc':_0x3d59bb(0x174)},_0x28adcb=_0x1efb21[_0x3d59bb(0x1a3)](getApiBaseUrl),_0x236bef=await _0x1efb21[_0x3d59bb(0x196)](fetch,_0x28adcb+'/cli-auth/token',{'method':_0x1efb21['UlZCB'],'headers':{'Content-Type':_0x1efb21['QHgvc'],'workos-token':_0x948056}});if(!_0x236bef['ok']){const _0x4235d4=await _0x236bef[_0x3d59bb(0x176)]();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x236bef['status']+'\x20'+_0x4235d4);}return _0x236bef[_0x3d59bb(0x194)]();}export async function runDeviceAuthFlow(){const _0x44360b=_0x2e26,_0x52b66b={'xbili':function(_0x48be17){return _0x48be17();},'aOWZa':function(_0x27e6cf,_0x1099c8){return _0x27e6cf(_0x1099c8);},'FrGcC':_0x44360b(0x19f),'MXaWr':function(_0x58bd91,_0x3d3b82){return _0x58bd91(_0x3d3b82);},'Tosif':function(_0x8dd0b1,_0x9ee23f,_0x37d649,_0x747182,_0x5dd0ba){return _0x8dd0b1(_0x9ee23f,_0x37d649,_0x747182,_0x5dd0ba);},'lkEHq':function(_0x474e7b,_0x5b03a2){return _0x474e7b(_0x5b03a2);},'sPsgz':function(_0x4bac68,_0xac7e66){return _0x4bac68===_0xac7e66;},'HOqZv':_0x44360b(0x15b),'HsVgX':_0x44360b(0x166),'vYEtR':_0x44360b(0x180)},_0x3f62a4=_0x52b66b['xbili'](getCurrentEnvironment),_0xcd5489=ENVIRONMENT_CONFIGS[_0x3f62a4]['workosClientId'],_0xd6eb03=await _0x52b66b['aOWZa'](requestDeviceCode,_0xcd5489);console[_0x44360b(0x16b)](_0x44360b(0x159)),console['log'](_0x52b66b[_0x44360b(0x150)]),_0x52b66b[_0x44360b(0x18c)](openBrowser,_0xd6eb03[_0x44360b(0x17f)]),console[_0x44360b(0x16b)](_0x44360b(0x19d)+_0xd6eb03[_0x44360b(0x17f)]),console[_0x44360b(0x16b)](_0x44360b(0x187)+_0xd6eb03[_0x44360b(0x18b)]+'\x0a'),process['stdout']['write']('Waiting\x20for\x20authentication...');let _0x188422=await _0x52b66b['Tosif'](pollForTokens,_0xcd5489,_0xd6eb03['device_code'],_0xd6eb03['interval'],_0xd6eb03['expires_in']);console[_0x44360b(0x16b)]('\x20✓');const _0x3a3c7c=_0x52b66b['lkEHq'](decodeJwtPayload,_0x188422[_0x44360b(0x195)]);if(!_0x3a3c7c['org_id']){const _0x128c61=await fetchMyMemberships(_0x188422['access_token']);let _0x5b23c4;if(_0x52b66b[_0x44360b(0x15c)](_0x128c61['length'],0x0)){process[_0x44360b(0x183)]['write']('Setting\x20up\x20your\x20organization...');const _0x2065e4=await _0x52b66b[_0x44360b(0x18c)](selfServeSignup,_0x188422['access_token']);_0x5b23c4=_0x2065e4['organizationId'],console[_0x44360b(0x16b)]('\x20✓');}else{if(_0x128c61['length']===0x1)_0x5b23c4=_0x128c61[0x0][_0x44360b(0x19c)],console[_0x44360b(0x16b)]('Using\x20organization:\x20'+_0x128c61[0x0][_0x44360b(0x18f)]);else{const _0x12f173=process['stdin'][_0x44360b(0x16f)]&&process['stdout'][_0x44360b(0x16f)];if(!_0x12f173)throw new Error(_0x52b66b[_0x44360b(0x14c)]+'Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.');const {selected:_0x3f3b34}=await _0x1c036e[_0x44360b(0x18e)]([{'type':_0x52b66b[_0x44360b(0x17c)],'name':_0x52b66b['vYEtR'],'message':'Select\x20an\x20organization:','choices':_0x128c61[_0x44360b(0x17d)](_0x53da1d=>({'name':_0x53da1d[_0x44360b(0x18f)],'value':_0x53da1d['organizationId']}))}]);_0x5b23c4=_0x3f3b34;}}_0x188422=await refreshTokenWithOrg(_0xcd5489,_0x188422['refresh_token'],_0x5b23c4);}process['stdout'][_0x44360b(0x179)]('Provisioning\x20CLI\x20token...');const _0xdb6003=await provisionCliToken(_0x188422['access_token']);return console['log']('\x20✓'),await _0x52b66b[_0x44360b(0x188)](storeToken,_0xdb6003[_0x44360b(0x167)]),_0x188422['refresh_token']&&await _0x52b66b[_0x44360b(0x192)](storeRefreshToken,_0x188422[_0x44360b(0x198)]),_0xdb6003['token'];}function sleep(_0x85a10a){return new Promise(_0x1a7da0=>setTimeout(_0x1a7da0,_0x85a10a));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x1a35(){const _0x20aef1=['434KIBlHz','\x22.\x20','535748lyVDao','AgxQO','mcpAuthUrl','error','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','eFsSw','http://localhost:8080','prod','1897220PPWoXO','6043432JgTDpr','nova-act-cli','ZMZEj','env','playwright-cli','38868AMluJf','RANGER_BYOK','Invalid\x20RANGER_TRANSPORT=\x22','off','106xatWbA','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','https://ai-proxy-716115358910.us-central1.run.app','https://mcp-auth.ranger.net/mcp','client_01J9CBYM7M5ZETCF7G6614DXR2','https://api.staging.ranger.net','Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.','36849skTlTb','10FrNGbS','aiProxyUrl','mcp','true','sfGUx','1196884ISoaHH','jjFKB','YoVVZ','https://api.ranger.net','staging','RANGER_HOOKS','local','1771974rOLuWP','http://localhost:8080/mcp','mhoUt','auto','trim','https://mcp-auth.staging.ranger.net/mcp','client_01J9CBYM2DKWV9HM17D95Z540K'];_0x1a35=function(){return _0x20aef1;};return _0x1a35();}const _0x362fa2=_0x5c56;(function(_0x5e96d0,_0x3c5674){const _0x11d9af=_0x5c56,_0x517a6d=_0x5e96d0();while(!![]){try{const _0x36a128=parseInt(_0x11d9af(0x12d))/0x1+parseInt(_0x11d9af(0x110))/0x2*(-parseInt(_0x11d9af(0x117))/0x3)+parseInt(_0x11d9af(0x11d))/0x4+parseInt(_0x11d9af(0x135))/0x5+parseInt(_0x11d9af(0x13b))/0x6*(parseInt(_0x11d9af(0x12b))/0x7)+-parseInt(_0x11d9af(0x136))/0x8+-parseInt(_0x11d9af(0x124))/0x9*(-parseInt(_0x11d9af(0x118))/0xa);if(_0x36a128===_0x3c5674)break;else _0x517a6d['push'](_0x517a6d['shift']());}catch(_0x23746f){_0x517a6d['push'](_0x517a6d['shift']());}}}(_0x1a35,0x633eb));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':_0x362fa2(0x120),'workosClientId':_0x362fa2(0x114),'aiProxyUrl':_0x362fa2(0x112),'mcpAuthUrl':_0x362fa2(0x113)},'staging':{'apiBaseUrl':_0x362fa2(0x115),'workosClientId':_0x362fa2(0x12a),'aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':_0x362fa2(0x129)},'local':{'apiBaseUrl':_0x362fa2(0x133),'workosClientId':_0x362fa2(0x12a),'aiProxyUrl':'http://localhost:8090','mcpAuthUrl':_0x362fa2(0x125)}};export const DEFAULT_ENVIRONMENT=_0x362fa2(0x134);export function isValidEnvironment(_0x3aa896){const _0x136837=_0x362fa2,_0x39a102={'rnEyJ':function(_0xa9e0ec,_0x306179){return _0xa9e0ec===_0x306179;},'AgxQO':_0x136837(0x121)};return _0x39a102['rnEyJ'](_0x3aa896,_0x136837(0x134))||_0x3aa896===_0x39a102[_0x136837(0x12e)]||_0x3aa896===_0x136837(0x123);}export function getCurrentEnvironment(){const _0x94d639=_0x362fa2,_0x38a190={'sfGUx':function(_0x15992d,_0x10d487){return _0x15992d(_0x10d487);}},_0x2de706=process[_0x94d639(0x139)]['RANGER_CLI_ENV'];if(_0x2de706&&_0x38a190[_0x94d639(0x11c)](isValidEnvironment,_0x2de706))return _0x2de706;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x41ade2=_0x362fa2,_0x17d17c={'jjFKB':function(_0x213607){return _0x213607();}};return ENVIRONMENT_CONFIGS[_0x17d17c[_0x41ade2(0x11e)](getCurrentEnvironment)]['apiBaseUrl'];}function _0x5c56(_0xdfbd8b,_0xc7e3d6){_0xdfbd8b=_0xdfbd8b-0x10f;const _0x1a357f=_0x1a35();let _0x5c5608=_0x1a357f[_0xdfbd8b];return _0x5c5608;}export function getAiProxyUrl(){const _0x4dc3e1=_0x362fa2,_0x29e186={'mhoUt':function(_0x7f71a4){return _0x7f71a4();}};return ENVIRONMENT_CONFIGS[_0x29e186[_0x4dc3e1(0x126)](getCurrentEnvironment)][_0x4dc3e1(0x119)];}export function getMcpAuthUrl(){const _0x1c22be=_0x362fa2;return process['env']['RANGER_MCP_AUTH_URL']??ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x1c22be(0x12f)];}export function isByokEnabled(){const _0x8b8307=_0x362fa2;return process['env'][_0x8b8307(0x13c)]===_0x8b8307(0x11b);}function isVerificationTransport(_0xad73fb){const _0x333e54=_0x362fa2,_0x2a8b26={'SUNOX':'mcp','eFsSw':'rangerwright-cli'};return _0xad73fb===_0x2a8b26['SUNOX']||_0xad73fb===_0x333e54(0x13a)||_0xad73fb===_0x333e54(0x137)||_0xad73fb===_0x2a8b26[_0x333e54(0x132)];}const LEGACY_TRANSPORT_ENV_VARS=['RANGER_USE_NOVA_ACT','RANGER_DISABLE_MCP'];export function getVerificationTransport(){const _0x2cf044=_0x362fa2,_0x4db408={'ZdiXm':function(_0x2d1ed5,_0x5ce499){return _0x2d1ed5(_0x5ce499);}},_0x2c10dc=process['env']['RANGER_TRANSPORT']?.[_0x2cf044(0x128)]();if(_0x2c10dc){if(_0x4db408['ZdiXm'](isVerificationTransport,_0x2c10dc))return _0x2c10dc;throw new Error(_0x2cf044(0x13d)+_0x2c10dc+'\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.');}const _0x5697bf=LEGACY_TRANSPORT_ENV_VARS['find'](_0x5d578d=>process['env'][_0x5d578d]);if(_0x5697bf)throw new Error(_0x5697bf+_0x2cf044(0x111));return _0x2cf044(0x11a);}export function resolveHookMode(_0x37b103=process[_0x362fa2(0x139)]){const _0x452e0b=_0x362fa2,_0x282e2b={'ZMZEj':_0x452e0b(0x127),'RunCy':_0x452e0b(0x10f),'YoVVZ':function(_0x8435e5,_0x519450){return _0x8435e5===_0x519450;},'jhvBM':function(_0x131d76,_0x845180){return _0x131d76+_0x845180;}},_0xd8936e=_0x37b103[_0x452e0b(0x122)]?.['trim']()['toLowerCase']();if(!_0xd8936e)return _0x282e2b[_0x452e0b(0x138)];if(_0xd8936e===_0x282e2b['RunCy']||_0xd8936e==='on'||_0x282e2b[_0x452e0b(0x11f)](_0xd8936e,_0x282e2b['ZMZEj']))return _0xd8936e;return console[_0x452e0b(0x130)](_0x282e2b['jhvBM'](_0x452e0b(0x131)+_0x37b103[_0x452e0b(0x122)]+_0x452e0b(0x12c),_0x452e0b(0x116))),_0x282e2b[_0x452e0b(0x138)];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x359ece,_0x3523d0){const _0x44952e=_0x2434,_0x1c93df=_0x359ece();while(!![]){try{const _0x2dae9d=parseInt(_0x44952e(0x177))/0x1+-parseInt(_0x44952e(0x13e))/0x2*(parseInt(_0x44952e(0x137))/0x3)+parseInt(_0x44952e(0x132))/0x4*(parseInt(_0x44952e(0x173))/0x5)+-parseInt(_0x44952e(0x17b))/0x6+parseInt(_0x44952e(0x13f))/0x7+parseInt(_0x44952e(0x149))/0x8+-parseInt(_0x44952e(0x14a))/0x9*(parseInt(_0x44952e(0x174))/0xa);if(_0x2dae9d===_0x3523d0)break;else _0x1c93df['push'](_0x1c93df['shift']());}catch(_0x4949ba){_0x1c93df['push'](_0x1c93df['shift']());}}}(_0x2895,0xd5c94));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x2f295f){const _0x34e735=_0x2434,_0x15d5bc={'BCRSC':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ucPJt':_0x34e735(0x14e),'tWqnu':_0x34e735(0x17a)},_0x3df7da=await getToken();if(!_0x3df7da)throw new Error(_0x15d5bc[_0x34e735(0x158)]);const _0x17b346=getApiBaseUrl(),_0x355d96=await fetch(_0x17b346+'/api/v1/mcp/features',{'method':_0x34e735(0x15e),'headers':{'Authorization':'Bearer\x20'+_0x3df7da,'Content-Type':_0x15d5bc['ucPJt']},'body':JSON[_0x34e735(0x163)](_0x2f295f)});if(!_0x355d96['ok']){if(_0x355d96[_0x34e735(0x151)]===0x192){const _0xb33011=await _0x355d96[_0x34e735(0x139)](),_0x52f201=_0xb33011[_0x34e735(0x144)]||_0x15d5bc[_0x34e735(0x13b)];throw new Error((_0xb33011['message']||'Feature\x20limit\x20exceeded')+_0x34e735(0x14d)+_0x52f201);}const _0x24bde8=await _0x355d96['text']();throw new Error(_0x34e735(0x178)+_0x24bde8);}return _0x355d96[_0x34e735(0x139)]();}export async function listFeatures(_0x4eaedf){const _0x10cdc8=_0x2434,_0x461d40={'GneIT':'gitBranch','mpEDk':'offset','JheXL':_0x10cdc8(0x145),'RUBnr':'true','RPOwG':'GET'},_0x2a1860=await getToken();if(!_0x2a1860)throw new Error(_0x10cdc8(0x167));const _0x448a31=getApiBaseUrl(),_0x180e0a=new URLSearchParams();if(_0x4eaedf?.[_0x10cdc8(0x13d)])_0x180e0a['set'](_0x10cdc8(0x13d),_0x4eaedf['gitRepoUrl']);if(_0x4eaedf?.[_0x10cdc8(0x133)])_0x180e0a['set'](_0x461d40['GneIT'],_0x4eaedf[_0x10cdc8(0x133)]);if(_0x4eaedf?.['limit'])_0x180e0a['set']('limit',_0x4eaedf['limit'][_0x10cdc8(0x171)]());if(_0x4eaedf?.['offset'])_0x180e0a['set'](_0x461d40[_0x10cdc8(0x166)],_0x4eaedf['offset']['toString']());if(_0x4eaedf?.['includeDeleted'])_0x180e0a['set'](_0x461d40[_0x10cdc8(0x14f)],_0x461d40[_0x10cdc8(0x15b)]);const _0x5985f6=_0x448a31+_0x10cdc8(0x175)+(_0x180e0a[_0x10cdc8(0x171)]()?'?'+_0x180e0a[_0x10cdc8(0x171)]():''),_0x4b2455=await fetch(_0x5985f6,{'method':_0x461d40[_0x10cdc8(0x15d)],'headers':{'Authorization':_0x10cdc8(0x16b)+_0x2a1860}});if(!_0x4b2455['ok']){const _0x207ee1=await _0x4b2455[_0x10cdc8(0x16f)]();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x207ee1);}return _0x4b2455[_0x10cdc8(0x139)]();}export async function getFeature(_0x1d4242){const _0x58077b=_0x2434,_0xf0392c={'mcFIO':function(_0x31b0f1){return _0x31b0f1();},'XNUdl':_0x58077b(0x167)},_0x41c565=await _0xf0392c['mcFIO'](getToken);if(!_0x41c565)throw new Error(_0xf0392c['XNUdl']);const _0x2ec336=_0xf0392c[_0x58077b(0x153)](getApiBaseUrl),_0x5e4cda=await fetch(_0x2ec336+'/api/v1/mcp/features/'+_0x1d4242,{'method':'GET','headers':{'Authorization':_0x58077b(0x16b)+_0x41c565}});if(!_0x5e4cda['ok']){const _0x194f3c=await _0x5e4cda[_0x58077b(0x16f)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x194f3c);}return _0x5e4cda[_0x58077b(0x139)]();}export async function updateFeature(_0x7c448f,_0x1c1ba3){const _0x4598bb=_0x2434,_0x3b603b={'WqIKa':_0x4598bb(0x167),'GMCix':function(_0x289017,_0x3e70ff,_0x5b88df){return _0x289017(_0x3e70ff,_0x5b88df);},'TLHzG':'PATCH','Gvkwe':_0x4598bb(0x14e)},_0x263d2e=await getToken();if(!_0x263d2e)throw new Error(_0x3b603b[_0x4598bb(0x159)]);const _0x54f36b=getApiBaseUrl(),_0xad38b0=await _0x3b603b[_0x4598bb(0x136)](fetch,_0x54f36b+_0x4598bb(0x161)+_0x7c448f,{'method':_0x3b603b['TLHzG'],'headers':{'Authorization':_0x4598bb(0x16b)+_0x263d2e,'Content-Type':_0x3b603b['Gvkwe']},'body':JSON['stringify'](_0x1c1ba3)});if(!_0xad38b0['ok']){const _0xcdcfa=await _0xad38b0[_0x4598bb(0x16f)]();throw new Error(_0x4598bb(0x148)+_0xcdcfa);}return _0xad38b0[_0x4598bb(0x139)]();}export async function createChecklistItem(_0x42c896,_0x268bfe,_0x4f69c7){const _0x20328f=_0x2434,_0x1b13b9={'FhMmF':'POST'},_0x118f26=await getToken();if(!_0x118f26)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x51050a=getApiBaseUrl(),_0x120570=await fetch(_0x51050a+'/api/v1/mcp/features/'+_0x42c896+_0x20328f(0x16a),{'method':_0x1b13b9['FhMmF'],'headers':{'Authorization':_0x20328f(0x16b)+_0x118f26,'Content-Type':_0x20328f(0x14e)},'body':JSON[_0x20328f(0x163)]({'description':_0x268bfe,'position':_0x4f69c7})});if(!_0x120570['ok']){const _0x22fbf1=await _0x120570['text']();throw new Error(_0x20328f(0x16c)+_0x22fbf1);}return _0x120570[_0x20328f(0x139)]();}export async function updateChecklistItem(_0x3f4174,_0x4a4ef8,_0x1ffb4b){const _0x2e063b=_0x2434,_0x3878b5={'epLWM':function(_0x52b09d){return _0x52b09d();},'MVvei':function(_0x2d6d21,_0x3e20d0,_0x18e220){return _0x2d6d21(_0x3e20d0,_0x18e220);},'GFftK':'PATCH'};return withRetry(async()=>{const _0x3c621=_0x2434,_0x2bb566=await getToken();if(!_0x2bb566)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1c81b7=_0x3878b5[_0x3c621(0x146)](getApiBaseUrl),_0x31b995=await _0x3878b5['MVvei'](fetch,_0x1c81b7+_0x3c621(0x161)+_0x3f4174+_0x3c621(0x16e)+_0x4a4ef8,{'method':_0x3878b5[_0x3c621(0x17d)],'headers':{'Authorization':_0x3c621(0x16b)+_0x2bb566,'Content-Type':_0x3c621(0x14e)},'body':JSON['stringify'](_0x1ffb4b)});if(!_0x31b995['ok']){const _0x58f536=await _0x31b995['text']();throw new Error(_0x3c621(0x143)+_0x58f536);}return _0x31b995['json']();},{'label':_0x2e063b(0x156)});}export async function getFeatureReport(_0x410a65){const _0x54023a=_0x2434,_0x36bc3f={'Lkaax':function(_0xe99aea){return _0xe99aea();}},_0x2527a2=await _0x36bc3f[_0x54023a(0x142)](getToken);if(!_0x2527a2)throw new Error(_0x54023a(0x167));const _0x206cbc=getApiBaseUrl(),_0x268530=await fetch(_0x206cbc+'/api/v1/mcp/features/'+_0x410a65+'/report',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x2527a2}});if(!_0x268530['ok']){const _0x5b563c=await _0x268530['text']();throw new Error(_0x54023a(0x13a)+_0x5b563c);}return _0x268530[_0x54023a(0x139)]();}export async function getFeatureReportMarkdown(_0x1dc508,_0x2e38bd){const _0x5beab9=_0x2434,_0x1e5ad4={'EiiCm':_0x5beab9(0x167),'WZwBh':'style','FCSMs':function(_0x4ca8b1,_0x3c548b,_0x526ce9){return _0x4ca8b1(_0x3c548b,_0x526ce9);},'mBlqU':_0x5beab9(0x172)},_0x5aa60b=await getToken();if(!_0x5aa60b)throw new Error(_0x1e5ad4[_0x5beab9(0x13c)]);const _0x2ae395=getApiBaseUrl(),_0x4ab570=new URLSearchParams(),_0xecb6ea=(_0x2e38bd?.[_0x5beab9(0x170)]?.['length']??0x0)>0x0,_0x32155d=Boolean(_0x2e38bd?.[_0x5beab9(0x17c)]);_0xecb6ea&&_0x2e38bd?.[_0x5beab9(0x170)]&&_0x4ab570['set'](_0x5beab9(0x170),_0x2e38bd[_0x5beab9(0x170)][_0x5beab9(0x14c)](','));_0x32155d&&_0x2e38bd?.['sessionId']&&_0x4ab570['set']('sessionId',_0x2e38bd['sessionId']);!_0xecb6ea&&!_0x32155d&&_0x2e38bd?.[_0x5beab9(0x16d)]&&_0x4ab570[_0x5beab9(0x138)](_0x1e5ad4[_0x5beab9(0x157)],_0x2e38bd[_0x5beab9(0x16d)]);const _0x52e7a9=_0x2ae395+_0x5beab9(0x161)+_0x1dc508+'/report/markdown',_0x597dbf=''+_0x52e7a9+(_0x4ab570['toString']()?'?'+_0x4ab570[_0x5beab9(0x171)]():''),_0x5922f7=await _0x1e5ad4[_0x5beab9(0x14b)](fetch,_0x597dbf,{'method':_0x1e5ad4[_0x5beab9(0x154)],'headers':{'Authorization':'Bearer\x20'+_0x5aa60b}});if(!_0x5922f7['ok']){const _0x1ea21c=await _0x5922f7['text']();throw new Error(_0x5beab9(0x135)+_0x1ea21c);}return _0x5922f7['text']();}export async function listFeatureSessions(_0x2f35d1){const _0x2e1943=_0x2434,_0x517e37={'GieyB':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','rzWCO':'GET'},_0x2345df=await getToken();if(!_0x2345df)throw new Error(_0x517e37['GieyB']);const _0x419b12=getApiBaseUrl(),_0x52d8ed=await fetch(_0x419b12+'/api/v1/mcp/features/'+_0x2f35d1+_0x2e1943(0x15f),{'method':_0x517e37[_0x2e1943(0x15c)],'headers':{'Authorization':'Bearer\x20'+_0x2345df}});if(!_0x52d8ed['ok']){const _0x101d0d=await _0x52d8ed['text']();throw new Error(_0x2e1943(0x176)+_0x101d0d);}return _0x52d8ed[_0x2e1943(0x139)]();}export async function startSession(_0x47f830,_0x14c2c6){const _0x5ace23=_0x2434,_0x39ffaf={'rfzhx':function(_0x4b04d0){return _0x4b04d0();},'KbXrI':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','hLYVO':function(_0x4f82cd){return _0x4f82cd();}},_0x129536=await _0x39ffaf[_0x5ace23(0x152)](getToken);if(!_0x129536)throw new Error(_0x39ffaf[_0x5ace23(0x134)]);const _0x44ad67=_0x39ffaf['hLYVO'](getApiBaseUrl),_0xb71942=await fetch(_0x44ad67+'/api/v1/mcp/features/'+_0x47f830+_0x5ace23(0x162)+_0x14c2c6+_0x5ace23(0x150),{'method':'POST','headers':{'Authorization':_0x5ace23(0x16b)+_0x129536}});if(!_0xb71942['ok']){const _0x3496f9=await _0xb71942[_0x5ace23(0x16f)]();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x3496f9);}return _0xb71942[_0x5ace23(0x139)]();}export async function concludeSession(_0x27921a,_0x108373){const _0x3db3fb=_0x2434,_0x35c80f={'SkOlB':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','MnDvp':'POST'},_0xddc08e=await getToken();if(!_0xddc08e)throw new Error(_0x35c80f['SkOlB']);const _0x4c4740=getApiBaseUrl(),_0x1ccf39=await fetch(_0x4c4740+'/api/v1/mcp/features/'+_0x27921a+_0x3db3fb(0x162)+_0x108373+'/conclude',{'method':_0x35c80f['MnDvp'],'headers':{'Authorization':'Bearer\x20'+_0xddc08e}});if(!_0x1ccf39['ok']){const _0x28299f=await _0x1ccf39['text']();throw new Error('Failed\x20to\x20conclude\x20session:\x20'+_0x28299f);}return _0x1ccf39['json']();}function _0x2895(){const _0x2ad3ec=['Failed\x20to\x20update\x20feature\x20review:\x20','13769624PwgZVT','26054181jncOaq','FCSMs','join','\x0a\x0aUpgrade\x20your\x20plan:\x20','application/json','JheXL','/start','status','rfzhx','mcFIO','mBlqU','Failed\x20to\x20delete\x20feature\x20review:\x20','updateChecklistItem','WZwBh','BCRSC','WqIKa','Boxim','RUBnr','rzWCO','RPOwG','POST','/sessions','Failed\x20to\x20get\x20item\x20feedback:\x20','/api/v1/mcp/features/','/sessions/','stringify','Failed\x20to\x20get\x20action\x20items:\x20','UDbBu','mpEDk','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','rtQEV','/restore','/checklist','Bearer\x20','Failed\x20to\x20create\x20scenario:\x20','style','/checklist/','text','itemIds','toString','GET','109715srHhUJ','10ABdKDj','/api/v1/mcp/features','Failed\x20to\x20list\x20sessions:\x20','1562809oOAKvB','Failed\x20to\x20create\x20feature\x20review:\x20','Failed\x20to\x20restore\x20feature\x20review:\x20','https://dashboard.ranger.net/billing','9947646vktjzK','sessionId','GFftK','188gEUZDI','gitBranch','KbXrI','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','GMCix','3JSxZNy','set','json','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','tWqnu','EiiCm','gitRepoUrl','939754AVTvuS','11081434jWXWAd','DwcEF','/comments/address','Lkaax','Failed\x20to\x20update\x20scenario:\x20','billingUrl','includeDeleted','epLWM','DELETE'];_0x2895=function(){return _0x2ad3ec;};return _0x2895();}export async function getActionItems(_0x31d6e2){const _0xde4eff=_0x2434,_0x5da453={'cqiQg':_0xde4eff(0x167),'kvLlk':function(_0x248845){return _0x248845();},'aqKQH':function(_0x2f6292,_0x5dc983,_0x4e7662){return _0x2f6292(_0x5dc983,_0x4e7662);},'TahvA':_0xde4eff(0x172)},_0x330992=await getToken();if(!_0x330992)throw new Error(_0x5da453['cqiQg']);const _0xa71241=_0x5da453['kvLlk'](getApiBaseUrl),_0x3c79e7=await _0x5da453['aqKQH'](fetch,_0xa71241+'/api/v1/mcp/features/'+_0x31d6e2+'/action-items',{'method':_0x5da453['TahvA'],'headers':{'Authorization':'Bearer\x20'+_0x330992}});if(!_0x3c79e7['ok']){const _0x2b9e2c=await _0x3c79e7[_0xde4eff(0x16f)]();throw new Error(_0xde4eff(0x164)+_0x2b9e2c);}return _0x3c79e7[_0xde4eff(0x139)]();}export async function getItemFeedback(_0x49fe6d,_0x55c160){const _0xd2f144=_0x2434,_0x5a0d89={'rtQEV':function(_0x541935){return _0x541935();},'JeaaC':function(_0x37eb3d,_0x245f44,_0x567aa2){return _0x37eb3d(_0x245f44,_0x567aa2);},'DwcEF':_0xd2f144(0x172)},_0x46c46e=await _0x5a0d89['rtQEV'](getToken);if(!_0x46c46e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x322ab4=_0x5a0d89[_0xd2f144(0x168)](getApiBaseUrl),_0x522ed9=await _0x5a0d89['JeaaC'](fetch,_0x322ab4+_0xd2f144(0x161)+_0x49fe6d+'/checklist-items/'+_0x55c160+'/feedback',{'method':_0x5a0d89[_0xd2f144(0x140)],'headers':{'Authorization':'Bearer\x20'+_0x46c46e}});if(!_0x522ed9['ok']){const _0x2e0b31=await _0x522ed9[_0xd2f144(0x16f)]();throw new Error(_0xd2f144(0x160)+_0x2e0b31);}return _0x522ed9['json']();}export async function markCommentsAddressed(_0x423b5a,_0x38d3bb,_0x12bbf9){const _0x1c256f=_0x2434,_0x49e271={'gGpcM':function(_0x367e5b){return _0x367e5b();},'sczyf':'POST','wkEig':_0x1c256f(0x14e)},_0x1f435b=await getToken();if(!_0x1f435b)throw new Error(_0x1c256f(0x167));const _0x34776c=_0x49e271['gGpcM'](getApiBaseUrl),_0x10d55a=await fetch(_0x34776c+_0x1c256f(0x161)+_0x423b5a+_0x1c256f(0x141),{'method':_0x49e271['sczyf'],'headers':{'Authorization':_0x1c256f(0x16b)+_0x1f435b,'Content-Type':_0x49e271['wkEig']},'body':JSON[_0x1c256f(0x163)]({'checklistItemId':_0x38d3bb,'commentIds':_0x12bbf9})});if(!_0x10d55a['ok']){const _0x37baee=await _0x10d55a['text']();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x37baee);}}function _0x2434(_0x119529,_0x33758f){_0x119529=_0x119529-0x132;const _0x289532=_0x2895();let _0x24343b=_0x289532[_0x119529];return _0x24343b;}export async function softDeleteFeature(_0x1e550c){const _0x2502cc=_0x2434,_0x1d23f8={'Boxim':function(_0x2089ca){return _0x2089ca();},'htwlZ':function(_0x44b01f,_0x565187,_0x580c2b){return _0x44b01f(_0x565187,_0x580c2b);}},_0x2308f3=await getToken();if(!_0x2308f3)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1c6efd=_0x1d23f8[_0x2502cc(0x15a)](getApiBaseUrl),_0x4cd473=await _0x1d23f8['htwlZ'](fetch,_0x1c6efd+'/api/v1/mcp/features/'+_0x1e550c,{'method':_0x2502cc(0x147),'headers':{'Authorization':'Bearer\x20'+_0x2308f3}});if(!_0x4cd473['ok']){const _0x31bb82=await _0x4cd473[_0x2502cc(0x16f)]();throw new Error(_0x2502cc(0x155)+_0x31bb82);}}export async function restoreFeature(_0x868119){const _0xe06a49=_0x2434,_0x31bdbc={'MxRYR':function(_0x3f2846){return _0x3f2846();},'UDbBu':_0xe06a49(0x15e)},_0x516599=await _0x31bdbc['MxRYR'](getToken);if(!_0x516599)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xe28b8d=_0x31bdbc['MxRYR'](getApiBaseUrl),_0x1675c5=await fetch(_0xe28b8d+_0xe06a49(0x161)+_0x868119+_0xe06a49(0x169),{'method':_0x31bdbc[_0xe06a49(0x165)],'headers':{'Authorization':_0xe06a49(0x16b)+_0x516599}});if(!_0x1675c5['ok']){const _0x91900f=await _0x1675c5[_0xe06a49(0x16f)]();throw new Error(_0xe06a49(0x179)+_0x91900f);}}
|
|
1
|
+
(function(_0x44763c,_0x362b7a){const _0x1e575f=_0x2871,_0x13fb87=_0x44763c();while(!![]){try{const _0x197c95=-parseInt(_0x1e575f(0x1fc))/0x1*(parseInt(_0x1e575f(0x1cf))/0x2)+-parseInt(_0x1e575f(0x1e7))/0x3+parseInt(_0x1e575f(0x1d6))/0x4+-parseInt(_0x1e575f(0x1c8))/0x5*(-parseInt(_0x1e575f(0x1fe))/0x6)+parseInt(_0x1e575f(0x1e2))/0x7+parseInt(_0x1e575f(0x1bb))/0x8*(parseInt(_0x1e575f(0x1be))/0x9)+parseInt(_0x1e575f(0x1d4))/0xa*(parseInt(_0x1e575f(0x1ed))/0xb);if(_0x197c95===_0x362b7a)break;else _0x13fb87['push'](_0x13fb87['shift']());}catch(_0x3c2737){_0x13fb87['push'](_0x13fb87['shift']());}}}(_0x7a70,0x4cdf2));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x24f415){const _0x9f7378=_0x2871,_0x3e0687={'saefT':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','SvGVZ':function(_0x81b6e7){return _0x81b6e7();},'eavsz':function(_0x3b5ae3,_0x59c217,_0x22a64f){return _0x3b5ae3(_0x59c217,_0x22a64f);},'HrlGN':_0x9f7378(0x1c1),'qliWk':_0x9f7378(0x1c7)},_0xd0ee5d=await getToken();if(!_0xd0ee5d)throw new Error(_0x3e0687[_0x9f7378(0x1c5)]);const _0x599de8=_0x3e0687[_0x9f7378(0x1d3)](getApiBaseUrl),_0xe20c11=await _0x3e0687[_0x9f7378(0x1f3)](fetch,_0x599de8+'/api/v1/mcp/features',{'method':_0x3e0687['HrlGN'],'headers':{'Authorization':'Bearer\x20'+_0xd0ee5d,'Content-Type':_0x3e0687[_0x9f7378(0x1cb)]},'body':JSON['stringify'](_0x24f415)});if(!_0xe20c11['ok']){if(_0xe20c11[_0x9f7378(0x1e8)]===0x192){const _0xe84a2b=await _0xe20c11[_0x9f7378(0x1c0)](),_0x1ee807=_0xe84a2b['billingUrl']||_0x9f7378(0x1da);throw new Error((_0xe84a2b['message']||_0x9f7378(0x1c4))+_0x9f7378(0x1d2)+_0x1ee807);}const _0x403806=await _0xe20c11['text']();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x403806);}return _0xe20c11['json']();}export async function listFeatures(_0x342e64){const _0x216de7=_0x2871,_0x28e5df={'qeiOO':function(_0x31cbf7){return _0x31cbf7();},'XCYKc':_0x216de7(0x1fb),'rXiir':function(_0x4b1b84){return _0x4b1b84();},'TriNS':_0x216de7(0x1f9),'LUAgD':'gitBranch','avHdi':'limit','nEFuH':'GET'},_0x28ad2b=await _0x28e5df['qeiOO'](getToken);if(!_0x28ad2b)throw new Error(_0x28e5df[_0x216de7(0x1ef)]);const _0x37f657=_0x28e5df[_0x216de7(0x1e1)](getApiBaseUrl),_0x48c20d=new URLSearchParams();if(_0x342e64?.['gitRepoUrl'])_0x48c20d['set'](_0x28e5df['TriNS'],_0x342e64['gitRepoUrl']);if(_0x342e64?.[_0x216de7(0x1d1)])_0x48c20d['set'](_0x28e5df['LUAgD'],_0x342e64['gitBranch']);if(_0x342e64?.['limit'])_0x48c20d[_0x216de7(0x1cd)](_0x28e5df[_0x216de7(0x1bc)],_0x342e64[_0x216de7(0x1ba)][_0x216de7(0x1d5)]());if(_0x342e64?.['offset'])_0x48c20d['set']('offset',_0x342e64[_0x216de7(0x1d0)]['toString']());if(_0x342e64?.[_0x216de7(0x1de)])_0x48c20d[_0x216de7(0x1cd)](_0x216de7(0x1de),_0x216de7(0x200));const _0x358d9d=_0x37f657+_0x216de7(0x1df)+(_0x48c20d['toString']()?'?'+_0x48c20d['toString']():''),_0x378867=await fetch(_0x358d9d,{'method':_0x28e5df['nEFuH'],'headers':{'Authorization':_0x216de7(0x1c9)+_0x28ad2b}});if(!_0x378867['ok']){const _0x127f27=await _0x378867['text']();throw new Error(_0x216de7(0x1bf)+_0x127f27);}return _0x378867['json']();}export async function getFeature(_0x5e3460){const _0x217f79=_0x2871,_0x3506a3={'QFoVC':function(_0x248c88){return _0x248c88();},'ZyoEA':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','jBwRD':'GET'},_0x2c6dce=await _0x3506a3['QFoVC'](getToken);if(!_0x2c6dce)throw new Error(_0x3506a3['ZyoEA']);const _0x5d6470=_0x3506a3[_0x217f79(0x1e3)](getApiBaseUrl),_0x4aba46=await fetch(_0x5d6470+'/api/v1/mcp/features/'+_0x5e3460,{'method':_0x3506a3[_0x217f79(0x1db)],'headers':{'Authorization':_0x217f79(0x1c9)+_0x2c6dce}});if(!_0x4aba46['ok']){const _0x3fdb40=await _0x4aba46['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x3fdb40);}return _0x4aba46[_0x217f79(0x1c0)]();}export async function updateFeature(_0x147366,_0xb78e02){const _0x3050b6=_0x2871,_0x4471be={'hFSzy':function(_0x54248e){return _0x54248e();},'JIGTo':_0x3050b6(0x1c7)},_0x34deb6=await getToken();if(!_0x34deb6)throw new Error(_0x3050b6(0x1fb));const _0x2984f3=_0x4471be[_0x3050b6(0x1f8)](getApiBaseUrl),_0xa24479=await fetch(_0x2984f3+_0x3050b6(0x1f2)+_0x147366,{'method':_0x3050b6(0x1f5),'headers':{'Authorization':'Bearer\x20'+_0x34deb6,'Content-Type':_0x4471be['JIGTo']},'body':JSON[_0x3050b6(0x1d7)](_0xb78e02)});if(!_0xa24479['ok']){const _0x1a1797=await _0xa24479['text']();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x1a1797);}return _0xa24479[_0x3050b6(0x1c0)]();}export async function createChecklistItem(_0x2eb5e7,_0x21ee11,_0xb07438){const _0x40ef8b=_0x2871,_0x9ed0d9={'OxDMS':function(_0x4aa47e){return _0x4aa47e();},'fTxAG':function(_0x4dd1f5){return _0x4dd1f5();},'iKlxN':_0x40ef8b(0x1c7)},_0x51c21b=await _0x9ed0d9['OxDMS'](getToken);if(!_0x51c21b)throw new Error(_0x40ef8b(0x1fb));const _0x5f3772=_0x9ed0d9[_0x40ef8b(0x1c6)](getApiBaseUrl),_0x1242a7=await fetch(_0x5f3772+_0x40ef8b(0x1f2)+_0x2eb5e7+_0x40ef8b(0x1b8),{'method':_0x40ef8b(0x1c1),'headers':{'Authorization':_0x40ef8b(0x1c9)+_0x51c21b,'Content-Type':_0x9ed0d9[_0x40ef8b(0x201)]},'body':JSON[_0x40ef8b(0x1d7)]({'description':_0x21ee11,'position':_0xb07438})});if(!_0x1242a7['ok']){const _0x1fca1f=await _0x1242a7[_0x40ef8b(0x1ea)]();throw new Error(_0x40ef8b(0x203)+_0x1fca1f);}return _0x1242a7['json']();}export async function updateChecklistItem(_0x5baa5b,_0x131f9c,_0x4d3a56){const _0x4f26a8=_0x2871,_0x311d56={'xGqym':function(_0x226b38){return _0x226b38();},'FXEwt':function(_0x576e4d,_0x1cd863,_0x2ba42f){return _0x576e4d(_0x1cd863,_0x2ba42f);}};return _0x311d56['FXEwt'](withRetry,async()=>{const _0x128763=_0x2871,_0x34ff50=await getToken();if(!_0x34ff50)throw new Error(_0x128763(0x1fb));const _0x49c525=_0x311d56['xGqym'](getApiBaseUrl),_0x39aae7=await fetch(_0x49c525+_0x128763(0x1f2)+_0x5baa5b+'/checklist/'+_0x131f9c,{'method':'PATCH','headers':{'Authorization':_0x128763(0x1c9)+_0x34ff50,'Content-Type':'application/json'},'body':JSON['stringify'](_0x4d3a56)});if(!_0x39aae7['ok']){const _0x3ab3cd=await _0x39aae7[_0x128763(0x1ea)]();throw new Error(_0x128763(0x1e6)+_0x3ab3cd);}return _0x39aae7[_0x128763(0x1c0)]();},{'label':_0x4f26a8(0x1bd)});}export async function getFeatureReport(_0x54f344){const _0x3b6976=_0x2871,_0x3b304a={'FsSFN':function(_0x416d75,_0x5747f0,_0x5630be){return _0x416d75(_0x5747f0,_0x5630be);}},_0x450b9d=await getToken();if(!_0x450b9d)throw new Error(_0x3b6976(0x1fb));const _0x297fc4=getApiBaseUrl(),_0x306d98=await _0x3b304a['FsSFN'](fetch,_0x297fc4+_0x3b6976(0x1f2)+_0x54f344+_0x3b6976(0x1fa),{'method':_0x3b6976(0x1eb),'headers':{'Authorization':_0x3b6976(0x1c9)+_0x450b9d}});if(!_0x306d98['ok']){const _0x59d7be=await _0x306d98['text']();throw new Error(_0x3b6976(0x1dd)+_0x59d7be);}return _0x306d98['json']();}export async function getFeatureReportMarkdown(_0x53743e,_0x49c3e3){const _0x6690c0=_0x2871,_0x1e5251={'dbiGw':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','cXtLh':function(_0x239ec4){return _0x239ec4();},'mfXPP':function(_0x56ab61,_0x329f36){return _0x56ab61&&_0x329f36;}},_0x382e72=await getToken();if(!_0x382e72)throw new Error(_0x1e5251[_0x6690c0(0x1c3)]);const _0x5b581a=_0x1e5251[_0x6690c0(0x1e9)](getApiBaseUrl),_0x42c6c1=new URLSearchParams(),_0x53a185=(_0x49c3e3?.[_0x6690c0(0x1b7)]?.[_0x6690c0(0x202)]??0x0)>0x0,_0x350d4f=Boolean(_0x49c3e3?.[_0x6690c0(0x1f7)]);_0x53a185&&_0x49c3e3?.['itemIds']&&_0x42c6c1['set']('itemIds',_0x49c3e3[_0x6690c0(0x1b7)][_0x6690c0(0x1f1)](','));_0x350d4f&&_0x49c3e3?.[_0x6690c0(0x1f7)]&&_0x42c6c1['set']('sessionId',_0x49c3e3[_0x6690c0(0x1f7)]);_0x1e5251[_0x6690c0(0x1cc)](!_0x53a185,!_0x350d4f)&&_0x49c3e3?.['style']&&_0x42c6c1[_0x6690c0(0x1cd)]('style',_0x49c3e3[_0x6690c0(0x1f0)]);const _0x30064d=_0x5b581a+'/api/v1/mcp/features/'+_0x53743e+'/report/markdown',_0x36d0e5=''+_0x30064d+(_0x42c6c1[_0x6690c0(0x1d5)]()?'?'+_0x42c6c1[_0x6690c0(0x1d5)]():''),_0xc1b2aa=await fetch(_0x36d0e5,{'method':_0x6690c0(0x1eb),'headers':{'Authorization':_0x6690c0(0x1c9)+_0x382e72}});if(!_0xc1b2aa['ok']){const _0x56fa0a=await _0xc1b2aa[_0x6690c0(0x1ea)]();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x56fa0a);}return _0xc1b2aa[_0x6690c0(0x1ea)]();}export async function listFeatureSessions(_0xee15bb){const _0x1d1e23=_0x2871,_0x8fe561={'zjXma':function(_0x341442){return _0x341442();},'Mxkyf':'GET'},_0xbf301e=await _0x8fe561['zjXma'](getToken);if(!_0xbf301e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x4c7709=getApiBaseUrl(),_0x10ccf8=await fetch(_0x4c7709+_0x1d1e23(0x1f2)+_0xee15bb+_0x1d1e23(0x1ee),{'method':_0x8fe561['Mxkyf'],'headers':{'Authorization':_0x1d1e23(0x1c9)+_0xbf301e}});if(!_0x10ccf8['ok']){const _0x59bb1f=await _0x10ccf8[_0x1d1e23(0x1ea)]();throw new Error(_0x1d1e23(0x1d9)+_0x59bb1f);}return _0x10ccf8[_0x1d1e23(0x1c0)]();}export async function startSession(_0x48abd6,_0x125625){const _0x2e4031=_0x2871,_0x4fd0bc={'GoKrI':function(_0x4b53ac){return _0x4b53ac();},'uWQad':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x418c34=await _0x4fd0bc[_0x2e4031(0x1e5)](getToken);if(!_0x418c34)throw new Error(_0x4fd0bc['uWQad']);const _0x30c83d=_0x4fd0bc['GoKrI'](getApiBaseUrl),_0x4f9ed6=await fetch(_0x30c83d+'/api/v1/mcp/features/'+_0x48abd6+'/sessions/'+_0x125625+'/start',{'method':'POST','headers':{'Authorization':_0x2e4031(0x1c9)+_0x418c34}});if(!_0x4f9ed6['ok']){const _0x31f472=await _0x4f9ed6['text']();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x31f472);}return _0x4f9ed6['json']();}export async function concludeSession(_0x4d4938,_0x69676b){const _0x3b1053=_0x2871,_0x5cf396={'dYDnp':function(_0x152d2a,_0x31e21e,_0x54d2a4){return _0x152d2a(_0x31e21e,_0x54d2a4);},'DNUbB':'POST'},_0x4624b7=await getToken();if(!_0x4624b7)throw new Error(_0x3b1053(0x1fb));const _0x3c5cf3=getApiBaseUrl(),_0x24ddfc=await _0x5cf396[_0x3b1053(0x1d8)](fetch,_0x3c5cf3+'/api/v1/mcp/features/'+_0x4d4938+_0x3b1053(0x1b9)+_0x69676b+_0x3b1053(0x1c2),{'method':_0x5cf396['DNUbB'],'headers':{'Authorization':_0x3b1053(0x1c9)+_0x4624b7}});if(!_0x24ddfc['ok']){const _0x552862=await _0x24ddfc[_0x3b1053(0x1ea)]();throw new Error(_0x3b1053(0x1ca)+_0x552862);}return _0x24ddfc['json']();}export async function getActionItems(_0x434cb8){const _0x1d7760=_0x2871,_0x58ed9a={'zfPVY':function(_0x5e8883){return _0x5e8883();},'VZrxe':function(_0x148d24,_0x2fe8f9,_0x436aa4){return _0x148d24(_0x2fe8f9,_0x436aa4);},'MThRJ':_0x1d7760(0x1eb)},_0x33e918=await getToken();if(!_0x33e918)throw new Error(_0x1d7760(0x1fb));const _0xcdec2c=_0x58ed9a[_0x1d7760(0x1f4)](getApiBaseUrl),_0xf2c309=await _0x58ed9a[_0x1d7760(0x1ce)](fetch,_0xcdec2c+'/api/v1/mcp/features/'+_0x434cb8+_0x1d7760(0x1e4),{'method':_0x58ed9a['MThRJ'],'headers':{'Authorization':'Bearer\x20'+_0x33e918}});if(!_0xf2c309['ok']){const _0xa8b80b=await _0xf2c309['text']();throw new Error(_0x1d7760(0x1dc)+_0xa8b80b);}return _0xf2c309['json']();}export async function getItemFeedback(_0x1b23f5,_0x3438fb){const _0x2a0931=_0x2871,_0x57f5c9={'fJZQI':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','zpFrx':function(_0xe80b06,_0x28a46c,_0x33f4a5){return _0xe80b06(_0x28a46c,_0x33f4a5);}},_0xc0e499=await getToken();if(!_0xc0e499)throw new Error(_0x57f5c9['fJZQI']);const _0x4e3e40=getApiBaseUrl(),_0x587e3a=await _0x57f5c9[_0x2a0931(0x1fd)](fetch,_0x4e3e40+_0x2a0931(0x1f2)+_0x1b23f5+'/checklist-items/'+_0x3438fb+'/feedback',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0xc0e499}});if(!_0x587e3a['ok']){const _0x31cbe8=await _0x587e3a[_0x2a0931(0x1ea)]();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x31cbe8);}return _0x587e3a[_0x2a0931(0x1c0)]();}function _0x7a70(){const _0x1ed56e=['191DLnKYZ','zpFrx','2842038LQLibA','DELETE','true','iKlxN','length','Failed\x20to\x20create\x20scenario:\x20','itemIds','/checklist','/sessions/','limit','24lrMBpy','avHdi','updateChecklistItem','49761VzSWCB','Failed\x20to\x20list\x20feature\x20reviews:\x20','json','POST','/conclude','dbiGw','Feature\x20limit\x20exceeded','saefT','fTxAG','application/json','5vWCGgb','Bearer\x20','Failed\x20to\x20conclude\x20session:\x20','qliWk','mfXPP','set','VZrxe','3798WhQIBJ','offset','gitBranch','\x0a\x0aUpgrade\x20your\x20plan:\x20','SvGVZ','830980dVmwUD','toString','906712sOLnvB','stringify','dYDnp','Failed\x20to\x20list\x20sessions:\x20','https://dashboard.ranger.net/billing','jBwRD','Failed\x20to\x20get\x20action\x20items:\x20','Failed\x20to\x20get\x20feature\x20review\x20report:\x20','includeDeleted','/api/v1/mcp/features','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','rXiir','343616kOvlzA','QFoVC','/action-items','GoKrI','Failed\x20to\x20update\x20scenario:\x20','514647UOZWTU','status','cXtLh','text','GET','Failed\x20to\x20delete\x20feature\x20review:\x20','11PesHWY','/sessions','XCYKc','style','join','/api/v1/mcp/features/','eavsz','zfPVY','PATCH','kjevH','sessionId','hFSzy','gitRepoUrl','/report','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'];_0x7a70=function(){return _0x1ed56e;};return _0x7a70();}export async function markCommentsAddressed(_0x4d9e75,_0x4ed5cd,_0x518536){const _0x3d7aee=_0x2871,_0x4db31d={'jvSmZ':function(_0xa0595d){return _0xa0595d();},'cdanT':function(_0x2bb8c8,_0x20c520,_0x1b083b){return _0x2bb8c8(_0x20c520,_0x1b083b);},'DSFJC':'application/json'},_0x4c40bf=await _0x4db31d['jvSmZ'](getToken);if(!_0x4c40bf)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x529a63=_0x4db31d['jvSmZ'](getApiBaseUrl),_0xaae783=await _0x4db31d['cdanT'](fetch,_0x529a63+'/api/v1/mcp/features/'+_0x4d9e75+'/comments/address',{'method':_0x3d7aee(0x1c1),'headers':{'Authorization':'Bearer\x20'+_0x4c40bf,'Content-Type':_0x4db31d['DSFJC']},'body':JSON[_0x3d7aee(0x1d7)]({'checklistItemId':_0x4ed5cd,'commentIds':_0x518536})});if(!_0xaae783['ok']){const _0x98f6b4=await _0xaae783['text']();throw new Error(_0x3d7aee(0x1e0)+_0x98f6b4);}}function _0x2871(_0x2a5820,_0x136952){_0x2a5820=_0x2a5820-0x1b7;const _0x7a708f=_0x7a70();let _0x28715b=_0x7a708f[_0x2a5820];return _0x28715b;}export async function softDeleteFeature(_0x3b834a){const _0x2bbc65=_0x2871,_0x291bc7={'KtjlC':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','ANSSR':function(_0x161aca){return _0x161aca();},'vDUIF':function(_0x3db514,_0x20da77,_0x2a4a22){return _0x3db514(_0x20da77,_0x2a4a22);},'MRFgV':_0x2bbc65(0x1ff)},_0x958dff=await getToken();if(!_0x958dff)throw new Error(_0x291bc7['KtjlC']);const _0x3a6637=_0x291bc7['ANSSR'](getApiBaseUrl),_0x37b6e6=await _0x291bc7['vDUIF'](fetch,_0x3a6637+'/api/v1/mcp/features/'+_0x3b834a,{'method':_0x291bc7['MRFgV'],'headers':{'Authorization':'Bearer\x20'+_0x958dff}});if(!_0x37b6e6['ok']){const _0x1487a0=await _0x37b6e6['text']();throw new Error(_0x2bbc65(0x1ec)+_0x1487a0);}}export async function restoreFeature(_0x2f71dd){const _0x5292e1=_0x2871,_0x4b46eb={'kjevH':function(_0x1bdbb0){return _0x1bdbb0();},'bdYlb':function(_0x2ab828){return _0x2ab828();}},_0x3286da=await _0x4b46eb[_0x5292e1(0x1f6)](getToken);if(!_0x3286da)throw new Error(_0x5292e1(0x1fb));const _0x3262e8=_0x4b46eb['bdYlb'](getApiBaseUrl),_0x1168f9=await fetch(_0x3262e8+_0x5292e1(0x1f2)+_0x2f71dd+'/restore',{'method':_0x5292e1(0x1c1),'headers':{'Authorization':'Bearer\x20'+_0x3286da}});if(!_0x1168f9['ok']){const _0x3dc07d=await _0x1168f9['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x3dc07d);}}
|