@open-mercato/cezar 0.9.1-pr705.839 → 0.9.1-pr705.843
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/server/server.d.ts +36 -36
- package/package.json +2 -2
- package/web/dist/assets/{compare-variants-KyucddH5.js → compare-variants--IUax1iv.js} +1 -1
- package/web/dist/assets/{diff-B1TroQje.js → diff-CNt01FyY.js} +2 -2
- package/web/dist/assets/{diff-view-RF_nCX4u.js → diff-view-CPL3GUgh.js} +1 -1
- package/web/dist/assets/{git-toolbar-B4anIwhb.js → git-toolbar-PuZTnn2Z.js} +1 -1
- package/web/dist/assets/{github-CGinvMbL.js → github-DHTw87wy.js} +1 -1
- package/web/dist/assets/{index-dVJvf20I.js → index-DiyQLNs2.js} +9 -9
- package/web/dist/assets/{repo-git-iSctu2IP.js → repo-git-D4oyqtPR.js} +1 -1
- package/web/dist/assets/{run-diff-BPsHpM-r.js → run-diff-DLo_-8Et.js} +1 -1
- package/web/dist/assets/{run-header-ConQmEVL.js → run-header-CiBeaAnP.js} +1 -1
- package/web/dist/assets/{skills-B0FbvF2c.js → skills-Bed45O3c.js} +1 -1
- package/web/dist/assets/{task-changes-BDZzCnVO.js → task-changes-noIrnu9G.js} +1 -1
- package/web/dist/assets/{task-commits-BWzyRCnM.js → task-commits-bDEF2Jfz.js} +1 -1
- package/web/dist/assets/{task-files-Bql05Mu3.js → task-files-BOOblfZc.js} +1 -1
- package/web/dist/assets/{task-thread-D_gXgug0.js → task-thread-BbyYsjLW.js} +1 -1
- package/web/dist/assets/{use-desktop-BxN_DAYI.js → use-desktop-DpM2CSDg.js} +1 -1
- package/web/dist/assets/{workflows-D-KuxA7g.js → workflows-DMH4Gabv.js} +1 -1
- package/web/dist/index.html +1 -1
package/dist/server/server.d.ts
CHANGED
|
@@ -306,14 +306,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
306
306
|
"/agent-config/:id": {
|
|
307
307
|
$put: {
|
|
308
308
|
output: {
|
|
309
|
-
|
|
310
|
-
path: string;
|
|
311
|
-
exists: boolean;
|
|
312
|
-
content: string;
|
|
313
|
-
version: string | null;
|
|
309
|
+
error: string;
|
|
314
310
|
};
|
|
315
311
|
outputFormat: "json";
|
|
316
|
-
status:
|
|
312
|
+
status: 404;
|
|
317
313
|
input: {
|
|
318
314
|
param: {
|
|
319
315
|
id: string;
|
|
@@ -321,10 +317,14 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
321
317
|
};
|
|
322
318
|
} | {
|
|
323
319
|
output: {
|
|
324
|
-
|
|
320
|
+
id: string;
|
|
321
|
+
path: string;
|
|
322
|
+
exists: boolean;
|
|
323
|
+
content: string;
|
|
324
|
+
version: string | null;
|
|
325
325
|
};
|
|
326
326
|
outputFormat: "json";
|
|
327
|
-
status:
|
|
327
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
328
328
|
input: {
|
|
329
329
|
param: {
|
|
330
330
|
id: string;
|
|
@@ -382,33 +382,33 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
382
382
|
"/workflows": {
|
|
383
383
|
$post: {
|
|
384
384
|
output: {
|
|
385
|
-
|
|
385
|
+
path: string;
|
|
386
|
+
name: string;
|
|
386
387
|
};
|
|
387
388
|
outputFormat: "json";
|
|
388
|
-
status:
|
|
389
|
+
status: 201;
|
|
389
390
|
input: {};
|
|
390
391
|
} | {
|
|
391
392
|
output: {
|
|
392
393
|
error: string;
|
|
393
|
-
exists: true;
|
|
394
394
|
};
|
|
395
395
|
outputFormat: "json";
|
|
396
|
-
status:
|
|
396
|
+
status: 400;
|
|
397
397
|
input: {};
|
|
398
398
|
} | {
|
|
399
399
|
output: {
|
|
400
400
|
error: string;
|
|
401
|
+
exists: true;
|
|
401
402
|
};
|
|
402
403
|
outputFormat: "json";
|
|
403
|
-
status:
|
|
404
|
+
status: 409;
|
|
404
405
|
input: {};
|
|
405
406
|
} | {
|
|
406
407
|
output: {
|
|
407
|
-
|
|
408
|
-
name: string;
|
|
408
|
+
error: string;
|
|
409
409
|
};
|
|
410
410
|
outputFormat: "json";
|
|
411
|
-
status:
|
|
411
|
+
status: 500;
|
|
412
412
|
input: {};
|
|
413
413
|
};
|
|
414
414
|
};
|
|
@@ -419,7 +419,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
419
419
|
error: string;
|
|
420
420
|
};
|
|
421
421
|
outputFormat: "json";
|
|
422
|
-
status:
|
|
422
|
+
status: 400;
|
|
423
423
|
input: {
|
|
424
424
|
param: {
|
|
425
425
|
name: string;
|
|
@@ -430,7 +430,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
430
430
|
error: string;
|
|
431
431
|
};
|
|
432
432
|
outputFormat: "json";
|
|
433
|
-
status:
|
|
433
|
+
status: 404;
|
|
434
434
|
input: {
|
|
435
435
|
param: {
|
|
436
436
|
name: string;
|
|
@@ -583,14 +583,10 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
583
583
|
"/agent-config/:id": {
|
|
584
584
|
$put: {
|
|
585
585
|
output: {
|
|
586
|
-
|
|
587
|
-
path: string;
|
|
588
|
-
exists: boolean;
|
|
589
|
-
content: string;
|
|
590
|
-
version: string | null;
|
|
586
|
+
error: string;
|
|
591
587
|
};
|
|
592
588
|
outputFormat: "json";
|
|
593
|
-
status:
|
|
589
|
+
status: 404;
|
|
594
590
|
input: {
|
|
595
591
|
param: {
|
|
596
592
|
id: string;
|
|
@@ -598,10 +594,14 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
598
594
|
};
|
|
599
595
|
} | {
|
|
600
596
|
output: {
|
|
601
|
-
|
|
597
|
+
id: string;
|
|
598
|
+
path: string;
|
|
599
|
+
exists: boolean;
|
|
600
|
+
content: string;
|
|
601
|
+
version: string | null;
|
|
602
602
|
};
|
|
603
603
|
outputFormat: "json";
|
|
604
|
-
status:
|
|
604
|
+
status: import("hono/utils/http-status").ContentfulStatusCode;
|
|
605
605
|
input: {
|
|
606
606
|
param: {
|
|
607
607
|
id: string;
|
|
@@ -659,33 +659,33 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
659
659
|
"/workflows": {
|
|
660
660
|
$post: {
|
|
661
661
|
output: {
|
|
662
|
-
|
|
662
|
+
path: string;
|
|
663
|
+
name: string;
|
|
663
664
|
};
|
|
664
665
|
outputFormat: "json";
|
|
665
|
-
status:
|
|
666
|
+
status: 201;
|
|
666
667
|
input: {};
|
|
667
668
|
} | {
|
|
668
669
|
output: {
|
|
669
670
|
error: string;
|
|
670
|
-
exists: true;
|
|
671
671
|
};
|
|
672
672
|
outputFormat: "json";
|
|
673
|
-
status:
|
|
673
|
+
status: 400;
|
|
674
674
|
input: {};
|
|
675
675
|
} | {
|
|
676
676
|
output: {
|
|
677
677
|
error: string;
|
|
678
|
+
exists: true;
|
|
678
679
|
};
|
|
679
680
|
outputFormat: "json";
|
|
680
|
-
status:
|
|
681
|
+
status: 409;
|
|
681
682
|
input: {};
|
|
682
683
|
} | {
|
|
683
684
|
output: {
|
|
684
|
-
|
|
685
|
-
name: string;
|
|
685
|
+
error: string;
|
|
686
686
|
};
|
|
687
687
|
outputFormat: "json";
|
|
688
|
-
status:
|
|
688
|
+
status: 500;
|
|
689
689
|
input: {};
|
|
690
690
|
};
|
|
691
691
|
};
|
|
@@ -696,7 +696,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
696
696
|
error: string;
|
|
697
697
|
};
|
|
698
698
|
outputFormat: "json";
|
|
699
|
-
status:
|
|
699
|
+
status: 400;
|
|
700
700
|
input: {
|
|
701
701
|
param: {
|
|
702
702
|
name: string;
|
|
@@ -707,7 +707,7 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
|
|
|
707
707
|
error: string;
|
|
708
708
|
};
|
|
709
709
|
outputFormat: "json";
|
|
710
|
-
status:
|
|
710
|
+
status: 404;
|
|
711
711
|
input: {
|
|
712
712
|
param: {
|
|
713
713
|
name: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-mercato/cezar",
|
|
3
|
-
"version": "0.9.1-pr705.
|
|
3
|
+
"version": "0.9.1-pr705.843",
|
|
4
4
|
"description": "Local cockpit for running and tracking AI agent tasks in your repo. Uses your logged-in `claude` CLI and `gh` — zero config, zero database.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"zod": "^3.23.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@open-mercato/cezar-api-client": "0.9.1-pr705.
|
|
53
|
+
"@open-mercato/cezar-api-client": "0.9.1-pr705.843",
|
|
54
54
|
"@types/node": "^20.14.0",
|
|
55
55
|
"@types/ws": "^8.18.1",
|
|
56
56
|
"tsx": "^4.19.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,Et as i,Pn as a,V as o,a as s,en as c,i as l,jn as u,k as d,kn as f,mt as p,t as m}from"./centered-state-_B4KtyI9.js";import{t as h}from"./utils-D27OaPrA.js";import{t as g}from"./search-x-CaddQd7u.js";import{i as _,n as v,r as y,t as b}from"./run-diff-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,Et as i,Pn as a,V as o,a as s,en as c,i as l,jn as u,k as d,kn as f,mt as p,t as m}from"./centered-state-_B4KtyI9.js";import{t as h}from"./utils-D27OaPrA.js";import{t as g}from"./search-x-CaddQd7u.js";import{i as _,n as v,r as y,t as b}from"./run-diff-DLo_-8Et.js";import{c as x,t as S}from"./project-router-DHNVGMTs.js";import{At as C,Ot as w,X as T,Xt as E,Y as D,Z as O,_ as k,an as A,d as j,f as M,g as N,h as P,ht as F,m as I,p as L,t as R,u as z,x as B}from"./index-DiyQLNs2.js";var V=e(t(),1),H=n();function U(){let{groupId:e}=f(),t=o(e),n=a();if((0,V.useEffect)(()=>{e&&n.invalidateQueries({queryKey:r.groups.detail(e)})},[n,e,(p().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,H.jsx)(D,{});if(t.isError){let e=t.error instanceof i&&t.error.status===404;return(0,H.jsx)(`div`,{"data-route":`compare`,className:`flex min-h-full flex-col`,children:(0,H.jsx)(m,{icon:e?(0,H.jsx)(g,{}):(0,H.jsx)(E,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load the variants`,subtitle:e?`No runs share this group id. The group may have been deleted, or a winner was already picked and the others removed.`:t.error.message,actions:(0,H.jsx)(s,{asChild:!0,variant:`outline`,children:(0,H.jsx)(S,{to:`/`,children:`Back to tasks`})})})})}return(0,H.jsx)(W,{groupId:e,variants:t.data.runs})}function W({groupId:e,variants:t}){let n=x(),i=a(),[o,s]=(0,V.useState)(null),f=t.every(e=>T.has(e.status)),p=t[0]?F(t[0]):``,m=u({mutationFn:t=>c(e,t),onSuccess:(t,a)=>{i.invalidateQueries({queryKey:r.runs.all}),i.invalidateQueries({queryKey:r.groups.detail(e)}),n(`/tasks/${t.winner?.id??a}`)},onError:e=>l(e.message,{tone:`danger`})});return(0,H.jsxs)(`div`,{"data-route":`compare`,className:`mx-auto flex w-full max-w-6xl flex-col gap-4 px-4 py-5 md:px-6`,children:[(0,H.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,H.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,H.jsx)(E,{className:`size-5 shrink-0 text-violet`,"aria-hidden":`true`}),(0,H.jsx)(`span`,{className:`min-w-0 truncate`,title:p,children:p})]}),(0,H.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[t.length,` variants of the same task, each in its own worktree — pick the diff you want to keep. The others are cancelled and archived, their worktrees and branches removed.`]})]}),(0,H.jsx)(`div`,{"data-slot":`compare-columns`,className:h(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,H.jsx)(G,{variant:e,allTerminal:f,pickPending:m.isPending,onPick:()=>s(e)},e.id))}),(0,H.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-2`,children:t.map(e=>(0,H.jsx)(K,{variant:e},e.id))}),(0,H.jsx)(z,{open:o!==null,onOpenChange:e=>!e&&s(null),children:(0,H.jsxs)(L,{children:[(0,H.jsxs)(N,{children:[(0,H.jsxs)(k,{children:[`Pick variant `,o?.variant,`?`]}),(0,H.jsxs)(I,{children:[`Variant `,o?.variant,`'s changes go to the review gate. The other`,` `,t.length-1==1?`variant is`:`${t.length-1} variants are`,` `,`cancelled if still open, archived, and their worktrees and branches removed. There is no undo.`]})]}),(0,H.jsxs)(P,{children:[(0,H.jsx)(M,{children:`Keep comparing`}),(0,H.jsxs)(j,{"data-slot":`confirm-pick`,onClick:()=>{o&&m.mutate(o.id),s(null)},children:[(0,H.jsx)(d,{"aria-hidden":`true`}),`Pick variant `,o?.variant]})]})]})})]})}function G({variant:e,allTerminal:t,pickPending:n,onPick:r}){let i=C(e),a=O(e.costUsd);return(0,H.jsxs)(`article`,{"data-slot":`variant-column`,"data-variant":e.variant,className:`flex min-w-0 flex-col gap-3 rounded-lg border border-border bg-card p-3.5 shadow-xs`,children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsx)(`span`,{"data-slot":`variant-letter`,"aria-label":`Variant ${e.variant}`,className:`inline-flex size-6 shrink-0 items-center justify-center rounded-full bg-violet/15 font-mono text-xs font-semibold text-violet`,children:e.variant}),(0,H.jsx)(R,{dot:i.tone,pulse:i.pulse,children:i.label}),(0,H.jsxs)(`span`,{className:`ml-auto shrink-0 font-mono text-[11px] text-soft-foreground tabular-nums`,children:[w(e.tokensUsed),a?` · ${a}`:``]})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,H.jsx)(`pre`,{"data-slot":`variant-diffstat`,className:`max-h-36 overflow-auto rounded-md bg-muted/60 px-2.5 py-2 font-mono text-[11px] leading-[1.6] whitespace-pre text-muted-foreground`,children:e.diffStat.trimEnd()||`(no changes)`})]}),(0,H.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,H.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,H.jsx)(`div`,{"data-slot":`variant-progress`,className:`max-h-28 min-w-0 overflow-hidden text-[12.5px] text-muted-foreground [mask-image:linear-gradient(to_bottom,black_75%,transparent)]`,children:(0,H.jsx)(B,{children:e.handoffExcerpt})}):(0,H.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,H.jsxs)(s,{"data-slot":`variant-pick`,title:t?`Keep variant ${e.variant}'s changes and archive the others`:`Every variant must finish before you can pick`,disabled:!t||n,onClick:r,children:[(0,H.jsx)(d,{"aria-hidden":`true`}),`Pick this one`]})]})}function K({variant:e}){let[t,n]=(0,V.useState)(!1);return(0,H.jsxs)(v,{open:t,onOpenChange:n,"data-slot":`variant-diff`,"data-variant":e.variant,className:`min-w-0 overflow-hidden rounded-lg border border-border bg-card`,children:[(0,H.jsxs)(_,{className:`flex w-full items-center gap-2 px-3.5 py-2.5 text-left text-[13px] font-medium hover:bg-muted/50`,children:[(0,H.jsx)(A,{className:h(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,H.jsx)(y,{children:(0,H.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,H.jsx)(b,{runId:e.id})})})]})}export{U as CompareVariantsRoute};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-
|
|
2
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{i as r}from"./bundle-mjs-BT31bpU6.js";import{t as i}from"./utils-D27OaPrA.js";import{rt as a}from"./index-
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-CPL3GUgh.js","assets/rolldown-runtime-QTnfLwEv.js","assets/react-runtime-CCIEwYL0.js","assets/utils-D27OaPrA.js","assets/bundle-mjs-BT31bpU6.js","assets/index-DiyQLNs2.js","assets/centered-state-_B4KtyI9.js","assets/search-x-CaddQd7u.js","assets/triangle-alert-BMsU3ymT.js","assets/textarea-Dd8d_Pwi.js","assets/dist-BDertzy3.js","assets/project-router-DHNVGMTs.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/index-CrdG_TLt.css","assets/lib-BQXq3kEf.js","assets/image-preview-B3W7bWIq.js","assets/zoomable-image-BBB-AoPi.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{i as r}from"./bundle-mjs-BT31bpU6.js";import{t as i}from"./utils-D27OaPrA.js";import{rt as a}from"./index-DiyQLNs2.js";import{n as o,t as s}from"./image-preview-B3W7bWIq.js";var c=e(t(),1),l=n();function u(e){let[t,n]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return r(()=>import(`./diff-view-CPL3GUgh.js`).then(t=>{e||n({View:t.DiffView})},()=>{e||n(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:i(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):t===`failed`?(0,l.jsx)(d,{...e}):t===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:i(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(t.View,{...e})}function d({files:e,wrap:t=!1,imageSrc:n,onOpenInApp:r,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:i(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:t,imageSrc:n,onOpenInApp:r},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:t,imageSrc:n,onOpenInApp:r}){return(0,l.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:n,onOpenInApp:r}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:i(`py-2 font-mono text-xs leading-[1.7]`,t?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
|
|
3
3
|
`).map((e,t)=>(0,l.jsxs)(`span`,{className:i(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},t))})]})}export{u as t};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-D27OaPrA.js";import{C as i,S as a,an as o,rt as s,w as c}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{t as r}from"./utils-D27OaPrA.js";import{C as i,S as a,an as o,rt as s,w as c}from"./index-DiyQLNs2.js";import{t as l}from"./lib-BQXq3kEf.js";import{n as u,t as d}from"./image-preview-B3W7bWIq.js";var f=e(t(),1),p=44;function m(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
|
|
2
2
|
`),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t.length:t.length-n}function h(e){return m(e)*20+p}function g(e){return e.reduce((e,t)=>e+m(t),0)}function _(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function v(e){return`${e.oldPath??``}→${e.path}`}function y(e){let t=0;for(let n of e.split(`
|
|
3
3
|
`))n.length>t&&(t=n.length);return t}var b=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,x=300,S=.3;function C(e,t){if(e===t)return null;let n=e.match(b)??[],r=t.match(b)??[];if(n.length===0||r.length===0||n.length>x||r.length>x)return null;let i=r.length+1,a=new Uint16Array((n.length+1)*i);for(let e=1;e<=n.length;e++)for(let t=1;t<=r.length;t++)a[e*i+t]=n[e-1]===r[t-1]?(a[(e-1)*i+(t-1)]??0)+1:Math.max(a[(e-1)*i+t]??0,a[e*i+(t-1)]??0);if((a[n.length*i+r.length]??0)/Math.max(n.length,r.length)<S)return null;let o=Array(n.length).fill(!1),s=Array(r.length).fill(!1),c=n.length,l=r.length;for(;c>0&&l>0;)n[c-1]===r[l-1]?(o[c-1]=!0,s[l-1]=!0,c--,l--):(a[(c-1)*i+l]??0)>=(a[c*i+(l-1)]??0)?c--:l--;return{del:w(n,o),add:w(r,s)}}function w(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function T(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var E=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,D=`… (patch truncated)`;function O(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
|
|
4
4
|
`);o.at(-1)===``&&o.pop();for(let e of o){let o=E.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(D)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function k(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function A(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function j(e,t){let n=Array(e.length),r=Array(t.length),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=C(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function M(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(j(t,i))}else t(i),r++}}function N(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),M(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function P(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),M(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var F=n(),I=1500,L=new Map;function R(e,t){if(e){for(let n of e.querySelectorAll(`[data-slot="diff-file"]`))if(n.dataset.path===t)return n}}function z({files:e,mode:t=`unified`,wrap:n=!1,loadFileText:i,imageSrc:a,onOpenInApp:o,viewRef:c,className:l}){let u=(0,f.useMemo)(()=>({adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length}),[e]),[d,p]=(0,f.useState)(()=>new Set),[m,y]=(0,f.useState)(()=>new Map),b=(0,f.useCallback)(e=>{p(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})},[]),x=(0,f.useCallback)(async(e,t)=>{if(!i)return;let n=await i(e.path);if(n===null)return;let r=A(t,n.split(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./centered-state-_B4KtyI9.js";import{n as i,r as a,t as o}from"./utils-D27OaPrA.js";import{t as s}from"./ellipsis-vertical-WowqAN6-.js";import{n as c}from"./tab-link-D6mbZhQc.js";import{t as l}from"./file-BWgi5VOt.js";import{i as u,n as d,r as f}from"./use-desktop-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{a as r}from"./centered-state-_B4KtyI9.js";import{n as i,r as a,t as o}from"./utils-D27OaPrA.js";import{t as s}from"./ellipsis-vertical-WowqAN6-.js";import{n as c}from"./tab-link-D6mbZhQc.js";import{t as l}from"./file-BWgi5VOt.js";import{i as u,n as d,r as f}from"./use-desktop-DpM2CSDg.js";import{t as p}from"./git-pull-request-D8yt-2Tr.js";import{t as m}from"./square-terminal-CoE5Kj-S.js";import{t as h}from"./upload-DH2pWIfO.js";import{an as g,dt as _,lt as v,mt as y,nn as b,rt as x,ut as S}from"./index-DiyQLNs2.js";var C=a(`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`}]]),w=e(t(),1),T=n();function E({root:e,selected:t,onSelect:n}){return(0,T.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function D({adds:e,dels:t}){return(0,T.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,T.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function O({dir:e,depth:t,selected:n,onSelect:r}){let[i,a]=(0,w.useState)(!0);return(0,T.jsxs)(`li`,{children:[(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":i?`open`:`closed`,"aria-expanded":i,onClick:()=>a(e=>!e),className:`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,T.jsx)(g,{"aria-hidden":`true`,className:o(`size-3.5 shrink-0 transition-transform`,i&&`rotate-90`)}),(0,T.jsx)(b,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]}),i?(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:t+1,selected:n,onSelect:r},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:r},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:r}){let i=n===e.path;return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":i?`true`:void 0,onClick:()=>r(e.path),className:o(`flex w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,i?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,T.jsx)(l,{"aria-hidden":`true`,className:o(`size-3.5 shrink-0`,k[e.status])}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]})})}function j(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function M(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(M)}}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=j(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=j(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(N),e.files.sort(N)};return i(t),{...t,dirs:t.dirs.map(M)}}function F({bar:e,branch:t,stat:n,mode:i,wrap:a,onModeChange:o,onWrapChange:c,onAction:l}){return(0,T.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:[t?(0,T.jsx)(d,{branch:t}):null,n?(0,T.jsx)(R,{stat:n}):null,(0,T.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(f,{mode:i,wrap:a,onModeChange:o,onWrapChange:c})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:l},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:l}),e.menu.length>0?(0,T.jsxs)(v,{children:[(0,T.jsx)(y,{asChild:!0,children:(0,T.jsx)(r,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(s,{"aria-hidden":`true`})})}),(0,T.jsx)(S,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(_,{disabled:!e.enabled,title:e.reason,onSelect:()=>l(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(u,{"aria-hidden":`true`}),push:(0,T.jsx)(h,{"aria-hidden":`true`}),"create-pr":(0,T.jsx)(p,{"aria-hidden":`true`}),"view-pr":(0,T.jsx)(c,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(m,{"aria-hidden":`true`})};function L({action:e,variant:t,onAction:n}){return e.id===`view-pr`?i(e.href)?(0,T.jsx)(r,{asChild:!0,variant:t,size:`sm`,"data-action":e.id,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[I[e.id],e.label]})}):(0,T.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[I[e.id],e.label]}):(0,T.jsxs)(r,{variant:t,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>n(e.id),children:[I[e.id],e.label]})}function R({stat:e}){return(0,T.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,T.jsx)(x,{stat:{adds:z(e.adds),dels:z(e.dels),files:e.files}})})}function z(e){let[t,n]=(0,w.useState)(e),r=(0,w.useRef)(e);return(0,w.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}export{C as a,E as i,F as n,P as r,R 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{A as r,B as i,Bn as a,Gt as o,Ht as s,It as c,Jt as l,L as u,Mn as d,O as f,Pn as p,R as m,Ut as h,Wt as g,a as _,gt as v,i as y,in as ee,jn as b,k as x,kn as S,t as C,xt as w,yt as te,z as T}from"./centered-state-_B4KtyI9.js";import{n as E,r as D,t as O}from"./utils-D27OaPrA.js";import{t as k}from"./arrow-left-BWue3Imk.js";import{t as A}from"./circle-check-TKq6_8_Y.js";import{t as j}from"./circle-x-bH39f-Yh.js";import{n as M,t as N}from"./tab-link-D6mbZhQc.js";import{t as P}from"./git-pull-request-D8yt-2Tr.js";import{t as ne}from"./refresh-cw-CFp_jUZr.js";import{t as re}from"./triangle-alert-BMsU3ymT.js";import{n as F,t as ie}from"./textarea-Dd8d_Pwi.js";import{r as ae,t as I}from"./project-router-DHNVGMTs.js";import{A as L,Bt as oe,Ct as se,D as ce,E as le,Et as ue,F as R,Ft as z,Gt as B,H as de,Ht as V,It as H,J as fe,Jt as pe,Kt as U,L as me,M as W,Mt as G,N as K,Nt as q,O as he,P as ge,Pt as _e,Qt as ve,R as ye,Rt as be,St as xe,Tt as Se,Ut as Ce,Vt as we,Wt as Te,Yt as Ee,an as De,bt as Oe,in as ke,j as Ae,jt as je,k as Me,kt as J,on as Ne,qt as Pe,rn as Fe,vt as Ie,wt as Le,x as Re,y as ze,z as Be}from"./index-dVJvf20I.js";import{t as Ve}from"./diff-B1TroQje.js";var He=D(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ue=D(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),We=D(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ge=D(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Y=e(t(),1),X=n();function Z({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:O(`animate-pulse rounded-md bg-accent`,e),...t})}function Ke(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function qe(e,t=[]){let n=Ke(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Je(t)),n}function Je(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Ye(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function Xe(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Ze(e,t,n){let r=(n??``).trim();if(!r)return qe(e,t);let i=Ke(e),a=r.startsWith(i)?i+Ye(r.slice(i.length),e):Ye(r,e),o=Xe(a,e)?a:`${i}\n\n${a}`;return t.length?o+Je(t):o}function Qe(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function $e(e,t,n,r,i={}){return t?{...i,workflow:t,task:Ze(e,n,r)}:n.length?{...i,steps:Qe(n),task:Ze(e,[],r)}:{...i,workflow:`quick-task`,task:Ze(e,[],r)}}function et(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function tt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function nt(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var rt={workflow:null,skills:[]},it=`cez-followup-selection`;function at(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function ot(){try{let e=localStorage.getItem(it);return e?at(JSON.parse(e)):{...rt}}catch{return{...rt}}}function st(e){try{localStorage.setItem(it,JSON.stringify(e))}catch{}}var ct=`cez-followup-prompt:`;function lt(e){try{return localStorage.getItem(ct+e)??``}catch{return``}}function ut(e,t){try{t===``?localStorage.removeItem(ct+e):localStorage.setItem(ct+e,t)}catch{}}function dt({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:u,queuedRunId:d,onQueued:f}){let m=p(),h=te(),g=e.kind===`pr`?`PR`:`issue`,v=o.filter(e=>n.some(t=>t.name===e)),[S]=(0,Y.useState)(()=>Ke(e)),[C,w]=(0,Y.useState)(()=>lt(e.url)||S),T=Be(l),E=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{ut(e.url,C===S?``:C)},[e.url,C,S]);let D=(0,Y.useMemo)(()=>L(h.data?.promptTemplates),[h.data?.promptTemplates]),O=e=>{let t=E.current,n=C===S?C.length:t?.selectionStart??C.length,r=Me(C,n,e);w(r.text),requestAnimationFrame(()=>{E.current?.focus(),E.current?.setSelectionRange(r.caret,r.caret)})},k=he(D,v),A=(0,Y.useRef)(C);A.current=C;let j=(0,Y.useRef)(``);(0,Y.useEffect)(()=>{let e=Ae(A.current,j.current,k,S);j.current=e.applied,e.text!==A.current&&w(e.text)},[k,S]);let M=b({mutationFn:async()=>T.canRun?c($e(e,i,v,C,ye(T))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&f(e.url,n.id),y(`Added to the queue — ${g} #${e.number}`),v.length>0&&h.data!==void 0&&ee({skillUsage:v.reduce((e,t)=>Ie(e,t),h.data.skillUsage)}).then(()=>m.invalidateQueries({queryKey:r.uiState})).catch(()=>{}),ut(e.url,``),w(S),j.current=``,m.invalidateQueries({queryKey:r.runs.all})},onError:e=>y(e.message,{tone:`danger`})}),N=e=>{le({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(),!M.isPending&&T.canRun&&M.mutate())},P=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,X.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,X.jsx)(U,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(ft,{workflows:t,value:i,onChange:a}),(0,X.jsx)(pt,{skills:n,skillUsage:h.data?.skillUsage,selected:v,onToggle:P}),(0,X.jsx)(me,{pick:l,onChange:u,disabled:M.isPending||!T.canRun}),!T.providerPending&&!T.canRun?(0,X.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[T.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,X.jsx)(I,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,(0,X.jsx)(W,{templates:D,onInsert:O})]}),v.length>0?(0,X.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:v.map(e=>(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>P(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,X.jsx)(F,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,X.jsx)(ie,{ref:E,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:C,onChange:e=>w(e.target.value),onKeyDown:N,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,X.jsxs)(_,{variant:`contrast`,"data-action":`gh-run`,disabled:M.isPending||!T.canRun,onClick:()=>M.mutate(),children:[(0,X.jsx)(ve,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,g]}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:ce()}),d?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,X.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,X.jsx)(I,{to:`/tasks/${d}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}function ft({workflows:e,value:t,onChange:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),s=(0,Y.useRef)(null),c=Se(e,a);return(0,X.jsxs)(K,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:O(de,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,X.jsx)(Pe,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,X.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,X.jsx)(Ne,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(ge,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(je,{shouldFilter:!1,children:[(0,X.jsx)(_e,{placeholder:`search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,X.jsxs)(H,{ref:s,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,X.jsx)(G,{children:`Nothing matches.`}):null,(0,X.jsx)(q,{children:c.map(e=>{let r=t===e.name;return(0,X.jsxs)(z,{value:`workflow ${e.name}`,keywords:ue(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,X.jsx)(x,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function pt({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(null),{mostUsed:d,project:f,global:p}=se(Le(e,o,t),t),m=(e,t)=>{let i=n.includes(e.name);return(0,X.jsxs)(z,{value:`skill ${e.name} ${e.path}`,keywords:ue(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>r(e.name),children:[(0,X.jsx)(`span`,{className:O(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,X.jsx)(Fe,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,X.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ze,{skill:c,onClose:()=>l(null)}),(0,X.jsxs)(K,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:O(de,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(pe,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,X.jsx)(Ne,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(ge,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(je,{shouldFilter:!1,children:[(0,X.jsx)(_e,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,X.jsxs)(H,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[d.length===0&&f.length===0&&p.length===0?(0,X.jsx)(G,{children:`Nothing matches.`}):null,d.length>0?(0,X.jsx)(q,{heading:`Most used`,children:d.map(e=>m(e,Oe(e)))}):null,f.length>0?(0,X.jsx)(q,{heading:`Project skills`,children:f.map(e=>m(e,!0))}):null,p.length>0?(0,X.jsx)(q,{heading:`Global`,children:p.map(e=>m(e,!1))}):null]})]})})]})]})}var Q=1e3,mt=100;function ht(){return te().data?.githubView===`prs`?(0,X.jsx)(ae,{to:`/github/prs`,replace:!0}):(0,X.jsx)(gt,{view:`issues`})}function gt({view:e,changes:t=!1}){let{n}=S(),i=u({limit:Q}),o=i.data,c=n===void 0?null:Number.parseInt(n,10),l=(0,Y.useMemo)(()=>{if(!o?.available)return[];let t=new Set;e===`prs`&&c!==null&&Number.isInteger(c)&&t.add(c);for(let e of o.prs){if(t.size>=mt)break;t.add(e.number)}return[...t]},[o,e,c]),d=m(l,e===`prs`),f=d.data?.available?d.data.checks:void 0,g=p(),x=e=>{g.setQueryData(r.uiState,t=>({...t,githubView:e})),ee({githubView:e}).then(e=>g.setQueryData(r.uiState,e)).catch(e=>{y(e instanceof Error?e.message:String(e),{tone:`danger`}),g.invalidateQueries({queryKey:r.uiState})})},T=(0,Y.useRef)(null),E=b({mutationFn:()=>s({refresh:!0,limit:Q}),onSuccess:e=>{g.setQueryData(r.github({limit:Q}),e),g.invalidateQueries({queryKey:r.githubChecks(l)});let t=T.current;if(!t){g.removeQueries({queryKey:[`github`,`comments`]});return}let n=r.githubComments(t.kind,t.number);h(t.kind,t.number,{refresh:!0}).then(e=>g.setQueryData(n,e)).catch(()=>{}),g.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==a(n)})},onError:e=>y(e.message,{tone:`danger`})}),D=w(),k=v(),A=te(),[j,M]=(0,Y.useState)(()=>ot().workflow),[F,ie]=(0,Y.useState)(()=>ot().skills),[ae,I]=(0,Y.useState)({runner:null,model:null});(0,Y.useEffect)(()=>{st({workflow:j,skills:[...F]})},[j,F]);let L=D.data?.workflows;(0,Y.useEffect)(()=>{L&&j!==null&&!L.some(e=>e.name===j)&&M(null)},[L,j]);let oe=k.data,se=A.data?.skillUsage,ce=(0,Y.useMemo)(()=>xe(oe??[],se),[oe,se]),[le,ue]=(0,Y.useState)(new Map),[R,z]=(0,Y.useState)(``),[B,de]=(0,Y.useState)([]);if(!o)return i.isError?(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(C,{icon:(0,X.jsx)(re,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:i.error.message})}):(0,X.jsx)(fe,{});if(T.current=null,!o.available)return(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(C,{icon:(0,X.jsx)(be,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:o.reason??`unknown reason`,actions:(0,X.jsx)(_,{variant:`outline`,"data-action":`gh-retry`,disabled:E.isPending,onClick:()=>E.mutate(),children:`Try again`}),children:(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let V=e===`issues`?o.issues:o.prs,H=o.labelColors??{},pe=et(V),U=tt(V,{query:R,labels:B}),me=R.trim()!==``||B.length>0,W=n===void 0?null:Number.parseInt(n,10),G=W===null?U[0]??null:V.find(e=>e.number===W)??null;T.current=G?{kind:G.kind,number:G.number}:null;let K=e===`issues`?`/github`:`/github/prs`;return(0,X.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,X.jsxs)(`section`,{"data-slot":`gh-list`,className:O(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,n===void 0?`flex`:`hidden`),children:[(0,X.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,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),o.repo?(0,X.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:o.repo}):null,(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:E.isPending,onClick:()=>E.mutate(),className:`ml-auto flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:O(`size-[9px]`,E.isPending&&`motion-safe:animate-spin`)}),o.syncedAt?`synced ${J(o.syncedAt)} ago`:`refresh`]})]}),(0,X.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,X.jsxs)(N,{to:`/github`,active:e===`issues`,onClick:()=>x(`issues`),children:[`Issues · `,_t(o.issues.length)]}),(0,X.jsxs)(N,{to:`/github/prs`,active:e===`prs`,onClick:()=>x(`prs`),children:[`Pull requests · `,_t(o.prs.length)]})]}),(0,X.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,X.jsx)(Ee,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,X.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:R,onChange:e=>z(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,X.jsx)(yt,{options:pe,colors:H,selected:B,onChange:de})]})]}),U.length===0?(0,X.jsx)(`p`,{className:`px-4 py-4 text-sm text-soft-foreground`,children:me?`No ${e===`issues`?`issues`:`pull requests`} match your filter.`:`No open ${e===`issues`?`issues`:`pull requests`}.`}):(0,X.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:U.map(t=>(0,X.jsx)(vt,{item:t,view:e,colors:H,active:G?.url===t.url,queued:le.has(t.url),checks:t.kind===`pr`?f?.[t.number]??t.checks:t.checks},t.url))})]}),(0,X.jsx)(`section`,{"data-slot":`gh-detail`,className:O(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,n===void 0?`hidden md:flex`:`flex`),children:G?(0,X.jsx)(xt,{item:G,listPath:K,colors:H,changes:t,checks:G.kind===`pr`?f?.[G.number]??G.checks:G.checks,children:(0,X.jsx)(dt,{item:G,workflows:D.data?.workflows??[],skills:ce,workflow:j,onWorkflowChange:M,selectedSkills:F,onSkillsChange:ie,engine:ae,onEngineChange:I,queuedRunId:le.get(G.url)??null,onQueued:(e,t)=>ue(n=>new Map(n).set(e,t))},G.url)}):(0,X.jsx)(C,{icon:e===`issues`?(0,X.jsx)(Ue,{}):(0,X.jsx)(P,{}),tone:`neutral`,heading:`h2`,title:W===null?`Nothing selected`:`Not in the open list`,subtitle:W===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${W} is not among the open ${e===`issues`?`issues`:`pull requests`} — it may be closed, or still outside the fetched batch.`})})]})}function _t(e){return`${e}${e>=Q?`+`:``}`}function vt({item:e,view:t,colors:n,active:i,queued:a,checks:o}){let s=e.kind===`issue`?Ue:P,c=p(),l=()=>{c.prefetchQuery({queryKey:r.githubComments(e.kind,e.number),queryFn:({signal:t})=>h(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,X.jsx)(`li`,{children:(0,X.jsxs)(I,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,qe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:l,onFocus:l,"data-slot":`gh-row`,"data-number":e.number,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:O(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,i&&`bg-muted`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(s,{"aria-hidden":`true`,className:O(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,X.jsx)(`span`,{className:O(`min-w-0 truncate text-[13px] font-medium`,i&&`font-semibold`),children:e.title})]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,X.jsxs)(`span`,{children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,X.jsx)(`span`,{children:J(e.createdAt)}),(0,X.jsx)(Rt,{count:e.comments}),o?(0,X.jsx)(Bt,{checks:o}):null,a?(0,X.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,X.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,X.jsx)(bt,{label:e,color:n[e]},e))}):null]})})}function yt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,Y.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,X.jsxs)(K,{open:i,onOpenChange:a,children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.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-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,X.jsx)(Ge,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,X.jsx)(ge,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(je,{children:[(0,X.jsx)(_e,{placeholder:`Filter labels…`}),(0,X.jsxs)(H,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(G,{children:`No labels.`}),n.length>0?(0,X.jsxs)(z,{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,X.jsxs)(z,{value:e,onSelect:()=>o(e),children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:nt(t[e])}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,X.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function bt({label:e,color:t}){return(0,X.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:nt(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function xt({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,X.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,X.jsxs)(I,{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,X.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,X.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,X.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,X.jsx)(`span`,{children:o}),`·`,(0,X.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,X.jsxs)(`span`,{children:[J(e.createdAt),` ago`]}),e.comments?(0,X.jsxs)(X.Fragment,{children:[`·`,(0,X.jsx)(Rt,{count:e.comments})]}):null,s?(0,X.jsxs)(X.Fragment,{children:[`·`,(0,X.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,E(e.url)?(0,X.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,X.jsx)(M,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,X.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,X.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.kind===`pr`?(0,X.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,X.jsx)(N,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,X.jsx)(N,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,X.jsx)(bt,{label:e,color:n[e]},e)),a?(0,X.jsx)(zt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,X.jsx)(wt,{item:e}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,X.jsx)(Re,{children:e.body}):(0,X.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,X.jsx)(Tt,{item:e,colors:n}),e.kind===`pr`?(0,X.jsx)(Ct,{number:e.number}):null,r]})]})}var $={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function St({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,X.jsx)(A,{"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:O(t,`text-success`)}):e===`failing`?(0,X.jsx)(j,{"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:O(t,`text-danger`)}):e===`pending`?(0,X.jsx)(f,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:O(t,`animate-spin text-warning`)}):(0,X.jsx)(ke,{"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:O(t,`text-soft-foreground`)})}function Ct({number:e}){let t=p(),n=d({queryKey:r.githubMergeState(e),queryFn:({signal:t})=>o(e,{},{signal:t}),retry:!1}),i=n.data?.available?n.data.mergeState:null,[a,s]=(0,Y.useState)(null),[c,u]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)(!1),h=b({mutationFn:()=>o(e,{refresh:!0}),onSuccess:n=>t.setQueryData(r.githubMergeState(e),n),onError:e=>y(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=a&&i?.methods.includes(a)?a:i?.defaultMethod??i?.methods[0]??null,v=b({mutationFn:()=>{if(!i||!g)throw Error(`No merge method is available.`);return l(e,{method:g,expectedHeadSha:i.headSha,...f&&i.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{u(!1),y(`Pull request #${e} merged`),t.invalidateQueries({queryKey:r.githubMergeState(e)}),t.invalidateQueries({queryKey:r.github({limit:Q})}),t.invalidateQueries({queryKey:r.githubComments(`pr`,e)})},onError:n=>{y(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:r.githubMergeState(e)})}});if(n.isPending)return(0,X.jsx)(Z,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!i)return(0,X.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,X.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 ee=i.state===`merged`?`Merged`:i.state===`closed`?`Closed`:i.isDraft?`Draft`:i.mergeable===`conflicting`?`Conflicts must be resolved`:i.canMerge?`Ready to merge`:`Merge blocked`,S=i.reviewDecision===`approved`?`passing`:i.reviewDecision===`unknown`?`unknown`:`failing`,C=i.mergeable===`mergeable`?`passing`:i.mergeable===`conflicting`?`failing`:`unknown`,w=!!(g&&(i.canMerge||i.canOverride&&f));return(0,X.jsxs)(`section`,{"data-slot":`gh-merge-box`,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i.canMerge?(0,X.jsx)(x,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,X.jsx)(re,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold`,children:ee}),(0,X.jsxs)(_,{type:`button`,variant:`ghost`,size:`sm`,disabled:h.isPending,onClick:()=>h.mutate(),children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:O(`size-3.5`,h.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,X.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[i.headRef,` (`,i.headSha.slice(0,7),`) → `,i.baseRef]}),(0,X.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(St,{state:S}),(0,X.jsxs)(`span`,{children:[`Reviews: `,i.reviewDecision.replaceAll(`-`,` `)]})]}),(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(St,{state:C}),(0,X.jsxs)(`span`,{children:[`Conflicts: `,i.mergeable===`conflicting`?`present`:i.mergeable===`mergeable`?`none`:`unknown`]})]}),i.checks.length===0?(0,X.jsx)(`li`,{children:`No checks configured`}):i.checks.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(St,{state:e.state}),(0,X.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&E(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),i.blockers.map(e=>(0,X.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),i.canOverride?(0,X.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,X.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,i.state===`open`&&i.methods.length>0?(0,X.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,X.jsx)(`select`,{"aria-label":`Merge method`,value:g??``,onChange:e=>s(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:i.methods.map(e=>(0,X.jsx)(`option`,{value:e,children:$[e]},e))}),(0,X.jsx)(_,{disabled:!w,onClick:()=>u(!0),children:g?$[g]:`Merge`})]}):null]})]}),(0,X.jsx)(oe,{open:c,onOpenChange:u,children:(0,X.jsxs)(we,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,X.jsxs)(Te,{children:[(0,X.jsxs)(B,{children:[g?$[g]:`Merge`,` pull request #`,e,`?`]}),(0,X.jsxs)(V,{children:[`This will merge “`,i.title,`” into `,i.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`,f&&i.canOverride?` You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`:``]})]}),v.error?(0,X.jsx)(`p`,{className:`text-sm text-danger`,children:v.error.message}):null,(0,X.jsxs)(Ce,{children:[(0,X.jsx)(_,{variant:`outline`,disabled:v.isPending,onClick:()=>u(!1),children:`Cancel`}),(0,X.jsx)(_,{disabled:v.isPending,onClick:()=>v.mutate(),children:v.isPending?`Merging…`:g?$[g]:`Merge`})]})]})})]})}function wt({item:e}){let t=p(),n=i(e.number),[r,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(null),c=n.data,l=c?.available?c.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],u=l.findIndex(e=>e.path===o);(0,Y.useEffect)(()=>{l.length>0&&!l.some(e=>e.path===o)&&s(l[0].path)},[c?.available?c.headSha:``,r]);let d=async()=>{let n=c?.available?c.headSha:null,r=await g(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(s(r.files[0]?.path??null),y(`The reviewed revision changed.`))};if(n.isPending)return(0,X.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!c)return(0,X.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!c.available)return(0,X.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:c.reason});let f=l.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),m=E(e.url)?`${e.url}/files`:null,h=l.find(e=>e.path===o);return(0,X.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,X.jsxs)(`strong`,{children:[c.files.length,` changed files`]}),(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,c.additions]}),(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,c.deletions]}),(0,X.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:c.headSha,children:[`head `,c.headSha.slice(0,8)]}),(0,X.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void d(),children:`Refresh`})]}),c.truncated?(0,X.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[c.reason??`This response is incomplete.`,` `,m?(0,X.jsx)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,X.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,X.jsxs)(`aside`,{className:`min-w-0`,children:[(0,X.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>a(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,X.jsx)(`select`,{"aria-label":`Select changed file`,value:o??``,onChange:e=>s(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:l.map(e=>(0,X.jsx)(`option`,{children:e.path},e.path))}),(0,X.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(e.path),className:O(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,o===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,X.jsx)(_,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<=0,onClick:()=>s(l[u-1]?.path??null),children:(0,X.jsx)(He,{})}),(0,X.jsx)(_,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<0||u>=l.length-1,onClick:()=>s(l[u+1]?.path??null),children:(0,X.jsx)(De,{})})]}),l.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ve,{files:f.filter(e=>e.path===o),wrap:!0,className:`min-w-0`}),h&&!h.patch?(0,X.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,h.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Tt({item:e,colors:t}){let n=T(e.kind,e.number),r=n.data,i=(0,Y.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(Et(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,X.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,X.jsx)(Z,{className:`mb-3 h-3 w-24`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(Z,{className:`h-14 w-full`}),(0,X.jsx)(Z,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,X.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,X.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,X.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,X.jsx)(M,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,X.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,X.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Dt(i).map(e=>e.group===`commits`?(0,X.jsx)(Ot,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,X.jsx)(Pt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,X.jsx)(At,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,X.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,X.jsx)(M,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Et=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Dt(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 Ot({commits:e,colors:t}){let[n,r]=(0,Y.useState)(!1),i=e[0]?.actor??`?`;return n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:kt.committed}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,X.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,X.jsx)(At,{event:e,colors:t},e.id))]}):(0,X.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:kt.committed}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,X.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,X.jsx)(`span`,{className:`shrink-0`,children:J(e[e.length-1].createdAt)})]})})}var kt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function At({event:e,colors:t}){return(0,X.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-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:kt[e.kind]}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,X.jsx)(jt,{event:e,colors:t}),(0,X.jsx)(`span`,{className:`shrink-0`,children:J(e.createdAt)}),e.url?(0,X.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,X.jsx)(M,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function jt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,X.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,X.jsx)(Mt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,X.jsx)(`span`,{"data-slot":`gh-event-label`,style:nt(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,X.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,X.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,X.jsx)(`span`,{children:`merged this`});case`closed`:return(0,X.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,X.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,X.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,X.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,X.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Mt({checks:e}){return e?(0,X.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:O(`shrink-0`,Lt[e]),children:It[e]}):null}var Nt={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 Pt({comment:e}){let t=e.reviewState?Nt[e.reviewState]:null;return(0,X.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,X.jsx)(Ft,{url:e.avatarUrl,login:e.author}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,X.jsx)(`span`,{children:J(e.createdAt)}),t?(0,X.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-[10px] font-medium`,t.tone),children:t.label}):null,(0,X.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,X.jsx)(M,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,X.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,X.jsx)(Re,{children:e.body}):(0,X.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Ft({url:e,login:t}){let[n,r]=(0,Y.useState)(!1);return e&&!n?(0,X.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,X.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 It={passing:`✓`,failing:`✗`,pending:`○`},Lt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Rt({count:e}){return e?(0,X.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,X.jsx)(We,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function zt({checks:e,url:t}){let n=O(`text-[11px] font-medium`,Lt[e],t&&`hover:underline`),r=`${It[e]} checks ${e}`;return t?(0,X.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,X.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Bt({checks:e}){return(0,X.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:O(`shrink-0 font-sans text-[11px] font-semibold`,Lt[e]),children:It[e]})}export{ht as GithubIndexRoute,gt as GithubRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{A as r,B as i,Bn as a,Gt as o,Ht as s,It as c,Jt as l,L as u,Mn as d,O as f,Pn as p,R as m,Ut as h,Wt as g,a as _,gt as v,i as y,in as ee,jn as b,k as x,kn as S,t as C,xt as w,yt as te,z as T}from"./centered-state-_B4KtyI9.js";import{n as E,r as D,t as O}from"./utils-D27OaPrA.js";import{t as k}from"./arrow-left-BWue3Imk.js";import{t as A}from"./circle-check-TKq6_8_Y.js";import{t as j}from"./circle-x-bH39f-Yh.js";import{n as M,t as N}from"./tab-link-D6mbZhQc.js";import{t as P}from"./git-pull-request-D8yt-2Tr.js";import{t as ne}from"./refresh-cw-CFp_jUZr.js";import{t as re}from"./triangle-alert-BMsU3ymT.js";import{n as F,t as ie}from"./textarea-Dd8d_Pwi.js";import{r as ae,t as I}from"./project-router-DHNVGMTs.js";import{A as L,Bt as oe,Ct as se,D as ce,E as le,Et as ue,F as R,Ft as z,Gt as B,H as de,Ht as V,It as H,J as fe,Jt as pe,Kt as U,L as me,M as W,Mt as G,N as K,Nt as q,O as he,P as ge,Pt as _e,Qt as ve,R as ye,Rt as be,St as xe,Tt as Se,Ut as Ce,Vt as we,Wt as Te,Yt as Ee,an as De,bt as Oe,in as ke,j as Ae,jt as je,k as Me,kt as J,on as Ne,qt as Pe,rn as Fe,vt as Ie,wt as Le,x as Re,y as ze,z as Be}from"./index-DiyQLNs2.js";import{t as Ve}from"./diff-CNt01FyY.js";var He=D(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ue=D(`circle-dot`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}]]),We=D(`message-square`,[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}]]),Ge=D(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),Y=e(t(),1),X=n();function Z({className:e,...t}){return(0,X.jsx)(`div`,{"data-slot":`skeleton`,className:O(`animate-pulse rounded-md bg-accent`,e),...t})}function Ke(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function qe(e,t=[]){let n=Ke(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=Je(t)),n}function Je(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function Ye(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function Xe(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function Ze(e,t,n){let r=(n??``).trim();if(!r)return qe(e,t);let i=Ke(e),a=r.startsWith(i)?i+Ye(r.slice(i.length),e):Ye(r,e),o=Xe(a,e)?a:`${i}\n\n${a}`;return t.length?o+Je(t):o}function Qe(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function $e(e,t,n,r,i={}){return t?{...i,workflow:t,task:Ze(e,n,r)}:n.length?{...i,steps:Qe(n),task:Ze(e,[],r)}:{...i,workflow:`quick-task`,task:Ze(e,[],r)}}function et(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function tt(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function nt(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var rt={workflow:null,skills:[]},it=`cez-followup-selection`;function at(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function ot(){try{let e=localStorage.getItem(it);return e?at(JSON.parse(e)):{...rt}}catch{return{...rt}}}function st(e){try{localStorage.setItem(it,JSON.stringify(e))}catch{}}var ct=`cez-followup-prompt:`;function lt(e){try{return localStorage.getItem(ct+e)??``}catch{return``}}function ut(e,t){try{t===``?localStorage.removeItem(ct+e):localStorage.setItem(ct+e,t)}catch{}}function dt({item:e,workflows:t,skills:n,workflow:i,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:u,queuedRunId:d,onQueued:f}){let m=p(),h=te(),g=e.kind===`pr`?`PR`:`issue`,v=o.filter(e=>n.some(t=>t.name===e)),[S]=(0,Y.useState)(()=>Ke(e)),[C,w]=(0,Y.useState)(()=>lt(e.url)||S),T=Be(l),E=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{ut(e.url,C===S?``:C)},[e.url,C,S]);let D=(0,Y.useMemo)(()=>L(h.data?.promptTemplates),[h.data?.promptTemplates]),O=e=>{let t=E.current,n=C===S?C.length:t?.selectionStart??C.length,r=Me(C,n,e);w(r.text),requestAnimationFrame(()=>{E.current?.focus(),E.current?.setSelectionRange(r.caret,r.caret)})},k=he(D,v),A=(0,Y.useRef)(C);A.current=C;let j=(0,Y.useRef)(``);(0,Y.useEffect)(()=>{let e=Ae(A.current,j.current,k,S);j.current=e.applied,e.text!==A.current&&w(e.text)},[k,S]);let M=b({mutationFn:async()=>T.canRun?c($e(e,i,v,C,ye(T))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&f(e.url,n.id),y(`Added to the queue — ${g} #${e.number}`),v.length>0&&h.data!==void 0&&ee({skillUsage:v.reduce((e,t)=>Ie(e,t),h.data.skillUsage)}).then(()=>m.invalidateQueries({queryKey:r.uiState})).catch(()=>{}),ut(e.url,``),w(S),j.current=``,m.invalidateQueries({queryKey:r.runs.all})},onError:e=>y(e.message,{tone:`danger`})}),N=e=>{le({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(),!M.isPending&&T.canRun&&M.mutate())},P=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,X.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,X.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-[11px] font-semibold tracking-[.04em] text-soft-foreground uppercase`,children:[(0,X.jsx)(U,{"aria-hidden":`true`,className:`size-3.5 text-violet`}),`Hand this to the agent`]}),(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(ft,{workflows:t,value:i,onChange:a}),(0,X.jsx)(pt,{skills:n,skillUsage:h.data?.skillUsage,selected:v,onToggle:P}),(0,X.jsx)(me,{pick:l,onChange:u,disabled:M.isPending||!T.canRun}),!T.providerPending&&!T.canRun?(0,X.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[T.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,X.jsx)(I,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null,(0,X.jsx)(W,{templates:D,onInsert:O})]}),v.length>0?(0,X.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:v.map(e=>(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>P(e),title:`Remove this skill`,className:`inline-flex items-center gap-1 rounded-full border border-border bg-muted px-2 py-px font-mono text-[11px] font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,X.jsx)(F,{"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,X.jsx)(ie,{ref:E,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:C,onChange:e=>w(e.target.value),onKeyDown:N,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`}),(0,X.jsxs)(`div`,{className:`mt-4 flex flex-wrap items-center gap-2.5`,children:[(0,X.jsxs)(_,{variant:`contrast`,"data-action":`gh-run`,disabled:M.isPending||!T.canRun,onClick:()=>M.mutate(),children:[(0,X.jsx)(ve,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,g]}),(0,X.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:ce()}),d?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,X.jsx)(x,{"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,X.jsx)(I,{to:`/tasks/${d}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-violet hover:underline`,children:`View task →`})]}):null]})]})}function ft({workflows:e,value:t,onChange:n}){let[r,i]=(0,Y.useState)(!1),[a,o]=(0,Y.useState)(``),s=(0,Y.useRef)(null),c=Se(e,a);return(0,X.jsxs)(K,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:O(de,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,X.jsx)(Pe,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),(0,X.jsx)(`span`,{className:`max-w-44 truncate`,children:t??`workflow`}),(0,X.jsx)(Ne,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(ge,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(je,{shouldFilter:!1,children:[(0,X.jsx)(_e,{placeholder:`search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,X.jsxs)(H,{ref:s,"data-slot":`gh-workflow-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[c.length===0?(0,X.jsx)(G,{children:`Nothing matches.`}):null,(0,X.jsx)(q,{children:c.map(e=>{let r=t===e.name;return(0,X.jsxs)(z,{value:`workflow ${e.name}`,keywords:ue(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,X.jsx)(x,{"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-primary`}):null]},e.name)})})]})]})})]})}function pt({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(``),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(null),{mostUsed:d,project:f,global:p}=se(Le(e,o,t),t),m=(e,t)=>{let i=n.includes(e.name);return(0,X.jsxs)(z,{value:`skill ${e.name} ${e.path}`,keywords:ue(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>r(e.name),children:[(0,X.jsx)(`span`,{className:O(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,X.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),l(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,X.jsx)(Fe,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,X.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e.path)};return e.length===0?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ze,{skill:c,onClose:()=>l(null)}),(0,X.jsxs)(K,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:O(de,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,X.jsx)(pe,{"aria-hidden":`true`,className:`size-3 shrink-0 text-violet`}),`skills`,n.length>0?` · ${n.length}`:``,(0,X.jsx)(Ne,{"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,X.jsx)(ge,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,X.jsxs)(je,{shouldFilter:!1,children:[(0,X.jsx)(_e,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>u.current?.scrollTo(0,0)}),(0,X.jsxs)(H,{ref:u,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[d.length===0&&f.length===0&&p.length===0?(0,X.jsx)(G,{children:`Nothing matches.`}):null,d.length>0?(0,X.jsx)(q,{heading:`Most used`,children:d.map(e=>m(e,Oe(e)))}):null,f.length>0?(0,X.jsx)(q,{heading:`Project skills`,children:f.map(e=>m(e,!0))}):null,p.length>0?(0,X.jsx)(q,{heading:`Global`,children:p.map(e=>m(e,!1))}):null]})]})})]})]})}var Q=1e3,mt=100;function ht(){return te().data?.githubView===`prs`?(0,X.jsx)(ae,{to:`/github/prs`,replace:!0}):(0,X.jsx)(gt,{view:`issues`})}function gt({view:e,changes:t=!1}){let{n}=S(),i=u({limit:Q}),o=i.data,c=n===void 0?null:Number.parseInt(n,10),l=(0,Y.useMemo)(()=>{if(!o?.available)return[];let t=new Set;e===`prs`&&c!==null&&Number.isInteger(c)&&t.add(c);for(let e of o.prs){if(t.size>=mt)break;t.add(e.number)}return[...t]},[o,e,c]),d=m(l,e===`prs`),f=d.data?.available?d.data.checks:void 0,g=p(),x=e=>{g.setQueryData(r.uiState,t=>({...t,githubView:e})),ee({githubView:e}).then(e=>g.setQueryData(r.uiState,e)).catch(e=>{y(e instanceof Error?e.message:String(e),{tone:`danger`}),g.invalidateQueries({queryKey:r.uiState})})},T=(0,Y.useRef)(null),E=b({mutationFn:()=>s({refresh:!0,limit:Q}),onSuccess:e=>{g.setQueryData(r.github({limit:Q}),e),g.invalidateQueries({queryKey:r.githubChecks(l)});let t=T.current;if(!t){g.removeQueries({queryKey:[`github`,`comments`]});return}let n=r.githubComments(t.kind,t.number);h(t.kind,t.number,{refresh:!0}).then(e=>g.setQueryData(n,e)).catch(()=>{}),g.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==a(n)})},onError:e=>y(e.message,{tone:`danger`})}),D=w(),k=v(),A=te(),[j,M]=(0,Y.useState)(()=>ot().workflow),[F,ie]=(0,Y.useState)(()=>ot().skills),[ae,I]=(0,Y.useState)({runner:null,model:null});(0,Y.useEffect)(()=>{st({workflow:j,skills:[...F]})},[j,F]);let L=D.data?.workflows;(0,Y.useEffect)(()=>{L&&j!==null&&!L.some(e=>e.name===j)&&M(null)},[L,j]);let oe=k.data,se=A.data?.skillUsage,ce=(0,Y.useMemo)(()=>xe(oe??[],se),[oe,se]),[le,ue]=(0,Y.useState)(new Map),[R,z]=(0,Y.useState)(``),[B,de]=(0,Y.useState)([]);if(!o)return i.isError?(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(C,{icon:(0,X.jsx)(re,{}),tone:`danger`,title:`Could not load GitHub`,subtitle:i.error.message})}):(0,X.jsx)(fe,{});if(T.current=null,!o.available)return(0,X.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,X.jsx)(C,{icon:(0,X.jsx)(be,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:o.reason??`unknown reason`,actions:(0,X.jsx)(_,{variant:`outline`,"data-action":`gh-retry`,disabled:E.isPending,onClick:()=>E.mutate(),children:`Try again`}),children:(0,X.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,X.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let V=e===`issues`?o.issues:o.prs,H=o.labelColors??{},pe=et(V),U=tt(V,{query:R,labels:B}),me=R.trim()!==``||B.length>0,W=n===void 0?null:Number.parseInt(n,10),G=W===null?U[0]??null:V.find(e=>e.number===W)??null;T.current=G?{kind:G.kind,number:G.number}:null;let K=e===`issues`?`/github`:`/github/prs`;return(0,X.jsxs)(`div`,{"data-route":`github`,className:`flex h-full min-h-0 items-stretch`,children:[(0,X.jsxs)(`section`,{"data-slot":`gh-list`,className:O(`w-full min-h-0 flex-col overflow-y-auto overscroll-contain border-border md:flex md:w-[360px] md:shrink-0 md:border-r`,n===void 0?`flex`:`hidden`),children:[(0,X.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,X.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,X.jsx)(`h1`,{className:`text-lg font-semibold`,children:`GitHub`}),o.repo?(0,X.jsx)(`span`,{"data-slot":`gh-repo`,className:`min-w-0 truncate font-mono text-[11px] text-soft-foreground`,children:o.repo}):null,(0,X.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:E.isPending,onClick:()=>E.mutate(),className:`ml-auto flex shrink-0 items-center gap-1 rounded-full border border-border px-1.5 py-px text-[10px] font-medium text-soft-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:O(`size-[9px]`,E.isPending&&`motion-safe:animate-spin`)}),o.syncedAt?`synced ${J(o.syncedAt)} ago`:`refresh`]})]}),(0,X.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,X.jsxs)(N,{to:`/github`,active:e===`issues`,onClick:()=>x(`issues`),children:[`Issues · `,_t(o.issues.length)]}),(0,X.jsxs)(N,{to:`/github/prs`,active:e===`prs`,onClick:()=>x(`prs`),children:[`Pull requests · `,_t(o.prs.length)]})]}),(0,X.jsxs)(`div`,{className:`mt-2.5 flex items-center gap-2 pb-3`,children:[(0,X.jsxs)(`div`,{className:`relative min-w-0 flex-1`,children:[(0,X.jsx)(Ee,{"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,X.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:R,onChange:e=>z(e.target.value),className:`w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,X.jsx)(yt,{options:pe,colors:H,selected:B,onChange:de})]})]}),U.length===0?(0,X.jsx)(`p`,{className:`px-4 py-4 text-sm text-soft-foreground`,children:me?`No ${e===`issues`?`issues`:`pull requests`} match your filter.`:`No open ${e===`issues`?`issues`:`pull requests`}.`}):(0,X.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-0.5 px-2 py-2`,children:U.map(t=>(0,X.jsx)(vt,{item:t,view:e,colors:H,active:G?.url===t.url,queued:le.has(t.url),checks:t.kind===`pr`?f?.[t.number]??t.checks:t.checks},t.url))})]}),(0,X.jsx)(`section`,{"data-slot":`gh-detail`,className:O(`min-w-0 min-h-0 flex-1 flex-col overflow-y-auto overscroll-contain`,n===void 0?`hidden md:flex`:`flex`),children:G?(0,X.jsx)(xt,{item:G,listPath:K,colors:H,changes:t,checks:G.kind===`pr`?f?.[G.number]??G.checks:G.checks,children:(0,X.jsx)(dt,{item:G,workflows:D.data?.workflows??[],skills:ce,workflow:j,onWorkflowChange:M,selectedSkills:F,onSkillsChange:ie,engine:ae,onEngineChange:I,queuedRunId:le.get(G.url)??null,onQueued:(e,t)=>ue(n=>new Map(n).set(e,t))},G.url)}):(0,X.jsx)(C,{icon:e===`issues`?(0,X.jsx)(Ue,{}):(0,X.jsx)(P,{}),tone:`neutral`,heading:`h2`,title:W===null?`Nothing selected`:`Not in the open list`,subtitle:W===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${W} is not among the open ${e===`issues`?`issues`:`pull requests`} — it may be closed, or still outside the fetched batch.`})})]})}function _t(e){return`${e}${e>=Q?`+`:``}`}function vt({item:e,view:t,colors:n,active:i,queued:a,checks:o}){let s=e.kind===`issue`?Ue:P,c=p(),l=()=>{c.prefetchQuery({queryKey:r.githubComments(e.kind,e.number),queryFn:({signal:t})=>h(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,X.jsx)(`li`,{children:(0,X.jsxs)(I,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,qe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:l,onFocus:l,"data-slot":`gh-row`,"data-number":e.number,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:O(`flex flex-col gap-1 rounded-md px-2.5 py-2 transition-colors hover:bg-muted`,i&&`bg-muted`),children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(s,{"aria-hidden":`true`,className:O(`size-3.5 shrink-0`,e.kind===`issue`?`text-success`:`text-violet`)}),(0,X.jsx)(`span`,{className:O(`min-w-0 truncate text-[13px] font-medium`,i&&`font-semibold`),children:e.title})]}),(0,X.jsxs)(`span`,{className:`flex items-center gap-2 pl-[22px] font-mono text-[10.5px] text-muted-foreground`,children:[(0,X.jsxs)(`span`,{children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.author}),(0,X.jsx)(`span`,{children:J(e.createdAt)}),(0,X.jsx)(Rt,{count:e.comments}),o?(0,X.jsx)(Bt,{checks:o}):null,a?(0,X.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-violet`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,X.jsx)(`span`,{className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,X.jsx)(bt,{label:e,color:n[e]},e))}):null]})})}function yt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,Y.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,X.jsxs)(K,{open:i,onOpenChange:a,children:[(0,X.jsx)(R,{asChild:!0,children:(0,X.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-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-primary/60 text-foreground`),children:[(0,X.jsx)(Ge,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,X.jsx)(ge,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,X.jsxs)(je,{children:[(0,X.jsx)(_e,{placeholder:`Filter labels…`}),(0,X.jsxs)(H,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,X.jsx)(G,{children:`No labels.`}),n.length>0?(0,X.jsxs)(z,{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,X.jsxs)(z,{value:e,onSelect:()=>o(e),children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:nt(t[e])}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,X.jsx)(x,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-primary`}):null]},e)})]})]})})]})}function bt({label:e,color:t}){return(0,X.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:nt(t),className:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function xt({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,X.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,X.jsxs)(I,{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,X.jsx)(k,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,X.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,X.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,X.jsx)(`span`,{children:o}),`·`,(0,X.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,X.jsxs)(`span`,{children:[J(e.createdAt),` ago`]}),e.comments?(0,X.jsxs)(X.Fragment,{children:[`·`,(0,X.jsx)(Rt,{count:e.comments})]}):null,s?(0,X.jsxs)(X.Fragment,{children:[`·`,(0,X.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,E(e.url)?(0,X.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,X.jsx)(M,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,X.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),(0,X.jsx)(`h2`,{className:`mt-2 text-xl leading-snug font-semibold`,children:e.title}),e.kind===`pr`?(0,X.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,X.jsx)(N,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,X.jsx)(N,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,X.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,X.jsx)(bt,{label:e,color:n[e]},e)),a?(0,X.jsx)(zt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,X.jsx)(wt,{item:e}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,X.jsx)(Re,{children:e.body}):(0,X.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,X.jsx)(Tt,{item:e,colors:n}),e.kind===`pr`?(0,X.jsx)(Ct,{number:e.number}):null,r]})]})}var $={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function St({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,X.jsx)(A,{"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:O(t,`text-success`)}):e===`failing`?(0,X.jsx)(j,{"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:O(t,`text-danger`)}):e===`pending`?(0,X.jsx)(f,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:O(t,`animate-spin text-warning`)}):(0,X.jsx)(ke,{"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:O(t,`text-soft-foreground`)})}function Ct({number:e}){let t=p(),n=d({queryKey:r.githubMergeState(e),queryFn:({signal:t})=>o(e,{},{signal:t}),retry:!1}),i=n.data?.available?n.data.mergeState:null,[a,s]=(0,Y.useState)(null),[c,u]=(0,Y.useState)(!1),[f,m]=(0,Y.useState)(!1),h=b({mutationFn:()=>o(e,{refresh:!0}),onSuccess:n=>t.setQueryData(r.githubMergeState(e),n),onError:e=>y(e instanceof Error?e.message:String(e),{tone:`danger`})}),g=a&&i?.methods.includes(a)?a:i?.defaultMethod??i?.methods[0]??null,v=b({mutationFn:()=>{if(!i||!g)throw Error(`No merge method is available.`);return l(e,{method:g,expectedHeadSha:i.headSha,...f&&i.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{u(!1),y(`Pull request #${e} merged`),t.invalidateQueries({queryKey:r.githubMergeState(e)}),t.invalidateQueries({queryKey:r.github({limit:Q})}),t.invalidateQueries({queryKey:r.githubComments(`pr`,e)})},onError:n=>{y(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:r.githubMergeState(e)})}});if(n.isPending)return(0,X.jsx)(Z,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!i)return(0,X.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,X.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,X.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 ee=i.state===`merged`?`Merged`:i.state===`closed`?`Closed`:i.isDraft?`Draft`:i.mergeable===`conflicting`?`Conflicts must be resolved`:i.canMerge?`Ready to merge`:`Merge blocked`,S=i.reviewDecision===`approved`?`passing`:i.reviewDecision===`unknown`?`unknown`:`failing`,C=i.mergeable===`mergeable`?`passing`:i.mergeable===`conflicting`?`failing`:`unknown`,w=!!(g&&(i.canMerge||i.canOverride&&f));return(0,X.jsxs)(`section`,{"data-slot":`gh-merge-box`,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,X.jsxs)(`div`,{className:`flex items-start gap-3`,children:[i.canMerge?(0,X.jsx)(x,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,X.jsx)(re,{"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,X.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,X.jsx)(`h3`,{className:`font-semibold`,children:ee}),(0,X.jsxs)(_,{type:`button`,variant:`ghost`,size:`sm`,disabled:h.isPending,onClick:()=>h.mutate(),children:[(0,X.jsx)(ne,{"aria-hidden":`true`,className:O(`size-3.5`,h.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,X.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[i.headRef,` (`,i.headSha.slice(0,7),`) → `,i.baseRef]}),(0,X.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(St,{state:S}),(0,X.jsxs)(`span`,{children:[`Reviews: `,i.reviewDecision.replaceAll(`-`,` `)]})]}),(0,X.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(St,{state:C}),(0,X.jsxs)(`span`,{children:[`Conflicts: `,i.mergeable===`conflicting`?`present`:i.mergeable===`mergeable`?`none`:`unknown`]})]}),i.checks.length===0?(0,X.jsx)(`li`,{children:`No checks configured`}):i.checks.map(e=>(0,X.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,X.jsx)(St,{state:e.state}),(0,X.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&E(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),i.blockers.map(e=>(0,X.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),i.canOverride?(0,X.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,X.jsx)(`input`,{type:`checkbox`,checked:f,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 accent-primary`}),(0,X.jsxs)(`span`,{children:[(0,X.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,X.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,i.state===`open`&&i.methods.length>0?(0,X.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,X.jsx)(`select`,{"aria-label":`Merge method`,value:g??``,onChange:e=>s(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:i.methods.map(e=>(0,X.jsx)(`option`,{value:e,children:$[e]},e))}),(0,X.jsx)(_,{disabled:!w,onClick:()=>u(!0),children:g?$[g]:`Merge`})]}):null]})]}),(0,X.jsx)(oe,{open:c,onOpenChange:u,children:(0,X.jsxs)(we,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,X.jsxs)(Te,{children:[(0,X.jsxs)(B,{children:[g?$[g]:`Merge`,` pull request #`,e,`?`]}),(0,X.jsxs)(V,{children:[`This will merge “`,i.title,`” into `,i.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`,f&&i.canOverride?` You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`:``]})]}),v.error?(0,X.jsx)(`p`,{className:`text-sm text-danger`,children:v.error.message}):null,(0,X.jsxs)(Ce,{children:[(0,X.jsx)(_,{variant:`outline`,disabled:v.isPending,onClick:()=>u(!1),children:`Cancel`}),(0,X.jsx)(_,{disabled:v.isPending,onClick:()=>v.mutate(),children:v.isPending?`Merging…`:g?$[g]:`Merge`})]})]})})]})}function wt({item:e}){let t=p(),n=i(e.number),[r,a]=(0,Y.useState)(``),[o,s]=(0,Y.useState)(null),c=n.data,l=c?.available?c.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],u=l.findIndex(e=>e.path===o);(0,Y.useEffect)(()=>{l.length>0&&!l.some(e=>e.path===o)&&s(l[0].path)},[c?.available?c.headSha:``,r]);let d=async()=>{let n=c?.available?c.headSha:null,r=await g(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(s(r.files[0]?.path??null),y(`The reviewed revision changed.`))};if(n.isPending)return(0,X.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!c)return(0,X.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!c.available)return(0,X.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:c.reason});let f=l.map(e=>({path:e.path,...e.previousPath?{oldPath:e.previousPath}:{},status:e.status===`removed`?`deleted`:e.status===`changed`?`modified`:e.status,adds:e.additions,dels:e.deletions,binary:e.patchUnavailableReason===`binary`,patch:e.patch??``})),m=E(e.url)?`${e.url}/files`:null,h=l.find(e=>e.path===o);return(0,X.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,X.jsxs)(`strong`,{children:[c.files.length,` changed files`]}),(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,c.additions]}),(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,c.deletions]}),(0,X.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:c.headSha,children:[`head `,c.headSha.slice(0,8)]}),(0,X.jsx)(_,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void d(),children:`Refresh`})]}),c.truncated?(0,X.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[c.reason??`This response is incomplete.`,` `,m?(0,X.jsx)(`a`,{href:m,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,X.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,X.jsxs)(`aside`,{className:`min-w-0`,children:[(0,X.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>a(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,X.jsx)(`select`,{"aria-label":`Select changed file`,value:o??``,onChange:e=>s(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:l.map(e=>(0,X.jsx)(`option`,{children:e.path},e.path))}),(0,X.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:l.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,onClick:()=>s(e.path),className:O(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,o===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,X.jsxs)(`div`,{className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,X.jsx)(_,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<=0,onClick:()=>s(l[u-1]?.path??null),children:(0,X.jsx)(He,{})}),(0,X.jsx)(_,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:u<0||u>=l.length-1,onClick:()=>s(l[u+1]?.path??null),children:(0,X.jsx)(De,{})})]}),l.length===0?(0,X.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ve,{files:f.filter(e=>e.path===o),wrap:!0,className:`min-w-0`}),h&&!h.patch?(0,X.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,h.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Tt({item:e,colors:t}){let n=T(e.kind,e.number),r=n.data,i=(0,Y.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(Et(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,X.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,X.jsx)(Z,{className:`mb-3 h-3 w-24`}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,X.jsx)(Z,{className:`h-14 w-full`}),(0,X.jsx)(Z,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,X.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,X.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,X.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,X.jsx)(M,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,X.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,X.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,X.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Dt(i).map(e=>e.group===`commits`?(0,X.jsx)(Ot,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,X.jsx)(Pt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,X.jsx)(At,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,X.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,X.jsx)(M,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var Et=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Dt(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 Ot({commits:e,colors:t}){let[n,r]=(0,Y.useState)(!1),i=e[0]?.actor??`?`;return n?(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:kt.committed}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,X.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,X.jsx)(At,{event:e,colors:t},e.id))]}):(0,X.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,children:kt.committed}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,X.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,X.jsx)(`span`,{className:`shrink-0`,children:J(e[e.length-1].createdAt)})]})})}var kt={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function At({event:e,colors:t}){return(0,X.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-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:kt[e.kind]}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,X.jsx)(jt,{event:e,colors:t}),(0,X.jsx)(`span`,{className:`shrink-0`,children:J(e.createdAt)}),e.url?(0,X.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,X.jsx)(M,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function jt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,X.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,X.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,X.jsx)(Mt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,X.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,X.jsx)(`span`,{"data-slot":`gh-event-label`,style:nt(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,X.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,X.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,X.jsx)(`span`,{children:`merged this`});case`closed`:return(0,X.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,X.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,X.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,X.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,X.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Mt({checks:e}){return e?(0,X.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:O(`shrink-0`,Lt[e]),children:It[e]}):null}var Nt={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 Pt({comment:e}){let t=e.reviewState?Nt[e.reviewState]:null;return(0,X.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,X.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,X.jsx)(Ft,{url:e.avatarUrl,login:e.author}),(0,X.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,X.jsx)(`span`,{children:J(e.createdAt)}),t?(0,X.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-[10px] font-medium`,t.tone),children:t.label}):null,(0,X.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,X.jsx)(M,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,X.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,X.jsx)(Re,{children:e.body}):(0,X.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Ft({url:e,login:t}){let[n,r]=(0,Y.useState)(!1);return e&&!n?(0,X.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,X.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 It={passing:`✓`,failing:`✗`,pending:`○`},Lt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Rt({count:e}){return e?(0,X.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,X.jsx)(We,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function zt({checks:e,url:t}){let n=O(`text-[11px] font-medium`,Lt[e],t&&`hover:underline`),r=`${It[e]} checks ${e}`;return t?(0,X.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,X.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function Bt({checks:e}){return(0,X.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:O(`shrink-0 font-sans text-[11px] font-semibold`,Lt[e]),children:It[e]})}export{ht as GithubIndexRoute,gt as GithubRoute};
|