@ranger-testing/ranger-cli 3.1.5-alpha.9b89f77-48 → 3.1.5-alpha.aebd071-49
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cli.js +1 -1
- package/build/commands/addEnv.js +1 -1
- package/build/commands/authEncrypt.js +1 -1
- package/build/commands/clean.js +1 -1
- package/build/commands/config.js +1 -1
- package/build/commands/deleteProfile.js +1 -1
- package/build/commands/env.js +1 -1
- package/build/commands/feature.js +1 -1
- package/build/commands/hook.js +1 -1
- package/build/commands/hooks/autoPrompt.js +1 -1
- package/build/commands/hooks/disable.js +1 -1
- package/build/commands/hooks/enable.js +1 -1
- package/build/commands/hooks/exitPlanMode.js +1 -1
- package/build/commands/hooks/index.js +1 -1
- package/build/commands/hooks/output.js +1 -1
- package/build/commands/hooks/planReminder.js +1 -1
- package/build/commands/hooks/planStart.js +1 -1
- package/build/commands/hooks/postEdit.js +1 -1
- package/build/commands/hooks/preCompact.js +1 -1
- package/build/commands/hooks/sessionEnd.js +1 -1
- package/build/commands/hooks/sessionStart.js +1 -1
- package/build/commands/hooks/stopHook.js +1 -1
- package/build/commands/index.js +1 -1
- package/build/commands/login.js +1 -1
- package/build/commands/mcpBootstrap.js +1 -1
- package/build/commands/migrateProfile.js +1 -1
- package/build/commands/setup/claude.js +1 -1
- package/build/commands/setup/opencode.js +1 -1
- package/build/commands/setupCi.js +1 -1
- package/build/commands/skillup.js +1 -1
- package/build/commands/start.js +1 -1
- package/build/commands/status.js +1 -1
- package/build/commands/update.js +1 -1
- package/build/commands/updateEnv.js +1 -1
- package/build/commands/useEnv.js +1 -1
- package/build/commands/utils/activeProfile.js +1 -1
- package/build/commands/utils/agentEnv.js +1 -1
- package/build/commands/utils/browserSessionsApi.js +1 -1
- package/build/commands/utils/claudeConfig.js +1 -1
- package/build/commands/utils/claudeOverrideSettings.js +1 -1
- package/build/commands/utils/claudePlugin.js +1 -1
- package/build/commands/utils/cloudProfile.js +1 -1
- package/build/commands/utils/cloudProfileSession.js +1 -1
- package/build/commands/utils/crypto.js +1 -1
- package/build/commands/utils/desirePathLog.js +1 -1
- package/build/commands/utils/deviceAuth.js +1 -1
- package/build/commands/utils/environment.js +1 -1
- package/build/commands/utils/featureApi.js +1 -1
- package/build/commands/utils/fixWebmDuration.js +1 -1
- package/build/commands/utils/gitTracked.js +1 -1
- package/build/commands/utils/keychain.js +1 -1
- package/build/commands/utils/legacyWarning.js +1 -1
- package/build/commands/utils/localAgentInstallationsApi.js +1 -1
- package/build/commands/utils/matchAuthEnvironment.js +1 -1
- package/build/commands/utils/mcpImageBase64.js +1 -1
- package/build/commands/utils/model.js +1 -1
- package/build/commands/utils/novaActCli.js +1 -1
- package/build/commands/utils/opencodeConfig.js +1 -1
- package/build/commands/utils/organizationEnvApi.js +1 -1
- package/build/commands/utils/playwrightCli.js +1 -1
- package/build/commands/utils/profileMessages.js +1 -1
- package/build/commands/utils/profileSetupBanner.js +1 -1
- package/build/commands/utils/projectsConfig.js +1 -1
- package/build/commands/utils/rangerConfig.js +1 -1
- package/build/commands/utils/rangerRoot.js +1 -1
- package/build/commands/utils/rangerwrightCli.js +1 -1
- package/build/commands/utils/resolveProfileContext.js +1 -1
- package/build/commands/utils/resolveProfileUrl.js +1 -1
- package/build/commands/utils/retry.js +1 -1
- package/build/commands/utils/scenarioOriginCheck.js +1 -1
- package/build/commands/utils/sessionCache.js +1 -1
- package/build/commands/utils/settings.js +1 -1
- package/build/commands/utils/skillContent.js +1 -1
- package/build/commands/utils/skills.js +1 -1
- package/build/commands/utils/stitchWebmFiles.js +1 -1
- package/build/commands/utils/telemetry.js +1 -1
- package/build/commands/utils/tokenRefresh.js +1 -1
- package/build/commands/utils/traceSnapshotMapper.js +1 -1
- package/build/commands/utils/tunnelClient.js +1 -1
- package/build/commands/utils/userApi.js +1 -1
- package/build/commands/utils/version.js +1 -1
- package/build/commands/verifyFeature.js +1 -1
- package/build/commands/verifyFeatureCli.js +1 -1
- package/build/commands/verifyFeatureNovaCli.js +1 -1
- package/build/commands/verifyFeatureRangerwrightCli.js +1 -1
- package/package.json +4 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
const _0x4bac8e=_0x24ab;(function(_0x3cefb7,_0xb08a73){const _0xdb78b=_0x24ab,_0x1f311c=_0x3cefb7();while(!![]){try{const _0x2215df=-parseInt(_0xdb78b(0x1e1))/0x1*(parseInt(_0xdb78b(0x1b2))/0x2)+-parseInt(_0xdb78b(0x1ea))/0x3*(parseInt(_0xdb78b(0x1e4))/0x4)+parseInt(_0xdb78b(0x191))/0x5+parseInt(_0xdb78b(0x196))/0x6+parseInt(_0xdb78b(0x178))/0x7+-parseInt(_0xdb78b(0x1a4))/0x8+parseInt(_0xdb78b(0x195))/0x9;if(_0x2215df===_0xb08a73)break;else _0x1f311c['push'](_0x1f311c['shift']());}catch(_0x59cfa0){_0x1f311c['push'](_0x1f311c['shift']());}}}(_0x34c4,0x74eba));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x25107d from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0x4a6003){const _0xc96b23=_0x24ab,_0x3b83f6={'yWUQK':'invalid-url'};try{return new URL(_0x4a6003)[_0xc96b23(0x17a)];}catch{return _0x3b83f6[_0xc96b23(0x1ac)];}}function errorMessageForTelemetry(_0x179eab){const _0x52e210={'TUFyg':function(_0x4e1e8a,_0x2c14db){return _0x4e1e8a instanceof _0x2c14db;}};return _0x52e210['TUFyg'](_0x179eab,Error)?_0x179eab['message']:undefined;}function trackBridgeEvent(_0x215f30,_0x581bac){const _0x20e872=_0x24ab,_0x42c35f={'gPEZo':function(_0x575a9d,_0x4a6a95){return _0x575a9d===_0x4a6a95;},'SDnvr':'local_ws_error','xnpeW':'tunnel_bridge'};if(!_0x215f30)return;const _0x19ce99={'tunnelSessionId':_0x581bac[_0x20e872(0x15f)],'tunnelEventType':_0x581bac['type'],'connectionId':_0x581bac[_0x20e872(0x15d)],'code':_0x581bac['code'],'reason':_0x581bac['reason'],'error':_0x581bac[_0x20e872(0x1e3)],'elapsedMs':_0x581bac[_0x20e872(0x18a)],'activeLocalConnections':_0x581bac[_0x20e872(0x17d)],'pendingLocalConnections':_0x581bac['pendingLocalConnections']};_0x215f30[_0x20e872(0x1d4)]('tunnel_bridge_event',_0x19ce99),(_0x42c35f[_0x20e872(0x1ef)](_0x581bac[_0x20e872(0x1b5)],_0x20e872(0x162))||_0x42c35f['gPEZo'](_0x581bac[_0x20e872(0x1b5)],_0x42c35f['SDnvr']))&&void _0x215f30[_0x20e872(0x1e8)](_0x42c35f[_0x20e872(0x1a0)],new Error(_0x581bac['error']??_0x581bac['type']),_0x19ce99);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x4d103c=_0x24ab,_0x359024={'jhBjS':_0x4d103c(0x1f8)},_0x2de857=await getToken();if(!_0x2de857)throw new Error(_0x359024['jhBjS']);return _0x2de857;}function _0x34c4(){const _0x530407=['utf-8','ambiguous','\x20\x20forceLogin\x20enabled\x20for\x20\x22','prompt','Auth\x20environment\x20\x22','4726449fSrmFH','\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.','host','/api/v1/tunnel/sessions/','confirm','activeLocalConnections','GrmOq','\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.','tunnel_login_request','JUpIu','Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','statusText','join','RCVPe','not_configured','storageState','newPage','ukAoe','elapsedMs','\x20\x20No\x20live\x20session\x20for\x20\x22','goto','Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20','catch','you\x27re\x20now\x20at\x20\x22','trim','2392265dtaQjI','VbCNt','string','oDGNs','5826528FyXuRY','4154766WEmCFI','tKnjN','log','\x22\x20failed\x20validation\x20—\x20refreshing...','RANGER_TUNNEL_LOGIN_HEADED','test_output','\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20','settings','YFLYX','\x22\x20matched\x20by\x20host\x20for\x20','xnpeW','sessionState','CwJlE','\x20\x20Cloud\x20session\x20for\x20\x22','5353200TkzmPb','BDsBV','\x22.\x0a','clientIp','):\x20','code','tzuVy','password','yWUQK','rUnTn','fBcfq','FaOjJ','isArray','environmentKey','42EjGzBJ','NBrNy','status','type','ehaaD','Iojya','TIliU','defaultEnvironmentKey','WWNhd','username','invalidateOn','trackPhaseStart','Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20(','env','POST','JbsfZ','auth','/api/v1/profiles/','gywRK','\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22','length','/login','\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22','storageStatePath','session_state','zITYm','\x20\x20Login\x20successful.\x20Session\x20cached.','TEjIF','/session','browserOptions','RVWzM','profiles','wsEndpoint','AbXym','trackPhaseEnd','userAgent','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','detail','airpa','application/json','force',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','setupHeaders','parse','sessionCheckPath','forceLogin','Cloud\x20profile\x20\x22','25131cLrkNi','replace','error','188UdWRty','telemetry','yfxIj','EUtLH','trackPhaseError','/api/v1/profiles','52194pkyJrC','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','tunnel_login_setup','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','RANGER_TEST_USERNAME','gPEZo','glEgc','xElKP','\x22\x20on\x20profile\x20\x22','obLFB','domains','\x22,\x20refreshing\x20session...','IwzfU','RANGER_TEST_PASSWORD','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','agent','environments','\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22','/api/v1/tunnel/sessions','aDFiA','iUJJr','\x22;\x20using\x20\x22','dLDnj','jGlTJ','\x20\x20Options:\x0a','WrmhS','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','EuwXC','TDuxI','success','connectionId','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','sessionId','name','true','tunnel_error','cookies','launch','organizationId','loginInstructions','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','tunnel','raw','stringify','close','key','effectiveBaseUrl','ApiError','\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20','Browser\x20login\x20timed\x20out\x20after\x20','json','targetUrl'];_0x34c4=function(){return _0x530407;};return _0x34c4();}async function apiRequest(_0x318ca3,_0x17cd40={}){const _0x26eb7e=_0x24ab,_0x5362e8={'RVWzM':function(_0x37a73f){return _0x37a73f();},'TIliU':function(_0x144200,_0x3bb011,_0x5e6b89){return _0x144200(_0x3bb011,_0x5e6b89);},'QOykO':function(_0xae88ab,_0x13feb0){return _0xae88ab===_0x13feb0;},'dLDnj':_0x26eb7e(0x193),'yfxIj':function(_0x563fa1,_0x744b6e){return _0x563fa1===_0x744b6e;}},_0x5c0eef=await _0x5362e8[_0x26eb7e(0x1d0)](requireToken),_0x5e3e6f=_0x5362e8['RVWzM'](getApiBaseUrl),_0x4c3e0c=await _0x5362e8[_0x26eb7e(0x1b8)](fetch,''+_0x5e3e6f+_0x318ca3,{..._0x17cd40,'headers':{'Authorization':'Bearer\x20'+_0x5c0eef,'Content-Type':_0x26eb7e(0x1d9),..._0x17cd40['headers']??{}}});if(!_0x4c3e0c['ok']){let _0x302983='',_0x180197;try{const _0x413609=await _0x4c3e0c[_0x26eb7e(0x171)](),_0x29963b=(_0x5362e8['QOykO'](typeof _0x413609[_0x26eb7e(0x1e3)],'string')?_0x413609['error']:undefined)??JSON[_0x26eb7e(0x16a)](_0x413609);_0x302983=_0x29963b;typeof _0x413609['test_output']===_0x5362e8[_0x26eb7e(0x155)]&&_0x413609[_0x26eb7e(0x19b)]&&(_0x302983=_0x302983+'\x0a'+_0x413609[_0x26eb7e(0x19b)]);if(typeof _0x413609[_0x26eb7e(0x1a9)]===_0x5362e8[_0x26eb7e(0x155)])_0x180197=_0x413609[_0x26eb7e(0x1a9)];}catch{_0x302983=_0x4c3e0c[_0x26eb7e(0x183)];}throw new ApiError('API\x20request\x20'+_0x318ca3+'\x20failed\x20('+_0x4c3e0c[_0x26eb7e(0x1b4)]+_0x26eb7e(0x1a8)+_0x302983,_0x4c3e0c[_0x26eb7e(0x1b4)],_0x302983,_0x180197);}if(_0x5362e8[_0x26eb7e(0x1e6)](_0x4c3e0c['status'],0xcc))return undefined;return _0x4c3e0c[_0x26eb7e(0x171)]();}export class ApiError extends Error{[_0x4bac8e(0x1b4)];['detail'];[_0x4bac8e(0x1a9)];constructor(_0x593625,_0x50ecec,_0x4a31da,_0x4bd011){const _0x425495=_0x4bac8e,_0x32be43={'qGmCu':_0x425495(0x16e)};super(_0x593625),this[_0x425495(0x1b4)]=_0x50ecec,this[_0x425495(0x1d7)]=_0x4a31da,this['code']=_0x4bd011,this['name']=_0x32be43['qGmCu'];}}export async function fetchCloudProfile(_0x57bc9a){const _0x113e53=_0x4bac8e,_0x59776e={'WrmhS':function(_0x422354,_0x464e23){return _0x422354(_0x464e23);},'IYsXf':function(_0x375114,_0x153df){return _0x375114(_0x153df);},'rNNTA':function(_0x35920f,_0x272db9){return _0x35920f instanceof _0x272db9;}};try{return await _0x59776e[_0x113e53(0x158)](apiRequest,_0x113e53(0x1c3)+_0x59776e['IYsXf'](encodeURIComponent,_0x57bc9a));}catch(_0x50543c){if(_0x59776e['rNNTA'](_0x50543c,ApiError)&&_0x50543c[_0x113e53(0x1b4)]===0x194)return null;throw _0x50543c;}}export async function listCloudProfiles(){const _0x92e9ee=_0x4bac8e,_0x1f8436={'oDGNs':_0x92e9ee(0x1e9)},_0x5688b6=await apiRequest(_0x1f8436[_0x92e9ee(0x194)]);return _0x5688b6[_0x92e9ee(0x1d1)];}export async function deleteCloudProfile(_0x111084){const _0xc808a4=_0x4bac8e,_0x25af54={'sAOSI':function(_0x5424b2,_0x196c79,_0x26f620){return _0x5424b2(_0x196c79,_0x26f620);},'TDuxI':function(_0x5a456d,_0x3a05a0){return _0x5a456d===_0x3a05a0;}};try{await _0x25af54['sAOSI'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x111084),{'method':'DELETE'});}catch(_0x3a3e6d){if(_0x3a3e6d instanceof ApiError&&_0x25af54[_0xc808a4(0x15b)](_0x3a3e6d[_0xc808a4(0x1b4)],0x194))throw new Error(_0xc808a4(0x1e0)+_0x111084+'\x22\x20not\x20found.');throw _0x3a3e6d;}}function _0x24ab(_0x10993a,_0x4c2f4a){_0x10993a=_0x10993a-0x155;const _0x34c435=_0x34c4();let _0x24ab02=_0x34c435[_0x10993a];return _0x24ab02;}export async function createCloudProfile(_0x30bed3,_0x5a84ab,_0x2b13e9={}){const _0x9e19cf=_0x4bac8e,_0x46b475={'pHyyi':function(_0x3889ed,_0x1ad666){return _0x3889ed>_0x1ad666;},'CwJlE':function(_0x468684,_0x3b5b48,_0xad5980){return _0x468684(_0x3b5b48,_0xad5980);},'CPhIC':_0x9e19cf(0x1c0)},_0x37135a={'name':_0x30bed3};if(_0x5a84ab)_0x37135a['environment_key']=_0x5a84ab;_0x2b13e9[_0x9e19cf(0x19d)]&&_0x46b475['pHyyi'](Object['keys'](_0x2b13e9[_0x9e19cf(0x19d)])['length'],0x0)&&(_0x37135a[_0x9e19cf(0x19d)]=_0x2b13e9['settings']);if(_0x2b13e9[_0x9e19cf(0x1bb)])_0x37135a['username']=_0x2b13e9[_0x9e19cf(0x1bb)];if(_0x2b13e9[_0x9e19cf(0x1ab)])_0x37135a['password']=_0x2b13e9[_0x9e19cf(0x1ab)];return await _0x46b475[_0x9e19cf(0x1a2)](apiRequest,'/api/v1/profiles',{'method':_0x46b475['CPhIC'],'body':JSON[_0x9e19cf(0x16a)](_0x37135a)});}export async function uploadCloudProfileSession(_0x32a4b1,_0x3596be){const _0x119e72=_0x4bac8e,_0x3c543a={'tmOTI':function(_0x82c93f,_0x2ad552,_0x14faaa){return _0x82c93f(_0x2ad552,_0x14faaa);}};return await _0x3c543a['tmOTI'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x32a4b1)+_0x119e72(0x1ce),{'method':'POST','body':JSON['stringify']({'session_state':_0x3596be})});}export async function saveCloudProfileCredentials(_0x274aa6,_0x2033da,_0x39dd60){const _0x5d211e=_0x4bac8e,_0x11e566={'sYDRR':'PUT'};await apiRequest(_0x5d211e(0x1c3)+encodeURIComponent(_0x274aa6),{'method':_0x11e566['sYDRR'],'body':JSON[_0x5d211e(0x16a)]({'username':_0x2033da,'password':_0x39dd60})});}export async function fetchAuthConfig(){const _0x5badf7=_0x4bac8e;try{const _0x27a2be=await apiRequest('/api/v1/profiles/auth-config');return _0x27a2be['auth_config'];}catch(_0x3399d8){return _0x3399d8 instanceof ApiError&&_0x3399d8['status']!==0x194&&console[_0x5badf7(0x1e3)](_0x5badf7(0x16f)+_0x3399d8['message']),null;}}async function createTunnelSession(_0x529c22){const _0x1b9c82=_0x4bac8e;return await apiRequest(_0x1b9c82(0x1fc),{'method':'POST','body':JSON['stringify']({'targetUrl':_0x529c22,'mode':_0x1b9c82(0x1f9)})});}async function deleteTunnelSession(_0x14bea9){const _0x157009=_0x4bac8e,_0x20dad2={'JUpIu':'DELETE'};await apiRequest(_0x157009(0x17b)+_0x14bea9,{'method':_0x20dad2[_0x157009(0x181)]});}export function pickAdHocEnvKey(_0x1ed67e,_0x53ffd8,_0x5cc9ee){const _0x4d07fe=_0x4bac8e,_0x54a498={'MOFvV':function(_0xabcf8c,_0x21ff8d,_0x4ce2e9){return _0xabcf8c(_0x21ff8d,_0x4ce2e9);},'TEjIF':function(_0x1beef4,_0x151397){return _0x1beef4 in _0x151397;},'Iojya':_0x4d07fe(0x16c),'EuwXC':function(_0x4033fc,_0x52ad05){return _0x4033fc(_0x52ad05);},'glEgc':function(_0x3124ba,_0x21d6a3){return _0x3124ba+_0x21d6a3;},'aDFiA':function(_0x3f38c3,_0x4c2585){return _0x3f38c3+_0x4c2585;}};if(_0x5cc9ee){if(!_0x1ed67e?.['environments']?.[_0x5cc9ee]){const _0x592360=Object['keys'](_0x1ed67e?.[_0x4d07fe(0x1fa)]??{});throw new Error(_0x4d07fe(0x177)+_0x5cc9ee+'\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.'+(_0x592360[_0x4d07fe(0x1c6)]?'\x20Available:\x20'+_0x592360[_0x4d07fe(0x184)](',\x20')+'.':_0x4d07fe(0x167))+'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)');}return _0x5cc9ee;}if(!_0x1ed67e)return null;if(_0x53ffd8){const _0x48d736=_0x54a498['MOFvV'](matchAuthEnvironmentExact,_0x53ffd8,_0x1ed67e);if(_0x48d736)return _0x48d736;const _0x37ba3b=matchAuthEnvironmentByHost(_0x53ffd8,_0x1ed67e);if(_0x37ba3b&&_0x54a498[_0x4d07fe(0x1cd)](_0x54a498[_0x4d07fe(0x1b7)],_0x37ba3b))return console[_0x4d07fe(0x198)]('\x20\x20Auth\x20env\x20\x22'+_0x37ba3b['key']+_0x4d07fe(0x19f)+_0x53ffd8+'\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).'),_0x37ba3b['key'];if(_0x37ba3b&&_0x4d07fe(0x174)in _0x37ba3b)throw new Error(_0x4d07fe(0x1be)+_0x37ba3b[_0x4d07fe(0x174)][_0x4d07fe(0x184)](',\x20')+_0x4d07fe(0x1db));if(_0x54a498[_0x4d07fe(0x15a)](needsTunnel,_0x53ffd8))throw new Error(_0x54a498['glEgc'](_0x54a498[_0x4d07fe(0x1f0)](_0x54a498['glEgc']('No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22'+_0x53ffd8+_0x4d07fe(0x1a6)+'\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a',_0x4d07fe(0x157)),'\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a'),'\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x53ffd8[_0x4d07fe(0x1e2)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a')+('\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20'+_0x53ffd8+_0x4d07fe(0x17f)));}if(_0x1ed67e['defaultEnvironmentKey'])return _0x1ed67e['defaultEnvironmentKey'];const _0x156e0f=Object['keys'](_0x1ed67e[_0x4d07fe(0x1fa)]??{});if(_0x156e0f[_0x4d07fe(0x1c6)]===0x1)return _0x156e0f[0x0];if(_0x156e0f['length']===0x0)return null;throw new Error(_0x54a498[_0x4d07fe(0x1fd)]('Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20('+_0x156e0f['join'](',\x20')+').\x20','Pass\x20--base-url\x20<your-app-url>\x20so\x20Ranger\x20can\x20match\x20the\x20right\x20one,\x20or\x20create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`.'));}export function adHocProfileName(_0x3380e2,_0x48b488,_0x3f3d92){if(!_0x48b488||_0x48b488===_0x3f3d92)return _0x3380e2;return _0x3380e2+':'+_0x48b488;}export async function resolveAdHocProfile(_0x4854e9={},_0x117e51=process[_0x4bac8e(0x1bf)]){const _0xb8c278=_0x4bac8e,_0x26a616={'RouDM':'none','IwzfU':function(_0x3035b7,_0x57aa5c){return _0x3035b7(_0x57aa5c);},'WWNhd':function(_0x29a87b,_0x65f629,_0x4acbfc,_0x3460f6){return _0x29a87b(_0x65f629,_0x4acbfc,_0x3460f6);}},_0x5d4d2e=_0x117e51['RANGER_TEST_USERNAME'];if(!_0x5d4d2e)return null;const _0x3c5f7e=await fetchAuthConfig(),_0x230721=pickAdHocEnvKey(_0x3c5f7e,_0x4854e9[_0xb8c278(0x172)],_0x4854e9['envKey']);let _0x1c45cc=adHocProfileName(_0x5d4d2e,_0x230721,_0x3c5f7e?.[_0xb8c278(0x1b9)]),_0x1c4e96=await fetchCloudProfile(_0x1c45cc);_0x1c4e96&&_0x230721&&_0x1c4e96[_0xb8c278(0x1b1)]!==_0x230721&&(console['log']('\x20\x20Cloud\x20profile\x20\x22'+_0x1c45cc+'\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22'+(_0x1c4e96['environmentKey']??_0x26a616['RouDM'])+_0xb8c278(0x1eb)+_0x230721+_0xb8c278(0x1ff)+_0x5d4d2e+':'+_0x230721+'\x22\x20instead.'),_0x1c45cc=_0x5d4d2e+':'+_0x230721,_0x1c4e96=await _0x26a616[_0xb8c278(0x1f6)](fetchCloudProfile,_0x1c45cc));if(_0x1c4e96)return{'name':_0x1c4e96['name'],'profile':_0x1c4e96};const _0x455ccd=_0x117e51[_0xb8c278(0x1f7)],_0x5ad473=await _0x26a616[_0xb8c278(0x1ba)](createCloudProfile,_0x1c45cc,_0x230721??undefined,{'username':_0x5d4d2e,'password':_0x455ccd});return console[_0xb8c278(0x198)]('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x5ad473['name']+'\x22\x20for\x20'+_0x5d4d2e+(_0x230721?'\x20(auth\x20env:\x20'+_0x230721+')':'')),{'name':_0x5ad473[_0xb8c278(0x160)],'profile':_0x5ad473};}export async function writeSessionToLocalCache(_0x1a9fcc,_0xf19486,_0x2b0e4c,_0x40e459,_0x138a5f,_0x2ac039,_0x25b3c4){const _0x4b4407=_0x4bac8e,_0x481457={'TRuqH':function(_0x49729d){return _0x49729d();},'xoBUd':_0x4b4407(0x1c2),'xElKP':function(_0x5bf479,_0x359553,_0xcb6db8){return _0x5bf479(_0x359553,_0xcb6db8);},'vUxiH':function(_0x54f1d3,_0x4c48d8,_0x413b7e){return _0x54f1d3(_0x4c48d8,_0x413b7e);},'XCGNn':function(_0x1a4b05,_0x2279be,_0x4b8cf6){return _0x1a4b05(_0x2279be,_0x4b8cf6);},'WGxny':function(_0x5f4b57,_0x214d99){return _0x5f4b57(_0x214d99);}},_0xced09e=sessionCacheHash({'orgId':_0xf19486,'profileName':_0x1a9fcc,'effectiveBaseUrl':_0x2b0e4c,'setupHeaders':_0x40e459,'invalidateOn':_0x25b3c4?.['invalidateOn'],'userAgent':_0x25b3c4?.[_0x4b4407(0x1d5)],'clientIp':_0x25b3c4?.['clientIp']}),_0x4b669f=getSessionCachePath(_0xced09e,_0x1a9fcc),_0x1913ea=join(_0x481457['TRuqH'](getRangerHomeDir),_0x481457['xoBUd']);!existsSync(_0x1913ea)&&await _0x481457[_0x4b4407(0x1f1)](mkdir,_0x1913ea,{'recursive':!![]});const _0x4ac7aa={..._0x138a5f};_0x2ac039&&_0x2ac039['length']>0x0&&Array[_0x4b4407(0x1b0)](_0x4ac7aa['cookies'])&&(_0x4ac7aa['cookies']=_0x481457['vUxiH'](duplicateCookiesForDomains,_0x4ac7aa[_0x4b4407(0x163)],_0x2ac039));const _0xf9c022={'cached_at':new Date()['toISOString'](),'session_state':_0x4ac7aa};await _0x481457['XCGNn'](writeFile,_0x4b669f,JSON['stringify'](_0xf9c022,null,0x2));const _0x2909da=_0x481457['WGxny'](getStorageStatePath,_0x4b669f);return await writeFile(_0x2909da,JSON['stringify'](_0x4ac7aa,null,0x2)),_0x2909da;}export async function checkLocalCache(_0x5edfe5,_0x1a3a95,_0xac23d9,_0x46f20c,_0x2b0ca2){const _0x524ad2=_0x4bac8e,_0x10bf1b={'FZoxY':function(_0x1df707,_0x196f9f,_0x4e5b02){return _0x1df707(_0x196f9f,_0x4e5b02);},'nEVdD':function(_0xae44d6,_0x14b03f){return _0xae44d6(_0x14b03f);},'iUJJr':function(_0x2f6fdf,_0x58cb52,_0x3ed551){return _0x2f6fdf(_0x58cb52,_0x3ed551);}},_0x518f91=sessionCacheHash({'orgId':_0x1a3a95,'profileName':_0x5edfe5,'effectiveBaseUrl':_0xac23d9,'setupHeaders':_0x46f20c,'invalidateOn':_0x2b0ca2?.[_0x524ad2(0x1bc)],'userAgent':_0x2b0ca2?.[_0x524ad2(0x1d5)],'clientIp':_0x2b0ca2?.[_0x524ad2(0x1a7)]}),_0x4ba44a=_0x10bf1b['FZoxY'](getSessionCachePath,_0x518f91,_0x5edfe5),_0x569139=getStorageStatePath(_0x4ba44a);if(!existsSync(_0x4ba44a)||!_0x10bf1b['nEVdD'](existsSync,_0x569139))return null;try{const _0x25b567=await _0x10bf1b[_0x524ad2(0x1fe)](readFile,_0x4ba44a,_0x524ad2(0x173));return JSON[_0x524ad2(0x1dd)](_0x25b567),{'storageStatePath':_0x569139};}catch{return null;}}function launchRealBrowser(){const _0x8f7cc4=_0x4bac8e;return chromium[_0x8f7cc4(0x164)]({'headless':!![]});}function emitSessionValidationHint(_0x54de2f,_0x4f5542){const _0x17f3e3=_0x4bac8e;if(!_0x4f5542||!_0x4f5542[_0x17f3e3(0x1f4)]?.[_0x17f3e3(0x1c6)])return;let _0x52c08a;try{_0x52c08a=new URL(_0x54de2f);}catch{return;}const _0x5b577e=[];for(const _0xf24fb2 of _0x4f5542[_0x17f3e3(0x1f4)]){try{_0x5b577e['push']({'raw':_0xf24fb2,'url':new URL(_0xf24fb2)});}catch{}}if(_0x5b577e['length']===0x0)return;if(_0x5b577e['some'](_0x5090f5=>_0x5090f5['url']['origin']===_0x52c08a['origin']))return;const _0x4a2d08=_0x5b577e['map'](_0x26e81b=>'\x22'+_0x26e81b[_0x17f3e3(0x169)]+'\x22')[_0x17f3e3(0x184)](',\x20');console[_0x17f3e3(0x198)](_0x17f3e3(0x19c)+_0x4a2d08+';\x20'+(_0x17f3e3(0x18f)+_0x54de2f+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+'If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.');}export async function serverSideLogin(_0x2c6eb5,_0x110e49){const _0x3ac140=_0x4bac8e,_0x2f4e29={'zITYm':'POST','SVpwh':function(_0x3f17dd,_0x1aca25){return _0x3f17dd===_0x1aca25;},'rUnTn':_0x3ac140(0x186)},_0x5af870=process[_0x3ac140(0x1bf)][_0x3ac140(0x1ee)],_0x32fb79=process['env'][_0x3ac140(0x1f7)],_0x50e0dc={};if(_0x5af870)_0x50e0dc[_0x3ac140(0x1bb)]=_0x5af870;if(_0x32fb79)_0x50e0dc[_0x3ac140(0x1ab)]=_0x32fb79;if(_0x110e49?.['force'])_0x50e0dc[_0x3ac140(0x1da)]=!![];if(_0x110e49?.[_0x3ac140(0x172)])_0x50e0dc['target_url']=_0x110e49[_0x3ac140(0x172)];_0x110e49?.[_0x3ac140(0x168)]&&(_0x50e0dc['tunnel_session_id']=_0x110e49['tunnel'][_0x3ac140(0x15f)],_0x50e0dc['pw_endpoint']=_0x110e49['tunnel']['pwEndpoint']);try{return await apiRequest(_0x3ac140(0x1c3)+encodeURIComponent(_0x2c6eb5)+_0x3ac140(0x1c7),{'method':_0x2f4e29[_0x3ac140(0x1cb)],'body':JSON['stringify'](_0x50e0dc)});}catch(_0x595c9b){if(_0x595c9b instanceof ApiError&&_0x595c9b[_0x3ac140(0x1b4)]===0x190&&_0x2f4e29['SVpwh'](_0x595c9b[_0x3ac140(0x1a9)],'not_configured'))return{'status':_0x2f4e29[_0x3ac140(0x1ad)],'error':_0x595c9b[_0x3ac140(0x1d7)]};throw _0x595c9b;}}async function serverSideLoginWithOptionalTunnel(_0x4df715,_0xe867b,_0x3f038c={}){const _0x4cf0c2=_0x4bac8e,_0xfe303c={'FxnuU':function(_0xc0e38c,_0x37f536){return _0xc0e38c(_0x37f536);},'jGlTJ':function(_0x3b32fb,_0xe97824){return _0x3b32fb===_0xe97824;},'NBrNy':_0x4cf0c2(0x1ec),'ySoso':_0x4cf0c2(0x1ed),'yRkrN':function(_0x59c51f,_0x254ff7){return _0x59c51f(_0x254ff7);},'JbsfZ':_0x4cf0c2(0x180),'pfHMb':function(_0x2904e1,_0x5c0523,_0x126e56){return _0x2904e1(_0x5c0523,_0x126e56);},'dRMDd':function(_0x5cfc68,_0x3d48c2){return _0x5cfc68(_0x3d48c2);},'YFLYX':function(_0x3d0abb,_0x192989){return _0x3d0abb(_0x192989);}};if(!_0xfe303c['FxnuU'](needsTunnel,_0xe867b))return await serverSideLogin(_0x4df715,{'force':_0x3f038c['force']});let _0x412a51=null,_0x37f1c1=null,_0x38e643=null,_0x3a4cbd=null,_0x185ce8=![];const _0x19798b=process['env'][_0x4cf0c2(0x19a)]?.['toLowerCase'](),_0x4df15c=_0x19798b==='1'||_0xfe303c[_0x4cf0c2(0x156)](_0x19798b,_0x4cf0c2(0x161)),_0x1a1a8c={'profileName':_0x4df715,'targetUrlHost':targetHostForTelemetry(_0xe867b),'tunnelRequired':!![],'forceLogin':Boolean(_0x3f038c[_0x4cf0c2(0x1da)]),'localBrowserServerHeaded':_0x4df15c};try{_0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1bd)](_0xfe303c[_0x4cf0c2(0x1b3)],_0x1a1a8c);_0x4df15c&&console[_0x4cf0c2(0x198)](_0xfe303c['ySoso']);_0x412a51=await launchBrowserServer({'headless':!_0x4df15c}),_0x37f1c1=await createTunnelSession(_0xe867b);const _0x2c3756=await requireToken();_0x38e643=await _0xfe303c['yRkrN'](createTunnelBridge,{'localWsUrl':_0x412a51[_0x4cf0c2(0x1d2)],'tunnelServerUrl':_0x37f1c1['tunnelUrl'],'sessionId':_0x37f1c1[_0x4cf0c2(0x15f)],'apiKey':_0x2c3756,'onError':_0x4916d5=>{_0x3a4cbd=_0x4916d5;},'onClose':()=>{const _0x3c73a5=_0x4cf0c2;_0x3a4cbd??=new Error(_0x3c73a5(0x18d)+_0x4df715);},'onEvent':_0x3c76df=>trackBridgeEvent(_0x3f038c[_0x4cf0c2(0x1e5)],_0x3c76df)}),_0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1d4)](_0xfe303c[_0x4cf0c2(0x1b3)],{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1[_0x4cf0c2(0x15f)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x4df15c}),_0x185ce8=!![];try{return _0x3f038c['telemetry']?.[_0x4cf0c2(0x1bd)](_0xfe303c[_0x4cf0c2(0x1c1)],{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1['sessionId']}),await _0xfe303c['pfHMb'](serverSideLogin,_0x4df715,{'force':_0x3f038c['force'],'targetUrl':_0xe867b,'tunnel':{'sessionId':_0x37f1c1[_0x4cf0c2(0x15f)],'pwEndpoint':_0x37f1c1['pwEndpoint']}})['then'](_0x185586=>{const _0x44bf01=_0x4cf0c2;return _0x3f038c['telemetry']?.[_0x44bf01(0x1d4)](_0x44bf01(0x180),{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x44bf01(0x15f)],'loginStatus':_0x185586[_0x44bf01(0x1b4)],'hasSessionState':_0xfe303c['FxnuU'](Boolean,_0x185586[_0x44bf01(0x1ca)]),'hasTestOutput':Boolean(_0x185586[_0x44bf01(0x19b)]),'bridgeError':_0xfe303c['FxnuU'](errorMessageForTelemetry,_0x3a4cbd)}),_0x185586;});}catch(_0x420eec){await _0x3f038c['telemetry']?.[_0x4cf0c2(0x1e8)](_0xfe303c['JbsfZ'],_0x3a4cbd??_0x420eec,{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1['sessionId'],'bridgeError':_0xfe303c['dRMDd'](errorMessageForTelemetry,_0x3a4cbd)});throw _0x3a4cbd??_0x420eec;}}catch(_0x5f38f2){!_0x185ce8&&await _0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1e8)](_0x4cf0c2(0x1ec),_0x5f38f2,{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x4cf0c2(0x15f)]});throw _0x5f38f2;}finally{(_0x37f1c1||_0x412a51||_0x38e643)&&(_0x3f038c['telemetry']?.[_0x4cf0c2(0x1bd)]('tunnel_login_cleanup',{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x4cf0c2(0x15f)]}),_0x38e643?.[_0x4cf0c2(0x16b)](),_0x412a51&&await _0x412a51[_0x4cf0c2(0x16b)]()['catch'](()=>{}),_0x37f1c1&&await _0xfe303c[_0x4cf0c2(0x19e)](deleteTunnelSession,_0x37f1c1['sessionId'])[_0x4cf0c2(0x18e)](()=>{}),_0x3f038c[_0x4cf0c2(0x1e5)]?.[_0x4cf0c2(0x1d4)]('tunnel_login_cleanup',{..._0x1a1a8c,'tunnelSessionId':_0x37f1c1?.[_0x4cf0c2(0x15f)]}));}}export async function manualBrowserLogin(_0xfdd2f7,_0x11e038,_0xcb9f00={}){const _0x217c5f=_0x4bac8e,_0x4ff482={'ukAoe':function(_0x68c206){return _0x68c206();},'EUtLH':function(_0x2adf3b,_0x1845f5,_0x31c07a){return _0x2adf3b(_0x1845f5,_0x31c07a);},'tKnjN':function(_0x5ec392){return _0x5ec392();},'tzuVy':function(_0x1e59dd,_0x164b1b){return _0x1e59dd+_0x164b1b;},'AbXym':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','FaOjJ':'about:blank','aYoIo':'Browser\x20closed\x20before\x20authentication\x20was\x20saved.'};if(!_0x4ff482[_0x217c5f(0x197)](isInteractive))throw new Error(_0x4ff482[_0x217c5f(0x1aa)](_0x4ff482[_0x217c5f(0x1aa)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0xfdd2f7['name']+_0x217c5f(0x1a6),'\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20'),_0x4ff482[_0x217c5f(0x1d3)]));const _0x22502b=_0x11e038&&_0x11e038[_0x217c5f(0x1f4)][_0x217c5f(0x1c6)]>0x0?_0x11e038[_0x217c5f(0x1f4)][0x0]:_0x4ff482[_0x217c5f(0x1af)];console[_0x217c5f(0x198)]('\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.'),console['log']('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x10f889=>setTimeout(_0x10f889,0x7d0));const _0x4486d3=await chromium[_0x217c5f(0x164)]({'headless':![]});let _0x225cd9=null;try{const _0x1479ae={'ignoreHTTPSErrors':!![]};_0x11e038?.['setupHeaders']&&(_0x1479ae['extraHTTPHeaders']=_0x11e038['setupHeaders']);const _0x15d372=await _0x4486d3['newContext'](_0x1479ae);await addProfileSetupBanner(_0x15d372);const _0x187a4d=await _0x15d372[_0x217c5f(0x188)]();await _0x187a4d[_0x217c5f(0x18c)](_0x22502b);let _0x24d02b=![];await new Promise(_0x4d8059=>{const _0x21d1c4=_0x217c5f,_0xfa511b=_0x4ff482[_0x21d1c4(0x1e7)](setTimeout,()=>{const _0x2a9ac1=_0x21d1c4;_0x24d02b=!![],console['error'](_0x2a9ac1(0x170)+MANUAL_LOGIN_TIMEOUT_MS/0xea60+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x4ff482['ukAoe'](_0x4d8059);},MANUAL_LOGIN_TIMEOUT_MS);_0x187a4d['on']('close',async()=>{const _0x2bac68=_0x21d1c4;clearTimeout(_0xfa511b);try{const _0x58901c=await _0x15d372[_0x2bac68(0x187)]();_0x225cd9=_0x58901c;}catch{}_0x4ff482[_0x2bac68(0x189)](_0x4d8059);});});if(_0x24d02b&&!_0x225cd9)throw new Error('Browser\x20login\x20timed\x20out\x20before\x20completion.');}finally{await _0x4486d3[_0x217c5f(0x16b)]()[_0x217c5f(0x18e)](()=>{});}if(!_0x225cd9)throw new Error(_0x4ff482['aYoIo']);return _0xcb9f00['persistSessionState']!==![]&&await _0x4ff482['EUtLH'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0xfdd2f7['name'])+'/session',{'method':_0x217c5f(0x1c0),'body':JSON['stringify']({'session_state':_0x225cd9,'updated_by':'cli:manual-login'})}),{'sessionState':_0x225cd9};}export async function promptSaveCredentials(_0x59d87e){const _0x4ac7a1=_0x4bac8e,_0x3f3550={'ehaaD':function(_0x20efb,_0x2f9d7e){return _0x20efb||_0x2f9d7e;},'VbCNt':_0x4ac7a1(0x182),'isGYn':function(_0x42fd8e,_0x5533f1,_0x45255c){return _0x42fd8e(_0x5533f1,_0x45255c);},'fBcfq':'PUT'},_0x519c3a=process['env'][_0x4ac7a1(0x1ee)],_0x4650cd=process[_0x4ac7a1(0x1bf)]['RANGER_TEST_PASSWORD'];if(_0x3f3550[_0x4ac7a1(0x1b6)](!_0x519c3a,!_0x4650cd))return;if(!isInteractive())return;const {save:_0x9b5fa5}=await _0x25107d[_0x4ac7a1(0x176)]([{'type':_0x4ac7a1(0x17c),'name':'save','message':_0x3f3550[_0x4ac7a1(0x192)],'default':![]}]);if(!_0x9b5fa5)return;await _0x3f3550['isGYn'](apiRequest,_0x4ac7a1(0x1c3)+encodeURIComponent(_0x59d87e),{'method':_0x3f3550[_0x4ac7a1(0x1ae)],'body':JSON['stringify']({'username':_0x519c3a,'password':_0x4650cd})}),console['log'](_0x4ac7a1(0x179));}export async function resolveCloudProfileSession(_0x672803,_0x38409d={}){const _0x4afa7c=_0x4bac8e,_0xc182a={'GjEZc':function(_0x449374){return _0x449374();},'TGKSy':function(_0x270fd5,_0x2f06cc,_0x54fe52){return _0x270fd5(_0x2f06cc,_0x54fe52);},'BDsBV':function(_0x3d77c6,_0x583c22){return _0x3d77c6===_0x583c22;},'airpa':_0x4afa7c(0x193),'PUAyj':function(_0x2cfd62,_0x47198d){return _0x2cfd62(_0x47198d);},'MDRja':function(_0x40de80,_0x24129d,_0x4880c7,_0x3e3f15,_0x5098b3,_0x6033ba){return _0x40de80(_0x24129d,_0x4880c7,_0x3e3f15,_0x5098b3,_0x6033ba);},'obLFB':function(_0x3b84b7,_0x359cc7){return _0x3b84b7&&_0x359cc7;},'uKDzV':function(_0x4c4a6f,_0x4e7df7,_0xd6bd43){return _0x4c4a6f(_0x4e7df7,_0xd6bd43);},'gcFnY':function(_0x2b40f4,_0x545531,_0x5d27c4,_0x482ad1,_0x38aaec){return _0x2b40f4(_0x545531,_0x5d27c4,_0x482ad1,_0x38aaec);},'vusBl':function(_0x49338f,_0x12afaa,_0xe4c00f){return _0x49338f(_0x12afaa,_0xe4c00f);},'zKkpy':function(_0x402845,_0x208f45){return _0x402845(_0x208f45);},'wXKFP':function(_0xf88672,_0x5e789b){return _0xf88672||_0x5e789b;},'SbQgm':function(_0x5c9c62,_0x160a78,_0x41e7b4,_0x31a4de){return _0x5c9c62(_0x160a78,_0x41e7b4,_0x31a4de);},'WBpHT':_0x4afa7c(0x186),'gywRK':'\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...','RCVPe':'\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','ATBGN':function(_0x265262,_0x3b9c03){return _0x265262 instanceof _0x3b9c03;},'PvroN':function(_0x1f1f8e,_0x5cc158){return _0x1f1f8e(_0x5cc158);},'GrmOq':function(_0x1f2141,_0x199cb2,_0x2a2005,_0x392c9c,_0x58893e,_0x3be7f6,_0x44262c,_0x42c55a){return _0x1f2141(_0x199cb2,_0x2a2005,_0x392c9c,_0x58893e,_0x3be7f6,_0x44262c,_0x42c55a);}},_0x3a4d07=_0x672803[_0x4afa7c(0x19d)]??{},_0x385bb4=await _0xc182a['GjEZc'](fetchAuthConfig),_0x2b5569=_0x385bb4?_0xc182a['TGKSy'](resolveAuthEnvironmentLocally,_0x385bb4,_0x672803[_0x4afa7c(0x1b1)]):null,_0xc56582=typeof _0x2b5569?.['loginInstructions']==='string'&&_0x2b5569['loginInstructions']['trim']()?_0x2b5569[_0x4afa7c(0x166)]:undefined,_0x57abea=_0xc182a[_0x4afa7c(0x1a5)](typeof _0x3a4d07[_0x4afa7c(0x166)],_0xc182a[_0x4afa7c(0x1d8)])&&_0x3a4d07['loginInstructions'][_0x4afa7c(0x190)]()?_0x3a4d07['loginInstructions']:undefined,_0x462dc5=_0x57abea||!_0xc56582?_0x3a4d07:{..._0x3a4d07,'loginInstructions':_0xc56582},_0x282aa3=_0xc182a['PUAyj'](Boolean,_0x462dc5['loginInstructions']?.['trim']()),_0x13bbc8=_0xc182a['PUAyj'](Boolean,_0x3a4d07[_0x4afa7c(0x1df)]||_0x2b5569?.[_0x4afa7c(0x1df)]),_0x2cea7e=_0x2b5569?.['domains'],_0x53073e=_0x3a4d07['setupHeaders'],_0x1a0971=_0x53073e??_0x2b5569?.[_0x4afa7c(0x1dc)],_0xc3b665=_0x38409d[_0x4afa7c(0x16d)]??_0x3a4d07['baseUrl']??(_0x2cea7e&&_0x2cea7e[_0x4afa7c(0x1c6)]>0x0?_0x2cea7e[0x0]:''),_0x49183f=_0xc3b665?_0xc182a['PUAyj'](needsTunnel,_0xc3b665):![],_0x29faaf={'invalidateOn':_0x2b5569?.['invalidateOn'],'userAgent':_0x2b5569?.[_0x4afa7c(0x1cf)]?.[_0x4afa7c(0x1d5)]??_0x3a4d07['userAgent']};_0x13bbc8&&console[_0x4afa7c(0x198)](_0x4afa7c(0x175)+_0x672803['name']+_0x4afa7c(0x1f5));if(!_0x13bbc8){const _0x428aac=await _0xc182a['MDRja'](checkLocalCache,_0x672803[_0x4afa7c(0x160)],_0x672803[_0x4afa7c(0x165)],_0xc3b665,_0x1a0971,_0x29faaf);if(_0x428aac){if(_0xc182a[_0x4afa7c(0x1f3)](_0xc3b665,!_0x49183f)){const _0xf3f3bc=await isCachedSessionLive(_0x428aac[_0x4afa7c(0x1c9)],_0xc3b665,{'sessionCheckPath':_0x2b5569?.['sessionCheckPath'],'setupHeaders':_0x1a0971},{'launchBrowser':launchRealBrowser});if(_0xf3f3bc)return console['log']('\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22'+_0x672803[_0x4afa7c(0x160)]+'\x22'),{'authPath':_0x428aac['storageStatePath'],'settings':_0x462dc5,'resolvedEnv':_0x2b5569};console['log']('\x20\x20Cached\x20session\x20for\x20\x22'+_0x672803[_0x4afa7c(0x160)]+_0x4afa7c(0x199)),_0xc182a['uKDzV'](emitSessionValidationHint,_0xc3b665,_0x2b5569);}else return _0x49183f&&console[_0x4afa7c(0x198)](_0x4afa7c(0x1c5)+_0x672803['name']+'\x22'),{'authPath':_0x428aac['storageStatePath'],'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}}if(!_0x13bbc8&&_0x672803['sessionState']){if(_0x49183f)console[_0x4afa7c(0x198)](_0x4afa7c(0x1fb)+_0xc3b665+_0x4afa7c(0x1f2)+_0x672803['name']+'\x22');else{const _0x13181a=await writeSessionToLocalCache(_0x672803[_0x4afa7c(0x160)],_0x672803[_0x4afa7c(0x165)],_0xc3b665,_0x1a0971,_0x672803[_0x4afa7c(0x1a1)],_0x2cea7e,_0x29faaf);if(_0xc3b665){const _0x41e47a=await _0xc182a['gcFnY'](isCachedSessionLive,_0x13181a,_0xc3b665,{'sessionCheckPath':_0x2b5569?.[_0x4afa7c(0x1de)],'setupHeaders':_0x1a0971},{'launchBrowser':launchRealBrowser});if(_0x41e47a)return console[_0x4afa7c(0x198)](_0x4afa7c(0x1c8)+_0x672803['name']+'\x22,\x20cached\x20locally'),{'authPath':_0x13181a,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};console['log'](_0x4afa7c(0x1a3)+_0x672803[_0x4afa7c(0x160)]+_0x4afa7c(0x1d6)),_0xc182a['vusBl'](emitSessionValidationHint,_0xc3b665,_0x2b5569);}else return{'authPath':_0x13181a,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}}if(_0x282aa3)return console['log'](_0x4afa7c(0x18b)+_0x672803[_0x4afa7c(0x160)]+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};console[_0x4afa7c(0x198)](_0x4afa7c(0x18b)+_0x672803['name']+'\x22,\x20attempting\x20login...');const _0x1d48a9=Boolean(process['env']['RANGER_TEST_USERNAME'])&&_0xc182a['zKkpy'](Boolean,process[_0x4afa7c(0x1bf)]['RANGER_TEST_PASSWORD']),_0x41038a=Boolean(_0x672803[_0x4afa7c(0x1bb)]);if(_0xc182a['wXKFP'](_0x1d48a9,_0x41038a))try{const _0x2f806c=_0xc3b665?await _0xc182a['SbQgm'](serverSideLoginWithOptionalTunnel,_0x672803['name'],_0xc3b665,{'force':_0x13bbc8,'telemetry':_0x38409d['telemetry']}):await serverSideLogin(_0x672803[_0x4afa7c(0x160)],{'force':_0x13bbc8});if(_0x2f806c[_0x4afa7c(0x1b4)]===_0xc182a['WBpHT'])console[_0x4afa7c(0x198)](_0xc182a[_0x4afa7c(0x1c4)]);else{if(_0x2f806c[_0x4afa7c(0x1b4)]===_0x4afa7c(0x15c)&&_0x2f806c[_0x4afa7c(0x1ca)]){console[_0x4afa7c(0x198)](_0x4afa7c(0x1cc));const _0x489096=await writeSessionToLocalCache(_0x672803['name'],_0x672803['organizationId'],_0xc3b665,_0x1a0971,_0x2f806c['session_state'],_0x2cea7e,_0x29faaf);return _0x1d48a9&&!_0x41038a&&await promptSaveCredentials(_0x672803[_0x4afa7c(0x160)]),{'authPath':_0x489096,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}else _0x2f806c[_0x4afa7c(0x19b)]&&(console[_0x4afa7c(0x198)](_0x4afa7c(0x15e)),console[_0x4afa7c(0x198)](_0x2f806c[_0x4afa7c(0x19b)])),console[_0x4afa7c(0x198)](_0xc182a[_0x4afa7c(0x185)]);}}catch(_0x5a186e){console[_0x4afa7c(0x198)]('\x20\x20Server-side\x20login\x20error:\x20'+(_0xc182a['ATBGN'](_0x5a186e,Error)?_0x5a186e['message']:_0xc182a['PvroN'](String,_0x5a186e))),console['log'](_0x4afa7c(0x159));}const _0x448177=_0x2b5569?{..._0x2b5569,'setupHeaders':_0x1a0971}:_0xc3b665?{'key':_0x672803['environmentKey']??'','domains':[_0xc3b665],'setupHeaders':_0x1a0971}:null,{sessionState:_0x21b24c}=await manualBrowserLogin(_0x672803,_0x448177,{'persistSessionState':!_0x49183f}),_0x2d730d=await _0xc182a[_0x4afa7c(0x17e)](writeSessionToLocalCache,_0x672803[_0x4afa7c(0x160)],_0x672803['organizationId'],_0xc3b665,_0x1a0971,_0x21b24c,_0x2cea7e,_0x29faaf);return{'authPath':_0x2d730d,'settings':_0x462dc5,'resolvedEnv':_0x2b5569};}
|
|
1
|
+
const _0x4cc66b=_0x33f5;(function(_0x3cae3c,_0x484026){const _0x16e8f1=_0x33f5,_0x559c09=_0x3cae3c();while(!![]){try{const _0xfb9191=parseInt(_0x16e8f1(0x1e2))/0x1*(-parseInt(_0x16e8f1(0x1d2))/0x2)+-parseInt(_0x16e8f1(0x21e))/0x3+parseInt(_0x16e8f1(0x270))/0x4+-parseInt(_0x16e8f1(0x245))/0x5+-parseInt(_0x16e8f1(0x283))/0x6*(parseInt(_0x16e8f1(0x1d3))/0x7)+-parseInt(_0x16e8f1(0x1d9))/0x8*(parseInt(_0x16e8f1(0x26a))/0x9)+parseInt(_0x16e8f1(0x24c))/0xa;if(_0xfb9191===_0x484026)break;else _0x559c09['push'](_0x559c09['shift']());}catch(_0x300b72){_0x559c09['push'](_0x559c09['shift']());}}}(_0x20e1,0xcaea0));import{readFile,writeFile,mkdir}from'fs/promises';import{join}from'path';import{existsSync}from'fs';import _0x1e4fbc from'inquirer';import{chromium}from'playwright';import{getApiBaseUrl}from'./environment.js';import{getToken}from'./keychain.js';import{getRangerHomeDir}from'./rangerRoot.js';import{addProfileSetupBanner}from'./profileSetupBanner.js';import{duplicateCookiesForDomains,getSessionCachePath,getStorageStatePath,isCachedSessionLive,isInteractive,needsTunnel,resolveAuthEnvironmentLocally,sessionCacheHash}from'./cloudProfileSession.js';import{matchAuthEnvironmentByHost,matchAuthEnvironmentExact}from'./matchAuthEnvironment.js';import{createTunnelBridge,launchBrowserServer}from'./tunnelClient.js';function targetHostForTelemetry(_0xea255){const _0x2dab9a=_0x33f5,_0x298cf0={'KdmfL':_0x2dab9a(0x218)};try{return new URL(_0xea255)['host'];}catch{return _0x298cf0['KdmfL'];}}function errorMessageForTelemetry(_0x591474){const _0x2454e9=_0x33f5;return _0x591474 instanceof Error?_0x591474[_0x2454e9(0x24e)]:undefined;}function trackBridgeEvent(_0x434bbb,_0x348adf){const _0x2e28db=_0x33f5,_0xecbcf6={'sKPgh':_0x2e28db(0x1ff),'QtJNR':'local_ws_error'};if(!_0x434bbb)return;const _0x39cf9d={'tunnelSessionId':_0x348adf[_0x2e28db(0x1e5)],'tunnelEventType':_0x348adf[_0x2e28db(0x25e)],'connectionId':_0x348adf['connectionId'],'code':_0x348adf['code'],'reason':_0x348adf[_0x2e28db(0x25f)],'error':_0x348adf['error'],'elapsedMs':_0x348adf['elapsedMs'],'activeLocalConnections':_0x348adf[_0x2e28db(0x1fb)],'pendingLocalConnections':_0x348adf['pendingLocalConnections']};_0x434bbb['trackPhaseEnd']('tunnel_bridge_event',_0x39cf9d),(_0x348adf[_0x2e28db(0x25e)]===_0xecbcf6[_0x2e28db(0x23a)]||_0x348adf['type']===_0xecbcf6[_0x2e28db(0x258)])&&void _0x434bbb['trackPhaseError']('tunnel_bridge',new Error(_0x348adf['error']??_0x348adf['type']),_0x39cf9d);}const MANUAL_LOGIN_TIMEOUT_MS=0xa*0x3c*0x3e8;async function requireToken(){const _0x50021a={'HJZPN':function(_0x162688){return _0x162688();},'mUXUT':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0xfa01bb=await _0x50021a['HJZPN'](getToken);if(!_0xfa01bb)throw new Error(_0x50021a['mUXUT']);return _0xfa01bb;}async function apiRequest(_0x55c645,_0x24f839={}){const _0x5caf54=_0x33f5,_0x372b63={'xwMCa':function(_0x2cb77e){return _0x2cb77e();},'EgohG':'application/json','vYRLh':function(_0x198572,_0x27eb63){return _0x198572===_0x27eb63;},'EEpTB':_0x5caf54(0x271)},_0x2a280d=await _0x372b63['xwMCa'](requireToken),_0x18e5fe=getApiBaseUrl(),_0x1d3322=await fetch(''+_0x18e5fe+_0x55c645,{..._0x24f839,'headers':{'Authorization':_0x5caf54(0x269)+_0x2a280d,'Content-Type':_0x372b63[_0x5caf54(0x1dc)],..._0x24f839[_0x5caf54(0x27d)]??{}}});if(!_0x1d3322['ok']){let _0x2d9f32='',_0x208370;try{const _0x41571c=await _0x1d3322['json'](),_0x27af78=(typeof _0x41571c[_0x5caf54(0x1fe)]==='string'?_0x41571c[_0x5caf54(0x1fe)]:undefined)??JSON[_0x5caf54(0x1fa)](_0x41571c);_0x2d9f32=_0x27af78;_0x372b63['vYRLh'](typeof _0x41571c['test_output'],_0x5caf54(0x271))&&_0x41571c[_0x5caf54(0x1f6)]&&(_0x2d9f32=_0x2d9f32+'\x0a'+_0x41571c[_0x5caf54(0x1f6)]);if(typeof _0x41571c[_0x5caf54(0x25a)]===_0x372b63['EEpTB'])_0x208370=_0x41571c['code'];}catch{_0x2d9f32=_0x1d3322[_0x5caf54(0x225)];}throw new ApiError('API\x20request\x20'+_0x55c645+_0x5caf54(0x223)+_0x1d3322['status']+_0x5caf54(0x21f)+_0x2d9f32,_0x1d3322['status'],_0x2d9f32,_0x208370);}if(_0x1d3322['status']===0xcc)return undefined;return _0x1d3322[_0x5caf54(0x22b)]();}export class ApiError extends Error{['status'];[_0x4cc66b(0x259)];['code'];constructor(_0x29df18,_0x2b5af4,_0x44edcf,_0xb7cff0){const _0x536c0a=_0x4cc66b,_0x260e18={'PEUAb':'ApiError'};super(_0x29df18),this['status']=_0x2b5af4,this['detail']=_0x44edcf,this[_0x536c0a(0x25a)]=_0xb7cff0,this[_0x536c0a(0x1e4)]=_0x260e18[_0x536c0a(0x1f4)];}}export async function fetchCloudProfile(_0x92c461){const _0x4db117=_0x4cc66b,_0x15aacc={'XFbTr':function(_0x58783b,_0x48abdb){return _0x58783b(_0x48abdb);}};try{return await _0x15aacc['XFbTr'](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x92c461));}catch(_0xf62e17){if(_0xf62e17 instanceof ApiError&&_0xf62e17[_0x4db117(0x1d5)]===0x194)return null;throw _0xf62e17;}}export async function listCloudProfiles(){const _0x3234a6=_0x4cc66b,_0x58cb28={'AyAFt':_0x3234a6(0x244)},_0x4010ce=await apiRequest(_0x58cb28[_0x3234a6(0x235)]);return _0x4010ce[_0x3234a6(0x26f)];}export async function deleteCloudProfile(_0x28c659){const _0x1f5c37=_0x4cc66b,_0x5e92af={'CwVDU':function(_0xb00e2b,_0x852278,_0x18823f){return _0xb00e2b(_0x852278,_0x18823f);},'dEnRs':function(_0x4b1ff9,_0x2fb6c8){return _0x4b1ff9 instanceof _0x2fb6c8;},'TDPHr':function(_0x474c73,_0x387b93){return _0x474c73===_0x387b93;}};try{await _0x5e92af[_0x1f5c37(0x23e)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x28c659),{'method':_0x1f5c37(0x247)});}catch(_0x432ff6){if(_0x5e92af['dEnRs'](_0x432ff6,ApiError)&&_0x5e92af[_0x1f5c37(0x272)](_0x432ff6[_0x1f5c37(0x1d5)],0x194))throw new Error(_0x1f5c37(0x261)+_0x28c659+_0x1f5c37(0x219));throw _0x432ff6;}}export async function createCloudProfile(_0x57004c,_0xe798be,_0x2d81ad={}){const _0x3eb182=_0x4cc66b,_0x438afb={'YkUVT':function(_0x193962,_0x34e85e){return _0x193962>_0x34e85e;},'NbGuJ':function(_0x3c21b3,_0x265f3,_0x5b252b){return _0x3c21b3(_0x265f3,_0x5b252b);},'GlWHT':'/api/v1/profiles','GHXCf':'POST'},_0x3f3813={'name':_0x57004c};if(_0xe798be)_0x3f3813[_0x3eb182(0x24b)]=_0xe798be;_0x2d81ad[_0x3eb182(0x23b)]&&_0x438afb['YkUVT'](Object['keys'](_0x2d81ad[_0x3eb182(0x23b)])['length'],0x0)&&(_0x3f3813[_0x3eb182(0x23b)]=_0x2d81ad['settings']);if(_0x2d81ad[_0x3eb182(0x1de)])_0x3f3813['username']=_0x2d81ad['username'];if(_0x2d81ad[_0x3eb182(0x257)])_0x3f3813[_0x3eb182(0x257)]=_0x2d81ad['password'];return await _0x438afb['NbGuJ'](apiRequest,_0x438afb['GlWHT'],{'method':_0x438afb[_0x3eb182(0x27e)],'body':JSON['stringify'](_0x3f3813)});}export async function uploadCloudProfileSession(_0x2f9ac4,_0xde6563){const _0x354ca2=_0x4cc66b,_0x5eac73={'sIRSa':function(_0x9968c5,_0x26ac09,_0x2497bd){return _0x9968c5(_0x26ac09,_0x2497bd);},'QQukE':function(_0x58a924,_0x2a5c66){return _0x58a924(_0x2a5c66);},'GadJR':_0x354ca2(0x1fd)};return await _0x5eac73['sIRSa'](apiRequest,'/api/v1/profiles/'+_0x5eac73['QQukE'](encodeURIComponent,_0x2f9ac4)+'/session',{'method':_0x5eac73['GadJR'],'body':JSON[_0x354ca2(0x1fa)]({'session_state':_0xde6563})});}export async function saveCloudProfileCredentials(_0x90e6c2,_0x6329fc,_0x582074){const _0x4e6b76=_0x4cc66b,_0x3988cc={'scpYx':function(_0x46cb25,_0x384d28,_0xd50340){return _0x46cb25(_0x384d28,_0xd50340);},'oSwzb':'PUT'};await _0x3988cc[_0x4e6b76(0x27b)](apiRequest,'/api/v1/profiles/'+encodeURIComponent(_0x90e6c2),{'method':_0x3988cc[_0x4e6b76(0x265)],'body':JSON[_0x4e6b76(0x1fa)]({'username':_0x6329fc,'password':_0x582074})});}export async function fetchAuthConfig(){const _0x174272=_0x4cc66b,_0x58bb19={'DgmYP':'/api/v1/profiles/auth-config','xUHHm':function(_0x1d741a,_0x1d393e){return _0x1d741a instanceof _0x1d393e;}};try{const _0xe03067=await apiRequest(_0x58bb19['DgmYP']);return _0xe03067['auth_config'];}catch(_0x269dab){return _0x58bb19[_0x174272(0x26d)](_0x269dab,ApiError)&&_0x269dab[_0x174272(0x1d5)]!==0x194&&console[_0x174272(0x1fe)]('\x0aWarning:\x20could\x20not\x20fetch\x20org\x20auth\x20config:\x20'+_0x269dab['message']),null;}}async function createTunnelSession(_0x5b2bbb){const _0x2044b0=_0x4cc66b,_0x4d47da={'xTsjT':function(_0x58aae5,_0x131320,_0x32fa49){return _0x58aae5(_0x131320,_0x32fa49);},'wBpwk':'POST'};return await _0x4d47da['xTsjT'](apiRequest,'/api/v1/tunnel/sessions',{'method':_0x4d47da['wBpwk'],'body':JSON['stringify']({'targetUrl':_0x5b2bbb,'mode':_0x2044b0(0x210)})});}async function deleteTunnelSession(_0x428fbf){const _0x1b2b01=_0x4cc66b,_0x5b75e8={'vKqDj':function(_0x487bc8,_0x5c0c60,_0x5750cf){return _0x487bc8(_0x5c0c60,_0x5750cf);},'MdiOf':_0x1b2b01(0x247)};await _0x5b75e8[_0x1b2b01(0x275)](apiRequest,'/api/v1/tunnel/sessions/'+_0x428fbf,{'method':_0x5b75e8[_0x1b2b01(0x255)]});}export function pickAdHocEnvKey(_0x29a3dc,_0x34d830,_0x131ed5){const _0x443678=_0x4cc66b,_0x5733db={'zkOcr':function(_0x18d5db,_0x2a055b){return _0x18d5db+_0x2a055b;},'UOQsO':function(_0x2f7e35,_0x4bdc05,_0xae39de){return _0x2f7e35(_0x4bdc05,_0xae39de);},'YXxHm':function(_0x199f6b,_0x5de071){return _0x199f6b in _0x5de071;},'VMnWR':'key','spvcP':function(_0x3c1b19,_0x5b4af3){return _0x3c1b19 in _0x5b4af3;},'yBPwD':function(_0x14a684,_0x32de7a){return _0x14a684+_0x32de7a;},'AWXqc':function(_0x18d5e1,_0x3605d3){return _0x18d5e1+_0x3605d3;},'UWLly':function(_0x4198a4,_0x60bc03){return _0x4198a4===_0x60bc03;},'cGzPg':function(_0x208ffd,_0x67f4){return _0x208ffd+_0x67f4;}};if(_0x131ed5){if(!_0x29a3dc?.['environments']?.[_0x131ed5]){const _0x4f097c=Object['keys'](_0x29a3dc?.['environments']??{});throw new Error(_0x5733db['zkOcr'](_0x5733db['zkOcr']('Auth\x20environment\x20\x22'+_0x131ed5+'\x22\x20not\x20found\x20in\x20your\x20org\x27s\x20config.',_0x4f097c[_0x443678(0x22a)]?'\x20Available:\x20'+_0x4f097c[_0x443678(0x206)](',\x20')+'.':_0x443678(0x1fc)),'\x20(If\x20you\x20meant\x20a\x20profile,\x20use\x20--profile.)'));}return _0x131ed5;}if(!_0x29a3dc)return null;if(_0x34d830){const _0x156cb3=matchAuthEnvironmentExact(_0x34d830,_0x29a3dc);if(_0x156cb3)return _0x156cb3;const _0x1934bb=_0x5733db[_0x443678(0x20c)](matchAuthEnvironmentByHost,_0x34d830,_0x29a3dc);if(_0x1934bb&&_0x5733db['YXxHm'](_0x5733db[_0x443678(0x24f)],_0x1934bb))return console['log']('\x20\x20Auth\x20env\x20\x22'+_0x1934bb[_0x443678(0x221)]+_0x443678(0x273)+_0x34d830+_0x443678(0x260)),_0x1934bb[_0x443678(0x221)];if(_0x1934bb&&_0x5733db[_0x443678(0x21c)]('ambiguous',_0x1934bb))throw new Error('Multiple\x20auth\x20environments\x20declare\x20this\x20host\x20('+_0x1934bb['ambiguous'][_0x443678(0x206)](',\x20')+_0x443678(0x1f9));if(needsTunnel(_0x34d830))throw new Error(_0x5733db[_0x443678(0x249)](_0x5733db['zkOcr'](_0x5733db['AWXqc'](_0x443678(0x220)+_0x34d830+'\x22.\x0a','\x20\x20Ranger\x20can\x27t\x20assume\x20your\x20org\x27s\x20default\x20login\x20flow\x20applies\x20to\x20an\x20arbitrary\x20local\x20app.\x0a'),'\x20\x20Options:\x0a')+_0x443678(0x1ea)+('\x20\x20-\x20ask\x20your\x20Ranger\x20admin\x20to\x20add\x20\x22'+_0x34d830[_0x443678(0x23c)](/\/+$/,'')+'\x22\x20to\x20the\x20matching\x20auth\x20environment\x27s\x20domains,\x20or\x0a'),_0x443678(0x27a)+_0x34d830+_0x443678(0x227)));}if(_0x29a3dc[_0x443678(0x266)])return _0x29a3dc['defaultEnvironmentKey'];const _0x2ed76f=Object[_0x443678(0x236)](_0x29a3dc[_0x443678(0x215)]??{});if(_0x5733db['UWLly'](_0x2ed76f[_0x443678(0x22a)],0x1))return _0x2ed76f[0x0];if(_0x2ed76f[_0x443678(0x22a)]===0x0)return null;throw new Error(_0x5733db[_0x443678(0x278)](_0x443678(0x207)+_0x2ed76f[_0x443678(0x206)](',\x20')+_0x443678(0x1d6),'Pass\x20--base-url\x20<your-app-url>\x20so\x20Ranger\x20can\x20match\x20the\x20right\x20one,\x20or\x20create\x20the\x20profile\x20explicitly\x20with\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20<your-app-url>`.'));}function _0x20e1(){const _0x1b7cfb=['\x20\x20Server-side\x20login\x20error:\x20','env','agent','force','envKey','clientIp','\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...','environments','/api/v1/profiles/','RANGER_TEST_USERNAME','invalid-url','\x22\x20not\x20found.','\x20\x20Debug:\x20launching\x20tunneled\x20login\x20browser\x20headed...','NvbuS','spvcP','push','390501EUecdZ','):\x20','No\x20auth\x20environment\x20matches\x20the\x20local\x20target\x20\x22','key','telemetry','\x20failed\x20(','organizationId','statusText','\x22;\x20using\x20\x22','\x20--skip-auth`\x20for\x20an\x20unauthenticated\x20profile.','CmATx','\x22,\x20refreshing\x20session...','length','json','/login','jMpsR','close','If\x20logins\x20keep\x20failing\x20here,\x20ask\x20your\x20Ranger\x20admin\x20to\x20tighten\x20session\x20reuse\x20for\x20this\x20environment.','QmdFX','true','setupHeaders','bAcie','storageStatePath','AyAFt','keys','\x20\x20Using\x20cached\x20session\x20for\x20cloud\x20profile\x20\x22','DbJwo','tunnel','sKPgh','settings','replace','newContext','CwVDU','\x0a\x20\x20A\x20browser\x20will\x20open.\x20Please\x20log\x20in\x20manually.','TlzyB','invalidateOn','uTAbO','then','/api/v1/profiles','7505760YYvAqa','BWVqM','DELETE','\x0a\x20\x20Server-side\x20login\x20failed.\x20Test\x20output:','yBPwD','tunnel_login_cleanup','environment_key','59131540WHSIkx','poIHu','message','VMnWR','Xtjsz','target_url','PfIgt','\x20\x20Cloud\x20profile\x20\x22','pwEndpoint','MdiOf','not_configured','password','QtJNR','detail','code','\x20\x20Set\x20RANGER_TEST_USERNAME/RANGER_TEST_PASSWORD\x20so\x20Ranger\x20can\x20log\x20in\x20for\x20you,\x20','VefhX','\x20\x20Login\x20successful.\x20Session\x20cached.','type','reason','\x20(declared\x20port\x20differs;\x20pass\x20--env\x20to\x20override).','Cloud\x20profile\x20\x22','fdnVT','effectiveBaseUrl','cookies','oSwzb','defaultEnvironmentKey','ebvNz','sessionCheckPath','Bearer\x20','1104489OdqeiD','PBCmP','newPage','xUHHm','domains','profiles','116852emFIif','string','TDPHr','\x22\x20matched\x20by\x20host\x20for\x20','XGrSM','vKqDj','PUT','Browser\x20login\x20timed\x20out\x20before\x20completion.','cGzPg','catch','\x20\x20-\x20run\x20`ranger\x20profile\x20add\x20<name>\x20--url\x20','scpYx','toLowerCase','headers','GHXCf','pw_endpoint','JWZwt','targetUrl','session_state','138ZDVYPw','\x22\x20but\x20this\x20run\x20resolved\x20env\x20\x22','VwYIF','\x22,\x20attempting\x20login...','FkhuN','xpOKr','utf-8','60fyPXdO','226807yxhuDa','\x20\x20No\x20live\x20session\x20for\x20\x22','status',').\x20','\x22\x20instead.','loginInstructions','72CJZkQD','trackPhaseEnd','origin','EgohG','\x22\x20on\x20profile\x20\x22','username','KIxtX','userAgent','\x22\x20is\x20bound\x20to\x20auth\x20env\x20\x22','54340wDdDsE','isArray','name','sessionId','\x20\x20forceLogin\x20enabled\x20for\x20\x22','tunnel_login_request','persistSessionState','baseUrl','\x20\x20-\x20pass\x20`--env\x20<key>`\x20to\x20pick\x20the\x20auth\x20environment\x20by\x20name,\x20or\x0a','wsEndpoint','launch','XSiDx','environmentKey','RANGER_TEST_PASSWORD','\x22\x20failed\x20validation\x20—\x20re-login\x20needed...','sessionState','you\x27re\x20now\x20at\x20\x22','/session','PEUAb','HNrNP','test_output','DwUlY','trackPhaseStart',');\x20pass\x20--env\x20<key>\x20to\x20pick\x20one.','stringify','activeLocalConnections','\x20Your\x20org\x20has\x20no\x20auth\x20environments\x20configured.','POST','error','tunnel_error','deBIf','trackPhaseError','kiqcm','tunnel_login_setup','yiiQo','\x22\x20failed\x20validation\x20—\x20refreshing...','join','Your\x20org\x20has\x20more\x20than\x20one\x20environment\x20configured\x20(','vXdmo','hpruR','log','IvBPv','UOQsO','wzklJ'];_0x20e1=function(){return _0x1b7cfb;};return _0x20e1();}export function adHocProfileName(_0x564b51,_0x211118,_0x3e5efd){if(!_0x211118||_0x211118===_0x3e5efd)return _0x564b51;return _0x564b51+':'+_0x211118;}export async function resolveAdHocProfile(_0x2278de={},_0x6dde34=process[_0x4cc66b(0x20f)]){const _0x4141e7=_0x4cc66b,_0x47f9ee={'plaDx':function(_0x193a1b,_0xc73c5a){return _0x193a1b&&_0xc73c5a;},'bAcie':function(_0x1c0a94,_0x3f3d5b){return _0x1c0a94!==_0x3f3d5b;},'iYeJr':'none','PBCmP':function(_0x3c9678,_0x488b8c){return _0x3c9678(_0x488b8c);},'JUXOe':function(_0x12335a,_0x439547,_0x5ab9d4,_0x59a1ca){return _0x12335a(_0x439547,_0x5ab9d4,_0x59a1ca);}},_0x3f7662=_0x6dde34[_0x4141e7(0x217)];if(!_0x3f7662)return null;const _0x53439f=await fetchAuthConfig(),_0x5da21f=pickAdHocEnvKey(_0x53439f,_0x2278de['targetUrl'],_0x2278de[_0x4141e7(0x212)]);let _0x11b699=adHocProfileName(_0x3f7662,_0x5da21f,_0x53439f?.['defaultEnvironmentKey']),_0x26e200=await fetchCloudProfile(_0x11b699);_0x47f9ee['plaDx'](_0x26e200,_0x5da21f)&&_0x47f9ee[_0x4141e7(0x233)](_0x26e200['environmentKey'],_0x5da21f)&&(console[_0x4141e7(0x20a)](_0x4141e7(0x253)+_0x11b699+_0x4141e7(0x1e1)+(_0x26e200['environmentKey']??_0x47f9ee['iYeJr'])+_0x4141e7(0x284)+_0x5da21f+_0x4141e7(0x226)+_0x3f7662+':'+_0x5da21f+_0x4141e7(0x1d7)),_0x11b699=_0x3f7662+':'+_0x5da21f,_0x26e200=await _0x47f9ee[_0x4141e7(0x26b)](fetchCloudProfile,_0x11b699));if(_0x26e200)return{'name':_0x26e200['name'],'profile':_0x26e200};const _0x103413=_0x6dde34['RANGER_TEST_PASSWORD'],_0x16a8b6=await _0x47f9ee['JUXOe'](createCloudProfile,_0x11b699,_0x5da21f??undefined,{'username':_0x3f7662,'password':_0x103413});return console[_0x4141e7(0x20a)]('\x20\x20Created\x20cloud\x20profile\x20\x22'+_0x16a8b6[_0x4141e7(0x1e4)]+'\x22\x20for\x20'+_0x3f7662+(_0x5da21f?'\x20(auth\x20env:\x20'+_0x5da21f+')':'')),{'name':_0x16a8b6['name'],'profile':_0x16a8b6};}export async function writeSessionToLocalCache(_0x2b4599,_0xda44c6,_0x580c46,_0x2f2a3a,_0x4fc22b,_0x5316bc,_0x30cd1b){const _0x487d87=_0x4cc66b,_0x14b094={'QmdFX':function(_0x34d4ac,_0x1396ff){return _0x34d4ac(_0x1396ff);},'DbJwo':function(_0x283701,_0xaaae58,_0x3f3c5d){return _0x283701(_0xaaae58,_0x3f3c5d);},'mxTlI':function(_0x381810){return _0x381810();},'CyTPS':'auth','poIHu':function(_0x487256,_0x344458){return _0x487256>_0x344458;},'SUJJw':function(_0x175226,_0x2fe2dc,_0x4d9e58){return _0x175226(_0x2fe2dc,_0x4d9e58);}},_0x3db42c=_0x14b094[_0x487d87(0x230)](sessionCacheHash,{'orgId':_0xda44c6,'profileName':_0x2b4599,'effectiveBaseUrl':_0x580c46,'setupHeaders':_0x2f2a3a,'invalidateOn':_0x30cd1b?.[_0x487d87(0x241)],'userAgent':_0x30cd1b?.['userAgent'],'clientIp':_0x30cd1b?.[_0x487d87(0x213)]}),_0x16ae64=_0x14b094[_0x487d87(0x238)](getSessionCachePath,_0x3db42c,_0x2b4599),_0x1064bc=_0x14b094[_0x487d87(0x238)](join,_0x14b094['mxTlI'](getRangerHomeDir),_0x14b094['CyTPS']);!_0x14b094['QmdFX'](existsSync,_0x1064bc)&&await mkdir(_0x1064bc,{'recursive':!![]});const _0x47de09={..._0x4fc22b};_0x5316bc&&_0x14b094[_0x487d87(0x24d)](_0x5316bc['length'],0x0)&&Array[_0x487d87(0x1e3)](_0x47de09[_0x487d87(0x264)])&&(_0x47de09[_0x487d87(0x264)]=_0x14b094['DbJwo'](duplicateCookiesForDomains,_0x47de09['cookies'],_0x5316bc));const _0x33707f={'cached_at':new Date()['toISOString'](),'session_state':_0x47de09};await _0x14b094['SUJJw'](writeFile,_0x16ae64,JSON['stringify'](_0x33707f,null,0x2));const _0x43d931=_0x14b094['QmdFX'](getStorageStatePath,_0x16ae64);return await writeFile(_0x43d931,JSON[_0x487d87(0x1fa)](_0x47de09,null,0x2)),_0x43d931;}export async function checkLocalCache(_0x6b85c8,_0x2d4d9c,_0x2d6845,_0x172cf5,_0x48175f){const _0x471e17=_0x4cc66b,_0x107c0e={'NvbuS':function(_0x3b63b5,_0x528b9e){return _0x3b63b5(_0x528b9e);},'KIxtX':function(_0x1e7c4d,_0x2c26ac,_0x278e71){return _0x1e7c4d(_0x2c26ac,_0x278e71);},'EcLUL':function(_0x125a10,_0x1ceb61){return _0x125a10(_0x1ceb61);},'OWYET':function(_0x8f2080,_0x31a68f){return _0x8f2080(_0x31a68f);},'BWVqM':_0x471e17(0x1d1)},_0x107864=_0x107c0e[_0x471e17(0x21b)](sessionCacheHash,{'orgId':_0x2d4d9c,'profileName':_0x6b85c8,'effectiveBaseUrl':_0x2d6845,'setupHeaders':_0x172cf5,'invalidateOn':_0x48175f?.[_0x471e17(0x241)],'userAgent':_0x48175f?.[_0x471e17(0x1e0)],'clientIp':_0x48175f?.['clientIp']}),_0x45c9db=_0x107c0e[_0x471e17(0x1df)](getSessionCachePath,_0x107864,_0x6b85c8),_0x592387=_0x107c0e['EcLUL'](getStorageStatePath,_0x45c9db);if(!_0x107c0e['EcLUL'](existsSync,_0x45c9db)||!_0x107c0e['OWYET'](existsSync,_0x592387))return null;try{const _0x4fc9a5=await readFile(_0x45c9db,_0x107c0e[_0x471e17(0x246)]);return JSON['parse'](_0x4fc9a5),{'storageStatePath':_0x592387};}catch{return null;}}function launchRealBrowser(){const _0x15ed88=_0x4cc66b;return chromium[_0x15ed88(0x1ec)]({'headless':!![]});}function emitSessionValidationHint(_0x5f1bd9,_0x2d3c55){const _0x556b37=_0x4cc66b,_0x4be72a={'ufesP':function(_0x29cda3,_0x3cc9d1){return _0x29cda3+_0x3cc9d1;}};if(!_0x2d3c55||!_0x2d3c55[_0x556b37(0x26e)]?.['length'])return;let _0x433c0f;try{_0x433c0f=new URL(_0x5f1bd9);}catch{return;}const _0x5577fa=[];for(const _0x448919 of _0x2d3c55[_0x556b37(0x26e)]){try{_0x5577fa[_0x556b37(0x21d)]({'raw':_0x448919,'url':new URL(_0x448919)});}catch{}}if(_0x5577fa[_0x556b37(0x22a)]===0x0)return;if(_0x5577fa['some'](_0x2295e4=>_0x2295e4['url'][_0x556b37(0x1db)]===_0x433c0f[_0x556b37(0x1db)]))return;const _0x22b89d=_0x5577fa['map'](_0xa968c3=>'\x22'+_0xa968c3['raw']+'\x22')['join'](',\x20');console['log'](_0x4be72a['ufesP']('\x20\x20(hint)\x20Cached\x20session\x20was\x20captured\x20against\x20one\x20of\x20'+_0x22b89d+';\x20',_0x556b37(0x1f2)+_0x5f1bd9+'\x22,\x20which\x20doesn\x27t\x20match\x20any\x20of\x20them.\x20')+_0x556b37(0x22f));}export async function serverSideLogin(_0x14f0b8,_0x108ab0){const _0x136c2b=_0x4cc66b,_0x120262={'rwzCo':function(_0x1e4671,_0x2da473,_0x1c3c2a){return _0x1e4671(_0x2da473,_0x1c3c2a);},'hbFmS':function(_0x3034a8,_0x34d1f1){return _0x3034a8 instanceof _0x34d1f1;},'deBIf':function(_0x11ed86,_0x280d54){return _0x11ed86===_0x280d54;}},_0x4a1e58=process[_0x136c2b(0x20f)][_0x136c2b(0x217)],_0x328d38=process[_0x136c2b(0x20f)][_0x136c2b(0x1ef)],_0x5a1de1={};if(_0x4a1e58)_0x5a1de1[_0x136c2b(0x1de)]=_0x4a1e58;if(_0x328d38)_0x5a1de1['password']=_0x328d38;if(_0x108ab0?.['force'])_0x5a1de1['force']=!![];if(_0x108ab0?.[_0x136c2b(0x281)])_0x5a1de1[_0x136c2b(0x251)]=_0x108ab0[_0x136c2b(0x281)];_0x108ab0?.['tunnel']&&(_0x5a1de1['tunnel_session_id']=_0x108ab0['tunnel']['sessionId'],_0x5a1de1[_0x136c2b(0x27f)]=_0x108ab0[_0x136c2b(0x239)][_0x136c2b(0x254)]);try{return await _0x120262['rwzCo'](apiRequest,_0x136c2b(0x216)+encodeURIComponent(_0x14f0b8)+_0x136c2b(0x22c),{'method':_0x136c2b(0x1fd),'body':JSON['stringify'](_0x5a1de1)});}catch(_0x4ef48a){if(_0x120262['hbFmS'](_0x4ef48a,ApiError)&&_0x120262['deBIf'](_0x4ef48a[_0x136c2b(0x1d5)],0x190)&&_0x120262[_0x136c2b(0x200)](_0x4ef48a[_0x136c2b(0x25a)],_0x136c2b(0x256)))return{'status':_0x136c2b(0x256),'error':_0x4ef48a['detail']};throw _0x4ef48a;}}async function serverSideLoginWithOptionalTunnel(_0x36b3b6,_0x989f12,_0x57f573={}){const _0x4d888a=_0x4cc66b,_0x10176b={'hpruR':_0x4d888a(0x1e7),'VwYIF':function(_0x41995d,_0x5962ee){return _0x41995d(_0x5962ee);},'Xtjsz':function(_0xeacf38,_0x1f5337){return _0xeacf38(_0x1f5337);},'dWGDx':function(_0x11f135,_0x50b0f6,_0x313341){return _0x11f135(_0x50b0f6,_0x313341);},'yiiQo':'tunnel_login_setup','IvBPv':_0x4d888a(0x21a),'EMrBm':function(_0x4c7f0f,_0x14aa95){return _0x4c7f0f(_0x14aa95);},'kiqcm':function(_0x14a5b2){return _0x14a5b2();},'XGrSM':function(_0xdea0e2,_0x32ef6c,_0x781302){return _0xdea0e2(_0x32ef6c,_0x781302);},'hWlJa':function(_0x1e16da,_0x3a2453){return _0x1e16da??_0x3a2453;},'TJqYU':function(_0x3aad02,_0x507565){return _0x3aad02??_0x507565;},'DzmBc':_0x4d888a(0x24a)};if(!_0x10176b['Xtjsz'](needsTunnel,_0x989f12))return await _0x10176b['dWGDx'](serverSideLogin,_0x36b3b6,{'force':_0x57f573['force']});let _0x21ef48=null,_0x320737=null,_0x3727cf=null,_0x378344=null,_0x5075b5=![];const _0x54c353=process[_0x4d888a(0x20f)]['RANGER_TUNNEL_LOGIN_HEADED']?.[_0x4d888a(0x27c)](),_0x2c47b5=_0x54c353==='1'||_0x54c353===_0x4d888a(0x231),_0x27f5bf={'profileName':_0x36b3b6,'targetUrlHost':targetHostForTelemetry(_0x989f12),'tunnelRequired':!![],'forceLogin':_0x10176b[_0x4d888a(0x285)](Boolean,_0x57f573[_0x4d888a(0x211)]),'localBrowserServerHeaded':_0x2c47b5};try{_0x57f573[_0x4d888a(0x222)]?.[_0x4d888a(0x1f8)](_0x10176b[_0x4d888a(0x204)],_0x27f5bf);_0x2c47b5&&console[_0x4d888a(0x20a)](_0x10176b[_0x4d888a(0x20b)]);_0x21ef48=await _0x10176b['Xtjsz'](launchBrowserServer,{'headless':!_0x2c47b5}),_0x320737=await _0x10176b['EMrBm'](createTunnelSession,_0x989f12);const _0x33b9f3=await _0x10176b[_0x4d888a(0x202)](requireToken);_0x3727cf=await _0x10176b[_0x4d888a(0x250)](createTunnelBridge,{'localWsUrl':_0x21ef48[_0x4d888a(0x1eb)],'tunnelServerUrl':_0x320737['tunnelUrl'],'sessionId':_0x320737[_0x4d888a(0x1e5)],'apiKey':_0x33b9f3,'onError':_0x163e1e=>{_0x378344=_0x163e1e;},'onClose':()=>{_0x378344??=new Error('Tunnel\x20bridge\x20closed\x20before\x20login\x20completed\x20for\x20'+_0x36b3b6);},'onEvent':_0x4a3f99=>trackBridgeEvent(_0x57f573[_0x4d888a(0x222)],_0x4a3f99)}),_0x57f573['telemetry']?.[_0x4d888a(0x1da)](_0x10176b['yiiQo'],{..._0x27f5bf,'tunnelSessionId':_0x320737[_0x4d888a(0x1e5)],'localBrowserServer':!![],'localBrowserServerHeaded':_0x2c47b5}),_0x5075b5=!![];try{return _0x57f573['telemetry']?.[_0x4d888a(0x1f8)](_0x4d888a(0x1e7),{..._0x27f5bf,'tunnelSessionId':_0x320737[_0x4d888a(0x1e5)]}),await _0x10176b[_0x4d888a(0x274)](serverSideLogin,_0x36b3b6,{'force':_0x57f573[_0x4d888a(0x211)],'targetUrl':_0x989f12,'tunnel':{'sessionId':_0x320737[_0x4d888a(0x1e5)],'pwEndpoint':_0x320737['pwEndpoint']}})[_0x4d888a(0x243)](_0x4ac9eb=>{const _0x593b6d=_0x4d888a;return _0x57f573['telemetry']?.['trackPhaseEnd'](_0x10176b[_0x593b6d(0x209)],{..._0x27f5bf,'tunnelSessionId':_0x320737?.[_0x593b6d(0x1e5)],'loginStatus':_0x4ac9eb[_0x593b6d(0x1d5)],'hasSessionState':Boolean(_0x4ac9eb[_0x593b6d(0x282)]),'hasTestOutput':Boolean(_0x4ac9eb[_0x593b6d(0x1f6)]),'bridgeError':_0x10176b[_0x593b6d(0x285)](errorMessageForTelemetry,_0x378344)}),_0x4ac9eb;});}catch(_0x486349){await _0x57f573[_0x4d888a(0x222)]?.['trackPhaseError'](_0x10176b['hpruR'],_0x10176b['hWlJa'](_0x378344,_0x486349),{..._0x27f5bf,'tunnelSessionId':_0x320737['sessionId'],'bridgeError':_0x10176b['VwYIF'](errorMessageForTelemetry,_0x378344)});throw _0x10176b['TJqYU'](_0x378344,_0x486349);}}catch(_0x572d55){!_0x5075b5&&await _0x57f573['telemetry']?.[_0x4d888a(0x201)](_0x4d888a(0x203),_0x572d55,{..._0x27f5bf,'tunnelSessionId':_0x320737?.[_0x4d888a(0x1e5)]});throw _0x572d55;}finally{(_0x320737||_0x21ef48||_0x3727cf)&&(_0x57f573[_0x4d888a(0x222)]?.[_0x4d888a(0x1f8)](_0x10176b['DzmBc'],{..._0x27f5bf,'tunnelSessionId':_0x320737?.[_0x4d888a(0x1e5)]}),_0x3727cf?.[_0x4d888a(0x22e)](),_0x21ef48&&await _0x21ef48[_0x4d888a(0x22e)]()['catch'](()=>{}),_0x320737&&await _0x10176b['EMrBm'](deleteTunnelSession,_0x320737[_0x4d888a(0x1e5)])[_0x4d888a(0x279)](()=>{}),_0x57f573['telemetry']?.[_0x4d888a(0x1da)](_0x10176b['DzmBc'],{..._0x27f5bf,'tunnelSessionId':_0x320737?.['sessionId']}));}}export async function manualBrowserLogin(_0x38c5fc,_0x35dd7c,_0x5857ed={}){const _0xfbf4b0=_0x4cc66b,_0x51ff3e={'wzklJ':'close','PfIgt':function(_0x4fc465,_0x3102d6){return _0x4fc465+_0x3102d6;},'rLMfw':_0xfbf4b0(0x25b),'DwUlY':'or\x20run\x20this\x20command\x20from\x20an\x20interactive\x20terminal\x20so\x20a\x20browser\x20can\x20open.','fdnVT':function(_0xd2df30,_0x2b5bcd){return _0xd2df30>_0x2b5bcd;},'jMpsR':'about:blank','FkhuN':function(_0x495fb6,_0x40b42b){return _0x495fb6(_0x40b42b);},'qkYWm':function(_0x5175d4,_0x5b2bdd){return _0x5175d4&&_0x5b2bdd;},'JWZwt':_0xfbf4b0(0x277),'umaGb':function(_0x532654,_0x32b0a5){return _0x532654!==_0x32b0a5;},'GIZIL':function(_0x50eb0e,_0x4f48e6,_0x2c4b67){return _0x50eb0e(_0x4f48e6,_0x2c4b67);}};if(!isInteractive())throw new Error(_0x51ff3e[_0xfbf4b0(0x252)]('No\x20automatic\x20login\x20available\x20for\x20profile\x20\x22'+_0x38c5fc['name']+'\x22.\x0a'+_0x51ff3e['rLMfw'],_0x51ff3e[_0xfbf4b0(0x1f7)]));const _0x3439b7=_0x35dd7c&&_0x51ff3e[_0xfbf4b0(0x262)](_0x35dd7c['domains'][_0xfbf4b0(0x22a)],0x0)?_0x35dd7c[_0xfbf4b0(0x26e)][0x0]:_0x51ff3e[_0xfbf4b0(0x22d)];console[_0xfbf4b0(0x20a)](_0xfbf4b0(0x23f)),console[_0xfbf4b0(0x20a)]('\x20\x20When\x20done,\x20close\x20the\x20browser\x20to\x20save\x20the\x20session.\x0a'),await new Promise(_0x282367=>setTimeout(_0x282367,0x7d0));const _0x273b8b=await chromium['launch']({'headless':![]});let _0x443267=null;try{const _0x588478={'ignoreHTTPSErrors':!![]};_0x35dd7c?.['setupHeaders']&&(_0x588478['extraHTTPHeaders']=_0x35dd7c[_0xfbf4b0(0x232)]);const _0x47a7a8=await _0x273b8b[_0xfbf4b0(0x23d)](_0x588478);await _0x51ff3e[_0xfbf4b0(0x287)](addProfileSetupBanner,_0x47a7a8);const _0x1cc08b=await _0x47a7a8[_0xfbf4b0(0x26c)]();await _0x1cc08b['goto'](_0x3439b7);let _0x1c4790=![];await new Promise(_0x18562a=>{const _0xadd19=_0xfbf4b0,_0x57041a={'cCzYi':function(_0x3080da,_0x178efd){return _0x3080da/_0x178efd;},'uheCZ':function(_0x13cc36){return _0x13cc36();}},_0x499c17=setTimeout(()=>{const _0x418acf=_0x33f5;_0x1c4790=!![],console[_0x418acf(0x1fe)]('Browser\x20login\x20timed\x20out\x20after\x20'+_0x57041a['cCzYi'](MANUAL_LOGIN_TIMEOUT_MS,0xea60)+'\x20minutes\x20—\x20close\x20the\x20browser\x20to\x20retry.'),_0x57041a['uheCZ'](_0x18562a);},MANUAL_LOGIN_TIMEOUT_MS);_0x1cc08b['on'](_0x51ff3e[_0xadd19(0x20d)],async()=>{clearTimeout(_0x499c17);try{const _0xcbcd3d=await _0x47a7a8['storageState']();_0x443267=_0xcbcd3d;}catch{}_0x18562a();});});if(_0x51ff3e['qkYWm'](_0x1c4790,!_0x443267))throw new Error(_0x51ff3e[_0xfbf4b0(0x280)]);}finally{await _0x273b8b[_0xfbf4b0(0x22e)]()['catch'](()=>{});}if(!_0x443267)throw new Error('Browser\x20closed\x20before\x20authentication\x20was\x20saved.');return _0x51ff3e['umaGb'](_0x5857ed[_0xfbf4b0(0x1e8)],![])&&await _0x51ff3e['GIZIL'](apiRequest,'/api/v1/profiles/'+_0x51ff3e[_0xfbf4b0(0x287)](encodeURIComponent,_0x38c5fc[_0xfbf4b0(0x1e4)])+_0xfbf4b0(0x1f3),{'method':'POST','body':JSON[_0xfbf4b0(0x1fa)]({'session_state':_0x443267,'updated_by':'cli:manual-login'})}),{'sessionState':_0x443267};}function _0x33f5(_0x41dcbe,_0x4f11fd){_0x41dcbe=_0x41dcbe-0x1d1;const _0x20e12d=_0x20e1();let _0x33f587=_0x20e12d[_0x41dcbe];return _0x33f587;}export async function promptSaveCredentials(_0x5a7579){const _0x496f53=_0x4cc66b,_0x4d0579={'xpOKr':function(_0x5e708a){return _0x5e708a();},'ebvNz':function(_0x458802,_0x194bbc,_0x1cd69d){return _0x458802(_0x194bbc,_0x1cd69d);},'cHDzx':function(_0x434018,_0x559538){return _0x434018(_0x559538);},'HNrNP':_0x496f53(0x276),'mmhiV':'\x20\x20Credentials\x20saved\x20to\x20cloud\x20profile.'},_0x4f63f1=process['env']['RANGER_TEST_USERNAME'],_0x33507d=process[_0x496f53(0x20f)]['RANGER_TEST_PASSWORD'];if(!_0x4f63f1||!_0x33507d)return;if(!_0x4d0579[_0x496f53(0x288)](isInteractive))return;const {save:_0x4ced7e}=await _0x1e4fbc['prompt']([{'type':'confirm','name':'save','message':'Save\x20credentials\x20to\x20profile\x20for\x20automatic\x20session\x20refresh?','default':![]}]);if(!_0x4ced7e)return;await _0x4d0579[_0x496f53(0x267)](apiRequest,'/api/v1/profiles/'+_0x4d0579['cHDzx'](encodeURIComponent,_0x5a7579),{'method':_0x4d0579[_0x496f53(0x1f5)],'body':JSON['stringify']({'username':_0x4f63f1,'password':_0x33507d})}),console[_0x496f53(0x20a)](_0x4d0579['mmhiV']);}export async function resolveCloudProfileSession(_0xfd2698,_0x423968={}){const _0x556d0c=_0x4cc66b,_0x1d0d44={'uTAbO':function(_0x4c3acc){return _0x4c3acc();},'CmATx':function(_0x5baf7b,_0x14b620){return _0x5baf7b===_0x14b620;},'ELtzR':'string','TlzyB':function(_0x14f149,_0x30c410){return _0x14f149||_0x30c410;},'DLSNf':function(_0x51ea2c,_0x43d4ad){return _0x51ea2c(_0x43d4ad);},'BAJPw':function(_0x5b2235,_0x309dee){return _0x5b2235>_0x309dee;},'XSiDx':function(_0x4d2481,_0x54c30e,_0x3116f9,_0xa65b73,_0x5dfcb8){return _0x4d2481(_0x54c30e,_0x3116f9,_0xa65b73,_0x5dfcb8);},'VefhX':function(_0x558e07,_0x316f3f,_0x525340){return _0x558e07(_0x316f3f,_0x525340);},'vXdmo':function(_0x2e684a,_0xa128fe){return _0x2e684a(_0xa128fe);},'UPXga':function(_0x4354cb,_0x1384fb){return _0x4354cb||_0x1384fb;},'AOHPa':'success','YefCu':_0x556d0c(0x25d),'TXgnp':function(_0x4d4ee7,_0x54e98d,_0x45d28f,_0x5cd623,_0x18bba2,_0x1a793d,_0xf82340,_0x59140e){return _0x4d4ee7(_0x54e98d,_0x45d28f,_0x5cd623,_0x18bba2,_0x1a793d,_0xf82340,_0x59140e);},'Tutug':function(_0x206808,_0x5d0e1a,_0x282632,_0x8fd12a){return _0x206808(_0x5d0e1a,_0x282632,_0x8fd12a);}},_0x824d0a=_0xfd2698['settings']??{},_0x3d3b66=await _0x1d0d44[_0x556d0c(0x242)](fetchAuthConfig),_0x256294=_0x3d3b66?resolveAuthEnvironmentLocally(_0x3d3b66,_0xfd2698[_0x556d0c(0x1ee)]):null,_0x48fb92=typeof _0x256294?.[_0x556d0c(0x1d8)]==='string'&&_0x256294[_0x556d0c(0x1d8)]['trim']()?_0x256294[_0x556d0c(0x1d8)]:undefined,_0x19db88=_0x1d0d44[_0x556d0c(0x228)](typeof _0x824d0a['loginInstructions'],_0x1d0d44['ELtzR'])&&_0x824d0a[_0x556d0c(0x1d8)]['trim']()?_0x824d0a[_0x556d0c(0x1d8)]:undefined,_0x3f2457=_0x1d0d44[_0x556d0c(0x240)](_0x19db88,!_0x48fb92)?_0x824d0a:{..._0x824d0a,'loginInstructions':_0x48fb92},_0x5ce403=Boolean(_0x3f2457[_0x556d0c(0x1d8)]?.['trim']()),_0x4bca58=_0x1d0d44['DLSNf'](Boolean,_0x824d0a['forceLogin']||_0x256294?.['forceLogin']),_0x47b886=_0x256294?.[_0x556d0c(0x26e)],_0x180991=_0x824d0a[_0x556d0c(0x232)],_0x3a5414=_0x180991??_0x256294?.[_0x556d0c(0x232)],_0x345236=_0x423968[_0x556d0c(0x263)]??_0x824d0a[_0x556d0c(0x1e9)]??(_0x47b886&&_0x1d0d44['BAJPw'](_0x47b886['length'],0x0)?_0x47b886[0x0]:''),_0x16fdf0=_0x345236?_0x1d0d44['DLSNf'](needsTunnel,_0x345236):![],_0x131675={'invalidateOn':_0x256294?.['invalidateOn'],'userAgent':_0x256294?.['browserOptions']?.[_0x556d0c(0x1e0)]??_0x824d0a['userAgent']};_0x4bca58&&console['log'](_0x556d0c(0x1e6)+_0xfd2698['name']+_0x556d0c(0x229));if(!_0x4bca58){const _0x1cc384=await checkLocalCache(_0xfd2698[_0x556d0c(0x1e4)],_0xfd2698[_0x556d0c(0x224)],_0x345236,_0x3a5414,_0x131675);if(_0x1cc384){if(_0x345236&&!_0x16fdf0){const _0x286482=await _0x1d0d44[_0x556d0c(0x1ed)](isCachedSessionLive,_0x1cc384['storageStatePath'],_0x345236,{'sessionCheckPath':_0x256294?.['sessionCheckPath'],'setupHeaders':_0x3a5414},{'launchBrowser':launchRealBrowser});if(_0x286482)return console['log'](_0x556d0c(0x237)+_0xfd2698['name']+'\x22'),{'authPath':_0x1cc384['storageStatePath'],'settings':_0x3f2457,'resolvedEnv':_0x256294};console[_0x556d0c(0x20a)]('\x20\x20Cached\x20session\x20for\x20\x22'+_0xfd2698[_0x556d0c(0x1e4)]+_0x556d0c(0x205)),emitSessionValidationHint(_0x345236,_0x256294);}else return _0x16fdf0&&console[_0x556d0c(0x20a)]('\x20\x20Using\x20cached\x20local\x20session\x20for\x20cloud\x20profile\x20\x22'+_0xfd2698['name']+'\x22'),{'authPath':_0x1cc384[_0x556d0c(0x234)],'settings':_0x3f2457,'resolvedEnv':_0x256294};}}if(!_0x4bca58&&_0xfd2698[_0x556d0c(0x1f1)]){if(_0x16fdf0)console[_0x556d0c(0x20a)]('\x20\x20Skipping\x20cloud\x20session\x20for\x20local\x20target\x20\x22'+_0x345236+_0x556d0c(0x1dd)+_0xfd2698['name']+'\x22');else{const _0x144150=await writeSessionToLocalCache(_0xfd2698['name'],_0xfd2698[_0x556d0c(0x224)],_0x345236,_0x3a5414,_0xfd2698[_0x556d0c(0x1f1)],_0x47b886,_0x131675);if(_0x345236){const _0x379c15=await isCachedSessionLive(_0x144150,_0x345236,{'sessionCheckPath':_0x256294?.[_0x556d0c(0x268)],'setupHeaders':_0x3a5414},{'launchBrowser':launchRealBrowser});if(_0x379c15)return console['log']('\x20\x20Cloud\x20session\x20is\x20live\x20for\x20\x22'+_0xfd2698[_0x556d0c(0x1e4)]+'\x22,\x20cached\x20locally'),{'authPath':_0x144150,'settings':_0x3f2457,'resolvedEnv':_0x256294};console['log']('\x20\x20Cloud\x20session\x20for\x20\x22'+_0xfd2698['name']+_0x556d0c(0x1f0)),_0x1d0d44[_0x556d0c(0x25c)](emitSessionValidationHint,_0x345236,_0x256294);}else return{'authPath':_0x144150,'settings':_0x3f2457,'resolvedEnv':_0x256294};}}if(_0x5ce403)return console['log'](_0x556d0c(0x1d4)+_0xfd2698[_0x556d0c(0x1e4)]+'\x22;\x20proceeding\x20with\x20loginInstructions.'),{'authPath':undefined,'settings':_0x3f2457,'resolvedEnv':_0x256294};console[_0x556d0c(0x20a)](_0x556d0c(0x1d4)+_0xfd2698[_0x556d0c(0x1e4)]+_0x556d0c(0x286));const _0x351f08=Boolean(process['env']['RANGER_TEST_USERNAME'])&&Boolean(process['env'][_0x556d0c(0x1ef)]),_0x1e5829=_0x1d0d44['vXdmo'](Boolean,_0xfd2698[_0x556d0c(0x1de)]);if(_0x1d0d44['UPXga'](_0x351f08,_0x1e5829))try{const _0x5cd318=_0x345236?await serverSideLoginWithOptionalTunnel(_0xfd2698[_0x556d0c(0x1e4)],_0x345236,{'force':_0x4bca58,'telemetry':_0x423968[_0x556d0c(0x222)]}):await _0x1d0d44['VefhX'](serverSideLogin,_0xfd2698[_0x556d0c(0x1e4)],{'force':_0x4bca58});if(_0x5cd318['status']==='not_configured')console['log']('\x20\x20Server-side\x20login\x20not\x20configured\x20for\x20this\x20org.\x20Falling\x20back\x20to\x20manual\x20login...');else{if(_0x5cd318[_0x556d0c(0x1d5)]===_0x1d0d44['AOHPa']&&_0x5cd318[_0x556d0c(0x282)]){console[_0x556d0c(0x20a)](_0x1d0d44['YefCu']);const _0x42ba6e=await _0x1d0d44['TXgnp'](writeSessionToLocalCache,_0xfd2698[_0x556d0c(0x1e4)],_0xfd2698['organizationId'],_0x345236,_0x3a5414,_0x5cd318[_0x556d0c(0x282)],_0x47b886,_0x131675);return _0x351f08&&!_0x1e5829&&await promptSaveCredentials(_0xfd2698['name']),{'authPath':_0x42ba6e,'settings':_0x3f2457,'resolvedEnv':_0x256294};}else _0x5cd318['test_output']&&(console['log'](_0x556d0c(0x248)),console[_0x556d0c(0x20a)](_0x5cd318[_0x556d0c(0x1f6)])),console['log']('\x20\x20Falling\x20back\x20to\x20manual\x20browser\x20login...');}}catch(_0x2225d4){console[_0x556d0c(0x20a)](_0x556d0c(0x20e)+(_0x2225d4 instanceof Error?_0x2225d4['message']:_0x1d0d44[_0x556d0c(0x208)](String,_0x2225d4))),console[_0x556d0c(0x20a)](_0x556d0c(0x214));}const _0x3a4298=_0x256294?{..._0x256294,'setupHeaders':_0x3a5414}:_0x345236?{'key':_0xfd2698[_0x556d0c(0x1ee)]??'','domains':[_0x345236],'setupHeaders':_0x3a5414}:null,{sessionState:_0x4c37fb}=await _0x1d0d44['Tutug'](manualBrowserLogin,_0xfd2698,_0x3a4298,{'persistSessionState':!_0x16fdf0}),_0x2aed33=await writeSessionToLocalCache(_0xfd2698['name'],_0xfd2698['organizationId'],_0x345236,_0x3a5414,_0x4c37fb,_0x47b886,_0x131675);return{'authPath':_0x2aed33,'settings':_0x3f2457,'resolvedEnv':_0x256294};}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
function _0x23d0(){const _0x435d8a=['push','environments','localhost.','205PXTWHy','has','jgpPi','launchBrowser','invalidateOn','clientIp','url','Tdlkk','goto','lvgXV','190421asIFNi','.localhost','setupHeaders','hostname','toString','add','780214xpiQMk','defaultEnvironmentKey','includes','.storageState.json','194478hYLQUZ','effectiveBaseUrl','replace','domcontentloaded','14284450sixriK','216ybmJzB','length','orgId','sha256','566392hyjKAS','3975138AxkcLb','auth','ycODN','1192698kPRGfS','sessionCheckPath','127.0.0.1','rQnOV','port','digest','bQkZi','map','.json','sort','userAgent','iQjDD','slice','stdout','stringify','3YMPqYW'];_0x23d0=function(){return _0x435d8a;};return _0x23d0();}const _0x451f04=_0x16fb;(function(_0x1672e8,_0x1c1bba){const _0x43df4a=_0x16fb,_0x29b02a=_0x1672e8();while(!![]){try{const _0x16b099=-parseInt(_0x43df4a(0x1f5))/0x1+-parseInt(_0x43df4a(0x1e4))/0x2+parseInt(_0x43df4a(0x204))/0x3*(-parseInt(_0x43df4a(0x1f1))/0x4)+-parseInt(_0x43df4a(0x1d4))/0x5*(-parseInt(_0x43df4a(0x1e8))/0x6)+-parseInt(_0x43df4a(0x1de))/0x7*(parseInt(_0x43df4a(0x1ed))/0x8)+parseInt(_0x43df4a(0x1f2))/0x9+parseInt(_0x43df4a(0x1ec))/0xa;if(_0x16b099===_0x1c1bba)break;else _0x29b02a['push'](_0x29b02a['shift']());}catch(_0x1bdc45){_0x29b02a['push'](_0x29b02a['shift']());}}}(_0x23d0,0xb4b50));import{createHash}from'crypto';import{join}from'path';import{getRangerHomeDir}from'./rangerRoot.js';export function isInteractive(_0x2da744=process['env'],_0x52a962={'stdin':process['stdin'],'stdout':process[_0x451f04(0x202)]}){const _0xc50344=_0x451f04,_0x145dcd={'bQkZi':function(_0x233f32,_0x3cce61){return _0x233f32(_0x3cce61);},'VskdJ':function(_0x4664a3,_0x33b5fa){return _0x4664a3(_0x33b5fa);}};if(_0x2da744['CI'])return![];return _0x145dcd[_0xc50344(0x1fb)](Boolean,_0x52a962['stdin']['isTTY'])&&_0x145dcd['VskdJ'](Boolean,_0x52a962[_0xc50344(0x202)]['isTTY']);}export const DEFAULT_INVALIDATE_ON=[];export function sessionCacheHash(_0x5531e3){const _0x52a36c=_0x451f04,_0x2c4ac5={'lvgXV':function(_0x367e63,_0xaa148b){return _0x367e63(_0xaa148b);},'Tarob':'baseUrl','jgpPi':'setupHeaders','rQnOV':function(_0x33f543,_0x1bcd8d){return _0x33f543!==_0x1bcd8d;},'ycODN':_0x52a36c(0x1d9),'InWHv':function(_0x26794f,_0x5536ec){return _0x26794f!==_0x5536ec;},'iQjDD':function(_0x26b233,_0x48c52b){return _0x26b233(_0x48c52b);}},_0x5aaf18=new Set(_0x5531e3[_0x52a36c(0x1d8)]??DEFAULT_INVALIDATE_ON);_0x5531e3[_0x52a36c(0x1e9)]&&_0x2c4ac5[_0x52a36c(0x1dd)](needsTunnel,_0x5531e3[_0x52a36c(0x1e9)])&&_0x5aaf18[_0x52a36c(0x1e3)]('baseUrl');const _0x10a3c8={'orgId':_0x5531e3[_0x52a36c(0x1ef)],'profileName':_0x5531e3['profileName']};return _0x5aaf18[_0x52a36c(0x1d5)](_0x2c4ac5['Tarob'])&&(_0x10a3c8[_0x52a36c(0x1e9)]=_0x5531e3[_0x52a36c(0x1e9)]),_0x5aaf18['has'](_0x2c4ac5[_0x52a36c(0x1d6)])&&(_0x10a3c8[_0x52a36c(0x1e0)]=_0x5531e3['setupHeaders']?sortObjectKeys(_0x5531e3[_0x52a36c(0x1e0)]):_0x5531e3['setupHeaders']),_0x5aaf18['has'](_0x52a36c(0x1f9))&&(_0x10a3c8['port']=extractPort(_0x5531e3['effectiveBaseUrl'])),_0x5aaf18[_0x52a36c(0x1d5)]('userAgent')&&_0x2c4ac5[_0x52a36c(0x1f8)](_0x5531e3['userAgent'],undefined)&&(_0x10a3c8['userAgent']=_0x5531e3[_0x52a36c(0x1ff)]),_0x5aaf18[_0x52a36c(0x1d5)](_0x2c4ac5[_0x52a36c(0x1f4)])&&_0x2c4ac5['InWHv'](_0x5531e3['clientIp'],undefined)&&(_0x10a3c8['clientIp']=_0x5531e3[_0x52a36c(0x1d9)]),_0x2c4ac5[_0x52a36c(0x200)](createHash,_0x52a36c(0x1f0))['update'](JSON[_0x52a36c(0x203)](_0x10a3c8))[_0x52a36c(0x1fa)]('hex')[_0x52a36c(0x201)](0x0,0xc);}function extractPort(_0x4723bf){try{return new URL(_0x4723bf)['port'];}catch{return'';}}function sortObjectKeys(_0x596c71){const _0xde9263=_0x451f04,_0xf941e4={};for(const _0x2808b7 of Object['keys'](_0x596c71)[_0xde9263(0x1fe)]()){_0xf941e4[_0x2808b7]=_0x596c71[_0x2808b7];}return _0xf941e4;}export function getSessionCachePath(_0x338c12,_0x2d4944){const _0x545e1d=_0x451f04,_0x3c0a1a={'wXmYS':_0x545e1d(0x1f3)};return join(getRangerHomeDir(),_0x3c0a1a['wXmYS'],_0x338c12+'-'+_0x2d4944+_0x545e1d(0x1fd));}export function getStorageStatePath(_0x51af0d){const _0x131945=_0x451f04,_0x391370={'mTBKr':_0x131945(0x1e7)};return _0x51af0d[_0x131945(0x1ea)](/\.json$/,_0x391370['mTBKr']);}export function needsTunnel(_0x232934){const _0x361de9=_0x451f04,_0x54b218={'Tdlkk':function(_0x2b2a10,_0x1e828e){return _0x2b2a10===_0x1e828e;}};let _0x4aa26f;try{_0x4aa26f=new URL(_0x232934)['hostname'];}catch{return![];}if(_0x4aa26f==='localhost'||_0x54b218[_0x361de9(0x1db)](_0x4aa26f,_0x361de9(0x1f7)))return!![];if(_0x4aa26f['endsWith'](_0x361de9(0x1df)))return!![];if(_0x4aa26f[_0x361de9(0x1e6)](_0x361de9(0x1d3)))return!![];return![];}export function hostnameOf(_0x3db0f9){const _0x332036=_0x451f04;return new URL(_0x3db0f9)[_0x332036(0x1e1)];}export function duplicateCookiesForDomains(_0x66ffe,_0x4d269d){const _0x9e8361=_0x451f04,_0x1816f2=[..._0x66ffe],_0x437d99=new Set(_0x66ffe[_0x9e8361(0x1fc)](_0x10455c=>_0x10455c['domain']));for(const _0xeeffdd of _0x4d269d){let _0x87a49;try{_0x87a49=hostnameOf(_0xeeffdd);}catch{continue;}if(!_0x87a49)continue;const _0x3bd9c5=_0x87a49['startsWith']('.')?_0x87a49:'.'+_0x87a49;if(_0x437d99['has'](_0x87a49)||_0x437d99['has'](_0x3bd9c5))continue;for(const _0x395bcc of _0x66ffe){_0x1816f2[_0x9e8361(0x1d1)]({..._0x395bcc,'domain':_0x3bd9c5});}_0x437d99['add'](_0x3bd9c5);}return _0x1816f2;}function _0x16fb(_0x4b6616,_0x226ad7){_0x4b6616=_0x4b6616-0x1d1;const _0x23d068=_0x23d0();let _0x16fb29=_0x23d068[_0x4b6616];return _0x16fb29;}export function resolveAuthEnvironmentLocally(_0x531e44,_0x3eb869){const _0x20d84f=_0x451f04,_0x4c82f7=_0x531e44[_0x20d84f(0x1d2)];if(_0x3eb869){const _0x18f8cf=_0x4c82f7[_0x3eb869];if(!_0x18f8cf)return null;return{'key':_0x3eb869,..._0x18f8cf};}if(_0x531e44['defaultEnvironmentKey']){const _0x5ca423=_0x4c82f7[_0x531e44['defaultEnvironmentKey']];if(!_0x5ca423)return null;return{'key':_0x531e44[_0x20d84f(0x1e5)],..._0x5ca423};}const _0x3b10e8=Object['keys'](_0x4c82f7);if(_0x3b10e8[_0x20d84f(0x1ee)]===0x1){const _0x215dd6=_0x3b10e8[0x0];return{'key':_0x215dd6,..._0x4c82f7[_0x215dd6]};}return null;}const LOGIN_URL_PATTERN=/(?:^|\/)(login|signin|sign-in|sso|auth\/login)(?:[/?#]|$)/i;export function buildSessionCheckUrl(_0x7e63b0,_0x17ff60){const _0x27bc37=_0x451f04;try{if(_0x17ff60)return new URL(_0x17ff60,_0x7e63b0)[_0x27bc37(0x1e2)]();return new URL(_0x7e63b0)['toString']();}catch{return null;}}export function looksLikeLoginUrl(_0x4b246d){try{const _0x24df73=new URL(_0x4b246d);return LOGIN_URL_PATTERN['test'](_0x24df73['pathname']);}catch{return LOGIN_URL_PATTERN['test'](_0x4b246d);}}export async function isCachedSessionLive(_0x1893ba,_0x4ff75b,_0x5953fe={},_0x134315={}){const _0x158e4a=_0x451f04,_0x41383e={'zQubR':function(_0x3a8cec,_0x4ea96f){return _0x3a8cec===_0x4ea96f;},'sWxuL':function(_0x4934f0,_0x4aec89){return _0x4934f0(_0x4aec89);}},_0x4e4ea5=buildSessionCheckUrl(_0x4ff75b,_0x5953fe[_0x158e4a(0x1f6)]);if(!_0x4e4ea5)return!![];if(!_0x134315[_0x158e4a(0x1d7)])return!![];let _0x19bf9a=null;try{_0x19bf9a=await _0x134315['launchBrowser']();const _0xd3511=await _0x19bf9a['newContext']({'storageState':_0x1893ba,'ignoreHTTPSErrors':!![],..._0x5953fe[_0x158e4a(0x1e0)]?{'extraHTTPHeaders':_0x5953fe['setupHeaders']}:{}}),_0x96ae46=await _0xd3511['newPage'](),_0x557a3a=await _0x96ae46[_0x158e4a(0x1dc)](_0x4e4ea5,{'waitUntil':_0x158e4a(0x1eb),'timeout':0x3a98}),_0xd0139a=_0x557a3a?.['status']();if(_0x41383e['zQubR'](_0xd0139a,0x191)||_0xd0139a===0x193)return![];const _0x3b539b=_0x96ae46[_0x158e4a(0x1da)]();if(_0x41383e['sWxuL'](looksLikeLoginUrl,_0x3b539b))return![];return!![];}catch{return![];}finally{if(_0x19bf9a)await _0x19bf9a['close']()['catch'](()=>{});}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function
|
|
1
|
+
function _0x3168(_0x299228,_0x5307a9){_0x299228=_0x299228-0x9a;const _0x2805dd=_0x2805();let _0x3168a6=_0x2805dd[_0x299228];return _0x3168a6;}(function(_0x23020f,_0x2ca27c){const _0x508855=_0x3168,_0x1d43af=_0x23020f();while(!![]){try{const _0x5d5aac=parseInt(_0x508855(0xa0))/0x1+-parseInt(_0x508855(0xa5))/0x2*(-parseInt(_0x508855(0xa3))/0x3)+parseInt(_0x508855(0xac))/0x4+-parseInt(_0x508855(0x9b))/0x5*(parseInt(_0x508855(0xab))/0x6)+-parseInt(_0x508855(0xa8))/0x7+parseInt(_0x508855(0xa6))/0x8*(-parseInt(_0x508855(0xa7))/0x9)+parseInt(_0x508855(0xa1))/0xa*(parseInt(_0x508855(0xa2))/0xb);if(_0x5d5aac===_0x2ca27c)break;else _0x1d43af['push'](_0x1d43af['shift']());}catch(_0x3ac55d){_0x1d43af['push'](_0x1d43af['shift']());}}}(_0x2805,0xc4b94));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(_0x481cc3){const _0x219d14=_0x3168,_0x49e765={'ARzHH':function(_0x32ba87,_0x79e16,_0xe427aa,_0x15cf15,_0x11afb3,_0x5e2a31){return _0x32ba87(_0x79e16,_0xe427aa,_0x15cf15,_0x11afb3,_0x5e2a31);},'aiLaR':_0x219d14(0x9a)};return _0x49e765['ARzHH'](pbkdf2Sync,_0x481cc3,SALT,0x186a0,KEY_LENGTH,_0x49e765['aiLaR']);}export function encrypt(_0x1c2d9d,_0x5297ab){const _0x9373b9=_0x3168,_0x476792={'hwQJe':function(_0x530664,_0x1b6d3f,_0x202b2c,_0x4f9852){return _0x530664(_0x1b6d3f,_0x202b2c,_0x4f9852);}},_0x1f9ffe=deriveKey(_0x5297ab),_0x570c63=randomBytes(IV_LENGTH),_0x57598d=_0x476792[_0x9373b9(0x9e)](createCipheriv,ALGORITHM,_0x1f9ffe,_0x570c63),_0x354895=Buffer['concat']([_0x57598d['update'](_0x1c2d9d,_0x9373b9(0x9c)),_0x57598d['final']()]),_0x4fd214=_0x57598d[_0x9373b9(0x9f)]();return Buffer[_0x9373b9(0x9d)]([_0x570c63,_0x4fd214,_0x354895]);}export function decrypt(_0x36fbb9,_0x3300c8){const _0x1ae9ee=_0x3168,_0x4080f7={'vXHrQ':function(_0x5e8ddb,_0x1dbe6c){return _0x5e8ddb+_0x1dbe6c;},'MMQVH':function(_0x2b9610,_0x5e3b1b,_0x8d729f,_0x380e5d){return _0x2b9610(_0x5e3b1b,_0x8d729f,_0x380e5d);}},_0x2ad33c=deriveKey(_0x3300c8),_0x578a02=_0x36fbb9['subarray'](0x0,IV_LENGTH),_0xb4916d=_0x36fbb9['subarray'](IV_LENGTH,_0x4080f7['vXHrQ'](IV_LENGTH,TAG_LENGTH)),_0x4765c9=_0x36fbb9['subarray'](IV_LENGTH+TAG_LENGTH),_0xf07e68=_0x4080f7[_0x1ae9ee(0xaa)](createDecipheriv,ALGORITHM,_0x2ad33c,_0x578a02);return _0xf07e68['setAuthTag'](_0xb4916d),_0x4080f7[_0x1ae9ee(0xa4)](_0xf07e68[_0x1ae9ee(0xa9)](_0x4765c9),_0xf07e68['final'](_0x1ae9ee(0x9c)));}function _0x2805(){const _0x56c99a=['vXHrQ','36KZcrSx','808KeBJSt','60372zuhnuO','152558fZYDYd','update','MMQVH','6JMEhTK','2387140JKGMdL','sha256','921505IOkbMy','utf8','concat','hwQJe','getAuthTag','319174INkULa','45570djPiCo','330gvDEVC','106119PAeDsK'];_0x2805=function(){return _0x56c99a;};return _0x2805();}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
function _0x4829(_0x3bd608,_0x58d8cb){_0x3bd608=_0x3bd608-0x73;const _0x15e76c=_0x15e7();let _0x48297c=_0x15e76c[_0x3bd608];return _0x48297c;}const _0x25d799=_0x4829;(function(_0x676a4a,_0x106e68){const _0x287a17=_0x4829,_0x360659=_0x676a4a();while(!![]){try{const _0x28e8f4=parseInt(_0x287a17(0x81))/0x1*(parseInt(_0x287a17(0x8d))/0x2)+parseInt(_0x287a17(0x97))/0x3*(parseInt(_0x287a17(0x85))/0x4)+parseInt(_0x287a17(0x83))/0x5+-parseInt(_0x287a17(0x92))/0x6+-parseInt(_0x287a17(0x8f))/0x7*(-parseInt(_0x287a17(0x76))/0x8)+parseInt(_0x287a17(0x79))/0x9+-parseInt(_0x287a17(0x99))/0xa;if(_0x28e8f4===_0x106e68)break;else _0x360659['push'](_0x360659['shift']());}catch(_0x90a85d){_0x360659['push'](_0x360659['shift']());}}}(_0x15e7,0xc7202));import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{getCurrentVersion}from'./version.js';const SENSITIVE_FLAGS=new Set(['--token','-t','--secret',_0x25d799(0x73),_0x25d799(0x93),'--key','--password','--pass','--auth',_0x25d799(0x75),_0x25d799(0x74),'--cookie',_0x25d799(0x9a)]),TOKEN_PATTERNS=[/^(ranger_|rngr_|sk-|pk-|api[_-]?)/i,/^[a-zA-Z0-9_-]{32,}$/,/^eyJ[a-zA-Z0-9_-]+\.[a-zA-Z0-9_-]+/];function looksLikeToken(_0x4216c6){const _0x1b995b=_0x25d799;return TOKEN_PATTERNS[_0x1b995b(0x88)](_0x482e53=>_0x482e53[_0x1b995b(0x8a)](_0x4216c6));}export function sanitizeArgs(_0x4a2126){const _0x28a316=_0x25d799,_0x37b1fc={'AuGRD':'[REDACTED]','gAriX':function(_0x475351,_0x2ff691){return _0x475351!==_0x2ff691;},'ppyCz':function(_0x34e5b5,_0x3df203){return _0x34e5b5(_0x3df203);}},_0x548379=[];let _0x6a1fac=![];for(let _0x119219=0x0;_0x119219<_0x4a2126['length'];_0x119219++){const _0x72727a=_0x4a2126[_0x119219];if(_0x6a1fac){_0x548379['push'](_0x37b1fc[_0x28a316(0x7d)]),_0x6a1fac=![];continue;}if(_0x72727a[_0x28a316(0x98)]('--')||_0x72727a[_0x28a316(0x98)]('-')){const _0x110ccc=_0x72727a['indexOf']('=');if(_0x37b1fc['gAriX'](_0x110ccc,-0x1)){const _0x3baeca=_0x72727a[_0x28a316(0x8e)](0x0,_0x110ccc)['toLowerCase']();if(SENSITIVE_FLAGS[_0x28a316(0x7c)](_0x3baeca)){_0x548379['push'](_0x72727a['slice'](0x0,_0x110ccc)+_0x28a316(0x91));continue;}}else{const _0x34ea63=_0x72727a['toLowerCase']();SENSITIVE_FLAGS['has'](_0x34ea63)&&(_0x6a1fac=!![]);}_0x548379[_0x28a316(0x7e)](_0x72727a);}else _0x37b1fc['ppyCz'](looksLikeToken,_0x72727a)?_0x548379[_0x28a316(0x7e)](_0x37b1fc['AuGRD']):_0x548379['push'](_0x72727a);}return _0x548379['join']('\x20');}export async function logDesirePath(_0x362427){const _0x2c7b87=_0x25d799,_0x24fbaa={'KDBTN':function(_0x595b28){return _0x595b28();},'wigeK':function(_0x24e8ec){return _0x24e8ec();},'ABgQt':_0x2c7b87(0x78),'qwRKh':'application/json','pbiCu':'POST'};try{const _0xabb041=await _0x24fbaa['KDBTN'](getToken)['catch'](()=>null),_0x18031d=getApiBaseUrl(),_0x5dba93=_0x24fbaa['wigeK'](getCurrentVersion),_0x162b25=_0xabb041?_0x24fbaa[_0x2c7b87(0x8b)]:'no_token',_0x4e29c6={..._0x362427[_0x2c7b87(0x7b)],'authStatus':_0x162b25,'isTty':process['stdout']['isTTY']??![]},_0x153537={'Content-Type':_0x24fbaa[_0x2c7b87(0x94)]};_0xabb041&&(_0x153537['Authorization']='Bearer\x20'+_0xabb041);const _0x2a7b81={'rawCommand':_0x362427['rawCommand'],'errorMessage':_0x362427['errorMessage'],'errorType':_0x362427['errorType'],'featureId':_0x362427[_0x2c7b87(0x9b)],'sessionId':_0x362427[_0x2c7b87(0x84)],'metadata':_0x4e29c6,'cliVersion':_0x5dba93};process[_0x2c7b87(0x96)]['DEBUG']&&(console[_0x2c7b87(0x95)](_0x2c7b87(0x7f)+_0x18031d+'/api/v1/mcp/desire-path-logs'),console['error']('[desire-path]\x20Payload:\x20'+JSON['stringify'](_0x2a7b81,null,0x2))),await fetch(_0x18031d+'/api/v1/mcp/desire-path-logs',{'method':_0x24fbaa['pbiCu'],'headers':_0x153537,'body':JSON['stringify'](_0x2a7b81)});}catch(_0x27b06f){process['env'][_0x2c7b87(0x8c)]&&console['error'](_0x2c7b87(0x86)+_0x27b06f);}}function _0x15e7(){const _0x46d6e9=['has_token','14434155aHyNIa','includes','metadata','has','AuGRD','push','[desire-path]\x20Sending\x20log\x20to\x20','unknown_argument','2SmgKoJ','ATpiY','1023415uonFDD','sessionId','1297716QmfDlD','[desire-path]\x20Failed\x20to\x20send:\x20','HIiVY','some','invalid_option_value','test','ABgQt','DEBUG','707346diCMqm','slice','9955694kKEuOI','Missing\x20required\x20argument','=[REDACTED]','6293364CozwQm','--apikey','qwRKh','error','env','9IBGXnu','startsWith','30468410dnOQVu','--credentials','featureId','--api-key','--header','--authorization','8WQywqH','syntax_error'];_0x15e7=function(){return _0x46d6e9;};return _0x15e7();}export function getErrorType(_0xc755a0,_0xf7e097){const _0x18e739=_0x25d799,_0x4fe4e7={'HIiVY':'4|2|7|1|6|0|3|5','UBHjZ':'Invalid\x20values','dbDxv':_0x18e739(0x89),'jZlgO':'Unknown\x20argument','yGgpj':'missing_option','ATpiY':'runtime_error','RVgkd':_0x18e739(0x77),'RpPeU':'Not\x20enough\x20non-option\x20arguments'},_0x50cbca=_0x4fe4e7[_0x18e739(0x87)]['split']('|');let _0x232965=0x0;while(!![]){switch(_0x50cbca[_0x232965++]){case'0':if(_0xc755a0['includes'](_0x4fe4e7['UBHjZ']))return _0x4fe4e7['dbDxv'];continue;case'1':if(_0xc755a0[_0x18e739(0x7a)](_0x4fe4e7['jZlgO']))return _0x18e739(0x80);continue;case'2':if(!_0xc755a0)return'unknown';continue;case'3':if(_0xc755a0[_0x18e739(0x7a)](_0x18e739(0x90)))return _0x4fe4e7['yGgpj'];continue;case'4':if(_0xf7e097)return _0x4fe4e7[_0x18e739(0x82)];continue;case'5':return _0x4fe4e7['RVgkd'];case'6':if(_0xc755a0['includes'](_0x4fe4e7['RpPeU']))return'missing_required_argument';continue;case'7':if(_0xc755a0['includes']('Unknown\x20command'))return'unknown_command';continue;}break;}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function _0xdb17(_0x2732ca,_0xcdd564){_0x2732ca=_0x2732ca-0x163;const _0x32e180=_0x32e1();let _0xdb17c2=_0x32e180[_0x2732ca];return _0xdb17c2;}const _0x40f7de=_0xdb17;(function(_0x3df51f,_0x170a7c){const _0x14fb33=_0xdb17,_0x3284e4=_0x3df51f();while(!![]){try{const _0x1cfe5c=parseInt(_0x14fb33(0x190))/0x1+parseInt(_0x14fb33(0x1a5))/0x2+parseInt(_0x14fb33(0x1ad))/0x3*(-parseInt(_0x14fb33(0x172))/0x4)+-parseInt(_0x14fb33(0x19a))/0x5+-parseInt(_0x14fb33(0x184))/0x6+-parseInt(_0x14fb33(0x195))/0x7+parseInt(_0x14fb33(0x199))/0x8;if(_0x1cfe5c===_0x170a7c)break;else _0x3284e4['push'](_0x3284e4['shift']());}catch(_0x2b0183){_0x3284e4['push'](_0x3284e4['shift']());}}}(_0x32e1,0xc85b4));import{spawn}from'child_process';import _0xbc9f05 from'inquirer';import{getCurrentEnvironment,ENVIRONMENT_CONFIGS,getApiBaseUrl}from'./environment.js';import{storeToken,storeRefreshToken}from'./keychain.js';const WORKOS_DEVICE_AUTH_URL=_0x40f7de(0x1a8),WORKOS_TOKEN_URL=_0x40f7de(0x163);export async function requestDeviceCode(_0x9befa2){const _0x100687=_0x40f7de,_0x1b9fd9={'FjcEC':function(_0x466c9,_0x2665d5,_0x3fb63e){return _0x466c9(_0x2665d5,_0x3fb63e);},'ReWAi':'application/x-www-form-urlencoded'},_0x4a5bd2=await _0x1b9fd9[_0x100687(0x175)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':'POST','headers':{'Content-Type':_0x1b9fd9['ReWAi']},'body':new URLSearchParams({'client_id':_0x9befa2})});if(!_0x4a5bd2['ok']){const _0x4137c3=await _0x4a5bd2['text']();throw new Error(_0x100687(0x1aa)+_0x4a5bd2[_0x100687(0x182)]+'\x20'+_0x4137c3);}return _0x4a5bd2[_0x100687(0x197)]();}export async function pollForTokens(_0x1cab0,_0x18d416,_0x49a897,_0x4f0937){const _0x30009f=_0x40f7de,_0x3c75ca={'qKdpq':function(_0x55f831,_0x41907a){return _0x55f831*_0x41907a;},'QlBJf':function(_0x51d398,_0x271f78){return _0x51d398(_0x271f78);},'xiptc':function(_0x43d94a,_0x5f518b,_0x3cf50a){return _0x43d94a(_0x5f518b,_0x3cf50a);},'sfGqU':function(_0x181e4f,_0x51b5a1){return _0x181e4f===_0x51b5a1;}},_0x1b3dc0=Date['now']()+_0x4f0937*0x3e8;let _0x4268e2=_0x3c75ca[_0x30009f(0x18f)](_0x49a897,0x3e8);while(Date['now']()<_0x1b3dc0){await _0x3c75ca['QlBJf'](sleep,_0x4268e2);const _0x1094f7=await _0x3c75ca['xiptc'](fetch,WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x30009f(0x1ab)},'body':new URLSearchParams({'client_id':_0x1cab0,'device_code':_0x18d416,'grant_type':'urn:ietf:params:oauth:grant-type:device_code'})});if(_0x1094f7['ok'])return _0x1094f7[_0x30009f(0x197)]();const _0x35f9ff=await _0x1094f7[_0x30009f(0x197)]();if(_0x3c75ca[_0x30009f(0x1ac)](_0x35f9ff[_0x30009f(0x178)],_0x30009f(0x192)))continue;if(_0x35f9ff['error']==='slow_down'){_0x4268e2+=0x3e8;continue;}throw new Error(_0x35f9ff['error_description']||_0x35f9ff['error']||'Authentication\x20failed');}throw new Error('Device\x20authorization\x20timed\x20out');}async function fetchUserProfile(_0x4a9502){const _0x1f3a94=_0x40f7de,_0xd2d7dd={'VSOSQ':function(_0x4c427f){return _0x4c427f();},'kOCgx':function(_0x7df561,_0x4f5edf,_0x29d24){return _0x7df561(_0x4f5edf,_0x29d24);}},_0x2d93b5=_0xd2d7dd[_0x1f3a94(0x174)](getApiBaseUrl);try{const _0x2b6279=await _0xd2d7dd['kOCgx'](fetch,_0x2d93b5+_0x1f3a94(0x1b1),{'method':'GET','headers':{'workos-token':_0x4a9502}});if(_0x2b6279['ok'])return _0x2b6279[_0x1f3a94(0x197)]();}catch{}return null;}function buildKeyName(_0x3e3d57,_0x2bc998){const _0x141358=_0x40f7de,_0x17b972={'VrqbF':function(_0x51c869,_0x59b78a){return _0x51c869===_0x59b78a;},'cVPgz':function(_0x33a46b,_0x2b02eb){return _0x33a46b+_0x2b02eb;}},_0x7f7d53=_0x2bc998[_0x141358(0x189)](_0x4aed93=>_0x4aed93[_0x141358(0x19f)]===_0x3e3d57||_0x4aed93[_0x141358(0x19f)]['startsWith'](_0x3e3d57+'\x20('));if(_0x17b972['VrqbF'](_0x7f7d53['length'],0x0))return _0x3e3d57;return _0x3e3d57+'\x20('+_0x17b972[_0x141358(0x169)](_0x7f7d53['length'],0x1)+')';}export async function provisionApiKey(_0x57de90){const _0x412eae=_0x40f7de,_0x5080c7={'jDCvJ':function(_0x1e5361){return _0x1e5361();},'XoRhK':_0x412eae(0x18e),'DLbmL':function(_0x57e6a3,_0x4f5464){return _0x57e6a3(_0x4f5464);},'VJWuQ':function(_0x3c1848,_0x418d67,_0x33b26b){return _0x3c1848(_0x418d67,_0x33b26b);},'aFluE':function(_0x4a3cc2,_0x4d70d5,_0x4d43fc){return _0x4a3cc2(_0x4d70d5,_0x4d43fc);},'KAhdm':'POST','lWwgA':_0x412eae(0x16c)},_0x27dcd9=_0x5080c7['jDCvJ'](getApiBaseUrl),_0x34f607={'Content-Type':_0x5080c7['XoRhK'],'workos-token':_0x57de90},_0x2e68e3=await _0x5080c7[_0x412eae(0x1a6)](fetchUserProfile,_0x57de90),_0x528111=_0x2e68e3?.[_0x412eae(0x164)]||_0x2e68e3?.['email']?.[_0x412eae(0x16d)]('@')[0x0],_0x31a0d8=_0x528111?_0x528111+'\x27s\x20CLI\x20Key':_0x412eae(0x193);let _0x59d278=[];try{const _0xb4da6e=await _0x5080c7[_0x412eae(0x1ae)](fetch,_0x27dcd9+'/api-keys',{'method':_0x412eae(0x16a),'headers':_0x34f607});if(_0xb4da6e['ok']){const _0x3620f1=await _0xb4da6e['json']();_0x59d278=_0x3620f1['apiKeys'];}}catch{}const _0x2f699a=_0x5080c7[_0x412eae(0x1ae)](buildKeyName,_0x31a0d8,_0x59d278),_0x47a827=await _0x5080c7['aFluE'](fetch,_0x27dcd9+_0x412eae(0x17a),{'method':_0x5080c7[_0x412eae(0x1a7)],'headers':_0x34f607,'body':JSON['stringify']({'name':_0x2f699a,'scope':_0x5080c7['lWwgA']})});if(!_0x47a827['ok']){const _0x2ba160=await _0x47a827[_0x412eae(0x16f)]();throw new Error(_0x412eae(0x196)+_0x47a827['status']+'\x20'+_0x2ba160);}const _0x29f462=await _0x47a827['json']();return _0x29f462[_0x412eae(0x1a3)]['token'];}export function openBrowser(_0x221517){const _0x2bb075=_0x40f7de,_0x57e72d={'dAbHv':_0x2bb075(0x17f),'uaXdU':function(_0x363201,_0x4bed17){return _0x363201===_0x4bed17;},'blDvT':'open','EOAtk':function(_0x18075e,_0x2e72cf,_0x102901,_0x3a7ec4){return _0x18075e(_0x2e72cf,_0x102901,_0x3a7ec4);}};try{if(process['platform']===_0x2bb075(0x183)){const _0x4b69a3=spawn(_0x2bb075(0x165),['/c','start','',_0x221517],{'detached':!![],'stdio':_0x57e72d['dAbHv'],'windowsHide':!![]});_0x4b69a3['unref']();return;}const _0x5316c4=_0x57e72d['uaXdU'](process['platform'],_0x2bb075(0x1b2))?_0x57e72d['blDvT']:'xdg-open',_0x40d2cc=_0x57e72d[_0x2bb075(0x185)](spawn,_0x5316c4,[_0x221517],{'detached':!![],'stdio':_0x57e72d[_0x2bb075(0x198)]});_0x40d2cc[_0x2bb075(0x179)]();}catch{}}function decodeJwtPayload(_0x359b0a){const _0x4548a4=_0x40f7de,_0x4c14af={'iUghE':'Invalid\x20JWT\x20format'},_0x15d622=_0x359b0a[_0x4548a4(0x16d)]('.');if(_0x15d622[_0x4548a4(0x173)]!==0x3)throw new Error(_0x4c14af['iUghE']);const _0x29fe3d=Buffer[_0x4548a4(0x18b)](_0x15d622[0x1],_0x4548a4(0x1a9))[_0x4548a4(0x170)]('utf-8');return JSON['parse'](_0x29fe3d);}async function selfServeSignup(_0x2105a4){const _0x539454=_0x40f7de,_0x2d15de={'yamQJ':function(_0x1a3e64){return _0x1a3e64();},'VfWxw':'POST'},_0x41314a=_0x2d15de['yamQJ'](getApiBaseUrl),_0x105299=await fetch(_0x41314a+_0x539454(0x181),{'method':_0x2d15de['VfWxw'],'headers':{'Content-Type':'application/json','workos-token':_0x2105a4}});if(!_0x105299['ok']){const _0x2c98e5=await _0x105299[_0x539454(0x16f)]();throw new Error(_0x539454(0x19e)+_0x105299['status']+'\x20'+_0x2c98e5);}return _0x105299[_0x539454(0x197)]();}async function fetchMyMemberships(_0x32f2f8){const _0x227065=_0x40f7de,_0x5eb70e={'oboxE':function(_0x31756d,_0x1a1e39,_0x568d92){return _0x31756d(_0x1a1e39,_0x568d92);},'QONOo':'GET'},_0x5890cd=getApiBaseUrl(),_0x309423=await _0x5eb70e[_0x227065(0x17e)](fetch,_0x5890cd+'/organization/my-memberships',{'method':_0x5eb70e[_0x227065(0x180)],'headers':{'workos-token':_0x32f2f8}});if(!_0x309423['ok']){const _0x28acb2=await _0x309423['text']();throw new Error(_0x227065(0x18d)+_0x309423[_0x227065(0x182)]+'\x20'+_0x28acb2);}const _0x4cb85d=await _0x309423['json']();return _0x4cb85d['memberships'];}async function refreshTokenWithOrg(_0x58fbaf,_0x23ca22,_0x3c6a0e){const _0x295c3f=_0x40f7de,_0xc8d408={'bSHHB':_0x295c3f(0x17d),'MKkqQ':'application/x-www-form-urlencoded'},_0x582148=await fetch(WORKOS_TOKEN_URL,{'method':_0xc8d408[_0x295c3f(0x19b)],'headers':{'Content-Type':_0xc8d408['MKkqQ']},'body':new URLSearchParams({'client_id':_0x58fbaf,'grant_type':_0x295c3f(0x177),'refresh_token':_0x23ca22,'organization_id':_0x3c6a0e})});if(!_0x582148['ok']){const _0x49cd71=await _0x582148[_0x295c3f(0x16f)]();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x582148['status']+'\x20'+_0x49cd71);}return _0x582148[_0x295c3f(0x197)]();}async function provisionCliToken(_0x162261){const _0x1cf133=_0x40f7de,_0x585ad6={'CCUxq':function(_0x3faa51,_0xd75dba,_0x378ba1){return _0x3faa51(_0xd75dba,_0x378ba1);},'WDOer':'POST'},_0x4a7446=getApiBaseUrl(),_0x56c37a=await _0x585ad6['CCUxq'](fetch,_0x4a7446+_0x1cf133(0x188),{'method':_0x585ad6['WDOer'],'headers':{'Content-Type':_0x1cf133(0x18e),'workos-token':_0x162261}});if(!_0x56c37a['ok']){const _0x514016=await _0x56c37a['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x56c37a['status']+'\x20'+_0x514016);}return _0x56c37a[_0x1cf133(0x197)]();}export async function runDeviceAuthFlow(){const _0x55e484=_0x40f7de,_0x432363={'CNJAz':function(_0x5f14a0){return _0x5f14a0();},'XKzsp':'\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','GKnGz':'\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','TDyAT':function(_0x1ea595,_0x3e4702,_0x2dca9e,_0x1c056d,_0x51e9f8){return _0x1ea595(_0x3e4702,_0x2dca9e,_0x1c056d,_0x51e9f8);},'zZgUO':function(_0x5624e0,_0x53f526){return _0x5624e0(_0x53f526);},'UaTgS':'Setting\x20up\x20your\x20organization...','aQFYs':function(_0x14512a,_0x4dc955){return _0x14512a(_0x4dc955);},'jvgFq':'Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','YSUbg':'list','HVtgU':'selected','prJhW':function(_0x17fcf5,_0x52a233,_0x21e901,_0x14f3d0){return _0x17fcf5(_0x52a233,_0x21e901,_0x14f3d0);},'fzyjH':_0x55e484(0x1a2),'osiKz':function(_0x2867f6,_0x563fe7){return _0x2867f6(_0x563fe7);}},_0x2034a5=_0x432363['CNJAz'](getCurrentEnvironment),_0x4654c5=ENVIRONMENT_CONFIGS[_0x2034a5]['workosClientId'],_0x22d2e5=await requestDeviceCode(_0x4654c5);console[_0x55e484(0x186)](_0x432363[_0x55e484(0x167)]),console['log'](_0x432363['GKnGz']),openBrowser(_0x22d2e5['verification_uri_complete']),console[_0x55e484(0x186)](_0x55e484(0x1af)+_0x22d2e5[_0x55e484(0x1a1)]),console[_0x55e484(0x186)]('Code:\x20'+_0x22d2e5['user_code']+'\x0a'),process[_0x55e484(0x18c)][_0x55e484(0x1a4)](_0x55e484(0x17c));let _0x1c5f49=await _0x432363[_0x55e484(0x194)](pollForTokens,_0x4654c5,_0x22d2e5['device_code'],_0x22d2e5[_0x55e484(0x16b)],_0x22d2e5['expires_in']);console['log']('\x20✓');const _0x2612b5=_0x432363['zZgUO'](decodeJwtPayload,_0x1c5f49[_0x55e484(0x171)]);if(!_0x2612b5[_0x55e484(0x19d)]){const _0x3ea38f=await fetchMyMemberships(_0x1c5f49['access_token']);let _0x4249ac;if(_0x3ea38f[_0x55e484(0x173)]===0x0){process[_0x55e484(0x18c)][_0x55e484(0x1a4)](_0x432363[_0x55e484(0x1b3)]);const _0x4cc2f6=await _0x432363[_0x55e484(0x168)](selfServeSignup,_0x1c5f49[_0x55e484(0x171)]);_0x4249ac=_0x4cc2f6[_0x55e484(0x166)],console['log']('\x20✓');}else{if(_0x3ea38f[_0x55e484(0x173)]===0x1)_0x4249ac=_0x3ea38f[0x0][_0x55e484(0x166)],console['log'](_0x55e484(0x176)+_0x3ea38f[0x0][_0x55e484(0x19f)]);else{const _0x445e1e=process['stdin']['isTTY']&&process['stdout'][_0x55e484(0x191)];if(!_0x445e1e)throw new Error(_0x432363['jvgFq']+_0x55e484(0x187));const {selected:_0x3e7ec8}=await _0xbc9f05['prompt']([{'type':_0x432363[_0x55e484(0x1b0)],'name':_0x432363[_0x55e484(0x18a)],'message':'Select\x20an\x20organization:','choices':_0x3ea38f[_0x55e484(0x1a0)](_0x4d62ee=>({'name':_0x4d62ee[_0x55e484(0x19f)],'value':_0x4d62ee[_0x55e484(0x166)]}))}]);_0x4249ac=_0x3e7ec8;}}_0x1c5f49=await _0x432363['prJhW'](refreshTokenWithOrg,_0x4654c5,_0x1c5f49[_0x55e484(0x177)],_0x4249ac);}process[_0x55e484(0x18c)][_0x55e484(0x1a4)](_0x432363[_0x55e484(0x17b)]);const _0x3aad9d=await _0x432363[_0x55e484(0x168)](provisionCliToken,_0x1c5f49['access_token']);return console[_0x55e484(0x186)]('\x20✓'),await _0x432363[_0x55e484(0x16e)](storeToken,_0x3aad9d['token']),_0x1c5f49['refresh_token']&&await storeRefreshToken(_0x1c5f49[_0x55e484(0x177)]),_0x3aad9d[_0x55e484(0x19c)];}function sleep(_0x187638){return new Promise(_0x42c42a=>setTimeout(_0x42c42a,_0x187638));}function _0x32e1(){const _0x39f029=['POST','oboxE','ignore','QONOo','/organization/self-serve-signup','status','win32','368922GMUOtj','EOAtk','log','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','/cli-auth/token','filter','HVtgU','from','stdout','Failed\x20to\x20fetch\x20memberships:\x20','application/json','qKdpq','103858QXXrnB','isTTY','authorization_pending','CLI\x20Key','TDyAT','11485992BmXSpV','Failed\x20to\x20provision\x20API\x20key:\x20','json','dAbHv','14015992vhKfER','809210wYfmMt','bSHHB','token','org_id','Failed\x20to\x20create\x20organization:\x20','name','map','verification_uri_complete','Provisioning\x20CLI\x20token...','apiKey','write','2870880RCauhZ','DLbmL','KAhdm','https://api.workos.com/user_management/authorize/device','base64url','Failed\x20to\x20request\x20device\x20code:\x20','application/x-www-form-urlencoded','sfGqU','165396oLoOqd','VJWuQ','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','YSUbg','/organization/me','darwin','UaTgS','https://api.workos.com/user_management/authenticate','firstName','cmd','organizationId','XKzsp','aQFYs','cVPgz','GET','interval','mcp:write','split','osiKz','text','toString','access_token','44jFlgef','length','VSOSQ','FjcEC','Using\x20organization:\x20','refresh_token','error','unref','/api-keys','fzyjH','Waiting\x20for\x20authentication...'];_0x32e1=function(){return _0x39f029;};return _0x32e1();}
|
|
1
|
+
const _0x321e2f=_0x22ae;(function(_0x2075fe,_0x421a71){const _0x4f0b39=_0x22ae,_0x3b02a0=_0x2075fe();while(!![]){try{const _0x1ed207=parseInt(_0x4f0b39(0x1c2))/0x1*(parseInt(_0x4f0b39(0x1b8))/0x2)+-parseInt(_0x4f0b39(0x199))/0x3*(parseInt(_0x4f0b39(0x1b6))/0x4)+-parseInt(_0x4f0b39(0x1e5))/0x5*(parseInt(_0x4f0b39(0x19b))/0x6)+parseInt(_0x4f0b39(0x18e))/0x7+-parseInt(_0x4f0b39(0x19f))/0x8+-parseInt(_0x4f0b39(0x1b2))/0x9*(-parseInt(_0x4f0b39(0x1a0))/0xa)+-parseInt(_0x4f0b39(0x1b3))/0xb*(-parseInt(_0x4f0b39(0x1c9))/0xc);if(_0x1ed207===_0x421a71)break;else _0x3b02a0['push'](_0x3b02a0['shift']());}catch(_0x159203){_0x3b02a0['push'](_0x3b02a0['shift']());}}}(_0x5bab,0x833f8));import{spawn}from'child_process';import _0xcc9e5e 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=_0x321e2f(0x1bd);function _0x5bab(){const _0x569ec0=['Provisioning\x20CLI\x20token...','prompt','error','startsWith','392769YxSdeX','6257779uDdKTD','length','ABBKu','4LlqDeO','unref','578tunORU','oFRIr','stdout','TXbEK','lsMXZ','https://api.workos.com/user_management/authenticate','status','urn:ietf:params:oauth:grant-type:device_code','write','toString','7XoQSIt','\x20\x20\x20A\x20human\x20needs\x20to\x20complete\x20authentication\x20in\x20the\x20browser.\x0a','split','pXJtg','access_token','Failed\x20to\x20request\x20device\x20code:\x20','platform','36yVVjax','tntiM','isTTY','start','text','If\x20the\x20browser\x20doesn\x27t\x20open,\x20visit:\x20','token','pgsmL','oDlKI','apiKeys','HXOXY','LQPHR','verification_uri_complete','apiKey','oAINE','org_id','open','/cli-auth/token','refresh_token','memberships','GET','filter','Multiple\x20organizations\x20available\x20but\x20cannot\x20prompt\x20for\x20selection\x20in\x20non-interactive\x20mode.\x0a','Failed\x20to\x20create\x20organization:\x20','Use:\x20ranger\x20setup\x20[token]\x20or\x20set\x20RANGER_CLI_TOKEN.','BwenA','/organization/me','json','2805975lTNpFB','list','user_code','utf-8','3067134LzbFBE','name','POST','\x0a🔐\x20Opening\x20browser\x20to\x20log\x20in...','mcp:write','\x27s\x20CLI\x20Key','Failed\x20to\x20provision\x20API\x20key:\x20','application/x-www-form-urlencoded','stringify','/api-keys','WrWBB','2827131FvoSyH','stdin','6GRAILX','Authentication\x20failed','UyVTh','xdg-open','5035040jNmStJ','120qkJoOh','RClPI','MiwbA','cIZiy','Waiting\x20for\x20authentication...','cmd','organizationId','selected','Setting\x20up\x20your\x20organization...','from','win32','log','FbJQC','now'];_0x5bab=function(){return _0x569ec0;};return _0x5bab();}export async function requestDeviceCode(_0x2a2340){const _0x4ce377=_0x321e2f,_0x423a44={'LQPHR':function(_0x4bcf58,_0x100cf4,_0x1885f7){return _0x4bcf58(_0x100cf4,_0x1885f7);},'CwXJv':_0x4ce377(0x190)},_0x328926=await _0x423a44[_0x4ce377(0x1d4)](fetch,WORKOS_DEVICE_AUTH_URL,{'method':_0x423a44['CwXJv'],'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x2a2340})});if(!_0x328926['ok']){const _0xe1982b=await _0x328926['text']();throw new Error(_0x4ce377(0x1c7)+_0x328926[_0x4ce377(0x1be)]+'\x20'+_0xe1982b);}return _0x328926[_0x4ce377(0x1e4)]();}export async function pollForTokens(_0x2f7157,_0xbab48b,_0x422577,_0x130daa){const _0x4e886b=_0x321e2f,_0x46fcb4={'WrWBB':function(_0x47619d,_0x11a838){return _0x47619d+_0x11a838;},'tntiM':function(_0x25f618,_0x15f654){return _0x25f618*_0x15f654;},'Rgkxg':function(_0x2fb9ff,_0x5923a8){return _0x2fb9ff(_0x5923a8);},'oAINE':function(_0x278972,_0x387f88){return _0x278972===_0x387f88;},'pXJtg':'slow_down','RClPI':'Device\x20authorization\x20timed\x20out'},_0x386b9d=_0x46fcb4[_0x4e886b(0x198)](Date[_0x4e886b(0x1ad)](),_0x130daa*0x3e8);let _0x5bcaa5=_0x46fcb4[_0x4e886b(0x1ca)](_0x422577,0x3e8);while(Date[_0x4e886b(0x1ad)]()<_0x386b9d){await _0x46fcb4['Rgkxg'](sleep,_0x5bcaa5);const _0x19093a=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':new URLSearchParams({'client_id':_0x2f7157,'device_code':_0xbab48b,'grant_type':_0x4e886b(0x1bf)})});if(_0x19093a['ok'])return _0x19093a[_0x4e886b(0x1e4)]();const _0x36e07a=await _0x19093a['json']();if(_0x46fcb4[_0x4e886b(0x1d7)](_0x36e07a[_0x4e886b(0x1b0)],'authorization_pending'))continue;if(_0x46fcb4[_0x4e886b(0x1d7)](_0x36e07a[_0x4e886b(0x1b0)],_0x46fcb4[_0x4e886b(0x1c5)])){_0x5bcaa5+=0x3e8;continue;}throw new Error(_0x36e07a['error_description']||_0x36e07a['error']||_0x4e886b(0x19c));}throw new Error(_0x46fcb4[_0x4e886b(0x1a1)]);}async function fetchUserProfile(_0x437be5){const _0x4fdeea=_0x321e2f,_0x241770=getApiBaseUrl();try{const _0x168427=await fetch(_0x241770+_0x4fdeea(0x1e3),{'method':_0x4fdeea(0x1dd),'headers':{'workos-token':_0x437be5}});if(_0x168427['ok'])return _0x168427[_0x4fdeea(0x1e4)]();}catch{}return null;}function buildKeyName(_0x3bb9b1,_0x4e9fa3){const _0x575d8e=_0x321e2f,_0x4cc3d2={'jonzU':function(_0x474ce4,_0x24ff18){return _0x474ce4===_0x24ff18;},'cIZiy':function(_0x33c63f,_0x24f50e){return _0x33c63f+_0x24f50e;}},_0x4567b3=_0x4e9fa3[_0x575d8e(0x1de)](_0x42e82b=>_0x42e82b['name']===_0x3bb9b1||_0x42e82b[_0x575d8e(0x18f)][_0x575d8e(0x1b1)](_0x3bb9b1+'\x20('));if(_0x4cc3d2['jonzU'](_0x4567b3['length'],0x0))return _0x3bb9b1;return _0x3bb9b1+'\x20('+_0x4cc3d2[_0x575d8e(0x1a3)](_0x4567b3[_0x575d8e(0x1b4)],0x1)+')';}export async function provisionApiKey(_0xb49265){const _0x34fe9b=_0x321e2f,_0x25c8c4={'dhYcl':function(_0x3705ac){return _0x3705ac();},'FbJQC':'application/json','MiwbA':function(_0x4f4614,_0x4d13f5){return _0x4f4614(_0x4d13f5);},'TXbEK':_0x34fe9b(0x190),'HXOXY':_0x34fe9b(0x192)},_0x3d2ac9=_0x25c8c4['dhYcl'](getApiBaseUrl),_0x39938c={'Content-Type':_0x25c8c4[_0x34fe9b(0x1ac)],'workos-token':_0xb49265},_0xb266e3=await _0x25c8c4[_0x34fe9b(0x1a2)](fetchUserProfile,_0xb49265),_0x24fc06=_0xb266e3?.['firstName']||_0xb266e3?.['email']?.['split']('@')[0x0],_0x2cbd79=_0x24fc06?_0x24fc06+_0x34fe9b(0x193):'CLI\x20Key';let _0x1e3613=[];try{const _0x3d2965=await fetch(_0x3d2ac9+_0x34fe9b(0x197),{'method':_0x34fe9b(0x1dd),'headers':_0x39938c});if(_0x3d2965['ok']){const _0x3a0445=await _0x3d2965['json']();_0x1e3613=_0x3a0445[_0x34fe9b(0x1d2)];}}catch{}const _0x1d76fb=buildKeyName(_0x2cbd79,_0x1e3613),_0x26ca7e=await fetch(_0x3d2ac9+'/api-keys',{'method':_0x25c8c4[_0x34fe9b(0x1bb)],'headers':_0x39938c,'body':JSON[_0x34fe9b(0x196)]({'name':_0x1d76fb,'scope':_0x25c8c4[_0x34fe9b(0x1d3)]})});if(!_0x26ca7e['ok']){const _0x5588de=await _0x26ca7e[_0x34fe9b(0x1cd)]();throw new Error(_0x34fe9b(0x194)+_0x26ca7e[_0x34fe9b(0x1be)]+'\x20'+_0x5588de);}const _0x2c3191=await _0x26ca7e['json']();return _0x2c3191[_0x34fe9b(0x1d6)][_0x34fe9b(0x1cf)];}export function openBrowser(_0x1d526e){const _0x11b4fd=_0x321e2f,_0x2b2c15={'oFRIr':_0x11b4fd(0x1aa),'Znycr':function(_0x689213,_0x17d86f,_0x262ba3,_0x2f1f4a){return _0x689213(_0x17d86f,_0x262ba3,_0x2f1f4a);},'nghOJ':_0x11b4fd(0x1a5),'OkweF':'ignore'};try{if(process[_0x11b4fd(0x1c8)]===_0x2b2c15[_0x11b4fd(0x1b9)]){const _0xa2e88d=_0x2b2c15['Znycr'](spawn,_0x2b2c15['nghOJ'],['/c',_0x11b4fd(0x1cc),'',_0x1d526e],{'detached':!![],'stdio':_0x2b2c15['OkweF'],'windowsHide':!![]});_0xa2e88d[_0x11b4fd(0x1b7)]();return;}const _0xdb48e4=process['platform']==='darwin'?_0x11b4fd(0x1d9):_0x11b4fd(0x19e),_0x3b20ef=spawn(_0xdb48e4,[_0x1d526e],{'detached':!![],'stdio':_0x2b2c15['OkweF']});_0x3b20ef[_0x11b4fd(0x1b7)]();}catch{}}function decodeJwtPayload(_0x24588e){const _0x351e2e=_0x321e2f,_0x1ebbaf={'vLPyV':'Invalid\x20JWT\x20format','wpIvg':'base64url'},_0x4cc883=_0x24588e[_0x351e2e(0x1c4)]('.');if(_0x4cc883['length']!==0x3)throw new Error(_0x1ebbaf['vLPyV']);const _0x586117=Buffer[_0x351e2e(0x1a9)](_0x4cc883[0x1],_0x1ebbaf['wpIvg'])[_0x351e2e(0x1c1)](_0x351e2e(0x18d));return JSON['parse'](_0x586117);}async function selfServeSignup(_0x541d2a){const _0x1b76af=_0x321e2f,_0x21b1ea={'nrLxb':function(_0x40686e){return _0x40686e();},'pgsmL':function(_0x457064,_0x507529,_0x4eddce){return _0x457064(_0x507529,_0x4eddce);}},_0x207501=_0x21b1ea['nrLxb'](getApiBaseUrl),_0x33d20b=await _0x21b1ea[_0x1b76af(0x1d0)](fetch,_0x207501+'/organization/self-serve-signup',{'method':'POST','headers':{'Content-Type':'application/json','workos-token':_0x541d2a}});if(!_0x33d20b['ok']){const _0xcd3c3b=await _0x33d20b[_0x1b76af(0x1cd)]();throw new Error(_0x1b76af(0x1e0)+_0x33d20b[_0x1b76af(0x1be)]+'\x20'+_0xcd3c3b);}return _0x33d20b['json']();}async function fetchMyMemberships(_0x5deeeb){const _0x3c21e9=_0x321e2f,_0x4b4326={'vrvfa':function(_0x345ae6,_0x32405b,_0x537a93){return _0x345ae6(_0x32405b,_0x537a93);}},_0x460a3f=getApiBaseUrl(),_0x1b0d2d=await _0x4b4326['vrvfa'](fetch,_0x460a3f+'/organization/my-memberships',{'method':'GET','headers':{'workos-token':_0x5deeeb}});if(!_0x1b0d2d['ok']){const _0x21241f=await _0x1b0d2d[_0x3c21e9(0x1cd)]();throw new Error('Failed\x20to\x20fetch\x20memberships:\x20'+_0x1b0d2d['status']+'\x20'+_0x21241f);}const _0x6da1ee=await _0x1b0d2d[_0x3c21e9(0x1e4)]();return _0x6da1ee[_0x3c21e9(0x1dc)];}function _0x22ae(_0x192d3e,_0x41ded8){_0x192d3e=_0x192d3e-0x18c;const _0x5babf5=_0x5bab();let _0x22ae80=_0x5babf5[_0x192d3e];return _0x22ae80;}async function refreshTokenWithOrg(_0x215378,_0x44bed8,_0x4b065c){const _0x4408b9=_0x321e2f,_0x22afdd=await fetch(WORKOS_TOKEN_URL,{'method':'POST','headers':{'Content-Type':_0x4408b9(0x195)},'body':new URLSearchParams({'client_id':_0x215378,'grant_type':_0x4408b9(0x1db),'refresh_token':_0x44bed8,'organization_id':_0x4b065c})});if(!_0x22afdd['ok']){const _0x510f2b=await _0x22afdd['text']();throw new Error('Failed\x20to\x20refresh\x20token\x20with\x20org:\x20'+_0x22afdd[_0x4408b9(0x1be)]+'\x20'+_0x510f2b);}return _0x22afdd['json']();}async function provisionCliToken(_0x346db6){const _0x5aa2a3=_0x321e2f,_0x3f6e17={'UyVTh':function(_0x49b457){return _0x49b457();},'XoVOx':function(_0x473481,_0x6e48fa,_0xffa19a){return _0x473481(_0x6e48fa,_0xffa19a);}},_0x526e77=_0x3f6e17[_0x5aa2a3(0x19d)](getApiBaseUrl),_0x7c1846=await _0x3f6e17['XoVOx'](fetch,_0x526e77+_0x5aa2a3(0x1da),{'method':_0x5aa2a3(0x190),'headers':{'Content-Type':'application/json','workos-token':_0x346db6}});if(!_0x7c1846['ok']){const _0x276f52=await _0x7c1846['text']();throw new Error('Failed\x20to\x20provision\x20CLI\x20token:\x20'+_0x7c1846[_0x5aa2a3(0x1be)]+'\x20'+_0x276f52);}return _0x7c1846['json']();}export async function runDeviceAuthFlow(){const _0x411366=_0x321e2f,_0x5ae87b={'UeOyw':function(_0x35d465,_0x24f1bd){return _0x35d465(_0x24f1bd);},'Bwkmv':_0x411366(0x1c3),'lsMXZ':_0x411366(0x1e1),'BwenA':_0x411366(0x1a7),'ABBKu':'Select\x20an\x20organization:','qTUDH':_0x411366(0x1ae),'oDlKI':function(_0x47a508,_0x360f1d){return _0x47a508(_0x360f1d);}},_0x4bbd1e=getCurrentEnvironment(),_0x5c75c6=ENVIRONMENT_CONFIGS[_0x4bbd1e]['workosClientId'],_0x1f9320=await _0x5ae87b['UeOyw'](requestDeviceCode,_0x5c75c6);console[_0x411366(0x1ab)](_0x411366(0x191)),console['log'](_0x5ae87b['Bwkmv']),openBrowser(_0x1f9320[_0x411366(0x1d5)]),console['log'](_0x411366(0x1ce)+_0x1f9320['verification_uri_complete']),console['log']('Code:\x20'+_0x1f9320[_0x411366(0x18c)]+'\x0a'),process[_0x411366(0x1ba)]['write'](_0x411366(0x1a4));let _0x4db8ea=await pollForTokens(_0x5c75c6,_0x1f9320['device_code'],_0x1f9320['interval'],_0x1f9320['expires_in']);console['log']('\x20✓');const _0x487711=_0x5ae87b['UeOyw'](decodeJwtPayload,_0x4db8ea['access_token']);if(!_0x487711[_0x411366(0x1d8)]){const _0x12bcf5=await fetchMyMemberships(_0x4db8ea[_0x411366(0x1c6)]);let _0x465508;if(_0x12bcf5[_0x411366(0x1b4)]===0x0){process[_0x411366(0x1ba)][_0x411366(0x1c0)](_0x411366(0x1a8));const _0x136ca6=await selfServeSignup(_0x4db8ea[_0x411366(0x1c6)]);_0x465508=_0x136ca6[_0x411366(0x1a6)],console['log']('\x20✓');}else{if(_0x12bcf5[_0x411366(0x1b4)]===0x1)_0x465508=_0x12bcf5[0x0][_0x411366(0x1a6)],console[_0x411366(0x1ab)]('Using\x20organization:\x20'+_0x12bcf5[0x0][_0x411366(0x18f)]);else{const _0x2a3c57=process[_0x411366(0x19a)][_0x411366(0x1cb)]&&process[_0x411366(0x1ba)][_0x411366(0x1cb)];if(!_0x2a3c57)throw new Error(_0x411366(0x1df)+_0x5ae87b[_0x411366(0x1bc)]);const {selected:_0x36a413}=await _0xcc9e5e[_0x411366(0x1af)]([{'type':_0x411366(0x1e6),'name':_0x5ae87b[_0x411366(0x1e2)],'message':_0x5ae87b[_0x411366(0x1b5)],'choices':_0x12bcf5['map'](_0x280be2=>({'name':_0x280be2['name'],'value':_0x280be2['organizationId']}))}]);_0x465508=_0x36a413;}}_0x4db8ea=await refreshTokenWithOrg(_0x5c75c6,_0x4db8ea['refresh_token'],_0x465508);}process['stdout']['write'](_0x5ae87b['qTUDH']);const _0x516cb5=await _0x5ae87b[_0x411366(0x1d1)](provisionCliToken,_0x4db8ea[_0x411366(0x1c6)]);return console['log']('\x20✓'),await storeToken(_0x516cb5[_0x411366(0x1cf)]),_0x4db8ea[_0x411366(0x1db)]&&await storeRefreshToken(_0x4db8ea[_0x411366(0x1db)]),_0x516cb5['token'];}function sleep(_0x597c00){return new Promise(_0x27151d=>setTimeout(_0x27151d,_0x597c00));}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const _0x206b5e=_0x27d6;(function(_0x423000,_0x5338bc){const _0x5ae56a=_0x27d6,_0x13d5d5=_0x423000();while(!![]){try{const _0x1cc9f8=parseInt(_0x5ae56a(0x1b7))/0x1+parseInt(_0x5ae56a(0x1bb))/0x2*(parseInt(_0x5ae56a(0x1b0))/0x3)+-parseInt(_0x5ae56a(0x1d3))/0x4+parseInt(_0x5ae56a(0x1c3))/0x5+-parseInt(_0x5ae56a(0x1ba))/0x6+parseInt(_0x5ae56a(0x1c4))/0x7+-parseInt(_0x5ae56a(0x1cf))/0x8;if(_0x1cc9f8===_0x5338bc)break;else _0x13d5d5['push'](_0x13d5d5['shift']());}catch(_0x12f5ab){_0x13d5d5['push'](_0x13d5d5['shift']());}}}(_0x5110,0xdb234));export const ENVIRONMENT_CONFIGS={'prod':{'apiBaseUrl':_0x206b5e(0x1c2),'workosClientId':_0x206b5e(0x1b3),'aiProxyUrl':'https://ai-proxy-716115358910.us-central1.run.app','mcpAuthUrl':_0x206b5e(0x1dc)},'staging':{'apiBaseUrl':'https://api.staging.ranger.net','workosClientId':_0x206b5e(0x1c7),'aiProxyUrl':'https://ai-proxy-301751771437.us-central1.run.app','mcpAuthUrl':_0x206b5e(0x1b2)},'local':{'apiBaseUrl':_0x206b5e(0x1ca),'workosClientId':_0x206b5e(0x1c7),'aiProxyUrl':'http://localhost:8090','mcpAuthUrl':'http://localhost:8080/mcp'}};export const DEFAULT_ENVIRONMENT=_0x206b5e(0x1c0);export function isValidEnvironment(_0x311eeb){const _0x5c2614=_0x206b5e,_0x259e29={'GZbUA':_0x5c2614(0x1c0),'wuSbw':'staging','dQBIT':'local'};return _0x311eeb===_0x259e29['GZbUA']||_0x311eeb===_0x259e29[_0x5c2614(0x1d6)]||_0x311eeb===_0x259e29[_0x5c2614(0x1d5)];}export function getCurrentEnvironment(){const _0x3ea59f=_0x206b5e,_0x2d2b25={'oELKR':function(_0x395dec,_0x44bfe4){return _0x395dec(_0x44bfe4);}},_0x48904b=process[_0x3ea59f(0x1b8)][_0x3ea59f(0x1d4)];if(_0x48904b&&_0x2d2b25[_0x3ea59f(0x1c9)](isValidEnvironment,_0x48904b))return _0x48904b;return DEFAULT_ENVIRONMENT;}export function getApiBaseUrl(){const _0x4d357a=_0x206b5e,_0x333dbc={'sCXOV':function(_0x55e57f){return _0x55e57f();}};return ENVIRONMENT_CONFIGS[_0x333dbc[_0x4d357a(0x1bc)](getCurrentEnvironment)][_0x4d357a(0x1c6)];}export function getAiProxyUrl(){const _0x2891ca={'nhCRT':function(_0x5d1229){return _0x5d1229();}};return ENVIRONMENT_CONFIGS[_0x2891ca['nhCRT'](getCurrentEnvironment)]['aiProxyUrl'];}export function getMcpAuthUrl(){const _0x259ac5=_0x206b5e;return process[_0x259ac5(0x1b8)]['RANGER_MCP_AUTH_URL']??ENVIRONMENT_CONFIGS[getCurrentEnvironment()][_0x259ac5(0x1d0)];}function _0x27d6(_0x54bff6,_0x15a2dc){_0x54bff6=_0x54bff6-0x1b0;const _0x51103c=_0x5110();let _0x27d67c=_0x51103c[_0x54bff6];return _0x27d67c;}export function isByokEnabled(){const _0x1edbf4=_0x206b5e,_0x1c1b8d={'jqehT':function(_0x829ead,_0x462d01){return _0x829ead===_0x462d01;}};return _0x1c1b8d['jqehT'](process[_0x1edbf4(0x1b8)]['RANGER_BYOK'],_0x1edbf4(0x1c1));}function _0x5110(){const _0xa987d0=['http://localhost:8080','toLowerCase','Yjugb','ocpvW','\x22.\x20','3962424knQEYO','mcpAuthUrl','mcp','nova-act-cli','5047316AIpwhE','RANGER_CLI_ENV','dQBIT','wuSbw','POFTy','QiIze','okfcN','aGnrk','RANGER_USE_NOVA_ACT','https://mcp-auth.ranger.net/mcp','21CcBMIZ','[ranger]\x20Ignoring\x20invalid\x20RANGER_HOOKS=\x22','https://mcp-auth.staging.ranger.net/mcp','client_01J9CBYM7M5ZETCF7G6614DXR2','auto','YvwkD','find','1290327rlvskm','env','\x20is\x20no\x20longer\x20supported.\x20Use\x20RANGER_TRANSPORT=mcp,\x20RANGER_TRANSPORT=playwright-cli,\x20RANGER_TRANSPORT=nova-act-cli,\x20or\x20RANGER_TRANSPORT=rangerwright-cli.','8666220PtJxjt','4124iVTRNL','sCXOV','\x22.\x20Expected\x20one\x20of:\x20mcp,\x20playwright-cli,\x20nova-act-cli,\x20rangerwright-cli.','trim','RANGER_HOOKS','prod','true','https://api.ranger.net','6370290uMgcRV','10641897vhJMPn','off','apiBaseUrl','client_01J9CBYM2DKWV9HM17D95Z540K','rangerwright-cli','oELKR'];_0x5110=function(){return _0xa987d0;};return _0x5110();}function isVerificationTransport(_0x2b4327){const _0x38b5fd=_0x206b5e,_0x2e78a0={'okfcN':function(_0x305dda,_0x4d842c){return _0x305dda===_0x4d842c;},'Yjugb':'mcp','QiIze':function(_0x32be42,_0x399928){return _0x32be42===_0x399928;},'oHRsy':'playwright-cli','aGnrk':_0x38b5fd(0x1d2),'ocpvW':_0x38b5fd(0x1c8)};return _0x2e78a0[_0x38b5fd(0x1d9)](_0x2b4327,_0x2e78a0[_0x38b5fd(0x1cc)])||_0x2e78a0[_0x38b5fd(0x1d8)](_0x2b4327,_0x2e78a0['oHRsy'])||_0x2b4327===_0x2e78a0[_0x38b5fd(0x1da)]||_0x2b4327===_0x2e78a0[_0x38b5fd(0x1cd)];}const LEGACY_TRANSPORT_ENV_VARS=[_0x206b5e(0x1db),'RANGER_DISABLE_MCP'];export function getVerificationTransport(){const _0x41b054=_0x206b5e,_0x1215e2={'uMPSK':function(_0x343984,_0x10f80a){return _0x343984(_0x10f80a);},'YvwkD':_0x41b054(0x1d1)},_0x519bdb=process[_0x41b054(0x1b8)]['RANGER_TRANSPORT']?.['trim']();if(_0x519bdb){if(_0x1215e2['uMPSK'](isVerificationTransport,_0x519bdb))return _0x519bdb;throw new Error('Invalid\x20RANGER_TRANSPORT=\x22'+_0x519bdb+_0x41b054(0x1bd));}const _0x4b229d=LEGACY_TRANSPORT_ENV_VARS[_0x41b054(0x1b6)](_0x51298c=>process['env'][_0x51298c]);if(_0x4b229d)throw new Error(_0x4b229d+_0x41b054(0x1b9));return _0x1215e2[_0x41b054(0x1b5)];}export function resolveHookMode(_0x477e6c=process['env']){const _0x339a71=_0x206b5e,_0x1c4a3c={'POFTy':_0x339a71(0x1b4),'LXHMI':_0x339a71(0x1c5),'HgSRf':function(_0x28ac20,_0x8dc7c2){return _0x28ac20===_0x8dc7c2;},'BXHcJ':function(_0x57c421,_0x16227f){return _0x57c421===_0x16227f;}},_0x38df3e=_0x477e6c[_0x339a71(0x1bf)]?.[_0x339a71(0x1be)]()[_0x339a71(0x1cb)]();if(!_0x38df3e)return _0x1c4a3c[_0x339a71(0x1d7)];if(_0x38df3e===_0x1c4a3c['LXHMI']||_0x1c4a3c['HgSRf'](_0x38df3e,'on')||_0x1c4a3c['BXHcJ'](_0x38df3e,_0x1c4a3c['POFTy']))return _0x38df3e;return console['error'](_0x339a71(0x1b1)+_0x477e6c[_0x339a71(0x1bf)]+_0x339a71(0x1ce)+'Expected\x20one\x20of:\x20off,\x20on,\x20auto.\x20Defaulting\x20to\x20auto.'),_0x1c4a3c['POFTy'];}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(_0x3348ba,_0x653be3){const _0x2656b4=_0x1adc,_0x4f8df9=_0x3348ba();while(!![]){try{const _0x1b2ac8=-parseInt(_0x2656b4(0x152))/0x1*(-parseInt(_0x2656b4(0x17e))/0x2)+parseInt(_0x2656b4(0x168))/0x3+parseInt(_0x2656b4(0x139))/0x4*(-parseInt(_0x2656b4(0x17d))/0x5)+parseInt(_0x2656b4(0x13a))/0x6+-parseInt(_0x2656b4(0x16d))/0x7+-parseInt(_0x2656b4(0x16b))/0x8*(-parseInt(_0x2656b4(0x169))/0x9)+-parseInt(_0x2656b4(0x143))/0xa*(-parseInt(_0x2656b4(0x13f))/0xb);if(_0x1b2ac8===_0x653be3)break;else _0x4f8df9['push'](_0x4f8df9['shift']());}catch(_0xa9e6eb){_0x4f8df9['push'](_0x4f8df9['shift']());}}}(_0x2877,0xf335e));function _0x2877(){const _0x49074a=['json','Feature\x20limit\x20exceeded','93407BWOnoZ','QLyMu','GET','toString','kdPok','Lqxub','jhwoE','LmwHj','sNzml','Failed\x20to\x20conclude\x20session:\x20','/report/markdown','pcvIN','stringify','limit','/conclude','zCOHn','nxOJe','xrazM','zjUHv','/sessions/','Bearer\x20','/sessions','4218903sSAFCx','9uGIkiE','/restore','3432128rhNcZT','GzXfa','13602729eKvFdu','itemIds','QQFOw','POST','mrucw','dKYsc','/action-items','SSJPk','DyziP','status','updateChecklistItem','Failed\x20to\x20list\x20sessions:\x20','/api/v1/mcp/features','text','klJKL','jnlBI','10CxrQjP','12FJVeMu','hpufn','uZjMK','set','https://dashboard.ranger.net/billing','843204MiSpag','1141170QNSYbH','gitRepoUrl','gitBranch','/start','/api/v1/mcp/features/','11sAiFzp','style','application/json','kdFlH','7750850GtBdfD','Failed\x20to\x20update\x20feature\x20review:\x20','offset','VXcVM','sessionId','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20','fUeQE','ioRhB','wZOME','includeDeleted','PATCH','/comments/address'];_0x2877=function(){return _0x49074a;};return _0x2877();}import{getToken}from'./keychain.js';import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';function _0x1adc(_0x1c5e90,_0x567c72){_0x1c5e90=_0x1c5e90-0x137;const _0x28779f=_0x2877();let _0x1adc97=_0x28779f[_0x1c5e90];return _0x1adc97;}export async function createFeature(_0x3a78b4){const _0x3941e6=_0x1adc,_0xad874e={'VXcVM':function(_0x4a9b51){return _0x4a9b51();},'SSJPk':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','QQFOw':_0x3941e6(0x141),'hpufn':function(_0x31a100,_0x5b071a){return _0x31a100===_0x5b071a;}},_0x417288=await _0xad874e[_0x3941e6(0x146)](getToken);if(!_0x417288)throw new Error(_0xad874e[_0x3941e6(0x174)]);const _0x586815=getApiBaseUrl(),_0x171277=await fetch(_0x586815+_0x3941e6(0x179),{'method':_0x3941e6(0x170),'headers':{'Authorization':'Bearer\x20'+_0x417288,'Content-Type':_0xad874e[_0x3941e6(0x16f)]},'body':JSON[_0x3941e6(0x15e)](_0x3a78b4)});if(!_0x171277['ok']){if(_0xad874e[_0x3941e6(0x17f)](_0x171277[_0x3941e6(0x176)],0x192)){const _0x47598b=await _0x171277[_0x3941e6(0x150)](),_0x4cfde4=_0x47598b['billingUrl']||_0x3941e6(0x138);throw new Error((_0x47598b['message']||_0x3941e6(0x151))+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x4cfde4);}const _0x56f53c=await _0x171277[_0x3941e6(0x17a)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x56f53c);}return _0x171277[_0x3941e6(0x150)]();}export async function listFeatures(_0x248d69){const _0x175a38=_0x1adc,_0x574d65={'Lqxub':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','kdFlH':_0x175a38(0x13b),'klJKL':_0x175a38(0x15f),'rwVDV':_0x175a38(0x145),'pcvIN':function(_0x4ed2de,_0x5affc4,_0x1d7239){return _0x4ed2de(_0x5affc4,_0x1d7239);}},_0x34b539=await getToken();if(!_0x34b539)throw new Error(_0x574d65[_0x175a38(0x157)]);const _0x3cd001=getApiBaseUrl(),_0x147383=new URLSearchParams();if(_0x248d69?.[_0x175a38(0x13b)])_0x147383[_0x175a38(0x137)](_0x574d65[_0x175a38(0x142)],_0x248d69['gitRepoUrl']);if(_0x248d69?.[_0x175a38(0x13c)])_0x147383['set']('gitBranch',_0x248d69['gitBranch']);if(_0x248d69?.[_0x175a38(0x15f)])_0x147383['set'](_0x574d65[_0x175a38(0x17b)],_0x248d69[_0x175a38(0x15f)]['toString']());if(_0x248d69?.[_0x175a38(0x145)])_0x147383['set'](_0x574d65['rwVDV'],_0x248d69['offset']['toString']());if(_0x248d69?.[_0x175a38(0x14d)])_0x147383['set'](_0x175a38(0x14d),'true');const _0x1d6970=_0x3cd001+_0x175a38(0x179)+(_0x147383['toString']()?'?'+_0x147383['toString']():''),_0x496e6f=await _0x574d65[_0x175a38(0x15d)](fetch,_0x1d6970,{'method':_0x175a38(0x154),'headers':{'Authorization':_0x175a38(0x166)+_0x34b539}});if(!_0x496e6f['ok']){const _0x23a93=await _0x496e6f[_0x175a38(0x17a)]();throw new Error('Failed\x20to\x20list\x20feature\x20reviews:\x20'+_0x23a93);}return _0x496e6f['json']();}export async function getFeature(_0x4856ec){const _0x28d5e0=_0x1adc,_0x55bea9={'xrazM':_0x28d5e0(0x148)},_0x230092=await getToken();if(!_0x230092)throw new Error(_0x55bea9[_0x28d5e0(0x163)]);const _0x569f62=getApiBaseUrl(),_0x4b0ac6=await fetch(_0x569f62+_0x28d5e0(0x13e)+_0x4856ec,{'method':'GET','headers':{'Authorization':_0x28d5e0(0x166)+_0x230092}});if(!_0x4b0ac6['ok']){const _0x5b8fb5=await _0x4b0ac6[_0x28d5e0(0x17a)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x5b8fb5);}return _0x4b0ac6[_0x28d5e0(0x150)]();}export async function updateFeature(_0x21b444,_0x3d5a8c){const _0xa503f2=_0x1adc,_0x29abd8={'nxOJe':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','sPbBL':function(_0x386d3b,_0x575086,_0x5e70e1){return _0x386d3b(_0x575086,_0x5e70e1);}},_0x53c6e3=await getToken();if(!_0x53c6e3)throw new Error(_0x29abd8[_0xa503f2(0x162)]);const _0x44f42d=getApiBaseUrl(),_0x5e22f5=await _0x29abd8['sPbBL'](fetch,_0x44f42d+_0xa503f2(0x13e)+_0x21b444,{'method':_0xa503f2(0x14e),'headers':{'Authorization':'Bearer\x20'+_0x53c6e3,'Content-Type':_0xa503f2(0x141)},'body':JSON['stringify'](_0x3d5a8c)});if(!_0x5e22f5['ok']){const _0x2aa5be=await _0x5e22f5[_0xa503f2(0x17a)]();throw new Error(_0xa503f2(0x144)+_0x2aa5be);}return _0x5e22f5[_0xa503f2(0x150)]();}export async function createChecklistItem(_0x5698ff,_0x17519e,_0x17bf39){const _0x1fe2f6=_0x1adc,_0x3c3114={'hAiwj':function(_0x302bef){return _0x302bef();},'SQKlo':_0x1fe2f6(0x170),'kdPok':_0x1fe2f6(0x141)},_0xedd788=await _0x3c3114['hAiwj'](getToken);if(!_0xedd788)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x14acd7=getApiBaseUrl(),_0x2ee2ba=await fetch(_0x14acd7+_0x1fe2f6(0x13e)+_0x5698ff+'/checklist',{'method':_0x3c3114['SQKlo'],'headers':{'Authorization':_0x1fe2f6(0x166)+_0xedd788,'Content-Type':_0x3c3114[_0x1fe2f6(0x156)]},'body':JSON[_0x1fe2f6(0x15e)]({'description':_0x17519e,'position':_0x17bf39})});if(!_0x2ee2ba['ok']){const _0x1d0861=await _0x2ee2ba[_0x1fe2f6(0x17a)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x1d0861);}return _0x2ee2ba['json']();}export async function updateChecklistItem(_0x294d6d,_0x1bc018,_0x251946){const _0x5cb266=_0x1adc,_0x3ada83={'fUeQE':function(_0x19cf9d){return _0x19cf9d();},'beBoZ':_0x5cb266(0x141),'gefuY':_0x5cb266(0x177)};return withRetry(async()=>{const _0x41185a=_0x5cb266,_0x2639d5=await _0x3ada83[_0x41185a(0x14a)](getToken);if(!_0x2639d5)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x14a19f=getApiBaseUrl(),_0x11397e=await fetch(_0x14a19f+'/api/v1/mcp/features/'+_0x294d6d+'/checklist/'+_0x1bc018,{'method':'PATCH','headers':{'Authorization':_0x41185a(0x166)+_0x2639d5,'Content-Type':_0x3ada83['beBoZ']},'body':JSON['stringify'](_0x251946)});if(!_0x11397e['ok']){const _0x1a85e4=await _0x11397e['text']();throw new Error('Failed\x20to\x20update\x20scenario:\x20'+_0x1a85e4);}return _0x11397e['json']();},{'label':_0x3ada83['gefuY']});}export async function getFeatureReport(_0x102aaf){const _0x453423=_0x1adc,_0x4c2534={'QLyMu':_0x453423(0x154)},_0x29620d=await getToken();if(!_0x29620d)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x41cdd6=getApiBaseUrl(),_0x30d8dc=await fetch(_0x41cdd6+_0x453423(0x13e)+_0x102aaf+'/report',{'method':_0x4c2534[_0x453423(0x153)],'headers':{'Authorization':'Bearer\x20'+_0x29620d}});if(!_0x30d8dc['ok']){const _0x38b5d3=await _0x30d8dc['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x38b5d3);}return _0x30d8dc[_0x453423(0x150)]();}export async function getFeatureReportMarkdown(_0x459807,_0x10a856){const _0x25e2f9=_0x1adc,_0x2002ca={'jhwoE':function(_0x406330){return _0x406330();},'bjObH':function(_0x1cc630){return _0x1cc630();},'jnlBI':function(_0x51ecfe,_0x3ed123){return _0x51ecfe>_0x3ed123;},'LmwHj':function(_0x37c638,_0x10c2a9){return _0x37c638(_0x10c2a9);},'JiQQl':_0x25e2f9(0x16e),'mlJwL':_0x25e2f9(0x147),'sNzml':_0x25e2f9(0x154)},_0x15d64c=await _0x2002ca[_0x25e2f9(0x158)](getToken);if(!_0x15d64c)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x1ccf6b=_0x2002ca['bjObH'](getApiBaseUrl),_0x4f880d=new URLSearchParams(),_0x43a234=_0x2002ca[_0x25e2f9(0x17c)](_0x10a856?.[_0x25e2f9(0x16e)]?.['length']??0x0,0x0),_0x4af2c3=_0x2002ca[_0x25e2f9(0x159)](Boolean,_0x10a856?.[_0x25e2f9(0x147)]);_0x43a234&&_0x10a856?.[_0x25e2f9(0x16e)]&&_0x4f880d['set'](_0x2002ca['JiQQl'],_0x10a856[_0x25e2f9(0x16e)]['join'](','));_0x4af2c3&&_0x10a856?.[_0x25e2f9(0x147)]&&_0x4f880d['set'](_0x2002ca['mlJwL'],_0x10a856[_0x25e2f9(0x147)]);!_0x43a234&&!_0x4af2c3&&_0x10a856?.[_0x25e2f9(0x140)]&&_0x4f880d[_0x25e2f9(0x137)](_0x25e2f9(0x140),_0x10a856[_0x25e2f9(0x140)]);const _0x5a865b=_0x1ccf6b+'/api/v1/mcp/features/'+_0x459807+_0x25e2f9(0x15c),_0x5c55a1=''+_0x5a865b+(_0x4f880d[_0x25e2f9(0x155)]()?'?'+_0x4f880d[_0x25e2f9(0x155)]():''),_0xb9bb88=await fetch(_0x5c55a1,{'method':_0x2002ca[_0x25e2f9(0x15a)],'headers':{'Authorization':'Bearer\x20'+_0x15d64c}});if(!_0xb9bb88['ok']){const _0x55f0f0=await _0xb9bb88['text']();throw new Error(_0x25e2f9(0x149)+_0x55f0f0);}return _0xb9bb88['text']();}export async function listFeatureSessions(_0x364d76){const _0x1c1162=_0x1adc,_0x1add9e={'mrucw':function(_0x4c148f,_0x461e2f,_0x4541e5){return _0x4c148f(_0x461e2f,_0x4541e5);}},_0x4ff5d4=await getToken();if(!_0x4ff5d4)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x504d43=getApiBaseUrl(),_0x30da08=await _0x1add9e[_0x1c1162(0x171)](fetch,_0x504d43+'/api/v1/mcp/features/'+_0x364d76+_0x1c1162(0x167),{'method':'GET','headers':{'Authorization':_0x1c1162(0x166)+_0x4ff5d4}});if(!_0x30da08['ok']){const _0xae651f=await _0x30da08[_0x1c1162(0x17a)]();throw new Error(_0x1c1162(0x178)+_0xae651f);}return _0x30da08[_0x1c1162(0x150)]();}export async function startSession(_0x2c78ce,_0x107860){const _0x1632e1=_0x1adc,_0xb30223={'PgckP':function(_0x43475e){return _0x43475e();}},_0xb7599=await getToken();if(!_0xb7599)throw new Error(_0x1632e1(0x148));const _0x5eb7f0=_0xb30223['PgckP'](getApiBaseUrl),_0x1db8fb=await fetch(_0x5eb7f0+'/api/v1/mcp/features/'+_0x2c78ce+_0x1632e1(0x165)+_0x107860+_0x1632e1(0x13d),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0xb7599}});if(!_0x1db8fb['ok']){const _0x513b67=await _0x1db8fb['text']();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x513b67);}return _0x1db8fb[_0x1632e1(0x150)]();}export async function concludeSession(_0x5119a3,_0x1852d8){const _0x137d8d=_0x1adc,_0x3ab2f6={'ioRhB':function(_0x144f2e){return _0x144f2e();},'BrUPq':function(_0x4f4c27,_0x3d08d8,_0x378a03){return _0x4f4c27(_0x3d08d8,_0x378a03);}},_0x1683ef=await getToken();if(!_0x1683ef)throw new Error(_0x137d8d(0x148));const _0xdf3203=_0x3ab2f6[_0x137d8d(0x14b)](getApiBaseUrl),_0x79fd27=await _0x3ab2f6['BrUPq'](fetch,_0xdf3203+_0x137d8d(0x13e)+_0x5119a3+_0x137d8d(0x165)+_0x1852d8+_0x137d8d(0x160),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x1683ef}});if(!_0x79fd27['ok']){const _0x1ee2bc=await _0x79fd27['text']();throw new Error(_0x137d8d(0x15b)+_0x1ee2bc);}return _0x79fd27['json']();}export async function getActionItems(_0x5c93f5){const _0x310a6b=_0x1adc,_0x31ae30={'uZjMK':_0x310a6b(0x148)},_0x3c9d5b=await getToken();if(!_0x3c9d5b)throw new Error(_0x31ae30[_0x310a6b(0x180)]);const _0x33d4c5=getApiBaseUrl(),_0xb3ba5d=await fetch(_0x33d4c5+_0x310a6b(0x13e)+_0x5c93f5+_0x310a6b(0x173),{'method':_0x310a6b(0x154),'headers':{'Authorization':_0x310a6b(0x166)+_0x3c9d5b}});if(!_0xb3ba5d['ok']){const _0x126973=await _0xb3ba5d[_0x310a6b(0x17a)]();throw new Error('Failed\x20to\x20get\x20action\x20items:\x20'+_0x126973);}return _0xb3ba5d[_0x310a6b(0x150)]();}export async function getItemFeedback(_0x4b8c7c,_0x216540){const _0x3a11d0=_0x1adc,_0x48decf={'DyziP':function(_0x14fb9f){return _0x14fb9f();},'eMkXl':function(_0x14d14b,_0x305f02,_0xce5372){return _0x14d14b(_0x305f02,_0xce5372);}},_0x17bb11=await _0x48decf['DyziP'](getToken);if(!_0x17bb11)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x33f154=_0x48decf[_0x3a11d0(0x175)](getApiBaseUrl),_0x50d1d2=await _0x48decf['eMkXl'](fetch,_0x33f154+_0x3a11d0(0x13e)+_0x4b8c7c+'/checklist-items/'+_0x216540+'/feedback',{'method':'GET','headers':{'Authorization':_0x3a11d0(0x166)+_0x17bb11}});if(!_0x50d1d2['ok']){const _0x4fe779=await _0x50d1d2['text']();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x4fe779);}return _0x50d1d2[_0x3a11d0(0x150)]();}export async function markCommentsAddressed(_0x25f42d,_0x22b296,_0x2c3665){const _0x1ef55a=_0x1adc,_0x127210={'zCOHn':function(_0x320a6f){return _0x320a6f();},'eNYnp':function(_0x5f44fe){return _0x5f44fe();},'zjUHv':_0x1ef55a(0x170),'TBPav':'application/json'},_0x18a5d4=await _0x127210[_0x1ef55a(0x161)](getToken);if(!_0x18a5d4)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x227cd=_0x127210['eNYnp'](getApiBaseUrl),_0x57c066=await fetch(_0x227cd+_0x1ef55a(0x13e)+_0x25f42d+_0x1ef55a(0x14f),{'method':_0x127210[_0x1ef55a(0x164)],'headers':{'Authorization':_0x1ef55a(0x166)+_0x18a5d4,'Content-Type':_0x127210['TBPav']},'body':JSON[_0x1ef55a(0x15e)]({'checklistItemId':_0x22b296,'commentIds':_0x2c3665})});if(!_0x57c066['ok']){const _0x29e1c0=await _0x57c066[_0x1ef55a(0x17a)]();throw new Error('Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20'+_0x29e1c0);}}export async function softDeleteFeature(_0x1bc420){const _0x5b5af9=_0x1adc,_0x4d2ab0={'GzXfa':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','dKYsc':'DELETE'},_0x38ee23=await getToken();if(!_0x38ee23)throw new Error(_0x4d2ab0[_0x5b5af9(0x16c)]);const _0x2e0a87=getApiBaseUrl(),_0x28b69a=await fetch(_0x2e0a87+'/api/v1/mcp/features/'+_0x1bc420,{'method':_0x4d2ab0[_0x5b5af9(0x172)],'headers':{'Authorization':_0x5b5af9(0x166)+_0x38ee23}});if(!_0x28b69a['ok']){const _0xcac15e=await _0x28b69a[_0x5b5af9(0x17a)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0xcac15e);}}export async function restoreFeature(_0x44b760){const _0x449cac=_0x1adc,_0xc95574={'wZOME':_0x449cac(0x148),'YrEtq':_0x449cac(0x170)},_0xdba80f=await getToken();if(!_0xdba80f)throw new Error(_0xc95574[_0x449cac(0x14c)]);const _0x5d2c33=getApiBaseUrl(),_0x58cc06=await fetch(_0x5d2c33+'/api/v1/mcp/features/'+_0x44b760+_0x449cac(0x16a),{'method':_0xc95574['YrEtq'],'headers':{'Authorization':'Bearer\x20'+_0xdba80f}});if(!_0x58cc06['ok']){const _0x4a519f=await _0x58cc06['text']();throw new Error('Failed\x20to\x20restore\x20feature\x20review:\x20'+_0x4a519f);}}
|
|
1
|
+
(function(_0x2d3dae,_0x5a738d){const _0x458833=_0x3a20,_0x51ca15=_0x2d3dae();while(!![]){try{const _0x124147=-parseInt(_0x458833(0x1c2))/0x1*(-parseInt(_0x458833(0x18b))/0x2)+-parseInt(_0x458833(0x19c))/0x3*(parseInt(_0x458833(0x1c7))/0x4)+-parseInt(_0x458833(0x19d))/0x5*(-parseInt(_0x458833(0x196))/0x6)+parseInt(_0x458833(0x198))/0x7+-parseInt(_0x458833(0x1b7))/0x8*(-parseInt(_0x458833(0x1a4))/0x9)+-parseInt(_0x458833(0x191))/0xa*(parseInt(_0x458833(0x1cb))/0xb)+-parseInt(_0x458833(0x1b0))/0xc;if(_0x124147===_0x5a738d)break;else _0x51ca15['push'](_0x51ca15['shift']());}catch(_0x15c6c9){_0x51ca15['push'](_0x51ca15['shift']());}}}(_0x59d6,0xbceb5));import{getToken}from'./keychain.js';function _0x3a20(_0x238282,_0x26f79c){_0x238282=_0x238282-0x18b;const _0x59d6f7=_0x59d6();let _0x3a202a=_0x59d6f7[_0x238282];return _0x3a202a;}import{getApiBaseUrl}from'./environment.js';import{withRetry}from'./retry.js';export async function createFeature(_0x1ae61c){const _0x2ac420=_0x3a20,_0x3e5742={'BtpLA':function(_0x216e26){return _0x216e26();},'CpxgR':_0x2ac420(0x193)},_0x59c35b=await _0x3e5742[_0x2ac420(0x1b3)](getToken);if(!_0x59c35b)throw new Error(_0x2ac420(0x1b5));const _0x2c8584=getApiBaseUrl(),_0x36f4e2=await fetch(_0x2c8584+'/api/v1/mcp/features',{'method':'POST','headers':{'Authorization':_0x2ac420(0x1b9)+_0x59c35b,'Content-Type':'application/json'},'body':JSON['stringify'](_0x1ae61c)});if(!_0x36f4e2['ok']){if(_0x36f4e2[_0x2ac420(0x1b8)]===0x192){const _0x6f733f=await _0x36f4e2['json'](),_0x154817=_0x6f733f[_0x2ac420(0x1c3)]||_0x2ac420(0x19e);throw new Error((_0x6f733f['message']||_0x3e5742['CpxgR'])+'\x0a\x0aUpgrade\x20your\x20plan:\x20'+_0x154817);}const _0x99b30f=await _0x36f4e2[_0x2ac420(0x1d0)]();throw new Error('Failed\x20to\x20create\x20feature\x20review:\x20'+_0x99b30f);}return _0x36f4e2[_0x2ac420(0x1b6)]();}function _0x59d6(){const _0x19a031=['9255008xEgGal','kbONn','cwWOw','limit','962085qvCpIg','866605wUPOFm','https://dashboard.ranger.net/billing','Failed\x20to\x20mark\x20comments\x20as\x20addressed:\x20','fNIcM','application/json','/sessions/','JBNMs','334926VtvoyK','rRbaF','MerAe','stringify','UXcCf','PATCH','pwDkl','/start','qfbBg','Failed\x20to\x20get\x20action\x20items:\x20','GET','/api/v1/mcp/features','14673204MPcTyT','/api/v1/mcp/features/','/comments/address','BtpLA','true','No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','json','168hAtZpI','status','Bearer\x20','Failed\x20to\x20list\x20feature\x20reviews:\x20','join','offset','QYBlV','UWhFh','gitRepoUrl','MFKrh','flWKo','549436ubuVQq','billingUrl','dfAjA','itemIds','LsgHV','8UFhqCa','Failed\x20to\x20restore\x20feature\x20review:\x20','hblix','includeDeleted','8116471kSBHQZ','EaBUz','Failed\x20to\x20update\x20scenario:\x20','set','siTlt','text','/feedback','Xcyvc','DELETE','rVhHF','POST','sMheE','wSigw','gitBranch','4qZkOMZ','ZqLYi','WYaUm','bHqIy','/conclude','QNuHa','10VEQWLe','Failed\x20to\x20conclude\x20session:\x20','Feature\x20limit\x20exceeded','sessionId','toString','6JVXsdU','hWYCP'];_0x59d6=function(){return _0x19a031;};return _0x59d6();}export async function listFeatures(_0xd6cf92){const _0x334408=_0x3a20,_0x4fb23c={'UXcCf':function(_0x58b6d6){return _0x58b6d6();},'kbONn':_0x334408(0x1bf),'LsgHV':_0x334408(0x1d8),'cwWOw':_0x334408(0x19b),'bHqIy':_0x334408(0x1ca)},_0x2c116a=await _0x4fb23c[_0x334408(0x1a8)](getToken);if(!_0x2c116a)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0xac1c1e=getApiBaseUrl(),_0x31eea6=new URLSearchParams();if(_0xd6cf92?.[_0x334408(0x1bf)])_0x31eea6['set'](_0x4fb23c[_0x334408(0x199)],_0xd6cf92['gitRepoUrl']);if(_0xd6cf92?.[_0x334408(0x1d8)])_0x31eea6['set'](_0x4fb23c[_0x334408(0x1c6)],_0xd6cf92['gitBranch']);if(_0xd6cf92?.[_0x334408(0x19b)])_0x31eea6['set'](_0x4fb23c[_0x334408(0x19a)],_0xd6cf92['limit']['toString']());if(_0xd6cf92?.[_0x334408(0x1bc)])_0x31eea6['set']('offset',_0xd6cf92[_0x334408(0x1bc)]['toString']());if(_0xd6cf92?.['includeDeleted'])_0x31eea6['set'](_0x4fb23c[_0x334408(0x18e)],_0x334408(0x1b4));const _0x1b0a19=_0xac1c1e+_0x334408(0x1af)+(_0x31eea6['toString']()?'?'+_0x31eea6[_0x334408(0x195)]():''),_0x1d6ef1=await fetch(_0x1b0a19,{'method':_0x334408(0x1ae),'headers':{'Authorization':'Bearer\x20'+_0x2c116a}});if(!_0x1d6ef1['ok']){const _0x4c62c3=await _0x1d6ef1[_0x334408(0x1d0)]();throw new Error(_0x334408(0x1ba)+_0x4c62c3);}return _0x1d6ef1['json']();}export async function getFeature(_0x2248d9){const _0x63ea14=_0x3a20,_0x55ed22={'hWYCP':function(_0x2fc899){return _0x2fc899();},'sMheE':function(_0x1668bb,_0x5a807d,_0x7a79a4){return _0x1668bb(_0x5a807d,_0x7a79a4);},'hblix':_0x63ea14(0x1ae)},_0x1ce40e=await _0x55ed22[_0x63ea14(0x197)](getToken);if(!_0x1ce40e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x26711b=getApiBaseUrl(),_0x1cbbe1=await _0x55ed22[_0x63ea14(0x1d6)](fetch,_0x26711b+_0x63ea14(0x1b1)+_0x2248d9,{'method':_0x55ed22[_0x63ea14(0x1c9)],'headers':{'Authorization':'Bearer\x20'+_0x1ce40e}});if(!_0x1cbbe1['ok']){const _0x1d0888=await _0x1cbbe1[_0x63ea14(0x1d0)]();throw new Error('Failed\x20to\x20get\x20feature\x20review:\x20'+_0x1d0888);}return _0x1cbbe1['json']();}export async function updateFeature(_0xdad7c5,_0x46baef){const _0x5ed8de=_0x3a20,_0x516e5b={'wSigw':function(_0x1088b){return _0x1088b();},'ZqLYi':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','fNIcM':_0x5ed8de(0x1a9),'EaBUz':_0x5ed8de(0x1a1)},_0x5c7c67=await _0x516e5b['wSigw'](getToken);if(!_0x5c7c67)throw new Error(_0x516e5b[_0x5ed8de(0x18c)]);const _0x241e45=_0x516e5b[_0x5ed8de(0x1d7)](getApiBaseUrl),_0x51e1d6=await fetch(_0x241e45+'/api/v1/mcp/features/'+_0xdad7c5,{'method':_0x516e5b[_0x5ed8de(0x1a0)],'headers':{'Authorization':_0x5ed8de(0x1b9)+_0x5c7c67,'Content-Type':_0x516e5b[_0x5ed8de(0x1cc)]},'body':JSON['stringify'](_0x46baef)});if(!_0x51e1d6['ok']){const _0x5de5fa=await _0x51e1d6[_0x5ed8de(0x1d0)]();throw new Error('Failed\x20to\x20update\x20feature\x20review:\x20'+_0x5de5fa);}return _0x51e1d6['json']();}export async function createChecklistItem(_0xedb547,_0x22573a,_0xdd8d0){const _0x11bb87=_0x3a20,_0x37b433={'CUPxS':function(_0x463862){return _0x463862();},'VxgKI':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]','rRbaF':'POST'},_0x474999=await _0x37b433['CUPxS'](getToken);if(!_0x474999)throw new Error(_0x37b433['VxgKI']);const _0x58595f=getApiBaseUrl(),_0x37fe99=await fetch(_0x58595f+_0x11bb87(0x1b1)+_0xedb547+'/checklist',{'method':_0x37b433[_0x11bb87(0x1a5)],'headers':{'Authorization':_0x11bb87(0x1b9)+_0x474999,'Content-Type':_0x11bb87(0x1a1)},'body':JSON['stringify']({'description':_0x22573a,'position':_0xdd8d0})});if(!_0x37fe99['ok']){const _0x4a28e7=await _0x37fe99[_0x11bb87(0x1d0)]();throw new Error('Failed\x20to\x20create\x20scenario:\x20'+_0x4a28e7);}return _0x37fe99['json']();}export async function updateChecklistItem(_0x2288f2,_0x530182,_0x4003fe){const _0x5b9203=_0x3a20,_0x101e34={'siTlt':function(_0x701e2e){return _0x701e2e();},'fxaNg':function(_0x50cd47){return _0x50cd47();},'qfbBg':function(_0x5e5977,_0x4243bb,_0x7a6ea6){return _0x5e5977(_0x4243bb,_0x7a6ea6);},'QYBlV':'application/json','UWhFh':'updateChecklistItem'};return _0x101e34[_0x5b9203(0x1ac)](withRetry,async()=>{const _0x3306fa=_0x5b9203,_0x5bcbec=await _0x101e34[_0x3306fa(0x1cf)](getToken);if(!_0x5bcbec)throw new Error(_0x3306fa(0x1b5));const _0x4f4503=_0x101e34['fxaNg'](getApiBaseUrl),_0x16c56c=await _0x101e34['qfbBg'](fetch,_0x4f4503+'/api/v1/mcp/features/'+_0x2288f2+'/checklist/'+_0x530182,{'method':_0x3306fa(0x1a9),'headers':{'Authorization':'Bearer\x20'+_0x5bcbec,'Content-Type':_0x101e34[_0x3306fa(0x1bd)]},'body':JSON['stringify'](_0x4003fe)});if(!_0x16c56c['ok']){const _0x17f0ec=await _0x16c56c[_0x3306fa(0x1d0)]();throw new Error(_0x3306fa(0x1cd)+_0x17f0ec);}return _0x16c56c['json']();},{'label':_0x101e34[_0x5b9203(0x1be)]});}export async function getFeatureReport(_0x1a4758){const _0x138fc3=_0x3a20,_0x3b9475={'hJAwQ':function(_0x27a94b,_0x30bd68,_0x2638ca){return _0x27a94b(_0x30bd68,_0x2638ca);}},_0x7d3a6d=await getToken();if(!_0x7d3a6d)throw new Error(_0x138fc3(0x1b5));const _0x529bff=getApiBaseUrl(),_0x4a0ddc=await _0x3b9475['hJAwQ'](fetch,_0x529bff+_0x138fc3(0x1b1)+_0x1a4758+'/report',{'method':'GET','headers':{'Authorization':'Bearer\x20'+_0x7d3a6d}});if(!_0x4a0ddc['ok']){const _0x577c6a=await _0x4a0ddc['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report:\x20'+_0x577c6a);}return _0x4a0ddc['json']();}export async function getFeatureReportMarkdown(_0x8b855,_0x2c6036){const _0x2135d7=_0x3a20,_0x139ece={'dfAjA':function(_0x1bebd3){return _0x1bebd3();},'cRfCs':function(_0x665ad2,_0x453687){return _0x665ad2(_0x453687);},'MerAe':'itemIds','obECq':'style'},_0x28dbab=await getToken();if(!_0x28dbab)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x19fc16=_0x139ece[_0x2135d7(0x1c4)](getApiBaseUrl),_0x187847=new URLSearchParams(),_0x5e9b37=(_0x2c6036?.[_0x2135d7(0x1c5)]?.['length']??0x0)>0x0,_0x156d88=_0x139ece['cRfCs'](Boolean,_0x2c6036?.['sessionId']);_0x5e9b37&&_0x2c6036?.['itemIds']&&_0x187847['set'](_0x139ece[_0x2135d7(0x1a6)],_0x2c6036[_0x2135d7(0x1c5)][_0x2135d7(0x1bb)](','));_0x156d88&&_0x2c6036?.['sessionId']&&_0x187847[_0x2135d7(0x1ce)](_0x2135d7(0x194),_0x2c6036[_0x2135d7(0x194)]);!_0x5e9b37&&!_0x156d88&&_0x2c6036?.['style']&&_0x187847['set'](_0x139ece['obECq'],_0x2c6036['style']);const _0x34acb2=_0x19fc16+'/api/v1/mcp/features/'+_0x8b855+'/report/markdown',_0x2ab458=''+_0x34acb2+(_0x187847['toString']()?'?'+_0x187847['toString']():''),_0x193f5b=await fetch(_0x2ab458,{'method':_0x2135d7(0x1ae),'headers':{'Authorization':'Bearer\x20'+_0x28dbab}});if(!_0x193f5b['ok']){const _0x2bcaed=await _0x193f5b['text']();throw new Error('Failed\x20to\x20get\x20feature\x20review\x20report\x20markdown:\x20'+_0x2bcaed);}return _0x193f5b[_0x2135d7(0x1d0)]();}export async function listFeatureSessions(_0x412569){const _0xb8fcd0=_0x3a20,_0x4b21c7={'pAfYC':function(_0x461e75){return _0x461e75();},'QNuHa':_0xb8fcd0(0x1b5),'OKcLL':function(_0x2b6166,_0x3a1c0b,_0xfb08c){return _0x2b6166(_0x3a1c0b,_0xfb08c);},'YlDnn':_0xb8fcd0(0x1ae)},_0x56da70=await _0x4b21c7['pAfYC'](getToken);if(!_0x56da70)throw new Error(_0x4b21c7[_0xb8fcd0(0x190)]);const _0x69f14b=getApiBaseUrl(),_0xd79c2b=await _0x4b21c7['OKcLL'](fetch,_0x69f14b+'/api/v1/mcp/features/'+_0x412569+'/sessions',{'method':_0x4b21c7['YlDnn'],'headers':{'Authorization':'Bearer\x20'+_0x56da70}});if(!_0xd79c2b['ok']){const _0x54c5de=await _0xd79c2b[_0xb8fcd0(0x1d0)]();throw new Error('Failed\x20to\x20list\x20sessions:\x20'+_0x54c5de);}return _0xd79c2b[_0xb8fcd0(0x1b6)]();}export async function startSession(_0x1cd9fd,_0x547460){const _0x875b02=_0x3a20,_0x38ff03={'VAaHY':function(_0x34b3f5){return _0x34b3f5();},'JBNMs':function(_0x34e2b4,_0x59b552,_0x976dfd){return _0x34e2b4(_0x59b552,_0x976dfd);},'DrLdk':_0x875b02(0x1d5)},_0xa0327e=await _0x38ff03['VAaHY'](getToken);if(!_0xa0327e)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x5f0e13=getApiBaseUrl(),_0x4590a8=await _0x38ff03[_0x875b02(0x1a3)](fetch,_0x5f0e13+'/api/v1/mcp/features/'+_0x1cd9fd+_0x875b02(0x1a2)+_0x547460+_0x875b02(0x1ab),{'method':_0x38ff03['DrLdk'],'headers':{'Authorization':'Bearer\x20'+_0xa0327e}});if(!_0x4590a8['ok']){const _0x2fef0e=await _0x4590a8[_0x875b02(0x1d0)]();throw new Error('Failed\x20to\x20start\x20session:\x20'+_0x2fef0e);}return _0x4590a8['json']();}export async function concludeSession(_0x29c636,_0x14bd4c){const _0x365a65=_0x3a20,_0x354505={'AiwdG':function(_0xab639b){return _0xab639b();},'pwDkl':function(_0x36f695,_0x376f98,_0x32503b){return _0x36f695(_0x376f98,_0x32503b);}},_0x1d0389=await _0x354505['AiwdG'](getToken);if(!_0x1d0389)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x3c0aee=getApiBaseUrl(),_0x1ce774=await _0x354505[_0x365a65(0x1aa)](fetch,_0x3c0aee+'/api/v1/mcp/features/'+_0x29c636+_0x365a65(0x1a2)+_0x14bd4c+_0x365a65(0x18f),{'method':_0x365a65(0x1d5),'headers':{'Authorization':'Bearer\x20'+_0x1d0389}});if(!_0x1ce774['ok']){const _0x2473f0=await _0x1ce774[_0x365a65(0x1d0)]();throw new Error(_0x365a65(0x192)+_0x2473f0);}return _0x1ce774[_0x365a65(0x1b6)]();}export async function getActionItems(_0x41ef80){const _0x30e5d2=_0x3a20,_0x1163e4={'vRZEN':function(_0xad80d6){return _0xad80d6();},'Xcyvc':_0x30e5d2(0x1b5),'ArTBB':'GET'},_0x3ff340=await _0x1163e4['vRZEN'](getToken);if(!_0x3ff340)throw new Error(_0x1163e4[_0x30e5d2(0x1d2)]);const _0x593dc6=getApiBaseUrl(),_0x232640=await fetch(_0x593dc6+'/api/v1/mcp/features/'+_0x41ef80+'/action-items',{'method':_0x1163e4['ArTBB'],'headers':{'Authorization':_0x30e5d2(0x1b9)+_0x3ff340}});if(!_0x232640['ok']){const _0x89944c=await _0x232640[_0x30e5d2(0x1d0)]();throw new Error(_0x30e5d2(0x1ad)+_0x89944c);}return _0x232640[_0x30e5d2(0x1b6)]();}export async function getItemFeedback(_0x3b6bbc,_0x26fcbb){const _0x3aef1e=_0x3a20,_0x223b3d={'MFKrh':'No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]'},_0x570272=await getToken();if(!_0x570272)throw new Error(_0x223b3d[_0x3aef1e(0x1c0)]);const _0x9f15b6=getApiBaseUrl(),_0x1f3078=await fetch(_0x9f15b6+'/api/v1/mcp/features/'+_0x3b6bbc+'/checklist-items/'+_0x26fcbb+_0x3aef1e(0x1d1),{'method':_0x3aef1e(0x1ae),'headers':{'Authorization':'Bearer\x20'+_0x570272}});if(!_0x1f3078['ok']){const _0x56bc58=await _0x1f3078['text']();throw new Error('Failed\x20to\x20get\x20item\x20feedback:\x20'+_0x56bc58);}return _0x1f3078[_0x3aef1e(0x1b6)]();}export async function markCommentsAddressed(_0x52a1bc,_0x308f13,_0x3f56a3){const _0xd2950=_0x3a20,_0x308ef7={'TihrK':function(_0x248600){return _0x248600();},'gdFHQ':_0xd2950(0x1b5),'qrSyM':'application/json'},_0x48aa5c=await _0x308ef7['TihrK'](getToken);if(!_0x48aa5c)throw new Error(_0x308ef7['gdFHQ']);const _0x4e0043=_0x308ef7['TihrK'](getApiBaseUrl),_0x492abf=await fetch(_0x4e0043+_0xd2950(0x1b1)+_0x52a1bc+_0xd2950(0x1b2),{'method':'POST','headers':{'Authorization':'Bearer\x20'+_0x48aa5c,'Content-Type':_0x308ef7['qrSyM']},'body':JSON[_0xd2950(0x1a7)]({'checklistItemId':_0x308f13,'commentIds':_0x3f56a3})});if(!_0x492abf['ok']){const _0x5daf1f=await _0x492abf['text']();throw new Error(_0xd2950(0x19f)+_0x5daf1f);}}export async function softDeleteFeature(_0x4e1d74){const _0x3b524b=_0x3a20,_0x3fb4ad={'DrCCb':function(_0x412022){return _0x412022();},'flWKo':function(_0x41b4d8,_0x2b25b0,_0x287881){return _0x41b4d8(_0x2b25b0,_0x287881);}},_0x45595b=await _0x3fb4ad['DrCCb'](getToken);if(!_0x45595b)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x258e7c=getApiBaseUrl(),_0x7b1c8b=await _0x3fb4ad[_0x3b524b(0x1c1)](fetch,_0x258e7c+_0x3b524b(0x1b1)+_0x4e1d74,{'method':_0x3b524b(0x1d3),'headers':{'Authorization':_0x3b524b(0x1b9)+_0x45595b}});if(!_0x7b1c8b['ok']){const _0x372391=await _0x7b1c8b[_0x3b524b(0x1d0)]();throw new Error('Failed\x20to\x20delete\x20feature\x20review:\x20'+_0x372391);}}export async function restoreFeature(_0xad4395){const _0x576d5e=_0x3a20,_0x200639={'rVhHF':function(_0x63de57){return _0x63de57();},'WYaUm':function(_0x341668,_0x40f3ab,_0x13be92){return _0x341668(_0x40f3ab,_0x13be92);},'tITIM':_0x576d5e(0x1d5)},_0x21fc55=await _0x200639['rVhHF'](getToken);if(!_0x21fc55)throw new Error('No\x20API\x20token\x20configured.\x20Run:\x20ranger\x20setup\x20[token]');const _0x25e4c0=_0x200639[_0x576d5e(0x1d4)](getApiBaseUrl),_0x1dbf45=await _0x200639[_0x576d5e(0x18d)](fetch,_0x25e4c0+_0x576d5e(0x1b1)+_0xad4395+'/restore',{'method':_0x200639['tITIM'],'headers':{'Authorization':_0x576d5e(0x1b9)+_0x21fc55}});if(!_0x1dbf45['ok']){const _0x2abca5=await _0x1dbf45[_0x576d5e(0x1d0)]();throw new Error(_0x576d5e(0x1c8)+_0x2abca5);}}
|