try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},s=(new e.Error).stack;s&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[s]="03ebd1aa-5768-447c-b91d-40a59f1991e8",e._sentryDebugIdIdentifier="sentry-dbid-03ebd1aa-5768-447c-b91d-40a59f1991e8")}()}catch(e){}!function(){try{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{}).SENTRY_RELEASE={id:"agent-cli@2026.05.09-0afadcc"}}catch(e){}}(),exports.id=4643,exports.ids=[4643],exports.modules={"./src/commands/auth-status-format.ts":(e,s,t)=>{t.d(s,{$7:()=>a,Fg:()=>r,cq:()=>o});var n=t("../../node_modules/.pnpm/chalk@5.4.1/node_modules/chalk/source/index.js");function r(e){const{status:s,message:t,userInfo:r,loginUrl:o}=e;switch(s){case"starting":return"Starting login process...";case"in-progress":{const e=["Authenticating with Cursor..."];return t&&e.push(t),o&&e.push(n.Ay.dim(o)),e.join("\n")}case"success":{const e=(null==r?void 0:r.email)?`Logged in as ${r.email}`:(null==r?void 0:r.userId)?`Logged in as user id ${r.userId}`:"Login successful!",s=[`${n.Ay.green("✓")} ${e}`];return t&&s.push(t),s.join("\n")}case"error":return t?n.Ay.red(t):""}}function o(e){const{status:s,message:t}=e;switch(s){case"starting":return"Preparing to log out...";case"in-progress":return"Logging out...";case"success":{const e=[n.Ay.green("✓ Logout successful")];return t&&e.push(t),e.join("\n")}case"error":{const e=[n.Ay.red("✗ Logout failed")];return t&&e.push(n.Ay.red(t)),e.join("\n")}}}function a(e){const{status:s,message:t}=e;switch(s){case"starting":{const e=["MCP Login","Preparing login..."];return t&&e.push(t),e.join("\n")}case"in-progress":{const e=["Checking status..."];return t&&e.push(t),e.join("\n")}case"success":{const e=[n.Ay.green("✓ MCP login successful")];return t&&e.push(t),e.join("\n")}case"error":{const e=[n.Ay.red("✗ MCP login failed")];return t&&e.push(n.Ay.red(t)),e.join("\n")}}}},"./src/commands/login.ts":(e,s,t)=>{t.r(s),t.d(s,{handleLogin:()=>l});var n=t("../cursor-config/dist/index.js"),r=t("../proto/dist/generated/aiserver/v1/dashboard_pb.js"),o=t("./src/console-io.ts"),a=t("./src/privacy.ts"),i=t("./src/statsig.ts"),c=t("./src/utils/open-browser.ts"),u=t("./src/commands/auth-status-format.ts"),d=function(e,s,t,n){return new(t||(t=Promise))((function(r,o){function a(e){try{c(n.next(e))}catch(e){o(e)}}function i(e){try{c(n.throw(e))}catch(e){o(e)}}function c(e){var s;e.done?r(e.value):(s=e.value,s instanceof t?s:new t((function(e){e(s)}))).then(a,i)}c((n=n.apply(e,s||[])).next())}))};function l(e,s,t){return d(this,void 0,void 0,(function*(){(0,o.OT)((0,u.Fg)({status:"starting"}));try{const d=new n.Pl,{metadata:l,loginUrl:g}=d.startLogin();if((0,c.g1)(g)){(0,o.OT)((0,u.Fg)({status:"in-progress",message:`Waiting for browser authentication...\nIf your browser didn't open, use this link:\n${g}`}));try{yield(0,c.ph)(g)}catch(e){}}else(0,o.OT)((0,u.Fg)({status:"in-progress",message:`Waiting for browser authentication...\nOpen a browser and navigate to this link: ${g}`}));const f=yield d.waitForResult(l);if(null==f?void 0:f.accessToken)try{let n;yield e.setAuthentication(f.accessToken,f.refreshToken),yield s.transform((e=>Object.assign(Object.assign({},e),{privacyCache:void 0}))),(0,a.H)({credentialManager:e,baseUrl:"https://api2.cursor.sh",configProvider:s});let c=!1;if(t)try{const o=yield t.getMe(new r.GetMeRequest({}));n=o.email;const a=s.get().channel,u=null==n?void 0:n.endsWith("@anysphere.co"),d=""!==o.authId?o.authId:void 0;yield s.transform((e=>{var s;return Object.assign(Object.assign(Object.assign({},e),{authInfo:{email:null!==(s=o.email)&&void 0!==s?s:"",displayName:[o.firstName,o.lastName].filter(Boolean).join(" "),teamId:o.teamId,teamName:o.teamName,userId:o.userId,authId:d}}),u&&"static"!==a&&"prod-stable-internal"!==a?{channel:"lab"}:{})})),(0,i.A3)(s,e,{endpoint:"https://api2.cursor.sh"}),u&&"lab"!==a&&"static"!==a&&"prod-stable-internal"!==a&&(c=!0)}catch(e){}(0,o.OT)((0,u.Fg)({status:"success",message:"Authentication tokens stored securely."+(c?" agent automatically configured to use nightly channel.":""),userInfo:n?{email:n}:void 0}))}catch(e){(0,o.p2)((0,u.Fg)({status:"error",message:"Failed to store authentication tokens. Please try again."}))}else(0,o.p2)((0,u.Fg)({status:"error",message:"Login failed or timed out. Please try again."})),process.exit(1)}catch(e){const s=e instanceof Error?e.message:"An unexpected error occurred";(0,o.p2)((0,u.Fg)({status:"error",message:`Login error: ${s}`})),process.exit(1)}process.exit(0)}))}}};