@hearsay-tools/squawk 0.17.0-dev.5736 → 0.17.0-dev.5739

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/contract/discovery.d.ts +1 -32
  2. package/dist/contract/health.d.ts +2 -17
  3. package/dist/contract/index.js +2573 -2565
  4. package/dist/contract/repo-info.d.ts +12 -0
  5. package/dist/contract/repo.d.ts +1 -2
  6. package/dist/contract/runner.d.ts +15 -0
  7. package/dist/contract/usage-limit-hold.d.ts +15 -0
  8. package/dist/contract/waits.d.ts +2 -11
  9. package/dist/contract/workflows.d.ts +1 -1
  10. package/dist/contract/workspace.d.ts +36 -1
  11. package/dist/delegation/routes.d.ts +66 -66
  12. package/dist/delegation/transport.d.ts +71 -71
  13. package/dist/runs/run-exits.js.map +1 -1
  14. package/dist/server/activity-routes.d.ts +23 -23
  15. package/dist/server/server.d.ts +1571 -1571
  16. package/dist/voice/routes.d.ts +19 -19
  17. package/dist/workflows/run/wait-engine.d.ts +72 -72
  18. package/package.json +4 -4
  19. package/web/dist/assets/activity-motion-Deqj_hcK.js +2 -0
  20. package/web/dist/assets/{activity-route-De0BnSrc.js → activity-route-Z8SMpPLm.js} +1 -1
  21. package/web/dist/assets/{agent-accounts-BCg-578Q.js → agent-accounts-f1cxwgfz.js} +2 -2
  22. package/web/dist/assets/{cez-idle-BT0U4GN_.js → cez-idle-EVoUsgU3.js} +1 -1
  23. package/web/dist/assets/{commit-diff-panel-DYtYc_dH.js → commit-diff-panel-DZutYRbq.js} +1 -1
  24. package/web/dist/assets/{control-locations-CA9TMupq.js → control-locations-C9II3kPz.js} +1 -1
  25. package/web/dist/assets/{diff-tVGVhYyc.js → diff-DNAtaTLC.js} +2 -2
  26. package/web/dist/assets/{diff-view-CNM3u77o.js → diff-view---8Bt-0a.js} +1 -1
  27. package/web/dist/assets/{file-preview-C1eTdJLJ.js → file-preview-D08Kq15E.js} +1 -1
  28. package/web/dist/assets/{git-toolbar-Dwz8p8GW.js → git-toolbar-DMDmGits.js} +1 -1
  29. package/web/dist/assets/{github-BSezqH6f.js → github-DlMu4p0I.js} +1 -1
  30. package/web/dist/assets/{github-sidebar-model-Ct0DltOv.js → github-sidebar-model-B0Ufci5S.js} +1 -1
  31. package/web/dist/assets/{global-activity-route-BZiYz-B0.js → global-activity-route-mJrrP9I0.js} +1 -1
  32. package/web/dist/assets/{index-D489J7QW.js → index-FoxgrgAH.js} +8 -8
  33. package/web/dist/assets/{live-protocol-BDY7JJpT.js → live-protocol-BVn0UA_g.js} +1 -1
  34. package/web/dist/assets/{live-refetch-C0kQc3-z.js → live-refetch-BdnmTJ_8.js} +1 -1
  35. package/web/dist/assets/{preview-pane-connected-DGkEs_L3.js → preview-pane-connected-KzJn9jAG.js} +1 -1
  36. package/web/dist/assets/{project-router-1m_VlC22.js → project-router-MMOk9VbW.js} +1 -1
  37. package/web/dist/assets/project-scope-context-B3M-u8R0.js +4 -0
  38. package/web/dist/assets/{queries-DYfIpJ-d.js → queries-DORTKwyN.js} +1 -1
  39. package/web/dist/assets/{repo-git-CU1S5P-y.js → repo-git-Bf_EfIHt.js} +1 -1
  40. package/web/dist/assets/{report-reader-DlZol2Ux.js → report-reader-ztLhC9gp.js} +1 -1
  41. package/web/dist/assets/reports-BxGqf1aC.js +1 -0
  42. package/web/dist/assets/{run-header-DPjiPKRe.js → run-header-CDMGqoPE.js} +1 -1
  43. package/web/dist/assets/skills-D2r8n5IP.js +1 -0
  44. package/web/dist/assets/{tab-link-DCUifQ46.js → tab-link-BvoGfK8S.js} +1 -1
  45. package/web/dist/assets/{task-changes-BZXWvQN3.js → task-changes-CfUCDwcL.js} +1 -1
  46. package/web/dist/assets/{task-commits-ByI9MSfc.js → task-commits-IOjoz_mL.js} +1 -1
  47. package/web/dist/assets/{task-files-LJbenpiH.js → task-files-CpUYhIpd.js} +1 -1
  48. package/web/dist/assets/{task-github-item-B0CU9lGR.js → task-github-item-B8YPhQDV.js} +1 -1
  49. package/web/dist/assets/task-thread-2Kme3Fc0.js +9 -0
  50. package/web/dist/assets/{thread-state-BLaCzqeX.js → thread-state-C136Em0C.js} +1 -1
  51. package/web/dist/assets/{use-hand-to-agent-state-BkmKad8x.js → use-hand-to-agent-state-C6u70P2A.js} +1 -1
  52. package/web/dist/assets/{useInfiniteQuery-qEY8OhKb.js → useInfiniteQuery-BbYMWe23.js} +1 -1
  53. package/web/dist/assets/useQuery-CqqnAJvu.js +1 -0
  54. package/web/dist/assets/{workflows-Dbxb-d-6.js → workflows-CWrdqLII.js} +1 -1
  55. package/web/dist/assets/{ws-DvGmrP4z.js → ws-BtSVmivO.js} +1 -1
  56. package/web/dist/index.html +13 -13
  57. package/web/dist/live-worker.js +1 -1
  58. package/web/dist/assets/activity-motion-hhx0e841.js +0 -2
  59. package/web/dist/assets/project-scope-context-CaUqlAd7.js +0 -4
  60. package/web/dist/assets/reports-DIGGjk7C.js +0 -1
  61. package/web/dist/assets/skills-BMwanop_.js +0 -1
  62. package/web/dist/assets/task-thread-CXCN__1a.js +0 -9
  63. package/web/dist/assets/useQuery-DOJQOEBO.js +0 -1
@@ -1 +1 @@
1
- import{ft as e}from"./live-protocol-BDY7JJpT.js";var t={queries:!1,sse:!1,ws:!1};function n(){return!t.queries&&!t.sse&&!t.ws}function r(){typeof window>`u`||Object.getOwnPropertyDescriptor(window,`__cezIdle`)?.get||Object.defineProperty(window,"__cezIdle",{configurable:!0,enumerable:!1,get:n})}function i(e,n){t[e]=n,r()}var a=!1;function o(e){a=e,!(typeof window>`u`)&&(Object.getOwnPropertyDescriptor(window,`__cezLive`)?.get||Object.defineProperty(window,"__cezLive",{configurable:!0,enumerable:!1,get:()=>a}))}function s(t){let n=0,r=!0;i(`queries`,t.isFetching()>0);let a=t.getQueryCache().subscribe(()=>{let a=++n;i(`queries`,!0),!(t.isFetching()>0)&&e.schedule(()=>{e.schedule(()=>{r&&a===n&&t.isFetching()===0&&i(`queries`,!1)})})});return()=>{r=!1,a(),i(`queries`,!1)}}function c(e){i(`sse`,!0);let t=e().filter(e=>e instanceof Promise);return Promise.allSettled(t).then(()=>i(`sse`,!1))}export{c as i,i as n,o as r,s as t};
1
+ import{lt as e}from"./live-protocol-BVn0UA_g.js";var t={queries:!1,sse:!1,ws:!1};function n(){return!t.queries&&!t.sse&&!t.ws}function r(){typeof window>`u`||Object.getOwnPropertyDescriptor(window,`__cezIdle`)?.get||Object.defineProperty(window,"__cezIdle",{configurable:!0,enumerable:!1,get:n})}function i(e,n){t[e]=n,r()}var a=!1;function o(e){a=e,!(typeof window>`u`)&&(Object.getOwnPropertyDescriptor(window,`__cezLive`)?.get||Object.defineProperty(window,"__cezLive",{configurable:!0,enumerable:!1,get:()=>a}))}function s(t){let n=0,r=!0;i(`queries`,t.isFetching()>0);let a=t.getQueryCache().subscribe(()=>{let a=++n;i(`queries`,!0),!(t.isFetching()>0)&&e.schedule(()=>{e.schedule(()=>{r&&a===n&&t.isFetching()===0&&i(`queries`,!1)})})});return()=>{r=!1,a(),i(`queries`,!1)}}function c(e){i(`sse`,!0);let t=e().filter(e=>e instanceof Promise);return Promise.allSettled(t).then(()=>i(`sse`,!1))}export{c as i,i as n,o as r,s as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./project-scope-context-CaUqlAd7.js";import{M as a,ct as o,r as s}from"./design-icons-DmYTv2r1.js";import{n as c}from"./diff-controls-BR2uqhwG.js";import{u as l}from"./control-locations-CA9TMupq.js";import{t as u}from"./project-router-1m_VlC22.js";import{t as d}from"./centered-state-DGyy0SuA.js";import{K as f,q as p}from"./index-D489J7QW.js";import{t as m}from"./diff-tVGVhYyc.js";var h=e(n(),1),g=r();function _({commit:e,sha:n,backTo:r,backLabel:_,slot:v,className:y,diffClassName:b}){let x=p(),[S,C]=(0,h.useState)(`unified`),[w,T]=(0,h.useState)(!1),E=e.isError&&e.error instanceof i&&e.error.status===409,D=x?S:`unified`,O=!x||w;return(0,g.jsxs)(`section`,{"data-slot":v,"data-sha":n,className:y,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,g.jsx)(t,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,g.jsxs)(u,{to:r,children:[(0,g.jsx)(s,{size:16,"aria-hidden":`true`}),_]})}),e.data?(0,g.jsx)(f,{stat:e.data.stat}):null,(0,g.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,g.jsx)(c,{mode:S,wrap:w,onModeChange:C,onWrapChange:T})})]}),e.isPending?(0,g.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):e.isError?(0,g.jsx)(d,{icon:E?(0,g.jsx)(l,{}):(0,g.jsx)(o,{size:16}),tone:E?`neutral`:`danger`,heading:`h2`,title:E?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,g.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[e.data.author,` · `,e.data.when,` ·`,` `,(0,g.jsx)(`span`,{className:`font-mono select-all`,children:e.data.sha})]})]}),e.data.files.length===0?(0,g.jsx)(d,{icon:(0,g.jsx)(a,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,g.jsx)(`div`,{className:b,children:(0,g.jsx)(m,{files:e.data.files,mode:D,wrap:O,className:`min-w-0`})})]})]})}export{_ as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./project-scope-context-B3M-u8R0.js";import{M as a,ct as o,r as s}from"./design-icons-DmYTv2r1.js";import{n as c}from"./diff-controls-BR2uqhwG.js";import{u as l}from"./control-locations-C9II3kPz.js";import{t as u}from"./project-router-MMOk9VbW.js";import{t as d}from"./centered-state-DGyy0SuA.js";import{K as f,q as p}from"./index-FoxgrgAH.js";import{t as m}from"./diff-DNAtaTLC.js";var h=e(n(),1),g=r();function _({commit:e,sha:n,backTo:r,backLabel:_,slot:v,className:y,diffClassName:b}){let x=p(),[S,C]=(0,h.useState)(`unified`),[w,T]=(0,h.useState)(!1),E=e.isError&&e.error instanceof i&&e.error.status===409,D=x?S:`unified`,O=!x||w;return(0,g.jsxs)(`section`,{"data-slot":v,"data-sha":n,className:y,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,g.jsx)(t,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,g.jsxs)(u,{to:r,children:[(0,g.jsx)(s,{size:16,"aria-hidden":`true`}),_]})}),e.data?(0,g.jsx)(f,{stat:e.data.stat}):null,(0,g.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,g.jsx)(c,{mode:S,wrap:w,onModeChange:C,onWrapChange:T})})]}),e.isPending?(0,g.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):e.isError?(0,g.jsx)(d,{icon:E?(0,g.jsx)(l,{}):(0,g.jsx)(o,{size:16}),tone:E?`neutral`:`danger`,heading:`h2`,title:E?`Commit not found`:`Could not load the commit`,subtitle:e.error.message}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,g.jsx)(`h2`,{className:`text-sm font-semibold`,children:e.data.subject}),(0,g.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[e.data.author,` · `,e.data.when,` ·`,` `,(0,g.jsx)(`span`,{className:`font-mono select-all`,children:e.data.sha})]})]}),e.data.files.length===0?(0,g.jsx)(d,{icon:(0,g.jsx)(a,{size:16}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,g.jsx)(`div`,{className:b,children:(0,g.jsx)(m,{files:e.data.files,mode:D,wrap:O,className:`min-w-0`})})]})]})}export{_ as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,p as n,u as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Ln as o,Rn as s,Zt as c,it as l}from"./queries-DYfIpJ-d.js";import{n as u,r as d,t as f}from"./popover-DRcRI46x.js";import{F as p,I as m,N as h,P as g,U as _,_ as v,ct as y,g as b,h as x,m as S,p as C}from"./design-icons-DmYTv2r1.js";import{t as w}from"./createLucideIcon-BHp8sXmF.js";var T=w(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),E=e(i(),1),D=a(),O=(0,E.createContext)(null);function k({children:e}){let[t,n]=(0,E.useState)(()=>new Map),r=(0,E.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,E.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=l((0,E.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,E.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,D.jsx)(O.Provider,{value:o,children:e})}var A=(0,E.createContext)(null);function j({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,E.useContext)(O),a=(0,E.useContext)(A),o=(0,E.useId)();(0,E.useEffect)(()=>{if(i)return i.publish(o,n),()=>i.retract(o)},[i,o,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let s=l(i?M:n),c=i?.lookup??s,u=t??(a&&a.projectId===e?a.repoBase:void 0),d=(0,E.useMemo)(()=>({lookup:c,projectId:e,repoBase:u}),[c,e,u]);return(0,D.jsx)(A.Provider,{value:d,children:r})}var M=[];function N(e,t,n){let r=(0,E.useContext)(A),i=n??r?.projectId;return!r||!i||t===void 0?te:r.lookup({projectId:i,kind:e,number:t})}function ee(e,t){let n=(0,E.useContext)(A),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function P(){let e=(0,E.useContext)(A);return{projectId:e?.projectId,repoBase:e?.repoBase}}var te=Object.freeze({state:`idle`}),F={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},I={success:`text-success`,danger:`text-danger`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-info`,neutral:`text-soft-foreground`,pending:`text-pending-strong`,conflict:`text-conflict`},ne={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},re={draft:p,"review-required":m,"changes-requested":_,"checks-pending":null,"checks-failing":v,ready:C,merged:h,closed:g,open:S,completed:C,"not-planned":b};function L(e){return e===`PR`?`pr-chip`:`issue-chip`}function R(e){return e?{"data-conflicting":`true`}:{}}function z(e,t,n,r){return!n||r!==void 0&&c({kind:e,number:t??0,url:n},r)}function B(e,t,n){return e===`PR`&&(t??n)===!0}function V({plain:e,inert:t,conflicting:n,className:i,tone:a}){return e?r(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,i):r(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,F[a],i)}function H(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function U(e){return e===`PR`?`pull request`:`issue`}function W(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function G(e,t){return e&&t?I[t.tone]:void 0}function K(e,n){return!e&&(!n||!t(n))}function q({conflicting:e,presentation:t,status:n,plain:i,compact:a,inert:o,kind:s,label:c,glyphClass:l}){return(0,D.jsxs)(D.Fragment,{children:[e?(0,D.jsx)(y,{className:r(`size-2.5 shrink-0`,l),"aria-hidden":`true`}):(0,D.jsx)($,{status:t?n:void 0,className:i?r(`size-2.5`,l):void 0}),i&&a?s===`PR`?(0,D.jsx)(m,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,D.jsx)(S,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,i?(0,D.jsx)(`span`,{className:o?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:c}):c]})}function J({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,D.jsx)(`span`,{"data-slot":L(e),"data-status":t,"data-inert":`true`,...R(n),className:r,children:i})}function Y({kind:e,number:n,tooltip:r,url:i}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,n?` #${n}`:``,` · `,r.headline]}),(0,D.jsx)(`span`,{className:`block`,children:r.detail}),r.also?(0,D.jsx)(`span`,{className:`block opacity-70`,children:r.also}):null,i&&t(i)?(0,D.jsx)(`span`,{className:`block opacity-70`,children:i.replace(/^https?:\/\//,``)}):null]})}function ie({reference:e,taskTitle:t,status:n,conflicting:i,conflictAction:a,projectId:c,repoBase:l,to:u,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=P(),y=N(h,z(h,g,_,l??v.repoBase)?g:void 0,c),b=n??y.status,x=s(b),S=B(h,i,y.conflicting),C=S?o:x,w=C?.tone??`accent`,T=V({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=le(y,C,S?x:void 0),O=H(h,g,p,f),k=U(h),A=W(k,g,t,C),j=(0,D.jsx)(q,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:O,glyphClass:G(p,C)});if(m)return(0,D.jsx)(J,{kind:h,status:b,conflicting:S,chipClass:T,body:j});let M=K(u,_)?(0,D.jsx)(`span`,{"data-slot":L(h),"data-status":b,...R(S),"aria-label":C?`${k} ${O} — ${C.label}`:void 0,className:T,children:j}):(0,D.jsx)(ae,{to:u,url:_,"data-slot":L(h),"data-status":b,...R(S),title:E?void 0:_,"aria-label":A,className:p?T:r(T,ne[w]),children:j});return E?(0,D.jsx)(ce,{chip:M,action:S?a:void 0,state:y.state,children:(0,D.jsx)(Y,{kind:h,number:g,tooltip:E,url:_})}):M}function ae({to:e,url:t,children:r,...i}){return e?(0,D.jsx)(n,{to:e,...i,children:r}):(0,D.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...i,children:r})}var X=(0,E.createContext)(()=>{});function oe(){return(0,E.useContext)(X)}var se=150,Z=120;function ce({chip:e,action:t,state:n,children:r}){let[i,a]=(0,E.useState)(!1),o=(0,E.useRef)(null),s=(0,E.useRef)(null),c=(0,E.useRef)(void 0),l=(0,E.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),p=(0,E.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,E.useEffect)(()=>()=>clearTimeout(c.current),[]);let m=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,D.jsxs)(f,{open:i,onOpenChange:e=>e?a(!0):p(),children:[(0,D.jsx)(u,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,se)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Z)},onFocus:()=>a(!0),onBlur:e=>{m(e.relatedTarget)||p()},onKeyDown:e=>{if(e.key===`Escape`)return p();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,D.jsxs)(d,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),m(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Z)},children:[(0,D.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,D.jsx)(X.Provider,{value:p,children:t}):null]})]})}function le(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${ue(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function ue(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Q({kind:e,number:t,className:n}){let i=N(e,t),a=s(i.status),c=e===`PR`&&i.conflicting===!0,l=c?o:a;if(!l)return null;let u=r(`size-2.5`,I[l.tone]);return(0,D.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":i.status,...c?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:r(`inline-flex items-center`,n),children:c?(0,D.jsx)(y,{className:r(`shrink-0`,u),"aria-hidden":`true`}):(0,D.jsx)($,{status:i.status,className:u})})}function $({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,D.jsx)(x,{"data-slot":`status-dot`,"data-tone":`pending`,className:r(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=re[e];return n?(0,D.jsx)(n,{className:r(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}var de={general:[`Settings`,`General`],webhooks:[`Settings`,`General`,`Webhooks`],providers:[`Settings`,`Agents`,`Providers`],projects:[`Settings`,`Projects`],worktrees:[`Settings`,`Worktrees`],sidebar:[`Settings`,`Sidebar`]};function fe(e,t=` → `){return de[e].join(t)}export{j as a,P as c,oe as i,N as l,ie as n,k as o,Q as r,ee as s,fe as t,T as u};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,p as n,u as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{Ln as o,Rn as s,Zt as c,it as l}from"./queries-DORTKwyN.js";import{n as u,r as d,t as f}from"./popover-DRcRI46x.js";import{F as p,I as m,N as h,P as g,U as _,_ as v,ct as y,g as b,h as x,m as S,p as C}from"./design-icons-DmYTv2r1.js";import{t as w}from"./createLucideIcon-BHp8sXmF.js";var T=w(`search-x`,[[`path`,{d:`m13.5 8.5-5 5`,key:`1cs55j`}],[`path`,{d:`m8.5 8.5 5 5`,key:`a8mexj`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]),E=e(i(),1),D=a(),O=(0,E.createContext)(null);function k({children:e}){let[t,n]=(0,E.useState)(()=>new Map),r=(0,E.useCallback)((e,t)=>{n(n=>{let r=new Map(n);return r.set(e,t),r})},[]),i=(0,E.useCallback)(e=>{n(t=>{if(!t.has(e))return t;let n=new Map(t);return n.delete(e),n})},[]),a=l((0,E.useMemo)(()=>[...t.values()].flat(),[t])),o=(0,E.useMemo)(()=>({publish:r,retract:i,lookup:a}),[r,i,a]);return(0,D.jsx)(O.Provider,{value:o,children:e})}var A=(0,E.createContext)(null);function j({projectId:e,repoBase:t,requests:n,children:r}){let i=(0,E.useContext)(O),a=(0,E.useContext)(A),o=(0,E.useId)();(0,E.useEffect)(()=>{if(i)return i.publish(o,n),()=>i.retract(o)},[i,o,n.map(e=>`${e.projectId} ${e.kind}#${e.number}`).sort().join(`|`)]);let s=l(i?M:n),c=i?.lookup??s,u=t??(a&&a.projectId===e?a.repoBase:void 0),d=(0,E.useMemo)(()=>({lookup:c,projectId:e,repoBase:u}),[c,e,u]);return(0,D.jsx)(A.Provider,{value:d,children:r})}var M=[];function N(e,t,n){let r=(0,E.useContext)(A),i=n??r?.projectId;return!r||!i||t===void 0?te:r.lookup({projectId:i,kind:e,number:t})}function ee(e,t){let n=(0,E.useContext)(A),r=t??n?.projectId;return!n||!r?[]:e.filter(e=>n.lookup({projectId:r,kind:`PR`,number:e}).conflicting===!0)}function P(){let e=(0,E.useContext)(A);return{projectId:e?.projectId,repoBase:e?.repoBase}}var te=Object.freeze({state:`idle`}),F={success:`border-success/40 text-success`,danger:`border-danger/40 text-danger`,accent:`border-accent-strong/35 text-accent-text`,merged:`border-merged-strong/35 text-merged-text`,info:`border-info/40 text-info`,neutral:`border-border text-muted-foreground`,pending:`border-pending-strong/45 text-pending-strong`,conflict:`border-conflict/45 text-conflict`},I={success:`text-success`,danger:`text-danger`,accent:`text-merged-text`,merged:`text-merged-text`,info:`text-info`,neutral:`text-soft-foreground`,pending:`text-pending-strong`,conflict:`text-conflict`},ne={success:`hover:bg-success/10`,danger:`hover:bg-danger/10`,accent:`hover:bg-accent-strong/10`,merged:`hover:bg-merged-strong/10`,info:`hover:bg-info/10`,neutral:`hover:bg-muted`,pending:`hover:bg-pending-strong/10`,conflict:`hover:bg-conflict/10`},re={draft:p,"review-required":m,"changes-requested":_,"checks-pending":null,"checks-failing":v,ready:C,merged:h,closed:g,open:S,completed:C,"not-planned":b};function L(e){return e===`PR`?`pr-chip`:`issue-chip`}function R(e){return e?{"data-conflicting":`true`}:{}}function z(e,t,n,r){return!n||r!==void 0&&c({kind:e,number:t??0,url:n},r)}function B(e,t,n){return e===`PR`&&(t??n)===!0}function V({plain:e,inert:t,conflicting:n,className:i,tone:a}){return e?r(`inline-flex items-center gap-1 rounded-[2px] text-inherit`,n&&`text-conflict font-medium`,!t&&`group/reference focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground`,i):r(`inline-flex h-[22px] items-center gap-1 rounded-md border px-1.5 font-mono text-[12px] font-normal`,F[a],i)}function H(e,t,n,r){return n&&!r?t?`${e===`PR`?`PR `:``}#${t}`:e:t?`${!r&&e===`Issue`?`Issue `:``}#${t}`:e}function U(e){return e===`PR`?`pull request`:`issue`}function W(e,t,n,r){return`Open the ${e}${t?` #${t}`:``} for ${n}${r?` — ${r.label}`:``}`}function G(e,t){return e&&t?I[t.tone]:void 0}function K(e,n){return!e&&(!n||!t(n))}function q({conflicting:e,presentation:t,status:n,plain:i,compact:a,inert:o,kind:s,label:c,glyphClass:l}){return(0,D.jsxs)(D.Fragment,{children:[e?(0,D.jsx)(y,{className:r(`size-2.5 shrink-0`,l),"aria-hidden":`true`}):(0,D.jsx)($,{status:t?n:void 0,className:i?r(`size-2.5`,l):void 0}),i&&a?s===`PR`?(0,D.jsx)(m,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):(0,D.jsx)(S,{"data-slot":`reference-kind`,className:`size-2.5 shrink-0`,"aria-hidden":`true`}):null,i?(0,D.jsx)(`span`,{className:o?void 0:`underline-offset-2 group-hover/reference:underline group-focus-visible/reference:underline`,children:c}):c]})}function J({kind:e,status:t,conflicting:n,chipClass:r,body:i}){return(0,D.jsx)(`span`,{"data-slot":L(e),"data-status":t,"data-inert":`true`,...R(n),className:r,children:i})}function Y({kind:e,number:n,tooltip:r,url:i}){return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`span`,{className:`block font-medium`,children:[e===`PR`?`Pull request`:`Issue`,n?` #${n}`:``,` · `,r.headline]}),(0,D.jsx)(`span`,{className:`block`,children:r.detail}),r.also?(0,D.jsx)(`span`,{className:`block opacity-70`,children:r.also}):null,i&&t(i)?(0,D.jsx)(`span`,{className:`block opacity-70`,children:i.replace(/^https?:\/\//,``)}):null]})}function ie({reference:e,taskTitle:t,status:n,conflicting:i,conflictAction:a,projectId:c,repoBase:l,to:u,className:d,compact:f=!1,plain:p=!1,inert:m=!1}){let{kind:h,number:g,url:_}=e,v=P(),y=N(h,z(h,g,_,l??v.repoBase)?g:void 0,c),b=n??y.status,x=s(b),S=B(h,i,y.conflicting),C=S?o:x,w=C?.tone??`accent`,T=V({plain:p,inert:m,conflicting:S,className:d,tone:w}),E=le(y,C,S?x:void 0),O=H(h,g,p,f),k=U(h),A=W(k,g,t,C),j=(0,D.jsx)(q,{conflicting:S,presentation:C,status:b,plain:p,compact:f,inert:m,kind:h,label:O,glyphClass:G(p,C)});if(m)return(0,D.jsx)(J,{kind:h,status:b,conflicting:S,chipClass:T,body:j});let M=K(u,_)?(0,D.jsx)(`span`,{"data-slot":L(h),"data-status":b,...R(S),"aria-label":C?`${k} ${O} — ${C.label}`:void 0,className:T,children:j}):(0,D.jsx)(ae,{to:u,url:_,"data-slot":L(h),"data-status":b,...R(S),title:E?void 0:_,"aria-label":A,className:p?T:r(T,ne[w]),children:j});return E?(0,D.jsx)(ce,{chip:M,action:S?a:void 0,state:y.state,children:(0,D.jsx)(Y,{kind:h,number:g,tooltip:E,url:_})}):M}function ae({to:e,url:t,children:r,...i}){return e?(0,D.jsx)(n,{to:e,...i,children:r}):(0,D.jsx)(`a`,{href:t,target:`_blank`,rel:`noopener noreferrer`,...i,children:r})}var X=(0,E.createContext)(()=>{});function oe(){return(0,E.useContext)(X)}var se=150,Z=120;function ce({chip:e,action:t,state:n,children:r}){let[i,a]=(0,E.useState)(!1),o=(0,E.useRef)(null),s=(0,E.useRef)(null),c=(0,E.useRef)(void 0),l=(0,E.useCallback)((e,t)=>{clearTimeout(c.current),c.current=setTimeout(()=>a(e),t)},[]),p=(0,E.useCallback)(()=>{clearTimeout(c.current),a(!1)},[]);(0,E.useEffect)(()=>()=>clearTimeout(c.current),[]);let m=e=>e instanceof Node&&(s.current?.contains(e)||o.current?.contains(e));return(0,D.jsxs)(f,{open:i,onOpenChange:e=>e?a(!0):p(),children:[(0,D.jsx)(u,{asChild:!0,ref:o,onPointerEnter:e=>{e.pointerType!==`touch`&&l(!0,se)},onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Z)},onFocus:()=>a(!0),onBlur:e=>{m(e.relatedTarget)||p()},onKeyDown:e=>{if(e.key===`Escape`)return p();if(e.key!==`Tab`||e.shiftKey||!t)return;let n=s.current?.querySelector(`button:not([disabled]), [href], input, select, textarea, [tabindex]:not([tabindex="-1"])`);n&&(e.preventDefault(),n.focus())},...t?{"aria-haspopup":`dialog`,"aria-expanded":i}:{},children:e}),(0,D.jsxs)(d,{ref:s,side:`top`,role:t?`dialog`:`tooltip`,"data-slot":`reference-status-card`,"data-tooltip-state":n,className:`w-64 space-y-2 p-3 text-xs`,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>{e.preventDefault(),m(document.activeElement)&&o.current?.focus()},onPointerEnter:()=>clearTimeout(c.current),onPointerLeave:e=>{e.pointerType!==`touch`&&l(!1,Z)},children:[(0,D.jsx)(`div`,{className:`space-y-0.5`,children:r}),t?(0,D.jsx)(X.Provider,{value:p,children:t}):null]})]})}function le(e,t,n){if(t){let{label:r,hint:i}=t,a=n?`also ${ue(n.label)} — ${n.hint}`:void 0;return e.state===`unavailable`?{headline:r,detail:`last known — GitHub is unreachable${e.reason?` (${e.reason})`:``}`,...a?{also:a}:{}}:{headline:r,detail:i,...a?{also:a}:{}}}switch(e.state){case`loading`:return{headline:`Checking GitHub…`,detail:`the status of this reference is on its way`};case`unavailable`:return{headline:`Status unavailable`,detail:e.reason??`GitHub could not be reached — the chip says nothing rather than guessing`};case`unknown`:return{headline:`Not found on this repository`,detail:`GitHub has no such number here — the reference may point at another repo`};default:return null}}function ue(e){return e.charAt(0).toLowerCase()+e.slice(1)}function Q({kind:e,number:t,className:n}){let i=N(e,t),a=s(i.status),c=e===`PR`&&i.conflicting===!0,l=c?o:a;if(!l)return null;let u=r(`size-2.5`,I[l.tone]);return(0,D.jsx)(`span`,{"data-slot":`reference-status-glyph`,"data-status":i.status,...c?{"data-conflicting":`true`}:{},"aria-hidden":`true`,className:r(`inline-flex items-center`,n),children:c?(0,D.jsx)(y,{className:r(`shrink-0`,u),"aria-hidden":`true`}):(0,D.jsx)($,{status:i.status,className:u})})}function $({status:e,className:t}){if(!e)return null;if(e===`checks-pending`)return(0,D.jsx)(x,{"data-slot":`status-dot`,"data-tone":`pending`,className:r(`size-3 animate-pulse motion-reduce:animate-none`,t),"aria-hidden":`true`});let n=re[e];return n?(0,D.jsx)(n,{className:r(`size-2.5 shrink-0`,t),"aria-hidden":`true`}):null}var de={general:[`Settings`,`General`],webhooks:[`Settings`,`General`,`Webhooks`],providers:[`Settings`,`Agents`,`Providers`],projects:[`Settings`,`Projects`],worktrees:[`Settings`,`Worktrees`],sidebar:[`Settings`,`Sidebar`]};function fe(e,t=` → `){return de[e].join(t)}export{j as a,P as c,oe as i,N as l,ie as n,k as o,Q as r,ee as s,fe as t,T as u};
@@ -1,3 +1,3 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view-CNM3u77o.js","assets/rolldown-runtime-QTnfLwEv.js","assets/button-CHUAMTHK.js","assets/react-runtime-CCIEwYL0.js","assets/bundle-mjs-BT31bpU6.js","assets/eye-B8okNWXU.js","assets/createLucideIcon-BHp8sXmF.js","assets/markdown-D7DUNWcJ.js","assets/alert-dialog-Dj464rjk.js","assets/es2015-D345RR4o.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/index-D489J7QW.js","assets/live-refetch-C0kQc3-z.js","assets/project-scope-context-CaUqlAd7.js","assets/live-protocol-BDY7JJpT.js","assets/useInfiniteQuery-qEY8OhKb.js","assets/queries-DYfIpJ-d.js","assets/useQuery-DOJQOEBO.js","assets/ws-DvGmrP4z.js","assets/toaster-B1MyeHiE.js","assets/cez-idle-BT0U4GN_.js","assets/dropdown-menu-DhrBcVgr.js","assets/design-icons-DmYTv2r1.js","assets/github-sidebar-model-Ct0DltOv.js","assets/popover-DRcRI46x.js","assets/textarea-DlVUfdWG.js","assets/project-router-1m_VlC22.js","assets/agent-accounts-BCg-578Q.js","assets/skills-DFBiAuJG.js","assets/skills-workflows-C21NystW.css","assets/loader-circle-CZkGEdoI.js","assets/nav-row-styles-BZUUavOF.js","assets/control-locations-CA9TMupq.js","assets/centered-state-DGyy0SuA.js","assets/sortable.esm-zp_qkYGV.js","assets/index-B18AqW0Z.css","assets/image-preview-Cq1vDiEo.js","assets/zoomable-image-5pOUaPEg.js","assets/markdown-BBDDg-4t.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{K as a}from"./index-D489J7QW.js";import{n as o,t as s}from"./image-preview-Cq1vDiEo.js";var c=e(n(),1),l=r();function u(e){let[n,r]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view-CNM3u77o.js`).then(t=>{e||r({View:t.DiffView})},()=>{e||r(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):n===`failed`?(0,l.jsx)(d,{...e}):n===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(n.View,{...e})}function d({files:e,wrap:n=!1,imageSrc:r,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:t(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:n,imageSrc:r,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:n,imageSrc:r,onOpenInApp:i}){return(0,l.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:r,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:t(`py-2 font-mono text-xs leading-[1.7]`,n?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/diff-view---8Bt-0a.js","assets/rolldown-runtime-QTnfLwEv.js","assets/button-CHUAMTHK.js","assets/react-runtime-CCIEwYL0.js","assets/bundle-mjs-BT31bpU6.js","assets/eye-B8okNWXU.js","assets/createLucideIcon-BHp8sXmF.js","assets/markdown-D7DUNWcJ.js","assets/alert-dialog-Dj464rjk.js","assets/es2015-D345RR4o.js","assets/chunk-BO2N2NFS-DE6qKn3r.js","assets/lib-BxQXEXDF.js","assets/index-FoxgrgAH.js","assets/live-refetch-BdnmTJ_8.js","assets/project-scope-context-B3M-u8R0.js","assets/live-protocol-BVn0UA_g.js","assets/useInfiniteQuery-BbYMWe23.js","assets/queries-DORTKwyN.js","assets/useQuery-CqqnAJvu.js","assets/ws-BtSVmivO.js","assets/toaster-B1MyeHiE.js","assets/cez-idle-EVoUsgU3.js","assets/dropdown-menu-DhrBcVgr.js","assets/design-icons-DmYTv2r1.js","assets/github-sidebar-model-B0Ufci5S.js","assets/popover-DRcRI46x.js","assets/textarea-DlVUfdWG.js","assets/project-router-MMOk9VbW.js","assets/agent-accounts-f1cxwgfz.js","assets/skills-DFBiAuJG.js","assets/skills-workflows-C21NystW.css","assets/loader-circle-CZkGEdoI.js","assets/nav-row-styles-BZUUavOF.js","assets/control-locations-C9II3kPz.js","assets/centered-state-DGyy0SuA.js","assets/sortable.esm-zp_qkYGV.js","assets/index-B18AqW0Z.css","assets/image-preview-Cq1vDiEo.js","assets/zoomable-image-5pOUaPEg.js","assets/markdown-BBDDg-4t.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{i}from"./bundle-mjs-BT31bpU6.js";import{K as a}from"./index-FoxgrgAH.js";import{n as o,t as s}from"./image-preview-Cq1vDiEo.js";var c=e(n(),1),l=r();function u(e){let[n,r]=(0,c.useState)(null);return(0,c.useEffect)(()=>{let e=!1;return i(()=>import(`./diff-view---8Bt-0a.js`).then(t=>{e||r({View:t.DiffView})},()=>{e||r(`failed`)}),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39])),()=>{e=!0}},[]),e.files.length===0?(0,l.jsx)(`p`,{"data-slot":`diff-empty`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`No changes.`}):n===`failed`?(0,l.jsx)(d,{...e}):n===null?(0,l.jsx)(`p`,{"data-slot":`diff-loading`,className:t(`px-1 text-xs text-soft-foreground`,e.className),children:`Loading diff…`}):(0,l.jsx)(n.View,{...e})}function d({files:e,wrap:n=!1,imageSrc:r,onOpenInApp:i,viewRef:o,className:s}){let u={adds:e.reduce((e,t)=>e+t.adds,0),dels:e.reduce((e,t)=>e+t.dels,0),files:e.length},d=(0,c.useRef)(null);return(0,c.useImperativeHandle)(o,()=>({scrollToPath:e=>{for(let t of d.current?.querySelectorAll(`[data-slot="diff-file"]`)??[])if(t.dataset.path===e){t.scrollIntoView({block:`start`,behavior:`smooth`});return}}})),(0,l.jsxs)(`div`,{ref:d,"data-slot":`diff`,"data-fallback":`true`,className:t(`flex min-w-0 flex-col gap-3`,s),children:[(0,l.jsxs)(`p`,{"data-slot":`diff-totals`,className:`flex items-center gap-2 px-1 text-xs text-muted-foreground`,children:[(0,l.jsxs)(`span`,{children:[u.files,` `,u.files===1?`file`:`files`,` changed`]}),(0,l.jsx)(a,{stat:u})]}),e.map(e=>(0,l.jsx)(f,{file:e,wrap:n,imageSrc:r,onOpenInApp:i},`${e.oldPath??``}→${e.path}`))]})}function f({file:e,wrap:n,imageSrc:r,onOpenInApp:i}){return(0,l.jsxs)(`section`,{"data-slot":`diff-file`,"data-path":e.path,className:`min-w-0 overflow-clip rounded-md border border-border bg-card`,children:[(0,l.jsxs)(`header`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,l.jsx)(`span`,{"data-slot":`diff-file-path`,className:`min-w-0 truncate font-mono text-xs font-medium`,children:e.oldPath?`${e.oldPath} → ${e.path}`:e.path}),(0,l.jsx)(`span`,{className:`ml-auto shrink-0`,children:(0,l.jsx)(a,{stat:{adds:e.adds,dels:e.dels,files:1},className:`text-[11px]`})})]}),o(e)?(0,l.jsx)(s,{file:e,imageSrc:r,onOpenInApp:i}):e.binary?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Binary file — no text diff.`}):e.patch===``?(0,l.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes (metadata only).`}):(0,l.jsx)(`pre`,{className:t(`py-2 font-mono text-xs leading-[1.7]`,n?`break-words whitespace-pre-wrap`:`overflow-x-auto whitespace-pre`),children:e.patch.split(`
3
3
  `).map((e,n)=>(0,l.jsxs)(`span`,{className:t(`block px-4`,e.startsWith(`+`)&&!e.startsWith(`+++`)&&`bg-diff-add`,e.startsWith(`-`)&&!e.startsWith(`---`)&&`bg-diff-del`,e.startsWith(`@@`)&&`text-soft-foreground`),children:[e,e===``?` `:``]},n))})]})}export{u as t};
@@ -1,4 +1,4 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./eye-B8okNWXU.js";import{h as a,m as o,p as s,t as c}from"./markdown-D7DUNWcJ.js";import{K as l,X as u,Xt as d}from"./index-D489J7QW.js";import{n as f,t as p}from"./image-preview-Cq1vDiEo.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";var g=e(n(),1),_=44;function v(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{u as t}from"./button-CHUAMTHK.js";import{i as n,t as r}from"./react-runtime-CCIEwYL0.js";import{t as i}from"./eye-B8okNWXU.js";import{h as a,m as o,p as s,t as c}from"./markdown-D7DUNWcJ.js";import{K as l,X as u,Xt as d}from"./index-FoxgrgAH.js";import{n as f,t as p}from"./image-preview-Cq1vDiEo.js";import{n as m,t as h}from"./markdown-BBDDg-4t.js";var g=e(n(),1),_=44;function v(e){if(e.binary===!0||e.patch===``)return 1;let t=e.patch.split(`
2
2
  `),n=t.findIndex(e=>e.startsWith(`@@`));return n===-1?t.length:t.length-n}function y(e){return v(e)*20+_}function b(e){return e.reduce((e,t)=>e+v(t),0)}function x(e,t){let n=new URLSearchParams(e).get(`diff`);return n===`flat`||n===`virtual`?n:t>1500?`virtual`:`flat`}function S(e){return`${e.oldPath??``}→${e.path}`}function C(e){let t=0;for(let n of e.split(`
3
3
  `))n.length>t&&(t=n.length);return t}var w=/[A-Za-z0-9_]+|\s+|[^\sA-Za-z0-9_]+/g,T=300,E=.3;function D(e,t){if(e===t)return null;let n=e.match(w)??[],r=t.match(w)??[];if(n.length===0||r.length===0||n.length>T||r.length>T)return null;let i=O(n,r),a=r.length+1;return(i[n.length*a+r.length]??0)/Math.max(n.length,r.length)<E?null:k(n,r,i)}function O(e,t){let n=t.length+1,r=new Uint16Array((e.length+1)*n);for(let i=1;i<=e.length;i++)for(let a=1;a<=t.length;a++)r[i*n+a]=e[i-1]===t[a-1]?(r[(i-1)*n+(a-1)]??0)+1:Math.max(r[(i-1)*n+a]??0,r[i*n+(a-1)]??0);return r}function k(e,t,n){let r=t.length+1,i=Array.from({length:e.length},()=>!1),a=Array.from({length:t.length},()=>!1),o=e.length,s=t.length;for(;o>0&&s>0;)e[o-1]===t[s-1]?(i[o-1]=!0,a[s-1]=!0,o--,s--):(n[(o-1)*r+s]??0)>=(n[o*r+(s-1)]??0)?o--:s--;return{del:A(e,i),add:A(t,a)}}function A(e,t){let n=[];return e.forEach((e,r)=>{let i=!(t[r]??!1),a=n[n.length-1];a&&a.changed===i?a.text+=e:n.push({text:e,changed:i})}),n}function j(e,t,n){if(!t||t.length===0)return e?e.map(e=>({text:e.content,color:e.color,changed:!1})):n===``?[]:[{text:n,changed:!1}];if(!e||e.length===0)return t.map(e=>({text:e.text,changed:e.changed}));let r=[],i=0,a=0,o=0,s=0;for(;i<e.length&&o<t.length;){let n=e[i],c=t[o],l=n.content.length-a,u=c.text.length-s,d=Math.min(l,u);d>0&&(r.push({text:n.content.slice(a,a+d),color:n.color,changed:c.changed}),a+=d,s+=d),n.content.length-a<=0&&(i++,a=0),c.text.length-s<=0&&(o++,s=0)}for(;i<e.length;){let t=e[i],n=t.content.slice(a);n!==``&&r.push({text:n,color:t.color,changed:!1}),i++,a=0}return r}var M=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@/,N=`… (patch truncated)`;function P(e){let t=[],n=!1,r=null,i=0,a=0,o=e.split(`
4
4
  `);o.at(-1)===``&&o.pop();for(let e of o){let o=M.exec(e);if(o){r={header:e,oldStart:Number(o[1]),oldCount:o[2]===void 0?1:Number(o[2]),newStart:Number(o[3]),newCount:o[4]===void 0?1:Number(o[4]),lines:[]},i=r.oldStart,a=r.newStart,t.push(r);continue}if(e.includes(N)){n=!0,r=null;continue}r&&(e.startsWith(`+`)?r.lines.push({kind:`add`,text:e.slice(1),newLine:a++}):e.startsWith(`-`)?r.lines.push({kind:`del`,text:e.slice(1),oldLine:i++}):e.startsWith(`\\`)||r.lines.push({kind:`context`,text:e.slice(1),oldLine:i++,newLine:a++}))}return{hunks:t,truncated:n}}function F(e,t=!1){let n=[],r=e[0];if(!r)return n;r.newStart>1&&n.push({beforeHunk:0,count:r.newStart-1,oldStart:1,newStart:1});for(let t=1;t<e.length;t++){let r=e[t-1],i=e[t],a=r.oldStart+r.oldCount,o=r.newStart+r.newCount,s=i.newStart-o;s>0&&n.push({beforeHunk:t,count:s,oldStart:a,newStart:o})}if(t){let t=e[e.length-1];n.push({beforeHunk:e.length,oldStart:t.oldStart+t.oldCount,newStart:t.newStart+t.newCount})}return n}function I(e,t){let n=e.count===void 0?t.length:e.newStart+e.count-1,r=e.oldStart-e.newStart,i=[];for(let a=e.newStart;a<=Math.min(n,t.length);a++)i.push({kind:`context`,text:t[a-1]??``,oldLine:a+r,newLine:a});return i}function L(e,t){let n=Array.from({length:e.length}),r=Array.from({length:t.length}),i=Math.min(e.length,t.length);for(let a=0;a<i;a++){let i=D(e[a].text,t[a].text);i&&(n[a]=i.del,r[a]=i.add)}return{dels:e,adds:t,delSpans:n,addSpans:r}}function R(e,t,n){let r=0;for(;r<e.lines.length;){let i=e.lines[r];if(i.kind===`del`||i.kind===`add`){let t=[],i=[];for(;r<e.lines.length&&e.lines[r].kind===`del`;)t.push(e.lines[r++]);for(;r<e.lines.length&&e.lines[r].kind===`add`;)i.push(e.lines[r++]);n(L(t,i))}else t(i),r++}}function z(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`line`,cell:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),R(e,e=>i.push({type:`line`,cell:{line:e}}),e=>{e.dels.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.delSpans[n]}})),e.adds.forEach((t,n)=>i.push({type:`line`,cell:{line:t,spans:e.addSpans[n]}}))})}),a(e.length),i}function B(e,t=[],n){let r=new Map(t.map(e=>[e.beforeHunk,e])),i=[],a=e=>{let t=r.get(e);if(!t)return;let a=n?.get(e);if(a)for(let e of a)i.push({type:`pair`,left:{line:e},right:{line:e}});else i.push({type:`gap`,gap:t})};return e.forEach((e,t)=>{a(t),i.push({type:`hunk`,hunk:e}),R(e,e=>i.push({type:`pair`,left:{line:e},right:{line:e}}),e=>{let t=Math.max(e.dels.length,e.adds.length);for(let n=0;n<t;n++){let t=e.dels[n],r=e.adds[n];i.push({type:`pair`,...t?{left:{line:t,spans:e.delSpans[n]}}:{},...r?{right:{line:r,spans:e.addSpans[n]}}:{}})}})}),a(e.length),i}var V=r();function H({file:e,loadFileText:t,imageSrc:n}){let r=(0,g.useMemo)(()=>U(e),[e]),i=(0,g.useRef)(t);i.current=t;let a=(0,g.useRef)(n);a.current=n;let o=t!==void 0,[s,l]=(0,g.useState)(null);(0,g.useEffect)(()=>{let t=i.current;if(!t)return;let n=!1;return t(e.path).then(t=>!n&&l({path:e.path,text:t}),()=>!n&&l({path:e.path,text:null})),()=>{n=!0}},[e.path,e.patch,o]);let u=(0,g.useCallback)(t=>{let n=a.current,r=n?m(e.path,t):null;return r===null||!n?null:n(r)},[e.path]),d=s?.path===e.path?s:null;if(o&&d===null)return(0,V.jsx)(`p`,{role:`status`,className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`Loading preview…`});let f=d?.text??null;if(f===null&&r.text===``)return(0,V.jsx)(`p`,{className:`px-4 py-2.5 text-xs text-soft-foreground`,children:`No content changes to preview.`});let p=f!==null||r.complete?null:o?`The full file could not be loaded. Showing the changed sections only.`:`Showing the changed sections only.`;return(0,V.jsx)(`div`,{"data-slot":`diff-markdown-preview`,className:`px-4 py-5 md:px-6`,children:(0,V.jsxs)(`div`,{className:`mx-auto max-w-[72ch]`,children:[p?(0,V.jsx)(`p`,{className:`mb-4 text-xs text-soft-foreground`,children:p}):null,(0,V.jsx)(c,{document:!0,imageSrc:u,children:f??r.text})]})})}function U(e){let t=P(e.patch);return{text:t.hunks.map(e=>e.lines.filter(e=>e.kind!==`del`).map(e=>e.text).join(`
@@ -1,2 +1,2 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,u as n,w as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{i as o,vn as s}from"./project-scope-context-CaUqlAd7.js";import{xt as c}from"./queries-DYfIpJ-d.js";import{T as l,ct as u}from"./design-icons-DmYTv2r1.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./centered-state-DGyy0SuA.js";import{a as p,c as m,d as h,h as g,l as _,m as v,n as y,o as b,p as x,s as S,t as C,u as w}from"./markdown-D7DUNWcJ.js";var T=d(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),E=d(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),D=d(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),O=e(i(),1),k=a(),A=[[`scripts`,`remote script`,`remote scripts`],[`remote`,`remote resource`,`remote resources`],[`relative`,`linked file next to the report`,`linked files next to the report`],[`forms`,`form`,`forms`],[`embeds`,`embedded frame or object`,`embedded frames or objects`]];function j(e){let t=A.filter(([t])=>e[t]>0).map(([t,n,r])=>`${e[t]} ${e[t]===1?n:r}`);return t.length?t.join(`, `):null}var M={};function N(e){let t=(0,O.useMemo)(()=>w(e),[e]).join(` `),[n,r]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(!t)return;let e=!0;return h(t.split(` `)).then(n=>{e&&r({key:t,libraries:n})}),()=>{e=!1}},[t]),t?n?.key===t?n.libraries:null:M}function P({html:e,title:t,fragment:r,className:i}){let a=N(e);return a?(0,k.jsx)(F,{html:e,title:t,fragment:r,className:i,libraries:a}):(0,k.jsx)(`div`,{"data-slot":`html-report`,"aria-busy":`true`,className:n(`flex min-h-0 flex-col`,i)})}function F({html:e,title:t,fragment:r,className:i,libraries:a}){let{srcdoc:o,blocked:s}=(0,O.useMemo)(()=>{let n=m(e,a);return{srcdoc:_(n.srcdoc,t),blocked:n.blocked}},[e,a,t]),c=e=>{r&&/^#\S+$/.test(r)&&e.currentTarget.contentWindow?.frames[0]?.location.replace(`about:srcdoc${r}`)},l=j(s);return(0,k.jsxs)(`div`,{"data-slot":`html-report`,className:n(`flex min-h-0 flex-col`,i),children:[l?(0,k.jsxs)(`p`,{"data-slot":`html-report-blocked`,role:`note`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-foreground`,children:[`Blocked for your safety: `,l,`. Reports show only what they carry inside the file.`]}):null,(0,k.jsx)(`iframe`,{"data-slot":`html-report-frame`,title:t,sandbox:b,allow:p,srcDoc:o,referrerPolicy:`no-referrer`,onLoad:c,className:`block min-h-0 w-full flex-1 border-0 bg-report-canvas`})]})}var I=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function L(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:I.has(t.slice(n+1).toLowerCase())}function R(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return L(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}function z(e){return e.tooLarge?`too-large`:R(e.path)?`image`:e.binary?`binary`:`text`}function B(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}function V({runId:e,path:t,className:n}){let r=c(e,t??void 0);if(t===null)return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,k.jsx)(K,{className:n,children:(0,k.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof o&&r.error.status===409;return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:e?(0,k.jsx)(D,{}):(0,k.jsx)(u,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,k.jsx)(H,{runId:e,entry:r.data,className:n}):(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function H({runId:e,entry:t,className:n,imageUrl:r,downloadUrl:i,snapshot:a,readerHref:o,documentPreview:s=!1}){let[c,l]=(0,O.useState)(!1),u=s&&/\.(?:md|markdown)$/i.test(t.path),d=s&&S(t.path),f=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(t.path),p=s&&f&&t.size<=10*1024*1024?`image`:z(t),m=(u||d)&&p===`text`;return(0,k.jsxs)(K,{className:n,children:[(0,k.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,k.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,k.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:B(t.size)})]}),a||i||m?(0,k.jsx)(W,{snapshot:a,downloadUrl:i,source:m?c:null,onSource:()=>l(e=>!e),readerHref:d&&p===`text`?o:void 0}):null,(0,k.jsx)(U,{runId:e,entry:t,kind:p,showImage:p===`image`&&(!s||f),rendered:c?null:u?`markdown`:d?`html`:null,imageUrl:r})]})}function U({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:a}){return r?(0,k.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,k.jsx)(`img`,{"data-slot":`file-preview-image`,src:a??s(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,k.jsx)(f,{icon:(0,k.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${B(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${B(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,k.jsx)(`div`,{className:`p-4`,children:(0,k.jsx)(C,{document:!0,children:t.content??``})}):i===`html`?(0,k.jsx)(P,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,k.jsx)(Y,{path:t.path,text:t.content??``})}function W({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,k.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,k.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:r,children:n?`Preview`:`View source`}),i?(0,k.jsx)(G,{href:i}):null]})}function G({href:e}){let n=r(),i=t();return(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:t=>y(t,n,e,i),children:`Open reader`})}function K({className:e,children:t}){return(0,k.jsx)(`section`,{"data-slot":`file-preview`,className:n(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var q=1500;function J(e,t){let n=(0,O.useMemo)(()=>t.split(`
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,u as n,w as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{i as o,vn as s}from"./project-scope-context-B3M-u8R0.js";import{xt as c}from"./queries-DORTKwyN.js";import{T as l,ct as u}from"./design-icons-DmYTv2r1.js";import{t as d}from"./createLucideIcon-BHp8sXmF.js";import{t as f}from"./centered-state-DGyy0SuA.js";import{a as p,c as m,d as h,h as g,l as _,m as v,n as y,o as b,p as x,s as S,t as C,u as w}from"./markdown-D7DUNWcJ.js";var T=d(`file-exclamation-point`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 9v4`,key:`juzpu7`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}]]),E=d(`file-question-mark`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M12 17h.01`,key:`p32p05`}],[`path`,{d:`M9.1 9a3 3 0 0 1 5.82 1c0 2-3 3-3 3`,key:`mhlwft`}]]),D=d(`file-x`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m14.5 12.5-5 5`,key:`b62r18`}],[`path`,{d:`m9.5 12.5 5 5`,key:`1rk7el`}]]),O=e(i(),1),k=a(),A=[[`scripts`,`remote script`,`remote scripts`],[`remote`,`remote resource`,`remote resources`],[`relative`,`linked file next to the report`,`linked files next to the report`],[`forms`,`form`,`forms`],[`embeds`,`embedded frame or object`,`embedded frames or objects`]];function j(e){let t=A.filter(([t])=>e[t]>0).map(([t,n,r])=>`${e[t]} ${e[t]===1?n:r}`);return t.length?t.join(`, `):null}var M={};function N(e){let t=(0,O.useMemo)(()=>w(e),[e]).join(` `),[n,r]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(!t)return;let e=!0;return h(t.split(` `)).then(n=>{e&&r({key:t,libraries:n})}),()=>{e=!1}},[t]),t?n?.key===t?n.libraries:null:M}function P({html:e,title:t,fragment:r,className:i}){let a=N(e);return a?(0,k.jsx)(F,{html:e,title:t,fragment:r,className:i,libraries:a}):(0,k.jsx)(`div`,{"data-slot":`html-report`,"aria-busy":`true`,className:n(`flex min-h-0 flex-col`,i)})}function F({html:e,title:t,fragment:r,className:i,libraries:a}){let{srcdoc:o,blocked:s}=(0,O.useMemo)(()=>{let n=m(e,a);return{srcdoc:_(n.srcdoc,t),blocked:n.blocked}},[e,a,t]),c=e=>{r&&/^#\S+$/.test(r)&&e.currentTarget.contentWindow?.frames[0]?.location.replace(`about:srcdoc${r}`)},l=j(s);return(0,k.jsxs)(`div`,{"data-slot":`html-report`,className:n(`flex min-h-0 flex-col`,i),children:[l?(0,k.jsxs)(`p`,{"data-slot":`html-report-blocked`,role:`note`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-foreground`,children:[`Blocked for your safety: `,l,`. Reports show only what they carry inside the file.`]}):null,(0,k.jsx)(`iframe`,{"data-slot":`html-report-frame`,title:t,sandbox:b,allow:p,srcDoc:o,referrerPolicy:`no-referrer`,onLoad:c,className:`block min-h-0 w-full flex-1 border-0 bg-report-canvas`})]})}var I=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`bmp`,`ico`,`avif`]);function L(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?!1:I.has(t.slice(n+1).toLowerCase())}function R(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return L(e)||n>0&&t.slice(n+1).toLowerCase()===`svg`}function z(e){return e.tooLarge?`too-large`:R(e.path)?`image`:e.binary?`binary`:`text`}function B(e){return e>=1024**2?`${(e/1024**2).toFixed(1)} MB`:e>=1024?`${(e/1024).toFixed(1)} kB`:`${e} B`}function V({runId:e,path:t,className:n}){let r=c(e,t??void 0);if(t===null)return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(l,{size:16}),tone:`neutral`,heading:`h2`,title:`Select a file`,subtitle:`Pick a file from this task’s worktree to inspect its contents.`,className:`[&_[data-slot=centered-state-tile]]:size-10 [&_[data-slot=centered-state-tile]]:border-0 [&_[data-slot=centered-state-tile]]:bg-transparent [&_[data-slot=centered-state-tile]]:text-accent-text [&_[data-slot=centered-state-tile]]:shadow-none [&_h2]:text-xl`})});if(r.isPending)return(0,k.jsx)(K,{className:n,children:(0,k.jsxs)(`p`,{"data-slot":`file-preview-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground`,children:[`Loading `,t,`…`]})});if(r.isError){let e=r.error instanceof o&&r.error.status===409;return(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:e?(0,k.jsx)(D,{}):(0,k.jsx)(u,{size:16}),tone:e?`neutral`:`danger`,heading:`h2`,title:e?`Cannot preview this file`:`Could not load this file`,subtitle:r.error.message})})}return r.data.type===`file`?(0,k.jsx)(H,{runId:e,entry:r.data,className:n}):(0,k.jsx)(K,{className:n,children:(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Choose a file inside this directory`,subtitle:`Expand the folder in the tree, or enter the full path to a file.`})})}function H({runId:e,entry:t,className:n,imageUrl:r,downloadUrl:i,snapshot:a,readerHref:o,documentPreview:s=!1}){let[c,l]=(0,O.useState)(!1),u=s&&/\.(?:md|markdown)$/i.test(t.path),d=s&&S(t.path),f=/\.(?:png|jpe?g|gif|webp|bmp|ico|avif)$/i.test(t.path),p=s&&f&&t.size<=10*1024*1024?`image`:z(t),m=(u||d)&&p===`text`;return(0,k.jsxs)(K,{className:n,children:[(0,k.jsxs)(`header`,{"data-slot":`file-preview-head`,className:`flex items-center gap-2 border-b border-border bg-muted/40 px-4 py-2 text-xs`,children:[(0,k.jsx)(`span`,{className:`min-w-0 truncate font-mono font-medium`,children:t.path}),(0,k.jsx)(`span`,{className:`ml-auto shrink-0 tabular-nums text-soft-foreground`,children:B(t.size)})]}),a||i||m?(0,k.jsx)(W,{snapshot:a,downloadUrl:i,source:m?c:null,onSource:()=>l(e=>!e),readerHref:d&&p===`text`?o:void 0}):null,(0,k.jsx)(U,{runId:e,entry:t,kind:p,showImage:p===`image`&&(!s||f),rendered:c?null:u?`markdown`:d?`html`:null,imageUrl:r})]})}function U({runId:e,entry:t,kind:n,showImage:r,rendered:i,imageUrl:a}){return r?(0,k.jsx)(`div`,{className:`flex justify-center p-4`,children:(0,k.jsx)(`img`,{"data-slot":`file-preview-image`,src:a??s(e,t.path),alt:t.path,className:`max-h-[70vh] max-w-full rounded-sm`})}):n===`too-large`?(0,k.jsx)(f,{icon:(0,k.jsx)(T,{}),tone:`neutral`,heading:`h2`,title:`Too large to preview`,subtitle:`${B(t.size)} — past the preview cap. Open it in your editor instead.`}):n===`binary`?(0,k.jsx)(f,{icon:(0,k.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`Binary file`,subtitle:`${B(t.size)} of binary data — no text preview.`}):i===`markdown`?(0,k.jsx)(`div`,{className:`p-4`,children:(0,k.jsx)(C,{document:!0,children:t.content??``})}):i===`html`?(0,k.jsx)(P,{html:t.content??``,title:`Report: ${t.path}`,className:`h-[70vh]`}):(0,k.jsx)(Y,{path:t.path,text:t.content??``})}function W({snapshot:e,downloadUrl:t,source:n,onSource:r,readerHref:i}){return(0,k.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3 border-b border-border px-4 py-2 text-xs`,children:[e?(0,k.jsxs)(`span`,{children:[`Published snapshot · `,e]}):null,t?(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center text-accent-text underline`,href:t,children:`Download`}):null,n===null?null:(0,k.jsx)(`button`,{className:`min-h-11 rounded px-2 text-accent-text underline focus-visible:ring-2`,onClick:r,children:n?`Preview`:`View source`}),i?(0,k.jsx)(G,{href:i}):null]})}function G({href:e}){let n=r(),i=t();return(0,k.jsx)(`a`,{className:`inline-flex min-h-11 items-center px-2 text-accent-text underline focus-visible:ring-2`,href:e,onClick:t=>y(t,n,e,i),children:`Open reader`})}function K({className:e,children:t}){return(0,k.jsx)(`section`,{"data-slot":`file-preview`,className:n(`flex flex-col overflow-hidden rounded-lg border border-border bg-card`,e),children:t})}var q=1500;function J(e,t){let n=(0,O.useMemo)(()=>t.split(`
2
2
  `).map(e=>[{content:e}]),[t]),r=(0,O.useMemo)(()=>g(e),[e]),i=n.length>q,[a,o]=(0,O.useState)(null);return(0,O.useEffect)(()=>{if(r===null||i)return;let n=!1;return x(t,r).then(r=>{n||o({key:`${e}\0${t}`,tokens:r.tokens})}),()=>{n=!0}},[e,t,r,i]),r===null||i?n:a?.key===`${e}\0${t}`?a.tokens:v(t,r)?.tokens??n}function Y({path:e,text:t}){let n=J(e,t);return(0,k.jsx)(`div`,{"data-slot":`file-preview-code`,"data-lang":g(e)??`plaintext`,className:`overflow-x-auto py-2 font-mono text-xs leading-[1.7]`,children:n.map((e,t)=>(0,k.jsxs)(`div`,{className:`flex px-4`,children:[(0,k.jsx)(`span`,{className:`w-10 shrink-0 select-none pr-3 text-right tabular-nums text-soft-foreground`,children:t+1}),(0,k.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre pr-4`,children:e.map((e,t)=>(0,k.jsx)(`span`,{style:e.color===void 0?void 0:{color:e.color},children:e.content},t))})]},t))})}export{R as a,E as c,B as i,T as l,H as n,P as o,V as r,D as s,Y as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{i as o,p as s,r as c,t as l}from"./dropdown-menu-DhrBcVgr.js";import{s as u}from"./popover-DRcRI46x.js";import{E as d,I as f,M as p,d as m,lt as h}from"./design-icons-DmYTv2r1.js";import{t as g}from"./createLucideIcon-BHp8sXmF.js";import{n as _,r as v,t as y}from"./diff-controls-BR2uqhwG.js";import{K as b,Lt as x}from"./index-D489J7QW.js";var S=g(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),C=g(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),w=e(i(),1),T=a();function E({root:e,selected:t,onSelect:n}){return(0,T.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function D({adds:e,dels:t}){return(0,T.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,T.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function O({dir:e,depth:t,selected:n,onSelect:i}){let[a,o]=(0,w.useState)(!0);return(0,T.jsxs)(`li`,{children:[(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":a?`open`:`closed`,"aria-expanded":a,onClick:()=>o(e=>!e),className:`flex min-h-11 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,T.jsx)(m,{size:16,"aria-hidden":`true`,className:r(`size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}),(0,T.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]}),a?(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:t+1,selected:n,onSelect:i},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:i},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:i}){let a=n===e.path;return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":a?`true`:void 0,onClick:()=>i(e.path),className:r(`flex min-h-11 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,a?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,T.jsx)(C,{"aria-hidden":`true`,className:r(`size-3.5 shrink-0`,k[e.status])}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]})})}function j(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function M(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(M)}}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=j(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=j(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(N),e.files.sort(N)};return i(t),{...t,dirs:t.dirs.map(M)}}function F({bar:e,healthReady:t,branch:i,stat:a,mode:u,wrap:d,preview:f=!1,onModeChange:p,onWrapChange:m,onPreviewChange:h,onAction:g}){return(0,T.jsxs)(`div`,{"data-slot":`git-toolbar`,"data-health-ready":t,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9 [&_button]:min-h-11`,children:[i?(0,T.jsx)(y,{branch:i}):null,a?(0,T.jsx)(R,{stat:a}):null,h?(0,T.jsx)(`span`,{className:`ml-auto flex items-center`,children:(0,T.jsx)(v,{preview:f,onPreviewChange:h})}):null,(0,T.jsxs)(`span`,{className:r(`flex items-center gap-1`,h?`max-md:ml-auto`:`ml-auto`),children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(_,{mode:u,wrap:d,onModeChange:p,onWrapChange:m})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:g},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:g}),e.menu.length>0?(0,T.jsxs)(l,{children:[(0,T.jsx)(s,{asChild:!0,children:(0,T.jsx)(n,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(S,{"aria-hidden":`true`})})}),(0,T.jsx)(c,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(o,{disabled:!e.enabled,title:e.reason,onSelect:()=>g(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(p,{size:16,"aria-hidden":`true`}),push:(0,T.jsx)(h,{size:16,"aria-hidden":`true`}),"create-pr":(0,T.jsx)(f,{size:16,"aria-hidden":`true`}),"view-pr":(0,T.jsx)(u,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(x,{"aria-hidden":`true`})};function L({action:e,variant:r,onAction:i}){return e.id===`view-pr`?t(e.href)?(0,T.jsx)(n,{asChild:!0,variant:r,size:`sm`,"data-action":e.id,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[I[e.id],e.label]})}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[I[e.id],e.label]}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>i(e.id),children:[I[e.id],e.label]})}function R({stat:e}){return(0,T.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,T.jsx)(b,{stat:{adds:z(e.adds),dels:z(e.dels),files:e.files}})})}function z(e){let[t,n]=(0,w.useState)(e),r=(0,w.useRef)(e);return(0,w.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{E as i,F as n,P as r,R as t};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{d as t,t as n,u as r}from"./button-CHUAMTHK.js";import{i,t as a}from"./react-runtime-CCIEwYL0.js";import{i as o,p as s,r as c,t as l}from"./dropdown-menu-DhrBcVgr.js";import{s as u}from"./popover-DRcRI46x.js";import{E as d,I as f,M as p,d as m,lt as h}from"./design-icons-DmYTv2r1.js";import{t as g}from"./createLucideIcon-BHp8sXmF.js";import{n as _,r as v,t as y}from"./diff-controls-BR2uqhwG.js";import{K as b,Lt as x}from"./index-FoxgrgAH.js";var S=g(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),C=g(`file`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}]]),w=e(i(),1),T=a();function E({root:e,selected:t,onSelect:n}){return(0,T.jsx)(`nav`,{"data-slot":`changes-tree`,"aria-label":`Changed files`,className:`min-w-0 text-[13px]`,children:(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:0,selected:t,onSelect:n},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:0,selected:t,onSelect:n},e.path))]})})}function D({adds:e,dels:t}){return(0,T.jsxs)(`span`,{className:`ml-auto shrink-0 pl-2 font-mono text-[11px] font-medium tabular-nums`,children:[e>0?(0,T.jsxs)(`span`,{className:`text-success`,children:[`+`,e]}):null,e>0&&t>0?` `:null,t>0?(0,T.jsxs)(`span`,{className:`text-danger`,children:[`−`,t]}):null]})}function O({dir:e,depth:t,selected:n,onSelect:i}){let[a,o]=(0,w.useState)(!0);return(0,T.jsxs)(`li`,{children:[(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-dir`,"data-path":e.path,"data-state":a?`open`:`closed`,"aria-expanded":a,onClick:()=>o(e=>!e),className:`flex min-h-11 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground`,style:{paddingLeft:`${6+t*14}px`},children:[(0,T.jsx)(m,{size:16,"aria-hidden":`true`,className:r(`size-3.5 shrink-0 transition-transform motion-reduce:transition-none`,a&&`rotate-90`)}),(0,T.jsx)(d,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,T.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]}),a?(0,T.jsxs)(`ul`,{className:`flex flex-col gap-px`,children:[e.dirs.map(e=>(0,T.jsx)(O,{dir:e,depth:t+1,selected:n,onSelect:i},e.path)),e.files.map(e=>(0,T.jsx)(A,{file:e,depth:t+1,selected:n,onSelect:i},e.path))]}):null]})}var k={added:`text-success`,deleted:`text-danger`};function A({file:e,depth:t,selected:n,onSelect:i}){let a=n===e.path;return(0,T.jsx)(`li`,{children:(0,T.jsxs)(`button`,{type:`button`,"data-slot":`tree-file`,"data-path":e.path,"aria-current":a?`true`:void 0,onClick:()=>i(e.path),className:r(`flex min-h-11 w-full min-w-0 items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted`,a?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:{paddingLeft:`${24+t*14}px`},children:[(0,T.jsx)(C,{"aria-hidden":`true`,className:r(`size-3.5 shrink-0`,k[e.status])}),(0,T.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name}),(0,T.jsx)(D,{adds:e.adds,dels:e.dels})]})})}function j(e,t){return{kind:`dir`,name:e,path:t,dirs:[],files:[],adds:0,dels:0,fileCount:0}}function M(e){let t=e;for(;t.files.length===0&&t.dirs.length===1;){let e=t.dirs[0];t={...e,name:`${t.name}/${e.name}`}}return{...t,dirs:t.dirs.map(M)}}var N=(e,t)=>e.name.localeCompare(t.name);function P(e){let t=j(``,``),n=new Map([[``,t]]),r=e=>{let t=n.get(e);if(t)return t;let i=e.lastIndexOf(`/`),a=r(i===-1?``:e.slice(0,i)),o=j(i===-1?e:e.slice(i+1),e);return a.dirs.push(o),n.set(e,o),o};for(let t of e){let e=t.path.lastIndexOf(`/`);r(e===-1?``:t.path.slice(0,e)).files.push({kind:`file`,name:e===-1?t.path:t.path.slice(e+1),path:t.path,status:t.status,adds:t.adds,dels:t.dels,binary:t.binary})}let i=e=>{e.dirs.forEach(i),e.adds=e.files.reduce((e,t)=>e+t.adds,0)+e.dirs.reduce((e,t)=>e+t.adds,0),e.dels=e.files.reduce((e,t)=>e+t.dels,0)+e.dirs.reduce((e,t)=>e+t.dels,0),e.fileCount=e.files.length+e.dirs.reduce((e,t)=>e+t.fileCount,0),e.dirs.sort(N),e.files.sort(N)};return i(t),{...t,dirs:t.dirs.map(M)}}function F({bar:e,healthReady:t,branch:i,stat:a,mode:u,wrap:d,preview:f=!1,onModeChange:p,onWrapChange:m,onPreviewChange:h,onAction:g}){return(0,T.jsxs)(`div`,{"data-slot":`git-toolbar`,"data-health-ready":t,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9 [&_button]:min-h-11`,children:[i?(0,T.jsx)(y,{branch:i}):null,a?(0,T.jsx)(R,{stat:a}):null,h?(0,T.jsx)(`span`,{className:`ml-auto flex items-center`,children:(0,T.jsx)(v,{preview:f,onPreviewChange:h})}):null,(0,T.jsxs)(`span`,{className:r(`flex items-center gap-1`,h?`max-md:ml-auto`:`ml-auto`),children:[(0,T.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,T.jsx)(_,{mode:u,wrap:d,onModeChange:p,onWrapChange:m})}),e.secondary.map(e=>(0,T.jsx)(L,{action:e,variant:`outline`,onAction:g},e.id)),(0,T.jsx)(L,{action:e.primary,variant:`primary`,onAction:g}),e.menu.length>0?(0,T.jsxs)(l,{children:[(0,T.jsx)(s,{asChild:!0,children:(0,T.jsx)(n,{variant:`ghost`,size:`icon-sm`,"aria-label":`More git actions`,children:(0,T.jsx)(S,{"aria-hidden":`true`})})}),(0,T.jsx)(c,{align:`end`,"data-slot":`git-toolbar-menu`,children:e.menu.map(e=>(0,T.jsxs)(o,{disabled:!e.enabled,title:e.reason,onSelect:()=>g(e.id),children:[I[e.id],e.label]},e.id))})]}):null]})]})}var I={commit:(0,T.jsx)(p,{size:16,"aria-hidden":`true`}),push:(0,T.jsx)(h,{size:16,"aria-hidden":`true`}),"create-pr":(0,T.jsx)(f,{size:16,"aria-hidden":`true`}),"view-pr":(0,T.jsx)(u,{"aria-hidden":`true`}),"open-terminal":(0,T.jsx)(x,{"aria-hidden":`true`})};function L({action:e,variant:r,onAction:i}){return e.id===`view-pr`?t(e.href)?(0,T.jsx)(n,{asChild:!0,variant:r,size:`sm`,"data-action":e.id,children:(0,T.jsxs)(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`,children:[I[e.id],e.label]})}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!0,title:`View PR unavailable — the recorded PR link is not an http(s) URL`,children:[I[e.id],e.label]}):(0,T.jsxs)(n,{variant:r,size:`sm`,"data-action":e.id,disabled:!e.enabled,title:e.enabled?void 0:e.reason,onClick:()=>i(e.id),children:[I[e.id],e.label]})}function R({stat:e}){return(0,T.jsx)(`span`,{"data-slot":`changes-stat`,children:(0,T.jsx)(b,{stat:{adds:z(e.adds),dels:z(e.dels),files:e.files}})})}function z(e){let[t,n]=(0,w.useState)(e),r=(0,w.useRef)(e);return(0,w.useEffect)(()=>{let t=r.current;if(t===e)return;if(typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches||typeof requestAnimationFrame!=`function`){r.current=e,n(e);return}let i=performance.now(),a=0,o=s=>{let c=Math.min(1,(s-i)/350),l=1-(1-c)**3;n(Math.round(t+(e-t)*l)),c<1?a=requestAnimationFrame(o):r.current=e};return a=requestAnimationFrame(o),()=>{cancelAnimationFrame(a),r.current=e,n(e)}},[e]),t}export{E as i,F as n,P as r,R as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,M as r,t as i,u as a}from"./button-CHUAMTHK.js";import{i as o,t as s}from"./react-runtime-CCIEwYL0.js";import"./live-refetch-C0kQc3-z.js";import{$ as c,Hn as l,Jr as u,Z as d,et as f,nn as p,ri as m,tt as h}from"./project-scope-context-CaUqlAd7.js";import{An as g,Cn as _,D as v,E as y,N as b,P as ee,Pt as te,Un as x,X as S,j as ne,k as C,l as w,n as T}from"./queries-DYfIpJ-d.js";import{n as E}from"./toaster-B1MyeHiE.js";import{_ as D,a as O,d as k,f as A,g as re,i as j,m as M,n as N,p as ie,r as ae,t as oe,u as P}from"./github-sidebar-model-Ct0DltOv.js";import{i as F,r as I,t as L}from"./popover-DRcRI46x.js";import{I as R,L as se,Q as ce,Z as z,ct as B,l as le,m as V,r as ue,u as H}from"./design-icons-DmYTv2r1.js";import{a as de,t as U}from"./loader-circle-CZkGEdoI.js";import{l as fe,n as pe}from"./nav-row-styles-BZUUavOF.js";import{r as me,t as W}from"./project-router-1m_VlC22.js";import{t as G}from"./centered-state-DGyy0SuA.js";import{A as he,E as ge,M as _e,O as ve,j as K}from"./agent-accounts-BCg-578Q.js";import{Pt as ye,X as be,Xt as xe,Zt as Se,n as Ce,ot as we,q as Te,t as Ee,yt as De}from"./index-D489J7QW.js";import{a as Oe,d as ke,f as Ae,i as je,l as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le,u as q}from"./use-hand-to-agent-state-BkmKad8x.js";import{t as J}from"./tab-link-DCUifQ46.js";var Y=e(o(),1),X=`cez-github-list-width`;function Z(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 Re(){try{let e=localStorage.getItem(X);return e===null?360:Z(e)}catch{return 360}}function ze(e){try{localStorage.setItem(X,String(Z(e)))}catch{}}var Q=s();function Be({number:e,repo:t}){let n=r();return(0,Q.jsx)(Ve,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function Ve({number:e,repo:t,scope:n}){let r=(0,Y.useId)(),a=(0,Y.useId)(),[o,s]=(0,Y.useState)(!1),c=o?Se:xe,u=S(n,!0,n==="default"),d=w(`#${e}`,!0),f=(0,Y.useMemo)(()=>ie(g(u.data??[],d.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[u.data,d.data,e,t,n]);return(0,Q.jsxs)(`section`,{"aria-labelledby":r,className:`mt-4 min-w-0 rounded-lg border border-border p-3`,children:[(0,Q.jsx)(`h3`,{id:r,className:`text-xs font-semibold text-muted-foreground`,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":o,"aria-controls":a,onClick:()=>s(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Q.jsxs)(`span`,{children:[`Linked tasks`,u.data?` (${f.length}${d.hasNextPage||d.isError?`+`:``})`:``]})]})}),(0,Q.jsx)(`div`,{id:a,children:o?(0,Q.jsxs)(Q.Fragment,{children:[u.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,u.isError?(0,Q.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,Q.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void u.refetch(),disabled:u.isFetching,children:`Retry linked tasks`})]}):null,u.data&&f.length===0&&!u.isError?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,f.length>0?(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:f.map(e=>{let t=l(e);return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(W,{to:`/tasks/${encodeURIComponent(e.id)}`,className:`flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-2 py-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:_(e)}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(we,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,Q.jsx)(`span`,{className:`rounded border border-border px-1`,children:`Archived`}):null,(0,Q.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,d.isError?(0,Q.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,Q.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.refetch(),disabled:d.isFetching,children:`Retry older linked tasks`})]}):d.hasNextPage?(0,Q.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.fetchNextPage(),disabled:d.isFetchingNextPage,children:d.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var He=`w-44 max-w-full`,$=`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 Ue(e,t){let n=new Map;for(let t of e)for(let e of t.assignees??[])n.set(e.toLowerCase(),e);for(let e of t)n.set(e.toLowerCase(),e);return[...n.values()].sort((e,t)=>e.localeCompare(t))}function We(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function Ge(e){let t=` Previous memberships are shown; issues with unknown membership remain visible.`;return e.projectsState===`refreshing`&&e.projects?`Refreshing project boards.${t}`:e.projectsState===`unavailable`&&e.projects?`${e.projectsReason}${t}`:e.projects?``:e.projectsReason??(e.projectsState===`refreshing`?`Project memberships pending.`:`Project boards unavailable.`)}function Ke(e){return[e.viewerLogin?``:`GitHub login unavailable.`,Ge(e)].filter(Boolean).join(` `)}function qe({options:e,assignees:t,onAssigneesChange:n}){return(0,Q.jsxs)(L,{children:[(0,Q.jsx)(F,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:$,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,Q.jsx)(H,{size:12,"aria-hidden":`true`,className:`ml-1 inline size-3 shrink-0 align-[-1px] text-soft-foreground`})]})}),(0,Q.jsx)(I,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Q.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Q.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),e.map(e=>{let r=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,Q.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Q.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function Je({data:e,projectId:t,onProjectChange:n,pickerRef:r}){return e.projects?.length?(0,Q.jsxs)(`select`,{ref:r,"aria-label":`Project board`,className:`${$} ${He}`,value:t,onChange:e=>n(e.target.value),children:[(0,Q.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects||e.projectsState?(0,Q.jsx)(`select`,{ref:r,"aria-label":`Project board`,className:`${$} ${He}`,disabled:!0,value:``,children:(0,Q.jsx)(`option`,{value:``,children:e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`})}):null}function Ye({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,Q.jsxs)(L,{open:i,onOpenChange:a,children:[(0,Q.jsx)(F,{asChild:!0,children:(0,Q.jsx)(`button`,{ref:o,type:`button`,className:`${$} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,Q.jsx)(z,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,Q.jsx)(B,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,Q.jsx)(I,{ref:s,align:`start`,"data-slot":`gh-issue-status`,onCloseAutoFocus:e=>{r||e.preventDefault()},className:`w-72 max-w-[calc(100vw-2rem)] p-3 text-xs text-muted-foreground`,children:t||n.current})]})]})}function Xe({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,Y.useState)(!1),s=(0,Y.useRef)(null),c=(0,Y.useRef)(null),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=Ue(e.issues,t),f=We(e.viewerLogin,t),p=Ke(e),m=p!==``,h=(0,Y.useRef)(p);m&&(h.current=p);let g=(0,Y.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,Y.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{g.current&&!e.relatedTarget&&requestAnimationFrame(()=>{(!document.activeElement||document.activeElement===document.body)&&_()})};return e.addEventListener(`blur`,t),()=>e.removeEventListener(`blur`,t)},[]),(0,Y.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,Q.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,Q.jsx)(qe,{options:d,assignees:t,onAssigneesChange:r}),(0,Q.jsx)(`button`,{ref:u,type:`button`,className:`${$} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:`Assigned to me`}),(0,Q.jsx)(Je,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,Q.jsx)(Ye,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function Ze({onRefresh:e,refreshing:t}){let n=Ee(r());return(0,Q.jsxs)(`div`,{"data-route":`github`,"data-slot":`github-filter-screen`,className:pe,children:[(0,Q.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,Q.jsx)(`h1`,{className:a(fe,`min-w-0 flex-1`),children:`GitHub`}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,className:`-my-2 -mr-[10px] flex size-11 shrink-0 items-center justify-center rounded-md text-soft-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,children:(0,Q.jsx)(z,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,t&&`motion-safe:animate-spin`)})})]}),(0,Q.jsx)(Ce,{model:n,variant:`screen`})]})}function Qe(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function $e(e){let[t,n]=(0,Y.useState)(null);return(0,Y.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(Qe(e));t();let r=typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 768px)`):null;r?.addEventListener(`change`,t);let i=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return i?.observe(e),()=>{r?.removeEventListener(`change`,t),i?.disconnect()}},[e]),t}function et(e,t){let[n,r]=(0,Y.useState)(0);return(0,Y.useLayoutEffect)(()=>{let n=()=>{!e||!t||r(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[e,t]),n}function tt(e,t,n){let[r,i]=(0,Y.useState)(null),a=(0,Y.useRef)(n);return(0,Y.useEffect)(()=>{a.current=n}),(0,Y.useEffect)(()=>{if(!e||!r||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&a.current()},{root:t.getAttribute(`data-slot`)===`main`?null:t,rootMargin:`0px 0px 600px 0px`});return n.observe(r),()=>n.disconnect()},[e,r,t]),i}function nt(e,t,n,r,i){let[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),l=$e(a),u=(0,Y.useRef)(null);u.current=l;let d=et(s,l),f=e===`issues`?n?.issues.length??0:n?.prs.length??0,p=t.hasNextPage&&r===null&&f>0;return{listEl:a,setListEl:o,setRowsEl:c,scrollOwner:l,scrollOwnerRef:u,startMargin:d,pagingAvailable:p,manualPaging:p&&i,loadMoreRef:tt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}var rt=100;function it(e,t,n,r,i){if(!e?.available||t!==`prs`)return[];let a=new Set;n!==null&&Number.isInteger(n)&&a.add(n);for(let t of[...r,...i,...e.prs]){if(a.size>=rt)break;a.add(t.number)}return[...a]}function at(e,t,n,r,i,a){let o=it(n,e,r,i,a),s=y(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=v(e===`issues`?`issue`:`pr`,(0,Y.useMemo)(()=>(t.data?.pages??[]).map(t=>(e===`issues`?t.issues:t.prs).map(e=>e.number)),[t.data,e]),n?.available===!0&&n.commentsDeferred===!0),u=(0,Y.useMemo)(()=>new Set(n?.commentsDeferred?(e===`issues`?n.issues:n.prs).map(e=>e.number):[]),[n,e]);return{checkPrNumbers:o,checksMap:c,commentsOf:e=>l[e.number]??(u.has(e.number)?void 0:e.comments)}}function ot(e){let[t,n]=De(),r=t.get(`filter`),i=M(e,r);return{rawFilterParam:r,filter:i,activeFilter:i??`all`,setFilterParam:e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n})}}function st(e,t,{filter:n,activeFilter:r,setFilterParam:i}){let[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)([]),[l,u]=(0,Y.useState)([]),{setProjectFilter:d,activeProject:f}=ct(t),p=e===`issues`&&r===`assigned`,m=p?t?.viewerLogin?[t.viewerLogin]:[]:l;return{query:a,setQuery:o,labelFilter:s,setLabelFilter:c,setProjectFilter:d,activeProject:f,isAssignedFilter:p,effectiveAssignees:m,changeAssignees:e=>{u(e),p&&i(`all`)},clearFilters:()=>{o(``),c([]),u([]),d(``),n!==null&&n!==`all`&&i(`all`)},filtering:a.trim()!==``||s.length>0||e===`issues`&&(m.length>0||f!==``)||n!==null&&n!==`all`,narrowing:a.trim()!==``||s.length>0||e===`issues`&&(!p&&l.length>0||f!==``)}}function ct(e){let[t,n]=(0,Y.useState)(``),r=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,i=r||e?.projects?.some(e=>e.id===t)?t:``;return(0,Y.useEffect)(()=>{e&&!r&&t&&!i&&n(``)},[e,t,i,r]),{setProjectFilter:n,activeProject:i}}function lt(e,t,{filter:n,activeFilter:i},a){let o=r(),s=e===`issues`&&(i===`no-task`||i===`has-task`),c=S(o,s,o==="default"),l=(0,Y.useMemo)(()=>c.data?A(c.data,t?.repo,o):null,[c.data,t?.repo,o]),u=k(e,n)?D(n):null,d=b(`pr`,u??``,u!==null&&t?.available===!0),f=u!==null&&d.data?.available?d.data.items:null,p=(0,Y.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),m=(0,Y.useMemo)(()=>f?re(f,p):null,[f,p]),h=ut({view:e,gh:t,activeFilter:i,isAssignedFilter:a,taskFilter:s,taskNumbers:l,runsQuery:c,backedQuery:u,filterHits:f,filterSearch:d});return{backedQuery:u,filterSearch:d,fullList:p,filterRows:m,filterGate:h,openItems:(0,Y.useMemo)(()=>h?[]:m??p,[h,m,p]),narrow:(0,Y.useMemo)(()=>e===`issues`?i===`no-task`&&l?{excludeNumbers:l}:i===`has-task`&&l?{includeNumbers:l}:{}:i===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:f?{includeNumbers:new Set(f.map(e=>e.number))}:{},[e,i,l,t?.viewerLogin,f])}}function ut({view:e,gh:t,activeFilter:n,isAssignedFilter:r,taskFilter:i,taskNumbers:a,runsQuery:o,backedQuery:s,filterHits:c,filterSearch:l}){return t?.available?(r||e===`prs`&&n===`mine`)&&!t.viewerLogin?{kind:`blocked`,message:`GitHub login unavailable, so this filter cannot be applied.`}:i&&!a?o.isError?{kind:`blocked`,message:`The task list is unavailable, so this filter cannot be applied.`}:{kind:`loading`,message:`Loading tasks…`}:s!==null&&!c?l.data?.available===!1?{kind:`blocked`,message:`GitHub could not be searched: ${l.data.reason??`unknown reason`}.`}:l.isError?{kind:`blocked`,message:`GitHub could not be searched: ${l.error instanceof Error?l.error.message:`the search request failed`}.`}:{kind:`loading`,message:`Searching GitHub…`}:null:null}function dt(e,t){return t?h(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function ft(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let o=T.github()[0],s=t===void 0?null:Number.parseInt(t,10),c=!r&&n.data?.available?n.data.items.find(e=>e.number===s):void 0,l=i&&s!==null&&!a.some(e=>e.number===s)?i.find(e=>e.number===s):void 0,u=c??l,[d,f]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{u&&f({scope:o,view:e,item:u})},[o,e,u]),{selectedNumber:s,remoteDetail:u??(d?.scope===o&&d.view===e&&d.item.number===s?d.item:null)}}function pt(e,t,n,{fullList:r,filterRows:i},a){let o=u(),s=(0,Y.useRef)(null),c=e===`issues`?`issue`:`pr`,l=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,d=C(c,n??0,l),f=l&&d.data?.available&&d.data.item?.kind===c?d.data.item:null;s.current=l&&n!==null?{kind:c,number:n,key:T.githubItem(c,n)}:null;let[p,m]=(0,Y.useState)(!1);return{exactWanted:l,exactItem:d,exactDetail:f,exactTargetRef:s,retryingExact:p,retryExact:()=>{m(!0),dt(o,s.current).then(e=>{m(!1),e||E(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function mt(e,t,n){let r=u(),i=(0,Y.useRef)(null);return{refresh:x({mutationFn:e=>(dt(r,e),d({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:T.githubPages(50),exact:!0}),r.setQueryData(T.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:T.githubChecks(t)});let o=e===`issues`?`issue`:`pr`,s=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=T.githubCommentCounts(o,s);r.removeQueries({queryKey:T.githubCommentCounts(o,[]).slice(0,4),predicate:e=>e.queryHash!==m(l)}),a.available&&a.commentsDeferred&&s.length>0&&c(o,s,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:T.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:T.githubSearch(`pr`,O)}),r.invalidateQueries({queryKey:T.githubSearch(`pr`,N)});let u=i.current;if(!u){r.removeQueries({queryKey:[`github`,`comments`]});return}let d=T.githubComments(u.kind,u.number);f(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(d,e)).catch(()=>{}),r.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==m(d)})},onError:e=>E(e.message,{tone:`danger`})}),openThreadRef:i}}var ht=350;function gt(e,t){let[n,r]=(0,Y.useState)(e);return(0,Y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function _t(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=gt(n,ht),u=(0,Y.useMemo)(()=>q(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),d=n.trim()===l.trim(),f=t?.available===!0&&!c&&d&&Ae(l,u),p=b(e===`issues`?`issue`:`pr`,l,f),m=q(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),h=f&&p.data?.available?p.data:null,g=new Set(m.map(e=>e.number)),_=vt(e,h,a,i);return{debouncedQuery:l,searchWanted:f,forgeSearch:p,items:m,searchPayload:h,metadataFailure:_,searchHits:h&&!_?q(h.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!g.has(e.number)):[],...yt(n,d,f,p)}}function vt(e,t,n,r){return e===`issues`&&t?n&&t.items.some(e=>e.projectIds===void 0)?t.projectsReason??`Project board data is incomplete. Refresh to try again.`:r.length&&t.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null}function yt(e,t,n,r){return{searching:e.trim()!==``&&!t||n&&r.isPending,searchFailed:n&&(r.data?.available===!1||r.isError),searchFailureReason:r.data?.available===!1?r.data.reason??`unknown reason`:r.error instanceof Error?r.error.message:`the search request failed`}}function bt({width:e,onWidthChange:t}){let n=(0,Y.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(Z(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,Q.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(Z(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 xt({view:e,changes:n=!1,index:r=!1}){let{n:i}=t(),a=ot(e),{rawFilterParam:o,activeFilter:s}=a,c=Te(),{pages:l,data:u}=ne(50),d=ee().data?.capabilities?.automations===!0,f=Ct(),p=Le(),m=St({index:r,isDesktop:c,rawFilterParam:o,n:i,rememberedView:te().data?.githubView}),h=wt(u?.available===!0&&!m.filterScreen),[g,_]=(0,Y.useState)(!1),v=st(e,u,a),y=lt(e,u,a,v.isAssignedFilter),b=_t(e,u,v,y),x=ft(e,i,b.forgeSearch,y),S=pt(e,u,x.selectedNumber,y,x.remoteDetail),C=at(e,l,u,x.selectedNumber,b.searchHits,y.openItems),{refresh:w,openThreadRef:T}=mt(e,C.checkPrNumbers,b.debouncedQuery),E=nt(e,l,u,y.backedQuery,v.narrowing);if(m.restorePrs)return(0,Q.jsx)(me,{to:`/github/prs`,replace:!0});if(!u)return l.isError?(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(G,{icon:(0,Q.jsx)(B,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:l.error.message})}):(0,Q.jsx)(ye,{});T.current=null;let D=()=>w.mutate(S.exactTargetRef.current);if(m.filterScreen&&u.available)return(0,Q.jsx)(Ze,{onRefresh:D,refreshing:w.isPending});if(!u.available)return(0,Q.jsx)(kt,{reason:u.reason,refreshing:w.isPending,onRetry:D});let{labelColors:O,labelOptions:k}=Tt(u,b.searchPayload,y.openItems,y.fullList),A=Et({number:x.selectedNumber,items:b.items,searchHits:b.searchHits,fullList:y.fullList,filterRows:y.filterRows,remoteDetail:x.remoteDetail,exactDetail:S.exactDetail});T.current=A?{kind:A.kind,number:A.number}:null;let{linkFilter:re,listPath:j}=Dt(e,o,s,c),M={view:e,filter:re,colors:O,selected:A,queued:p.queued,checksMap:C.checksMap,commentsOf:C.commentsOf},N=Ot(e,v,y.filterGate,b);return(0,Q.jsxs)(`div`,{ref:h.routeRef,"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:px-7 md:pt-4 md:pb-4`,children:[(0,Q.jsx)(At,{view:e,activeFilter:s,isDesktop:c,rawFilterParam:o,n:i,gh:u}),(0,Q.jsxs)(`div`,{ref:h.workspaceRef,"data-slot":`gh-workspace`,"data-stacked":h.panesStacked,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 md:h-[calc(var(--gh-workspace-height,calc(100dvh-4rem))-1rem)] md:flex-none md:gap-[22px]`,children:[(0,Q.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-[22px]`,children:[(0,Q.jsx)(jt,{view:e,isDesktop:c,gh:u,automationsAvailable:d,onSaveView:f,refreshing:w.isPending,onRefresh:D}),(0,Q.jsx)(Mt,{view:e,gh:u,filters:v,labelOptions:k,labelColors:O,searchPayload:b.searchPayload})]}),(0,Q.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 md:items-stretch md:overflow-hidden`,children:[(0,Q.jsx)(Ft,{view:e,n:i,rows:M,verdict:N,search:b,sidebar:y,list:l,paging:E,width:h.githubListWidth,onWidthChange:h.changeGithubListWidth,expanded:g,onExpandedChange:_}),(0,Q.jsx)(Vt,{view:e,n:i,selected:A,selectedNumber:x.selectedNumber,exact:S,repo:u.repo,rows:M,listPath:j,changes:n,handToAgent:p})]})]})]})}function St({index:e,isDesktop:t,rawFilterParam:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&n===null&&r===void 0,restorePrs:e&&t&&n===null&&i===`prs`}}function Ct(){let e=u();return t=>{e.setQueryData(T.uiState,e=>({...e,githubView:t})),p({githubView:t}).then(t=>e.setQueryData(T.uiState,t)).catch(t=>{E(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:T.uiState})})}}function wt(e){let[t,n]=(0,Y.useState)(Re),[r,i]=(0,Y.useState)(!0),a=(0,Y.useRef)(null),o=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{if(!e)return;let n=a.current,r=o.current,s=n?.closest(`[data-slot="main"]`);if(!n||!r||!s)return;let c=window.matchMedia(`(min-width: 768px)`),l=!1,u=()=>{if(l=c.matches&&r.clientWidth>=t+22+360,i(!l),!l||s.clientHeight<1){n.style.removeProperty(`--gh-workspace-height`);return}n.style.setProperty(`--gh-workspace-height`,`${Math.round(s.clientHeight)}px`)};u();let d=new ResizeObserver(u);d.observe(s),d.observe(r);let f=e=>{if(!l||e.ctrlKey||!e.deltaY||Math.abs(e.deltaX)>Math.abs(e.deltaY)||r.getBoundingClientRect().top<=s.getBoundingClientRect().top+1||!(e.target instanceof Element)||!e.target.closest(`[data-slot="gh-panes"]`))return;e.preventDefault();let t=e.deltaMode===1?16:e.deltaMode===2?s.clientHeight:1;s.scrollTop+=e.deltaY*t};return r.addEventListener(`wheel`,f,{passive:!1}),c.addEventListener(`change`,u),()=>{r.removeEventListener(`wheel`,f),d.disconnect(),c.removeEventListener(`change`,u)}},[e,t]),{githubListWidth:t,changeGithubListWidth:e=>{let t=Z(e);n(t),ze(t)},panesStacked:r,routeRef:a,workspaceRef:o}}function Tt(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:Me([...n,...r,...t?.items??[]])}}function Et({number:e,items:t,searchHits:n,fullList:r,filterRows:i,remoteDetail:a,exactDetail:o}){return e===null?t[0]??n[0]??null:r.find(t=>t.number===e)??i?.find(t=>t.number===e)??a??o??null}function Dt(e,t,n,r){let i=t===null?null:n;return{linkFilter:i,listPath:P(e,i??(e===`issues`&&!r?`all`:null))}}function Ot(e,{query:t,filtering:n},r,{searching:i,searchFailed:a,searchFailureReason:o,metadataFailure:s,searchHits:c,searchPayload:l,items:u}){let d=e===`issues`?`issues`:`pull requests`;return r?(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5`,"data-slot":`gh-filter-gate`,"data-kind":r.kind,children:[r.kind===`loading`?(0,Q.jsx)(U,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(U,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,Q.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,Q.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,Q.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,Q.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,Q.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,Q.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,Q.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,Q.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,Q.jsxs)(`p`,{children:[`No open `,d,`.`]})}function kt({reason:e,refreshing:t,onRetry:r}){return(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(G,{icon:(0,Q.jsx)(se,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,Q.jsx)(i,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:r,children:`Try again`}),children:(0,Q.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Q.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in `,n(`cezar`),` works without it.`]})})})}function At({view:e,activeFilter:t,isDesktop:n,rawFilterParam:r,n:i,gh:a}){return(0,Q.jsxs)(`div`,{"data-slot":`gh-masthead`,className:`flex min-w-0 shrink-0 flex-col gap-1 md:flex-row md:items-baseline md:gap-3`,children:[(0,Q.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:n?`${e===`issues`?`Issues`:`Pull requests`} · ${oe[t]}`:`GitHub`}),r!==null&&i===void 0?(0,Q.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`flex min-w-0 items-center gap-3 md:hidden`,children:[(0,Q.jsxs)(W,{to:`/github`,"data-slot":`gh-back-filters`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(ue,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,Q.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-soft-foreground`,children:[...ae,...j].find(e=>e.id===t)?.label})]}):null,a.repo?(0,Q.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground md:text-[11px] md:text-soft-foreground`,children:[(0,Q.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,Q.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,a.syncedAt?`Synced ${de(a.syncedAt)} ago`:`Not synced yet`]})]}):null]})}function jt({view:e,isDesktop:t,gh:n,automationsAvailable:r,onSaveView:i,refreshing:o,onRefresh:s}){return(0,Q.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Q.jsxs)(J,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>i(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,Q.jsxs)(J,{to:`/github/prs`,active:e===`prs`,onClick:()=>i(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]}),r?(0,Q.jsx)(W,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:o,onClick:s,className:`gh-utility`,children:[(0,Q.jsx)(z,{size:16,"aria-hidden":`true`,className:a(`size-3.5`,o&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function Mt({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,Q.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Q.jsx)(ce,{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,Q.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:e===`issues`?`Filter issues…`:`Filter pull requests…`,value:n.query,onChange:e=>n.setQuery(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,Q.jsx)(qt,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,Q.jsx)(Xe,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,Q.jsx)(`button`,{type:`button`,disabled:!n.filtering,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:n.clearFilters,children:`Clear filters`})]})}function Nt(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Pt(e,t){return(0,Q.jsx)(Kt,{item:e,view:t.view,filter:t.filter,colors:t.colors,active:t.selected?.url===e.url,queued:t.queued.has(e.url),checks:Nt(e,t.checksMap),comments:t.commentsOf(e)})}function Ft({view:e,n:t,rows:n,verdict:r,search:i,sidebar:a,list:o,paging:s,width:c,onWidthChange:l,expanded:u,onExpandedChange:d}){let{items:f,searchHits:p}=i,m=e===`issues`&&t!==void 0&&!u;return(0,Q.jsxs)(`section`,{ref:s.setListEl,"data-slot":`gh-list`,"data-mobile-preview":m||void 0,style:{"--github-list-width":`${c}px`},className:`relative flex w-full min-h-0 min-w-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0 md:overflow-x-hidden md:overflow-y-auto`,children:[f.length===0?r&&(0,Q.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):(0,Q.jsx)(It,{items:f,rows:n,compactPreview:m,paging:s}),s.pagingAvailable?(0,Q.jsx)(Lt,{view:e,list:o,paging:s}):null,(0,Q.jsx)(Rt,{backedQuery:a.backedQuery,filterSearch:a.filterSearch}),(0,Q.jsx)(zt,{view:e,n:t,count:f.length,expanded:u,onExpandedChange:d}),f.length>0&&i.searchWanted&&r?(0,Q.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):null,p.length>0?(0,Q.jsx)(Bt,{hits:p,searchPayload:i.searchPayload,rows:n}):null,(0,Q.jsx)(bt,{width:c,onWidthChange:l})]})}function It({items:e,rows:t,compactPreview:n,paging:r}){let{setRowsEl:i,scrollOwner:a,listEl:o,scrollOwnerRef:s,startMargin:c}=r,l=e.map((e,r)=>(0,Q.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":r>0||void 0,"data-compact-hidden":n&&r>=2&&t.selected?.url!==e.url||void 0,children:Pt(e,t)},e.url));return(0,Q.jsx)(`div`,{ref:i,"data-slot":`gh-rows`,"data-virtualized":a?`true`:void 0,role:`list`,children:a?(0,Q.jsx)(be,{scrollRef:s,startMargin:c,children:l},a===o?`list`:`main`):l})}function Lt({view:e,list:t,paging:n}){return(0,Q.jsx)(`div`,{ref:n.loadMoreRef,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-soft-foreground`,children:t.isFetchingNextPage?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,Q.jsxs)(Q.Fragment,{children:[`Could not load more.`,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Retry`})]}):n.manualPaging?(0,Q.jsxs)(Q.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-manual`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Load more`})]}):null})}function Rt({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,Q.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-soft-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function zt({view:e,n:t,count:n,expanded:r,onExpandedChange:a}){return e===`issues`&&t!==void 0&&n>2?(0,Q.jsx)(i,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":r,onClick:()=>a(e=>!e),children:r?`Show fewer issues`:`View all ${n} issues`}):null}function Bt({hits:e,searchPayload:t,rows:n}){return(0,Q.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Q.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,Q.jsx)(`li`,{children:Pt(e,n)},e.url))})]})}function Vt({view:e,n:t,selected:n,selectedNumber:r,exact:i,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}){let{exactWanted:d,exactItem:f}=i;return(0,Q.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 md:overflow-y-auto`,t===void 0?`hidden md:flex`:`flex`),children:n?(0,Q.jsx)(Ht,{item:n,n:t,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}):d&&f.isPending?(0,Q.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,Q.jsx)(G,{icon:(0,Q.jsx)(U,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${r}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):d&&(f.isError||f.data?.available===!1)?(0,Q.jsx)(Ut,{number:r,exact:i}):(0,Q.jsx)(Wt,{view:e,number:r})})}function Ht({item:e,n:t,repo:n,rows:r,listPath:i,changes:a,handToAgent:o}){let{workflows:s,skillList:c,workflow:l,setWorkflow:u,selectedSkills:d,setSelectedSkills:f,engine:p,setEngine:m,queued:h,onQueued:g}=o;return(0,Q.jsx)(Pe,{item:e,comments:r.commentsOf(e),afterHeading:e.kind===`issue`?(0,Q.jsx)(Be,{number:e.number,repo:n},t??`list`):void 0,backLink:{to:i},subNav:{filter:r.filter,changes:a},onRunAgent:Gt,colors:r.colors,checks:Nt(e,r.checksMap),children:(0,Q.jsx)(Ne,{item:e,workflows:s.data?.workflows??[],skills:c,workflow:l,onWorkflowChange:u,selectedSkills:d,onSkillsChange:f,engine:p,onEngineChange:m,queuedRunId:h.get(e.url)??null,onQueued:g},e.url)})}function Ut({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:a}=t;return(0,Q.jsx)(G,{icon:(0,Q.jsx)(B,{size:16}),tone:n.isError?`danger`:`neutral`,heading:`h2`,title:`Could not load #${e}`,subtitle:n.data?.available===!1?n.data.reason:n.error instanceof Error?n.error.message:`The request failed.`,actions:(0,Q.jsx)(i,{variant:`outline`,disabled:r,onClick:a,children:`Retry`})})}function Wt({view:e,number:t}){return(0,Q.jsx)(G,{icon:e===`issues`?(0,Q.jsx)(V,{size:16}):(0,Q.jsx)(R,{size:16}),tone:`neutral`,heading:`h2`,title:t===null?`Nothing selected`:`Not found`,subtitle:t===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${t} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${t} above to look it up on GitHub, closed and merged included.`})}function Gt(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}function Kt({item:e,view:t,filter:n,colors:r,active:i,queued:o,checks:s,comments:c}){let l=e.kind===`issue`?V:R,d=u(),p=()=>{d.prefetchQuery({queryKey:T.githubComments(e.kind,e.number),queryFn:({signal:t})=>f(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Q.jsxs)(W,{to:P(t,n,e.number),draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Fe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:p,onFocus:p,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:a(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,i&&`bg-accent-strong/10 text-accent-text`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,Q.jsx)(l,{"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,Q.jsx)(`span`,{className:a(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,i&&`font-semibold`),children:e.title})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[11px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,Q.jsxs)(`span`,{children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Q.jsx)(`span`,{children:de(e.createdAt)}),(0,Q.jsx)(Oe,{count:c}),s?(0,Q.jsx)(je,{checks:s}):null,o?(0,Q.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Q.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Q.jsx)(Ie,{label:e,color:r[e],plain:!0},e))}):null]})}function qt({options:e,colors:t,selected:n,onChange:r}){let[i,o]=(0,Y.useState)(!1),s=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Q.jsxs)(L,{open:i,onOpenChange:o,children:[(0,Q.jsx)(F,{asChild:!0,children:(0,Q.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:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,Q.jsx)(H,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(I,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(he,{placeholder:`Filter labels…`}),(0,Q.jsxs)(_e,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(ve,{children:`No labels.`}),n.length>0?(0,Q.jsxs)(K,{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,Q.jsxs)(K,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ke(t[e])}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Q.jsx)(le,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{xt as GithubRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{E as t,L as n,M as r,t as i,u as a}from"./button-CHUAMTHK.js";import{i as o,t as s}from"./react-runtime-CCIEwYL0.js";import"./live-refetch-BdnmTJ_8.js";import{$ as c,Hn as l,Jr as u,Z as d,et as f,nn as p,ri as m,tt as h}from"./project-scope-context-B3M-u8R0.js";import{An as g,Cn as _,D as v,E as y,N as b,P as ee,Pt as te,Un as x,X as S,j as ne,k as C,l as w,n as T}from"./queries-DORTKwyN.js";import{n as E}from"./toaster-B1MyeHiE.js";import{_ as D,a as O,d as k,f as A,g as re,i as j,m as M,n as N,p as ie,r as ae,t as oe,u as P}from"./github-sidebar-model-B0Ufci5S.js";import{i as F,r as I,t as L}from"./popover-DRcRI46x.js";import{I as R,L as se,Q as ce,Z as z,ct as B,l as le,m as V,r as ue,u as H}from"./design-icons-DmYTv2r1.js";import{a as de,t as U}from"./loader-circle-CZkGEdoI.js";import{l as fe,n as pe}from"./nav-row-styles-BZUUavOF.js";import{r as me,t as W}from"./project-router-MMOk9VbW.js";import{t as G}from"./centered-state-DGyy0SuA.js";import{A as he,E as ge,M as _e,O as ve,j as K}from"./agent-accounts-f1cxwgfz.js";import{Pt as ye,X as be,Xt as xe,Zt as Se,n as Ce,ot as we,q as Te,t as Ee,yt as De}from"./index-FoxgrgAH.js";import{a as Oe,d as ke,f as Ae,i as je,l as Me,n as Ne,o as Pe,r as Fe,s as Ie,t as Le,u as q}from"./use-hand-to-agent-state-C6u70P2A.js";import{t as J}from"./tab-link-BvoGfK8S.js";var Y=e(o(),1),X=`cez-github-list-width`;function Z(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 Re(){try{let e=localStorage.getItem(X);return e===null?360:Z(e)}catch{return 360}}function ze(e){try{localStorage.setItem(X,String(Z(e)))}catch{}}var Q=s();function Be({number:e,repo:t}){let n=r();return(0,Q.jsx)(Ve,{number:e,repo:t,scope:n},JSON.stringify([n,t,e]))}function Ve({number:e,repo:t,scope:n}){let r=(0,Y.useId)(),a=(0,Y.useId)(),[o,s]=(0,Y.useState)(!1),c=o?Se:xe,u=S(n,!0,n==="default"),d=w(`#${e}`,!0),f=(0,Y.useMemo)(()=>ie(g(u.data??[],d.data?.pages.flatMap(e=>e.runs)??[]),e,t,n),[u.data,d.data,e,t,n]);return(0,Q.jsxs)(`section`,{"aria-labelledby":r,className:`mt-4 min-w-0 rounded-lg border border-border p-3`,children:[(0,Q.jsx)(`h3`,{id:r,className:`text-xs font-semibold text-muted-foreground`,children:(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":o,"aria-controls":a,onClick:()=>s(e=>!e),className:`flex min-h-11 w-full items-center gap-2 rounded-md px-2 text-left hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(c,{"aria-hidden":`true`,className:`size-4 shrink-0`}),(0,Q.jsxs)(`span`,{children:[`Linked tasks`,u.data?` (${f.length}${d.hasNextPage||d.isError?`+`:``})`:``]})]})}),(0,Q.jsx)(`div`,{id:a,children:o?(0,Q.jsxs)(Q.Fragment,{children:[u.isPending?(0,Q.jsx)(`p`,{role:`status`,className:`mt-2 text-xs text-muted-foreground`,children:`Loading linked tasks…`}):null,u.isError?(0,Q.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{role:`status`,children:`Couldn’t load linked tasks. Check your connection and try again.`}),(0,Q.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void u.refetch(),disabled:u.isFetching,children:`Retry linked tasks`})]}):null,u.data&&f.length===0&&!u.isError?(0,Q.jsx)(`p`,{className:`mt-2 text-xs text-muted-foreground`,children:`No linked tasks yet.`}):null,f.length>0?(0,Q.jsx)(`ul`,{className:`mt-2 flex flex-col gap-1`,children:f.map(e=>{let t=l(e);return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(W,{to:`/tasks/${encodeURIComponent(e.id)}`,className:`flex min-h-11 min-w-0 flex-col justify-center gap-1 rounded-md px-2 py-2 hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:[(0,Q.jsx)(`span`,{className:`text-sm font-medium break-words [overflow-wrap:anywhere]`,children:_(e)}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-muted-foreground`,children:[(0,Q.jsx)(we,{tone:t.tone,shape:t.shape,pulse:t.pulse,role:`img`,"aria-label":t.label,title:t.label}),e.archived?(0,Q.jsx)(`span`,{className:`rounded border border-border px-1`,children:`Archived`}):null,(0,Q.jsx)(`time`,{dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleDateString()})]})]})},e.id)})}):null,d.isError?(0,Q.jsxs)(`div`,{className:`mt-2 text-xs text-muted-foreground`,children:[(0,Q.jsx)(`p`,{role:`status`,children:`Couldn’t load older archived linked tasks.`}),(0,Q.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.refetch(),disabled:d.isFetching,children:`Retry older linked tasks`})]}):d.hasNextPage?(0,Q.jsx)(i,{variant:`outline`,className:`mt-2 min-h-11`,onClick:()=>void d.fetchNextPage(),disabled:d.isFetchingNextPage,children:d.isFetchingNextPage?`Loading older linked tasks…`:`Show older linked tasks`}):null]}):null})]})}var He=`w-44 max-w-full`,$=`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 Ue(e,t){let n=new Map;for(let t of e)for(let e of t.assignees??[])n.set(e.toLowerCase(),e);for(let e of t)n.set(e.toLowerCase(),e);return[...n.values()].sort((e,t)=>e.localeCompare(t))}function We(e,t){return!!e&&t.length===1&&t[0]?.toLowerCase()===e.toLowerCase()}function Ge(e){let t=` Previous memberships are shown; issues with unknown membership remain visible.`;return e.projectsState===`refreshing`&&e.projects?`Refreshing project boards.${t}`:e.projectsState===`unavailable`&&e.projects?`${e.projectsReason}${t}`:e.projects?``:e.projectsReason??(e.projectsState===`refreshing`?`Project memberships pending.`:`Project boards unavailable.`)}function Ke(e){return[e.viewerLogin?``:`GitHub login unavailable.`,Ge(e)].filter(Boolean).join(` `)}function qe({options:e,assignees:t,onAssigneesChange:n}){return(0,Q.jsxs)(L,{children:[(0,Q.jsx)(F,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,className:$,disabled:e.length===0,children:[`Assignee`,t.length?` · ${t.length}`:``,(0,Q.jsx)(H,{size:12,"aria-hidden":`true`,className:`ml-1 inline size-3 shrink-0 align-[-1px] text-soft-foreground`})]})}),(0,Q.jsx)(I,{align:`start`,className:`w-64 max-w-[calc(100vw-2rem)] p-2`,children:(0,Q.jsxs)(`fieldset`,{className:`max-h-[min(16rem,var(--radix-popover-content-available-height))] overflow-y-auto`,children:[(0,Q.jsx)(`legend`,{className:`px-2 text-xs text-muted-foreground`,children:`Match any selected assignee`}),e.map(e=>{let r=t.some(t=>t.toLowerCase()===e.toLowerCase());return(0,Q.jsxs)(`label`,{className:`flex min-h-11 cursor-pointer items-center gap-2 rounded px-2 hover:bg-muted`,children:[(0,Q.jsx)(`input`,{type:`checkbox`,checked:r,onChange:()=>n(r?t.filter(t=>t.toLowerCase()!==e.toLowerCase()):[...t,e])}),(0,Q.jsx)(`span`,{className:`break-all text-sm`,children:e})]},e.toLowerCase())})]})})]})}function Je({data:e,projectId:t,onProjectChange:n,pickerRef:r}){return e.projects?.length?(0,Q.jsxs)(`select`,{ref:r,"aria-label":`Project board`,className:`${$} ${He}`,value:t,onChange:e=>n(e.target.value),children:[(0,Q.jsx)(`option`,{value:``,children:`All boards`}),e.projects.map(e=>(0,Q.jsx)(`option`,{value:e.id,children:e.title},e.id))]}):e.projects||e.projectsState?(0,Q.jsx)(`select`,{ref:r,"aria-label":`Project board`,className:`${$} ${He}`,disabled:!0,value:``,children:(0,Q.jsx)(`option`,{value:``,children:e.projects?`No boards`:e.projectsState===`refreshing`?`Loading boards…`:`Boards unavailable`})}):null}function Ye({data:e,message:t,lastMessage:n,hasMessage:r,statusOpen:i,setStatusOpen:a,triggerRef:o,contentRef:s}){return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{role:`status`,className:`sr-only`,children:t}),(0,Q.jsxs)(L,{open:i,onOpenChange:a,children:[(0,Q.jsx)(F,{asChild:!0,children:(0,Q.jsx)(`button`,{ref:o,type:`button`,className:`${$} inline-flex items-center justify-center ${t?``:`invisible`}`,"aria-label":`Project board status`,tabIndex:t?void 0:-1,children:e.projectsState===`refreshing`?(0,Q.jsx)(z,{size:14,"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):(0,Q.jsx)(B,{size:14,"aria-hidden":`true`,className:`size-3.5`})})}),(0,Q.jsx)(I,{ref:s,align:`start`,"data-slot":`gh-issue-status`,onCloseAutoFocus:e=>{r||e.preventDefault()},className:`w-72 max-w-[calc(100vw-2rem)] p-3 text-xs text-muted-foreground`,children:t||n.current})]})]})}function Xe({data:e,assignees:t,projectId:n,onAssigneesChange:r,onProjectChange:i}){let[a,o]=(0,Y.useState)(!1),s=(0,Y.useRef)(null),c=(0,Y.useRef)(null),l=(0,Y.useRef)(null),u=(0,Y.useRef)(null),d=Ue(e.issues,t),f=We(e.viewerLogin,t),p=Ke(e),m=p!==``,h=(0,Y.useRef)(p);m&&(h.current=p);let g=(0,Y.useRef)(!m);g.current=!m;let _=()=>(l.current&&!l.current.disabled?l.current:u.current)?.focus();return(0,Y.useEffect)(()=>{let e=s.current;if(!e)return;let t=e=>{g.current&&!e.relatedTarget&&requestAnimationFrame(()=>{(!document.activeElement||document.activeElement===document.body)&&_()})};return e.addEventListener(`blur`,t),()=>e.removeEventListener(`blur`,t)},[]),(0,Y.useEffect)(()=>{if(m)return;let e=document.activeElement,t=!!e&&(e===s.current||!!c.current?.contains(e));o(!1),t&&_()},[m]),(0,Q.jsxs)(`div`,{className:`contents`,"data-slot":`gh-issue-filters`,children:[(0,Q.jsx)(qe,{options:d,assignees:t,onAssigneesChange:r}),(0,Q.jsx)(`button`,{ref:u,type:`button`,className:`${$} aria-pressed:border-foreground aria-pressed:bg-foreground aria-pressed:text-background`,disabled:!e.viewerLogin,"aria-pressed":f,onClick:()=>r(f?[]:[e.viewerLogin]),children:`Assigned to me`}),(0,Q.jsx)(Je,{data:e,projectId:n,onProjectChange:i,pickerRef:l}),(0,Q.jsx)(Ye,{data:e,message:p,lastMessage:h,hasMessage:m,statusOpen:a,setStatusOpen:o,triggerRef:s,contentRef:c})]})}function Ze({onRefresh:e,refreshing:t}){let n=Ee(r());return(0,Q.jsxs)(`div`,{"data-route":`github`,"data-slot":`github-filter-screen`,className:pe,children:[(0,Q.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,Q.jsx)(`h1`,{className:a(fe,`min-w-0 flex-1`),children:`GitHub`}),(0,Q.jsx)(`button`,{type:`button`,"data-slot":`gh-screen-refresh`,"aria-label":`Refresh from GitHub`,title:`Refresh from GitHub`,disabled:t,onClick:e,className:`-my-2 -mr-[10px] flex size-11 shrink-0 items-center justify-center rounded-md text-soft-foreground hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-60`,children:(0,Q.jsx)(z,{size:17,"aria-hidden":`true`,className:a(`size-[17px]`,t&&`motion-safe:animate-spin`)})})]}),(0,Q.jsx)(Ce,{model:n,variant:`screen`})]})}function Qe(e){let t=getComputedStyle(e).overflowY;return t===`auto`||t===`scroll`?e:e.closest(`[data-slot="main"]`)??e}function $e(e){let[t,n]=(0,Y.useState)(null);return(0,Y.useLayoutEffect)(()=>{if(!e){n(null);return}let t=()=>n(Qe(e));t();let r=typeof window.matchMedia==`function`?window.matchMedia(`(min-width: 768px)`):null;r?.addEventListener(`change`,t);let i=typeof ResizeObserver>`u`?null:new ResizeObserver(t);return i?.observe(e),()=>{r?.removeEventListener(`change`,t),i?.disconnect()}},[e]),t}function et(e,t){let[n,r]=(0,Y.useState)(0);return(0,Y.useLayoutEffect)(()=>{let n=()=>{!e||!t||r(Math.max(0,Math.round(e.getBoundingClientRect().top-t.getBoundingClientRect().top+t.scrollTop)))};return n(),window.addEventListener(`resize`,n),()=>window.removeEventListener(`resize`,n)},[e,t]),n}function tt(e,t,n){let[r,i]=(0,Y.useState)(null),a=(0,Y.useRef)(n);return(0,Y.useEffect)(()=>{a.current=n}),(0,Y.useEffect)(()=>{if(!e||!r||!t||typeof IntersectionObserver>`u`)return;let n=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&a.current()},{root:t.getAttribute(`data-slot`)===`main`?null:t,rootMargin:`0px 0px 600px 0px`});return n.observe(r),()=>n.disconnect()},[e,r,t]),i}function nt(e,t,n,r,i){let[a,o]=(0,Y.useState)(null),[s,c]=(0,Y.useState)(null),l=$e(a),u=(0,Y.useRef)(null);u.current=l;let d=et(s,l),f=e===`issues`?n?.issues.length??0:n?.prs.length??0,p=t.hasNextPage&&r===null&&f>0;return{listEl:a,setListEl:o,setRowsEl:c,scrollOwner:l,scrollOwnerRef:u,startMargin:d,pagingAvailable:p,manualPaging:p&&i,loadMoreRef:tt(p&&!i&&!t.isFetchingNextPage&&!t.isFetchNextPageError,l,()=>void t.fetchNextPage())}}var rt=100;function it(e,t,n,r,i){if(!e?.available||t!==`prs`)return[];let a=new Set;n!==null&&Number.isInteger(n)&&a.add(n);for(let t of[...r,...i,...e.prs]){if(a.size>=rt)break;a.add(t.number)}return[...a]}function at(e,t,n,r,i,a){let o=it(n,e,r,i,a),s=y(o,e===`prs`),c=s.data?.available?s.data.checks:void 0,l=v(e===`issues`?`issue`:`pr`,(0,Y.useMemo)(()=>(t.data?.pages??[]).map(t=>(e===`issues`?t.issues:t.prs).map(e=>e.number)),[t.data,e]),n?.available===!0&&n.commentsDeferred===!0),u=(0,Y.useMemo)(()=>new Set(n?.commentsDeferred?(e===`issues`?n.issues:n.prs).map(e=>e.number):[]),[n,e]);return{checkPrNumbers:o,checksMap:c,commentsOf:e=>l[e.number]??(u.has(e.number)?void 0:e.comments)}}function ot(e){let[t,n]=De(),r=t.get(`filter`),i=M(e,r);return{rawFilterParam:r,filter:i,activeFilter:i??`all`,setFilterParam:e=>n(t=>{let n=new URLSearchParams(t);return e===null?n.delete(`filter`):n.set(`filter`,e),n})}}function st(e,t,{filter:n,activeFilter:r,setFilterParam:i}){let[a,o]=(0,Y.useState)(``),[s,c]=(0,Y.useState)([]),[l,u]=(0,Y.useState)([]),{setProjectFilter:d,activeProject:f}=ct(t),p=e===`issues`&&r===`assigned`,m=p?t?.viewerLogin?[t.viewerLogin]:[]:l;return{query:a,setQuery:o,labelFilter:s,setLabelFilter:c,setProjectFilter:d,activeProject:f,isAssignedFilter:p,effectiveAssignees:m,changeAssignees:e=>{u(e),p&&i(`all`)},clearFilters:()=>{o(``),c([]),u([]),d(``),n!==null&&n!==`all`&&i(`all`)},filtering:a.trim()!==``||s.length>0||e===`issues`&&(m.length>0||f!==``)||n!==null&&n!==`all`,narrowing:a.trim()!==``||s.length>0||e===`issues`&&(!p&&l.length>0||f!==``)}}function ct(e){let[t,n]=(0,Y.useState)(``),r=e?.projectsState===`refreshing`||e?.projectsState===`unavailable`,i=r||e?.projects?.some(e=>e.id===t)?t:``;return(0,Y.useEffect)(()=>{e&&!r&&t&&!i&&n(``)},[e,t,i,r]),{setProjectFilter:n,activeProject:i}}function lt(e,t,{filter:n,activeFilter:i},a){let o=r(),s=e===`issues`&&(i===`no-task`||i===`has-task`),c=S(o,s,o==="default"),l=(0,Y.useMemo)(()=>c.data?A(c.data,t?.repo,o):null,[c.data,t?.repo,o]),u=k(e,n)?D(n):null,d=b(`pr`,u??``,u!==null&&t?.available===!0),f=u!==null&&d.data?.available?d.data.items:null,p=(0,Y.useMemo)(()=>t?.available?e===`issues`?t.issues:t.prs:[],[t,e]),m=(0,Y.useMemo)(()=>f?re(f,p):null,[f,p]),h=ut({view:e,gh:t,activeFilter:i,isAssignedFilter:a,taskFilter:s,taskNumbers:l,runsQuery:c,backedQuery:u,filterHits:f,filterSearch:d});return{backedQuery:u,filterSearch:d,fullList:p,filterRows:m,filterGate:h,openItems:(0,Y.useMemo)(()=>h?[]:m??p,[h,m,p]),narrow:(0,Y.useMemo)(()=>e===`issues`?i===`no-task`&&l?{excludeNumbers:l}:i===`has-task`&&l?{includeNumbers:l}:{}:i===`mine`&&t?.viewerLogin?{author:t.viewerLogin}:f?{includeNumbers:new Set(f.map(e=>e.number))}:{},[e,i,l,t?.viewerLogin,f])}}function ut({view:e,gh:t,activeFilter:n,isAssignedFilter:r,taskFilter:i,taskNumbers:a,runsQuery:o,backedQuery:s,filterHits:c,filterSearch:l}){return t?.available?(r||e===`prs`&&n===`mine`)&&!t.viewerLogin?{kind:`blocked`,message:`GitHub login unavailable, so this filter cannot be applied.`}:i&&!a?o.isError?{kind:`blocked`,message:`The task list is unavailable, so this filter cannot be applied.`}:{kind:`loading`,message:`Loading tasks…`}:s!==null&&!c?l.data?.available===!1?{kind:`blocked`,message:`GitHub could not be searched: ${l.data.reason??`unknown reason`}.`}:l.isError?{kind:`blocked`,message:`GitHub could not be searched: ${l.error instanceof Error?l.error.message:`the search request failed`}.`}:{kind:`loading`,message:`Searching GitHub…`}:null:null}function dt(e,t){return t?h(t.kind,t.number,{refresh:!0}).then(n=>(e.setQueryData(t.key,n),!0)).catch(()=>!1):Promise.resolve(!0)}function ft(e,t,n,{filterGate:r,filterRows:i,fullList:a}){let o=T.github()[0],s=t===void 0?null:Number.parseInt(t,10),c=!r&&n.data?.available?n.data.items.find(e=>e.number===s):void 0,l=i&&s!==null&&!a.some(e=>e.number===s)?i.find(e=>e.number===s):void 0,u=c??l,[d,f]=(0,Y.useState)(null);return(0,Y.useEffect)(()=>{u&&f({scope:o,view:e,item:u})},[o,e,u]),{selectedNumber:s,remoteDetail:u??(d?.scope===o&&d.view===e&&d.item.number===s?d.item:null)}}function pt(e,t,n,{fullList:r,filterRows:i},a){let o=u(),s=(0,Y.useRef)(null),c=e===`issues`?`issue`:`pr`,l=t?.available===!0&&n!==null&&Number.isSafeInteger(n)&&n>0&&!r.some(e=>e.number===n)&&!i?.some(e=>e.number===n)&&a===null,d=C(c,n??0,l),f=l&&d.data?.available&&d.data.item?.kind===c?d.data.item:null;s.current=l&&n!==null?{kind:c,number:n,key:T.githubItem(c,n)}:null;let[p,m]=(0,Y.useState)(!1);return{exactWanted:l,exactItem:d,exactDetail:f,exactTargetRef:s,retryingExact:p,retryExact:()=>{m(!0),dt(o,s.current).then(e=>{m(!1),e||E(`Could not reach GitHub for #${n}`,{tone:`danger`})})}}}function mt(e,t,n){let r=u(),i=(0,Y.useRef)(null);return{refresh:x({mutationFn:e=>(dt(r,e),d({refresh:!0,limit:50})),onSuccess:async a=>{await r.cancelQueries({queryKey:T.githubPages(50),exact:!0}),r.setQueryData(T.githubPages(50),{pages:[a],pageParams:[{}]}),r.invalidateQueries({queryKey:T.githubChecks(t)});let o=e===`issues`?`issue`:`pr`,s=(e===`issues`?a.issues:a.prs).map(e=>e.number),l=T.githubCommentCounts(o,s);r.removeQueries({queryKey:T.githubCommentCounts(o,[]).slice(0,4),predicate:e=>e.queryHash!==m(l)}),a.available&&a.commentsDeferred&&s.length>0&&c(o,s,{refresh:!0}).then(e=>r.setQueryData(l,e)).catch(()=>{}),r.invalidateQueries({queryKey:T.githubSearch(e===`issues`?`issue`:`pr`,n)}),r.invalidateQueries({queryKey:T.githubSearch(`pr`,O)}),r.invalidateQueries({queryKey:T.githubSearch(`pr`,N)});let u=i.current;if(!u){r.removeQueries({queryKey:[`github`,`comments`]});return}let d=T.githubComments(u.kind,u.number);f(u.kind,u.number,{refresh:!0}).then(e=>r.setQueryData(d,e)).catch(()=>{}),r.removeQueries({queryKey:[`github`,`comments`],predicate:e=>e.queryHash!==m(d)})},onError:e=>E(e.message,{tone:`danger`})}),openThreadRef:i}}var ht=350;function gt(e,t){let[n,r]=(0,Y.useState)(e);return(0,Y.useEffect)(()=>{let n=setTimeout(()=>r(e),t);return()=>clearTimeout(n)},[e,t]),n}function _t(e,t,{query:n,labelFilter:r,effectiveAssignees:i,activeProject:a},{openItems:o,narrow:s,filterGate:c}){let l=gt(n,ht),u=(0,Y.useMemo)(()=>q(o,{query:l,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),[o,l,r,e,i,a,s]),d=n.trim()===l.trim(),f=t?.available===!0&&!c&&d&&Ae(l,u),p=b(e===`issues`?`issue`:`pr`,l,f),m=q(o,{query:n,labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}),h=f&&p.data?.available?p.data:null,g=new Set(m.map(e=>e.number)),_=vt(e,h,a,i);return{debouncedQuery:l,searchWanted:f,forgeSearch:p,items:m,searchPayload:h,metadataFailure:_,searchHits:h&&!_?q(h.items,{labels:r,...s,...e===`issues`?{assignees:i,projectId:a}:{}}).filter(e=>!g.has(e.number)):[],...yt(n,d,f,p)}}function vt(e,t,n,r){return e===`issues`&&t?n&&t.items.some(e=>e.projectIds===void 0)?t.projectsReason??`Project board data is incomplete. Refresh to try again.`:r.length&&t.items.some(e=>e.assignees===void 0)?`Assignee data is incomplete. Refresh to try again.`:null:null}function yt(e,t,n,r){return{searching:e.trim()!==``&&!t||n&&r.isPending,searchFailed:n&&(r.data?.available===!1||r.isError),searchFailureReason:r.data?.available===!1?r.data.reason??`unknown reason`:r.error instanceof Error?r.error.message:`the search request failed`}}function bt({width:e,onWidthChange:t}){let n=(0,Y.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(Z(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,Q.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(Z(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 xt({view:e,changes:n=!1,index:r=!1}){let{n:i}=t(),a=ot(e),{rawFilterParam:o,activeFilter:s}=a,c=Te(),{pages:l,data:u}=ne(50),d=ee().data?.capabilities?.automations===!0,f=Ct(),p=Le(),m=St({index:r,isDesktop:c,rawFilterParam:o,n:i,rememberedView:te().data?.githubView}),h=wt(u?.available===!0&&!m.filterScreen),[g,_]=(0,Y.useState)(!1),v=st(e,u,a),y=lt(e,u,a,v.isAssignedFilter),b=_t(e,u,v,y),x=ft(e,i,b.forgeSearch,y),S=pt(e,u,x.selectedNumber,y,x.remoteDetail),C=at(e,l,u,x.selectedNumber,b.searchHits,y.openItems),{refresh:w,openThreadRef:T}=mt(e,C.checkPrNumbers,b.debouncedQuery),E=nt(e,l,u,y.backedQuery,v.narrowing);if(m.restorePrs)return(0,Q.jsx)(me,{to:`/github/prs`,replace:!0});if(!u)return l.isError?(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(G,{icon:(0,Q.jsx)(B,{size:16}),tone:`danger`,title:`Could not load GitHub`,subtitle:l.error.message})}):(0,Q.jsx)(ye,{});T.current=null;let D=()=>w.mutate(S.exactTargetRef.current);if(m.filterScreen&&u.available)return(0,Q.jsx)(Ze,{onRefresh:D,refreshing:w.isPending});if(!u.available)return(0,Q.jsx)(kt,{reason:u.reason,refreshing:w.isPending,onRetry:D});let{labelColors:O,labelOptions:k}=Tt(u,b.searchPayload,y.openItems,y.fullList),A=Et({number:x.selectedNumber,items:b.items,searchHits:b.searchHits,fullList:y.fullList,filterRows:y.filterRows,remoteDetail:x.remoteDetail,exactDetail:S.exactDetail});T.current=A?{kind:A.kind,number:A.number}:null;let{linkFilter:re,listPath:j}=Dt(e,o,s,c),M={view:e,filter:re,colors:O,selected:A,queued:p.queued,checksMap:C.checksMap,commentsOf:C.commentsOf},N=Ot(e,v,y.filterGate,b);return(0,Q.jsxs)(`div`,{ref:h.routeRef,"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:px-7 md:pt-4 md:pb-4`,children:[(0,Q.jsx)(At,{view:e,activeFilter:s,isDesktop:c,rawFilterParam:o,n:i,gh:u}),(0,Q.jsxs)(`div`,{ref:h.workspaceRef,"data-slot":`gh-workspace`,"data-stacked":h.panesStacked,className:`flex min-h-0 min-w-0 flex-1 flex-col gap-3 md:h-[calc(var(--gh-workspace-height,calc(100dvh-4rem))-1rem)] md:flex-none md:gap-[22px]`,children:[(0,Q.jsxs)(`header`,{"data-slot":`gh-header`,className:`flex shrink-0 flex-col gap-3 bg-background md:gap-[22px]`,children:[(0,Q.jsx)(jt,{view:e,isDesktop:c,gh:u,automationsAvailable:d,onSaveView:f,refreshing:w.isPending,onRefresh:D}),(0,Q.jsx)(Mt,{view:e,gh:u,filters:v,labelOptions:k,labelColors:O,searchPayload:b.searchPayload})]}),(0,Q.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 md:items-stretch md:overflow-hidden`,children:[(0,Q.jsx)(Ft,{view:e,n:i,rows:M,verdict:N,search:b,sidebar:y,list:l,paging:E,width:h.githubListWidth,onWidthChange:h.changeGithubListWidth,expanded:g,onExpandedChange:_}),(0,Q.jsx)(Vt,{view:e,n:i,selected:A,selectedNumber:x.selectedNumber,exact:S,repo:u.repo,rows:M,listPath:j,changes:n,handToAgent:p})]})]})]})}function St({index:e,isDesktop:t,rawFilterParam:n,n:r,rememberedView:i}){return{filterScreen:e&&!t&&n===null&&r===void 0,restorePrs:e&&t&&n===null&&i===`prs`}}function Ct(){let e=u();return t=>{e.setQueryData(T.uiState,e=>({...e,githubView:t})),p({githubView:t}).then(t=>e.setQueryData(T.uiState,t)).catch(t=>{E(t instanceof Error?t.message:String(t),{tone:`danger`}),e.invalidateQueries({queryKey:T.uiState})})}}function wt(e){let[t,n]=(0,Y.useState)(Re),[r,i]=(0,Y.useState)(!0),a=(0,Y.useRef)(null),o=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{if(!e)return;let n=a.current,r=o.current,s=n?.closest(`[data-slot="main"]`);if(!n||!r||!s)return;let c=window.matchMedia(`(min-width: 768px)`),l=!1,u=()=>{if(l=c.matches&&r.clientWidth>=t+22+360,i(!l),!l||s.clientHeight<1){n.style.removeProperty(`--gh-workspace-height`);return}n.style.setProperty(`--gh-workspace-height`,`${Math.round(s.clientHeight)}px`)};u();let d=new ResizeObserver(u);d.observe(s),d.observe(r);let f=e=>{if(!l||e.ctrlKey||!e.deltaY||Math.abs(e.deltaX)>Math.abs(e.deltaY)||r.getBoundingClientRect().top<=s.getBoundingClientRect().top+1||!(e.target instanceof Element)||!e.target.closest(`[data-slot="gh-panes"]`))return;e.preventDefault();let t=e.deltaMode===1?16:e.deltaMode===2?s.clientHeight:1;s.scrollTop+=e.deltaY*t};return r.addEventListener(`wheel`,f,{passive:!1}),c.addEventListener(`change`,u),()=>{r.removeEventListener(`wheel`,f),d.disconnect(),c.removeEventListener(`change`,u)}},[e,t]),{githubListWidth:t,changeGithubListWidth:e=>{let t=Z(e);n(t),ze(t)},panesStacked:r,routeRef:a,workspaceRef:o}}function Tt(e,t,n,r){return{labelColors:{...t?.labelColors,...e.labelColors},labelOptions:Me([...n,...r,...t?.items??[]])}}function Et({number:e,items:t,searchHits:n,fullList:r,filterRows:i,remoteDetail:a,exactDetail:o}){return e===null?t[0]??n[0]??null:r.find(t=>t.number===e)??i?.find(t=>t.number===e)??a??o??null}function Dt(e,t,n,r){let i=t===null?null:n;return{linkFilter:i,listPath:P(e,i??(e===`issues`&&!r?`all`:null))}}function Ot(e,{query:t,filtering:n},r,{searching:i,searchFailed:a,searchFailureReason:o,metadataFailure:s,searchHits:c,searchPayload:l,items:u}){let d=e===`issues`?`issues`:`pull requests`;return r?(0,Q.jsxs)(`p`,{role:`status`,className:`flex items-center gap-1.5`,"data-slot":`gh-filter-gate`,"data-kind":r.kind,children:[r.kind===`loading`?(0,Q.jsx)(U,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}):null,r.message]}):n?i?(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5`,children:[(0,Q.jsx)(U,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Searching GitHub for “`,t.trim(),`”…`]}):a?c.length>0?(0,Q.jsxs)(`p`,{role:`status`,children:[`Showing previous results. GitHub could not be refreshed: `,o,`. Use Refresh to try again.`]}):u.length>0?(0,Q.jsxs)(`p`,{children:[`GitHub could not be searched: `,o,`.`]}):(0,Q.jsxs)(`p`,{children:[`No open `,d,` match your filter, and GitHub could not be searched: `,o,`.`]}):s?(0,Q.jsxs)(`p`,{role:`status`,children:[`Cannot apply the selected filters to GitHub results: `,s]}):c.length>0?null:l?.truncated?(0,Q.jsx)(`p`,{children:`No matches within GitHub’s first matches. Narrow your search to check more specific results.`}):l&&u.length>0?(0,Q.jsxs)(`p`,{children:[`No additional `,d,` match your filter on GitHub.`]}):l?(0,Q.jsxs)(`p`,{children:[`No `,d,` match your filter — open, closed or merged.`]}):(0,Q.jsxs)(`p`,{children:[`No open `,d,` match your filter.`]}):(0,Q.jsxs)(`p`,{children:[`No open `,d,`.`]})}function kt({reason:e,refreshing:t,onRetry:r}){return(0,Q.jsx)(`div`,{"data-route":`github`,className:`flex min-h-full flex-col`,children:(0,Q.jsx)(G,{icon:(0,Q.jsx)(se,{}),tone:`neutral`,title:`GitHub is unavailable here`,subtitle:e??`unknown reason`,actions:(0,Q.jsx)(i,{variant:`outline`,"data-action":`gh-retry`,disabled:t,onClick:r,children:`Try again`}),children:(0,Q.jsxs)(`p`,{className:`text-xs leading-relaxed text-soft-foreground`,children:[`The tab needs the `,(0,Q.jsx)(`span`,{className:`font-mono`,children:`gh`}),` CLI, logged in (`,(0,Q.jsx)(`span`,{className:`font-mono`,children:`gh auth login`}),`), and a repo with a GitHub remote. Everything else in `,n(`cezar`),` works without it.`]})})})}function At({view:e,activeFilter:t,isDesktop:n,rawFilterParam:r,n:i,gh:a}){return(0,Q.jsxs)(`div`,{"data-slot":`gh-masthead`,className:`flex min-w-0 shrink-0 flex-col gap-1 md:flex-row md:items-baseline md:gap-3`,children:[(0,Q.jsx)(`h1`,{className:`text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:n?`${e===`issues`?`Issues`:`Pull requests`} · ${oe[t]}`:`GitHub`}),r!==null&&i===void 0?(0,Q.jsxs)(`div`,{"data-slot":`gh-filter-context`,className:`flex min-w-0 items-center gap-3 md:hidden`,children:[(0,Q.jsxs)(W,{to:`/github`,"data-slot":`gh-back-filters`,className:`inline-flex min-h-11 items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground`,children:[(0,Q.jsx)(ue,{size:16,"aria-hidden":`true`,className:`size-3.5`}),`Back to filters`]}),t===`all`?null:(0,Q.jsx)(`span`,{"data-slot":`gh-active-filter`,className:`truncate text-xs text-soft-foreground`,children:[...ae,...j].find(e=>e.id===t)?.label})]}):null,a.repo?(0,Q.jsxs)(`span`,{className:`min-w-0 truncate text-[13px] text-muted-foreground md:text-[11px] md:text-soft-foreground`,children:[(0,Q.jsx)(`span`,{"data-slot":`gh-repo`,children:a.repo}),(0,Q.jsxs)(`span`,{"data-slot":`gh-synced`,children:[` · `,a.syncedAt?`Synced ${de(a.syncedAt)} ago`:`Not synced yet`]})]}):null]})}function jt({view:e,isDesktop:t,gh:n,automationsAvailable:r,onSaveView:i,refreshing:o,onRefresh:s}){return(0,Q.jsxs)(`div`,{"data-slot":`gh-tabs`,className:`flex min-h-11 flex-wrap items-center gap-3`,children:[(0,Q.jsxs)(J,{to:t?`/github`:`/github?filter=all`,active:e===`issues`,onClick:()=>i(`issues`),children:[`Issues · `,n.issuesTotal??n.issues.length]}),(0,Q.jsxs)(J,{to:`/github/prs`,active:e===`prs`,onClick:()=>i(`prs`),children:[`Pull requests · `,n.prsTotal??n.prs.length]}),r?(0,Q.jsx)(W,{to:`/automations/new`,className:`gh-utility`,children:`Set up automations`}):null,(0,Q.jsxs)(`button`,{type:`button`,"data-slot":`gh-refresh`,title:`Refresh from GitHub`,disabled:o,onClick:s,className:`gh-utility`,children:[(0,Q.jsx)(z,{size:16,"aria-hidden":`true`,className:a(`size-3.5`,o&&`motion-safe:animate-spin`)}),`Refresh`]})]})}function Mt({view:e,gh:t,filters:n,labelOptions:r,labelColors:i,searchPayload:a}){return(0,Q.jsxs)(`div`,{"data-slot":`gh-filter-toolbar`,className:`flex flex-wrap items-center gap-2.5`,children:[(0,Q.jsxs)(`div`,{className:`relative min-w-0 basis-full md:flex-1 md:basis-auto`,children:[(0,Q.jsx)(ce,{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,Q.jsx)(`input`,{type:`search`,"data-slot":`gh-search`,"aria-label":`Search ${e}`,placeholder:e===`issues`?`Filter issues…`:`Filter pull requests…`,value:n.query,onChange:e=>n.setQuery(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,Q.jsx)(qt,{options:r,colors:i,selected:n.labelFilter,onChange:n.setLabelFilter}),e===`issues`?(0,Q.jsx)(Xe,{data:{...t,issues:[...t.issues,...a?.items??[]]},assignees:n.effectiveAssignees,projectId:n.activeProject,onAssigneesChange:n.changeAssignees,onProjectChange:n.setProjectFilter}):null,(0,Q.jsx)(`button`,{type:`button`,disabled:!n.filtering,className:`min-h-11 min-w-11 rounded-md border border-border bg-card px-4 text-xs disabled:opacity-50`,onClick:n.clearFilters,children:`Clear filters`})]})}function Nt(e,t){return e.kind===`pr`?t?.[e.number]??e.checks:e.checks}function Pt(e,t){return(0,Q.jsx)(Kt,{item:e,view:t.view,filter:t.filter,colors:t.colors,active:t.selected?.url===e.url,queued:t.queued.has(e.url),checks:Nt(e,t.checksMap),comments:t.commentsOf(e)})}function Ft({view:e,n:t,rows:n,verdict:r,search:i,sidebar:a,list:o,paging:s,width:c,onWidthChange:l,expanded:u,onExpandedChange:d}){let{items:f,searchHits:p}=i,m=e===`issues`&&t!==void 0&&!u;return(0,Q.jsxs)(`section`,{ref:s.setListEl,"data-slot":`gh-list`,"data-mobile-preview":m||void 0,style:{"--github-list-width":`${c}px`},className:`relative flex w-full min-h-0 min-w-0 flex-col rounded-lg border border-border bg-card p-3 md:w-[var(--github-list-width)] md:shrink-0 md:overflow-x-hidden md:overflow-y-auto`,children:[f.length===0?r&&(0,Q.jsx)(`div`,{"data-slot":`gh-empty`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):(0,Q.jsx)(It,{items:f,rows:n,compactPreview:m,paging:s}),s.pagingAvailable?(0,Q.jsx)(Lt,{view:e,list:o,paging:s}):null,(0,Q.jsx)(Rt,{backedQuery:a.backedQuery,filterSearch:a.filterSearch}),(0,Q.jsx)(zt,{view:e,n:t,count:f.length,expanded:u,onExpandedChange:d}),f.length>0&&i.searchWanted&&r?(0,Q.jsx)(`div`,{"data-slot":`gh-search-status`,role:`status`,className:`px-4 py-4 text-sm text-soft-foreground`,children:r}):null,p.length>0?(0,Q.jsx)(Bt,{hits:p,searchPayload:i.searchPayload,rows:n}):null,(0,Q.jsx)(bt,{width:c,onWidthChange:l})]})}function It({items:e,rows:t,compactPreview:n,paging:r}){let{setRowsEl:i,scrollOwner:a,listEl:o,scrollOwnerRef:s,startMargin:c}=r,l=e.map((e,r)=>(0,Q.jsx)(`div`,{role:`listitem`,"data-slot":`gh-row-item`,"data-divided":r>0||void 0,"data-compact-hidden":n&&r>=2&&t.selected?.url!==e.url||void 0,children:Pt(e,t)},e.url));return(0,Q.jsx)(`div`,{ref:i,"data-slot":`gh-rows`,"data-virtualized":a?`true`:void 0,role:`list`,children:a?(0,Q.jsx)(be,{scrollRef:s,startMargin:c,children:l},a===o?`list`:`main`):l})}function Lt({view:e,list:t,paging:n}){return(0,Q.jsx)(`div`,{ref:n.loadMoreRef,"data-slot":`gh-load-more`,className:`flex min-h-6 items-center justify-center gap-1.5 px-4 pb-3 text-xs text-soft-foreground`,children:t.isFetchingNextPage?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(U,{"aria-hidden":`true`,className:`size-3.5 motion-safe:animate-spin`}),`Loading more…`]}):t.isFetchNextPageError?(0,Q.jsxs)(Q.Fragment,{children:[`Could not load more.`,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-retry`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Retry`})]}):n.manualPaging?(0,Q.jsxs)(Q.Fragment,{children:[`Filters cover the loaded `,e===`issues`?`issues`:`pull requests`,`.`,(0,Q.jsx)(`button`,{type:`button`,"data-slot":`gh-load-more-manual`,onClick:()=>void t.fetchNextPage(),className:`font-medium text-accent-text hover:underline`,children:`Load more`})]}):null})}function Rt({backedQuery:e,filterSearch:t}){return e!==null&&t.data?.available&&t.data.truncated?(0,Q.jsxs)(`div`,{"data-slot":`gh-filter-note`,role:`status`,className:`px-4 py-3 text-xs text-soft-foreground`,children:[`Showing the first `,t.data.items.length,` matches from GitHub search; more may exist.`]}):null}function zt({view:e,n:t,count:n,expanded:r,onExpandedChange:a}){return e===`issues`&&t!==void 0&&n>2?(0,Q.jsx)(i,{variant:`outline`,className:`mt-2 self-start md:hidden`,"data-slot":`gh-expand-list`,"aria-expanded":r,onClick:()=>a(e=>!e),children:r?`Show fewer issues`:`View all ${n} issues`}):null}function Bt({hits:e,searchPayload:t,rows:n}){return(0,Q.jsxs)(`div`,{"data-slot":`gh-search-hits`,children:[(0,Q.jsxs)(`p`,{className:`px-4 pt-2 pb-1 text-[11px] font-medium tracking-wide text-soft-foreground uppercase`,children:[`Found on GitHub`,t?.truncated?` (first matches)`:``]}),(0,Q.jsx)(`ul`,{className:`flex flex-col gap-0.5 px-2 pb-2`,children:e.map(e=>(0,Q.jsx)(`li`,{children:Pt(e,n)},e.url))})]})}function Vt({view:e,n:t,selected:n,selectedNumber:r,exact:i,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}){let{exactWanted:d,exactItem:f}=i;return(0,Q.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 md:overflow-y-auto`,t===void 0?`hidden md:flex`:`flex`),children:n?(0,Q.jsx)(Ht,{item:n,n:t,repo:o,rows:s,listPath:c,changes:l,handToAgent:u}):d&&f.isPending?(0,Q.jsx)(`div`,{"data-slot":`gh-detail-loading`,className:`flex min-h-full flex-1 flex-col`,children:(0,Q.jsx)(G,{icon:(0,Q.jsx)(U,{className:`motion-safe:animate-spin`}),tone:`neutral`,heading:`h2`,title:`Loading #${r}…`,subtitle:`It is not among the open items, so the tab is asking GitHub for it.`})}):d&&(f.isError||f.data?.available===!1)?(0,Q.jsx)(Ut,{number:r,exact:i}):(0,Q.jsx)(Wt,{view:e,number:r})})}function Ht({item:e,n:t,repo:n,rows:r,listPath:i,changes:a,handToAgent:o}){let{workflows:s,skillList:c,workflow:l,setWorkflow:u,selectedSkills:d,setSelectedSkills:f,engine:p,setEngine:m,queued:h,onQueued:g}=o;return(0,Q.jsx)(Pe,{item:e,comments:r.commentsOf(e),afterHeading:e.kind===`issue`?(0,Q.jsx)(Be,{number:e.number,repo:n},t??`list`):void 0,backLink:{to:i},subNav:{filter:r.filter,changes:a},onRunAgent:Gt,colors:r.colors,checks:Nt(e,r.checksMap),children:(0,Q.jsx)(Ne,{item:e,workflows:s.data?.workflows??[],skills:c,workflow:l,onWorkflowChange:u,selectedSkills:d,onSkillsChange:f,engine:p,onEngineChange:m,queuedRunId:h.get(e.url)??null,onQueued:g},e.url)})}function Ut({number:e,exact:t}){let{exactItem:n,retryingExact:r,retryExact:a}=t;return(0,Q.jsx)(G,{icon:(0,Q.jsx)(B,{size:16}),tone:n.isError?`danger`:`neutral`,heading:`h2`,title:`Could not load #${e}`,subtitle:n.data?.available===!1?n.data.reason:n.error instanceof Error?n.error.message:`The request failed.`,actions:(0,Q.jsx)(i,{variant:`outline`,disabled:r,onClick:a,children:`Retry`})})}function Wt({view:e,number:t}){return(0,Q.jsx)(G,{icon:e===`issues`?(0,Q.jsx)(V,{size:16}):(0,Q.jsx)(R,{size:16}),tone:`neutral`,heading:`h2`,title:t===null?`Nothing selected`:`Not found`,subtitle:t===null?`No open ${e===`issues`?`issues`:`pull requests`} to show.`:`#${t} is not among the open ${e===`issues`?`issues`:`pull requests`}. Search for ${t} above to look it up on GitHub, closed and merged included.`})}function Gt(){let e=document.querySelector(`[data-slot="gh-detail-inner"] [data-slot="gh-custom-prompt"]`);e?.scrollIntoView({block:`center`}),e?.focus({preventScroll:!0})}function Kt({item:e,view:t,filter:n,colors:r,active:i,queued:o,checks:s,comments:c}){let l=e.kind===`issue`?V:R,d=u(),p=()=>{d.prefetchQuery({queryKey:T.githubComments(e.kind,e.number),queryFn:({signal:t})=>f(e.kind,e.number,{},{signal:t}),staleTime:6e4})};return(0,Q.jsxs)(W,{to:P(t,n,e.number),draggable:!0,onDragStart:t=>{try{t.dataTransfer.setData(`text/plain`,Fe(e)),t.dataTransfer.effectAllowed=`copy`}catch{}},onMouseEnter:p,onFocus:p,"data-slot":`gh-row`,"data-number":e.number,"data-kind":e.kind,"aria-current":i?`page`:void 0,title:`Drag into the composer to prefill a task`,className:a(`flex flex-col gap-2 rounded-md px-3 py-4 transition-colors hover:bg-muted`,i&&`bg-accent-strong/10 text-accent-text`),children:[(0,Q.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2 md:items-center`,children:[(0,Q.jsx)(l,{"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,Q.jsx)(`span`,{className:a(`line-clamp-2 min-w-0 text-[13px] font-medium md:block md:truncate`,i&&`font-semibold`),children:e.title})]}),(0,Q.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 pl-[22px] font-mono text-[11px] text-muted-foreground md:flex-nowrap md:gap-y-0`,children:[(0,Q.jsxs)(`span`,{children:[`#`,e.number]}),(0,Q.jsx)(`span`,{className:`max-w-full shrink-0 truncate md:min-w-0 md:shrink`,children:e.author}),(0,Q.jsx)(`span`,{children:de(e.createdAt)}),(0,Q.jsx)(Oe,{count:c}),s?(0,Q.jsx)(je,{checks:s}):null,o?(0,Q.jsx)(`span`,{"data-slot":`gh-queued-flag`,className:`font-sans font-medium text-accent-text`,children:`↗ run queued`}):null]}),e.labels.length>0?(0,Q.jsx)(`span`,{"data-slot":`gh-row-labels`,className:`flex flex-wrap gap-1 pl-[22px]`,children:e.labels.map(e=>(0,Q.jsx)(Ie,{label:e,color:r[e],plain:!0},e))}):null]})}function qt({options:e,colors:t,selected:n,onChange:r}){let[i,o]=(0,Y.useState)(!1),s=e=>r(n.includes(e)?n.filter(t=>t!==e):[...n,e]);return(0,Q.jsxs)(L,{open:i,onOpenChange:o,children:[(0,Q.jsx)(F,{asChild:!0,children:(0,Q.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:[n.length>0?`Labels · ${n.length}`:`Labels`,(0,Q.jsx)(H,{size:12,"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`})]})}),(0,Q.jsx)(I,{align:`end`,sideOffset:6,className:`w-60 p-0`,children:(0,Q.jsxs)(ge,{children:[(0,Q.jsx)(he,{placeholder:`Filter labels…`}),(0,Q.jsxs)(_e,{className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,Q.jsx)(ve,{children:`No labels.`}),n.length>0?(0,Q.jsxs)(K,{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,Q.jsxs)(K,{value:e,onSelect:()=>s(e),className:`min-h-11`,children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 shrink-0 rounded-full border`,style:ke(t[e])}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),r?(0,Q.jsx)(le,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-link-foreground`}):null]},e)})]})]})})]})}export{xt as GithubRoute};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{s as t,u as n}from"./button-CHUAMTHK.js";import{i as r,t as i}from"./react-runtime-CCIEwYL0.js";import{Ut as a,_n as o,cn as s}from"./queries-DYfIpJ-d.js";import{d as c,h as l,m as u,p as d}from"./es2015-D345RR4o.js";import{S as f}from"./dropdown-menu-DhrBcVgr.js";import{i as p,r as m,t as h}from"./popover-DRcRI46x.js";import{K as g,i as _,rt as v,u as y}from"./design-icons-DmYTv2r1.js";import{a as b,c as x,i as S,n as ee}from"./textarea-DlVUfdWG.js";import{c as te,t as ne}from"./project-router-1m_VlC22.js";import{A as re,E as ie,M as ae,N as oe,O as se,j as C,k as w}from"./agent-accounts-BCg-578Q.js";import{a as T,i as E}from"./skills-DFBiAuJG.js";/* empty css */import{t as D}from"./markdown-D7DUNWcJ.js";var O=e(r(),1);function k(e){let t=O.useRef({value:e,previous:e});return O.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var A=i(),j=`Switch`,[ce,le]=u(j),[ue,M]=ce(j);function de(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=c({prop:n,defaultProp:i??!1,onChange:l,caller:j}),[h,g]=O.useState(null),[_,v]=O.useState(null),y={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:O.useRef(!1),required:u,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,A.jsx)(ue,{scope:t,...y,children:B(f)?f(y):r})}var N=`SwitchTrigger`,P=O.forwardRef(({__scopeSwitch:e,onClick:n,...r},i)=>{let{control:a,form:o,value:s,disabled:c,checked:u,required:f,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:_}=M(N,e),v=t(i,p),y=O.useRef(u);return O.useEffect(()=>{let e=o?a?.ownerDocument.getElementById(o):a?.form;if(e instanceof HTMLFormElement){let t=()=>m(y.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,o,m]),(0,A.jsx)(l.button,{type:`button`,role:`switch`,"aria-checked":u,"aria-required":f,"data-state":V(u),"data-disabled":c?``:void 0,disabled:c,value:s,...r,ref:v,onClick:d(n,e=>{m(e=>!e),_&&g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});P.displayName=N;var F=O.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,A.jsx)(de,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(P,{...d,ref:t,__scopeSwitch:n}),e&&(0,A.jsx)(z,{__scopeSwitch:n})]})})});F.displayName=j;var I=`SwitchThumb`,L=O.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=M(I,n);return(0,A.jsx)(l.span,{"data-state":V(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});L.displayName=I;var R=`SwitchBubbleInput`,z=O.forwardRef(({__scopeSwitch:e,...n},r)=>{let{control:i,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:s,required:c,disabled:u,name:d,value:p,form:m,bubbleInput:h,setBubbleInput:g}=M(R,e),_=t(r,g),v=k(o),y=f(i);O.useEffect(()=>{let e=h;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!a.current;if(v!==o&&n){let t=new Event(`click`,{bubbles:r});n.call(e,o),e.dispatchEvent(t)}},[h,v,o,a]);let b=O.useRef(o);return(0,A.jsx)(l.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??b.current,required:c,disabled:u,name:d,value:p,form:m,...n,tabIndex:-1,ref:_,style:{...n.style,...y,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});z.displayName=R;function B(e){return typeof e==`function`}function V(e){return e?`checked`:`unchecked`}function H({templates:e,onInsert:t,triggerClassName:r,disabled:i,iconOnly:a=!1,label:o=`Template`}){let[s,c]=(0,O.useState)(!1),l=(0,O.useRef)(null),u=te();return e.length===0?null:(0,A.jsxs)(h,{open:s,onOpenChange:c,children:[(0,A.jsx)(p,{asChild:!0,children:(0,A.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:i,className:n(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a?`w-[26px] justify-center px-0`:`h-11 gap-2 rounded-lg px-3 text-foreground`,r),children:[(0,A.jsx)(g,{"aria-hidden":`true`,className:a?`size-3 shrink-0 text-accent-icon`:`size-[18px] shrink-0 text-muted-foreground`}),a?null:(0,A.jsxs)(A.Fragment,{children:[o,(0,A.jsx)(y,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`})]})]})}),(0,A.jsx)(m,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,A.jsxs)(ie,{filter:T,children:[(0,A.jsx)(re,{placeholder:`search templates…`,onInput:()=>l.current?.scrollTo(0,0)}),(0,A.jsxs)(ae,{ref:l,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,A.jsx)(se,{children:`Nothing matches.`}),(0,A.jsx)(w,{heading:`Insert a template`,children:e.map(e=>(0,A.jsxs)(C,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{t(e.text),c(!1)},children:[(0,A.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,A.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[12px] font-medium text-accent-text`,children:[(0,A.jsx)(v,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,A.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,A.jsx)(oe,{}),(0,A.jsx)(w,{children:(0,A.jsx)(C,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{c(!1),u(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}function U({className:e,size:t=`default`,...r}){return(0,A.jsx)(F,{"data-slot":`switch`,"data-size":t,className:n(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-none transition-[color,background-color,border-color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-6 data-[size=default]:w-10 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-accent-strong data-[state=unchecked]:bg-input`,e),...r,children:(0,A.jsx)(L,{"data-slot":`switch-thumb`,className:n(`pointer-events-none block rounded-full bg-background ring-0 motion-safe:transition-transform group-data-[size=default]/switch:size-[18px] group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-5 group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0.5 group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0`)})})}function fe({source:e,className:t}){return(0,A.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,className:n(`shrink-0 rounded bg-accent-strong/10 px-2 py-1 text-[12px]`,E({source:e})?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e===`team`?`Team`:e})}function W({skill:e,activation:t}){return(0,A.jsx)(`span`,{className:`inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center`,children:(0,A.jsx)(U,{"data-slot":`skill-switch`,"data-skill":e.name,"data-repo":e.team?.repo,"data-locked":t.locked||void 0,"aria-label":t.ariaLabel,checked:t.checked,disabled:t.disabled,onCheckedChange:()=>t.onCheckedChange(),className:`relative before:absolute before:-inset-x-1 before:-inset-y-2.5 before:content-[''] disabled:cursor-default`})})}function G({skill:e,usedBy:t,activation:n,heading:r=`h2`}){return(0,A.jsxs)(`div`,{"data-slot":`skill-detail`,className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-4`,children:[(0,A.jsxs)(`span`,{className:`sw-detail-source text-[12px]`,children:[(0,A.jsx)(fe,{source:e.source}),` skill`]}),(0,A.jsxs)(`div`,{className:`flex w-full min-w-0 items-start justify-between gap-3`,children:[(0,A.jsx)(r,{className:`min-w-0 text-[19px] font-normal md:text-2xl break-words [overflow-wrap:anywhere]`,children:e.name}),n?(0,A.jsx)(W,{skill:e,activation:n}):null]})]}),n&&!n.checked?(0,A.jsx)(`p`,{"data-slot":`skill-inactive-notice`,className:`mt-4 rounded-md border border-border bg-background px-3 py-2 text-[13px] text-muted-foreground`,children:`Not enabled for this project — agents can’t pick it.`}):null,(0,A.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-4 text-[12px] break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,A.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null,t===void 0?null:(0,A.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-5`,children:[(0,A.jsx)(`h3`,{className:`text-[13px] font-semibold`,children:`Used by`}),t.length>0?(0,A.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,A.jsx)(_,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,A.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by a workflow yet. quick-task can use it when the task mentions it.`})]}),(0,A.jsx)(`section`,{className:`mt-5`,children:(0,A.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-2 text-sm`,children:(0,A.jsx)(D,{children:e.body})})})]})}function pe({skill:e,onClose:t}){return(0,A.jsx)(ee,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,A.jsx)(S,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(x,{className:`sr-only`,children:e.name}),(0,A.jsx)(b,{className:`sr-only`,children:`Read-only skill preview`}),(0,A.jsx)(G,{skill:e,heading:`h3`}),(0,A.jsx)(`p`,{className:`mt-5`,children:(0,A.jsx)(ne,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-accent-text hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function me({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`skeleton`,className:n(`animate-pulse rounded-md bg-accent`,e),...t})}var he=[`assigned`,`no-task`,`has-task`,`all`],ge=[`review`,`mine`,`failing`,`all`],_e=50,K=`is:open review-requested:@me`,q=`is:open status:failure`;function ve(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function ye(e){return e===`review`?K:e===`failing`?q:null}function be(e,t){return t===null?null:(e===`issues`?he:ge).includes(t)?t:`all`}function xe(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function Se(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function Ce(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var J=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],Y=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],X=Object.fromEntries([...J,...Y].map(e=>[e.id,e.label]));function we(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function Te(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${_e} results.`:`At least ${t.value}: only the loaded pages are counted. Scroll to load more.`}var Z=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function Ee(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function De(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>Q(e,t,n)))}function Q(e,t,n){let r=t?.toLowerCase();return s(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&Ee(e.url)===r)).map(e=>e.number)}function Oe(e,t,n,r){let i=new Map;for(let a of e)!o(a)&&Q(a,n,r).includes(t)&&i.set(a.id,a);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function ke(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function $(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function Ae({gh:e,tasks:t,review:n,failing:r}){let i={assigned:null,"no-task":null,"has-task":null,all:null,review:$(n),mine:null,failing:$(r),"all-prs":null};if(!e?.available)return i;let o=!a(e,`issues`),s=!a(e,`prs`),c=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),l=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...i,all:c(e.issuesTotal??e.issues.length,!1),"all-prs":c(e.prsTotal??e.prs.length,!1),assigned:e.viewerLogin?c(e.issues.filter(t=>t.assignees?.some(t=>Z(t,e.viewerLogin))).length,o):null,mine:e.viewerLogin?c(e.prs.filter(t=>Z(t.author,e.viewerLogin)).length,s):null,"has-task":l===null?null:c(l,o),"no-task":l===null?null:c(e.issues.length-l,o)}}export{H as C,U as S,ye as _,K as a,pe as b,Ce as c,ve as d,De as f,ke as g,Se as h,Y as i,we as l,be as m,q as n,Te as o,Oe as p,J as r,Ae as s,X as t,xe as u,me as v,k as w,W as x,G as y};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{s as t,u as n}from"./button-CHUAMTHK.js";import{i as r,t as i}from"./react-runtime-CCIEwYL0.js";import{Ut as a,_n as o,cn as s}from"./queries-DORTKwyN.js";import{d as c,h as l,m as u,p as d}from"./es2015-D345RR4o.js";import{S as f}from"./dropdown-menu-DhrBcVgr.js";import{i as p,r as m,t as h}from"./popover-DRcRI46x.js";import{K as g,i as _,rt as v,u as y}from"./design-icons-DmYTv2r1.js";import{a as b,c as x,i as S,n as ee}from"./textarea-DlVUfdWG.js";import{c as te,t as ne}from"./project-router-MMOk9VbW.js";import{A as re,E as ie,M as ae,N as oe,O as se,j as C,k as w}from"./agent-accounts-f1cxwgfz.js";import{a as T,i as E}from"./skills-DFBiAuJG.js";/* empty css */import{t as D}from"./markdown-D7DUNWcJ.js";var O=e(r(),1);function k(e){let t=O.useRef({value:e,previous:e});return O.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var A=i(),j=`Switch`,[ce,le]=u(j),[ue,M]=ce(j);function de(e){let{__scopeSwitch:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:l,required:u,value:d=`on`,internal_do_not_use_render:f}=e,[p,m]=c({prop:n,defaultProp:i??!1,onChange:l,caller:j}),[h,g]=O.useState(null),[_,v]=O.useState(null),y={checked:p,setChecked:m,disabled:a,control:h,setControl:g,name:s,form:o,value:d,hasConsumerStoppedPropagationRef:O.useRef(!1),required:u,defaultChecked:i,isFormControl:!h||!!o||!!h.closest(`form`),bubbleInput:_,setBubbleInput:v};return(0,A.jsx)(ue,{scope:t,...y,children:B(f)?f(y):r})}var N=`SwitchTrigger`,P=O.forwardRef(({__scopeSwitch:e,onClick:n,...r},i)=>{let{control:a,form:o,value:s,disabled:c,checked:u,required:f,setControl:p,setChecked:m,hasConsumerStoppedPropagationRef:h,isFormControl:g,bubbleInput:_}=M(N,e),v=t(i,p),y=O.useRef(u);return O.useEffect(()=>{let e=o?a?.ownerDocument.getElementById(o):a?.form;if(e instanceof HTMLFormElement){let t=()=>m(y.current);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,o,m]),(0,A.jsx)(l.button,{type:`button`,role:`switch`,"aria-checked":u,"aria-required":f,"data-state":V(u),"data-disabled":c?``:void 0,disabled:c,value:s,...r,ref:v,onClick:d(n,e=>{m(e=>!e),_&&g&&(h.current=e.isPropagationStopped(),h.current||e.stopPropagation())})})});P.displayName=N;var F=O.forwardRef((e,t)=>{let{__scopeSwitch:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,A.jsx)(de,{__scopeSwitch:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(P,{...d,ref:t,__scopeSwitch:n}),e&&(0,A.jsx)(z,{__scopeSwitch:n})]})})});F.displayName=j;var I=`SwitchThumb`,L=O.forwardRef((e,t)=>{let{__scopeSwitch:n,...r}=e,i=M(I,n);return(0,A.jsx)(l.span,{"data-state":V(i.checked),"data-disabled":i.disabled?``:void 0,...r,ref:t})});L.displayName=I;var R=`SwitchBubbleInput`,z=O.forwardRef(({__scopeSwitch:e,...n},r)=>{let{control:i,hasConsumerStoppedPropagationRef:a,checked:o,defaultChecked:s,required:c,disabled:u,name:d,value:p,form:m,bubbleInput:h,setBubbleInput:g}=M(R,e),_=t(r,g),v=k(o),y=f(i);O.useEffect(()=>{let e=h;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=!a.current;if(v!==o&&n){let t=new Event(`click`,{bubbles:r});n.call(e,o),e.dispatchEvent(t)}},[h,v,o,a]);let b=O.useRef(o);return(0,A.jsx)(l.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:s??b.current,required:c,disabled:u,name:d,value:p,form:m,...n,tabIndex:-1,ref:_,style:{...n.style,...y,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})});z.displayName=R;function B(e){return typeof e==`function`}function V(e){return e?`checked`:`unchecked`}function H({templates:e,onInsert:t,triggerClassName:r,disabled:i,iconOnly:a=!1,label:o=`Template`}){let[s,c]=(0,O.useState)(!1),l=(0,O.useRef)(null),u=te();return e.length===0?null:(0,A.jsxs)(h,{open:s,onOpenChange:c,children:[(0,A.jsx)(p,{asChild:!0,children:(0,A.jsxs)(`button`,{type:`button`,"data-slot":`prompt-template-trigger`,"aria-label":`Insert a prompt template`,title:`Insert a prompt template`,disabled:i,className:n(`inline-flex h-[26px] items-center gap-1.5 rounded-full border border-border bg-card text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:pointer-events-none disabled:opacity-50`,a?`w-[26px] justify-center px-0`:`h-11 gap-2 rounded-lg px-3 text-foreground`,r),children:[(0,A.jsx)(g,{"aria-hidden":`true`,className:a?`size-3 shrink-0 text-accent-icon`:`size-[18px] shrink-0 text-muted-foreground`}),a?null:(0,A.jsxs)(A.Fragment,{children:[o,(0,A.jsx)(y,{"aria-hidden":`true`,className:`size-[13px] shrink-0 text-soft-foreground`})]})]})}),(0,A.jsx)(m,{align:`start`,sideOffset:8,"data-slot":`prompt-template-menu`,className:`w-[336px] max-w-[calc(100vw-2rem)] p-0`,onCloseAutoFocus:e=>e.preventDefault(),children:(0,A.jsxs)(ie,{filter:T,children:[(0,A.jsx)(re,{placeholder:`search templates…`,onInput:()=>l.current?.scrollTo(0,0)}),(0,A.jsxs)(ae,{ref:l,"data-slot":`prompt-template-list-menu`,className:`max-h-[min(16rem,calc(var(--radix-popover-content-available-height)-3rem))]`,children:[(0,A.jsx)(se,{children:`Nothing matches.`}),(0,A.jsx)(w,{heading:`Insert a template`,children:e.map(e=>(0,A.jsxs)(C,{value:`template ${e.label} ${e.id}`,keywords:[e.text,...e.skills??[]],"data-slot":`prompt-template-option`,"data-template":e.id,title:e.text,className:`flex-col items-start gap-0.5`,onSelect:()=>{t(e.text),c(!1)},children:[(0,A.jsxs)(`span`,{className:`flex w-full items-center gap-1.5`,children:[(0,A.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px] font-medium text-foreground`,children:e.label}),e.skills&&e.skills.length>0?(0,A.jsxs)(`span`,{"data-slot":`prompt-template-assigned`,title:`Applied automatically with: ${e.skills.join(`, `)}`,className:`inline-flex shrink-0 items-center gap-0.5 text-[12px] font-medium text-accent-text`,children:[(0,A.jsx)(v,{"aria-hidden":`true`,className:`size-2.5`}),e.skills.length]}):null]}),(0,A.jsx)(`span`,{className:`line-clamp-1 text-[11px] text-soft-foreground`,children:e.text})]},e.id))}),(0,A.jsx)(oe,{}),(0,A.jsx)(w,{children:(0,A.jsx)(C,{value:`edit prompt templates settings`,"data-slot":`prompt-template-settings`,className:`text-[12px] text-muted-foreground`,onSelect:()=>{c(!1),u(`/settings/prompt-templates`)},children:`Edit templates…`})})]})]})})]})}function U({className:e,size:t=`default`,...r}){return(0,A.jsx)(F,{"data-slot":`switch`,"data-size":t,className:n(`peer group/switch inline-flex shrink-0 items-center rounded-full border border-transparent shadow-none transition-[color,background-color,border-color,box-shadow] outline-hidden focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 data-[size=default]:h-6 data-[size=default]:w-10 data-[size=sm]:h-3.5 data-[size=sm]:w-6 data-[state=checked]:bg-accent-strong data-[state=unchecked]:bg-input`,e),...r,children:(0,A.jsx)(L,{"data-slot":`switch-thumb`,className:n(`pointer-events-none block rounded-full bg-background ring-0 motion-safe:transition-transform group-data-[size=default]/switch:size-[18px] group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-[state=checked]:translate-x-5 group-data-[size=default]/switch:data-[state=unchecked]:translate-x-0.5 group-data-[size=sm]/switch:data-[state=checked]:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-[state=unchecked]:translate-x-0`)})})}function fe({source:e,className:t}){return(0,A.jsx)(`span`,{"data-slot":`skill-source`,"data-source":e,className:n(`shrink-0 rounded bg-accent-strong/10 px-2 py-1 text-[12px]`,E({source:e})?`font-semibold text-foreground`:`text-soft-foreground`,t),children:e===`team`?`Team`:e})}function W({skill:e,activation:t}){return(0,A.jsx)(`span`,{className:`inline-flex min-h-11 min-w-11 shrink-0 items-center justify-center`,children:(0,A.jsx)(U,{"data-slot":`skill-switch`,"data-skill":e.name,"data-repo":e.team?.repo,"data-locked":t.locked||void 0,"aria-label":t.ariaLabel,checked:t.checked,disabled:t.disabled,onCheckedChange:()=>t.onCheckedChange(),className:`relative before:absolute before:-inset-x-1 before:-inset-y-2.5 before:content-[''] disabled:cursor-default`})})}function G({skill:e,usedBy:t,activation:n,heading:r=`h2`}){return(0,A.jsxs)(`div`,{"data-slot":`skill-detail`,className:`min-w-0`,children:[(0,A.jsxs)(`div`,{className:`flex min-w-0 flex-col items-start gap-4`,children:[(0,A.jsxs)(`span`,{className:`sw-detail-source text-[12px]`,children:[(0,A.jsx)(fe,{source:e.source}),` skill`]}),(0,A.jsxs)(`div`,{className:`flex w-full min-w-0 items-start justify-between gap-3`,children:[(0,A.jsx)(r,{className:`min-w-0 text-[19px] font-normal md:text-2xl break-words [overflow-wrap:anywhere]`,children:e.name}),n?(0,A.jsx)(W,{skill:e,activation:n}):null]})]}),n&&!n.checked?(0,A.jsx)(`p`,{"data-slot":`skill-inactive-notice`,className:`mt-4 rounded-md border border-border bg-background px-3 py-2 text-[13px] text-muted-foreground`,children:`Not enabled for this project — agents can’t pick it.`}):null,(0,A.jsxs)(`p`,{"data-slot":`skill-path`,className:`mt-4 text-[12px] break-all text-soft-foreground`,children:[e.path,e.team?` · from ${e.team.repo}`:``]}),e.description?(0,A.jsx)(`p`,{"data-slot":`skill-description`,className:`mt-2.5 text-[13px] text-muted-foreground`,children:e.description}):null,t===void 0?null:(0,A.jsxs)(`section`,{"data-slot":`skill-used-by`,className:`mt-5`,children:[(0,A.jsx)(`h3`,{className:`text-[13px] font-semibold`,children:`Used by`}),t.length>0?(0,A.jsx)(`ul`,{className:`mt-1.5 flex flex-col gap-1`,children:t.map(e=>(0,A.jsxs)(`li`,{className:`flex items-center gap-1.5 font-mono text-xs text-muted-foreground`,children:[(0,A.jsx)(_,{"aria-hidden":`true`,className:`size-3 shrink-0 text-soft-foreground`}),e]},e))}):(0,A.jsx)(`p`,{className:`mt-1.5 text-xs text-soft-foreground`,children:`Not referenced by a workflow yet. quick-task can use it when the task mentions it.`})]}),(0,A.jsx)(`section`,{className:`mt-5`,children:(0,A.jsx)(`div`,{"data-slot":`skill-body`,className:`mt-2 text-sm`,children:(0,A.jsx)(D,{children:e.body})})})]})}function pe({skill:e,onClose:t}){return(0,A.jsx)(ee,{open:e!==null,onOpenChange:e=>e?void 0:t(),children:(0,A.jsx)(S,{"data-slot":`skill-preview`,className:`block max-h-[80dvh] overflow-y-auto sm:max-w-2xl`,children:e?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(x,{className:`sr-only`,children:e.name}),(0,A.jsx)(b,{className:`sr-only`,children:`Read-only skill preview`}),(0,A.jsx)(G,{skill:e,heading:`h3`}),(0,A.jsx)(`p`,{className:`mt-5`,children:(0,A.jsx)(ne,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-preview-manage`,onClick:t,className:`text-xs font-semibold text-accent-text hover:underline`,children:`Open in the Skills catalog`})})]}):null})})}function me({className:e,...t}){return(0,A.jsx)(`div`,{"data-slot":`skeleton`,className:n(`animate-pulse rounded-md bg-accent`,e),...t})}var he=[`assigned`,`no-task`,`has-task`,`all`],ge=[`review`,`mine`,`failing`,`all`],_e=50,K=`is:open review-requested:@me`,q=`is:open status:failure`;function ve(e,t){return e===`prs`&&(t===`review`||t===`failing`)}function ye(e){return e===`review`?K:e===`failing`?q:null}function be(e,t){return t===null?null:(e===`issues`?he:ge).includes(t)?t:`all`}function xe(e,t,n,r=``){let i=`${n===void 0?e===`issues`?`/github`:`/github/prs`:`${e===`issues`?`/github/issues`:`/github/prs`}/${n}`}${r}`;return t===null?i:`${i}?filter=${encodeURIComponent(t)}`}function Se(e,t){let n=t??`all`;return n===`all`?e===`issues`?`all`:`all-prs`:n}function Ce(e){return e===`all`?{view:`issues`,filter:`all`}:e===`all-prs`?{view:`prs`,filter:`all`}:{view:e===`review`||e===`mine`||e===`failing`?`prs`:`issues`,filter:e}}var J=[{id:`assigned`,label:`Assigned to me`},{id:`no-task`,label:`No task yet`},{id:`has-task`,label:`Has a task`},{id:`all`,label:`All open`}],Y=[{id:`review`,label:`Review requested`},{id:`mine`,label:`Mine`},{id:`failing`,label:`Checks failing`},{id:`all-prs`,label:`All open`}],X=Object.fromEntries([...J,...Y].map(e=>[e.id,e.label]));function we(e){return e===null?``:`${e.value}${e.bound===`atLeast`?`+`:``}`}function Te(e,t){if(t?.bound===`atLeast`)return e===`review`||e===`failing`?`At least ${t.value}: GitHub search returns at most ${_e} results.`:`At least ${t.value}: only the loaded pages are counted. Scroll to load more.`}var Z=(e,t)=>e!==void 0&&t!==void 0&&e.toLowerCase()===t.toLowerCase();function Ee(e){try{let t=new URL(e).pathname.split(`/`).filter(Boolean);return t.length>=2?`${t[0]}/${t[1]}`.toLowerCase():null}catch{return null}}function De(e,t,n){return new Set(e.filter(e=>!e.archived).flatMap(e=>Q(e,t,n)))}function Q(e,t,n){let r=t?.toLowerCase();return s(e,void 0,n).filter(e=>e.kind===`Issue`&&(!e.url||r!==void 0&&Ee(e.url)===r)).map(e=>e.number)}function Oe(e,t,n,r){let i=new Map;for(let a of e)!o(a)&&Q(a,n,r).includes(t)&&i.set(a.id,a);return[...i.values()].sort((e,t)=>Date.parse(t.createdAt)-Date.parse(e.createdAt)||e.id.localeCompare(t.id))}function ke(e,t){let n=new Map(t.map(e=>[e.number,e]));return e.map(e=>n.get(e.number)??e)}function $(e){return e?.available?{value:e.items.length,bound:e.truncated?`atLeast`:`exact`}:null}function Ae({gh:e,tasks:t,review:n,failing:r}){let i={assigned:null,"no-task":null,"has-task":null,all:null,review:$(n),mine:null,failing:$(r),"all-prs":null};if(!e?.available)return i;let o=!a(e,`issues`),s=!a(e,`prs`),c=(e,t)=>({value:e,bound:t?`atLeast`:`exact`}),l=t?e.issues.filter(e=>t.has(e.number)).length:null;return{...i,all:c(e.issuesTotal??e.issues.length,!1),"all-prs":c(e.prsTotal??e.prs.length,!1),assigned:e.viewerLogin?c(e.issues.filter(t=>t.assignees?.some(t=>Z(t,e.viewerLogin))).length,o):null,mine:e.viewerLogin?c(e.prs.filter(t=>Z(t.author,e.viewerLogin)).length,s):null,"has-task":l===null?null:c(l,o),"no-task":l===null?null:c(e.issues.length-l,o)}}export{H as C,U as S,ye as _,K as a,pe as b,Ce as c,ve as d,De as f,ke as g,Se as h,Y as i,we as l,be as m,q as n,Te as o,Oe as p,J as r,Ae as s,X as t,xe as u,me as v,k as w,W as x,G as y};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,p as n,t as r,u as i}from"./button-CHUAMTHK.js";import{i as a,t as o}from"./react-runtime-CCIEwYL0.js";import{$ as s,P as c}from"./queries-DYfIpJ-d.js";import{A as l,B as u,D as d,F as f,I as p,J as m,K as h,M as g,O as _,P as v,Q as ee,R as te,S as ne,V as y,W as b,X as x,Z as S,_ as re,a as ie,b as ae,d as C,f as oe,h as se,i as w,j as T,k as E,l as D,n as O,o as k,p as A,q as j,r as M,t as N,u as P,v as F,x as I,y as L,z as R}from"./activity-motion-hhx0e841.js";import{nt as z,tt as B}from"./index-D489J7QW.js";var V=e(a(),1);function H(e,t){if(!t||t.length===0)return[...e];let n=new Map(t.map((e,t)=>[e,t])),r=e.filter(e=>n.has(e.projectId)),i=e.filter(e=>!n.has(e.projectId));return r.sort((e,t)=>(n.get(e.projectId)??0)-(n.get(t.projectId)??0)),[...r,...i]}function U(e){let t=[],n=[];for(let r of e)y(r)===void 0&&r.tasks.length===0?n.push(r):t.push(r);return{panels:t,idle:n}}function W(e){let t=new Set(e.tasks.map(e=>e.runId));return e.requests.filter(e=>e.relationship===`peer`&&t.has(e.senderRunId)&&t.has(e.recipientRunId))}function G(e,t){let n=new Set(e.map(e=>e.runId));return t.filter(e=>n.has(e.waiterRunId)&&n.has(e.peerRunId))}function K(e){let t=e.tasks.length,n=e.tasks.reduce((e,t)=>e+t.workers.filter(e=>j(e.status)).length,0),r=[`${t} active task${t===1?``:`s`}`];return n>0&&r.push(`${n} worker${n===1?``:`s`}`),r.join(` · `)}function ce(e,t){let n=t?`more `:``;return e===1?`1 ${n}project has no active work:`:`${e} ${n}projects have no active work:`}var q=o(),le={w:104,h:20};function ue(e){let t=e.getBoundingClientRect(),n=new Map;for(let r of e.querySelectorAll(`[data-activity-pill]`)){let e=r.getAttribute(`data-activity-pill`);e&&n.set(e,ae(r.getBoundingClientRect(),t))}return n}function de(e,t,n=[]){let r=ue(e),i=[...r.values()],a=[...t.map(e=>({requestId:e.requestId,senderRunId:e.senderRunId,recipientRunId:e.recipientRunId,kind:`peer`})),...n.map(e=>({...F(e),kind:`wait`}))],o=I(a),s=[];for(let e of a){let t=r.get(e.senderRunId),n=r.get(e.recipientRunId);t&&n&&s.push({id:e.requestId,kind:e.kind,...L(t,n,i,o.get(e.requestId))})}let c=ne(s.map(e=>({id:e.id,at:e.label})),le,`x`);return s.map(e=>({...e,label:c.get(e.id)??e.label}))}function fe(e,t){return e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.d===t[n]?.d&&e.label.x===t[n]?.label.x&&e.label.y===t[n]?.label.y)}var J=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-md border bg-background px-1.5 py-px text-[10.5px] whitespace-nowrap text-foreground tabular-nums max-md:hidden`;function pe({arc:e,wait:t,now:n,motion:r}){return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:i(J,`border-dashed border-message-peer-accent`,t.id in r.waitsClosing&&`activity-line-out`),children:[(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Waiting`}),` · `,x(S(t.since,n))]})}function me({arc:e,request:t,now:n,motion:r}){let a=oe(r,e.id);return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-request":e.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:i(J,a?`border-success`:`border-message-peer-accent`,C(r,e.id)===`fade`&&`activity-line-out`),children:[a?(0,q.jsx)(`span`,{className:`font-semibold text-success`,children:`Replied`}):(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Request`}),` · `,x(S(t.createdAt,n))]})}var he=[],ge=new Set;function _e({arcs:e,waits:t=he,active:n=ge,layoutKey:r,now:a,motion:o=f,paused:s=!1}){let c=V.useRef(null),l=se(c,V.useCallback(n=>de(n,e,t),[e,t]),fe,`[data-activity-pill]`,r),u=V.useMemo(()=>new Set(l.map(e=>e.id)),[l]),d=re(o.comets,u,s),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e])),h=V.useId().replace(/[^a-zA-Z0-9_-]/g,``),g=`activity-arrow-arc-${h}`,_=`activity-ring-arc-${h}`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`svg`,{ref:c,"data-slot":`activity-arcs`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible max-md:hidden`,children:[(0,q.jsxs)(`defs`,{children:[(0,q.jsx)(`marker`,{id:g,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,q.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,q.jsx)(D,{id:_})]}),l.map(e=>{if(e.kind===`wait`){let t=n.has(e.id);return(0,q.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":t?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:t?3:2.2,markerEnd:`url(#${_})`,className:i(`stroke-message-peer-accent`,t?`opacity-100`:`opacity-80`,A(o,e.id))},e.id)}let t=C(o,e.id);return(0,q.jsx)(`path`,{"data-request":e.id,"data-kind":`peer`,"data-phase":t,d:e.d,fill:`none`,strokeDasharray:t===`replied`?void 0:`6 5`,strokeWidth:2,markerEnd:`url(#${g})`,className:i(`stroke-message-peer-accent`,P(t,e.id in o.opening))},e.id)}),(0,q.jsx)(`g`,{ref:d,"data-slot":`activity-comets`})]}),l.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,q.jsx)(pe,{arc:e,wait:t,now:a,motion:o},e.id);let n=p.get(e.id);return n?(0,q.jsx)(me,{arc:e,request:n,now:a,motion:o},e.id):null})]})}var Y=(e,t)=>`/p/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}`,ve=[],ye=`relative z-[1] inline-flex min-h-11 items-center text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring`;function be({task:e}){let t=e.workers.filter(e=>j(e.status));return t.length===0?null:(0,q.jsxs)(`div`,{"data-slot":`activity-pill-workers`,className:`mt-1.5 ml-[19px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[t.map(e=>(0,q.jsx)(g,{run:e,role:`worker`},e.runId)),(0,q.jsxs)(`span`,{className:`ml-0.5`,children:[t.length,` worker`,t.length===1?``:`s`]})]})}function xe({projectId:e,task:t,requests:r,waits:a=ve,index:o,ctx:s,motion:c=f,linked:u=!1,onHover:p}){let h=m(t,s);return(0,q.jsxs)(`li`,{"data-activity-pill":t.runId,"data-rung":t.rung,"data-linked":u?`true`:void 0,...E(t.runId,p),className:i(`relative min-w-0 rounded-[10px] border bg-card-2 px-2.5 py-2`,h.action?`border-pending`:`border-border`,u&&`outline-2 outline-offset-2 outline-message-peer-accent`,t.runId in c.entering&&`activity-card-enter`),children:[(0,q.jsx)(d,{task:t,motion:c,glow:h.action!==void 0}),(0,q.jsxs)(`div`,{className:`flex items-center gap-[7px]`,children:[(0,q.jsx)(g,{run:t,role:`root`}),(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium`,children:(0,q.jsx)(n,{to:Y(e,t.runId),className:`after:absolute after:inset-0 after:rounded-[10px] after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:t.title})}),(0,q.jsx)(l,{rate:t.rate,className:`h-3 w-10`})]}),(0,q.jsxs)(`p`,{"data-slot":`activity-pill-line`,className:`mt-[3px] ml-[19px] truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,q.jsx)(v,{"data-slot":`activity-verb`,tone:h.tone,className:`font-semibold`,children:h.verb}),` · `,(0,q.jsx)(`span`,{"data-slot":`activity-main`,className:i(h.mono&&`font-mono text-[11px]`),children:h.main})]}),(0,q.jsx)(_,{texts:te(t.runId,r,o,a)}),(0,q.jsx)(be,{task:t}),(0,q.jsx)(T,{runId:t.runId,requests:r,waits:a,index:o,link:n,pathOf:t=>Y(e,t),className:`mt-1 ml-[19px] flex flex-col md:hidden`,linkClassName:ye})]})}var X=e=>`/p/${encodeURIComponent(e)}/activity`,Se=e=>`/p/${encodeURIComponent(e)}/`,Z=`rounded-xl border border-border bg-card px-4 pt-3.5 pb-4`,Ce=`ml-auto inline-flex items-center text-[12px] text-accent-text hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`;function Q({project:e,headingId:t,detail:r,to:i,label:a}){return(0,q.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,q.jsx)(`h2`,{id:t,className:`min-w-0 truncate text-[14px] font-semibold`,children:e.name}),(0,q.jsx)(`span`,{"data-slot":`activity-panel-detail`,className:`text-[12px] text-muted-foreground`,children:r}),(0,q.jsx)(n,{to:i,className:Ce,children:a})]})}function $({project:e,notice:t}){let n=V.useId();return(0,q.jsx)(`section`,{"aria-labelledby":n,"data-slot":`activity-panel`,"data-project":e.projectId,"data-notice":`true`,className:Z,children:(0,q.jsx)(Q,{project:e,headingId:n,detail:t,to:Se(e.projectId),label:`Open project →`})})}function we(e,t){return V.useMemo(()=>{let n=new Set(e.requests.map(e=>e.requestId)),r=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!n.has(t.request.requestId)).map(e=>e.request);return W({tasks:e.tasks,requests:[...e.requests,...r]})},[e,t.closing])}function Te({project:e,now:t,motion:n=f,paused:r=!1}){let a=V.useId(),o=V.useMemo(()=>b(e),[e]),s=we(e,n),c=V.useMemo(()=>u(e.tasks),[e.tasks]),l=V.useMemo(()=>G(e.tasks,[...c,...p(e.projectId,c,n)]),[e.tasks,e.projectId,c,n]),d=k(c),m={now:t,titleOf:e=>R(o,e)},h=`${e.tasks.map(e=>e.runId).join(`,`)}:${s.map(e=>e.requestId).join(`,`)}:${l.map(e=>e.id).join(`,`)}`,g=s.length>0||l.length>0;return(0,q.jsxs)(`section`,{"aria-labelledby":a,"data-slot":`activity-panel`,"data-project":e.projectId,className:Z,children:[(0,q.jsx)(Q,{project:e,headingId:a,detail:K(e),to:X(e.projectId),label:`Open project activity →`}),(0,q.jsxs)(`div`,{className:i(`relative mt-3`,g&&`md:mt-1 md:pt-10`),children:[(0,q.jsx)(`ul`,{"data-slot":`activity-pills`,"aria-label":`${e.name} tasks`,className:i(`grid grid-cols-[repeat(auto-fill,minmax(min(100%,220px),1fr))] items-start gap-3.5`,g&&`md:gap-y-11`),children:e.tasks.map(t=>(0,q.jsx)(xe,{projectId:e.projectId,task:t,requests:e.requests,waits:c,index:o,ctx:m,motion:n,linked:d.linked.has(t.runId),onHover:d.onHover},t.runId))}),g?(0,q.jsx)(_e,{arcs:s,waits:l,active:d.active,layoutKey:h,now:t,motion:n,paused:r}):null]})]})}function Ee(e){let t=y(e.project);return t===void 0?(0,q.jsx)(Te,{...e}):(0,q.jsx)($,{project:e.project,notice:t})}function De({projects:e,belowPanels:t}){return e.length===0?null:(0,q.jsxs)(`p`,{"data-slot":`activity-idle`,className:`text-[12.5px] text-muted-foreground`,children:[ce(e.length,t),` `,e.map((e,t)=>(0,q.jsxs)(V.Fragment,{children:[t>0?`, `:null,(0,q.jsx)(n,{to:X(e.projectId),"data-project":e.projectId,className:`text-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.name})]},e.projectId))]})}var Oe={kind:`workspace`};function ke(){let e=s().data?.projects,{order:t}=B();return V.useMemo(()=>e?z(e,t).map(e=>e.id):void 0,[e,t])}function Ae(){let e=ee(Oe),n=s(),i=c(),a=t().state?.activityProjectId,o=ke(),l=N(e.data?.generatedAt,e.dataUpdatedAt),u=n.data?.bootProject??i.data?.bootProject??null,d=typeof a==`string`&&n.data?.projects.some(e=>e.id===a&&e.status!==`missing`)?a:u,f=e.data?.projects,p=V.useMemo(()=>U(H(f??[],o)),[f,o]),{motion:m,paused:g,reduced:_}=O(e.data,`workspace`);return(0,q.jsxs)(`div`,{"data-route":`activity-global`,"data-activity-paused":g?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,q.jsx)(M,{name:`All projects`,now:e.data?l:void 0,stale:e.isError,children:(0,q.jsx)(w,{scope:`all`,projectId:d})}),f?(0,q.jsx)(ie,{summary:h(f),tasksTo:`/tasks`,bumps:m.bumps}):null,e.isPending?(0,q.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading activity…`}):null,e.isError&&!f?(0,q.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-3 text-[13px] text-muted-foreground`,children:[`Could not load activity: `,e.error.message,(0,q.jsx)(r,{size:`sm`,variant:`outline`,onClick:()=>void e.refetch(),className:`max-md:min-h-11`,children:`Retry`})]}):null,f&&p.panels.length===0&&p.idle.length===0?(0,q.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No projects to show.`}):null,(0,q.jsx)(`div`,{"data-slot":`activity-panels`,className:`flex flex-col gap-3.5`,children:p.panels.map(e=>(0,q.jsx)(Ee,{project:e,now:l,motion:m,paused:g||_},e.projectId))}),(0,q.jsx)(De,{projects:p.idle,belowPanels:p.panels.length>0})]})}export{Ae as GlobalActivityRoute};
1
+ import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{C as t,p as n,t as r,u as i}from"./button-CHUAMTHK.js";import{i as a,t as o}from"./react-runtime-CCIEwYL0.js";import{$ as s,P as c}from"./queries-DORTKwyN.js";import{A as l,B as u,D as d,F as f,I as p,J as m,K as h,M as g,O as _,P as v,Q as ee,R as te,S as ne,V as y,W as b,X as x,Z as S,_ as re,a as ie,b as ae,d as C,f as oe,h as se,i as w,j as T,k as E,l as D,n as O,o as k,p as A,q as j,r as M,t as N,u as P,v as F,x as I,y as L,z as R}from"./activity-motion-Deqj_hcK.js";import{nt as z,tt as B}from"./index-FoxgrgAH.js";var V=e(a(),1);function H(e,t){if(!t||t.length===0)return[...e];let n=new Map(t.map((e,t)=>[e,t])),r=e.filter(e=>n.has(e.projectId)),i=e.filter(e=>!n.has(e.projectId));return r.sort((e,t)=>(n.get(e.projectId)??0)-(n.get(t.projectId)??0)),[...r,...i]}function U(e){let t=[],n=[];for(let r of e)y(r)===void 0&&r.tasks.length===0?n.push(r):t.push(r);return{panels:t,idle:n}}function W(e){let t=new Set(e.tasks.map(e=>e.runId));return e.requests.filter(e=>e.relationship===`peer`&&t.has(e.senderRunId)&&t.has(e.recipientRunId))}function G(e,t){let n=new Set(e.map(e=>e.runId));return t.filter(e=>n.has(e.waiterRunId)&&n.has(e.peerRunId))}function K(e){let t=e.tasks.length,n=e.tasks.reduce((e,t)=>e+t.workers.filter(e=>j(e.status)).length,0),r=[`${t} active task${t===1?``:`s`}`];return n>0&&r.push(`${n} worker${n===1?``:`s`}`),r.join(` · `)}function ce(e,t){let n=t?`more `:``;return e===1?`1 ${n}project has no active work:`:`${e} ${n}projects have no active work:`}var q=o(),le={w:104,h:20};function ue(e){let t=e.getBoundingClientRect(),n=new Map;for(let r of e.querySelectorAll(`[data-activity-pill]`)){let e=r.getAttribute(`data-activity-pill`);e&&n.set(e,ae(r.getBoundingClientRect(),t))}return n}function de(e,t,n=[]){let r=ue(e),i=[...r.values()],a=[...t.map(e=>({requestId:e.requestId,senderRunId:e.senderRunId,recipientRunId:e.recipientRunId,kind:`peer`})),...n.map(e=>({...F(e),kind:`wait`}))],o=I(a),s=[];for(let e of a){let t=r.get(e.senderRunId),n=r.get(e.recipientRunId);t&&n&&s.push({id:e.requestId,kind:e.kind,...L(t,n,i,o.get(e.requestId))})}let c=ne(s.map(e=>({id:e.id,at:e.label})),le,`x`);return s.map(e=>({...e,label:c.get(e.id)??e.label}))}function fe(e,t){return e.length===t.length&&e.every((e,n)=>e.id===t[n]?.id&&e.d===t[n]?.d&&e.label.x===t[n]?.label.x&&e.label.y===t[n]?.label.y)}var J=`pointer-events-none absolute z-[4] -translate-x-1/2 -translate-y-1/2 rounded-md border bg-background px-1.5 py-px text-[10.5px] whitespace-nowrap text-foreground tabular-nums max-md:hidden`;function pe({arc:e,wait:t,now:n,motion:r}){return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-wait":t.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:i(J,`border-dashed border-message-peer-accent`,t.id in r.waitsClosing&&`activity-line-out`),children:[(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Waiting`}),` · `,x(S(t.since,n))]})}function me({arc:e,request:t,now:n,motion:r}){let a=oe(r,e.id);return(0,q.jsxs)(`span`,{"data-slot":`activity-arc-label`,"data-request":e.id,"aria-hidden":`true`,style:{left:e.label.x,top:e.label.y},className:i(J,a?`border-success`:`border-message-peer-accent`,C(r,e.id)===`fade`&&`activity-line-out`),children:[a?(0,q.jsx)(`span`,{className:`font-semibold text-success`,children:`Replied`}):(0,q.jsx)(`span`,{className:`font-semibold text-message-peer-accent`,children:`Request`}),` · `,x(S(t.createdAt,n))]})}var he=[],ge=new Set;function _e({arcs:e,waits:t=he,active:n=ge,layoutKey:r,now:a,motion:o=f,paused:s=!1}){let c=V.useRef(null),l=se(c,V.useCallback(n=>de(n,e,t),[e,t]),fe,`[data-activity-pill]`,r),u=V.useMemo(()=>new Set(l.map(e=>e.id)),[l]),d=re(o.comets,u,s),p=new Map(e.map(e=>[e.requestId,e])),m=new Map(t.map(e=>[e.id,e])),h=V.useId().replace(/[^a-zA-Z0-9_-]/g,``),g=`activity-arrow-arc-${h}`,_=`activity-ring-arc-${h}`;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`svg`,{ref:c,"data-slot":`activity-arcs`,"aria-hidden":`true`,className:`pointer-events-none absolute inset-0 z-[3] size-full overflow-visible max-md:hidden`,children:[(0,q.jsxs)(`defs`,{children:[(0,q.jsx)(`marker`,{id:g,viewBox:`0 0 10 10`,refX:`8`,refY:`5`,markerWidth:`7`,markerHeight:`7`,orient:`auto`,children:(0,q.jsx)(`path`,{d:`M0 0 10 5 0 10z`,className:`fill-message-peer-accent`})}),(0,q.jsx)(D,{id:_})]}),l.map(e=>{if(e.kind===`wait`){let t=n.has(e.id);return(0,q.jsx)(`path`,{"data-wait":e.id,"data-kind":`wait`,"data-active":t?`true`:void 0,d:e.d,fill:`none`,strokeDasharray:`0 8`,strokeLinecap:`round`,strokeWidth:t?3:2.2,markerEnd:`url(#${_})`,className:i(`stroke-message-peer-accent`,t?`opacity-100`:`opacity-80`,A(o,e.id))},e.id)}let t=C(o,e.id);return(0,q.jsx)(`path`,{"data-request":e.id,"data-kind":`peer`,"data-phase":t,d:e.d,fill:`none`,strokeDasharray:t===`replied`?void 0:`6 5`,strokeWidth:2,markerEnd:`url(#${g})`,className:i(`stroke-message-peer-accent`,P(t,e.id in o.opening))},e.id)}),(0,q.jsx)(`g`,{ref:d,"data-slot":`activity-comets`})]}),l.map(e=>{let t=e.kind===`wait`?m.get(e.id):void 0;if(t)return(0,q.jsx)(pe,{arc:e,wait:t,now:a,motion:o},e.id);let n=p.get(e.id);return n?(0,q.jsx)(me,{arc:e,request:n,now:a,motion:o},e.id):null})]})}var Y=(e,t)=>`/p/${encodeURIComponent(e)}/tasks/${encodeURIComponent(t)}`,ve=[],ye=`relative z-[1] inline-flex min-h-11 items-center text-[12px] text-message-peer-accent hover:underline focus-visible:outline-2 focus-visible:outline-ring`;function be({task:e}){let t=e.workers.filter(e=>j(e.status));return t.length===0?null:(0,q.jsxs)(`div`,{"data-slot":`activity-pill-workers`,className:`mt-1.5 ml-[19px] flex flex-wrap items-center gap-1 text-[11px] text-muted-foreground`,children:[t.map(e=>(0,q.jsx)(g,{run:e,role:`worker`},e.runId)),(0,q.jsxs)(`span`,{className:`ml-0.5`,children:[t.length,` worker`,t.length===1?``:`s`]})]})}function xe({projectId:e,task:t,requests:r,waits:a=ve,index:o,ctx:s,motion:c=f,linked:u=!1,onHover:p}){let h=m(t,s);return(0,q.jsxs)(`li`,{"data-activity-pill":t.runId,"data-rung":t.rung,"data-linked":u?`true`:void 0,...E(t.runId,p),className:i(`relative min-w-0 rounded-[10px] border bg-card-2 px-2.5 py-2`,h.action?`border-pending`:`border-border`,u&&`outline-2 outline-offset-2 outline-message-peer-accent`,t.runId in c.entering&&`activity-card-enter`),children:[(0,q.jsx)(d,{task:t,motion:c,glow:h.action!==void 0}),(0,q.jsxs)(`div`,{className:`flex items-center gap-[7px]`,children:[(0,q.jsx)(g,{run:t,role:`root`}),(0,q.jsx)(`h3`,{className:`min-w-0 flex-1 truncate text-[12.5px] font-medium`,children:(0,q.jsx)(n,{to:Y(e,t.runId),className:`after:absolute after:inset-0 after:rounded-[10px] after:content-[''] focus-visible:outline-2 focus-visible:outline-ring`,children:t.title})}),(0,q.jsx)(l,{rate:t.rate,className:`h-3 w-10`})]}),(0,q.jsxs)(`p`,{"data-slot":`activity-pill-line`,className:`mt-[3px] ml-[19px] truncate text-[11.5px] text-muted-foreground tabular-nums`,children:[(0,q.jsx)(v,{"data-slot":`activity-verb`,tone:h.tone,className:`font-semibold`,children:h.verb}),` · `,(0,q.jsx)(`span`,{"data-slot":`activity-main`,className:i(h.mono&&`font-mono text-[11px]`),children:h.main})]}),(0,q.jsx)(_,{texts:te(t.runId,r,o,a)}),(0,q.jsx)(be,{task:t}),(0,q.jsx)(T,{runId:t.runId,requests:r,waits:a,index:o,link:n,pathOf:t=>Y(e,t),className:`mt-1 ml-[19px] flex flex-col md:hidden`,linkClassName:ye})]})}var X=e=>`/p/${encodeURIComponent(e)}/activity`,Se=e=>`/p/${encodeURIComponent(e)}/`,Z=`rounded-xl border border-border bg-card px-4 pt-3.5 pb-4`,Ce=`ml-auto inline-flex items-center text-[12px] text-accent-text hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:min-h-11`;function Q({project:e,headingId:t,detail:r,to:i,label:a}){return(0,q.jsxs)(`header`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1`,children:[(0,q.jsx)(`h2`,{id:t,className:`min-w-0 truncate text-[14px] font-semibold`,children:e.name}),(0,q.jsx)(`span`,{"data-slot":`activity-panel-detail`,className:`text-[12px] text-muted-foreground`,children:r}),(0,q.jsx)(n,{to:i,className:Ce,children:a})]})}function $({project:e,notice:t}){let n=V.useId();return(0,q.jsx)(`section`,{"aria-labelledby":n,"data-slot":`activity-panel`,"data-project":e.projectId,"data-notice":`true`,className:Z,children:(0,q.jsx)(Q,{project:e,headingId:n,detail:t,to:Se(e.projectId),label:`Open project →`})})}function we(e,t){return V.useMemo(()=>{let n=new Set(e.requests.map(e=>e.requestId)),r=Object.values(t.closing).filter(t=>t.projectId===e.projectId&&!n.has(t.request.requestId)).map(e=>e.request);return W({tasks:e.tasks,requests:[...e.requests,...r]})},[e,t.closing])}function Te({project:e,now:t,motion:n=f,paused:r=!1}){let a=V.useId(),o=V.useMemo(()=>b(e),[e]),s=we(e,n),c=V.useMemo(()=>u(e.tasks),[e.tasks]),l=V.useMemo(()=>G(e.tasks,[...c,...p(e.projectId,c,n)]),[e.tasks,e.projectId,c,n]),d=k(c),m={now:t,titleOf:e=>R(o,e)},h=`${e.tasks.map(e=>e.runId).join(`,`)}:${s.map(e=>e.requestId).join(`,`)}:${l.map(e=>e.id).join(`,`)}`,g=s.length>0||l.length>0;return(0,q.jsxs)(`section`,{"aria-labelledby":a,"data-slot":`activity-panel`,"data-project":e.projectId,className:Z,children:[(0,q.jsx)(Q,{project:e,headingId:a,detail:K(e),to:X(e.projectId),label:`Open project activity →`}),(0,q.jsxs)(`div`,{className:i(`relative mt-3`,g&&`md:mt-1 md:pt-10`),children:[(0,q.jsx)(`ul`,{"data-slot":`activity-pills`,"aria-label":`${e.name} tasks`,className:i(`grid grid-cols-[repeat(auto-fill,minmax(min(100%,220px),1fr))] items-start gap-3.5`,g&&`md:gap-y-11`),children:e.tasks.map(t=>(0,q.jsx)(xe,{projectId:e.projectId,task:t,requests:e.requests,waits:c,index:o,ctx:m,motion:n,linked:d.linked.has(t.runId),onHover:d.onHover},t.runId))}),g?(0,q.jsx)(_e,{arcs:s,waits:l,active:d.active,layoutKey:h,now:t,motion:n,paused:r}):null]})]})}function Ee(e){let t=y(e.project);return t===void 0?(0,q.jsx)(Te,{...e}):(0,q.jsx)($,{project:e.project,notice:t})}function De({projects:e,belowPanels:t}){return e.length===0?null:(0,q.jsxs)(`p`,{"data-slot":`activity-idle`,className:`text-[12.5px] text-muted-foreground`,children:[ce(e.length,t),` `,e.map((e,t)=>(0,q.jsxs)(V.Fragment,{children:[t>0?`, `:null,(0,q.jsx)(n,{to:X(e.projectId),"data-project":e.projectId,className:`text-foreground hover:underline focus-visible:outline-2 focus-visible:outline-ring max-md:inline-flex max-md:min-h-11 max-md:items-center`,children:e.name})]},e.projectId))]})}var Oe={kind:`workspace`};function ke(){let e=s().data?.projects,{order:t}=B();return V.useMemo(()=>e?z(e,t).map(e=>e.id):void 0,[e,t])}function Ae(){let e=ee(Oe),n=s(),i=c(),a=t().state?.activityProjectId,o=ke(),l=N(e.data?.generatedAt,e.dataUpdatedAt),u=n.data?.bootProject??i.data?.bootProject??null,d=typeof a==`string`&&n.data?.projects.some(e=>e.id===a&&e.status!==`missing`)?a:u,f=e.data?.projects,p=V.useMemo(()=>U(H(f??[],o)),[f,o]),{motion:m,paused:g,reduced:_}=O(e.data,`workspace`);return(0,q.jsxs)(`div`,{"data-route":`activity-global`,"data-activity-paused":g?`true`:void 0,className:`flex min-h-full w-full flex-col gap-4 px-[18px] py-6 md:px-7`,children:[(0,q.jsx)(M,{name:`All projects`,now:e.data?l:void 0,stale:e.isError,children:(0,q.jsx)(w,{scope:`all`,projectId:d})}),f?(0,q.jsx)(ie,{summary:h(f),tasksTo:`/tasks`,bumps:m.bumps}):null,e.isPending?(0,q.jsx)(`p`,{"data-slot":`activity-loading`,role:`status`,className:`text-xs text-muted-foreground`,children:`Loading activity…`}):null,e.isError&&!f?(0,q.jsxs)(`div`,{role:`alert`,className:`flex items-center gap-3 text-[13px] text-muted-foreground`,children:[`Could not load activity: `,e.error.message,(0,q.jsx)(r,{size:`sm`,variant:`outline`,onClick:()=>void e.refetch(),className:`max-md:min-h-11`,children:`Retry`})]}):null,f&&p.panels.length===0&&p.idle.length===0?(0,q.jsx)(`p`,{"data-slot":`activity-empty`,className:`py-6 text-[13px] text-muted-foreground`,children:`No projects to show.`}):null,(0,q.jsx)(`div`,{"data-slot":`activity-panels`,className:`flex flex-col gap-3.5`,children:p.panels.map(e=>(0,q.jsx)(Ee,{project:e,now:l,motion:m,paused:g||_},e.projectId))}),(0,q.jsx)(De,{projects:p.idle,belowPanels:p.panels.length>0})]})}export{Ae as GlobalActivityRoute};