@open-mercato/cezar 0.19.0 → 0.20.0-pr1372.4752
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/contract/index.js +4 -1
- package/dist/contract/repo.d.ts +3 -1
- package/dist/git-worktree.d.ts +2 -1
- package/dist/git-worktree.js +7 -2
- package/dist/git-worktree.js.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/runs/retention.d.ts +9 -2
- package/dist/runs/retention.js +23 -4
- package/dist/runs/retention.js.map +1 -1
- package/dist/server/server.d.ts +12 -10
- package/dist/server/server.js +27 -2
- package/dist/server/server.js.map +1 -1
- package/dist/worktree-in-use.d.ts +25 -0
- package/dist/worktree-in-use.js +274 -0
- package/dist/worktree-in-use.js.map +1 -0
- package/dist/worktree-lifecycle/coordinator.js +4 -0
- package/dist/worktree-lifecycle/coordinator.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{agent-task-pickers-C6pdeuHJ.js → agent-task-pickers-C0lbPIio.js} +1 -1
- package/web/dist/assets/{alert-dialog-DsAKVB9U.js → alert-dialog-D7_6EawW.js} +1 -1
- package/web/dist/assets/arrow-left-Ci5OwIMH.js +1 -0
- package/web/dist/assets/{arrow-up-DerG9eQK.js → arrow-up-Pd8kIuRY.js} +1 -1
- package/web/dist/assets/{assets-view-COAZvPqm.js → assets-view-Dig8Ow0W.js} +1 -1
- package/web/dist/assets/{automation-format-DmmN5Z7N.js → automation-format-MLNn8qnY.js} +1 -1
- package/web/dist/assets/{automations-route-C9h3Pe23.js → automations-route-B_hyZJ2Q.js} +1 -1
- package/web/dist/assets/{bot-tf6AC27f.js → bot-TU5OTE8D.js} +1 -1
- package/web/dist/assets/{button-DhBNRPDb.js → button-jcXhXi-5.js} +1 -1
- package/web/dist/assets/{centered-state-DWZ57Ha1.js → centered-state-zjxxQcEb.js} +1 -1
- package/web/dist/assets/check-CNVywZ6B.js +1 -0
- package/web/dist/assets/chevron-left-D94sZNQc.js +1 -0
- package/web/dist/assets/chevron-right-D2EqYt_O.js +1 -0
- package/web/dist/assets/circle-check-C09e7mFj.js +1 -0
- package/web/dist/assets/{collapsible-BXlCnxCU.js → collapsible-BGyXLTVv.js} +1 -1
- package/web/dist/assets/{commit-list-Inz2UHlC.js → commit-list-DxiIebKF.js} +1 -1
- package/web/dist/assets/{compare-variants-B66gT_Lp.js → compare-variants-RfJUgKZi.js} +1 -1
- package/web/dist/assets/{dashboard-DQ2EsruE.js → dashboard-CPnDqmbf.js} +1 -1
- package/web/dist/assets/{diff-NBMGWe9I.js → diff-DpElozOH.js} +2 -2
- package/web/dist/assets/{diff-stat-CgvKmRgV.js → diff-stat-YT7Licr1.js} +1 -1
- package/web/dist/assets/{diff-view-t0WQPrPT.js → diff-view-mNp6Fo84.js} +1 -1
- package/web/dist/assets/{dist-BJiHofth.js → dist-C2IyLYZs.js} +1 -1
- package/web/dist/assets/{download-CEvQNLNA.js → download-Cu9ySzL2.js} +1 -1
- package/web/dist/assets/{dropdown-menu-R7qzKuR5.js → dropdown-menu-Da8iP-nI.js} +1 -1
- package/web/dist/assets/{external-link-OzBGW2PE.js → external-link-CTJbUN9h.js} +1 -1
- package/web/dist/assets/{facet-filter-Qbx1pf2T.js → facet-filter-Be0XFoHu.js} +1 -1
- package/web/dist/assets/{file-fM0ty7CG.js → file-D9jm2sJ3.js} +1 -1
- package/web/dist/assets/{file-preview-vKAohITF.js → file-preview-BIAcYezC.js} +1 -1
- package/web/dist/assets/{file-tree-DZ2eXzpR.js → file-tree-hpaNl9qS.js} +1 -1
- package/web/dist/assets/{folder-DdjIxY7B.js → folder-Ctd1Xvqx.js} +1 -1
- package/web/dist/assets/{follow-up-engine-BSEbPKpI.js → follow-up-engine-WsUFV3Ry.js} +1 -1
- package/web/dist/assets/{git-pull-request-D2gvtstb.js → git-pull-request-BAfSEvVb.js} +1 -1
- package/web/dist/assets/{git-pull-request-draft-CLy0NzfX.js → git-pull-request-draft-BIgZJsu-.js} +1 -1
- package/web/dist/assets/{git-tab-loading-BfHswOkO.js → git-tab-loading-BnU4U-BA.js} +1 -1
- package/web/dist/assets/{github-3riSQ6Lm.js → github-DnDrPPfz.js} +1 -1
- package/web/dist/assets/{host-usage-7ZdPz-XK.js → host-usage-BeX2ZFmV.js} +1 -1
- package/web/dist/assets/{icon-tooltip-DWp0bFCr.js → icon-tooltip-BfI1AC00.js} +1 -1
- package/web/dist/assets/{impact-control-C6qnPF32.js → impact-control-Ba9XW3tV.js} +1 -1
- package/web/dist/assets/{impact-model-BXkk-8LD.js → impact-model-Bo4KSZmi.js} +1 -1
- package/web/dist/assets/{index-BJPVto-W.js → index-Crs_dvXc.js} +5 -5
- package/web/dist/assets/{input-Cv2-g500.js → input-vswZUfsf.js} +1 -1
- package/web/dist/assets/{layout-cards-rvwV0uTN.js → layout-cards-BxB9Sv6Z.js} +1 -1
- package/web/dist/assets/loader-circle-BuBcxAH7.js +1 -0
- package/web/dist/assets/{markdown-DpThfUoB.js → markdown--qN61YgZ.js} +1 -1
- package/web/dist/assets/{markdown-ugFgDUM5.js → markdown-BiRiR9OM.js} +1 -1
- package/web/dist/assets/{message-square-k8K2YFw2.js → message-square-Jt8U2gAH.js} +1 -1
- package/web/dist/assets/{picker-pill-DjKsq5S1.js → picker-pill-BFprBA9h.js} +1 -1
- package/web/dist/assets/plus-nGmv0BVG.js +1 -0
- package/web/dist/assets/{project-router-DXcbRXxc.js → project-router-ByYpf5zi.js} +1 -1
- package/web/dist/assets/{queries-DvnoUOE1.js → queries-DbDUaheq.js} +1 -1
- package/web/dist/assets/{reasoning-effort-pill-BtWN6FBA.js → reasoning-effort-pill-BMAjcAKk.js} +1 -1
- package/web/dist/assets/{repo-git-DQHghYiX.js → repo-git-CpbhUvyL.js} +1 -1
- package/web/dist/assets/{run-diff-CymNF6XN.js → run-diff-DTbhZHQE.js} +1 -1
- package/web/dist/assets/{save-A5Be1rcj.js → save-DGJET0jv.js} +1 -1
- package/web/dist/assets/{scroll-within-DIDO40Ps.js → scroll-within-sbc5xXAl.js} +1 -1
- package/web/dist/assets/search-P545ZVzc.js +1 -0
- package/web/dist/assets/{search-x-DHAJ1hHA.js → search-x-BI_L6x3P.js} +1 -1
- package/web/dist/assets/{settings-2-CT4CHpD0.js → settings-2-CcipoS54.js} +1 -1
- package/web/dist/assets/{sheet-D8vk1p4X.js → sheet-DJ7Q8rRA.js} +1 -1
- package/web/dist/assets/{skills-BAzH59kW.js → skills-DwnXdnzS.js} +1 -1
- package/web/dist/assets/{square-dKpVPAsQ.js → square-CuNOgYBC.js} +1 -1
- package/web/dist/assets/{tabs-B_vUNwk9.js → tabs-BCUQqEYa.js} +1 -1
- package/web/dist/assets/{tag-BWgO0bkB.js → tag-DHjatodA.js} +1 -1
- package/web/dist/assets/{task-commits-rj991QXb.js → task-commits-x21u_XE-.js} +1 -1
- package/web/dist/assets/{task-graph-VKJ_lfXL.js → task-graph-DdCE5G3r.js} +1 -1
- package/web/dist/assets/{task-notes-CyXwM1jJ.js → task-notes-C6RP3maE.js} +1 -1
- package/web/dist/assets/task-workspace-xnZHXFXk.js +29 -0
- package/web/dist/assets/terminal-ZT2Z_ALj.js +1 -0
- package/web/dist/assets/{terminal-drawer-BZItdxn-.js → terminal-drawer-Dm0kyMmF.js} +1 -1
- package/web/dist/assets/{terminal-pane-D4ZoQdKv.js → terminal-pane-CRjYeI78.js} +1 -1
- package/web/dist/assets/{textarea-DGt1COuN.js → textarea-Ckx3d0hV.js} +1 -1
- package/web/dist/assets/{toaster-DkOynrTr.js → toaster-CejrnYvv.js} +1 -1
- package/web/dist/assets/{token-metrics-CH6yTO0m.js → token-metrics-BINGXGrg.js} +1 -1
- package/web/dist/assets/{tooltip-DZFNJfGV.js → tooltip-26XdOGj8.js} +1 -1
- package/web/dist/assets/{tracker-CfV4FaME.js → tracker-BzXE6yLf.js} +1 -1
- package/web/dist/assets/{triangle-alert-DPgo0TAM.js → triangle-alert-CBrg6nYB.js} +1 -1
- package/web/dist/assets/{upload-CyWxzeww.js → upload-Cu6NRABh.js} +1 -1
- package/web/dist/assets/{use-now-p7SRpNs9.js → use-now-CdtIyF-0.js} +1 -1
- package/web/dist/assets/{use-submit-shortcut-DbaZm8p1.js → use-submit-shortcut-B3TJ3HBP.js} +1 -1
- package/web/dist/assets/{utils-DujIMO-J.js → utils-Bl_tQdVw.js} +1 -1
- package/web/dist/assets/{workflow-graph-Bi8UYX1n.js → workflow-graph-CkCPBwhB.js} +1 -1
- package/web/dist/assets/{worktree-lifecycle-operation-D7uIWIl_.js → worktree-lifecycle-operation-UpV9MAuk.js} +1 -1
- package/web/dist/assets/x-Qhn_uE86.js +1 -0
- package/web/dist/index.html +50 -50
- package/dist/telemetry-service.json +0 -1
- package/web/dist/assets/arrow-left-D773GDAV.js +0 -1
- package/web/dist/assets/check--JMF5pzG.js +0 -1
- package/web/dist/assets/chevron-left-BiwkBjqr.js +0 -1
- package/web/dist/assets/chevron-right-QEoLhwFQ.js +0 -1
- package/web/dist/assets/circle-check-C7cRTvGo.js +0 -1
- package/web/dist/assets/loader-circle-wWXhd3lT.js +0 -1
- package/web/dist/assets/plus-BCu7YC-w.js +0 -1
- package/web/dist/assets/search-_XntIRWA.js +0 -1
- package/web/dist/assets/task-workspace-BsOvp8_P.js +0 -29
- package/web/dist/assets/terminal-De3oF9fR.js +0 -1
- package/web/dist/assets/x-BzTqCf_Q.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,F as i,Fi as a,Fr as o,Kt as s,M as c,N as l,O as u,ai as d,ao as f,cn as p,co as m,go as h,ii as g,in as ee,k as _,na as v,ni as y,r as b,ri as x,so as S,ti as C,uo as w}from"./queries-DvnoUOE1.js";import{c as T,mt as E,n as D,t as O}from"./utils-DujIMO-J.js";import{r as te,t as ne,x as re}from"./project-router-DXcbRXxc.js";import{_ as k,g as A,h as j,i as M,m as ie,o as ae,p as N,s as oe,v as se,x as ce,y as le}from"./use-now-p7SRpNs9.js";import{i as ue}from"./facet-filter-Qbx1pf2T.js";import{a as de,c as fe,f as pe,i as me,m as he,o as ge,p as P,r as _e,t as ve,u as ye}from"./sheet-D8vk1p4X.js";import{N as be,t as F}from"./button-DhBNRPDb.js";import{t as xe}from"./arrow-left-D773GDAV.js";import{E as Se,F as Ce,I,M as we,c as Te,d as L,f as Ee,l as De,s as Oe}from"./worktree-lifecycle-operation-D7uIWIl_.js";import{Et as ke,Ot as R,gt as z}from"./picker-pill-DjKsq5S1.js";import{t as B}from"./check--JMF5pzG.js";import{t as V}from"./chevron-left-BiwkBjqr.js";import{t as Ae}from"./chevron-right-QEoLhwFQ.js";import{t as H}from"./circle-check-C7cRTvGo.js";import{h as U}from"./dropdown-menu-R7qzKuR5.js";import{n as je,t as W}from"./use-submit-shortcut-DbaZm8p1.js";import{t as G}from"./external-link-OzBGW2PE.js";import{_ as Me,m as Ne}from"./impact-model-BXkk-8LD.js";import{t as Pe}from"./git-pull-request-D2gvtstb.js";import{n as K,t as Fe}from"./textarea-DGt1COuN.js";import{t as Ie}from"./loader-circle-wWXhd3lT.js";import{t as q}from"./message-square-k8K2YFw2.js";import{n as J}from"./square-dKpVPAsQ.js";import{t as Le}from"./search-_XntIRWA.js";import{t as Re}from"./tag-BWgO0bkB.js";import{t as ze}from"./triangle-alert-DPgo0TAM.js";import{t as Be}from"./x-BzTqCf_Q.js";import{r as Y}from"./toaster-DkOynrTr.js";import{n as X}from"./format-DHK74MwW.js";import{t as Ve}from"./lib-BQXq3kEf.js";import{t as He}from"./centered-state-DWZ57Ha1.js";import{t as Ue}from"./markdown-DpThfUoB.js";import{C as Z,D as We,E as Ge,G as Ke,O as qe,S as Je,T as Ye,_ as Xe,d as Ze,f as Qe,g as $e,h as et,m as tt,n as nt,p as rt,u as it,v as at,w as ot,x as st,y as ct}from"./index-BJPVto-W.js";import{i as lt,n as ut,r as dt,t as ft}from"./agent-task-pickers-C6pdeuHJ.js";import{t as pt}from"./diff-NBMGWe9I.js";import{t as mt}from"./impact-control-C6qnPF32.js";var ht=be(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Q=e(t(),1),$=n(),gt=class extends Error{};function _t({src:e,alt:t,srcSet:n,...r}){f();let i=T(),a=typeof e==`string`?e:``,o=E(a),s=m({queryKey:[`github-asset`,i,a],queryFn:async({signal:e})=>{let t=await y(a,{signal:e},i);if(!t.available&&t.retryable)throw new gt;return t},enabled:o,staleTime:5*6e4,gcTime:6e4,retry:(e,t)=>t instanceof gt&&e<16,retryDelay:1e3});return o?s.data?.available?(0,$.jsx)(`img`,{...r,src:s.data.dataUrl,alt:t}):(0,$.jsxs)(`span`,{role:`img`,"aria-label":t||`Image`,children:[t||`Image`,s.isPending?` (loading…)`:` (unavailable)`]}):(0,$.jsx)(`img`,{...r,src:e,alt:t})}function vt({children:e}){return(0,$.jsx)(Ue,{imageComponent:_t,children:e})}function yt({item:e}){if(e.kind!==`issue`||e.assignees===void 0&&e.linkedPrs===void 0)return null;let t=`inline-flex min-w-0 max-w-full items-center gap-1 rounded border border-border/70 px-1.5 py-0.5`;return(0,$.jsxs)(`div`,{"aria-label":`Issue #${e.number} ownership`,role:`group`,className:`flex min-w-0 flex-wrap items-center gap-1 px-2.5 pb-2 pl-8 text-meta text-muted-foreground`,children:[e.assignees===void 0?null:(0,$.jsxs)(`span`,{className:t,title:e.assignees.length?`Assigned to ${e.assignees.map(e=>`@${e}`).join(`, `)}`:void 0,children:[(0,$.jsx)(ht,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.assignees.length?`Assigned to ${e.assignees.map(e=>`@${e}`).join(`, `)}`:e.assigneesTruncated?`Assignees`:`Unassigned`})]}),e.assigneesTruncated&&D(e.url)?(0,$.jsx)(`a`,{className:O(t,`hover:text-foreground focus-visible:outline focus-visible:outline-ring`),href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`More assignees for issue #${e.number}`,children:`More assignees…`}):null,e.linkedPrs?.map(e=>{let n=e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:`Open`,r=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pe,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[`PR #`,e.number,` · `,n]})]}),i=O(t,e.state===`merged`?`text-violet`:e.state===`open`&&!e.isDraft?`text-success`:``);return D(e.url)?(0,$.jsx)(`a`,{className:O(i,`hover:underline focus-visible:outline focus-visible:outline-ring`),href:e.url,target:`_blank`,rel:`noopener noreferrer`,title:`${e.title} — ${e.url}`,"aria-label":`PR #${e.number} · ${n}: ${e.title}`,children:r},e.url):(0,$.jsx)(`span`,{className:i,children:r},e.url)}),e.linkedPrsTruncated&&D(e.url)?(0,$.jsx)(`a`,{className:O(t,`hover:text-foreground focus-visible:outline focus-visible:outline-ring`),href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`More linked pull requests for issue #${e.number}`,children:`More linked PRs…`}):null]})}function bt({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:a,selectedSkills:s,onSkillsChange:c,engine:l,onEngineChange:u,queuedRunId:d,onQueued:f}){let p=w(),m=ee(),h=e.kind===`pr`?`PR`:`issue`,g=s.filter(e=>n.some(t=>t.name===e)),[_]=(0,Q.useState)(()=>qe(e)),[y,x]=(0,Q.useState)(()=>et(e.url)||_),C=tt(l),T=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{Xe(e.url,y===_?``:y)},[e.url,y,_]);let E=i(),D=(0,Q.useMemo)(()=>Te(L(m.data?.promptTemplates),E.data?.capabilities),[m.data?.promptTemplates,E.data?.capabilities]),O=e=>{let t=T.current,n=y===_?y.length:t?.selectionStart??y.length,r=De(y,n,e);x(r.text),requestAnimationFrame(()=>{T.current?.focus(),T.current?.setSelectionRange(r.caret,r.caret)})},te=Oe(D,g),re=(0,Q.useRef)(y);re.current=y;let k=(0,Q.useRef)(``);(0,Q.useEffect)(()=>{let e=Ee(re.current,k.current,te,_);k.current=e.applied,e.text!==re.current&&x(e.text)},[te,_]);let A=S({mutationFn:async()=>C.canRun?o(Ge(e,r,g,y,Qe(C))):null,onSuccess:t=>{if(t===null)return;z(`github`);let n=`runs`in t?t.runs[0]:t;n&&f(e.url,n.id),Y(`Added to the queue — ${h} #${e.number}`),g.length>0&&m.data!==void 0&&v({skillUsage:g.reduce((e,t)=>Se(e,t),m.data.skillUsage)}).then(()=>p.invalidateQueries({queryKey:b.uiState})).catch(()=>{}),Xe(e.url,``),x(_),k.current=``,p.invalidateQueries({queryKey:b.runs.all})},onError:e=>Y(e.message,{tone:`danger`})}),j=e=>{W({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(),!A.isPending&&C.canRun&&A.mutate())},M=e=>c(s.includes(e)?s.filter(t=>t!==e):[...s,e]);return(0,$.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-1.5 eyebrow text-soft-foreground`,children:[(0,$.jsx)(ke,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(ut,{workflows:t,value:r,onChange:a}),(0,$.jsx)(ft,{skills:n,skillUsage:m.data?.skillUsage,selected:g,onToggle:M}),(0,$.jsx)(Ze,{pick:l,onChange:u,disabled:A.isPending||!C.canRun,accounts:!0}),(0,$.jsx)(dt,{resolved:C,dataSlot:`gh-provider-gate`}),(0,$.jsx)(it,{templates:D,onInsert:O})]}),g.length>0?(0,$.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:g.map(e=>(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>M(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-meta font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,$.jsx)(Be,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,$.jsx)(Fe,{ref:T,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:y,onChange:e=>x(e.target.value),onKeyDown:j,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-ui`}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,$.jsxs)(F,{variant:`contrast`,"data-action":`gh-run`,disabled:A.isPending||!C.canRun,onClick:()=>A.mutate(),children:[(0,$.jsx)(J,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,h]}),(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-micro font-medium text-muted-foreground`,children:je()}),d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,$.jsx)(B,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,$.jsx)(ne,{to:`/tasks/${d}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}var xt=10;function St(e){let[t,n]=(0,Q.useState)(0),r=(0,Q.useRef)(null),i=(0,Q.useRef)(!1),a=e=>{i.current=!1,e.pointerType===`touch`&&(r.current={id:e.pointerId,x:e.clientX,y:e.clientY,axis:null})},o=e=>{let t=r.current;if(!t||t.id!==e.pointerId)return;let a=e.clientX-t.x,o=e.clientY-t.y;if(t.axis===null){if(Math.abs(a)<xt&&Math.abs(o)<xt)return;t.axis=Math.abs(a)>Math.abs(o)?`x`:`y`}t.axis===`x`&&(i.current=!0,n(Math.max(-112,Math.min(0,a))))},s=(t,i)=>{let a=r.current;!a||a.id!==t.pointerId||(r.current=null,n(0),!i&&a.axis===`x`&&t.clientX-a.x<=-72&&e())};return{offset:t,handlers:{onPointerDown:a,onPointerMove:o,onPointerUp:e=>s(e,!1),onPointerCancel:e=>s(e,!0),onClickCapture:e=>{i.current&&(i.current=!1,e.preventDefault(),e.stopPropagation())},onKeyDown:()=>{i.current=!1}}}}function Ct({offset:e}){return e===0?null:(0,$.jsxs)(`span`,{"aria-hidden":`true`,"data-slot":`gh-swipe-reveal`,className:O(`absolute inset-y-0 right-0 flex items-center gap-1.5 rounded-md px-4 text-xs font-semibold transition-colors`,e<=-72?`bg-violet text-violet-foreground`:`bg-violet/15 text-violet`),children:[(0,$.jsx)(J,{className:`size-3.5`}),`Run…`]})}function wt({item:e,open:t,onOpenChange:n,workflows:r,skills:i,engine:a,onQueued:s}){let c=w(),l=ee(),u=tt(a),[d,f]=(0,Q.useState)(``),p=S({mutationFn:async e=>({pick:e,created:await o(Ge(e.target,e.workflow,e.skill?[e.skill]:[],qe(e.target),Qe(u)))}),onSuccess:({pick:e,created:t})=>{z(`github`);let r=`runs`in t?t.runs[0]:t;r&&s(e.target.url,r.id),Y(`Added to the queue — ${e.target.kind===`pr`?`PR`:`issue`} #${e.target.number}`),n(!1),f(``),e.skill&&l.data!==void 0&&v({skillUsage:Se(l.data.skillUsage,e.skill)}).then(()=>c.invalidateQueries({queryKey:b.uiState})).catch(()=>{}),c.invalidateQueries({queryKey:b.runs.all})},onError:e=>Y(e.message,{tone:`danger`})}),m=(t,n)=>{!e||p.isPending||!u.canRun||p.mutate({target:e,workflow:t,skill:n})},h=p.isPending||!u.canRun,g=I(r,d),_=Ce([...i],d,l.data?.skillUsage);return(0,$.jsx)(ve,{open:t,onOpenChange:e=>{e||f(``),n(e)},children:(0,$.jsxs)(_e,{side:`bottom`,"data-slot":`gh-swipe-sheet`,onOpenAutoFocus:e=>e.preventDefault(),className:`max-h-[85dvh] gap-0 rounded-t-xl pb-[env(safe-area-inset-bottom)]`,children:[(0,$.jsxs)(de,{className:`pb-2`,children:[(0,$.jsxs)(ge,{className:`truncate text-base`,children:[`Run agent on `,e?`${e.kind===`pr`?`PR`:`issue`} #${e.number}`:`…`]}),(0,$.jsxs)(me,{className:`truncate text-xs`,children:[e?.title??``,` — tap a workflow or skill to start.`]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 pb-2`,children:[(0,$.jsx)(dt,{resolved:u,dataSlot:`gh-swipe-provider-gate`}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Le,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,$.jsx)(`input`,{type:`search`,"data-slot":`gh-swipe-filter`,"aria-label":`Filter workflows and skills`,placeholder:`Filter workflows and skills…`,value:d,onChange:e=>f(e.target.value),className:`w-full rounded-md border border-input bg-card py-2 pr-2 pl-7 text-body outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:[g.length>0?(0,$.jsx)(Tt,{label:`Workflows`,children:g.map(e=>(0,$.jsx)(Et,{slot:`gh-swipe-workflow`,name:e.name,description:e.description,icon:(0,$.jsx)(K,{"aria-hidden":`true`,className:`size-4 shrink-0 text-violet`}),disabled:h,onClick:()=>m(e.name,null)},e.name))}):null,_.length>0?(0,$.jsx)(Tt,{label:`Skills`,children:_.map(e=>(0,$.jsx)(Et,{slot:`gh-swipe-skill`,name:e.name,description:e.description,icon:(0,$.jsx)(R,{"aria-hidden":`true`,className:`size-4 shrink-0 text-success`}),disabled:h,onClick:()=>m(null,e.name)},e.name))}):null,g.length===0&&_.length===0?(0,$.jsxs)(`p`,{className:`px-2 py-3 text-sm text-soft-foreground`,children:[`Nothing matches “`,d.trim(),`”.`]}):null]})]})})}function Tt({label:e,children:t}){return(0,$.jsxs)(`section`,{className:`pt-2`,children:[(0,$.jsx)(`h3`,{className:`px-2 pb-1 eyebrow text-soft-foreground`,children:e}),(0,$.jsx)(`ul`,{className:`flex flex-col`,children:t})]})}function Et({slot:e,name:t,description:n,icon:r,disabled:i,onClick:a}){return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":e,"data-name":t,disabled:i,onClick:a,className:`flex min-h-11 w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted active:bg-muted disabled:opacity-55`,children:[r,(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate font-mono text-ui font-medium`,children:t}),n?(0,$.jsx)(`span`,{className:`truncate text-xs text-soft-foreground`,children:n}):null]})]})})}var Dt=50,Ot=100,kt=350;function At(e,t){let[n,r]=(0,Q.useState)(e);return(0,Q.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var jt=600;function Mt(e,t){let[n,r]=(0,Q.useState)(null),i=(0,Q.useRef)(t);return(0,Q.useEffect)(()=>{i.current=t}),(0,Q.useEffect)(()=>{if(!e||!n||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&i.current()},{root:n.closest(`[data-slot="gh-list"]`),rootMargin:`0px 0px ${jt}px 0px`});return t.observe(n),()=>t.disconnect()},[e,n]),r}function Nt({view:e,changes:t=!1,index:n=!1}){let{n:a}=re(),o=_(Dt),c=i().data?.capabilities?.automations===!0,u=(0,Q.useMemo)(()=>{let e=o.data?.pages;if(!e||e.length===0)return;let t=e[0],n=e[e.length-1];if(!(!t||!n))return{...t,available:t.available??!1,issues:e.flatMap(e=>e.issues??[]),prs:e.flatMap(e=>e.prs??[]),labelColors:Object.assign({},...e.map(e=>e.labelColors??{})),issuesNextCursor:n.issuesNextCursor,prsNextCursor:n.prsNextCursor}},[o.data]),d=ee(),f=d.data?.githubSort===`oldest`?`oldest`:`newest`,m=(0,Q.useMemo)(()=>u?.available?Ye(u.prs,f):[],[u,f]),g=a===void 0?null:Number.parseInt(a,10),y=(0,Q.useMemo)(()=>{if(!u?.available)return[];let t=new Set;e===`prs`&&g!==null&&Number.isInteger(g)&&t.add(g);for(let e of m){if(t.size>=Ot)break;t.add(e.number)}return[...t]},[u,m,e,g]),T=r(y,e===`prs`),E=T.data?.available?T.data.checks:void 0,D=w(),k=e=>{D.setQueryData(b.uiState,t=>({...t,githubView:e})),v({githubView:e}).then(e=>D.setQueryData(b.uiState,e)).catch(e=>{Y(e instanceof Error?e.message:String(e),{tone:`danger`}),D.invalidateQueries({queryKey:b.uiState})})},A=e=>{D.setQueryData(b.uiState,t=>({...t,githubSort:e})),v({githubSort:e}).then(e=>D.setQueryData(b.uiState,e)).catch(e=>{Y(e instanceof Error?e.message:String(e),{tone:`danger`}),D.invalidateQueries({queryKey:b.uiState})})},j=(0,Q.useRef)(null),M=S({mutationFn:()=>C({refresh:!0,limit:Dt}),onSuccess:()=>{D.invalidateQueries({queryKey:b.githubPages(Dt)}),D.invalidateQueries({queryKey:b.githubChecks(y)});let e=j.current;if(!e){D.removeQueries({queryKey:[`github`,`comments`]});return}let t=b.githubComments(e.kind,e.number);x(e.kind,e.number,{refresh:!0}).then(e=>D.setQueryData(t,e)).catch(()=>{}),D.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==h(t)})},onError:e=>Y(e.message,{tone:`danger`})}),ie=p(),ae=s(),[N,oe]=(0,Q.useState)(()=>$e().workflow),[se,le]=(0,Q.useState)(()=>$e().skills),[de,fe]=rt();(0,Q.useEffect)(()=>{at({workflow:N,skills:[...se]})},[N,se]);let pe=ie.data?.workflows;(0,Q.useEffect)(()=>{pe&&N!==null&&!pe.some(e=>e.name===N)&&oe(null)},[pe,N]);let me=ae.data,he=d.data?.skillUsage,ge=(0,Q.useMemo)(()=>we(me??[],he),[me,he]),[P,_e]=(0,Q.useState)(new Map),[ve,ye]=(0,Q.useState)(null),[be,xe]=(0,Q.useState)(!1),Se=(0,Q.useCallback)(e=>{ye(e),xe(!0)},[]),Ce=(0,Q.useCallback)((e,t)=>_e(n=>new Map(n).set(e,t)),[]),[I,Te]=(0,Q.useState)(``),[L,Ee]=(0,Q.useState)([]),De=I.trim()!==``||L.length>0,Oe=(0,Q.useRef)(null),ke=Mt(o.hasNextPage&&!o.isFetchingNextPage&&!o.isFetchNextPageError&&!De,()=>void o.fetchNextPage()),R=At(I,kt),z=(0,Q.useMemo)(()=>u?.available?e===`issues`?Ye(u.issues,f):m:[],[u,e,f,m]),B=ot(R,(0,Q.useMemo)(()=>Je(z,{query:R,labels:L}).length,[z,R,L])),V=l(e===`issues`?`issue`:`pr`,R,B);if(n&&d.data?.githubView===`prs`)return(0,$.jsx)(te,{to:`/github/prs`,replace:!0});if(!u)return o.isError?(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(He,{icon:(0,$.jsx)(ze,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:o.error.message})}):(0,$.jsx)(ct,{});if(j.current=null,!u.available)return(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(He,{icon:(0,$.jsx)(Ke,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:u.reason??`unknown reason`,actions:(0,$.jsx)(F,{variant:`outline`,"data-action":`gh-retry`,disabled:M.isPending,onClick:()=>M.mutate(),children:`Try again`}),children:(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in the cockpit works without it.`]})})});let Ae=z,H=Je(Ae,{query:I,labels:L}),U=B&&V.data?.available?V.data:null,je=new Set(H.map(e=>e.number)),W=U?Ye(Je(U.items,{labels:L}).filter(e=>!je.has(e.number)),f):[],G=I.trim()!==``&&I.trim()!==R.trim()||B&&V.isPending,K={...U?.labelColors??{},...u.labelColors??{}},Fe=st(Ae),q=a===void 0?null:Number.parseInt(a,10),J=q===null?H[0]??W[0]??null:Ae.find(e=>e.number===q)??W.find(e=>e.number===q)??null;j.current=J?{kind:J.kind,number:J.number}:null;let Re=e===`issues`?`/github`:`/github/prs`,Be=B&&(V.data?.available===!1||V.isError),Ue=V.data?.available===!1?V.data.reason??`unknown reason`:V.error instanceof Error?V.error.message:`the search request failed`,Z=De?G?(0,$.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Ie,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,I.trim(),`”…`]}):W.length>0?null:Be?(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,Ue,`.`]}):U?(0,$.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,$.jsx)(lt,{name:`gh`,route:`github`,selected:a!==void 0,list:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),u.repo?(0,$.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-meta text-soft-foreground`,children:u.repo}):null,c?(0,$.jsx)(ne,{to:`/automations/new`,className:`ml-auto shrink-0 text-micro font-medium text-primary hover:underline`,children:`Set up automations`}):null,(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:M.isPending,onClick:()=>M.mutate(),className:O(`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-micro font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,!c&&`ml-auto`),children:[(0,$.jsx)(Me,{"aria-hidden":`true`,className:O(`size-[9px]`,M.isPending&&`motion-safe:animate-spin`)}),u.syncedAt?`synced ${X(u.syncedAt)} ago`:`refresh`]})]}),(0,$.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,$.jsxs)(Ne,{to:`/github`,active:e===`issues`,onClick:()=>k(`issues`),children:[`Issues · `,Pt(u.issuesTotal??u.issues.length)]}),(0,$.jsxs)(Ne,{to:`/github/prs`,active:e===`prs`,onClick:()=>k(`prs`),children:[`Pull requests · `,Pt(u.prsTotal??u.prs.length)]})]}),(0,$.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-2 pb-3`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-[11rem] flex-1`,children:[(0,$.jsx)(Le,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,$.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:I,onChange:e=>Te(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-ui outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,$.jsx)(Lt,{options:Fe,colors:K,selected:L,onChange:Ee}),(0,$.jsx)(ue,{slot:`gh-sort`,label:`Sort order`,value:f,options:[{value:`newest`,label:`Newest`},{value:`oldest`,label:`Oldest`}],onChange:A,className:`shrink-0`})]})]}),H.length===0?Z&&(0,$.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:Z}):(0,$.jsx)(`div`,{ref:e=>{Oe.current=e?.closest(`[data-slot="gh-list"]`)??null},"data-slot":`gh-rows`,"data-virtualized":`true`,className:`px-2 py-2`,children:(0,$.jsx)(Ve,{scrollRef:Oe,children:H.map(t=>(0,$.jsx)(`div`,{className:`pb-0.5`,children:(0,$.jsx)(Ft,{item:t,view:e,colors:K,active:J?.url===t.url,queued:P.has(t.url),checks:t.kind===`pr`?E?.[t.number]??t.checks:t.checks,onSwipe:Se})},t.url))})}),o.hasNextPage&&!De&&H.length>0?(0,$.jsx)(`div`,{ref:ke,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-soft-foreground`,children:o.isFetchingNextPage?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ie,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):o.isFetchNextPageError?(0,$.jsxs)($.Fragment,{children:[`Could not load more.`,(0,$.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void o.fetchNextPage(),className:`font-medium text-primary hover:underline`,children:`Retry`})]}):null}):null,W.length>0?(0,$.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,$.jsxs)(`p`,{className:`px-4 pt-2 pb-1 eyebrow text-soft-foreground`,children:[`Found on GitHub`,U?.truncated?` (first matches)`:``]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:W.map(t=>(0,$.jsx)(Ft,{item:t,view:e,colors:K,active:J?.url===t.url,queued:P.has(t.url),checks:t.kind===`pr`?E?.[t.number]??t.checks:t.checks,onSwipe:Se},t.url))})]}):null,(0,$.jsx)(wt,{item:ve,open:be,onOpenChange:xe,workflows:ie.data?.workflows??[],skills:ge,engine:de,onQueued:Ce})]}),detail:(0,$.jsx)($.Fragment,{children:J?(0,$.jsx)(zt,{item:J,listPath:Re,colors:K,changes:t,checks:J.kind===`pr`?E?.[J.number]??J.checks:J.checks,children:(0,$.jsx)(bt,{item:J,workflows:ie.data?.workflows??[],skills:ge,workflow:N,onWorkflowChange:oe,selectedSkills:se,onSkillsChange:le,engine:de,onEngineChange:fe,queuedRunId:P.get(J.url)??null,onQueued:Ce},J.url)}):(0,$.jsx)(He,{icon:e===`issues`?(0,$.jsx)(ce,{}):(0,$.jsx)(Pe,{}),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 Pt(e){return String(e)}var Ft=(0,Q.memo)(function({item:e,view:t,colors:n,active:r,queued:i,checks:a,onSwipe:o}){let s=e.kind===`issue`?ce:Pe,c=w(),l=St(()=>o?.(e)),u=()=>{c.prefetchQuery({queryKey:b.githubComments(e.kind,e.number),queryFn:({signal:t})=>x(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,$.jsxs)(`li`,{className:O(`relative rounded-md`,l.offset!==0&&`overflow-hidden`),children:[o?(0,$.jsx)(Ct,{offset:l.offset}):null,(0,$.jsxs)(ne,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,We(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},...o?l.handlers:{},style:l.offset?{transform:`translateX(${l.offset}px)`}:void 0,onMouseEnter:u,onFocus:u,"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:O(`relative flex touch-pan-y flex-col gap-1 rounded-md bg-background px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(s,{"aria-hidden":`true`,className:O(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,$.jsx)(`span`,{className:O(`min-w-0 truncate text-ui font-medium`,r&&`font-semibold`),children:e.title})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-micro text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,$.jsx)(`span`,{children:X(e.createdAt)}),(0,$.jsx)(an,{count:e.comments}),a?(0,$.jsx)(sn,{checks:a}):null,i?(0,$.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,$.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,$.jsx)(Rt,{label:e,color:n[e]},e))}):null]}),(0,$.jsx)(yt,{item:e})]})},It);function It(e,t){return e.item===t.item&&e.view===t.view&&e.active===t.active&&e.queued===t.queued&&e.checks===t.checks&&e.onSwipe===t.onSwipe&&t.item.labels.every(n=>e.colors[n]===t.colors[n])}function Lt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,Q.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,$.jsxs)(M,{open:i,onOpenChange:a,children:[(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:O(`flex shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-label font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,$.jsx)(Re,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,$.jsx)(ae,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,$.jsxs)(fe,{children:[(0,$.jsx)(pe,{placeholder:`Filter labels…`}),(0,$.jsxs)(he,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,$.jsx)(ye,{children:`No labels.`}),n.length>0?(0,$.jsxs)(P,{value:`__clear__`,onSelect:()=>r([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,$.jsxs)(P,{value:e,onSelect:()=>o(e),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:Z(t[e])}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,$.jsx)(B,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function Rt({label:e,color:t}){return(0,$.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:Z(t),className:`rounded-full border px-1.5 py-px text-micro font-medium`,children:e})}function zt({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=u(e.kind,e.number),c=s.data?.detail?.body??e.body,l=s.data?.detail?.additions??e.additions,d=s.data?.detail?.deletions??e.deletions,f=e.kind===`pr`&&!!(l||d);return(0,$.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,$.jsxs)(ne,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,$.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,$.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-micro text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,$.jsx)(`span`,{children:o}),`·`,(0,$.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,$.jsxs)(`span`,{children:[X(e.createdAt),` ago`]}),e.comments?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsx)(an,{count:e.comments})]}):null,f?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,l??0]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,d??0]})]})]}):null,`·`,D(e.url)?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,$.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,$.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.kind===`pr`?(0,$.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,$.jsx)(Ne,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,$.jsx)(Ne,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,$.jsx)(Rt,{label:e,color:n[e]},e)),a?(0,$.jsx)(on,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,$.jsx)(Wt,{item:e}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:c?(0,$.jsx)(vt,{children:c}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,$.jsx)(Gt,{item:e,colors:n}),e.kind===`pr`?(0,$.jsx)(Ht,{number:e.number}):null,e.kind===`pr`?(0,$.jsx)(Ut,{number:e.number}):null,r]})]})}var Bt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Vt({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,$.jsx)(H,{"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:O(t,`text-success`)}):e===`failing`?(0,$.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:O(t,`text-danger`)}):e===`pending`?(0,$.jsx)(Ie,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:O(t,`animate-spin text-warning`)}):(0,$.jsx)(U,{"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:O(t,`text-soft-foreground`)})}function Ht({number:e}){let t=i().data?.forge,n=t===null?`Assess impact needs a GitHub remote — none was detected.`:t?.available===!1?`Assess impact needs GitHub: ${t.reason??`it is unreachable`}.`:void 0;return(0,$.jsx)(`section`,{"data-slot":`gh-impact`,"aria-label":`Change impact`,className:`mt-6 rounded-lg border border-border bg-card p-3`,children:(0,$.jsx)(mt,{subject:{kind:`pr`,number:e},unavailable:n})})}function Ut({number:e}){let t=w(),n=m({queryKey:b.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),r=n.data?.available?n.data.mergeState:null,[i,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),f=S({mutationFn:()=>d(e,{refresh:!0}),onSuccess:n=>t.setQueryData(b.githubMergeState(e),n),onError:e=>Y(e instanceof Error?e.message:String(e),{tone:`danger`})}),p=i&&r?.methods.includes(i)?i:r?.defaultMethod??r?.methods[0]??null,h=S({mutationFn:()=>{if(!r||!p)throw Error(`No merge method is available.`);return a(e,{method:p,expectedHeadSha:r.headSha,...l&&r.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{c(!1),Y(`Pull request #${e} merged`),t.invalidateQueries({queryKey:b.githubMergeState(e)}),t.invalidateQueries({queryKey:b.githubPages(Dt)}),t.invalidateQueries({queryKey:b.githubComments(`pr`,e)})},onError:n=>{Y(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:b.githubMergeState(e)})}});if(n.isPending)return(0,$.jsx)(nt,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!r)return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:n.data?.available===!1?n.data.reason:`GitHub could not load merge requirements.`})]});let g=r.state===`merged`?`Merged`:r.state===`closed`?`Closed`:r.isDraft?`Draft`:r.mergeable===`conflicting`?`Conflicts must be resolved`:r.canMerge?`Ready to merge`:`Merge blocked`,ee=r.reviewDecision===`approved`?`passing`:r.reviewDecision===`unknown`?`unknown`:`failing`,_=r.mergeable===`mergeable`?`passing`:r.mergeable===`conflicting`?`failing`:`unknown`,v=!!(p&&(r.canMerge||r.canOverride&&l));return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-box`,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[r.canMerge?(0,$.jsx)(B,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,$.jsx)(ze,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:g}),(0,$.jsxs)(F,{type:`button`,variant:`ghost`,size:`sm`,disabled:f.isPending,onClick:()=>f.mutate(),children:[(0,$.jsx)(Me,{"aria-hidden":`true`,className:O(`size-3.5`,f.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,$.jsxs)(`p`,{className:`mt-1 font-mono text-meta text-soft-foreground`,children:[r.headRef,` (`,r.headSha.slice(0,7),`) → `,r.baseRef]}),(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Vt,{state:ee}),(0,$.jsxs)(`span`,{children:[`Reviews: `,r.reviewDecision.replaceAll(`-`,` `)]})]}),(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Vt,{state:_}),(0,$.jsxs)(`span`,{children:[`Conflicts: `,r.mergeable===`conflicting`?`present`:r.mergeable===`mergeable`?`none`:`unknown`]})]}),r.checks.length===0&&r.checksTier!==`none`?(0,$.jsx)(`li`,{children:`No checks configured`}):r.checks.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Vt,{state:e.state}),(0,$.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&D(e.url)?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),r.checksTier===`aggregate`||r.checksTier===`none`?(0,$.jsxs)(`li`,{"data-slot":`gh-merge-checks-degraded`,className:`flex items-start gap-2`,children:[(0,$.jsx)(Vt,{state:`unknown`}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[r.checksTier===`aggregate`?`Only the rolled-up check state is readable here — per-check detail is not.`:`This token cannot read the checks on this pull request.`,r.checksReason?(0,$.jsx)(`span`,{className:`mt-0.5 block break-words text-soft-foreground`,children:r.checksReason}):null]})]}):null,r.blockers.filter(e=>!(e.code===`checks-unknown`&&r.checksTier===`none`)).map(e=>(0,$.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),r.canOverride?(0,$.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,r.state===`open`&&r.methods.length>0?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(`select`,{"aria-label":`Merge method`,value:p??``,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 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:r.methods.map(e=>(0,$.jsx)(`option`,{value:e,children:Bt[e]},e))}),(0,$.jsx)(F,{disabled:!v,onClick:()=>c(!0),children:p?Bt[p]:`Merge`})]}):null]})]}),(0,$.jsx)(N,{open:s,onOpenChange:c,children:(0,$.jsxs)(ie,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,$.jsxs)(k,{children:[(0,$.jsxs)(se,{children:[p?Bt[p]:`Merge`,` pull request #`,e,`?`]}),(0,$.jsxs)(j,{children:[`This will merge “`,r.title,`” into `,r.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`,l&&r.canOverride?` You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`:``]})]}),h.error?(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:h.error.message}):null,(0,$.jsxs)(A,{children:[(0,$.jsx)(F,{variant:`outline`,disabled:h.isPending,onClick:()=>c(!1),children:`Cancel`}),(0,$.jsx)(F,{disabled:h.isPending,onClick:()=>h.mutate(),children:h.isPending?`Merging…`:p?Bt[p]:`Merge`})]})]})})]})}function Wt({item:e}){let t=w(),n=c(e.number),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(null),s=n.data,l=s?.available?s.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],u=l.findIndex(e=>e.path===a);(0,Q.useEffect)(()=>{l.length>0&&!l.some(e=>e.path===a)&&o(l[0].path)},[s?.available?s.headSha:``,r]);let d=async()=>{let n=s?.available?s.headSha:null,r=await g(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(o(r.files[0]?.path??null),Y(`The reviewed revision changed.`))};if(n.isPending)return(0,$.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!s)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!s.available)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:s.reason});let f=l.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),p=D(e.url)?`${e.url}/files`:null,m=l.find(e=>e.path===a);return(0,$.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,$.jsxs)(`strong`,{children:[s.files.length,` changed files`]}),(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,s.additions]}),(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,s.deletions]}),(0,$.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:s.headSha,children:[`head `,s.headSha.slice(0,8)]}),(0,$.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void d(),children:`Refresh`})]}),s.truncated?(0,$.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[s.reason??`This response is incomplete.`,` `,p?(0,$.jsx)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,$.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,$.jsxs)(`aside`,{className:`min-w-0`,children:[(0,$.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>i(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,$.jsx)(`select`,{"aria-label":`Select changed file`,value:a??``,onChange:e=>o(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 lg:hidden`,children:l.map(e=>(0,$.jsx)(`option`,{children:e.path},e.path))}),(0,$.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:O(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,a===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,$.jsx)(F,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<=0,onClick:()=>o(l[u-1]?.path??null),children:(0,$.jsx)(V,{})}),(0,$.jsx)(F,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<0||u>=l.length-1,onClick:()=>o(l[u+1]?.path??null),children:(0,$.jsx)(Ae,{})})]}),l.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pt,{files:f.filter(e=>e.path===a),wrap:!0,className:`min-w-0`}),m&&!m.patch?(0,$.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,m.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Gt({item:e,colors:t}){let n=u(e.kind,e.number),r=n.data,i=(0,Q.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Kt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsx)(nt,{className:`mb-3 h-3 w-24`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(nt,{className:`h-14 w-full`}),(0,$.jsx)(nt,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,$.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 eyebrow text-soft-foreground`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-5`,children:qt(i).map(e=>e.group===`commits`?(0,$.jsx)(Jt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,$.jsx)(en,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,$.jsx)(Xt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Kt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function qt(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 Jt({commits:e,colors:t}){let[n,r]=(0,Q.useState)(!1),i=e[0]?.actor??`?`;return n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-meta text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:Yt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,$.jsx)(Xt,{event:e,colors:t},e.id))]}):(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-meta text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:Yt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,$.jsx)(`span`,{className:`shrink-0`,children:X(e[e.length-1].createdAt)})]})})}var Yt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Xt({event:e,colors:t}){return(0,$.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:O(`flex min-w-0 items-center gap-1.5 font-mono text-meta text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Yt[e.kind]}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,$.jsx)(Zt,{event:e,colors:t}),(0,$.jsx)(`span`,{className:`shrink-0`,children:X(e.createdAt)}),e.url?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Zt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,$.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,$.jsx)(Qt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,$.jsx)(`span`,{"data-slot":`gh-event-label`,style:Z(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-micro`,children:e.label.name}):null,(0,$.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,$.jsx)(`span`,{children:`merged this`});case`closed`:return(0,$.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,$.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,$.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Qt({checks:e}){return e?(0,$.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:O(`shrink-0`,rn[e]),children:nn[e]}):null}var $t={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 en({comment:e}){let t=e.reviewState?$t[e.reviewState]:null;return(0,$.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-meta text-soft-foreground`,children:[(0,$.jsx)(tn,{url:e.avatarUrl,login:e.author}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,$.jsx)(`span`,{children:X(e.createdAt)}),t?(0,$.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:O(`rounded-full border px-1.5 py-px font-sans text-micro font-medium`,t.tone),children:t.label}):null,(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,$.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,$.jsx)(vt,{children:e.body}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function tn({url:e,login:t}){let[n,r]=(0,Q.useState)(!1);return e&&!n?(0,$.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,$.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var nn={passing:`✓`,failing:`✗`,pending:`○`},rn={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function an({count:e}){return e?(0,$.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,$.jsx)(q,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function on({checks:e,url:t}){let n=O(`text-meta font-medium`,rn[e],t&&`hover:underline`),r=`${nn[e]} checks ${e}`;return t?(0,$.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,$.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function sn({checks:e}){return(0,$.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:O(`shrink-0 font-sans text-meta font-semibold`,rn[e]),children:nn[e]})}export{Nt 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{D as r,F as i,Fi as a,Fr as o,Kt as s,M as c,N as l,O as u,ai as d,ao as f,cn as p,co as m,go as h,ii as g,in as ee,k as _,na as v,ni as y,r as b,ri as x,so as S,ti as C,uo as w}from"./queries-DbDUaheq.js";import{c as T,mt as E,n as D,t as O}from"./utils-Bl_tQdVw.js";import{r as te,t as ne,x as re}from"./project-router-ByYpf5zi.js";import{_ as k,g as A,h as j,i as M,m as ie,o as ae,p as N,s as oe,v as se,x as ce,y as le}from"./use-now-CdtIyF-0.js";import{i as ue}from"./facet-filter-Be0XFoHu.js";import{a as de,c as fe,f as pe,i as me,m as he,o as ge,p as P,r as _e,t as ve,u as ye}from"./sheet-DJ7Q8rRA.js";import{N as be,t as F}from"./button-jcXhXi-5.js";import{t as xe}from"./arrow-left-Ci5OwIMH.js";import{E as Se,F as Ce,I,M as we,c as Te,d as L,f as Ee,l as De,s as Oe}from"./worktree-lifecycle-operation-UpV9MAuk.js";import{Et as ke,Ot as R,gt as z}from"./picker-pill-BFprBA9h.js";import{t as B}from"./check-CNVywZ6B.js";import{t as V}from"./chevron-left-D94sZNQc.js";import{t as Ae}from"./chevron-right-D2EqYt_O.js";import{t as H}from"./circle-check-C09e7mFj.js";import{h as U}from"./dropdown-menu-Da8iP-nI.js";import{n as je,t as W}from"./use-submit-shortcut-B3TJ3HBP.js";import{t as G}from"./external-link-CTJbUN9h.js";import{_ as Me,m as Ne}from"./impact-model-Bo4KSZmi.js";import{t as Pe}from"./git-pull-request-BAfSEvVb.js";import{n as K,t as Fe}from"./textarea-Ckx3d0hV.js";import{t as Ie}from"./loader-circle-BuBcxAH7.js";import{t as q}from"./message-square-Jt8U2gAH.js";import{n as J}from"./square-CuNOgYBC.js";import{t as Le}from"./search-P545ZVzc.js";import{t as Re}from"./tag-DHjatodA.js";import{t as ze}from"./triangle-alert-CBrg6nYB.js";import{t as Be}from"./x-Qhn_uE86.js";import{r as Y}from"./toaster-CejrnYvv.js";import{n as X}from"./format-DHK74MwW.js";import{t as Ve}from"./lib-BQXq3kEf.js";import{t as He}from"./centered-state-zjxxQcEb.js";import{t as Ue}from"./markdown--qN61YgZ.js";import{C as Z,D as We,E as Ge,G as Ke,O as qe,S as Je,T as Ye,_ as Xe,d as Ze,f as Qe,g as $e,h as et,m as tt,n as nt,p as rt,u as it,v as at,w as ot,x as st,y as ct}from"./index-Crs_dvXc.js";import{i as lt,n as ut,r as dt,t as ft}from"./agent-task-pickers-C0lbPIio.js";import{t as pt}from"./diff-DpElozOH.js";import{t as mt}from"./impact-control-Ba9XW3tV.js";var ht=be(`user-round`,[[`circle`,{cx:`12`,cy:`8`,r:`5`,key:`1hypcn`}],[`path`,{d:`M20 21a8 8 0 0 0-16 0`,key:`rfgkzh`}]]),Q=e(t(),1),$=n(),gt=class extends Error{};function _t({src:e,alt:t,srcSet:n,...r}){f();let i=T(),a=typeof e==`string`?e:``,o=E(a),s=m({queryKey:[`github-asset`,i,a],queryFn:async({signal:e})=>{let t=await y(a,{signal:e},i);if(!t.available&&t.retryable)throw new gt;return t},enabled:o,staleTime:5*6e4,gcTime:6e4,retry:(e,t)=>t instanceof gt&&e<16,retryDelay:1e3});return o?s.data?.available?(0,$.jsx)(`img`,{...r,src:s.data.dataUrl,alt:t}):(0,$.jsxs)(`span`,{role:`img`,"aria-label":t||`Image`,children:[t||`Image`,s.isPending?` (loading…)`:` (unavailable)`]}):(0,$.jsx)(`img`,{...r,src:e,alt:t})}function vt({children:e}){return(0,$.jsx)(Ue,{imageComponent:_t,children:e})}function yt({item:e}){if(e.kind!==`issue`||e.assignees===void 0&&e.linkedPrs===void 0)return null;let t=`inline-flex min-w-0 max-w-full items-center gap-1 rounded border border-border/70 px-1.5 py-0.5`;return(0,$.jsxs)(`div`,{"aria-label":`Issue #${e.number} ownership`,role:`group`,className:`flex min-w-0 flex-wrap items-center gap-1 px-2.5 pb-2 pl-8 text-meta text-muted-foreground`,children:[e.assignees===void 0?null:(0,$.jsxs)(`span`,{className:t,title:e.assignees.length?`Assigned to ${e.assignees.map(e=>`@${e}`).join(`, `)}`:void 0,children:[(0,$.jsx)(ht,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,$.jsx)(`span`,{className:`truncate`,children:e.assignees.length?`Assigned to ${e.assignees.map(e=>`@${e}`).join(`, `)}`:e.assigneesTruncated?`Assignees`:`Unassigned`})]}),e.assigneesTruncated&&D(e.url)?(0,$.jsx)(`a`,{className:O(t,`hover:text-foreground focus-visible:outline focus-visible:outline-ring`),href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`More assignees for issue #${e.number}`,children:`More assignees…`}):null,e.linkedPrs?.map(e=>{let n=e.state===`merged`?`Merged`:e.state===`closed`?`Closed`:e.isDraft?`Draft`:`Open`,r=(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Pe,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,$.jsxs)(`span`,{className:`truncate`,children:[`PR #`,e.number,` · `,n]})]}),i=O(t,e.state===`merged`?`text-violet`:e.state===`open`&&!e.isDraft?`text-success`:``);return D(e.url)?(0,$.jsx)(`a`,{className:O(i,`hover:underline focus-visible:outline focus-visible:outline-ring`),href:e.url,target:`_blank`,rel:`noopener noreferrer`,title:`${e.title} — ${e.url}`,"aria-label":`PR #${e.number} · ${n}: ${e.title}`,children:r},e.url):(0,$.jsx)(`span`,{className:i,children:r},e.url)}),e.linkedPrsTruncated&&D(e.url)?(0,$.jsx)(`a`,{className:O(t,`hover:text-foreground focus-visible:outline focus-visible:outline-ring`),href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`More linked pull requests for issue #${e.number}`,children:`More linked PRs…`}):null]})}function bt({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:a,selectedSkills:s,onSkillsChange:c,engine:l,onEngineChange:u,queuedRunId:d,onQueued:f}){let p=w(),m=ee(),h=e.kind===`pr`?`PR`:`issue`,g=s.filter(e=>n.some(t=>t.name===e)),[_]=(0,Q.useState)(()=>qe(e)),[y,x]=(0,Q.useState)(()=>et(e.url)||_),C=tt(l),T=(0,Q.useRef)(null);(0,Q.useEffect)(()=>{Xe(e.url,y===_?``:y)},[e.url,y,_]);let E=i(),D=(0,Q.useMemo)(()=>Te(L(m.data?.promptTemplates),E.data?.capabilities),[m.data?.promptTemplates,E.data?.capabilities]),O=e=>{let t=T.current,n=y===_?y.length:t?.selectionStart??y.length,r=De(y,n,e);x(r.text),requestAnimationFrame(()=>{T.current?.focus(),T.current?.setSelectionRange(r.caret,r.caret)})},te=Oe(D,g),re=(0,Q.useRef)(y);re.current=y;let k=(0,Q.useRef)(``);(0,Q.useEffect)(()=>{let e=Ee(re.current,k.current,te,_);k.current=e.applied,e.text!==re.current&&x(e.text)},[te,_]);let A=S({mutationFn:async()=>C.canRun?o(Ge(e,r,g,y,Qe(C))):null,onSuccess:t=>{if(t===null)return;z(`github`);let n=`runs`in t?t.runs[0]:t;n&&f(e.url,n.id),Y(`Added to the queue — ${h} #${e.number}`),g.length>0&&m.data!==void 0&&v({skillUsage:g.reduce((e,t)=>Se(e,t),m.data.skillUsage)}).then(()=>p.invalidateQueries({queryKey:b.uiState})).catch(()=>{}),Xe(e.url,``),x(_),k.current=``,p.invalidateQueries({queryKey:b.runs.all})},onError:e=>Y(e.message,{tone:`danger`})}),j=e=>{W({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(),!A.isPending&&C.canRun&&A.mutate())},M=e=>c(s.includes(e)?s.filter(t=>t!==e):[...s,e]);return(0,$.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`h3`,{className:`flex items-center gap-1.5 eyebrow text-soft-foreground`,children:[(0,$.jsx)(ke,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,$.jsx)(ut,{workflows:t,value:r,onChange:a}),(0,$.jsx)(ft,{skills:n,skillUsage:m.data?.skillUsage,selected:g,onToggle:M}),(0,$.jsx)(Ze,{pick:l,onChange:u,disabled:A.isPending||!C.canRun,accounts:!0}),(0,$.jsx)(dt,{resolved:C,dataSlot:`gh-provider-gate`}),(0,$.jsx)(it,{templates:D,onInsert:O})]}),g.length>0?(0,$.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:g.map(e=>(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>M(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-meta font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,$.jsx)(Be,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,$.jsx)(Fe,{ref:T,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:y,onChange:e=>x(e.target.value),onKeyDown:j,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-ui`}),(0,$.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,$.jsxs)(F,{variant:`contrast`,"data-action":`gh-run`,disabled:A.isPending||!C.canRun,onClick:()=>A.mutate(),children:[(0,$.jsx)(J,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,h]}),(0,$.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-micro font-medium text-muted-foreground`,children:je()}),d?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,$.jsx)(B,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,$.jsx)(ne,{to:`/tasks/${d}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}var xt=10;function St(e){let[t,n]=(0,Q.useState)(0),r=(0,Q.useRef)(null),i=(0,Q.useRef)(!1),a=e=>{i.current=!1,e.pointerType===`touch`&&(r.current={id:e.pointerId,x:e.clientX,y:e.clientY,axis:null})},o=e=>{let t=r.current;if(!t||t.id!==e.pointerId)return;let a=e.clientX-t.x,o=e.clientY-t.y;if(t.axis===null){if(Math.abs(a)<xt&&Math.abs(o)<xt)return;t.axis=Math.abs(a)>Math.abs(o)?`x`:`y`}t.axis===`x`&&(i.current=!0,n(Math.max(-112,Math.min(0,a))))},s=(t,i)=>{let a=r.current;!a||a.id!==t.pointerId||(r.current=null,n(0),!i&&a.axis===`x`&&t.clientX-a.x<=-72&&e())};return{offset:t,handlers:{onPointerDown:a,onPointerMove:o,onPointerUp:e=>s(e,!1),onPointerCancel:e=>s(e,!0),onClickCapture:e=>{i.current&&(i.current=!1,e.preventDefault(),e.stopPropagation())},onKeyDown:()=>{i.current=!1}}}}function Ct({offset:e}){return e===0?null:(0,$.jsxs)(`span`,{"aria-hidden":`true`,"data-slot":`gh-swipe-reveal`,className:O(`absolute inset-y-0 right-0 flex items-center gap-1.5 rounded-md px-4 text-xs font-semibold transition-colors`,e<=-72?`bg-violet text-violet-foreground`:`bg-violet/15 text-violet`),children:[(0,$.jsx)(J,{className:`size-3.5`}),`Run…`]})}function wt({item:e,open:t,onOpenChange:n,workflows:r,skills:i,engine:a,onQueued:s}){let c=w(),l=ee(),u=tt(a),[d,f]=(0,Q.useState)(``),p=S({mutationFn:async e=>({pick:e,created:await o(Ge(e.target,e.workflow,e.skill?[e.skill]:[],qe(e.target),Qe(u)))}),onSuccess:({pick:e,created:t})=>{z(`github`);let r=`runs`in t?t.runs[0]:t;r&&s(e.target.url,r.id),Y(`Added to the queue — ${e.target.kind===`pr`?`PR`:`issue`} #${e.target.number}`),n(!1),f(``),e.skill&&l.data!==void 0&&v({skillUsage:Se(l.data.skillUsage,e.skill)}).then(()=>c.invalidateQueries({queryKey:b.uiState})).catch(()=>{}),c.invalidateQueries({queryKey:b.runs.all})},onError:e=>Y(e.message,{tone:`danger`})}),m=(t,n)=>{!e||p.isPending||!u.canRun||p.mutate({target:e,workflow:t,skill:n})},h=p.isPending||!u.canRun,g=I(r,d),_=Ce([...i],d,l.data?.skillUsage);return(0,$.jsx)(ve,{open:t,onOpenChange:e=>{e||f(``),n(e)},children:(0,$.jsxs)(_e,{side:`bottom`,"data-slot":`gh-swipe-sheet`,onOpenAutoFocus:e=>e.preventDefault(),className:`max-h-[85dvh] gap-0 rounded-t-xl pb-[env(safe-area-inset-bottom)]`,children:[(0,$.jsxs)(de,{className:`pb-2`,children:[(0,$.jsxs)(ge,{className:`truncate text-base`,children:[`Run agent on `,e?`${e.kind===`pr`?`PR`:`issue`} #${e.number}`:`…`]}),(0,$.jsxs)(me,{className:`truncate text-xs`,children:[e?.title??``,` — tap a workflow or skill to start.`]})]}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 px-4 pb-2`,children:[(0,$.jsx)(dt,{resolved:u,dataSlot:`gh-swipe-provider-gate`}),(0,$.jsxs)(`div`,{className:`relative`,children:[(0,$.jsx)(Le,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,$.jsx)(`input`,{type:`search`,"data-slot":`gh-swipe-filter`,"aria-label":`Filter workflows and skills`,placeholder:`Filter workflows and skills…`,value:d,onChange:e=>f(e.target.value),className:`w-full rounded-md border border-input bg-card py-2 pr-2 pl-7 text-body outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]})]}),(0,$.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto px-2 pb-4`,children:[g.length>0?(0,$.jsx)(Tt,{label:`Workflows`,children:g.map(e=>(0,$.jsx)(Et,{slot:`gh-swipe-workflow`,name:e.name,description:e.description,icon:(0,$.jsx)(K,{"aria-hidden":`true`,className:`size-4 shrink-0 text-violet`}),disabled:h,onClick:()=>m(e.name,null)},e.name))}):null,_.length>0?(0,$.jsx)(Tt,{label:`Skills`,children:_.map(e=>(0,$.jsx)(Et,{slot:`gh-swipe-skill`,name:e.name,description:e.description,icon:(0,$.jsx)(R,{"aria-hidden":`true`,className:`size-4 shrink-0 text-success`}),disabled:h,onClick:()=>m(null,e.name)},e.name))}):null,g.length===0&&_.length===0?(0,$.jsxs)(`p`,{className:`px-2 py-3 text-sm text-soft-foreground`,children:[`Nothing matches “`,d.trim(),`”.`]}):null]})]})})}function Tt({label:e,children:t}){return(0,$.jsxs)(`section`,{className:`pt-2`,children:[(0,$.jsx)(`h3`,{className:`px-2 pb-1 eyebrow text-soft-foreground`,children:e}),(0,$.jsx)(`ul`,{className:`flex flex-col`,children:t})]})}function Et({slot:e,name:t,description:n,icon:r,disabled:i,onClick:a}){return(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":e,"data-name":t,disabled:i,onClick:a,className:`flex min-h-11 w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left transition-colors hover:bg-muted active:bg-muted disabled:opacity-55`,children:[r,(0,$.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,$.jsx)(`span`,{className:`truncate font-mono text-ui font-medium`,children:t}),n?(0,$.jsx)(`span`,{className:`truncate text-xs text-soft-foreground`,children:n}):null]})]})})}var Dt=50,Ot=100,kt=350;function At(e,t){let[n,r]=(0,Q.useState)(e);return(0,Q.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}var jt=600;function Mt(e,t){let[n,r]=(0,Q.useState)(null),i=(0,Q.useRef)(t);return(0,Q.useEffect)(()=>{i.current=t}),(0,Q.useEffect)(()=>{if(!e||!n||typeof IntersectionObserver>`u`)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&i.current()},{root:n.closest(`[data-slot="gh-list"]`),rootMargin:`0px 0px ${jt}px 0px`});return t.observe(n),()=>t.disconnect()},[e,n]),r}function Nt({view:e,changes:t=!1,index:n=!1}){let{n:a}=re(),o=_(Dt),c=i().data?.capabilities?.automations===!0,u=(0,Q.useMemo)(()=>{let e=o.data?.pages;if(!e||e.length===0)return;let t=e[0],n=e[e.length-1];if(!(!t||!n))return{...t,available:t.available??!1,issues:e.flatMap(e=>e.issues??[]),prs:e.flatMap(e=>e.prs??[]),labelColors:Object.assign({},...e.map(e=>e.labelColors??{})),issuesNextCursor:n.issuesNextCursor,prsNextCursor:n.prsNextCursor}},[o.data]),d=ee(),f=d.data?.githubSort===`oldest`?`oldest`:`newest`,m=(0,Q.useMemo)(()=>u?.available?Ye(u.prs,f):[],[u,f]),g=a===void 0?null:Number.parseInt(a,10),y=(0,Q.useMemo)(()=>{if(!u?.available)return[];let t=new Set;e===`prs`&&g!==null&&Number.isInteger(g)&&t.add(g);for(let e of m){if(t.size>=Ot)break;t.add(e.number)}return[...t]},[u,m,e,g]),T=r(y,e===`prs`),E=T.data?.available?T.data.checks:void 0,D=w(),k=e=>{D.setQueryData(b.uiState,t=>({...t,githubView:e})),v({githubView:e}).then(e=>D.setQueryData(b.uiState,e)).catch(e=>{Y(e instanceof Error?e.message:String(e),{tone:`danger`}),D.invalidateQueries({queryKey:b.uiState})})},A=e=>{D.setQueryData(b.uiState,t=>({...t,githubSort:e})),v({githubSort:e}).then(e=>D.setQueryData(b.uiState,e)).catch(e=>{Y(e instanceof Error?e.message:String(e),{tone:`danger`}),D.invalidateQueries({queryKey:b.uiState})})},j=(0,Q.useRef)(null),M=S({mutationFn:()=>C({refresh:!0,limit:Dt}),onSuccess:()=>{D.invalidateQueries({queryKey:b.githubPages(Dt)}),D.invalidateQueries({queryKey:b.githubChecks(y)});let e=j.current;if(!e){D.removeQueries({queryKey:[`github`,`comments`]});return}let t=b.githubComments(e.kind,e.number);x(e.kind,e.number,{refresh:!0}).then(e=>D.setQueryData(t,e)).catch(()=>{}),D.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==h(t)})},onError:e=>Y(e.message,{tone:`danger`})}),ie=p(),ae=s(),[N,oe]=(0,Q.useState)(()=>$e().workflow),[se,le]=(0,Q.useState)(()=>$e().skills),[de,fe]=rt();(0,Q.useEffect)(()=>{at({workflow:N,skills:[...se]})},[N,se]);let pe=ie.data?.workflows;(0,Q.useEffect)(()=>{pe&&N!==null&&!pe.some(e=>e.name===N)&&oe(null)},[pe,N]);let me=ae.data,he=d.data?.skillUsage,ge=(0,Q.useMemo)(()=>we(me??[],he),[me,he]),[P,_e]=(0,Q.useState)(new Map),[ve,ye]=(0,Q.useState)(null),[be,xe]=(0,Q.useState)(!1),Se=(0,Q.useCallback)(e=>{ye(e),xe(!0)},[]),Ce=(0,Q.useCallback)((e,t)=>_e(n=>new Map(n).set(e,t)),[]),[I,Te]=(0,Q.useState)(``),[L,Ee]=(0,Q.useState)([]),De=I.trim()!==``||L.length>0,Oe=(0,Q.useRef)(null),ke=Mt(o.hasNextPage&&!o.isFetchingNextPage&&!o.isFetchNextPageError&&!De,()=>void o.fetchNextPage()),R=At(I,kt),z=(0,Q.useMemo)(()=>u?.available?e===`issues`?Ye(u.issues,f):m:[],[u,e,f,m]),B=ot(R,(0,Q.useMemo)(()=>Je(z,{query:R,labels:L}).length,[z,R,L])),V=l(e===`issues`?`issue`:`pr`,R,B);if(n&&d.data?.githubView===`prs`)return(0,$.jsx)(te,{to:`/github/prs`,replace:!0});if(!u)return o.isError?(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(He,{icon:(0,$.jsx)(ze,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:o.error.message})}):(0,$.jsx)(ct,{});if(j.current=null,!u.available)return(0,$.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,$.jsx)(He,{icon:(0,$.jsx)(Ke,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:u.reason??`unknown reason`,actions:(0,$.jsx)(F,{variant:`outline`,"data-action":`gh-retry`,disabled:M.isPending,onClick:()=>M.mutate(),children:`Try again`}),children:(0,$.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,$.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in the cockpit works without it.`]})})});let Ae=z,H=Je(Ae,{query:I,labels:L}),U=B&&V.data?.available?V.data:null,je=new Set(H.map(e=>e.number)),W=U?Ye(Je(U.items,{labels:L}).filter(e=>!je.has(e.number)),f):[],G=I.trim()!==``&&I.trim()!==R.trim()||B&&V.isPending,K={...U?.labelColors??{},...u.labelColors??{}},Fe=st(Ae),q=a===void 0?null:Number.parseInt(a,10),J=q===null?H[0]??W[0]??null:Ae.find(e=>e.number===q)??W.find(e=>e.number===q)??null;j.current=J?{kind:J.kind,number:J.number}:null;let Re=e===`issues`?`/github`:`/github/prs`,Be=B&&(V.data?.available===!1||V.isError),Ue=V.data?.available===!1?V.data.reason??`unknown reason`:V.error instanceof Error?V.error.message:`the search request failed`,Z=De?G?(0,$.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,$.jsx)(Ie,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,I.trim(),`”…`]}):W.length>0?null:Be?(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,Ue,`.`]}):U?(0,$.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,$.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,$.jsx)(lt,{name:`gh`,route:`github`,selected:a!==void 0,list:(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(`header`,{"data-slot":`gh-header`,className:`sticky top-0 z-10 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,$.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),u.repo?(0,$.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-meta text-soft-foreground`,children:u.repo}):null,c?(0,$.jsx)(ne,{to:`/automations/new`,className:`ml-auto shrink-0 text-micro font-medium text-primary hover:underline`,children:`Set up automations`}):null,(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:M.isPending,onClick:()=>M.mutate(),className:O(`flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-micro font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,!c&&`ml-auto`),children:[(0,$.jsx)(Me,{"aria-hidden":`true`,className:O(`size-[9px]`,M.isPending&&`motion-safe:animate-spin`)}),u.syncedAt?`synced ${X(u.syncedAt)} ago`:`refresh`]})]}),(0,$.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,$.jsxs)(Ne,{to:`/github`,active:e===`issues`,onClick:()=>k(`issues`),children:[`Issues · `,Pt(u.issuesTotal??u.issues.length)]}),(0,$.jsxs)(Ne,{to:`/github/prs`,active:e===`prs`,onClick:()=>k(`prs`),children:[`Pull requests · `,Pt(u.prsTotal??u.prs.length)]})]}),(0,$.jsxs)(`div`,{className:`mt-2.5 flex flex-wrap items-center gap-2 pb-3`,children:[(0,$.jsxs)(`div`,{className:`relative min-w-[11rem] flex-1`,children:[(0,$.jsx)(Le,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,$.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:I,onChange:e=>Te(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-ui outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,$.jsx)(Lt,{options:Fe,colors:K,selected:L,onChange:Ee}),(0,$.jsx)(ue,{slot:`gh-sort`,label:`Sort order`,value:f,options:[{value:`newest`,label:`Newest`},{value:`oldest`,label:`Oldest`}],onChange:A,className:`shrink-0`})]})]}),H.length===0?Z&&(0,$.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:Z}):(0,$.jsx)(`div`,{ref:e=>{Oe.current=e?.closest(`[data-slot="gh-list"]`)??null},"data-slot":`gh-rows`,"data-virtualized":`true`,className:`px-2 py-2`,children:(0,$.jsx)(Ve,{scrollRef:Oe,children:H.map(t=>(0,$.jsx)(`div`,{className:`pb-0.5`,children:(0,$.jsx)(Ft,{item:t,view:e,colors:K,active:J?.url===t.url,queued:P.has(t.url),checks:t.kind===`pr`?E?.[t.number]??t.checks:t.checks,onSwipe:Se})},t.url))})}),o.hasNextPage&&!De&&H.length>0?(0,$.jsx)(`div`,{ref:ke,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-soft-foreground`,children:o.isFetchingNextPage?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Ie,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):o.isFetchNextPageError?(0,$.jsxs)($.Fragment,{children:[`Could not load more.`,(0,$.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void o.fetchNextPage(),className:`font-medium text-primary hover:underline`,children:`Retry`})]}):null}):null,W.length>0?(0,$.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,$.jsxs)(`p`,{className:`px-4 pt-2 pb-1 eyebrow text-soft-foreground`,children:[`Found on GitHub`,U?.truncated?` (first matches)`:``]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:W.map(t=>(0,$.jsx)(Ft,{item:t,view:e,colors:K,active:J?.url===t.url,queued:P.has(t.url),checks:t.kind===`pr`?E?.[t.number]??t.checks:t.checks,onSwipe:Se},t.url))})]}):null,(0,$.jsx)(wt,{item:ve,open:be,onOpenChange:xe,workflows:ie.data?.workflows??[],skills:ge,engine:de,onQueued:Ce})]}),detail:(0,$.jsx)($.Fragment,{children:J?(0,$.jsx)(zt,{item:J,listPath:Re,colors:K,changes:t,checks:J.kind===`pr`?E?.[J.number]??J.checks:J.checks,children:(0,$.jsx)(bt,{item:J,workflows:ie.data?.workflows??[],skills:ge,workflow:N,onWorkflowChange:oe,selectedSkills:se,onSkillsChange:le,engine:de,onEngineChange:fe,queuedRunId:P.get(J.url)??null,onQueued:Ce},J.url)}):(0,$.jsx)(He,{icon:e===`issues`?(0,$.jsx)(ce,{}):(0,$.jsx)(Pe,{}),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 Pt(e){return String(e)}var Ft=(0,Q.memo)(function({item:e,view:t,colors:n,active:r,queued:i,checks:a,onSwipe:o}){let s=e.kind===`issue`?ce:Pe,c=w(),l=St(()=>o?.(e)),u=()=>{c.prefetchQuery({queryKey:b.githubComments(e.kind,e.number),queryFn:({signal:t})=>x(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,$.jsxs)(`li`,{className:O(`relative rounded-md`,l.offset!==0&&`overflow-hidden`),children:[o?(0,$.jsx)(Ct,{offset:l.offset}):null,(0,$.jsxs)(ne,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,We(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},...o?l.handlers:{},style:l.offset?{transform:`translateX(${l.offset}px)`}:void 0,onMouseEnter:u,onFocus:u,"data-slot":`gh-row`,"data-number":e.number,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:O(`relative flex touch-pan-y flex-col gap-1 rounded-md bg-background px-2.5 py-2 transition-colors hover:bg-muted`,r&&`bg-muted`),children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(s,{"aria-hidden":`true`,className:O(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,$.jsx)(`span`,{className:O(`min-w-0 truncate text-ui font-medium`,r&&`font-semibold`),children:e.title})]}),(0,$.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-micro text-muted-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),(0,$.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,$.jsx)(`span`,{children:X(e.createdAt)}),(0,$.jsx)(an,{count:e.comments}),a?(0,$.jsx)(sn,{checks:a}):null,i?(0,$.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,$.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,$.jsx)(Rt,{label:e,color:n[e]},e))}):null]}),(0,$.jsx)(yt,{item:e})]})},It);function It(e,t){return e.item===t.item&&e.view===t.view&&e.active===t.active&&e.queued===t.queued&&e.checks===t.checks&&e.onSwipe===t.onSwipe&&t.item.labels.every(n=>e.colors[n]===t.colors[n])}function Lt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,Q.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,$.jsxs)(M,{open:i,onOpenChange:a,children:[(0,$.jsx)(oe,{asChild:!0,children:(0,$.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:O(`flex shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-label font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,$.jsx)(Re,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,$.jsx)(ae,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,$.jsxs)(fe,{children:[(0,$.jsx)(pe,{placeholder:`Filter labels…`}),(0,$.jsxs)(he,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,$.jsx)(ye,{children:`No labels.`}),n.length>0?(0,$.jsxs)(P,{value:`__clear__`,onSelect:()=>r([]),className:`text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,$.jsxs)(P,{value:e,onSelect:()=>o(e),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:Z(t[e])}),(0,$.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,$.jsx)(B,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function Rt({label:e,color:t}){return(0,$.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:Z(t),className:`rounded-full border px-1.5 py-px text-micro font-medium`,children:e})}function zt({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=u(e.kind,e.number),c=s.data?.detail?.body??e.body,l=s.data?.detail?.additions??e.additions,d=s.data?.detail?.deletions??e.deletions,f=e.kind===`pr`&&!!(l||d);return(0,$.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,$.jsxs)(ne,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,$.jsx)(xe,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,$.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-micro text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,$.jsx)(`span`,{children:o}),`·`,(0,$.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,$.jsxs)(`span`,{children:[X(e.createdAt),` ago`]}),e.comments?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsx)(an,{count:e.comments})]}):null,f?(0,$.jsxs)($.Fragment,{children:[`·`,(0,$.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,l??0]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,d??0]})]})]}):null,`·`,D(e.url)?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,$.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,$.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.kind===`pr`?(0,$.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,$.jsx)(Ne,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,$.jsx)(Ne,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,$.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,$.jsx)(Rt,{label:e,color:n[e]},e)),a?(0,$.jsx)(on,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,$.jsx)(Wt,{item:e}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:c?(0,$.jsx)(vt,{children:c}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,$.jsx)(Gt,{item:e,colors:n}),e.kind===`pr`?(0,$.jsx)(Ht,{number:e.number}):null,e.kind===`pr`?(0,$.jsx)(Ut,{number:e.number}):null,r]})]})}var Bt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Vt({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,$.jsx)(H,{"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:O(t,`text-success`)}):e===`failing`?(0,$.jsx)(le,{"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:O(t,`text-danger`)}):e===`pending`?(0,$.jsx)(Ie,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:O(t,`animate-spin text-warning`)}):(0,$.jsx)(U,{"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:O(t,`text-soft-foreground`)})}function Ht({number:e}){let t=i().data?.forge,n=t===null?`Assess impact needs a GitHub remote — none was detected.`:t?.available===!1?`Assess impact needs GitHub: ${t.reason??`it is unreachable`}.`:void 0;return(0,$.jsx)(`section`,{"data-slot":`gh-impact`,"aria-label":`Change impact`,className:`mt-6 rounded-lg border border-border bg-card p-3`,children:(0,$.jsx)(mt,{subject:{kind:`pr`,number:e},unavailable:n})})}function Ut({number:e}){let t=w(),n=m({queryKey:b.githubMergeState(e),queryFn:({signal:t})=>d(e,{},{signal:t}),retry:!1}),r=n.data?.available?n.data.mergeState:null,[i,o]=(0,Q.useState)(null),[s,c]=(0,Q.useState)(!1),[l,u]=(0,Q.useState)(!1),f=S({mutationFn:()=>d(e,{refresh:!0}),onSuccess:n=>t.setQueryData(b.githubMergeState(e),n),onError:e=>Y(e instanceof Error?e.message:String(e),{tone:`danger`})}),p=i&&r?.methods.includes(i)?i:r?.defaultMethod??r?.methods[0]??null,h=S({mutationFn:()=>{if(!r||!p)throw Error(`No merge method is available.`);return a(e,{method:p,expectedHeadSha:r.headSha,...l&&r.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{c(!1),Y(`Pull request #${e} merged`),t.invalidateQueries({queryKey:b.githubMergeState(e)}),t.invalidateQueries({queryKey:b.githubPages(Dt)}),t.invalidateQueries({queryKey:b.githubComments(`pr`,e)})},onError:n=>{Y(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:b.githubMergeState(e)})}});if(n.isPending)return(0,$.jsx)(nt,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!r)return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,$.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,$.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:n.data?.available===!1?n.data.reason:`GitHub could not load merge requirements.`})]});let g=r.state===`merged`?`Merged`:r.state===`closed`?`Closed`:r.isDraft?`Draft`:r.mergeable===`conflicting`?`Conflicts must be resolved`:r.canMerge?`Ready to merge`:`Merge blocked`,ee=r.reviewDecision===`approved`?`passing`:r.reviewDecision===`unknown`?`unknown`:`failing`,_=r.mergeable===`mergeable`?`passing`:r.mergeable===`conflicting`?`failing`:`unknown`,v=!!(p&&(r.canMerge||r.canOverride&&l));return(0,$.jsxs)(`section`,{"data-slot":`gh-merge-box`,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,$.jsxs)(`div`,{className:`flex items-start gap-3`,children:[r.canMerge?(0,$.jsx)(B,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,$.jsx)(ze,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,$.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,$.jsx)(`h3`,{className:`font-semibold`,children:g}),(0,$.jsxs)(F,{type:`button`,variant:`ghost`,size:`sm`,disabled:f.isPending,onClick:()=>f.mutate(),children:[(0,$.jsx)(Me,{"aria-hidden":`true`,className:O(`size-3.5`,f.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,$.jsxs)(`p`,{className:`mt-1 font-mono text-meta text-soft-foreground`,children:[r.headRef,` (`,r.headSha.slice(0,7),`) → `,r.baseRef]}),(0,$.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Vt,{state:ee}),(0,$.jsxs)(`span`,{children:[`Reviews: `,r.reviewDecision.replaceAll(`-`,` `)]})]}),(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(Vt,{state:_}),(0,$.jsxs)(`span`,{children:[`Conflicts: `,r.mergeable===`conflicting`?`present`:r.mergeable===`mergeable`?`none`:`unknown`]})]}),r.checks.length===0&&r.checksTier!==`none`?(0,$.jsx)(`li`,{children:`No checks configured`}):r.checks.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,$.jsx)(Vt,{state:e.state}),(0,$.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&D(e.url)?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),r.checksTier===`aggregate`||r.checksTier===`none`?(0,$.jsxs)(`li`,{"data-slot":`gh-merge-checks-degraded`,className:`flex items-start gap-2`,children:[(0,$.jsx)(Vt,{state:`unknown`}),(0,$.jsxs)(`span`,{className:`min-w-0`,children:[r.checksTier===`aggregate`?`Only the rolled-up check state is readable here — per-check detail is not.`:`This token cannot read the checks on this pull request.`,r.checksReason?(0,$.jsx)(`span`,{className:`mt-0.5 block break-words text-soft-foreground`,children:r.checksReason}):null]})]}):null,r.blockers.filter(e=>!(e.code===`checks-unknown`&&r.checksTier===`none`)).map(e=>(0,$.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),r.canOverride?(0,$.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,$.jsx)(`input`,{type:`checkbox`,checked:l,onChange:e=>u(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,$.jsxs)(`span`,{children:[(0,$.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,$.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,r.state===`open`&&r.methods.length>0?(0,$.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,$.jsx)(`select`,{"aria-label":`Merge method`,value:p??``,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 outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`,children:r.methods.map(e=>(0,$.jsx)(`option`,{value:e,children:Bt[e]},e))}),(0,$.jsx)(F,{disabled:!v,onClick:()=>c(!0),children:p?Bt[p]:`Merge`})]}):null]})]}),(0,$.jsx)(N,{open:s,onOpenChange:c,children:(0,$.jsxs)(ie,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,$.jsxs)(k,{children:[(0,$.jsxs)(se,{children:[p?Bt[p]:`Merge`,` pull request #`,e,`?`]}),(0,$.jsxs)(j,{children:[`This will merge “`,r.title,`” into `,r.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`,l&&r.canOverride?` You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`:``]})]}),h.error?(0,$.jsx)(`p`,{className:`text-sm text-danger`,children:h.error.message}):null,(0,$.jsxs)(A,{children:[(0,$.jsx)(F,{variant:`outline`,disabled:h.isPending,onClick:()=>c(!1),children:`Cancel`}),(0,$.jsx)(F,{disabled:h.isPending,onClick:()=>h.mutate(),children:h.isPending?`Merging…`:p?Bt[p]:`Merge`})]})]})})]})}function Wt({item:e}){let t=w(),n=c(e.number),[r,i]=(0,Q.useState)(``),[a,o]=(0,Q.useState)(null),s=n.data,l=s?.available?s.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],u=l.findIndex(e=>e.path===a);(0,Q.useEffect)(()=>{l.length>0&&!l.some(e=>e.path===a)&&o(l[0].path)},[s?.available?s.headSha:``,r]);let d=async()=>{let n=s?.available?s.headSha:null,r=await g(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(o(r.files[0]?.path??null),Y(`The reviewed revision changed.`))};if(n.isPending)return(0,$.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!s)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!s.available)return(0,$.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:s.reason});let f=l.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),p=D(e.url)?`${e.url}/files`:null,m=l.find(e=>e.path===a);return(0,$.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,$.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,$.jsxs)(`strong`,{children:[s.files.length,` changed files`]}),(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,s.additions]}),(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,s.deletions]}),(0,$.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:s.headSha,children:[`head `,s.headSha.slice(0,8)]}),(0,$.jsx)(F,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void d(),children:`Refresh`})]}),s.truncated?(0,$.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[s.reason??`This response is incomplete.`,` `,p?(0,$.jsx)(`a`,{href:p,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,$.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,$.jsxs)(`aside`,{className:`min-w-0`,children:[(0,$.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>i(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,$.jsx)(`select`,{"aria-label":`Select changed file`,value:a??``,onChange:e=>o(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 lg:hidden`,children:l.map(e=>(0,$.jsx)(`option`,{children:e.path},e.path))}),(0,$.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,$.jsx)(`li`,{children:(0,$.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:O(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,a===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,$.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,$.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,$.jsxs)(`div`,{className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,$.jsx)(F,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<=0,onClick:()=>o(l[u-1]?.path??null),children:(0,$.jsx)(V,{})}),(0,$.jsx)(F,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<0||u>=l.length-1,onClick:()=>o(l[u+1]?.path??null),children:(0,$.jsx)(Ae,{})})]}),l.length===0?(0,$.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(pt,{files:f.filter(e=>e.path===a),wrap:!0,className:`min-w-0`}),m&&!m.patch?(0,$.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,m.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Gt({item:e,colors:t}){let n=u(e.kind,e.number),r=n.data,i=(0,Q.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(Kt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsx)(nt,{className:`mb-3 h-3 w-24`}),(0,$.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,$.jsx)(nt,{className:`h-14 w-full`}),(0,$.jsx)(nt,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,$.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,$.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,$.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,$.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 eyebrow text-soft-foreground`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,$.jsx)(`ul`,{className:`flex flex-col gap-5`,children:qt(i).map(e=>e.group===`commits`?(0,$.jsx)(Jt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,$.jsx)(en,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,$.jsx)(Xt,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,$.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Kt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function qt(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 Jt({commits:e,colors:t}){let[n,r]=(0,Q.useState)(!1),i=e[0]?.actor??`?`;return n?(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-meta text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:Yt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,$.jsx)(Xt,{event:e,colors:t},e.id))]}):(0,$.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,$.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-meta text-soft-foreground hover:text-foreground`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,children:Yt.committed}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,$.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,$.jsx)(`span`,{className:`shrink-0`,children:X(e[e.length-1].createdAt)})]})})}var Yt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Xt({event:e,colors:t}){return(0,$.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:O(`flex min-w-0 items-center gap-1.5 font-mono text-meta text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Yt[e.kind]}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,$.jsx)(Zt,{event:e,colors:t}),(0,$.jsx)(`span`,{className:`shrink-0`,children:X(e.createdAt)}),e.url?(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Zt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,$.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,$.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,$.jsx)(Qt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,$.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,$.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,$.jsx)(`span`,{"data-slot":`gh-event-label`,style:Z(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-micro`,children:e.label.name}):null,(0,$.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,$.jsx)(`span`,{children:`merged this`});case`closed`:return(0,$.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,$.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,$.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,$.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Qt({checks:e}){return e?(0,$.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:O(`shrink-0`,rn[e]),children:nn[e]}):null}var $t={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 en({comment:e}){let t=e.reviewState?$t[e.reviewState]:null;return(0,$.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,$.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-meta text-soft-foreground`,children:[(0,$.jsx)(tn,{url:e.avatarUrl,login:e.author}),(0,$.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,$.jsx)(`span`,{children:X(e.createdAt)}),t?(0,$.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:O(`rounded-full border px-1.5 py-px font-sans text-micro font-medium`,t.tone),children:t.label}):null,(0,$.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,$.jsx)(G,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,$.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,$.jsx)(vt,{children:e.body}):(0,$.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function tn({url:e,login:t}){let[n,r]=(0,Q.useState)(!1);return e&&!n?(0,$.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,$.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var nn={passing:`✓`,failing:`✗`,pending:`○`},rn={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function an({count:e}){return e?(0,$.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,$.jsx)(q,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function on({checks:e,url:t}){let n=O(`text-meta font-medium`,rn[e],t&&`hover:underline`),r=`${nn[e]} checks ${e}`;return t?(0,$.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,$.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function sn({checks:e}){return(0,$.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:O(`shrink-0 font-sans text-meta font-semibold`,rn[e]),children:nn[e]})}export{Nt as GithubRoute};
|
|
@@ -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{Cn as r,Di as i,F as a,co as o,hn as s,pn as c}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Cn as r,Di as i,F as a,co as o,hn as s,pn as c}from"./queries-DbDUaheq.js";import{w as l}from"./utils-Bl_tQdVw.js";import{t as u}from"./use-desktop-BNN3U2y9.js";var d=e(t(),1);function f(e){let t=e.container;if(t===void 0)return{hasContainer:!1,cpuLimited:!1,cpuCores:e.cpuCount,...e.cpuPct===void 0?{}:{cpuPct:e.cpuPct},cpuIsEffective:!1,memLimited:!1,memTotalBytes:e.memTotalBytes,...e.memUsedBytes===void 0?{}:{memUsedBytes:e.memUsedBytes},memIsEffective:!1,cgroupUnknown:e.cgroupProbe===`unavailable`};let n=t.cpuQuotaCores!==void 0||t.cpuAffinityCores!==void 0,r=t.cpuQuotaCores===void 0?t.cpuAffinityCores===void 0?void 0:`cpuset`:`quota`,i=n?Math.min(e.cpuCount,e.hostCpuCount??1/0,t.cpuQuotaCores??1/0,t.cpuAffinityCores??1/0):e.cpuCount,a=t.memLimitBytes!==void 0,o=n?t.cpuPct:e.cpuPct,s=a?t.memUsedBytes:e.memUsedBytes;return{hasContainer:!0,source:t.source,cpuLimited:n,...r===void 0?{}:{cpuLimitKind:r},cpuCores:i,...o===void 0?{}:{cpuPct:o},cpuIsEffective:n,memLimited:a,memTotalBytes:a?t.memLimitBytes??e.memTotalBytes:e.memTotalBytes,...s===void 0?{}:{memUsedBytes:s},memIsEffective:a,...e.hostCpuCount===void 0?{}:{hostCpuCount:e.hostCpuCount},cgroupUnknown:e.cgroupProbe===`unavailable`}}function p(e){let t=Math.round(e*10)/10;return`${Number.isInteger(t)?t:t.toFixed(1)} CPU`}function m(e,t){let n=r(t);if(e===void 0)return`— / ${n}`;let i=r(e),a=n.split(` `)[1];return a!==void 0&&i.endsWith(` ${a}`)?`${i.slice(0,-(a.length+1))}/${n}`:`${i}/${n}`}var h=n(),g=2500,_=2e3,v=(e,t)=>new Promise((n,r)=>{if(t?.aborted){r(new DOMException(`Aborted`,`AbortError`));return}let i=()=>{clearTimeout(a),r(new DOMException(`Aborted`,`AbortError`))},a=setTimeout(()=>{t?.removeEventListener(`abort`,i),n()},e);t?.addEventListener(`abort`,i,{once:!0})});async function y(e){let t=await i({signal:e});return t.cpuPct===void 0?(await v(g,e),i({signal:e})):t}function b(){let e=a().data;if(e!==void 0)return e.capabilities?.localHandoff===!0?`local`:`remote`}var x=Object.freeze([]),S=Object.freeze({history:x});function C(){let e=S,t,n=new Set,r=()=>{for(let e of n)e()},i=!1,a=()=>{document.visibilityState!==`hidden`&&(document.removeEventListener(`visibilitychange`,a),i=!1,r())},o=()=>{if(typeof document>`u`||document.visibilityState!==`hidden`)return r();i||(i=!0,document.addEventListener(`visibilitychange`,a))};return{subscribe(e){return n.add(e),()=>n.delete(e)},get:()=>e,push(n,r,i){let a=e,s=t!==void 0&&t!==i;t=i;let c=a.latest?.sampledAt===n.sampledAt;if(c&&a.latest===n&&a.lastFrameAt===r&&!s)return;let l=a.history[a.history.length-1],u=!c&&l!==void 0&&Date.parse(n.sampledAt)-Date.parse(l.sampledAt)>8e3,d=i!==`route`,p=s||u||!d?[]:a.history,m=f(n).cpuPct,h=p[p.length-1];e={latest:n,lastFrameAt:r,history:d&&m!==void 0&&h?.sampledAt!==n.sampledAt?[...p,{sampledAt:n.sampledAt,receivedAt:r,cpuPct:m}].slice(-30):p,...a.topicUnavailable===!0?{topicUnavailable:!0}:{}},o()},markTopicUnavailable(){e.topicUnavailable!==!0&&(e={...e,topicUnavailable:!0},r())},reset(){t=void 0,e=S,r()}}}var w=(0,d.createContext)(null);function T({children:e}){let[t]=(0,d.useState)(C);return(0,h.jsxs)(w.Provider,{value:t,children:[e,(0,h.jsx)(E,{})]})}function E(){return P(),null}var D=()=>()=>void 0;function O(){let e=(0,d.useContext)(w);return(0,d.useSyncExternalStore)(e?e.subscribe:D,()=>e?.get().latest,()=>void 0)}function k(){let e=(0,d.useContext)(w);return(0,d.useSyncExternalStore)(e?e.subscribe:D,()=>e?.get().history??S.history,()=>S.history)}function A(){let e=(0,d.useContext)(w);return(0,d.useSyncExternalStore)(e?e.subscribe:D,()=>e?.get().lastFrameAt,()=>void 0)}function j(){let e=(0,d.useContext)(w);return(0,d.useSyncExternalStore)(e?e.subscribe:D,()=>e?.get().topicUnavailable===!0,()=>!1)}function M(){let e=O(),t=A(),[n,r]=(0,d.useState)(()=>Date.now());if((0,d.useEffect)(()=>{let e=setInterval(()=>r(Date.now()),1e3);return()=>clearInterval(e)},[]),e===void 0)return;let i=Date.parse(e.sampledAt);return Number.isNaN(i)?t===void 0?void 0:Math.max(0,Math.round((n-t)/1e3)):Math.max(0,Math.round((n-i)/1e3))}function N(e,t){let n=(0,d.useContext)(w),r=b(),a=j();(0,d.useEffect)(()=>{if(!(!n||!t||r!==`local`))return s(`host`,t=>{let r=l.safeParse(t);r.success&&n.push(r.data,Date.now(),e)},()=>n.markTopicUnavailable())},[n,t,r,e]);let u=o({queryKey:[...c.hostUsage,`poll`],queryFn:({signal:e})=>i({signal:e}),enabled:n!==null&&t&&r===`local`&&a,refetchInterval:_,staleTime:0,retry:!1}).data;(0,d.useEffect)(()=>{!n||u===void 0||n.push(u,Date.now(),e)},[n,u,e])}function P(){N(`root`,u())}function F(e={}){N(`card`,e.enabled??!0)}function I(){let e=(0,d.useContext)(w),t=b(),n=o({queryKey:c.hostUsage,queryFn:({signal:e})=>y(e),enabled:t===`remote`,staleTime:0,retry:!1}),r=n.data;return(0,d.useEffect)(()=>{!e||r===void 0||e.push(r,Date.now(),`route`)},[e,r]),n}export{j as a,I as c,p as d,m as f,M as i,F as l,k as n,b as o,A as r,O as s,T as t,f as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as e}from"./react-runtime-CCIEwYL0.js";import{i as t,n,r,t as i}from"./tooltip-
|
|
1
|
+
import{t as e}from"./react-runtime-CCIEwYL0.js";import{i as t,n,r,t as i}from"./tooltip-26XdOGj8.js";var a=e();function o({label:e,side:o=`bottom`,children:s}){return(0,a.jsx)(r,{delayDuration:300,children:(0,a.jsxs)(i,{children:[(0,a.jsx)(t,{asChild:!0,children:s}),(0,a.jsx)(n,{side:o,sideOffset:6,"data-slot":`icon-tooltip`,children:e})]})})}export{o as t};
|
|
@@ -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{It as r,L as i,Xt as a,ji as o,r as s,uo as c}from"./queries-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{It as r,L as i,Xt as a,ji as o,r as s,uo as c}from"./queries-DbDUaheq.js";import{t as l}from"./utils-Bl_tQdVw.js";import{c as u,t as d}from"./project-router-ByYpf5zi.js";import{t as f}from"./button-jcXhXi-5.js";import{_ as p,i as m,r as h,y as g}from"./impact-model-Bo4KSZmi.js";import{t as _}from"./loader-circle-BuBcxAH7.js";var v=e(t(),1),y=n();function b({subject:e,unavailable:t,className:n}){let b=o(e),x=i(e),S=x.data?.run?.id,C=r((0,v.useMemo)(()=>e=>S?e.find(e=>e.id===S)?.status:void 0,[S])).data,w=m(x.data,{pending:x.isPending,error:x.error,liveStatus:C}),T=c(),E=x.data?.run?.status;(0,v.useEffect)(()=>{C===void 0||E===void 0||C===E||T.invalidateQueries({queryKey:s.runs.impactSubject(b)})},[E,b,C,T]);let D=(0,v.useId)(),O=a(),[k,A]=(0,v.useState)(null),j=k?.key===b?k.message:void 0,M=t??j,N=u(),P=()=>{M||O.isPending||O.mutate({subject:e},{onError:e=>A({key:b,message:e instanceof Error?e.message:String(e)})})},F=(e,t)=>(0,y.jsxs)(f,{type:`button`,size:`sm`,variant:t,"data-action":`impact-assess`,disabled:!!M||O.isPending,"aria-busy":O.isPending||void 0,"aria-describedby":M?D:void 0,onClick:P,children:[O.isPending?(0,y.jsx)(_,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):e===`Re-assess`?(0,y.jsx)(p,{"aria-hidden":`true`}):(0,y.jsx)(g,{"aria-hidden":`true`}),e]});return(0,y.jsxs)(`div`,{"data-slot":`impact-control`,"data-state":w.kind===`open`&&w.stale?`stale`:w.kind,className:l(`flex flex-wrap items-center gap-2 text-xs`,n),children:[w.kind===`loading`?(0,y.jsx)(`span`,{className:`text-soft-foreground`,children:`Checking impact…`}):w.kind===`error`?(0,y.jsxs)(`span`,{"data-slot":`impact-error`,className:`text-danger`,children:[`Could not check impact: `,w.message]}):w.kind===`assessing`?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsxs)(`span`,{"data-slot":`impact-assessing`,role:`status`,className:`inline-flex items-center gap-1.5 rounded-full border border-border bg-muted px-2 py-0.5 font-medium`,children:[(0,y.jsx)(_,{"aria-hidden":`true`,className:`size-3 motion-safe:animate-spin`}),`Assessing…`]}),(0,y.jsx)(f,{asChild:!0,size:`sm`,variant:`outline`,children:(0,y.jsx)(d,{"data-action":`impact-go-to-task`,to:`/tasks/${w.runId}`,children:`Go to task`})})]}):w.kind===`open`?(0,y.jsxs)(y.Fragment,{children:[w.stale?(0,y.jsx)(`span`,{"data-slot":`impact-stale`,title:`The subject changed since this assessment`,className:`rounded-full border border-pending-strong/45 bg-pending-strong/10 px-2 py-0.5 font-medium text-pending-strong`,children:`Stale`}):null,(0,y.jsx)(f,{type:`button`,size:`sm`,variant:w.stale?`outline`:`primary`,"data-action":`impact-open`,onClick:()=>N(h(w.runId)),children:`Open impact`}),F(`Re-assess`,w.stale?`primary`:`outline`),(0,y.jsx)(`span`,{"data-slot":`impact-meta`,className:`font-mono text-meta text-soft-foreground`,children:w.meta})]}):(0,y.jsxs)(y.Fragment,{children:[F(`Assess impact`,`primary`),w.note?(0,y.jsxs)(`span`,{"data-slot":`impact-note`,className:`text-soft-foreground`,children:[w.note,` `,w.runId?(0,y.jsx)(d,{to:`/tasks/${w.runId}`,className:`underline underline-offset-2 hover:text-foreground`,children:`Go to task`}):null]}):null]}),M&&w.kind!==`loading`&&w.kind!==`error`&&w.kind!==`assessing`?(0,y.jsx)(`span`,{id:D,"data-slot":`impact-reason`,className:`basis-full text-soft-foreground`,children:M}):null]})}export{b as t};
|
|
@@ -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,F as i}from"./queries-DvnoUOE1.js";import{t as a}from"./utils-DujIMO-J.js";import{s as o,t as s}from"./project-router-DXcbRXxc.js";import{N as c,t as l}from"./button-DhBNRPDb.js";import{s as u}from"./dist-BJiHofth.js";import{l as d,n as ee,r as f,t as p}from"./dropdown-menu-R7qzKuR5.js";import{n as m,t as h}from"./upload-CyWxzeww.js";import{n as g,t as _}from"./git-pull-request-D2gvtstb.js";import{t as v}from"./git-pull-request-draft-CLy0NzfX.js";import{t as te}from"./loader-circle-wWXhd3lT.js";import{i as y,n as b,r as x,t as S}from"./tooltip-DZFNJfGV.js";import{n as C}from"./format-DHK74MwW.js";import{t as ne}from"./diff-stat-CgvKmRgV.js";import{t as re}from"./icon-tooltip-DWp0bFCr.js";var w=c(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),T=c(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),E=c(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),D=c(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),O=c(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),k=c(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),A=c(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),j=e(t(),1),M={github:`gh`};function N(e){return M[e]}function P(e){return`the ${e} CLI is not installed or not logged in — run \`${e} auth login\``}function F(e,t,n){let r=t?.bootProject??e?.bootProject??null;if(n===null||n==="default"||n===r)return e?.forge;let i=t?.projects?.find(e=>e.id===n);if(!i||!e)return;if(!i.forge)return null;let a=N(i.forge),o=a?e.checks?.find(e=>e.name===a):void 0;return!a||!o?{kind:i.forge}:o.available?{kind:i.forge,available:!0}:{kind:i.forge,available:!1,reason:P(a)}}function I(){let e=i().data,t=r().data,n=o();return(0,j.useMemo)(()=>F(e,t,n),[e,t,n])}var L=n();function R({to:e,active:t=!1,onClick:n,children:r}){return(0,L.jsx)(s,{to:e,"aria-current":t?`page`:void 0,onClick:n,className:a(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-2 text-ui font-medium md:px-3`,t?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`),children:r})}function z({mode:e,wrap:t,preview:n=!1,onModeChange:r,onWrapChange:i,onPreviewChange:o}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,L.jsx)(B,{current:e,value:`unified`,onModeChange:r}),(0,L.jsx)(B,{current:e,value:`split`,onModeChange:r})]}),o?(0,L.jsx)(x,{delayDuration:300,children:(0,L.jsxs)(S,{children:[(0,L.jsx)(y,{asChild:!0,children:(0,L.jsx)(l,{variant:`ghost`,size:`icon-sm`,"data-slot":`markdown-preview-toggle`,"aria-pressed":n,"aria-label":`Preview Markdown`,className:a(n&&`bg-muted text-foreground`),onClick:()=>o(!n),children:(0,L.jsx)(w,{"aria-hidden":`true`})})}),(0,L.jsx)(b,{side:`bottom`,sideOffset:6,"data-slot":`markdown-preview-tooltip`,children:n?`Show Markdown as a diff`:`Preview Markdown`})]})}):null,(0,L.jsx)(l,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:a(t&&`bg-muted text-foreground`),onClick:()=>i(!t),children:(0,L.jsx)(k,{"aria-hidden":`true`})})]})}function B({current:e,value:t,onModeChange:n}){let r=e===t;return(0,L.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:a(`rounded-[5px] px-2 py-0.5 text-meta font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function V({branch:e}){return(0,L.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-meta font-medium`,children:[(0,L.jsx)(D,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,L.jsx)(`span`,{className:`truncate`,children:e})]})}function H({branch:e,stat:t,mode:n,wrap:r,preview:i,onModeChange:a,onWrapChange:o,onPreviewChange:s}){return(0,L.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[e?(0,L.jsx)(V,{branch:e}):null,t?(0,L.jsx)(q,{stat:t}):null,(0,L.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:(0,L.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,L.jsx)(z,{mode:n,wrap:r,preview:i,onModeChange:a,onWrapChange:o,onPreviewChange:s})})})]})}function U({action:e,pending:t=null,onAction:n}){if(!e)return null;let r=e.alternatives??[],i=t!==null;return(0,L.jsxs)(`span`,{"data-slot":`git-button`,className:`inline-flex items-center`,children:[(0,L.jsx)(K,{action:e,busyAs:i?t:null,variant:`outline`,onAction:n,className:r.length>0?`rounded-r-none`:void 0}),r.length>0?(0,L.jsxs)(p,{children:[(0,L.jsx)(d,{asChild:!0,children:(0,L.jsx)(l,{variant:`outline`,size:`sm`,disabled:i,"aria-label":`More ways to ${e.label.toLowerCase()}`,className:`-ml-px rounded-l-none px-1.5`,children:(0,L.jsx)(u,{"aria-hidden":`true`})})}),(0,L.jsx)(ee,{align:`end`,"data-slot":`git-button-menu`,children:r.map(e=>(0,L.jsxs)(f,{"data-action":e.id,disabled:!e.enabled,title:e.reason,onSelect:()=>n(e.id),children:[W[e.id],e.label]},e.id))})]}):null]})}var W={land:(0,L.jsx)(m,{"aria-hidden":`true`}),commit:(0,L.jsx)(m,{"aria-hidden":`true`}),"commit-push":(0,L.jsx)(h,{"aria-hidden":`true`}),push:(0,L.jsx)(h,{"aria-hidden":`true`}),"create-pr":(0,L.jsx)(_,{"aria-hidden":`true`}),"create-draft-pr":(0,L.jsx)(v,{"aria-hidden":`true`}),"update-branch":(0,L.jsx)(O,{"aria-hidden":`true`}),"resolve-conflicts":(0,L.jsx)(g,{"aria-hidden":`true`}),"fix-checks":(0,L.jsx)(A,{"aria-hidden":`true`})},G={land:`Committing and pushing…`,commit:`Committing…`,"commit-push":`Committing and pushing…`,push:`Pushing…`,"create-pr":`Creating PR…`,"create-draft-pr":`Creating draft PR…`,"update-branch":`Updating branch…`,"resolve-conflicts":`Resolving conflicts…`,"fix-checks":`Fixing errors…`};function K({action:e,busyAs:t,variant:n,onAction:r,className:i}){let o=!e.enabled&&t===null,s=(0,L.jsx)(l,{variant:n,size:`sm`,"data-action":e.id,className:a(i,o&&`cursor-not-allowed opacity-50 hover:bg-card`),disabled:t!==null,"aria-disabled":o||void 0,"aria-busy":t!==null||void 0,onClick:o?void 0:()=>r(e.id),children:t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(te,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}),G[t]]}):(0,L.jsxs)(L.Fragment,{children:[W[e.id],e.label]})});return o&&e.reason?(0,L.jsx)(re,{label:e.reason,children:s}):s}function q({stat:e}){return(0,L.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,L.jsx)(ne,{stat:{adds:J(e.adds),dels:J(e.dels),files:e.files}})})}function J(e){let[t,n]=(0,j.useState)(e),r=(0,j.useRef)(e);return(0,j.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}var Y=`impact.html`,X=/^\.ai\/specs\/(?:[^/]+\/)*[^/]+\.md$/;function ie(e){return!e||!X.test(e)?!1:!e.split(`/`).some(e=>e===`..`||e===`.`||e===``)}var ae=new Set([`queued`,`running`,`waiting`]);function oe(e,t){if(t.error)return{kind:`error`,message:t.error.message};if(t.pending||e===void 0)return{kind:`loading`};if(e.run===null)return{kind:`assess`};let n=e.run.id,r=t.liveStatus??e.run.status,i=e.artifacts.find(e=>e.name===Y);if(!i&&ae.has(r))return{kind:`assessing`,runId:n};if(!i)return{kind:`assess`,runId:n,note:r===`failed`?`The last assessment failed without a report.`:r===`cancelled`?`The last assessment was stopped before its report.`:`The last assessment ended without a report.`};let a=se(e.subject.kind===`pr`?e.subject.headSha:e.subject.blobSha,i.updatedAt,e.versions,t.now);return{kind:`open`,runId:n,stale:e.stale===!0,meta:a}}function se(e,t,n,r=Date.now()){let i=C(t,r),a=[e.slice(0,7),i?`${i} ago`:``],o=n?.at(-1);return o&&a.push(`v${o.version}`),a.filter(Boolean).join(` · `)}function ce(e){return`/tasks/${e}/assets/${Y}`}var Z=`cez-impact-auto-switched`;function Q(){try{let e=JSON.parse(sessionStorage.getItem(Z)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function le(e){return Q().includes(e)}function $(e){try{let t=[...Q().filter(t=>t!==e),e].slice(-50);sessionStorage.setItem(Z,JSON.stringify(t))}catch{}}export{O as _,ie as a,T as b,W as c,H as d,V as f,A as g,I as h,oe as i,G as l,R as m,le as n,$ as o,z as p,ce as r,q as s,Y as t,U as u,D as v,w as x,E as y};
|
|
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,F as i}from"./queries-DbDUaheq.js";import{t as a}from"./utils-Bl_tQdVw.js";import{s as o,t as s}from"./project-router-ByYpf5zi.js";import{N as c,t as l}from"./button-jcXhXi-5.js";import{s as u}from"./dist-C2IyLYZs.js";import{l as d,n as ee,r as f,t as p}from"./dropdown-menu-Da8iP-nI.js";import{n as m,t as h}from"./upload-Cu6NRABh.js";import{n as g,t as _}from"./git-pull-request-BAfSEvVb.js";import{t as v}from"./git-pull-request-draft-BIgZJsu-.js";import{t as te}from"./loader-circle-BuBcxAH7.js";import{i as y,n as b,r as x,t as S}from"./tooltip-26XdOGj8.js";import{n as C}from"./format-DHK74MwW.js";import{t as ne}from"./diff-stat-YT7Licr1.js";import{t as re}from"./icon-tooltip-BfI1AC00.js";var w=c(`eye`,[[`path`,{d:`M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0`,key:`1nclc0`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]),T=c(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),E=c(`file-search`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`11.5`,cy:`14.5`,r:`2.5`,key:`1bq0ko`}],[`path`,{d:`M13.3 16.3 15 18`,key:`2quom7`}]]),D=c(`git-branch`,[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]),O=c(`refresh-cw`,[[`path`,{d:`M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8`,key:`v9h5vc`}],[`path`,{d:`M21 3v5h-5`,key:`1q7to0`}],[`path`,{d:`M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16`,key:`3uifl3`}],[`path`,{d:`M8 16H3v5`,key:`1cv678`}]]),k=c(`text-wrap`,[[`path`,{d:`m16 16-3 3 3 3`,key:`117b85`}],[`path`,{d:`M3 12h14.5a1 1 0 0 1 0 7H13`,key:`18xa6z`}],[`path`,{d:`M3 19h6`,key:`1ygdsz`}],[`path`,{d:`M3 5h18`,key:`1u36vt`}]]),A=c(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),j=e(t(),1),M={github:`gh`};function N(e){return M[e]}function P(e){return`the ${e} CLI is not installed or not logged in — run \`${e} auth login\``}function F(e,t,n){let r=t?.bootProject??e?.bootProject??null;if(n===null||n==="default"||n===r)return e?.forge;let i=t?.projects?.find(e=>e.id===n);if(!i||!e)return;if(!i.forge)return null;let a=N(i.forge),o=a?e.checks?.find(e=>e.name===a):void 0;return!a||!o?{kind:i.forge}:o.available?{kind:i.forge,available:!0}:{kind:i.forge,available:!1,reason:P(a)}}function I(){let e=i().data,t=r().data,n=o();return(0,j.useMemo)(()=>F(e,t,n),[e,t,n])}var L=n();function R({to:e,active:t=!1,onClick:n,children:r}){return(0,L.jsx)(s,{to:e,"aria-current":t?`page`:void 0,onClick:n,className:a(`-mb-px flex h-8 items-center rounded-t-md border-b-2 px-2 text-ui font-medium md:px-3`,t?`border-foreground font-semibold text-foreground`:`border-transparent text-muted-foreground hover:bg-muted hover:text-foreground`),children:r})}function z({mode:e,wrap:t,preview:n=!1,onModeChange:r,onWrapChange:i,onPreviewChange:o}){return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`span`,{"data-slot":`diff-mode-toggle`,role:`group`,"aria-label":`Diff layout`,className:`flex items-center rounded-md border border-border p-0.5`,children:[(0,L.jsx)(B,{current:e,value:`unified`,onModeChange:r}),(0,L.jsx)(B,{current:e,value:`split`,onModeChange:r})]}),o?(0,L.jsx)(x,{delayDuration:300,children:(0,L.jsxs)(S,{children:[(0,L.jsx)(y,{asChild:!0,children:(0,L.jsx)(l,{variant:`ghost`,size:`icon-sm`,"data-slot":`markdown-preview-toggle`,"aria-pressed":n,"aria-label":`Preview Markdown`,className:a(n&&`bg-muted text-foreground`),onClick:()=>o(!n),children:(0,L.jsx)(w,{"aria-hidden":`true`})})}),(0,L.jsx)(b,{side:`bottom`,sideOffset:6,"data-slot":`markdown-preview-tooltip`,children:n?`Show Markdown as a diff`:`Preview Markdown`})]})}):null,(0,L.jsx)(l,{variant:`ghost`,size:`icon-sm`,"data-slot":`wrap-toggle`,"aria-pressed":t,"aria-label":`Wrap long lines`,title:`Wrap long lines`,className:a(t&&`bg-muted text-foreground`),onClick:()=>i(!t),children:(0,L.jsx)(k,{"aria-hidden":`true`})})]})}function B({current:e,value:t,onModeChange:n}){let r=e===t;return(0,L.jsx)(`button`,{type:`button`,"data-mode":t,"aria-pressed":r,onClick:()=>n(t),className:a(`rounded-[5px] px-2 py-0.5 text-meta font-medium capitalize`,r?`bg-muted text-foreground`:`text-muted-foreground hover:text-foreground`),children:t})}function V({branch:e}){return(0,L.jsxs)(`span`,{"data-slot":`branch-chip`,className:`flex min-w-0 items-center gap-1 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-meta font-medium`,children:[(0,L.jsx)(D,{"aria-hidden":`true`,className:`size-3 shrink-0`}),(0,L.jsx)(`span`,{className:`truncate`,children:e})]})}function H({branch:e,stat:t,mode:n,wrap:r,preview:i,onModeChange:a,onWrapChange:o,onPreviewChange:s}){return(0,L.jsxs)(`div`,{"data-slot":`git-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[e?(0,L.jsx)(V,{branch:e}):null,t?(0,L.jsx)(q,{stat:t}):null,(0,L.jsx)(`span`,{className:`ml-auto flex items-center gap-1`,children:(0,L.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,L.jsx)(z,{mode:n,wrap:r,preview:i,onModeChange:a,onWrapChange:o,onPreviewChange:s})})})]})}function U({action:e,pending:t=null,onAction:n}){if(!e)return null;let r=e.alternatives??[],i=t!==null;return(0,L.jsxs)(`span`,{"data-slot":`git-button`,className:`inline-flex items-center`,children:[(0,L.jsx)(K,{action:e,busyAs:i?t:null,variant:`outline`,onAction:n,className:r.length>0?`rounded-r-none`:void 0}),r.length>0?(0,L.jsxs)(p,{children:[(0,L.jsx)(d,{asChild:!0,children:(0,L.jsx)(l,{variant:`outline`,size:`sm`,disabled:i,"aria-label":`More ways to ${e.label.toLowerCase()}`,className:`-ml-px rounded-l-none px-1.5`,children:(0,L.jsx)(u,{"aria-hidden":`true`})})}),(0,L.jsx)(ee,{align:`end`,"data-slot":`git-button-menu`,children:r.map(e=>(0,L.jsxs)(f,{"data-action":e.id,disabled:!e.enabled,title:e.reason,onSelect:()=>n(e.id),children:[W[e.id],e.label]},e.id))})]}):null]})}var W={land:(0,L.jsx)(m,{"aria-hidden":`true`}),commit:(0,L.jsx)(m,{"aria-hidden":`true`}),"commit-push":(0,L.jsx)(h,{"aria-hidden":`true`}),push:(0,L.jsx)(h,{"aria-hidden":`true`}),"create-pr":(0,L.jsx)(_,{"aria-hidden":`true`}),"create-draft-pr":(0,L.jsx)(v,{"aria-hidden":`true`}),"update-branch":(0,L.jsx)(O,{"aria-hidden":`true`}),"resolve-conflicts":(0,L.jsx)(g,{"aria-hidden":`true`}),"fix-checks":(0,L.jsx)(A,{"aria-hidden":`true`})},G={land:`Committing and pushing…`,commit:`Committing…`,"commit-push":`Committing and pushing…`,push:`Pushing…`,"create-pr":`Creating PR…`,"create-draft-pr":`Creating draft PR…`,"update-branch":`Updating branch…`,"resolve-conflicts":`Resolving conflicts…`,"fix-checks":`Fixing errors…`};function K({action:e,busyAs:t,variant:n,onAction:r,className:i}){let o=!e.enabled&&t===null,s=(0,L.jsx)(l,{variant:n,size:`sm`,"data-action":e.id,className:a(i,o&&`cursor-not-allowed opacity-50 hover:bg-card`),disabled:t!==null,"aria-disabled":o||void 0,"aria-busy":t!==null||void 0,onClick:o?void 0:()=>r(e.id),children:t?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(te,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}),G[t]]}):(0,L.jsxs)(L.Fragment,{children:[W[e.id],e.label]})});return o&&e.reason?(0,L.jsx)(re,{label:e.reason,children:s}):s}function q({stat:e}){return(0,L.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,L.jsx)(ne,{stat:{adds:J(e.adds),dels:J(e.dels),files:e.files}})})}function J(e){let[t,n]=(0,j.useState)(e),r=(0,j.useRef)(e);return(0,j.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}var Y=`impact.html`,X=/^\.ai\/specs\/(?:[^/]+\/)*[^/]+\.md$/;function ie(e){return!e||!X.test(e)?!1:!e.split(`/`).some(e=>e===`..`||e===`.`||e===``)}var ae=new Set([`queued`,`running`,`waiting`]);function oe(e,t){if(t.error)return{kind:`error`,message:t.error.message};if(t.pending||e===void 0)return{kind:`loading`};if(e.run===null)return{kind:`assess`};let n=e.run.id,r=t.liveStatus??e.run.status,i=e.artifacts.find(e=>e.name===Y);if(!i&&ae.has(r))return{kind:`assessing`,runId:n};if(!i)return{kind:`assess`,runId:n,note:r===`failed`?`The last assessment failed without a report.`:r===`cancelled`?`The last assessment was stopped before its report.`:`The last assessment ended without a report.`};let a=se(e.subject.kind===`pr`?e.subject.headSha:e.subject.blobSha,i.updatedAt,e.versions,t.now);return{kind:`open`,runId:n,stale:e.stale===!0,meta:a}}function se(e,t,n,r=Date.now()){let i=C(t,r),a=[e.slice(0,7),i?`${i} ago`:``],o=n?.at(-1);return o&&a.push(`v${o.version}`),a.filter(Boolean).join(` · `)}function ce(e){return`/tasks/${e}/assets/${Y}`}var Z=`cez-impact-auto-switched`;function Q(){try{let e=JSON.parse(sessionStorage.getItem(Z)??`[]`);return Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}catch{return[]}}function le(e){return Q().includes(e)}function $(e){try{let t=[...Q().filter(t=>t!==e),e].slice(-50);sessionStorage.setItem(Z,JSON.stringify(t))}catch{}}export{O as _,ie as a,T as b,W as c,H as d,V as f,A as g,I as h,oe as i,G as l,R as m,le as n,$ as o,z as p,ce as r,q as s,Y as t,U as u,D as v,w as x,E as y};
|