import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{f as n,s as r}from"./envUtils-BWeoiL4Y.js";import{Rn as i,b as a,f as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{Cc as u,dc as d,dn as f,on as p,yc as m}from"./paths-Ci1iwL5Y.js";import{a as h,n as g}from"./env-C2A9gV_G.js";import{aS as _,lC as v,oS as y,uC as b}from"./loadAgentsDir-C_wFhytF.js";import{n as x,t as S}from"./browser-Bt-ckCaU.js";import{c as C,d as w,t as T}from"./common-Da57Qwms.js";import{n as E,t as D}from"./setup-BECFDOT9.js";function O({onDone:e,isExtensionInstalled:t,configEnabled:r,isClaudeAISubscriber:i,isWSL:s}){let l=b(e=>e.mcp.clients),[d,f]=(0,k.useState)(0),[p,m]=(0,k.useState)(r??!1),[h,g]=(0,k.useState)(!1),[v,y]=(0,k.useState)(t),S=process.env.USER_TYPE===`ant`&&n(),C=l.find(e=>e.name===T)?.type===`connected`;function D(e){S?x(e):w(e)}function O(e){switch(e){case`install-extension`:f(e=>e+1),g(!0),D(j);break;case`reconnect`:f(e=>e+1),E().then(e=>{y(e),e&&g(!1)}),D(N);break;case`manage-permissions`:f(e=>e+1),D(M);break;case`toggle-default`:{let e=!p;u(t=>({...t,claudeInChromeDefaultEnabled:e})),m(e);break}}}let P=[],F=v?``:` (requires extension)`;!v&&!S&&P.push({label:`Install Chrome extension`,value:`install-extension`}),P.push({label:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a,{children:`Manage permissions`}),(0,A.jsx)(a,{dimColor:!0,children:F})]}),value:`manage-permissions`},{label:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(a,{children:`Reconnect extension`}),(0,A.jsx)(a,{dimColor:!0,children:F})]}),value:`reconnect`},{label:`Enabled by default: ${p?`Yes`:`No`}`,value:`toggle-default`});let I=s||process.env.USER_TYPE!==`ant`&&!i;return(0,A.jsx)(o,{title:`Claude in Chrome (Beta)`,onCancel:()=>e(),color:`chromeYellow`,children:(0,A.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,A.jsx)(a,{children:`Claude in Chrome works with the Chrome extension to let you control your browser directly from Claude Code. Navigate websites, fill forms, capture screenshots, record GIFs, and debug with console logs and network requests.`}),s&&(0,A.jsx)(a,{color:`error`,children:`Claude in Chrome is not supported in WSL at this time.`}),process.env.USER_TYPE!==`ant`&&!i&&(0,A.jsx)(a,{color:`error`,children:`Claude in Chrome requires a claude.ai subscription.`}),!I&&(0,A.jsxs)(A.Fragment,{children:[!S&&(0,A.jsxs)(c,{flexDirection:`column`,children:[(0,A.jsxs)(a,{children:[`Status: `,C?(0,A.jsx)(a,{color:`success`,children:`Enabled`}):(0,A.jsx)(a,{color:`inactive`,children:`Disabled`})]}),(0,A.jsxs)(a,{children:[`Extension:`,` `,v?(0,A.jsx)(a,{color:`success`,children:`Installed`}):(0,A.jsx)(a,{color:`warning`,children:`Not detected`})]})]}),(0,A.jsx)(_,{options:P,onChange:O,hideIndexes:!0},d),h&&(0,A.jsxs)(a,{color:`warning`,children:[`Once installed, select `,`"Reconnect extension"`,` to connect.`]}),(0,A.jsxs)(a,{children:[(0,A.jsx)(a,{dimColor:!0,children:`Usage: `}),(0,A.jsx)(a,{children:`claude --chrome`}),(0,A.jsx)(a,{dimColor:!0,children:` or `}),(0,A.jsx)(a,{children:`claude --no-chrome`})]}),(0,A.jsx)(a,{dimColor:!0,children:`Site-level permissions are inherited from the Chrome extension. Manage permissions in the Chrome extension settings to control which sites Claude can browse, click, and type on.`})]}),(0,A.jsx)(a,{dimColor:!0,children:`Learn more: https://code.claude.com/docs/en/chrome`})]})})}var k,A,j,M,N,P;e((()=>{k=t(i(),1),y(),s(),v(),p(),S(),C(),D(),m(),h(),r(),A=l(),j=`https://claude.ai/chrome`,M=`https://clau.de/chrome/permissions`,N=`https://clau.de/chrome/reconnect`,P=async function(e){let t=await E(),n=d(),r=f(),i=g.isWslEnvironment();return(0,A.jsx)(O,{onDone:e,isExtensionInstalled:t,configEnabled:n.claudeInChromeDefaultEnabled,isClaudeAISubscriber:r,isWSL:i})}}))();export{P as call};