@wjarka/cezarion 0.17.0-pr2750.4607 → 0.17.0-pr2753.4613
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ci-wait/controller.d.ts +37 -37
- package/dist/delegation/transport.d.ts +62 -62
- package/dist/server/activity-routes.d.ts +23 -23
- package/dist/server/self-update-routes.d.ts +11 -11
- package/dist/server/server.d.ts +1230 -1230
- package/package.json +3 -3
- package/web/dist/assets/activity-motion-B5fIHwoB.css +1 -0
- package/web/dist/assets/activity-motion-Ch0PoZJR.js +2 -0
- package/web/dist/assets/activity-route-CQPkXxJ2.js +1 -0
- package/web/dist/assets/{agent-accounts-lFFHk56I.js → agent-accounts-ZGHdsjYE.js} +1 -1
- package/web/dist/assets/arrow-right-Dh_Lx3um.js +1 -0
- package/web/dist/assets/{commit-diff-panel-0_Qu3h0B.js → commit-diff-panel-UwU29VK_.js} +1 -1
- package/web/dist/assets/{control-locations-CM5KUQ3d.js → control-locations-SzZ8gyme.js} +1 -1
- package/web/dist/assets/{diff-Ca1O4a0T.js → diff-CQdcUei8.js} +2 -2
- package/web/dist/assets/{diff-view-Bk5YG0An.js → diff-view-BH7MnYEM.js} +1 -1
- package/web/dist/assets/{file-preview-bylLpbji.js → file-preview-BmEFF1nO.js} +1 -1
- package/web/dist/assets/{git-toolbar-BhVKNNog.js → git-toolbar-BIctOY7_.js} +1 -1
- package/web/dist/assets/github-BtPVrHZu.js +1 -0
- package/web/dist/assets/{github-sidebar-model-DeQrUvUi.js → github-sidebar-model-DssVqUad.js} +1 -1
- package/web/dist/assets/global-activity-route-BOg5DOZ-.js +1 -0
- package/web/dist/assets/hourglass-B0lPAJvT.js +1 -0
- package/web/dist/assets/index-B98HIjrF.js +12 -0
- package/web/dist/assets/index-DZItIsRv.css +1 -0
- package/web/dist/assets/{preview-pane-connected-DY6nOrSu.js → preview-pane-connected-Dfc9BAkc.js} +2 -2
- package/web/dist/assets/{project-router-n0p0qOgE.js → project-router-DQWY9FSQ.js} +1 -1
- package/web/dist/assets/{project-scope-context-a1Wrxrws.js → project-scope-context-DFjJ4Dzo.js} +3 -3
- package/web/dist/assets/queries-Cgys1fiN.js +1 -0
- package/web/dist/assets/{repo-git-BlRkTKPh.js → repo-git-BmaBIIo9.js} +1 -1
- package/web/dist/assets/{report-reader-BHAqz7cz.js → report-reader-BflKmitB.js} +1 -1
- package/web/dist/assets/{reports-CDtBVfcd.js → reports-D0VRvzsA.js} +1 -1
- package/web/dist/assets/run-header-p5pX7Js3.js +2 -0
- package/web/dist/assets/{skills-DHipK-wn.js → skills-BLI5ZUXe.js} +1 -1
- package/web/dist/assets/{tab-link-aLp9SnaN.js → tab-link-SMUzNnZa.js} +1 -1
- package/web/dist/assets/{task-changes-QfK-hLrE.js → task-changes-nzP5M4TF.js} +1 -1
- package/web/dist/assets/{task-commits-xIQcR_Km.js → task-commits-IDq_lfu-.js} +1 -1
- package/web/dist/assets/{task-files-B7oZBfjd.js → task-files-DKCWoClo.js} +1 -1
- package/web/dist/assets/{task-github-item-CjDws-2w.js → task-github-item-D-HcRSL8.js} +1 -1
- package/web/dist/assets/task-thread-BJuTSmY_.js +9 -0
- package/web/dist/assets/{thread-state-BBWH_A_c.js → thread-state-DWNsDveq.js} +1 -1
- package/web/dist/assets/{use-hand-to-agent-state-Ce533i9c.js → use-hand-to-agent-state-Ds1bv9Yr.js} +1 -1
- package/web/dist/assets/{useInfiniteQuery-BrVyFSZ3.js → useInfiniteQuery-HtyVqdKz.js} +1 -1
- package/web/dist/assets/useQuery-BGIo-SEb.js +1 -0
- package/web/dist/assets/{workflows-CBpLWh2t.js → workflows-BWyhlz9X.js} +2 -2
- package/web/dist/assets/ws-BZNDvStH.js +1 -0
- package/web/dist/index.html +11 -11
- package/web/dist/assets/activity-route-B1mVzd-G.js +0 -2
- package/web/dist/assets/attention-GMrS0SeU.js +0 -1
- package/web/dist/assets/github-lnyth9tK.js +0 -1
- package/web/dist/assets/global-activity-route-Bw-ScJWc.js +0 -1
- package/web/dist/assets/hourglass-DjKAbcdJ.js +0 -1
- package/web/dist/assets/index-BS8upD5I.js +0 -12
- package/web/dist/assets/index-CRlkK-XH.css +0 -1
- package/web/dist/assets/queries-k8gAuGEO.js +0 -1
- package/web/dist/assets/run-header-CIroyrry.js +0 -2
- package/web/dist/assets/task-thread-Ce9y5t-U.js +0 -9
- package/web/dist/assets/useQuery-P6-rXCt0.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t}from"./react-runtime-CCIEwYL0.js";import{A as n,M as r}from"./button-RJMdCnZw.js";import{$ as i,$n as a,$r as o,An as s,At as c,B as l,Ct as u,Dn as d,Fr as ee,Ft as f,Gn as p,H as te,Hn as m,Hr as ne,Ht as re,I as ie,Ir as ae,It as oe,Kr as se,L as ce,Ln as le,Lr as ue,Lt as de,M as fe,Mr as pe,Mt as me,N as he,Nr as ge,Nt as _e,Ot as ve,Pr as ye,Pt as be,Q as xe,R as Se,Rr as Ce,Rt as we,S as Te,St as Ee,Tn as De,Tr as Oe,Tt as ke,U as Ae,Ut as je,V as Me,Vr as h,W as Ne,X as Pe,Xt as Fe,Y as Ie,Yr as g,Yt as Le,Z as _,Zr as Re,_ as ze,_t as Be,ar as Ve,at as He,bn as Ue,br as We,bt as Ge,cn as Ke,ct as qe,dn as Je,dt as Ye,en as Xe,et as Ze,fn as Qe,ft as $e,gn as et,gt as tt,h as nt,hr as v,ht as rt,i as it,ii as at,jt as ot,kn as st,kt as ct,l as lt,ln as ut,lt as dt,mt as ft,ni as pt,nt as mt,oi as ht,ot as gt,pt as _t,q as vt,qr as yt,r as bt,rt as xt,si as St,st as Ct,tt as wt,ui as Tt,un as Et,ut as Dt,v as Ot,vt as kt,wn as At,wt as jt,x as Mt,xn as Nt,xr as Pt,xt as Ft,y as It,yn as Lt,yt as Rt,z as zt,zr as Bt}from"./project-scope-context-DFjJ4Dzo.js";import{t as y}from"./useInfiniteQuery-HtyVqdKz.js";import{t as b}from"./useQuery-BGIo-SEb.js";import{I as x,L as Vt,N as Ht}from"./live-protocol-ai7TG3jr.js";import{a as S,i as Ut,n as C,o as Wt,t as Gt}from"./ws-BZNDvStH.js";import{n as Kt}from"./toaster-BWMQArHJ.js";var qt=class extends se{#e;#t;#n;#r;constructor(e){super(),this.#e=e.client,this.mutationId=e.mutationId,this.#n=e.mutationCache,this.#t=[],this.state=e.state||Jt(),this.setOptions(e.options),this.scheduleGc()}setOptions(e){this.options=e,this.updateGcTime(this.options.gcTime)}get meta(){return this.options.meta}addObserver(e){this.#t.includes(e)||(this.#t.push(e),this.clearGcTimeout(),this.#n.notify({type:`observerAdded`,mutation:this,observer:e}))}removeObserver(e){this.#t=this.#t.filter(t=>t!==e),this.scheduleGc(),this.#n.notify({type:`observerRemoved`,mutation:this,observer:e})}optionalRemove(){this.#t.length||(this.state.status===`pending`?this.scheduleGc():this.#n.remove(this))}continue(){return this.#r?.continue()??this.execute(this.state.variables)}async execute(e){let t=()=>{this.#i({type:`continue`})},n={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#r=yt({fn:()=>this.options.mutationFn?this.options.mutationFn(e,n):Promise.reject(Error(`No mutationFn found`)),onFail:(e,t)=>{this.#i({type:`failed`,failureCount:e,error:t})},onPause:()=>{this.#i({type:`pause`})},onContinue:t,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#n.canRun(this)});let r=this.state.status===`pending`,i=!this.#r.canStart();try{if(r)t();else{this.#i({type:`pending`,variables:e,isPaused:i}),this.#n.config.onMutate&&await this.#n.config.onMutate(e,this,n);let t=await this.options.onMutate?.(e,n);t!==this.state.context&&this.#i({type:`pending`,context:t,variables:e,isPaused:i})}let a=await this.#r.start();return await this.#n.config.onSuccess?.(a,e,this.state.context,this,n),await this.options.onSuccess?.(a,e,this.state.context,n),await this.#n.config.onSettled?.(a,null,this.state.variables,this.state.context,this,n),await this.options.onSettled?.(a,null,e,this.state.context,n),this.#i({type:`success`,data:a}),a}catch(t){try{await this.#n.config.onError?.(t,e,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onError?.(t,e,this.state.context,n)}catch(e){Promise.reject(e)}try{await this.#n.config.onSettled?.(void 0,t,this.state.variables,this.state.context,this,n)}catch(e){Promise.reject(e)}try{await this.options.onSettled?.(void 0,t,e,this.state.context,n)}catch(e){Promise.reject(e)}throw this.#i({type:`error`,error:t}),t}finally{this.#n.runNext(this)}}#i(e){let t=t=>{switch(e.type){case`failed`:return{...t,failureCount:e.failureCount,failureReason:e.error};case`pause`:return{...t,isPaused:!0};case`continue`:return{...t,isPaused:!1};case`pending`:return{...t,context:e.context,data:void 0,failureCount:0,failureReason:null,error:null,isPaused:e.isPaused,status:`pending`,variables:e.variables,submittedAt:Date.now()};case`success`:return{...t,data:e.data,failureCount:0,failureReason:null,error:null,status:`success`,isPaused:!1};case`error`:return{...t,data:void 0,error:e.error,failureCount:t.failureCount+1,failureReason:e.error,isPaused:!1,status:`error`}}};this.state=t(this.state),g.batch(()=>{this.#t.forEach(t=>{t.onMutationUpdate(e)}),this.#n.notify({mutation:this,type:`updated`,action:e})})}};function Jt(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:`idle`,variables:void 0,submittedAt:0}}var Yt=class extends Tt{#e;#t=void 0;#n;#r;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#i()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),ht(this.options,t)||this.#e.getMutationCache().notify({type:`observerOptionsUpdated`,mutation:this.#n,observer:this}),t?.mutationKey&&this.options.mutationKey&&Re(t.mutationKey)!==Re(this.options.mutationKey)?this.reset():this.#n?.state.status===`pending`&&this.#n.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#n?.removeObserver(this)}onMutationUpdate(e){this.#i(),this.#a(e)}getCurrentResult(){return this.#t}reset(){this.#n?.removeObserver(this),this.#n=void 0,this.#i(),this.#a()}mutate(e,t){return this.#r=t,this.#n?.removeObserver(this),this.#n=this.#e.getMutationCache().build(this.#e,this.options),this.#n.addObserver(this),this.#n.execute(e)}#i(){let e=this.#n?.state??Jt();this.#t={...e,isPending:e.status===`pending`,isSuccess:e.status===`success`,isError:e.status===`error`,isIdle:e.status===`idle`,mutate:this.mutate,reset:this.reset}}#a(e){g.batch(()=>{if(this.#r&&this.hasListeners()){let t=this.#t.variables,n=this.#t.context,r={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type===`success`){try{this.#r.onSuccess?.(e.data,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(e.data,null,t,n,r)}catch(e){Promise.reject(e)}}else if(e?.type===`error`){try{this.#r.onError?.(e.error,t,n,r)}catch(e){Promise.reject(e)}try{this.#r.onSettled?.(void 0,e.error,t,n,r)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#t)})})}};function Xt(e,t){let n=new Set(t);return e.filter(e=>!n.has(e))}function Zt(e,t,n){let r=e.slice(0);return r[t]=n,r}var Qt=class extends Tt{#e;#t;#n;#r;#i;#a;#o;#s;#c;#l=[];constructor(e,t,n){super(),this.#e=e,this.#r=n,this.#n=[],this.#i=[],this.#t=[],this.setQueries(t)}onSubscribe(){this.listeners.size===1&&this.#i.forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})}onUnsubscribe(){this.listeners.size||this.destroy()}destroy(){this.listeners=new Set,this.#i.forEach(e=>{e.destroy()})}setQueries(e,t){this.#n=e,this.#r=t,g.batch(()=>{let e=this.#i,t=this.#p(this.#n);t.forEach(e=>e.observer.setOptions(e.defaultedQueryOptions));let n=t.map(e=>e.observer),r=n.map(e=>e.getCurrentResult()),i=e.length!==n.length,a=n.some((t,n)=>t!==e[n]),o=i||a,s=o?!0:r.some((e,t)=>{let n=this.#t[t];return!n||!ht(e,n)});!o&&!s||(o&&(this.#l=t,this.#i=n),this.#t=r,this.hasListeners()&&(o&&(Xt(e,n).forEach(e=>{e.destroy()}),Xt(n,e).forEach(e=>{e.subscribe(t=>{this.#m(e,t)})})),this.#h()))})}getCurrentResult(){return this.#t}getQueries(){return this.#i.map(e=>e.getCurrentQuery())}getObservers(){return this.#i}getOptimisticResult(e,t){let n=this.#p(e),r=n.map(e=>e.observer.getOptimisticResult(e.defaultedQueryOptions)),i=n.map(e=>e.defaultedQueryOptions.queryHash);return[r,e=>this.#d(e??r,t,i),()=>this.#u(r,n)]}#u(e,t){return t.map((n,r)=>{let i=e[r];return n.defaultedQueryOptions.notifyOnChangeProps?i:n.observer.trackResult(i,e=>{t.forEach(t=>{t.observer.trackProp(e)})})})}#d(e,t,n){if(t){let r=this.#c,i=n!==void 0&&r!==void 0&&(r.length!==n.length||n.some((e,t)=>e!==r[t]));return(!this.#a||this.#t!==this.#s||i||t!==this.#o)&&(this.#o=t,this.#s=this.#t,n!==void 0&&(this.#c=n),this.#a=at(this.#a,t(e))),this.#a}return e}#f(){return this.#r?.combine!==void 0&&this.#i.some((e,t)=>e.options.suspense&&this.#t[t]?.data===void 0)}#p(e){let t=new Map;this.#i.forEach(e=>{let n=e.options.queryHash;if(!n)return;let r=t.get(n);r?r.push(e):t.set(n,[e])});let n=[];return e.forEach(e=>{let r=this.#e.defaultQueryOptions(e),i=t.get(r.queryHash)?.shift()??new ne(this.#e,r);n.push({defaultedQueryOptions:r,observer:i})}),n}#m(e,t){let n=this.#i.indexOf(e);n!==-1&&(this.#t=Zt(this.#t,n,t),this.#h())}#h(){if(this.hasListeners()){let e=this.#u(this.#t,this.#l),t=this.#f(),n=this.#a,r=t?n:this.#d(e,this.#r?.combine);(t||n!==r)&&g.batch(()=>{this.listeners.forEach(e=>{e(this.#t)})})}}},w=e(t(),1);function T({queries:e,...t},n){let r=h(n),i=Bt(),a=Ce(),o=w.useMemo(()=>e.map(e=>{let t=r.defaultQueryOptions(e);return t._optimisticResults=i?`isRestoring`:`optimistic`,t}),[e,r,i]);o.forEach(e=>{pe(e);let t=r.getQueryCache().get(e.queryHash);ee(e,a,t)}),ue(a);let[s]=w.useState(()=>new Qt(r,o,t)),[c,l,u]=s.getOptimisticResult(o,t.combine),d=!i&&t.subscribed!==!1;w.useSyncExternalStore(w.useCallback(e=>d?s.subscribe(g.batchCalls(e)):pt,[s,d]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),w.useEffect(()=>{s.setQueries(o,t)},[o,t,s]);let f=c.some((e,t)=>ye(o[t],e))?c.flatMap((e,t)=>{let n=o[t];return n&&ye(n,e)?ge(n,new ne(r,n),a):[]}):[];if(f.length>0)throw Promise.all(f);let p=c.find((e,t)=>{let n=o[t];return n&&ae({result:e,errorResetBoundary:a,throwOnError:n.throwOnError,query:r.getQueryCache().get(n.queryHash),suspense:n.suspense})});if(p?.error)throw p.error;return l(u())}function E(e,t){let n=h(t),[r]=w.useState(()=>new Yt(n,e));w.useEffect(()=>{r.setOptions(e)},[r,e]);let i=w.useSyncExternalStore(w.useCallback(e=>r.subscribe(g.batchCalls(e)),[r]),()=>r.getCurrentResult(),()=>r.getCurrentResult()),a=w.useCallback((e,t)=>{r.mutate(e,t).catch(pt)},[r]);if(i.error&&St(r.options.throwOnError,[i.error]))throw i.error;return{...i,mutate:a,mutateAsync:i.mutate}}function D(e={}){let t=e.projectId??r();return{projectId:t,cacheScope:e.cacheScope??(e.boot?`default`:t)}}function O(e,t={}){return{...D(t),runId:e}}var k=[`workspace`,`runs-index`],A=e=>[e.cacheScope,`runs`,`list`],j=e=>[e.cacheScope,`runs`,`detail`,e.runId],M=e=>typeof e==`function`?e():e;function $t(e){let{seenAt:t,...n}=e;return n}function en(e,t){let n=$t(e);return t.seenAt===void 0?n:{...n,seenAt:t.seenAt}}function N(e,t,n){return t?{...e,seenAt:n}:$t(e)}function tn(e){let t=()=>{e.invalidateQueries({queryKey:k})};function n(n,i){if(n===`index`)return t();let a=typeof i==`function`?i():i;if(n===`indexed`){t(),e.invalidateQueries({queryKey:[r(),`runs`]}),e.invalidateQueries({queryKey:[a.projectId,`runs`,`list`]});return}if(n===`runs`)return e.invalidateQueries({queryKey:[a.cacheScope,`runs`]});let o=Pt(),s=[a.projectId,a.cacheScope],c=o!==void 0&&s.some(e=>e===o||e==="default")?[o,`default`]:[],l=new Set([...s,...c,r()]);return Promise.all([...l].map(t=>e.invalidateQueries({queryKey:[t,`runs`]}))).then(()=>void 0)}async function i(n,r){await e.cancelQueries({queryKey:A(M(n))}),await e.cancelQueries({queryKey:j(M(n))});let i=e.getQueryData(A(M(n))),a=e.getQueryData(j(M(n))),o=M(n).runId,s=new Date().toISOString();return e.setQueryData(A(M(n)),e=>e?.map(e=>e.id===o?N(e,r,s):e)),e.setQueryData(j(M(n)),e=>e&&N(e,r,s)),{id:o,prevList:i,prevDetail:a,rollback(){if(!r){i&&e.setQueryData(A(M(n)),i),a&&e.setQueryData(j(M(n)),a);return}let t=i?.find(e=>e.id===o);t&&e.setQueryData(A(M(n)),e=>e?.map(e=>e.id===o?en(e,t):e)),a&&e.setQueryData(j(M(n)),e=>e&&en(e,a))},settle(i){let a=e=>e.id===(r?o:i.id)?N(e,r,i.seenAt):e;e.setQueryData(A(M(n)),e=>e?.map(a));let s={...M(n),runId:r?o:i.id};e.setQueryData(j(s),e=>e?a(e):i),t()}}}async function a(t,r){await e.cancelQueries({queryKey:k});let i=e.getQueryData(k),a=r();return e.setQueryData(k,e=>e===void 0?e:{...e,runs:e.runs.map(e=>e.projectId===t.projectId&&e.id===t.runId?a(e):e)}),{previous:i,rollback(){i&&e.setQueryData(k,i)},settle(){n(`indexed`,t)}}}return{patchRead:i,patchIndex:a,invalidateAfter:n}}function P(){let e=h();return(0,w.useMemo)(()=>tn(e),[e])}var nn={draft:{label:`Draft`,hint:`the author has not marked it ready for review`,tone:`neutral`},"review-required":{label:`Waiting for review`,hint:`checks are fine, no one has reviewed it yet`,tone:`info`},"changes-requested":{label:`Changes requested`,hint:`a reviewer asked for edits before this can merge`,tone:`danger`},"checks-pending":{label:`Checks running`,hint:`CI has not finished on the latest commit`,tone:`pending`},"checks-failing":{label:`Checks failing`,hint:`CI is red on the latest commit`,tone:`danger`},ready:{label:`Ready to merge`,hint:`open, checks pass, nothing is waiting on a reviewer`,tone:`success`},merged:{label:`Merged`,hint:`this landed on its base branch`,tone:`merged`},closed:{label:`Closed`,hint:`closed without merging — the work did not land`,tone:`danger`},open:{label:`Open`,hint:`still open on the tracker`,tone:`success`},completed:{label:`Closed as completed`,hint:`the issue was resolved`,tone:`accent`},"not-planned":{label:`Closed as not planned`,hint:`the issue was declined — nothing shipped for it`,tone:`neutral`}},rn={label:`Merge conflicts`,hint:`this branch no longer merges cleanly into its base — rebase or merge the base in`,tone:`conflict`};function an(e){return typeof e==`string`&&Object.hasOwn(nn,e)}function on(e){return e!==void 0&&an(e)?nn[e]:void 0}function sn(e){return a(e)?!1:e.status===`queued`||e.status===`running`||e.status===`waiting`}function cn(e){return sn(e)&&e.status!==`queued`}function ln(e,t,n){return e.archived||!(e.status===`done`||e.status===`failed`||e.status===`cancelled`)||e.delegation?.role===`worker`||n!==void 0&&p(e)!==n?!1:t===`unpinned`?!e.pinned:t!==`pinned`||e.pinned===!0}var un=[`done`,`failed`];function dn(e){return e.archived||a(e)||!un.includes(e.status)?!1:e.finishedAt!==void 0}function fn(e){let t=e.finishedAt;return t===void 0||!dn(e)?!1:e.seenAt===void 0||e.seenAt<t}function pn(e){let t=/\/(\d+)\/?$/.exec(e.trim()),n=t?Number(t[1]):NaN;return Number.isInteger(n)&&n>0?n:null}function mn(e){let t=new Set;for(let n of[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl]){let e=n?pn(n):null;e!==null&&t.add(e)}for(let n of[e.prNumber,e.issueNumber,e.markerRefs?.pr,e.markerRefs?.issue])typeof n==`number`&&Number.isInteger(n)&&n>0&&t.add(n);for(let n of e.pullRequests??[])t.add(n.number);return[...t]}var hn=[{id:`title`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.title]},{id:`titleSummary`,kind:`text`,scopes:[`stored`],source:`summary`,texts:e=>[e.titleSummary]},{id:`displayTitle`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.displayTitle]},{id:`branch`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.branch]},{id:`workflow`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflow]},{id:`workflowLabel`,kind:`text`,scopes:[`stored`,`shown`],source:`summary`,texts:e=>[e.workflowLabel]},{id:`automation`,kind:`text`,scopes:[`stored`,`shown`],source:`reader`,texts:(e,t)=>[t.automation],universe:e=>[...e.automationNames?.values()??[]]},{id:`projectName`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>[t.projectName]},{id:`tags`,kind:`text`,scopes:[`shown`],source:`reader`,texts:(e,t)=>t.tags??[]},{id:`id`,kind:`identifier`,scopes:[`stored`],source:`summary`,texts:e=>[e.id]},{id:`urls`,kind:`link`,scopes:[`stored`],source:`summary`,texts:e=>[e.pullRequestUrl,e.referencedPullRequestUrl,e.referencedIssueUrl,...(e.pullRequests??[]).map(e=>e.url)]},{id:`heldReferences`,kind:`reference`,scopes:[`stored`],source:`summary`,numbers:mn},{id:`shownReferences`,kind:`reference`,scopes:[`shown`],source:`reader`,numbers:(e,t)=>t.references?.()??[]}];function gn(e){return e.trim().toLowerCase().split(/\s+/).filter(e=>e!==``)}function _n(e,t){if(t!==`phrase`)return gn(e);let n=e.trim().toLowerCase();return n===``?[]:[n]}function vn(e,t){return t&&e.automationId!==void 0?t.get(e.automationId)??e.automationId:void 0}function yn(e,t){let n=t.scope??`stored`,r=t.scope===`shown`?t.omit??[]:[],i=t.scope===`shown`?t.extras:{automation:vn(e,t.automationNames)},a=[],o=[],s=[],c={text:a,identifier:o,link:s},l=[];for(let t of hn)if(!(!t.scopes.includes(n)||r.includes(t.id))){if(t.kind===`reference`){l.push(()=>t.numbers(e,i));continue}for(let n of t.texts(e,i))typeof n==`string`&&c[t.kind].push(n.toLowerCase())}let u;return{prose:a,ids:o,links:s,references:()=>u??=new Set(l.flatMap(e=>e().map(String)))}}function bn(e,t,n={}){let r=_n(t,n.mode);if(r.length===0)return!1;let{prose:i,ids:a,links:o,references:s}=yn(e,n);return r.every(e=>{if(i.some(t=>t.includes(e)))return!0;let t=e.replace(/^#/,``);return/^\d+$/.test(t)?s().has(String(Number(t)))||a.some(e=>e.startsWith(t)):a.some(t=>t.includes(e))||o.some(t=>t.includes(e))})}var xn=[`Needs you`,`Finished`,`Working`,`Archived`],Sn={waiting:0,review:1,running:2,queued:4,done:5,failed:6,cancelled:7},Cn=3,F=e=>a(e)?Cn:Sn[e.status]??9;function wn(e){let t=e=>le[m(e).bucket];return[...e].sort((e,n)=>t(e)-t(n)||F(e)-F(n))[0]}function Tn(e,t){return t===`archived`?`Archived`:m(e).bucket===`waiting`?`Needs you`:e.status===`waiting`||e.status===`running`||e.status===`queued`?`Working`:`Finished`}function En(e){let t=e.titleSummary;return t===void 0||!(e.titleOrigin===`user`||e.titleOrigin===`marker`)&&/[.!?][A-Z]/.test(t)?e.title:t}function Dn(e){let t=/^(\d{1,9}): (.+)$/.exec(e),n=t?.[1],r=t?.[2];return n===void 0||r===void 0?{ref:null,rest:e}:{ref:Number(n),rest:r}}function On(e,t){return t!==void 0&&Dn(e).ref===t}function kn(e){let t=e.filter(e=>!e.archived&&e.status===`queued`).sort((e,t)=>e.createdAt.localeCompare(t.createdAt));return new Map(t.map((e,t)=>[e.id,t+1]))}function An(e,t){return e.filter(e=>t===`archived`?e.archived:!e.archived).sort((e,n)=>{if(t!==`archived`){let t=Number(!!n.pinned)-Number(!!e.pinned);if(t!==0)return t}let r=F(e)-F(n);if(r!==0)return r;if(a(e)&&a(n)){let t=e.autoResumeAt.localeCompare(n.autoResumeAt);if(t!==0)return t}return e.status===`queued`&&n.status===`queued`?e.createdAt.localeCompare(n.createdAt):n.createdAt.localeCompare(e.createdAt)})}function I(e){return e.delegation?.role===`worker`}function jn(e,t){if(e==null)return null;let n=t.find(t=>t.id===e);return!n||!I(n)?e:n.delegation?.parentRunId??e}function Mn(e,t,n=kn(e)){let r=An(e,t).filter(e=>!I(e)),i=new Map,a=(e,t)=>{let n=i.get(e);n?n.push(t):i.set(e,[t])};for(let e of r)a(Tn(e,t),{kind:`run`,run:e,queuePosition:n.get(e.id)??null});return xn.filter(e=>i.has(e)).map(e=>({label:e,rows:i.get(e)}))}function Nn(e,t={}){let n=typeof t==`number`?{overall:t}:Ht(t),r={"Needs you":`needsYou`,Finished:`finished`,Working:`working`},i=[],a=n.overall===void 0?10:n.overall??1/0;for(let t of e){let e=t.label===`Archived`?1/0:n[r[t.label]]??1/0,o=t.rows.filter(n=>{let r=n.run.pinned;return t.label!==`Archived`&&r?!0:a<=0||e<=0?!1:(--a,--e,!0)});o.length&&i.push({label:t.label,rows:o})}return i}function Pn(e,t){if(t.length===0)return[...e];let n=new Set(e.map(e=>e.id)),r=new Set,i=t.filter(e=>n.has(e.id)||r.has(e.id)?!1:(r.add(e.id),!0));return[...e,...i]}function Fn(e){let t=0,n=0,r=0;for(let i of e)if(!I(i)){if(i.archived){n+=1;continue}t+=1,m(i).bucket===`waiting`&&(r+=1)}return{active:t,archived:n,waiting:r}}function In(e,t){let n=t===`automations`;return e.filter(e=>!e.archived&&p(e)===n)}var L={"Needs you":`needs-you`,Finished:`finished`,Working:`working`},Ln=Object.keys(L),Rn=`section`;function zn(e,t){return`/?origin=${t===`automations`?`automations`:`direct`}&${Rn}=${L[e]}`}function Bn(e){return Ln.find(t=>L[t]===e)??null}function Vn(e){let t={active:0,automations:0,activeWaiting:0,automationsWaiting:0};for(let n of e){if(I(n)||n.archived)continue;let e=+(m(n).bucket===`waiting`);p(n)?(t.automations+=1,t.automationsWaiting+=e):(t.active+=1,t.activeWaiting+=e)}return t}var Hn=new Set([`running`,`waiting`]);function R(e){return e?e>=1024**3?`${(e/1024**3).toFixed(1)} GB`:e>=1024**2?`${Math.round(e/1024**2)} MB`:`${Math.round(e/1024)} kB`:``}function Un(e){return e===void 0?``:`$${e>=10?e.toFixed(0):e.toFixed(2)}`}function Wn(e,t=new Date){if(!a(e))return;let n=new Date(e.autoResumeAt);if(!Number.isFinite(n.getTime()))return;let r=n.toDateString()===t.toDateString(),i=new Intl.DateTimeFormat(void 0,{hour:`numeric`,minute:`2-digit`}).format(n);return{label:r?i:`${new Intl.DateTimeFormat(void 0,{month:`short`,day:`numeric`}).format(n)} ${i}`,title:`Resumes automatically at ${new Intl.DateTimeFormat(void 0,{dateStyle:`medium`,timeStyle:`long`}).format(n)}`}}function Gn(e){return e.steps?Ve({workflow:e.workflow,steps:e.steps}):e.workflowLabel??e.workflow}function Kn(e,t,n=()=>``){let r=e.filter(e=>!I(e));return t.trim()?r.filter(e=>bn(e,t,{scope:`shown`,mode:`phrase`,extras:{displayTitle:En(e),automation:n(e),references:()=>qn(e)}})):[...r]}function qn(e){return z(e).map(e=>e.number)}function Jn(e,t){return e.filter(e=>ln(e,t)).length}function Yn(e){return Jn(e)}function Xn(e){if(!e)return;let t=e.trim().replace(/\/+$/,``),n=/^(?:https?|ssh|git|git\+ssh):\/\/(?:[^@/]+@)?([^/:]+)(?::\d+)?\/(.+)$/.exec(t),r=n?null:/^(?:[^@/:]+@)?([^:/]+):(.+)$/.exec(t),i=n??r;if(!i)return;let[,a,o]=i;if(!o||a?.toLowerCase()!==`github.com`)return;let s=o.replace(/\.git$/i,``).split(`/`).filter(Boolean),c=s[s.length-2],l=s[s.length-1];return c&&l?`https://github.com/${c}/${l}`:void 0}function Zn(e){return Qn(e)[0]??e.pullRequests?.find(e=>e.url)?.url}function Qn(e){let t=[];return e.pullRequestUrl&&t.push(e.pullRequestUrl),!(e.markerRefs?.issue!==void 0&&e.markerRefs?.pr===void 0)&&e.referencedPullRequestUrl&&t.push(e.referencedPullRequestUrl),t}function $n(e,t){if(e.referencedIssueUrl)return e.referencedIssueUrl;let n=e.issueNumber??e.markerRefs?.issue;if(!(!n||!t))return`${t}/issues/${n}`}function er(e){let t=`${e.kind}#${e.number}`;if(!e.url)return`${t}@project:${e.projectId??`default`}`;try{let n=new URL(e.url),r=n.pathname.split(`/`).filter(Boolean).slice(0,2).join(`/`);return`${t}@${n.host.toLowerCase()}/${r.toLowerCase()}`}catch{return`${t}@${e.url}`}}function z(e,t,n=e.projectId){let r=Qn(e),i=e.markerRefs?.pr,a=[...i===void 0||[...r,...(e.pullRequests??[]).flatMap(e=>e.url?[e.url]:[])].some(e=>V(e)===String(i))?[]:[{kind:`PR`,number:i}],...r.map(e=>({kind:`PR`,url:e})),{kind:`PR`,number:e.prNumber},...(e.pullRequests??[]).map(e=>({kind:`PR`,number:e.number,...e.url?{url:e.url}:{},authoritative:!0})),{kind:`Issue`,url:$n(e,t)},{kind:`Issue`,number:e.issueNumber}],o=new Set,s=[];for(let e of a){let r=e.url?Number(V(e.url)):e.number;if(!r||!Number.isInteger(r)||!e.url&&!e.authoritative&&s.some(t=>t.url&&t.kind===e.kind&&t.number===r))continue;let i=e.url??tr(e.kind,r,t),a={kind:e.kind,number:r,...i?{url:i}:n===void 0?{}:{projectId:n}},c=er(a);o.has(c)||(o.add(c),s.push(a))}return s}function tr(e,t,n){if(n)return`${n}/${e===`PR`?`pull`:`issues`}/${t}`}function nr(e){return z(e)[0]}function B(e,t){if(!e.url)return!0;if(!t)return!1;let n=rr(t);return n!==void 0&&rr(e.url)===n}function rr(e){try{let t=new URL(e),[n,r]=t.pathname.split(`/`).filter(Boolean);return n&&r?`${t.host}/${n}/${r}`.toLowerCase():void 0}catch{return}}function ir(e,t){let n=[];for(let r of z(e,t)){if(!B(r,t))continue;let e=r.kind===`PR`?`pr`:`issue`;n.some(t=>t.kind===e&&t.number===r.number)||n.push({kind:e,number:r.number})}return n}function ar(e,t,n,r){if(B(n,r))return`/p/${e}/tasks/${t}/${n.kind===`PR`?`pr`:`issue`}/${n.number}`}function V(e){return/\/(\d+)\/?(?:[?#].*)?$/.exec(e)?.[1]??null}function or(e,t){let n=Hn.has(e.status)?t:void 0;if(n)return{cpu:{text:`${n.cpuPct.toFixed(0)}%`,kind:`live`},mem:{text:R(n.rssBytes),kind:`live`}};let r=R(e.peakRssBytes);return{cpu:{text:``,kind:`none`},mem:r?{text:`peak ${r}`,kind:`peak`,title:`peak — run finished${e.peakProcCount?` · ${e.peakProcCount} procs`:``}`}:{text:``,kind:`none`}}}function sr(e){let t=new Map;for(let n of e)for(let e of n.tags??[]){let n=e.toLowerCase();t.has(n)||t.set(n,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function cr(e,t,n,r=8){let i=n.trim().toLowerCase(),a=new Set(t.map(e=>e.toLowerCase())),o=e.filter(e=>{let t=e.toLowerCase();return a.has(t)?!1:i===``||t.includes(i)&&t!==i});return i===``?o.slice(0,r):o.sort((e,t)=>Number(t.toLowerCase().startsWith(i))-Number(e.toLowerCase().startsWith(i))||e.localeCompare(t,void 0,{sensitivity:`base`})).slice(0,r)}function lr(e){let t=new Map;for(let n of e){let e=n.trim();if(!e)continue;let r=e.toLowerCase();t.has(r)||t.set(r,e)}return[...t.values()].sort((e,t)=>e.localeCompare(t,void 0,{sensitivity:`base`}))}function ur(e){if(!e.available)return;let t=e.issuesNextCursor,n=e.prsNextCursor;if(!(t===void 0&&n===void 0)&&!(!t&&!n))return{...t?{issuesCursor:t}:{issuesDone:!0},...n?{prsCursor:n}:{prsDone:!0}}}function dr(e,t){return e?(t===`issues`?e.issuesNextCursor:e.prsNextCursor)==null:!1}function fr(e,t,n){for(let r of e)t.has(r.number)||(t.add(r.number),n.push(r))}function pr(e){let t=e[0];if(!t)return;let n=e[e.length-1],r=[],i=[],a=new Set,o=new Set,s={};for(let t of e){fr(t.issues,a,r),fr(t.prs,o,i);for(let[e,n]of Object.entries(t.labelColors??{}))s[e]??=n}let c=e.find(e=>e.projects)?.projects,l=e.map(e=>e.projectsState),u=e.find(e=>e.projectsState===`unavailable`),d=l.includes(`refreshing`)?`refreshing`:u?`unavailable`:l.some(e=>e===`ready`)?`ready`:void 0,{projectsGeneration:ee,projectsReason:f,...p}=t;return{...p,issues:r,prs:i,...Object.keys(s).length>0?{labelColors:s}:{},...c?{projects:c}:{},...d?{projectsState:d}:{},...d===`unavailable`&&u?.projectsReason?{projectsReason:u.projectsReason}:{},...`issuesNextCursor`in n?{issuesNextCursor:n.issuesNextCursor}:{},...`prsNextCursor`in n?{prsNextCursor:n.prsNextCursor}:{}}}var H=e=>e.map(e=>e.number).join(`,`);function mr(e,t){let n=e[0];if(e.length>1&&n&&(H(n.issues)!==H(t.issues)||H(n.prs)!==H(t.prs)||n.issuesTotal!==t.issuesTotal||n.prsTotal!==t.prsTotal))return`refetch`;let r=t;if(n&&t.available&&t.projectsState===`refreshing`&&n.repo===t.repo){let e=new Map(n.issues.map(e=>[e.number,e.projectIds]));r={...t,issues:t.issues.map(t=>{let n=e.get(t.number);return t.projectIds===void 0&&n!==void 0?{...t,projectIds:n}:t})}}return[r,...e.slice(1)]}var U={get health(){return[r(),`health`]},runs:{get all(){return[r(),`runs`]},relationships:e=>[r(),`runs`,`relationships`,e],list:(e=r())=>[e,`runs`,`list`],archived:e=>[r(),`runs`,`archived`,e],detail:(e,t=r())=>[t,`runs`,`detail`,e],diff:e=>[r(),`runs`,`diff`,e],changes:e=>[r(),`runs`,`changes`,e],file:(e,t)=>[r(),`runs`,`files`,e,t],handoff:e=>[r(),`runs`,`handoff`,e],commits:e=>[r(),`runs`,`commits`,e],commit:(e,t)=>[r(),`runs`,`commit`,e,t]},get workflows(){return[r(),`workflows`]},get skills(){return[r(),`skills`]},get skillsReady(){return[r(),`skills`,`ready`]},get importableSkills(){return[r(),`skills`,`importable`]},get importableSkillsReady(){return[r(),`skills`,`importable`,`ready`]},get launchKey(){return[r(),`launch-key`]},get repo(){return[r(),`repo`]},get repoChanges(){return[r(),`repo`,`changes`]},repoCommit:e=>[r(),`repo`,`commit`,e],get repoBranches(){return[r(),`repo`,`branches`]},get uiState(){return[r(),`ui-state`]},get config(){return[r(),`config`]},get agentConfig(){return[r(),`agent-config`]},agentConfigFile:e=>[r(),`agent-config`,`file`,e],get worktrees(){return[r(),`worktrees`]},github:(e={})=>[r(),`github`,e.limit??null],githubPages:e=>[r(),`github`,`pages`,e],githubPagesHead:e=>[r(),`github`,`pages-head`,e],githubCommentCounts:(e,t)=>[r(),`github`,`comment-counts`,e,[...t].sort((e,t)=>e-t).join(`,`)],githubChecks:e=>[r(),`github`,`checks`,[...e].sort((e,t)=>e-t).join(`,`)],githubSearch:(e,t)=>[r(),`github`,`search`,e,t],githubRefStatus:(e,t,n)=>[e,`github`,`ref-status`,[...t].sort((e,t)=>e-t).join(`,`),[...n].sort((e,t)=>e-t).join(`,`)],githubComments:(e,t)=>[r(),`github`,`comments`,e,t],githubItem:(e,t)=>[r(),`github`,`item`,e,t],githubRefStatusOf:e=>[e,`github`,`ref-status`],githubPrChanges:e=>[r(),`github`,`pr-changes`,e],githubMergeState:e=>[r(),`github`,`merge-state`,e],get openTargets(){return[r(),`open-targets`]}},W={models:e=>[`workspace`,`models`,e],providerStatus:[`workspace`,`providers`,`status`],projects:[`workspace`,`projects`],githubOwners:[`workspace`,`github-owners`],runsIndex:[`workspace`,`runs-index`],runsSearch:e=>[`workspace`,`runs-search`,e],uiState:[`workspace`,`ui-state`],config:[`workspace`,`config`],agentProfiles:[`workspace`,`agent-profiles`],agentAccountDetails:e=>[`workspace`,`agent-profiles`,`details`,e],agentAccountStatus:e=>[`workspace`,`agent-profiles`,`status`,e],fsBrowseRoot:[`workspace`,`fs-browse`],fsBrowse:(e,t=!1)=>[...W.fsBrowseRoot,e,t]};function G(e,t,n=`active`){return e.invalidateQueries({queryKey:t===void 0?[`workspace`,`models`]:W.models(t),refetchType:n})}function K(e,t=!0){let n=h();return(0,w.useEffect)(()=>{if(!t||e!==`cursor`)return;let r,i=()=>{let e=n.getQueryData(U.health)?.capabilities?.localHandoff===!0;e&&!r?r=Gt(`models:cursor`,e=>{let t=Vt.safeParse(e);t.success&&t.data.runner===`cursor`&&(n.cancelQueries({queryKey:W.models(`cursor`)}),n.setQueryData(W.models(`cursor`),t.data))}):!e&&r&&(r(),r=void 0)};i();let a=n.getQueryCache().subscribe(i);return()=>{a(),r?.()}},[t,e,n]),b({queryKey:W.models(e),queryFn:({signal:t})=>x(e)?ct(e,{signal:t}):Promise.reject(Error(`${e} has no host model catalog`)),staleTime:300*1e3,enabled:t&&x(e)})}function hr(e=!0){return{claude:K(`claude`,e),codex:K(`codex`,e),opencode:K(`opencode`,e),pi:K(`pi`,e),cursor:K(`cursor`,e),omp:K(`omp`,e)}}function gr(){let e=h();return b({queryKey:W.providerStatus,queryFn:async({signal:t})=>{let n=e.getQueryData(W.providerStatus),r=await ft(!1,{signal:t});return v(n,e.getQueryData(W.providerStatus),r)},staleTime:5*6e4,refetchInterval:C(!1),refetchOnWindowFocus:!0})}function _r(){let e=h();return E({mutationFn:()=>ft(!0),onMutate:()=>e.getQueryData(W.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(W.providerStatus,e=>v(r,e,t)),G(e)}})}function vr(){let e=h();return E({mutationFn:({provider:e,authFailureId:t})=>et(e,t),onMutate:()=>e.getQueryData(W.providerStatus),onSuccess:(t,n,r)=>{e.setQueryData(W.providerStatus,e=>v(r,e,t,n.authFailureId)),x(n.provider)&&G(e,n.provider)}})}function yr(e={}){return b({queryKey:W.projects,queryFn:({signal:e})=>_t({signal:e}),...e})}function br(e,t=!1){return b({queryKey:W.fsBrowse(e,t),queryFn:({signal:n})=>lt(e??void 0,{signal:n,showHidden:t}),retry:!1})}function xr(){let e=h();return E({mutationFn:e=>Ke(e),onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function Sr(){let e=h();return E({mutationFn:e=>Et(e),retry:!1,onSuccess:()=>{e.invalidateQueries({queryKey:W.projects})}})}function Cr(){let e=h();return E({mutationFn:e=>{let{id:t,...n}=e;return st(t,n)},retry:!1,onMutate:async({id:t,...n})=>{await e.cancelQueries({queryKey:W.projects});let r=e.getQueryData(W.projects);return e.setQueryData(W.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t?wr(e,n):e)}),{previous:r}},onError:(t,n,r)=>{r?.previous&&e.setQueryData(W.projects,r.previous)},onSuccess:({project:t})=>{e.setQueryData(W.projects,e=>e===void 0?e:{...e,projects:e.projects.map(e=>e.id===t.id?t:e)})},onSettled:()=>e.invalidateQueries({queryKey:W.projects})})}function wr(e,t){let{maxParallel:n,tags:r,...i}=e,a={...i},o=`maxParallel`in t?t.maxParallel:e.maxParallel;o!=null&&(a.maxParallel=o);let s=`tags`in t&&t.tags!==void 0?t.tags:e.tags,c=s==null?[]:lr(s);if(c.length>0&&(a.tags=c),`webhook`in t&&t.webhook!==void 0)if(t.webhook===null)delete a.webhook;else{let n=t.webhook.token===void 0?e.webhook?.tokenSet??!1:t.webhook.token!==``;a.webhook={url:t.webhook.url,tokenSet:n}}return a}function q(e){let t=h();return E({mutationFn:e,retry:!1,onSuccess:({project:e})=>{t.setQueryData(W.projects,t=>t===void 0?t:{...t,projects:t.projects.map(t=>t.id===e.id?e:t)})},onSettled:()=>t.invalidateQueries({queryKey:W.projects})})}function Tr(){return q(e=>{let{projectId:t,...n}=e;return Te(t,n)})}function Er(){return q(e=>{let{projectId:t,webhookId:n,...r}=e;return s(t,n,r)})}function Dr(){return q(({projectId:e,webhookId:t})=>Je(e,t))}function Or(){return E({mutationFn:({projectId:e,webhookId:t})=>De(e,t),retry:!1})}function kr(e){let t=h();return E({mutationFn:t=>re(e,t),retry:!1,onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function J(e){let t=h();return E({mutationFn:e,retry:!1,onSuccess:async()=>{await Promise.all([t.invalidateQueries({queryKey:W.agentProfiles}),t.invalidateQueries({queryKey:W.projects})])}})}function Ar(){return J(e=>It(e))}function jr(){return J(e=>{let{id:t,...n}=e;return d(t,n)})}function Mr(){return J(e=>ut(e))}function Nr(){return J(e=>Ue(e))}function Pr(e,t){return b({queryKey:W.agentAccountDetails(e),queryFn:({signal:t})=>ie(e,{signal:t}),enabled:t,staleTime:0,retry:!1})}function Fr(e,t){return b({queryKey:W.agentAccountStatus(e),queryFn:({signal:t})=>ce(e,{signal:t}),enabled:t,staleTime:6e4,retry:!1})}function Ir(){let e=h();return E({mutationFn:({provider:e,profileId:t})=>ze(e,t),retry:!1,onSuccess:async(t,{provider:n})=>{await Promise.all([e.invalidateQueries({queryKey:W.agentProfiles}),e.invalidateQueries({queryKey:W.providerStatus}),x(n)?G(e,n,`none`):Promise.resolve()])}})}function Lr(){let e=h();return E({mutationFn:e=>ce(e,{refresh:!0}),retry:!1,onSuccess:(t,n)=>{e.setQueryData(W.agentAccountStatus(n),t),e.invalidateQueries({queryKey:W.agentProfiles}),x(t.status.provider)&&G(e,t.status.provider)}})}function Rr(){return E({mutationFn:e=>{let{routeId:t,...n}=e;return je(t,n)},retry:!1})}function zr(){let e=h();return E({mutationFn:e=>nt(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function Br(){let e=h();return E({mutationFn:e=>Mt(e),retry:!1,onSuccess:()=>e.invalidateQueries({queryKey:W.projects})})}function Vr({enabled:e}){return b({queryKey:W.githubOwners,queryFn:({signal:e})=>mt({signal:e}),enabled:e,staleTime:6e4,retry:!1})}function Hr(){let e=h();(0,w.useEffect)(()=>{let t,r=()=>{let r=e.getQueryData(U.health),i=r?.capabilities?.localHandoff===!0;r&&We({local:i,bootProject:r.bootProject??`default`,apiBase:n()}),i&&t===void 0?t=Gt(`health`,t=>{e.setQueryData(U.health,t)}):!i&&t!==void 0&&(t(),t=void 0)};r();let i=e.getQueryCache().subscribe(r);return()=>{i(),t?.(),Oe()}},[e])}function Y(){return b({queryKey:U.health,queryFn:({signal:e})=>qe({signal:e})})}function Ur(e,t){let n=Y().data,r=yr(t).data?.projects,i=bt(),a=e??i.projectId,o=a??n?.bootProject,s=o===void 0?void 0:r?.find(e=>e.id===o);return s?.repoUrl?s.repoUrl:a===null||a===n?.bootProject?Xn(n?.repo?.remote):void 0}function Wr(){return b({queryKey:U.openTargets,queryFn:({signal:e})=>$e({signal:e}),staleTime:5*6e4})}function Gr(){return b({queryKey:U.runs.list(),queryFn:({signal:e})=>c(D(),{signal:e})})}function Kr(e,t){return y({queryKey:U.runs.archived(e),enabled:t,initialPageParam:void 0,queryFn:({pageParam:t,signal:n})=>Me({before:t,limit:200,q:e},{signal:n}),getNextPageParam:e=>e.nextCursor??void 0,placeholderData:(e,t)=>t?.queryKey[0]===r()?e:void 0})}function qr(e){let t=e.trim();return b({queryKey:W.runsSearch(t),queryFn:({signal:e})=>Lt(t,{signal:e}),enabled:t.length>=2,placeholderData:o,staleTime:1e4})}function Jr(e=!0,t){return S(`/api/v1/workspace/runs-index`,W.runsIndex,C(e?t??!1:!1)),b({queryKey:W.runsIndex,queryFn:({signal:e})=>ot({signal:e}),enabled:e,staleTime:3e4,refetchInterval:!1})}function Yr(e,t=!0,n=!1){return b({queryKey:[D({projectId:e,boot:n}).cacheScope,`runs`,`list`],queryFn:({signal:t})=>c(D({projectId:e,boot:n}),{signal:t}),enabled:t})}function Xr(e){let t=h();return E({mutationFn:e=>fe(e),onSettled:()=>t.invalidateQueries({queryKey:U.runs.relationships(e)})})}function Zr(e,t={}){return b({queryKey:U.runs.relationships(e),queryFn:({signal:t})=>ve(e,{signal:t}),enabled:t.enabled??!0})}function Qr(e){return b({queryKey:U.runs.detail(e??``),queryFn:({signal:t})=>Rt(O(e),{signal:t}),enabled:!!e})}function $r(e,t,n=!0){return b({queryKey:[e??`default`,`runs`,`detail`,t??``],queryFn:({signal:n})=>Rt(O(t,{projectId:e}),{signal:n}),enabled:n&&!!e&&!!t})}function ei(e){return b({queryKey:U.runs.diff(e??``),queryFn:({signal:t})=>u(e,{signal:t}),enabled:!!e})}function ti(e,t=!1){return S(e?`/api/v1/p/${r()}/runs/${encodeURIComponent(e)}/changes`:void 0,U.runs.changes(e??``),C(t?4e3:!1)),b({queryKey:U.runs.changes(e??``),queryFn:({signal:t})=>Ge(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1,refetchOnWindowFocus:!0,staleTime:0})}function ni(e,t){return b({queryKey:U.runs.file(e??``,t??``),queryFn:({signal:n})=>jt(e,t,{signal:n}),enabled:!!e&&t!==void 0,retry:!1})}function ri(e,t){return b({queryKey:[r(),`runs`,`file-link`,e,t],queryFn:({signal:n})=>Pe(e,t,{signal:n}),enabled:t!==null,retry:!1})}function ii(e,t){return b({queryKey:[r(),`runs`,`artifact`,e,t],queryFn:({signal:n})=>te(e,t,{signal:n}),enabled:t!==null,retry:!1})}function ai(e,t){return b({queryKey:[r(),`runs`,`artifact-metadata`,e,t],queryFn:({signal:n})=>Ae(e,t,{signal:n}),enabled:t!==null,retry:!1})}function oi(e){return b({queryKey:[r(),`runs`,`artifacts`,e],queryFn:({signal:t})=>Ne(e,{signal:t}),retry:!1,staleTime:0,refetchOnWindowFocus:!0})}function si(e,t=!1){return S(e?`/api/v1/p/${r()}/runs/${encodeURIComponent(e)}/commits`:void 0,U.runs.commits(e??``),C(t?5e3:!1)),b({queryKey:U.runs.commits(e??``),queryFn:({signal:t})=>Ee(e,{signal:t}),enabled:!!e,retry:!1,refetchInterval:!1})}function ci(e,t){return b({queryKey:U.runs.commit(e??``,t??``),queryFn:({signal:n})=>Ft(e,t,{signal:n}),enabled:!!e&&!!t,retry:!1})}function li(e,t=!0){return b({queryKey:U.runs.handoff(e??``),queryFn:({signal:t})=>ke(O(e),{signal:t}),enabled:!!e&&t})}function ui(e,t,n){return b({queryKey:e===void 0?U.runs.handoff(t):[e,`runs`,`handoff`,t],queryFn:({signal:n})=>ke(O(t,{projectId:e}),{signal:n}),enabled:n,staleTime:15e3})}function di(e,t){let n=[...new Set(e)],i=T({queries:n.map(e=>({queryKey:[e??r(),`automations`,`names`],queryFn:({signal:t})=>vt({signal:t,archived:`include`,...e===void 0?{}:{projectId:e}}),enabled:t,staleTime:6e4,retry:!1}))}),a=i.map(e=>e.data);return(0,w.useMemo)(()=>{let e=new Map;return a.forEach((t,r)=>{if(t?.available)for(let i of t.automations)e.set(JSON.stringify([n[r]??null,i.id]),i.name)}),(t,n)=>e.get(JSON.stringify([t??null,n]))},[JSON.stringify([n,i.map(e=>e.dataUpdatedAt)])])}function fi(){return b({queryKey:U.workflows,queryFn:({signal:e})=>f({signal:e})})}function pi(e=!0){let t=h(),n=U.skills,r=n[0],i=b({queryKey:n,queryFn:({signal:e})=>me({signal:e}),enabled:e}),a=b({queryKey:U.skillsReady,queryFn:({signal:e})=>_e({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,w.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`],a.data)},[t,a.data,r]),i}function mi(e=!0){let t=h(),n=U.importableSkills,r=n[0],i=b({queryKey:n,queryFn:({signal:e})=>dt({signal:e}),enabled:e}),a=b({queryKey:U.importableSkillsReady,queryFn:({signal:e})=>Dt({signal:e}),enabled:e&&i.isSuccess,staleTime:1/0,retry:!1});return(0,w.useEffect)(()=>{Array.isArray(a.data)&&t.setQueryData([r,`skills`,`importable`],a.data)},[t,a.data,r]),i}function hi(){return b({queryKey:U.launchKey,queryFn:({signal:e})=>Ye({signal:e}),staleTime:1/0})}function gi(){return b({queryKey:U.repo,queryFn:({signal:e})=>rt({signal:e})})}function _i(e){return b({queryKey:[e,`repo`],queryFn:({signal:t})=>rt({signal:t},e)})}function vi(){return b({queryKey:U.repoBranches,queryFn:({signal:e})=>tt({signal:e})})}function yi(){return b({queryKey:U.repoChanges,queryFn:({signal:e})=>Be({signal:e}),retry:!1})}function bi(e){return b({queryKey:U.repoCommit(e??``),queryFn:({signal:t})=>kt(e,{signal:t}),enabled:!!e,retry:!1})}function xi(){return b({queryKey:U.config,queryFn:({signal:e})=>Ie({signal:e})})}function Si(){return b({queryKey:U.worktrees,queryFn:({signal:e})=>we({signal:e})})}function Ci(e){return b({queryKey:[e,`worktrees`],queryFn:({signal:t})=>we({signal:t},e),staleTime:0})}function wi(e,t=!0,n=!1){return b({queryKey:[D({projectId:e,boot:n}).cacheScope,`ui-state`],queryFn:({signal:t})=>be({signal:t},e),select:e=>e.sidebarLimits===void 0?e:{...e,sidebarLimits:Ht(e.sidebarLimits)},enabled:t})}function Ti(){return wi(r())}function Ei(){return b({queryKey:U.agentConfig,queryFn:({signal:e})=>Se({signal:e})})}function Di(e){return b({queryKey:U.agentConfigFile(e??``),queryFn:({signal:t})=>zt(e,{signal:t}),enabled:e!==null})}function Oi(e){let t=h(),n=U.agentConfig,r=U.agentConfigFile(e);return E({mutationFn:t=>Xe(e,t),onSuccess:e=>{t.setQueryData(r,e),t.invalidateQueries({queryKey:n})}})}function ki(){return b({queryKey:W.uiState,queryFn:({signal:e})=>de({signal:e})})}function Ai(){return b({queryKey:W.config,queryFn:({signal:e})=>oe({signal:e})})}function ji(){return b({queryKey:W.agentProfiles,queryFn:({signal:e})=>l({signal:e})})}function Mi(e){let t=h();return E({mutationFn:t=>Le(e,t),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function Ni(e){let t=P(),n=e?.projectId,r=e?.cacheScope,i=E({mutationFn:e=>At(e,!0),onMutate:e=>t.patchRead(e,!0),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)}),a=(0,w.useCallback)(e=>({...O(e,{projectId:n,cacheScope:r}),id:e}),[n,r]),o=(0,w.useCallback)(e=>({onSuccess:(t,n,r,i)=>e?.onSuccess?.(t,n.id,r,i),onError:(t,n,r,i)=>e?.onError?.(t,n.id,r,i),onSettled:(t,n,r,i,a)=>e?.onSettled?.(t,n,r.id,i,a)}),[]),{mutate:s,mutateAsync:c}=i,l=(0,w.useCallback)((e,t)=>s(a(e),o(t)),[s,a,o]),u=(0,w.useCallback)((e,t)=>c(a(e),o(t)),[c,a,o]);return{...i,variables:i.variables?.id,mutate:l,mutateAsync:u}}function Pi(){let e=P();return E({mutationFn:e=>At(O(e),!1),onMutate:t=>e.patchRead(()=>O(t),!1),onError:(e,t,n)=>n?.rollback(),onSuccess:(e,t,n)=>n?.settle(e)})}function Fi(e){let t=P();return E({mutationFn:({id:t,pinned:n})=>Fe(O(t,e),n),onError:e=>Kt(`Could not update pin. ${e.message} Please retry.`,{tone:`danger`}),onMutate:()=>e??D(),onSuccess:(e,n,r)=>t.invalidateAfter(`runs`,r)})}function Ii(e,t){let n=P();return E({mutationFn:n=>Nt(O(e,{projectId:t}),n),onMutate:()=>D({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`send`,r),onError:(e,t,r)=>{e instanceof it&&e.status===409&&r&&n.invalidateAfter(`send`,r)}})}function Li(e,t){let n=P();return E({mutationFn:(n={})=>Ot(O(e,{projectId:t}),n),onMutate:()=>D({projectId:t}),onSuccess:(e,t,r)=>n.invalidateAfter(`continue`,r)})}function Ri(e){let t=h();return E({mutationFn:({msgId:t,message:n})=>he(e,t,n),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function zi(e){let t=h();return E({mutationFn:t=>Qe(e,t),onSuccess:()=>t.invalidateQueries({queryKey:U.runs.all})})}function Bi(e={},t=!0){let n=h(),i=U.github(e);S(`/api/v1/p/${r()}/github${e.limit===void 0?``:`?limit=${e.limit}`}`,i,C(t?6e4:!1));let a=b({queryKey:U.github(e),queryFn:({signal:t})=>_({limit:e.limit},{signal:t}),enabled:t,staleTime:6e4,refetchInterval:!1,refetchIntervalInBackground:!1,refetchOnWindowFocus:!0}),o=a.data?.projectsGeneration,s=b({queryKey:[...i,`projects`,o],queryFn:({signal:e})=>He(o,{signal:e}),enabled:t&&a.data?.projectsState===`refreshing`&&!!o,staleTime:1/0,retry:!1});return(0,w.useEffect)(()=>{!o||!s.data&&!s.error||n.setQueryData(i,e=>{if(!e||e.projectsGeneration!==o||e.projectsState!==`refreshing`)return e;let t=s.data;return t?.generation&&t.generation!==o?e:t?.state===`ready`?{...e,projectsState:`ready`,projects:t.projects,issues:e.issues.map(e=>({...e,projectIds:t.membership?.[e.number]??[]}))}:{...e,projectsState:`unavailable`,projectsReason:t?.reason??`Project boards unavailable. Refresh to try again.`}})},[n,o,s.data,s.error,i]),a}var Vi=class extends Error{};function Hi(e,t,n){return{queryKey:e,initialPageParam:{},queryFn:async({pageParam:e,signal:r})=>{let i=await _({limit:t,...e,...n?{projectId:n}:{}},{signal:r});if(!i.available&&Object.keys(e).length>0)throw new Vi(i.reason??`GitHub is unavailable.`);return i},getNextPageParam:e=>ur(e),retry:(e,t)=>!(t instanceof Vi)&&!(t instanceof it&&t.status>=400&&t.status<500)&&e<1,staleTime:6e4,refetchOnWindowFocus:!0}}function Ui(e=50,t=!0){let n=h(),i=U.githubPages(e),a=U.githubPagesHead(e);S(`/api/v1/p/${r()}/github?limit=${e}`,a,C(t?6e4:!1));let o=y({...Hi(i,e),enabled:t,refetchInterval:!1,refetchIntervalInBackground:!1}),s=b({queryKey:a,queryFn:({signal:t})=>_({limit:e},{signal:t}),enabled:!1,staleTime:1/0}),{refetch:c}=o;(0,w.useEffect)(()=>{if(!s.data)return;let e=n.getQueryData(i);if(!e||e.pages.length===0)return;let t=mr(e.pages,s.data);t===`refetch`?c():n.setQueryData(i,{...e,pages:t})},[n,s.dataUpdatedAt,c]);let l=(o.data?.pages??[]).flatMap(e=>e.projectsState===`refreshing`&&e.projectsGeneration?[e.projectsGeneration]:[]),u=T({queries:l.map(e=>({queryKey:[...i,`projects`,e],queryFn:({signal:t})=>He(e,{signal:t}),enabled:t,staleTime:1/0,retry:!1}))});return(0,w.useEffect)(()=>{u.forEach((e,t)=>{let r=l[t];!r||!e.data&&!e.error||n.setQueryData(i,t=>{if(!t)return t;let n=!1,i=t.pages.map(t=>{if(t.projectsGeneration!==r||t.projectsState!==`refreshing`)return t;let i=e.data;return i?.generation&&i.generation!==r?t:(n=!0,i?.state===`ready`?{...t,projectsState:`ready`,projects:i.projects,issues:t.issues.map(e=>({...e,projectIds:i.membership?.[e.number]??[]}))}:{...t,projectsState:`unavailable`,projectsReason:i?.reason??`Project boards unavailable. Refresh to try again.`})});return n?{...t,pages:i}:t})})},[n,u.map((e,t)=>e.data||e.error?l[t]:``).join(`,`)]),{pages:o,data:(0,w.useMemo)(()=>pr(o.data?.pages??[]),[o.data])}}function Wi(e,t=50,n=!0){let r=y({...Hi([e,`github`,`pages`,t],t,e),enabled:n});return{pages:r,data:(0,w.useMemo)(()=>pr(r.data?.pages??[]),[r.data])}}function Gi(e,t,n=!0){let r=T({queries:t.filter(e=>e.length>0).map(t=>({queryKey:U.githubCommentCounts(e,t),queryFn:({signal:n})=>i(e,t,{},{signal:n}),enabled:n,staleTime:6e4}))});return(0,w.useMemo)(()=>{let e={};for(let t of r)t.data?.available&&Object.assign(e,t.data.counts);return e},[r.map(e=>e.dataUpdatedAt).join(`,`)])}function Ki(e,t,n,r=!0){return b({queryKey:[e,`github`,`search`,t,n],queryFn:({signal:r})=>Ct(t,n,{projectId:e},{signal:r}),enabled:r&&n.trim()!==``,staleTime:6e4})}function qi(e,t=!0){return b({queryKey:U.githubChecks(e),queryFn:({signal:t})=>xe(e,{signal:t}),enabled:t&&e.length>0,staleTime:6e4})}function Ji(e,t,n=!0){return b({queryKey:U.githubSearch(e,t),queryFn:({signal:n})=>Ct(e,t,{},{signal:n}),enabled:n&&t.trim()!==``,staleTime:6e4})}var Yi=100;function Xi(e){return[...e].sort((e,t)=>t-e).slice(0,Yi).sort((e,t)=>e-t)}var X=new Map(ta()),Zi=1e3;function Z(e,t){if(X.get(e)!==t){for(X.delete(e),X.set(e,t);X.size>Zi;){let e=X.keys().next().value;if(e===void 0)break;X.delete(e)}ia()}}var Q=new Set(na());function Qi(e,t){if(Q.has(e)!==t){if(t)for(Q.add(e);Q.size>Zi;){let e=Q.values().next().value;if(e===void 0)break;Q.delete(e)}else Q.delete(e);ia()}}var $i=`cez.reference-statuses.v1`,ea=`cez.reference-conflicts.v1`;function ta(){try{let e=globalThis.sessionStorage?.getItem($i);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>Array.isArray(e)&&e.length===2&&typeof e[0]==`string`&&an(e[1])):[]}catch{return[]}}function na(){try{let e=globalThis.sessionStorage?.getItem(ea);if(!e)return[];let t=JSON.parse(e);return Array.isArray(t)?t.filter(e=>typeof e==`string`):[]}catch{return[]}}var ra;function ia(){ra===void 0&&(ra=setTimeout(()=>{ra=void 0;try{globalThis.sessionStorage?.setItem($i,JSON.stringify([...X])),globalThis.sessionStorage?.setItem(ea,JSON.stringify([...Q]))}catch{}},250))}function aa(){let e=bt(),t=Y();return e.projectId??t.data?.bootProject}function oa(e){for(let[t,n]of Object.entries(e)){for(let[e,r]of Object.entries(n.prs))Z($({projectId:t,kind:`PR`,number:Number(e)}),r);for(let[e,r]of Object.entries(n.issues))Z($({projectId:t,kind:`Issue`,number:Number(e)}),r)}}var sa=5*6e4;function ca(e){return e?e.recheckAfterMs:sa}var $=e=>`${e.projectId}\u0000${e.kind}#${e.number}`;function la(e,t=!0){let n=(0,w.useMemo)(()=>{let t=new Map;for(let n of e){let e=t.get(n.projectId)??{prs:new Set,issues:new Set};e[n.kind===`PR`?`prs`:`issues`].add(n.number),t.set(n.projectId,e)}return[...t.entries()].map(([e,t])=>({projectId:e,prs:Xi(t.prs),issues:Xi(t.issues)}))},[e.map($).sort().join(`|`)]),r=T({queries:n.map(e=>({queryKey:U.githubRefStatus(e.projectId,e.prs,e.issues),queryFn:({signal:t})=>gt(e.projectId,{prs:e.prs,issues:e.issues},{signal:t}),enabled:t&&e.prs.length+e.issues.length>0,staleTime:e=>ca(e.state.data)??1/0,refetchInterval:!1,refetchOnWindowFocus:!0}))}),i=h(),a=JSON.stringify(n.map((e,t)=>({...e,interval:ca(r[t]?.data)??!1})));(0,w.useEffect)(()=>{if(!t||Wt())return;let e=!0,n=JSON.parse(a).filter(e=>e.interval!==!1).map(t=>{let n=new URLSearchParams;t.prs.length&&n.set(`prs`,t.prs.join(`,`)),t.issues.length&&n.set(`issues`,t.issues.join(`,`));let r=U.githubRefStatus(t.projectId,t.prs,t.issues);return Ut({path:`/api/v1/p/${t.projectId}/github/ref-status?${n}`,intervalMs:t.interval},(t,n)=>{n||i.cancelQueries({queryKey:r,exact:!0}).then(()=>{e&&i.setQueryData(r,t)})})});return()=>{e=!1;for(let e of n)e()}},[t,a,i]);let o=(0,w.useMemo)(()=>{let e=new Map;return r.forEach((t,r)=>{let i=n[r];if(!i)return;let a=[...i.prs.map(e=>({projectId:i.projectId,kind:`PR`,number:e})),...i.issues.map(e=>({projectId:i.projectId,kind:`Issue`,number:e}))],o=t.data;for(let n of a){let r=$(n),i=X.get(r),a=Q.has(r)?!0:void 0;if(o?.available){let t=o.prs[n.number]??o.issues[n.number];if(t){let i=o.conflicts?o.conflicts.includes(n.number):void 0;Z(r,t),i!==void 0&&Qi(r,i),e.set(r,{state:`ready`,status:t,...i??a?{conflicting:!0}:{}})}else e.set(r,{state:`unknown`,...i?{status:i}:{}})}else o?e.set(r,{state:`unavailable`,reason:o.reason,...i?{status:i}:{},...a?{conflicting:!0}:{}}):t.isError?e.set(r,{state:`unavailable`,reason:t.error instanceof Error?t.error.message:void 0,...i?{status:i}:{},...a?{conflicting:!0}:{}}):e.set(r,{state:`loading`,...i?{status:i}:{},...a?{conflicting:!0}:{}})}}),e},[n,r.map(e=>`${e.dataUpdatedAt}:${e.status}`).join(`,`)]);return(0,w.useCallback)(e=>{let t=$(e),n=o.get(t);if(n)return n;let r=X.get(t);return{state:`idle`,...r?{status:r}:{},...Q.has(t)?{conflicting:!0}:{}}},[o])}function ua(e,t,n=!0){return b({queryKey:U.githubComments(e,t),queryFn:({signal:n})=>Ze(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function da(e,t,n=!0){return b({queryKey:U.githubItem(e,t),queryFn:({signal:n})=>wt(e,t,{},{signal:n}),enabled:n,staleTime:6e4})}function fa(e){return b({queryKey:U.githubPrChanges(e??0),queryFn:({signal:t})=>xt(e,{},{signal:t}),enabled:e!==void 0,staleTime:6e4,retry:!1})}export{yr as $,er as $t,Vr as A,bn as An,Ii as At,kr as B,O as Bn,ki as Bt,ri as C,zn as Cn,Zr as Ct,Gi as D,An as Dn,Jr as Dt,qi as E,In as En,Gr as Et,Hr as F,fn as Fn,jr as Ft,Wi as G,cr as Gt,Wr as H,qt as Hn,W as Ht,mi as I,rn as In,Cr as It,Ur as J,Un as Jt,Ki as K,Kn as Kt,hi as L,on as Ln,Er as Lt,fa as M,sn as Mn,ui as Mt,Ji as N,cn as Nn,Or as Nt,ua as O,Dn as On,qr as Ot,Y as P,ln as Pn,Ti as Pt,Ci as Q,V as Qt,Ni as R,P as Rn,fi as Rt,Ri as S,En as Sn,li as St,Bi as T,Vn as Tn,K as Tt,Mi as U,dr as Ut,Rr as V,E as Vn,Si as Vt,Fi as W,sr as Wt,Yr as X,Xn as Xt,$r as Y,R as Yt,wi as Z,B as Zt,Li as _,Fn as _n,ti as _t,Fr as a,ir as an,_r as at,Tr as b,kn as bn,ei as bt,ji as c,z as cn,Sr as ct,ai as d,Rn as dn,gi as dt,Wn as en,gr as et,oi as f,Ln as fn,vi as ft,Ir as g,I as gn,Qr as gt,xi as h,Mn as hn,vr as ht,Pr as i,ar as in,la as it,Ui as j,dn as jn,pi as jt,da as k,Pn as kn,Nr as kt,Kr as l,or as ln,Dr as lt,zr as m,Nn as mn,bi as mt,U as n,Jn as nn,Lr as nt,Ei as o,Zn as on,xr as ot,di as p,Tn as pn,yi as pt,_i as q,Yn as qt,oa as r,$n as rn,aa as rt,Di as s,nr as sn,Mr as st,G as t,qn as tn,Oi as tt,ii as u,Gn as un,zi as ut,Ar as v,wn as vn,ci as vt,br as w,jn as wn,hr as wt,Xr as x,On as xn,ni as xt,Br as y,Bn as yn,si as yt,Pi as z,D as zn,Ai as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,E as i,M as a,d as o,t as s,u as c}from"./button-RJMdCnZw.js";import{C as l,Kt as u,T as d,an as f,i as p,k as m,on as h,qr as g,zr as _}from"./project-scope-context-a1Wrxrws.js";import{Et as v,H as ee,Hn as y,J as b,P as x,Rn as S,T as te,Vt as ne,Xt as C,dt as w,ft as T,mt as re,n as E,pt as ie}from"./queries-k8gAuGEO.js";import{n as D}from"./toaster-BWMQArHJ.js";import{i as O,l as ae,p as oe,r as se,t as ce}from"./dropdown-menu-B2Hg08ap.js";import{a as k,c as A,i as j,n as M,o as N,r as P,s as F,t as I}from"./alert-dialog-D5mmm9BZ.js";import{D as le,I as ue,M as de,N as fe,Q as pe,S as me,X as he,Z as ge,c as _e,ct as L,d as ve,j as R,n as ye,st as be,w as z,y as xe}from"./design-icons-DmYTv2r1.js";import{a as B,t as Se}from"./loader-circle-CZkGEdoI.js";import{t as V}from"./createLucideIcon-BHp8sXmF.js";import{l as Ce,n as we,y as Te}from"./nav-row-styles-D4xk5Osn.js";import{n as Ee,r as De}from"./diff-controls-7vfelV7P.js";import{i as Oe,r as ke,t as Ae}from"./git-toolbar-BhVKNNog.js";import{t as H}from"./info-DA1x_4bz.js";import{a as je,l as Me,n as Ne,t as Pe}from"./control-locations-CM5KUQ3d.js";import{t as U}from"./project-router-n0p0qOgE.js";import{t as W}from"./centered-state-dmABwupF.js";import{$t as G,Gt as Fe,Tt as K,a as Ie,at as Le,c as Re,d as ze,f as Be,h as q,i as Ve,l as He,m as Ue,nn as J,o as We,p as Ge,r as Ke,s as qe,u as Je,wt as Ye}from"./index-BS8upD5I.js";import{t as Xe}from"./markdown-BBDDg-4t.js";import{t as Ze}from"./diff-Ca1O4a0T.js";import{t as Qe}from"./commit-diff-panel-0_Qu3h0B.js";var Y=e(t(),1);function $e(e,t){let n=_(t),r=n.getQueryCache();return Y.useSyncExternalStore(Y.useCallback(e=>r.subscribe(g.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var et=V(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),tt=V(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),X=n();function nt(){let e=a(),t=w(),n=_(),r=$e({queryKey:E.repo})>0,i=t.data?.info?t.data:null,o=Ke(e,i,`screen`);return(0,X.jsxs)(`div`,{"data-route":`repo-git`,"data-slot":`git-screen`,className:we,children:[(0,X.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,X.jsx)(`h1`,{className:c(Ce,`min-w-0 flex-1`),children:`Git`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:r,onClick:()=>{n.invalidateQueries({queryKey:E.repo}),n.invalidateQueries({queryKey:E.worktrees})},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,X.jsx)(ge,{size:17,"aria-hidden":`true`,className:c(`size-[17px]`,r&&`motion-safe:animate-spin`)})})]}),i?.info?(0,X.jsx)(`div`,{className:`mb-[16px]`,children:(0,X.jsx)(We,{scope:e,repo:i,info:i.info,variant:`screen`},e)}):t.isPending?(0,X.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,X.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,X.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,X.jsx)(Ve,{branch:i?.info?.branch??null,counts:o,variant:`screen`})]})}function Z({entry:e}){return e.keptReason?(0,X.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-[11px] text-soft-foreground`,children:e.keptReason}):null}function rt({repo:e,info:t}){let n=x(),r=T(),i=new Map((r.data?.branches??[]).map(e=>[e.name,e])),a=_(),o=y({mutationFn:e=>l({name:e}),onSuccess:async e=>{D(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([a.invalidateQueries({queryKey:E.repo}),a.invalidateQueries({queryKey:E.health})]),a.setQueryData(E.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),a.setQueryData(E.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:e=>D(e.message,{tone:`danger`})}),[u,d]=(0,Y.useState)(``),[f,p]=(0,Y.useState)(``),m=f.trim().toLowerCase(),h=Q(e,r.data?.branches),g=m?h.filter(e=>e.toLowerCase().includes(m)):h;return(0,X.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-[18px] py-[22px] md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(pe,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,X.jsx)(J,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:f,onChange:e=>p(e.target.value),className:`h-11 pl-10`})]}),(0,X.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-4 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[g.map(e=>{let n=e===t.branch,r=i.get(e);return(0,X.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":r?.class,className:`flex min-h-20 flex-col items-start justify-center gap-2 py-3 md:flex-row md:items-center md:justify-start md:py-2.5`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,X.jsx)(U,{to:`/tasks/${r.runId}`,"data-slot":`branch-task-link`,title:r.title?`Open the task ${r.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] text-[13px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,X.jsx)(`span`,{className:c(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),r?(0,X.jsx)(ct,{entry:r}):null]}),r?(0,X.jsx)(Z,{entry:r}):null,e.startsWith(`cez/`)&&!n?null:n?(0,X.jsx)(`span`,{"data-slot":`branch-current`,className:`md:ml-auto flex shrink-0 items-center rounded-md bg-accent-strong/10 px-2 py-1.5 text-[12px] font-medium text-accent-text`,children:`Current`}):(0,X.jsxs)(s,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto h-11`,disabled:o.isPending,onClick:()=>o.mutate(e),children:[(0,X.jsx)(R,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),g.length===0?(0,X.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,f.trim(),`”.`]}):null]})]}),(0,X.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,X.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-7 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=u.trim();t&&o.mutate(t,{onSuccess:()=>d(``)})},children:[(0,X.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,X.jsx)(`p`,{className:`-mt-1 text-xs text-muted-foreground`,children:`Create from the selected base.`}),(0,X.jsx)(J,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:u,onChange:e=>d(e.target.value)}),(0,X.jsxs)(s,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!u.trim()||o.isPending,children:[(0,X.jsx)(he,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,X.jsx)(`p`,{className:`mt-3 border-t border-border pt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),n.data?.forge?.available?(0,X.jsx)(it,{}):null]})}function it(){let e=te({limit:20});return(0,X.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,X.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,X.jsx)(at,{pr:e},e.number))}):(0,X.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function at({pr:e}){let t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ue,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,X.jsx)(ot,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,X.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:o(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:c(n,`hover:bg-muted`),children:t}):(0,X.jsx)(`span`,{className:n,children:t})})}function ot({checks:e}){return(0,X.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:c(`shrink-0 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}var st={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function ct({entry:e}){return(0,X.jsx)(`span`,{"data-slot":`branch-class`,className:c(`shrink-0 rounded-[4px] border px-[5px] py-[1px] text-[10.5px] leading-[14px]`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:st[e.class]})}function Q(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function lt(){let e=ie(),t=q(),[n,r]=(0,Y.useState)(`unified`),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(null),d=e.isError&&e.error instanceof p&&e.error.status===409,f=e.data?.files??[],m=(0,Y.useMemo)(()=>ke(f),[f]),h=(0,Y.useMemo)(()=>f.some(Xe),[f]),g=t?n:`unified`,_=!t||i;return(0,X.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:e.data?`${e.data.stat.files} files changed ·`:`Uncommitted changes`}),e.data?(0,X.jsx)(Ae,{stat:e.data.stat}):null,(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,X.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,X.jsx)(Ee,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})}),h?(0,X.jsx)(De,{preview:o,onPreviewChange:s}):null]})]}),e.isPending?(0,X.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,X.jsx)(W,{icon:d?(0,X.jsx)(z,{size:16}):(0,X.jsx)(L,{size:16}),tone:d?`neutral`:`danger`,heading:`h2`,title:d?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):f.length===0?(0,X.jsx)(W,{icon:(0,X.jsx)(z,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:1rem] md:px-9`,children:[(0,X.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[250px]`,children:[(0,X.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,X.jsx)(Oe,{root:m,selected:c,onSelect:e=>{l(e),u.current?.scrollToPath(e)}})]}),(0,X.jsx)(Ze,{files:f,viewRef:u,mode:g,wrap:_,preview:o,className:`min-w-0 flex-1`})]})]})}function ut({repo:e,info:t}){let{sha:n}=i(),r=e.log,a=(0,Y.useMemo)(()=>Ge(r),[r]);if(n)return(0,X.jsx)(pt,{sha:n});let o=ze(e,t),s=o&&o.behind>0?(0,X.jsx)(ft,{info:t,tracking:o}):null;return r.length===0?(0,X.jsxs)(X.Fragment,{children:[s?(0,X.jsx)(`div`,{className:`px-[8px] pt-[12px] md:px-[20px]`,children:s}):null,(0,X.jsx)(W,{icon:(0,X.jsx)(de,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,X.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-[2px] px-[8px] pt-[12px] pb-[20px] md:px-[20px]`,children:[s,a.map(e=>(0,X.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col`,children:[(0,X.jsx)(`h2`,{className:`px-[10px] pt-[14px] pb-[4px] text-[11px] font-medium text-soft-foreground`,children:e.label}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:e.commits.map(e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] items-center gap-[14px] rounded-[6px] hover:bg-sidebar-row-hover`,children:[(0,X.jsxs)(U,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-[3px] rounded-[6px] px-[10px] py-[6px] focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] text-foreground`,children:e.subject}),(0,X.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.hash}),(0,X.jsxs)(`span`,{className:`truncate`,children:[`· `,e.author,` · `,Ue(e.when)]})]})]}),(0,X.jsx)(dt,{source:e.source})]},e.hash))})]},e.label))]})}function dt({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-[10px] text-[11.5px] text-soft-foreground md:flex`;return e?(0,X.jsxs)(U,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:c(t,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fe,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,X.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,X.jsx)(_e,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,X.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function ft({info:e,tracking:t}){let n=Re(a(),e),r=(0,Y.useRef)(null);return(0,X.jsxs)(`div`,{"data-slot":`git-incoming`,className:`mb-[4px] flex min-h-[40px] items-center gap-[8px] rounded-[8px] border border-border px-[10px] py-[6px]`,children:[(0,X.jsx)(et,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,X.jsxs)(`button`,{ref:r,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[26px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,X.jsx)(Se,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(ye,{"aria-hidden":`true`}),`Pull`]}),(0,X.jsx)(qe,{checkout:n,returnFocus:r})]})}function pt({sha:e}){return(0,X.jsx)(Qe,{commit:re(e),sha:e,backTo:q()?`/git`:He,backLabel:`All recent commits`,slot:`repo-commit`,className:`flex min-h-0 flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:1rem] md:px-6`})}var $=`Squash-merged branches may show as not landed without GitHub`;function mt(e){let t=[],n=[],r=[];for(let i of e)if(i.class===`orphan`)r.push(i);else if(i.class!==`not-landed`)continue;else i.pr&&(i.pr.state===`open`||i.pr.state===`draft`)?n.push(i):t.push(i);return[{key:`no-pr`,title:`No pull request`,note:`nobody sees this work until you act`,rows:t},{key:`pr-open`,title:`Pull request open`,rows:n},{key:`deleted`,title:`Task deleted`,note:`this branch is the only copy of the work`,rows:r}].filter(e=>e.rows.length>0)}function ht(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}var gt={done:`success`,failed:`danger`,cancelled:`neutral`};function _t(){let e=T(),t=v(),n=a(),r=b(),[i,o]=(0,Y.useState)(null);if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`px-[28px] py-[20px] text-[13px] text-soft-foreground`,children:`Loading branches…`});if(e.isError)return(0,X.jsx)(W,{icon:(0,X.jsx)(L,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=mt(e.data.branches),c=ht(e.data.branches),l=c>0?(0,X.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-[6px] px-[10px] pt-[6px] text-[11.5px] leading-[17px] text-soft-foreground`,children:[(0,X.jsx)(H,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),(0,X.jsxs)(`span`,{children:[c,` finished task`,c===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,c===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,X.jsx)(U,{to:Je.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,u=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,X.jsxs)(je,{projectId:n,repoBase:r,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,X.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-[2px] px-[8px] pt-[12px] pb-[calc(90px+env(safe-area-inset-bottom))] md:px-[20px] md:pb-[20px]`,children:[e.data.prStateKnown?null:(0,X.jsx)(vt,{}),l,s.length===0?(0,X.jsx)(W,{icon:(0,X.jsx)(Fe,{size:16}),tone:`neutral`,heading:`h2`,title:c>0?`Nothing else waiting to land`:`Everything landed`,subtitle:c>0?`Every other finished task's commits are on the base branch, or it made none.`:`Every finished task's commits are on the base branch, or it made none.`}):(0,X.jsxs)(X.Fragment,{children:[s.map(e=>(0,X.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col`,children:[(0,X.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-[6px] px-[10px] pt-[14px] pb-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,X.jsx)(`span`,{children:e.rows.length}),e.note?(0,X.jsxs)(`span`,{children:[`· `,e.note]}):null]}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:e.rows.map(e=>(0,X.jsx)(yt,{entry:e,finishedAt:e.runId?u.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key)),(0,X.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-[6px] px-[10px] pt-[14px] text-[11.5px] leading-[17px] text-soft-foreground`,children:[(0,X.jsx)(H,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),`Delete branch is in each row's … menu. It confirms and names the commits it drops. Nothing on this list can be bulk-deleted.`]})]})]}),(0,X.jsx)(wt,{entry:i,onClose:()=>o(null)})]})}function vt({className:e}){return(0,X.jsxs)(`p`,{"data-slot":`git-no-forge`,className:c(`flex items-start gap-[6px] px-[10px] pt-[6px] text-[11.5px] leading-[17px] text-soft-foreground`,e),children:[(0,X.jsx)(H,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),$,`.`]})}function yt({entry:e,finishedAt:t,onDelete:n}){return(0,X.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[56px] items-center gap-[12px] rounded-[6px] px-[10px] py-[6px] hover:bg-sidebar-row-hover`,children:[(0,X.jsx)(St,{entry:e,finishedAt:t}),(0,X.jsx)(bt,{entry:e}),(0,X.jsx)(xt,{entry:e,onDelete:n})]})}function bt({entry:e}){return(0,X.jsx)(X.Fragment,{children:e.pr?(0,X.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-[4px] text-[11.5px] text-muted-foreground md:flex`,children:[(0,X.jsx)(Ne,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,X.jsx)(Ct,{entry:e})]}):null})}function xt({entry:e,onDelete:t}){let n=_(),r=e.class===`orphan`,i=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,a=!r&&e.runId!==null&&!i,o=y({mutationFn:()=>d(e.runId),onSuccess:e=>{D(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:E.repoBranches}),n.invalidateQueries({queryKey:E.runs.all})},onError:e=>D(e instanceof p&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),s=()=>void navigator.clipboard.writeText(e.name).then(()=>D(`Copied ${e.name}`),()=>D(`Could not copy the branch name`,{tone:`danger`})),l=`inline-flex h-[28px] shrink-0 items-center gap-[5px] rounded-[6px] px-[10px] text-[12px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,X.jsxs)(X.Fragment,{children:[e.runId?(0,X.jsx)(U,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:c(l,`hidden border border-border hover:bg-muted md:inline-flex`),children:`Open task`}):null,a?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:o.isPending,onClick:()=>o.mutate(),className:c(l,`hidden bg-muted hover:brightness-110 md:inline-flex`),children:[(0,X.jsx)(tt,{"aria-hidden":`true`}),o.isPending?`Creating…`:`Create draft PR`]}):null,r?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,onClick:s,className:c(l,`hidden border border-border hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(xe,{"aria-hidden":`true`}),`Copy branch`]}):null,(0,X.jsxs)(ce,{children:[(0,X.jsx)(oe,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,X.jsx)(me,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,X.jsxs)(se,{align:`end`,className:`w-52`,children:[e.runId?(0,X.jsx)(O,{asChild:!0,className:`md:hidden`,children:(0,X.jsx)(U,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,a?(0,X.jsx)(O,{className:`md:hidden`,disabled:o.isPending,onSelect:()=>o.mutate(),children:`Create draft PR`}):null,(0,X.jsx)(O,{className:c(!r&&`md:hidden`),onSelect:s,children:`Copy branch`}),(0,X.jsx)(ae,{className:`md:hidden`}),(0,X.jsx)(O,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function St({entry:e,finishedAt:t}){let n=e.class===`orphan`,r=n?`No task · last commit “${e.lastCommit.subject}”`:e.title??e.name,i=B(t??e.lastCommit.at),a=n||!e.runStatus?i?`${i} ago`:``:`${e.runStatus}${i?` ${i} ago`:``}`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,X.jsx)(Te,{"aria-label":`Task deleted`,className:`size-[12px] text-soft-foreground`}):(0,X.jsx)(Le,{tone:e.runStatus&>[e.runStatus]||`neutral`,"aria-label":e.runStatus??void 0})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[3px]`,children:[e.runId?(0,X.jsx)(U,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:r}):(0,X.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] text-muted-foreground`,title:r,children:r}),(0,X.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,X.jsxs)(`span`,{className:`flex shrink-0 gap-[4px] tabular-nums`,children:[(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,e.diffStat.additions]}),(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.diffStat.deletions]})]}):null,a?(0,X.jsxs)(`span`,{className:`truncate`,children:[`· `,a]}):null]}),(0,X.jsx)(Z,{entry:e})]})]})}function Ct({entry:e}){let t=S(Me(`PR`,e.pr?.number).status),n=e.pr?.state;return(0,X.jsxs)(`span`,{"data-slot":`not-landed-pr-state`,children:[`· `,n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`]})}function wt({entry:e,onClose:t}){let n=_(),[r,i]=(0,Y.useState)(``),a=(0,Y.useId)(),o=y({mutationFn:e=>m({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;D(e.deleted.length>0?`Deleted ${e.deleted[0]}${t?` and ${t} commit${t===1?``:`s`} with it`:``}`:e.refused[0]?.reason??`Nothing was deleted`),n.invalidateQueries({queryKey:E.repo}),s()},onError:e=>D(e.message,{tone:`danger`})}),s=()=>{i(``),t()},c=e!==null&&r.trim()===e.name,l=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,X.jsx)(I,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,X.jsxs)(j,{"data-slot":`delete-branch-dialog`,children:[(0,X.jsxs)(F,{children:[(0,X.jsxs)(A,{children:[`Delete `,e?.name,`?`]}),(0,X.jsx)(k,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,X.jsxs)(X.Fragment,{children:[`This drops the work of `,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,X.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[l,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,` `,`(`,(0,X.jsx)(`span`,{className:`font-mono`,children:e?.lastCommit.sha.slice(0,7)}),`).`]})]})})]}),(0,X.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,X.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,X.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,X.jsx)(J,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,X.jsxs)(N,{children:[(0,X.jsx)(P,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,X.jsx)(M,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function Tt({base:e}){let t=T(),n=_(),[r,i]=(0,Y.useState)({merged:!1,empty:!1}),[a,o]=(0,Y.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],u=y({mutationFn:e=>m({names:e}),onSuccess:e=>{let t=e.refused.length;D(`Deleted ${e.deleted.length} branch${e.deleted.length===1?``:`es`}${t?`; kept ${t} that ${t===1?`is`:`are`} no longer safe to delete`:``}`),n.invalidateQueries({queryKey:E.repo})},onError:e=>{n.invalidateQueries({queryKey:E.repo}),D(e.message,{tone:`danger`})}});if(t.isPending)return(0,X.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,X.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let d=l.length,f=`branch${d===1?``:`es`}`;return(0,X.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,d]}),(0,X.jsxs)(`p`,{className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:d===0||u.isPending,onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(be,{"aria-hidden":`true`,className:`size-[12px]`}),u.isPending?`Deleting…`:`Delete ${d} ${f}`]})]}),(0,X.jsx)(Et,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:$.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,X.jsx)(Et,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,X.jsx)(I,{open:a,onOpenChange:o,children:(0,X.jsxs)(j,{children:[(0,X.jsxs)(F,{children:[(0,X.jsxs)(A,{children:[`Delete `,d,` `,f,`?`]}),(0,X.jsxs)(k,{children:[s.length,` merged into `,e,` and `,c.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,X.jsxs)(N,{children:[(0,X.jsx)(P,{children:`Keep them`}),(0,X.jsxs)(M,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{u.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,d,` `,f]})]})]})})]})}function Et({kind:e,title:t,hint:n,rows:r,open:i,onToggle:a}){let o=`cleanup-branches-${e}`;return(0,X.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":o,disabled:r.length===0,onClick:a,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,X.jsx)(`span`,{className:`truncate text-[11px] text-soft-foreground`,children:n})]}),r.length>0?(0,X.jsx)(ve,{"aria-hidden":`true`,className:c(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,X.jsx)(`ul`,{id:o,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,X.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-[11.5px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),e.runId?(0,X.jsx)(U,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,X.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums text-soft-foreground`,children:B(e.lastCommit.at)})]},e.name))}):null]})}function Dt(){let e=ne(),t=ee().data?.targets.find(e=>e.id===`finder`),n=y({mutationFn:e=>u(e,t.id),onError:e=>D(e.message,{tone:`danger`})}),r=_(),[i,a]=(0,Y.useState)(!1),o=()=>Promise.all([r.invalidateQueries({queryKey:E.worktrees}),r.invalidateQueries({queryKey:E.repoBranches})]),s=y({mutationFn:e=>h(),onSuccess:(e,t)=>{o();let n=e.reclaimed.length,r=Math.max(0,t-n);D(n===0?r>0?`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Nothing to reclaim — no finished worktrees exceed the keep limit`:`Reclaimed ${n} worktree${n===1?``:`s`} (branch kept)${r>0?` · ${r} kept: uncommitted work or in use`:``}`)},onError:e=>D(e.message,{tone:`danger`})}),c=y({mutationFn:e=>f(e.runId),onSuccess:(e,t)=>{o(),D(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{o(),D(e.message,{tone:`danger`})}});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:l,totalBytes:d,keep:p}=e.data,m=s.isPending||c.isPending,g=l.filter(e=>e.pastKeep),v=g.length>0,b=g.some(e=>e.sizeBytes===null)?null:g.reduce((e,t)=>e+(t.sizeBytes??0),0),x=v?b?`Reclaim ${C(b)} now`:`Reclaim ${g.length} now`:`Reclaim now`,S=d?C(d):null;return(0,X.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,S?` · ${S}`:``]}),(0,X.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[p===0?`Retention is unlimited (`:`Retention keeps the newest ${p} finished checkout${p===1?``:`s`} (`,(0,X.jsx)(U,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:Pe(`worktrees`,` › `)}),p===0?`), so nothing is reclaimed on its own.`:`) and reclaims the rest.`,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:m||!v,title:v?void 0:`Nothing past the keep limit to reclaim`,onClick:()=>a(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(G,{"aria-hidden":`true`,className:`size-[12px]`}),x]})]}),l.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:l.map(e=>(0,X.jsx)(At,{worktree:e,keep:p,disabled:m,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>c.mutate(e)},e.runId))}),(0,X.jsx)(I,{open:i,onOpenChange:a,children:(0,X.jsxs)(j,{children:[(0,X.jsxs)(F,{children:[(0,X.jsx)(A,{children:`Reclaim old worktrees?`}),(0,X.jsxs)(k,{children:[g.length,` finished worktree`,g.length===1?``:`s`,` beyond the keep limit`,b?` (${C(b)})`:``,` `,g.length===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,X.jsxs)(N,{children:[(0,X.jsx)(P,{children:`Keep them`}),(0,X.jsx)(M,{"data-action":`worktrees-confirm`,onClick:()=>{s.mutate(g.length),a(!1)},children:x})]})]})})]})}var Ot=new Set([`queued`,`running`,`waiting`,`review`]);function kt(e,t){return Ot.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`}:e.pastKeep?{label:`reclaimable`,tone:`plain`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`}}function At({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:a}){let o=kt(e,t),s=B(e.finishedAt??void 0),l=e.status===`review`?`at review`:s?`${e.status} ${s} ago`:e.status,u=(0,X.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":o.tone===`in-use`?`in-use`:e.pastKeep?`reclaimable`:`kept`,className:c(`text-[11.5px]`,o.tone===`in-use`?`text-status-running`:`text-soft-foreground`),children:o.label}),d=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`;return(0,X.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,X.jsxs)(`span`,{className:`truncate font-mono text-[10.5px] text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,X.jsxs)(`span`,{className:`md:hidden`,children:[` · `,o.label]})]})]}),(0,X.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-[11.5px] tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:C(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:u}),r?(0,X.jsx)(`button`,{type:`button`,className:d,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,X.jsx)(le,{"aria-hidden":`true`,className:`size-[13px]`})}):null,o.tone===`in-use`?null:(0,X.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":`Reclaim the worktree of ${e.title} (branch kept)`,title:`Reclaim the directory (branch kept)`,disabled:n,onClick:a,className:d,children:(0,X.jsx)(G,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function jt({section:e,index:t=!1}){let n=w(),i=q(),[a]=r();if(t&&!i&&a.get(`view`)!==`repo`)return(0,X.jsx)(nt,{});if(n.isPending)return(0,X.jsx)(Ye,{});if(n.isError)return(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(K,{}),(0,X.jsx)(W,{icon:(0,X.jsx)(L,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})]});let o=n.data.info;return o?(0,X.jsx)(Mt,{repo:n.data,info:o,section:e}):(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(K,{}),(0,X.jsx)(W,{icon:(0,X.jsx)(R,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`cezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})]})}function Mt({repo:e,info:t,section:n}){return(0,X.jsxs)(`div`,{"data-route":`repo-git`,"data-git-section":n,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(K,{}),(0,X.jsxs)(`header`,{"data-slot":`repo-header`,className:`flex flex-col gap-1 px-[18px] pt-[18px] md:min-h-[61px] md:flex-row md:items-center md:gap-[10px] md:border-b md:border-border md:px-7 md:py-4`,children:[(0,X.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:Ie(n,t.branch)}),(0,X.jsx)(`p`,{"data-slot":`repo-meta`,className:`min-w-0 truncate text-[12px] text-soft-foreground md:text-[11.5px]`,children:(0,X.jsx)(Nt,{repo:e,info:t,section:n})})]}),n===`main`?(0,X.jsx)(ut,{repo:e,info:t}):n===`not-landed`?(0,X.jsx)(_t,{}):n===`cleanup`?(0,X.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-[16px] px-[18px] pt-[12px] pb-[calc(90px+env(safe-area-inset-bottom))] md:px-[20px] md:pb-[20px]`,children:[(0,X.jsx)(Dt,{}),(0,X.jsx)(Tt,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,X.jsx)(rt,{repo:e,info:t}):(0,X.jsx)(lt,{})]})}function Nt({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,X.jsxs)(X.Fragment,{children:[e.log.length===0?`no commits yet`:`latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${Be(e.tracking)}`:``]});case`not-landed`:return(0,X.jsxs)(X.Fragment,{children:[`finished tasks whose commits are not on `,r]});case`branches`:return(0,X.jsx)(Pt,{repo:e,info:t});case`changes`:return(0,X.jsxs)(X.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,X.jsxs)(X.Fragment,{children:[`nothing here can delete work that is not on `,r]})}}function Pt({repo:e,info:t}){let n=Q(e,T().data?.branches).length;return(0,X.jsxs)(X.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{jt as RepoGitRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{D as r,E as i,M as a,d as o,t as s,u as c}from"./button-RJMdCnZw.js";import{C as l,Kt as u,T as d,Vr as f,Yr as p,an as m,i as h,k as g,on as _}from"./project-scope-context-DFjJ4Dzo.js";import{Et as v,H as ee,J as y,Ln as b,P as x,T as te,Vn as S,Vt as ne,Yt as C,dt as w,ft as T,mt as re,n as E,pt as ie}from"./queries-Cgys1fiN.js";import{n as D}from"./toaster-BWMQArHJ.js";import{i as O,l as ae,p as oe,r as se,t as ce}from"./dropdown-menu-B2Hg08ap.js";import{a as k,c as A,i as j,n as M,o as N,r as P,s as F,t as I}from"./alert-dialog-D5mmm9BZ.js";import{D as le,I as ue,M as de,N as fe,Q as pe,S as me,X as he,Z as ge,c as _e,ct as L,d as ve,j as R,n as ye,st as be,w as z,y as xe}from"./design-icons-DmYTv2r1.js";import{a as B,t as Se}from"./loader-circle-CZkGEdoI.js";import{t as V}from"./createLucideIcon-BHp8sXmF.js";import{l as Ce,n as we,y as Te}from"./nav-row-styles-D4xk5Osn.js";import{n as Ee,r as De}from"./diff-controls-7vfelV7P.js";import{i as Oe,r as ke,t as Ae}from"./git-toolbar-BIctOY7_.js";import{t as H}from"./info-DA1x_4bz.js";import{a as je,l as Me,n as Ne,t as Pe}from"./control-locations-SzZ8gyme.js";import{t as U}from"./project-router-DQWY9FSQ.js";import{t as W}from"./centered-state-dmABwupF.js";import{$t as G,Gt as Fe,Tt as K,a as Ie,at as Le,c as Re,d as ze,f as Be,h as q,i as Ve,l as He,m as Ue,nn as J,o as We,p as Ge,r as Ke,s as qe,u as Je,wt as Ye}from"./index-B98HIjrF.js";import{t as Xe}from"./markdown-BBDDg-4t.js";import{t as Ze}from"./diff-CQdcUei8.js";import{t as Qe}from"./commit-diff-panel-UwU29VK_.js";var Y=e(t(),1);function $e(e,t){let n=f(t),r=n.getQueryCache();return Y.useSyncExternalStore(Y.useCallback(e=>r.subscribe(p.batchCalls(e)),[r]),()=>n.isFetching(e),()=>n.isFetching(e))}var et=V(`arrow-down-to-line`,[[`path`,{d:`M12 17V3`,key:`1cwfxf`}],[`path`,{d:`m6 11 6 6 6-6`,key:`12ii2o`}],[`path`,{d:`M19 21H5`,key:`150jfl`}]]),tt=V(`git-pull-request-create`,[[`circle`,{cx:`6`,cy:`6`,r:`3`,key:`1lh9wr`}],[`path`,{d:`M6 9v12`,key:`1sc30k`}],[`path`,{d:`M13 6h3a2 2 0 0 1 2 2v3`,key:`1jb6z3`}],[`path`,{d:`M18 15v6`,key:`9wciyi`}],[`path`,{d:`M21 18h-6`,key:`139f0c`}]]),X=n();function nt(){let e=a(),t=w(),n=f(),r=$e({queryKey:E.repo})>0,i=t.data?.info?t.data:null,o=Ke(e,i,`screen`);return(0,X.jsxs)(`div`,{"data-route":`repo-git`,"data-slot":`git-screen`,className:we,children:[(0,X.jsxs)(`div`,{className:`mb-[16px] flex items-center gap-[8px]`,children:[(0,X.jsx)(`h1`,{className:c(Ce,`min-w-0 flex-1`),children:`Git`}),(0,X.jsx)(`button`,{type:`button`,"data-slot":`git-screen-refresh`,"aria-label":`Refresh the repository`,title:`Refresh the repository`,disabled:r,onClick:()=>{n.invalidateQueries({queryKey:E.repo}),n.invalidateQueries({queryKey:E.worktrees})},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,X.jsx)(ge,{size:17,"aria-hidden":`true`,className:c(`size-[17px]`,r&&`motion-safe:animate-spin`)})})]}),i?.info?(0,X.jsx)(`div`,{className:`mb-[16px]`,children:(0,X.jsx)(We,{scope:e,repo:i,info:i.info,variant:`screen`},e)}):t.isPending?(0,X.jsx)(`p`,{"data-slot":`git-screen-loading`,role:`status`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Loading the checkout…`}):t.isError?(0,X.jsxs)(`p`,{"data-slot":`git-screen-error`,role:`alert`,className:`mb-[16px] px-[10px] text-[13px] text-danger`,children:[`Could not load the repository: `,t.error.message]}):(0,X.jsx)(`p`,{"data-slot":`git-screen-not-git`,className:`mb-[16px] px-[10px] text-[13px] text-soft-foreground`,children:`Not a git repository.`}),t.isPending?null:(0,X.jsx)(Ve,{branch:i?.info?.branch??null,counts:o,variant:`screen`})]})}function Z({entry:e}){return e.keptReason?(0,X.jsx)(`span`,{"data-slot":`branch-kept-reason`,className:`min-w-0 text-[11px] text-soft-foreground`,children:e.keptReason}):null}function rt({repo:e,info:t}){let n=x(),r=T(),i=new Map((r.data?.branches??[]).map(e=>[e.name,e])),a=f(),o=S({mutationFn:e=>l({name:e}),onSuccess:async e=>{D(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([a.invalidateQueries({queryKey:E.repo}),a.invalidateQueries({queryKey:E.health})]),a.setQueryData(E.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),a.setQueryData(E.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:e=>D(e.message,{tone:`danger`})}),[u,d]=(0,Y.useState)(``),[p,m]=(0,Y.useState)(``),h=p.trim().toLowerCase(),g=Q(e,r.data?.branches),_=h?g.filter(e=>e.toLowerCase().includes(h)):g;return(0,X.jsxs)(`section`,{"data-slot":`repo-branches`,className:`grid min-w-0 grid-cols-1 gap-5 px-[18px] py-[22px] md:grid-cols-[minmax(0,1fr)_290px] md:px-9`,children:[(0,X.jsxs)(`div`,{className:`min-w-0 rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`sr-only`,children:`Branches`}),(0,X.jsxs)(`label`,{className:`relative block`,children:[(0,X.jsx)(pe,{size:16,"aria-hidden":`true`,className:`pointer-events-none absolute left-3 top-3.5 size-4 text-muted-foreground`}),(0,X.jsx)(J,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:p,onChange:e=>m(e.target.value),className:`h-11 pl-10`})]}),(0,X.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-4 flex min-w-0 flex-col divide-y divide-border border-t border-border md:max-h-[40rem] md:overflow-y-auto md:overscroll-contain`,children:[_.map(e=>{let n=e===t.branch,r=i.get(e);return(0,X.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":e,"data-branch-class":r?.class,className:`flex min-h-20 flex-col items-start justify-center gap-2 py-3 md:flex-row md:items-center md:justify-start md:py-2.5`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 items-center gap-[8px]`,children:[r?.runId?(0,X.jsx)(U,{to:`/tasks/${r.runId}`,"data-slot":`branch-task-link`,title:r.title?`Open the task ${r.title}`:`Open the task`,className:`min-w-0 truncate rounded-[2px] text-[13px] underline-offset-2 hover:underline focus-visible:outline-2 focus-visible:outline-ring`,children:e}):(0,X.jsx)(`span`,{className:c(`min-w-0 truncate text-[13px]`,n&&`font-normal`),children:e}),r?(0,X.jsx)(ct,{entry:r}):null]}),r?(0,X.jsx)(Z,{entry:r}):null,e.startsWith(`cez/`)&&!n?null:n?(0,X.jsx)(`span`,{"data-slot":`branch-current`,className:`md:ml-auto flex shrink-0 items-center rounded-md bg-accent-strong/10 px-2 py-1.5 text-[12px] font-medium text-accent-text`,children:`Current`}):(0,X.jsxs)(s,{variant:`outline`,size:`sm`,"data-action":`switch-branch`,className:`md:ml-auto h-11`,disabled:o.isPending,onClick:()=>o.mutate(e),children:[(0,X.jsx)(R,{size:16,"aria-hidden":`true`}),`Switch`]})]},e)}),_.length===0?(0,X.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,p.trim(),`”.`]}):null]})]}),(0,X.jsxs)(`div`,{className:`min-w-0 self-start rounded-xl border border-border bg-card p-5`,children:[(0,X.jsx)(`h2`,{className:`text-base font-semibold`,children:`Create a branch`}),(0,X.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-7 flex flex-col items-stretch gap-3`,onSubmit:e=>{e.preventDefault();let t=u.trim();t&&o.mutate(t,{onSuccess:()=>d(``)})},children:[(0,X.jsx)(`label`,{htmlFor:`new-branch-name`,className:`text-sm font-medium`,children:`Branch name`}),(0,X.jsx)(`p`,{className:`-mt-1 text-xs text-muted-foreground`,children:`Create from the selected base.`}),(0,X.jsx)(J,{id:`new-branch-name`,"aria-label":`New branch name`,placeholder:`new-branch-name`,className:`h-11 bg-background`,value:u,onChange:e=>d(e.target.value)}),(0,X.jsxs)(s,{type:`submit`,variant:`primary`,size:`sm`,className:`min-h-11 self-start`,"data-action":`create-branch`,disabled:!u.trim()||o.isPending,children:[(0,X.jsx)(he,{size:16,"aria-hidden":`true`}),`Create branch`]})]}),(0,X.jsx)(`p`,{className:`mt-3 border-t border-border pt-4 text-xs leading-relaxed text-muted-foreground`,children:`Switching branches changes your working tree. Review uncommitted changes first.`})]}),n.data?.forge?.available?(0,X.jsx)(it,{}):null]})}function it(){let e=te({limit:20});return(0,X.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,X.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,X.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,X.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,X.jsx)(at,{pr:e},e.number))}):(0,X.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function at({pr:e}){let t=(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(ue,{size:16,"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,X.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,X.jsx)(ot,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,X.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:o(e.url)?(0,X.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:c(n,`hover:bg-muted`),children:t}):(0,X.jsx)(`span`,{className:n,children:t})})}function ot({checks:e}){return(0,X.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:c(`shrink-0 text-[12px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}var st={active:`in use`,"not-landed":`not landed`,orphan:`not landed`,merged:`merged`,empty:`empty`,other:`yours`};function ct({entry:e}){return(0,X.jsx)(`span`,{"data-slot":`branch-class`,className:c(`shrink-0 rounded-[4px] border px-[5px] py-[1px] text-[10.5px] leading-[14px]`,e.class===`active`?`border-status-running/40 text-status-running`:e.class===`not-landed`||e.class===`orphan`?`border-inbox-count-foreground/40 text-inbox-count-foreground`:`border-border text-soft-foreground`),children:st[e.class]})}function Q(e,t){let n=new Set(e.branches);for(let e of t??[])n.add(e.name);return[...n].sort((e,t)=>e.localeCompare(t))}function lt(){let e=ie(),t=q(),[n,r]=(0,Y.useState)(`unified`),[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(!1),[c,l]=(0,Y.useState)(null),u=(0,Y.useRef)(null),d=e.isError&&e.error instanceof h&&e.error.status===409,f=e.data?.files??[],p=(0,Y.useMemo)(()=>ke(f),[f]),m=(0,Y.useMemo)(()=>f.some(Xe),[f]),g=t?n:`unified`,_=!t||i;return(0,X.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,X.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 px-[18px] py-[22px] md:px-9`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:e.data?`${e.data.stat.files} files changed ·`:`Uncommitted changes`}),e.data?(0,X.jsx)(Ae,{stat:e.data.stat}):null,(0,X.jsxs)(`span`,{className:`ml-auto flex items-center gap-1`,children:[(0,X.jsx)(`span`,{className:`hidden items-center gap-1 md:flex`,children:(0,X.jsx)(Ee,{mode:n,wrap:i,onModeChange:r,onWrapChange:a})}),m?(0,X.jsx)(De,{preview:o,onPreviewChange:s}):null]})]}),e.isPending?(0,X.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-9`,children:`Loading changes…`}):e.isError?(0,X.jsx)(W,{icon:d?(0,X.jsx)(z,{size:16}):(0,X.jsx)(L,{size:16}),tone:d?`neutral`:`danger`,heading:`h2`,title:d?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):f.length===0?(0,X.jsx)(W,{icon:(0,X.jsx)(z,{size:16}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,X.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 md:flex-row md:items-start px-[18px] pb-9 pt-0 [--diff-sticky-top:1rem] md:px-9`,children:[(0,X.jsxs)(`aside`,{"data-slot":`changes-tree-pane`,className:`md:sticky md:top-4 md:max-h-[calc(100dvh_-_64px_-_var(--diff-sticky-top)_-_1rem)] w-full md:w-60 shrink-0 overflow-y-auto overscroll-contain rounded-xl border border-border bg-card p-3.5 lg:w-[250px]`,children:[(0,X.jsx)(`h2`,{className:`mb-3 border-b border-border pb-3 text-xs font-semibold`,children:`Changed files`}),(0,X.jsx)(Oe,{root:p,selected:c,onSelect:e=>{l(e),u.current?.scrollToPath(e)}})]}),(0,X.jsx)(Ze,{files:f,viewRef:u,mode:g,wrap:_,preview:o,className:`min-w-0 flex-1`})]})]})}function ut({repo:e,info:t}){let{sha:n}=i(),r=e.log,a=(0,Y.useMemo)(()=>Ge(r),[r]);if(n)return(0,X.jsx)(pt,{sha:n});let o=ze(e,t),s=o&&o.behind>0?(0,X.jsx)(ft,{info:t,tracking:o}):null;return r.length===0?(0,X.jsxs)(X.Fragment,{children:[s?(0,X.jsx)(`div`,{className:`px-[8px] pt-[12px] md:px-[20px]`,children:s}):null,(0,X.jsx)(W,{icon:(0,X.jsx)(de,{size:16}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`})]}):(0,X.jsxs)(`div`,{"data-slot":`repo-commits`,className:`flex flex-col gap-[2px] px-[8px] pt-[12px] pb-[20px] md:px-[20px]`,children:[s,a.map(e=>(0,X.jsxs)(`section`,{"data-slot":`repo-commit-day`,"aria-label":e.label,className:`flex flex-col`,children:[(0,X.jsx)(`h2`,{className:`px-[10px] pt-[14px] pb-[4px] text-[11px] font-medium text-soft-foreground`,children:e.label}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:e.commits.map(e=>(0,X.jsxs)(`li`,{className:`flex min-h-[52px] items-center gap-[14px] rounded-[6px] hover:bg-sidebar-row-hover`,children:[(0,X.jsxs)(U,{to:`/git/commits/${e.hash}`,"data-slot":`commit-row`,"data-sha":e.hash,className:`flex min-h-[52px] min-w-0 flex-1 flex-col justify-center gap-[3px] rounded-[6px] px-[10px] py-[6px] focus-visible:outline-2 focus-visible:outline-ring`,children:[(0,X.jsx)(`span`,{"data-slot":`commit-row-subject`,className:`truncate text-[13px] text-foreground`,children:e.subject}),(0,X.jsxs)(`span`,{"data-slot":`commit-row-meta`,className:`flex min-w-0 items-center gap-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono`,children:e.hash}),(0,X.jsxs)(`span`,{className:`truncate`,children:[`· `,e.author,` · `,Ue(e.when)]})]})]}),(0,X.jsx)(dt,{source:e.source})]},e.hash))})]},e.label))]})}function dt({source:e}){let t=`hidden max-w-[45%] shrink-0 items-center gap-[5px] pr-[10px] text-[11.5px] text-soft-foreground md:flex`;return e?(0,X.jsxs)(U,{to:`/tasks/${e.runId}`,"data-slot":`commit-source`,"data-source":`task`,"aria-label":`From the task ${e.title}${e.prNumber===null?``:`, pull request #${e.prNumber}`}`,className:c(t,`rounded-[4px] hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring`),children:[e.prNumber===null?null:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(fe,{"aria-hidden":`true`,className:`size-[11px] shrink-0 text-merged-text`}),(0,X.jsxs)(`span`,{className:`shrink-0 text-muted-foreground`,children:[`PR #`,e.prNumber]})]}),(0,X.jsx)(_e,{"aria-hidden":`true`,className:`size-[12px] shrink-0`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.title})]}):(0,X.jsx)(`span`,{"data-slot":`commit-source`,"data-source":`unknown`,className:t,children:`no task found`})}function ft({info:e,tracking:t}){let n=Re(a(),e),r=(0,Y.useRef)(null);return(0,X.jsxs)(`div`,{"data-slot":`git-incoming`,className:`mb-[4px] flex min-h-[40px] items-center gap-[8px] rounded-[8px] border border-border px-[10px] py-[6px]`,children:[(0,X.jsx)(et,{"aria-hidden":`true`,className:`size-[14px] shrink-0 text-inbox-count-foreground`}),(0,X.jsxs)(`span`,{className:`min-w-0 flex-1 text-[12.5px] text-muted-foreground`,children:[t.behind,` commit`,t.behind===1?``:`s`,` on `,t.ref,` `,t.behind===1?`is`:`are`,` not in your checkout yet`]}),(0,X.jsxs)(`button`,{ref:r,type:`button`,"data-action":`repo-pull-incoming`,disabled:!n.hasRemote||n.pulling,onClick:()=>void n.pull(),className:`inline-flex h-[26px] shrink-0 items-center gap-[4px] rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:h-11 [&>svg]:size-[12px]`,children:[n.pulling?(0,X.jsx)(Se,{"aria-hidden":`true`,className:`motion-safe:animate-spin`}):(0,X.jsx)(ye,{"aria-hidden":`true`}),`Pull`]}),(0,X.jsx)(qe,{checkout:n,returnFocus:r})]})}function pt({sha:e}){return(0,X.jsx)(Qe,{commit:re(e),sha:e,backTo:q()?`/git`:He,backLabel:`All recent commits`,slot:`repo-commit`,className:`flex min-h-0 flex-1 flex-col`,diffClassName:`px-4 py-4 [--diff-sticky-top:1rem] md:px-6`})}var $=`Squash-merged branches may show as not landed without GitHub`;function mt(e){let t=[],n=[],r=[];for(let i of e)if(i.class===`orphan`)r.push(i);else if(i.class!==`not-landed`)continue;else i.pr&&(i.pr.state===`open`||i.pr.state===`draft`)?n.push(i):t.push(i);return[{key:`no-pr`,title:`No pull request`,note:`nobody sees this work until you act`,rows:t},{key:`pr-open`,title:`Pull request open`,rows:n},{key:`deleted`,title:`Task deleted`,note:`this branch is the only copy of the work`,rows:r}].filter(e=>e.rows.length>0)}function ht(e){return e.filter(e=>e.class===`active`&&e.runId!==null&&e.ahead>0&&(e.runStatus===`done`||e.runStatus===`failed`||e.runStatus===`cancelled`)).length}var gt={done:`success`,failed:`danger`,cancelled:`neutral`};function _t(){let e=T(),t=v(),n=a(),r=y(),[i,o]=(0,Y.useState)(null);if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`not-landed-loading`,role:`status`,className:`px-[28px] py-[20px] text-[13px] text-soft-foreground`,children:`Loading branches…`});if(e.isError)return(0,X.jsx)(W,{icon:(0,X.jsx)(L,{size:16}),tone:`danger`,heading:`h2`,title:`Could not classify the branches`,subtitle:e.error.message});let s=mt(e.data.branches),c=ht(e.data.branches),l=c>0?(0,X.jsxs)(`p`,{"data-slot":`not-landed-retained`,className:`flex items-start gap-[6px] px-[10px] pt-[6px] text-[11.5px] leading-[17px] text-soft-foreground`,children:[(0,X.jsx)(H,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),(0,X.jsxs)(`span`,{children:[c,` finished task`,c===1?` still has its`:`s still have their`,` worktree and commits not on the base, so `,c===1?`it is`:`they are`,` not listed here.`,` `,`They show here once the worktree is reclaimed in `,(0,X.jsx)(U,{to:Je.cleanup,className:`underline underline-offset-2 hover:text-foreground`,children:`Cleanup`}),`.`]})]}):null,u=new Map((t.data??[]).map(e=>[e.id,e.finishedAt]));return(0,X.jsxs)(je,{projectId:n,repoBase:r,requests:s.flatMap(e=>e.rows).flatMap(e=>e.pr?[{projectId:n,kind:`PR`,number:e.pr.number}]:[]),children:[(0,X.jsxs)(`div`,{"data-slot":`repo-not-landed`,className:`flex flex-col gap-[2px] px-[8px] pt-[12px] pb-[calc(90px+env(safe-area-inset-bottom))] md:px-[20px] md:pb-[20px]`,children:[e.data.prStateKnown?null:(0,X.jsx)(vt,{}),l,s.length===0?(0,X.jsx)(W,{icon:(0,X.jsx)(Fe,{size:16}),tone:`neutral`,heading:`h2`,title:c>0?`Nothing else waiting to land`:`Everything landed`,subtitle:c>0?`Every other finished task's commits are on the base branch, or it made none.`:`Every finished task's commits are on the base branch, or it made none.`}):(0,X.jsxs)(X.Fragment,{children:[s.map(e=>(0,X.jsxs)(`section`,{"data-slot":`not-landed-group`,"data-group":e.key,"aria-label":e.title,className:`flex flex-col`,children:[(0,X.jsxs)(`h2`,{className:`flex min-w-0 flex-wrap items-baseline gap-x-[6px] px-[10px] pt-[14px] pb-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`font-medium`,children:e.title}),(0,X.jsx)(`span`,{children:e.rows.length}),e.note?(0,X.jsxs)(`span`,{children:[`· `,e.note]}):null]}),(0,X.jsx)(`ul`,{className:`flex flex-col`,children:e.rows.map(e=>(0,X.jsx)(yt,{entry:e,finishedAt:e.runId?u.get(e.runId):void 0,onDelete:()=>o(e)},e.name))})]},e.key)),(0,X.jsxs)(`p`,{"data-slot":`not-landed-note`,className:`flex items-start gap-[6px] px-[10px] pt-[14px] text-[11.5px] leading-[17px] text-soft-foreground`,children:[(0,X.jsx)(H,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),`Delete branch is in each row's … menu. It confirms and names the commits it drops. Nothing on this list can be bulk-deleted.`]})]})]}),(0,X.jsx)(wt,{entry:i,onClose:()=>o(null)})]})}function vt({className:e}){return(0,X.jsxs)(`p`,{"data-slot":`git-no-forge`,className:c(`flex items-start gap-[6px] px-[10px] pt-[6px] text-[11.5px] leading-[17px] text-soft-foreground`,e),children:[(0,X.jsx)(H,{"aria-hidden":`true`,className:`mt-[2.5px] size-[12px] shrink-0`}),$,`.`]})}function yt({entry:e,finishedAt:t,onDelete:n}){return(0,X.jsxs)(`li`,{"data-slot":`not-landed-row`,"data-branch":e.name,"data-branch-class":e.class,className:`flex min-h-[56px] items-center gap-[12px] rounded-[6px] px-[10px] py-[6px] hover:bg-sidebar-row-hover`,children:[(0,X.jsx)(St,{entry:e,finishedAt:t}),(0,X.jsx)(bt,{entry:e}),(0,X.jsx)(xt,{entry:e,onDelete:n})]})}function bt({entry:e}){return(0,X.jsx)(X.Fragment,{children:e.pr?(0,X.jsxs)(`span`,{"data-slot":`not-landed-pr`,className:`hidden shrink-0 items-center gap-[4px] text-[11.5px] text-muted-foreground md:flex`,children:[(0,X.jsx)(Ne,{plain:!0,reference:{kind:`PR`,number:e.pr.number,url:e.pr.url},taskTitle:e.title??e.name,status:e.pr.state===`draft`?`draft`:e.pr.state===`closed`?`closed`:void 0}),(0,X.jsx)(Ct,{entry:e})]}):null})}function xt({entry:e,onDelete:t}){let n=f(),r=e.class===`orphan`,i=e.pr&&(e.pr.state===`open`||e.pr.state===`draft`)?e.pr:null,a=!r&&e.runId!==null&&!i,o=S({mutationFn:()=>d(e.runId),onSuccess:e=>{D(`Draft PR created — ${e.url}`),n.invalidateQueries({queryKey:E.repoBranches}),n.invalidateQueries({queryKey:E.runs.all})},onError:e=>D(e instanceof h&&e.manual?`${e.message} — ${e.manual}`:e.message,{tone:`danger`})}),s=()=>void navigator.clipboard.writeText(e.name).then(()=>D(`Copied ${e.name}`),()=>D(`Could not copy the branch name`,{tone:`danger`})),l=`inline-flex h-[28px] shrink-0 items-center gap-[5px] rounded-[6px] px-[10px] text-[12px] font-medium text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 [&>svg]:size-[12px]`;return(0,X.jsxs)(X.Fragment,{children:[e.runId?(0,X.jsx)(U,{to:`/tasks/${e.runId}`,"data-action":`not-landed-open`,className:c(l,`hidden border border-border hover:bg-muted md:inline-flex`),children:`Open task`}):null,a?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-create-pr`,disabled:o.isPending,onClick:()=>o.mutate(),className:c(l,`hidden bg-muted hover:brightness-110 md:inline-flex`),children:[(0,X.jsx)(tt,{"aria-hidden":`true`}),o.isPending?`Creating…`:`Create draft PR`]}):null,r?(0,X.jsxs)(`button`,{type:`button`,"data-action":`not-landed-copy`,onClick:s,className:c(l,`hidden border border-border hover:bg-muted md:inline-flex`),children:[(0,X.jsx)(xe,{"aria-hidden":`true`}),`Copy branch`]}):null,(0,X.jsxs)(ce,{children:[(0,X.jsx)(oe,{"data-action":`not-landed-more`,"aria-label":`More actions for ${e.name}`,className:`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground outline-none hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring max-md:size-11`,children:(0,X.jsx)(me,{"aria-hidden":`true`,className:`size-[14px]`})}),(0,X.jsxs)(se,{align:`end`,className:`w-52`,children:[e.runId?(0,X.jsx)(O,{asChild:!0,className:`md:hidden`,children:(0,X.jsx)(U,{to:`/tasks/${e.runId}`,children:`Open task`})}):null,a?(0,X.jsx)(O,{className:`md:hidden`,disabled:o.isPending,onSelect:()=>o.mutate(),children:`Create draft PR`}):null,(0,X.jsx)(O,{className:c(!r&&`md:hidden`),onSelect:s,children:`Copy branch`}),(0,X.jsx)(ae,{className:`md:hidden`}),(0,X.jsx)(O,{"data-action":`not-landed-delete`,variant:`destructive`,onSelect:t,children:`Delete branch…`})]})]})]})}function St({entry:e,finishedAt:t}){let n=e.class===`orphan`,r=n?`No task · last commit “${e.lastCommit.subject}”`:e.title??e.name,i=B(t??e.lastCommit.at),a=n||!e.runStatus?i?`${i} ago`:``:`${e.runStatus}${i?` ${i} ago`:``}`;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`span`,{className:`flex size-[12px] shrink-0 items-center justify-center`,children:n?(0,X.jsx)(Te,{"aria-label":`Task deleted`,className:`size-[12px] text-soft-foreground`}):(0,X.jsx)(Le,{tone:e.runStatus&>[e.runStatus]||`neutral`,"aria-label":e.runStatus??void 0})}),(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[3px]`,children:[e.runId?(0,X.jsx)(U,{to:`/tasks/${e.runId}`,"data-slot":`not-landed-title`,className:`min-w-0 truncate rounded-[2px] text-[13px] text-foreground hover:underline underline-offset-2 focus-visible:outline-2 focus-visible:outline-ring`,children:r}):(0,X.jsx)(`span`,{"data-slot":`not-landed-title`,className:`min-w-0 truncate text-[13px] text-muted-foreground`,title:r,children:r}),(0,X.jsxs)(`span`,{"data-slot":`not-landed-meta`,className:`flex min-w-0 items-center gap-[6px] text-[11px] text-soft-foreground`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),(0,X.jsxs)(`span`,{className:`shrink-0`,children:[`· `,e.ahead,` commit`,e.ahead===1?``:`s`]}),e.diffStat?(0,X.jsxs)(`span`,{className:`flex shrink-0 gap-[4px] tabular-nums`,children:[(0,X.jsxs)(`span`,{className:`text-success`,children:[`+`,e.diffStat.additions]}),(0,X.jsxs)(`span`,{className:`text-danger`,children:[`−`,e.diffStat.deletions]})]}):null,a?(0,X.jsxs)(`span`,{className:`truncate`,children:[`· `,a]}):null]}),(0,X.jsx)(Z,{entry:e})]})]})}function Ct({entry:e}){let t=b(Me(`PR`,e.pr?.number).status),n=e.pr?.state;return(0,X.jsxs)(`span`,{"data-slot":`not-landed-pr-state`,children:[`· `,n===`draft`||n===`closed`?n:t?t.label.toLowerCase():`open`]})}function wt({entry:e,onClose:t}){let n=f(),[r,i]=(0,Y.useState)(``),a=(0,Y.useId)(),o=S({mutationFn:e=>g({names:[e],confirm:e}),onSuccess:e=>{let t=e.dropped?.length??0;D(e.deleted.length>0?`Deleted ${e.deleted[0]}${t?` and ${t} commit${t===1?``:`s`} with it`:``}`:e.refused[0]?.reason??`Nothing was deleted`),n.invalidateQueries({queryKey:E.repo}),s()},onError:e=>D(e.message,{tone:`danger`})}),s=()=>{i(``),t()},c=e!==null&&r.trim()===e.name,l=e&&`${e.ahead} commit${e.ahead===1?``:`s`}`;return(0,X.jsx)(I,{open:e!==null,onOpenChange:e=>!e&&!o.isPending&&s(),children:(0,X.jsxs)(j,{"data-slot":`delete-branch-dialog`,children:[(0,X.jsxs)(F,{children:[(0,X.jsxs)(A,{children:[`Delete `,e?.name,`?`]}),(0,X.jsx)(k,{asChild:!0,children:(0,X.jsxs)(`div`,{className:`space-y-2`,children:[(0,X.jsx)(`p`,{children:e?.class===`orphan`?`Its task was deleted, so this branch is the only copy of the work.`:(0,X.jsxs)(X.Fragment,{children:[`This drops the work of `,(0,X.jsx)(`span`,{className:`font-medium text-foreground`,children:e?.title??e?.name}),`. It is not on the base branch`,e?.pr?``:` and no pull request carries it`,`.`]})}),(0,X.jsxs)(`p`,{"data-slot":`delete-branch-dropped`,children:[l,` will be dropped`,e?.diffStat?` (+${e.diffStat.additions} −${e.diffStat.deletions})`:``,`, the latest “`,e?.lastCommit.subject,`”`,` `,`(`,(0,X.jsx)(`span`,{className:`font-mono`,children:e?.lastCommit.sha.slice(0,7)}),`).`]})]})})]}),(0,X.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),c&&e&&o.mutate(e.name)},className:`flex flex-col gap-[6px]`,children:[(0,X.jsxs)(`label`,{htmlFor:a,className:`text-[12.5px] text-muted-foreground`,children:[`Type `,(0,X.jsx)(`span`,{className:`font-mono text-foreground`,children:e?.name}),` to confirm`]}),(0,X.jsx)(J,{id:a,"data-slot":`delete-branch-confirm`,autoComplete:`off`,spellCheck:!1,value:r,onChange:e=>i(e.target.value),className:`h-11 font-mono`})]}),(0,X.jsxs)(N,{children:[(0,X.jsx)(P,{className:`h-11`,disabled:o.isPending,children:`Keep it`}),(0,X.jsx)(M,{"data-action":`delete-branch-confirm`,className:`h-11 bg-danger text-danger-foreground hover:brightness-[0.96]`,disabled:!c||o.isPending,onClick:t=>{t.preventDefault(),e&&o.mutate(e.name)},children:o.isPending?`Deleting…`:`Delete branch`})]})]})})}function Tt({base:e}){let t=T(),n=f(),[r,i]=(0,Y.useState)({merged:!1,empty:!1}),[a,o]=(0,Y.useState)(!1),s=(t.data?.branches??[]).filter(e=>e.class===`merged`),c=(t.data?.branches??[]).filter(e=>e.class===`empty`),l=[...s,...c],u=S({mutationFn:e=>g({names:e}),onSuccess:e=>{let t=e.refused.length;D(`Deleted ${e.deleted.length} branch${e.deleted.length===1?``:`es`}${t?`; kept ${t} that ${t===1?`is`:`are`} no longer safe to delete`:``}`),n.invalidateQueries({queryKey:E.repo})},onError:e=>{n.invalidateQueries({queryKey:E.repo}),D(e.message,{tone:`danger`})}});if(t.isPending)return(0,X.jsx)(`p`,{"data-slot":`cleanup-branches-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading branches…`});if(t.isError)return(0,X.jsxs)(`p`,{"data-slot":`cleanup-branches-error`,className:`text-[13px] text-danger`,children:[`Branches did not load: `,t.error.message]});let d=l.length,p=`branch${d===1?``:`es`}`;return(0,X.jsxs)(`section`,{"data-slot":`cleanup-branches`,"aria-labelledby":`cleanup-branches-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`cleanup-branches-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Branches safe to delete · `,d]}),(0,X.jsxs)(`p`,{className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[`Their work is already on `,e,`, or they have none. Deleting loses nothing.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`cleanup-branches-delete`,disabled:d===0||u.isPending,onClick:()=>o(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(be,{"aria-hidden":`true`,className:`size-[12px]`}),u.isPending?`Deleting…`:`Delete ${d} ${p}`]})]}),(0,X.jsx)(Et,{kind:`merged`,title:`Merged into ${e}`,hint:t.data.prStateKnown?`including squash-merged PRs, read from the PR state`:$.toLowerCase(),rows:s,open:r.merged,onToggle:()=>i(e=>({...e,merged:!e.merged}))}),(0,X.jsx)(Et,{kind:`empty`,title:`Empty`,hint:`no commits beyond the fork point`,rows:c,open:r.empty,onToggle:()=>i(e=>({...e,empty:!e.empty}))}),(0,X.jsx)(I,{open:a,onOpenChange:o,children:(0,X.jsxs)(j,{children:[(0,X.jsxs)(F,{children:[(0,X.jsxs)(A,{children:[`Delete `,d,` `,p,`?`]}),(0,X.jsxs)(k,{children:[s.length,` merged into `,e,` and `,c.length,` empty. Their work is already on `,e,`, or they have none. Anything that stopped being safe since this list loaded is kept.`]})]}),(0,X.jsxs)(N,{children:[(0,X.jsx)(P,{children:`Keep them`}),(0,X.jsxs)(M,{"data-action":`cleanup-branches-confirm`,className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{u.mutate(l.map(e=>e.name)),o(!1)},children:[`Delete `,d,` `,p]})]})]})})]})}function Et({kind:e,title:t,hint:n,rows:r,open:i,onToggle:a}){let o=`cleanup-branches-${e}`;return(0,X.jsxs)(`div`,{"data-slot":`cleanup-branch-group`,"data-group":e,className:`border-b border-border last:border-0`,children:[(0,X.jsxs)(`button`,{type:`button`,"aria-expanded":i,"aria-controls":o,disabled:r.length===0,onClick:a,className:`flex min-h-[44px] w-full items-center gap-[12px] px-[14px] py-[4px] text-left hover:bg-sidebar-row-hover focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-ring disabled:hover:bg-transparent`,children:[(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`span`,{className:`truncate text-[12.5px] text-foreground`,children:[t,` · `,r.length]}),(0,X.jsx)(`span`,{className:`truncate text-[11px] text-soft-foreground`,children:n})]}),r.length>0?(0,X.jsx)(ve,{"aria-hidden":`true`,className:c(`size-[13px] shrink-0 text-soft-foreground transition-transform motion-reduce:transition-none`,i&&`rotate-90`)}):null]}),i?(0,X.jsx)(`ul`,{id:o,"aria-label":t,className:`flex flex-col pb-[6px]`,children:r.map(e=>(0,X.jsxs)(`li`,{"data-slot":`cleanup-branch-row`,"data-branch":e.name,className:`flex min-h-[32px] items-center gap-[10px] px-[14px] pl-[26px] text-[11.5px]`,children:[(0,X.jsx)(`span`,{className:`shrink-0 font-mono text-muted-foreground`,children:e.name}),e.runId?(0,X.jsx)(U,{to:`/tasks/${e.runId}`,className:`min-w-0 flex-1 truncate text-soft-foreground underline-offset-2 hover:text-foreground hover:underline`,children:e.title??`Open the task`}):(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-soft-foreground`,children:e.lastCommit.subject}),e.pr?(0,X.jsxs)(`span`,{className:`shrink-0 text-soft-foreground`,children:[`PR #`,e.pr.number]}):null,(0,X.jsx)(`span`,{className:`shrink-0 tabular-nums text-soft-foreground`,children:B(e.lastCommit.at)})]},e.name))}):null]})}function Dt(){let e=ne(),t=ee().data?.targets.find(e=>e.id===`finder`),n=S({mutationFn:e=>u(e,t.id),onError:e=>D(e.message,{tone:`danger`})}),r=f(),[i,a]=(0,Y.useState)(!1),o=()=>Promise.all([r.invalidateQueries({queryKey:E.worktrees}),r.invalidateQueries({queryKey:E.repoBranches})]),s=S({mutationFn:e=>_(),onSuccess:(e,t)=>{o();let n=e.reclaimed.length,r=Math.max(0,t-n);D(n===0?r>0?`Nothing was reclaimed — the worktrees past the keep limit have uncommitted work or are in use`:`Nothing to reclaim — no finished worktrees exceed the keep limit`:`Reclaimed ${n} worktree${n===1?``:`s`} (branch kept)${r>0?` · ${r} kept: uncommitted work or in use`:``}`)},onError:e=>D(e.message,{tone:`danger`})}),c=S({mutationFn:e=>m(e.runId),onSuccess:(e,t)=>{o(),D(`Reclaimed the worktree of ${t.title} (branch kept)`)},onError:e=>{o(),D(e.message,{tone:`danger`})}});if(e.isPending)return(0,X.jsx)(`p`,{"data-slot":`worktrees-loading`,className:`text-[13px] text-soft-foreground`,children:`Loading worktrees…`});if(e.isError)return(0,X.jsxs)(`p`,{"data-slot":`worktrees-error`,className:`text-[13px] text-danger`,children:[`Worktrees did not load: `,e.error.message]});let{worktrees:l,totalBytes:d,keep:p}=e.data,h=s.isPending||c.isPending,g=l.filter(e=>e.pastKeep),v=g.length>0,y=g.some(e=>e.sizeBytes===null)?null:g.reduce((e,t)=>e+(t.sizeBytes??0),0),b=v?y?`Reclaim ${C(y)} now`:`Reclaim ${g.length} now`:`Reclaim now`,x=d?C(d):null;return(0,X.jsxs)(`section`,{"data-slot":`worktrees-panel`,"aria-labelledby":`worktrees-panel-title`,className:`flex flex-col rounded-[8px] border border-border`,children:[(0,X.jsxs)(`div`,{className:`flex flex-col gap-[10px] border-b border-border px-[14px] py-[12px] md:flex-row md:items-center`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsxs)(`h2`,{id:`worktrees-panel-title`,className:`text-[13px] font-semibold text-foreground`,children:[`Worktrees on disk`,x?` · ${x}`:``]}),(0,X.jsxs)(`p`,{"data-slot":`worktrees-retention`,className:`text-[11.5px] leading-[17px] text-soft-foreground`,children:[p===0?`Retention is unlimited (`:`Retention keeps the newest ${p} finished checkout${p===1?``:`s`} (`,(0,X.jsx)(U,{to:`/settings/worktrees`,"data-slot":`worktrees-retention-link`,className:`underline-offset-2 hover:text-foreground hover:underline`,children:Pe(`worktrees`,` › `)}),p===0?`), so nothing is reclaimed on its own.`:`) and reclaims the rest.`,` `,`Reclaim removes the directory only; the branch stays, so its work stays recoverable.`]})]}),(0,X.jsxs)(`button`,{type:`button`,"data-action":`worktrees-reclaim-now`,disabled:h||!v,title:v?void 0:`Nothing past the keep limit to reclaim`,onClick:()=>a(!0),className:`inline-flex h-[28px] shrink-0 items-center gap-[5px] self-start rounded-[6px] bg-muted px-[10px] text-[12px] font-medium text-foreground hover:brightness-110 focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 disabled:hover:brightness-100 max-md:h-11 md:self-center`,children:[(0,X.jsx)(G,{"aria-hidden":`true`,className:`size-[12px]`}),b]})]}),l.length===0?(0,X.jsx)(`p`,{"data-slot":`worktrees-empty`,className:`px-[14px] py-[12px] text-[12.5px] text-soft-foreground`,children:`No task worktrees on disk.`}):(0,X.jsx)(`ul`,{"aria-label":`Task worktrees on disk`,className:`flex flex-col`,children:l.map(e=>(0,X.jsx)(At,{worktree:e,keep:p,disabled:h,onOpen:t?()=>n.mutate(e.runId):void 0,opening:n.isPending,onReclaim:()=>c.mutate(e)},e.runId))}),(0,X.jsx)(I,{open:i,onOpenChange:a,children:(0,X.jsxs)(j,{children:[(0,X.jsxs)(F,{children:[(0,X.jsx)(A,{children:`Reclaim old worktrees?`}),(0,X.jsxs)(k,{children:[g.length,` finished worktree`,g.length===1?``:`s`,` beyond the keep limit`,y?` (${C(y)})`:``,` `,g.length===1?`is`:`are`,` reclaimed now, directory only. Their branches are kept, so the work stays recoverable.`]})]}),(0,X.jsxs)(N,{children:[(0,X.jsx)(P,{children:`Keep them`}),(0,X.jsx)(M,{"data-action":`worktrees-confirm`,onClick:()=>{s.mutate(g.length),a(!1)},children:b})]})]})})]})}var Ot=new Set([`queued`,`running`,`waiting`,`review`]);function kt(e,t){return Ot.has(e.status)||!e.reclaimable?{label:`in use`,tone:`in-use`}:e.pastKeep?{label:`reclaimable`,tone:`plain`}:{label:t>0?`kept · newest ${t}`:`kept`,tone:`plain`}}function At({worktree:e,keep:t,disabled:n,onOpen:r,opening:i,onReclaim:a}){let o=kt(e,t),s=B(e.finishedAt??void 0),l=e.status===`review`?`at review`:s?`${e.status} ${s} ago`:e.status,u=(0,X.jsx)(`span`,{"data-slot":`worktree-state`,"data-state":o.tone===`in-use`?`in-use`:e.pastKeep?`reclaimable`:`kept`,className:c(`text-[11.5px]`,o.tone===`in-use`?`text-status-running`:`text-soft-foreground`),children:o.label}),d=`flex size-[28px] shrink-0 items-center justify-center rounded-[6px] text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring disabled:opacity-50 max-md:size-11`;return(0,X.jsxs)(`li`,{"data-slot":`worktree-row`,"data-run":e.runId,className:`flex min-h-[44px] items-center gap-[12px] border-b border-border px-[14px] py-[4px] last:border-0`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-[2px]`,children:[(0,X.jsx)(`span`,{className:`truncate text-[12.5px] text-foreground`,title:e.title,children:e.title}),(0,X.jsxs)(`span`,{className:`truncate font-mono text-[10.5px] text-soft-foreground`,children:[e.branch??e.runId.slice(0,8),` · `,l,(0,X.jsxs)(`span`,{className:`md:hidden`,children:[` · `,o.label]})]})]}),(0,X.jsx)(`span`,{"data-slot":`worktree-size`,className:`shrink-0 text-[11.5px] tabular-nums text-muted-foreground`,children:e.sizeBytes===null?`—`:C(e.sizeBytes)||`0 kB`}),(0,X.jsx)(`span`,{className:`hidden shrink-0 md:inline`,children:u}),r?(0,X.jsx)(`button`,{type:`button`,className:d,"aria-label":`Open folder for ${e.title}`,title:`Open folder`,disabled:i,onClick:r,children:(0,X.jsx)(le,{"aria-hidden":`true`,className:`size-[13px]`})}):null,o.tone===`in-use`?null:(0,X.jsx)(`button`,{type:`button`,"data-action":`worktree-reclaim`,"aria-label":`Reclaim the worktree of ${e.title} (branch kept)`,title:`Reclaim the directory (branch kept)`,disabled:n,onClick:a,className:d,children:(0,X.jsx)(G,{"aria-hidden":`true`,className:`size-[13px]`})})]})}function jt({section:e,index:t=!1}){let n=w(),i=q(),[a]=r();if(t&&!i&&a.get(`view`)!==`repo`)return(0,X.jsx)(nt,{});if(n.isPending)return(0,X.jsx)(Ye,{});if(n.isError)return(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(K,{}),(0,X.jsx)(W,{icon:(0,X.jsx)(L,{size:16}),tone:`danger`,title:`Could not load the repository`,subtitle:n.error.message})]});let o=n.data.info;return o?(0,X.jsx)(Mt,{repo:n.data,info:o,section:e}):(0,X.jsxs)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(K,{}),(0,X.jsx)(W,{icon:(0,X.jsx)(R,{size:16}),tone:`neutral`,title:`Not a git repository`,subtitle:`cezar is running outside a git repository — start it inside one to browse changes, commits and branches.`})]})}function Mt({repo:e,info:t,section:n}){return(0,X.jsxs)(`div`,{"data-route":`repo-git`,"data-git-section":n,className:`flex min-h-full flex-col`,children:[(0,X.jsx)(K,{}),(0,X.jsxs)(`header`,{"data-slot":`repo-header`,className:`flex flex-col gap-1 px-[18px] pt-[18px] md:min-h-[61px] md:flex-row md:items-center md:gap-[10px] md:border-b md:border-border md:px-7 md:py-4`,children:[(0,X.jsx)(`h1`,{className:`min-w-0 flex-1 truncate text-2xl font-semibold tracking-tight md:text-[15px] md:tracking-normal`,children:Ie(n,t.branch)}),(0,X.jsx)(`p`,{"data-slot":`repo-meta`,className:`min-w-0 truncate text-[12px] text-soft-foreground md:text-[11.5px]`,children:(0,X.jsx)(Nt,{repo:e,info:t,section:n})})]}),n===`main`?(0,X.jsx)(ut,{repo:e,info:t}):n===`not-landed`?(0,X.jsx)(_t,{}):n===`cleanup`?(0,X.jsxs)(`div`,{"data-slot":`repo-cleanup`,className:`flex flex-col gap-[16px] px-[18px] pt-[12px] pb-[calc(90px+env(safe-area-inset-bottom))] md:px-[20px] md:pb-[20px]`,children:[(0,X.jsx)(Dt,{}),(0,X.jsx)(Tt,{base:e.baseBranch??t.branch})]}):n===`branches`?(0,X.jsx)(rt,{repo:e,info:t}):(0,X.jsx)(lt,{})]})}function Nt({repo:e,info:t,section:n}){let r=e.baseBranch??t.branch;switch(n){case`main`:return(0,X.jsxs)(X.Fragment,{children:[e.log.length===0?`no commits yet`:`latest ${e.log.length} commit${e.log.length===1?``:`s`} in the main checkout`,e.tracking?` · ${Be(e.tracking)}`:``]});case`not-landed`:return(0,X.jsxs)(X.Fragment,{children:[`finished tasks whose commits are not on `,r]});case`branches`:return(0,X.jsx)(Pt,{repo:e,info:t});case`changes`:return(0,X.jsxs)(X.Fragment,{children:[e.status.length,` uncommitted file`,e.status.length===1?``:`s`,` in the main checkout`]});case`cleanup`:return(0,X.jsxs)(X.Fragment,{children:[`nothing here can delete work that is not on `,r]})}}function Pt({repo:e,info:t}){let n=Q(e,T().data?.branches).length;return(0,X.jsxs)(X.Fragment,{children:[n,` branch`,n===1?``:`es`,` · on `,t.branch]})}export{jt as RepoGitRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,D as i,E as a,h as o,p as s,t as c,w as l}from"./button-RJMdCnZw.js";import{c as u,i as d}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,D as i,E as a,h as o,p as s,t as c,w as l}from"./button-RJMdCnZw.js";import{c as u,i as d}from"./project-scope-context-DFjJ4Dzo.js";import{C as f,u as p}from"./queries-Cgys1fiN.js";import{ct as m,r as h}from"./design-icons-DmYTv2r1.js";import{c as g,i as _,l as v,o as y,s as b,t as x}from"./file-preview-BmEFF1nO.js";import{t as S}from"./centered-state-dmABwupF.js";import{s as C}from"./markdown-CYkWwCze.js";import{ht as w,mt as T,pt as E}from"./index-B98HIjrF.js";var D=e(t(),1),O=n();function k(){let e=r(),t=l();return()=>{if(e.key==="default"||window.history.state?.idx===0){t({pathname:e.pathname.replace(/\/report\/?$/,``)},{replace:!0});return}let n=window.navigation,r=A(e.state);n?.canGoBack?n.back():r?t(r,{state:{filesRestoreKey:e.state?.filesRestoreKey}}):t(-1)}}function A(e){let t=e?.readerFrom;return typeof t==`string`&&t.startsWith(`/`)&&!t.startsWith(`//`)?t:null}function j(e){return e?.type===`file`?e:null}function M(){let[e]=i(),t=e.get(`path`),n=e.get(`artifact`);return{path:t,artifactId:n,conflict:e.getAll(`path`).length>1||e.getAll(`artifact`).length>1||t!==null&&n!==null||t===``||n===``}}function N(){let{id:e=``}=a(),t=M(),n=r(),i=k();return(0,O.jsx)(P,{runId:e,selection:t,fragment:n.hash,onBack:i,variant:`route`})}function P({runId:e,selection:t,fragment:n,onBack:i,variant:a,sourceLookup:s}){let{path:c,conflict:l,selected:u,result:d}=I(e,t,s),f=w(E,!0),p=w(T,!1),m=r(),[h,g]=(0,D.useState)(!1),_=j(d.data);if(a===`route`&&L(_))return(0,O.jsx)(o,{replace:!0,to:{pathname:m.pathname.replace(/\/report\/?$/,`/files`),search:m.search,hash:m.hash}});let v=z(_,c),y=a===`pane`&&!p&&!f?`Conversation`:`Back`,b=a===`pane`&&!h&&R(_),x=F(m.pathname,e,t);return(0,O.jsxs)(`div`,{"data-route":`task-report`,"data-variant":a,onKeyDown:e=>{a!==`pane`||e.key!==`Escape`||e.defaultPrevented||(e.preventDefault(),e.stopPropagation(),i())},className:a===`route`?`fixed inset-0 z-50 flex flex-col bg-background [padding-block-start:env(safe-area-inset-top)] [padding-inline-end:env(safe-area-inset-right)] [padding-block-end:env(safe-area-inset-bottom)] [padding-inline-start:env(safe-area-inset-left)] md:static md:z-auto md:h-full md:p-0`:`flex h-full min-h-0 flex-col bg-background max-md:[padding-block-start:env(safe-area-inset-top)] max-md:[padding-inline-start:env(safe-area-inset-left)] max-md:[padding-inline-end:env(safe-area-inset-right)]`,children:[(0,O.jsx)(B,{runId:e,file:_,name:v,source:h,onSource:()=>g(e=>!e),onBack:i,backLabel:y,hideDownload:a===`pane`&&p,focusBack:a===`pane`}),(0,O.jsx)(`div`,{"data-slot":`report-body`,className:b?`flex min-h-0 flex-1 flex-col overflow-clip`:`flex min-h-0 flex-1 flex-col overflow-auto`,children:(0,O.jsx)(V,{conflict:l,selected:u,result:d,source:h,name:v,fragment:n,pane:a===`pane`,filesHref:x})})]})}function F(e,t,n){let r=/^\/p\/[^/]+/.exec(e)?.[0]??``,i=n.artifactId?new URLSearchParams({artifact:n.artifactId}):new URLSearchParams({path:n.path??``});return`${r}/tasks/${encodeURIComponent(t)}/files?${i}`}function I(e,t,n){let{path:r=null,artifactId:i=null,conflict:a=!1}=t,o=n?.isPending||n?.isError,s=f(e,i||a||o?null:r),c=p(e,a||o?null:i),l=o&&n?{...n,data:void 0}:i?c:s;return{path:r,conflict:a,selected:r!==null||i!==null,result:l}}function L(e){return e!==null&&(!C(e.path)||!e.artifact&&(e.tooLarge||e.binary))}function R(e){return e!==null&&!e.tooLarge&&!e.binary}function z(e,t){return e?e.artifact?.name??e.path.split(/[\\/]/).at(-1)??e.path:t??`Report`}function B({runId:e,file:t,name:n,source:r,onSource:i,onBack:a,backLabel:o,hideDownload:s,focusBack:l}){let d=(0,D.useRef)(null);(0,D.useEffect)(()=>{l&&d.current?.focus({preventScroll:!0})},[l]);let f=t?.artifact;return(0,O.jsxs)(`header`,{"data-slot":`report-bar`,className:`flex min-h-14 shrink-0 items-center gap-2 border-b border-border bg-card px-2 md:px-4`,children:[(0,O.jsxs)(c,{ref:d,variant:`ghost`,className:`min-h-11 min-w-11 gap-1.5 px-2`,onClick:a,"aria-label":o,children:[(0,O.jsx)(h,{size:18,"aria-hidden":`true`}),(0,O.jsx)(`span`,{className:`max-sm:sr-only`,children:o})]}),(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsx)(`h1`,{className:`truncate text-sm font-medium`,children:n}),t?(0,O.jsxs)(`p`,{className:`truncate text-xs text-soft-foreground`,children:[f?`Published snapshot · ${new Date(f.createdAt).toLocaleString()}`:`Live file`,` · `,_(t.size)]}):null]}),t&&!t.tooLarge&&!t.binary?(0,O.jsx)(c,{variant:`ghost`,className:`min-h-11 px-3 text-accent-text`,onClick:i,children:r?`Preview`:`Source`}):null,f&&!s?(0,O.jsx)(`a`,{className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline focus-visible:ring-2`,href:u(e,f.id,`download`),children:`Download`}):null]})}function V({conflict:e,selected:t,result:n,source:r,name:i,fragment:a,pane:o,filesHref:c}){if(e)return(0,O.jsx)(U,{icon:(0,O.jsx)(b,{}),title:`Invalid report link`,subtitle:`Choose either a path or a published artifact.`});if(!t)return(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`No report selected`,subtitle:`Open a report from a link in the conversation or from Files.`});if(n.isPending)return(0,O.jsx)(`p`,{role:`status`,"data-slot":`report-loading`,className:`px-4 py-6 text-center text-sm text-soft-foreground`,children:`Loading report…`});if(n.isError)return(0,O.jsx)(H,{result:n});let l=n.data;return l.type===`file`?o&&!C(l.path)?(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`Not an HTML report`,subtitle:`Open this published file in Files.`,action:(0,O.jsx)(s,{to:c,className:`inline-flex min-h-11 items-center rounded-md px-3 text-sm text-accent-text underline active:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring`,children:`Open in Files`})}):l.tooLarge?(0,O.jsx)(U,{icon:(0,O.jsx)(v,{}),title:`Too large to preview`,subtitle:`${_(l.size)} is past the 500 kB preview limit. Download it to read it.`}):l.binary?(0,O.jsx)(U,{icon:(0,O.jsx)(g,{}),title:`Binary file`,subtitle:`This file holds binary data, not readable HTML.`}):r?(0,O.jsx)(`div`,{className:`bg-card`,children:(0,O.jsx)(x,{path:l.path,text:l.content??``})}):(0,O.jsx)(y,{html:l.content??``,title:`Report: ${i}`,fragment:a,className:o?`min-h-0 flex-1`:`min-h-[60dvh] flex-1`}):(0,O.jsx)(U,{icon:(0,O.jsx)(b,{}),title:l.type===`unpublished`?`Report not published`:`Report unavailable`,subtitle:l.reason})}function H({result:e}){let t=e.error instanceof d&&e.error.status===404;return(0,O.jsx)(U,{icon:t?(0,O.jsx)(b,{}):(0,O.jsx)(m,{size:16}),tone:t?`neutral`:`danger`,title:t?`Report missing or deleted`:`Could not load this report`,subtitle:e.error?.message??`Try again.`,action:(0,O.jsx)(c,{variant:`outline`,className:`min-h-11`,onClick:()=>void e.refetch(),children:`Retry`})})}function U({icon:e,title:t,subtitle:n,tone:r=`neutral`,action:i}){return(0,O.jsxs)(`div`,{"data-slot":`report-state`,className:`flex flex-col items-center gap-3 p-6`,children:[(0,O.jsx)(S,{icon:e,tone:r,heading:`h2`,title:t,subtitle:n}),i]})}export{P as ReportReader,N as TaskReportRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,M as i,T as a,t as o}from"./button-RJMdCnZw.js";import{En as s,Kn as c,p as l,zt as u}from"./project-scope-context-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,M as i,T as a,t as o}from"./button-RJMdCnZw.js";import{En as s,Kn as c,p as l,zt as u}from"./project-scope-context-DFjJ4Dzo.js";import{t as d}from"./useInfiniteQuery-HtyVqdKz.js";import{Z as f,dt as p,nt as m,ot as h,rt as g,ut as _}from"./live-protocol-ai7TG3jr.js";import{t as v}from"./project-router-DQWY9FSQ.js";import{nn as y,vt as b}from"./index-B98HIjrF.js";import{t as x}from"./report-title-D4Mbu2Er.js";var S=e(t(),1),C=1e3,w=h().min(1).max(1024);g({q:h().max(C).optional(),before:w.optional(),limit:h().regex(/^(?:[1-9]|[1-9][0-9]|100)$/).transform(Number).optional()}).strict();var T=g({reports:f(g({id:_(),runId:_(),name:h(),title:h(),createdAt:p(),size:m().int().nonnegative(),taskTitle:h(),taskStatus:c}).strict()),nextCursor:w.nullable(),total:m().int().nonnegative()}).strict();async function E(e,t,n,r){let i=await l.api.v1.p[`:projectId`].reports.$get({param:{projectId:e},query:{q:t.slice(0,C),...n?{before:n}:{}}},u(r?{signal:r}:void 0));return T.parse(await s(i,`/reports`))}function D(e){let t=i();return d({queryKey:[t,`reports`,e],initialPageParam:void 0,queryFn:({pageParam:n,signal:r})=>E(t,e,n,r),getNextPageParam:e=>e.nextCursor??void 0,staleTime:0,refetchOnWindowFocus:!0})}var O=n(),k=new Map;function A(){let e=r(),t=a(),[n,i]=b(),s=(n.get(`q`)??``).slice(0,C),c=D(s),l=(0,S.useRef)(null),u=(0,S.useRef)(``),d=e.pathname+e.search,f=c.data?.pages.flatMap(e=>e.reports)??[];(0,S.useLayoutEffect)(()=>{if(!c.data||u.current===d)return;let n=k.get(d),r=e.state?.filesRestoreKey===d;if(!n||!l.current||t!==`POP`&&!r){u.current=d;return}let i=l.current.querySelector(`[data-report-id="${n.row}"]`);if(c.isFetchNextPageError){u.current=d,l.current.scrollTop=0;return}if((!i||c.data.pages.length<n.pages)&&c.hasNextPage){c.isFetchingNextPage||c.fetchNextPage();return}u.current=d,l.current.scrollTop=i?n.scroll:0,i?.focus({preventScroll:!0})},[d,c.data,c.hasNextPage,c.isFetchingNextPage,c.isFetchNextPageError,c.fetchNextPage,e.state,t]);let p=t=>i(n=>(t?n.set(`q`,t.slice(0,C)):n.delete(`q`),k.delete(e.pathname+`?`+n.toString()),n));return(0,O.jsxs)(`section`,{"data-route":`reports`,className:`flex h-full min-h-0 flex-col`,children:[(0,O.jsxs)(`header`,{className:`flex shrink-0 flex-col gap-3 border-b border-border p-4`,children:[(0,O.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Reports`}),(0,O.jsx)(y,{maxLength:C,"aria-label":`Search reports`,placeholder:`Search reports or source tasks`,value:s,onChange:e=>p(e.target.value),className:`min-h-11`})]}),(0,O.jsxs)(`div`,{ref:l,"data-slot":`reports-list`,className:`min-h-0 flex-1 overflow-y-auto overscroll-contain p-4 [scrollbar-gutter:stable]`,children:[c.isPending?(0,O.jsx)(`p`,{role:`status`,children:`Loading reports…`}):c.isError?(0,O.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3`,children:[(0,O.jsx)(`p`,{children:`Could not load reports`}),(0,O.jsx)(`p`,{className:`text-sm text-soft-foreground`,children:c.error.message}),(0,O.jsx)(o,{className:`min-h-11`,onClick:()=>void c.refetch(),children:`Retry`})]}):f.length===0?(0,O.jsxs)(`div`,{className:`flex flex-col items-start gap-3`,children:[(0,O.jsx)(`h2`,{className:`font-medium`,children:s?`No matching reports`:`No published reports yet`}),s?(0,O.jsx)(o,{"data-slot":`reports-clear-search`,variant:`outline`,className:`min-h-11`,onClick:()=>p(``),children:`Clear search`}):(0,O.jsxs)(`p`,{className:`text-sm text-soft-foreground`,children:[`Publish an HTML snapshot with `,(0,O.jsx)(`code`,{children:`cez artifact publish`}),` to list it here.`]})]}):(0,O.jsx)(`ul`,{className:`flex flex-col gap-3`,children:f.map(e=>(0,O.jsxs)(`li`,{"data-slot":`report-row`,className:`reports-row rounded-lg border border-border bg-card p-3`,children:[(0,O.jsx)(`h2`,{className:`min-w-0 font-medium [overflow-wrap:anywhere]`,children:(0,O.jsx)(v,{"data-report-id":e.id,className:`reports-open`,to:`/tasks/${e.runId}/report?artifact=${e.id}`,state:{readerFrom:d,filesRestoreKey:d},onClick:()=>k.set(d,{scroll:l.current?.scrollTop??0,row:e.id,pages:c.data?.pages.length??1}),children:x(e)})}),(0,O.jsx)(v,{className:`reports-task text-sm text-accent-text underline [overflow-wrap:anywhere]`,to:`/tasks/${e.runId}`,children:e.taskTitle}),(0,O.jsx)(`time`,{className:`block text-xs text-soft-foreground`,dateTime:e.createdAt,children:new Date(e.createdAt).toLocaleString()})]},e.id))}),c.hasNextPage?(0,O.jsx)(o,{variant:`outline`,className:`min-h-11`,disabled:c.isFetchingNextPage,onClick:()=>void c.fetchNextPage(),children:`Load more reports`}):null]})]})}export{A as ReportsRoute};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{E as r,S as i,d as a,t as o,u as s}from"./button-RJMdCnZw.js";import{A as c,Hn as l,Kt as u,Vr as d,i as f,qt as p,s as m,yr as h}from"./project-scope-context-DFjJ4Dzo.js";import{$ as g,$t as _,B as v,Bn as ee,Et as te,H as y,J as b,P as ne,Qt as x,Rn as S,Sn as C,St as w,U as T,Vn as E,W as D,Zt as O,an as re,bn as ie,cn as k,et as ae,gt as oe,in as se,n as ce,on as le,rn as ue,rt as de,z as fe,zn as pe}from"./queries-Cgys1fiN.js";import"./ws-BZNDvStH.js";import{n as A}from"./toaster-BWMQArHJ.js";import{a as j,i as M,l as N,n as P,p as F,r as I,t as L}from"./dropdown-menu-B2Hg08ap.js";import{a as me,c as he,i as ge,n as _e,o as ve,r as ye,s as be,t as xe}from"./alert-dialog-D5mmm9BZ.js";import{i as Se,r as Ce,t as we}from"./popover-DV9NKc0j.js";import{I as Te,S as Ee,Y as De,a as R,m as Oe,mt as z,st as ke,t as Ae,u as je,y as B}from"./design-icons-DmYTv2r1.js";import{a as Me,c as Ne,i as Pe,n as Fe,o as Ie,s as Le,t as Re}from"./textarea-CMbcARwO.js";import{n as ze}from"./loader-circle-CZkGEdoI.js";import{t as V}from"./createLucideIcon-BHp8sXmF.js";import{t as Be}from"./app-window-CSHwDX9N.js";import{t as Ve}from"./info-DA1x_4bz.js";import{t as He}from"./message-square-B-MD-8rD.js";import{a as Ue,n as H,r as We}from"./control-locations-SzZ8gyme.js";import{c as Ge,s as Ke,t as U}from"./project-router-DQWY9FSQ.js";import{r as W,t as qe}from"./markdown-CYkWwCze.js";import{Bt as Je,Dt as Ye,Et as Xe,F as Ze,G as Qe,H as G,It as $e,K as et,Kt as tt,M as nt,Ot as rt,P as it,R as at,Rt as ot,U as K,_ as st,at as ct,ft as lt,g as ut,it as dt,nt as ft,q as pt,rt as mt,tn as ht,v as gt}from"./index-B98HIjrF.js";import{t as q}from"./tab-link-SMUzNnZa.js";var _t=V(`bell-off`,[[`path`,{d:`M10.268 21a2 2 0 0 0 3.464 0`,key:`vwvbt9`}],[`path`,{d:`M17 17H4a1 1 0 0 1-.74-1.673C4.59 13.956 6 12.499 6 8a6 6 0 0 1 .258-1.742`,key:`178tsu`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M8.668 3.01A6 6 0 0 1 18 8c0 2.687.77 4.653 1.707 6.05`,key:`1hqiys`}]]),vt=V(`mail`,[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]),yt=V(`pin-off`,[[`path`,{d:`M12 17v5`,key:`bb1du9`}],[`path`,{d:`M15 9.34V7a1 1 0 0 1 1-1 2 2 0 0 0 0-4H7.89`,key:`znwnzq`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}],[`path`,{d:`M9 9v1.76a2 2 0 0 1-1.11 1.79l-1.78.9A2 2 0 0 0 5 15.24V16a1 1 0 0 0 1 1h11`,key:`c9qhm2`}]]),J=e(t(),1),Y=n();function bt(e){let t=S();return E({mutationFn:t=>m(ee(e),t),onSuccess:()=>t.invalidateAfter(`runs`,()=>pe()),onError:e=>A(e.message,{tone:`danger`})})}function xt(e){return e.archived?`Unarchive`:`Archive task`}function St({run:e,open:t,onOpenChange:n,onConfirm:r}){return(0,Y.jsx)(xe,{open:t,onOpenChange:n,children:(0,Y.jsxs)(ge,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(be,{children:[(0,Y.jsx)(he,{children:`Archive task?`}),(0,Y.jsxs)(me,{children:[`Move “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:C(e),children:C(e)}),`” out of Active tasks. You can restore it from Archived.`]})]}),(0,Y.jsxs)(ve,{children:[(0,Y.jsx)(ye,{children:`Cancel`}),(0,Y.jsx)(_e,{className:`bg-accent-strong text-accent-strong-foreground hover:brightness-[0.96]`,onClick:r,children:`Archive task`})]})]})})}function X({run:e,className:t,compactOnMobile:n=!1}){let[r,i]=(0,J.useState)(!1),a=bt(e.id),c=xt(e);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(o,{type:`button`,variant:`outline`,"data-slot":`archive-action`,"aria-label":c,title:e.archived?`Put this task back in Active tasks`:`Move this task out of Active tasks`,disabled:a.isPending,className:s(`h-11 gap-[7px] px-3`,n&&`max-md:size-11 max-md:px-0`,t),onClick:()=>e.archived?a.mutate(!1):i(!0),children:[e.archived?(0,Y.jsx)(ht,{"aria-hidden":`true`}):(0,Y.jsx)(Ae,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:s(n&&`max-md:sr-only`),children:c})]}),(0,Y.jsx)(St,{run:e,open:r,onOpenChange:i,onConfirm:()=>{a.mutate(!0),i(!1)}})]})}function Ct({run:e}){let t=T(e.id),n=K(e),r=e.status===`done`?e.completionAction:void 0,i=n.archive?e.archiveBlocker:void 0,s=r&&r.phase!==`complete`;if(!s&&!i)return null;let c=e.pullRequestUrl??e.pullRequests?.find(e=>e.url)?.url;return(0,Y.jsxs)(`section`,{"data-slot":`completion-status`,"aria-label":`Completion action`,className:`grid min-w-0 gap-2 rounded-lg border border-border bg-card p-3 [margin-block:0.75rem]`,children:[s?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:r.phase===`blocked`?`Completion blocked`:`Completion pending`}),` · `,r.message||(r.phase===`blocked`?`Completion needs attention.`:`Checking completion actions.`)]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[c&&a(c)?(0,Y.jsx)(o,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:c,target:`_blank`,rel:`noopener noreferrer`,children:`Open PR`})}):null,e.autoMergePr?(0,Y.jsx)(o,{variant:`outline`,disabled:t.isPending,onClick:()=>t.mutate({autoMergePr:!1},{onError:e=>A(e.message,{tone:`danger`})}),children:t.isPending?`Saving…`:`Disable auto-merge`}):null]})]}):null,i?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsxs)(`p`,{role:`status`,"aria-live":`polite`,"aria-atomic":`true`,className:`text-sm [overflow-wrap:anywhere]`,children:[(0,Y.jsx)(`span`,{className:`font-medium`,children:`Archive blocked`}),` · `,i.message]}),(0,Y.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[i.runId?(0,Y.jsx)(o,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(U,{to:`/tasks/${i.runId}`,children:`Open blocking task`})}):null,i.pullRequestUrl&&a(i.pullRequestUrl)?(0,Y.jsx)(o,{variant:`outline`,asChild:!0,children:(0,Y.jsx)(`a`,{href:i.pullRequestUrl,target:`_blank`,rel:`noopener noreferrer`,children:`Open blocking PR`})}):null,n.archive?(0,Y.jsx)(X,{run:e}):null]})]}):null]})}var wt=[`running`,`queued`,`waiting`];function Tt(e,{queuePosition:t,now:n=new Date}){let r=l(e),i=r.label.charAt(0).toUpperCase()+r.label.slice(1),a=t===void 0?i:`${i} #${t}`,o=wt.includes(e.status)?Dt(e,n):void 0;return o?{attention:r,label:a,nextCheck:o}:{attention:r,label:a}}function Et(e){return e.nextCheck?`${e.label} · Next check ${e.nextCheck.text}`:e.label}function Dt(e,t){let n;for(let t of Array.isArray(e.waits)?e.waits:[]){if(t?.kind!==`timer`||t.phase!==`open`)continue;let e=new Date(t.deadline);Number.isFinite(e.getTime())&&(!n||e<n)&&(n=e)}if(n)return{at:n.toISOString(),text:ze(n,t)}}async function Z(e,t){try{await navigator.clipboard.writeText(e),A(t)}catch{A(`Run manually: ${e}`)}}function Ot(e){let t=b(),n=de(),r=(0,J.useMemo)(()=>k(e,t),[e,t]);return{referenceProjectId:n,repoBase:t,references:r,requests:(0,J.useMemo)(()=>n===void 0?[]:r.filter(e=>O(e,t)).map(e=>({projectId:n,kind:e.kind,number:e.number})),[r,n,t])}}function kt(e){return E({mutationFn:()=>p(e.id),onError:e=>{if(e instanceof f&&e.command){Z(e.command,`No terminal found — command copied to clipboard.`);return}A(e.message,{tone:`danger`})}})}function Q(e,t){let n=y(),r=ae(),i=E({mutationFn:t=>u(e.id,t),onError:e=>A(e.message,{tone:`danger`})}),a=h(r.data),o=e=>!r.isSuccess||a.includes(e??`claude`);return{canResumeHere:t&&o(at(e)),choices:e.worktreePath?(n.data?.targets??[]).filter(e=>{let t=mt(e.id);return t===void 0||o(t)}).map(t=>({target:t,...Ze(e,t.id)?{suffix:` (resume)`,title:`Resume this run's session`}:{}})):[],open:i}}function At({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),s=G(e);return!r&&i.length===0&&!s?null:(0,Y.jsxs)(Y.Fragment,{children:[r||i.length>0?(0,Y.jsxs)(`div`,{className:`task-open-targets flex flex-wrap gap-3`,children:[r?(0,Y.jsxs)(o,{variant:`outline`,"data-target":`terminal-resume`,onClick:n,children:[(0,Y.jsx)($e,{}),`Terminal (resume session)`]}):null,i.map(({target:e,suffix:t,title:n})=>{let r=dt(e);return(0,Y.jsxs)(o,{variant:`outline`,"data-target":e.id,title:n,disabled:a.isPending,onClick:()=>a.mutate(e.id),children:[(0,Y.jsx)(r,{"aria-hidden":`true`}),e.label,t??``]},e.id)}),e.worktreePath?(0,Y.jsxs)(o,{variant:`outline`,onClick:()=>{let t=e.worktreePath;t&&navigator.clipboard.writeText(t).then(()=>A(`Worktree path copied`)).catch(()=>A(`Path: ${t}`))},children:[(0,Y.jsx)(B,{}),`Copy worktree path`]}):null]}):null,s?(0,Y.jsxs)(`div`,{"data-slot":`resume-command`,className:`mt-5 border-t border-border pt-5`,children:[(0,Y.jsx)(`h3`,{className:`text-base font-medium`,children:`Resume in a terminal`}),(0,Y.jsx)(`pre`,{className:`my-4 whitespace-pre-wrap break-all rounded-lg border border-border bg-background p-4 text-xs`,children:s}),(0,Y.jsxs)(o,{variant:`outline`,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(B,{}),`Copy resume command`]})]}):null]})}function jt({run:e,canResume:t,onResume:n}){let{canResumeHere:r,choices:i,open:a}=Q(e,t),s=G(e),c=e.worktreePath;if(!r&&i.length===0&&!s&&!c)return null;let l=`max-md:min-h-11`;return(0,Y.jsxs)(`div`,{"data-slot":`workspace-tools`,className:`flex min-w-0 flex-wrap gap-2`,children:[r||i.length>0?(0,Y.jsx)(ft,{choices:i,onPick:e=>a.mutate(e),disabled:a.isPending,triggerVariant:`outline`,className:l,leading:r?(0,Y.jsxs)(M,{"data-target":`terminal-resume`,onSelect:n,children:[(0,Y.jsx)($e,{"aria-hidden":`true`}),`Terminal (resume session)`]}):void 0}):null,c?(0,Y.jsxs)(o,{variant:`outline`,size:`sm`,className:l,onClick:()=>void Z(c,`Worktree path copied`),children:[(0,Y.jsx)(B,{"aria-hidden":`true`}),`Copy worktree path`]}):null,s?(0,Y.jsxs)(o,{variant:`outline`,size:`sm`,"data-slot":`resume-command`,title:s,className:l,onClick:()=>void Z(s,`Command copied to clipboard.`),children:[(0,Y.jsx)(B,{"aria-hidden":`true`}),`Copy resume command`]}):null]})}function Mt({run:e,canResume:t,onResume:n,onOpen:r,onClose:i}){let{canResumeHere:a,choices:s}=Q(e,t);return!a&&s.length===0?null:r?(0,Y.jsx)(M,{onSelect:r,children:`Open in…`}):(0,Y.jsxs)(`section`,{"aria-label":`Open task worktree in…`,className:`task-action-panel my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Open task worktree in…`}),(0,Y.jsx)(o,{variant:`ghost`,size:`icon`,"aria-label":`Close worktree chooser`,onClick:i,children:(0,Y.jsx)(z,{})})]}),e.worktreePath?(0,Y.jsx)(`p`,{className:`my-4 break-all text-xs text-muted-foreground`,children:e.worktreePath}):null,(0,Y.jsx)(`div`,{className:`mt-4`,children:(0,Y.jsx)(At,{run:e,canResume:t,onResume:n})})]})}function Nt({branch:e}){let[t,n]=(0,J.useState)(null),r=(0,J.useRef)(null);(0,J.useEffect)(()=>()=>{r.current!==null&&clearTimeout(r.current)},[]);let i=t===e,a=async()=>{r.current!==null&&clearTimeout(r.current),n(null);try{if(!navigator.clipboard?.writeText)throw Error(`Clipboard unavailable`);await navigator.clipboard.writeText(e),n(e),r.current=setTimeout(()=>n(null),2e3)}catch{A(`Could not copy branch. Select and copy: ${e}`)}};return(0,Y.jsxs)(`span`,{className:`inline-flex min-w-0 max-w-full items-center gap-1`,children:[(0,Y.jsx)(`span`,{"data-slot":`branch-chip`,className:`min-w-0 rounded-sm border border-border bg-card px-1.5 py-px font-mono text-[11px] font-medium break-all`,children:e}),(0,Y.jsxs)(`button`,{type:`button`,"aria-label":i?`Copied branch name`:`Copy branch name`,onClick:()=>void a(),className:`inline-flex min-h-11 shrink-0 items-center gap-1 rounded-sm px-2 text-xs font-medium text-foreground hover:bg-muted focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-link-foreground md:min-h-8`,children:[(0,Y.jsx)(B,{className:`size-3.5`,"aria-hidden":`true`}),(0,Y.jsx)(`span`,{"aria-live":`polite`,children:i?`Copied`:`Copy`})]})]})}function Pt({run:e}){let t=b(),n=de(),r=r=>n===void 0?void 0:se(n,e.id,r,t),i=(0,J.useMemo)(()=>k(e,t),[e,t]),o=[],s=[],c=i.filter(e=>e.kind===`PR`);for(let t of c)o.push((0,Y.jsx)(H,{reference:t,to:r(t),taskTitle:C(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`,conflictAction:(0,Y.jsx)(nt,{run:e,prNumber:t.number})},_(t)));let l=le(e);l&&a(l)&&!c.some(e=>e.url===l)&&o.push((0,Y.jsx)(H,{reference:{kind:`PR`,url:l},taskTitle:C(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`pr`));let u=i.filter(e=>e.kind===`Issue`);for(let t of u)s.push((0,Y.jsx)(H,{reference:t,to:r(t),taskTitle:C(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},_(t)));let d=ue(e,t);if(d&&a(d)&&!u.some(e=>e.url===d)){let t=x(d);s.push((0,Y.jsx)(H,{reference:{kind:`Issue`,...t?{number:Number(t)}:{},url:d},to:t?r({kind:`Issue`,number:Number(t),url:d}):void 0,taskTitle:C(e),className:`h-5 no-hover:min-h-[44px] no-hover:min-w-[44px]`},`issue`))}return o.length===0&&s.length===0?null:(0,Y.jsx)(`div`,{"data-slot":`linked-references`,className:`flex min-w-0 flex-col gap-3`,children:[[`PR`,`PRs`,o],[`Issue`,`Issues`,s]].map(([e,t,n])=>n.length>0?(0,Y.jsxs)(`div`,{"data-reference-kind":e,className:`grid min-w-0 grid-cols-[5rem_minmax(0,1fr)] items-center gap-x-2 gap-y-1`,children:[(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,children:t}),(0,Y.jsx)(`div`,{className:`flex min-w-0 flex-wrap items-center gap-2`,children:n})]},e):null)})}function $(){let e=Ke(),t=g();return Xe(t.data?.projects?.find(n=>n.id===(e??t.data?.bootProject)))}var Ft=e=>e.map(e=>`${e.name}: ${Ye(e.url)}`).join(`
|
|
2
|
+
`);function It(e){return $().length>0||e.notify===!0}function Lt({run:e}){let t=$(),n=t.length>0,r=v(e.id),[i,a]=(0,J.useState)(null),s=e.notify===!0;return!n&&!s?null:(0,Y.jsxs)(Y.Fragment,{children:[s?(0,Y.jsxs)(L,{children:[(0,Y.jsx)(F,{asChild:!0,children:(0,Y.jsxs)(o,{variant:`outline`,size:`sm`,"data-slot":`notifying-chip`,className:`h-11 gap-1.5 md:h-[30px]`,"aria-label":n?`Notifying ${rt(t)} — webhook actions`:`Notifying — webhook actions`,title:n?Ft(t):void 0,children:[(0,Y.jsx)(ct,{tone:`success`}),(0,Y.jsx)(`span`,{children:`Notifying`}),(0,Y.jsx)(je,{"aria-hidden":`true`,className:`size-3.5`})]})}),(0,Y.jsxs)(I,{align:`end`,"data-slot":`notifying-menu`,className:`w-[240px] max-w-[calc(100vw-2rem)] p-2`,children:[n?(0,Y.jsx)(j,{"data-slot":`notifying-targets`,className:`flex flex-col gap-0.5 px-2 py-1.5 text-[11px] font-normal text-muted-foreground`,children:t.map(e=>(0,Y.jsx)(`span`,{"data-webhook-target":e.id,className:`truncate`,title:Ye(e.url),children:e.name},e.id))}):null,n?(0,Y.jsxs)(M,{className:`min-h-11`,onSelect:()=>a(`note`),children:[(0,Y.jsx)(He,{"aria-hidden":`true`}),` Send a note…`]}):null,(0,Y.jsxs)(M,{variant:`destructive`,className:`min-h-11`,disabled:r.isPending,onSelect:()=>r.mutate({notify:!1},{onSuccess:()=>A(`Stopped notifying the webhook`),onError:e=>A(`Could not stop notifying. ${e.message}`,{tone:`danger`})}),children:[(0,Y.jsx)(_t,{"aria-hidden":`true`}),` Stop notifying`]})]})]}):(0,Y.jsxs)(o,{variant:`outline`,size:`sm`,"data-action":`handoff`,className:`size-11 px-0 md:h-[30px] md:w-auto md:px-2.5`,"aria-label":`Hand off to webhook`,onClick:()=>a(`handoff`),children:[(0,Y.jsx)(ot,{"aria-hidden":`true`}),(0,Y.jsx)(`span`,{className:`max-md:sr-only`,children:`Hand off`})]}),n?(0,Y.jsx)(Rt,{mode:i,targets:t,pending:r.isPending,onOpenChange:e=>!e&&a(null),onSubmit:e=>r.mutate({notify:!0,...e?{message:e}:{}},{onSuccess:()=>{a(null),A(i===`note`?`Note sent to the webhook`:`Handed off to the webhook`)},onError:e=>A(`Could not hand off. ${e.message}`,{tone:`danger`})})}):null]})}function Rt({mode:e,targets:t,pending:n,onOpenChange:r,onSubmit:i}){let a=(0,J.useId)(),s=(0,J.useId)(),[c,l]=(0,J.useState)(``);(0,J.useEffect)(()=>{e!==null&&l(``)},[e]);let u=e===`note`,d=rt(t);return(0,Y.jsx)(Fe,{open:e!==null,onOpenChange:e=>{e||l(``),r(e)},children:(0,Y.jsx)(Pe,{"data-slot":`handoff-dialog`,className:`max-sm:top-auto max-sm:bottom-0 max-sm:left-0 max-sm:max-w-none max-sm:translate-x-0 max-sm:translate-y-0 max-sm:rounded-b-none max-sm:rounded-t-xl max-sm:border-x-0 max-sm:border-b-0 max-sm:pb-[max(1.5rem,env(safe-area-inset-bottom))] max-sm:data-[state=open]:slide-in-from-bottom max-sm:data-[state=open]:zoom-in-100 max-sm:data-[state=closed]:slide-out-to-bottom max-sm:data-[state=closed]:zoom-out-100`,children:(0,Y.jsxs)(`form`,{className:`grid gap-4`,onSubmit:e=>{e.preventDefault(),i(c.trim())},children:[(0,Y.jsxs)(Le,{className:`text-left`,children:[(0,Y.jsx)(Ne,{children:u?`Send a note to ${t.length===1?`the webhook`:`the webhooks`}`:`Hand off to webhook`}),(0,Y.jsx)(Me,{children:(0,Y.jsx)(`span`,{"data-webhook-destination":``,title:Ft(t),children:u?`${d} ${t.length===1?`gets`:`get`} this note with the task's current status.`:`${d} will start receiving this task's status updates. Add a note (optional).`})})]}),(0,Y.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,Y.jsx)(`label`,{htmlFor:a,className:`text-[13px] font-medium`,children:`Note`}),(0,Y.jsx)(Re,{id:a,"data-slot":`handoff-note`,"aria-describedby":s,rows:4,maxLength:1e5,className:`min-h-24`,placeholder:`e.g. Take over from here, ping me when the PR is green`,value:c,onChange:e=>l(e.target.value)}),(0,Y.jsxs)(`p`,{id:s,className:`flex items-center gap-1.5 text-[12px] text-muted-foreground`,children:[(0,Y.jsx)(Ve,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),`The note goes to the webhook only, not to the agent.`]})]}),(0,Y.jsxs)(Ie,{className:`gap-2 max-sm:flex-col-reverse max-sm:[&>button]:h-11 max-sm:[&>button]:w-full`,children:[(0,Y.jsx)(o,{type:`button`,variant:`ghost`,className:`sm:h-9`,onClick:()=>r(!1),children:`Cancel`}),(0,Y.jsxs)(o,{type:`submit`,variant:`contrast`,className:`sm:h-9`,"data-action":`handoff-submit`,disabled:n||u&&c.trim()===``,children:[(0,Y.jsx)(ot,{"aria-hidden":`true`}),u?`Send note`:`Hand off`]})]})]})})})}function zt({runId:e,children:t}){let n=i(),r=(0,J.useMemo)(()=>({runId:e}),[e]);return n?(0,Y.jsx)(Bt,{runId:e,children:t}):(0,Y.jsx)(W.Provider,{value:r,children:t})}function Bt({runId:e,children:t}){let{projectId:n}=r(),i=(0,J.useMemo)(()=>({runId:e,...n?{projectId:n}:{}}),[e,n]);return(0,Y.jsx)(W.Provider,{value:i,children:t})}function Vt({id:e}){return(0,Y.jsxs)(U,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,"data-slot":`mobile-parent-task-link`,className:`inline-flex shrink-0 items-center justify-center gap-1 rounded-sm px-2 text-[13px] text-muted-foreground [min-block-size:2.75rem] [min-inline-size:2.75rem] focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:bg-muted active:text-foreground`,children:[(0,Y.jsx)(R,{"aria-hidden":!0,className:`shrink-0 [block-size:1.2cap] [inline-size:auto]`}),`Parent`]})}function Ht({id:e}){let t=oe(e),n=t.data?C(t.data):e;return(0,Y.jsxs)(`div`,{"data-slot":`parent-task`,className:`flex min-w-0 flex-wrap items-center gap-x-2 text-[13px] text-muted-foreground`,children:[(0,Y.jsxs)(U,{to:`/tasks/${e}`,"aria-label":`Parent task ${e}`,title:`Parent · ${n}`,"data-slot":`parent-task-link`,className:`flex min-h-11 min-w-0 max-w-full items-center gap-2 rounded-sm text-muted-foreground focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring active:text-foreground`,children:[(0,Y.jsx)(R,{"aria-hidden":!0,className:`h-[1.2cap] w-auto shrink-0`}),(0,Y.jsx)(`span`,{className:`shrink-0`,children:`Parent`}),(0,Y.jsx)(`span`,{"aria-hidden":!0,children:`·`}),(0,Y.jsx)(`span`,{className:`min-w-0 overflow-clip text-ellipsis whitespace-nowrap`,children:n})]}),t.isError?(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(`span`,{children:`Parent record unavailable or deleted`}),(0,Y.jsx)(o,{variant:`outline`,className:`min-h-11`,onClick:()=>void t.refetch(),children:`Retry parent task`})]}):null]})}var Ut=3,Wt=(e,t)=>e.kind===t.kind&&e.number===t.number;function Gt(e,t,n=Ut){let r=t?e.findIndex(e=>Wt(e,t)):-1;if(e.length<=n||r<n)return{inline:e.slice(0,n),overflow:e.slice(n)};let i=[...e.slice(0,n-1),e[r]];return{inline:i,overflow:e.filter(e=>!i.includes(e))}}var Kt=(e,t)=>`/tasks/${e}/${t.kind}/${t.number}`;function qt({tab:e}){return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(e.kind===`pr`?Te:Oe,{"aria-hidden":`true`,className:`mr-1 size-3.5 shrink-0`}),(0,Y.jsx)(`span`,{className:`sr-only`,children:e.kind===`pr`?`Pull request`:`Issue`}),` #`,e.number,(0,Y.jsx)(We,{kind:e.kind===`pr`?`PR`:`Issue`,number:e.number,className:`ml-1`})]})}function Jt(e,t){let n=e[0],r=e.length+ +!!t;return n?`Preview :${n.port}${r>1?` +${r-1}`:``}`:t?`Preview · agent`:`Preview`}function Yt({servers:e}){let t=lt();if(t===null)return null;let n=t.agentLive===!0,r=e[0],i=e.length+ +!!n===1?r?{port:r.port}:{agent:!0}:{};return(0,Y.jsxs)(o,{variant:`outline`,size:`sm`,"data-slot":`preview-toggle`,className:`max-md:h-11`,"aria-pressed":t.open,onClick:()=>t.openPane(i),children:[(0,Y.jsx)(Be,{"aria-hidden":`true`}),Jt(e,n),t.live?(0,Y.jsx)(ct,{tone:`success`,"aria-label":`Preview is live`}):null]})}function Xt({run:e,tab:t=`session`,onMarkedUnread:n}){let r=l(e),i=K(e),[a,o]=(0,J.useState)(!1),[c,u]=(0,J.useState)(!1),d=Zt(e,n),f=te(),p=ne(),m=Tt(e,{queuePosition:e.status===`queued`?ie(f.data??[]).get(e.id):void 0}),h=gt(),g=st(),_=h!==null&&!g?h:null,v=_!==null,{referenceProjectId:ee,repoBase:y,requests:b}=Ot(e),x=(0,J.useMemo)(()=>re(e,y),[e,y]),S=typeof t==`object`?t:null,{inline:C,overflow:w}=Gt(x,S),T=(0,J.useRef)(null),E=S?`${S.kind}#${S.number}`:null;(0,J.useEffect)(()=>{!E||g||T.current?.querySelector(`[aria-current="page"]`)?.scrollIntoView?.({block:`nearest`,inline:`nearest`})},[E,C.map(e=>`${e.kind}#${e.number}`).join(`,`),g]);let D=e.worktreePath&&p.data?.capabilities?.preview===!0?(0,Y.jsx)(Yt,{servers:e.previewServers??[]}):null,O=(0,Y.jsx)(tn,{run:e,actions:d,onOpenChooser:()=>u(!0),onToggleNotes:()=>o(e=>!e)}),k=!e.archiveBlocker&&i.archive&&(t!==`session`||!it(e))?(0,Y.jsx)(X,{run:e}):null,ae=It(e);return(0,Y.jsx)(Ue,{projectId:ee,repoBase:y,requests:b,children:(0,Y.jsxs)(`header`,{"data-slot":`run-header`,className:s(`relative z-20 bg-background px-[18px] md:px-9 md:pt-7`,v?`pt-0`:`pt-[18px]`,t===`session`&&`md:sticky md:top-0`),children:[e.archived&&e.autoArchive?.reason===`pull-requests-merged`&&e.autoArchive.archivedAt===e.archivedAt?(0,Y.jsx)(`p`,{"data-slot":`auto-archive-reason`,className:`text-[13px] text-muted-foreground`,children:`Archived automatically after all associated PRs merged.`}):null,(0,Y.jsx)(Ct,{run:e}),(0,Y.jsxs)(`div`,{className:`w-full`,children:[e.delegation?.role===`worker`?(0,Y.jsx)(Ht,{id:e.delegation.parentRunId}):null,_?(0,Y.jsxs)(ut,{slot:_,children:[(0,Y.jsx)(en,{run:e}),e.delegation?.role===`worker`?(0,Y.jsx)(Vt,{id:e.delegation.parentRunId}):null,O]}):(0,Y.jsxs)(`div`,{"data-slot":`run-title-row`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 md:flex-nowrap`,children:[(0,Y.jsx)(`p`,{"data-slot":`session-kind`,className:`text-[12px] font-semibold tracking-[0.14em] text-muted-foreground uppercase md:hidden`,children:e.delegation?.role===`worker`?`Worker session`:e.delegation?.role===`root`?`Parent session`:`Task session`}),(0,Y.jsx)($t,{run:e}),(0,Y.jsx)(Qe,{dot:r.tone,shape:r.shape,pulse:r.pulse,className:`max-md:hidden`,children:Et(m)}),(0,Y.jsxs)(`span`,{className:`ml-auto flex shrink-0 items-center gap-1 md:gap-2.5`,children:[k,D,(0,Y.jsx)(Lt,{run:e}),O]})]}),_&&(k||D||ae)?(0,Y.jsxs)(`div`,{"data-slot":`run-mobile-actions`,className:`flex flex-wrap items-center gap-2 pt-2`,children:[k,D,(0,Y.jsx)(Lt,{run:e})]}):null,(0,Y.jsxs)(`div`,{ref:T,"data-slot":`run-tabs`,"data-phone-bar":v||void 0,className:`mt-3 flex flex-wrap items-end gap-1 border-b border-border md:mt-5 max-md:flex-nowrap max-md:overflow-x-auto max-md:border-b-0 max-md:shadow-[inset_0_-1px_0_var(--border)] max-md:gap-0 max-md:[&>*]:mb-0 max-md:[&>*]:shrink-0 max-md:[&>a]:min-h-11 max-md:[&>a]:px-3.5 max-md:[&>a]:text-[13.5px]`,children:[(0,Y.jsx)(q,{to:`/tasks/${e.id}`,active:t===`session`,replace:v,children:`Session`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/changes`,active:t===`changes`,replace:v,count:e.diffStat&&e.diffStat.files>0?e.diffStat.files:void 0,children:`Changes`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/commits`,active:t===`commits`,replace:v,children:`Commits`}),(0,Y.jsx)(q,{to:`/tasks/${e.id}/files`,active:t===`files`,replace:v,children:`Files`}),C.map(t=>(0,Y.jsx)(q,{to:Kt(e.id,t),active:S!==null&&Wt(t,S),replace:v,children:(0,Y.jsx)(qt,{tab:t})},`${t.kind}-${t.number}`)),w.length>0?(0,Y.jsxs)(L,{children:[(0,Y.jsxs)(F,{"data-slot":`run-tabs-more`,"aria-label":`${w.length} more linked items`,className:`-mb-px flex h-8 items-center rounded-t-md border-b-2 border-transparent px-3 text-[13px] font-medium text-muted-foreground hover:bg-muted hover:text-foreground focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-link-foreground max-md:min-h-11 max-md:px-3.5 max-md:text-[13.5px]`,children:[`+`,w.length]}),(0,Y.jsx)(I,{align:`end`,children:w.map(t=>(0,Y.jsx)(M,{asChild:!0,children:(0,Y.jsx)(U,{to:Kt(e.id,t),replace:v,children:(0,Y.jsx)(qt,{tab:t})})},`${t.kind}-${t.number}`))})]}):null]}),a?(0,Y.jsx)(rn,{runId:e.id,onClose:()=>o(!1)}):null,c?(0,Y.jsx)(Mt,{run:e,canResume:K(e).terminal,onResume:()=>d.terminal.mutate(),onClose:()=>u(!1)}):null]}),(0,Y.jsx)(nn,{run:e,actions:d})]})})}function Zt(e,t){let n=d(),r=Ge(),[i,a]=(0,J.useState)(null),o=()=>n.invalidateQueries({queryKey:ce.runs.all}),s=e=>A(e.message,{tone:`danger`}),l=D(),u={isPending:l.isPending,mutate:()=>l.mutate({id:e.id,pinned:!e.pinned})},f=fe();return{pin:u,markUnread:{isPending:f.isPending,mutate:()=>{t?.(),f.mutate(e.id,{onError:s})}},delete:E({mutationFn:()=>c(e.id),onSuccess:()=>{o(),r(`/`)},onError:s}),terminal:kt(e),confirming:i,setConfirming:a}}function Qt(e){let t=T(e.id),n=C(e);return{title:n,editor:pt(n,e=>t.mutate({title:e},{onError:e=>A(e.message,{tone:`danger`})}))}}function $t({run:e}){let{title:t,editor:n}=Qt(e);return n.editing?(0,Y.jsx)(et,{editor:n,className:`flex-1 text-[16px] font-semibold`}):(0,Y.jsxs)(`span`,{className:`group flex min-w-0 items-center gap-1`,children:[(0,Y.jsx)(`h1`,{className:`line-clamp-2 min-w-0 break-words text-2xl font-semibold tracking-tight`,title:e.task,children:t}),(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,onClick:n.begin,className:`shrink-0 rounded-sm p-1 text-soft-foreground opacity-0 transition-opacity group-hover:opacity-100 hover:bg-muted hover:text-foreground focus-visible:opacity-100 focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(Je,{className:`size-3.5`,"aria-hidden":`true`})})]})}function en({run:e}){let{title:t,editor:n}=Qt(e);return(0,Y.jsxs)(we,{open:n.editing,onOpenChange:e=>{e?n.begin():n.commit()},children:[(0,Y.jsx)(`div`,{"data-slot":`mobile-run-title`,className:`flex min-w-0 flex-1 flex-col gap-px`,children:(0,Y.jsx)(`h1`,{className:`truncate text-[15px] leading-tight font-semibold text-foreground`,title:e.task,children:t})}),(0,Y.jsx)(Se,{asChild:!0,children:(0,Y.jsx)(`button`,{type:`button`,"aria-label":`Rename task`,className:`flex size-11 shrink-0 items-center justify-center rounded-sm text-soft-foreground hover:bg-muted hover:text-foreground focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-none`,children:(0,Y.jsx)(Je,{className:`size-3.5`,"aria-hidden":`true`})})}),(0,Y.jsx)(Ce,{align:`end`,className:`w-64 max-w-[calc(100vw-16px)] p-2`,onEscapeKeyDown:e=>{e.preventDefault(),n.cancel()},children:(0,Y.jsx)(et,{editor:n,className:`text-[16px] font-semibold`})})]})}function tn({run:e,actions:t,onToggleNotes:n,onOpenChooser:r}){let i=K(e),a=G(e),s=T(e.id),c=(0,J.useId)();return(0,Y.jsxs)(L,{children:[(0,Y.jsx)(F,{asChild:!0,children:(0,Y.jsx)(o,{variant:`ghost`,size:`icon-sm`,className:`size-11`,"aria-label":`Run actions`,children:(0,Y.jsx)(Ee,{"aria-hidden":`true`})})}),(0,Y.jsxs)(I,{align:`end`,"data-slot":`run-actions-menu`,className:`w-[270px] max-w-[calc(100vw-2rem)] p-3`,children:[(0,Y.jsx)(j,{className:`px-2 py-3 text-[12px] font-normal text-muted-foreground`,children:`TASK ACTIONS`}),(0,Y.jsxs)(M,{onSelect:n,children:[(0,Y.jsx)(tt,{"aria-hidden":`true`}),` Notes / handoff`]}),(0,Y.jsx)(Mt,{run:e,canResume:i.terminal,onResume:()=>t.terminal.mutate(),onOpen:r}),a?(0,Y.jsxs)(M,{onSelect:()=>void Z(a,`Command copied to clipboard.`),children:[(0,Y.jsx)(B,{"aria-hidden":`true`}),` Copy resume command`]}):null,i.markUnread?(0,Y.jsxs)(M,{disabled:t.markUnread.isPending,onSelect:()=>t.markUnread.mutate(),children:[(0,Y.jsx)(vt,{"aria-hidden":`true`}),` Mark unread`]}):null,i.pin?(0,Y.jsxs)(P,{"data-slot":`pin-run`,className:`min-h-11`,checked:!!e.pinned,disabled:t.pin.isPending,onCheckedChange:()=>t.pin.mutate(),children:[e.pinned?(0,Y.jsx)(yt,{"aria-hidden":`true`}):(0,Y.jsx)(De,{"aria-hidden":`true`}),e.pinned?`Unpin task`:`Pin task`]}):null,(0,Y.jsx)(N,{}),(0,Y.jsx)(j,{className:`text-xs text-muted-foreground`,children:`AFTER DONE`}),(0,Y.jsx)(P,{"data-slot":`archive-when-done`,className:`min-h-11`,checked:e.archiveWhenDone===!0,disabled:s.isPending,onCheckedChange:e=>s.mutate({archiveWhenDone:e},{onError:e=>A(e.message,{tone:`danger`})}),children:`Archive when Done`}),(0,Y.jsx)(P,{"data-slot":`auto-merge-pr`,className:`min-h-11`,checked:e.autoMergePr===!0,disabled:s.isPending,"aria-describedby":c,onCheckedChange:e=>s.mutate({autoMergePr:e},{onError:e=>A(e.message,{tone:`danger`})}),children:`Auto-merge PR`}),(0,Y.jsx)(`p`,{id:c,className:`text-xs text-muted-foreground [padding-inline:0.5rem] [padding-block:0.5rem]`,children:`After Done, auto-merge can mark a draft PR ready. It waits for current-head CI and GitHub rules. Merge comes before archive.`}),i.deleteRun?(0,Y.jsx)(N,{}):null,i.deleteRun?(0,Y.jsxs)(M,{variant:`destructive`,onSelect:()=>t.setConfirming(`delete`),children:[(0,Y.jsx)(ke,{"aria-hidden":`true`}),` Delete task…`]}):null]})]})}function nn({run:e,actions:t}){let n=t.confirming;return(0,Y.jsx)(xe,{open:n!==null,onOpenChange:e=>!e&&t.setConfirming(null),children:(0,Y.jsxs)(ge,{"data-slot":`task-confirmation`,className:`sm:max-w-[660px]`,children:[(0,Y.jsxs)(be,{children:[(0,Y.jsx)(he,{className:`text-danger`,children:`Delete task permanently?`}),(0,Y.jsx)(me,{children:(0,Y.jsxs)(Y.Fragment,{children:[`Delete “`,(0,Y.jsx)(`span`,{className:`font-medium text-foreground`,title:C(e),children:C(e)}),`” and its transcript, worktree and branch. This cannot be undone.`]})})]}),(0,Y.jsxs)(ve,{children:[(0,Y.jsx)(ye,{children:`Cancel`}),(0,Y.jsx)(_e,{className:`bg-danger text-danger-foreground hover:brightness-[0.96]`,onClick:()=>{t.delete.mutate(),t.setConfirming(null)},children:`Delete task`})]})]})})}function rn({runId:e,onClose:t}){let n=w(e);return(0,Y.jsxs)(`div`,{"data-slot":`notes-panel`,className:`my-5 rounded-xl border border-border bg-card p-6`,children:[(0,Y.jsxs)(`div`,{className:`mb-4 flex items-center justify-between gap-3`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-medium`,children:`Notes / handoff`}),(0,Y.jsx)(o,{variant:`ghost`,size:`icon`,"aria-label":`Close notes`,onClick:t,children:(0,Y.jsx)(z,{})})]}),n.isPending?(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`Loading notes…`}):n.isError?(0,Y.jsx)(`p`,{className:`text-xs text-danger`,children:n.error.message}):n.data.trim().length>0?(0,Y.jsx)(zt,{runId:e,children:(0,Y.jsx)(qe,{children:n.data})}):(0,Y.jsx)(`p`,{className:`text-xs text-soft-foreground`,children:`No notes yet — the handoff file is seeded when the task starts.`}),(0,Y.jsxs)(`div`,{className:`mt-4 flex gap-3`,children:[(0,Y.jsx)(o,{variant:`outline`,disabled:!n.data?.trim(),onClick:()=>void Z(n.data??``,`Notes copied`),children:`Copy notes`}),(0,Y.jsx)(o,{variant:`outline`,onClick:t,children:`Close`})]})]})}export{jt as a,Tt as c,Pt as i,X as l,zt as n,kt as o,Nt as r,Ot as s,Xt as t};
|