@tryglen/review 0.2.14 → 0.2.15

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.
@@ -1,2 +1,2 @@
1
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{C as l,D as u,T as d,b as f,g as p,o as m}from"./card-ChTMYRL-.js";import{a as h,o as g}from"./bundle-mjs-IMkwHZOK.js";import{l as _}from"./schemas-D5jfrTNW.js";import{a as v}from"./reviewer-connection-B1irBiYS.js";import{c as y,f as b,i as x,o as S,r as C,s as w,t as T}from"./command-C70vtZ-g.js";import{c as ee}from"./input-group-CXlyHH6x.js";import{_ as te,a as ne,c as re,d as ie,f as ae,g as oe,h as se,i as ce,l as le,m as ue,n as de,o as fe,p as pe,r as me,s as he,t as ge,u as _e,v as ve,y as ye}from"./agent-list-query-DG0_h639.js";import{a as be,i as xe,n as Se,r as Ce,t as we}from"./shortcut-label-Do9KpCPN.js";import{t as Te}from"./preload-helper-B0Qg_vqV.js";import{F as Ee,I as De,M as Oe,P as ke,Tt as Ae,V as je,a as Me,bt as Ne,i as Pe,n as Fe,r as E}from"./index-Dro0lXd8.js";var D=e(g(),1),Ie=new Map([[`bold`,D.createElement(D.Fragment,null,D.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`,D.createElement(D.Fragment,null,D.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`}),D.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`,D.createElement(D.Fragment,null,D.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`,D.createElement(D.Fragment,null,D.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`,D.createElement(D.Fragment,null,D.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`,D.createElement(D.Fragment,null,D.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`}))]]),Le=D.forwardRef((e,n)=>D.createElement(t,{ref:n,...e,weights:Ie}));Le.displayName=`TerminalWindowIcon`;var Re=24,O={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<=Re;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})},ze=(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:O.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=O.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(O.grew(s.state,a()))}),p=t?window:r;return f.observe(e),p.addEventListener(`scroll`,u,{passive:!0}),{pin:()=>l(O.pin(s.state)),stop:()=>{f.disconnect(),p.removeEventListener(`scroll`,u)}}},k=h();function Be({sent:e,page:t=!1,className:i,emptyState:a,footer:o,bottomContent:s,bottomClassName:c,children:l}){let[u,d]=(0,D.useState)(!1),f=(0,D.useRef)(null),[p]=(0,D.useState)(()=>e=>{if(!e)return;let n=ze(e,t,d);return f.current=n,()=>{n.stop(),f.current=null}});(0,D.useLayoutEffect)(()=>f.current?.pin(),[e]);let m=(0,k.jsxs)(`div`,{ref:p,className:n(`flex flex-col`,i),children:[a,l,o]});return(0,k.jsxs)(k.Fragment,{children:[t?m:(0,k.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:m}),(0,k.jsxs)(`div`,{className:n(`relative shrink-0`,c),children:[u?(0,k.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full flex justify-center pb-2`,children:(0,k.jsxs)(r,{size:`sm`,variant:`secondary`,className:`pointer-events-auto shadow-md`,onClick:()=>f.current?.pin(),children:[(0,k.jsx)(b,{}),`Jump to latest`]})}):null,s]})]})}var Ve=({contextItems:e,onRemoveContextItem:t,onClearContextItems:n})=>e.length===0?null:(0,k.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,k.jsx)(ue,{item:e,onRemove:t},e.id)),(0,k.jsx)(r,{variant:`ghost`,size:`xs`,className:`ml-auto`,onClick:n,children:(0,k.jsxs)(`span`,{className:`text-muted-foreground group-hover/button:text-foreground group-focus-visible/button:text-foreground contents`,children:[(0,k.jsx)(c,{className:`size-3.5`}),`Clear all`]})})]});function A(e){return Array.isArray?Array.isArray(e):Ke(e)===`[object Array]`}function He(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 j(e){return e==null?``:He(e)}function M(e){return typeof e==`string`}function N(e){return typeof e==`number`}function Ue(e){return e===!0||e===!1||Ge(e)&&Ke(e)==`[object Boolean]`}function We(e){return typeof e==`object`}function Ge(e){return We(e)&&e!==null}function P(e){return e!=null}function F(e){return!e.trim().length}function Ke(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var qe=`Incorrect 'index' type`,I=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,Je=e=>`Invalid value for key ${e}`,Ye=e=>`Pattern length exceeds max of ${e}.`,Xe=e=>`Missing ${e} property in key`,Ze=e=>`Property 'weight' in key '${e}' must be a positive integer`,Qe=`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.`,$e=Object.prototype.hasOwnProperty,et=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=tt(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 tt(e){let t=null,n=null,r=null,i=1,a=null;if(M(e)||A(e))r=e,t=nt(e),n=L(e);else{if(!$e.call(e,`name`))throw Error(Xe(`name`));let o=e.name;if(r=o,$e.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(Ze(L(o)));t=nt(o),n=L(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function nt(e){return A(e)?e:e.split(`.`)}function L(e){return A(e)?e.join(`.`):e}function rt(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(P(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!P(s))return;if(a===t.length-1&&(M(s)||N(s)||Ue(s)||typeof s==`bigint`))n.push(o===void 0?j(s):{v:j(s),i:o});else if(A(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,M(t)?t.split(`.`):t,0),r?n:n[0]}var it={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},at={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},ot={location:0,threshold:.6,distance:100},st={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:rt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},R=Object.freeze({...at,...it,...ot,...st});function ct(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 z=class{constructor({getFn:e=R.getFn,fieldNormWeight:t=R.fieldNormWeight}={}){this.norm=ct(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(M(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(I);if(M(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(I);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!P(e)||F(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(P(i)){if(A(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(P(n)){if(M(n)){if(!F(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(P(n.v)){let t=M(n.v)?n.v:j(n.v);if(!F(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(M(i)&&!F(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 lt(e,t,{getFn:n=R.getFn,fieldNormWeight:r=R.fieldNormWeight}={}){let i=new z({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(tt)),i.setSources(t),i.create(),i}function ut(e,{getFn:t=R.getFn,fieldNormWeight:n=R.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new z({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function dt(e=[],t=R.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 B=32;function ft(e,t,n,{location:r=R.location,distance:i=R.distance,threshold:a=R.threshold,findAllMatches:o=R.findAllMatches,minMatchCharLength:s=R.minMatchCharLength,includeMatches:c=R.includeMatches,ignoreLocation:l=R.ignoreLocation}={}){if(t.length>B)throw Error(Ye(B));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=dt(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function pt(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 V(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 mt={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},ht=RegExp(`[`+Object.keys(mt).join(``)+`]`,`g`),H=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(ht,e=>mt[e]):e=>e,U=class{constructor(e,{location:t=R.location,threshold:n=R.threshold,distance:r=R.distance,includeMatches:i=R.includeMatches,findAllMatches:a=R.findAllMatches,minMatchCharLength:o=R.minMatchCharLength,isCaseSensitive:s=R.isCaseSensitive,ignoreDiacritics:c=R.ignoreDiacritics,ignoreLocation:l=R.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?H(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:pt(e),startIndex:t})},d=this.pattern.length;if(d>B){let e=0,t=d%B,n=d-t;for(;e<n;)u(this.pattern.substr(e,B),e),e+=B;if(t){let e=d-B;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?H(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}=ft(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=V(u)),p}},gt=new Set([`fuzzy`,`include`]);function _t(e){return e.startsWith(`inverse`)}var W=[{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 U(e,{location:t.location??R.location,threshold:t.threshold??R.threshold,distance:t.distance??R.distance,includeMatches:t.includeMatches??R.includeMatches,findAllMatches:t.findAllMatches??R.findAllMatches,minMatchCharLength:t.minMatchCharLength??R.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??R.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??R.ignoreDiacritics,ignoreLocation:t.ignoreLocation??R.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],vt=W.length,yt=`\0`,bt=`|`;function xt(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 St(e,t){let n=e.match(t);return n?n[1]:null}function Ct(e,t={}){return e.replace(/\\\|/g,yt).split(bt).map(e=>{let n=xt(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<vt;){let e=W[o],n=St(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<vt;){let e=W[o],n=St(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var wt=class{constructor(e,{isCaseSensitive:t=R.isCaseSensitive,ignoreDiacritics:n=R.ignoreDiacritics,includeMatches:r=R.includeMatches,minMatchCharLength:i=R.minMatchCharLength,ignoreLocation:a=R.ignoreLocation,findAllMatches:o=R.findAllMatches,location:s=R.location,threshold:c=R.threshold,distance:l=R.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?H(e):e,this.pattern=e,this.query=Ct(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?H(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,_t(r.type)&&(c=!0),n&&(gt.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=V(o)),e}}return{isMatch:!1,score:1}}},G=[];function K(...e){G.push(...e)}function q(e,t){for(let n=0,r=G.length;n<r;n+=1){let r=G[n];if(r.condition(e,t))return new r(e,t)}return new U(e,t)}var J={AND:`$and`,OR:`$or`},Y={PATH:`$path`,PATTERN:`$val`},X=e=>!!(e[J.AND]||e[J.OR]),Tt=e=>!!e[Y.PATH],Et=e=>!A(e)&&We(e)&&!X(e),Dt=e=>({[J.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Ot(e,t,{auto:n=!0}={}){let r=e=>{if(M(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=q(e,t)),r}let i=Object.keys(e),a=Tt(e);if(!a&&i.length>1&&!X(e))return r(Dt(e));if(Et(e)){let r=a?e[Y.PATH]:i[0],o=a?e[Y.PATTERN]:e[r];if(!M(o))throw Error(Je(r));let s={keyId:L(r),pattern:o};return n&&(s.searcher=q(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];A(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return X(e)||(e=Dt(e)),r(e)}function Z(e,{ignoreFieldNorm:t=R.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=R.ignoreFieldNorm}){e.forEach(e=>{e.score=Z(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(!P(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=R.includeMatches,includeScore:r=R.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=H(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 U(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=V(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={...R,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new et(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=q(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 z))throw Error(qe);if(this._myIndex=t||lt(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(!P(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(I);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(M(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return N(n)&&n>-1&&(e=e.slice(0,n)),e}let c=N(n)&&n>0&&M(e),l;if(c){let t=new At(n);M(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),l=t.extractSorted(o)}else l=M(e)?M(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),kt(l,{ignoreFieldNorm:s}),a&&l.sort(o),N(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(!P(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=Z(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=Ot(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===J.AND)return[]}return o},r=this._myIndex.records,i=new Map,a=[];return r.forEach(({$:e,i:r})=>{if(P(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(!P(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=Z(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!P(t))return[];let r=[];if(A(t))t.forEach(({v:t,i,n:a})=>{if(!P(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=lt,$.parseIndex=ut,$.config=R,$.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(Qe);return q(e,{...R,...n}).searchIn(t)},$.parseQuery=Ot,K(wt),K(zt),$.use=function(...e){e.forEach(e=>K(e))};var Gt=e=>e.kind===`selection`||e.kind===`symbol`?(0,k.jsx)(ee,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`file`?(0,k.jsx)(ve,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`pr-description`?(0,k.jsx)(Ne,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`check`?(0,k.jsx)(ye,{className:`text-muted-foreground size-3.5 shrink-0`}):(0,k.jsx)(f,{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,k.jsx)(`div`,{className:`border-edge bg-popover absolute right-2 bottom-full left-2 mb-2 rounded-lg border shadow-sm`,children:(0,k.jsx)(T,{shouldFilter:!1,children:(0,k.jsxs)(w,{children:[(0,k.jsx)(C,{children:`No matching context.`}),e.map(e=>(0,k.jsx)(x,{heading:Kt(e.group,t),children:e.items.map(e=>(0,k.jsxs)(S,{value:e.item.id,onSelect:()=>n(e),children:[Gt(e.item),(0,k.jsx)(`span`,{className:`truncate`,children:e.label}),e.detail?(0,k.jsx)(`span`,{className:`text-muted-foreground truncate text-xs`,children:e.detail}):null]},e.item.id))},e.group)),i.map(e=>(0,k.jsx)(x,{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,D.useState)(``),[d,f]=(0,D.useState)(0),p=(0,D.useId)(),m=(0,D.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,k.jsxs)(k.Fragment,{children:[_&&(0,k.jsx)(qt,{mentionGroups:S,contextGroups:n,onSelectCandidate:w}),(0,k.jsx)(te,{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=de(e),o=(0,D.useSyncExternalStore)(a.subscribe,a.getSnapshot),s=u({mutationFn:t=>m.local.agent.prompt.mutate({chatId:e,...t}),onError:e=>v.error(e.message)}),c=u({mutationFn:()=>m.local.agent.cancel.mutate({chatId:e}),onError:e=>v.error(e.message)}),l=u({mutationFn:()=>m.local.agent.restart.mutate({chatId:e}),onError:e=>v.error(e.message)}),d=o.busy||s.isPending;return(0,k.jsx)(Be,{sent:o.rows.filter(e=>e.type===`user`).length,className:`min-h-full gap-3 p-3`,emptyState:o.rows.length===0?(0,k.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4 text-center`,children:(0,k.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`Ask `,n,` about this PR. It reads the worktree; select diff lines with `,(0,k.jsx)(we,{keys:[`mod`,`L`]}),` or type @ to add context.`]})}):null,footer:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(se,{label:o.status===`starting`?`Starting ${n}`:`${n} is working`,thinking:d}),o.status===`failed`||o.status===`closed`?(0,k.jsx)(oe,{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,k.jsx)(`div`,{children:(0,k.jsx)(pe,{agent:t,label:n,onSignIn:i})}):null,(0,k.jsx)(me,{chatId:e,queue:o.queue})]}),bottomContent:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(Ve,{contextItems:r.contextItems,onRemoveContextItem:r.removeContextItem,onClearContextItems:r.clearContextItems}),(0,k.jsx)(`div`,{className:`border-edge relative border-t p-2`,children:(0,k.jsx)(Yt,{contextItems:r.contextItems,contextCandidates:r.contextCandidates,contextGroups:r.contextGroups,busy:d,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,k.jsx)(ae,{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,k.jsx)(Xt,{chatId:e,agent:t.id,label:t.label,context:n,onSignIn:i},`${e}:${t.id}`):(0,k.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,k.jsx)(_e,{agents:[t],onSettled:r,onSignIn:i})}),Qt=({chats:e,current:t,onPick:n})=>{let i=u({mutationFn:e=>m.local.agent.close.mutate({chatId:e}),onError:e=>v.error(e.message)});return(0,k.jsxs)(Oe,{children:[(0,k.jsx)(je,{asChild:!0,children:(0,k.jsxs)(r,{size:`sm`,variant:`ghost`,"aria-label":`Chats`,className:`max-w-48 min-w-0 shrink`,children:[(0,k.jsx)(ne,{agent:t.agent,className:`size-3.5`}),(0,k.jsx)(`span`,{className:`truncate`,children:t.title}),t.busy?(0,k.jsx)(p,{}):null,(0,k.jsx)(l,{})]})}),(0,k.jsxs)(ke,{align:`start`,className:`w-72`,children:[(0,k.jsx)(De,{children:`Chats`}),e.map(e=>(0,k.jsxs)(Ee,{onSelect:()=>n(e.id),className:`pr-0.5`,children:[(0,k.jsx)(ne,{agent:e.agent,className:`size-3.5`}),(0,k.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),e.busy?(0,k.jsx)(p,{}):null,e.queued>0?(0,k.jsx)(_,{variant:`secondary`,title:`Queued messages`,children:e.queued}):null,(0,k.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,k.jsx)(c,{})})]},e.id))]})]})},$t=2e3,en=(0,D.lazy)(()=>Te(()=>import(`./terminal-shell-Cnt0r4V7.js`).then(e=>({default:e.TerminalShell})),__vite__mapDeps([0,1,2,3,4,5]))),tn=()=>(0,k.jsx)(`div`,{className:`flex-1 p-2`,children:(0,k.jsx)(o,{className:`h-full w-full`})}),nn=e=>{let t=i({queryKey:[`local`,`addon`,`status`,`terminal`],queryFn:()=>m.local.addon.status.query({addon:`terminal`}),refetchInterval:e=>e.state.data?.state===`installing`&&$t});return t.isPending?(0,k.jsx)(tn,{}):t.isError?(0,k.jsx)(`div`,{className:`p-3`,children:(0,k.jsx)(s,{message:`Couldn't check the terminal.`,refetch:()=>void t.refetch()})}):t.data.state===`installed`?(0,k.jsx)(D.Suspense,{fallback:(0,k.jsx)(tn,{}),children:(0,k.jsx)(en,{...e})}):(0,k.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,k.jsx)(d,{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,k.jsx)(ie,{addon:`terminal`,label:`the terminal`,status:t.data,onSettled:()=>void t.refetch()})})})},rn=({context:e})=>{let t=a(),n=(0,D.useSyncExternalStore)(E.subscribe,E.getSnapshot),o=(0,D.useSyncExternalStore)(Me.subscribe,Me.getSnapshot),c=i(ge()),l=u({mutationFn:e=>m.local.agent.create.mutate({agent:e,placement:{kind:`panel`}}),onSuccess:e=>E.showChat(e.id),onError:e=>v.error(e.message)}),d=u({mutationFn:e=>m.local.agent.setAgent.mutate(e),onError:e=>v.error(e.message)}),f=o?.filter(e=>e.placement.kind===`panel`)??[],h=f.find(e=>e.id===n.chatId)??f[0],g=h?c.data?.find(e=>e.id===h.agent):void 0,_=c.data?Pe(c.data,o?.[0]?.agent??null)?.id:void 0,b=o!==null&&f.length===0,{mutate:x,isPending:S,isError:C}=l;(0,D.useEffect)(()=>{b&&_&&!S&&!C&&x(_)},[b,_,S,C,x]);let w=()=>void c.refetch();return(0,k.jsx)(`div`,{className:`relative h-full`,children:(0,k.jsxs)(fe,{value:n.tab,onValueChange:e=>E.showTab(e===`terminal`?`terminal`:`agent`),className:`absolute inset-0 flex min-h-0 flex-col gap-0`,children:[(0,k.jsxs)(`div`,{className:`border-edge @container flex shrink-0 items-center gap-2 border-b p-2`,children:[(0,k.jsxs)(re,{children:[(0,k.jsxs)(le,{value:`agent`,"aria-label":`Agent`,children:[(0,k.jsx)(Ae,{}),(0,k.jsx)(`span`,{className:`hidden @xs:inline`,children:`Agent`})]}),(0,k.jsxs)(le,{value:`terminal`,"aria-label":`Terminal`,children:[(0,k.jsx)(Le,{}),(0,k.jsx)(`span`,{className:`hidden @xs:inline`,children:`Terminal`})]})]}),n.tab===`agent`&&c.data&&h?(0,k.jsx)(Qt,{chats:f,current:h,onPick:E.showChat}):null,n.tab===`agent`&&c.data&&h?(0,k.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,k.jsx)(ce,{agents:c.data,value:h.agent,onValueChange:e=>{h&&e!==h.agent&&(h.turns===0&&h.queued===0&&!h.busy?d.mutate({chatId:h.id,agent:e}):l.mutate(e))},disabled:d.isPending}),(0,k.jsx)(xe,{children:(0,k.jsxs)(Se,{children:[(0,k.jsx)(be,{asChild:!0,children:(0,k.jsx)(r,{size:`icon-sm`,variant:`ghost`,"aria-label":`New chat`,disabled:l.isPending,onClick:()=>l.mutate(h.agent),children:l.isPending?(0,k.jsx)(p,{}):(0,k.jsx)(y,{})})}),(0,k.jsx)(Ce,{side:`bottom`,children:`New chat`})]})})]}):null]}),(0,k.jsx)(he,{value:`agent`,forceMount:!0,className:`flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:c.isError?(0,k.jsx)(`div`,{className:`p-3`,children:(0,k.jsx)(s,{message:`Couldn't list the agents.`,refetch:w})}):!h&&C&&_?(0,k.jsx)(`div`,{className:`p-3`,children:(0,k.jsx)(s,{message:`Couldn't start a chat.`,refetch:()=>l.mutate(_)})}):!h||!g?(0,k.jsx)(Fe,{}):(0,k.jsx)(Zt,{chatId:h.id,agent:g,context:e,onSettled:w,onSignIn:(e,t)=>E.signIn(e,t,h.id)})}),(0,k.jsx)(he,{value:`terminal`,forceMount:!0,className:`flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:n.terminalOpened?(0,k.jsx)(nn,{signIn:n.signIn,onSignInExit:e=>{let r=n.signIn;r&&e===0&&(t.invalidateQueries({queryKey:ge().queryKey}),E.showTab(`agent`),m.local.agent.restart.mutate({chatId:r.chatId}).catch(e=>v.error(e.message)))},onRestart:E.clearSignIn}):null})]})})};export{rn as LocalSidePanel};
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{C as l,D as u,T as d,b as f,g as p,o as m}from"./card-ChTMYRL-.js";import{a as h,o as g}from"./bundle-mjs-IMkwHZOK.js";import{l as _}from"./schemas-D5jfrTNW.js";import{a as v}from"./reviewer-connection-B1irBiYS.js";import{c as y,f as b,i as x,o as S,r as C,s as w,t as T}from"./command-BHYrxLvA.js";import{c as ee}from"./input-group-CXlyHH6x.js";import{_ as te,a as ne,c as re,d as ie,f as ae,g as oe,h as se,i as ce,l as le,m as ue,n as de,o as fe,p as pe,r as me,s as he,t as ge,u as _e,v as ve,y as ye}from"./agent-list-query-COrbuW6I.js";import{a as be,i as xe,n as Se,r as Ce,t as we}from"./shortcut-label-Do9KpCPN.js";import{t as Te}from"./preload-helper-B0Qg_vqV.js";import{F as Ee,I as De,M as Oe,P as ke,Tt as Ae,V as je,a as Me,bt as Ne,i as Pe,n as Fe,r as E}from"./index-C23o55YE.js";var D=e(g(),1),Ie=new Map([[`bold`,D.createElement(D.Fragment,null,D.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`,D.createElement(D.Fragment,null,D.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`}),D.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`,D.createElement(D.Fragment,null,D.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`,D.createElement(D.Fragment,null,D.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`,D.createElement(D.Fragment,null,D.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`,D.createElement(D.Fragment,null,D.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`}))]]),Le=D.forwardRef((e,n)=>D.createElement(t,{ref:n,...e,weights:Ie}));Le.displayName=`TerminalWindowIcon`;var Re=24,O={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<=Re;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})},ze=(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:O.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=O.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(O.grew(s.state,a()))}),p=t?window:r;return f.observe(e),p.addEventListener(`scroll`,u,{passive:!0}),{pin:()=>l(O.pin(s.state)),stop:()=>{f.disconnect(),p.removeEventListener(`scroll`,u)}}},k=h();function Be({sent:e,page:t=!1,className:i,emptyState:a,footer:o,bottomContent:s,bottomClassName:c,children:l}){let[u,d]=(0,D.useState)(!1),f=(0,D.useRef)(null),[p]=(0,D.useState)(()=>e=>{if(!e)return;let n=ze(e,t,d);return f.current=n,()=>{n.stop(),f.current=null}});(0,D.useLayoutEffect)(()=>f.current?.pin(),[e]);let m=(0,k.jsxs)(`div`,{ref:p,className:n(`flex flex-col`,i),children:[a,l,o]});return(0,k.jsxs)(k.Fragment,{children:[t?m:(0,k.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:m}),(0,k.jsxs)(`div`,{className:n(`relative shrink-0`,c),children:[u?(0,k.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-full flex justify-center pb-2`,children:(0,k.jsxs)(r,{size:`sm`,variant:`secondary`,className:`pointer-events-auto shadow-md`,onClick:()=>f.current?.pin(),children:[(0,k.jsx)(b,{}),`Jump to latest`]})}):null,s]})]})}var Ve=({contextItems:e,onRemoveContextItem:t,onClearContextItems:n})=>e.length===0?null:(0,k.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,k.jsx)(ue,{item:e,onRemove:t},e.id)),(0,k.jsx)(r,{variant:`ghost`,size:`xs`,className:`ml-auto`,onClick:n,children:(0,k.jsxs)(`span`,{className:`text-muted-foreground group-hover/button:text-foreground group-focus-visible/button:text-foreground contents`,children:[(0,k.jsx)(c,{className:`size-3.5`}),`Clear all`]})})]});function A(e){return Array.isArray?Array.isArray(e):Ke(e)===`[object Array]`}function He(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 j(e){return e==null?``:He(e)}function M(e){return typeof e==`string`}function N(e){return typeof e==`number`}function Ue(e){return e===!0||e===!1||Ge(e)&&Ke(e)==`[object Boolean]`}function We(e){return typeof e==`object`}function Ge(e){return We(e)&&e!==null}function P(e){return e!=null}function F(e){return!e.trim().length}function Ke(e){return e==null?e===void 0?`[object Undefined]`:`[object Null]`:Object.prototype.toString.call(e)}var qe=`Incorrect 'index' type`,I=`Invalid doc index: must be a non-negative integer within the bounds of the docs array`,Je=e=>`Invalid value for key ${e}`,Ye=e=>`Pattern length exceeds max of ${e}.`,Xe=e=>`Missing ${e} property in key`,Ze=e=>`Property 'weight' in key '${e}' must be a positive integer`,Qe=`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.`,$e=Object.prototype.hasOwnProperty,et=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(e=>{let n=tt(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 tt(e){let t=null,n=null,r=null,i=1,a=null;if(M(e)||A(e))r=e,t=nt(e),n=L(e);else{if(!$e.call(e,`name`))throw Error(Xe(`name`));let o=e.name;if(r=o,$e.call(e,`weight`)&&e.weight!==void 0&&(i=e.weight,i<=0))throw Error(Ze(L(o)));t=nt(o),n=L(o),a=e.getFn??null}return{path:t,id:n,weight:i,src:r,getFn:a}}function nt(e){return A(e)?e:e.split(`.`)}function L(e){return A(e)?e.join(`.`):e}function rt(e,t){let n=[],r=!1,i=(e,t,a,o)=>{if(P(e)){if(!t[a])n.push(o===void 0?e:{v:e,i:o});else{let s=e[t[a]];if(!P(s))return;if(a===t.length-1&&(M(s)||N(s)||Ue(s)||typeof s==`bigint`))n.push(o===void 0?j(s):{v:j(s),i:o});else if(A(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,M(t)?t.split(`.`):t,0),r?n:n[0]}var it={includeMatches:!1,findAllMatches:!1,minMatchCharLength:1},at={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},ot={location:0,threshold:.6,distance:100},st={useExtendedSearch:!1,useTokenSearch:!1,tokenize:void 0,tokenMatch:`any`,getFn:rt,ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1},R=Object.freeze({...at,...it,...ot,...st});function ct(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 z=class{constructor({getFn:e=R.getFn,fieldNormWeight:t=R.fieldNormWeight}={}){this.norm=ct(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(M(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(I);if(M(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(I);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!P(e)||F(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(P(i)){if(A(i)){let e=[];for(let t=0,n=i.length;t<n;t+=1){let n=i[t];if(P(n)){if(M(n)){if(!F(n)){let r={v:n,i:t,n:this.norm.get(n)};e.push(r)}}else if(P(n.v)){let t=M(n.v)?n.v:j(n.v);if(!F(t)){let r={v:t,i:n.i,n:this.norm.get(t)};e.push(r)}}}}n.$[t]=e}else if(M(i)&&!F(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 lt(e,t,{getFn:n=R.getFn,fieldNormWeight:r=R.fieldNormWeight}={}){let i=new z({getFn:n,fieldNormWeight:r});return i.setKeys(e.map(tt)),i.setSources(t),i.create(),i}function ut(e,{getFn:t=R.getFn,fieldNormWeight:n=R.fieldNormWeight}={}){let{keys:r,records:i}=e,a=new z({getFn:t,fieldNormWeight:n});return a.setKeys(r),a.setIndexRecords(i),a}function dt(e=[],t=R.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 B=32;function ft(e,t,n,{location:r=R.location,distance:i=R.distance,threshold:a=R.threshold,findAllMatches:o=R.findAllMatches,minMatchCharLength:s=R.minMatchCharLength,includeMatches:c=R.includeMatches,ignoreLocation:l=R.ignoreLocation}={}){if(t.length>B)throw Error(Ye(B));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=dt(_,s);e.length?c&&(w.indices=e):w.isMatch=!1}return w}function pt(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 V(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 mt={ł:`l`,Ł:`L`,đ:`d`,Đ:`D`,ø:`o`,Ø:`O`,ħ:`h`,Ħ:`H`,ŧ:`t`,Ŧ:`T`,ı:`i`,ß:`ss`},ht=RegExp(`[`+Object.keys(mt).join(``)+`]`,`g`),H=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(ht,e=>mt[e]):e=>e,U=class{constructor(e,{location:t=R.location,threshold:n=R.threshold,distance:r=R.distance,includeMatches:i=R.includeMatches,findAllMatches:a=R.findAllMatches,minMatchCharLength:o=R.minMatchCharLength,isCaseSensitive:s=R.isCaseSensitive,ignoreDiacritics:c=R.ignoreDiacritics,ignoreLocation:l=R.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?H(e):e,this.pattern=e,this.chunks=[],!this.pattern.length)return;let u=(e,t)=>{this.chunks.push({pattern:e,alphabet:pt(e),startIndex:t})},d=this.pattern.length;if(d>B){let e=0,t=d%B,n=d-t;for(;e<n;)u(this.pattern.substr(e,B),e),e+=B;if(t){let e=d-B;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?H(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}=ft(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=V(u)),p}},gt=new Set([`fuzzy`,`include`]);function _t(e){return e.startsWith(`inverse`)}var W=[{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 U(e,{location:t.location??R.location,threshold:t.threshold??R.threshold,distance:t.distance??R.distance,includeMatches:t.includeMatches??R.includeMatches,findAllMatches:t.findAllMatches??R.findAllMatches,minMatchCharLength:t.minMatchCharLength??R.minMatchCharLength,isCaseSensitive:t.isCaseSensitive??R.isCaseSensitive,ignoreDiacritics:t.ignoreDiacritics??R.ignoreDiacritics,ignoreLocation:t.ignoreLocation??R.ignoreLocation});return{type:`fuzzy`,search(e){return n.searchIn(e)}}}}],vt=W.length,yt=`\0`,bt=`|`;function xt(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 St(e,t){let n=e.match(t);return n?n[1]:null}function Ct(e,t={}){return e.replace(/\\\|/g,yt).split(bt).map(e=>{let n=xt(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<vt;){let e=W[o],n=St(i,e.multiRegex);n&&(r.push(e.create(n,t)),a=!0)}if(!a)for(o=-1;++o<vt;){let e=W[o],n=St(i,e.singleRegex);if(n){r.push(e.create(n,t));break}}}return r})}var wt=class{constructor(e,{isCaseSensitive:t=R.isCaseSensitive,ignoreDiacritics:n=R.ignoreDiacritics,includeMatches:r=R.includeMatches,minMatchCharLength:i=R.minMatchCharLength,ignoreLocation:a=R.ignoreLocation,findAllMatches:o=R.findAllMatches,location:s=R.location,threshold:c=R.threshold,distance:l=R.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?H(e):e,this.pattern=e,this.query=Ct(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?H(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,_t(r.type)&&(c=!0),n&&(gt.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=V(o)),e}}return{isMatch:!1,score:1}}},G=[];function K(...e){G.push(...e)}function q(e,t){for(let n=0,r=G.length;n<r;n+=1){let r=G[n];if(r.condition(e,t))return new r(e,t)}return new U(e,t)}var J={AND:`$and`,OR:`$or`},Y={PATH:`$path`,PATTERN:`$val`},X=e=>!!(e[J.AND]||e[J.OR]),Tt=e=>!!e[Y.PATH],Et=e=>!A(e)&&We(e)&&!X(e),Dt=e=>({[J.AND]:Object.keys(e).map(t=>({[t]:e[t]}))});function Ot(e,t,{auto:n=!0}={}){let r=e=>{if(M(e)){let r={keyId:null,pattern:e};return n&&(r.searcher=q(e,t)),r}let i=Object.keys(e),a=Tt(e);if(!a&&i.length>1&&!X(e))return r(Dt(e));if(Et(e)){let r=a?e[Y.PATH]:i[0],o=a?e[Y.PATTERN]:e[r];if(!M(o))throw Error(Je(r));let s={keyId:L(r),pattern:o};return n&&(s.searcher=q(o,t)),s}let o={children:[],operator:i[0]};return i.forEach(t=>{let n=e[t];A(n)&&n.forEach(e=>{o.children.push(r(e))})}),o};return X(e)||(e=Dt(e)),r(e)}function Z(e,{ignoreFieldNorm:t=R.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=R.ignoreFieldNorm}){e.forEach(e=>{e.score=Z(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(!P(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=R.includeMatches,includeScore:r=R.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=H(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 U(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=V(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={...R,...t},this.options.useExtendedSearch,this.options.useTokenSearch,this._keyStore=new et(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=q(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 z))throw Error(qe);if(this._myIndex=t||lt(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(!P(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(I);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(M(e)&&!e.trim()){let e=this._docs.map((e,t)=>({item:e,refIndex:t}));return N(n)&&n>-1&&(e=e.slice(0,n)),e}let c=N(n)&&n>0&&M(e),l;if(c){let t=new At(n);M(this._docs[0])?this._searchStringList(e,{heap:t,ignoreFieldNorm:s}):this._searchObjectList(e,{heap:t,ignoreFieldNorm:s}),l=t.extractSorted(o)}else l=M(e)?M(this._docs[0])?this._searchStringList(e):this._searchObjectList(e):this._searchLogical(e),kt(l,{ignoreFieldNorm:s}),a&&l.sort(o),N(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(!P(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=Z(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):o.push(r)}}}),o}_searchLogical(e){let t=Ot(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===J.AND)return[]}return o},r=this._myIndex.records,i=new Map,a=[];return r.forEach(({$:e,i:r})=>{if(P(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(!P(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=Z(r.matches,{ignoreFieldNorm:n}),t.shouldInsert(r.score)&&t.insert(r)):s.push(r)}}),s}_findMatches({key:e,value:t,searcher:n}){if(!P(t))return[];let r=[];if(A(t))t.forEach(({v:t,i,n:a})=>{if(!P(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=lt,$.parseIndex=ut,$.config=R,$.match=function(e,t,n){if(n&&n.useTokenSearch)throw Error(Qe);return q(e,{...R,...n}).searchIn(t)},$.parseQuery=Ot,K(wt),K(zt),$.use=function(...e){e.forEach(e=>K(e))};var Gt=e=>e.kind===`selection`||e.kind===`symbol`?(0,k.jsx)(ee,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`file`?(0,k.jsx)(ve,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`pr-description`?(0,k.jsx)(Ne,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`check`?(0,k.jsx)(ye,{className:`text-muted-foreground size-3.5 shrink-0`}):(0,k.jsx)(f,{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,k.jsx)(`div`,{className:`border-edge bg-popover absolute right-2 bottom-full left-2 mb-2 rounded-lg border shadow-sm`,children:(0,k.jsx)(T,{shouldFilter:!1,children:(0,k.jsxs)(w,{children:[(0,k.jsx)(C,{children:`No matching context.`}),e.map(e=>(0,k.jsx)(x,{heading:Kt(e.group,t),children:e.items.map(e=>(0,k.jsxs)(S,{value:e.item.id,onSelect:()=>n(e),children:[Gt(e.item),(0,k.jsx)(`span`,{className:`truncate`,children:e.label}),e.detail?(0,k.jsx)(`span`,{className:`text-muted-foreground truncate text-xs`,children:e.detail}):null]},e.item.id))},e.group)),i.map(e=>(0,k.jsx)(x,{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,D.useState)(``),[d,f]=(0,D.useState)(0),p=(0,D.useId)(),m=(0,D.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,k.jsxs)(k.Fragment,{children:[_&&(0,k.jsx)(qt,{mentionGroups:S,contextGroups:n,onSelectCandidate:w}),(0,k.jsx)(te,{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=de(e),o=(0,D.useSyncExternalStore)(a.subscribe,a.getSnapshot),s=u({mutationFn:t=>m.local.agent.prompt.mutate({chatId:e,...t}),onError:e=>v.error(e.message)}),c=u({mutationFn:()=>m.local.agent.cancel.mutate({chatId:e}),onError:e=>v.error(e.message)}),l=u({mutationFn:()=>m.local.agent.restart.mutate({chatId:e}),onError:e=>v.error(e.message)}),d=o.busy||s.isPending;return(0,k.jsx)(Be,{sent:o.rows.filter(e=>e.type===`user`).length,className:`min-h-full gap-3 p-3`,emptyState:o.rows.length===0?(0,k.jsx)(`div`,{className:`flex flex-1 items-center justify-center px-4 text-center`,children:(0,k.jsxs)(`p`,{className:`text-muted-foreground text-sm`,children:[`Ask `,n,` about this PR. It reads the worktree; select diff lines with `,(0,k.jsx)(we,{keys:[`mod`,`L`]}),` or type @ to add context.`]})}):null,footer:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(se,{label:o.status===`starting`?`Starting ${n}`:`${n} is working`,thinking:d}),o.status===`failed`||o.status===`closed`?(0,k.jsx)(oe,{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,k.jsx)(`div`,{children:(0,k.jsx)(pe,{agent:t,label:n,onSignIn:i})}):null,(0,k.jsx)(me,{chatId:e,queue:o.queue})]}),bottomContent:(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(Ve,{contextItems:r.contextItems,onRemoveContextItem:r.removeContextItem,onClearContextItems:r.clearContextItems}),(0,k.jsx)(`div`,{className:`border-edge relative border-t p-2`,children:(0,k.jsx)(Yt,{contextItems:r.contextItems,contextCandidates:r.contextCandidates,contextGroups:r.contextGroups,busy:d,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,k.jsx)(ae,{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,k.jsx)(Xt,{chatId:e,agent:t.id,label:t.label,context:n,onSignIn:i},`${e}:${t.id}`):(0,k.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,k.jsx)(_e,{agents:[t],onSettled:r,onSignIn:i})}),Qt=({chats:e,current:t,onPick:n})=>{let i=u({mutationFn:e=>m.local.agent.close.mutate({chatId:e}),onError:e=>v.error(e.message)});return(0,k.jsxs)(Oe,{children:[(0,k.jsx)(je,{asChild:!0,children:(0,k.jsxs)(r,{size:`sm`,variant:`ghost`,"aria-label":`Chats`,className:`max-w-48 min-w-0 shrink`,children:[(0,k.jsx)(ne,{agent:t.agent,className:`size-3.5`}),(0,k.jsx)(`span`,{className:`truncate`,children:t.title}),t.busy?(0,k.jsx)(p,{}):null,(0,k.jsx)(l,{})]})}),(0,k.jsxs)(ke,{align:`start`,className:`w-72`,children:[(0,k.jsx)(De,{children:`Chats`}),e.map(e=>(0,k.jsxs)(Ee,{onSelect:()=>n(e.id),className:`pr-0.5`,children:[(0,k.jsx)(ne,{agent:e.agent,className:`size-3.5`}),(0,k.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),e.busy?(0,k.jsx)(p,{}):null,e.queued>0?(0,k.jsx)(_,{variant:`secondary`,title:`Queued messages`,children:e.queued}):null,(0,k.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,k.jsx)(c,{})})]},e.id))]})]})},$t=2e3,en=(0,D.lazy)(()=>Te(()=>import(`./terminal-shell-Cnt0r4V7.js`).then(e=>({default:e.TerminalShell})),__vite__mapDeps([0,1,2,3,4,5]))),tn=()=>(0,k.jsx)(`div`,{className:`flex-1 p-2`,children:(0,k.jsx)(o,{className:`h-full w-full`})}),nn=e=>{let t=i({queryKey:[`local`,`addon`,`status`,`terminal`],queryFn:()=>m.local.addon.status.query({addon:`terminal`}),refetchInterval:e=>e.state.data?.state===`installing`&&$t});return t.isPending?(0,k.jsx)(tn,{}):t.isError?(0,k.jsx)(`div`,{className:`p-3`,children:(0,k.jsx)(s,{message:`Couldn't check the terminal.`,refetch:()=>void t.refetch()})}):t.data.state===`installed`?(0,k.jsx)(D.Suspense,{fallback:(0,k.jsx)(tn,{}),children:(0,k.jsx)(en,{...e})}):(0,k.jsx)(`div`,{className:`flex h-full items-center justify-center p-4`,children:(0,k.jsx)(d,{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,k.jsx)(ie,{addon:`terminal`,label:`the terminal`,status:t.data,onSettled:()=>void t.refetch()})})})},rn=({context:e})=>{let t=a(),n=(0,D.useSyncExternalStore)(E.subscribe,E.getSnapshot),o=(0,D.useSyncExternalStore)(Me.subscribe,Me.getSnapshot),c=i(ge()),l=u({mutationFn:e=>m.local.agent.create.mutate({agent:e,placement:{kind:`panel`}}),onSuccess:e=>E.showChat(e.id),onError:e=>v.error(e.message)}),d=u({mutationFn:e=>m.local.agent.setAgent.mutate(e),onError:e=>v.error(e.message)}),f=o?.filter(e=>e.placement.kind===`panel`)??[],h=f.find(e=>e.id===n.chatId)??f[0],g=h?c.data?.find(e=>e.id===h.agent):void 0,_=c.data?Pe(c.data,o?.[0]?.agent??null)?.id:void 0,b=o!==null&&f.length===0,{mutate:x,isPending:S,isError:C}=l;(0,D.useEffect)(()=>{b&&_&&!S&&!C&&x(_)},[b,_,S,C,x]);let w=()=>void c.refetch();return(0,k.jsx)(`div`,{className:`relative h-full`,children:(0,k.jsxs)(fe,{value:n.tab,onValueChange:e=>E.showTab(e===`terminal`?`terminal`:`agent`),className:`absolute inset-0 flex min-h-0 flex-col gap-0`,children:[(0,k.jsxs)(`div`,{className:`border-edge @container flex shrink-0 items-center gap-2 border-b p-2`,children:[(0,k.jsxs)(re,{children:[(0,k.jsxs)(le,{value:`agent`,"aria-label":`Agent`,children:[(0,k.jsx)(Ae,{}),(0,k.jsx)(`span`,{className:`hidden @xs:inline`,children:`Agent`})]}),(0,k.jsxs)(le,{value:`terminal`,"aria-label":`Terminal`,children:[(0,k.jsx)(Le,{}),(0,k.jsx)(`span`,{className:`hidden @xs:inline`,children:`Terminal`})]})]}),n.tab===`agent`&&c.data&&h?(0,k.jsx)(Qt,{chats:f,current:h,onPick:E.showChat}):null,n.tab===`agent`&&c.data&&h?(0,k.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,k.jsx)(ce,{agents:c.data,value:h.agent,onValueChange:e=>{h&&e!==h.agent&&(h.turns===0&&h.queued===0&&!h.busy?d.mutate({chatId:h.id,agent:e}):l.mutate(e))},disabled:d.isPending}),(0,k.jsx)(xe,{children:(0,k.jsxs)(Se,{children:[(0,k.jsx)(be,{asChild:!0,children:(0,k.jsx)(r,{size:`icon-sm`,variant:`ghost`,"aria-label":`New chat`,disabled:l.isPending,onClick:()=>l.mutate(h.agent),children:l.isPending?(0,k.jsx)(p,{}):(0,k.jsx)(y,{})})}),(0,k.jsx)(Ce,{side:`bottom`,children:`New chat`})]})})]}):null]}),(0,k.jsx)(he,{value:`agent`,forceMount:!0,className:`flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:c.isError?(0,k.jsx)(`div`,{className:`p-3`,children:(0,k.jsx)(s,{message:`Couldn't list the agents.`,refetch:w})}):!h&&C&&_?(0,k.jsx)(`div`,{className:`p-3`,children:(0,k.jsx)(s,{message:`Couldn't start a chat.`,refetch:()=>l.mutate(_)})}):!h||!g?(0,k.jsx)(Fe,{}):(0,k.jsx)(Zt,{chatId:h.id,agent:g,context:e,onSettled:w,onSignIn:(e,t)=>E.signIn(e,t,h.id)})}),(0,k.jsx)(he,{value:`terminal`,forceMount:!0,className:`flex min-h-0 flex-1 flex-col data-[state=inactive]:hidden`,children:n.terminalOpened?(0,k.jsx)(nn,{signIn:n.signIn,onSignInExit:e=>{let r=n.signIn;r&&e===0&&(t.invalidateQueries({queryKey:ge().queryKey}),E.showTab(`agent`),m.local.agent.restart.mutate({chatId:r.chatId}).catch(e=>v.error(e.message)))},onRestart:E.clearSignIn}):null})]})})};export{rn as LocalSidePanel};
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <link rel="icon" href="/favicon.svg" type="image/svg+xml" />
7
7
  <title>glen review</title>
8
- <script type="module" crossorigin src="/assets/index-Dro0lXd8.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-C23o55YE.js"></script>
9
9
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-XKyaHtl9.js">
10
10
  <link rel="modulepreload" crossorigin href="/assets/bundle-mjs-IMkwHZOK.js">
11
11
  <link rel="modulepreload" crossorigin href="/assets/button-DizkG3Et.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryglen/review",
3
- "version": "0.2.14",
3
+ "version": "0.2.15",
4
4
  "description": "Glen's PR reviewer, served locally from a git worktree of the PR head.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -51,5 +51,5 @@
51
51
  "node": ">=20"
52
52
  },
53
53
  "license": "UNLICENSED",
54
- "gitHead": "f742393e47e56cdf8a9355d077f44937e17241b4"
54
+ "gitHead": "5da92409d2f4c0c5e06479819f3140cae31fc41f"
55
55
  }
@@ -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{f as a,g as o,m as s,p as c,v as l,x as u,y as d}from"./query-error-DSrxRVZP.js";import{D as f,T as p,_ as m,b as h,c as ee,d as te,f as ne,g,l as re,m as ie,o as _,p as v,t as ae,u as oe,x as se}from"./card-ChTMYRL-.js";import{a as ce,o as le}from"./bundle-mjs-IMkwHZOK.js";import{a as y,r as ue,t as b}from"./reviewer-connection-B1irBiYS.js";import{a as de,c as fe,o as pe,u as me}from"./input-group-CXlyHH6x.js";import{r as he}from"./chunk-BO2N2NFS-CNHkQg2l.js";import{Ct as ge,_ as _e,_t as ve,bt as ye,g as be,v as xe,vt as Se}from"./index-Dro0lXd8.js";var x=e(le(),1),Ce=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M152.41,88.56l-89.6,88a12,12,0,0,1-16.82,0L7.59,138.85a12,12,0,0,1,16.82-17.13l30,29.46,81.19-79.74a12,12,0,0,1,16.82,17.12Zm96.15-17a12,12,0,0,0-17-.15L150.4,151.18l-7.88-7.74a12,12,0,0,0-16.82,17.12l16.29,16a12,12,0,0,0,16.82,0l89.6-88A12,12,0,0,0,248.56,71.59Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M240,64V192a16,16,0,0,1-16,16H32a16,16,0,0,1-16-16V64A16,16,0,0,1,32,48H224A16,16,0,0,1,240,64Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M149.61,85.71l-89.6,88a8,8,0,0,1-11.22,0L10.39,136a8,8,0,1,1,11.22-11.41L54.4,156.79l84-82.5a8,8,0,1,1,11.22,11.42Zm96.1-11.32a8,8,0,0,0-11.32-.1l-84,82.5-18.83-18.5a8,8,0,0,0-11.21,11.42l24.43,24a8,8,0,0,0,11.22,0l89.6-88A8,8,0,0,0,245.71,74.39Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224,48H32A16,16,0,0,0,16,64V192a16,16,0,0,0,16,16H224a16,16,0,0,0,16-16V64A16,16,0,0,0,224,48ZM72,168a8,8,0,0,1-5.66-2.34l-24-24a8,8,0,0,1,11.32-11.32L72,148.69l58.34-58.35a8,8,0,0,1,11.32,11.32l-64,64A8,8,0,0,1,72,168Zm141.66-66.34-64,64a8,8,0,0,1-11.32,0l-16-16a8,8,0,0,1,11.32-11.32L144,148.69l58.34-58.35a8,8,0,0,1,11.32,11.32Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M148.2,84.28l-89.6,88a6,6,0,0,1-8.4,0L11.8,134.57A6,6,0,1,1,20.2,126l34.2,33.58,85.4-83.87a6,6,0,1,1,8.4,8.56Zm96.08-8.48a6,6,0,0,0-8.48-.08l-85.4,83.87-20.23-19.87a6,6,0,1,0-8.41,8.56l24.44,24a6,6,0,0,0,8.4,0l89.6-88A6,6,0,0,0,244.28,75.8Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M149.61,85.71l-89.6,88a8,8,0,0,1-11.22,0L10.39,136a8,8,0,1,1,11.22-11.41L54.4,156.79l84-82.5a8,8,0,1,1,11.22,11.42Zm96.1-11.32a8,8,0,0,0-11.32-.1l-84,82.5-18.83-18.5a8,8,0,0,0-11.21,11.42l24.43,24a8,8,0,0,0,11.22,0l89.6-88A8,8,0,0,0,245.71,74.39Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M146.8,82.85l-89.6,88a4,4,0,0,1-5.6,0L13.2,133.14a4,4,0,0,1,5.6-5.71l35.6,35,86.8-85.24a4,4,0,0,1,5.6,5.7Zm96-5.65a4,4,0,0,0-5.65,0l-86.8,85.24-21.63-21.24a4,4,0,1,0-5.61,5.7l24.44,24a4,4,0,0,0,5.6,0l89.6-88A4,4,0,0,0,242.85,77.2Z`}))]]),we=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,20A108,108,0,1,0,236,128,108.12,108.12,0,0,0,128,20Zm0,192a84,84,0,1,1,84-84A84.09,84.09,0,0,1,128,212Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M224,128a96,96,0,1,1-96-96A96,96,0,0,1,224,128Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M232,128A104,104,0,1,1,128,24,104.13,104.13,0,0,1,232,128Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,26A102,102,0,1,0,230,128,102.12,102.12,0,0,0,128,26Zm0,192a90,90,0,1,1,90-90A90.1,90.1,0,0,1,128,218Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,24A104,104,0,1,0,232,128,104.11,104.11,0,0,0,128,24Zm0,192a88,88,0,1,1,88-88A88.1,88.1,0,0,1,128,216Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M128,28A100,100,0,1,0,228,128,100.11,100.11,0,0,0,128,28Zm0,192a92,92,0,1,1,92-92A92.1,92.1,0,0,1,128,220Z`}))]]),Te=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M216.49,79.52l-56-56A12,12,0,0,0,152,20H56A20,20,0,0,0,36,40V216a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V88A12,12,0,0,0,216.49,79.52ZM160,57l23,23H160ZM60,212V44h76V92a12,12,0,0,0,12,12h48V212Zm112-80a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,132Zm0,40a12,12,0,0,1-12,12H96a12,12,0,0,1,0-24h64A12,12,0,0,1,172,172Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M208,88H152V32Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,176H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm0-32H96a8,8,0,0,1,0-16h64a8,8,0,0,1,0,16Zm-8-56V44l44,44Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M212.24,83.76l-56-56A6,6,0,0,0,152,26H56A14,14,0,0,0,42,40V216a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V88A6,6,0,0,0,212.24,83.76ZM158,46.48,193.52,82H158ZM200,218H56a2,2,0,0,1-2-2V40a2,2,0,0,1,2-2h90V88a6,6,0,0,0,6,6h50V216A2,2,0,0,1,200,218Zm-34-82a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,136Zm0,32a6,6,0,0,1-6,6H96a6,6,0,0,1,0-12h64A6,6,0,0,1,166,168Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M213.66,82.34l-56-56A8,8,0,0,0,152,24H56A16,16,0,0,0,40,40V216a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V88A8,8,0,0,0,213.66,82.34ZM160,51.31,188.69,80H160ZM200,216H56V40h88V88a8,8,0,0,0,8,8h48V216Zm-32-80a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,136Zm0,32a8,8,0,0,1-8,8H96a8,8,0,0,1,0-16h64A8,8,0,0,1,168,168Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M210.83,85.17l-56-56A4,4,0,0,0,152,28H56A12,12,0,0,0,44,40V216a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V88A4,4,0,0,0,210.83,85.17ZM156,41.65,198.34,84H156ZM200,220H56a4,4,0,0,1-4-4V40a4,4,0,0,1,4-4h92V88a4,4,0,0,0,4,4h52V216A4,4,0,0,1,200,220Zm-36-84a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,136Zm0,32a4,4,0,0,1-4,4H96a4,4,0,0,1,0-8h64A4,4,0,0,1,164,168Z`}))]]),Ee=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M116,132V96a12,12,0,0,1,24,0v36a12,12,0,0,1-24,0Zm12,56a16,16,0,1,0-16-16A16,16,0,0,0,128,188ZM228,56v56c0,54.29-26.32,87.22-48.4,105.29-23.71,19.39-47.44,26-48.44,26.29a12.1,12.1,0,0,1-6.32,0c-1-.28-24.73-6.9-48.44-26.29C54.32,199.22,28,166.29,28,112V56A20,20,0,0,1,48,36H208A20,20,0,0,1,228,56Zm-24,4H52v52c0,35.71,13.09,64.69,38.91,86.15A126.14,126.14,0,0,0,128,219.38a126.28,126.28,0,0,0,37.09-21.23C190.91,176.69,204,147.71,204,112Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M216,56v56c0,96-88,120-88,120S40,208,40,112V56a8,8,0,0,1,8-8H208A8,8,0,0,1,216,56Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M120,136V96a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,48a12,12,0,1,0-12-12A12,12,0,0,0,128,184ZM224,56v56c0,52.72-25.52,84.67-46.93,102.19-23.06,18.86-46,25.27-47,25.53a8,8,0,0,1-4.2,0c-1-.26-23.91-6.67-47-25.53C57.52,196.67,32,164.72,32,112V56A16,16,0,0,1,48,40H208A16,16,0,0,1,224,56Zm-16,0L48,56l0,56c0,37.3,13.82,67.51,41.07,89.81A128.25,128.25,0,0,0,128,223.62a129.3,129.3,0,0,0,39.41-22.2C194.34,179.16,208,149.07,208,112Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M208,40H48A16,16,0,0,0,32,56v56c0,52.72,25.52,84.67,46.93,102.19,23.06,18.86,46,25.27,47,25.53a8,8,0,0,0,4.2,0c1-.26,23.91-6.67,47-25.53C198.48,196.67,224,164.72,224,112V56A16,16,0,0,0,208,40ZM120,96a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,88a12,12,0,1,1,12-12A12,12,0,0,1,128,184Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M122,136V96a6,6,0,0,1,12,0v40a6,6,0,0,1-12,0Zm6,26a10,10,0,1,0,10,10A10,10,0,0,0,128,162ZM222,56v56c0,51.94-25.12,83.4-46.2,100.64-22.73,18.6-45.27,24.89-46.22,25.15a6,6,0,0,1-3.16,0c-1-.26-23.49-6.55-46.22-25.15C59.12,195.4,34,163.94,34,112V56A14,14,0,0,1,48,42H208A14,14,0,0,1,222,56Zm-12,0a2,2,0,0,0-2-2H48a2,2,0,0,0-2,2v56c0,37.75,13.94,68.39,41.44,91.06A130.94,130.94,0,0,0,128,225.72a131.17,131.17,0,0,0,40.56-22.66C196.06,180.39,210,149.75,210,112Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M120,136V96a8,8,0,0,1,16,0v40a8,8,0,0,1-16,0Zm8,48a12,12,0,1,0-12-12A12,12,0,0,0,128,184ZM224,56v56c0,52.72-25.52,84.67-46.93,102.19-23.06,18.86-46,25.27-47,25.53a8,8,0,0,1-4.2,0c-1-.26-23.91-6.67-47-25.53C57.52,196.67,32,164.72,32,112V56A16,16,0,0,1,48,40H208A16,16,0,0,1,224,56Zm-16,0L48,56l0,56c0,37.3,13.82,67.51,41.07,89.81A128.25,128.25,0,0,0,128,223.62a129.3,129.3,0,0,0,39.41-22.2C194.34,179.16,208,149.07,208,112Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M124,136V96a4,4,0,0,1,8,0v40a4,4,0,0,1-8,0Zm4,28a8,8,0,1,0,8,8A8,8,0,0,0,128,164ZM220,56v56c0,51.16-24.73,82.12-45.47,99.1-22.4,18.32-44.55,24.5-45.48,24.76a4,4,0,0,1-2.1,0c-.93-.26-23.08-6.44-45.48-24.76C60.73,194.12,36,163.16,36,112V56A12,12,0,0,1,48,44H208A12,12,0,0,1,220,56Zm-8,0a4,4,0,0,0-4-4H48a4,4,0,0,0-4,4v56c0,38.44,14.23,69.63,42.29,92.71A132.23,132.23,0,0,0,128,227.82a132.45,132.45,0,0,0,41.71-23.11C197.77,181.63,212,150.44,212,112Z`}))]]),De=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M144.49,136.49l-40,40a12,12,0,0,1-17-17L107,140H24a12,12,0,0,1,0-24h83L87.51,96.49a12,12,0,0,1,17-17l40,40A12,12,0,0,1,144.49,136.49ZM200,28H136a12,12,0,0,0,0,24h52V204H136a12,12,0,0,0,0,24h64a12,12,0,0,0,12-12V40A12,12,0,0,0,200,28Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M200,40V216H40a16,16,0,0,1-16-16V56A16,16,0,0,1,40,40Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M141.66,133.66l-40,40a8,8,0,0,1-11.32-11.32L116.69,136H24a8,8,0,0,1,0-16h92.69L90.34,93.66a8,8,0,0,1,11.32-11.32l40,40A8,8,0,0,1,141.66,133.66ZM200,32H136a8,8,0,0,0,0,16h56V208H136a8,8,0,0,0,0,16h64a8,8,0,0,0,8-8V40A8,8,0,0,0,200,32Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M141.66,133.66l-40,40A8,8,0,0,1,88,168V136H24a8,8,0,0,1,0-16H88V88a8,8,0,0,1,13.66-5.66l40,40A8,8,0,0,1,141.66,133.66ZM200,32H136a8,8,0,0,0,0,16h56V208H136a8,8,0,0,0,0,16h64a8,8,0,0,0,8-8V40A8,8,0,0,0,200,32Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M140.24,132.24l-40,40a6,6,0,0,1-8.48-8.48L121.51,134H24a6,6,0,0,1,0-12h97.51L91.76,92.24a6,6,0,0,1,8.48-8.48l40,40A6,6,0,0,1,140.24,132.24ZM200,34H136a6,6,0,0,0,0,12h58V210H136a6,6,0,0,0,0,12h64a6,6,0,0,0,6-6V40A6,6,0,0,0,200,34Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M141.66,133.66l-40,40a8,8,0,0,1-11.32-11.32L116.69,136H24a8,8,0,0,1,0-16h92.69L90.34,93.66a8,8,0,0,1,11.32-11.32l40,40A8,8,0,0,1,141.66,133.66ZM200,32H136a8,8,0,0,0,0,16h56V208H136a8,8,0,0,0,0,16h64a8,8,0,0,0,8-8V40A8,8,0,0,0,200,32Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M138.83,130.83l-40,40a4,4,0,0,1-5.66-5.66L126.34,132H24a4,4,0,0,1,0-8H126.34L93.17,90.83a4,4,0,0,1,5.66-5.66l40,40A4,4,0,0,1,138.83,130.83ZM200,36H136a4,4,0,0,0,0,8h60V212H136a4,4,0,0,0,0,8h64a4,4,0,0,0,4-4V40A4,4,0,0,0,200,36Z`}))]]),Oe=new Map([[`bold`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M200,36H56A20,20,0,0,0,36,56V200a20,20,0,0,0,20,20H200a20,20,0,0,0,20-20V56A20,20,0,0,0,200,36Zm-4,160H60V60H196Z`}))],[`duotone`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M208,56V200a8,8,0,0,1-8,8H56a8,8,0,0,1-8-8V56a8,8,0,0,1,8-8H200A8,8,0,0,1,208,56Z`,opacity:`0.2`}),x.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`fill`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M216,56V200a16,16,0,0,1-16,16H56a16,16,0,0,1-16-16V56A16,16,0,0,1,56,40H200A16,16,0,0,1,216,56Z`}))],[`light`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M200,42H56A14,14,0,0,0,42,56V200a14,14,0,0,0,14,14H200a14,14,0,0,0,14-14V56A14,14,0,0,0,200,42Zm2,158a2,2,0,0,1-2,2H56a2,2,0,0,1-2-2V56a2,2,0,0,1,2-2H200a2,2,0,0,1,2,2Z`}))],[`regular`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M200,40H56A16,16,0,0,0,40,56V200a16,16,0,0,0,16,16H200a16,16,0,0,0,16-16V56A16,16,0,0,0,200,40Zm0,160H56V56H200V200Z`}))],[`thin`,x.createElement(x.Fragment,null,x.createElement(`path`,{d:`M200,44H56A12,12,0,0,0,44,56V200a12,12,0,0,0,12,12H200a12,12,0,0,0,12-12V56A12,12,0,0,0,200,44Zm4,156a4,4,0,0,1-4,4H56a4,4,0,0,1-4-4V56a4,4,0,0,1,4-4H200a4,4,0,0,1,4,4Z`}))]]),S=x.forwardRef((e,n)=>x.createElement(t,{ref:n,...e,weights:Ce}));S.displayName=`ChecksIcon`;var C=x.forwardRef((e,n)=>x.createElement(t,{ref:n,...e,weights:we}));C.displayName=`CircleIcon`;var w=x.forwardRef((e,n)=>x.createElement(t,{ref:n,...e,weights:Te}));w.displayName=`FileTextIcon`;var T=x.forwardRef((e,n)=>x.createElement(t,{ref:n,...e,weights:Ee}));T.displayName=`ShieldWarningIcon`;var E=x.forwardRef((e,n)=>x.createElement(t,{ref:n,...e,weights:De}));E.displayName=`SignInIcon`;var D=x.forwardRef((e,n)=>x.createElement(t,{ref:n,...e,weights:Oe}));D.displayName=`StopIcon`;var O=ce(),k=`Tabs`,[ke,Ae]=l(k,[v]),A=v(),[je,j]=ke(k),M=x.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,onValueChange:i,defaultValue:o,orientation:c=`horizontal`,dir:l,activationMode:u=`automatic`,...f}=e,p=ie(l),[m,h]=s({prop:r,onChange:i,defaultProp:o??``,caller:k});return(0,O.jsx)(je,{scope:n,baseId:a(),value:m,onValueChange:h,orientation:c,dir:p,activationMode:u,children:(0,O.jsx)(d.div,{dir:p,"data-orientation":c,...f,ref:t})})});M.displayName=k;var N=`TabsList`,P=x.forwardRef((e,t)=>{let{__scopeTabs:n,loop:r=!0,...i}=e,a=j(N,n),o=A(n);return(0,O.jsx)(ne,{asChild:!0,...o,orientation:a.orientation,dir:a.dir,loop:r,children:(0,O.jsx)(d.div,{role:`tablist`,"aria-orientation":a.orientation,...i,ref:t})})});P.displayName=N;var F=`TabsTrigger`,I=x.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,disabled:i=!1,...a}=e,s=j(F,n),c=A(n),l=z(s.baseId,r),u=B(s.baseId,r),f=r===s.value;return(0,O.jsx)(te,{asChild:!0,...c,focusable:!i,active:f,children:(0,O.jsx)(d.button,{type:`button`,role:`tab`,"aria-selected":f,"aria-controls":u,"data-state":f?`active`:`inactive`,"data-disabled":i?``:void 0,disabled:i,id:l,...a,ref:t,onMouseDown:o(e.onMouseDown,e=>{!i&&e.button===0&&e.ctrlKey===!1?s.onValueChange(r):e.preventDefault()}),onKeyDown:o(e.onKeyDown,e=>{[` `,`Enter`].includes(e.key)&&s.onValueChange(r)}),onFocus:o(e.onFocus,()=>{let e=s.activationMode!==`manual`;!f&&!i&&e&&s.onValueChange(r)})})})});I.displayName=F;var L=`TabsContent`,R=x.forwardRef((e,t)=>{let{__scopeTabs:n,value:r,forceMount:i,children:a,...o}=e,s=j(L,n),l=z(s.baseId,r),u=B(s.baseId,r),f=r===s.value,p=x.useRef(f);return x.useEffect(()=>{let e=requestAnimationFrame(()=>p.current=!1);return()=>cancelAnimationFrame(e)},[]),(0,O.jsx)(c,{present:i||f,children:({present:n})=>(0,O.jsx)(d.div,{"data-state":f?`active`:`inactive`,"data-orientation":s.orientation,role:`tabpanel`,"aria-labelledby":l,hidden:!n,id:u,tabIndex:0,...o,ref:t,style:{...e.style,animationDuration:p.current?`0s`:void 0},children:n&&a})})});R.displayName=L;function z(e,t){return`${e}-trigger-${t}`}function B(e,t){return`${e}-content-${t}`}var Me=M,Ne=P,Pe=I,Fe=R;function Ie({value:e,onValueChange:t,onSend:r,onEnter:a,onStop:o,busy:s,canSend:c,flat:l=!1,children:u,...d}){return(0,O.jsxs)(`div`,{className:n(`flex w-full items-end gap-1.5 py-1.5 pr-1.5`,!l&&`glass-surface rounded-surface has-[textarea:focus-visible]:border-ring/50 has-[textarea:focus-visible]:ring-ring/10 low-power:transition-none transition duration-(--duration-fast) ease-(--ease-standard) has-[textarea:focus-visible]:ring-3 motion-reduce:transition-none`,u?`pl-1.5`:`pl-3`),children:[u,(0,O.jsx)(de,{rows:1,"aria-label":`Message`,...d,value:e,onChange:e=>t(e.target.value,e.target.selectionStart??e.target.value.length),onKeyDown:e=>{e.key!==`Enter`||e.shiftKey||e.nativeEvent.isComposing||e.keyCode===229||(e.preventDefault(),(a??r)())},className:`max-h-40 min-h-7 px-0 py-1`}),s&&o?(0,O.jsx)(i,{size:`icon-sm`,variant:`ghost`,"aria-label":`Stop`,onClick:o,children:(0,O.jsx)(D,{weight:`fill`,className:`size-3.5`})}):(0,O.jsx)(i,{size:`icon-sm`,variant:c?`default`:`ghost`,"aria-label":`Send`,disabled:!c,onClick:r,children:(0,O.jsx)(me,{weight:`bold`,className:`size-4`})})]})}function Le({message:e,detail:t,onRetry:n,retryDisabled:r}){return(0,O.jsxs)(`div`,{role:`alert`,className:`bg-destructive-soft rounded-surface flex items-center justify-between gap-3 px-3 py-2 text-sm`,children:[(0,O.jsxs)(`span`,{className:`text-destructive flex min-w-0 items-start gap-1.5`,children:[(0,O.jsx)(Se,{weight:`fill`,className:`mt-0.5 size-4 shrink-0`}),(0,O.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-0.5`,children:[(0,O.jsx)(`span`,{children:e}),t?(0,O.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:t}):null]})]}),(0,O.jsxs)(i,{size:`sm`,variant:`outline`,onClick:n,disabled:r,children:[(0,O.jsx)(ue,{className:`size-3.5`}),`Retry`]})]})}function Re({label:e,thinking:t}){return(0,O.jsx)(`output`,{className:`text-muted-foreground flex items-center gap-2 self-start py-1 empty:absolute empty:p-0`,children:t?(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(g,{role:`presentation`,"aria-hidden":!0}),(0,O.jsx)(`span`,{className:`text-shimmer text-xs font-medium`,children:e})]}):null})}function V({children:e,className:t}){return(0,O.jsx)(he,{className:n(`text-foreground min-w-0 text-sm leading-relaxed`,t),children:e})}function ze({icon:e,children:t,title:r,failed:i=!1}){return(0,O.jsxs)(`div`,{title:r,className:n(`bg-background rounded-chip border-edge flex h-6 max-w-full items-center gap-1.5 self-start border px-1.5 text-xs`,i?`text-destructive`:`text-muted-foreground`),children:[(0,O.jsx)(`span`,{className:`flex shrink-0 items-center`,children:e}),(0,O.jsx)(`span`,{className:`min-w-0 truncate`,children:t})]})}function Be({children:e,className:t}){return(0,O.jsx)(`div`,{className:n(`bg-secondary text-secondary-foreground rounded-surface ml-auto max-w-4/5 px-4 py-2.5 text-sm wrap-break-word whitespace-pre-wrap`,t),children:e})}var Ve=e=>{if(e.kind===`selection`){if(e.path){let t=e.startLine&&e.endLine&&e.endLine!==e.startLine?`:${e.startLine}-${e.endLine}`:e.startLine?`:${e.startLine}`:``;return`${e.path}${t}`}return e.label??`Selected context`}if(e.kind===`file`)return e.path;if(e.kind===`symbol`)return`${e.name} - ${e.path}`;if(e.kind===`pr-description`)return`PR #${e.prNumber}`;if(e.kind===`check`)return e.name;let t=e.path?` - ${e.path}${e.line?`:${e.line}`:``}`:``;return`${e.author}${t}`},He=e=>e.kind===`selection`||e.kind===`symbol`?(0,O.jsx)(fe,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`file`?(0,O.jsx)(w,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`pr-description`?(0,O.jsx)(ye,{className:`text-muted-foreground size-3.5 shrink-0`}):e.kind===`check`?(0,O.jsx)(S,{className:`text-muted-foreground size-3.5 shrink-0`}):(0,O.jsx)(h,{className:`text-muted-foreground size-3.5 shrink-0`}),H=({item:e,onRemove:t})=>{let n=Ve(e),r=(0,O.jsxs)(`span`,{className:`bg-background border-edge text-foreground inline-flex max-w-full items-center gap-1.5 rounded-md border px-2 py-1 text-xs`,title:n,children:[He(e),(0,O.jsx)(`span`,{className:`text-muted-foreground`,children:`@`}),(0,O.jsx)(`span`,{className:`truncate`,children:n}),t?(0,O.jsx)(i,{variant:`ghost`,size:`icon-xs`,"aria-label":`Remove ${n}`,onClick:()=>t(e.id),children:(0,O.jsx)(u,{className:`size-3`})}):null]});return e.kind===`selection`?(0,O.jsxs)(ee,{openDelay:150,children:[(0,O.jsx)(oe,{asChild:!0,children:r}),(0,O.jsx)(re,{className:`w-96 p-0`,children:(0,O.jsx)(`pre`,{className:`max-h-64 overflow-auto p-3 font-mono text-xs whitespace-pre-wrap`,children:e.text})})]}):r},U=({message:e,assistantName:t=`Glen`})=>(0,O.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-sm`,children:[(0,O.jsx)(`div`,{className:e.role===`user`?`text-muted-foreground self-end text-xs font-medium`:`text-muted-foreground text-xs font-medium`,children:e.role===`user`?`You`:t}),e.role===`user`&&e.metadata?.contextItems&&e.metadata.contextItems.length>0?(0,O.jsx)(`div`,{className:`flex max-w-5/6 flex-wrap justify-end gap-1.5 self-end`,children:e.metadata.contextItems.map(e=>(0,O.jsx)(H,{item:e},e.id))}):null,e.parts.map((t,n)=>t.type===`text`?e.role===`user`?(0,O.jsx)(Be,{className:`max-w-5/6`,children:t.text},`${t.type}-${n}`):(0,O.jsx)(V,{children:t.text},`${t.type}-${n}`):null)]}),W=({agent:e,label:t,onSignIn:n})=>(0,O.jsxs)(i,{size:`sm`,variant:`outline`,onClick:()=>n(e,t),children:[(0,O.jsx)(E,{}),`Sign in to `,t]}),Ue=e=>e===`completed`?(0,O.jsx)(m,{className:`size-3.5`}):e===`failed`?(0,O.jsx)(ve,{className:`size-3.5`}):(0,O.jsx)(g,{className:`size-3`}),We=({chatId:e,row:t})=>{let n=f({mutationFn:n=>_.local.agent.answerPermission.mutate({chatId:e,requestId:t.id.replace(/^permission:/,``),optionId:n}),onError:e=>y.error(e.message)}),r=t.options.filter(e=>e.kind.endsWith(`_once`)),a=t.answer===void 0?null:t.options.find(e=>e.optionId===t.answer)?.name??`Cancelled`;return(0,O.jsxs)(ae,{className:`gap-2 p-3 text-sm`,children:[(0,O.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,O.jsx)(T,{className:`text-muted-foreground mt-0.5 size-4 shrink-0`}),(0,O.jsx)(`span`,{className:`min-w-0 break-words`,children:t.title})]}),a?(0,O.jsx)(`span`,{className:`text-muted-foreground text-xs`,children:a}):(0,O.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:(r.length>0?r:t.options).map(e=>(0,O.jsxs)(i,{size:`sm`,variant:e.kind.startsWith(`allow`)?`outline`:`destructive`,disabled:n.isPending,onClick:()=>n.mutate(e.optionId),children:[n.isPending&&n.variables===e.optionId?(0,O.jsx)(g,{}):null,e.name]},e.optionId))})]})},Ge=({chatId:e,agent:t,label:n,row:r,onSignIn:i})=>r.type===`user`?(0,O.jsx)(U,{message:{id:r.id,role:`user`,parts:[{type:`text`,text:r.text}],metadata:{contextItems:r.contextItems}}}):r.type===`assistant`?(0,O.jsx)(U,{assistantName:n,message:{id:r.id,role:`assistant`,parts:[{type:`text`,text:r.text}]}}):r.type===`thought`?(0,O.jsx)(`div`,{className:`text-muted-foreground text-xs`,children:(0,O.jsxs)(be,{children:[(0,O.jsxs)(xe,{className:`group flex items-center gap-1`,children:[(0,O.jsx)(se,{className:`size-3 transition-transform group-data-[state=open]:rotate-90`}),`Thinking`]}),(0,O.jsx)(_e,{className:`pt-1 pl-4 whitespace-pre-wrap`,children:r.text})]})}):r.type===`tool`?(0,O.jsx)(ze,{icon:Ue(r.status),title:r.title??`Tool call`,failed:r.status===`failed`,children:r.title??`Tool call`}):r.type===`plan`?(0,O.jsx)(`ul`,{className:`text-muted-foreground flex flex-col gap-1 text-xs`,children:r.entries.map(e=>(0,O.jsxs)(`li`,{className:`flex items-start gap-1.5`,children:[e.status===`completed`?(0,O.jsx)(m,{className:`mt-0.5 size-3.5 shrink-0`}):(0,O.jsx)(C,{className:`mt-0.5 size-3.5 shrink-0`}),(0,O.jsx)(`span`,{children:e.content})]},e.content))}):r.type===`permission`?(0,O.jsx)(We,{chatId:e,row:r}):(0,O.jsxs)(`div`,{className:`flex flex-col items-start gap-2`,children:[(0,O.jsx)(V,{className:`text-destructive`,children:r.message}),r.signIn?(0,O.jsx)(W,{agent:t,label:n,onSignIn:i}):null]}),G=({addon:e,label:t,status:n,onSettled:r})=>{let a=f({mutationFn:()=>_.local.addon.install.mutate({addon:e}),onSettled:r,onError:e=>y.error(e.message)}),o=a.isPending||n.state===`installing`;return(0,O.jsxs)(i,{size:`sm`,variant:`outline`,disabled:o,onClick:()=>a.mutate(),children:[o?(0,O.jsx)(g,{}):(0,O.jsx)(pe,{}),o?`Installing ${t} (about ${n.sizeMb} MB)…`:`Install ${t} (about ${n.sizeMb} MB)`]})},Ke=({agents:e,onSettled:t,onSignIn:n})=>(0,O.jsx)(p,{variant:`quiet`,size:`sm`,title:`Set up an agent`,description:`Agents install the first time you use them. Pick one to ask about this pull request.`,action:(0,O.jsxs)(`div`,{className:`flex flex-col items-center gap-2 text-xs`,children:[(0,O.jsx)(`div`,{className:`flex flex-wrap items-center justify-center gap-2`,children:e.map(e=>e.install.state===`installed`?(0,O.jsxs)(`div`,{className:`flex flex-col items-center gap-1.5`,children:[(0,O.jsx)(`span`,{children:e.reason}),e.signIn?(0,O.jsx)(W,{agent:e.id,label:e.label,onSignIn:n}):null]},e.id):(0,O.jsxs)(`div`,{className:`flex flex-col items-center gap-1`,children:[(0,O.jsx)(G,{addon:e.id,label:e.label,status:e.install,onSettled:t}),e.install.error&&e.install.state===`missing`?(0,O.jsx)(`span`,{className:`text-destructive max-w-64 text-center`,children:e.install.error}):null]},e.id))}),(0,O.jsx)(i,{size:`sm`,variant:`ghost`,onClick:t,children:`Check again`})]})});function K({className:e,orientation:t=`horizontal`,...r}){return(0,O.jsx)(Me,{"data-slot":`tabs`,"data-orientation":t,className:n(`group/tabs flex gap-2 data-horizontal:flex-col`,e),...r})}var qe=r(`group/tabs-list inline-flex w-fit items-center justify-center rounded-control p-[3px] text-muted-foreground group-data-horizontal/tabs:h-8 group-data-vertical/tabs:h-fit group-data-vertical/tabs:flex-col data-[variant=line]:rounded-none`,{variants:{variant:{default:`bg-muted`,line:`gap-1 bg-transparent`}},defaultVariants:{variant:`default`}});function q({className:e,variant:t=`default`,...r}){return(0,O.jsx)(Ne,{"data-slot":`tabs-list`,"data-variant":t,className:n(qe({variant:t}),e),...r})}function J({className:e,...t}){return(0,O.jsx)(Pe,{"data-slot":`tabs-trigger`,className:n(`relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 rounded-control border border-transparent px-1.5 py-0.5 text-sm font-medium whitespace-nowrap text-foreground/60 transition-colors duration-(--duration-fast) motion-reduce:transition-none low-power:transition-none group-data-vertical/tabs:w-full group-data-vertical/tabs:justify-start hover:text-foreground not-data-active:hover:bg-hover-tint focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50 has-data-[icon=inline-end]:pr-1 has-data-[icon=inline-start]:pl-1 dark:text-muted-foreground dark:hover:text-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,`group-data-[variant=line]/tabs-list:bg-transparent group-data-[variant=line]/tabs-list:hover:bg-transparent group-data-[variant=line]/tabs-list:data-active:bg-transparent group-data-[variant=line]/tabs-list:data-active:border-transparent dark:group-data-[variant=line]/tabs-list:data-active:bg-transparent`,`data-active:border-edge-strong data-active:bg-background data-active:text-foreground dark:data-active:bg-glass dark:data-active:text-foreground`,`after:absolute after:bg-foreground after:opacity-0 after:transition-opacity motion-reduce:after:transition-none low-power:after:transition-none group-data-horizontal/tabs:after:inset-x-0 group-data-horizontal/tabs:after:bottom-[-5px] group-data-horizontal/tabs:after:h-0.5 group-data-vertical/tabs:after:inset-y-0 group-data-vertical/tabs:after:-right-1 group-data-vertical/tabs:after:w-0.5 group-data-[variant=line]/tabs-list:data-active:after:opacity-100`,e),...t})}function Je({className:e,...t}){return(0,O.jsx)(Fe,{"data-slot":`tabs-content`,className:n(`flex-1 text-sm outline-none`,e),...t})}var Ye={claude:`M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 0 1-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z`,codex:`M8.086.457a6.105 6.105 0 013.046-.415c1.333.153 2.521.72 3.564 1.7a.117.117 0 00.107.029c1.408-.346 2.762-.224 4.061.366l.063.03.154.076c1.357.703 2.33 1.77 2.918 3.198.278.679.418 1.388.421 2.126a5.655 5.655 0 01-.18 1.631.167.167 0 00.04.155 5.982 5.982 0 011.578 2.891c.385 1.901-.01 3.615-1.183 5.14l-.182.22a6.063 6.063 0 01-2.934 1.851.162.162 0 00-.108.102c-.255.736-.511 1.364-.987 1.992-1.199 1.582-2.962 2.462-4.948 2.451-1.583-.008-2.986-.587-4.21-1.736a.145.145 0 00-.14-.032c-.518.167-1.04.191-1.604.185a5.924 5.924 0 01-2.595-.622 6.058 6.058 0 01-2.146-1.781c-.203-.269-.404-.522-.551-.821a7.74 7.74 0 01-.495-1.283 6.11 6.11 0 01-.017-3.064.166.166 0 00.008-.074.115.115 0 00-.037-.064 5.958 5.958 0 01-1.38-2.202 5.196 5.196 0 01-.333-1.589 6.915 6.915 0 01.188-2.132c.45-1.484 1.309-2.648 2.577-3.493.282-.188.55-.334.802-.438.286-.12.573-.22.861-.304a.129.129 0 00.087-.087A6.016 6.016 0 015.635 2.31C6.315 1.464 7.132.846 8.086.457zm-.804 7.85a.848.848 0 00-1.473.842l1.694 2.965-1.688 2.848a.849.849 0 001.46.864l1.94-3.272a.849.849 0 00.007-.854l-1.94-3.393zm5.446 6.24a.849.849 0 000 1.695h4.848a.849.849 0 000-1.696h-4.848z`},Y=({agent:e,className:t})=>(0,O.jsx)(`svg`,{viewBox:`0 0 24 24`,"aria-hidden":`true`,className:n(`size-4 shrink-0`,t),children:(0,O.jsx)(`path`,{d:Ye[e],fill:`currentColor`,fillRule:e===`codex`?`evenodd`:`nonzero`})}),Xe=({agents:e,value:t,onValueChange:r,compact:i=!1,disabled:a=!1})=>(0,O.jsx)(K,{value:t,onValueChange:e=>r(e===`codex`?`codex`:`claude`),className:`shrink-0`,children:(0,O.jsx)(q,{"aria-label":`Agent to ask`,className:n(i&&`group-data-horizontal/tabs:h-6`),children:e.map(e=>(0,O.jsxs)(J,{value:e.id,disabled:a,"aria-label":e.label,title:e.available?e.label:e.reason??e.label,className:n(i&&`gap-1 px-1 text-xs`),children:[(0,O.jsx)(Y,{agent:e.id,className:n(i&&`size-3.5`)}),(0,O.jsx)(`span`,{className:`hidden @md:inline`,children:e.label})]},e.id))})}),Ze=({chatId:e,queue:t})=>{let n=f({mutationFn:t=>_.local.agent.unqueue.mutate({chatId:e,id:t}),onError:e=>y.error(e.message)});return t.length===0?null:(0,O.jsx)(`ul`,{className:`flex flex-col gap-1`,"aria-label":`Queued messages`,children:t.map(e=>(0,O.jsxs)(`li`,{className:`text-muted-foreground flex items-center gap-2 text-xs`,children:[(0,O.jsx)(ge,{className:`size-3.5 shrink-0`}),(0,O.jsx)(`span`,{className:`shrink-0`,children:`Queued`}),(0,O.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.text}),(0,O.jsx)(i,{size:`icon-xs`,variant:`ghost`,"aria-label":`Remove from queue`,disabled:n.isPending,onClick:()=>n.mutate(e.id),children:n.isPending&&n.variables===e.id?(0,O.jsx)(g,{}):(0,O.jsx)(u,{})})]},e.id))})},X={status:`idle`,reason:null,signIn:!1,busy:!1,rows:[],queue:[]},Z=(e,t,n,r)=>{let i=e.at(-1);return i?.type===t?[...e.slice(0,-1),{...i,text:i.text+r}]:[...e,{type:t,id:n,text:r}]},Qe=(e,t)=>e.some(e=>e.id===t.id)?e.map(e=>e.id===t.id?{...e,...t}:e):[...e,t],Q={initial:X,reduce:(e,t,n)=>{if(t.kind===`reset`)return X;if(t.kind===`status`)return{...e,status:t.status,reason:t.reason??null,signIn:t.signIn??!1,busy:t.status===`busy`?!0:t.status===`starting`||t.status===`ready`?e.busy:!1};if(t.kind===`user`)return{...e,busy:!0,queue:e.queue.filter(e=>e.id!==t.id),rows:[...e.rows,{type:`user`,id:t.id,text:t.text,contextItems:t.contextItems}]};if(t.kind===`queued`){let{kind:n,...r}=t;return{...e,queue:[...e.queue,r]}}if(t.kind===`unqueued`)return{...e,queue:e.queue.filter(e=>e.id!==t.id)};if(t.kind===`text`)return{...e,rows:Z(e.rows,`assistant`,n,t.text)};if(t.kind===`thought`)return{...e,rows:Z(e.rows,`thought`,n,t.text)};if(t.kind===`tool`){let{kind:n,toolCallId:r,...i}=t;return{...e,rows:Qe(e.rows,{type:`tool`,id:`tool:${r}`,...i})}}if(t.kind===`plan`){let r=e.rows.findLastIndex(e=>e.type===`user`),i=e.rows.findLastIndex((e,t)=>e.type===`plan`&&t>r),a={type:`plan`,id:i>=0?e.rows[i]?.id??n:n,entries:t.entries};return{...e,rows:i>=0?Qe(e.rows,a):[...e.rows,a]}}return t.kind===`permission`?{...e,rows:[...e.rows,{type:`permission`,id:`permission:${t.requestId}`,title:t.title,options:t.options,answer:void 0}]}:t.kind===`permission-answered`?{...e,rows:e.rows.map(e=>e.id===`permission:${t.requestId}`&&e.type===`permission`?{...e,answer:t.optionId}:e)}:t.kind===`turn-end`?{...e,busy:!1}:{...e,busy:!1,rows:[...e.rows,{type:`error`,id:n,message:t.message,signIn:t.signIn??!1}]}}},$e=e=>{let t={view:Q.initial,connection:null,listeners:new Set,epoch:b.getSnapshot().epoch},n=()=>t.listeners.forEach(e=>e()),r=e=>{t.view={...t.view,busy:!1,rows:[...t.view.rows,{type:`error`,id:`stream:${Date.now()}`,message:e,signIn:!1}]},n()},i=()=>_.local.agent.events.subscribe({chatId:e},{onData:({id:e,data:r})=>{t.view=Q.reduce(t.view,r,e),n()},onConnectionStateChange:e=>{e.state===`connecting`&&e.error&&b.check()},onError:e=>void b.check().then(t=>{t&&r(e.message)})});return b.subscribe(()=>{let{epoch:e}=b.getSnapshot();e!==t.epoch&&(t.epoch=e,t.connection&&(t.connection.unsubscribe(),t.view=Q.initial,t.connection=i(),n()))}),{getSnapshot:()=>t.view,subscribe:e=>(t.listeners.add(e),t.connection??=i(),()=>{t.listeners.delete(e),!(t.listeners.size>0)&&(t.connection?.unsubscribe(),t.connection=null,t.view=Q.initial)})}},$=new Map,et=e=>{let t=$.get(e);if(t)return t;let n=$e(e);return $.set(e,n),n},tt=2e3,nt=()=>({queryKey:[`local`,`agent`,`list`],queryFn:()=>_.local.agent.list.query(),refetchInterval:e=>e.state.data?.some(e=>e.install.state===`installing`)?tt:!1});export{Ie as _,Y as a,q as c,G as d,Ge as f,Le as g,Re as h,Xe as i,J as l,H as m,et as n,K as o,W as p,Ze as r,Je as s,nt as t,Ke as u,w as v,S as y};