"use strict";exports.id=3556,exports.ids=[3556],exports.modules={"./src/commands/status.ts"(e,t,s){s.r(t),s.d(t,{gatherStatusInfo:()=>o,handleStatus:()=>u});var a=s("../proto/dist/generated/aiserver/v1/dashboard_pb.js"),n=s("../../../../../../../../../../private/tmp/buildkite-job-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684/agent-cli-mac-macos-x64-01a03ad4-00a2-4e4f-9a4f-0e1ec809f684.LshlV881/pnpm-virtual-store/chalk@5.6.2/node_modules/chalk/source/index.js"),i=s("./src/console-io.ts"),r=function(e,t,s,a){return new(s||(s=Promise))((function(n,i){function r(e){try{u(a.next(e))}catch(e){i(e)}}function o(e){try{u(a.throw(e))}catch(e){i(e)}}function u(e){var t;e.done?n(e.value):(t=e.value,t instanceof s?t:new s((function(e){e(t)}))).then(r,o)}u((a=a.apply(e,t||[])).next())}))};function o(e,t){return r(this,void 0,void 0,(function*(){const s=yield e.getAccessToken(),n=yield e.getRefreshToken();if(s&&n)try{const e=yield t.getMe(new a.GetMeRequest({})),s=null!=e.email||null!=e.userId||null!=e.firstName||null!=e.lastName||null!=e.teamId||null!=e.createdAt?{email:e.email,userId:e.userId,firstName:e.firstName,lastName:e.lastName,teamId:e.teamId,createdAt:e.createdAt}:void 0;return{status:"authenticated",isAuthenticated:!0,hasAccessToken:!0,hasRefreshToken:!0,message:null!=e.email?void 0:"Logged in (user details not available)",userInfo:s}}catch(e){return{status:"authenticated",isAuthenticated:!0,hasAccessToken:!0,hasRefreshToken:!0,message:"Logged in (unable to fetch user details)"}}return s?{status:"partially-authenticated",isAuthenticated:!1,hasAccessToken:!0,hasRefreshToken:!1,message:"Partially authenticated (missing refresh token)"}:{status:"unauthenticated",isAuthenticated:!1,hasAccessToken:!1,hasRefreshToken:!1,message:"Not logged in"}}))}function u(e,t){return r(this,arguments,void 0,(function*(e,t,s={}){var a;const r=null!==(a=s.format)&&void 0!==a?a:"text";let u=0;try{const s=yield o(e,t);"json"===r?(0,i.OT)(JSON.stringify(s,null,2)):(0,i.OT)(function(e){var t;switch(e.status){case"authenticated":{const t=e.userInfo,s=(null==t?void 0:t.email)?`Logged in as ${t.email}`:(null==t?void 0:t.userId)?`Logged in as user id ${t.userId}`:"Login successful!",a=[`${n.Ay.green("✓")} ${s}`];return e.message&&a.push(e.message),a.join("\n")}case"partially-authenticated":case"unauthenticated":return n.Ay.red(null!==(t=e.message)&&void 0!==t?t:"Not logged in")}}(s))}catch(e){u=1;const t=e instanceof Error?e.message:String(e);"json"===r?(0,i.OT)(JSON.stringify({status:"error",message:`Status check error: ${t}`},null,2)):(0,i.p2)(n.Ay.red(`Status check error: ${t}`))}finally{process.exit(u)}}))}}};