groove-dev 0.22.22 → 0.22.24
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/node_modules/@groove-dev/gui/dist/assets/{index-COKbbm6r.js → index-BX6hv3XJ.js} +1 -1
- package/node_modules/@groove-dev/gui/dist/assets/{index-Cu3h6_1j.css → index-BlH4CGdR.css} +1 -1
- package/node_modules/@groove-dev/gui/dist/index.html +2 -2
- package/node_modules/@groove-dev/gui/package.json +1 -1
- package/node_modules/@groove-dev/gui/src/components/agents/agent-feed.jsx +4 -3
- package/package.json +1 -1
- package/packages/gui/dist/assets/{index-COKbbm6r.js → index-BX6hv3XJ.js} +1 -1
- package/packages/gui/dist/assets/{index-Cu3h6_1j.css → index-BlH4CGdR.css} +1 -1
- package/packages/gui/dist/index.html +2 -2
- package/packages/gui/package.json +1 -1
- package/packages/gui/src/components/agents/agent-feed.jsx +4 -3
|
@@ -568,7 +568,7 @@ If you want to hide the \`${n.titleName}\`, you can wrap it with our VisuallyHid
|
|
|
568
568
|
|
|
569
569
|
For more information, see https://radix-ui.com/primitives/docs/components/${n.docsSlug}`;return y.useEffect(()=>{t&&(document.getElementById(t)||console.error(s))},[s,t]),null},sC="DialogDescriptionWarning",lC=({contentRef:t,descriptionId:n})=>{const l=`Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${wS(sC).contentName}}.`;return y.useEffect(()=>{var u;const i=(u=t.current)==null?void 0:u.getAttribute("aria-describedby");n&&i&&(document.getElementById(n)||console.warn(l))},[l,t,n]),null},$S=OS,kS=mS,TS=pS,PS=xS,NS=bS,zS=yS,RS=QS;function rC({children:t,...n}){return o.jsx($S,{...n,children:t})}function iC({children:t,className:n,title:s,description:l,...i}){return o.jsxs(kS,{children:[o.jsx(TS,{className:"fixed inset-0 z-50 bg-black/50 backdrop-blur-sm data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0"}),o.jsxs(PS,{className:se("fixed left-1/2 top-1/2 z-50 -translate-x-1/2 -translate-y-1/2","w-full max-w-lg max-h-[85vh] overflow-y-auto","bg-surface-1 border border-border rounded-lg shadow-2xl","data-[state=open]:animate-in data-[state=closed]:animate-out","data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0","data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",n),...i,children:[s&&o.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border-subtle",children:[o.jsx(NS,{className:"text-base font-semibold text-text-0 font-sans",children:s}),o.jsx(RS,{className:"p-1 rounded-md text-text-3 hover:text-text-0 hover:bg-surface-5 transition-colors",children:o.jsx(Nt,{size:16})})]}),l&&o.jsx(zS,{className:"sr-only",children:l}),t]})]})}var c0={};function oC({path:t,onNavigate:n}){const s=t.split("/").filter(Boolean);return o.jsxs("div",{className:"flex items-center gap-0.5 min-w-0 overflow-x-auto py-1.5 scrollbar-none",children:[o.jsx("button",{onClick:()=>n("/"),className:"flex-shrink-0 p-1 rounded hover:bg-surface-5 cursor-pointer text-text-3 hover:text-text-0 transition-colors",children:o.jsx(wb,{size:13})}),s.map((l,i)=>{const u="/"+s.slice(0,i+1).join("/"),d=i===s.length-1;return o.jsxs("div",{className:"flex items-center gap-0.5 flex-shrink-0",children:[o.jsx(si,{size:11,className:"text-text-4"}),o.jsx("button",{onClick:()=>n(u),className:se("px-1.5 py-0.5 rounded text-xs font-mono cursor-pointer transition-colors",d?"text-text-0 bg-surface-4 font-medium":"text-text-3 hover:text-text-0 hover:bg-surface-5"),children:l})]},i)})]})}function XS({open:t,onOpenChange:n,currentPath:s,onSelect:l}){const[i,u]=y.useState(s||c0.HOME||"/"),[d,f]=y.useState([]),[m,p]=y.useState(!1),[x,g]=y.useState(null);y.useEffect(()=>{t&&b(s||"/")},[t]);async function b(T){p(!0),g(null);try{const k=await J.get(`/browse-system?path=${encodeURIComponent(T)}`);u(k.current||T),f(k.dirs||[])}catch(k){g(k.message),f([])}p(!1)}function S(){const T=i==="/"?"/":i.split("/").slice(0,-1).join("/")||"/";b(T)}function w(){b(c0.HOME||"/Users")}function j(){l(i),n(!1)}return o.jsx(rC,{open:t,onOpenChange:n,children:o.jsx(iC,{title:"Select Working Directory",description:"Choose a directory for this agent to work in",className:"max-w-[520px]",children:o.jsxs("div",{className:"px-5 py-4 space-y-3",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("button",{onClick:S,disabled:i==="/",className:"p-1.5 rounded-md bg-surface-4 border border-border text-text-2 hover:text-text-0 hover:bg-surface-5 transition-colors cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed",children:o.jsx(dT,{size:14})}),o.jsx("button",{onClick:w,className:"p-1.5 rounded-md bg-surface-4 border border-border text-text-2 hover:text-text-0 hover:bg-surface-5 transition-colors cursor-pointer",children:o.jsx(u5,{size:14})}),o.jsx("div",{className:"flex-1 min-w-0 bg-surface-0 rounded-md border border-border-subtle px-2",children:o.jsx(oC,{path:i,onNavigate:b})})]}),o.jsx("div",{className:"bg-surface-0 rounded-lg border border-border-subtle overflow-hidden",children:o.jsxs("div",{className:"max-h-[340px] overflow-y-auto",children:[m&&o.jsx("div",{className:"flex items-center justify-center py-8",children:o.jsx(kb,{size:18,className:"text-text-3 animate-spin"})}),x&&o.jsx("div",{className:"px-4 py-6 text-center",children:o.jsx("p",{className:"text-xs text-danger font-sans",children:x})}),!m&&!x&&d.length===0&&o.jsx("div",{className:"px-4 py-6 text-center",children:o.jsx("p",{className:"text-xs text-text-3 font-sans",children:"No subdirectories"})}),!m&&!x&&d.map(T=>o.jsxs("button",{onClick:()=>b(T.path),className:se("w-full flex items-center gap-2.5 px-3.5 py-2 text-left cursor-pointer","hover:bg-surface-4 transition-colors border-b border-border-subtle last:border-0"),children:[T.hasChildren?o.jsx(FT,{size:15,className:"text-warning flex-shrink-0"}):o.jsx(Dr,{size:15,className:"text-text-3 flex-shrink-0"}),o.jsx("span",{className:"text-sm text-text-0 font-sans truncate flex-1",children:T.name}),T.hasChildren&&o.jsx(si,{size:12,className:"text-text-4 flex-shrink-0"})]},T.path))]})}),o.jsxs("div",{className:"flex items-center gap-3 bg-surface-4/50 rounded-lg px-3.5 py-2.5 border border-border-subtle",children:[o.jsx(Dr,{size:16,className:"text-accent flex-shrink-0"}),o.jsx("span",{className:"text-xs font-mono text-text-1 truncate flex-1",children:i})]}),o.jsxs("div",{className:"flex justify-end gap-2",children:[o.jsx(Se,{variant:"ghost",size:"md",onClick:()=>n(!1),children:"Cancel"}),o.jsxs(Se,{variant:"primary",size:"md",onClick:j,className:"gap-1.5",children:[o.jsx(la,{size:14})," Select Folder"]})]})]})})})}function _S({children:t,...n}){return o.jsx($S,{...n,children:t})}function CS({children:t,className:n,title:s,side:l="right",width:i=400,...u}){return o.jsxs(kS,{children:[o.jsx(TS,{className:"fixed inset-0 z-40 bg-black/30"}),o.jsxs(PS,{className:se("fixed top-0 z-50 h-full overflow-y-auto","bg-surface-1 border-l border-border shadow-2xl","data-[state=open]:animate-in data-[state=closed]:animate-out",l==="right"&&"right-0 data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right",l==="left"&&"left-0 data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left",n),style:{width:i},...u,children:[s&&o.jsxs("div",{className:"flex items-center justify-between px-5 py-4 border-b border-border-subtle sticky top-0 bg-surface-1 z-10",children:[o.jsx(NS,{className:"text-base font-semibold text-text-0 font-sans",children:s}),o.jsx(RS,{className:"p-1 rounded-md text-text-3 hover:text-text-0 hover:bg-surface-5 transition-colors cursor-pointer",children:o.jsx(Nt,{size:16})})]}),o.jsx(zS,{className:"sr-only",children:"Panel"}),t]})]})}function cC({value:t,onChange:n}){return o.jsx("button",{onClick:()=>n(!t),className:se("w-9 h-5 rounded-full p-0.5 transition-colors cursor-pointer",t?"bg-accent":"bg-surface-5"),children:o.jsx("div",{className:se("w-4 h-4 rounded-full bg-white shadow-sm transition-transform",t?"translate-x-4":"translate-x-0")})})}function uC({user:t}){const[n,s]=y.useState(!1),l=(t==null?void 0:t.avatar)||(t==null?void 0:t.picture)||(t==null?void 0:t.photoURL)||(t==null?void 0:t.photo);return l&&!n?o.jsx("img",{src:l,alt:"",className:"w-6 h-6 rounded-full",referrerPolicy:"no-referrer",crossOrigin:"anonymous",onError:()=>s(!0)}):o.jsx("div",{className:"w-6 h-6 rounded-full bg-accent/10 flex items-center justify-center",children:o.jsx(Vb,{size:12,className:"text-accent"})})}function dC({provider:t,onKeyChange:n}){var T,k;const[s,l]=y.useState(!1),[i,u]=y.useState(""),[d,f]=y.useState(!1),[m,p]=y.useState(!1),x=D(z=>z.addToast),g=t.authType==="local",b=t.authType==="subscription",S=g||b?t.installed:t.hasKey;async function w(){if(i.trim())try{await J.post(`/credentials/${t.id}`,{key:i.trim()}),x("success",`API key set for ${t.name}`),u(""),l(!1),n&&n()}catch(z){x("error","Failed to set key",z.message)}}async function j(){try{await J.delete(`/credentials/${t.id}`),x("info",`Removed ${t.name} key`),n&&n()}catch(z){x("error","Remove failed",z.message)}}return g?o.jsxs("div",{className:"flex flex-col rounded-lg border border-border-subtle bg-surface-1 overflow-hidden min-w-[220px]",children:[o.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-3 border-b border-border-subtle",children:[o.jsx(Qs,{status:S?"running":"crashed",size:"sm"}),o.jsx("span",{className:"text-[13px] font-semibold text-text-0 font-sans",children:t.name}),o.jsx("div",{className:"flex-1"}),S?o.jsxs(De,{variant:"success",className:"text-2xs gap-1",children:[o.jsx(la,{size:8})," Ready"]}):o.jsx(De,{variant:"default",className:"text-2xs",children:"Not installed"})]}),o.jsx("div",{className:"flex-1",children:m?o.jsx(Jy,{isInstalled:S,onModelChange:n}):o.jsxs("div",{className:"px-4 py-3 flex flex-col h-full",children:[o.jsx("div",{className:"text-xs text-text-3 font-sans flex-1",children:S?`${((T=t.models)==null?void 0:T.length)||0} models available`:"Local AI models — free, private, no API key"}),o.jsxs(Se,{variant:S?"secondary":"primary",size:"sm",onClick:()=>p(!0),className:"w-full h-7 text-2xs gap-1.5 mt-3",children:[o.jsx(Af,{size:11}),S?"Manage Models":"Set Up Ollama"]})]})})]}):o.jsxs("div",{className:"flex flex-col rounded-lg border border-border-subtle bg-surface-1 overflow-hidden min-w-[220px]",children:[o.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-3 border-b border-border-subtle",children:[o.jsx(Qs,{status:S?"running":"crashed",size:"sm"}),o.jsx("span",{className:"text-[13px] font-semibold text-text-0 font-sans",children:t.name}),o.jsx("div",{className:"flex-1"}),S?o.jsxs(De,{variant:"success",className:"text-2xs gap-1",children:[o.jsx(la,{size:8})," Ready"]}):o.jsx(De,{variant:"default",className:"text-2xs",children:b?"Not installed":"No key"})]}),o.jsxs("div",{className:"flex-1 flex flex-col px-4 py-3 min-h-[120px]",children:[((k=t.models)==null?void 0:k.length)>0&&o.jsx("div",{className:"flex flex-wrap gap-1 mb-3",children:t.models.map(z=>o.jsx("span",{className:"px-1.5 py-0.5 rounded bg-surface-4 text-2xs font-mono text-text-3",children:z.name||z.id},z.id))}),b&&S&&!t.hasKey&&!s&&o.jsxs("div",{className:"flex items-center gap-1.5 h-8 px-2.5 bg-accent/8 border border-accent/20 rounded-md text-2xs font-sans text-accent mb-3",children:[o.jsx(la,{size:10})," Subscription active"]}),t.hasKey&&!s&&o.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[o.jsxs("div",{className:"flex-1 flex items-center gap-1.5 h-8 px-2.5 bg-success/8 border border-success/20 rounded-md text-2xs font-sans text-success",children:[o.jsx(la,{size:10})," API Connected"]}),o.jsx("button",{onClick:()=>{l(!0),f(!1),u("")},className:"text-2xs text-text-4 hover:text-accent cursor-pointer font-sans",children:"Edit"}),o.jsx("button",{onClick:j,className:"text-2xs text-text-4 hover:text-danger cursor-pointer font-sans",children:"Remove"})]}),o.jsx("div",{className:"flex-1"}),s&&o.jsxs("div",{className:"space-y-2.5 pt-1",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-2xs font-semibold text-text-2 font-sans mb-1.5 block",children:t.hasKey?"Update API Key":`${t.name} API Key`}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{value:i,onChange:z=>u(z.target.value),onKeyDown:z=>z.key==="Enter"&&w(),type:d?"text":"password",placeholder:"sk-...",className:"w-full h-9 px-3 pr-9 text-xs bg-surface-0 border border-border rounded-md text-text-0 font-mono placeholder:text-text-4 focus:outline-none focus:ring-1 focus:ring-accent",autoFocus:!0}),o.jsx("button",{onClick:()=>f(!d),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-4 hover:text-text-2 cursor-pointer",children:d?o.jsx(qf,{size:12}):o.jsx(li,{size:12})})]})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Se,{variant:"primary",size:"sm",onClick:w,disabled:!i.trim(),className:"flex-1 h-8 text-xs",children:"Save Key"}),o.jsx(Se,{variant:"ghost",size:"sm",onClick:()=>{l(!1),u("")},className:"h-8 text-xs px-3",children:"Cancel"})]})]}),!s&&!t.hasKey&&o.jsxs(Se,{variant:b?"secondary":"primary",size:"sm",onClick:()=>{l(!0),f(!1),u("")},className:"w-full h-8 text-2xs gap-1.5 mt-2",children:[o.jsx(oc,{size:11}),b?"Add API key for headless mode":"Add API Key"]})]})]})}function xl({icon:t,label:n,description:s,children:l}){return o.jsxs("div",{className:"rounded-lg border border-border-subtle bg-surface-1 px-4 py-3.5 flex flex-col gap-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("div",{className:"w-6 h-6 rounded bg-accent/8 flex items-center justify-center flex-shrink-0",children:o.jsx(t,{size:12,className:"text-accent"})}),o.jsx("div",{className:"text-[13px] font-medium text-text-0 font-sans leading-tight",children:n})]}),o.jsx("div",{className:"text-2xs text-text-4 font-sans leading-relaxed",children:s}),o.jsx("div",{className:"mt-auto pt-1",children:l})]})}const ZS={telegram:Vf,discord:ri,slack:Pb},bs={telegram:"Telegram",discord:"Discord",slack:"Slack"},OC={telegram:"Bot token from @BotFather",discord:"Bot token from Developer Portal",slack:"Bot token (xoxb-...)"},fC=["critical","lifecycle","all"];function hC({type:t,open:n,onOpenChange:s}){if(!t)return null;const i={telegram:{title:"Set Up Telegram",icon:Vf,intro:"Create a Telegram bot and connect it to Groove in under 2 minutes. No dependencies required.",sections:[{title:"Create Your Bot",steps:[{text:"Open Telegram on any device and search for",link:"https://t.me/BotFather",linkText:"@BotFather"},{text:"Send /newbot to start the setup"},{text:"Choose a display name — we suggest GroovePilot"},{text:'Choose a username (must end in "bot") — e.g. GroovePilot_bot'},{text:"BotFather will reply with your bot token — copy it"}]},{title:"Connect to Groove",steps:[{text:"In Groove Settings > Gateways, click Set Token on the Telegram card"},{text:"Paste your bot token and click Save"},{text:"The gateway will connect automatically"}]},{title:"Link a Chat",steps:[{text:"Open a chat with your new bot in Telegram"},{text:'Send any message (e.g. "hello") — Groove captures the chat ID automatically'},{text:"Click Test in the gateway card to verify"}]},{title:"Commands",note:"All commands use / prefix in Telegram:",commands:["/instruct <team> <msg>","/query <team> <question>","/plan <description>","/log <team>","/brief","/tokens","/status","/agents","/help"]}]},discord:{title:"Set Up Discord",icon:ri,intro:"Create a Discord bot and add it to your server. Requires discord.js (installed automatically with Groove).",sections:[{title:"Create the Application",steps:[{text:"Go to the",link:"https://discord.com/developers/applications",linkText:"Discord Developer Portal"},{text:"Click New Application and name it GroovePilot"},{text:"Go to the Bot tab in the left sidebar"},{text:"Click Reset Token and copy the bot token"}]},{title:"Set Permissions & Invite",steps:[{text:"Go to OAuth2 > URL Generator"},{text:"Under Scopes, check bot"},{text:"Under Bot Permissions, check:"}],scopes:["Send Messages","Read Message History","Embed Links","Use External Emojis"],after:[{text:"Copy the generated URL at the bottom and open it in your browser"},{text:"Select your server and click Authorize"}]},{title:"Enable Message Content Intent",steps:[{text:"Go back to the Bot tab in the Developer Portal"},{text:"Scroll to Privileged Gateway Intents"},{text:"Enable Message Content Intent — required for the bot to read commands"},{text:"Click Save Changes"}]},{title:"Connect to Groove",steps:[{text:"In Groove Settings > Gateways, click Set Token on the Discord card"},{text:"Paste your bot token and click Save"},{text:"Send a message in any channel where the bot is — Groove captures the channel automatically"}]},{title:"Commands",note:"All commands use / prefix in Discord:",commands:["/instruct <team> <msg>","/query <team> <question>","/plan <description>","/log <team>","/brief","/tokens","/status","/agents","/help"]}]},slack:{title:"Set Up Slack",icon:Pb,intro:"Create a Slack app with Socket Mode — no public URL needed. Requires @slack/bolt (installed automatically with Groove).",sections:[{title:"Create the App",steps:[{text:"Go to",link:"https://api.slack.com/apps",linkText:"api.slack.com/apps"},{text:"Click Create New App > From scratch"},{text:"Name it GroovePilot and select your workspace"}]},{title:"Enable Socket Mode",steps:[{text:"In the left sidebar, go to Settings > Socket Mode"},{text:"Toggle Enable Socket Mode to on"},{text:"It will ask you to create an App-Level Token"},{text:'Name it "groove", add the connections:write scope'},{text:"Click Generate — copy the xapp-... token (this is your App Token)"}],important:"Save this token now — you can't view it again after closing the dialog."},{title:"Set Bot Token Scopes",steps:[{text:"Go to Features > OAuth & Permissions"},{text:"Scroll to Bot Token Scopes and add all of these:"}],scopes:["chat:write","channels:read","channels:history","groups:read","groups:history","im:history","app_mentions:read"],after:[{text:"Scroll up and click Install to Workspace"},{text:"Click Allow to grant permissions"},{text:"Copy the Bot User OAuth Token (xoxb-...) — this is your Bot Token"}]},{title:"Enable Events",steps:[{text:"Go to Features > Event Subscriptions"},{text:"Toggle Enable Events to on"},{text:"Under Subscribe to bot events, add:"}],scopes:["message.channels","message.im","app_mention"],after:[{text:"Click Save Changes at the bottom"}]},{title:"Connect to Groove",steps:[{text:"In Groove Settings > Gateways, click Set Token on the Slack card"},{text:"Paste your Bot Token (xoxb-...) in the first field"},{text:"Paste your App Token (xapp-...) in the second field"},{text:"Click Save — Groove will auto-connect"}]},{title:"Link a Channel",steps:[{text:"Invite the bot to a channel: /invite @GroovePilot"},{text:"Select the channel from the dropdown in the gateway card"},{text:"Or @mention the bot — it will auto-capture the channel"},{text:"Click Test to verify"}],important:"For private channels, make sure you added the groups:read scope."},{title:"Commands",note:"In Slack, use plain text commands (no / prefix) or @mention the bot:",commands:["instruct <team> <msg>","query <team> <question>","plan <description>","log <team>","brief","tokens","status","agents","help","@GroovePilot status"]}]}}[t];if(!i)return null;const u=i.icon;return o.jsx(_S,{open:n,onOpenChange:s,children:o.jsx(CS,{title:i.title,width:480,children:o.jsxs("div",{className:"px-5 py-4 space-y-5",children:[o.jsxs("div",{className:"flex items-start gap-3 p-3 bg-accent/5 border border-accent/15 rounded-lg",children:[o.jsx("div",{className:"w-8 h-8 rounded-lg bg-accent/10 flex items-center justify-center flex-shrink-0 mt-0.5",children:o.jsx(u,{size:16,className:"text-accent"})}),o.jsx("p",{className:"text-xs text-text-2 font-sans leading-relaxed",children:i.intro})]}),i.sections.map((d,f)=>{var m;return o.jsxs("div",{children:[o.jsxs("h3",{className:"text-xs font-semibold text-text-0 font-sans mb-2.5 flex items-center gap-2",children:[o.jsx("span",{className:"w-5 h-5 rounded-full bg-accent/10 flex items-center justify-center text-2xs font-bold text-accent",children:f+1}),d.title]}),d.note&&o.jsx("p",{className:"text-2xs text-text-3 font-sans mb-2",children:d.note}),d.steps&&o.jsx("ol",{className:"space-y-2 mb-2",children:d.steps.map((p,x)=>o.jsxs("li",{className:"flex gap-2 text-2xs text-text-2 font-sans leading-relaxed",children:[o.jsxs("span",{className:"text-text-4 font-mono w-4 flex-shrink-0 pt-px",children:[x+1,"."]}),o.jsxs("span",{children:[p.text,p.link&&o.jsxs(o.Fragment,{children:[" ",o.jsxs("a",{href:p.link,target:"_blank",rel:"noopener noreferrer",className:"text-accent hover:underline inline-flex items-center gap-0.5 font-medium",children:[p.linkText,o.jsx(ic,{size:9})]})]})]})]},x))}),d.scopes&&o.jsx("div",{className:"flex flex-wrap gap-1.5 mb-2 ml-6",children:d.scopes.map(p=>o.jsx("code",{className:"px-2 py-0.5 rounded bg-surface-4 text-2xs font-mono text-accent",children:p},p))}),d.after&&o.jsx("ol",{className:"space-y-2 mb-2",start:(((m=d.steps)==null?void 0:m.length)||0)+1,children:d.after.map((p,x)=>{var g;return o.jsxs("li",{className:"flex gap-2 text-2xs text-text-2 font-sans leading-relaxed",children:[o.jsxs("span",{className:"text-text-4 font-mono w-4 flex-shrink-0 pt-px",children:[(((g=d.steps)==null?void 0:g.length)||0)+x+1,"."]}),o.jsx("span",{children:p.text})]},x)})}),d.important&&o.jsx("div",{className:"ml-6 p-2 bg-warning/8 border border-warning/20 rounded-md text-2xs text-warning font-sans",children:d.important}),d.commands&&o.jsx("div",{className:"ml-6 p-2.5 bg-surface-0 border border-border-subtle rounded-md space-y-1",children:d.commands.map(p=>o.jsx("code",{className:"block text-2xs font-mono text-text-1",children:p},p))})]},f)}),o.jsxs("a",{href:"https://docs.groovedev.ai/guide/gateways",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1.5 text-2xs text-accent hover:text-accent/80 font-sans font-medium mt-2",children:[o.jsx(ic,{size:10}),"Full documentation at docs.groovedev.ai"]})]})})})}function mC({gateway:t,onRefresh:n}){var be,pe;const[s,l]=y.useState(!1),[i,u]=y.useState(""),[d,f]=y.useState(""),[m,p]=y.useState(!1),[x,g]=y.useState(!1),[b,S]=y.useState(!1),[w,j]=y.useState([]),[T,k]=y.useState(!1),z=D(K=>K.addToast);y.useEffect(()=>{t.connected&&!t.chatId&&t.type==="slack"&&J.get(`/gateways/${t.id}/channels`).then(K=>j(Array.isArray(K)?K:[])).catch(()=>{})},[t.connected,t.chatId,t.id,t.type]);const R=ZS[t.type]||_b,E=t.type==="slack";async function G(){if(i.trim())try{await J.post(`/gateways/${t.id}/credentials`,{key:"bot_token",value:i.trim()}),E&&d.trim()&&await J.post(`/gateways/${t.id}/credentials`,{key:"app_token",value:d.trim()}),z("success","Token saved — connecting..."),u(""),f(""),l(!1);try{await J.post(`/gateways/${t.id}/connect`),z("success",`${bs[t.type]} connected!`)}catch(K){z("error","Token saved but connect failed",K.message)}n()}catch(K){z("error","Failed to save token",K.message)}}async function _(){g(!0);try{await J.post(`/gateways/${t.id}/test`),z("success","Test message sent!")}catch(K){z("error","Test failed",K.message)}g(!1)}async function N(){S(!0);try{t.connected?(await J.post(`/gateways/${t.id}/disconnect`),z("info",`${bs[t.type]} disconnected`)):(await J.post(`/gateways/${t.id}/connect`),z("success",`${bs[t.type]} connected!`)),n()}catch(K){z("error",t.connected?"Disconnect failed":"Connect failed",K.message)}S(!1)}async function $(K){try{await J.patch(`/gateways/${t.id}`,{enabled:K}),n()}catch(Z){z("error","Update failed",Z.message)}}async function W(K){try{await J.patch(`/gateways/${t.id}`,{notifications:{preset:K}}),n()}catch(Z){z("error","Update failed",Z.message)}}async function V(K){try{await J.patch(`/gateways/${t.id}`,{commandPermission:K}),n()}catch(Z){z("error","Update failed",Z.message)}}async function le(){try{await J.delete(`/gateways/${t.id}`),z("info",`${bs[t.type]} gateway removed`),n()}catch(K){z("error","Delete failed",K.message)}}const Oe=((be=t.notifications)==null?void 0:be.preset)||"critical";return o.jsxs("div",{className:"flex flex-col rounded-lg border border-border-subtle bg-surface-1 overflow-hidden min-w-[220px]",children:[o.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-3 border-b border-border-subtle",children:[o.jsx(Qs,{status:t.connected?"running":"crashed",size:"sm"}),o.jsx(R,{size:13,className:"text-text-2"}),o.jsx("span",{className:"text-[13px] font-semibold text-text-0 font-sans",children:bs[t.type]}),o.jsx("div",{className:"flex-1"}),t.connected?o.jsxs(De,{variant:"success",className:"text-2xs gap-1",children:[o.jsx(Gg,{size:8})," Connected"]}):t.enabled?o.jsx(De,{variant:"warning",className:"text-2xs",children:"Disconnected"}):o.jsx(De,{variant:"default",className:"text-2xs",children:"Disabled"})]}),o.jsxs("div",{className:"flex-1 flex flex-col px-4 py-3 min-h-[140px]",children:[t.connected&&!s&&o.jsxs(o.Fragment,{children:[o.jsxs("div",{className:"flex items-center gap-1.5 h-8 px-2.5 bg-success/8 border border-success/20 rounded-md text-2xs font-sans text-success mb-3",children:[o.jsx(la,{size:10})," Gateway active",t.botUsername&&o.jsxs("span",{className:"text-text-4 ml-1",children:["@",t.botUsername]}),t.botTag&&o.jsx("span",{className:"text-text-4 ml-1",children:t.botTag})]}),o.jsxs("div",{className:"mb-3",children:[o.jsx("label",{className:"text-2xs font-semibold text-text-3 font-sans mb-1.5 block",children:t.type==="slack"?"Channel":"Chat ID"}),t.chatId?o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("code",{className:"flex-1 flex items-center h-7 px-2 bg-surface-0 border border-border-subtle rounded-md text-2xs font-mono text-text-2",children:t.type==="slack"&&w.length>0?`#${((pe=w.find(K=>K.id===t.chatId))==null?void 0:pe.name)||t.chatId}`:t.chatId}),o.jsx("button",{onClick:async()=>{try{await J.patch(`/gateways/${t.id}`,{chatId:null}),n()}catch(K){z("error","Failed",K.message)}},className:"text-2xs text-text-4 hover:text-text-1 cursor-pointer font-sans",children:"Change"})]}):t.type==="slack"&&w.length>0?o.jsxs("select",{onChange:async K=>{if(K.target.value)try{await J.patch(`/gateways/${t.id}`,{chatId:K.target.value}),n()}catch(Z){z("error","Failed to set channel",Z.message)}},className:"w-full h-7 px-2 text-2xs bg-surface-0 border border-border-subtle rounded-md text-text-0 font-sans focus:outline-none focus:ring-1 focus:ring-accent cursor-pointer",defaultValue:"",children:[o.jsx("option",{value:"",disabled:!0,children:"Select a channel..."}),w.map(K=>o.jsxs("option",{value:K.id,children:["#",K.name]},K.id))]}):o.jsxs("div",{className:"text-2xs text-warning font-sans",children:[t.type==="slack"?"No channels found — invite the bot to a channel first.":"Send a message to the bot to auto-capture, or enter manually:",o.jsx("input",{placeholder:t.type==="slack"?"C0123456789":"Chat ID",className:"mt-1 w-full h-7 px-2 text-2xs bg-surface-0 border border-border rounded-md text-text-0 font-mono placeholder:text-text-4 focus:outline-none focus:ring-1 focus:ring-accent",onKeyDown:async K=>{if(K.key==="Enter"&&K.target.value.trim())try{await J.patch(`/gateways/${t.id}`,{chatId:K.target.value.trim()}),n()}catch(Z){z("error","Failed to set channel",Z.message)}}})]})]}),o.jsxs("div",{className:"mb-3",children:[o.jsx("label",{className:"text-2xs font-semibold text-text-3 font-sans mb-1.5 block",children:"Notifications"}),o.jsx("div",{className:"flex bg-surface-0 rounded-md p-0.5 border border-border-subtle",children:fC.map(K=>o.jsx("button",{onClick:()=>W(K),className:se("flex-1 px-2 py-1.5 text-2xs font-semibold font-sans rounded transition-all cursor-pointer capitalize",Oe===K?"bg-accent/15 text-accent shadow-sm":"text-text-3 hover:text-text-1"),children:K},K))})]}),o.jsxs("div",{className:"mb-3",children:[o.jsx("label",{className:"text-2xs font-semibold text-text-3 font-sans mb-1.5 block",children:"Commands"}),o.jsx("div",{className:"flex bg-surface-0 rounded-md p-0.5 border border-border-subtle",children:["full","read-only"].map(K=>o.jsx("button",{onClick:()=>V(K),className:se("flex-1 px-2 py-1.5 text-2xs font-semibold font-sans rounded transition-all cursor-pointer capitalize",(t.commandPermission||"full")===K?"bg-accent/15 text-accent shadow-sm":"text-text-3 hover:text-text-1"),children:K==="full"?"Full Access":"Read Only"},K))})]})]}),!t.connected&&!s&&o.jsxs(o.Fragment,{children:[o.jsx("div",{className:"text-xs text-text-3 font-sans mb-2",children:t.enabled?t.hasCredentials?"Tokens saved — click Connect.":"Configure bot token to connect.":"Gateway is disabled."}),!t.hasCredentials&&o.jsxs("button",{onClick:()=>k(!0),className:"flex items-center gap-1.5 text-2xs text-accent hover:text-accent/80 font-sans font-medium cursor-pointer mb-2",children:[o.jsx(lc,{size:11}),"How to set up",o.jsx(ic,{size:9})]})]}),o.jsx(hC,{type:t.type,open:T,onOpenChange:k}),o.jsx("div",{className:"flex-1"}),s&&o.jsxs("div",{className:"space-y-2.5 pt-1",children:[o.jsxs("button",{onClick:()=>k(!0),className:"flex items-center gap-1.5 text-2xs text-accent hover:text-accent/80 font-sans font-medium cursor-pointer",children:[o.jsx(lc,{size:11}),"Where do I get these?"]}),o.jsxs("div",{children:[o.jsx("label",{className:"text-2xs font-semibold text-text-2 font-sans mb-1.5 block",children:"Bot Token"}),o.jsxs("div",{className:"relative",children:[o.jsx("input",{value:i,onChange:K=>u(K.target.value),onKeyDown:K=>K.key==="Enter"&&!E&&G(),type:m?"text":"password",placeholder:OC[t.type],className:"w-full h-9 px-3 pr-9 text-xs bg-surface-0 border border-border rounded-md text-text-0 font-mono placeholder:text-text-4 focus:outline-none focus:ring-1 focus:ring-accent",autoFocus:!0}),o.jsx("button",{onClick:()=>p(!m),className:"absolute right-2.5 top-1/2 -translate-y-1/2 text-text-4 hover:text-text-2 cursor-pointer",children:m?o.jsx(qf,{size:12}):o.jsx(li,{size:12})})]})]}),E&&o.jsxs("div",{children:[o.jsx("label",{className:"text-2xs font-semibold text-text-2 font-sans mb-1.5 block",children:"App Token (Socket Mode)"}),o.jsx("input",{value:d,onChange:K=>f(K.target.value),onKeyDown:K=>K.key==="Enter"&&G(),type:m?"text":"password",placeholder:"xapp-...",className:"w-full h-9 px-3 text-xs bg-surface-0 border border-border rounded-md text-text-0 font-mono placeholder:text-text-4 focus:outline-none focus:ring-1 focus:ring-accent"})]}),o.jsxs("div",{className:"flex gap-2",children:[o.jsx(Se,{variant:"primary",size:"sm",onClick:G,disabled:!i.trim(),className:"flex-1 h-8 text-xs",children:"Save Token"}),o.jsx(Se,{variant:"ghost",size:"sm",onClick:()=>{l(!1),u(""),f("")},className:"h-8 text-xs px-3",children:"Cancel"})]})]}),!s&&o.jsxs("div",{className:"flex gap-2 mt-2",children:[!t.connected&&o.jsxs(Se,{variant:"primary",size:"sm",onClick:()=>l(!0),className:"flex-1 h-7 text-2xs gap-1.5",children:[o.jsx(oc,{size:11}),t.enabled?"Set Token":"Configure"]}),t.connected&&o.jsxs(o.Fragment,{children:[o.jsxs(Se,{variant:"secondary",size:"sm",onClick:_,disabled:x,className:"flex-1 h-7 text-2xs gap-1.5",children:[o.jsx(Uf,{size:11}),x?"Sending...":"Test"]}),o.jsx(Se,{variant:"secondary",size:"sm",onClick:()=>l(!0),className:"h-7 text-2xs px-2.5",children:o.jsx(oc,{size:11})})]}),o.jsx(Se,{variant:"ghost",size:"sm",onClick:N,disabled:b,className:"h-7 text-2xs px-2.5",title:t.connected?"Disconnect":"Connect",children:t.connected?o.jsx(Rb,{size:11}):o.jsx(Gg,{size:11})}),o.jsx(cC,{value:t.enabled,onChange:$}),o.jsx("button",{onClick:le,className:"text-text-4 hover:text-danger cursor-pointer p-1",title:"Remove gateway",children:o.jsx(Rc,{size:11})})]})]})]})}function pC({existingTypes:t,onAdd:n}){const[s,l]=y.useState(!1),i=["telegram","discord","slack"].filter(u=>!t.includes(u));return i.length===0?null:s?o.jsxs("div",{className:"flex flex-col rounded-lg border border-accent/30 bg-surface-1 overflow-hidden min-w-[220px]",children:[o.jsxs("div",{className:"flex items-center gap-2.5 px-4 py-3 border-b border-border-subtle",children:[o.jsx(_b,{size:13,className:"text-accent"}),o.jsx("span",{className:"text-[13px] font-semibold text-text-0 font-sans",children:"Add Gateway"}),o.jsx("div",{className:"flex-1"}),o.jsx("button",{onClick:()=>l(!1),className:"text-text-4 hover:text-text-1 cursor-pointer",children:o.jsx(Nt,{size:12})})]}),o.jsx("div",{className:"p-3 space-y-2",children:i.map(u=>{const d=ZS[u];return o.jsxs("button",{onClick:()=>{n(u),l(!1)},className:"w-full flex items-center gap-3 px-3 py-2.5 rounded-md bg-surface-0 hover:bg-accent/8 border border-border-subtle hover:border-accent/20 cursor-pointer transition-all group",children:[o.jsx(d,{size:14,className:"text-text-3 group-hover:text-accent"}),o.jsx("span",{className:"text-xs font-medium text-text-1 group-hover:text-accent font-sans",children:bs[u]})]},u)})})]}):o.jsxs("button",{onClick:()=>l(!0),className:"flex flex-col items-center justify-center rounded-lg border border-dashed border-border-subtle bg-surface-1/50 hover:bg-surface-1 hover:border-accent/30 min-h-[140px] min-w-[220px] cursor-pointer transition-all group",children:[o.jsx("div",{className:"w-8 h-8 rounded-full bg-accent/8 group-hover:bg-accent/15 flex items-center justify-center mb-2 transition-colors",children:o.jsx(Bn,{size:14,className:"text-accent"})}),o.jsx("span",{className:"text-2xs font-semibold text-text-3 group-hover:text-text-1 font-sans transition-colors",children:"Add Gateway"})]})}function xC(){const[t,n]=y.useState([]),[s,l]=y.useState(null),[i,u]=y.useState(null),[d,f]=y.useState([]),[m,p]=y.useState(!0),[x,g]=y.useState(!1),b=D(N=>N.addToast),S=D(N=>N.marketplaceUser),w=D(N=>N.marketplaceAuthenticated),j=D(N=>N.marketplaceLogin),T=D(N=>N.marketplaceLogout);function k(){J.get("/providers").then(N=>n(Array.isArray(N)?N:[])).catch(()=>{})}function z(){J.get("/gateways").then(N=>f(Array.isArray(N)?N:[])).catch(()=>{})}y.useEffect(()=>{Promise.all([J.get("/providers"),J.get("/config"),J.get("/status"),J.get("/gateways")]).then(([N,$,W,V])=>{n(Array.isArray(N)?N:[]),l($),u(W),f(Array.isArray(V)?V:[]),p(!1)}).catch(()=>p(!1))},[]);async function R(N){try{await J.post("/gateways",{type:N}),b("success",`${bs[N]} gateway added`),z()}catch($){b("error","Failed to add gateway",$.message)}}async function E(N,$){try{const W=await J.patch("/config",{[N]:$});l(W)}catch(W){b("error","Update failed",W.message)}}if(m)return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsx("div",{className:"h-12 bg-surface-1 border-b border-border"}),o.jsxs("div",{className:"flex-1 p-4 space-y-4",children:[o.jsx("div",{className:"grid grid-cols-4 gap-3",children:[...Array(4)].map((N,$)=>o.jsx(ra,{className:"h-40 rounded-lg"},$))}),o.jsx("div",{className:"grid grid-cols-3 gap-3",children:[...Array(6)].map((N,$)=>o.jsx(ra,{className:"h-28 rounded-lg"},$))})]})]});const G=t.filter(N=>N.authType==="local"||N.authType==="subscription"?N.installed:N.hasKey).length,_=(s==null?void 0:s.rotationThreshold)||0;return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex items-center gap-4 px-4 py-2.5 bg-surface-1 border-b border-border flex-shrink-0",children:[o.jsx("h2",{className:"text-sm font-semibold text-text-0 font-sans",children:"Settings"}),o.jsx("div",{className:"flex-1"}),o.jsxs("div",{className:"flex items-center gap-4 text-2xs text-text-3 font-sans",children:[(i==null?void 0:i.version)&&o.jsxs("span",{children:["v",i.version]}),(i==null?void 0:i.port)&&o.jsxs("span",{children:[":",i.port]}),(i==null?void 0:i.uptime)>0&&o.jsxs("span",{children:["Up ",Cc(i.uptime)]})]}),o.jsx("div",{className:"w-px h-4 bg-border-subtle"}),w?o.jsxs("div",{className:"flex items-center gap-2.5",children:[o.jsx(uC,{user:S}),o.jsx("span",{className:"text-xs font-medium text-text-0 font-sans",children:(S==null?void 0:S.displayName)||"User"}),o.jsxs("button",{onClick:T,className:"text-2xs text-text-4 hover:text-text-1 cursor-pointer font-sans flex items-center gap-1",children:[o.jsx(Tb,{size:10})," Sign out"]})]}):o.jsxs(Se,{variant:"ghost",size:"sm",onClick:j,className:"h-7 text-2xs gap-1.5 text-text-3",children:[o.jsx(Mf,{size:11})," Sign in"]}),o.jsx(Qs,{status:"running",size:"sm"})]}),o.jsx(Na,{className:"flex-1",children:o.jsxs("div",{className:"p-4 space-y-4",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2.5 px-0.5",children:[o.jsx("span",{className:"text-2xs font-semibold text-text-3 font-sans uppercase tracking-wider",children:"Providers"}),o.jsx("div",{className:"flex-1 h-px bg-border-subtle"}),o.jsxs("span",{className:"text-2xs text-text-4 font-sans",children:[G,"/",t.length," connected"]})]}),o.jsx("div",{className:"grid grid-cols-4 gap-3",children:t.map(N=>o.jsx(dC,{provider:N,onKeyChange:k},N.id))})]}),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2.5 px-0.5",children:[o.jsx("span",{className:"text-2xs font-semibold text-text-3 font-sans uppercase tracking-wider",children:"Gateways"}),o.jsx("div",{className:"flex-1 h-px bg-border-subtle"}),o.jsxs("span",{className:"text-2xs text-text-4 font-sans",children:[d.filter(N=>N.connected).length,"/",d.length," connected"]})]}),o.jsxs("div",{className:"grid grid-cols-4 gap-3",children:[d.map(N=>o.jsx(mC,{gateway:N,onRefresh:z},N.id)),o.jsx(pC,{existingTypes:d.map(N=>N.type),onAdd:R})]})]}),s&&o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center gap-2 mb-2.5 px-0.5",children:[o.jsx("span",{className:"text-2xs font-semibold text-text-3 font-sans uppercase tracking-wider",children:"Configuration"}),o.jsx("div",{className:"flex-1 h-px bg-border-subtle"}),o.jsx("span",{className:"text-2xs text-text-4 font-sans",children:"Auto-saves"})]}),o.jsxs("div",{className:"grid grid-cols-3 gap-3",children:[o.jsx(xl,{icon:Af,label:"Default Provider",description:"Provider used when spawning new agents.",children:o.jsx("select",{value:s.defaultProvider||"claude-code",onChange:N=>E("defaultProvider",N.target.value),className:"w-full h-8 px-2.5 text-xs bg-surface-0 border border-border-subtle rounded-md text-text-0 font-mono focus:outline-none focus:ring-1 focus:ring-accent cursor-pointer",children:t.filter(N=>N.installed||N.hasKey).map(N=>o.jsx("option",{value:N.id,children:N.name},N.id))})}),o.jsx(xl,{icon:Dr,label:"Working Directory",description:"Default root directory for new agents.",children:o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("code",{className:"flex-1 h-8 px-2 flex items-center bg-surface-0 border border-border-subtle rounded-md text-2xs font-mono text-text-2 truncate min-w-0",children:s.defaultWorkingDir||"Project root"}),o.jsx(Se,{variant:"secondary",size:"sm",onClick:()=>g(!0),className:"h-8 px-2 flex-shrink-0",children:o.jsx(Qb,{size:12})})]})}),o.jsx(xl,{icon:jb,label:"Rotation Threshold",description:"Context usage that triggers auto-rotation.",children:o.jsx("div",{className:"flex bg-surface-0 rounded-md p-0.5 border border-border-subtle",children:["auto","50%","65%","75%","85%"].map(N=>{const $=N==="auto"?0:parseInt(N,10)/100,W=_===$;return o.jsx("button",{onClick:()=>E("rotationThreshold",$),className:se("flex-1 px-2 py-1.5 text-2xs font-semibold font-sans rounded transition-all cursor-pointer",W?"bg-accent/15 text-accent shadow-sm":"text-text-3 hover:text-text-1"),children:N==="auto"?"Auto":N},N)})})}),o.jsx(xl,{icon:Eb,label:"QC Threshold",description:"Running agents count that triggers auto-QC.",children:o.jsx("div",{className:"flex bg-surface-0 rounded-md p-0.5 border border-border-subtle",children:[2,3,4,6,8].map(N=>{const $=(s.qcThreshold||2)===N;return o.jsx("button",{onClick:()=>E("qcThreshold",N),className:se("flex-1 px-2 py-1.5 text-2xs font-semibold font-sans rounded transition-all cursor-pointer",$?"bg-accent/15 text-accent shadow-sm":"text-text-3 hover:text-text-1"),children:N},N)})})}),o.jsx(xl,{icon:_c,label:"Max Agents",description:"Concurrent agent limit. 0 = unlimited.",children:o.jsx("div",{className:"flex bg-surface-0 rounded-md p-0.5 border border-border-subtle",children:[0,4,8,12,20].map(N=>{const $=(s.maxAgents||0)===N;return o.jsx("button",{onClick:()=>E("maxAgents",N),className:se("flex-1 px-2 py-1.5 text-2xs font-semibold font-sans rounded transition-all cursor-pointer",$?"bg-accent/15 text-accent shadow-sm":"text-text-3 hover:text-text-1"),children:N===0?"∞":N},N)})})}),o.jsx(xl,{icon:Wr,label:"Journalist Interval",description:"Seconds between synthesis cycles.",children:o.jsx("div",{className:"flex bg-surface-0 rounded-md p-0.5 border border-border-subtle",children:[60,120,300,600].map(N=>{const $=(s.journalistInterval||120)===N,W=N<60?`${N}s`:`${N/60}m`;return o.jsx("button",{onClick:()=>E("journalistInterval",N),className:se("flex-1 px-2 py-1.5 text-2xs font-semibold font-sans rounded transition-all cursor-pointer",$?"bg-accent/15 text-accent shadow-sm":"text-text-3 hover:text-text-1"),children:W},N)})})})]})]})]})}),o.jsx(XS,{open:x,onOpenChange:g,currentPath:(s==null?void 0:s.defaultWorkingDir)||"/",onSelect:N=>E("defaultWorkingDir",N)})]})}const bf=[];function AS(t){const n=(t||"").toLowerCase();return n.includes("reading")||n.includes("read ")?{icon:li,color:"text-info",label:"Reading"}:n.includes("editing")||n.includes("wrote")||n.includes("writing")||n.includes("edit ")?{icon:Sb,color:"text-warning",label:"Editing"}:n.includes("searching")||n.includes("search")||n.includes("grep")||n.includes("glob")?{icon:Cl,color:"text-purple",label:"Searching"}:n.includes("running")||n.includes("bash")||n.includes("command")||n.includes("exec")?{icon:oi,color:"text-orange",label:"Running"}:n.includes("test")||n.includes("pass")?{icon:af,color:"text-success",label:"Testing"}:n.includes("error")||n.includes("fail")||n.includes("crash")?{icon:Ss,color:"text-danger",label:"Error"}:n.includes("rotat")?{icon:ii,color:"text-accent",label:"Rotating"}:n.includes("spawn")||n.includes("start")?{icon:cn,color:"text-success",label:"Spawned"}:n.includes("tool")||n.includes("function")?{icon:dP,color:"text-text-2",label:"Tool"}:n.includes("complet")||n.includes("done")||n.includes("finish")?{icon:af,color:"text-success",label:"Done"}:{icon:Ta,color:"text-text-3",label:"Activity"}}function gl({text:t}){return t?t.split(/(\*\*[^*]+\*\*|`[^`]+`)/g).map((n,s)=>n.startsWith("**")&&n.endsWith("**")?o.jsx("strong",{className:"font-semibold text-text-0",children:n.slice(2,-2)},s):n.startsWith("`")&&n.endsWith("`")?o.jsx("code",{className:"px-1 py-px rounded bg-accent/8 text-[11px] font-mono text-accent",children:n.slice(1,-1)},s):o.jsx("span",{children:n},s)):null}function gC({text:t}){if(!t)return null;const n=[],s=t.split(`
|
|
570
570
|
`);let l=0;for(;l<s.length;){const i=s[l];if(i.trimStart().startsWith("```")){const d=[],f=i.trim().slice(3);for(l++;l<s.length&&!s[l].trimStart().startsWith("```");)d.push(s[l]),l++;l++,n.push({type:"code",content:d.join(`
|
|
571
|
-
`),lang:f});continue}if(/^#{1,3}\s/.test(i)||/^\*\*[^*]+:\*\*\s*$/.test(i.trim())){const d=i.replace(/^#+\s*/,"").replace(/^\*\*/,"").replace(/:\*\*\s*$/,":").trim();n.push({type:"heading",content:d}),l++;continue}if(/^\s*[-*]\s/.test(i)){const d=[];for(;l<s.length&&/^\s*[-*]\s/.test(s[l]);)d.push(s[l].replace(/^\s*[-*]\s+/,"").trim()),l++;n.push({type:"list",items:d});continue}if(/^\s*\d+[\.)]\s/.test(i)){const d=[];for(;l<s.length&&/^\s*\d+[\.)]\s/.test(s[l]);)d.push(s[l].replace(/^\s*\d+[\.)]\s+/,"").trim()),l++;n.push({type:"numbered",items:d});continue}if(!i.trim()){l++;continue}if(/^(Note|Warning|Important|IMPORTANT|TODO):/i.test(i.trim())){n.push({type:"note",content:i.trim()}),l++;continue}const u=[];for(;l<s.length&&s[l].trim()&&!/^#{1,3}\s/.test(s[l])&&!/^\s*[-*]\s/.test(s[l])&&!/^\s*\d+[\.)]\s/.test(s[l])&&!s[l].trimStart().startsWith("```");)u.push(s[l].trim()),l++;u.length>0&&n.push({type:"para",content:u.join(" ")})}return o.jsx("div",{className:"space-y-2",children:n.map((i,u)=>{switch(i.type){case"heading":return o.jsxs("div",{className:"flex items-center gap-1.5 pt-1.5 first:pt-0",children:[o.jsx("div",{className:"w-1 h-3.5 rounded-full bg-accent/40 flex-shrink-0"}),o.jsx("span",{className:"text-[12px] font-semibold text-text-0 font-sans",children:o.jsx(gl,{text:i.content})})]},u);case"list":return o.jsx("div",{className:"space-y-1 pl-2",children:i.items.map((d,f)=>o.jsxs("div",{className:"flex gap-2 text-[12px] text-text-0 font-sans leading-relaxed",children:[o.jsx("span",{className:"text-accent/50 mt-0.5 flex-shrink-0",children:"-"}),o.jsx("span",{className:"min-w-0",children:o.jsx(gl,{text:d})})]},f))},u);case"numbered":return o.jsx("div",{className:"space-y-1 pl-2",children:i.items.map((d,f)=>o.jsxs("div",{className:"flex gap-2 text-[12px] text-text-0 font-sans leading-relaxed",children:[o.jsxs("span",{className:"text-text-4 font-mono w-4 text-right flex-shrink-0",children:[f+1,"."]}),o.jsx("span",{className:"min-w-0",children:o.jsx(gl,{text:d})})]},f))},u);case"code":return o.jsx("pre",{className:"p-2.5 rounded-md bg-[#0d1117] text-[11px] font-mono text-[#c9d1d9] overflow-x-auto whitespace-pre-wrap border border-white/[0.06] leading-relaxed",children:i.content},u);case"note":return o.jsxs("div",{className:"flex items-start gap-1.5 px-2.5 py-1.5 rounded-md bg-warning/6 border border-warning/12",children:[o.jsx(Ss,{size:10,className:"text-warning mt-0.5 flex-shrink-0"}),o.jsx("span",{className:"text-[11px] text-warning/80 font-sans",children:o.jsx(gl,{text:i.content})})]},u);case"para":default:return o.jsx("p",{className:"text-[12px] text-text-0 font-sans leading-relaxed",children:o.jsx(gl,{text:i.content})},u)}})})}function bC({text:t}){if(!t)return null;const n=t.split(/(```[\s\S]*?```)/g);return o.jsx("span",{children:n.map((s,l)=>{if(s.startsWith("```")&&s.endsWith("```")){const i=s.slice(3,-3).replace(/^\w+\n/,"");return o.jsx("pre",{className:"my-1.5 p-2 rounded-md bg-[#0d1117] text-[11px] font-mono text-[#c9d1d9] overflow-x-auto whitespace-pre-wrap border border-white/[0.06]",children:i},l)}return o.jsx("span",{children:o.jsx(gl,{text:s})},l)})})}function vC({msg:t}){const n=t.isQuery;return o.jsx("div",{className:"flex justify-end pl-8",children:o.jsxs("div",{className:"max-w-[90%]",children:[n&&o.jsxs("div",{className:"flex items-center justify-end gap-1 mb-1",children:[o.jsx(lc,{size:9,className:"text-info"}),o.jsx("span",{className:"text-2xs text-info font-sans font-medium",children:"Query"})]}),o.jsx("div",{className:se("px-3.5 py-2.5 rounded-lg border","bg-info/10 border-info/25"),children:o.jsx("div",{className:"text-[12px] font-sans whitespace-pre-wrap break-words leading-relaxed text-text-0",children:o.jsx(bC,{text:t.text})})}),o.jsx("div",{className:"text-[10px] text-text-4 font-sans mt-1 text-right",children:Wt(t.timestamp)})]})})}function yC({msg:t,agent:n}){var u,d;const[s,l]=y.useState(((u=t.text)==null?void 0:u.length)>600),i=((d=t.text)==null?void 0:d.length)>600;return o.jsxs("div",{className:"pr-2",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[o.jsx("div",{className:"w-5 h-5 rounded-md bg-accent/12 flex items-center justify-center flex-shrink-0",children:o.jsx(Ta,{size:10,className:"text-accent"})}),o.jsx("span",{className:"text-2xs font-semibold text-text-1 font-sans",children:(n==null?void 0:n.name)||"Agent"}),o.jsx("span",{className:"text-2xs text-text-4 font-sans",children:n==null?void 0:n.role})]}),o.jsxs("div",{className:se("ml-7 px-3.5 py-3 rounded-lg bg-accent/10 border border-accent/25 overflow-hidden",s&&"max-h-[200px] relative"),children:[o.jsx(gC,{text:s?t.text.slice(0,600):t.text}),s&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-surface-2/90 to-transparent flex items-end justify-center pb-2",children:o.jsxs("button",{onClick:()=>l(!1),className:"flex items-center gap-1 px-3 py-1 rounded-full bg-surface-3 border border-border-subtle text-2xs text-text-2 font-sans hover:text-text-0 cursor-pointer transition-colors",children:[o.jsx(Wn,{size:10}),"Show full response"]})})]}),i&&!s&&o.jsx("button",{onClick:()=>l(!0),className:"ml-7 mt-1 text-[10px] text-text-4 hover:text-text-2 font-sans cursor-pointer",children:"Collapse"}),o.jsx("div",{className:"text-[10px] text-text-4 font-sans mt-1 ml-7",children:Wt(t.timestamp)})]})}function SC({msg:t}){return o.jsxs("div",{className:"flex items-center gap-3 py-2",children:[o.jsx("div",{className:"flex-1 h-px bg-border-subtle"}),o.jsx("span",{className:"text-[10px] text-text-4 font-sans flex-shrink-0 uppercase tracking-wide",children:t.text}),o.jsx("div",{className:"flex-1 h-px bg-border-subtle"})]})}function u0({entry:t}){var i;const n=AS(t.text),s=n.icon,l=((i=t.text)==null?void 0:i.length)>120?t.text.slice(0,120)+"...":t.text;return o.jsxs("div",{className:"flex items-center gap-2 py-0.5 group",children:[o.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0",children:o.jsx(s,{size:10,className:se(n.color,"opacity-70")})}),o.jsx("p",{className:"text-[11px] text-text-3 font-sans truncate flex-1 min-w-0",children:l}),o.jsx("span",{className:"text-[10px] text-text-4 font-mono opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:Wt(t.timestamp)})]})}function QC({entries:t}){const[n,s]=y.useState(!1);if(t.length===1)return o.jsx("div",{className:"ml-7",children:o.jsx(u0,{entry:t[0]})});const l=n?t:t.slice(0,2),i=t.length-2;return o.jsxs("div",{className:"ml-7 py-1 pl-3 border-l border-border-subtle/50 space-y-px",children:[l.map((u,d)=>o.jsx(u0,{entry:u},d)),!n&&i>0&&o.jsxs("button",{onClick:()=>s(!0),className:"flex items-center gap-1.5 text-[11px] text-text-4 hover:text-text-2 font-sans cursor-pointer py-0.5 ml-6",children:[o.jsx(Wn,{size:9}),o.jsxs("span",{children:[i," more"]})]})]})}function jC({agent:t}){const n=D(m=>m.activityLog[t.id])||bf,s=n[n.length-1],l=s?AS(s.text):null,i=(l==null?void 0:l.icon)||Ta,u=s&&Date.now()-s.timestamp<1e4,d=u&&s.text?s.text.length>60?s.text.slice(0,60)+"...":s.text:null,f=Math.round((t.contextUsage||0)*100);return o.jsxs("div",{className:"flex items-center gap-3 px-4 h-8 border-b border-border-subtle bg-surface-1/80 flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[o.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[o.jsx("span",{className:"absolute inset-0 rounded-full bg-accent/15 animate-ping",style:{animationDuration:"2s"}}),o.jsx("span",{className:"relative w-1.5 h-1.5 rounded-full bg-accent"})]}),u?o.jsxs(o.Fragment,{children:[o.jsx(i,{size:10,className:se(l.color,"flex-shrink-0")}),o.jsx("span",{className:"text-[11px] text-text-2 font-sans truncate",children:d})]}):o.jsx("span",{className:"text-[11px] text-text-3 font-sans",children:"Working..."})]}),o.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[o.jsx("span",{className:"text-[10px] text-text-4 font-mono",children:wC(t.tokensUsed)}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:"w-14 h-1 rounded-full bg-surface-4 overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${f}%`,background:f>=75?"var(--color-danger)":f>=50?"var(--color-warning)":"var(--color-accent)"}})}),o.jsxs("span",{className:"text-[10px] text-text-4 font-mono w-7 text-right",children:[f,"%"]})]})]})]})}function wC(t){return t?t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t):"0"}function $C({agent:t}){const[n,s]=y.useState([]),l=[{text:`Initializing ${t.name}`,delay:0},{text:`Role: ${t.role}`,delay:400},{text:`Provider: ${t.provider||"claude-code"}`,delay:700},{text:"Loading workspace context",delay:1e3},{text:"Scanning project structure",delay:1400},{text:"Session active",delay:1900}];return y.useEffect(()=>{const i=l.map((u,d)=>setTimeout(()=>s(f=>[...f,d]),u.delay));return()=>i.forEach(clearTimeout)},[]),o.jsxs("div",{className:"flex flex-col justify-center h-full px-2 py-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsxs("div",{className:"relative w-10 h-10",children:[o.jsx("span",{className:"absolute inset-0 rounded-lg border-2 border-transparent border-t-accent animate-spin",style:{animationDuration:"1s"}}),o.jsx("span",{className:"absolute inset-[3px] rounded-md bg-accent/8"})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-bold text-text-0 font-sans",children:t.name}),o.jsx("p",{className:"text-2xs text-accent font-mono",children:"starting up"})]})]}),o.jsx("div",{className:"space-y-2 pl-3 border-l border-accent/15 ml-5",children:l.map((i,u)=>{const d=n.includes(u),f=u===l.length-1;return o.jsxs("div",{className:se("flex items-center gap-2.5 transition-all duration-300",d?"opacity-100 translate-x-0":"opacity-0 -translate-x-2"),children:[o.jsx("span",{className:se("w-1 h-1 rounded-full flex-shrink-0",f&&d?"bg-accent":d?"bg-text-3":"bg-transparent")}),o.jsx("span",{className:se("text-[11px] font-mono",f&&d?"text-accent":"text-text-3"),children:i.text}),f&&d&&o.jsxs("span",{className:"flex gap-0.5 ml-1",children:[o.jsx("span",{className:"w-1 h-1 rounded-full bg-accent animate-pulse",style:{animationDelay:"0ms"}}),o.jsx("span",{className:"w-1 h-1 rounded-full bg-accent animate-pulse",style:{animationDelay:"200ms"}}),o.jsx("span",{className:"w-1 h-1 rounded-full bg-accent animate-pulse",style:{animationDelay:"400ms"}})]})]},u)})})]})}function kC({agent:t}){const n=D(k=>k.chatHistory[t.id])||bf,s=D(k=>k.activityLog[t.id])||bf,l=D(k=>k.instructAgent),i=D(k=>k.queryAgent),[u,d]=y.useState(""),[f,m]=y.useState("instruct"),[p,x]=y.useState(!1),g=y.useRef(null),b=y.useRef(null),S=y.useMemo(()=>{var N;const k=[],z=new Set;for(const $ of n){const W=`${$.from}:${(N=$.text)==null?void 0:N.slice(0,100)}`;k.find(le=>{var Oe;return le.kind==="chat"&&`${le.from}:${(Oe=le.text)==null?void 0:Oe.slice(0,100)}`===W&&Math.abs(le.ts-$.timestamp)<5e3})||(k.push({...$,kind:"chat",ts:$.timestamp}),z.add($.text))}const R=z,E=s.slice(-30);for(const $ of E)($.text||"").trim()&&!R.has($.text)&&k.push({...$,kind:"activity",ts:$.timestamp});k.sort(($,W)=>$.ts-W.ts);const G=[];let _=[];for(const $ of k)$.kind==="activity"?_.push($):(_.length>0&&(G.push({kind:"activity-group",entries:_}),_=[]),G.push($));return _.length>0&&G.push({kind:"activity-group",entries:_}),G},[n,s]);y.useEffect(()=>{g.current&&requestAnimationFrame(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)})},[S.length]);async function w(){var z;const k=u.trim();if(!(!k||p)){if(k==="/rotate"){const R=D.getState().rotateAgent;d("");try{await R(t.id)}catch{}return}d(""),x(!0);try{f==="query"?await i(t.id,k):await l(t.id,k)}catch{}x(!1),(z=b.current)==null||z.focus()}}function j(k){k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),w())}const T=t.status==="running"||t.status==="starting";return o.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[T&&o.jsx(jC,{agent:t}),o.jsxs("div",{ref:g,className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[!S.some(k=>k.from==="agent"||k.kind==="activity-group")&&(T?o.jsx($C,{agent:t}):o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center py-8",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-surface-3 flex items-center justify-center mb-3",children:o.jsx(ri,{size:18,className:"text-text-4"})}),o.jsx("p",{className:"text-sm font-semibold text-text-0 font-sans",children:t.name}),o.jsx("p",{className:"text-xs text-text-3 font-sans mt-1",children:"Session complete — send a message to continue"})]})),S.map((k,z)=>k.kind==="activity-group"?o.jsx(QC,{entries:k.entries},`grp-${z}`):k.from==="user"?o.jsx(vC,{msg:k},`msg-${z}`):k.from==="system"?o.jsx(SC,{msg:k},`msg-${z}`):o.jsx(yC,{msg:k,agent:t},`msg-${z}`)),p&&o.jsxs("div",{className:"flex items-center gap-2 ml-7 py-2",children:[o.jsx("div",{className:"w-5 h-5 rounded-md bg-accent/12 flex items-center justify-center",children:o.jsx(Ta,{size:10,className:"text-accent"})}),o.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 rounded-2xl bg-surface-2/60 border border-border-subtle",children:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent/60 animate-pulse",style:{animationDelay:"0ms"}}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent/60 animate-pulse",style:{animationDelay:"200ms"}}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent/60 animate-pulse",style:{animationDelay:"400ms"}})]})]})]}),o.jsxs("div",{className:"border-t border-border px-4 py-3 bg-surface-1/50 flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[o.jsxs("button",{onClick:()=>m("instruct"),className:se("flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[11px] font-sans font-medium transition-colors cursor-pointer",f==="instruct"?"bg-accent/12 text-accent border border-accent/20":"text-text-3 hover:text-text-1 hover:bg-surface-3"),children:[o.jsx(zc,{size:10}),"Instruct"]}),o.jsxs("button",{onClick:()=>m("query"),className:se("flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[11px] font-sans font-medium transition-colors cursor-pointer",f==="query"?"bg-info/12 text-info border border-info/20":"text-text-3 hover:text-text-1 hover:bg-surface-3"),children:[o.jsx(lc,{size:10}),"Query"]}),o.jsx("span",{className:"text-[10px] text-text-4 font-sans ml-auto",children:f==="query"?"Read-only — agent keeps working":T?"Directs the agent":"Continues the session"})]}),o.jsxs("div",{className:se("flex items-end gap-2 rounded-xl border bg-surface-0 p-1 transition-colors",f==="query"?"border-info/20 focus-within:border-info/40":"border-border-subtle focus-within:border-accent/30"),children:[o.jsx("textarea",{ref:b,value:u,onChange:k=>d(k.target.value),onKeyDown:j,placeholder:f==="query"?"Ask about this agent's work...":T?"Send an instruction...":"Continue this session...",rows:1,className:se("flex-1 resize-none px-3 py-2 text-[13px]","bg-transparent text-text-0 font-sans","placeholder:text-text-4","focus:outline-none","max-h-[120px] min-h-[36px]"),style:{height:Math.min(Math.max(36,u.split(`
|
|
571
|
+
`),lang:f});continue}if(/^#{1,3}\s/.test(i)||/^\*\*[^*]+:\*\*\s*$/.test(i.trim())){const d=i.replace(/^#+\s*/,"").replace(/^\*\*/,"").replace(/:\*\*\s*$/,":").trim();n.push({type:"heading",content:d}),l++;continue}if(/^\s*[-*]\s/.test(i)){const d=[];for(;l<s.length&&/^\s*[-*]\s/.test(s[l]);)d.push(s[l].replace(/^\s*[-*]\s+/,"").trim()),l++;n.push({type:"list",items:d});continue}if(/^\s*\d+[\.)]\s/.test(i)){const d=[];for(;l<s.length&&/^\s*\d+[\.)]\s/.test(s[l]);)d.push(s[l].replace(/^\s*\d+[\.)]\s+/,"").trim()),l++;n.push({type:"numbered",items:d});continue}if(!i.trim()){l++;continue}if(/^(Note|Warning|Important|IMPORTANT|TODO):/i.test(i.trim())){n.push({type:"note",content:i.trim()}),l++;continue}const u=[];for(;l<s.length&&s[l].trim()&&!/^#{1,3}\s/.test(s[l])&&!/^\s*[-*]\s/.test(s[l])&&!/^\s*\d+[\.)]\s/.test(s[l])&&!s[l].trimStart().startsWith("```");)u.push(s[l].trim()),l++;u.length>0&&n.push({type:"para",content:u.join(" ")})}return o.jsx("div",{className:"space-y-2",children:n.map((i,u)=>{switch(i.type){case"heading":return o.jsxs("div",{className:"flex items-center gap-1.5 pt-1.5 first:pt-0",children:[o.jsx("div",{className:"w-1 h-3.5 rounded-full bg-accent/40 flex-shrink-0"}),o.jsx("span",{className:"text-[12px] font-semibold text-text-0 font-sans",children:o.jsx(gl,{text:i.content})})]},u);case"list":return o.jsx("div",{className:"space-y-1 pl-2",children:i.items.map((d,f)=>o.jsxs("div",{className:"flex gap-2 text-[12px] text-text-0 font-sans leading-relaxed",children:[o.jsx("span",{className:"text-accent/50 mt-0.5 flex-shrink-0",children:"-"}),o.jsx("span",{className:"min-w-0",children:o.jsx(gl,{text:d})})]},f))},u);case"numbered":return o.jsx("div",{className:"space-y-1 pl-2",children:i.items.map((d,f)=>o.jsxs("div",{className:"flex gap-2 text-[12px] text-text-0 font-sans leading-relaxed",children:[o.jsxs("span",{className:"text-text-4 font-mono w-4 text-right flex-shrink-0",children:[f+1,"."]}),o.jsx("span",{className:"min-w-0",children:o.jsx(gl,{text:d})})]},f))},u);case"code":return o.jsx("pre",{className:"p-2.5 rounded-md bg-[#0d1117] text-[11px] font-mono text-[#c9d1d9] overflow-x-auto whitespace-pre-wrap border border-white/[0.06] leading-relaxed",children:i.content},u);case"note":return o.jsxs("div",{className:"flex items-start gap-1.5 px-2.5 py-1.5 rounded-md bg-warning/6 border border-warning/12",children:[o.jsx(Ss,{size:10,className:"text-warning mt-0.5 flex-shrink-0"}),o.jsx("span",{className:"text-[11px] text-warning/80 font-sans",children:o.jsx(gl,{text:i.content})})]},u);case"para":default:return o.jsx("p",{className:"text-[12px] text-text-0 font-sans leading-relaxed",children:o.jsx(gl,{text:i.content})},u)}})})}function bC({text:t}){if(!t)return null;const n=t.split(/(```[\s\S]*?```)/g);return o.jsx("span",{children:n.map((s,l)=>{if(s.startsWith("```")&&s.endsWith("```")){const i=s.slice(3,-3).replace(/^\w+\n/,"");return o.jsx("pre",{className:"my-1.5 p-2 rounded-md bg-[#0d1117] text-[11px] font-mono text-[#c9d1d9] overflow-x-auto whitespace-pre-wrap border border-white/[0.06]",children:i},l)}return o.jsx("span",{children:o.jsx(gl,{text:s})},l)})})}function vC({msg:t}){const n=t.isQuery;return o.jsx("div",{className:"flex justify-end pl-8",children:o.jsxs("div",{className:"max-w-[90%]",children:[n&&o.jsxs("div",{className:"flex items-center justify-end gap-1 mb-1",children:[o.jsx(lc,{size:9,className:"text-info"}),o.jsx("span",{className:"text-2xs text-info font-sans font-medium",children:"Query"})]}),o.jsx("div",{className:se("px-3.5 py-2.5 rounded-lg border","bg-info/10 border-info/25"),children:o.jsx("div",{className:"text-[12px] font-sans whitespace-pre-wrap break-words leading-relaxed text-text-0",children:o.jsx(bC,{text:t.text})})}),o.jsx("div",{className:"text-[10px] text-text-4 font-sans mt-1 text-right",children:Wt(t.timestamp)})]})})}function yC({msg:t,agent:n}){var u,d;const[s,l]=y.useState(((u=t.text)==null?void 0:u.length)>600),i=((d=t.text)==null?void 0:d.length)>600;return o.jsxs("div",{className:"pr-2",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1.5",children:[o.jsx("div",{className:"w-5 h-5 rounded-md bg-accent/12 flex items-center justify-center flex-shrink-0",children:o.jsx(Ta,{size:10,className:"text-accent"})}),o.jsx("span",{className:"text-2xs font-semibold text-text-1 font-sans",children:(n==null?void 0:n.name)||"Agent"}),o.jsx("span",{className:"text-2xs text-text-4 font-sans",children:n==null?void 0:n.role})]}),o.jsxs("div",{className:se("ml-7 px-3.5 py-3 rounded-lg bg-accent/10 border border-accent/25 overflow-hidden",s&&"max-h-[200px] relative"),children:[o.jsx(gC,{text:s?t.text.slice(0,600):t.text}),s&&o.jsx("div",{className:"absolute bottom-0 left-0 right-0 h-16 bg-gradient-to-t from-surface-2/90 to-transparent flex items-end justify-center pb-2",children:o.jsxs("button",{onClick:()=>l(!1),className:"flex items-center gap-1 px-3 py-1 rounded-full bg-surface-3 border border-border-subtle text-2xs text-text-2 font-sans hover:text-text-0 cursor-pointer transition-colors",children:[o.jsx(Wn,{size:10}),"Show full response"]})})]}),i&&!s&&o.jsx("button",{onClick:()=>l(!0),className:"ml-7 mt-1 text-[10px] text-text-4 hover:text-text-2 font-sans cursor-pointer",children:"Collapse"}),o.jsx("div",{className:"text-[10px] text-text-4 font-sans mt-1 ml-7",children:Wt(t.timestamp)})]})}function SC({msg:t}){return o.jsxs("div",{className:"flex items-center gap-3 py-2",children:[o.jsx("div",{className:"flex-1 h-px bg-border-subtle"}),o.jsx("span",{className:"text-[10px] text-text-4 font-sans flex-shrink-0 uppercase tracking-wide",children:t.text}),o.jsx("div",{className:"flex-1 h-px bg-border-subtle"})]})}function u0({entry:t}){var i;const n=AS(t.text),s=n.icon,l=((i=t.text)==null?void 0:i.length)>120?t.text.slice(0,120)+"...":t.text;return o.jsxs("div",{className:"flex items-center gap-2 py-0.5 group",children:[o.jsx("div",{className:"w-4 h-4 rounded flex items-center justify-center flex-shrink-0",children:o.jsx(s,{size:10,className:se(n.color,"opacity-70")})}),o.jsx("p",{className:"text-[11px] text-text-3 font-sans truncate flex-1 min-w-0",children:l}),o.jsx("span",{className:"text-[10px] text-text-4 font-mono opacity-0 group-hover:opacity-100 transition-opacity flex-shrink-0",children:Wt(t.timestamp)})]})}function QC({entries:t}){const[n,s]=y.useState(!1);if(t.length===1)return o.jsx("div",{className:"ml-7",children:o.jsx(u0,{entry:t[0]})});const l=n?t:t.slice(0,2),i=t.length-2;return o.jsxs("div",{className:"ml-7 py-1 pl-3 border-l border-border-subtle/50 space-y-px",children:[l.map((u,d)=>o.jsx(u0,{entry:u},d)),!n&&i>0&&o.jsxs("button",{onClick:()=>s(!0),className:"flex items-center gap-1.5 text-[11px] text-text-4 hover:text-text-2 font-sans cursor-pointer py-0.5 ml-6",children:[o.jsx(Wn,{size:9}),o.jsxs("span",{children:[i," more"]})]})]})}function jC({agent:t}){const n=D(m=>m.activityLog[t.id])||bf,s=n[n.length-1],l=s?AS(s.text):null,i=(l==null?void 0:l.icon)||Ta,u=s&&Date.now()-s.timestamp<1e4,d=u&&s.text?s.text.length>60?s.text.slice(0,60)+"...":s.text:null,f=Math.round((t.contextUsage||0)*100);return o.jsxs("div",{className:"flex items-center gap-3 px-4 h-8 border-b border-border-subtle bg-surface-1/80 flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[o.jsxs("div",{className:"relative flex items-center justify-center w-4 h-4",children:[o.jsx("span",{className:"absolute inset-0 rounded-full bg-accent/15 animate-ping",style:{animationDuration:"2s"}}),o.jsx("span",{className:"relative w-1.5 h-1.5 rounded-full bg-accent"})]}),u?o.jsxs(o.Fragment,{children:[o.jsx(i,{size:10,className:se(l.color,"flex-shrink-0")}),o.jsx("span",{className:"text-[11px] text-text-2 font-sans truncate",children:d})]}):o.jsx("span",{className:"text-[11px] text-text-3 font-sans",children:"Working..."})]}),o.jsxs("div",{className:"flex items-center gap-3 flex-shrink-0",children:[o.jsx("span",{className:"text-[10px] text-text-4 font-mono",children:wC(t.tokensUsed)}),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("div",{className:"w-14 h-1 rounded-full bg-surface-4 overflow-hidden",children:o.jsx("div",{className:"h-full rounded-full transition-all duration-500",style:{width:`${f}%`,background:f>=75?"var(--color-danger)":f>=50?"var(--color-warning)":"var(--color-accent)"}})}),o.jsxs("span",{className:"text-[10px] text-text-4 font-mono w-7 text-right",children:[f,"%"]})]})]})]})}function wC(t){return t?t>=1e6?(t/1e6).toFixed(1)+"M":t>=1e3?(t/1e3).toFixed(1)+"K":String(t):"0"}function $C({agent:t}){const[n,s]=y.useState([]),l=[{text:`Initializing ${t.name}`,delay:0},{text:`Role: ${t.role}`,delay:400},{text:`Provider: ${t.provider||"claude-code"}`,delay:700},{text:"Loading workspace context",delay:1e3},{text:"Scanning project structure",delay:1400},{text:"Session active",delay:1900}];return y.useEffect(()=>{const i=l.map((u,d)=>setTimeout(()=>s(f=>[...f,d]),u.delay));return()=>i.forEach(clearTimeout)},[]),o.jsxs("div",{className:"flex flex-col justify-center h-full px-2 py-6",children:[o.jsxs("div",{className:"flex items-center gap-3 mb-6",children:[o.jsxs("div",{className:"relative w-9 h-9",children:[o.jsx("span",{className:"absolute inset-0 rounded-full border-2 border-accent/20 animate-ping",style:{animationDuration:"2s"}}),o.jsx("span",{className:"absolute inset-0 rounded-full border-2 border-transparent border-t-accent animate-spin",style:{animationDuration:"1s"}}),o.jsx("span",{className:"absolute inset-[5px] rounded-full bg-accent/8"})]}),o.jsxs("div",{children:[o.jsx("p",{className:"text-sm font-bold text-text-0 font-sans",children:t.name}),o.jsx("p",{className:"text-2xs text-accent font-mono",children:"starting up"})]})]}),o.jsx("div",{className:"space-y-2 pl-3 border-l border-accent/15 ml-5",children:l.map((i,u)=>{const d=n.includes(u),f=u===l.length-1;return o.jsxs("div",{className:se("flex items-center gap-2.5 transition-all duration-300",d?"opacity-100 translate-x-0":"opacity-0 -translate-x-2"),children:[o.jsx("span",{className:se("w-1 h-1 rounded-full flex-shrink-0",f&&d?"bg-accent":d?"bg-text-3":"bg-transparent")}),o.jsx("span",{className:se("text-[11px] font-mono",f&&d?"text-accent":"text-text-3"),children:i.text}),f&&d&&o.jsxs("span",{className:"flex gap-0.5 ml-1",children:[o.jsx("span",{className:"w-1 h-1 rounded-full bg-accent animate-pulse",style:{animationDelay:"0ms"}}),o.jsx("span",{className:"w-1 h-1 rounded-full bg-accent animate-pulse",style:{animationDelay:"200ms"}}),o.jsx("span",{className:"w-1 h-1 rounded-full bg-accent animate-pulse",style:{animationDelay:"400ms"}})]})]},u)})})]})}function kC({agent:t}){const n=D(k=>k.chatHistory[t.id])||bf,s=D(k=>k.activityLog[t.id])||bf,l=D(k=>k.instructAgent),i=D(k=>k.queryAgent),[u,d]=y.useState(""),[f,m]=y.useState("instruct"),[p,x]=y.useState(!1),g=y.useRef(null),b=y.useRef(null),S=y.useMemo(()=>{var N;const k=[],z=new Set;for(const $ of n){const W=`${$.from}:${(N=$.text)==null?void 0:N.slice(0,100)}`;k.find(le=>{var Oe;return le.kind==="chat"&&`${le.from}:${(Oe=le.text)==null?void 0:Oe.slice(0,100)}`===W&&Math.abs(le.ts-$.timestamp)<5e3})||(k.push({...$,kind:"chat",ts:$.timestamp}),z.add($.text))}const R=z,E=s.slice(-30);for(const $ of E)($.text||"").trim()&&!R.has($.text)&&k.push({...$,kind:"activity",ts:$.timestamp});k.sort(($,W)=>$.ts-W.ts);const G=[];let _=[];for(const $ of k)$.kind==="activity"?_.push($):(_.length>0&&(G.push({kind:"activity-group",entries:_}),_=[]),G.push($));return _.length>0&&G.push({kind:"activity-group",entries:_}),G},[n,s]);y.useEffect(()=>{g.current&&requestAnimationFrame(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)})},[S.length]);async function w(){var z;const k=u.trim();if(!(!k||p)){if(k==="/rotate"){const R=D.getState().rotateAgent;d("");try{await R(t.id)}catch{}return}d(""),x(!0);try{f==="query"?await i(t.id,k):await l(t.id,k)}catch{}x(!1),(z=b.current)==null||z.focus()}}function j(k){k.key==="Enter"&&!k.shiftKey&&(k.preventDefault(),w())}const T=t.status==="running"||t.status==="starting";return o.jsxs("div",{className:"flex flex-col h-full min-h-0",children:[T&&o.jsx(jC,{agent:t}),o.jsxs("div",{ref:g,className:"flex-1 overflow-y-auto px-4 py-4 space-y-4",children:[!S.some(k=>k.from==="agent"||k.kind==="activity-group")&&(T?o.jsx($C,{agent:t}):o.jsxs("div",{className:"flex flex-col items-center justify-center h-full text-center py-8",children:[o.jsx("div",{className:"w-10 h-10 rounded-xl bg-surface-3 flex items-center justify-center mb-3",children:o.jsx(ri,{size:18,className:"text-text-4"})}),o.jsx("p",{className:"text-sm font-semibold text-text-0 font-sans",children:t.name}),o.jsx("p",{className:"text-xs text-text-3 font-sans mt-1",children:"Session complete — send a message to continue"})]})),S.map((k,z)=>k.kind==="activity-group"?o.jsx(QC,{entries:k.entries},`grp-${z}`):k.from==="user"?o.jsx(vC,{msg:k},`msg-${z}`):k.from==="system"?o.jsx(SC,{msg:k},`msg-${z}`):o.jsx(yC,{msg:k,agent:t},`msg-${z}`)),p&&o.jsxs("div",{className:"flex items-center gap-2 ml-7 py-2",children:[o.jsx("div",{className:"w-5 h-5 rounded-md bg-accent/12 flex items-center justify-center",children:o.jsx(Ta,{size:10,className:"text-accent"})}),o.jsxs("div",{className:"flex items-center gap-1.5 px-3 py-2 rounded-2xl bg-surface-2/60 border border-border-subtle",children:[o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent/60 animate-pulse",style:{animationDelay:"0ms"}}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent/60 animate-pulse",style:{animationDelay:"200ms"}}),o.jsx("span",{className:"w-1.5 h-1.5 rounded-full bg-accent/60 animate-pulse",style:{animationDelay:"400ms"}})]})]})]}),o.jsxs("div",{className:"border-t border-border px-4 py-3 bg-surface-1/50 flex-shrink-0",children:[o.jsxs("div",{className:"flex items-center gap-1 mb-2",children:[o.jsxs("button",{onClick:()=>m("instruct"),className:se("flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[11px] font-sans font-medium transition-colors cursor-pointer",f==="instruct"?"bg-accent/12 text-accent border border-accent/20":"text-text-3 hover:text-text-1 hover:bg-surface-3"),children:[o.jsx(zc,{size:10}),"Instruct"]}),o.jsxs("button",{onClick:()=>m("query"),className:se("flex items-center gap-1.5 px-2.5 py-1 rounded-md text-[11px] font-sans font-medium transition-colors cursor-pointer",f==="query"?"bg-info/12 text-info border border-info/20":"text-text-3 hover:text-text-1 hover:bg-surface-3"),children:[o.jsx(lc,{size:10}),"Query"]}),o.jsx("span",{className:"text-[10px] text-text-4 font-sans ml-auto",children:f==="query"?"Read-only — agent keeps working":T?"Directs the agent":"Continues the session"})]}),o.jsxs("div",{className:se("flex items-end gap-2 rounded-xl border bg-surface-0 p-1 transition-colors",f==="query"?"border-info/20 focus-within:border-info/40":"border-border-subtle focus-within:border-accent/30"),children:[o.jsx("textarea",{ref:b,value:u,onChange:k=>d(k.target.value),onKeyDown:j,placeholder:f==="query"?"Ask about this agent's work...":T?"Send an instruction...":"Continue this session...",rows:1,className:se("flex-1 resize-none px-3 py-2 text-[13px]","bg-transparent text-text-0 font-sans","placeholder:text-text-4","focus:outline-none","max-h-[120px] min-h-[36px]"),style:{height:Math.min(Math.max(36,u.split(`
|
|
572
572
|
`).length*20),120)}}),o.jsx("button",{onClick:w,disabled:!u.trim()||p,className:se("w-9 h-9 flex items-center justify-center rounded-lg transition-all cursor-pointer flex-shrink-0 mb-px","disabled:opacity-15 disabled:cursor-not-allowed",u.trim()?f==="query"?"bg-info text-white hover:bg-info/85":"bg-accent text-white hover:bg-accent/85":"bg-transparent text-text-4"),children:p?o.jsx(kb,{size:15,className:"animate-spin"}):o.jsx(Vf,{size:15})})]})]})]})}function DO({options:t,value:n,onChange:s}){return o.jsx("div",{className:"flex bg-surface-0 rounded-lg p-0.5 border border-border-subtle",children:t.map(l=>o.jsx("button",{onClick:()=>s(l.value),className:se("flex-1 px-3 py-1.5 text-2xs font-semibold font-sans rounded-md transition-all cursor-pointer",n===l.value?"bg-accent/15 text-accent shadow-sm":"text-text-3 hover:text-text-1"),children:l.label},l.value))})}function Oa({label:t,icon:n,children:s,description:l}){return o.jsxs("div",{className:"space-y-2",children:[o.jsxs("div",{children:[o.jsxs("label",{className:"flex items-center gap-1.5 text-xs font-semibold text-text-1 font-sans",children:[n&&o.jsx(n,{size:13,className:"text-text-3"}),t]}),l&&o.jsx("p",{className:"text-2xs text-text-4 font-sans mt-0.5",children:l})]}),s]})}function TC({agent:t}){const n=D(w=>w.killAgent),s=D(w=>w.rotateAgent),l=D(w=>w.spawnAgent),i=D(w=>w.closeDetail),u=D(w=>w.addToast),[d,f]=y.useState(null),[m,p]=y.useState(!1),x=t.status==="running"||t.status==="starting";async function g(){f("rotate");try{await s(t.id)}catch{}f(null)}async function b(){if(!m){p(!0),setTimeout(()=>p(!1),3e3);return}f("kill");try{await n(t.id),i()}catch{}f(null),p(!1)}async function S(){f("clone");try{await l({role:t.role,provider:t.provider,model:t.model,name:`${t.name}-clone`,scope:t.scope,workingDir:t.workingDir}),u("success",`Cloned ${t.name}`)}catch{}f(null)}return x?o.jsx("div",{className:"space-y-2",children:o.jsxs("div",{className:"grid grid-cols-3 gap-2",children:[o.jsxs(Se,{variant:"primary",size:"md",onClick:g,disabled:d==="rotate",className:"gap-1.5",children:[o.jsx(ii,{size:12,className:d==="rotate"?"animate-spin":""}),"Rotate"]}),o.jsxs(Se,{variant:"info",size:"md",onClick:S,disabled:!!d,className:"gap-1.5",children:[o.jsx(nf,{size:12})," Clone"]}),o.jsxs(Se,{variant:"danger",size:"md",onClick:b,disabled:d==="kill",className:"gap-1.5",children:[o.jsx(qb,{size:12}),m?"Confirm":"Kill"]})]})}):o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsxs(Se,{variant:"info",size:"md",onClick:S,disabled:!!d,className:"gap-1.5",children:[o.jsx(nf,{size:12})," Clone"]}),o.jsxs(Se,{variant:"danger",size:"md",onClick:b,disabled:d==="kill",className:"gap-1.5",children:[o.jsx(Rc,{size:12}),m?"Confirm":"Remove"]})]})}function PC({agent:t}){var Ye;const n=D(L=>L.addToast),[s,l]=y.useState([]),[i,u]=y.useState(t.model||""),[d,f]=y.useState(""),[m,p]=y.useState(t.effort||"default"),[x,g]=y.useState(!1),[b,S]=y.useState(""),[w,j]=y.useState(null),[T,k]=y.useState(!1),[z,R]=y.useState(null),[E,G]=y.useState("fixed"),[_,N]=y.useState([]),[$,W]=y.useState("hr"),[V,le]=y.useState("1"),[Oe,be]=y.useState(!1),pe=t.status==="running"||t.status==="starting";y.useEffect(()=>{K(),J.get("/skills/installed").then(ce=>N(Array.isArray(ce)?ce:ce.skills||[])).catch(()=>{});function L(){K()}return window.addEventListener("groove:providers-changed",L),()=>window.removeEventListener("groove:providers-changed",L)},[]);function K(){J.get("/providers").then(L=>l(Array.isArray(L)?L:[])).catch(()=>{})}y.useEffect(()=>{u(t.model||""),J.get(`/agents/${t.id}/routing/recommend`).then(L=>{G((L==null?void 0:L.mode)||"fixed")}).catch(()=>{})},[t.id,t.model]);const Z=s.find(L=>L.id===t.provider);async function F(L,ce){u(ce);try{await J.patch(`/agents/${t.id}`,{model:ce}),n("success",`Model → ${ce}`)}catch(Pe){n("error","Model swap failed",Pe.message)}}async function ee(L){try{await J.patch(`/agents/${t.id}`,{workingDir:L}),n("success",`Working dir → ${L.split("/").pop()||L}`)}catch(ce){n("error","Update failed",ce.message)}}async function he(L){p(L);try{await J.patch(`/agents/${t.id}`,{effort:L}),n("success",`Effort → ${L}`)}catch(ce){n("error","Update failed",ce.message)}}async function te(L){if(!L.trim())return;const ce=[...t.scope||[],L.trim()];try{await J.patch(`/agents/${t.id}`,{scope:ce}),f("")}catch(Pe){n("error","Scope update failed",Pe.message)}}async function Ue(L){const ce=(t.scope||[]).filter((Pe,dt)=>dt!==L);try{await J.patch(`/agents/${t.id}`,{scope:ce})}catch(Pe){n("error","Scope update failed",Pe.message)}}async function Re(L){if(b.trim())try{await J.post(`/credentials/${L}`,{key:b.trim()}),n("success",`API key set for ${L}`),S(""),j(null),K(),window.dispatchEvent(new CustomEvent("groove:providers-changed"))}catch(ce){n("error","Failed to set key",ce.message)}}const ye=t.spawnedAt||t.createdAt;return o.jsxs("div",{className:"px-5 py-5 space-y-6 overflow-y-auto h-full",children:[o.jsx(Oa,{label:"Active Model",icon:Af,children:o.jsxs("div",{className:"bg-surface-0 rounded-lg border border-border-subtle px-3.5 py-3",children:[o.jsxs("div",{className:"flex items-center justify-between",children:[o.jsxs("div",{children:[o.jsx("div",{className:"text-sm font-bold font-mono text-text-0",children:t.model||"auto"}),o.jsx("div",{className:"text-2xs text-text-3 font-sans mt-0.5",children:(Z==null?void 0:Z.name)||t.provider})]}),(Z==null?void 0:Z.canHotSwap)&&pe&&o.jsxs(De,{variant:"accent",className:"text-2xs gap-1",children:[o.jsx(cn,{size:8})," Hot-swap"]})]}),((Ye=Z==null?void 0:Z.models)==null?void 0:Ye.length)>1&&o.jsx("div",{className:"flex flex-wrap gap-1.5 mt-3 pt-3 border-t border-border-subtle",children:Z.models.map(L=>{const ce=L.id===t.model,Pe=!pe||Z.canHotSwap;return o.jsx("button",{onClick:()=>Pe&&F(t.provider,L.id),disabled:!Pe,className:se("px-2.5 py-1 rounded-md text-xs font-mono transition-all",Pe?"cursor-pointer":"cursor-not-allowed opacity-40",ce?"bg-accent/15 text-accent font-semibold":"bg-surface-4 text-text-2 hover:bg-surface-5 hover:text-text-0"),children:L.name||L.id},L.id)})})]})}),o.jsx(TC,{agent:t}),o.jsxs(Oa,{label:"Providers",icon:Ug,description:"Click a provider to see its models and connection status.",children:[o.jsx("div",{className:"space-y-1.5",children:s.map(L=>{const ce=L.id===t.provider,Pe=L.installed||L.hasKey,dt=z===L.id,Xe=L.models||[];return o.jsxs("div",{className:"rounded-lg border border-border-subtle bg-surface-0 overflow-hidden",children:[o.jsxs("button",{onClick:()=>R(dt?null:L.id),className:"w-full flex items-center gap-2.5 px-3 py-2 cursor-pointer hover:bg-surface-4/50 transition-colors",children:[o.jsx("div",{className:se("w-2 h-2 rounded-full flex-shrink-0",Pe?"bg-success":"bg-text-4")}),o.jsx("span",{className:se("text-xs font-semibold font-sans flex-1 text-left",Pe?"text-text-0":"text-text-3"),children:L.name||L.id}),ce&&o.jsx(De,{variant:"accent",className:"text-2xs",children:"Active"}),!Pe&&o.jsx("span",{className:"text-2xs text-text-4 font-sans",children:L.authType==="local"?"Not installed":"No key"}),o.jsx(Wn,{size:12,className:se("text-text-4 transition-transform",dt&&"rotate-180")})]}),dt&&L.authType==="local"&&o.jsx("div",{className:"border-t border-border-subtle",children:o.jsx(Jy,{isInstalled:Pe,onModelChange:K})}),dt&&L.authType!=="local"&&o.jsxs("div",{className:"border-t border-border-subtle",children:[(!Pe||L.hasKey)&&o.jsx("div",{className:"px-3 py-2 bg-surface-1/50",children:w===L.id?o.jsxs("div",{className:"flex gap-1.5",children:[o.jsxs("div",{className:"flex-1 relative",children:[o.jsx("input",{value:b,onChange:tt=>S(tt.target.value),onKeyDown:tt=>tt.key==="Enter"&&Re(L.id),type:T?"text":"password",placeholder:`${L.name||L.id} API key...`,className:"w-full h-7 px-2.5 pr-7 text-2xs bg-surface-0 border border-border rounded-md text-text-0 font-mono placeholder:text-text-4 focus:outline-none focus:ring-1 focus:ring-accent",autoFocus:!0}),o.jsx("button",{onClick:()=>k(!T),className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-4 hover:text-text-2 cursor-pointer",children:T?o.jsx(qf,{size:10}):o.jsx(li,{size:10})})]}),o.jsx(Se,{variant:"primary",size:"sm",onClick:()=>Re(L.id),disabled:!b.trim(),className:"h-7 px-2 text-2xs",children:"Save"}),o.jsx(Se,{variant:"ghost",size:"sm",onClick:()=>{j(null),S("")},className:"h-7 px-2 text-2xs",children:"Cancel"})]}):o.jsxs("button",{onClick:()=>{j(L.id),S(""),k(!1)},className:"flex items-center gap-1.5 text-2xs text-text-3 hover:text-accent font-sans cursor-pointer transition-colors",children:[o.jsx(oc,{size:10}),Pe?"Update API key":"Add API key to enable"]})}),Pe&&Xe.length>0&&Xe.map(tt=>{const gt=L.id===t.provider&&tt.id===t.model,bt=!pe;return o.jsxs("button",{onClick:()=>bt&&F(L.id,tt.id),disabled:!bt,className:se("w-full flex items-center gap-2 px-3 py-2 text-left text-xs font-sans transition-colors","border-t border-border-subtle",bt?"cursor-pointer hover:bg-surface-4/50":"cursor-not-allowed opacity-40",gt?"text-accent":"text-text-2"),children:[gt?o.jsx(la,{size:11,className:"text-accent flex-shrink-0"}):o.jsx("div",{className:"w-[11px]"}),o.jsx("span",{className:"font-mono flex-1 truncate",children:tt.name||tt.id}),o.jsx(De,{variant:gt?"accent":"default",className:"text-2xs",children:tt.tier})]},tt.id)})]})]},L.id)})}),pe&&o.jsxs("div",{className:"flex items-center gap-1.5 text-2xs text-text-3 font-sans mt-1.5",children:[o.jsx(Ss,{size:10}),o.jsx("span",{children:"Stop agent to switch providers."})]})]}),o.jsx(Oa,{label:"Working Directory",icon:Dr,description:"The root directory this agent operates in.",children:o.jsxs("div",{className:"flex gap-2",children:[o.jsx("div",{className:"flex-1 bg-surface-0 rounded-lg px-3 py-2.5 text-sm font-mono text-text-1 border border-border-subtle truncate min-w-0",children:t.workingDir||"Project root"}),o.jsxs(Se,{variant:"secondary",size:"md",onClick:()=>g(!0),className:"gap-1.5 flex-shrink-0",children:[o.jsx(Qb,{size:14})," Browse"]})]})}),o.jsx(Oa,{label:"Permission Mode",icon:Br,description:"Full Send = no approvals. Agent Approve = Fullstack Manager reviews risky operations.",children:o.jsx(DO,{options:[{value:"full",label:"Full Send"},{value:"auto",label:"Agent Approve"}],value:t.permission||"full",onChange:async L=>{try{await J.patch(`/agents/${t.id}`,{permission:L}),n("success",`Permission → ${L==="full"?"Full Send":"Agent Approve"}`)}catch(ce){n("error","Update failed",ce.message)}}})}),o.jsxs(Oa,{label:"Model Routing",icon:sc,description:"How Groove selects models for this agent's tasks.",children:[o.jsx(DO,{options:[{value:"fixed",label:"Fixed"},{value:"auto",label:"Auto"},{value:"auto-floor",label:"Auto + Floor"}],value:E,onChange:async L=>{G(L);try{await J.post(`/agents/${t.id}/routing`,{mode:L}),n("success",`Routing → ${L}`)}catch(ce){n("error","Update failed",ce.message)}}}),o.jsxs("div",{className:"text-2xs text-text-4 font-sans mt-1",children:[E==="fixed"&&"Uses the selected model for all tasks.",E==="auto"&&"Groove picks Opus/Sonnet/Haiku based on task complexity.",E==="auto-floor"&&"Auto-routes but never drops below Sonnet."]})]}),o.jsx(Oa,{label:"File Scope",icon:Br,description:"Restrict which files this agent can access. Empty = unrestricted.",children:o.jsxs("div",{className:"flex flex-wrap gap-2",children:[(t.scope||[]).map((L,ce)=>o.jsxs(De,{variant:"default",className:"font-mono text-xs gap-1.5 px-2.5 py-1",children:[L,o.jsx("button",{onClick:()=>Ue(ce),className:"hover:text-danger cursor-pointer",children:o.jsx(Nt,{size:10})})]},ce)),o.jsxs("div",{className:"flex items-center gap-1.5",children:[o.jsx("input",{value:d,onChange:L=>f(L.target.value),onKeyDown:L=>L.key==="Enter"&&te(d),placeholder:"e.g. src/**",className:"w-28 h-7 px-2.5 text-xs bg-surface-0 border border-border-subtle rounded-md text-text-0 font-mono placeholder:text-text-4 focus:outline-none focus:ring-1 focus:ring-accent"}),o.jsx("button",{onClick:()=>te(d),disabled:!d.trim(),className:"w-7 h-7 flex items-center justify-center rounded-md bg-surface-4 border border-border-subtle text-text-3 hover:text-accent cursor-pointer disabled:opacity-30 disabled:cursor-not-allowed transition-colors",children:o.jsx(Bn,{size:12})})]})]})}),o.jsx(Oa,{label:"Effort Level",icon:jb,description:"Controls how deep the agent reasons. Higher = more tokens but better results.",children:o.jsx(DO,{options:[{value:"min",label:"Min"},{value:"low",label:"Low"},{value:"default",label:"Default"},{value:"high",label:"High"},{value:"max",label:"Max"}],value:m,onChange:he})}),o.jsx(Oa,{label:"Agent Details",icon:Ug,children:o.jsxs("div",{className:"bg-surface-0 rounded-lg border border-border-subtle divide-y divide-border-subtle",children:[o.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[o.jsx("span",{className:"text-xs text-text-3 font-sans",children:"ID"}),o.jsx("span",{className:"text-xs text-text-1 font-mono",children:t.id})]}),o.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[o.jsx("span",{className:"text-xs text-text-3 font-sans",children:"Role"}),o.jsx("span",{className:"text-xs text-text-1 font-sans capitalize",children:t.role})]}),o.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[o.jsx("span",{className:"text-xs text-text-3 font-sans",children:"Provider"}),o.jsx("span",{className:"text-xs text-text-1 font-mono",children:t.provider})]}),o.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[o.jsx("span",{className:"text-xs text-text-3 font-sans",children:"Model"}),o.jsx("span",{className:"text-xs text-text-1 font-mono",children:t.model||"auto"})]}),o.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[o.jsx("span",{className:"text-xs text-text-3 font-sans",children:"Status"}),o.jsx("span",{className:"text-xs text-text-1 font-sans capitalize",children:t.status})]}),o.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[o.jsx("span",{className:"text-xs text-text-3 font-sans",children:"Spawned"}),o.jsx("span",{className:"text-xs text-text-1 font-sans",children:ye?Wt(ye):"—"})]}),t.sessionId&&o.jsxs("div",{className:"flex items-center justify-between px-3 py-2",children:[o.jsx("span",{className:"text-xs text-text-3 font-sans",children:"Session"}),o.jsxs("span",{className:"text-xs text-text-1 font-mono",children:[t.sessionId.slice(0,16),"..."]})]})]})}),o.jsx(Oa,{label:"Skills",icon:Mb,description:"Attach installed skills to this agent's context.",children:o.jsxs("div",{className:"flex flex-wrap gap-1.5",children:[(t.skills||[]).map(L=>o.jsxs(De,{variant:"accent",className:"font-mono text-xs gap-1.5 px-2.5 py-1",children:[L,o.jsx("button",{onClick:async()=>{try{await J.delete(`/agents/${t.id}/skills/${L}`),n("success",`Detached ${L}`)}catch(ce){n("error","Detach failed",ce.message)}},className:"hover:text-danger cursor-pointer",children:o.jsx(Nt,{size:10})})]},L)),_.filter(L=>!(t.skills||[]).includes(L.id)).length>0&&o.jsxs("div",{className:"relative group",children:[o.jsx("button",{className:"w-7 h-7 flex items-center justify-center rounded-md bg-surface-4 border border-border-subtle text-text-3 hover:text-accent cursor-pointer transition-colors",children:o.jsx(Bn,{size:12})}),o.jsx("div",{className:"absolute top-full left-0 mt-1 z-20 hidden group-hover:block bg-surface-2 border border-border-subtle rounded-lg shadow-xl py-1 min-w-[160px]",children:_.filter(L=>!(t.skills||[]).includes(L.id)).map(L=>o.jsx("button",{onClick:async()=>{try{await J.post(`/agents/${t.id}/skills/${L.id}`),n("success",`Attached ${L.name||L.id}`)}catch(ce){n("error","Attach failed",ce.message)}},className:"w-full text-left px-3 py-1.5 text-xs font-sans text-text-1 hover:bg-surface-4 cursor-pointer transition-colors",children:L.name||L.id},L.id))})]}),(t.skills||[]).length===0&&_.length===0&&o.jsx("span",{className:"text-2xs text-text-4 font-sans",children:"No skills installed — browse the Marketplace"})]})}),o.jsx(Oa,{label:"Schedule",icon:Vg,description:"Run this agent on a recurring schedule.",children:o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx("span",{className:"text-xs text-text-2 font-sans",children:"Every"}),o.jsx("input",{value:V,onChange:L=>le(L.target.value.replace(/\D/g,"").slice(0,3)),className:"w-12 h-7 px-2 text-xs text-center bg-surface-0 border border-border-subtle rounded-md text-text-0 font-mono focus:outline-none focus:ring-1 focus:ring-accent",placeholder:"1"}),o.jsx("div",{className:"flex bg-surface-0 rounded-lg p-0.5 border border-border-subtle",children:[{value:"min",label:"Min"},{value:"hr",label:"Hr"},{value:"day",label:"Day"},{value:"wk",label:"Wk"},{value:"mo",label:"Mo"}].map(L=>o.jsx("button",{onClick:()=>W(L.value),className:se("px-2 py-1 text-2xs font-semibold font-sans rounded-md transition-all cursor-pointer",$===L.value?"bg-accent/15 text-accent shadow-sm":"text-text-3 hover:text-text-1"),children:L.label},L.value))}),o.jsxs(Se,{variant:"primary",size:"sm",disabled:Oe||!V||parseInt(V,10)<1,onClick:async()=>{const L=parseInt(V,10);if(!L||L<1)return;const ce={min:L===1?"* * * * *":`*/${L} * * * *`,hr:L===1?"0 * * * *":`0 */${L} * * *`,day:L===1?"0 0 * * *":`0 0 */${L} * *`,wk:`0 0 * * ${L===1?"1":"*"}`,mo:`0 0 ${L===1?"1":L} * *`};be(!0);try{await J.post("/schedules",{name:`${t.name} schedule`,cron:ce[$],agentConfig:{role:t.role,provider:t.provider,model:t.model,scope:t.scope,workingDir:t.workingDir,prompt:t.prompt}}),n("success",`Scheduled every ${L} ${$}`)}catch(Pe){n("error","Schedule failed",Pe.message)}be(!1)},className:"h-7 px-3 text-2xs gap-1",children:[o.jsx(Vg,{size:10}),Oe?"...":"Set"]})]})}),t.prompt&&o.jsx(Oa,{label:"Original Prompt",icon:sc,children:o.jsx("div",{className:"bg-surface-0 rounded-lg border border-border-subtle px-3 py-3 text-xs text-text-2 font-sans leading-relaxed max-h-40 overflow-y-auto",children:t.prompt})}),o.jsx(XS,{open:x,onOpenChange:g,currentPath:t.workingDir||"/",onSelect:ee})]})}const d0=[];function NC({data:t,isAlive:n,height:s=48}){const l=y.useRef(null);return y.useEffect(()=>{const i=l.current;if(!i||!t.length)return;const u=i.getContext("2d"),d=window.devicePixelRatio||1,f=i.clientWidth,m=i.clientHeight;i.width=f*d,i.height=m*d,u.scale(d,d),u.clearRect(0,0,f,m);const p=t.map(w=>w.v),x=Math.min(...p),b=Math.max(...p,1)-x||1;u.beginPath(),u.moveTo(0,m),t.forEach((w,j)=>{const T=j/(t.length-1)*f,k=m-(w.v-x)/b*(m-4)-2;u.lineTo(T,k)}),u.lineTo(f,m),u.closePath();const S=u.createLinearGradient(0,0,0,m);if(S.addColorStop(0,n?"rgba(51,175,188,0.15)":"rgba(110,118,129,0.08)"),S.addColorStop(1,"rgba(0,0,0,0)"),u.fillStyle=S,u.fill(),u.beginPath(),u.strokeStyle=n?Ie.accent:Ie.text3,u.lineWidth=1.5,t.forEach((w,j)=>{const T=j/(t.length-1)*f,k=m-(w.v-x)/b*(m-4)-2;j===0?u.moveTo(T,k):u.lineTo(T,k)}),u.stroke(),t.length>1&&n){const w=t[t.length-1],j=f-1,T=m-(w.v-x)/b*(m-4)-2;u.beginPath(),u.arc(j,T,5,0,Math.PI*2),u.fillStyle="rgba(51,175,188,0.3)",u.fill(),u.beginPath(),u.arc(j,T,2.5,0,Math.PI*2),u.fillStyle=Ie.accent,u.fill()}},[t,n]),o.jsx("div",{className:"w-full rounded-lg bg-surface-0 overflow-hidden border border-border-subtle",style:{height:s},children:o.jsx("canvas",{ref:l,className:"w-full h-full"})})}function Vo({icon:t,label:n,value:s,color:l,sub:i}){return o.jsxs("div",{className:"bg-surface-0 rounded-lg px-3 py-2.5 border border-border-subtle",children:[o.jsxs("div",{className:"flex items-center gap-2 mb-1",children:[o.jsx(t,{size:12,className:l||"text-text-3"}),o.jsx("span",{className:"text-2xs text-text-4 font-sans uppercase tracking-wider",children:n})]}),o.jsx("div",{className:se("text-lg font-bold font-mono tabular-nums",l||"text-text-0"),children:s}),i&&o.jsx("div",{className:"text-2xs text-text-4 font-sans mt-0.5",children:i})]})}function zC({score:t}){const n=Math.min(Math.max(t,0),100);let s=Ie.success,l="Healthy";return n<40?(s=Ie.danger,l="Degraded"):n<70&&(s=Ie.warning,l="Fair"),o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-1.5",children:[o.jsxs("span",{className:"text-2xs text-text-3 font-sans flex items-center gap-1.5",children:[o.jsx(o5,{size:11}),"Session Health"]}),o.jsxs("span",{className:"text-xs font-bold font-mono",style:{color:s},children:[n,"/100"]})]}),o.jsx("div",{className:"h-2 bg-surface-0 rounded-full overflow-hidden border border-border-subtle",children:o.jsx("div",{className:"h-full rounded-full transition-all duration-700",style:{width:`${n}%`,background:s}})}),o.jsx("span",{className:"text-2xs font-sans mt-1 block",style:{color:s},children:l})]})}function RC(t){const n=(t||"").toLowerCase();return n.includes("edit")||n.includes("writ")?{icon:Sb,color:"text-warning"}:n.includes("read")||n.includes("view")?{icon:li,color:"text-info"}:n.includes("search")||n.includes("grep")||n.includes("glob")?{icon:Cl,color:"text-purple"}:n.includes("bash")||n.includes("command")||n.includes("terminal")?{icon:oi,color:"text-orange"}:n.includes("error")||n.includes("fail")?{icon:Ss,color:"text-danger"}:n.includes("spawn")||n.includes("start")?{icon:cn,color:"text-success"}:n.includes("complet")||n.includes("done")?{icon:af,color:"text-success"}:{icon:rc,color:"text-text-4"}}function XC({agent:t}){const n=D(d=>d.tokenTimeline[t.id])||d0,s=D(d=>d.activityLog[t.id])||d0,l=t.status==="running"||t.status==="starting",i=y.useMemo(()=>{if(n.length<2)return 0;const d=n.slice(-10),f=(d[d.length-1].t-d[0].t)/6e4,m=d[d.length-1].v-d[0].v;return f>0?Math.round(m/f):0},[n]),u=y.useMemo(()=>{const d=t.contextUsage||0;let f=100;return d>90?f-=50:d>70?f-=25:d>50&&(f-=10),i>5e3?f-=15:i>3e3&&(f-=8),t.status==="crashed"&&(f=10),t.status==="completed"&&(f=95),Math.max(0,Math.min(100,f))},[t.contextUsage,t.status,i]);return o.jsxs("div",{className:"px-5 py-5 space-y-5 overflow-y-auto h-full",children:[o.jsxs("div",{children:[o.jsxs("div",{className:"flex items-center justify-between mb-2",children:[o.jsx("span",{className:"text-2xs font-semibold text-text-3 font-sans uppercase tracking-wider",children:"Token Burn"}),l&&o.jsx("span",{className:"text-2xs text-accent font-mono animate-pulse",children:"LIVE"})]}),o.jsx(NC,{data:n,isAlive:l,height:56})]}),o.jsxs("div",{className:"grid grid-cols-2 gap-2",children:[o.jsx(Vo,{icon:HT,label:"Burn Rate",value:i>0?`${Dt(i)}/m`:"—",color:i>5e3?"text-danger":i>2e3?"text-warning":"text-text-0"}),o.jsx(Vo,{icon:ET,label:"Cost",value:Lf(t.costUsd||0),color:"text-text-0"}),o.jsx(Vo,{icon:ii,label:"Rotations",value:t.rotations||"0",color:"text-text-0"}),o.jsx(Vo,{icon:cn,label:"Turns",value:t.turns||"0",color:"text-text-0"})]}),o.jsx(zC,{score:u}),t.prompt&&o.jsxs("div",{children:[o.jsx("span",{className:"text-2xs font-semibold text-text-3 font-sans uppercase tracking-wider block mb-1.5",children:"Task"}),o.jsx("div",{className:"bg-surface-0 rounded-lg px-3 py-2.5 text-xs text-text-2 font-sans leading-relaxed max-h-28 overflow-y-auto border border-border-subtle",children:t.prompt})]}),s.length>0&&o.jsxs("div",{children:[o.jsx("span",{className:"text-2xs font-semibold text-text-3 font-sans uppercase tracking-wider block mb-2",children:"Activity"}),o.jsxs("div",{className:"space-y-0 relative",children:[o.jsx("div",{className:"absolute left-[9px] top-2 bottom-2 w-px bg-border-subtle"}),s.slice(-12).reverse().map((d,f)=>{const m=RC(d.text),p=m.icon;return o.jsxs("div",{className:"flex items-start gap-3 py-1.5 relative",children:[o.jsx("div",{className:se("w-[18px] h-[18px] rounded-full flex items-center justify-center flex-shrink-0 z-10","bg-surface-1 border border-border-subtle"),children:o.jsx(p,{size:9,className:m.color})}),o.jsx("span",{className:"text-2xs text-text-2 font-sans flex-1 line-clamp-1 pt-0.5",children:d.text}),o.jsx("span",{className:"text-2xs text-text-4 font-mono flex-shrink-0 pt-0.5",children:Wt(d.timestamp)})]},f)})]})]})]})}const _C={running:"success",starting:"warning",stopped:"default",crashed:"danger",completed:"accent",killed:"default",rotating:"purple"},CC={running:"Running",starting:"Starting",stopped:"Stopped",crashed:"Crashed",completed:"Done",killed:"Killed",rotating:"Rotating"},ZC=[{id:"command",label:"Chat",icon:ri},{id:"config",label:"Config",icon:Ab},{id:"telemetry",label:"Monitor",icon:sc}];function AC({agent:t}){const n=D(m=>m.addToast),[s,l]=y.useState(!1),[i,u]=y.useState(t.name),d=y.useRef(null);async function f(){const m=i.trim();if(!m||m===t.name){l(!1);return}try{await J.patch(`/agents/${t.id}`,{name:m.replace(/\s+/g,"-")}),n("success",`Renamed → ${m}`)}catch(p){n("error","Rename failed",p.message),u(t.name)}l(!1)}return s?o.jsxs("div",{className:"flex items-center gap-1 flex-1 min-w-0",children:[o.jsx("input",{ref:d,value:i,onChange:m=>u(m.target.value),onKeyDown:m=>{m.key==="Enter"&&f(),m.key==="Escape"&&(u(t.name),l(!1))},className:"flex-1 min-w-0 h-6 px-1.5 text-sm font-bold bg-surface-0 border border-accent/30 rounded text-text-0 font-sans focus:outline-none focus:ring-1 focus:ring-accent/40",autoFocus:!0}),o.jsx("button",{onClick:f,className:"p-0.5 text-accent hover:text-accent/80 cursor-pointer",children:o.jsx(la,{size:12})}),o.jsx("button",{onClick:()=>{u(t.name),l(!1)},className:"p-0.5 text-text-4 hover:text-text-1 cursor-pointer",children:o.jsx(Nt,{size:12})})]}):o.jsxs("div",{className:"flex items-center gap-1.5 flex-1 min-w-0 group",children:[o.jsx("h2",{className:"text-sm font-bold text-text-0 font-sans truncate",children:t.name}),o.jsx("button",{onClick:()=>{u(t.name),l(!0)},className:"p-0.5 text-text-4 opacity-0 group-hover:opacity-100 hover:text-text-1 cursor-pointer transition-opacity",children:o.jsx(zc,{size:10})})]})}function EC(){const t=D(p=>p.detailPanel),n=D(p=>p.agents),[s,l]=y.useState("command");if((t==null?void 0:t.type)!=="agent")return null;const i=n.find(p=>p.id===t.agentId);if(!i)return null;const u=i.status==="running"||i.status==="starting",d=Math.round((i.contextUsage||0)*100),f=i.spawnedAt||i.createdAt,m=f?Math.floor((Date.now()-new Date(f).getTime())/1e3):0;return Gf(i.role),o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"flex-shrink-0",children:[o.jsxs("div",{className:"pl-4 pr-10 pt-3 pb-2",children:[o.jsxs("div",{className:"flex items-center gap-2",children:[o.jsx(AC,{agent:i}),o.jsx(De,{variant:_C[i.status]||"default",dot:u?"pulse":void 0,className:"text-2xs flex-shrink-0",children:CC[i.status]||i.status})]}),o.jsxs("div",{className:"flex items-center gap-2 mt-1 text-2xs text-text-3 font-mono",children:[o.jsx("span",{className:"capitalize",children:i.role}),o.jsx("span",{className:"text-text-4",children:"·"}),o.jsxs("span",{children:[i.provider,":",i.model||"auto"]}),o.jsx("span",{className:"text-text-4",children:"·"}),o.jsxs("span",{children:[Dt(i.tokensUsed||0)," tok"]}),d>0&&o.jsxs(o.Fragment,{children:[o.jsx("span",{className:"text-text-4",children:"·"}),o.jsxs("span",{className:se(d>80?"text-danger":d>60?"text-warning":"text-text-3"),children:[d,"% ctx"]})]}),o.jsx("span",{className:"text-text-4",children:"·"}),o.jsx("span",{children:Cc(m)})]})]}),o.jsx("div",{className:"flex items-center px-4 border-b border-border-subtle",children:ZC.map(p=>{const x=p.icon,g=s===p.id;return o.jsxs("button",{onClick:()=>l(p.id),className:se("flex items-center gap-1.5 px-3 py-2 text-2xs font-semibold font-sans transition-all cursor-pointer select-none border-b-2 -mb-px",g?"border-accent text-text-0":"border-transparent text-text-3 hover:text-text-1"),children:[o.jsx(x,{size:11}),p.label]},p.id)})})]}),o.jsxs("div",{className:"flex-1 min-h-0 flex flex-col overflow-hidden",children:[s==="command"&&o.jsx(kC,{agent:i}),s==="config"&&o.jsx(PC,{agent:i}),s==="telemetry"&&o.jsx(XC,{agent:i})]})]})}const vf=y.forwardRef(({className:t,label:n,error:s,mono:l,...i},u)=>o.jsxs("div",{className:"flex flex-col gap-1",children:[n&&o.jsx("label",{className:"text-xs font-medium text-text-2 font-sans",children:n}),o.jsx("input",{ref:u,className:se("h-8 w-full rounded-md px-3 text-sm","bg-surface-1 border border-border text-text-0","placeholder:text-text-4","focus:outline-none focus:ring-1 focus:ring-accent focus:border-accent","disabled:opacity-40 disabled:cursor-not-allowed","transition-colors duration-100",l?"font-mono":"font-sans",s&&"border-danger focus:ring-danger",t),...i}),s&&o.jsx("span",{className:"text-2xs text-danger font-sans",children:s})]}));vf.displayName="Input";const ES=y.forwardRef(({className:t,label:n,error:s,mono:l,...i},u)=>o.jsxs("div",{className:"flex flex-col gap-1",children:[n&&o.jsx("label",{className:"text-xs font-medium text-text-2 font-sans",children:n}),o.jsx("textarea",{ref:u,className:se("w-full rounded-md px-3 py-2 text-sm resize-none","bg-surface-1 border border-border text-text-0","placeholder:text-text-4","focus:outline-none focus:ring-1 focus:ring-accent focus:border-accent","disabled:opacity-40 disabled:cursor-not-allowed","transition-colors duration-100",l?"font-mono":"font-sans",s&&"border-danger focus:ring-danger",t),...i}),s&&o.jsx("span",{className:"text-2xs text-danger font-sans",children:s})]}));ES.displayName="Textarea";const qC=[{id:"planner",label:"Planner",desc:"Plans the team and tasks",icon:Cb,tier:"Heavy"},{id:"backend",label:"Backend",desc:"APIs, services, databases",icon:Zb,tier:"Medium"},{id:"frontend",label:"Frontend",desc:"UI, components, styling",icon:Yf,tier:"Medium"},{id:"fullstack",label:"Fullstack",desc:"End-to-end implementation",icon:Ta,tier:"Heavy"},{id:"testing",label:"Testing",desc:"Tests, coverage, QA",icon:Uf,tier:"Medium"},{id:"devops",label:"DevOps",desc:"CI/CD, infra, deployment",icon:zT,tier:"Medium"},{id:"docs",label:"Docs",desc:"Documentation, guides",icon:sf,tier:"Light"},{id:"security",label:"Security",desc:"Audits, vulnerabilities",icon:Br,tier:"Medium"},{id:"database",label:"Database",desc:"Schema, migrations, queries",icon:ZT,tier:"Medium"},{id:"cmo",label:"CMO",desc:"Marketing, content, growth",icon:S5,tier:"Medium"},{id:"cfo",label:"CFO",desc:"Finance, metrics, forecasting",icon:mT,tier:"Medium"},{id:"ea",label:"EA",desc:"Executive assistant, scheduling",icon:lP,tier:"Light"},{id:"support",label:"Support",desc:"Customer support, FAQs",icon:r5,tier:"Medium"},{id:"analyst",label:"Analyst",desc:"Data analysis, insights",icon:Nc,tier:"Medium"}];function MC(){const t=D(V=>V.detailPanel),n=D(V=>V.closeDetail),s=D(V=>V.spawnAgent),l=D(V=>V.fetchProviders),i=(t==null?void 0:t.type)==="spawn",[u,d]=y.useState(""),[f,m]=y.useState(""),[p,x]=y.useState(""),[g,b]=y.useState(""),[S,w]=y.useState(""),[j,T]=y.useState(""),[k,z]=y.useState([]),[R,E]=y.useState(!1);y.useEffect(()=>{i&&(l().then(V=>{z(Array.isArray(V)?V:V.providers||[])}).catch(()=>{}),d(""),m(""),x(""),b(""),w(""),T(""))},[i,l]);const G=u||f,_=k.find(V=>V.id===g),N=(_==null?void 0:_.models)||[],$=k.filter(V=>V.installed);async function W(){if(G){E(!0);try{const V={role:G,...p&&{name:p.replace(/\s+/g,"-")},...g&&{provider:g},...S&&{model:S},...j&&{prompt:j}};await s(V),n()}catch{}E(!1)}}return o.jsx(_S,{open:i,onOpenChange:V=>{V||n()},children:o.jsx(CS,{title:"Spawn Agent",width:480,children:o.jsxs("div",{className:"flex flex-col h-[calc(100%-57px)]",children:[o.jsxs("div",{className:"flex-1 overflow-y-auto px-5 py-4 space-y-6",children:[o.jsxs("div",{children:[o.jsx("label",{className:"text-xs font-semibold text-text-2 font-sans uppercase tracking-wider block mb-3",children:"Choose Role"}),o.jsx("div",{className:"grid grid-cols-2 gap-2",children:qC.map(V=>{const le=Gf(V.id),Oe=u===V.id;return o.jsxs("button",{onClick:()=>{d(V.id),m("")},className:se("flex items-center gap-2.5 p-3 rounded-md border text-left transition-all cursor-pointer",Oe?"border-accent bg-accent/5":"border-border-subtle bg-surface-1 hover:border-border hover:bg-surface-2"),children:[o.jsx("div",{className:"w-8 h-8 rounded-md flex items-center justify-center flex-shrink-0",style:{background:le.bg},children:o.jsx(V.icon,{size:16,style:{color:le.text}})}),o.jsxs("div",{className:"min-w-0",children:[o.jsx("div",{className:"text-xs font-semibold text-text-0 font-sans",children:V.label}),o.jsx("div",{className:"text-2xs text-text-3 font-sans truncate",children:V.desc})]})]},V.id)})}),o.jsx("div",{className:"mt-3",children:o.jsx(vf,{placeholder:"or type a custom role...",value:f,onChange:V=>{m(V.target.value),d("")},className:"text-xs"})})]}),G&&o.jsxs("div",{className:"space-y-4",children:[o.jsx("label",{className:"text-xs font-semibold text-text-2 font-sans uppercase tracking-wider block",children:"Configuration"}),o.jsx(vf,{label:"Name (optional)",value:p,onChange:V=>x(V.target.value),placeholder:`${G}-1`}),o.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"text-xs font-medium text-text-2 font-sans",children:"Provider"}),o.jsxs("div",{className:"relative",children:[o.jsxs("select",{value:g,onChange:V=>{b(V.target.value),w("")},className:"w-full h-8 px-3 pr-8 text-sm rounded-md bg-surface-1 border border-border text-text-0 font-sans appearance-none cursor-pointer focus:outline-none focus:ring-1 focus:ring-accent",children:[o.jsx("option",{value:"",children:"Auto"}),$.map(V=>o.jsx("option",{value:V.id,children:V.name},V.id))]}),o.jsx(Wn,{size:14,className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-3 pointer-events-none"})]})]}),o.jsxs("div",{className:"space-y-1",children:[o.jsx("label",{className:"text-xs font-medium text-text-2 font-sans",children:"Model"}),o.jsxs("div",{className:"relative",children:[o.jsxs("select",{value:S,onChange:V=>w(V.target.value),disabled:!g,className:"w-full h-8 px-3 pr-8 text-sm rounded-md bg-surface-1 border border-border text-text-0 font-sans appearance-none cursor-pointer focus:outline-none focus:ring-1 focus:ring-accent disabled:opacity-40",children:[o.jsx("option",{value:"",children:"Auto"}),N.map(V=>o.jsx("option",{value:V.id,children:V.name},V.id))]}),o.jsx(Wn,{size:14,className:"absolute right-2 top-1/2 -translate-y-1/2 text-text-3 pointer-events-none"})]})]})]}),g&&_&&o.jsx("div",{className:"text-2xs text-text-3 font-sans flex items-center gap-2",children:_.hasKey?o.jsx(De,{variant:"success",children:"API key set"}):_.authType==="subscription"?o.jsx(De,{variant:"accent",children:"Subscription"}):o.jsxs(De,{variant:"warning",children:["No API key — set with: groove set-key ",g," YOUR_KEY"]})}),o.jsx(ES,{label:"Prompt (optional)",value:j,onChange:V=>T(V.target.value),placeholder:"What should this agent work on?",rows:3})]})]}),o.jsxs("div",{className:"border-t border-border-subtle px-5 py-4 bg-surface-1",children:[G&&o.jsxs("div",{className:"flex items-center gap-2 mb-3 text-xs text-text-3 font-sans",children:[o.jsx("span",{children:"Spawning"}),o.jsx(De,{variant:"accent",children:G}),g&&o.jsxs("span",{children:["on ",(_==null?void 0:_.name)||g]}),p&&o.jsxs("span",{children:["as ",p.replace(/\s+/g,"-")]})]}),o.jsx(Se,{variant:"primary",size:"lg",onClick:W,disabled:!G||R,className:"w-full",children:R?"Spawning...":"Spawn Agent"})]})]})})})}function O0({title:t,icon:n,defaultOpen:s=!1,badge:l,children:i,className:u}){const[d,f]=y.useState(s);return o.jsxs("div",{className:se("border-t border-border-subtle",u),children:[o.jsxs("button",{onClick:()=>f(!d),className:"w-full flex items-center gap-2 px-5 py-3 text-left cursor-pointer hover:bg-surface-5/30 transition-colors group",children:[o.jsx(si,{size:12,className:se("text-text-4 transition-transform duration-200 flex-shrink-0",d&&"rotate-90")}),n&&o.jsx(n,{size:13,className:"text-text-3 flex-shrink-0"}),o.jsx("span",{className:"text-xs font-semibold text-text-2 font-sans uppercase tracking-wider flex-1",children:t}),l&&o.jsx("span",{className:"text-2xs font-mono text-text-4 bg-surface-4 px-1.5 py-0.5 rounded",children:l})]}),d&&o.jsx("div",{className:"px-5 pb-4",children:i})]})}function YC(){const t=D(g=>g.journalistStatus),n=D(g=>g.fetchJournalist),s=D(g=>g.triggerJournalistCycle),[l,i]=y.useState(!0),[u,d]=y.useState(!1);y.useEffect(()=>{n().then(()=>i(!1));const g=setInterval(n,1e4);return()=>clearInterval(g)},[n]);async function f(){d(!0);try{await s()}catch{}d(!1)}if(l)return o.jsxs("div",{className:"p-5 space-y-4",children:[o.jsx(ra,{className:"h-6 w-32 rounded"}),o.jsx(ra,{className:"h-20 rounded-md"}),o.jsx(ra,{className:"h-20 rounded-md"})]});const m=t||{},p=m.lastSynthesis,x=m.history||[];return o.jsxs("div",{className:"flex flex-col h-full",children:[o.jsxs("div",{className:"px-5 py-4 border-b border-border-subtle flex items-center gap-2",children:[o.jsx(Wr,{size:16,className:"text-accent"}),o.jsx("h3",{className:"text-sm font-semibold text-text-0 font-sans flex-1",children:"Journalist"}),o.jsxs(Se,{variant:"secondary",size:"sm",onClick:f,disabled:u,className:"gap-1.5 text-2xs",children:[o.jsx(_l,{size:11,className:u?"animate-spin":""}),u?"Running...":"Run Synthesis"]})]}),o.jsx(Na,{className:"flex-1",children:o.jsxs("div",{className:"px-5 py-4 space-y-5",children:[o.jsxs("div",{className:"flex items-center gap-3 text-2xs text-text-3 font-sans",children:[o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(sc,{size:10}),o.jsxs("span",{children:[m.cycleCount||0," cycles"]})]}),m.lastCycleTime&&o.jsxs("div",{className:"flex items-center gap-1",children:[o.jsx(rc,{size:10}),o.jsxs("span",{children:["Last: ",Wt(m.lastCycleTime)]})]}),o.jsx(De,{variant:m.cycleCount>0?"success":"default",className:"text-2xs",children:m.cycleCount>0?"Active":"Idle"})]}),(p==null?void 0:p.summary)&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-xs font-semibold text-text-1 font-sans flex items-center gap-1.5",children:[o.jsx(sf,{size:12,className:"text-text-3"}),"Latest Summary"]}),o.jsx("div",{className:"bg-surface-0 rounded-lg border border-border-subtle px-3.5 py-3 text-xs text-text-2 font-sans leading-relaxed",children:p.summary})]}),(p==null?void 0:p.projectMap)&&o.jsx(O0,{title:"Project Map",icon:g5,children:o.jsx("div",{className:"bg-surface-0 rounded-lg border border-border-subtle px-3.5 py-3 text-xs text-text-2 font-mono leading-relaxed max-h-64 overflow-y-auto whitespace-pre-wrap",children:p.projectMap})}),(p==null?void 0:p.decisions)&&o.jsx(O0,{title:"Decisions Log",icon:sf,children:o.jsx("div",{className:"bg-surface-0 rounded-lg border border-border-subtle px-3.5 py-3 text-xs text-text-2 font-mono leading-relaxed max-h-64 overflow-y-auto whitespace-pre-wrap",children:p.decisions})}),x.length>0&&o.jsxs("div",{className:"space-y-2",children:[o.jsxs("label",{className:"text-xs font-semibold text-text-1 font-sans flex items-center gap-1.5",children:[o.jsx(rc,{size:12,className:"text-text-3"}),"History (",x.length,")"]}),o.jsx("div",{className:"space-y-1.5",children:x.slice().reverse().slice(0,20).map((g,b)=>o.jsxs("div",{className:"bg-surface-0 rounded-md border border-border-subtle px-3 py-2",children:[o.jsxs("div",{className:"flex items-center gap-2 text-2xs",children:[o.jsxs(De,{variant:"default",className:"text-2xs",children:["Cycle ",g.cycle]}),o.jsxs("span",{className:"text-text-4 font-sans",children:[g.agentCount," agent",g.agentCount!==1?"s":""]}),o.jsx("span",{className:"text-text-4 font-sans ml-auto",children:Wt(g.timestamp)})]}),g.summary&&o.jsx("p",{className:"text-xs text-text-2 font-sans mt-1 leading-relaxed",children:g.summary})]},b))})]}),!p&&x.length===0&&o.jsxs("div",{className:"text-center py-8 text-text-4 font-sans",children:[o.jsx(Wr,{size:28,className:"mx-auto mb-2"}),o.jsx("p",{className:"text-sm",children:"No synthesis data yet"}),o.jsx("p",{className:"text-2xs mt-1",children:"The journalist runs automatically when agents are active, or trigger manually above"})]})]})})]})}function VC({children:t,height:n,onHeightChange:s,visible:l,fullHeight:i,tabs:u,activeTab:d,onSelectTab:f,onAddTab:m,onCloseTab:p,onToggleFullHeight:x,onMinimize:g}){const b=y.useRef(!1),S=y.useRef(0),w=y.useRef(0),j=y.useCallback(k=>{if(i)return;k.preventDefault(),b.current=!0,S.current=k.clientY,w.current=n;function z(E){if(!b.current)return;const G=S.current-E.clientY,_=Math.min(Math.max(w.current+G,120),600);s(_)}function R(){b.current=!1,document.removeEventListener("mousemove",z),document.removeEventListener("mouseup",R)}document.addEventListener("mousemove",z),document.addEventListener("mouseup",R)},[n,s,i]);if(!l)return null;const T=u||[{id:"default",label:"Terminal"}];return o.jsxs("div",{className:"flex flex-col border-t border-border bg-surface-0 relative",style:i?{flex:1,minHeight:0}:{height:n,flexShrink:0},children:[!i&&o.jsx("div",{className:"absolute top-0 left-0 right-0 h-1 cursor-row-resize hover:bg-accent/30 transition-colors z-10",onMouseDown:j}),o.jsxs("div",{className:"flex items-center h-9 bg-surface-1 border-b border-border-subtle flex-shrink-0 pl-3 pr-1.5",children:[o.jsxs("div",{className:"flex items-center gap-0 flex-1 min-w-0 overflow-x-auto scrollbar-none",children:[T.map(k=>o.jsxs("button",{onClick:()=>f==null?void 0:f(k.id),className:se("flex items-center gap-1.5 pl-2.5 pr-1 h-7 text-2xs font-sans cursor-pointer select-none transition-colors flex-shrink-0 rounded-t",k.id===d?"text-text-0 bg-surface-0":"text-text-3 hover:text-text-1 hover:bg-surface-0/50"),children:[o.jsx(oi,{size:10}),o.jsx("span",{className:"truncate max-w-[80px]",children:k.label}),T.length>1&&o.jsx("button",{onClick:z=>{z.stopPropagation(),p==null||p(k.id)},className:"ml-0.5 p-0.5 rounded hover:bg-surface-5 text-text-4 hover:text-text-1 cursor-pointer",children:o.jsx(Nt,{size:9})})]},k.id)),o.jsx("button",{onClick:m,className:"flex items-center justify-center w-6 h-6 text-text-4 hover:text-text-1 hover:bg-surface-0/50 rounded cursor-pointer transition-colors flex-shrink-0 ml-0.5",title:"New terminal",children:o.jsx(Bn,{size:11})})]}),o.jsx("div",{className:"flex items-center gap-0.5 flex-shrink-0 ml-2",children:i?o.jsx("button",{onClick:g,className:"p-1.5 rounded text-text-3 hover:text-text-0 hover:bg-surface-5 cursor-pointer transition-colors",title:"Restore",children:o.jsx($5,{size:12})}):o.jsx("button",{onClick:x,className:"p-1.5 rounded text-text-3 hover:text-text-0 hover:bg-surface-5 cursor-pointer transition-colors",title:"Maximize",children:o.jsx(v5,{size:12})})})]}),o.jsx("div",{className:"flex-1 min-h-0 p-2",children:t})]})}const UC={background:"#1a1e25",foreground:"#bcc2cd",cursor:"#33afbc",cursorAccent:"#1a1e25",selectionBackground:"rgba(51, 175, 188, 0.25)",black:"#1a1e25",red:"#e06c75",green:"#4ae168",yellow:"#e5c07b",blue:"#61afef",magenta:"#c678dd",cyan:"#33afbc",white:"#bcc2cd",brightBlack:"#505862",brightRed:"#e06c75",brightGreen:"#4ae168",brightYellow:"#e5c07b",brightBlue:"#61afef",brightMagenta:"#c678dd",brightCyan:"#33afbc",brightWhite:"#e6e6e6"};let WO=0;function GC({tabId:t,visible:n}){const s=y.useRef(null),l=y.useRef(null),i=y.useRef(null),u=y.useRef(null),d=y.useRef(!1);return y.useEffect(()=>{if(!s.current||d.current)return;d.current=!0;const f=new Mj({theme:UC,fontFamily:"'JetBrains Mono Variable', 'SF Mono', monospace",fontSize:13,lineHeight:1.4,cursorBlink:!0,cursorStyle:"bar",scrollback:5e3,allowProposedApi:!0}),m=new Yj;f.loadAddon(m),f.loadAddon(new Vj),f.open(s.current),l.current=f,requestAnimationFrame(()=>m.fit());function p(){const g=D.getState().ws;if(!g||g.readyState!==WebSocket.OPEN){setTimeout(p,500);return}g.send(JSON.stringify({type:"terminal:spawn",cols:f.cols,rows:f.rows}));function b(S){let w;try{w=JSON.parse(S.data)}catch{return}w.type==="terminal:spawned"&&!i.current?i.current=w.id:w.type==="terminal:output"&&w.id===i.current?f.write(w.data):w.type==="terminal:exit"&&w.id===i.current&&(f.write(`\r
|
|
573
573
|
\x1B[90m[session ended]\x1B[0m\r
|
|
574
574
|
`),i.current=null)}g.addEventListener("message",b),u.current={ws:g,handler:b},f.onData(S=>{const w=D.getState().ws;(w==null?void 0:w.readyState)===WebSocket.OPEN&&i.current&&w.send(JSON.stringify({type:"terminal:input",id:i.current,data:S}))}),f.onResize(({cols:S,rows:w})=>{const j=D.getState().ws;(j==null?void 0:j.readyState)===WebSocket.OPEN&&i.current&&j.send(JSON.stringify({type:"terminal:resize",id:i.current,rows:w,cols:S}))})}p();const x=new ResizeObserver(()=>{requestAnimationFrame(()=>{try{m.fit()}catch{}})});return x.observe(s.current),()=>{x.disconnect();const g=D.getState().ws;(g==null?void 0:g.readyState)===WebSocket.OPEN&&i.current&&g.send(JSON.stringify({type:"terminal:kill",id:i.current})),u.current&&u.current.ws.removeEventListener("message",u.current.handler),f.dispose(),d.current=!1}},[]),y.useEffect(()=>{n&&l.current&&requestAnimationFrame(()=>{var f,m,p,x,g;try{(g=(x=(p=(m=(f=l.current._addonManager)==null?void 0:f._addons)==null?void 0:m[0])==null?void 0:p.instance)==null?void 0:x.fit)==null||g.call(x)}catch{}})},[n]),o.jsx("div",{ref:s,className:"w-full h-full",style:{display:n?"block":"none"}})}function LC(){const t=D(b=>b.terminalVisible),n=D(b=>b.terminalHeight),s=D(b=>b.setTerminalVisible),l=D(b=>b.setTerminalHeight),i=D(b=>b.terminalFullHeight),u=D(b=>b.setTerminalFullHeight),[d,f]=y.useState([{id:"term-0",label:"Terminal"}]),[m,p]=y.useState("term-0"),x=y.useCallback(()=>{WO++;const b=`term-${WO}`;f(S=>[...S,{id:b,label:`Terminal ${WO+1}`}]),p(b)},[]),g=y.useCallback(b=>{f(S=>{const w=S.filter(j=>j.id!==b);if(w.length===0)return s(!1),S;if(m===b){const j=S.findIndex(k=>k.id===b),T=w[Math.min(j,w.length-1)];p(T.id)}return w})},[m,s]);return o.jsx(VC,{visible:t,height:n,onHeightChange:l,fullHeight:i,tabs:d,activeTab:m,onSelectTab:p,onAddTab:x,onCloseTab:g,onToggleFullHeight:()=>u(!0),onMinimize:()=>u(!1),children:d.map(b=>o.jsx(GC,{tabId:b.id,visible:b.id===m},b.id))})}class DC extends Mn.Component{constructor(n){super(n),this.state={error:null}}static getDerivedStateFromError(n){return{error:n}}render(){return this.state.error?o.jsxs("div",{className:"h-screen bg-surface-0 p-10 font-sans",children:[o.jsx("h2",{className:"text-lg font-semibold text-text-0 mb-4",children:"Groove — Render Error"}),o.jsx("pre",{className:"text-sm text-danger whitespace-pre-wrap mb-4",children:this.state.error.message}),o.jsx("pre",{className:"text-xs text-text-3 whitespace-pre-wrap",children:this.state.error.stack}),o.jsx("button",{onClick:()=>this.setState({error:null}),className:"mt-6 px-4 py-2 bg-accent text-surface-0 rounded-md font-medium text-sm cursor-pointer",children:"Try Again"})]}):this.props.children}}function WC(){const t=D(i=>i.activeView),n=D(i=>i.detailPanel);let s;switch(t){case"agents":s=o.jsx(Bg,{});break;case"editor":s=o.jsx(HR,{});break;case"dashboard":s=o.jsx(lX,{});break;case"marketplace":s=o.jsx(QX,{});break;case"teams":s=o.jsx(HX,{});break;case"settings":s=o.jsx(xC,{});break;default:s=o.jsx(Bg,{})}let l=null;if(n)switch(n.type){case"agent":l=o.jsx(EC,{});break;case"journalist":l=o.jsx(YC,{});break;case"spawn":l=null;break}return o.jsxs(zP,{detailContent:l,terminalContent:o.jsx(LC,{}),children:[s,o.jsx(MC,{})]})}function BC(){return o.jsxs("div",{className:"h-screen bg-surface-0 flex flex-col items-center justify-center gap-4",children:[o.jsx("img",{src:"/favicon.png",alt:"",className:"w-10 h-10 opacity-60 animate-pulse"}),o.jsx("p",{className:"text-sm text-text-3 font-sans",children:"Connecting..."})]})}function HC(){const t=D(s=>s.connect),n=D(s=>s.hydrated);return y.useEffect(()=>{t()},[t]),n?o.jsx(DC,{children:o.jsx(WC,{})}):o.jsx(BC,{})}Wj.createRoot(document.getElementById("root")).render(o.jsx(y.StrictMode,{children:o.jsx(HC,{})}));
|