@wjarka/cezarion 0.14.5 → 0.14.6

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.
Files changed (65) hide show
  1. package/README.md +4 -1
  2. package/dist/automations/types.d.ts +2 -0
  3. package/dist/contract/automations.d.ts +8 -0
  4. package/dist/contract/delegation.d.ts +1 -0
  5. package/dist/contract/index.js +5 -1
  6. package/dist/contract/runs.d.ts +7 -0
  7. package/dist/contract/skills.d.ts +1 -0
  8. package/dist/contract/workflows.d.ts +6 -0
  9. package/dist/delegation/cli.js +5 -3
  10. package/dist/delegation/cli.js.map +1 -1
  11. package/dist/delegation/execution-identity.d.ts +92 -4
  12. package/dist/delegation/execution-identity.js +40 -10
  13. package/dist/delegation/execution-identity.js.map +1 -1
  14. package/dist/delegation/provision.js +5 -2
  15. package/dist/delegation/provision.js.map +1 -1
  16. package/dist/delegation/routes.d.ts +1 -0
  17. package/dist/delegation/service.js +95 -13
  18. package/dist/delegation/service.js.map +1 -1
  19. package/dist/delegation/transport.d.ts +1 -0
  20. package/dist/runs/store.d.ts +1 -0
  21. package/dist/server/server.d.ts +68 -0
  22. package/dist/workflows/load.d.ts +2 -0
  23. package/dist/workflows/load.js +5 -0
  24. package/dist/workflows/load.js.map +1 -1
  25. package/dist/workflows/run.d.ts +37 -2
  26. package/dist/workflows/run.js +160 -47
  27. package/dist/workflows/run.js.map +1 -1
  28. package/dist/workflows/types.d.ts +5 -1
  29. package/dist/workflows/types.js +6 -2
  30. package/dist/workflows/types.js.map +1 -1
  31. package/package.json +3 -3
  32. package/web/dist/assets/{agent-accounts-4EqNShyp.js → agent-accounts-lP_xK83o.js} +1 -1
  33. package/web/dist/assets/{alert-dialog-CVF_qvQ8.js → alert-dialog-CmDuefYh.js} +1 -1
  34. package/web/dist/assets/{collapsible-DVDGHZAE.js → collapsible-BqX8REmY.js} +1 -1
  35. package/web/dist/assets/{commit-list-BuNsBn8P.js → commit-list-BWvv1H7A.js} +1 -1
  36. package/web/dist/assets/{compare-variants-BnQ1O8Ix.js → compare-variants-Bg7eLW3z.js} +1 -1
  37. package/web/dist/assets/{diff-DWmKlqw52.js → diff-0GBum40Q2.js} +2 -2
  38. package/web/dist/assets/{diff-controls-CuqRa-63.js → diff-controls-HwWHHait.js} +1 -1
  39. package/web/dist/assets/{diff-stat-BXriPIds.js → diff-stat-mNkhAc5m.js} +1 -1
  40. package/web/dist/assets/{diff-view-DLPDcgEV.js → diff-view-DW64doDY.js} +1 -1
  41. package/web/dist/assets/{dropdown-menu-IsTcumXE.js → dropdown-menu-sZjYPcLh.js} +1 -1
  42. package/web/dist/assets/{git-toolbar-BjMzETip.js → git-toolbar-DBW5EIcY.js} +1 -1
  43. package/web/dist/assets/{github-BvowTAuy.js → github-CkZ4hWI5.js} +1 -1
  44. package/web/dist/assets/{image-preview-WXKTY8KT.js → image-preview-DZicGNkU.js} +1 -1
  45. package/web/dist/assets/{index-Cz3N9b18.js → index-DWWI-B9n.js} +3 -3
  46. package/web/dist/assets/{markdown-gFxX4dDH.js → markdown-AY2K3kIV.js} +1 -1
  47. package/web/dist/assets/{pill-BlaWNkHk.js → pill-CcJqA1cL.js} +1 -1
  48. package/web/dist/assets/{project-router-CX1jLqj-.js → project-router-SwsXRKXs.js} +1 -1
  49. package/web/dist/assets/{prompt-templates-DwdQcfSc.js → prompt-templates-iV2WD2jy.js} +1 -1
  50. package/web/dist/assets/{repo-git-DnbE8dR5.js → repo-git-BW3TOs3U.js} +1 -1
  51. package/web/dist/assets/{run-diff-Mfc85irR.js → run-diff-DPUNj56q.js} +1 -1
  52. package/web/dist/assets/{run-header-CDO3LV4z.js → run-header-DbDluWoV.js} +1 -1
  53. package/web/dist/assets/{skills-DHfsyXTQ.js → skills-Dv8Vwv5D.js} +1 -1
  54. package/web/dist/assets/{tab-link-DhREnUYE.js → tab-link-DSftvkZS.js} +1 -1
  55. package/web/dist/assets/{task-changes-Cfo-vtEl.js → task-changes-CTCuVls1.js} +1 -1
  56. package/web/dist/assets/{task-commits-CvK4flXT.js → task-commits-weJQ5GSl.js} +1 -1
  57. package/web/dist/assets/{task-files-BwVGUObK.js → task-files-B4bUimY8.js} +1 -1
  58. package/web/dist/assets/{task-thread-g1vc4tKn.js → task-thread-BuXrVB9K.js} +1 -1
  59. package/web/dist/assets/{textarea-DCP8bOOf.js → textarea-CxRdTWlq.js} +1 -1
  60. package/web/dist/assets/{thread-loading-D9DbIsIS.js → thread-loading-JlP6dUpX.js} +1 -1
  61. package/web/dist/assets/{token-metrics-PSnNTJZF.js → token-metrics-Z3UFYbuD.js} +1 -1
  62. package/web/dist/assets/{utils-DNvmfH6b.js → utils-CUnaAifW.js} +1 -1
  63. package/web/dist/assets/{workflows-BDdUJIFT.js → workflows-vA27Yi8W.js} +3 -3
  64. package/web/dist/assets/{zoomable-image-yNqiuVu7.js → zoomable-image-DUE1KFJ0.js} +1 -1
  65. package/web/dist/index.html +13 -13
@@ -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{$ as r,$t as i,Aa as a,Ca as o,Di as s,Ea as c,Ei as l,Fi as u,Lt as d,Oi as f,Rt as p,Sn as m,St as h,Ta as ee,Ti as g,U as _,Ut as v,X as y,Y as b,Yt as x,Z as S,Zt as C,bn as w,d as T,et as E,fr as te,gi as ne,hr as re,in as D,l as O,nt as k,qi as ie,sa as A,tn as ae,vn as oe,vr as se,wn as ce,xn as le,xt as ue,yn as de,za as fe}from"./alert-dialog-CVF_qvQ8.js";import{d as pe,n as me,t as j}from"./utils-DNvmfH6b.js";import{a as M,o as he,r as ge}from"./agent-accounts-4EqNShyp.js";import{a as _e,i as ve,n as ye,o as be,r as xe,s as Se,t as N}from"./textarea-DCP8bOOf.js";import{t as Ce}from"./createLucideIcon-BHp8sXmF.js";import{t as P}from"./external-link-BE6y205O.js";import{A as F,E as I,F as we,I as L,M as R,O as z,a as Te,c as B,d as Ee,j as De,k as V,n as H,o as U,r as Oe,s as W}from"./prompt-templates-DwdQcfSc.js";import{r as ke,t as Ae,u as je}from"./project-router-CX1jLqj-.js";import{t as Me}from"./message-square-B-MD-8rD.js";import{r as G,t as Ne}from"./markdown-gFxX4dDH.js";import{d as K,f as Pe,i as Fe,s as Ie,t as q,u as Le}from"./skills-DFBiAuJG.js";import{n as J,t as Re}from"./use-submit-shortcut-KWJsC906.js";import{d as Y,f as ze,l as Be,p as Ve,s as He,u as Ue}from"./index-Cz3N9b18.js";import{t as We}from"./diff-DWmKlqw52.js";import{t as Ge}from"./tab-link-DhREnUYE.js";var Ke=Ce(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),qe=Ce(`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`}]]),X=e(t(),1),Z=n();function Je({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`skeleton`,className:j(`animate-pulse rounded-md bg-accent`,e),...t})}var Q=`cez-github-list-width`;function Ye(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Xe(){try{let e=localStorage.getItem(Q);return e===null?360:Ye(e)}catch{return 360}}function Ze(e){try{localStorage.setItem(Q,String(Ye(e)))}catch{}}function $(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=$(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=$e(t)),n}function $e(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function et(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 tt(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 nt(e,t,n){let r=(n??``).trim();if(!r)return Qe(e,t);let i=$(e),a=r.startsWith(i)?i+et(r.slice(i.length),e):et(r,e),o=tt(a,e)?a:`${i}\n\n${a}`;return t.length?o+$e(t):o}function rt(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 it(e,t,n,r,i={}){return t?{...i,workflow:t,task:nt(e,n,r)}:n.length?{...i,steps:rt(n),task:nt(e,[],r)}:{...i,workflow:`quick-task`,task:nt(e,[],r)}}var at=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm text-foreground focus-visible:outline-ring disabled:opacity-50`;function ot({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let a=new Map;for(let t of e.issues)for(let e of t.assignees??[])a.set(e.toLowerCase(),e);for(let e of t)a.set(e.toLowerCase(),e);let o=[...a.values()].sort((e,t)=>e.localeCompare(t)),s=!!e.viewerLogin&&t.length===1&&t[0]?.toLowerCase()===e.viewerLogin.toLowerCase();return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`gh-issue-filters`,children:[(0,Z.jsxs)(ge,{children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:at,disabled:o.length===0,children:[`Assignees`,t.length?` · ${t.length}`:``]})}),(0,Z.jsx)(M,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Z.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Z.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),o.map(e=>{let n=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,Z.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>r(n?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Z.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]}),(0,Z.jsx)(`button`,{type:`button`,className:`${at} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":s,onClick:()=>r(s?[]:[e.viewerLogin]),children:`Assigned to me`}),e.viewerLogin?null:(0,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:`GitHub login unavailable.`}),e.projects?.length?(0,Z.jsxs)(`select`,{"aria-label":`Project board`,className:at,value:n,onChange:e=>i(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects?(0,Z.jsx)(`select`,{"aria-label":`Project board`,className:at,disabled:!0,value:``,children:(0,Z.jsx)(`option`,{value:``,children:`No boards`})}):(0,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:e.projectsReason??`Project boards unavailable.`})]})}function st(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 ct(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))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.projectId&&!e.projectIds?.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function lt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function ut(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 dt={workflow:null,skills:[]},ft=`cez-followup-selection`;function pt(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 mt(){try{let e=localStorage.getItem(ft);return e?pt(JSON.parse(e)):{...dt}}catch{return{...dt}}}function ht(e){try{localStorage.setItem(ft,JSON.stringify(e))}catch{}}var gt=`cez-followup-prompt:`;function _t(e){try{return localStorage.getItem(gt+e)??``}catch{return``}}function vt(e,t){try{t===``?localStorage.removeItem(gt+e):localStorage.setItem(gt+e,t)}catch{}}function yt({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:i,selectedSkills:o,onSkillsChange:s,engine:c,onEngineChange:l,queuedRunId:u,onQueued:d}){let f=a(),p=re(),m=e.kind===`pr`?`PR`:`issue`,h=o.filter(e=>n.some(t=>t.name===e)),[g]=(0,X.useState)(()=>$(e)),[_,v]=(0,X.useState)(()=>_t(e.url)||g),y=ze(c),x=(0,X.useRef)(null),S=(0,X.useRef)(null);(0,X.useEffect)(()=>{vt(e.url,_===g?``:_)},[e.url,_,g]);let C=(0,X.useMemo)(()=>Te(p.data?.promptTemplates),[p.data?.promptTemplates]),w=e=>{let t=x.current,n=W({prompt:_,base:g,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:S.current}),r=Oe(_,n,e);v(r.text),S.current=r.caret,requestAnimationFrame(()=>{x.current?.focus(),x.current?.setSelectionRange(r.caret,r.caret)})},E=H(C,h),te=(0,X.useRef)(_);te.current=_;let O=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=U(te.current,O.current,E,g);O.current=e.applied,e.text!==te.current&&v(e.text)},[E,g]);let k=ee({mutationFn:async()=>y.canRun?ne(it(e,r,h,_,Y(y))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&d(e.url,n.id),A(`Added to the queue — ${m} #${e.number}`),h.length>0&&p.data!==void 0&&ie({skillUsage:h.reduce((e,t)=>q(e,t),p.data.skillUsage)}).then(()=>f.invalidateQueries({queryKey:D.uiState})).catch(()=>{}),vt(e.url,``),v(g),O.current=``,f.invalidateQueries({queryKey:D.runs.all})},onError:e=>A(e.message,{tone:`danger`})}),oe=e=>{Re({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(),!k.isPending&&y.canRun&&k.mutate())},se=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(N,{ref:x,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:_,onChange:e=>v(e.target.value),onSelect:e=>{S.current=e.currentTarget.selectionStart},onKeyDown:oe,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(Be,{templates:C,onInsert:w}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(bt,{workflows:t,value:r,onChange:i})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(St,{skills:n,skillUsage:p.data?.skillUsage,selected:h,onToggle:se})]}),h.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:h.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>se(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Z.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Z.jsxs)(`div`,{className:`gh-engine-fields`,children:[(0,Z.jsx)(Ue,{pick:c,onChange:l,disabled:k.isPending||!y.canRun,accounts:!0}),y.runners.length<=1&&!y.accounts.some(e=>e.provider===y.runner&&e.id!=="default")?(0,Z.jsxs)(`div`,{className:`gh-fixed-runner`,children:[(0,Z.jsx)(`span`,{children:`Runner`}),y.runner]}):null]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(xt,{resolved:y,disabled:k.isPending||!y.canRun,onPick:e=>l({...c,account:e})})]}),!y.providerPending&&!y.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[y.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(Ae,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[me(e.url)?(0,Z.jsx)(T,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(T,{variant:`primary`,"data-action":`gh-run`,disabled:k.isPending||!y.canRun,onClick:()=>k.mutate(),children:[(0,Z.jsx)(we,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,m]}),(0,Z.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:J()}),u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(Ae,{to:`/tasks/${u}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function bt({workflows:e,value:t,onChange:n}){let[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=K(e,o);return(0,Z.jsxs)(ge,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:j(Ee,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Z.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(y,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(M,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(I,{shouldFilter:!1,children:[(0,Z.jsx)(F,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.jsxs)(R,{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,Z.jsx)(z,{children:`Nothing matches.`}):null,(0,Z.jsx)(V,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(De,{value:`workflow ${e.name}`,keywords:Pe(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function xt({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:pe,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(B,{icon:(0,Z.jsx)(C,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function St({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(null),{mostUsed:d,project:f,global:p,ranked:m}=Le(e,o,t),h=(e,t)=>{let i=n.includes(e.name);return(0,Z.jsxs)(De,{value:`skill ${e.name} ${e.path}`,keywords:Pe(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>r(e.name),children:[(0,Z.jsx)(`span`,{className:j(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(L,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(He,{skill:c,onClose:()=>l(null)}),(0,Z.jsxs)(ge,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:j(Ee,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(y,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(M,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(I,{shouldFilter:!1,children:[(0,Z.jsx)(F,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,Z.jsxs)(R,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(m?m.length===0:d.length===0&&f.length===0&&p.length===0)?(0,Z.jsx)(z,{children:`Nothing matches.`}):null,m?m.length>0?(0,Z.jsx)(V,{children:m.map(e=>h(e,Fe(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[d.length>0?(0,Z.jsx)(V,{heading:`Most used`,children:d.map(e=>h(e,Fe(e)))}):null,f.length>0?(0,Z.jsx)(V,{heading:`Project skills`,children:f.map(e=>h(e,!0))}):null,p.length>0?(0,Z.jsx)(V,{heading:`Global`,children:p.map(e=>h(e,!1))}):null]})]})]})})]})]})}var Ct=1e3,wt=100,Tt=350;function Et({width:e,onWidthChange:t}){let n=(0,X.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Ye(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,Z.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Ye(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function Dt(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Ot({view:e,changes:t=!1,index:n=!1}){let{n:i}=o(),s=oe({limit:Ct}),c=ce().data?.capabilities?.automations===!0,u=s.data,f=a(),_=e=>{f.setQueryData(D.uiState,t=>({...t,githubView:e})),ie({githubView:e}).then(e=>f.setQueryData(D.uiState,e)).catch(e=>{A(e instanceof Error?e.message:String(e),{tone:`danger`}),f.invalidateQueries({queryKey:D.uiState})})},v=(0,X.useRef)(null),y=ee({mutationFn:()=>g({refresh:!0,limit:Ct}),onSuccess:t=>{f.setQueryData(D.github({limit:Ct}),t),f.invalidateQueries({queryKey:D.githubChecks(He)}),f.invalidateQueries({queryKey:D.githubSearch(e===`issues`?`issue`:`pr`,B)});let n=v.current;if(!n){f.removeQueries({queryKey:[`github`,`comments`]});return}let r=D.githubComments(n.kind,n.number);l(n.kind,n.number,{refresh:!0}).then(e=>f.setQueryData(r,e)).catch(()=>{}),f.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==fe(r)})},onError:e=>A(e.message,{tone:`danger`})}),b=se(),S=te(),C=re(),[w,E]=(0,X.useState)(()=>mt().workflow),[ne,k]=(0,X.useState)(()=>mt().skills),[ae,le]=(0,X.useState)({runner:null,model:null,effort:null,account:null}),[pe,me]=(0,X.useState)(Xe),[M,he]=(0,X.useState)(!1),ge=e=>{let t=Ye(e);me(t),Ze(t)};(0,X.useEffect)(()=>{ht({workflow:w,skills:[...ne]})},[w,ne]);let _e=b.data?.workflows;(0,X.useEffect)(()=>{_e&&w!==null&&!_e.some(e=>e.name===w)&&E(null)},[_e,w]);let ve=S.data,ye=C.data?.skillUsage,be=(0,X.useMemo)(()=>Ie(ve??[],ye),[ve,ye]),[xe,Se]=(0,X.useState)(new Map),[N,Ce]=(0,X.useState)(``),[P,F]=(0,X.useState)([]),[I,we]=(0,X.useState)([]),[L,R]=(0,X.useState)(``),z=u?.projects?.some(e=>e.id===L)?L:``;(0,X.useEffect)(()=>{u&&L&&!z&&R(``)},[u,L,z]);let Te=()=>{Ce(``),F([]),we([]),R(``)},B=Dt(N,Tt),Ee=(0,X.useMemo)(()=>u?.available?e===`issues`?u.issues:u.prs:[],[u,e]),De=(0,X.useMemo)(()=>ct(Ee,{query:B,labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}),[Ee,B,P,e,I,z]),V=N.trim()===B.trim(),H=u?.available===!0&&V&&lt(B,De),U=m(e===`issues`?`issue`:`pr`,B,H),Oe=Ee,W=ct(Oe,{query:N,labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}),Me=e===`issues`&&i!==void 0&&!M,Ne=N.trim()!==``||P.length>0||e===`issues`&&(I.length>0||z!==``),K=H&&U.data?.available?U.data:null,Pe=new Set(W.map(e=>e.number)),Fe=e===`issues`&&K?z&&K.items.some(e=>e.projectIds===void 0)?K.projectsReason??`Project board data is incomplete. Refresh to try again.`:I.length&&K.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null,q=K&&!Fe?ct(K.items,{labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}).filter(e=>!Pe.has(e.number)):[],Le=D.github()[0],J=i===void 0?null:Number.parseInt(i,10),Re=U.data?.available?U.data.items.find(e=>e.number===J):void 0,[Y,ze]=(0,X.useState)(null);(0,X.useEffect)(()=>{Re&&ze({scope:Le,view:e,item:Re})},[Le,e,Re]);let Be=Re??(Y?.scope===Le&&Y.view===e&&Y.item.number===J?Y.item:null),He=(()=>{if(!u?.available||e!==`prs`)return[];let t=new Set;J!==null&&Number.isInteger(J)&&t.add(J);for(let e of[...q,...u.prs]){if(t.size>=wt)break;t.add(e.number)}return[...t]})(),Ue=de(He,e===`prs`),We=Ue.data?.available?Ue.data.checks:void 0;if(n&&C.data?.githubView===`prs`)return(0,Z.jsx)(ke,{to:`/github/prs`,replace:!0});if(!u)return s.isError?(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(O,{icon:(0,Z.jsx)(x,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:s.error.message})}):(0,Z.jsx)(Ve,{});if(v.current=null,!u.available)return(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(O,{icon:(0,Z.jsx)(h,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:u.reason??`unknown reason`,actions:(0,Z.jsx)(T,{variant:`outline`,"data-action":`gh-retry`,disabled:y.isPending,onClick:()=>y.mutate(),children:`Try again`}),children:(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let Ke=N.trim()!==``&&!V||H&&U.isPending,qe={...K?.labelColors??{},...u.labelColors??{}},Je=st([...Oe,...K?.items??[]]),Q=i===void 0?null:Number.parseInt(i,10),$=Q===null?W[0]??q[0]??null:Oe.find(e=>e.number===Q)??Be??null;v.current=$?{kind:$.kind,number:$.number}:null;let Qe=e===`issues`?`/github`:`/github/prs`,$e=H&&(U.data?.available===!1||U.isError),et=U.data?.available===!1?U.data.reason??`unknown reason`:U.error instanceof Error?U.error.message:`the search request failed`,tt=Ne?Ke?(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,N.trim(),`”…`]}):$e?q.length>0?(0,Z.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,et,`. Use Refresh to try again.`]}):W.length>0?(0,Z.jsxs)(`p`,{children:[`GitHub could not be searched: `,et,`.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,et,`.`]}):Fe?(0,Z.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,Fe]}):q.length>0?null:K?.truncated?(0,Z.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):K&&W.length>0?(0,Z.jsxs)(`p`,{children:[`No additional `,e===`issues`?`issues`:`pull requests`,` match your filter on GitHub.`]}):K?(0,Z.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,Z.jsxs)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col gap-3 px-[18px] pt-[18px] pb-[calc(90px+env(safe-area-inset-bottom))] md:gap-[22px] md:p-9`,children:[(0,Z.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 md:gap-[22px]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:`GitHub`}),u.repo?(0,Z.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground`,children:[(0,Z.jsx)(`span`,{"data-slot":`gh-repo`,children:u.repo}),(0,Z.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,u.syncedAt?`Synced ${G(u.syncedAt)} ago`:`Not synced yet`]})]}):null]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(Ge,{to:`/github`,active:e===`issues`,onClick:()=>_(`issues`),children:[`Issues · `,kt(u.issues.length)]}),(0,Z.jsxs)(Ge,{to:`/github/prs`,active:e===`prs`,onClick:()=>_(`prs`),children:[`Pull requests · `,kt(u.prs.length)]}),c?(0,Z.jsx)(Ae,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:y.isPending,onClick:()=>y.mutate(),className:`gh-utility`,children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:j(`size-3.5`,y.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Z.jsx)(p,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Z.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:N,onChange:e=>Ce(e.target.value),className:`min-h-11 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,Z.jsx)(jt,{options:Je,colors:qe,selected:P,onChange:F}),e===`issues`?(0,Z.jsx)(ot,{data:{...u,issues:[...u.issues,...K?.items??[]]},assignees:I,projectId:z,onAssigneesChange:we,onProjectChange:R}):null,(0,Z.jsx)(`button`,{type:`button`,disabled:!Ne,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:Te,children:`Clear filters`})]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row`,children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-list`,"data-mobile-preview":Me||void 0,style:{"--github-list-width":`${pe}px`},className:`relative flex w-full min-h-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0`,children:[W.length===0?tt&&(0,Z.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):(0,Z.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-1`,children:W.map((t,n)=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,compactHidden:Me&&n>=2&&$?.url!==t.url,queued:xe.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))}),e===`issues`&&i!==void 0&&W.length>2?(0,Z.jsx)(T,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":M,onClick:()=>he(e=>!e),children:M?`Show fewer issues`:`View all ${W.length} issues`}):null,W.length>0&&H&&tt?(0,Z.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):null,q.length>0?(0,Z.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Z.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,K?.truncated?` (first matches)`:``]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:q.map(t=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,queued:xe.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))})]}):null,(0,Z.jsx)(Et,{width:pe,onWidthChange:ge})]}),(0,Z.jsx)(`section`,{"data-slot":`gh-detail`,className:j(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card`,i===void 0?`hidden md:flex`:`flex`),children:$?(0,Z.jsx)(Nt,{item:$,listPath:Qe,colors:qe,changes:t,checks:$.kind===`pr`?We?.[$.number]??$.checks:$.checks,children:(0,Z.jsx)(yt,{item:$,workflows:b.data?.workflows??[],skills:be,workflow:w,onWorkflowChange:E,selectedSkills:ne,onSkillsChange:k,engine:ae,onEngineChange:le,queuedRunId:xe.get($.url)??null,onQueued:(e,t)=>Se(n=>new Map(n).set(e,t))},$.url)}):(0,Z.jsx)(O,{icon:e===`issues`?(0,Z.jsx)(r,{size:16}):(0,Z.jsx)(ue,{size:16}),tone:`neutral`,heading:`h2`,title:Q===null?`Nothing selected`:`Not found`,subtitle:Q===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${Q} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${Q} above to look it up on GitHub, closed and merged included.`})})]})]})}function kt(e){return`${e}${e>=Ct?`+`:``}`}function At({item:e,view:t,colors:n,active:i,compactHidden:o,queued:s,checks:c}){let u=e.kind===`issue`?r:ue,d=a(),f=()=>{d.prefetchQuery({queryKey:D.githubComments(e.kind,e.number),queryFn:({signal:t})=>l(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Z.jsx)(`li`,{"data-compact-hidden":o||void 0,children:(0,Z.jsxs)(Ae,{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:f,onFocus:f,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:j(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,i&&`bg-accent-strong/10 text-accent-text`),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,Z.jsx)(u,{"aria-hidden":`true`,className:j(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,Z.jsx)(`span`,{className:j(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,i&&`font-semibold`),children:e.title})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[10.5px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,Z.jsxs)(`span`,{children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),(0,Z.jsx)(Zt,{count:e.comments}),c?(0,Z.jsx)($t,{checks:c}):null,s?(0,Z.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Z.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e],plain:!0},e))}):null]})})}function jt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,X.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Z.jsxs)(ge,{open:i,onOpenChange:a,children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:j(`flex min-h-11 min-w-11 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-accent-strong/60 text-foreground`),children:[(0,Z.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Z.jsx)(M,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(F,{placeholder:`Filter labels…`}),(0,Z.jsxs)(R,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Z.jsx)(z,{children:`No labels.`}),n.length>0?(0,Z.jsxs)(De,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Z.jsxs)(De,{value:e,onSelect:()=>o(e),className:`min-h-11`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ut(t[e])}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}function Mt({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:ut(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function Nt({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,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsxs)(Ae,{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,Z.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Z.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Z.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,Z.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:o}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsxs)(`span`,{children:[G(e.createdAt),` ago`]}),e.comments?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(Zt,{count:e.comments})]}):null,s?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,me(e.url)?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),e.kind===`pr`?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e]},e)),a?(0,Z.jsx)(Qt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,Z.jsx)(Lt,{item:e}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Z.jsx)(Rt,{item:e,colors:n})]})]}),e.kind===`pr`?(0,Z.jsx)(It,{number:e.number}):null,r]})}var Pt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Ft({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:j(t,`text-success`)}):e===`failing`?(0,Z.jsx)(k,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:j(t,`text-danger`)}):e===`pending`?(0,Z.jsx)(je,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:j(t,`animate-spin text-warning`)}):(0,Z.jsx)(E,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:j(t,`text-soft-foreground`)})}function It({number:e}){let t=a(),n=c({queryKey:D.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),r=n.data?.available?n.data.mergeState:null,[i,o]=(0,X.useState)(null),[s,l]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),h=ee({mutationFn:()=>f(e,{refresh:!0}),onSuccess:n=>t.setQueryData(D.githubMergeState(e),n),onError:e=>A(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=i&&r?.methods.includes(i)?i:r?.defaultMethod??r?.methods[0]??null,_=ee({mutationFn:()=>{if(!r||!g)throw Error(`No merge method is available.`);return u(e,{method:g,expectedHeadSha:r.headSha,...p&&r.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{l(!1),A(`Pull request #${e} merged`),t.invalidateQueries({queryKey:D.githubMergeState(e)}),t.invalidateQueries({queryKey:D.github({limit:Ct})}),t.invalidateQueries({queryKey:D.githubComments(`pr`,e)})},onError:n=>{A(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:D.githubMergeState(e)})}});if(n.isPending)return(0,Z.jsx)(Je,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!r)return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.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 v=r.state===`merged`?`Merged`:r.state===`closed`?`Closed`:r.isDraft?`Draft`:r.mergeable===`conflicting`?`Conflicts must be resolved`:r.canMerge?`Ready to merge`:r.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`,y=r.reviewDecision===`approved`?`passing`:r.reviewDecision===`unknown`?`unknown`:`failing`,S=r.mergeable===`mergeable`?`passing`:r.mergeable===`conflicting`?`failing`:`unknown`,C=!!(g&&(r.canMerge||r.canOverride&&p));return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":r.eligibility,"data-conflicting":r.mergeable===`conflicting`?`true`:void 0,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[r.canMerge?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Z.jsx)(x,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:v}),(0,Z.jsxs)(T,{type:`button`,variant:`ghost`,size:`sm`,disabled:h.isPending,onClick:()=>h.mutate(),children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:j(`size-3.5`,h.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[r.headRef,` (`,r.headSha.slice(0,7),`) → `,r.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:y}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,r.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:S}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,r.mergeable===`conflicting`?`present`:r.mergeable===`mergeable`?`none`:`unknown`]})]}),r.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):r.checks.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&me(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),r.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),r.mergeable===`conflicting`?(0,Z.jsx)(T,{className:`mt-4`,onClick:e=>{let t=e.currentTarget.closest(`article`)?.querySelector(`[data-slot="gh-custom-prompt"]`);t?.scrollIntoView({block:`center`}),t?.focus({preventScroll:!0})},children:`Run agent on this PR`}):null,r.canOverride?(0,Z.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,Z.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.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,r.eligibility===`unknown`?(0,Z.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,r.state===`open`&&r.methods.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsx)(`select`,{"aria-label":`Merge method`,value:g??``,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:r.methods.map(e=>(0,Z.jsx)(`option`,{value:e,children:Pt[e]},e))}),(0,Z.jsx)(T,{disabled:!C,onClick:()=>l(!0),children:g?Pt[g]:`Merge`})]}):null]})]}),(0,Z.jsx)(ye,{open:s,onOpenChange:l,children:(0,Z.jsxs)(xe,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(be,{children:[(0,Z.jsxs)(Se,{children:[g?Pt[g]:`Merge`,` pull request #`,e,`?`]}),(0,Z.jsx)(ve,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,r.title,`” into `,r.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),p&&r.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),_.error?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:_.error.message}):null,(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(T,{variant:`outline`,disabled:_.isPending,onClick:()=>l(!1),children:`Cancel`}),(0,Z.jsx)(T,{disabled:_.isPending,onClick:()=>_.mutate(),children:_.isPending?`Merging…`:g?Pt[g]:`Merge`})]})]})})]})}function Lt({item:e}){let t=a(),n=le(e.number),[r,i]=(0,X.useState)(``),[o,c]=(0,X.useState)(null),l=n.data,u=l?.available?l.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],d=u.findIndex(e=>e.path===o);(0,X.useEffect)(()=>{u.length>0&&!u.some(e=>e.path===o)&&c(u[0].path)},[l?.available?l.headSha:``,r]);let f=async()=>{let n=l?.available?l.headSha:null,r=await s(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(c(r.files[0]?.path??null),A(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!l)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!l.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:l.reason});let p=u.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??``})),m=me(e.url)?`${e.url}/files`:null,h=u.find(e=>e.path===o);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[l.files.length,` changed files`]}),(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,l.additions]}),(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,l.deletions]}),(0,Z.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:l.headSha,children:[`head `,l.headSha.slice(0,8)]}),(0,Z.jsx)(T,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void f(),children:`Refresh`})]}),l.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[l.reason??`This response is incomplete.`,` `,m?(0,Z.jsx)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.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,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:o??``,onChange:e=>c(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:u.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:u.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>c(e.path),className:j(`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,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(T,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:d<=0,onClick:()=>c(u[d-1]?.path??null),children:(0,Z.jsx)(Ke,{})}),(0,Z.jsx)(T,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:d<0||d>=u.length-1,onClick:()=>c(u[d+1]?.path??null),children:(0,Z.jsx)(S,{size:16})})]}),u.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(We,{files:p.filter(e=>e.path===o),wrap:!0,className:`min-w-0`}),h&&!h.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,h.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Rt({item:e,colors:t}){let n=w(e.kind,e.number),r=n.data,i=(0,X.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(zt(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,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(Je,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(Je,{className:`h-14 w-full`}),(0,Z.jsx)(Je,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.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,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Bt(i).map(e=>e.group===`commits`?(0,Z.jsx)(Vt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(qt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Ut,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var zt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Bt(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 Vt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.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,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Ut,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.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,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e[e.length-1].createdAt)})]})})}var Ht={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Ut({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:j(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Ht[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Wt,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e.createdAt)}),e.url?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Wt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Gt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:ut(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,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Z.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Z.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Z.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Z.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Gt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:j(`shrink-0`,Xt[e]),children:Yt[e]}):null}var Kt={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 qt({comment:e}){let t=e.reviewState?Kt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Z.jsx)(Jt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:j(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Jt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.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,Z.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 Yt={passing:`✓`,failing:`✗`,pending:`○`},Xt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Zt({count:e}){return e?(0,Z.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,Z.jsx)(Me,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Qt({checks:e,url:t}){let n=j(`text-[11px] font-medium`,Xt[e],t&&`hover:underline`),r=`${Yt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function $t({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:j(`shrink-0 font-sans text-[11px] font-semibold`,Xt[e]),children:Yt[e]})}export{Ot 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{$ as r,$t as i,Aa as a,Ca as o,Di as s,Ea as c,Ei as l,Fi as u,Lt as d,Oi as f,Rt as p,Sn as m,St as h,Ta as ee,Ti as g,U as _,Ut as v,X as y,Y as b,Yt as x,Z as S,Zt as C,bn as w,d as T,et as E,fr as te,gi as ne,hr as re,in as D,l as O,nt as k,qi as ie,sa as A,tn as ae,vn as oe,vr as se,wn as ce,xn as le,xt as ue,yn as de,za as fe}from"./alert-dialog-CmDuefYh.js";import{d as pe,n as me,t as j}from"./utils-CUnaAifW.js";import{a as M,o as he,r as ge}from"./agent-accounts-lP_xK83o.js";import{a as _e,i as ve,n as ye,o as be,r as xe,s as Se,t as N}from"./textarea-CxRdTWlq.js";import{t as Ce}from"./createLucideIcon-BHp8sXmF.js";import{t as P}from"./external-link-BE6y205O.js";import{A as F,E as I,F as we,I as L,M as R,O as z,a as Te,c as B,d as Ee,j as De,k as V,n as H,o as U,r as Oe,s as W}from"./prompt-templates-iV2WD2jy.js";import{r as ke,t as Ae,u as je}from"./project-router-SwsXRKXs.js";import{t as Me}from"./message-square-B-MD-8rD.js";import{r as G,t as Ne}from"./markdown-AY2K3kIV.js";import{d as K,f as Pe,i as Fe,s as Ie,t as q,u as Le}from"./skills-DFBiAuJG.js";import{n as J,t as Re}from"./use-submit-shortcut-KWJsC906.js";import{d as Y,f as ze,l as Be,p as Ve,s as He,u as Ue}from"./index-DWWI-B9n.js";import{t as We}from"./diff-0GBum40Q2.js";import{t as Ge}from"./tab-link-DSftvkZS.js";var Ke=Ce(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),qe=Ce(`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`}]]),X=e(t(),1),Z=n();function Je({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`skeleton`,className:j(`animate-pulse rounded-md bg-accent`,e),...t})}var Q=`cez-github-list-width`;function Ye(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Xe(){try{let e=localStorage.getItem(Q);return e===null?360:Ye(e)}catch{return 360}}function Ze(e){try{localStorage.setItem(Q,String(Ye(e)))}catch{}}function $(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=$(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=$e(t)),n}function $e(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function et(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 tt(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 nt(e,t,n){let r=(n??``).trim();if(!r)return Qe(e,t);let i=$(e),a=r.startsWith(i)?i+et(r.slice(i.length),e):et(r,e),o=tt(a,e)?a:`${i}\n\n${a}`;return t.length?o+$e(t):o}function rt(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 it(e,t,n,r,i={}){return t?{...i,workflow:t,task:nt(e,n,r)}:n.length?{...i,steps:rt(n),task:nt(e,[],r)}:{...i,workflow:`quick-task`,task:nt(e,[],r)}}var at=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm text-foreground focus-visible:outline-ring disabled:opacity-50`;function ot({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let a=new Map;for(let t of e.issues)for(let e of t.assignees??[])a.set(e.toLowerCase(),e);for(let e of t)a.set(e.toLowerCase(),e);let o=[...a.values()].sort((e,t)=>e.localeCompare(t)),s=!!e.viewerLogin&&t.length===1&&t[0]?.toLowerCase()===e.viewerLogin.toLowerCase();return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`gh-issue-filters`,children:[(0,Z.jsxs)(ge,{children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:at,disabled:o.length===0,children:[`Assignees`,t.length?` · ${t.length}`:``]})}),(0,Z.jsx)(M,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Z.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Z.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),o.map(e=>{let n=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,Z.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>r(n?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Z.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]}),(0,Z.jsx)(`button`,{type:`button`,className:`${at} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":s,onClick:()=>r(s?[]:[e.viewerLogin]),children:`Assigned to me`}),e.viewerLogin?null:(0,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:`GitHub login unavailable.`}),e.projects?.length?(0,Z.jsxs)(`select`,{"aria-label":`Project board`,className:at,value:n,onChange:e=>i(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects?(0,Z.jsx)(`select`,{"aria-label":`Project board`,className:at,disabled:!0,value:``,children:(0,Z.jsx)(`option`,{value:``,children:`No boards`})}):(0,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:e.projectsReason??`Project boards unavailable.`})]})}function st(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 ct(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))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.projectId&&!e.projectIds?.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function lt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function ut(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 dt={workflow:null,skills:[]},ft=`cez-followup-selection`;function pt(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 mt(){try{let e=localStorage.getItem(ft);return e?pt(JSON.parse(e)):{...dt}}catch{return{...dt}}}function ht(e){try{localStorage.setItem(ft,JSON.stringify(e))}catch{}}var gt=`cez-followup-prompt:`;function _t(e){try{return localStorage.getItem(gt+e)??``}catch{return``}}function vt(e,t){try{t===``?localStorage.removeItem(gt+e):localStorage.setItem(gt+e,t)}catch{}}function yt({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:i,selectedSkills:o,onSkillsChange:s,engine:c,onEngineChange:l,queuedRunId:u,onQueued:d}){let f=a(),p=re(),m=e.kind===`pr`?`PR`:`issue`,h=o.filter(e=>n.some(t=>t.name===e)),[g]=(0,X.useState)(()=>$(e)),[_,v]=(0,X.useState)(()=>_t(e.url)||g),y=ze(c),x=(0,X.useRef)(null),S=(0,X.useRef)(null);(0,X.useEffect)(()=>{vt(e.url,_===g?``:_)},[e.url,_,g]);let C=(0,X.useMemo)(()=>Te(p.data?.promptTemplates),[p.data?.promptTemplates]),w=e=>{let t=x.current,n=W({prompt:_,base:g,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:S.current}),r=Oe(_,n,e);v(r.text),S.current=r.caret,requestAnimationFrame(()=>{x.current?.focus(),x.current?.setSelectionRange(r.caret,r.caret)})},E=H(C,h),te=(0,X.useRef)(_);te.current=_;let O=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=U(te.current,O.current,E,g);O.current=e.applied,e.text!==te.current&&v(e.text)},[E,g]);let k=ee({mutationFn:async()=>y.canRun?ne(it(e,r,h,_,Y(y))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&d(e.url,n.id),A(`Added to the queue — ${m} #${e.number}`),h.length>0&&p.data!==void 0&&ie({skillUsage:h.reduce((e,t)=>q(e,t),p.data.skillUsage)}).then(()=>f.invalidateQueries({queryKey:D.uiState})).catch(()=>{}),vt(e.url,``),v(g),O.current=``,f.invalidateQueries({queryKey:D.runs.all})},onError:e=>A(e.message,{tone:`danger`})}),oe=e=>{Re({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(),!k.isPending&&y.canRun&&k.mutate())},se=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(N,{ref:x,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:_,onChange:e=>v(e.target.value),onSelect:e=>{S.current=e.currentTarget.selectionStart},onKeyDown:oe,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(Be,{templates:C,onInsert:w}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(bt,{workflows:t,value:r,onChange:i})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(St,{skills:n,skillUsage:p.data?.skillUsage,selected:h,onToggle:se})]}),h.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:h.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>se(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Z.jsx)(ae,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Z.jsxs)(`div`,{className:`gh-engine-fields`,children:[(0,Z.jsx)(Ue,{pick:c,onChange:l,disabled:k.isPending||!y.canRun,accounts:!0}),y.runners.length<=1&&!y.accounts.some(e=>e.provider===y.runner&&e.id!=="default")?(0,Z.jsxs)(`div`,{className:`gh-fixed-runner`,children:[(0,Z.jsx)(`span`,{children:`Runner`}),y.runner]}):null]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(xt,{resolved:y,disabled:k.isPending||!y.canRun,onPick:e=>l({...c,account:e})})]}),!y.providerPending&&!y.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[y.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(Ae,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[me(e.url)?(0,Z.jsx)(T,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(T,{variant:`primary`,"data-action":`gh-run`,disabled:k.isPending||!y.canRun,onClick:()=>k.mutate(),children:[(0,Z.jsx)(we,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,m]}),(0,Z.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:J()}),u?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(Ae,{to:`/tasks/${u}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function bt({workflows:e,value:t,onChange:n}){let[r,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),c=(0,X.useRef)(null),l=K(e,o);return(0,Z.jsxs)(ge,{open:r,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:j(Ee,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Z.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(y,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(M,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(I,{shouldFilter:!1,children:[(0,Z.jsx)(F,{placeholder:`search workflows…`,value:o,onValueChange:s,onInput:()=>c.current?.scrollTo(0,0)}),(0,Z.jsxs)(R,{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,Z.jsx)(z,{children:`Nothing matches.`}):null,(0,Z.jsx)(V,{children:l.map(e=>{let r=t===e.name;return(0,Z.jsxs)(De,{value:`workflow ${e.name}`,keywords:Pe(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),a(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function xt({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:pe,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(B,{icon:(0,Z.jsx)(C,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function St({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),[c,l]=(0,X.useState)(null),u=(0,X.useRef)(null),{mostUsed:d,project:f,global:p,ranked:m}=Le(e,o,t),h=(e,t)=>{let i=n.includes(e.name);return(0,Z.jsxs)(De,{value:`skill ${e.name} ${e.path}`,keywords:Pe(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>r(e.name),children:[(0,Z.jsx)(`span`,{className:j(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(L,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(He,{skill:c,onClose:()=>l(null)}),(0,Z.jsxs)(ge,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:j(Ee,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(y,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(M,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(I,{shouldFilter:!1,children:[(0,Z.jsx)(F,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,Z.jsxs)(R,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(m?m.length===0:d.length===0&&f.length===0&&p.length===0)?(0,Z.jsx)(z,{children:`Nothing matches.`}):null,m?m.length>0?(0,Z.jsx)(V,{children:m.map(e=>h(e,Fe(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[d.length>0?(0,Z.jsx)(V,{heading:`Most used`,children:d.map(e=>h(e,Fe(e)))}):null,f.length>0?(0,Z.jsx)(V,{heading:`Project skills`,children:f.map(e=>h(e,!0))}):null,p.length>0?(0,Z.jsx)(V,{heading:`Global`,children:p.map(e=>h(e,!1))}):null]})]})]})})]})]})}var Ct=1e3,wt=100,Tt=350;function Et({width:e,onWidthChange:t}){let n=(0,X.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Ye(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,Z.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Ye(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function Dt(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Ot({view:e,changes:t=!1,index:n=!1}){let{n:i}=o(),s=oe({limit:Ct}),c=ce().data?.capabilities?.automations===!0,u=s.data,f=a(),_=e=>{f.setQueryData(D.uiState,t=>({...t,githubView:e})),ie({githubView:e}).then(e=>f.setQueryData(D.uiState,e)).catch(e=>{A(e instanceof Error?e.message:String(e),{tone:`danger`}),f.invalidateQueries({queryKey:D.uiState})})},v=(0,X.useRef)(null),y=ee({mutationFn:()=>g({refresh:!0,limit:Ct}),onSuccess:t=>{f.setQueryData(D.github({limit:Ct}),t),f.invalidateQueries({queryKey:D.githubChecks(He)}),f.invalidateQueries({queryKey:D.githubSearch(e===`issues`?`issue`:`pr`,B)});let n=v.current;if(!n){f.removeQueries({queryKey:[`github`,`comments`]});return}let r=D.githubComments(n.kind,n.number);l(n.kind,n.number,{refresh:!0}).then(e=>f.setQueryData(r,e)).catch(()=>{}),f.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==fe(r)})},onError:e=>A(e.message,{tone:`danger`})}),b=se(),S=te(),C=re(),[w,E]=(0,X.useState)(()=>mt().workflow),[ne,k]=(0,X.useState)(()=>mt().skills),[ae,le]=(0,X.useState)({runner:null,model:null,effort:null,account:null}),[pe,me]=(0,X.useState)(Xe),[M,he]=(0,X.useState)(!1),ge=e=>{let t=Ye(e);me(t),Ze(t)};(0,X.useEffect)(()=>{ht({workflow:w,skills:[...ne]})},[w,ne]);let _e=b.data?.workflows;(0,X.useEffect)(()=>{_e&&w!==null&&!_e.some(e=>e.name===w)&&E(null)},[_e,w]);let ve=S.data,ye=C.data?.skillUsage,be=(0,X.useMemo)(()=>Ie(ve??[],ye),[ve,ye]),[xe,Se]=(0,X.useState)(new Map),[N,Ce]=(0,X.useState)(``),[P,F]=(0,X.useState)([]),[I,we]=(0,X.useState)([]),[L,R]=(0,X.useState)(``),z=u?.projects?.some(e=>e.id===L)?L:``;(0,X.useEffect)(()=>{u&&L&&!z&&R(``)},[u,L,z]);let Te=()=>{Ce(``),F([]),we([]),R(``)},B=Dt(N,Tt),Ee=(0,X.useMemo)(()=>u?.available?e===`issues`?u.issues:u.prs:[],[u,e]),De=(0,X.useMemo)(()=>ct(Ee,{query:B,labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}),[Ee,B,P,e,I,z]),V=N.trim()===B.trim(),H=u?.available===!0&&V&&lt(B,De),U=m(e===`issues`?`issue`:`pr`,B,H),Oe=Ee,W=ct(Oe,{query:N,labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}),Me=e===`issues`&&i!==void 0&&!M,Ne=N.trim()!==``||P.length>0||e===`issues`&&(I.length>0||z!==``),K=H&&U.data?.available?U.data:null,Pe=new Set(W.map(e=>e.number)),Fe=e===`issues`&&K?z&&K.items.some(e=>e.projectIds===void 0)?K.projectsReason??`Project board data is incomplete. Refresh to try again.`:I.length&&K.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null,q=K&&!Fe?ct(K.items,{labels:P,...e===`issues`?{assignees:I,projectId:z}:{}}).filter(e=>!Pe.has(e.number)):[],Le=D.github()[0],J=i===void 0?null:Number.parseInt(i,10),Re=U.data?.available?U.data.items.find(e=>e.number===J):void 0,[Y,ze]=(0,X.useState)(null);(0,X.useEffect)(()=>{Re&&ze({scope:Le,view:e,item:Re})},[Le,e,Re]);let Be=Re??(Y?.scope===Le&&Y.view===e&&Y.item.number===J?Y.item:null),He=(()=>{if(!u?.available||e!==`prs`)return[];let t=new Set;J!==null&&Number.isInteger(J)&&t.add(J);for(let e of[...q,...u.prs]){if(t.size>=wt)break;t.add(e.number)}return[...t]})(),Ue=de(He,e===`prs`),We=Ue.data?.available?Ue.data.checks:void 0;if(n&&C.data?.githubView===`prs`)return(0,Z.jsx)(ke,{to:`/github/prs`,replace:!0});if(!u)return s.isError?(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(O,{icon:(0,Z.jsx)(x,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:s.error.message})}):(0,Z.jsx)(Ve,{});if(v.current=null,!u.available)return(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(O,{icon:(0,Z.jsx)(h,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:u.reason??`unknown reason`,actions:(0,Z.jsx)(T,{variant:`outline`,"data-action":`gh-retry`,disabled:y.isPending,onClick:()=>y.mutate(),children:`Try again`}),children:(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let Ke=N.trim()!==``&&!V||H&&U.isPending,qe={...K?.labelColors??{},...u.labelColors??{}},Je=st([...Oe,...K?.items??[]]),Q=i===void 0?null:Number.parseInt(i,10),$=Q===null?W[0]??q[0]??null:Oe.find(e=>e.number===Q)??Be??null;v.current=$?{kind:$.kind,number:$.number}:null;let Qe=e===`issues`?`/github`:`/github/prs`,$e=H&&(U.data?.available===!1||U.isError),et=U.data?.available===!1?U.data.reason??`unknown reason`:U.error instanceof Error?U.error.message:`the search request failed`,tt=Ne?Ke?(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,N.trim(),`”…`]}):$e?q.length>0?(0,Z.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,et,`. Use Refresh to try again.`]}):W.length>0?(0,Z.jsxs)(`p`,{children:[`GitHub could not be searched: `,et,`.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,et,`.`]}):Fe?(0,Z.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,Fe]}):q.length>0?null:K?.truncated?(0,Z.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):K&&W.length>0?(0,Z.jsxs)(`p`,{children:[`No additional `,e===`issues`?`issues`:`pull requests`,` match your filter on GitHub.`]}):K?(0,Z.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,Z.jsxs)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col gap-3 px-[18px] pt-[18px] pb-[calc(90px+env(safe-area-inset-bottom))] md:gap-[22px] md:p-9`,children:[(0,Z.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 md:gap-[22px]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:`GitHub`}),u.repo?(0,Z.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground`,children:[(0,Z.jsx)(`span`,{"data-slot":`gh-repo`,children:u.repo}),(0,Z.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,u.syncedAt?`Synced ${G(u.syncedAt)} ago`:`Not synced yet`]})]}):null]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(Ge,{to:`/github`,active:e===`issues`,onClick:()=>_(`issues`),children:[`Issues · `,kt(u.issues.length)]}),(0,Z.jsxs)(Ge,{to:`/github/prs`,active:e===`prs`,onClick:()=>_(`prs`),children:[`Pull requests · `,kt(u.prs.length)]}),c?(0,Z.jsx)(Ae,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:y.isPending,onClick:()=>y.mutate(),className:`gh-utility`,children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:j(`size-3.5`,y.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Z.jsx)(p,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Z.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:N,onChange:e=>Ce(e.target.value),className:`min-h-11 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,Z.jsx)(jt,{options:Je,colors:qe,selected:P,onChange:F}),e===`issues`?(0,Z.jsx)(ot,{data:{...u,issues:[...u.issues,...K?.items??[]]},assignees:I,projectId:z,onAssigneesChange:we,onProjectChange:R}):null,(0,Z.jsx)(`button`,{type:`button`,disabled:!Ne,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:Te,children:`Clear filters`})]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row`,children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-list`,"data-mobile-preview":Me||void 0,style:{"--github-list-width":`${pe}px`},className:`relative flex w-full min-h-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0`,children:[W.length===0?tt&&(0,Z.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):(0,Z.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-1`,children:W.map((t,n)=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,compactHidden:Me&&n>=2&&$?.url!==t.url,queued:xe.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))}),e===`issues`&&i!==void 0&&W.length>2?(0,Z.jsx)(T,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":M,onClick:()=>he(e=>!e),children:M?`Show fewer issues`:`View all ${W.length} issues`}):null,W.length>0&&H&&tt?(0,Z.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):null,q.length>0?(0,Z.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Z.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,K?.truncated?` (first matches)`:``]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:q.map(t=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,queued:xe.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))})]}):null,(0,Z.jsx)(Et,{width:pe,onWidthChange:ge})]}),(0,Z.jsx)(`section`,{"data-slot":`gh-detail`,className:j(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card`,i===void 0?`hidden md:flex`:`flex`),children:$?(0,Z.jsx)(Nt,{item:$,listPath:Qe,colors:qe,changes:t,checks:$.kind===`pr`?We?.[$.number]??$.checks:$.checks,children:(0,Z.jsx)(yt,{item:$,workflows:b.data?.workflows??[],skills:be,workflow:w,onWorkflowChange:E,selectedSkills:ne,onSkillsChange:k,engine:ae,onEngineChange:le,queuedRunId:xe.get($.url)??null,onQueued:(e,t)=>Se(n=>new Map(n).set(e,t))},$.url)}):(0,Z.jsx)(O,{icon:e===`issues`?(0,Z.jsx)(r,{size:16}):(0,Z.jsx)(ue,{size:16}),tone:`neutral`,heading:`h2`,title:Q===null?`Nothing selected`:`Not found`,subtitle:Q===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${Q} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${Q} above to look it up on GitHub, closed and merged included.`})})]})]})}function kt(e){return`${e}${e>=Ct?`+`:``}`}function At({item:e,view:t,colors:n,active:i,compactHidden:o,queued:s,checks:c}){let u=e.kind===`issue`?r:ue,d=a(),f=()=>{d.prefetchQuery({queryKey:D.githubComments(e.kind,e.number),queryFn:({signal:t})=>l(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Z.jsx)(`li`,{"data-compact-hidden":o||void 0,children:(0,Z.jsxs)(Ae,{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:f,onFocus:f,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:j(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,i&&`bg-accent-strong/10 text-accent-text`),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,Z.jsx)(u,{"aria-hidden":`true`,className:j(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,Z.jsx)(`span`,{className:j(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,i&&`font-semibold`),children:e.title})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[10.5px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,Z.jsxs)(`span`,{children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),(0,Z.jsx)(Zt,{count:e.comments}),c?(0,Z.jsx)($t,{checks:c}):null,s?(0,Z.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Z.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e],plain:!0},e))}):null]})})}function jt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,X.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Z.jsxs)(ge,{open:i,onOpenChange:a,children:[(0,Z.jsx)(he,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:j(`flex min-h-11 min-w-11 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-accent-strong/60 text-foreground`),children:[(0,Z.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Z.jsx)(M,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Z.jsxs)(I,{children:[(0,Z.jsx)(F,{placeholder:`Filter labels…`}),(0,Z.jsxs)(R,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Z.jsx)(z,{children:`No labels.`}),n.length>0?(0,Z.jsxs)(De,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Z.jsxs)(De,{value:e,onSelect:()=>o(e),className:`min-h-11`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ut(t[e])}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}function Mt({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:ut(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function Nt({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,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsxs)(Ae,{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,Z.jsx)(_,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Z.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Z.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,Z.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:o}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsxs)(`span`,{children:[G(e.createdAt),` ago`]}),e.comments?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(Zt,{count:e.comments})]}):null,s?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,me(e.url)?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),e.kind===`pr`?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e]},e)),a?(0,Z.jsx)(Qt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,Z.jsx)(Lt,{item:e}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Z.jsx)(Rt,{item:e,colors:n})]})]}),e.kind===`pr`?(0,Z.jsx)(It,{number:e.number}):null,r]})}var Pt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Ft({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:j(t,`text-success`)}):e===`failing`?(0,Z.jsx)(k,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:j(t,`text-danger`)}):e===`pending`?(0,Z.jsx)(je,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:j(t,`animate-spin text-warning`)}):(0,Z.jsx)(E,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:j(t,`text-soft-foreground`)})}function It({number:e}){let t=a(),n=c({queryKey:D.githubMergeState(e),queryFn:({signal:t})=>f(e,{},{signal:t}),retry:!1}),r=n.data?.available?n.data.mergeState:null,[i,o]=(0,X.useState)(null),[s,l]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),h=ee({mutationFn:()=>f(e,{refresh:!0}),onSuccess:n=>t.setQueryData(D.githubMergeState(e),n),onError:e=>A(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=i&&r?.methods.includes(i)?i:r?.defaultMethod??r?.methods[0]??null,_=ee({mutationFn:()=>{if(!r||!g)throw Error(`No merge method is available.`);return u(e,{method:g,expectedHeadSha:r.headSha,...p&&r.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{l(!1),A(`Pull request #${e} merged`),t.invalidateQueries({queryKey:D.githubMergeState(e)}),t.invalidateQueries({queryKey:D.github({limit:Ct})}),t.invalidateQueries({queryKey:D.githubComments(`pr`,e)})},onError:n=>{A(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:D.githubMergeState(e)})}});if(n.isPending)return(0,Z.jsx)(Je,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!r)return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.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 v=r.state===`merged`?`Merged`:r.state===`closed`?`Closed`:r.isDraft?`Draft`:r.mergeable===`conflicting`?`Conflicts must be resolved`:r.canMerge?`Ready to merge`:r.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`,y=r.reviewDecision===`approved`?`passing`:r.reviewDecision===`unknown`?`unknown`:`failing`,S=r.mergeable===`mergeable`?`passing`:r.mergeable===`conflicting`?`failing`:`unknown`,C=!!(g&&(r.canMerge||r.canOverride&&p));return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":r.eligibility,"data-conflicting":r.mergeable===`conflicting`?`true`:void 0,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[r.canMerge?(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Z.jsx)(x,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:v}),(0,Z.jsxs)(T,{type:`button`,variant:`ghost`,size:`sm`,disabled:h.isPending,onClick:()=>h.mutate(),children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:j(`size-3.5`,h.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[r.headRef,` (`,r.headSha.slice(0,7),`) → `,r.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:y}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,r.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:S}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,r.mergeable===`conflicting`?`present`:r.mergeable===`mergeable`?`none`:`unknown`]})]}),r.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):r.checks.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&me(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),r.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),r.mergeable===`conflicting`?(0,Z.jsx)(T,{className:`mt-4`,onClick:e=>{let t=e.currentTarget.closest(`article`)?.querySelector(`[data-slot="gh-custom-prompt"]`);t?.scrollIntoView({block:`center`}),t?.focus({preventScroll:!0})},children:`Run agent on this PR`}):null,r.canOverride?(0,Z.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,Z.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.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,r.eligibility===`unknown`?(0,Z.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,r.state===`open`&&r.methods.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsx)(`select`,{"aria-label":`Merge method`,value:g??``,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:r.methods.map(e=>(0,Z.jsx)(`option`,{value:e,children:Pt[e]},e))}),(0,Z.jsx)(T,{disabled:!C,onClick:()=>l(!0),children:g?Pt[g]:`Merge`})]}):null]})]}),(0,Z.jsx)(ye,{open:s,onOpenChange:l,children:(0,Z.jsxs)(xe,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(be,{children:[(0,Z.jsxs)(Se,{children:[g?Pt[g]:`Merge`,` pull request #`,e,`?`]}),(0,Z.jsx)(ve,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,r.title,`” into `,r.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),p&&r.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),_.error?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:_.error.message}):null,(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(T,{variant:`outline`,disabled:_.isPending,onClick:()=>l(!1),children:`Cancel`}),(0,Z.jsx)(T,{disabled:_.isPending,onClick:()=>_.mutate(),children:_.isPending?`Merging…`:g?Pt[g]:`Merge`})]})]})})]})}function Lt({item:e}){let t=a(),n=le(e.number),[r,i]=(0,X.useState)(``),[o,c]=(0,X.useState)(null),l=n.data,u=l?.available?l.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],d=u.findIndex(e=>e.path===o);(0,X.useEffect)(()=>{u.length>0&&!u.some(e=>e.path===o)&&c(u[0].path)},[l?.available?l.headSha:``,r]);let f=async()=>{let n=l?.available?l.headSha:null,r=await s(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(c(r.files[0]?.path??null),A(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!l)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!l.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:l.reason});let p=u.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??``})),m=me(e.url)?`${e.url}/files`:null,h=u.find(e=>e.path===o);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[l.files.length,` changed files`]}),(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,l.additions]}),(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,l.deletions]}),(0,Z.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:l.headSha,children:[`head `,l.headSha.slice(0,8)]}),(0,Z.jsx)(T,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void f(),children:`Refresh`})]}),l.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[l.reason??`This response is incomplete.`,` `,m?(0,Z.jsx)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.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,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:o??``,onChange:e=>c(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:u.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:u.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>c(e.path),className:j(`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,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(T,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:d<=0,onClick:()=>c(u[d-1]?.path??null),children:(0,Z.jsx)(Ke,{})}),(0,Z.jsx)(T,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:d<0||d>=u.length-1,onClick:()=>c(u[d+1]?.path??null),children:(0,Z.jsx)(S,{size:16})})]}),u.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(We,{files:p.filter(e=>e.path===o),wrap:!0,className:`min-w-0`}),h&&!h.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,h.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Rt({item:e,colors:t}){let n=w(e.kind,e.number),r=n.data,i=(0,X.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(zt(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,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(Je,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(Je,{className:`h-14 w-full`}),(0,Z.jsx)(Je,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.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,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Bt(i).map(e=>e.group===`commits`?(0,Z.jsx)(Vt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(qt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Ut,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var zt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Bt(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 Vt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.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,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Ut,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.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,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e[e.length-1].createdAt)})]})})}var Ht={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Ut({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:j(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Ht[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Wt,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e.createdAt)}),e.url?(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Wt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Gt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:ut(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,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Z.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Z.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Z.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Z.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Gt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:j(`shrink-0`,Xt[e]),children:Yt[e]}):null}var Kt={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 qt({comment:e}){let t=e.reviewState?Kt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Z.jsx)(Jt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:j(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Z.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,Z.jsx)(P,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Jt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.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,Z.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 Yt={passing:`✓`,failing:`✗`,pending:`○`},Xt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Zt({count:e}){return e?(0,Z.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,Z.jsx)(Me,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Qt({checks:e,url:t}){let n=j(`text-[11px] font-medium`,Xt[e],t&&`hover:underline`),r=`${Yt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function $t({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:j(`shrink-0 font-sans text-[11px] font-semibold`,Xt[e]),children:Yt[e]})}export{Ot as GithubRoute};
@@ -1 +1 @@
1
- import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./zoomable-image-yNqiuVu7.js";var n=e();function r(e){return e.image===!0&&(e.binary===!0||e.patch===``)}function i({file:e,imageSrc:r,onOpenInApp:i}){return e.status===`deleted`?(0,n.jsx)(a,{children:`Image deleted — only the new side can be previewed.`}):r?(0,n.jsxs)(`div`,{"data-slot":`diff-image-preview`,className:`flex flex-col items-center gap-2 p-4`,children:[(0,n.jsx)(t,{src:r(e.path),alt:e.path,className:`max-h-[60vh] max-w-full rounded-sm`}),i?(0,n.jsx)(`button`,{type:`button`,"data-slot":`diff-image-open`,onClick:()=>i(e.path),className:`text-[11px] font-medium text-soft-foreground hover:text-foreground hover:underline`,children:`Open in default app`}):null]}):(0,n.jsx)(a,{children:`Binary file — no text diff.`})}function a({children:e}){return(0,n.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}export{r as n,i as t};
1
+ import{t as e}from"./react-runtime-CCIEwYL0.js";import{t}from"./zoomable-image-DUE1KFJ0.js";var n=e();function r(e){return e.image===!0&&(e.binary===!0||e.patch===``)}function i({file:e,imageSrc:r,onOpenInApp:i}){return e.status===`deleted`?(0,n.jsx)(a,{children:`Image deleted — only the new side can be previewed.`}):r?(0,n.jsxs)(`div`,{"data-slot":`diff-image-preview`,className:`flex flex-col items-center gap-2 p-4`,children:[(0,n.jsx)(t,{src:r(e.path),alt:e.path,className:`max-h-[60vh] max-w-full rounded-sm`}),i?(0,n.jsx)(`button`,{type:`button`,"data-slot":`diff-image-open`,onClick:()=>i(e.path),className:`text-[11px] font-medium text-soft-foreground hover:text-foreground hover:underline`,children:`Open in default app`}):null]}):(0,n.jsx)(a,{children:`Binary file — no text diff.`})}function a({children:e}){return(0,n.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:e})}export{r as n,i as t};