@wjarka/cezarion 0.13.5-pr376.577 → 0.13.5-pr378.582

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.
@@ -3957,19 +3957,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
3957
3957
  } & {
3958
3958
  "/repo/commit/:sha": {
3959
3959
  $get: {
3960
- output: string;
3961
- outputFormat: "text";
3962
- status: import("hono/utils/http-status").ContentfulStatusCode;
3963
- input: {
3964
- query: {
3965
- structured?: string | undefined;
3966
- };
3967
- } & {
3968
- param: {
3969
- sha: string;
3970
- };
3971
- };
3972
- } | {
3973
3960
  output: {
3974
3961
  error: string;
3975
3962
  code?: "invalid_input" | undefined;
@@ -4033,6 +4020,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
4033
4020
  sha: string;
4034
4021
  };
4035
4022
  };
4023
+ } | {
4024
+ output: string;
4025
+ outputFormat: "text";
4026
+ status: import("hono/utils/http-status").ContentfulStatusCode;
4027
+ input: {
4028
+ query: {
4029
+ structured?: string | undefined;
4030
+ };
4031
+ } & {
4032
+ param: {
4033
+ sha: string;
4034
+ };
4035
+ };
4036
4036
  };
4037
4037
  };
4038
4038
  } & {
@@ -10093,20 +10093,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
10093
10093
  } & {
10094
10094
  "/runs/:id/handoff": {
10095
10095
  $get: {
10096
- output: string;
10097
- outputFormat: "text";
10098
- status: 200;
10096
+ output: {
10097
+ error: string;
10098
+ };
10099
+ outputFormat: "json";
10100
+ status: 404;
10099
10101
  input: {
10100
10102
  param: {
10101
10103
  id: string;
10102
10104
  };
10103
10105
  };
10104
10106
  } | {
10105
- output: {
10106
- error: string;
10107
- };
10108
- outputFormat: "json";
10109
- status: 404;
10107
+ output: string;
10108
+ outputFormat: "text";
10109
+ status: 200;
10110
10110
  input: {
10111
10111
  param: {
10112
10112
  id: string;
@@ -10144,20 +10144,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
10144
10144
  } & {
10145
10145
  "/runs/:id/diff": {
10146
10146
  $get: {
10147
- output: string;
10148
- outputFormat: "text";
10149
- status: import("hono/utils/http-status").ContentfulStatusCode;
10147
+ output: {
10148
+ error: string;
10149
+ };
10150
+ outputFormat: "json";
10151
+ status: 404;
10150
10152
  input: {
10151
10153
  param: {
10152
10154
  id: string;
10153
10155
  };
10154
10156
  };
10155
10157
  } | {
10156
- output: {
10157
- error: string;
10158
- };
10159
- outputFormat: "json";
10160
- status: 404;
10158
+ output: string;
10159
+ outputFormat: "text";
10160
+ status: import("hono/utils/http-status").ContentfulStatusCode;
10161
10161
  input: {
10162
10162
  param: {
10163
10163
  id: string;
@@ -12534,19 +12534,6 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
12534
12534
  } & {
12535
12535
  "/repo/commit/:sha": {
12536
12536
  $get: {
12537
- output: string;
12538
- outputFormat: "text";
12539
- status: import("hono/utils/http-status").ContentfulStatusCode;
12540
- input: {
12541
- query: {
12542
- structured?: string | undefined;
12543
- };
12544
- } & {
12545
- param: {
12546
- sha: string;
12547
- };
12548
- };
12549
- } | {
12550
12537
  output: {
12551
12538
  error: string;
12552
12539
  code?: "invalid_input" | undefined;
@@ -12610,6 +12597,19 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
12610
12597
  sha: string;
12611
12598
  };
12612
12599
  };
12600
+ } | {
12601
+ output: string;
12602
+ outputFormat: "text";
12603
+ status: import("hono/utils/http-status").ContentfulStatusCode;
12604
+ input: {
12605
+ query: {
12606
+ structured?: string | undefined;
12607
+ };
12608
+ } & {
12609
+ param: {
12610
+ sha: string;
12611
+ };
12612
+ };
12613
12613
  };
12614
12614
  };
12615
12615
  } & {
@@ -18670,20 +18670,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18670
18670
  } & {
18671
18671
  "/runs/:id/handoff": {
18672
18672
  $get: {
18673
- output: string;
18674
- outputFormat: "text";
18675
- status: 200;
18673
+ output: {
18674
+ error: string;
18675
+ };
18676
+ outputFormat: "json";
18677
+ status: 404;
18676
18678
  input: {
18677
18679
  param: {
18678
18680
  id: string;
18679
18681
  };
18680
18682
  };
18681
18683
  } | {
18682
- output: {
18683
- error: string;
18684
- };
18685
- outputFormat: "json";
18686
- status: 404;
18684
+ output: string;
18685
+ outputFormat: "text";
18686
+ status: 200;
18687
18687
  input: {
18688
18688
  param: {
18689
18689
  id: string;
@@ -18721,20 +18721,20 @@ export declare function createApp(deps: ServerDeps): import("hono/hono-base").Ho
18721
18721
  } & {
18722
18722
  "/runs/:id/diff": {
18723
18723
  $get: {
18724
- output: string;
18725
- outputFormat: "text";
18726
- status: import("hono/utils/http-status").ContentfulStatusCode;
18724
+ output: {
18725
+ error: string;
18726
+ };
18727
+ outputFormat: "json";
18728
+ status: 404;
18727
18729
  input: {
18728
18730
  param: {
18729
18731
  id: string;
18730
18732
  };
18731
18733
  };
18732
18734
  } | {
18733
- output: {
18734
- error: string;
18735
- };
18736
- outputFormat: "json";
18737
- status: 404;
18735
+ output: string;
18736
+ outputFormat: "text";
18737
+ status: import("hono/utils/http-status").ContentfulStatusCode;
18738
18738
  input: {
18739
18739
  param: {
18740
18740
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wjarka/cezarion",
3
- "version": "0.13.5-pr376.577",
3
+ "version": "0.13.5-pr378.582",
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,8 +50,8 @@
50
50
  "zod": "^4.4.3"
51
51
  },
52
52
  "devDependencies": {
53
- "@open-mercato/cezar-api-client": "0.13.5-pr376.577",
54
- "@open-mercato/cezar-contract": "0.13.5-pr376.577",
53
+ "@open-mercato/cezar-api-client": "0.13.5-pr378.582",
54
+ "@open-mercato/cezar-contract": "0.13.5-pr378.582",
55
55
  "@types/node": "^20.14.0",
56
56
  "@types/ws": "^8.18.1",
57
57
  "esbuild": "^0.28.1",
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Lt as r,ct as i,gt as a}from"./alert-dialog-KUiPIBmb.js";import{t as o}from"./utils-CG8vWc5K.js";import{t as s}from"./project-router-BOglfKgF.js";import{h as c}from"./index-LuDSzPED.js";import{t as l}from"./lib-BQXq3kEf.js";var u=e(t(),1),d=n(),f=77;function p({slot:e,commits:t,className:n,heading:i}){let[a,s]=(0,u.useState)(``),p=a.trim().toLowerCase(),h=p?t.filter(e=>e.subject.toLowerCase().includes(p)):t,g=h.length>150,_=(0,u.useRef)(null),v=(0,u.useRef)(null),[y,b]=(0,u.useState)(0);(0,u.useLayoutEffect)(()=>{if(!g)return;let e=()=>{let e=_.current,t=v.current;!e||!t||b(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[g]);let x=h.map(n=>(0,d.jsx)(m,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,d.jsx)(r,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,d.jsx)(c,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>s(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,d.jsxs)(`div`,{ref:e=>{_.current=e,e&&(v.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":g,className:o(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,d.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,h.length===0?(0,d.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,g?(0,d.jsx)(l,{scrollRef:v,startMargin:y,itemSize:f,children:x}):x]})]})}function m({commit:e,detailed:t}){return(0,d.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,d.jsxs)(s,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:o(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,d.jsx)(a,{size:16,"aria-hidden":`true`,className:o(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,d.jsxs)(`span`,{className:o(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,d.jsx)(`span`,{className:o(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,d.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,d.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,d.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,d.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}export{p as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Lt as r,ct as i,gt as a}from"./alert-dialog-KUiPIBmb.js";import{t as o}from"./utils-CG8vWc5K.js";import{t as s}from"./project-router-BOglfKgF.js";import{h as c}from"./index-ujHRHX5o.js";import{t as l}from"./lib-BQXq3kEf.js";var u=e(t(),1),d=n(),f=77;function p({slot:e,commits:t,className:n,heading:i}){let[a,s]=(0,u.useState)(``),p=a.trim().toLowerCase(),h=p?t.filter(e=>e.subject.toLowerCase().includes(p)):t,g=h.length>150,_=(0,u.useRef)(null),v=(0,u.useRef)(null),[y,b]=(0,u.useState)(0);(0,u.useLayoutEffect)(()=>{if(!g)return;let e=()=>{let e=_.current,t=v.current;!e||!t||b(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[g]);let x=h.map(n=>(0,d.jsx)(m,{commit:n,detailed:e===`task-commits`&&t.length===1},n.sha));return(0,d.jsxs)(d.Fragment,{children:[(0,d.jsxs)(`label`,{className:`relative mb-[22px] block`,children:[(0,d.jsx)(r,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-3.5 left-3 size-4 text-muted-foreground`}),(0,d.jsx)(c,{"aria-label":`Search commit messages`,placeholder:`Search commit messages…`,value:a,onChange:e=>s(e.target.value),className:`h-11 bg-card pl-10`})]}),(0,d.jsxs)(`div`,{ref:e=>{_.current=e,e&&(v.current=e.closest(`[data-slot="main"]`))},"data-slot":e,"data-virtualized":g,className:o(`flex flex-col divide-y divide-border rounded-xl border border-border bg-card px-4 py-1 md:px-5`,n),children:[i?(0,d.jsx)(`div`,{className:`flex min-h-14 flex-wrap items-center gap-2 py-4`,children:i}):null,h.length===0?(0,d.jsx)(`p`,{role:`status`,className:`py-5 text-sm text-muted-foreground`,children:`No loaded commits match your search.`}):null,g?(0,d.jsx)(l,{scrollRef:v,startMargin:y,itemSize:f,children:x}):x]})]})}function m({commit:e,detailed:t}){return(0,d.jsx)(`div`,{className:`[contain-intrinsic-block-size:auto_77px] [content-visibility:auto]`,children:(0,d.jsxs)(s,{"data-slot":`commit-row`,"data-sha":e.sha,to:e.href,className:o(`flex min-h-[76px] min-w-0 flex-col items-start gap-3 rounded-sm py-4 hover:bg-muted`,!t&&`md:flex-row md:items-center md:py-3`),children:[(0,d.jsx)(a,{size:16,"aria-hidden":`true`,className:o(`shrink-0 text-accent-text`,t?`size-[22px]`:`size-4`)}),(0,d.jsxs)(`span`,{className:o(`min-w-0 w-full`,!t&&`md:w-auto md:flex-1`),children:[(0,d.jsx)(`span`,{className:o(`block font-normal`,t?`text-[22px] leading-snug`:`text-[13px] md:truncate`),children:e.subject}),(0,d.jsxs)(`span`,{className:`mt-1 block truncate text-[11px] text-soft-foreground`,children:[e.author,` · `,e.when]})]}),(0,d.jsx)(`span`,{className:`shrink-0 rounded-md bg-muted px-2 py-1 font-mono text-[11px] text-muted-foreground`,children:e.shaLabel}),t?(0,d.jsxs)(`span`,{className:`inline-flex min-h-11 items-center gap-2 rounded-lg bg-action px-3 text-xs font-medium text-action-foreground`,children:[(0,d.jsx)(i,{size:16,"aria-hidden":`true`,className:`size-4`}),`View changes`]}):null]})})}export{p 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{Bi as r,Ca as i,Cn as a,J as o,Jr as s,Oa as c,Or as l,Sn as u,Vr as d,X as f,a as p,aa as m,c as h,d as g,ei as _,i as v,l as y,n as b,o as x,r as S,rn as C,s as w,sr as T,t as E,wr as D,xa as O}from"./alert-dialog-KUiPIBmb.js";import{t as k}from"./utils-CG8vWc5K.js";import{n as A,r as j,t as M}from"./collapsible-CkSaP6_n.js";import{c as N,t as P}from"./project-router-BOglfKgF.js";import{t as F}from"./search-x-I9Q8pgUa.js";import{t as I}from"./markdown-CIi0LXvU.js";import{n as L,t as R}from"./token-metrics-DDvhrHmK.js";import{g as z,m as B}from"./index-LuDSzPED.js";import{t as V}from"./run-diff-DEVs-zV1.js";var H=e(t(),1),U=n();function W(){let{groupId:e}=O(),t=u(e),n=R(a().data),r=c();if((0,H.useEffect)(()=>{e&&r.invalidateQueries({queryKey:C.groups.detail(e)})},[r,e,(T().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,U.jsx)(B,{});if(t.isError){let e=t.error instanceof _&&t.error.status===404;return(0,U.jsx)(`div`,{"data-route":`compare`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(y,{icon:e?(0,U.jsx)(F,{}):(0,U.jsx)(z,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load 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,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(g,{asChild:!0,variant:`outline`,children:(0,U.jsx)(P,{to:`/`,children:`Back to tasks`})}),e?null:(0,U.jsx)(g,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]})})})}return(0,U.jsx)(G,{groupId:e,variants:t.data.runs,showTokens:n.tokens,showCost:n.cost})}function G({groupId:e,variants:t,showTokens:n,showCost:a}){let o=N(),s=c(),[l,u]=(0,H.useState)(null),f=t.every(e=>D.has(e.status)),g=t[0]?d(t[0]):``,_=i({mutationFn:t=>r(e,t),onSuccess:(t,n)=>{s.invalidateQueries({queryKey:C.runs.all}),s.invalidateQueries({queryKey:C.groups.detail(e)}),o(`/tasks/${t.winner?.id??n}`)},onError:e=>m(e.message,{tone:`danger`})});return(0,U.jsxs)(`div`,{"data-route":`compare`,className:`task-flow-page flex w-full flex-col`,children:[(0,U.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,U.jsx)(z,{className:`size-5 shrink-0 text-accent-icon`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{children:`Compare variants`})]}),(0,U.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[g,` · `,t.length,` `,f?`completed variants with distinct committed diffs.`:`variants of the same task, each in its own worktree.`]})]}),f?null:(0,U.jsxs)(`section`,{role:`status`,className:`rounded-xl border border-border bg-card p-5`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-normal`,children:`Variants are still running`}),(0,U.jsx)(`p`,{className:`mt-3 text-[13px] text-muted-foreground`,children:`Compare progress now. Picking a result is disabled until every variant finishes.`})]}),(0,U.jsx)(`div`,{"data-slot":`compare-columns`,className:k(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,U.jsx)(K,{variant:e,allTerminal:f,pickPending:_.isPending,onPick:()=>u(e),showTokens:n,showCost:a},e.id))}),(0,U.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-[22px]`,children:t.map(e=>(0,U.jsx)(q,{variant:e},e.id))}),(0,U.jsx)(E,{open:l!==null,onOpenChange:e=>!e&&u(null),children:(0,U.jsxs)(v,{"data-slot":`variant-confirm-dialog`,children:[(0,U.jsxs)(w,{children:[(0,U.jsxs)(h,{children:[`Pick variant `,l?.variant,`?`]}),(0,U.jsxs)(p,{children:[`Variant `,l?.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,U.jsxs)(x,{children:[(0,U.jsx)(S,{children:`Cancel`}),(0,U.jsxs)(b,{"data-slot":`confirm-pick`,onClick:()=>{l&&_.mutate(l.id),u(null)},children:[`Pick variant `,l?.variant]})]})]})})]})}function K({variant:e,allTerminal:t,pickPending:n,onPick:r,showTokens:i,showCost:a}){let c=s(e),u=l(e.costUsd),d=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,U.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,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.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-accent-strong/15 font-mono text-xs font-semibold text-accent-text`,children:e.variant}),(0,U.jsxs)(`span`,{"data-slot":`variant-status`,className:`text-lg font-normal`,children:[`· `,(0,U.jsx)(`span`,{className:`capitalize`,children:c.label})]}),i&&d||a&&u?(0,U.jsxs)(`span`,{"data-slot":`variant-token-metrics`,className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-soft-foreground`,children:[i?(0,U.jsx)(L,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):null,i&&d&&a&&u?(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,a&&u?(0,U.jsx)(`span`,{className:`font-mono tabular-nums`,children:u}):null]}):null]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,U.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,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,U.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,U.jsx)(I,{children:e.handoffExcerpt})}):(0,U.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,U.jsx)(g,{asChild:!0,variant:`outline`,className:`self-start`,children:(0,U.jsx)(P,{to:`/tasks/${e.id}`,children:`Open task`})}),(0,U.jsxs)(g,{"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,U.jsx)(o,{"aria-hidden":`true`}),`Pick variant `,e.variant]})]})}function q({variant:e}){let[t,n]=(0,H.useState)(!1);return(0,U.jsxs)(M,{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,U.jsxs)(j,{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,U.jsx)(f,{className:k(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,U.jsx)(A,{children:(0,U.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,U.jsx)(V,{runId:e.id})})})]})}export{W as CompareVariantsRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Bi as r,Ca as i,Cn as a,J as o,Jr as s,Oa as c,Or as l,Sn as u,Vr as d,X as f,a as p,aa as m,c as h,d as g,ei as _,i as v,l as y,n as b,o as x,r as S,rn as C,s as w,sr as T,t as E,wr as D,xa as O}from"./alert-dialog-KUiPIBmb.js";import{t as k}from"./utils-CG8vWc5K.js";import{n as A,r as j,t as M}from"./collapsible-CkSaP6_n.js";import{c as N,t as P}from"./project-router-BOglfKgF.js";import{t as F}from"./search-x-I9Q8pgUa.js";import{t as I}from"./markdown-CIi0LXvU.js";import{n as L,t as R}from"./token-metrics-DDvhrHmK.js";import{g as z,m as B}from"./index-ujHRHX5o.js";import{t as V}from"./run-diff-DEVs-zV1.js";var H=e(t(),1),U=n();function W(){let{groupId:e}=O(),t=u(e),n=R(a().data),r=c();if((0,H.useEffect)(()=>{e&&r.invalidateQueries({queryKey:C.groups.detail(e)})},[r,e,(T().data??[]).filter(t=>t.groupId===e).map(e=>`${e.id}:${e.status}:${e.archived}`).sort().join(`,`)]),t.isPending)return(0,U.jsx)(B,{});if(t.isError){let e=t.error instanceof _&&t.error.status===404;return(0,U.jsx)(`div`,{"data-route":`compare`,className:`task-flow-page flex min-h-full flex-col`,children:(0,U.jsx)(y,{icon:e?(0,U.jsx)(F,{}):(0,U.jsx)(z,{}),tone:e?`neutral`:`danger`,title:e?`No such variant group`:`Could not load 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,U.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,U.jsx)(g,{asChild:!0,variant:`outline`,children:(0,U.jsx)(P,{to:`/`,children:`Back to tasks`})}),e?null:(0,U.jsx)(g,{variant:`outline`,onClick:()=>void t.refetch(),children:`Retry`})]})})})}return(0,U.jsx)(G,{groupId:e,variants:t.data.runs,showTokens:n.tokens,showCost:n.cost})}function G({groupId:e,variants:t,showTokens:n,showCost:a}){let o=N(),s=c(),[l,u]=(0,H.useState)(null),f=t.every(e=>D.has(e.status)),g=t[0]?d(t[0]):``,_=i({mutationFn:t=>r(e,t),onSuccess:(t,n)=>{s.invalidateQueries({queryKey:C.runs.all}),s.invalidateQueries({queryKey:C.groups.detail(e)}),o(`/tasks/${t.winner?.id??n}`)},onError:e=>m(e.message,{tone:`danger`})});return(0,U.jsxs)(`div`,{"data-route":`compare`,className:`task-flow-page flex w-full flex-col`,children:[(0,U.jsxs)(`header`,{className:`flex flex-col gap-1`,children:[(0,U.jsxs)(`h1`,{className:`flex items-center gap-2 text-xl font-semibold`,children:[(0,U.jsx)(z,{className:`size-5 shrink-0 text-accent-icon`,"aria-hidden":`true`}),(0,U.jsx)(`span`,{children:`Compare variants`})]}),(0,U.jsxs)(`p`,{className:`text-[13px] text-muted-foreground`,children:[g,` · `,t.length,` `,f?`completed variants with distinct committed diffs.`:`variants of the same task, each in its own worktree.`]})]}),f?null:(0,U.jsxs)(`section`,{role:`status`,className:`rounded-xl border border-border bg-card p-5`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-normal`,children:`Variants are still running`}),(0,U.jsx)(`p`,{className:`mt-3 text-[13px] text-muted-foreground`,children:`Compare progress now. Picking a result is disabled until every variant finishes.`})]}),(0,U.jsx)(`div`,{"data-slot":`compare-columns`,className:k(`grid grid-cols-1 gap-3`,t.length>=3?`md:grid-cols-3`:`md:grid-cols-2`),children:t.map(e=>(0,U.jsx)(K,{variant:e,allTerminal:f,pickPending:_.isPending,onPick:()=>u(e),showTokens:n,showCost:a},e.id))}),(0,U.jsx)(`section`,{"aria-label":`Full diffs`,className:`flex flex-col gap-[22px]`,children:t.map(e=>(0,U.jsx)(q,{variant:e},e.id))}),(0,U.jsx)(E,{open:l!==null,onOpenChange:e=>!e&&u(null),children:(0,U.jsxs)(v,{"data-slot":`variant-confirm-dialog`,children:[(0,U.jsxs)(w,{children:[(0,U.jsxs)(h,{children:[`Pick variant `,l?.variant,`?`]}),(0,U.jsxs)(p,{children:[`Variant `,l?.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,U.jsxs)(x,{children:[(0,U.jsx)(S,{children:`Cancel`}),(0,U.jsxs)(b,{"data-slot":`confirm-pick`,onClick:()=>{l&&_.mutate(l.id),u(null)},children:[`Pick variant `,l?.variant]})]})]})})]})}function K({variant:e,allTerminal:t,pickPending:n,onPick:r,showTokens:i,showCost:a}){let c=s(e),u=l(e.costUsd),d=e.inputTokens!==void 0||e.outputTokens!==void 0;return(0,U.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,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.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-accent-strong/15 font-mono text-xs font-semibold text-accent-text`,children:e.variant}),(0,U.jsxs)(`span`,{"data-slot":`variant-status`,className:`text-lg font-normal`,children:[`· `,(0,U.jsx)(`span`,{className:`capitalize`,children:c.label})]}),i&&d||a&&u?(0,U.jsxs)(`span`,{"data-slot":`variant-token-metrics`,className:`ml-auto flex shrink-0 items-center gap-1.5 text-[11px] text-soft-foreground`,children:[i?(0,U.jsx)(L,{inputTokens:e.inputTokens,outputTokens:e.outputTokens}):null,i&&d&&a&&u?(0,U.jsx)(`span`,{"aria-hidden":`true`,children:`·`}):null,a&&u?(0,U.jsx)(`span`,{className:`font-mono tabular-nums`,children:u}):null]}):null]}),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`git diff --stat`}),(0,U.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,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,U.jsx)(`span`,{className:`text-[10.5px] font-semibold tracking-[0.04em] text-soft-foreground uppercase`,children:`Progress`}),e.handoffExcerpt?(0,U.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,U.jsx)(I,{children:e.handoffExcerpt})}):(0,U.jsx)(`p`,{"data-slot":`variant-progress`,className:`text-xs text-soft-foreground`,children:`(no progress notes)`})]}),(0,U.jsx)(g,{asChild:!0,variant:`outline`,className:`self-start`,children:(0,U.jsx)(P,{to:`/tasks/${e.id}`,children:`Open task`})}),(0,U.jsxs)(g,{"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,U.jsx)(o,{"aria-hidden":`true`}),`Pick variant `,e.variant]})]})}function q({variant:e}){let[t,n]=(0,H.useState)(!1);return(0,U.jsxs)(M,{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,U.jsxs)(j,{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,U.jsx)(f,{className:k(`size-3.5 shrink-0 text-soft-foreground transition-transform`,t&&`rotate-90`),"aria-hidden":`true`}),`Variant `,e.variant,` — full diff`]}),(0,U.jsx)(A,{children:(0,U.jsx)(`div`,{className:`border-t border-border/50 px-3 py-3`,children:(0,U.jsx)(V,{runId:e.id})})})]})}export{W as CompareVariantsRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,Ca as i,Ci as a,Cn as o,Ei as s,Gi as c,Ht as l,It as u,J as d,Jt as f,La as p,Lt as m,Ni as h,Oa as g,Q as _,Qt as v,Ti as y,U as b,X as x,Xt as S,Y as C,_n as ee,_r as te,aa as w,bn as T,bt as ne,d as E,dr as re,en as ie,l as D,mi as ae,mr as oe,rn as O,tt as k,vn as se,wa as ce,wi as le,xa as ue,xn as de,xt as fe,yn as pe}from"./alert-dialog-KUiPIBmb.js";import{d as me,n as he,t as A}from"./utils-CG8vWc5K.js";import{a as j,o as ge,r as _e}from"./agent-accounts-MT-jtwOU.js";import{a as ve,i as ye,n as be,o as xe,r as Se,s as Ce,t as M}from"./textarea-DdKiIORK.js";import{t as we}from"./createLucideIcon-BHp8sXmF.js";import{t as N}from"./external-link-BE6y205O.js";import{A as P,E as F,F as Te,I,M as L,O as R,a as Ee,c as z,d as B,j as De,k as V,n as H,o as U,r as Oe,s as W}from"./prompt-templates-D86VeB2V.js";import{r as ke,t as Ae,u as je}from"./project-router-BOglfKgF.js";import{t as Me}from"./message-square-B-MD-8rD.js";import{r as G,t as Ne}from"./markdown-CIi0LXvU.js";import{d as K,f as Pe,i as Fe,s as Ie,t as q,u as Le}from"./skills-DFBiAuJG.js";import{n as J,t as Re}from"./use-submit-shortcut-KWJsC906.js";import{d as Y,f as ze,l as Be,p as Ve,s as He,u as Ue}from"./index-LuDSzPED.js";import{t as We}from"./diff-C4aSZfrQ2.js";import{t as Ge}from"./tab-link-ChqeHA8K.js";var Ke=we(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),qe=we(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),X=e(t(),1),Z=n();function Je({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`skeleton`,className:A(`animate-pulse rounded-md bg-accent`,e),...t})}var Q=`cez-github-list-width`;function Ye(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Xe(){try{let e=localStorage.getItem(Q);return e===null?360:Ye(e)}catch{return 360}}function Ze(e){try{localStorage.setItem(Q,String(Ye(e)))}catch{}}function $(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Qe(e,t=[]){let n=$(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=$e(t)),n}function $e(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function et(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function tt(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function nt(e,t,n){let r=(n??``).trim();if(!r)return Qe(e,t);let i=$(e),a=r.startsWith(i)?i+et(r.slice(i.length),e):et(r,e),o=tt(a,e)?a:`${i}\n\n${a}`;return t.length?o+$e(t):o}function rt(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function it(e,t,n,r,i={}){return t?{...i,workflow:t,task:nt(e,n,r)}:n.length?{...i,steps:rt(n),task:nt(e,[],r)}:{...i,workflow:`quick-task`,task:nt(e,[],r)}}var at=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm text-foreground focus-visible:outline-ring disabled:opacity-50`;function ot({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let a=new Map;for(let t of e.issues)for(let e of t.assignees??[])a.set(e.toLowerCase(),e);for(let e of t)a.set(e.toLowerCase(),e);let o=[...a.values()].sort((e,t)=>e.localeCompare(t)),s=!!e.viewerLogin&&t.length===1&&t[0]?.toLowerCase()===e.viewerLogin.toLowerCase();return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`gh-issue-filters`,children:[(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(ge,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:at,disabled:o.length===0,children:[`Assignees`,t.length?` · ${t.length}`:``]})}),(0,Z.jsx)(j,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Z.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Z.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),o.map(e=>{let n=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,Z.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>r(n?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Z.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]}),(0,Z.jsx)(`button`,{type:`button`,className:`${at} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":s,onClick:()=>r(s?[]:[e.viewerLogin]),children:`Assigned to me`}),e.viewerLogin?null:(0,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:`GitHub login unavailable.`}),e.projects?.length?(0,Z.jsxs)(`select`,{"aria-label":`Project board`,className:at,value:n,onChange:e=>i(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects?(0,Z.jsx)(`select`,{"aria-label":`Project board`,className:at,disabled:!0,value:``,children:(0,Z.jsx)(`option`,{value:``,children:`No boards`})}):(0,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:e.projectsReason??`Project boards unavailable.`})]})}function st(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function ct(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.projectId&&!e.projectIds?.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function lt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function ut(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var dt={workflow:null,skills:[]},ft=`cez-followup-selection`;function pt(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function mt(){try{let e=localStorage.getItem(ft);return e?pt(JSON.parse(e)):{...dt}}catch{return{...dt}}}function ht(e){try{localStorage.setItem(ft,JSON.stringify(e))}catch{}}var gt=`cez-followup-prompt:`;function _t(e){try{return localStorage.getItem(gt+e)??``}catch{return``}}function vt(e,t){try{t===``?localStorage.removeItem(gt+e):localStorage.setItem(gt+e,t)}catch{}}function yt({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:u,queuedRunId:f,onQueued:p}){let m=g(),h=oe(),_=e.kind===`pr`?`PR`:`issue`,v=o.filter(e=>n.some(t=>t.name===e)),[y]=(0,X.useState)(()=>$(e)),[b,x]=(0,X.useState)(()=>_t(e.url)||y),S=ze(l),C=(0,X.useRef)(null),ee=(0,X.useRef)(null);(0,X.useEffect)(()=>{vt(e.url,b===y?``:b)},[e.url,b,y]);let te=(0,X.useMemo)(()=>Ee(h.data?.promptTemplates),[h.data?.promptTemplates]),T=e=>{let t=C.current,n=W({prompt:b,base:y,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:ee.current}),r=Oe(b,n,e);x(r.text),ee.current=r.caret,requestAnimationFrame(()=>{C.current?.focus(),C.current?.setSelectionRange(r.caret,r.caret)})},ne=H(te,v),re=(0,X.useRef)(b);re.current=b;let D=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=U(re.current,D.current,ne,y);D.current=e.applied,e.text!==re.current&&x(e.text)},[ne,y]);let k=i({mutationFn:async()=>S.canRun?ae(it(e,r,v,b,Y(S))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&p(e.url,n.id),w(`Added to the queue — ${_} #${e.number}`),v.length>0&&h.data!==void 0&&c({skillUsage:v.reduce((e,t)=>q(e,t),h.data.skillUsage)}).then(()=>m.invalidateQueries({queryKey:O.uiState})).catch(()=>{}),vt(e.url,``),x(y),D.current=``,m.invalidateQueries({queryKey:O.runs.all})},onError:e=>w(e.message,{tone:`danger`})}),se=e=>{Re({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!k.isPending&&S.canRun&&k.mutate())},ce=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(M,{ref:C,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:b,onChange:e=>x(e.target.value),onSelect:e=>{ee.current=e.currentTarget.selectionStart},onKeyDown:se,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(Be,{templates:te,onInsert:T}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(bt,{workflows:t,value:r,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(St,{skills:n,skillUsage:h.data?.skillUsage,selected:v,onToggle:ce})]}),v.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:v.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>ce(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Z.jsx)(ie,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Z.jsxs)(`div`,{className:`gh-engine-fields`,children:[(0,Z.jsx)(Ue,{pick:l,onChange:u,disabled:k.isPending||!S.canRun,accounts:!0}),S.runners.length<=1&&!S.accounts.some(e=>e.provider===S.runner&&e.id!=="default")?(0,Z.jsxs)(`div`,{className:`gh-fixed-runner`,children:[(0,Z.jsx)(`span`,{children:`Runner`}),S.runner]}):null]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(xt,{resolved:S,disabled:k.isPending||!S.canRun,onPick:e=>u({...l,account:e})})]}),!S.providerPending&&!S.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[S.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(Ae,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[he(e.url)?(0,Z.jsx)(E,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(E,{variant:`primary`,"data-action":`gh-run`,disabled:k.isPending||!S.canRun,onClick:()=>k.mutate(),children:[(0,Z.jsx)(Te,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,_]}),(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:J()}),f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(Ae,{to:`/tasks/${f}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function bt({workflows:e,value:t,onChange:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(``),s=(0,X.useRef)(null),c=K(e,a);return(0,Z.jsxs)(_e,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Z.jsx)(ge,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:A(B,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Z.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(C,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(j,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(F,{shouldFilter:!1,children:[(0,Z.jsx)(P,{placeholder:`search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,Z.jsxs)(L,{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,Z.jsx)(R,{children:`Nothing matches.`}):null,(0,Z.jsx)(V,{children:c.map(e=>{let r=t===e.name;return(0,Z.jsxs)(De,{value:`workflow ${e.name}`,keywords:Pe(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function xt({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:me,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(z,{icon:(0,Z.jsx)(S,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function St({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),[c,u]=(0,X.useState)(null),f=(0,X.useRef)(null),{mostUsed:p,project:m,global:h,ranked:g}=Le(e,o,t),_=(e,t)=>{let i=n.includes(e.name);return(0,Z.jsxs)(De,{value:`skill ${e.name} ${e.path}`,keywords:Pe(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>r(e.name),children:[(0,Z.jsx)(`span`,{className:A(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(He,{skill:c,onClose:()=>u(null)}),(0,Z.jsxs)(_e,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(ge,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:A(B,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(l,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(C,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(j,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(F,{shouldFilter:!1,children:[(0,Z.jsx)(P,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>f.current?.scrollTo(0,0)}),(0,Z.jsxs)(L,{ref:f,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(g?g.length===0:p.length===0&&m.length===0&&h.length===0)?(0,Z.jsx)(R,{children:`Nothing matches.`}):null,g?g.length>0?(0,Z.jsx)(V,{children:g.map(e=>_(e,Fe(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[p.length>0?(0,Z.jsx)(V,{heading:`Most used`,children:p.map(e=>_(e,Fe(e)))}):null,m.length>0?(0,Z.jsx)(V,{heading:`Project skills`,children:m.map(e=>_(e,!0))}):null,h.length>0?(0,Z.jsx)(V,{heading:`Global`,children:h.map(e=>_(e,!1))}):null]})]})]})})]})]})}var Ct=1e3,wt=100,Tt=350;function Et({width:e,onWidthChange:t}){let n=(0,X.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Ye(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,Z.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Ye(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function Dt(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Ot({view:e,changes:t=!1,index:n=!1}){let{n:r}=ue(),s=ee({limit:Ct}),l=o().data?.capabilities?.automations===!0,d=s.data,h=g(),v=e=>{h.setQueryData(O.uiState,t=>({...t,githubView:e})),c({githubView:e}).then(e=>h.setQueryData(O.uiState,e)).catch(e=>{w(e instanceof Error?e.message:String(e),{tone:`danger`}),h.invalidateQueries({queryKey:O.uiState})})},y=(0,X.useRef)(null),b=i({mutationFn:()=>a({refresh:!0,limit:Ct}),onSuccess:t=>{h.setQueryData(O.github({limit:Ct}),t),h.invalidateQueries({queryKey:O.githubChecks(He)}),h.invalidateQueries({queryKey:O.githubSearch(e===`issues`?`issue`:`pr`,z)});let n=y.current;if(!n){h.removeQueries({queryKey:[`github`,`comments`]});return}let r=O.githubComments(n.kind,n.number);le(n.kind,n.number,{refresh:!0}).then(e=>h.setQueryData(r,e)).catch(()=>{}),h.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==p(r)})},onError:e=>w(e.message,{tone:`danger`})}),x=te(),S=re(),C=oe(),[T,ie]=(0,X.useState)(()=>mt().workflow),[ae,k]=(0,X.useState)(()=>mt().skills),[ce,pe]=(0,X.useState)({runner:null,model:null,effort:null,account:null}),[me,he]=(0,X.useState)(Xe),[j,ge]=(0,X.useState)(!1),_e=e=>{let t=Ye(e);he(t),Ze(t)};(0,X.useEffect)(()=>{ht({workflow:T,skills:[...ae]})},[T,ae]);let ve=x.data?.workflows;(0,X.useEffect)(()=>{ve&&T!==null&&!ve.some(e=>e.name===T)&&ie(null)},[ve,T]);let ye=S.data,be=C.data?.skillUsage,xe=(0,X.useMemo)(()=>Ie(ye??[],be),[ye,be]),[Se,Ce]=(0,X.useState)(new Map),[M,we]=(0,X.useState)(``),[N,P]=(0,X.useState)([]),[F,Te]=(0,X.useState)([]),[I,L]=(0,X.useState)(``),R=d?.projects?.some(e=>e.id===I)?I:``;(0,X.useEffect)(()=>{d&&I&&!R&&L(``)},[d,I,R]);let Ee=()=>{we(``),P([]),Te([]),L(``)},z=Dt(M,Tt),B=(0,X.useMemo)(()=>d?.available?e===`issues`?d.issues:d.prs:[],[d,e]),De=(0,X.useMemo)(()=>ct(B,{query:z,labels:N,...e===`issues`?{assignees:F,projectId:R}:{}}),[B,z,N,e,F,R]),V=M.trim()===z.trim(),H=d?.available===!0&&V&&lt(z,De),U=de(e===`issues`?`issue`:`pr`,z,H),Oe=B,W=ct(Oe,{query:M,labels:N,...e===`issues`?{assignees:F,projectId:R}:{}}),Me=e===`issues`&&r!==void 0&&!j,Ne=M.trim()!==``||N.length>0||e===`issues`&&(F.length>0||R!==``),K=H&&U.data?.available?U.data:null,Pe=new Set(W.map(e=>e.number)),Fe=e===`issues`&&K?R&&K.items.some(e=>e.projectIds===void 0)?K.projectsReason??`Project board data is incomplete. Refresh to try again.`:F.length&&K.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null,q=K&&!Fe?ct(K.items,{labels:N,...e===`issues`?{assignees:F,projectId:R}:{}}).filter(e=>!Pe.has(e.number)):[],Le=O.github()[0],J=r===void 0?null:Number.parseInt(r,10),Re=U.data?.available?U.data.items.find(e=>e.number===J):void 0,[Y,ze]=(0,X.useState)(null);(0,X.useEffect)(()=>{Re&&ze({scope:Le,view:e,item:Re})},[Le,e,Re]);let Be=Re??(Y?.scope===Le&&Y.view===e&&Y.item.number===J?Y.item:null),He=(()=>{if(!d?.available||e!==`prs`)return[];let t=new Set;J!==null&&Number.isInteger(J)&&t.add(J);for(let e of[...q,...d.prs]){if(t.size>=wt)break;t.add(e.number)}return[...t]})(),Ue=se(He,e===`prs`),We=Ue.data?.available?Ue.data.checks:void 0;if(n&&C.data?.githubView===`prs`)return(0,Z.jsx)(ke,{to:`/github/prs`,replace:!0});if(!d)return s.isError?(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(D,{icon:(0,Z.jsx)(f,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:s.error.message})}):(0,Z.jsx)(Ve,{});if(y.current=null,!d.available)return(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(D,{icon:(0,Z.jsx)(fe,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:d.reason??`unknown reason`,actions:(0,Z.jsx)(E,{variant:`outline`,"data-action":`gh-retry`,disabled:b.isPending,onClick:()=>b.mutate(),children:`Try again`}),children:(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let Ke=M.trim()!==``&&!V||H&&U.isPending,qe={...K?.labelColors??{},...d.labelColors??{}},Je=st([...Oe,...K?.items??[]]),Q=r===void 0?null:Number.parseInt(r,10),$=Q===null?W[0]??q[0]??null:Oe.find(e=>e.number===Q)??Be??null;y.current=$?{kind:$.kind,number:$.number}:null;let Qe=e===`issues`?`/github`:`/github/prs`,$e=H&&(U.data?.available===!1||U.isError),et=U.data?.available===!1?U.data.reason??`unknown reason`:U.error instanceof Error?U.error.message:`the search request failed`,tt=Ne?Ke?(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,M.trim(),`”…`]}):$e?q.length>0?(0,Z.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,et,`. Use Refresh to try again.`]}):W.length>0?(0,Z.jsxs)(`p`,{children:[`GitHub could not be searched: `,et,`.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,et,`.`]}):Fe?(0,Z.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,Fe]}):q.length>0?null:K?.truncated?(0,Z.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):K&&W.length>0?(0,Z.jsxs)(`p`,{children:[`No additional `,e===`issues`?`issues`:`pull requests`,` match your filter on GitHub.`]}):K?(0,Z.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,Z.jsxs)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col gap-3 px-[18px] pt-[18px] pb-[calc(90px+env(safe-area-inset-bottom))] md:gap-[22px] md:p-9`,children:[(0,Z.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 md:gap-[22px]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:`GitHub`}),d.repo?(0,Z.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground`,children:[(0,Z.jsx)(`span`,{"data-slot":`gh-repo`,children:d.repo}),(0,Z.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,d.syncedAt?`Synced ${G(d.syncedAt)} ago`:`Not synced yet`]})]}):null]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(Ge,{to:`/github`,active:e===`issues`,onClick:()=>v(`issues`),children:[`Issues · `,kt(d.issues.length)]}),(0,Z.jsxs)(Ge,{to:`/github/prs`,active:e===`prs`,onClick:()=>v(`prs`),children:[`Pull requests · `,kt(d.prs.length)]}),l?(0,Z.jsx)(Ae,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:b.isPending,onClick:()=>b.mutate(),className:`gh-utility`,children:[(0,Z.jsx)(u,{size:16,"aria-hidden":`true`,className:A(`size-3.5`,b.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Z.jsx)(m,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Z.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:M,onChange:e=>we(e.target.value),className:`min-h-11 w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Z.jsx)(jt,{options:Je,colors:qe,selected:N,onChange:P}),e===`issues`?(0,Z.jsx)(ot,{data:{...d,issues:[...d.issues,...K?.items??[]]},assignees:F,projectId:R,onAssigneesChange:Te,onProjectChange:L}):null,(0,Z.jsx)(`button`,{type:`button`,disabled:!Ne,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:Ee,children:`Clear filters`})]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row`,children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-list`,"data-mobile-preview":Me||void 0,style:{"--github-list-width":`${me}px`},className:`relative flex w-full min-h-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0`,children:[W.length===0?tt&&(0,Z.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):(0,Z.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-1`,children:W.map((t,n)=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,compactHidden:Me&&n>=2&&$?.url!==t.url,queued:Se.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))}),e===`issues`&&r!==void 0&&W.length>2?(0,Z.jsx)(E,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":j,onClick:()=>ge(e=>!e),children:j?`Show fewer issues`:`View all ${W.length} issues`}):null,W.length>0&&H&&tt?(0,Z.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):null,q.length>0?(0,Z.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Z.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,K?.truncated?` (first matches)`:``]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:q.map(t=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,queued:Se.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))})]}):null,(0,Z.jsx)(Et,{width:me,onWidthChange:_e})]}),(0,Z.jsx)(`section`,{"data-slot":`gh-detail`,className:A(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card`,r===void 0?`hidden md:flex`:`flex`),children:$?(0,Z.jsx)(Nt,{item:$,listPath:Qe,colors:qe,changes:t,checks:$.kind===`pr`?We?.[$.number]??$.checks:$.checks,children:(0,Z.jsx)(yt,{item:$,workflows:x.data?.workflows??[],skills:xe,workflow:T,onWorkflowChange:ie,selectedSkills:ae,onSkillsChange:k,engine:ce,onEngineChange:pe,queuedRunId:Se.get($.url)??null,onQueued:(e,t)=>Ce(n=>new Map(n).set(e,t))},$.url)}):(0,Z.jsx)(D,{icon:e===`issues`?(0,Z.jsx)(_,{size:16}):(0,Z.jsx)(ne,{size:16}),tone:`neutral`,heading:`h2`,title:Q===null?`Nothing selected`:`Not found`,subtitle:Q===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${Q} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${Q} above to look it up on GitHub, closed and merged included.`})})]})]})}function kt(e){return`${e}${e>=Ct?`+`:``}`}function At({item:e,view:t,colors:n,active:r,compactHidden:i,queued:a,checks:o}){let s=e.kind===`issue`?_:ne,c=g(),l=()=>{c.prefetchQuery({queryKey:O.githubComments(e.kind,e.number),queryFn:({signal:t})=>le(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Z.jsx)(`li`,{"data-compact-hidden":i||void 0,children:(0,Z.jsxs)(Ae,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Qe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:l,onFocus:l,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:A(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,r&&`bg-accent-strong/10 text-accent-text`),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,Z.jsx)(s,{"aria-hidden":`true`,className:A(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,Z.jsx)(`span`,{className:A(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,r&&`font-semibold`),children:e.title})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[10.5px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,Z.jsxs)(`span`,{children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),(0,Z.jsx)(Zt,{count:e.comments}),o?(0,Z.jsx)($t,{checks:o}):null,a?(0,Z.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Z.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e],plain:!0},e))}):null]})})}function jt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,X.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Z.jsxs)(_e,{open:i,onOpenChange:a,children:[(0,Z.jsx)(ge,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:A(`flex min-h-11 min-w-11 shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[(0,Z.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Z.jsx)(j,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Z.jsxs)(F,{children:[(0,Z.jsx)(P,{placeholder:`Filter labels…`}),(0,Z.jsxs)(L,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Z.jsx)(R,{children:`No labels.`}),n.length>0?(0,Z.jsxs)(De,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Z.jsxs)(De,{value:e,onSelect:()=>o(e),className:`min-h-11`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ut(t[e])}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}function Mt({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:ut(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function Nt({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsxs)(Ae,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Z.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:o}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsxs)(`span`,{children:[G(e.createdAt),` ago`]}),e.comments?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(Zt,{count:e.comments})]}):null,s?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,he(e.url)?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),e.kind===`pr`?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e]},e)),a?(0,Z.jsx)(Qt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,Z.jsx)(Lt,{item:e}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Z.jsx)(Rt,{item:e,colors:n})]})]}),e.kind===`pr`?(0,Z.jsx)(It,{number:e.number}):null,r]})}var Pt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Ft({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:A(t,`text-success`)}):e===`failing`?(0,Z.jsx)(k,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:A(t,`text-danger`)}):e===`pending`?(0,Z.jsx)(je,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:A(t,`animate-spin text-warning`)}):(0,Z.jsx)(r,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:A(t,`text-soft-foreground`)})}function It({number:e}){let t=g(),n=ce({queryKey:O.githubMergeState(e),queryFn:({signal:t})=>s(e,{},{signal:t}),retry:!1}),r=n.data?.available?n.data.mergeState:null,[a,o]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),_=i({mutationFn:()=>s(e,{refresh:!0}),onSuccess:n=>t.setQueryData(O.githubMergeState(e),n),onError:e=>w(e instanceof Error?e.message:String(e),{tone:`danger`})}),v=a&&r?.methods.includes(a)?a:r?.defaultMethod??r?.methods[0]??null,y=i({mutationFn:()=>{if(!r||!v)throw Error(`No merge method is available.`);return h(e,{method:v,expectedHeadSha:r.headSha,...p&&r.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{l(!1),w(`Pull request #${e} merged`),t.invalidateQueries({queryKey:O.githubMergeState(e)}),t.invalidateQueries({queryKey:O.github({limit:Ct})}),t.invalidateQueries({queryKey:O.githubComments(`pr`,e)})},onError:n=>{w(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:O.githubMergeState(e)})}});if(n.isPending)return(0,Z.jsx)(Je,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!r)return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:n.data?.available===!1?n.data.reason:`GitHub could not load merge requirements.`})]});let b=r.state===`merged`?`Merged`:r.state===`closed`?`Closed`:r.isDraft?`Draft`:r.mergeable===`conflicting`?`Conflicts must be resolved`:r.canMerge?`Ready to merge`:r.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`,x=r.reviewDecision===`approved`?`passing`:r.reviewDecision===`unknown`?`unknown`:`failing`,S=r.mergeable===`mergeable`?`passing`:r.mergeable===`conflicting`?`failing`:`unknown`,C=!!(v&&(r.canMerge||r.canOverride&&p));return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":r.eligibility,"data-conflicting":r.mergeable===`conflicting`?`true`:void 0,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[r.canMerge?(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Z.jsx)(f,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:b}),(0,Z.jsxs)(E,{type:`button`,variant:`ghost`,size:`sm`,disabled:_.isPending,onClick:()=>_.mutate(),children:[(0,Z.jsx)(u,{size:16,"aria-hidden":`true`,className:A(`size-3.5`,_.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[r.headRef,` (`,r.headSha.slice(0,7),`) → `,r.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:x}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,r.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:S}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,r.mergeable===`conflicting`?`present`:r.mergeable===`mergeable`?`none`:`unknown`]})]}),r.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):r.checks.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&he(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),r.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),r.mergeable===`conflicting`?(0,Z.jsx)(E,{className:`mt-4`,onClick:e=>{let t=e.currentTarget.closest(`article`)?.querySelector(`[data-slot="gh-custom-prompt"]`);t?.scrollIntoView({block:`center`}),t?.focus({preventScroll:!0})},children:`Run agent on this PR`}):null,r.canOverride?(0,Z.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,r.eligibility===`unknown`?(0,Z.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,r.state===`open`&&r.methods.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsx)(`select`,{"aria-label":`Merge method`,value:v??``,onChange:e=>o(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:r.methods.map(e=>(0,Z.jsx)(`option`,{value:e,children:Pt[e]},e))}),(0,Z.jsx)(E,{disabled:!C,onClick:()=>l(!0),children:v?Pt[v]:`Merge`})]}):null]})]}),(0,Z.jsx)(be,{open:c,onOpenChange:l,children:(0,Z.jsxs)(Se,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(xe,{children:[(0,Z.jsxs)(Ce,{children:[v?Pt[v]:`Merge`,` pull request #`,e,`?`]}),(0,Z.jsx)(ye,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,r.title,`” into `,r.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),p&&r.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),y.error?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:y.error.message}):null,(0,Z.jsxs)(ve,{children:[(0,Z.jsx)(E,{variant:`outline`,disabled:y.isPending,onClick:()=>l(!1),children:`Cancel`}),(0,Z.jsx)(E,{disabled:y.isPending,onClick:()=>y.mutate(),children:y.isPending?`Merging…`:v?Pt[v]:`Merge`})]})]})})]})}function Lt({item:e}){let t=g(),n=T(e.number),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(null),s=n.data,c=s?.available?s.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],l=c.findIndex(e=>e.path===a);(0,X.useEffect)(()=>{c.length>0&&!c.some(e=>e.path===a)&&o(c[0].path)},[s?.available?s.headSha:``,r]);let u=async()=>{let n=s?.available?s.headSha:null,r=await y(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(o(r.files[0]?.path??null),w(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!s)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!s.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:s.reason});let d=c.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??``})),f=he(e.url)?`${e.url}/files`:null,p=c.find(e=>e.path===a);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[s.files.length,` changed files`]}),(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,s.additions]}),(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,s.deletions]}),(0,Z.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:s.headSha,children:[`head `,s.headSha.slice(0,8)]}),(0,Z.jsx)(E,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void u(),children:`Refresh`})]}),s.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[s.reason??`This response is incomplete.`,` `,f?(0,Z.jsx)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>i(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:a??``,onChange:e=>o(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:c.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:c.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:A(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,a===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(E,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:l<=0,onClick:()=>o(c[l-1]?.path??null),children:(0,Z.jsx)(Ke,{})}),(0,Z.jsx)(E,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:l<0||l>=c.length-1,onClick:()=>o(c[l+1]?.path??null),children:(0,Z.jsx)(x,{size:16})})]}),c.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(We,{files:d.filter(e=>e.path===a),wrap:!0,className:`min-w-0`}),p&&!p.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,p.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Rt({item:e,colors:t}){let n=pe(e.kind,e.number),r=n.data,i=(0,X.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(zt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(Je,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(Je,{className:`h-14 w-full`}),(0,Z.jsx)(Je,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Bt(i).map(e=>e.group===`commits`?(0,Z.jsx)(Vt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(qt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Ut,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var zt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Bt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Vt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Ut,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e[e.length-1].createdAt)})]})})}var Ht={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Ut({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:A(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Ht[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Wt,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e.createdAt)}),e.url?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Wt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Gt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:ut(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Z.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Z.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Z.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Z.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Gt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:A(`shrink-0`,Xt[e]),children:Yt[e]}):null}var Kt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function qt({comment:e}){let t=e.reviewState?Kt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Z.jsx)(Jt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:A(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Jt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Yt={passing:`✓`,failing:`✗`,pending:`○`},Xt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Zt({count:e}){return e?(0,Z.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Z.jsx)(Me,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Qt({checks:e,url:t}){let n=A(`text-[11px] font-medium`,Xt[e],t&&`hover:underline`),r=`${Yt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function $t({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:A(`shrink-0 font-sans text-[11px] font-semibold`,Xt[e]),children:Yt[e]})}export{Ot as GithubRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{$ as r,Ca as i,Ci as a,Cn as o,Ei as s,Gi as c,Ht as l,It as u,J as d,Jt as f,La as p,Lt as m,Ni as h,Oa as g,Q as _,Qt as v,Ti as y,U as b,X as x,Xt as S,Y as C,_n as ee,_r as te,aa as w,bn as T,bt as ne,d as E,dr as re,en as ie,l as D,mi as ae,mr as oe,rn as O,tt as k,vn as se,wa as ce,wi as le,xa as ue,xn as de,xt as fe,yn as pe}from"./alert-dialog-KUiPIBmb.js";import{d as me,n as he,t as A}from"./utils-CG8vWc5K.js";import{a as j,o as ge,r as _e}from"./agent-accounts-MT-jtwOU.js";import{a as ve,i as ye,n as be,o as xe,r as Se,s as Ce,t as M}from"./textarea-DdKiIORK.js";import{t as we}from"./createLucideIcon-BHp8sXmF.js";import{t as N}from"./external-link-BE6y205O.js";import{A as P,E as F,F as Te,I,M as L,O as R,a as Ee,c as z,d as B,j as De,k as V,n as H,o as U,r as Oe,s as W}from"./prompt-templates-DTSPmJP-.js";import{r as ke,t as Ae,u as je}from"./project-router-BOglfKgF.js";import{t as Me}from"./message-square-B-MD-8rD.js";import{r as G,t as Ne}from"./markdown-CIi0LXvU.js";import{d as K,f as Pe,i as Fe,s as Ie,t as q,u as Le}from"./skills-DFBiAuJG.js";import{n as J,t as Re}from"./use-submit-shortcut-KWJsC906.js";import{d as Y,f as ze,l as Be,p as Ve,s as He,u as Ue}from"./index-ujHRHX5o.js";import{t as We}from"./diff-C4aSZfrQ2.js";import{t as Ge}from"./tab-link-ChqeHA8K.js";var Ke=we(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),qe=we(`tag`,[[`path`,{d:`M12.586 2.586A2 2 0 0 0 11.172 2H4a2 2 0 0 0-2 2v7.172a2 2 0 0 0 .586 1.414l8.704 8.704a2.426 2.426 0 0 0 3.42 0l6.58-6.58a2.426 2.426 0 0 0 0-3.42z`,key:`vktsd0`}],[`circle`,{cx:`7.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`kqv944`}]]),X=e(t(),1),Z=n();function Je({className:e,...t}){return(0,Z.jsx)(`div`,{"data-slot":`skeleton`,className:A(`animate-pulse rounded-md bg-accent`,e),...t})}var Q=`cez-github-list-width`;function Ye(e){if(e==null||e===``||typeof e==`string`&&e.trim()===``)return 360;let t=typeof e==`number`?e:Number(e);return Number.isFinite(t)?Math.min(520,Math.max(280,Math.round(t))):360}function Xe(){try{let e=localStorage.getItem(Q);return e===null?360:Ye(e)}catch{return 360}}function Ze(e){try{localStorage.setItem(Q,String(Ye(e)))}catch{}}function $(e){return`${e.kind===`pr`?`Address GitHub pull request`:`Fix GitHub issue`} #${e.number}: ${e.title}\n\n${e.url}`}function Qe(e,t=[]){let n=$(e);return e.body?.trim()&&(n+=`\n\n---\n\n${e.body.trim()}`),t.length&&(n+=$e(t)),n}function $e(e){return`\n\nUse these skills where relevant: ${e.join(`, `)}.`}function et(e,t){return e.replace(/\{\{\s*number\s*\}\}/gi,()=>`#${t.number}`).replace(/\{\{\s*title\s*\}\}/gi,()=>t.title).replace(/\{\{\s*url\s*\}\}/gi,()=>t.url)}function tt(e,t){if(e.includes(t.url))return!0;let n=t.kind===`pr`?String.raw`(?:pull\s+request|pr)`:String.raw`issue`;return new RegExp(String.raw`\b${n}\s*#?\s*${t.number}\b`,`i`).test(e)}function nt(e,t,n){let r=(n??``).trim();if(!r)return Qe(e,t);let i=$(e),a=r.startsWith(i)?i+et(r.slice(i.length),e):et(r,e),o=tt(a,e)?a:`${i}\n\n${a}`;return t.length?o+$e(t):o}function rt(e){let t=[];for(let n of e.slice(0,8)){let e=new Set(t.map(e=>e.id)),r=n;for(let t=2;e.has(r);t++)r=`${n}-${t}`;t.push({id:r,name:n,skill:n,prompt:`{{task}}`})}return t}function it(e,t,n,r,i={}){return t?{...i,workflow:t,task:nt(e,n,r)}:n.length?{...i,steps:rt(n),task:nt(e,[],r)}:{...i,workflow:`quick-task`,task:nt(e,[],r)}}var at=`min-h-11 min-w-11 rounded-md border border-input bg-card px-3 text-sm text-foreground focus-visible:outline-ring disabled:opacity-50`;function ot({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let a=new Map;for(let t of e.issues)for(let e of t.assignees??[])a.set(e.toLowerCase(),e);for(let e of t)a.set(e.toLowerCase(),e);let o=[...a.values()].sort((e,t)=>e.localeCompare(t)),s=!!e.viewerLogin&&t.length===1&&t[0]?.toLowerCase()===e.viewerLogin.toLowerCase();return(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,"data-slot":`gh-issue-filters`,children:[(0,Z.jsxs)(_e,{children:[(0,Z.jsx)(ge,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,className:at,disabled:o.length===0,children:[`Assignees`,t.length?` · ${t.length}`:``]})}),(0,Z.jsx)(j,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Z.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Z.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),o.map(e=>{let n=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,Z.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:n,onChange:()=>r(n?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Z.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]}),(0,Z.jsx)(`button`,{type:`button`,className:`${at} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":s,onClick:()=>r(s?[]:[e.viewerLogin]),children:`Assigned to me`}),e.viewerLogin?null:(0,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:`GitHub login unavailable.`}),e.projects?.length?(0,Z.jsxs)(`select`,{"aria-label":`Project board`,className:at,value:n,onChange:e=>i(e.target.value),children:[(0,Z.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,Z.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects?(0,Z.jsx)(`select`,{"aria-label":`Project board`,className:at,disabled:!0,value:``,children:(0,Z.jsx)(`option`,{value:``,children:`No boards`})}):(0,Z.jsx)(`p`,{className:`w-full text-xs text-muted-foreground`,children:e.projectsReason??`Project boards unavailable.`})]})}function st(e){let t=new Set;for(let n of e)for(let e of n.labels)t.add(e);return[...t].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase()))}function ct(e,t={}){let n=(t.query??``).trim().toLowerCase(),r=t.labels??[],i=n.replace(/^#/,``),a=i!==``&&/^\d+$/.test(i);return e.filter(e=>r.length>0&&!r.every(t=>e.labels.includes(t))||t.assignees?.length&&!e.assignees?.some(e=>t.assignees.some(t=>t.toLowerCase()===e.toLowerCase()))||t.projectId&&!e.projectIds?.includes(t.projectId)?!1:n===``?!0:a?String(e.number).includes(i):`#${e.number} ${e.title} ${e.author} ${e.body}`.toLowerCase().includes(n))}function lt(e,t){let n=e.trim();if(n===``)return!1;let r=n.replace(/^#/,``);return/^\d+$/.test(r)?!t.some(e=>e.number===Number(r)):t.length===0}function ut(e){if(!e||!/^[0-9a-fA-F]{6}$/.test(e))return{borderColor:`var(--border)`,color:`var(--muted-foreground)`};let t=`#${e}`;return{backgroundColor:`${t}22`,borderColor:`${t}66`,color:`color-mix(in srgb, ${t} 50%, var(--foreground))`}}var dt={workflow:null,skills:[]},ft=`cez-followup-selection`;function pt(e){let t=e&&typeof e==`object`?e:{};return{workflow:typeof t.workflow==`string`?t.workflow:null,skills:Array.isArray(t.skills)?t.skills.filter(e=>typeof e==`string`):[]}}function mt(){try{let e=localStorage.getItem(ft);return e?pt(JSON.parse(e)):{...dt}}catch{return{...dt}}}function ht(e){try{localStorage.setItem(ft,JSON.stringify(e))}catch{}}var gt=`cez-followup-prompt:`;function _t(e){try{return localStorage.getItem(gt+e)??``}catch{return``}}function vt(e,t){try{t===``?localStorage.removeItem(gt+e):localStorage.setItem(gt+e,t)}catch{}}function yt({item:e,workflows:t,skills:n,workflow:r,onWorkflowChange:a,selectedSkills:o,onSkillsChange:s,engine:l,onEngineChange:u,queuedRunId:f,onQueued:p}){let m=g(),h=oe(),_=e.kind===`pr`?`PR`:`issue`,v=o.filter(e=>n.some(t=>t.name===e)),[y]=(0,X.useState)(()=>$(e)),[b,x]=(0,X.useState)(()=>_t(e.url)||y),S=ze(l),C=(0,X.useRef)(null),ee=(0,X.useRef)(null);(0,X.useEffect)(()=>{vt(e.url,b===y?``:b)},[e.url,b,y]);let te=(0,X.useMemo)(()=>Ee(h.data?.promptTemplates),[h.data?.promptTemplates]),T=e=>{let t=C.current,n=W({prompt:b,base:y,selectionStart:t?.selectionStart??null,focused:document.activeElement===t,remembered:ee.current}),r=Oe(b,n,e);x(r.text),ee.current=r.caret,requestAnimationFrame(()=>{C.current?.focus(),C.current?.setSelectionRange(r.caret,r.caret)})},ne=H(te,v),re=(0,X.useRef)(b);re.current=b;let D=(0,X.useRef)(``);(0,X.useEffect)(()=>{let e=U(re.current,D.current,ne,y);D.current=e.applied,e.text!==re.current&&x(e.text)},[ne,y]);let k=i({mutationFn:async()=>S.canRun?ae(it(e,r,v,b,Y(S))):null,onSuccess:t=>{if(t===null)return;let n=`runs`in t?t.runs[0]:t;n&&p(e.url,n.id),w(`Added to the queue — ${_} #${e.number}`),v.length>0&&h.data!==void 0&&c({skillUsage:v.reduce((e,t)=>q(e,t),h.data.skillUsage)}).then(()=>m.invalidateQueries({queryKey:O.uiState})).catch(()=>{}),vt(e.url,``),x(y),D.current=``,m.invalidateQueries({queryKey:O.runs.all})},onError:e=>w(e.message,{tone:`danger`})}),se=e=>{Re({key:e.key,shiftKey:e.shiftKey,metaKey:e.metaKey,ctrlKey:e.ctrlKey,altKey:e.altKey,repeat:e.repeat,isComposing:e.nativeEvent.isComposing})&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),!k.isPending&&S.canRun&&k.mutate())},ce=e=>s(o.includes(e)?o.filter(t=>t!==e):[...o,e]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-hand`,className:`mt-7 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsx)(`h3`,{className:`text-xl font-normal text-foreground`,children:`Hand this to the agent`}),(0,Z.jsxs)(`label`,{className:`gh-field gh-prompt-field`,children:[(0,Z.jsx)(`span`,{children:`Instructions for the agent`}),(0,Z.jsx)(M,{ref:C,"data-slot":`gh-custom-prompt`,"aria-label":`Custom prompt`,"aria-keyshortcuts":`Control+Enter Meta+Enter`,value:b,onChange:e=>x(e.target.value),onSelect:e=>{ee.current=e.currentTarget.selectionStart},onKeyDown:se,placeholder:`Instructions for the agent… (#${e.number} and its link are always sent)`,className:`mt-3 min-h-20 text-[13px]`})]}),(0,Z.jsx)(Be,{templates:te,onInsert:T}),(0,Z.jsxs)(`div`,{className:`gh-handoff-settings`,children:[(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Workflow`}),(0,Z.jsx)(bt,{workflows:t,value:r,onChange:a})]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Skills · select one or more`}),(0,Z.jsx)(St,{skills:n,skillUsage:h.data?.skillUsage,selected:v,onToggle:ce})]}),v.length>0?(0,Z.jsx)(`div`,{"data-slot":`gh-skill-chips`,className:`mt-2.5 flex flex-wrap gap-1.5`,children:v.map(e=>(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skill-chip`,"data-skill":e,onClick:()=>ce(e),title:`Remove this skill`,className:`inline-flex min-h-11 items-center gap-2 rounded-lg border border-border bg-card px-3 text-xs font-medium text-foreground transition-colors hover:bg-danger/10 hover:text-danger`,children:[e,(0,Z.jsx)(ie,{size:16,"aria-hidden":`true`,className:`size-3`})]},e))}):null,(0,Z.jsxs)(`div`,{className:`gh-engine-fields`,children:[(0,Z.jsx)(Ue,{pick:l,onChange:u,disabled:k.isPending||!S.canRun,accounts:!0}),S.runners.length<=1&&!S.accounts.some(e=>e.provider===S.runner&&e.id!=="default")?(0,Z.jsxs)(`div`,{className:`gh-fixed-runner`,children:[(0,Z.jsx)(`span`,{children:`Runner`}),S.runner]}):null]}),(0,Z.jsxs)(`div`,{className:`gh-field`,children:[(0,Z.jsx)(`span`,{children:`Account`}),(0,Z.jsx)(xt,{resolved:S,disabled:k.isPending||!S.canRun,onPick:e=>u({...l,account:e})})]}),!S.providerPending&&!S.canRun?(0,Z.jsxs)(`span`,{"data-slot":`gh-provider-gate`,className:`inline-flex flex-wrap items-center gap-1 text-xs text-muted-foreground`,children:[S.providerError?`Provider authentication could not be verified.`:`Connect an agent provider to run this item.`,(0,Z.jsx)(Ae,{to:`/settings/agents#providers`,className:`font-medium text-foreground underline underline-offset-4`,children:`Configure providers`})]}):null]}),(0,Z.jsxs)(`p`,{className:`text-[11px] leading-relaxed text-muted-foreground`,children:[e.kind===`pr`?`PR`:`Issue`,` number and link remain attached to the task. Edit the prompt before starting. Cmd/Ctrl+Enter submits; Enter adds a new line.`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-handoff-actions`,className:`mt-[22px] flex flex-wrap items-center gap-2.5`,children:[he(e.url)?(0,Z.jsx)(E,{asChild:!0,variant:`outline`,children:(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:`Open in GitHub`})}):null,(0,Z.jsxs)(E,{variant:`primary`,"data-action":`gh-run`,disabled:k.isPending||!S.canRun,onClick:()=>k.mutate(),children:[(0,Z.jsx)(Te,{"aria-hidden":`true`,className:`size-3.5`}),`Run agent on this `,_]}),(0,Z.jsx)(`kbd`,{"aria-hidden":`true`,className:`rounded-[5px] border border-b-2 border-border bg-card px-[5px] py-px font-mono text-[10.5px] font-medium text-muted-foreground`,children:J()}),f?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`span`,{"data-slot":`gh-queued`,className:`flex items-center gap-1 text-xs font-medium text-success`,children:[(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`queued`]}),(0,Z.jsx)(Ae,{to:`/tasks/${f}`,"data-slot":`gh-view-run`,className:`text-xs font-semibold text-accent-text hover:underline`,children:`View task →`})]}):null]})]})}function bt({workflows:e,value:t,onChange:n}){let[r,i]=(0,X.useState)(!1),[a,o]=(0,X.useState)(``),s=(0,X.useRef)(null),c=K(e,a);return(0,Z.jsxs)(_e,{open:r,onOpenChange:e=>{i(e),e||o(``)},children:[(0,Z.jsx)(ge,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-workflow-trigger`,"aria-label":`Choose a workflow`,className:A(B,t&&`border-foreground/60 font-mono text-[11.5px] font-semibold text-foreground`),children:[(0,Z.jsx)(v,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),(0,Z.jsx)(`span`,{className:`min-w-0 max-w-44 truncate`,children:t??`workflow`}),(0,Z.jsx)(C,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(j,{align:`start`,sideOffset:8,className:`w-[320px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(F,{shouldFilter:!1,children:[(0,Z.jsx)(P,{placeholder:`search workflows…`,value:a,onValueChange:o,onInput:()=>s.current?.scrollTo(0,0)}),(0,Z.jsxs)(L,{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,Z.jsx)(R,{children:`Nothing matches.`}):null,(0,Z.jsx)(V,{children:c.map(e=>{let r=t===e.name;return(0,Z.jsxs)(De,{value:`workflow ${e.name}`,keywords:Pe(e.name,e.description),"data-slot":`gh-workflow-option`,"data-workflow":e.name,onSelect:()=>{n(r?null:e.name),i(!1)},children:[(0,Z.jsx)(`span`,{className:`shrink-0 font-mono text-xs`,children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,r?(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:`ml-auto size-3.5 shrink-0 text-link-foreground`}):null]},e.name)})})]})]})})]})}function xt({resolved:e,disabled:t,onPick:n}){let r=e.accounts.filter(t=>t.provider===e.runner),i=[...r.some(e=>e.id==="default")?[]:[{value:me,label:`Default`}],...r.map(e=>({value:e.id,label:e.label,desc:e.configDir}))],a=e.account??e.repoAccount?.[e.runner]??`default`;return(0,Z.jsx)(z,{icon:(0,Z.jsx)(S,{"aria-hidden":`true`,className:`size-[18px] shrink-0 text-accent-text`}),slot:`account-pill`,ariaLabel:`Account`,label:i.find(e=>e.value===a)?.label??`Default`,value:a,options:i,disabled:t,onPick:n})}function St({skills:e,skillUsage:t,selected:n,onToggle:r}){let[i,a]=(0,X.useState)(!1),[o,s]=(0,X.useState)(``),[c,u]=(0,X.useState)(null),f=(0,X.useRef)(null),{mostUsed:p,project:m,global:h,ranked:g}=Le(e,o,t),_=(e,t)=>{let i=n.includes(e.name);return(0,Z.jsxs)(De,{value:`skill ${e.name} ${e.path}`,keywords:Pe(e.name,e.description),"data-slot":`gh-skill-option`,"data-skill":e.name,"data-selected":i?`true`:void 0,onSelect:()=>r(e.name),children:[(0,Z.jsx)(`span`,{className:A(`shrink-0 font-mono text-xs`,t&&`font-semibold`),children:e.name}),e.description?(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-xs text-soft-foreground`,children:e.description}):null,(0,Z.jsx)(`button`,{type:`button`,"data-slot":`gh-skill-view`,"aria-label":`View skill ${e.name}`,title:`View skill`,onClick:t=>{t.preventDefault(),t.stopPropagation(),u(e)},className:`ml-auto shrink-0 rounded-sm p-0.5 text-soft-foreground transition-colors hover:text-foreground`,children:(0,Z.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`})}),i?(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e.path)};return e.length===0?null:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(He,{skill:c,onClose:()=>u(null)}),(0,Z.jsxs)(_e,{open:i,onOpenChange:e=>{a(e),e||s(``)},children:[(0,Z.jsx)(ge,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-skills-trigger`,"aria-label":`Choose skills`,className:A(B,n.length>0&&`border-foreground/60 font-semibold text-foreground`),children:[(0,Z.jsx)(l,{size:16,"aria-hidden":`true`,className:`size-3 shrink-0 text-accent-icon`}),`skills`,n.length>0?` · ${n.length}`:``,(0,Z.jsx)(C,{size:16,"aria-hidden":`true`,className:`size-2.5 shrink-0 text-soft-foreground`})]})}),(0,Z.jsx)(j,{align:`start`,sideOffset:8,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,children:(0,Z.jsxs)(F,{shouldFilter:!1,children:[(0,Z.jsx)(P,{placeholder:`search skills…`,value:o,onValueChange:s,onInput:()=>f.current?.scrollTo(0,0)}),(0,Z.jsxs)(L,{ref:f,"data-slot":`gh-skill-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(g?g.length===0:p.length===0&&m.length===0&&h.length===0)?(0,Z.jsx)(R,{children:`Nothing matches.`}):null,g?g.length>0?(0,Z.jsx)(V,{children:g.map(e=>_(e,Fe(e)))}):null:(0,Z.jsxs)(Z.Fragment,{children:[p.length>0?(0,Z.jsx)(V,{heading:`Most used`,children:p.map(e=>_(e,Fe(e)))}):null,m.length>0?(0,Z.jsx)(V,{heading:`Project skills`,children:m.map(e=>_(e,!0))}):null,h.length>0?(0,Z.jsx)(V,{heading:`Global`,children:h.map(e=>_(e,!1))}):null]})]})]})})]})]})}var Ct=1e3,wt=100,Tt=350;function Et({width:e,onWidthChange:t}){let n=(0,X.useRef)(null),r=t=>{t.button===0&&(n.current={x:t.clientX,width:e},t.currentTarget.setPointerCapture(t.pointerId),t.preventDefault(),t.currentTarget.focus())},i=e=>{let r=n.current;r&&t(Ye(r.width+(e.clientX-r.x)))},a=e=>{n.current&&(n.current=null,e.currentTarget.hasPointerCapture(e.pointerId)&&e.currentTarget.releasePointerCapture(e.pointerId))};return(0,Z.jsx)(`div`,{"data-slot":`gh-list-resize-handle`,role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize the GitHub list`,"aria-valuenow":e,"aria-valuemin":280,"aria-valuemax":520,tabIndex:0,onPointerDown:r,onPointerMove:i,onPointerUp:a,onPointerCancel:a,onKeyDown:n=>{let r=n.key===`ArrowLeft`?e-16:n.key===`ArrowRight`?e+16:n.key===`Home`?280:n.key===`End`?520:null;r!==null&&(n.preventDefault(),t(Ye(r)))},onDoubleClick:()=>t(360),title:`Drag to resize the GitHub list — double-click to reset`,className:`absolute inset-y-0 -right-[2px] z-20 hidden w-[5px] cursor-col-resize touch-none bg-transparent transition-colors hover:bg-accent-strong/40 focus-visible:bg-accent-strong/60 focus-visible:outline-none md:block`})}function Dt(e,t){let[n,r]=(0,X.useState)(e);return(0,X.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function Ot({view:e,changes:t=!1,index:n=!1}){let{n:r}=ue(),s=ee({limit:Ct}),l=o().data?.capabilities?.automations===!0,d=s.data,h=g(),v=e=>{h.setQueryData(O.uiState,t=>({...t,githubView:e})),c({githubView:e}).then(e=>h.setQueryData(O.uiState,e)).catch(e=>{w(e instanceof Error?e.message:String(e),{tone:`danger`}),h.invalidateQueries({queryKey:O.uiState})})},y=(0,X.useRef)(null),b=i({mutationFn:()=>a({refresh:!0,limit:Ct}),onSuccess:t=>{h.setQueryData(O.github({limit:Ct}),t),h.invalidateQueries({queryKey:O.githubChecks(He)}),h.invalidateQueries({queryKey:O.githubSearch(e===`issues`?`issue`:`pr`,z)});let n=y.current;if(!n){h.removeQueries({queryKey:[`github`,`comments`]});return}let r=O.githubComments(n.kind,n.number);le(n.kind,n.number,{refresh:!0}).then(e=>h.setQueryData(r,e)).catch(()=>{}),h.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==p(r)})},onError:e=>w(e.message,{tone:`danger`})}),x=te(),S=re(),C=oe(),[T,ie]=(0,X.useState)(()=>mt().workflow),[ae,k]=(0,X.useState)(()=>mt().skills),[ce,pe]=(0,X.useState)({runner:null,model:null,effort:null,account:null}),[me,he]=(0,X.useState)(Xe),[j,ge]=(0,X.useState)(!1),_e=e=>{let t=Ye(e);he(t),Ze(t)};(0,X.useEffect)(()=>{ht({workflow:T,skills:[...ae]})},[T,ae]);let ve=x.data?.workflows;(0,X.useEffect)(()=>{ve&&T!==null&&!ve.some(e=>e.name===T)&&ie(null)},[ve,T]);let ye=S.data,be=C.data?.skillUsage,xe=(0,X.useMemo)(()=>Ie(ye??[],be),[ye,be]),[Se,Ce]=(0,X.useState)(new Map),[M,we]=(0,X.useState)(``),[N,P]=(0,X.useState)([]),[F,Te]=(0,X.useState)([]),[I,L]=(0,X.useState)(``),R=d?.projects?.some(e=>e.id===I)?I:``;(0,X.useEffect)(()=>{d&&I&&!R&&L(``)},[d,I,R]);let Ee=()=>{we(``),P([]),Te([]),L(``)},z=Dt(M,Tt),B=(0,X.useMemo)(()=>d?.available?e===`issues`?d.issues:d.prs:[],[d,e]),De=(0,X.useMemo)(()=>ct(B,{query:z,labels:N,...e===`issues`?{assignees:F,projectId:R}:{}}),[B,z,N,e,F,R]),V=M.trim()===z.trim(),H=d?.available===!0&&V&&lt(z,De),U=de(e===`issues`?`issue`:`pr`,z,H),Oe=B,W=ct(Oe,{query:M,labels:N,...e===`issues`?{assignees:F,projectId:R}:{}}),Me=e===`issues`&&r!==void 0&&!j,Ne=M.trim()!==``||N.length>0||e===`issues`&&(F.length>0||R!==``),K=H&&U.data?.available?U.data:null,Pe=new Set(W.map(e=>e.number)),Fe=e===`issues`&&K?R&&K.items.some(e=>e.projectIds===void 0)?K.projectsReason??`Project board data is incomplete. Refresh to try again.`:F.length&&K.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null,q=K&&!Fe?ct(K.items,{labels:N,...e===`issues`?{assignees:F,projectId:R}:{}}).filter(e=>!Pe.has(e.number)):[],Le=O.github()[0],J=r===void 0?null:Number.parseInt(r,10),Re=U.data?.available?U.data.items.find(e=>e.number===J):void 0,[Y,ze]=(0,X.useState)(null);(0,X.useEffect)(()=>{Re&&ze({scope:Le,view:e,item:Re})},[Le,e,Re]);let Be=Re??(Y?.scope===Le&&Y.view===e&&Y.item.number===J?Y.item:null),He=(()=>{if(!d?.available||e!==`prs`)return[];let t=new Set;J!==null&&Number.isInteger(J)&&t.add(J);for(let e of[...q,...d.prs]){if(t.size>=wt)break;t.add(e.number)}return[...t]})(),Ue=se(He,e===`prs`),We=Ue.data?.available?Ue.data.checks:void 0;if(n&&C.data?.githubView===`prs`)return(0,Z.jsx)(ke,{to:`/github/prs`,replace:!0});if(!d)return s.isError?(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(D,{icon:(0,Z.jsx)(f,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:s.error.message})}):(0,Z.jsx)(Ve,{});if(y.current=null,!d.available)return(0,Z.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Z.jsx)(D,{icon:(0,Z.jsx)(fe,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:d.reason??`unknown reason`,actions:(0,Z.jsx)(E,{variant:`outline`,"data-action":`gh-retry`,disabled:b.isPending,onClick:()=>b.mutate(),children:`Try again`}),children:(0,Z.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Z.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in cezar works without it.`]})})});let Ke=M.trim()!==``&&!V||H&&U.isPending,qe={...K?.labelColors??{},...d.labelColors??{}},Je=st([...Oe,...K?.items??[]]),Q=r===void 0?null:Number.parseInt(r,10),$=Q===null?W[0]??q[0]??null:Oe.find(e=>e.number===Q)??Be??null;y.current=$?{kind:$.kind,number:$.number}:null;let Qe=e===`issues`?`/github`:`/github/prs`,$e=H&&(U.data?.available===!1||U.isError),et=U.data?.available===!1?U.data.reason??`unknown reason`:U.error instanceof Error?U.error.message:`the search request failed`,tt=Ne?Ke?(0,Z.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Z.jsx)(je,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,M.trim(),`”…`]}):$e?q.length>0?(0,Z.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,et,`. Use Refresh to try again.`]}):W.length>0?(0,Z.jsxs)(`p`,{children:[`GitHub could not be searched: `,et,`.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter, and GitHub could not be searched: `,et,`.`]}):Fe?(0,Z.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,Fe]}):q.length>0?null:K?.truncated?(0,Z.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):K&&W.length>0?(0,Z.jsxs)(`p`,{children:[`No additional `,e===`issues`?`issues`:`pull requests`,` match your filter on GitHub.`]}):K?(0,Z.jsxs)(`p`,{children:[`No `,e===`issues`?`issues`:`pull requests`,` match your filter — open, closed or merged.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,` match your filter.`]}):(0,Z.jsxs)(`p`,{children:[`No open `,e===`issues`?`issues`:`pull requests`,`.`]});return(0,Z.jsxs)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col gap-3 px-[18px] pt-[18px] pb-[calc(90px+env(safe-area-inset-bottom))] md:gap-[22px] md:p-9`,children:[(0,Z.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 md:gap-[22px]`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,Z.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[30px]`,children:`GitHub`}),d.repo?(0,Z.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground`,children:[(0,Z.jsx)(`span`,{"data-slot":`gh-repo`,children:d.repo}),(0,Z.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,d.syncedAt?`Synced ${G(d.syncedAt)} ago`:`Not synced yet`]})]}):null]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Z.jsxs)(Ge,{to:`/github`,active:e===`issues`,onClick:()=>v(`issues`),children:[`Issues · `,kt(d.issues.length)]}),(0,Z.jsxs)(Ge,{to:`/github/prs`,active:e===`prs`,onClick:()=>v(`prs`),children:[`Pull requests · `,kt(d.prs.length)]}),l?(0,Z.jsx)(Ae,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:b.isPending,onClick:()=>b.mutate(),className:`gh-utility`,children:[(0,Z.jsx)(u,{size:16,"aria-hidden":`true`,className:A(`size-3.5`,b.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Z.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Z.jsx)(m,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute top-1/2 left-2 size-3.5 -translate-y-1/2 text-soft-foreground`}),(0,Z.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:`Search #id, title, author…`,value:M,onChange:e=>we(e.target.value),className:`min-h-11 w-full rounded-md border border-input bg-card py-1 pr-2 pl-7 text-[13px] outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50`})]}),(0,Z.jsx)(jt,{options:Je,colors:qe,selected:N,onChange:P}),e===`issues`?(0,Z.jsx)(ot,{data:{...d,issues:[...d.issues,...K?.items??[]]},assignees:F,projectId:R,onAssigneesChange:Te,onProjectChange:L}):null,(0,Z.jsx)(`button`,{type:`button`,disabled:!Ne,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:Ee,children:`Clear filters`})]})]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-panes`,className:`flex min-h-0 min-w-0 flex-1 flex-col items-start gap-[22px] md:flex-row`,children:[(0,Z.jsxs)(`section`,{"data-slot":`gh-list`,"data-mobile-preview":Me||void 0,style:{"--github-list-width":`${me}px`},className:`relative flex w-full min-h-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0`,children:[W.length===0?tt&&(0,Z.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):(0,Z.jsx)(`ul`,{"data-slot":`gh-rows`,className:`flex flex-col gap-1`,children:W.map((t,n)=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,compactHidden:Me&&n>=2&&$?.url!==t.url,queued:Se.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))}),e===`issues`&&r!==void 0&&W.length>2?(0,Z.jsx)(E,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":j,onClick:()=>ge(e=>!e),children:j?`Show fewer issues`:`View all ${W.length} issues`}):null,W.length>0&&H&&tt?(0,Z.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:tt}):null,q.length>0?(0,Z.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Z.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,K?.truncated?` (first matches)`:``]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:q.map(t=>(0,Z.jsx)(At,{item:t,view:e,colors:qe,active:$?.url===t.url,queued:Se.has(t.url),checks:t.kind===`pr`?We?.[t.number]??t.checks:t.checks},t.url))})]}):null,(0,Z.jsx)(Et,{width:me,onWidthChange:_e})]}),(0,Z.jsx)(`section`,{"data-slot":`gh-detail`,className:A(`w-full min-w-0 min-h-0 flex-1 flex-col rounded-lg border border-border bg-card`,r===void 0?`hidden md:flex`:`flex`),children:$?(0,Z.jsx)(Nt,{item:$,listPath:Qe,colors:qe,changes:t,checks:$.kind===`pr`?We?.[$.number]??$.checks:$.checks,children:(0,Z.jsx)(yt,{item:$,workflows:x.data?.workflows??[],skills:xe,workflow:T,onWorkflowChange:ie,selectedSkills:ae,onSkillsChange:k,engine:ce,onEngineChange:pe,queuedRunId:Se.get($.url)??null,onQueued:(e,t)=>Ce(n=>new Map(n).set(e,t))},$.url)}):(0,Z.jsx)(D,{icon:e===`issues`?(0,Z.jsx)(_,{size:16}):(0,Z.jsx)(ne,{size:16}),tone:`neutral`,heading:`h2`,title:Q===null?`Nothing selected`:`Not found`,subtitle:Q===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${Q} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${Q} above to look it up on GitHub, closed and merged included.`})})]})]})}function kt(e){return`${e}${e>=Ct?`+`:``}`}function At({item:e,view:t,colors:n,active:r,compactHidden:i,queued:a,checks:o}){let s=e.kind===`issue`?_:ne,c=g(),l=()=>{c.prefetchQuery({queryKey:O.githubComments(e.kind,e.number),queryFn:({signal:t})=>le(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Z.jsx)(`li`,{"data-compact-hidden":i||void 0,children:(0,Z.jsxs)(Ae,{to:`${t===`issues`?`/github/issues`:`/github/prs`}/${e.number}`,draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Qe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:l,onFocus:l,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":r?`page`:void 0,title:`Drag into the composer to prefill a task`,className:A(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,r&&`bg-accent-strong/10 text-accent-text`),children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,Z.jsx)(s,{"aria-hidden":`true`,className:A(`mt-0.5 size-3.5 shrink-0 md:mt-0`,e.kind===`issue`?`text-success`:`text-accent-icon`)}),(0,Z.jsx)(`span`,{className:A(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,r&&`font-semibold`),children:e.title})]}),(0,Z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[10.5px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,Z.jsxs)(`span`,{children:[`#`,e.number]}),(0,Z.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),(0,Z.jsx)(Zt,{count:e.comments}),o?(0,Z.jsx)($t,{checks:o}):null,a?(0,Z.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Z.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e],plain:!0},e))}):null]})})}function jt({options:e,colors:t,selected:n,onChange:r}){let[i,a]=(0,X.useState)(!1),o=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Z.jsxs)(_e,{open:i,onOpenChange:a,children:[(0,Z.jsx)(ge,{asChild:!0,children:(0,Z.jsxs)(`button`,{type:`button`,"data-slot":`gh-label-filter`,disabled:e.length===0,className:A(`flex min-h-11 min-w-11 shrink-0 items-center gap-1 rounded-md border border-input bg-card px-2 py-1 text-[12px] font-medium text-muted-foreground transition-colors hover:text-foreground disabled:opacity-50`,n.length>0&&`border-accent-strong/60 text-foreground`),children:[(0,Z.jsx)(qe,{"aria-hidden":`true`,className:`size-3.5`}),n.length>0?`Labels · ${n.length}`:`Labels`]})}),(0,Z.jsx)(j,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Z.jsxs)(F,{children:[(0,Z.jsx)(P,{placeholder:`Filter labels…`}),(0,Z.jsxs)(L,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Z.jsx)(R,{children:`No labels.`}),n.length>0?(0,Z.jsxs)(De,{value:`__clear__`,onSelect:()=>r([]),className:`min-h-11 text-soft-foreground`,children:[`Clear `,n.length,` filter`,n.length>1?`s`:``]}):null,e.map(e=>{let r=n.includes(e);return(0,Z.jsxs)(De,{value:e,onSelect:()=>o(e),className:`min-h-11`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ut(t[e])}),(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}function Mt({label:e,color:t,plain:n=!1}){return(0,Z.jsx)(`span`,{"data-slot":`gh-label`,"data-label":e,style:n?void 0:ut(t),className:n?`text-[11px] font-normal text-muted-foreground`:`rounded-full border px-1.5 py-px text-[10px] font-medium`,children:e})}function Nt({item:e,listPath:t,colors:n,children:r,changes:i,checks:a}){let o=e.kind===`pr`?`pull request`:`issue`,s=e.kind===`pr`&&!!(e.additions||e.deletions);return(0,Z.jsxs)(`article`,{"data-slot":`gh-detail-inner`,className:`min-w-0 px-4 py-4 md:px-7 md:py-5`,children:[(0,Z.jsxs)(Ae,{to:t,"data-slot":`gh-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,Z.jsx)(b,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to the list`]}),(0,Z.jsxs)(`div`,{"data-slot":`gh-description-card`,className:e.kind===`pr`?`rounded-xl border border-border bg-card p-6`:void 0,children:[e.kind===`pr`?(0,Z.jsxs)(`h2`,{className:`mb-4 text-[22px] leading-snug font-normal`,children:[`#`,e.number,` `,e.title]}):null,(0,Z.jsxs)(`p`,{"data-slot":`gh-meta`,className:`flex flex-wrap items-center gap-x-1.5 font-mono text-[10.5px] text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`#`,e.number]}),`·`,(0,Z.jsx)(`span`,{children:o}),`·`,(0,Z.jsxs)(`span`,{children:[`opened by `,e.author]}),`·`,(0,Z.jsxs)(`span`,{children:[G(e.createdAt),` ago`]}),e.comments?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsx)(Zt,{count:e.comments})]}):null,s?(0,Z.jsxs)(Z.Fragment,{children:[`·`,(0,Z.jsxs)(`span`,{"data-slot":`gh-diffstat`,children:[(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions??0]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions??0]})]})]}):null,`·`,he(e.url)?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-open-link`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):(0,Z.jsx)(`span`,{"data-slot":`gh-open-link`,className:`text-muted-foreground`,children:`open on GitHub`})]}),e.kind===`pr`?null:(0,Z.jsx)(`h2`,{className:`mt-2 text-[22px] leading-snug font-normal`,children:e.title}),e.kind===`pr`?(0,Z.jsxs)(`nav`,{"aria-label":`Pull request detail`,className:`mt-4 flex border-b border-border`,children:[(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}`,active:!i,children:`Conversation`}),(0,Z.jsx)(Ge,{to:`/github/prs/${e.number}/changes`,active:i,children:`Changes`})]}):null,e.labels.length>0||a?(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-1.5`,children:[e.labels.map(e=>(0,Z.jsx)(Mt,{label:e,color:n[e]},e)),a?(0,Z.jsx)(Qt,{checks:a,url:e.url}):null]}):null,i&&e.kind===`pr`?(0,Z.jsx)(Lt,{item:e}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"data-slot":`gh-body`,className:`mt-5 text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no description)`})}),(0,Z.jsx)(Rt,{item:e,colors:n})]})]}),e.kind===`pr`?(0,Z.jsx)(It,{number:e.number}):null,r]})}var Pt={squash:`Squash and merge`,merge:`Create a merge commit`,rebase:`Rebase and merge`};function Ft({state:e}){let t=`size-4 shrink-0`;return e===`passing`?(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-passing`,className:A(t,`text-success`)}):e===`failing`?(0,Z.jsx)(k,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-failing`,className:A(t,`text-danger`)}):e===`pending`?(0,Z.jsx)(je,{"aria-hidden":`true`,"data-slot":`gh-merge-status-pending`,className:A(t,`animate-spin text-warning`)}):(0,Z.jsx)(r,{size:16,"aria-hidden":`true`,"data-slot":`gh-merge-status-unknown`,className:A(t,`text-soft-foreground`)})}function It({number:e}){let t=g(),n=ce({queryKey:O.githubMergeState(e),queryFn:({signal:t})=>s(e,{},{signal:t}),retry:!1}),r=n.data?.available?n.data.mergeState:null,[a,o]=(0,X.useState)(null),[c,l]=(0,X.useState)(!1),[p,m]=(0,X.useState)(!1),_=i({mutationFn:()=>s(e,{refresh:!0}),onSuccess:n=>t.setQueryData(O.githubMergeState(e),n),onError:e=>w(e instanceof Error?e.message:String(e),{tone:`danger`})}),v=a&&r?.methods.includes(a)?a:r?.defaultMethod??r?.methods[0]??null,y=i({mutationFn:()=>{if(!r||!v)throw Error(`No merge method is available.`);return h(e,{method:v,expectedHeadSha:r.headSha,...p&&r.canOverride?{overrideRules:!0}:{}})},onSuccess:()=>{l(!1),w(`Pull request #${e} merged`),t.invalidateQueries({queryKey:O.githubMergeState(e)}),t.invalidateQueries({queryKey:O.github({limit:Ct})}),t.invalidateQueries({queryKey:O.githubComments(`pr`,e)})},onError:n=>{w(n instanceof Error?n.message:String(n),{tone:`danger`}),t.invalidateQueries({queryKey:O.githubMergeState(e)})}});if(n.isPending)return(0,Z.jsx)(Je,{"data-slot":`gh-merge-loading`,className:`mt-6 h-32 w-full`});if(!r)return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-unavailable`,className:`mt-6 rounded-lg border border-border bg-card p-4 text-sm`,children:[(0,Z.jsx)(`p`,{className:`font-medium`,children:`Merge status unavailable`}),(0,Z.jsx)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:n.data?.available===!1?n.data.reason:`GitHub could not load merge requirements.`})]});let b=r.state===`merged`?`Merged`:r.state===`closed`?`Closed`:r.isDraft?`Draft`:r.mergeable===`conflicting`?`Conflicts must be resolved`:r.canMerge?`Ready to merge`:r.eligibility===`unknown`?`Merge blocked · Requirements unknown`:`Merge blocked`,x=r.reviewDecision===`approved`?`passing`:r.reviewDecision===`unknown`?`unknown`:`failing`,S=r.mergeable===`mergeable`?`passing`:r.mergeable===`conflicting`?`failing`:`unknown`,C=!!(v&&(r.canMerge||r.canOverride&&p));return(0,Z.jsxs)(`section`,{"data-slot":`gh-merge-box`,"data-eligibility":r.eligibility,"data-conflicting":r.mergeable===`conflicting`?`true`:void 0,"aria-live":`polite`,className:`mt-6 rounded-lg border border-border bg-card p-4`,children:[(0,Z.jsxs)(`div`,{className:`flex items-start gap-3`,children:[r.canMerge?(0,Z.jsx)(d,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-success`}):(0,Z.jsx)(f,{size:16,"aria-hidden":`true`,className:`mt-0.5 size-5 shrink-0 text-warning`}),(0,Z.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2`,children:[(0,Z.jsx)(`h3`,{className:`font-semibold`,children:b}),(0,Z.jsxs)(E,{type:`button`,variant:`ghost`,size:`sm`,disabled:_.isPending,onClick:()=>_.mutate(),children:[(0,Z.jsx)(u,{size:16,"aria-hidden":`true`,className:A(`size-3.5`,_.isPending&&`animate-spin`)}),`Refresh`]})]}),(0,Z.jsxs)(`p`,{className:`mt-1 font-mono text-[11px] text-soft-foreground`,children:[r.headRef,` (`,r.headSha.slice(0,7),`) → `,r.baseRef]}),(0,Z.jsxs)(`ul`,{className:`mt-3 space-y-2 text-xs`,children:[(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:x}),(0,Z.jsxs)(`span`,{children:[`Reviews: `,r.reviewDecision.replaceAll(`-`,` `)]})]}),(0,Z.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:S}),(0,Z.jsxs)(`span`,{children:[`Conflicts: `,r.mergeable===`conflicting`?`present`:r.mergeable===`mergeable`?`none`:`unknown`]})]}),r.checks.length===0?(0,Z.jsx)(`li`,{children:`No checks configured`}):r.checks.map(e=>(0,Z.jsxs)(`li`,{className:`flex items-center justify-between gap-3`,children:[(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,Z.jsx)(Ft,{state:e.state}),(0,Z.jsxs)(`span`,{children:[e.name,` · `,e.state,e.required===!0?` · required`:e.required===null?` · requiredness unknown`:``]})]}),e.url&&he(e.url)?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`text-muted-foreground underline`,children:`details`}):null]},e.name)),r.blockers.map(e=>(0,Z.jsx)(`li`,{className:`text-soft-foreground`,children:e.message},e.code))]}),r.mergeable===`conflicting`?(0,Z.jsx)(E,{className:`mt-4`,onClick:e=>{let t=e.currentTarget.closest(`article`)?.querySelector(`[data-slot="gh-custom-prompt"]`);t?.scrollIntoView({block:`center`}),t?.focus({preventScroll:!0})},children:`Run agent on this PR`}):null,r.canOverride?(0,Z.jsxs)(`label`,{className:`mt-4 flex cursor-pointer items-start gap-2 rounded-md border border-warning/40 bg-warning/5 p-3 text-xs`,children:[(0,Z.jsx)(`input`,{type:`checkbox`,checked:p,onChange:e=>m(e.target.checked),className:`mt-0.5 size-4 accent-accent-strong`}),(0,Z.jsxs)(`span`,{children:[(0,Z.jsx)(`span`,{className:`block font-medium`,children:`Merge without waiting for requirements`}),(0,Z.jsx)(`span`,{className:`mt-0.5 block text-soft-foreground`,children:`GitHub will allow this only if your permissions can bypass the repository rules.`})]})]}):null,r.eligibility===`unknown`?(0,Z.jsx)(`p`,{className:`mt-4 text-xs text-muted-foreground`,children:`GitHub could not confirm review and branch-protection requirements. Passing checks do not establish merge readiness.`}):null,r.state===`open`&&r.methods.length>0?(0,Z.jsxs)(`div`,{className:`mt-4 flex flex-col gap-2 sm:flex-row`,children:[(0,Z.jsx)(`select`,{"aria-label":`Merge method`,value:v??``,onChange:e=>o(e.target.value),className:`h-9 min-w-0 flex-1 rounded-md border border-input bg-background px-3 text-sm`,children:r.methods.map(e=>(0,Z.jsx)(`option`,{value:e,children:Pt[e]},e))}),(0,Z.jsx)(E,{disabled:!C,onClick:()=>l(!0),children:v?Pt[v]:`Merge`})]}):null]})]}),(0,Z.jsx)(be,{open:c,onOpenChange:l,children:(0,Z.jsxs)(Se,{"data-slot":`gh-merge-confirm`,showCloseButton:!1,children:[(0,Z.jsxs)(xe,{children:[(0,Z.jsxs)(Ce,{children:[v?Pt[v]:`Merge`,` pull request #`,e,`?`]}),(0,Z.jsx)(ye,{asChild:!0,children:(0,Z.jsxs)(`div`,{children:[(0,Z.jsxs)(`p`,{children:[`This will merge “`,r.title,`” into `,r.baseRef,`. GitHub will re-check the exact reviewed head before changing the repository.`]}),p&&r.canOverride?(0,Z.jsx)(`p`,{"data-slot":`gh-bypass-warning`,className:`mt-4 text-sm text-warning`,children:`You are asking GitHub to bypass unmet repository requirements; GitHub may refuse if your permissions do not allow it.`}):null]})})]}),y.error?(0,Z.jsx)(`p`,{className:`text-sm text-danger`,children:y.error.message}):null,(0,Z.jsxs)(ve,{children:[(0,Z.jsx)(E,{variant:`outline`,disabled:y.isPending,onClick:()=>l(!1),children:`Cancel`}),(0,Z.jsx)(E,{disabled:y.isPending,onClick:()=>y.mutate(),children:y.isPending?`Merging…`:v?Pt[v]:`Merge`})]})]})})]})}function Lt({item:e}){let t=g(),n=T(e.number),[r,i]=(0,X.useState)(``),[a,o]=(0,X.useState)(null),s=n.data,c=s?.available?s.files.filter(e=>e.path.toLowerCase().includes(r.toLowerCase())):[],l=c.findIndex(e=>e.path===a);(0,X.useEffect)(()=>{c.length>0&&!c.some(e=>e.path===a)&&o(c[0].path)},[s?.available?s.headSha:``,r]);let u=async()=>{let n=s?.available?s.headSha:null,r=await y(e.number,{refresh:!0});t.setQueryData([`github`,`pr-changes`,e.number],r),r.available&&n&&n!==r.headSha&&(o(r.files[0]?.path??null),w(`The reviewed revision changed.`))};if(n.isPending)return(0,Z.jsx)(`p`,{"aria-live":`polite`,className:`mt-6 text-sm text-muted-foreground`,children:`Loading changed files…`});if(n.isError||!s)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-danger`,children:`Changed files could not be loaded.`});if(!s.available)return(0,Z.jsx)(`p`,{className:`mt-6 text-sm text-muted-foreground`,children:s.reason});let d=c.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??``})),f=he(e.url)?`${e.url}/files`:null,p=c.find(e=>e.path===a);return(0,Z.jsxs)(`section`,{"data-slot":`gh-pr-changes`,className:`mt-5 min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-xs`,children:[(0,Z.jsxs)(`strong`,{children:[s.files.length,` changed files`]}),(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,s.additions]}),(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,s.deletions]}),(0,Z.jsxs)(`span`,{className:`font-mono text-muted-foreground`,title:s.headSha,children:[`head `,s.headSha.slice(0,8)]}),(0,Z.jsx)(E,{type:`button`,variant:`outline`,size:`sm`,className:`ml-auto min-h-11`,onClick:()=>void u(),children:`Refresh`})]}),s.truncated?(0,Z.jsxs)(`p`,{role:`status`,className:`mt-3 rounded-md border border-warning/40 bg-warning/10 p-3 text-xs`,children:[s.reason??`This response is incomplete.`,` `,f?(0,Z.jsx)(`a`,{href:f,target:`_blank`,rel:`noopener noreferrer`,className:`underline`,children:`Open all files on GitHub`}):null]}):null,(0,Z.jsxs)(`div`,{className:`mt-4 grid min-w-0 gap-4 lg:grid-cols-[240px_minmax(0,1fr)]`,children:[(0,Z.jsxs)(`aside`,{className:`min-w-0`,children:[(0,Z.jsx)(`input`,{"aria-label":`Filter changed files`,value:r,onChange:e=>i(e.target.value),placeholder:`Filter files…`,className:`min-h-11 w-full rounded-md border border-input bg-background px-3 text-sm`}),(0,Z.jsx)(`select`,{"aria-label":`Select changed file`,value:a??``,onChange:e=>o(e.target.value),className:`mt-2 min-h-11 w-full rounded-md border border-input bg-background px-2 text-sm lg:hidden`,children:c.map(e=>(0,Z.jsx)(`option`,{children:e.path},e.path))}),(0,Z.jsx)(`ul`,{className:`mt-2 hidden max-h-[60vh] overflow-auto lg:block`,children:c.map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>o(e.path),className:A(`min-h-11 w-full truncate rounded px-2 text-left text-xs`,a===e.path&&`bg-muted font-medium`),title:e.path,children:[e.status,` · `,e.path,` `,(0,Z.jsxs)(`span`,{className:`text-success`,children:[`+`,e.additions]}),` `,(0,Z.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.deletions]})]})},e.path))})]}),(0,Z.jsxs)(`div`,{className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-2 flex justify-end gap-1`,children:[(0,Z.jsx)(E,{"aria-label":`Previous file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:l<=0,onClick:()=>o(c[l-1]?.path??null),children:(0,Z.jsx)(Ke,{})}),(0,Z.jsx)(E,{"aria-label":`Next file`,variant:`outline`,size:`icon`,className:`min-h-11 min-w-11`,disabled:l<0||l>=c.length-1,onClick:()=>o(c[l+1]?.path??null),children:(0,Z.jsx)(x,{size:16})})]}),c.length===0?(0,Z.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`No changed files match this filter.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(We,{files:d.filter(e=>e.path===a),wrap:!0,className:`min-w-0`}),p&&!p.patch?(0,Z.jsxs)(`p`,{className:`rounded-b border border-border p-3 text-xs text-muted-foreground`,children:[`Patch unavailable: `,p.patchUnavailableReason??`not-provided`,`.`]}):null]})]})]})]})}function Rt({item:e,colors:t}){let n=pe(e.kind,e.number),r=n.data,i=(0,X.useMemo)(()=>{let e=[...(r?.comments??[]).map(e=>({row:`comment`,comment:e})),...(r?.events??[]).map(e=>({row:`event`,event:e}))],t=e=>{let t=Date.parse(zt(e));return Number.isNaN(t)?-1/0:t};return e.sort((e,n)=>t(e)-t(n))},[r?.comments,r?.events]);return n.isPending?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-loading`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsx)(Je,{className:`mb-3 h-3 w-24`}),(0,Z.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,Z.jsx)(Je,{className:`h-14 w-full`}),(0,Z.jsx)(Je,{className:`h-14 w-full`})]})]}):!r||!r.available?(0,Z.jsxs)(`section`,{"data-slot":`gh-thread-error`,className:`mt-6 border-t border-border pt-5 text-xs text-soft-foreground`,children:[(0,Z.jsxs)(`span`,{children:[`Couldn’t load comments — `,r?.reason??(n.error instanceof Error?n.error.message:`could not load comments`),`. `]}),(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-0.5 text-muted-foreground hover:text-foreground hover:underline`,children:[`open on GitHub`,(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]})]}):i.length===0?null:(0,Z.jsxs)(`section`,{"data-slot":`gh-thread`,className:`mt-6 border-t border-border pt-5`,children:[(0,Z.jsxs)(`h3`,{"data-slot":`gh-thread-header`,className:`mb-4 text-[11px] font-semibold tracking-wide text-soft-foreground uppercase`,children:[`Activity · `,r.comments.length,` comment`,r.comments.length===1?``:`s`]}),(0,Z.jsx)(`ul`,{className:`flex flex-col gap-5`,children:Bt(i).map(e=>e.group===`commits`?(0,Z.jsx)(Vt,{commits:e.commits,colors:t},e.commits[0].id):e.entry.row===`comment`?(0,Z.jsx)(qt,{comment:e.entry.comment},`${e.entry.comment.kind}-${e.entry.comment.id}`):(0,Z.jsx)(Ut,{event:e.entry.event,colors:t},e.entry.event.id))}),r.truncated?(0,Z.jsxs)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-thread-truncated`,className:`mt-4 inline-flex items-center gap-0.5 text-xs text-soft-foreground hover:text-foreground hover:underline`,children:[`thread truncated — open on GitHub`,(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})]}):null]})}var zt=e=>e.row===`comment`?e.comment.createdAt:e.event.createdAt;function Bt(e){let t=[],n=[],r=()=>{n.length!==0&&(n.length===1?t.push({group:`single`,entry:{row:`event`,event:n[0]}}):t.push({group:`commits`,commits:n}),n=[])};for(let i of e){if(i.row===`event`&&i.event.kind===`committed`&&i.row===`event`){let e=n[n.length-1];e&&e.actor!==i.event.actor&&r(),n.push(i.event);continue}r(),t.push({group:`single`,entry:i})}return r(),t}function Vt({commits:e,colors:t}){let[n,r]=(0,X.useState)(!1),i=e[0]?.actor??`?`;return n?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`true`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!0,onClick:()=>r(!1),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]})]})}),e.map(e=>(0,Z.jsx)(Ut,{event:e,colors:t},e.id))]}):(0,Z.jsx)(`li`,{"data-slot":`gh-commit-group`,"data-open":`false`,className:`min-w-0`,children:(0,Z.jsxs)(`button`,{type:`button`,"aria-expanded":!1,onClick:()=>r(!0),className:`flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground hover:text-foreground`,children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,children:Ht.committed}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:i}),(0,Z.jsxs)(`span`,{children:[`added `,e.length,` commits`]}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e[e.length-1].createdAt)})]})})}var Ht={committed:`⚙`,labeled:`◆`,unlabeled:`◇`,assigned:`◍`,unassigned:`◌`,merged:`⑃`,closed:`⊘`,reopened:`⊙`,head_ref_force_pushed:`↻`,"cross-referenced":`↗`,renamed:`✎`};function Ut({event:e,colors:t}){return(0,Z.jsxs)(`li`,{"data-slot":`gh-event-row`,"data-kind":e.kind,className:A(`flex min-w-0 items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,e.kind===`merged`&&`text-accent-foreground`),children:[(0,Z.jsx)(`span`,{"aria-hidden":`true`,className:`shrink-0`,children:Ht[e.kind]}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.actor}),(0,Z.jsx)(Wt,{event:e,colors:t}),(0,Z.jsx)(`span`,{className:`shrink-0`,children:G(e.createdAt)}),e.url?(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open ${e.kind} on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})}):null]})}function Wt({event:e,colors:t}){switch(e.kind){case`committed`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:`committed`}),e.sha?(0,Z.jsx)(`span`,{className:`shrink-0 text-muted-foreground`,children:e.sha.slice(0,7)}):null,e.message?(0,Z.jsx)(`span`,{className:`truncate font-sans text-foreground`,children:e.message}):null,(0,Z.jsx)(Gt,{checks:e.checks})]});case`labeled`:case`unlabeled`:return(0,Z.jsxs)(`span`,{className:`flex min-w-0 items-center gap-1.5`,children:[(0,Z.jsx)(`span`,{className:`shrink-0`,children:e.kind===`labeled`?`added the`:`removed the`}),e.label?(0,Z.jsx)(`span`,{"data-slot":`gh-event-label`,style:ut(e.label.color??t[e.label.name]),className:`max-w-[12rem] truncate rounded-full border px-1.5 py-px font-sans text-[10px]`,children:e.label.name}):null,(0,Z.jsx)(`span`,{className:`shrink-0`,children:`label`})]});case`assigned`:case`unassigned`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[e.kind===`assigned`?`assigned`:`unassigned`,` `,e.subject??`someone`]});case`merged`:return(0,Z.jsx)(`span`,{children:`merged this`});case`closed`:return(0,Z.jsx)(`span`,{children:`closed this`});case`reopened`:return(0,Z.jsx)(`span`,{children:`reopened this`});case`head_ref_force_pushed`:return(0,Z.jsx)(`span`,{children:`force-pushed`});case`renamed`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`renamed this to `,e.subject??`—`]});case`cross-referenced`:return(0,Z.jsxs)(`span`,{className:`truncate`,children:[`referenced this in `,e.refNumber?`#${e.refNumber}`:`another thread`,e.refTitle?` ${e.refTitle}`:``]})}}function Gt({checks:e}){return e?(0,Z.jsx)(`span`,{"data-slot":`gh-commit-checks`,"data-checks":e,"aria-label":`checks ${e}`,className:A(`shrink-0`,Xt[e]),children:Yt[e]}):null}var Kt={approved:{label:`approved`,tone:`border-success/40 text-success`},changes_requested:{label:`changes requested`,tone:`border-danger/40 text-danger`},commented:{label:`commented`,tone:`border-border text-muted-foreground`},dismissed:{label:`dismissed`,tone:`border-border text-muted-foreground`}};function qt({comment:e}){let t=e.reviewState?Kt[e.reviewState]:null;return(0,Z.jsxs)(`li`,{"data-slot":`gh-thread-entry`,"data-kind":e.kind,className:`min-w-0`,children:[(0,Z.jsxs)(`div`,{className:`mb-1.5 flex items-center gap-1.5 font-mono text-[11px] text-soft-foreground`,children:[(0,Z.jsx)(Jt,{url:e.avatarUrl,login:e.author}),(0,Z.jsx)(`span`,{className:`font-sans font-medium text-foreground`,children:e.author}),(0,Z.jsx)(`span`,{children:G(e.createdAt)}),t?(0,Z.jsx)(`span`,{"data-slot":`gh-review-chip`,"data-review-state":e.reviewState,className:A(`rounded-full border px-1.5 py-px font-sans text-[10px] font-medium`,t.tone),children:t.label}):null,(0,Z.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,"aria-label":`open comment on GitHub`,className:`ml-auto shrink-0 text-muted-foreground hover:text-foreground`,children:(0,Z.jsx)(N,{"aria-hidden":`true`,className:`size-2.5`})})]}),(0,Z.jsx)(`div`,{"data-slot":`gh-thread-body`,className:`text-sm`,children:e.body?(0,Z.jsx)(Ne,{children:e.body}):(0,Z.jsx)(`p`,{className:`text-soft-foreground`,children:`(no body)`})})]})}function Jt({url:e,login:t}){let[n,r]=(0,X.useState)(!1);return e&&!n?(0,Z.jsx)(`img`,{src:e,alt:``,width:16,height:16,loading:`lazy`,onError:()=>r(!0),"data-slot":`gh-avatar`,className:`size-4 shrink-0 rounded-full`}):(0,Z.jsx)(`span`,{"data-slot":`gh-avatar-fallback`,"aria-hidden":`true`,className:`flex size-4 shrink-0 items-center justify-center rounded-full bg-muted text-[8px] font-semibold text-muted-foreground uppercase`,children:t.slice(0,1)||`?`})}var Yt={passing:`✓`,failing:`✗`,pending:`○`},Xt={passing:`text-success`,failing:`text-danger`,pending:`text-muted-foreground`};function Zt({count:e}){return e?(0,Z.jsxs)(`span`,{"data-slot":`gh-comment-count`,"data-count":e,"aria-label":`${e} comment${e===1?``:`s`}`,className:`inline-flex shrink-0 items-center gap-0.5`,children:[(0,Z.jsx)(Me,{"aria-hidden":`true`,className:`size-3`}),e]}):null}function Qt({checks:e,url:t}){let n=A(`text-[11px] font-medium`,Xt[e],t&&`hover:underline`),r=`${Yt[e]} checks ${e}`;return t?(0,Z.jsx)(`a`,{href:`${t}/checks`,target:`_blank`,rel:`noopener noreferrer`,"data-slot":`gh-checks`,"data-checks":e,className:n,children:r}):(0,Z.jsx)(`span`,{"data-slot":`gh-checks`,"data-checks":e,className:n,children:r})}function $t({checks:e}){return(0,Z.jsx)(`span`,{"data-slot":`gh-row-checks`,"data-checks":e,title:`checks ${e}`,"aria-label":`checks ${e}`,className:A(`shrink-0 font-sans text-[11px] font-semibold`,Xt[e]),children:Yt[e]})}export{Ot as GithubRoute};