"use strict";exports.id=6475,exports.ids=[6475],exports.modules={"./src/commands/auth-status-format.ts"(e,s,t){t.d(s,{$7:()=>c,Fg:()=>r,cq:()=>o});var n=t("../../../../../../../../../../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");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 c(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/dev-login.ts"(e,s,t){t.r(s),t.d(s,{handleDevLogin:()=>o});var n=t("./src/console-io.ts"),r=t("./src/commands/auth-status-format.ts");function o(e){return s=this,t=arguments,c=function*(e,s={}){(0,n.OT)((0,r.Fg)({status:"starting"}));const t=process.env.NODE_TLS_REJECT_UNAUTHORIZED;try{const t=(s.endpoint||"https://localhost:8000").replace(/\/+$/,""),o=s.email,c=new URLSearchParams;o&&c.set("email",o),s.trial&&c.set("trial","true");const i=`${t}/auth/cursor_dev_session_token?${c.toString()}`;(0,n.OT)((0,r.Fg)({status:"in-progress",message:`Authenticating with dev backend at ${t}...`})),s.insecure&&t.startsWith("https:")&&(process.env.NODE_TLS_REJECT_UNAUTHORIZED="0");const a=yield fetch(i);if(!a.ok){const e=yield a.text();throw new Error(`Dev authentication failed (${a.status}): ${e}`)}const u=yield a.json();if(null==u?void 0:u.accessToken)try{yield e.setAuthentication(u.accessToken,u.refreshToken);const t=s.trial?"free trial":"pro",o=s.insecure?" (insecure SSL)":"";(0,n.OT)((0,r.Fg)({status:"success",message:`Dev authentication successful!${o} Logged in with ${t} account.\nAuth ID: ${u.authId}`}))}catch(e){const s=`Failed to store dev authentication tokens.\nAccess token: ${u.accessToken}`;(0,n.p2)((0,r.Fg)({status:"error",message:s}))}else(0,n.p2)((0,r.Fg)({status:"error",message:"Dev login failed - invalid response from server."})),process.exit(1)}catch(e){const t=e instanceof TypeError&&e.message.includes("fetch");let o;o=e instanceof Error&&(e.message.includes("certificate")||e.message.includes("self signed")||e.message.includes("unable to verify"))&&!s.insecure?`SSL certificate error. Try using the -k flag to ignore certificate validation: ${e}`:t?`Failed to connect to dev backend. Make sure the development server is running at ${s.endpoint||"https://localhost:8000"}.`:`Dev login error: ${e}`,(0,n.p2)((0,r.Fg)({status:"error",message:o})),process.exit(1)}finally{void 0!==t?process.env.NODE_TLS_REJECT_UNAUTHORIZED=t:delete process.env.NODE_TLS_REJECT_UNAUTHORIZED}process.exit(0)},new((o=void 0)||(o=Promise))((function(e,n){function r(e){try{a(c.next(e))}catch(e){n(e)}}function i(e){try{a(c.throw(e))}catch(e){n(e)}}function a(s){var t;s.done?e(s.value):(t=s.value,t instanceof o?t:new o((function(e){e(t)}))).then(r,i)}a((c=c.apply(s,t||[])).next())}));var s,t,o,c}}};