@tryglen/review 0.2.12 → 0.2.13
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/dist/server.mjs +89 -89
- package/dist/ui/assets/agent-list-query-DG0_h639.js +1 -0
- package/dist/ui/assets/card-ChTMYRL-.js +1 -0
- package/dist/ui/assets/{command-3yBkMBPV.js → command-C70vtZ-g.js} +1 -1
- package/dist/ui/assets/diff-viewer-DDWYsF6W.js +4 -0
- package/dist/ui/assets/{explored-file-view-BuO3IGTN.js → explored-file-view-DGqTyQfd.js} +1 -1
- package/dist/ui/assets/{history-nav-buttons-9MGKgV8Z.js → history-nav-buttons-DINMfDbp.js} +1 -1
- package/dist/ui/assets/index-Dro0lXd8.js +75 -0
- package/dist/ui/assets/inline-ask-CHr1EM6l.js +1 -0
- package/dist/ui/assets/input-group-CXlyHH6x.js +1 -0
- package/dist/ui/assets/local-side-panel-Cop6TTG7.js +2 -0
- package/dist/ui/index.html +3 -3
- package/package.json +2 -2
- package/dist/ui/assets/agent-list-query-DU__57Ym.js +0 -1
- package/dist/ui/assets/card-BPb3NZYg.js +0 -1
- package/dist/ui/assets/diff-viewer-Ch0w6iYS.js +0 -4
- package/dist/ui/assets/index-D7PxCZso.js +0 -75
- package/dist/ui/assets/inline-ask-S9RCvffn.js +0 -1
- package/dist/ui/assets/input-group-apzvTSGh.js +0 -1
- package/dist/ui/assets/local-side-panel-DbsADL8W.js +0 -2
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./button-DizkG3Et.js";import{B as n,t as r,x as i}from"./query-error-DSrxRVZP.js";import{a,o}from"./bundle-mjs-IMkwHZOK.js";import{C as s,g as c,o as l}from"./card-BPb3NZYg.js";import{a as u}from"./reviewer-connection-B1irBiYS.js";import{t as d}from"./CaretUp.es-C6IDKCMg.js";import{_ as f,f as p,g as m,h,i as g,n as _,p as v,r as y,t as b,u as x}from"./agent-list-query-DU__57Ym.js";import{Dt as S,a as C,kt as w,r as T,t as E}from"./index-D7PxCZso.js";var D=e(o(),1),O=a(),k=e=>e?.kind===`selection`&&e.path?`${e.path}${e.startLine?`:${e.startLine}${e.endLine&&e.endLine!==e.startLine?`-${e.endLine}`:``}`:``}`:e?.label??`Selection`,A=({title:e,actions:n,onClose:r,closing:a=!1,children:o})=>(0,O.jsxs)(`div`,{className:`border-edge bg-background border-y`,children:[(0,O.jsxs)(`div`,{className:o?`border-edge @container flex min-w-0 items-center gap-2 border-b px-3 py-1.5`:`@container flex min-w-0 items-center gap-2 px-3 py-1.5`,children:[(0,O.jsx)(`div`,{className:`text-muted-foreground flex min-w-0 flex-1 items-center gap-1.5 text-xs font-medium`,children:e}),n,(0,O.jsx)(t,{size:`icon-xs`,variant:`ghost`,"aria-label":`Close`,disabled:a,onClick:r,children:a?(0,O.jsx)(c,{}):(0,O.jsx)(i,{})})]}),o]}),j=({chat:e,agents:n,agent:r,onSettled:i})=>{let a=_(e.id),o=(0,D.useSyncExternalStore)(a.subscribe,a.getSnapshot),b=(0,D.useSyncExternalStore)(C.subscribe,C.getCollapsed).has(e.id),E=(0,D.useSyncExternalStore)(C.subscribe,C.getFocus),[j,M]=(0,D.useState)(``),N=e.id,P=e.placement.kind===`line`?e.placement.item:null,F=w({mutationFn:e=>l.local.agent.prompt.mutate({chatId:N,text:e,contextItems:[]}),onError:e=>u.error(e.message)}),I=w({mutationFn:()=>l.local.agent.cancel.mutate({chatId:N}),onError:e=>u.error(e.message)}),L=w({mutationFn:()=>l.local.agent.restart.mutate({chatId:N}),onError:e=>u.error(e.message)}),R=w({mutationFn:()=>l.local.agent.close.mutate({chatId:N}),onError:e=>u.error(e.message)}),z=w({mutationFn:e=>l.local.agent.setAgent.mutate({chatId:N,agent:e}),onError:e=>u.error(e.message)}),B=w({mutationFn:()=>l.local.agent.moveToPanel.mutate({chatId:N}),onSuccess:()=>T.showChat(N),onError:e=>u.error(e.message)}),V=F.isPending||o.busy,H=e.turns>0||e.queued>0||V,U=(e,t)=>T.signIn(e,t,N),W=()=>{let e=j.trim();e&&(F.mutate(e),M(``))},G=(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(`span`,{className:`shrink-0`,children:`Ask`}),(0,O.jsx)(g,{agents:n,value:r.id,onValueChange:e=>{e!==r.id&&z.mutate(e)},compact:!0,disabled:H||z.isPending}),(0,O.jsx)(`span`,{className:`truncate`,children:b&&e.turns>0?e.title:`about ${k(P)}`}),b&&V?(0,O.jsx)(c,{className:`shrink-0`}):null]}),K=(0,O.jsxs)(O.Fragment,{children:[o.rows.length>0&&!b?(0,O.jsxs)(t,{size:`xs`,variant:`ghost`,disabled:B.isPending,onClick:()=>B.mutate(),children:[B.isPending?(0,O.jsx)(c,{}):(0,O.jsx)(S,{}),`Continue in chat`]}):null,(0,O.jsx)(t,{size:`icon-xs`,variant:`ghost`,"aria-label":b?`Expand`:`Minimize`,onClick:()=>C.toggleCollapsed(N),children:b?(0,O.jsx)(s,{}):(0,O.jsx)(d,{})})]});return b?(0,O.jsx)(A,{title:G,actions:K,onClose:()=>R.mutate(),closing:R.isPending}):r.available?(0,O.jsxs)(A,{title:G,actions:K,onClose:()=>R.mutate(),closing:R.isPending,children:[o.rows.length>0?(0,O.jsxs)(`div`,{className:`flex max-h-96 flex-col gap-3 overflow-y-auto px-3 pt-3`,children:[o.rows.map(e=>(0,O.jsx)(p,{chatId:N,agent:r.id,label:r.label,row:e,onSignIn:U},e.id)),(0,O.jsx)(h,{label:o.status===`starting`?`Starting ${r.label}`:`${r.label} is working`,thinking:V})]}):null,o.status===`failed`||o.status===`closed`?(0,O.jsxs)(`div`,{className:`px-3 pt-3`,children:[(0,O.jsx)(m,{message:o.status===`failed`?`${r.label} didn't start`:`${r.label} stopped`,detail:o.reason??void 0,onRetry:()=>L.mutate(),retryDisabled:L.isPending}),o.status===`failed`&&o.signIn?(0,O.jsx)(`div`,{className:`pt-2`,children:(0,O.jsx)(v,{agent:r.id,label:r.label,onSignIn:U})}):null]}):null,o.queue.length>0?(0,O.jsx)(`div`,{className:`px-3 pt-2`,children:(0,O.jsx)(y,{chatId:N,queue:o.queue})}):null,(0,O.jsx)(`div`,{className:o.rows.length>0||o.status===`failed`||o.status===`closed`||o.queue.length>0?`border-edge mt-3 border-t`:void 0,children:(0,O.jsx)(f,{flat:!0,value:j,onValueChange:e=>M(e),onSend:W,onStop:()=>I.mutate(),busy:V,canSend:j.trim().length>0,placeholder:V?`Queue a follow-up`:o.rows.length>0?`Ask a follow-up`:`Ask ${r.label} about these lines`,"aria-label":`Question`,autoFocus:E===N&&o.rows.length===0})})]}):(0,O.jsx)(A,{title:G,actions:K,onClose:()=>R.mutate(),closing:R.isPending,children:(0,O.jsx)(`div`,{className:`p-3`,children:(0,O.jsx)(x,{agents:[r],onSettled:i,onSignIn:U})})})},M=({chatId:e})=>{let t=n(b()),i=(0,D.useSyncExternalStore)(C.subscribe,C.getSnapshot)?.find(t=>t.id===e);if(t.isPending||!i)return(0,O.jsx)(E,{});if(t.isError)return(0,O.jsx)(`div`,{className:`p-3`,children:(0,O.jsx)(r,{message:`Couldn't list the agents.`,refetch:()=>void t.refetch()})});let a=t.data.find(e=>e.id===i.agent);return a?(0,O.jsx)(j,{chat:i,agents:t.data,agent:a,onSettled:()=>void t.refetch()}):(0,O.jsx)(E,{})};export{M as InlineAsk};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{c as t,l as n,n as r,t as i}from"./button-DizkG3Et.js";import{a,o}from"./bundle-mjs-IMkwHZOK.js";import{s}from"./card-BPb3NZYg.js";var c=e(o(),1),l=new Map([[`bold`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M208.49,120.49a12,12,0,0,1-17,0L140,69V216a12,12,0,0,1-24,0V69L64.49,120.49a12,12,0,0,1-17-17l72-72a12,12,0,0,1,17,0l72,72A12,12,0,0,1,208.49,120.49Z`}))],[`duotone`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M200,112H56l72-72Z`,opacity:`0.2`}),c.createElement(`path`,{d:`M205.66,106.34l-72-72a8,8,0,0,0-11.32,0l-72,72A8,8,0,0,0,56,120h64v96a8,8,0,0,0,16,0V120h64a8,8,0,0,0,5.66-13.66ZM75.31,104,128,51.31,180.69,104Z`}))],[`fill`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M207.39,115.06A8,8,0,0,1,200,120H136v96a8,8,0,0,1-16,0V120H56a8,8,0,0,1-5.66-13.66l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,207.39,115.06Z`}))],[`light`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M204.24,116.24a6,6,0,0,1-8.48,0L134,54.49V216a6,6,0,0,1-12,0V54.49L60.24,116.24a6,6,0,0,1-8.48-8.48l72-72a6,6,0,0,1,8.48,0l72,72A6,6,0,0,1,204.24,116.24Z`}))],[`regular`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M205.66,117.66a8,8,0,0,1-11.32,0L136,59.31V216a8,8,0,0,1-16,0V59.31L61.66,117.66a8,8,0,0,1-11.32-11.32l72-72a8,8,0,0,1,11.32,0l72,72A8,8,0,0,1,205.66,117.66Z`}))],[`thin`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M202.83,114.83a4,4,0,0,1-5.66,0L132,49.66V216a4,4,0,0,1-8,0V49.66L58.83,114.83a4,4,0,0,1-5.66-5.66l72-72a4,4,0,0,1,5.66,0l72,72A4,4,0,0,1,202.83,114.83Z`}))]]),u=new Map([[`bold`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M71.68,97.22,34.74,128l36.94,30.78a12,12,0,1,1-15.36,18.44l-48-40a12,12,0,0,1,0-18.44l48-40A12,12,0,0,1,71.68,97.22Zm176,21.56-48-40a12,12,0,1,0-15.36,18.44L221.26,128l-36.94,30.78a12,12,0,1,0,15.36,18.44l48-40a12,12,0,0,0,0-18.44ZM164.1,28.72a12,12,0,0,0-15.38,7.18l-64,176a12,12,0,0,0,7.18,15.37A11.79,11.79,0,0,0,96,228a12,12,0,0,0,11.28-7.9l64-176A12,12,0,0,0,164.1,28.72Z`}))],[`duotone`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M240,128l-48,40H64L16,128,64,88H192Z`,opacity:`0.2`}),c.createElement(`path`,{d:`M69.12,94.15,28.5,128l40.62,33.85a8,8,0,1,1-10.24,12.29l-48-40a8,8,0,0,1,0-12.29l48-40a8,8,0,0,1,10.24,12.3Zm176,27.7-48-40a8,8,0,1,0-10.24,12.3L227.5,128l-40.62,33.85a8,8,0,1,0,10.24,12.29l48-40a8,8,0,0,0,0-12.29ZM162.73,32.48a8,8,0,0,0-10.25,4.79l-64,176a8,8,0,0,0,4.79,10.26A8.14,8.14,0,0,0,96,224a8,8,0,0,0,7.52-5.27l64-176A8,8,0,0,0,162.73,32.48Z`}))],[`fill`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40ZM92.8,145.6a8,8,0,1,1-9.6,12.8l-32-24a8,8,0,0,1,0-12.8l32-24a8,8,0,0,1,9.6,12.8L69.33,128Zm58.89-71.4-32,112a8,8,0,1,1-15.38-4.4l32-112a8,8,0,0,1,15.38,4.4Zm53.11,60.2-32,24a8,8,0,0,1-9.6-12.8L186.67,128,163.2,110.4a8,8,0,1,1,9.6-12.8l32,24a8,8,0,0,1,0,12.8Z`}))],[`light`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M67.84,92.61,25.37,128l42.47,35.39a6,6,0,1,1-7.68,9.22l-48-40a6,6,0,0,1,0-9.22l48-40a6,6,0,0,1,7.68,9.22Zm176,30.78-48-40a6,6,0,1,0-7.68,9.22L230.63,128l-42.47,35.39a6,6,0,1,0,7.68,9.22l48-40a6,6,0,0,0,0-9.22Zm-81.79-89A6,6,0,0,0,154.36,38l-64,176A6,6,0,0,0,94,221.64a6.15,6.15,0,0,0,2,.36,6,6,0,0,0,5.64-3.95l64-176A6,6,0,0,0,162.05,34.36Z`}))],[`regular`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M69.12,94.15,28.5,128l40.62,33.85a8,8,0,1,1-10.24,12.29l-48-40a8,8,0,0,1,0-12.29l48-40a8,8,0,0,1,10.24,12.3Zm176,27.7-48-40a8,8,0,1,0-10.24,12.3L227.5,128l-40.62,33.85a8,8,0,1,0,10.24,12.29l48-40a8,8,0,0,0,0-12.29ZM162.73,32.48a8,8,0,0,0-10.25,4.79l-64,176a8,8,0,0,0,4.79,10.26A8.14,8.14,0,0,0,96,224a8,8,0,0,0,7.52-5.27l64-176A8,8,0,0,0,162.73,32.48Z`}))],[`thin`,c.createElement(c.Fragment,null,c.createElement(`path`,{d:`M66.56,91.07,22.25,128l44.31,36.93A4,4,0,0,1,64,172a3.94,3.94,0,0,1-2.56-.93l-48-40a4,4,0,0,1,0-6.14l48-40a4,4,0,0,1,5.12,6.14Zm176,33.86-48-40a4,4,0,1,0-5.12,6.14L233.75,128l-44.31,36.93a4,4,0,1,0,5.12,6.14l48-40a4,4,0,0,0,0-6.14ZM161.37,36.24a4,4,0,0,0-5.13,2.39l-64,176a4,4,0,0,0,2.39,5.13A4.12,4.12,0,0,0,96,220a4,4,0,0,0,3.76-2.63l64-176A4,4,0,0,0,161.37,36.24Z`}))]]),d=c.forwardRef((e,n)=>c.createElement(t,{ref:n,...e,weights:l}));d.displayName=`ArrowUpIcon`;var f=d,p=c.forwardRef((e,n)=>c.createElement(t,{ref:n,...e,weights:u}));p.displayName=`CodeIcon`;var m=p,h=a();function g({className:e,type:t,autoComplete:r=`off`,...i}){return(0,h.jsx)(`input`,{type:t,autoComplete:r,"data-slot":`input`,className:n(`border-edge-strong file:text-foreground placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 rounded-control bg-glass h-8 w-full min-w-0 border px-2.5 py-1 text-base transition-colors outline-none file:inline-flex file:h-6 file:border-0 file:bg-transparent file:text-sm file:font-medium focus-visible:ring-3 disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:ring-3 md:text-sm`,e),...i})}function _({className:e,...t}){return(0,h.jsx)(`div`,{"data-slot":`input-group`,role:`group`,className:n(`group/input-group relative flex h-8 w-full min-w-0 items-center rounded-control border border-edge-strong bg-glass transition-colors outline-none in-data-[slot=combobox-content]:focus-within:border-inherit in-data-[slot=combobox-content]:focus-within:ring-0 has-disabled:opacity-50 has-[[data-slot=input-group-control]:focus-visible]:border-ring has-[[data-slot=input-group-control]:focus-visible]:ring-3 has-[[data-slot=input-group-control]:focus-visible]:ring-ring/50 has-[[data-slot][aria-invalid=true]]:border-destructive has-[[data-slot][aria-invalid=true]]:ring-3 has-[[data-slot][aria-invalid=true]]:ring-destructive/20 has-[>[data-align=block-end]]:h-auto has-[>[data-align=block-end]]:flex-col has-[>[data-align=block-start]]:h-auto has-[>[data-align=block-start]]:flex-col has-[>textarea]:h-auto dark:has-[[data-slot][aria-invalid=true]]:ring-destructive/40 has-[>[data-align=block-end]]:[&>input]:pt-3 has-[>[data-align=block-start]]:[&>input]:pb-3 has-[>[data-align=inline-end]]:[&>input]:pr-1.5 has-[>[data-align=inline-start]]:[&>input]:pl-1.5`,e),...t})}var v=r(`flex h-auto cursor-text items-center justify-center gap-2 py-1.5 text-sm font-medium text-muted-foreground select-none group-data-[disabled=true]/input-group:opacity-50 [&>kbd]:rounded-chip [&>svg:not([class*='size-'])]:size-4`,{variants:{align:{"inline-start":`order-first pl-2 has-[>button]:ml-[-0.3rem] has-[>kbd]:ml-[-0.15rem]`,"inline-end":`order-last pr-2 has-[>button]:mr-[-0.3rem] has-[>kbd]:mr-[-0.15rem]`,"block-start":`order-first w-full justify-start px-2.5 pt-2 group-has-[>input]/input-group:pt-2 [.border-b]:pb-2`,"block-end":`order-last w-full justify-start px-2.5 pb-2 group-has-[>input]/input-group:pb-2 [.border-t]:pt-2`}},defaultVariants:{align:`inline-start`}});function y({className:e,align:t=`inline-start`,...r}){return(0,h.jsx)(`div`,{role:`group`,"data-slot":`input-group-addon`,"data-align":t,className:n(v({align:t}),e),onClick:e=>{e.target.closest(`button`)||e.currentTarget.parentElement?.querySelector(`input`)?.focus()},...r})}var b=r(`flex items-center gap-2 rounded-control text-sm shadow-none`,{variants:{size:{xs:`h-6 gap-1 px-1.5 [&>svg:not([class*='size-'])]:size-3.5`,sm:``,"icon-xs":`size-6 p-0 has-[>svg]:p-0`,"icon-sm":`size-8 p-0 has-[>svg]:p-0`}},defaultVariants:{size:`xs`}});function x({className:e,type:t=`button`,variant:r=`ghost`,size:a=`xs`,...o}){return(0,h.jsx)(i,{type:t,"data-size":a,variant:r,className:n(b({size:a}),e),...o})}function S({className:e,...t}){return(0,h.jsx)(g,{"data-slot":`input-group-control`,className:n(`flex-1 rounded-none border-0 bg-transparent shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}function C({className:e,...t}){return(0,h.jsx)(s,{"data-slot":`input-group-control`,className:n(`flex-1 resize-none rounded-none border-0 bg-transparent py-2 shadow-none ring-0 focus-visible:ring-0 disabled:bg-transparent aria-invalid:ring-0 dark:bg-transparent dark:disabled:bg-transparent`,e),...t})}export{C as a,d as c,S as i,f as l,y as n,p as o,x as r,m as s,_ as t};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/terminal-shell-Cnt0r4V7.js","assets/rolldown-runtime-XKyaHtl9.js","assets/button-DizkG3Et.js","assets/bundle-mjs-IMkwHZOK.js","assets/reviewer-connection-B1irBiYS.js","assets/terminal-shell-BrP-ENHg.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{c as t,l as n,t as r}from"./button-DizkG3Et.js";import{B as i,H as a,n as o,t as s,x as c}from"./query-error-DSrxRVZP.js";import{a as l,o as u}from"./bundle-mjs-IMkwHZOK.js";import{l as d}from"./schemas-D5jfrTNW.js";import{C as f,T as p,b as m,g as h,o as g}from"./card-BPb3NZYg.js";import{a as _}from"./reviewer-connection-B1irBiYS.js";import{c as v,f as y,i as b,o as x,r as S,s as C,t as w}from"./command-3yBkMBPV.js";import{o as T}from"./input-group-apzvTSGh.js";import{_ as ee,a as te,c as ne,d as re,f as ie,g as ae,h as oe,i as se,l as ce,m as le,n as ue,o as de,p as fe,r as pe,s as me,t as he,u as ge,v as _e,y as ve}from"./agent-list-query-DU__57Ym.js";import{a as ye,i as be,n as xe,r as Se,t as Ce}from"./shortcut-label-Do9KpCPN.js";import{t as we}from"./preload-helper-B0Qg_vqV.js";import{F as Te,I as Ee,M as De,P as Oe,Tt as ke,V as Ae,a as je,bt as Me,i as Ne,kt as E,n as Pe,r as D}from"./index-D7PxCZso.js";var O=e(u(),1),Fe=new Map([[`bold`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M72.5,150.63,100.79,128,72.5,105.37a12,12,0,1,1,15-18.74l40,32a12,12,0,0,1,0,18.74l-40,32a12,12,0,0,1-15-18.74ZM144,172h32a12,12,0,0,0,0-24H144a12,12,0,0,0,0,24ZM236,56V200a20,20,0,0,1-20,20H40a20,20,0,0,1-20-20V56A20,20,0,0,1,40,36H216A20,20,0,0,1,236,56Zm-24,4H44V196H212Z`}))],[`duotone`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M224,56V200a8,8,0,0,1-8,8H40a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H216A8,8,0,0,1,224,56Z`,opacity:`0.2`}),O.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`fill`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M216,40H40A16,16,0,0,0,24,56V200a16,16,0,0,0,16,16H216a16,16,0,0,0,16-16V56A16,16,0,0,0,216,40Zm-91,94.25-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32a8,8,0,0,1,0,12.5ZM176,168H136a8,8,0,0,1,0-16h40a8,8,0,0,1,0,16Z`}))],[`light`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M126,128a6,6,0,0,1-2.25,4.69l-40,32a6,6,0,0,1-7.5-9.38L110.4,128,76.25,100.69a6,6,0,1,1,7.5-9.38l40,32A6,6,0,0,1,126,128Zm50,26H136a6,6,0,0,0,0,12h40a6,6,0,0,0,0-12Zm54-98V200a14,14,0,0,1-14,14H40a14,14,0,0,1-14-14V56A14,14,0,0,1,40,42H216A14,14,0,0,1,230,56Zm-12,0a2,2,0,0,0-2-2H40a2,2,0,0,0-2,2V200a2,2,0,0,0,2,2H216a2,2,0,0,0,2-2Z`}))],[`regular`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M128,128a8,8,0,0,1-3,6.25l-40,32a8,8,0,1,1-10-12.5L107.19,128,75,102.25a8,8,0,1,1,10-12.5l40,32A8,8,0,0,1,128,128Zm48,24H136a8,8,0,0,0,0,16h40a8,8,0,0,0,0-16Zm56-96V200a16,16,0,0,1-16,16H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40H216A16,16,0,0,1,232,56ZM216,200V56H40V200H216Z`}))],[`thin`,O.createElement(O.Fragment,null,O.createElement(`path`,{d:`M122.5,124.88a4,4,0,0,1,0,6.24l-40,32a4,4,0,0,1-5-6.24L113.6,128,77.5,99.12a4,4,0,0,1,5-6.24ZM176,156H136a4,4,0,0,0,0,8h40a4,4,0,0,0,0-8ZM228,56V200a12,12,0,0,1-12,12H40a12,12,0,0,1-12-12V56A12,12,0,0,1,40,44H216A12,12,0,0,1,228,56Zm-8,0a4,4,0,0,0-4-4H40a4,4,0,0,0-4,4V200a4,4,0,0,0,4,4H216a4,4,0,0,0,4-4Z`}))]]),Ie=O.forwardRef((e,n)=>O.createElement(t,{ref:n,...e,weights:Fe}));Ie.displayName=`TerminalWindowIcon`;var Le=24,k={start:{top:0,gap:0,pinned:!0,unseen:!1},scrolled:(e,t)=>{let n=t.top<e.top?t.gap<=1:e.pinned||t.gap<=Le;return{...t,pinned:n,unseen:!n&&e.unseen}},grew:(e,t)=>e.pinned?{state:{...e,unseen:!1},toBottom:!0}:{state:{...e,gap:t.gap,unseen:e.unseen||t.gap>e.gap+1},toBottom:!1},pin:e=>({state:{...e,pinned:!0,unseen:!1},toBottom:!0})},Re=(e,t,n)=>{let r=t?document.scrollingElement:e.parentElement;if(!r)return{pin:()=>void 0,stop:()=>void 0};let i=()=>t?0:r.getBoundingClientRect().top,a=()=>({top:r.scrollTop,gap:r.scrollHeight-r.scrollTop-r.clientHeight}),o=()=>{let t=Array.from(e.children).find(e=>e.getBoundingClientRect().bottom>i());return t?{row:t,offset:t.getBoundingClientRect().top-i()}:null},s={state:k.start,anchor:o()},c=()=>{s.anchor=o(),n(s.state.unseen)},l=({state:e,toBottom:t})=>{t&&(r.scrollTop=r.scrollHeight),s.state=t?{...e,...a()}:e,c()},u=()=>{s.state=k.scrolled(s.state,a()),c()},d=()=>{let e=s.anchor;if(s.state.pinned||!e?.row.isConnected)return;let t=e.row.getBoundingClientRect().top-i()-e.offset;t!==0&&(r.scrollTop+=t)},f=new ResizeObserver(()=>{d(),l(k.grew(s.state,a()))}),p=t?window:r;return f.observe(e),p.addEventListener(`scroll`,u,{passive:!0}),{pin:()=>l(k.pin(s.state)),stop:()=>{f.disconnect(),p.removeEventListener(`scroll`,u)}}},A=l();function ze({sent:e,page:t=!1,className:i,emptyState:a,footer:o,bottomContent:s,bottomClassName:c,children:l}){let[u,d]=(0,O.useState)(!1),f=(0,O.useRef)(null),[p]=(0,O.useState)(()=>e=>{if(!e)return;let n=Re(e,t,d);return f.current=n,()=>{n.stop(),f.current=null}});(0,O.useLayoutEffect)(()=>f.current?.pin(),[e]);let m=(0,A.jsxs)(`div`,{ref:p,className:n(`flex flex-col`,i),children:[a,l,o]});return(0,A.jsxs)(A.Fragment,{children:[t?m:(0,A.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:m}),(0,A.jsxs)(`div`,{className:n(`relative shrink-0`,c),children:[u?(0,A.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full flex justify-center pb-2`,children:(0,A.jsxs)(r,{size:`sm`,variant:`secondary`,className:`pointer-events-auto shadow-md`,onClick:()=>f.current?.pin(),children:[(0,A.jsx)(y,{}),`Jump to latest`]})}):null,s]})]})}var Be=({contextItems:e,onRemoveContextItem:t,onClearContextItems:n})=>e.length===0?null:(0,A.jsxs)(`div`,{className:`border-edge bg-muted/50 flex flex-wrap gap-1.5 border-t px-3 py-2`,children:[e.map(e=>(0,A.jsx)(le,{item:e,onRemove:t},e.id)),(0,A.jsx)(r,{variant:`ghost`,size:`xs`,className:`ml-auto`,onClick:n,children:(0,A.jsxs)(`span`,{className:`text-muted-foreground group-hover/button:text-foreground group-focus-visible/button:text-foreground contents`,children:[(0,A.jsx)(c,{className:`size-3.5`}),`Clear all`]})})]});function j(e){return Array.isArray?Array.isArray(e):Ge(e)===`[object Array]`}function Ve(e){if(typeof e==`string`)return e;if(typeof e==`bigint`)return e.toString();let t=e+``;return t==`0`&&1/e==-1/0?`-0`:t}function M(e){return e==null?``:Ve(e)}function N(e){return typeof e==`string`}function P(e){return typeof e==`number`}function He(e){return e===!0||e===!1||We(e)&&Ge(e)==`[object Boolean]`}function Ue(e){return typeof e==`object`}function We(e){return Ue(e)&&e!==null}function F(e){return e!=null}function I(e){return!e.trim().length}function Ge(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var Ke=`Incorrect 'index' type`,L=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,qe=e=>`Invalid value for key ${e}`,Je=e=>`Pattern length exceeds max of ${e}.`,Ye=e=>`Missing ${e} property in key`,Xe=e=>`Property 'weight' in key '${e}' must be a positive integer`,Ze=`Fuse.match does not support useTokenSearch: token search requires corpus-level statistics (df, fieldCount) that a one-off string comparison does not have. Use new Fuse(...).search(...) instead.`,Qe=Object.prototype.hasOwnProperty,$e=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=et(e);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(e=>{e.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function et(e){let t=null,n=null,r=null,i=1,a=null;if(N(e)||j(e))r=e,t=tt(e),n=R(e);else{if(!Qe.call(e,`name`))throw Error(Ye(`name`));let o=e.name;if(r=o,Qe.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(Xe(R(o)));t=tt(o),n=R(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function tt(e){return j(e)?e:e.split(`.`)}function R(e){return j(e)?e.join(`.`):e}function nt(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(F(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!F(s))return;if(a===t.length-1&&(N(s)||P(s)||He(s)||typeof s==`bigint`))n.push(o===void 0?M(s):{v:M(s),i:o});else if(j(s)){r=!0;for(let e=0,n=s.length;e<n;e+=1)i(s[e],t,a+1,e)}else t.length&&i(s,t,a+1,o)}}};return i(e,N(t)?t.split(`.`):t,0),r?n:n[0]}var rt={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},it={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(e,t)=>e.score===t.score?e.idx<t.idx?-1:1:e.score<t.score?-1:1},at={location:0,threshold:.6,distance:100},ot={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:nt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},z=Object.freeze({...it,...rt,...at,...ot});function st(e=1,t=3){let n=new Map,r=10**t;return{get(t){let i=1,a=!1;for(let e=0;e<t.length;e++)t.charCodeAt(e)===32?a||=(i++,!0):a=!1;if(n.has(i))return n.get(i);let o=Math.round(r/i**(.5*e))/r;return n.set(i,o),o},clear(){n.clear()}}}var B=class{constructor({getFn:e=z.getFn,fieldNormWeight:t=z.fieldNormWeight}={}){this.norm=st(t,3),this.getFn=e,this.isCreated=!1,this.docs=[],this.keys=[],this._keysMap={},this.setIndexRecords()}setSources(e=[]){this.docs=e}setIndexRecords(e=[]){this.records=e}setKeys(e=[]){this.keys=e,this._keysMap={},e.forEach((e,t)=>{this._keysMap[e.id]=t})}create(){if(this.isCreated||!this.docs.length)return;this.isCreated=!0;let e=this.docs.length;this.records=Array(e);let t=0;if(N(this.docs[0]))for(let n=0;n<e;n++){let e=this._createStringRecord(this.docs[n],n);e&&(this.records[t++]=e)}else for(let n=0;n<e;n++)this.records[t++]=this._createObjectRecord(this.docs[n],n);this.records.length=t,this.norm.clear()}add(e,t){if(!Number.isInteger(t)||t<0)throw Error(L);if(N(e)){let n=this._createStringRecord(e,t);return n&&this.records.push(n),n}let n=this._createObjectRecord(e,t);return this.records.push(n),n}removeAt(e){if(!Number.isInteger(e)||e<0)throw Error(L);for(let t=0,n=this.records.length;t<n;t+=1)if(this.records[t].i===e){this.records.splice(t,1);break}for(let t=0,n=this.records.length;t<n;t+=1)this.records[t].i>e&&--this.records[t].i}removeAll(e){let t=new Set;for(let n of e)Number.isInteger(n)&&n>=0&&t.add(n);if(t.size===0)return;this.records=this.records.filter(e=>!t.has(e.i));let n=Array.from(t).sort((e,t)=>e-t);for(let e of this.records){let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e.i?t=i+1:r=i}e.i-=t}}getValueForItemAtKeyId(e,t){return e[this._keysMap[t]]}size(){return this.records.length}_createStringRecord(e,t){return!F(e)||I(e)?null:{v:e,i:t,n:this.norm.get(e)}}_createObjectRecord(e,t){let n={i:t,$:{}};for(let t=0,r=this.keys.length;t<r;t++){let r=this.keys[t],i=r.getFn?r.getFn(e):this.getFn(e,r.path);if(F(i)){if(j(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(F(n)){if(N(n)){if(!I(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(F(n.v)){let t=N(n.v)?n.v:M(n.v);if(!I(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(N(i)&&!I(i)){let e={v:i,n:this.norm.get(i)};n.$[t]=e}}}return n}toJSON(){return{keys:this.keys.map(({getFn:e,...t})=>t),records:this.records}}};function ct(e,t,{getFn:n=z.getFn,fieldNormWeight:r=z.fieldNormWeight}={}){let i=new B({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(et)),i.setSources(t),i.create(),i}function lt(e,{getFn:t=z.getFn,fieldNormWeight:n=z.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new B({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function ut(e=[],t=z.minMatchCharLength){let n=[],r=-1,i=-1,a=0;for(let o=e.length;a<o;a+=1){let o=e[a];o&&r===-1?r=a:!o&&r!==-1&&(i=a-1,i-r+1>=t&&n.push([r,i]),r=-1)}return e[a-1]&&a-r>=t&&n.push([r,a-1]),n}var V=32;function dt(e,t,n,{location:r=z.location,distance:i=z.distance,threshold:a=z.threshold,findAllMatches:o=z.findAllMatches,minMatchCharLength:s=z.minMatchCharLength,includeMatches:c=z.includeMatches,ignoreLocation:l=z.ignoreLocation}={}){if(t.length>V)throw Error(Je(V));let u=t.length,d=e.length,f=Math.max(0,Math.min(r,d)),p=a,m=f,h=(e,t)=>{let n=e/u;if(l)return n;let r=Math.abs(f-t);return i?n+r/i:r?1:n},g=s>1||c,_=g?Array(d):[],v;for(;(v=e.indexOf(t,m))>-1;){let e=h(0,v);if(p=Math.min(e,p),m=v+u,g){let e=0;for(;e<u;)_[v+e]=1,e+=1}}m=-1;let y=[],b=1,x=0,S=u+d,C=1<<u-1;for(let t=0;t<u;t+=1){let r=0,i=S;for(;r<i;)h(t,f+i)<=p?r=i:S=i,i=Math.floor((S-r)/2+r);S=i;let a=Math.max(1,f-i+1),s=o?d:Math.min(f+i,d)+u,c=Array(s+2);c[s+1]=(1<<t)-1;for(let r=s;r>=a;--r){let i=r-1,o=n[e[i]];if(c[r]=(c[r+1]<<1|1)&o,t&&(c[r]|=(y[r+1]|y[r])<<1|1|y[r+1]),c[r]&C&&(b=h(t,i),b<=p)){if(p=b,m=i,x=t,m<=f)break;a=Math.max(1,2*f-m)}}if(h(t+1,f)>p)break;y=c}if(g&&m>=0){let t=Math.min(d-1,m+u-1+x);for(let r=m;r<=t;r+=1)n[e[r]]&&(_[r]=1)}let w={isMatch:m>=0,score:Math.max(.001,b)};if(g){let e=ut(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function ft(e){let t={};for(let n=0,r=e.length;n<r;n+=1){let i=e.charAt(n);t[i]=(t[i]||0)|1<<r-n-1}return t}function H(e){if(e.length<=1)return e;e.sort((e,t)=>e[0]-t[0]||e[1]-t[1]);let t=[e[0]];for(let n=1,r=e.length;n<r;n+=1){let r=t[t.length-1],i=e[n];i[0]<=r[1]+1?r[1]=Math.max(r[1],i[1]):t.push(i)}return t}var pt={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},mt=RegExp(`[`+Object.keys(pt).join(``)+`]`,`g`),U=typeof String.prototype.normalize==`function`?e=>e.normalize(`NFD`).replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,``).replace(mt,e=>pt[e]):e=>e,W=class{constructor(e,{location:t=z.location,threshold:n=z.threshold,distance:r=z.distance,includeMatches:i=z.includeMatches,findAllMatches:a=z.findAllMatches,minMatchCharLength:o=z.minMatchCharLength,isCaseSensitive:s=z.isCaseSensitive,ignoreDiacritics:c=z.ignoreDiacritics,ignoreLocation:l=z.ignoreLocation}={}){if(this.options={location:t,threshold:n,distance:r,includeMatches:i,findAllMatches:a,minMatchCharLength:o,isCaseSensitive:s,ignoreDiacritics:c,ignoreLocation:l},e=s?e:e.toLowerCase(),e=c?U(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:ft(e),startIndex:t})},d=this.pattern.length;if(d>V){let e=0,t=d%V,n=d-t;for(;e<n;)u(this.pattern.substr(e,V),e),e+=V;if(t){let e=d-V;u(this.pattern.substr(e),e)}}else u(this.pattern,0)}searchIn(e){let{isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r}=this.options;if(e=t?e:e.toLowerCase(),e=n?U(e):e,this.pattern===e){let t={isMatch:!0,score:0};return r&&(t.indices=[[0,e.length-1]]),t}let{location:i,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,ignoreLocation:l}=this.options,u=[],d=0,f=!1;this.chunks.forEach(({pattern:t,alphabet:n,startIndex:p})=>{let{isMatch:m,score:h,indices:g}=dt(e,t,n,{location:i+p,distance:a,threshold:o,findAllMatches:s,minMatchCharLength:c,includeMatches:r,ignoreLocation:l});m&&(f=!0),d+=h,m&&g&&u.push(...g)});let p={isMatch:f,score:f?d/this.chunks.length:1};return f&&r&&(p.indices=H(u)),p}},ht=new Set([`fuzzy`,`include`]);function gt(e){return e.startsWith(`inverse`)}var G=[{type:`exact`,multiRegex:/^="(.*)"$/,singleRegex:/^=(.*)$/,create:e=>({type:`exact`,search(t){let n=t===e;return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`include`,multiRegex:/^'"(.*)"$/,singleRegex:/^'(.*)$/,create:e=>({type:`include`,search(t){let n=0,r,i=[],a=e.length;for(;(r=t.indexOf(e,n))>-1;)n=r+a,i.push([r,n-1]);let o=!!i.length;return{isMatch:o,score:+!o,indices:i}}})},{type:`prefix-exact`,multiRegex:/^\^"(.*)"$/,singleRegex:/^\^(.*)$/,create:e=>({type:`prefix-exact`,search(t){let n=t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,e.length-1]}}})},{type:`inverse-prefix-exact`,multiRegex:/^!\^"(.*)"$/,singleRegex:/^!\^(.*)$/,create:e=>({type:`inverse-prefix-exact`,search(t){let n=!t.startsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`inverse-suffix-exact`,multiRegex:/^!"(.*)"\$$/,singleRegex:/^!(.*)\$$/,create:e=>({type:`inverse-suffix-exact`,search(t){let n=!t.endsWith(e);return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`suffix-exact`,multiRegex:/^"(.*)"\$$/,singleRegex:/^(.*)\$$/,create:e=>({type:`suffix-exact`,search(t){let n=t.endsWith(e);return{isMatch:n,score:+!n,indices:[t.length-e.length,t.length-1]}}})},{type:`inverse-exact`,multiRegex:/^!"(.*)"$/,singleRegex:/^!(.*)$/,create:e=>({type:`inverse-exact`,search(t){let n=t.indexOf(e)===-1;return{isMatch:n,score:+!n,indices:[0,t.length-1]}}})},{type:`fuzzy`,multiRegex:/^"(.*)"$/,singleRegex:/^(.*)$/,create:(e,t={})=>{let n=new W(e,{location:t.location??z.location,threshold:t.threshold??z.threshold,distance:t.distance??z.distance,includeMatches:t.includeMatches??z.includeMatches,findAllMatches:t.findAllMatches??z.findAllMatches,minMatchCharLength:t.minMatchCharLength??z.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??z.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??z.ignoreDiacritics,ignoreLocation:t.ignoreLocation??z.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],_t=G.length,vt=`\0`,yt=`|`;function bt(e){let t=[],n=e.length,r=0;for(;r<n;){for(;r<n&&e[r]===` `;)r++;if(r>=n)break;let i=r;for(;i<n&&e[i]!==` `&&e[i]!==`"`;)i++;if(i<n&&e[i]===`"`){for(i++;i<n;){if(e[i]===`"`){let t=i+1;if(t>=n||e[t]===` `){i++;break}if(e[t]===`$`&&(t+1>=n||e[t+1]===` `)){i+=2;break}}i++}t.push(e.substring(r,i)),r=i}else{for(;i<n&&e[i]!==` `;)i++;t.push(e.substring(r,i)),r=i}}return t}function xt(e,t){let n=e.match(t);return n?n[1]:null}function St(e,t={}){return e.replace(/\\\|/g,vt).split(yt).map(e=>{let n=bt(e.replace(/\u0000/g,`|`).trim()).filter(e=>e&&!!e.trim()),r=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e],a=!1,o=-1;for(;!a&&++o<_t;){let e=G[o],n=xt(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<_t;){let e=G[o],n=xt(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var Ct=class{constructor(e,{isCaseSensitive:t=z.isCaseSensitive,ignoreDiacritics:n=z.ignoreDiacritics,includeMatches:r=z.includeMatches,minMatchCharLength:i=z.minMatchCharLength,ignoreLocation:a=z.ignoreLocation,findAllMatches:o=z.findAllMatches,location:s=z.location,threshold:c=z.threshold,distance:l=z.distance}={}){this.query=null,this.options={isCaseSensitive:t,ignoreDiacritics:n,includeMatches:r,minMatchCharLength:i,findAllMatches:o,ignoreLocation:a,location:s,threshold:c,distance:l},e=t?e:e.toLowerCase(),e=n?U(e):e,this.pattern=e,this.query=St(this.pattern,this.options)}static condition(e,t){return t.useExtendedSearch}searchIn(e){let t=this.query;if(!t)return{isMatch:!1,score:1};let{includeMatches:n,isCaseSensitive:r,ignoreDiacritics:i}=this.options;e=r?e:e.toLowerCase(),e=i?U(e):e;let a=0,o=[],s=0,c=!1;for(let r=0,i=t.length;r<i;r+=1){let i=t[r];o.length=0,a=0,c=!1;for(let t=0,r=i.length;t<r;t+=1){let r=i[t],{isMatch:l,indices:u,score:d}=r.search(e);if(l)a+=1,s+=d,gt(r.type)&&(c=!0),n&&(ht.has(r.type)?o.push(...u):o.push(u));else{s=0,a=0,o.length=0,c=!1;break}}if(a){let e={isMatch:!0,score:s/a};return c&&(e.hasInverse=!0),n&&(e.indices=H(o)),e}}return{isMatch:!1,score:1}}},K=[];function q(...e){K.push(...e)}function J(e,t){for(let n=0,r=K.length;n<r;n+=1){let r=K[n];if(r.condition(e,t))return new r(e,t)}return new W(e,t)}var Y={AND:`$and`,OR:`$or`},X={PATH:`$path`,PATTERN:`$val`},Z=e=>!!(e[Y.AND]||e[Y.OR]),wt=e=>!!e[X.PATH],Tt=e=>!j(e)&&Ue(e)&&!Z(e),Et=e=>({[Y.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Dt(e,t,{auto:n=!0}={}){let r=e=>{if(N(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=J(e,t)),r}let i=Object.keys(e),a=wt(e);if(!a&&i.length>1&&!Z(e))return r(Et(e));if(Tt(e)){let r=a?e[X.PATH]:i[0],o=a?e[X.PATTERN]:e[r];if(!N(o))throw Error(qe(r));let s={keyId:R(r),pattern:o};return n&&(s.searcher=J(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];j(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return Z(e)||(e=Et(e)),r(e)}function Ot(e,{ignoreFieldNorm:t=z.ignoreFieldNorm}){let n=1;return e.forEach(({key:e,norm:r,score:i})=>{let a=e?e.weight:null;n*=(i===0&&a?2**-52:i)**+((a||1)*(t?1:r))}),n}function kt(e,{ignoreFieldNorm:t=z.ignoreFieldNorm}){e.forEach(e=>{e.score=Ot(e.matches,{ignoreFieldNorm:t})})}var At=class{constructor(e){this.limit=e,this.heap=[]}get size(){return this.heap.length}shouldInsert(e){return this.size<this.limit||e<this.heap[0].score}insert(e){this.size<this.limit?(this.heap.push(e),this._bubbleUp(this.size-1)):e.score<this.heap[0].score&&(this.heap[0]=e,this._sinkDown(0))}extractSorted(e){return this.heap.sort(e)}_bubbleUp(e){let t=this.heap;for(;e>0;){let n=e-1>>1;if(t[e].score<=t[n].score)break;let r=t[e];t[e]=t[n],t[n]=r,e=n}}_sinkDown(e){let t=this.heap,n=t.length,r=e;do{e=r;let i=2*e+1,a=2*e+2;if(i<n&&t[i].score>t[r].score&&(r=i),a<n&&t[a].score>t[r].score&&(r=a),r!==e){let n=t[e];t[e]=t[r],t[r]=n}}while(r!==e)}};function jt(e){let t=[];return e.matches.forEach(e=>{if(!F(e.indices)||!e.indices.length)return;let n={indices:e.indices,value:e.value};e.key&&(n.key=e.key.id),e.idx>-1&&(n.refIndex=e.idx),t.push(n)}),t}function Mt(e,t,{includeMatches:n=z.includeMatches,includeScore:r=z.includeScore}={}){return e.map(e=>{let{idx:i}=e,a={item:t[i],refIndex:i};return n&&(a.matches=jt(e)),r&&(a.score=e.score),a})}var Nt=/[\p{L}\p{M}\p{N}_]+/gu,Pt=new WeakSet;function Ft(e){Pt.has(e)||(Pt.add(e),console.warn(`[Fuse] tokenize regex ${e} lacks the global flag; only the first match per text will be returned. Add the 'g' flag.`))}function It(e){if(typeof e==`function`){let t=!1;return n=>{let r=e(n);if(!t&&(t=!0,!Array.isArray(r)||r.some(e=>typeof e!=`string`)))throw Error(`[Fuse] tokenize function must return string[]; received ${Array.isArray(r)?`array containing non-strings`:typeof r}.`);return r}}return e instanceof RegExp?(e.global||Ft(e),t=>t.match(e)||[]):e=>e.match(Nt)||[]}function Lt({isCaseSensitive:e=!1,ignoreDiacritics:t=!1,tokenize:n}={}){let r=It(n);return{tokenize(n){return e||(n=n.toLowerCase()),t&&(n=U(n)),r(n)}}}var Rt=31,zt=class{static condition(e,t){return t.useTokenSearch}constructor(e,t){this.options=t,this.analyzer=Lt({isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,tokenize:t.tokenize});let n=this.analyzer.tokenize(e),{df:r,fieldCount:i}=t._invertedIndex;this.termSearchers=[],this.idfWeights=[];for(let e of n){this.termSearchers.push(new W(e,{location:t.location,threshold:t.threshold,distance:t.distance,includeMatches:t.includeMatches,findAllMatches:t.findAllMatches,minMatchCharLength:t.minMatchCharLength,isCaseSensitive:t.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics,ignoreLocation:!0}));let n=r.get(e)||0,a=Math.log(1+(i-n+.5)/(n+.5));this.idfWeights.push(a)}this.combineAll=t.tokenMatch===`all`,this.numTerms=this.termSearchers.length,this.useMask=this.numTerms<=Rt}searchIn(e){if(!this.termSearchers.length)return{isMatch:!1,score:1};let t=[],n=0,r=0,i=0,a=0,o=this.combineAll&&!this.useMask?new Set:null;for(let s=0;s<this.termSearchers.length;s++){let c=this.termSearchers[s].searchIn(e),l=this.idfWeights[s];r+=l,c.isMatch&&(i++,n+=l*(1-c.score),c.indices&&t.push(...c.indices),this.combineAll&&(this.useMask?a|=1<<s:o.add(s)))}if(i===0)return{isMatch:!1,score:1};let s=r>0?1-n/r:0,c={isMatch:!0,score:Math.max(.001,s)};return this.options.includeMatches&&t.length&&(c.indices=H(t)),this.combineAll&&(this.useMask?c.matchedMask=a:c.matchedTerms=o,c.termCount=this.numTerms),c}};function Q(e,t,n,r){let i=r.tokenize(t);if(!i.length)return;e.fieldCount++,e.docFieldCount.set(n,(e.docFieldCount.get(n)||0)+1);let a=new Set(i),o=e.docTermFieldHits.get(n);o||(o=new Map,e.docTermFieldHits.set(n,o));for(let t of a)o.set(t,(o.get(t)||0)+1),e.df.set(t,(e.df.get(t)||0)+1)}function Bt(e,t,n,r){let{i,v:a,$:o}=t;if(a!==void 0)Q(e,a,i,r);else if(o)for(let t=0;t<n;t++){let n=o[t];if(n){if(Array.isArray(n))for(let t of n)Q(e,t.v,i,r);else Q(e,n.v,i,r)}}}function Vt(e,t,n){let r={fieldCount:0,df:new Map,docFieldCount:new Map,docTermFieldHits:new Map};for(let i of e)Bt(r,i,t,n);return r}function Ht(e,t,n,r){Bt(e,t,n,r)}function Ut(e,t){let n=e.docFieldCount.get(t);if(n===void 0)return;e.fieldCount-=n,e.docFieldCount.delete(t);let r=e.docTermFieldHits.get(t);if(r){for(let[t,n]of r){let r=(e.df.get(t)||0)-n;r<=0?e.df.delete(t):e.df.set(t,r)}e.docTermFieldHits.delete(t)}}function Wt(e,t){if(t.length===0)return;let n=Array.from(new Set(t)).sort((e,t)=>e-t);for(let t of n)Ut(e,t);let r=e=>{let t=0,r=n.length;for(;t<r;){let i=t+r>>>1;n[i]<e?t=i+1:r=i}return e-t},i=n[0],a=new Map;for(let[t,n]of e.docFieldCount)a.set(t>i?r(t):t,n);e.docFieldCount=a;let o=new Map;for(let[t,n]of e.docTermFieldHits)o.set(t>i?r(t):t,n);e.docTermFieldHits=o}var $=class{constructor(e,t,n){this.options={...z,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new $e(this.options.keys),this._docs=e,this._myIndex=null,this._invertedIndex=null,this.setCollection(e,n),this._lastQuery=null,this._lastSearcher=null}_getSearcher(e){if(this._lastQuery===e)return this._lastSearcher;let t=J(e,this._invertedIndex?{...this.options,_invertedIndex:this._invertedIndex}:this.options);return this._lastQuery=e,this._lastSearcher=t,t}setCollection(e,t){if(this._docs=e,t&&!(t instanceof B))throw Error(Ke);if(this._myIndex=t||ct(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight}),this.options.useTokenSearch){let e=Lt({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});this._invertedIndex=Vt(this._myIndex.records,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}add(e){if(!F(e))return;this._docs.push(e);let t=this._myIndex.add(e,this._docs.length-1);if(this._invertedIndex&&t){let e=Lt({isCaseSensitive:this.options.isCaseSensitive,ignoreDiacritics:this.options.ignoreDiacritics,tokenize:this.options.tokenize});Ht(this._invertedIndex,t,this._myIndex.keys.length,e)}this._invalidateSearcherCache()}remove(e=()=>!1){let t=[],n=[];for(let r=0,i=this._docs.length;r<i;r+=1)e(this._docs[r],r)&&(t.push(this._docs[r]),n.push(r));if(n.length){this._invertedIndex&&Wt(this._invertedIndex,n);let e=new Set(n);this._docs=this._docs.filter((t,n)=>!e.has(n)),this._myIndex.removeAll(n),this._invalidateSearcherCache()}return t}removeAt(e){if(!Number.isInteger(e)||e<0||e>=this._docs.length)throw Error(L);this._invertedIndex&&Wt(this._invertedIndex,[e]);let t=this._docs.splice(e,1)[0];return this._myIndex.removeAt(e),this._invalidateSearcherCache(),t}_invalidateSearcherCache(){this._lastQuery=null,this._lastSearcher=null}getIndex(){return this._myIndex}search(e,t){let{limit:n=-1}=t||{},{includeMatches:r,includeScore:i,shouldSort:a,sortFn:o,ignoreFieldNorm:s}=this.options;if(N(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return P(n)&&n>-1&&(e=e.slice(0,n)),e}let c=P(n)&&n>0&&N(e),l;if(c){let t=new At(n);N(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),l=t.extractSorted(o)}else l=N(e)?N(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),kt(l,{ignoreFieldNorm:s}),a&&l.sort(o),P(n)&&n>-1&&(l=l.slice(0,n));return Mt(l,this._docs,{includeMatches:r,includeScore:i})}_searchStringList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{records:a}=this._myIndex,o=t?null:[];return a.forEach(({v:e,i:a,n:s})=>{if(!F(e))return;let c=r.searchIn(e);if(c.isMatch){let r={score:c.score,value:e,norm:s,indices:c.indices};i&&(r.matchedMask=c.matchedMask,r.matchedTerms=c.matchedTerms,r.termCount=c.termCount);let l=[r];if(!i||this._coversAllTokens(l)){let r={item:e,idx:a,matches:l};t?(r.score=Ot(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=Dt(e,this.options),n=(e,t,r)=>{if(!(`children`in e)){let{keyId:n,searcher:i}=e,a;return n===null?(a=[],this._myIndex.keys.forEach((e,n)=>{a.push(...this._findMatches({key:e,value:t[n],searcher:i}))})):a=this._findMatches({key:this._keyStore.get(n),value:this._myIndex.getValueForItemAtKeyId(t,n),searcher:i}),a&&a.length?[{idx:r,item:t,matches:a}]:[]}let{children:i,operator:a}=e,o=[];for(let e=0,s=i.length;e<s;e+=1){let s=i[e],c=n(s,t,r);if(c.length)o.push(...c);else if(a===Y.AND)return[]}return o},r=this._myIndex.records,i=new Map,a=[];return r.forEach(({$:e,i:r})=>{if(F(e)){let o=n(t,e,r);o.length&&(i.has(r)||(i.set(r,{idx:r,item:e,matches:[]}),a.push(i.get(r))),o.forEach(({matches:e})=>{i.get(r).matches.push(...e)}))}}),a}_searchObjectList(e,{heap:t,ignoreFieldNorm:n}={}){let r=this._getSearcher(e),i=this.options.useTokenSearch&&this.options.tokenMatch===`all`,{keys:a,records:o}=this._myIndex,s=t?null:[];return o.forEach(({$:e,i:o})=>{if(!F(e))return;let c=[],l=!1,u=!1;if(a.forEach((t,n)=>{let i=this._findMatches({key:t,value:e[n],searcher:r});i.length?(c.push(...i),i[0].hasInverse&&(u=!0)):l=!0}),!(u&&l)&&c.length&&(!i||this._coversAllTokens(c))){let r={idx:o,item:e,matches:c};t?(r.score=Ot(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!F(t))return[];let r=[];if(j(t))t.forEach(({v:t,i,n:a})=>{if(!F(t))return;let o=n.searchIn(t);if(o.isMatch){let n={score:o.score,key:e,value:t,idx:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(n.matchedMask=o.matchedMask,n.matchedTerms=o.matchedTerms,n.termCount=o.termCount),r.push(n)}});else{let{v:i,n:a}=t,o=n.searchIn(i);if(o.isMatch){let t={score:o.score,key:e,value:i,norm:a,indices:o.indices,hasInverse:o.hasInverse};o.termCount!==void 0&&(t.matchedMask=o.matchedMask,t.matchedTerms=o.matchedTerms,t.termCount=o.termCount),r.push(t)}}return r}_coversAllTokens(e){let t=e.length?e[0].termCount:void 0;if(t===void 0)return!0;if(t<=Rt){let n=0;for(let t=0;t<e.length;t++)n|=e[t].matchedMask||0;return n===2**t-1}let n=new Set;for(let t=0;t<e.length;t++){let r=e[t].matchedTerms;if(r)for(let e of r)n.add(e)}return n.size===t}};$.version=`7.4.0`,$.createIndex=ct,$.parseIndex=lt,$.config=z,$.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(Ze);return J(e,{...z,...n}).searchIn(t)},$.parseQuery=Dt,q(Ct),q(zt),$.use=function(...e){e.forEach(e=>q(e))};var Gt=e=>e.kind===`selection`||e.kind===`symbol`?(0,A.jsx)(T,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`file`?(0,A.jsx)(_e,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`pr-description`?(0,A.jsx)(Me,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`check`?(0,A.jsx)(ve,{className:`text-muted-foreground size-3.5 shrink-0`}):(0,A.jsx)(m,{className:`text-muted-foreground size-3.5 shrink-0`}),Kt=(e,t)=>e===`Comments`&&t.comments===`pending`?`Comments (loading...)`:e===`Comments`&&t.comments===`error`?`Comments (unavailable)`:e===`Checks`&&t.checks===`pending`?`Checks (loading...)`:e===`Checks`&&t.checks===`error`?`Checks (unavailable)`:e===`Symbols`&&t.symbols===`pending`?`Symbols (loading...)`:e===`Symbols`&&t.symbols===`error`?`Symbols (unavailable)`:e,qt=({mentionGroups:e,contextGroups:t,onSelectCandidate:n})=>{let r=new Set(e.map(e=>e.group)),i=[`Comments`,`Checks`,`Symbols`].filter(e=>r.has(e)?!1:e===`Comments`?t.comments!==`idle`:e===`Checks`?t.checks!==`idle`:t.symbols!==`idle`);return(0,A.jsx)(`div`,{className:`border-edge bg-popover absolute right-2 bottom-full left-2 mb-2 rounded-lg border shadow-sm`,children:(0,A.jsx)(w,{shouldFilter:!1,children:(0,A.jsxs)(C,{children:[(0,A.jsx)(S,{children:`No matching context.`}),e.map(e=>(0,A.jsx)(b,{heading:Kt(e.group,t),children:e.items.map(e=>(0,A.jsxs)(x,{value:e.item.id,onSelect:()=>n(e),children:[Gt(e.item),(0,A.jsx)(`span`,{className:`truncate`,children:e.label}),e.detail?(0,A.jsx)(`span`,{className:`text-muted-foreground truncate text-xs`,children:e.detail}):null]},e.item.id))},e.group)),i.map(e=>(0,A.jsx)(b,{heading:Kt(e,t)},e))]})})})},Jt=/(^|\s)@([^\s@]*)$/,Yt=({contextItems:e,contextCandidates:t,contextGroups:n,busy:r,blocked:i,onAsk:a,onStop:o,onAddContextItem:s,onContextIntent:c})=>{let[l,u]=(0,O.useState)(``),[d,f]=(0,O.useState)(0),p=(0,O.useId)(),m=(0,O.useRef)(!1),h=Jt.exec(l.slice(0,d)),g=h?.[2]??null,_=h?{query:g??``,start:d-(g?.length??0)-1}:null,v=(e,t)=>{let n=Jt.test(e.slice(0,t));n&&!m.current&&c(),m.current=n},y=new Set(e.map(e=>e.id)),b=t.filter(e=>!y.has(e.item.id)),x=_?.query?new $(b,{keys:[`label`,`detail`,`searchText`,`group`],threshold:.3,ignoreLocation:!0}).search(_.query).map(e=>e.item).slice(0,12):b.slice(0,12),S=[`PR`,`Files`,`Comments`,`Checks`,`Symbols`].flatMap(e=>{let t=x.filter(t=>t.group===e);return t.length===0?[]:[{group:e,items:t}]}),C=()=>{a(l)&&(u(``),f(0),m.current=!1)},w=e=>{if(!_)return;s(e.item);let t=l.slice(0,_.start)+l.slice(d);u(t),m.current=!1,v(t,_.start),requestAnimationFrame(()=>{let e=document.getElementById(p);e?.focus(),e?.setSelectionRange(_.start,_.start),f(_.start)})},T=e=>{f(e),v(l,e)};return(0,A.jsxs)(A.Fragment,{children:[_&&(0,A.jsx)(qt,{mentionGroups:S,contextGroups:n,onSelectCandidate:w}),(0,A.jsx)(ee,{id:p,value:l,onValueChange:(e,t)=>{u(e),f(t),v(e,t)},onClick:e=>T(e.currentTarget.selectionStart??0),onSelect:e=>T(e.currentTarget.selectionStart??0),onEnter:()=>{let e=_?x[0]:void 0;e?w(e):C()},onSend:C,onStop:o,busy:r,canSend:!i&&l.trim().length>0,placeholder:e.length>0?`Ask about this PR and context...`:`Ask about this PR...`})]})},Xt=({chatId:e,agent:t,label:n,context:r,onSignIn:i})=>{let a=ue(e),o=(0,O.useSyncExternalStore)(a.subscribe,a.getSnapshot),s=E({mutationFn:t=>g.local.agent.prompt.mutate({chatId:e,...t}),onError:e=>_.error(e.message)}),c=E({mutationFn:()=>g.local.agent.cancel.mutate({chatId:e}),onError:e=>_.error(e.message)}),l=E({mutationFn:()=>g.local.agent.restart.mutate({chatId:e}),onError:e=>_.error(e.message)}),u=o.busy||s.isPending;return(0,A.jsx)(ze,{sent:o.rows.filter(e=>e.type===`user`).length,className:`min-h-full gap-3 p-3`,emptyState:o.rows.length===0?(0,A.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4 text-center`,children:(0,A.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`Ask `,n,` about this PR. It reads the worktree; select diff lines with `,(0,A.jsx)(Ce,{keys:[`mod`,`L`]}),` or type @ to add context.`]})}):null,footer:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(oe,{label:o.status===`starting`?`Starting ${n}`:`${n} is working`,thinking:u}),o.status===`failed`||o.status===`closed`?(0,A.jsx)(ae,{message:o.status===`failed`?`${n} didn't start`:`${n} stopped`,detail:o.reason??void 0,onRetry:()=>l.mutate(),retryDisabled:l.isPending}):null,o.status===`failed`&&o.signIn?(0,A.jsx)(`div`,{children:(0,A.jsx)(fe,{agent:t,label:n,onSignIn:i})}):null,(0,A.jsx)(pe,{chatId:e,queue:o.queue})]}),bottomContent:(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Be,{contextItems:r.contextItems,onRemoveContextItem:r.removeContextItem,onClearContextItems:r.clearContextItems}),(0,A.jsx)(`div`,{className:`border-edge relative border-t p-2`,children:(0,A.jsx)(Yt,{contextItems:r.contextItems,contextCandidates:r.contextCandidates,contextGroups:r.contextGroups,busy:u,blocked:!1,onAsk:e=>{let t=e.trim();return t?(s.mutate({text:t,contextItems:r.contextItems}),r.clearContextItems(),!0):!1},onStop:()=>c.mutate(),onAddContextItem:r.addContextItem,onContextIntent:r.onContextIntent})})]}),children:o.rows.map(r=>(0,A.jsx)(ie,{chatId:e,agent:t,label:n,row:r,onSignIn:i},r.id))})},Zt=({chatId:e,agent:t,context:n,onSettled:r,onSignIn:i})=>t.available?(0,A.jsx)(Xt,{chatId:e,agent:t.id,label:t.label,context:n,onSignIn:i},`${e}:${t.id}`):(0,A.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,A.jsx)(ge,{agents:[t],onSettled:r,onSignIn:i})}),Qt=({chats:e,current:t,onPick:n})=>{let i=E({mutationFn:e=>g.local.agent.close.mutate({chatId:e}),onError:e=>_.error(e.message)});return(0,A.jsxs)(De,{children:[(0,A.jsx)(Ae,{asChild:!0,children:(0,A.jsxs)(r,{size:`sm`,variant:`ghost`,"aria-label":`Chats`,className:`max-w-48 min-w-0 shrink`,children:[(0,A.jsx)(te,{agent:t.agent,className:`size-3.5`}),(0,A.jsx)(`span`,{className:`truncate`,children:t.title}),t.busy?(0,A.jsx)(h,{}):null,(0,A.jsx)(f,{})]})}),(0,A.jsxs)(Oe,{align:`start`,className:`w-72`,children:[(0,A.jsx)(Ee,{children:`Chats`}),e.map(e=>(0,A.jsxs)(Te,{onSelect:()=>n(e.id),className:`pr-0.5`,children:[(0,A.jsx)(te,{agent:e.agent,className:`size-3.5`}),(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),e.busy?(0,A.jsx)(h,{}):null,e.queued>0?(0,A.jsx)(d,{variant:`secondary`,title:`Queued messages`,children:e.queued}):null,(0,A.jsx)(r,{size:`icon-xs`,variant:`ghost`,"aria-label":`Close ${e.title}`,disabled:i.isPending&&i.variables===e.id,onClick:t=>{t.stopPropagation(),i.mutate(e.id)},children:(0,A.jsx)(c,{})})]},e.id))]})]})},$t=2e3,en=(0,O.lazy)(()=>we(()=>import(`./terminal-shell-Cnt0r4V7.js`).then(e=>({default:e.TerminalShell})),__vite__mapDeps([0,1,2,3,4,5]))),tn=()=>(0,A.jsx)(`div`,{className:`flex-1 p-2`,children:(0,A.jsx)(o,{className:`h-full w-full`})}),nn=e=>{let t=i({queryKey:[`local`,`addon`,`status`,`terminal`],queryFn:()=>g.local.addon.status.query({addon:`terminal`}),refetchInterval:e=>e.state.data?.state===`installing`&&$t});return t.isPending?(0,A.jsx)(tn,{}):t.isError?(0,A.jsx)(`div`,{className:`p-3`,children:(0,A.jsx)(s,{message:`Couldn't check the terminal.`,refetch:()=>void t.refetch()})}):t.data.state===`installed`?(0,A.jsx)(O.Suspense,{fallback:(0,A.jsx)(tn,{}),children:(0,A.jsx)(en,{...e})}):(0,A.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,A.jsx)(p,{variant:`quiet`,size:`sm`,title:`Set up the terminal`,description:t.data.error??`The terminal installs the first time you use it: a shell in the PR worktree.`,action:(0,A.jsx)(re,{addon:`terminal`,label:`the terminal`,status:t.data,onSettled:()=>void t.refetch()})})})},rn=({context:e})=>{let t=a(),n=(0,O.useSyncExternalStore)(D.subscribe,D.getSnapshot),o=(0,O.useSyncExternalStore)(je.subscribe,je.getSnapshot),c=i(he()),l=E({mutationFn:e=>g.local.agent.create.mutate({agent:e,placement:{kind:`panel`}}),onSuccess:e=>D.showChat(e.id),onError:e=>_.error(e.message)}),u=E({mutationFn:e=>g.local.agent.setAgent.mutate(e),onError:e=>_.error(e.message)}),d=o?.filter(e=>e.placement.kind===`panel`)??[],f=d.find(e=>e.id===n.chatId)??d[0],p=f?c.data?.find(e=>e.id===f.agent):void 0,m=c.data?Ne(c.data,o?.[0]?.agent??null)?.id:void 0,y=o!==null&&d.length===0,{mutate:b,isPending:x,isError:S}=l;(0,O.useEffect)(()=>{y&&m&&!x&&!S&&b(m)},[y,m,x,S,b]);let C=()=>void c.refetch();return(0,A.jsx)(`div`,{className:`relative h-full`,children:(0,A.jsxs)(de,{value:n.tab,onValueChange:e=>D.showTab(e===`terminal`?`terminal`:`agent`),className:`absolute inset-0 flex min-h-0 flex-col gap-0`,children:[(0,A.jsxs)(`div`,{className:`border-edge @container flex shrink-0 items-center gap-2 border-b p-2`,children:[(0,A.jsxs)(ne,{children:[(0,A.jsxs)(ce,{value:`agent`,"aria-label":`Agent`,children:[(0,A.jsx)(ke,{}),(0,A.jsx)(`span`,{className:`hidden @xs:inline`,children:`Agent`})]}),(0,A.jsxs)(ce,{value:`terminal`,"aria-label":`Terminal`,children:[(0,A.jsx)(Ie,{}),(0,A.jsx)(`span`,{className:`hidden @xs:inline`,children:`Terminal`})]})]}),n.tab===`agent`&&c.data&&f?(0,A.jsx)(Qt,{chats:d,current:f,onPick:D.showChat}):null,n.tab===`agent`&&c.data&&f?(0,A.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,A.jsx)(se,{agents:c.data,value:f.agent,onValueChange:e=>{f&&e!==f.agent&&(f.turns===0&&f.queued===0&&!f.busy?u.mutate({chatId:f.id,agent:e}):l.mutate(e))},disabled:u.isPending}),(0,A.jsx)(be,{children:(0,A.jsxs)(xe,{children:[(0,A.jsx)(ye,{asChild:!0,children:(0,A.jsx)(r,{size:`icon-sm`,variant:`ghost`,"aria-label":`New chat`,disabled:l.isPending,onClick:()=>l.mutate(f.agent),children:l.isPending?(0,A.jsx)(h,{}):(0,A.jsx)(v,{})})}),(0,A.jsx)(Se,{side:`bottom`,children:`New chat`})]})})]}):null]}),(0,A.jsx)(me,{value:`agent`,forceMount:!0,className:`flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:c.isError?(0,A.jsx)(`div`,{className:`p-3`,children:(0,A.jsx)(s,{message:`Couldn't list the agents.`,refetch:C})}):!f&&S&&m?(0,A.jsx)(`div`,{className:`p-3`,children:(0,A.jsx)(s,{message:`Couldn't start a chat.`,refetch:()=>l.mutate(m)})}):!f||!p?(0,A.jsx)(Pe,{}):(0,A.jsx)(Zt,{chatId:f.id,agent:p,context:e,onSettled:C,onSignIn:(e,t)=>D.signIn(e,t,f.id)})}),(0,A.jsx)(me,{value:`terminal`,forceMount:!0,className:`flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:n.terminalOpened?(0,A.jsx)(nn,{signIn:n.signIn,onSignInExit:e=>{let r=n.signIn;r&&e===0&&(t.invalidateQueries({queryKey:he().queryKey}),D.showTab(`agent`),g.local.agent.restart.mutate({chatId:r.chatId}).catch(e=>_.error(e.message)))},onRestart:D.clearSignIn}):null})]})})};export{rn as LocalSidePanel};
|