@qodeca/xezar 0.11.0 → 0.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -18
- package/dist/core/provider-auth.js +23 -1
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/runs/task-refs.d.ts +8 -1
- package/dist/runs/task-refs.js +45 -10
- package/dist/runs/task-refs.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{compare-variants-Cp3Thwv2.js → compare-variants-et0mplGi.js} +1 -1
- package/web/dist/assets/{git-toolbar-BAZPUijR.js → git-toolbar-Q2kk2F7v.js} +1 -1
- package/web/dist/assets/{github-BBVKH-CW.js → github-DjEYCxwt.js} +1 -1
- package/web/dist/assets/index-Cz4GSAqV.js +7 -0
- package/web/dist/assets/{repo-git-C0lQ9_O3.js → repo-git-h1RFfly3.js} +1 -1
- package/web/dist/assets/{skills-BfcNlZEY.js → skills-BqAzyGS3.js} +1 -1
- package/web/dist/assets/{task-changes-DHpe4ZuJ.js → task-changes-DwXPFXqG.js} +1 -1
- package/web/dist/assets/{task-commits-DUWVyp0I.js → task-commits-Bessua-c.js} +1 -1
- package/web/dist/assets/{task-files-Do3S40OR.js → task-files-DxFIhRPP.js} +1 -1
- package/web/dist/assets/{task-thread-Bfyqqy-t.js → task-thread-Dhkupf1-.js} +1 -1
- package/web/dist/assets/thread-loading-ZhJref0J.js +1 -0
- package/web/dist/assets/{use-desktop-Cec0eUGX.js → use-desktop-Sr1QlxhT.js} +1 -1
- package/web/dist/assets/{workflows-CJ1FV1hP.js → workflows-9HC240Wx.js} +1 -1
- package/web/dist/index.html +2 -2
- package/web/dist/assets/index-GflrFgEB.js +0 -7
- package/web/dist/assets/thread-loading-GyH2Atwo.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,G as i,J as a,Jn as o,K as s,Rn as c,Rt as l,Ur as u,Vr as d,Vt as f,Wr as p,Wt as m,Xn as h,Y as g,Yn as _,Z as v,a as y,i as b,j as x,k as S,ni as C,nr as w,pr as ee,q as T,qn as te,qr as ne,t as E}from"./centered-state-B_V_Ai2h.js";import{n as D,r as O,t as k}from"./utils-Bb8ohcr3.js";import{t as A}from"./arrow-left-BJsIW6A0.js";import{C as j,S as re,b as ie,g as M,h as N,p as P,v as ae,x as oe,y as se}from"./new-task-form-BydHBbef.js";import{t as ce}from"./chevron-right-CFzn-von.js";import{b as F,x as le,y as ue}from"./dropdown-menu-Z80KMInL.js";import{C as de,S as fe,_ as I,a as pe,g as L,h as me,n as R,o as he,p as z,r as ge,u as B,v as V,y as H}from"./prompt-templates-B7Fs2b1S.js";import{t as _e}from"./refresh-cw-DGliez3E.js";import{t as U}from"./sparkles-B8agSxBZ.js";import{t as ve}from"./triangle-alert-D5tJwRD2.js";import{n as ye,t as W}from"./textarea--cpYshee.js";import{a as be,c as G,l as xe,n as K,o as Se,r as q,s as Ce,t as J}from"./use-submit-shortcut-JY8M_MPL.js";import{r as we,t as Y}from"./project-router-BbCzrHKs.js";import{r as X,t as Z}from"./markdown-5FuCZDA4.js";import{c as Te,d as Ee,f as De,i as Oe,s as ke,t as Ae,u as je}from"./skills-D4P-Hgey.js";import{_ as Me,d as Ne,f as Pe,h as Fe,l as Ie,p as Le,s as Re,u as ze}from"./index-GflrFgEB.js";import{t as Be}from"./diff-CbozNUJq.js";import{t as Ve}from"./tab-link-Cp2-CJS8.js";var He=O(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ue=O(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),We=O(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Q=e(t(),1),$=n();function Ge({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`skeleton`,className:k(`animate-pulse rounded-md bg-accent`,e),...t})}function Ke(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function qe(e,t=[]){let n=Ke(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Je(t)),n}function Je(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Ye(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function Xe(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Ze(e,t,n){let r=(n??``).trim();if(!r)return qe(e,t);let i=Ke(e),a=r.startsWith(i)?i+Ye(r.slice(i.length),e):Ye(r,e),o=Xe(a,e)?a:`${i}\n\n${a}`;return t.length?o+Je(t):o}function Qe(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function $e(e,t,n,r,i={}){return t?{...i,workflow:t,task:Ze(e,n,r)}:n.length?{...i,steps:Qe(n),task:Ze(e,[],r)}:{...i,workflow:`quick-task`,task:Ze(e,[],r)}}function et(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function tt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function nt(e,t){return e.trim()!==``&&t===0}function rt(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var it={workflow:null,skills:[]},at=`xez-followup-selection`;function ot(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function st(){try{let e=localStorage.getItem(at);return e?ot(JSON.parse(e)):{...it}}catch{return{...it}}}function ct(e){try{localStorage.setItem(at,JSON.stringify(e))}catch{}}var lt=`xez-followup-prompt:`;function ut(e){try{return localStorage.getItem(lt+e)??``}catch{return``}}function dt(e,t){try{t===``?localStorage.removeItem(lt+e):localStorage.setItem(lt+e,t)}catch{}}function ft({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:d,queuedRunId:p,onQueued:m}){let h=ne(),g=f(),_=e.kind===`pr`?`PR`:`issue`,v=o.filter(e=>n.some(t=>t.name===e)),[S]=(0,Q.useState)(()=>Ke(e)),[C,w]=(0,Q.useState)(()=>ut(e.url)||S),T=Pe(l),te=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{dt(e.url,C===S?``:C)},[e.url,C,S]);let E=(0,Q.useMemo)(()=>pe(g.data?.promptTemplates),[g.data?.promptTemplates]),D=e=>{let t=te.current,n=C===S?C.length:t?.selectionStart??C.length,r=ge(C,n,e);w(r.text),requestAnimationFrame(()=>{te.current?.focus(),te.current?.setSelectionRange(r.caret,r.caret)})},O=R(E,v),k=(0,Q.useRef)(C);k.current=C;let A=(0,Q.useRef)(``);(0,Q.useEffect)(()=>{let e=he(k.current,A.current,O,S);A.current=e.applied,e.text!==k.current&&w(e.text)},[O,S]);let j=u({mutationFn:async()=>T.canRun?c($e(e,i,v,C,Ne(T))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&m(e.url,n.id),b(`Added to the queue — ${_} #${e.number}`),v.length>0&&g.data!==void 0&&ee({skillUsage:v.reduce((e,t)=>Ae(e,t),g.data.skillUsage)}).then(()=>h.invalidateQueries({queryKey:x.uiState})).catch(()=>{}),dt(e.url,``),w(S),A.current=``,h.invalidateQueries({queryKey:x.runs.all})},onError:e=>b(e.message,{tone:`danger`})}),re=e=>{J({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!j.isPending&&T.canRun&&j.mutate())},ie=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,$.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,$.jsx)(ae,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(pt,{workflows:t,value:i,onChange:a}),(0,$.jsx)(mt,{skills:n,skillUsage:g.data?.skillUsage,selected:v,onToggle:ie}),(0,$.jsx)(ze,{pick:l,onChange:d,disabled:j.isPending||!T.canRun,accounts:!0}),!T.providerPending&&!T.canRun?(0,$.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[T.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,$.jsx)(Y,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,(0,$.jsx)(Ie,{templates:E,onInsert:D})]}),v.length>0?(0,$.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:v.map(e=>(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>ie(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,$.jsx)(ye,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,$.jsx)(W,{ref:te,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:C,onChange:e=>w(e.target.value),onKeyDown:re,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,$.jsxs)(y,{variant:`contrast`,"data-action":`gh-run`,disabled:j.isPending||!T.canRun,onClick:()=>j.mutate(),children:[(0,$.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,_]}),(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:K()}),p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,$.jsx)(r,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,$.jsx)(Y,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}function pt({workflows:e,value:t,onChange:n}){let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=(0,Q.useRef)(null),l=Ee(e,o);return(0,$.jsxs)(P,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:k(B,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,$.jsx)(Me,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,$.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,$.jsx)(j,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,$.jsx)(N,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(z,{shouldFilter:!1,children:[(0,$.jsx)(I,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,$.jsxs)(H,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,$.jsx)(me,{children:`Nothing matches.`}):null,(0,$.jsx)(L,{children:l.map(e=>{let i=t===e.name;return(0,$.jsxs)(V,{value:`workflow ${e.name}`,keywords:De(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(i?null:e.name),a(!1)},children:[(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,i?(0,$.jsx)(r,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function mt({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(null),{mostUsed:f,project:p,global:m}=Te(je(e,s,t),t),h=(e,t)=>{let a=n.includes(e.name);return(0,$.jsxs)(V,{value:`skill ${e.name} ${e.path}`,keywords:De(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,$.jsx)(`span`,{className:k(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,$.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,$.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,$.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Re,{skill:l,onClose:()=>u(null)}),(0,$.jsxs)(P,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:k(B,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,$.jsx)(U,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,$.jsx)(j,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,$.jsx)(N,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(z,{shouldFilter:!1,children:[(0,$.jsx)(I,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,$.jsxs)(H,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[f.length===0&&p.length===0&&m.length===0?(0,$.jsx)(me,{children:`Nothing matches.`}):null,f.length>0?(0,$.jsx)(L,{heading:`Most used`,children:f.map(e=>h(e,Oe(e)))}):null,p.length>0?(0,$.jsx)(L,{heading:`Project skills`,children:p.map(e=>h(e,!0))}):null,m.length>0?(0,$.jsx)(L,{heading:`Global`,children:m.map(e=>h(e,!1))}):null]})]})})]})]})}var ht=1e3,gt=100,_t=350;function vt(e,t){let[n,r]=(0,Q.useState)(e);return(0,Q.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function yt({view:e,changes:t=!1,index:n=!1}){let{n:r}=d(),a=i({limit:ht}),c=v().data?.capabilities?.automations===!0,p=a.data,h=r===void 0?null:Number.parseInt(r,10),_=(0,Q.useMemo)(()=>{if(!p?.available)return[];let t=new Set;e===`prs`&&h!==null&&Number.isInteger(h)&&t.add(h);for(let e of p.prs){if(t.size>=gt)break;t.add(e.number)}return[...t]},[p,e,h]),w=s(_,e===`prs`),T=w.data?.available?w.data.checks:void 0,D=ne(),O=e=>{D.setQueryData(x.uiState,t=>({...t,githubView:e})),ee({githubView:e}).then(e=>D.setQueryData(x.uiState,e)).catch(e=>{b(e instanceof Error?e.message:String(e),{tone:`danger`}),D.invalidateQueries({queryKey:x.uiState})})},A=(0,Q.useRef)(null),j=u({mutationFn:()=>te({refresh:!0,limit:ht}),onSuccess:e=>{D.setQueryData(x.github({limit:ht}),e),D.invalidateQueries({queryKey:x.githubChecks(_)});let t=A.current;if(!t){D.removeQueries({queryKey:[`github`,`comments`]});return}let n=x.githubComments(t.kind,t.number);o(t.kind,t.number,{refresh:!0}).then(e=>D.setQueryData(n,e)).catch(()=>{}),D.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==C(n)})},onError:e=>b(e.message,{tone:`danger`})}),re=m(),ie=l(),M=f(),[N,P]=(0,Q.useState)(()=>st().workflow),[ae,se]=(0,Q.useState)(()=>st().skills),[ce,F]=(0,Q.useState)({runner:null,model:null,account:null});(0,Q.useEffect)(()=>{ct({workflow:N,skills:[...ae]})},[N,ae]);let le=re.data?.workflows;(0,Q.useEffect)(()=>{le&&N!==null&&!le.some(e=>e.name===N)&&P(null)},[le,N]);let de=ie.data,I=M.data?.skillUsage,pe=(0,Q.useMemo)(()=>ke(de??[],I),[de,I]),[L,me]=(0,Q.useState)(new Map),[R,he]=(0,Q.useState)(``),[z,ge]=(0,Q.useState)([]),B=vt(R,_t),V=(0,Q.useMemo)(()=>p?.available?e===`issues`?p.issues:p.prs:[],[p,e]),H=nt(B,(0,Q.useMemo)(()=>tt(V,{query:B,labels:z}).length,[V,B,z])),U=g(e===`issues`?`issue`:`pr`,B,H);if(n&&M.data?.githubView===`prs`)return(0,$.jsx)(we,{to:`/github/prs`,replace:!0});if(!p)return a.isError?(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(E,{icon:(0,$.jsx)(ve,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:a.error.message})}):(0,$.jsx)(Le,{});if(A.current=null,!p.available)return(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(E,{icon:(0,$.jsx)(Fe,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:p.reason??`unknown reason`,actions:(0,$.jsx)(y,{variant:`outline`,"data-action":`gh-retry`,disabled:j.isPending,onClick:()=>j.mutate(),children:`Try again`}),children:(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in xezar works without it.`]})})});let ye=V,W=tt(ye,{query:R,labels:z}),be=R.trim()!==``||z.length>0,G=H&&U.data?.available?U.data:null,xe=new Set(W.map(e=>e.number)),K=G?tt(G.items,{labels:z}).filter(e=>!xe.has(e.number)):[],Se=R.trim()!==``&&R.trim()!==B.trim()||H&&U.isPending,q={...G?.labelColors??{},...p.labelColors??{}},Ce=et(ye),J=r===void 0?null:Number.parseInt(r,10),Z=J===null?W[0]??K[0]??null:ye.find(e=>e.number===J)??K.find(e=>e.number===J)??null;A.current=Z?{kind:Z.kind,number:Z.number}:null;let Te=e===`issues`?`/github`:`/github/prs`,Ee=H&&(U.data?.available===!1||U.isError),De=U.data?.available===!1?U.data.reason??`unknown reason`:U.error instanceof Error?U.error.message:`the search request failed`,Oe=be?Se?(0,$.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,R.trim(),`”…`]}):K.length>0?null:Ee?(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,De,`.`]}):G?(0,$.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,$.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,$.jsxs)(`section`,{"data-slot":`gh-list`,className:k(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,r===void 0?`flex`:`hidden`),children:[(0,$.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),p.repo?(0,$.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:p.repo}):null,c?(0,$.jsx)(Y,{to:`/automations/new`,className:`ml-auto shrink-0 text-[10px] font-medium text-primary hover:underline`,children:`Set up automations`}):null,(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:j.isPending,onClick:()=>j.mutate(),className:k(`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,!c&&`ml-auto`),children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:k(`size-[9px]`,j.isPending&&`motion-safe:animate-spin`)}),p.syncedAt?`synced ${X(p.syncedAt)} ago`:`refresh`]})]}),(0,$.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,$.jsxs)(Ve,{to:`/github`,active:e===`issues`,onClick:()=>O(`issues`),children:[`Issues · `,bt(p.issues.length)]}),(0,$.jsxs)(Ve,{to:`/github/prs`,active:e===`prs`,onClick:()=>O(`prs`),children:[`Pull requests · `,bt(p.prs.length)]})]}),(0,$.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,$.jsx)(fe,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,$.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:R,onChange:e=>he(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,$.jsx)(St,{options:Ce,colors:q,selected:z,onChange:ge})]})]}),W.length===0?Oe&&(0,$.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:Oe}):(0,$.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:W.map(t=>(0,$.jsx)(xt,{item:t,view:e,colors:q,active:Z?.url===t.url,queued:L.has(t.url),checks:t.kind===`pr`?T?.[t.number]??t.checks:t.checks},t.url))}),K.length>0?(0,$.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,$.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,G?.truncated?` (first matches)`:``]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:K.map(t=>(0,$.jsx)(xt,{item:t,view:e,colors:q,active:Z?.url===t.url,queued:L.has(t.url),checks:t.kind===`pr`?T?.[t.number]??t.checks:t.checks},t.url))})]}):null]}),(0,$.jsx)(`section`,{"data-slot":`gh-detail`,className:k(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,r===void 0?`hidden md:flex`:`flex`),children:Z?(0,$.jsx)(wt,{item:Z,listPath:Te,colors:q,changes:t,checks:Z.kind===`pr`?T?.[Z.number]??Z.checks:Z.checks,children:(0,$.jsx)(ft,{item:Z,workflows:re.data?.workflows??[],skills:pe,workflow:N,onWorkflowChange:P,selectedSkills:ae,onSkillsChange:se,engine:ce,onEngineChange:F,queuedRunId:L.get(Z.url)??null,onQueued:(e,t)=>me(n=>new Map(n).set(e,t))},Z.url)}):(0,$.jsx)(E,{icon:e===`issues`?(0,$.jsx)(oe,{}):(0,$.jsx)(ue,{}),tone:`neutral`,heading:`h2`,title:J===null?`Nothing selected`:`Not found`,subtitle:J===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${J} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${J} above to look it up on GitHub, closed and merged included.`})})]})}function bt(e){return`${e}${e>=ht?`+`:``}`}function xt({item:e,view:t,colors:n,active:r,queued:i,checks:a}){let s=e.kind===`issue`?oe:ue,c=ne(),l=()=>{c.prefetchQuery({queryKey:x.githubComments(e.kind,e.number),queryFn:({signal:t})=>o(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,$.jsx)(`li`,{children:(0,$.jsxs)(Y,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,qe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:l,onFocus:l,"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:k(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(s,{"aria-hidden":`true`,className:k(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,$.jsx)(`span`,{className:k(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,$.jsx)(`span`,{children:X(e.createdAt)}),(0,$.jsx)(Ht,{count:e.comments}),a?(0,$.jsx)(Wt,{checks:a}):null,i?(0,$.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,$.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,$.jsx)(Ct,{label:e,color:n[e]},e))}):null]})})}function St({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,Q.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,$.jsxs)(P,{open:a,onOpenChange:o,children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:k(`flex shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,$.jsx)(We,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,$.jsx)(N,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,$.jsxs)(z,{children:[(0,$.jsx)(I,{placeholder:`Filter labels…`}),(0,$.jsxs)(H,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,$.jsx)(me,{children:`No labels.`}),n.length>0?(0,$.jsxs)(V,{value:`__clear__`,onSelect:()=>i([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let i=n.includes(e);return(0,$.jsxs)(V,{value:e,onSelect:()=>s(e),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:rt(t[e])}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),i?(0,$.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function Ct({label:e,color:t}){return(0,$.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:rt(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function wt({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,$.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,$.jsxs)(Y,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,$.jsx)(A,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,$.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,$.jsx)(`span`,{children:o}),`·`,(0,$.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,$.jsxs)(`span`,{children:[X(e.createdAt),` ago`]}),e.comments?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsx)(Ht,{count:e.comments})]}):null,s?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,D(e.url)?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,$.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,$.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.kind===`pr`?(0,$.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,$.jsx)(Ve,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,$.jsx)(Ve,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,$.jsx)(Ct,{label:e,color:n[e]},e)),a?(0,$.jsx)(Ut,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,$.jsx)(Ot,{item:e}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,$.jsx)(Z,{children:e.body}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,$.jsx)(kt,{item:e,colors:n}),e.kind===`pr`?(0,$.jsx)(Dt,{number:e.number}):null,r]})]})}var Tt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Et({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,$.jsx)(re,{"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:k(t,`text-success`)}):e===`failing`?(0,$.jsx)(ie,{"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:k(t,`text-danger`)}):e===`pending`?(0,$.jsx)(S,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:k(t,`animate-spin text-warning`)}):(0,$.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:k(t,`text-soft-foreground`)})}function Dt({number:e}){let t=ne(),n=p({queryKey:x.githubMergeState(e),queryFn:({signal:t})=>h(e,{},{signal:t}),retry:!1}),i=n.data?.available?n.data.mergeState:null,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),[l,d]=(0,Q.useState)(!1),f=u({mutationFn:()=>h(e,{refresh:!0}),onSuccess:n=>t.setQueryData(x.githubMergeState(e),n),onError:e=>b(e instanceof Error?e.message:String(e),{tone:`danger`})}),m=a&&i?.methods.includes(a)?a:i?.defaultMethod??i?.methods[0]??null,g=u({mutationFn:()=>{if(!i||!m)throw Error(`No merge method is available.`);return w(e,{method:m,expectedHeadSha:i.headSha,...l&&i.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{c(!1),b(`Pull request #${e} merged`),t.invalidateQueries({queryKey:x.githubMergeState(e)}),t.invalidateQueries({queryKey:x.github({limit:ht})}),t.invalidateQueries({queryKey:x.githubComments(`pr`,e)})},onError:n=>{b(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:x.githubMergeState(e)})}});if(n.isPending)return(0,$.jsx)(Ge,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!i)return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:n.data?.available===!1?n.data.reason:`GitHub could not load merge requirements.`})]});let _=i.state===`merged`?`Merged`:i.state===`closed`?`Closed`:i.isDraft?`Draft`:i.mergeable===`conflicting`?`Conflicts must be resolved`:i.canMerge?`Ready to merge`:`Merge blocked`,v=i.reviewDecision===`approved`?`passing`:i.reviewDecision===`unknown`?`unknown`:`failing`,S=i.mergeable===`mergeable`?`passing`:i.mergeable===`conflicting`?`failing`:`unknown`,C=!!(m&&(i.canMerge||i.canOverride&&l));return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-box`,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i.canMerge?(0,$.jsx)(r,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,$.jsx)(ve,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:_}),(0,$.jsxs)(y,{type:`button`,variant:`ghost`,size:`sm`,disabled:f.isPending,onClick:()=>f.mutate(),children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:k(`size-3.5`,f.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,$.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[i.headRef,` (`,i.headSha.slice(0,7),`) → `,i.baseRef]}),(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Et,{state:v}),(0,$.jsxs)(`span`,{children:[`Reviews: `,i.reviewDecision.replaceAll(`-`,` `)]})]}),(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Et,{state:S}),(0,$.jsxs)(`span`,{children:[`Conflicts: `,i.mergeable===`conflicting`?`present`:i.mergeable===`mergeable`?`none`:`unknown`]})]}),i.checks.length===0?(0,$.jsx)(`li`,{children:`No checks configured`}):i.checks.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Et,{state:e.state}),(0,$.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&D(e.url)?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),i.blockers.map(e=>(0,$.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),i.canOverride?(0,$.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,i.state===`open`&&i.methods.length>0?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(`select`,{"aria-label":`Merge method`,value:m??``,onChange:e=>o(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:i.methods.map(e=>(0,$.jsx)(`option`,{value:e,children:Tt[e]},e))}),(0,$.jsx)(y,{disabled:!C,onClick:()=>c(!0),children:m?Tt[m]:`Merge`})]}):null]})]}),(0,$.jsx)(q,{open:s,onOpenChange:c,children:(0,$.jsxs)(be,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,$.jsxs)(G,{children:[(0,$.jsxs)(xe,{children:[m?Tt[m]:`Merge`,` pull request #`,e,`?`]}),(0,$.jsxs)(Se,{children:[`This will merge “`,i.title,`” into `,i.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`,l&&i.canOverride?` You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`:``]})]}),g.error?(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:g.error.message}):null,(0,$.jsxs)(Ce,{children:[(0,$.jsx)(y,{variant:`outline`,disabled:g.isPending,onClick:()=>c(!1),children:`Cancel`}),(0,$.jsx)(y,{disabled:g.isPending,onClick:()=>g.mutate(),children:g.isPending?`Merging…`:m?Tt[m]:`Merge`})]})]})})]})}function Ot({item:e}){let t=ne(),n=a(e.number),[r,i]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(null),c=n.data,l=c?.available?c.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],u=l.findIndex(e=>e.path===o);(0,Q.useEffect)(()=>{l.length>0&&!l.some(e=>e.path===o)&&s(l[0].path)},[c?.available?c.headSha:``,r]);let d=async()=>{let n=c?.available?c.headSha:null,r=await _(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(s(r.files[0]?.path??null),b(`The reviewed revision changed.`))};if(n.isPending)return(0,$.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!c)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!c.available)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:c.reason});let f=l.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),p=D(e.url)?`${e.url}/files`:null,m=l.find(e=>e.path===o);return(0,$.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,$.jsxs)(`strong`,{children:[c.files.length,` changed files`]}),(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,c.additions]}),(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,c.deletions]}),(0,$.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:c.headSha,children:[`head `,c.headSha.slice(0,8)]}),(0,$.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void d(),children:`Refresh`})]}),c.truncated?(0,$.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[c.reason??`This response is incomplete.`,` `,p?(0,$.jsx)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,$.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,$.jsxs)(`aside`,{className:`min-w-0`,children:[(0,$.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>i(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,$.jsx)(`select`,{"aria-label":`Select changed file`,value:o??``,onChange:e=>s(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:l.map(e=>(0,$.jsx)(`option`,{children:e.path},e.path))}),(0,$.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>s(e.path),className:k(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,o===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,$.jsx)(y,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<=0,onClick:()=>s(l[u-1]?.path??null),children:(0,$.jsx)(He,{})}),(0,$.jsx)(y,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<0||u>=l.length-1,onClick:()=>s(l[u+1]?.path??null),children:(0,$.jsx)(ce,{})})]}),l.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Be,{files:f.filter(e=>e.path===o),wrap:!0,className:`min-w-0`}),m&&!m.patch?(0,$.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,m.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function kt({item:e,colors:t}){let n=T(e.kind,e.number),r=n.data,i=(0,Q.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(At(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsx)(Ge,{className:`mb-3 h-3 w-24`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(Ge,{className:`h-14 w-full`}),(0,$.jsx)(Ge,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,$.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-5`,children:jt(i).map(e=>e.group===`commits`?(0,$.jsx)(Mt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,$.jsx)(Rt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,$.jsx)(Pt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var At=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function jt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Mt({commits:e,colors:t}){let[n,r]=(0,Q.useState)(!1),i=e[0]?.actor??`?`;return n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,$.jsx)(Pt,{event:e,colors:t},e.id))]}):(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,$.jsx)(`span`,{className:`shrink-0`,children:X(e[e.length-1].createdAt)})]})})}var Nt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Pt({event:e,colors:t}){return(0,$.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:k(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Nt[e.kind]}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,$.jsx)(Ft,{event:e,colors:t}),(0,$.jsx)(`span`,{className:`shrink-0`,children:X(e.createdAt)}),e.url?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Ft({event:e,colors:t}){switch(e.kind){case`committed`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,$.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,$.jsx)(It,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,$.jsx)(`span`,{"data-slot":`gh-event-label`,style:rt(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,$.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,$.jsx)(`span`,{children:`merged this`});case`closed`:return(0,$.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,$.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,$.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function It({checks:e}){return e?(0,$.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:k(`shrink-0`,Vt[e]),children:Bt[e]}):null}var Lt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Rt({comment:e}){let t=e.reviewState?Lt[e.reviewState]:null;return(0,$.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,$.jsx)(zt,{url:e.avatarUrl,login:e.author}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,$.jsx)(`span`,{children:X(e.createdAt)}),t?(0,$.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:k(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,$.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,$.jsx)(Z,{children:e.body}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function zt({url:e,login:t}){let[n,r]=(0,Q.useState)(!1);return e&&!n?(0,$.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,$.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Bt={passing:`✓`,failing:`✗`,pending:`○`},Vt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Ht({count:e}){return e?(0,$.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,$.jsx)(Ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Ut({checks:e,url:t}){let n=k(`text-[11px] font-medium`,Vt[e],t&&`hover:underline`),r=`${Bt[e]} checks ${e}`;return t?(0,$.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,$.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Wt({checks:e}){return(0,$.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:k(`shrink-0 font-sans text-[11px] font-semibold`,Vt[e]),children:Bt[e]})}export{yt as GithubRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,G as i,J as a,Jn as o,K as s,Rn as c,Rt as l,Ur as u,Vr as d,Vt as f,Wr as p,Wt as m,Xn as h,Y as g,Yn as _,Z as v,a as y,i as b,j as x,k as S,ni as C,nr as w,pr as ee,q as T,qn as te,qr as ne,t as E}from"./centered-state-B_V_Ai2h.js";import{n as D,r as O,t as k}from"./utils-Bb8ohcr3.js";import{t as A}from"./arrow-left-BJsIW6A0.js";import{C as j,S as re,b as ie,g as M,h as N,p as P,v as ae,x as oe,y as se}from"./new-task-form-BydHBbef.js";import{t as ce}from"./chevron-right-CFzn-von.js";import{b as F,x as le,y as ue}from"./dropdown-menu-Z80KMInL.js";import{C as de,S as fe,_ as I,a as pe,g as L,h as me,n as R,o as he,p as z,r as ge,u as B,v as V,y as H}from"./prompt-templates-B7Fs2b1S.js";import{t as _e}from"./refresh-cw-DGliez3E.js";import{t as U}from"./sparkles-B8agSxBZ.js";import{t as ve}from"./triangle-alert-D5tJwRD2.js";import{n as ye,t as W}from"./textarea--cpYshee.js";import{a as be,c as G,l as xe,n as K,o as Se,r as q,s as Ce,t as J}from"./use-submit-shortcut-JY8M_MPL.js";import{r as we,t as Y}from"./project-router-BbCzrHKs.js";import{r as X,t as Z}from"./markdown-5FuCZDA4.js";import{c as Te,d as Ee,f as De,i as Oe,s as ke,t as Ae,u as je}from"./skills-D4P-Hgey.js";import{_ as Me,d as Ne,f as Pe,h as Fe,l as Ie,p as Le,s as Re,u as ze}from"./index-Cz4GSAqV.js";import{t as Be}from"./diff-CbozNUJq.js";import{t as Ve}from"./tab-link-Cp2-CJS8.js";var He=O(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ue=O(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),We=O(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Q=e(t(),1),$=n();function Ge({className:e,...t}){return(0,$.jsx)(`div`,{"data-slot":`skeleton`,className:k(`animate-pulse rounded-md bg-accent`,e),...t})}function Ke(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function qe(e,t=[]){let n=Ke(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Je(t)),n}function Je(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Ye(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function Xe(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Ze(e,t,n){let r=(n??``).trim();if(!r)return qe(e,t);let i=Ke(e),a=r.startsWith(i)?i+Ye(r.slice(i.length),e):Ye(r,e),o=Xe(a,e)?a:`${i}\n\n${a}`;return t.length?o+Je(t):o}function Qe(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function $e(e,t,n,r,i={}){return t?{...i,workflow:t,task:Ze(e,n,r)}:n.length?{...i,steps:Qe(n),task:Ze(e,[],r)}:{...i,workflow:`quick-task`,task:Ze(e,[],r)}}function et(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function tt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function nt(e,t){return e.trim()!==``&&t===0}function rt(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var it={workflow:null,skills:[]},at=`xez-followup-selection`;function ot(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function st(){try{let e=localStorage.getItem(at);return e?ot(JSON.parse(e)):{...it}}catch{return{...it}}}function ct(e){try{localStorage.setItem(at,JSON.stringify(e))}catch{}}var lt=`xez-followup-prompt:`;function ut(e){try{return localStorage.getItem(lt+e)??``}catch{return``}}function dt(e,t){try{t===``?localStorage.removeItem(lt+e):localStorage.setItem(lt+e,t)}catch{}}function ft({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:d,queuedRunId:p,onQueued:m}){let h=ne(),g=f(),_=e.kind===`pr`?`PR`:`issue`,v=o.filter(e=>n.some(t=>t.name===e)),[S]=(0,Q.useState)(()=>Ke(e)),[C,w]=(0,Q.useState)(()=>ut(e.url)||S),T=Pe(l),te=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{dt(e.url,C===S?``:C)},[e.url,C,S]);let E=(0,Q.useMemo)(()=>pe(g.data?.promptTemplates),[g.data?.promptTemplates]),D=e=>{let t=te.current,n=C===S?C.length:t?.selectionStart??C.length,r=ge(C,n,e);w(r.text),requestAnimationFrame(()=>{te.current?.focus(),te.current?.setSelectionRange(r.caret,r.caret)})},O=R(E,v),k=(0,Q.useRef)(C);k.current=C;let A=(0,Q.useRef)(``);(0,Q.useEffect)(()=>{let e=he(k.current,A.current,O,S);A.current=e.applied,e.text!==k.current&&w(e.text)},[O,S]);let j=u({mutationFn:async()=>T.canRun?c($e(e,i,v,C,Ne(T))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&m(e.url,n.id),b(`Added to the queue — ${_} #${e.number}`),v.length>0&&g.data!==void 0&&ee({skillUsage:v.reduce((e,t)=>Ae(e,t),g.data.skillUsage)}).then(()=>h.invalidateQueries({queryKey:x.uiState})).catch(()=>{}),dt(e.url,``),w(S),A.current=``,h.invalidateQueries({queryKey:x.runs.all})},onError:e=>b(e.message,{tone:`danger`})}),re=e=>{J({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!j.isPending&&T.canRun&&j.mutate())},ie=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,$.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,$.jsx)(ae,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(pt,{workflows:t,value:i,onChange:a}),(0,$.jsx)(mt,{skills:n,skillUsage:g.data?.skillUsage,selected:v,onToggle:ie}),(0,$.jsx)(ze,{pick:l,onChange:d,disabled:j.isPending||!T.canRun,accounts:!0}),!T.providerPending&&!T.canRun?(0,$.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[T.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,$.jsx)(Y,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,(0,$.jsx)(Ie,{templates:E,onInsert:D})]}),v.length>0?(0,$.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:v.map(e=>(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>ie(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,$.jsx)(ye,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,$.jsx)(W,{ref:te,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:C,onChange:e=>w(e.target.value),onKeyDown:re,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,$.jsxs)(y,{variant:`contrast`,"data-action":`gh-run`,disabled:j.isPending||!T.canRun,onClick:()=>j.mutate(),children:[(0,$.jsx)(se,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,_]}),(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:K()}),p?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,$.jsx)(r,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,$.jsx)(Y,{to:`/tasks/${p}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}function pt({workflows:e,value:t,onChange:n}){let[i,a]=(0,Q.useState)(!1),[o,s]=(0,Q.useState)(``),c=(0,Q.useRef)(null),l=Ee(e,o);return(0,$.jsxs)(P,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:k(B,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,$.jsx)(Me,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,$.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,$.jsx)(j,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,$.jsx)(N,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(z,{shouldFilter:!1,children:[(0,$.jsx)(I,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,$.jsxs)(H,{ref:c,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[l.length===0?(0,$.jsx)(me,{children:`Nothing matches.`}):null,(0,$.jsx)(L,{children:l.map(e=>{let i=t===e.name;return(0,$.jsxs)(V,{value:`workflow ${e.name}`,keywords:De(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(i?null:e.name),a(!1)},children:[(0,$.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,i?(0,$.jsx)(r,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function mt({skills:e,skillUsage:t,selected:n,onToggle:i}){let[a,o]=(0,Q.useState)(!1),[s,c]=(0,Q.useState)(``),[l,u]=(0,Q.useState)(null),d=(0,Q.useRef)(null),{mostUsed:f,project:p,global:m}=Te(je(e,s,t),t),h=(e,t)=>{let a=n.includes(e.name);return(0,$.jsxs)(V,{value:`skill ${e.name} ${e.path}`,keywords:De(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":a?`true`:void 0,onSelect:()=>i(e.name),children:[(0,$.jsx)(`span`,{className:k(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,$.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,$.jsx)(de,{"aria-hidden":`true`,className:`size-3.5`})}),a?(0,$.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Re,{skill:l,onClose:()=>u(null)}),(0,$.jsxs)(P,{open:a,onOpenChange:e=>{o(e),e||c(``)},children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:k(B,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,$.jsx)(U,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,$.jsx)(j,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,$.jsx)(N,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,$.jsxs)(z,{shouldFilter:!1,children:[(0,$.jsx)(I,{placeholder:`search skills…`,value:s,onValueChange:c,onInput:()=>d.current?.scrollTo(0,0)}),(0,$.jsxs)(H,{ref:d,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[f.length===0&&p.length===0&&m.length===0?(0,$.jsx)(me,{children:`Nothing matches.`}):null,f.length>0?(0,$.jsx)(L,{heading:`Most used`,children:f.map(e=>h(e,Oe(e)))}):null,p.length>0?(0,$.jsx)(L,{heading:`Project skills`,children:p.map(e=>h(e,!0))}):null,m.length>0?(0,$.jsx)(L,{heading:`Global`,children:m.map(e=>h(e,!1))}):null]})]})})]})]})}var ht=1e3,gt=100,_t=350;function vt(e,t){let[n,r]=(0,Q.useState)(e);return(0,Q.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function yt({view:e,changes:t=!1,index:n=!1}){let{n:r}=d(),a=i({limit:ht}),c=v().data?.capabilities?.automations===!0,p=a.data,h=r===void 0?null:Number.parseInt(r,10),_=(0,Q.useMemo)(()=>{if(!p?.available)return[];let t=new Set;e===`prs`&&h!==null&&Number.isInteger(h)&&t.add(h);for(let e of p.prs){if(t.size>=gt)break;t.add(e.number)}return[...t]},[p,e,h]),w=s(_,e===`prs`),T=w.data?.available?w.data.checks:void 0,D=ne(),O=e=>{D.setQueryData(x.uiState,t=>({...t,githubView:e})),ee({githubView:e}).then(e=>D.setQueryData(x.uiState,e)).catch(e=>{b(e instanceof Error?e.message:String(e),{tone:`danger`}),D.invalidateQueries({queryKey:x.uiState})})},A=(0,Q.useRef)(null),j=u({mutationFn:()=>te({refresh:!0,limit:ht}),onSuccess:e=>{D.setQueryData(x.github({limit:ht}),e),D.invalidateQueries({queryKey:x.githubChecks(_)});let t=A.current;if(!t){D.removeQueries({queryKey:[`github`,`comments`]});return}let n=x.githubComments(t.kind,t.number);o(t.kind,t.number,{refresh:!0}).then(e=>D.setQueryData(n,e)).catch(()=>{}),D.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==C(n)})},onError:e=>b(e.message,{tone:`danger`})}),re=m(),ie=l(),M=f(),[N,P]=(0,Q.useState)(()=>st().workflow),[ae,se]=(0,Q.useState)(()=>st().skills),[ce,F]=(0,Q.useState)({runner:null,model:null,account:null});(0,Q.useEffect)(()=>{ct({workflow:N,skills:[...ae]})},[N,ae]);let le=re.data?.workflows;(0,Q.useEffect)(()=>{le&&N!==null&&!le.some(e=>e.name===N)&&P(null)},[le,N]);let de=ie.data,I=M.data?.skillUsage,pe=(0,Q.useMemo)(()=>ke(de??[],I),[de,I]),[L,me]=(0,Q.useState)(new Map),[R,he]=(0,Q.useState)(``),[z,ge]=(0,Q.useState)([]),B=vt(R,_t),V=(0,Q.useMemo)(()=>p?.available?e===`issues`?p.issues:p.prs:[],[p,e]),H=nt(B,(0,Q.useMemo)(()=>tt(V,{query:B,labels:z}).length,[V,B,z])),U=g(e===`issues`?`issue`:`pr`,B,H);if(n&&M.data?.githubView===`prs`)return(0,$.jsx)(we,{to:`/github/prs`,replace:!0});if(!p)return a.isError?(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(E,{icon:(0,$.jsx)(ve,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:a.error.message})}):(0,$.jsx)(Le,{});if(A.current=null,!p.available)return(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(E,{icon:(0,$.jsx)(Fe,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:p.reason??`unknown reason`,actions:(0,$.jsx)(y,{variant:`outline`,"data-action":`gh-retry`,disabled:j.isPending,onClick:()=>j.mutate(),children:`Try again`}),children:(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in xezar works without it.`]})})});let ye=V,W=tt(ye,{query:R,labels:z}),be=R.trim()!==``||z.length>0,G=H&&U.data?.available?U.data:null,xe=new Set(W.map(e=>e.number)),K=G?tt(G.items,{labels:z}).filter(e=>!xe.has(e.number)):[],Se=R.trim()!==``&&R.trim()!==B.trim()||H&&U.isPending,q={...G?.labelColors??{},...p.labelColors??{}},Ce=et(ye),J=r===void 0?null:Number.parseInt(r,10),Z=J===null?W[0]??K[0]??null:ye.find(e=>e.number===J)??K.find(e=>e.number===J)??null;A.current=Z?{kind:Z.kind,number:Z.number}:null;let Te=e===`issues`?`/github`:`/github/prs`,Ee=H&&(U.data?.available===!1||U.isError),De=U.data?.available===!1?U.data.reason??`unknown reason`:U.error instanceof Error?U.error.message:`the search request failed`,Oe=be?Se?(0,$.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(S,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,R.trim(),`”…`]}):K.length>0?null:Ee?(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,De,`.`]}):G?(0,$.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,$.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,$.jsxs)(`section`,{"data-slot":`gh-list`,className:k(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,r===void 0?`flex`:`hidden`),children:[(0,$.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),p.repo?(0,$.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:p.repo}):null,c?(0,$.jsx)(Y,{to:`/automations/new`,className:`ml-auto shrink-0 text-[10px] font-medium text-primary hover:underline`,children:`Set up automations`}):null,(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:j.isPending,onClick:()=>j.mutate(),className:k(`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,!c&&`ml-auto`),children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:k(`size-[9px]`,j.isPending&&`motion-safe:animate-spin`)}),p.syncedAt?`synced ${X(p.syncedAt)} ago`:`refresh`]})]}),(0,$.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,$.jsxs)(Ve,{to:`/github`,active:e===`issues`,onClick:()=>O(`issues`),children:[`Issues · `,bt(p.issues.length)]}),(0,$.jsxs)(Ve,{to:`/github/prs`,active:e===`prs`,onClick:()=>O(`prs`),children:[`Pull requests · `,bt(p.prs.length)]})]}),(0,$.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,$.jsx)(fe,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,$.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:R,onChange:e=>he(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,$.jsx)(St,{options:Ce,colors:q,selected:z,onChange:ge})]})]}),W.length===0?Oe&&(0,$.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:Oe}):(0,$.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:W.map(t=>(0,$.jsx)(xt,{item:t,view:e,colors:q,active:Z?.url===t.url,queued:L.has(t.url),checks:t.kind===`pr`?T?.[t.number]??t.checks:t.checks},t.url))}),K.length>0?(0,$.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,$.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,G?.truncated?` (first matches)`:``]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:K.map(t=>(0,$.jsx)(xt,{item:t,view:e,colors:q,active:Z?.url===t.url,queued:L.has(t.url),checks:t.kind===`pr`?T?.[t.number]??t.checks:t.checks},t.url))})]}):null]}),(0,$.jsx)(`section`,{"data-slot":`gh-detail`,className:k(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,r===void 0?`hidden md:flex`:`flex`),children:Z?(0,$.jsx)(wt,{item:Z,listPath:Te,colors:q,changes:t,checks:Z.kind===`pr`?T?.[Z.number]??Z.checks:Z.checks,children:(0,$.jsx)(ft,{item:Z,workflows:re.data?.workflows??[],skills:pe,workflow:N,onWorkflowChange:P,selectedSkills:ae,onSkillsChange:se,engine:ce,onEngineChange:F,queuedRunId:L.get(Z.url)??null,onQueued:(e,t)=>me(n=>new Map(n).set(e,t))},Z.url)}):(0,$.jsx)(E,{icon:e===`issues`?(0,$.jsx)(oe,{}):(0,$.jsx)(ue,{}),tone:`neutral`,heading:`h2`,title:J===null?`Nothing selected`:`Not found`,subtitle:J===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${J} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${J} above to look it up on GitHub, closed and merged included.`})})]})}function bt(e){return`${e}${e>=ht?`+`:``}`}function xt({item:e,view:t,colors:n,active:r,queued:i,checks:a}){let s=e.kind===`issue`?oe:ue,c=ne(),l=()=>{c.prefetchQuery({queryKey:x.githubComments(e.kind,e.number),queryFn:({signal:t})=>o(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,$.jsx)(`li`,{children:(0,$.jsxs)(Y,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,qe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:l,onFocus:l,"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:k(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(s,{"aria-hidden":`true`,className:k(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,$.jsx)(`span`,{className:k(`min-w-0 truncate text-[13px] font-medium`,r&&`font-semibold`),children:e.title})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,$.jsx)(`span`,{children:X(e.createdAt)}),(0,$.jsx)(Ht,{count:e.comments}),a?(0,$.jsx)(Wt,{checks:a}):null,i?(0,$.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,$.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,$.jsx)(Ct,{label:e,color:n[e]},e))}):null]})})}function St({options:e,colors:t,selected:n,onChange:i}){let[a,o]=(0,Q.useState)(!1),s=e=>i(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,$.jsxs)(P,{open:a,onOpenChange:o,children:[(0,$.jsx)(M,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:k(`flex shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,$.jsx)(We,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,$.jsx)(N,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,$.jsxs)(z,{children:[(0,$.jsx)(I,{placeholder:`Filter labels…`}),(0,$.jsxs)(H,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,$.jsx)(me,{children:`No labels.`}),n.length>0?(0,$.jsxs)(V,{value:`__clear__`,onSelect:()=>i([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let i=n.includes(e);return(0,$.jsxs)(V,{value:e,onSelect:()=>s(e),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:rt(t[e])}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),i?(0,$.jsx)(r,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function Ct({label:e,color:t}){return(0,$.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:rt(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function wt({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,$.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,$.jsxs)(Y,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,$.jsx)(A,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,$.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,$.jsx)(`span`,{children:o}),`·`,(0,$.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,$.jsxs)(`span`,{children:[X(e.createdAt),` ago`]}),e.comments?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsx)(Ht,{count:e.comments})]}):null,s?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,D(e.url)?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,$.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,$.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.kind===`pr`?(0,$.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,$.jsx)(Ve,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,$.jsx)(Ve,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,$.jsx)(Ct,{label:e,color:n[e]},e)),a?(0,$.jsx)(Ut,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,$.jsx)(Ot,{item:e}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,$.jsx)(Z,{children:e.body}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,$.jsx)(kt,{item:e,colors:n}),e.kind===`pr`?(0,$.jsx)(Dt,{number:e.number}):null,r]})]})}var Tt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Et({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,$.jsx)(re,{"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:k(t,`text-success`)}):e===`failing`?(0,$.jsx)(ie,{"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:k(t,`text-danger`)}):e===`pending`?(0,$.jsx)(S,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:k(t,`animate-spin text-warning`)}):(0,$.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:k(t,`text-soft-foreground`)})}function Dt({number:e}){let t=ne(),n=p({queryKey:x.githubMergeState(e),queryFn:({signal:t})=>h(e,{},{signal:t}),retry:!1}),i=n.data?.available?n.data.mergeState:null,[a,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),[l,d]=(0,Q.useState)(!1),f=u({mutationFn:()=>h(e,{refresh:!0}),onSuccess:n=>t.setQueryData(x.githubMergeState(e),n),onError:e=>b(e instanceof Error?e.message:String(e),{tone:`danger`})}),m=a&&i?.methods.includes(a)?a:i?.defaultMethod??i?.methods[0]??null,g=u({mutationFn:()=>{if(!i||!m)throw Error(`No merge method is available.`);return w(e,{method:m,expectedHeadSha:i.headSha,...l&&i.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{c(!1),b(`Pull request #${e} merged`),t.invalidateQueries({queryKey:x.githubMergeState(e)}),t.invalidateQueries({queryKey:x.github({limit:ht})}),t.invalidateQueries({queryKey:x.githubComments(`pr`,e)})},onError:n=>{b(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:x.githubMergeState(e)})}});if(n.isPending)return(0,$.jsx)(Ge,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!i)return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:n.data?.available===!1?n.data.reason:`GitHub could not load merge requirements.`})]});let _=i.state===`merged`?`Merged`:i.state===`closed`?`Closed`:i.isDraft?`Draft`:i.mergeable===`conflicting`?`Conflicts must be resolved`:i.canMerge?`Ready to merge`:`Merge blocked`,v=i.reviewDecision===`approved`?`passing`:i.reviewDecision===`unknown`?`unknown`:`failing`,S=i.mergeable===`mergeable`?`passing`:i.mergeable===`conflicting`?`failing`:`unknown`,C=!!(m&&(i.canMerge||i.canOverride&&l));return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-box`,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i.canMerge?(0,$.jsx)(r,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,$.jsx)(ve,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:_}),(0,$.jsxs)(y,{type:`button`,variant:`ghost`,size:`sm`,disabled:f.isPending,onClick:()=>f.mutate(),children:[(0,$.jsx)(_e,{"aria-hidden":`true`,className:k(`size-3.5`,f.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,$.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[i.headRef,` (`,i.headSha.slice(0,7),`) → `,i.baseRef]}),(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Et,{state:v}),(0,$.jsxs)(`span`,{children:[`Reviews: `,i.reviewDecision.replaceAll(`-`,` `)]})]}),(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Et,{state:S}),(0,$.jsxs)(`span`,{children:[`Conflicts: `,i.mergeable===`conflicting`?`present`:i.mergeable===`mergeable`?`none`:`unknown`]})]}),i.checks.length===0?(0,$.jsx)(`li`,{children:`No checks configured`}):i.checks.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Et,{state:e.state}),(0,$.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&D(e.url)?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),i.blockers.map(e=>(0,$.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),i.canOverride?(0,$.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>d(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,i.state===`open`&&i.methods.length>0?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(`select`,{"aria-label":`Merge method`,value:m??``,onChange:e=>o(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:i.methods.map(e=>(0,$.jsx)(`option`,{value:e,children:Tt[e]},e))}),(0,$.jsx)(y,{disabled:!C,onClick:()=>c(!0),children:m?Tt[m]:`Merge`})]}):null]})]}),(0,$.jsx)(q,{open:s,onOpenChange:c,children:(0,$.jsxs)(be,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,$.jsxs)(G,{children:[(0,$.jsxs)(xe,{children:[m?Tt[m]:`Merge`,` pull request #`,e,`?`]}),(0,$.jsxs)(Se,{children:[`This will merge “`,i.title,`” into `,i.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`,l&&i.canOverride?` You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`:``]})]}),g.error?(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:g.error.message}):null,(0,$.jsxs)(Ce,{children:[(0,$.jsx)(y,{variant:`outline`,disabled:g.isPending,onClick:()=>c(!1),children:`Cancel`}),(0,$.jsx)(y,{disabled:g.isPending,onClick:()=>g.mutate(),children:g.isPending?`Merging…`:m?Tt[m]:`Merge`})]})]})})]})}function Ot({item:e}){let t=ne(),n=a(e.number),[r,i]=(0,Q.useState)(``),[o,s]=(0,Q.useState)(null),c=n.data,l=c?.available?c.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],u=l.findIndex(e=>e.path===o);(0,Q.useEffect)(()=>{l.length>0&&!l.some(e=>e.path===o)&&s(l[0].path)},[c?.available?c.headSha:``,r]);let d=async()=>{let n=c?.available?c.headSha:null,r=await _(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(s(r.files[0]?.path??null),b(`The reviewed revision changed.`))};if(n.isPending)return(0,$.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!c)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!c.available)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:c.reason});let f=l.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),p=D(e.url)?`${e.url}/files`:null,m=l.find(e=>e.path===o);return(0,$.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,$.jsxs)(`strong`,{children:[c.files.length,` changed files`]}),(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,c.additions]}),(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,c.deletions]}),(0,$.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:c.headSha,children:[`head `,c.headSha.slice(0,8)]}),(0,$.jsx)(y,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void d(),children:`Refresh`})]}),c.truncated?(0,$.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[c.reason??`This response is incomplete.`,` `,p?(0,$.jsx)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,$.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,$.jsxs)(`aside`,{className:`min-w-0`,children:[(0,$.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>i(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,$.jsx)(`select`,{"aria-label":`Select changed file`,value:o??``,onChange:e=>s(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:l.map(e=>(0,$.jsx)(`option`,{children:e.path},e.path))}),(0,$.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>s(e.path),className:k(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,o===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,$.jsx)(y,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<=0,onClick:()=>s(l[u-1]?.path??null),children:(0,$.jsx)(He,{})}),(0,$.jsx)(y,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<0||u>=l.length-1,onClick:()=>s(l[u+1]?.path??null),children:(0,$.jsx)(ce,{})})]}),l.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Be,{files:f.filter(e=>e.path===o),wrap:!0,className:`min-w-0`}),m&&!m.patch?(0,$.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,m.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function kt({item:e,colors:t}){let n=T(e.kind,e.number),r=n.data,i=(0,Q.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(At(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsx)(Ge,{className:`mb-3 h-3 w-24`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(Ge,{className:`h-14 w-full`}),(0,$.jsx)(Ge,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,$.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-5`,children:jt(i).map(e=>e.group===`commits`?(0,$.jsx)(Mt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,$.jsx)(Rt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,$.jsx)(Pt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var At=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function jt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Mt({commits:e,colors:t}){let[n,r]=(0,Q.useState)(!1),i=e[0]?.actor??`?`;return n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,$.jsx)(Pt,{event:e,colors:t},e.id))]}):(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:Nt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,$.jsx)(`span`,{className:`shrink-0`,children:X(e[e.length-1].createdAt)})]})})}var Nt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Pt({event:e,colors:t}){return(0,$.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:k(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Nt[e.kind]}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,$.jsx)(Ft,{event:e,colors:t}),(0,$.jsx)(`span`,{className:`shrink-0`,children:X(e.createdAt)}),e.url?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Ft({event:e,colors:t}){switch(e.kind){case`committed`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,$.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,$.jsx)(It,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,$.jsx)(`span`,{"data-slot":`gh-event-label`,style:rt(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,$.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,$.jsx)(`span`,{children:`merged this`});case`closed`:return(0,$.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,$.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,$.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function It({checks:e}){return e?(0,$.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:k(`shrink-0`,Vt[e]),children:Bt[e]}):null}var Lt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function Rt({comment:e}){let t=e.reviewState?Lt[e.reviewState]:null;return(0,$.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,$.jsx)(zt,{url:e.avatarUrl,login:e.author}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,$.jsx)(`span`,{children:X(e.createdAt)}),t?(0,$.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:k(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(F,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,$.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,$.jsx)(Z,{children:e.body}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function zt({url:e,login:t}){let[n,r]=(0,Q.useState)(!1);return e&&!n?(0,$.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,$.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Bt={passing:`✓`,failing:`✗`,pending:`○`},Vt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Ht({count:e}){return e?(0,$.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,$.jsx)(Ue,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Ut({checks:e,url:t}){let n=k(`text-[11px] font-medium`,Vt[e],t&&`hover:underline`),r=`${Bt[e]} checks ${e}`;return t?(0,$.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,$.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Wt({checks:e}){return(0,$.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:k(`shrink-0 font-sans text-[11px] font-semibold`,Vt[e]),children:Bt[e]})}export{yt as GithubRoute};
|